@tokenbuddy/tokenbuddy 1.0.34 → 1.0.35
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/src/buyer-store.d.ts +16 -0
- package/dist/src/buyer-store.d.ts.map +1 -1
- package/dist/src/buyer-store.js +29 -1
- package/dist/src/buyer-store.js.map +1 -1
- package/dist/src/daemon.d.ts +13 -0
- package/dist/src/daemon.d.ts.map +1 -1
- package/dist/src/daemon.js +121 -9
- package/dist/src/daemon.js.map +1 -1
- package/dist/src/provider-routing-config.d.ts +1 -1
- package/dist/src/provider-routing-config.d.ts.map +1 -1
- package/dist/src/provider-routing-config.js +1 -1
- package/dist/src/provider-routing-config.js.map +1 -1
- package/dist/src/seller-catalog.d.ts +1 -1
- package/dist/src/seller-catalog.d.ts.map +1 -1
- package/dist/src/seller-routing-strategy.d.ts +15 -0
- package/dist/src/seller-routing-strategy.d.ts.map +1 -1
- package/dist/src/seller-routing-strategy.js +41 -0
- package/dist/src/seller-routing-strategy.js.map +1 -1
- package/package.json +1 -1
- package/src/buyer-store.ts +61 -1
- package/src/daemon.ts +136 -9
- package/src/provider-routing-config.ts +2 -2
- package/src/seller-catalog.ts +1 -1
- package/src/seller-routing-strategy.ts +41 -0
- package/static/ui/assets/index-BVbeDEwq.js +271 -0
- package/static/ui/assets/index-BVbeDEwq.js.map +1 -0
- package/static/ui/index.html +1 -1
- package/tests/daemon-classify.test.ts +8 -0
- package/tests/image-generation-e2e.test.ts +230 -0
- package/static/ui/assets/index-Mt3BZFuP.js +0 -266
- package/static/ui/assets/index-Mt3BZFuP.js.map +0 -1
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
var z0=Object.defineProperty;var Ov=n=>{throw TypeError(n)};var _0=(n,l,i)=>l in n?z0(n,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[l]=i;var yd=(n,l,i)=>_0(n,typeof l!="symbol"?l+"":l,i),Sd=(n,l,i)=>l.has(n)||Ov("Cannot "+i);var M=(n,l,i)=>(Sd(n,l,"read from private field"),i?i.call(n):l.get(n)),me=(n,l,i)=>l.has(n)?Ov("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,i),ae=(n,l,i,s)=>(Sd(n,l,"write to private field"),s?s.call(n,i):l.set(n,i),i),Ne=(n,l,i)=>(Sd(n,l,"access private method"),i);var Do=(n,l,i,s)=>({set _(u){ae(n,l,u,i)},get _(){return M(n,l,s)}});(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))s(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&s(h)}).observe(document,{childList:!0,subtree:!0});function i(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function s(u){if(u.ep)return;u.ep=!0;const f=i(u);fetch(u.href,f)}})();var jd={exports:{}},Ji={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Dv;function O0(){if(Dv)return Ji;Dv=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(s,u,f){var h=null;if(f!==void 0&&(h=""+f),u.key!==void 0&&(h=""+u.key),"key"in u){f={};for(var v in u)v!=="key"&&(f[v]=u[v])}else f=u;return u=f.ref,{$$typeof:n,type:s,key:h,ref:u!==void 0?u:null,props:f}}return Ji.Fragment=l,Ji.jsx=i,Ji.jsxs=i,Ji}var Uv;function D0(){return Uv||(Uv=1,jd.exports=O0()),jd.exports}var o=D0(),Nd={exports:{}},ye={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Lv;function U0(){if(Lv)return ye;Lv=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function N(C){return C===null||typeof C!="object"?null:(C=j&&C[j]||C["@@iterator"],typeof C=="function"?C:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,L={};function z(C,P,I){this.props=C,this.context=P,this.refs=L,this.updater=I||T}z.prototype.isReactComponent={},z.prototype.setState=function(C,P){if(typeof C!="object"&&typeof C!="function"&&C!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,C,P,"setState")},z.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function Q(){}Q.prototype=z.prototype;function q(C,P,I){this.props=C,this.context=P,this.refs=L,this.updater=I||T}var O=q.prototype=new Q;O.constructor=q,E(O,z.prototype),O.isPureReactComponent=!0;var K=Array.isArray;function J(){}var H={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function Z(C,P,I){var te=I.ref;return{$$typeof:n,type:C,key:P,ref:te!==void 0?te:null,props:I}}function le(C,P){return Z(C.type,P,C.props)}function $(C){return typeof C=="object"&&C!==null&&C.$$typeof===n}function ue(C){var P={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(I){return P[I]})}var ee=/\/+/g;function xe(C,P){return typeof C=="object"&&C!==null&&C.key!=null?ue(""+C.key):P.toString(36)}function de(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(J,J):(C.status="pending",C.then(function(P){C.status==="pending"&&(C.status="fulfilled",C.value=P)},function(P){C.status==="pending"&&(C.status="rejected",C.reason=P)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function R(C,P,I,te,fe){var be=typeof C;(be==="undefined"||be==="boolean")&&(C=null);var ge=!1;if(C===null)ge=!0;else switch(be){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(C.$$typeof){case n:case l:ge=!0;break;case y:return ge=C._init,R(ge(C._payload),P,I,te,fe)}}if(ge)return fe=fe(C),ge=te===""?"."+xe(C,0):te,K(fe)?(I="",ge!=null&&(I=ge.replace(ee,"$&/")+"/"),R(fe,P,I,"",function(_t){return _t})):fe!=null&&($(fe)&&(fe=le(fe,I+(fe.key==null||C&&C.key===fe.key?"":(""+fe.key).replace(ee,"$&/")+"/")+ge)),P.push(fe)),1;ge=0;var _e=te===""?".":te+":";if(K(C))for(var Ee=0;Ee<C.length;Ee++)te=C[Ee],be=_e+xe(te,Ee),ge+=R(te,P,I,be,fe);else if(Ee=N(C),typeof Ee=="function")for(C=Ee.call(C),Ee=0;!(te=C.next()).done;)te=te.value,be=_e+xe(te,Ee++),ge+=R(te,P,I,be,fe);else if(be==="object"){if(typeof C.then=="function")return R(de(C),P,I,te,fe);throw P=String(C),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return ge}function X(C,P,I){if(C==null)return C;var te=[],fe=0;return R(C,te,"","",function(be){return P.call(I,be,fe++)}),te}function ie(C){if(C._status===-1){var P=C._result;P=P(),P.then(function(I){(C._status===0||C._status===-1)&&(C._status=1,C._result=I)},function(I){(C._status===0||C._status===-1)&&(C._status=2,C._result=I)}),C._status===-1&&(C._status=0,C._result=P)}if(C._status===1)return C._result.default;throw C._result}var ne=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},pe={map:X,forEach:function(C,P,I){X(C,function(){P.apply(this,arguments)},I)},count:function(C){var P=0;return X(C,function(){P++}),P},toArray:function(C){return X(C,function(P){return P})||[]},only:function(C){if(!$(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return ye.Activity=g,ye.Children=pe,ye.Component=z,ye.Fragment=i,ye.Profiler=u,ye.PureComponent=q,ye.StrictMode=s,ye.Suspense=p,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,ye.__COMPILER_RUNTIME={__proto__:null,c:function(C){return H.H.useMemoCache(C)}},ye.cache=function(C){return function(){return C.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(C,P,I){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var te=E({},C.props),fe=C.key;if(P!=null)for(be in P.key!==void 0&&(fe=""+P.key),P)!F.call(P,be)||be==="key"||be==="__self"||be==="__source"||be==="ref"&&P.ref===void 0||(te[be]=P[be]);var be=arguments.length-2;if(be===1)te.children=I;else if(1<be){for(var ge=Array(be),_e=0;_e<be;_e++)ge[_e]=arguments[_e+2];te.children=ge}return Z(C.type,fe,te)},ye.createContext=function(C){return C={$$typeof:h,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:f,_context:C},C},ye.createElement=function(C,P,I){var te,fe={},be=null;if(P!=null)for(te in P.key!==void 0&&(be=""+P.key),P)F.call(P,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(fe[te]=P[te]);var ge=arguments.length-2;if(ge===1)fe.children=I;else if(1<ge){for(var _e=Array(ge),Ee=0;Ee<ge;Ee++)_e[Ee]=arguments[Ee+2];fe.children=_e}if(C&&C.defaultProps)for(te in ge=C.defaultProps,ge)fe[te]===void 0&&(fe[te]=ge[te]);return Z(C,be,fe)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(C){return{$$typeof:v,render:C}},ye.isValidElement=$,ye.lazy=function(C){return{$$typeof:y,_payload:{_status:-1,_result:C},_init:ie}},ye.memo=function(C,P){return{$$typeof:x,type:C,compare:P===void 0?null:P}},ye.startTransition=function(C){var P=H.T,I={};H.T=I;try{var te=C(),fe=H.S;fe!==null&&fe(I,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(J,ne)}catch(be){ne(be)}finally{P!==null&&I.types!==null&&(P.types=I.types),H.T=P}},ye.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},ye.use=function(C){return H.H.use(C)},ye.useActionState=function(C,P,I){return H.H.useActionState(C,P,I)},ye.useCallback=function(C,P){return H.H.useCallback(C,P)},ye.useContext=function(C){return H.H.useContext(C)},ye.useDebugValue=function(){},ye.useDeferredValue=function(C,P){return H.H.useDeferredValue(C,P)},ye.useEffect=function(C,P){return H.H.useEffect(C,P)},ye.useEffectEvent=function(C){return H.H.useEffectEvent(C)},ye.useId=function(){return H.H.useId()},ye.useImperativeHandle=function(C,P,I){return H.H.useImperativeHandle(C,P,I)},ye.useInsertionEffect=function(C,P){return H.H.useInsertionEffect(C,P)},ye.useLayoutEffect=function(C,P){return H.H.useLayoutEffect(C,P)},ye.useMemo=function(C,P){return H.H.useMemo(C,P)},ye.useOptimistic=function(C,P){return H.H.useOptimistic(C,P)},ye.useReducer=function(C,P,I){return H.H.useReducer(C,P,I)},ye.useRef=function(C){return H.H.useRef(C)},ye.useState=function(C){return H.H.useState(C)},ye.useSyncExternalStore=function(C,P,I){return H.H.useSyncExternalStore(C,P,I)},ye.useTransition=function(){return H.H.useTransition()},ye.version="19.2.7",ye}var Bv;function xf(){return Bv||(Bv=1,Nd.exports=U0()),Nd.exports}var S=xf(),wd={exports:{}},Ii={},Md={exports:{}},Cd={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var qv;function L0(){return qv||(qv=1,(function(n){function l(R,X){var ie=R.length;R.push(X);e:for(;0<ie;){var ne=ie-1>>>1,pe=R[ne];if(0<u(pe,X))R[ne]=X,R[ie]=pe,ie=ne;else break e}}function i(R){return R.length===0?null:R[0]}function s(R){if(R.length===0)return null;var X=R[0],ie=R.pop();if(ie!==X){R[0]=ie;e:for(var ne=0,pe=R.length,C=pe>>>1;ne<C;){var P=2*(ne+1)-1,I=R[P],te=P+1,fe=R[te];if(0>u(I,ie))te<pe&&0>u(fe,I)?(R[ne]=fe,R[te]=ie,ne=te):(R[ne]=I,R[P]=ie,ne=P);else if(te<pe&&0>u(fe,ie))R[ne]=fe,R[te]=ie,ne=te;else break e}}return X}function u(R,X){var ie=R.sortIndex-X.sortIndex;return ie!==0?ie:R.id-X.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,v=h.now();n.unstable_now=function(){return h.now()-v}}var p=[],x=[],y=1,g=null,j=3,N=!1,T=!1,E=!1,L=!1,z=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function O(R){for(var X=i(x);X!==null;){if(X.callback===null)s(x);else if(X.startTime<=R)s(x),X.sortIndex=X.expirationTime,l(p,X);else break;X=i(x)}}function K(R){if(E=!1,O(R),!T)if(i(p)!==null)T=!0,J||(J=!0,ue());else{var X=i(x);X!==null&&de(K,X.startTime-R)}}var J=!1,H=-1,F=5,Z=-1;function le(){return L?!0:!(n.unstable_now()-Z<F)}function $(){if(L=!1,J){var R=n.unstable_now();Z=R;var X=!0;try{e:{T=!1,E&&(E=!1,Q(H),H=-1),N=!0;var ie=j;try{t:{for(O(R),g=i(p);g!==null&&!(g.expirationTime>R&&le());){var ne=g.callback;if(typeof ne=="function"){g.callback=null,j=g.priorityLevel;var pe=ne(g.expirationTime<=R);if(R=n.unstable_now(),typeof pe=="function"){g.callback=pe,O(R),X=!0;break t}g===i(p)&&s(p),O(R)}else s(p);g=i(p)}if(g!==null)X=!0;else{var C=i(x);C!==null&&de(K,C.startTime-R),X=!1}}break e}finally{g=null,j=ie,N=!1}X=void 0}}finally{X?ue():J=!1}}}var ue;if(typeof q=="function")ue=function(){q($)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,xe=ee.port2;ee.port1.onmessage=$,ue=function(){xe.postMessage(null)}}else ue=function(){z($,0)};function de(R,X){H=z(function(){R(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(R){R.callback=null},n.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<R?Math.floor(1e3/R):5},n.unstable_getCurrentPriorityLevel=function(){return j},n.unstable_next=function(R){switch(j){case 1:case 2:case 3:var X=3;break;default:X=j}var ie=j;j=X;try{return R()}finally{j=ie}},n.unstable_requestPaint=function(){L=!0},n.unstable_runWithPriority=function(R,X){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var ie=j;j=R;try{return X()}finally{j=ie}},n.unstable_scheduleCallback=function(R,X,ie){var ne=n.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?ne+ie:ne):ie=ne,R){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=ie+pe,R={id:y++,callback:X,priorityLevel:R,startTime:ie,expirationTime:pe,sortIndex:-1},ie>ne?(R.sortIndex=ie,l(x,R),i(p)===null&&R===i(x)&&(E?(Q(H),H=-1):E=!0,de(K,ie-ne))):(R.sortIndex=pe,l(p,R),T||N||(T=!0,J||(J=!0,ue()))),R},n.unstable_shouldYield=le,n.unstable_wrapCallback=function(R){var X=j;return function(){var ie=j;j=X;try{return R.apply(this,arguments)}finally{j=ie}}}})(Cd)),Cd}var Hv;function B0(){return Hv||(Hv=1,Md.exports=L0()),Md.exports}var Td={exports:{}},kt={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var $v;function q0(){if($v)return kt;$v=1;var n=xf();function l(p){var x="https://react.dev/errors/"+p;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)x+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+p+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(l(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(p,x,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:p,containerInfo:x,implementation:y}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function v(p,x){if(p==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,kt.createPortal=function(p,x){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!x||x.nodeType!==1&&x.nodeType!==9&&x.nodeType!==11)throw Error(l(299));return f(p,x,null,y)},kt.flushSync=function(p){var x=h.T,y=s.p;try{if(h.T=null,s.p=2,p)return p()}finally{h.T=x,s.p=y,s.d.f()}},kt.preconnect=function(p,x){typeof p=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,s.d.C(p,x))},kt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},kt.preinit=function(p,x){if(typeof p=="string"&&x&&typeof x.as=="string"){var y=x.as,g=v(y,x.crossOrigin),j=typeof x.integrity=="string"?x.integrity:void 0,N=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;y==="style"?s.d.S(p,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:N}):y==="script"&&s.d.X(p,{crossOrigin:g,integrity:j,fetchPriority:N,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},kt.preinitModule=function(p,x){if(typeof p=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var y=v(x.as,x.crossOrigin);s.d.M(p,{crossOrigin:y,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0})}}else x==null&&s.d.M(p)},kt.preload=function(p,x){if(typeof p=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var y=x.as,g=v(y,x.crossOrigin);s.d.L(p,y,{crossOrigin:g,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},kt.preloadModule=function(p,x){if(typeof p=="string")if(x){var y=v(x.as,x.crossOrigin);s.d.m(p,{as:typeof x.as=="string"&&x.as!=="script"?x.as:void 0,crossOrigin:y,integrity:typeof x.integrity=="string"?x.integrity:void 0})}else s.d.m(p)},kt.requestFormReset=function(p){s.d.r(p)},kt.unstable_batchedUpdates=function(p,x){return p(x)},kt.useFormState=function(p,x,y){return h.H.useFormState(p,x,y)},kt.useFormStatus=function(){return h.H.useHostTransitionStatus()},kt.version="19.2.7",kt}var Qv;function Zx(){if(Qv)return Td.exports;Qv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),Td.exports=q0(),Td.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var Kv;function H0(){if(Kv)return Ii;Kv=1;var n=B0(),l=xf(),i=Zx();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function v(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(f(e)!==e)throw Error(s(188))}function x(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(s(188));return t!==e?null:e}for(var a=e,r=t;;){var c=a.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){a=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===a)return p(c),e;if(d===r)return p(c),t;d=d.sibling}throw Error(s(188))}if(a.return!==r.return)a=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===a){m=!0,a=c,r=d;break}if(b===r){m=!0,r=c,a=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===a){m=!0,a=d,r=c;break}if(b===r){m=!0,r=d,a=c;break}b=b.sibling}if(!m)throw Error(s(189))}}if(a.alternate!==r)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),q=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),le=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function ue(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var ee=Symbol.for("react.client.reference");function xe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case z:return"Profiler";case L:return"StrictMode";case K:return"Suspense";case J:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case q:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case O:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return t=e.displayName||null,t!==null?t:xe(e.type)||"Memo";case F:t=e._payload,e=e._init;try{return xe(e(t))}catch{}}return null}var de=Array.isArray,R=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ne=[],pe=-1;function C(e){return{current:e}}function P(e){0>pe||(e.current=ne[pe],ne[pe]=null,pe--)}function I(e,t){pe++,ne[pe]=e.current,e.current=t}var te=C(null),fe=C(null),be=C(null),ge=C(null);function _e(e,t){switch(I(be,t),I(fe,e),I(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?nv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=nv(t),e=lv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(te),I(te,e)}function Ee(){P(te),P(fe),P(be)}function _t(e){e.memoizedState!==null&&I(ge,e);var t=te.current,a=lv(t,e.type);t!==a&&(I(fe,e),I(te,a))}function bt(e){fe.current===e&&(P(te),P(fe)),ge.current===e&&(P(ge),Xi._currentValue=ie)}var Ot,rt;function Ie(e){if(Ot===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ot=t&&t[1]||"",rt=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Ot+e+rt}var ma=!1;function Kt(e,t){if(!e||ma)return"";ma=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(B){var U=B}Reflect.construct(e,[],V)}else{try{V.call()}catch(B){U=B}e.call(V.prototype)}}else{try{throw Error()}catch(B){U=B}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(B){if(B&&U&&typeof B.stack=="string")return[B.stack,U.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=r.DetermineComponentFrameRoot(),m=d[0],b=d[1];if(m&&b){var w=m.split(`
|
|
44
|
-
`),D=b.split(`
|
|
45
|
-
`);for(c=r=0;r<w.length&&!w[r].includes("DetermineComponentFrameRoot");)r++;for(;c<D.length&&!D[c].includes("DetermineComponentFrameRoot");)c++;if(r===w.length||c===D.length)for(r=w.length-1,c=D.length-1;1<=r&&0<=c&&w[r]!==D[c];)c--;for(;1<=r&&0<=c;r--,c--)if(w[r]!==D[c]){if(r!==1||c!==1)do if(r--,c--,0>c||w[r]!==D[c]){var Y=`
|
|
46
|
-
`+w[r].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=r&&0<=c);break}}}finally{ma=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ie(a):""}function zn(e,t){switch(e.tag){case 26:case 27:case 5:return Ie(e.type);case 16:return Ie("Lazy");case 13:return e.child!==t&&t!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("SuspenseList");case 0:case 15:return Kt(e.type,!1);case 11:return Kt(e.type.render,!1);case 1:return Kt(e.type,!0);case 31:return Ie("Activity");default:return""}}function ea(e){try{var t="",a=null;do t+=zn(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
47
|
-
Error generating stack: `+r.message+`
|
|
48
|
-
`+r.stack}}var Dt=Object.prototype.hasOwnProperty,Ta=n.unstable_scheduleCallback,Ut=n.unstable_cancelCallback,ta=n.unstable_shouldYield,tn=n.unstable_requestPaint,ct=n.unstable_now,_n=n.unstable_getCurrentPriorityLevel,an=n.unstable_ImmediatePriority,Ua=n.unstable_UserBlockingPriority,Aa=n.unstable_NormalPriority,On=n.unstable_LowPriority,nn=n.unstable_IdlePriority,Dn=n.log,Un=n.unstable_setDisableYieldValue,He=null,We=null;function ha(e){if(typeof Dn=="function"&&Un(e),We&&typeof We.setStrictMode=="function")try{We.setStrictMode(He,e)}catch{}}var jt=Math.clz32?Math.clz32:La,er=Math.log,tr=Math.LN2;function La(e){return e>>>=0,e===0?32:31-(er(e)/tr|0)|0}var Ba=256,qa=262144,Ha=4194304;function aa(e){var t=e&42;if(t!==0)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function $a(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var c=0,d=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var b=r&134217727;return b!==0?(r=b&~d,r!==0?c=aa(r):(m&=b,m!==0?c=aa(m):a||(a=b&~e,a!==0&&(c=aa(a))))):(b=r&~d,b!==0?c=aa(b):m!==0?c=aa(m):a||(a=r&~e,a!==0&&(c=aa(a)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:c}function Ea(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function bl(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ln(){var e=Ha;return Ha<<=1,(Ha&62914560)===0&&(Ha=4194304),e}function ln(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function oe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $e(e,t,a,r,c,d){var m=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,w=e.expirationTimes,D=e.hiddenUpdates;for(a=m&~a;0<a;){var Y=31-jt(a),V=1<<Y;b[Y]=0,w[Y]=-1;var U=D[Y];if(U!==null)for(D[Y]=null,Y=0;Y<U.length;Y++){var B=U[Y];B!==null&&(B.lane&=-536870913)}a&=~V}r!==0&&Et(e,r,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(m&~t))}function Et(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-jt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function W(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-jt(a),c=1<<r;c&t|e[r]&t&&(e[r]|=t),a&=~c}}function re(e,t){var a=t&-t;return a=(a&42)!==0?1:we(a),(a&(e.suspendedLanes|t))!==0?0:a}function we(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function tt(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qa(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:Tv(e.type))}function ar(e,t){var a=X.p;try{return X.p=e,t()}finally{X.p=a}}var it=Math.random().toString(36).slice(2),ke="__reactFiber$"+it,ut="__reactProps$"+it,nr="__reactContainer$"+it,dc="__reactEvents$"+it,Sg="__reactListeners$"+it,jg="__reactHandles$"+it,Yf="__reactResources$"+it,oi="__reactMarker$"+it;function fc(e){delete e[ke],delete e[ut],delete e[dc],delete e[Sg],delete e[jg]}function lr(e){var t=e[ke];if(t)return t;for(var a=e.parentNode;a;){if(t=a[nr]||a[ke]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=dv(e);e!==null;){if(a=e[ke])return a;e=dv(e)}return t}e=a,a=e.parentNode}return null}function rr(e){if(e=e[ke]||e[nr]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ci(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function ir(e){var t=e[Yf];return t||(t=e[Yf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function gt(e){e[oi]=!0}var Pf=new Set,Gf={};function gl(e,t){sr(e,t),sr(e+"Capture",t)}function sr(e,t){for(Gf[e]=t,e=0;e<t.length;e++)Pf.add(t[e])}var Ng=RegExp("^[: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]*$"),Xf={},Vf={};function wg(e){return Dt.call(Vf,e)?!0:Dt.call(Xf,e)?!1:Ng.test(e)?Vf[e]=!0:(Xf[e]=!0,!1)}function js(e,t,a){if(wg(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Ns(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function rn(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function pa(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ff(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Mg(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var c=r.get,d=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(m){a=""+m,d.call(this,m)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(m){a=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function mc(e){if(!e._valueTracker){var t=Ff(e)?"checked":"value";e._valueTracker=Mg(e,t,""+e[t])}}function Zf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=Ff(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function ws(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Cg=/[\n"\\]/g;function va(e){return e.replace(Cg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function hc(e,t,a,r,c,d,m,b){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+pa(t)):e.value!==""+pa(t)&&(e.value=""+pa(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?pc(e,m,pa(t)):a!=null?pc(e,m,pa(a)):r!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+pa(b):e.removeAttribute("name")}function Jf(e,t,a,r,c,d,m,b){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){mc(e);return}a=a!=null?""+pa(a):"",t=t!=null?""+pa(t):a,b||t===e.value||(e.value=t),e.defaultValue=t}r=r??c,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=b?e.checked:!!r,e.defaultChecked=!!r,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),mc(e)}function pc(e,t,a){t==="number"&&ws(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function or(e,t,a,r){if(e=e.options,t){t={};for(var c=0;c<a.length;c++)t["$"+a[c]]=!0;for(a=0;a<e.length;a++)c=t.hasOwnProperty("$"+e[a].value),e[a].selected!==c&&(e[a].selected=c),c&&r&&(e[a].defaultSelected=!0)}else{for(a=""+pa(a),t=null,c=0;c<e.length;c++){if(e[c].value===a){e[c].selected=!0,r&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function If(e,t,a){if(t!=null&&(t=""+pa(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+pa(a):""}function Wf(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(s(92));if(de(r)){if(1<r.length)throw Error(s(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=pa(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),mc(e)}function cr(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Tg=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function em(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||Tg.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function tm(e,t,a){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var c in t)r=t[c],t.hasOwnProperty(c)&&a[c]!==r&&em(e,c,r)}else for(var d in t)t.hasOwnProperty(d)&&em(e,d,t[d])}function vc(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Ag=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Eg=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ms(e){return Eg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function sn(){}var xc=null;function bc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ur=null,dr=null;function am(e){var t=rr(e);if(t&&(e=t.stateNode)){var a=e[ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(hc(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+va(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var c=r[ut]||null;if(!c)throw Error(s(90));hc(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&Zf(r)}break e;case"textarea":If(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&or(e,!!a.multiple,t,!1)}}}var gc=!1;function nm(e,t,a){if(gc)return e(t,a);gc=!0;try{var r=e(t);return r}finally{if(gc=!1,(ur!==null||dr!==null)&&(mo(),ur&&(t=ur,e=dr,dr=ur=null,am(t),e)))for(t=0;t<e.length;t++)am(e[t])}}function ui(e,t){var a=e.stateNode;if(a===null)return null;var r=a[ut]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(s(231,t,typeof a));return a}var on=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yc=!1;if(on)try{var di={};Object.defineProperty(di,"passive",{get:function(){yc=!0}}),window.addEventListener("test",di,di),window.removeEventListener("test",di,di)}catch{yc=!1}var Bn=null,Sc=null,Cs=null;function lm(){if(Cs)return Cs;var e,t=Sc,a=t.length,r,c="value"in Bn?Bn.value:Bn.textContent,d=c.length;for(e=0;e<a&&t[e]===c[e];e++);var m=a-e;for(r=1;r<=m&&t[a-r]===c[d-r];r++);return Cs=c.slice(e,1<r?1-r:void 0)}function Ts(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function As(){return!0}function rm(){return!1}function Yt(e){function t(a,r,c,d,m){this._reactName=a,this._targetInst=c,this.type=r,this.nativeEvent=d,this.target=m,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(a=e[b],this[b]=a?a(d):d[b]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?As:rm,this.isPropagationStopped=rm,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=As)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=As)},persist:function(){},isPersistent:As}),t}var yl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Es=Yt(yl),fi=g({},yl,{view:0,detail:0}),kg=Yt(fi),jc,Nc,mi,ks=g({},fi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==mi&&(mi&&e.type==="mousemove"?(jc=e.screenX-mi.screenX,Nc=e.screenY-mi.screenY):Nc=jc=0,mi=e),jc)},movementY:function(e){return"movementY"in e?e.movementY:Nc}}),im=Yt(ks),Rg=g({},ks,{dataTransfer:0}),zg=Yt(Rg),_g=g({},fi,{relatedTarget:0}),wc=Yt(_g),Og=g({},yl,{animationName:0,elapsedTime:0,pseudoElement:0}),Dg=Yt(Og),Ug=g({},yl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Lg=Yt(Ug),Bg=g({},yl,{data:0}),sm=Yt(Bg),qg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Hg={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"},$g={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$g[e])?!!t[e]:!1}function Mc(){return Qg}var Kg=g({},fi,{key:function(e){if(e.key){var t=qg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ts(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Hg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mc,charCode:function(e){return e.type==="keypress"?Ts(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ts(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Yg=Yt(Kg),Pg=g({},ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),om=Yt(Pg),Gg=g({},fi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mc}),Xg=Yt(Gg),Vg=g({},yl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fg=Yt(Vg),Zg=g({},ks,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Jg=Yt(Zg),Ig=g({},yl,{newState:0,oldState:0}),Wg=Yt(Ig),ey=[9,13,27,32],Cc=on&&"CompositionEvent"in window,hi=null;on&&"documentMode"in document&&(hi=document.documentMode);var ty=on&&"TextEvent"in window&&!hi,cm=on&&(!Cc||hi&&8<hi&&11>=hi),um=" ",dm=!1;function fm(e,t){switch(e){case"keyup":return ey.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fr=!1;function ay(e,t){switch(e){case"compositionend":return mm(t);case"keypress":return t.which!==32?null:(dm=!0,um);case"textInput":return e=t.data,e===um&&dm?null:e;default:return null}}function ny(e,t){if(fr)return e==="compositionend"||!Cc&&fm(e,t)?(e=lm(),Cs=Sc=Bn=null,fr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return cm&&t.locale!=="ko"?null:t.data;default:return null}}var ly={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 hm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ly[e.type]:t==="textarea"}function pm(e,t,a,r){ur?dr?dr.push(r):dr=[r]:ur=r,t=yo(t,"onChange"),0<t.length&&(a=new Es("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var pi=null,vi=null;function ry(e){Jp(e,0)}function Rs(e){var t=ci(e);if(Zf(t))return e}function vm(e,t){if(e==="change")return t}var xm=!1;if(on){var Tc;if(on){var Ac="oninput"in document;if(!Ac){var bm=document.createElement("div");bm.setAttribute("oninput","return;"),Ac=typeof bm.oninput=="function"}Tc=Ac}else Tc=!1;xm=Tc&&(!document.documentMode||9<document.documentMode)}function gm(){pi&&(pi.detachEvent("onpropertychange",ym),vi=pi=null)}function ym(e){if(e.propertyName==="value"&&Rs(vi)){var t=[];pm(t,vi,e,bc(e)),nm(ry,t)}}function iy(e,t,a){e==="focusin"?(gm(),pi=t,vi=a,pi.attachEvent("onpropertychange",ym)):e==="focusout"&&gm()}function sy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rs(vi)}function oy(e,t){if(e==="click")return Rs(t)}function cy(e,t){if(e==="input"||e==="change")return Rs(t)}function uy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var na=typeof Object.is=="function"?Object.is:uy;function xi(e,t){if(na(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var c=a[r];if(!Dt.call(t,c)||!na(e[c],t[c]))return!1}return!0}function Sm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jm(e,t){var a=Sm(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Sm(a)}}function Nm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ws(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=ws(e.document)}return t}function Ec(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var dy=on&&"documentMode"in document&&11>=document.documentMode,mr=null,kc=null,bi=null,Rc=!1;function Mm(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Rc||mr==null||mr!==ws(r)||(r=mr,"selectionStart"in r&&Ec(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),bi&&xi(bi,r)||(bi=r,r=yo(kc,"onSelect"),0<r.length&&(t=new Es("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=mr)))}function Sl(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var hr={animationend:Sl("Animation","AnimationEnd"),animationiteration:Sl("Animation","AnimationIteration"),animationstart:Sl("Animation","AnimationStart"),transitionrun:Sl("Transition","TransitionRun"),transitionstart:Sl("Transition","TransitionStart"),transitioncancel:Sl("Transition","TransitionCancel"),transitionend:Sl("Transition","TransitionEnd")},zc={},Cm={};on&&(Cm=document.createElement("div").style,"AnimationEvent"in window||(delete hr.animationend.animation,delete hr.animationiteration.animation,delete hr.animationstart.animation),"TransitionEvent"in window||delete hr.transitionend.transition);function jl(e){if(zc[e])return zc[e];if(!hr[e])return e;var t=hr[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Cm)return zc[e]=t[a];return e}var Tm=jl("animationend"),Am=jl("animationiteration"),Em=jl("animationstart"),fy=jl("transitionrun"),my=jl("transitionstart"),hy=jl("transitioncancel"),km=jl("transitionend"),Rm=new Map,_c="abort auxClick beforeToggle 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(" ");_c.push("scrollEnd");function ka(e,t){Rm.set(e,t),gl(t,[e])}var zs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},xa=[],pr=0,Oc=0;function _s(){for(var e=pr,t=Oc=pr=0;t<e;){var a=xa[t];xa[t++]=null;var r=xa[t];xa[t++]=null;var c=xa[t];xa[t++]=null;var d=xa[t];if(xa[t++]=null,r!==null&&c!==null){var m=r.pending;m===null?c.next=c:(c.next=m.next,m.next=c),r.pending=c}d!==0&&zm(a,c,d)}}function Os(e,t,a,r){xa[pr++]=e,xa[pr++]=t,xa[pr++]=a,xa[pr++]=r,Oc|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Dc(e,t,a,r){return Os(e,t,a,r),Ds(e)}function Nl(e,t){return Os(e,null,null,t),Ds(e)}function zm(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var c=!1,d=e.return;d!==null;)d.childLanes|=a,r=d.alternate,r!==null&&(r.childLanes|=a),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-jt(a),e=d.hiddenUpdates,r=e[c],r===null?e[c]=[t]:r.push(t),t.lane=a|536870912),d):null}function Ds(e){if(50<Hi)throw Hi=0,Yu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var vr={};function py(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function la(e,t,a,r){return new py(e,t,a,r)}function Uc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cn(e,t){var a=e.alternate;return a===null?(a=la(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function _m(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Us(e,t,a,r,c,d){var m=0;if(r=e,typeof e=="function")Uc(e)&&(m=1);else if(typeof e=="string")m=y0(e,a,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Z:return e=la(31,a,t,c),e.elementType=Z,e.lanes=d,e;case E:return wl(a.children,c,d,t);case L:m=8,c|=24;break;case z:return e=la(12,a,t,c|2),e.elementType=z,e.lanes=d,e;case K:return e=la(13,a,t,c),e.elementType=K,e.lanes=d,e;case J:return e=la(19,a,t,c),e.elementType=J,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:m=10;break e;case Q:m=9;break e;case O:m=11;break e;case H:m=14;break e;case F:m=16,r=null;break e}m=29,a=Error(s(130,e===null?"null":typeof e,"")),r=null}return t=la(m,a,t,c),t.elementType=e,t.type=r,t.lanes=d,t}function wl(e,t,a,r){return e=la(7,e,r,t),e.lanes=a,e}function Lc(e,t,a){return e=la(6,e,null,t),e.lanes=a,e}function Om(e){var t=la(18,null,null,0);return t.stateNode=e,t}function Bc(e,t,a){return t=la(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Dm=new WeakMap;function ba(e,t){if(typeof e=="object"&&e!==null){var a=Dm.get(e);return a!==void 0?a:(t={value:e,source:t,stack:ea(t)},Dm.set(e,t),t)}return{value:e,source:t,stack:ea(t)}}var xr=[],br=0,Ls=null,gi=0,ga=[],ya=0,qn=null,Ka=1,Ya="";function un(e,t){xr[br++]=gi,xr[br++]=Ls,Ls=e,gi=t}function Um(e,t,a){ga[ya++]=Ka,ga[ya++]=Ya,ga[ya++]=qn,qn=e;var r=Ka;e=Ya;var c=32-jt(r)-1;r&=~(1<<c),a+=1;var d=32-jt(t)+c;if(30<d){var m=c-c%5;d=(r&(1<<m)-1).toString(32),r>>=m,c-=m,Ka=1<<32-jt(t)+c|a<<c|r,Ya=d+e}else Ka=1<<d|a<<c|r,Ya=e}function qc(e){e.return!==null&&(un(e,1),Um(e,1,0))}function Hc(e){for(;e===Ls;)Ls=xr[--br],xr[br]=null,gi=xr[--br],xr[br]=null;for(;e===qn;)qn=ga[--ya],ga[ya]=null,Ya=ga[--ya],ga[ya]=null,Ka=ga[--ya],ga[ya]=null}function Lm(e,t){ga[ya++]=Ka,ga[ya++]=Ya,ga[ya++]=qn,Ka=t.id,Ya=t.overflow,qn=e}var Nt=null,Fe=null,Re=!1,Hn=null,Sa=!1,$c=Error(s(519));function $n(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yi(ba(t,e)),$c}function Bm(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[ke]=e,t[ut]=r,a){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(a=0;a<Qi.length;a++)Ce(Qi[a],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),Jf(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),Wf(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||tv(t.textContent,a)?(r.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),r.onScroll!=null&&Ce("scroll",t),r.onScrollEnd!=null&&Ce("scrollend",t),r.onClick!=null&&(t.onclick=sn),t=!0):t=!1,t||$n(e,!0)}function qm(e){for(Nt=e.return;Nt;)switch(Nt.tag){case 5:case 31:case 13:Sa=!1;return;case 27:case 3:Sa=!0;return;default:Nt=Nt.return}}function gr(e){if(e!==Nt)return!1;if(!Re)return qm(e),Re=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||rd(e.type,e.memoizedProps)),a=!a),a&&Fe&&$n(e),qm(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Fe=uv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Fe=uv(e)}else t===27?(t=Fe,tl(e.type)?(e=ud,ud=null,Fe=e):Fe=t):Fe=Nt?Na(e.stateNode.nextSibling):null;return!0}function Ml(){Fe=Nt=null,Re=!1}function Qc(){var e=Hn;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),Hn=null),e}function yi(e){Hn===null?Hn=[e]:Hn.push(e)}var Kc=C(null),Cl=null,dn=null;function Qn(e,t,a){I(Kc,t._currentValue),t._currentValue=a}function fn(e){e._currentValue=Kc.current,P(Kc)}function Yc(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Pc(e,t,a,r){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var m=c.child;d=d.firstContext;e:for(;d!==null;){var b=d;d=c;for(var w=0;w<t.length;w++)if(b.context===t[w]){d.lanes|=a,b=d.alternate,b!==null&&(b.lanes|=a),Yc(d.return,a,e),r||(m=null);break e}d=b.next}}else if(c.tag===18){if(m=c.return,m===null)throw Error(s(341));m.lanes|=a,d=m.alternate,d!==null&&(d.lanes|=a),Yc(m,a,e),m=null}else m=c.child;if(m!==null)m.return=c;else for(m=c;m!==null;){if(m===e){m=null;break}if(c=m.sibling,c!==null){c.return=m.return,m=c;break}m=m.return}c=m}}function yr(e,t,a,r){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var m=c.alternate;if(m===null)throw Error(s(387));if(m=m.memoizedProps,m!==null){var b=c.type;na(c.pendingProps.value,m.value)||(e!==null?e.push(b):e=[b])}}else if(c===ge.current){if(m=c.alternate,m===null)throw Error(s(387));m.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Xi):e=[Xi])}c=c.return}e!==null&&Pc(t,e,a,r),t.flags|=262144}function Bs(e){for(e=e.firstContext;e!==null;){if(!na(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Tl(e){Cl=e,dn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wt(e){return Hm(Cl,e)}function qs(e,t){return Cl===null&&Tl(e),Hm(e,t)}function Hm(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},dn===null){if(e===null)throw Error(s(308));dn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else dn=dn.next=t;return a}var vy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},xy=n.unstable_scheduleCallback,by=n.unstable_NormalPriority,dt={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Gc(){return{controller:new vy,data:new Map,refCount:0}}function Si(e){e.refCount--,e.refCount===0&&xy(by,function(){e.controller.abort()})}var ji=null,Xc=0,Sr=0,jr=null;function gy(e,t){if(ji===null){var a=ji=[];Xc=0,Sr=Zu(),jr={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Xc++,t.then($m,$m),t}function $m(){if(--Xc===0&&ji!==null){jr!==null&&(jr.status="fulfilled");var e=ji;ji=null,Sr=0,jr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function yy(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(c){a.push(c)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var c=0;c<a.length;c++)(0,a[c])(t)},function(c){for(r.status="rejected",r.reason=c,c=0;c<a.length;c++)(0,a[c])(void 0)}),r}var Qm=R.S;R.S=function(e,t){Mp=ct(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&gy(e,t),Qm!==null&&Qm(e,t)};var Al=C(null);function Vc(){var e=Al.current;return e!==null?e:Ve.pooledCache}function Hs(e,t){t===null?I(Al,Al.current):I(Al,t.pool)}function Km(){var e=Vc();return e===null?null:{parent:dt._currentValue,pool:e}}var Nr=Error(s(460)),Fc=Error(s(474)),$s=Error(s(542)),Qs={then:function(){}};function Ym(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Pm(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(sn,sn),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Xm(e),e;default:if(typeof t.status=="string")t.then(sn,sn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=r}},function(r){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Xm(e),e}throw kl=t,Nr}}function El(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(kl=a,Nr):a}}var kl=null;function Gm(){if(kl===null)throw Error(s(459));var e=kl;return kl=null,e}function Xm(e){if(e===Nr||e===$s)throw Error(s(483))}var wr=null,Ni=0;function Ks(e){var t=Ni;return Ni+=1,wr===null&&(wr=[]),Pm(wr,e,t)}function wi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ys(e,t){throw t.$$typeof===j?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Vm(e){function t(k,A){if(e){var _=k.deletions;_===null?(k.deletions=[A],k.flags|=16):_.push(A)}}function a(k,A){if(!e)return null;for(;A!==null;)t(k,A),A=A.sibling;return null}function r(k){for(var A=new Map;k!==null;)k.key!==null?A.set(k.key,k):A.set(k.index,k),k=k.sibling;return A}function c(k,A){return k=cn(k,A),k.index=0,k.sibling=null,k}function d(k,A,_){return k.index=_,e?(_=k.alternate,_!==null?(_=_.index,_<A?(k.flags|=67108866,A):_):(k.flags|=67108866,A)):(k.flags|=1048576,A)}function m(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function b(k,A,_,G){return A===null||A.tag!==6?(A=Lc(_,k.mode,G),A.return=k,A):(A=c(A,_),A.return=k,A)}function w(k,A,_,G){var he=_.type;return he===E?Y(k,A,_.props.children,G,_.key):A!==null&&(A.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===F&&El(he)===A.type)?(A=c(A,_.props),wi(A,_),A.return=k,A):(A=Us(_.type,_.key,_.props,null,k.mode,G),wi(A,_),A.return=k,A)}function D(k,A,_,G){return A===null||A.tag!==4||A.stateNode.containerInfo!==_.containerInfo||A.stateNode.implementation!==_.implementation?(A=Bc(_,k.mode,G),A.return=k,A):(A=c(A,_.children||[]),A.return=k,A)}function Y(k,A,_,G,he){return A===null||A.tag!==7?(A=wl(_,k.mode,G,he),A.return=k,A):(A=c(A,_),A.return=k,A)}function V(k,A,_){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=Lc(""+A,k.mode,_),A.return=k,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case N:return _=Us(A.type,A.key,A.props,null,k.mode,_),wi(_,A),_.return=k,_;case T:return A=Bc(A,k.mode,_),A.return=k,A;case F:return A=El(A),V(k,A,_)}if(de(A)||ue(A))return A=wl(A,k.mode,_,null),A.return=k,A;if(typeof A.then=="function")return V(k,Ks(A),_);if(A.$$typeof===q)return V(k,qs(k,A),_);Ys(k,A)}return null}function U(k,A,_,G){var he=A!==null?A.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return he!==null?null:b(k,A,""+_,G);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case N:return _.key===he?w(k,A,_,G):null;case T:return _.key===he?D(k,A,_,G):null;case F:return _=El(_),U(k,A,_,G)}if(de(_)||ue(_))return he!==null?null:Y(k,A,_,G,null);if(typeof _.then=="function")return U(k,A,Ks(_),G);if(_.$$typeof===q)return U(k,A,qs(k,_),G);Ys(k,_)}return null}function B(k,A,_,G,he){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return k=k.get(_)||null,b(A,k,""+G,he);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case N:return k=k.get(G.key===null?_:G.key)||null,w(A,k,G,he);case T:return k=k.get(G.key===null?_:G.key)||null,D(A,k,G,he);case F:return G=El(G),B(k,A,_,G,he)}if(de(G)||ue(G))return k=k.get(_)||null,Y(A,k,G,he,null);if(typeof G.then=="function")return B(k,A,_,Ks(G),he);if(G.$$typeof===q)return B(k,A,_,qs(A,G),he);Ys(A,G)}return null}function se(k,A,_,G){for(var he=null,Ue=null,ce=A,je=A=0,Ae=null;ce!==null&&je<_.length;je++){ce.index>je?(Ae=ce,ce=null):Ae=ce.sibling;var Le=U(k,ce,_[je],G);if(Le===null){ce===null&&(ce=Ae);break}e&&ce&&Le.alternate===null&&t(k,ce),A=d(Le,A,je),Ue===null?he=Le:Ue.sibling=Le,Ue=Le,ce=Ae}if(je===_.length)return a(k,ce),Re&&un(k,je),he;if(ce===null){for(;je<_.length;je++)ce=V(k,_[je],G),ce!==null&&(A=d(ce,A,je),Ue===null?he=ce:Ue.sibling=ce,Ue=ce);return Re&&un(k,je),he}for(ce=r(ce);je<_.length;je++)Ae=B(ce,k,je,_[je],G),Ae!==null&&(e&&Ae.alternate!==null&&ce.delete(Ae.key===null?je:Ae.key),A=d(Ae,A,je),Ue===null?he=Ae:Ue.sibling=Ae,Ue=Ae);return e&&ce.forEach(function(il){return t(k,il)}),Re&&un(k,je),he}function ve(k,A,_,G){if(_==null)throw Error(s(151));for(var he=null,Ue=null,ce=A,je=A=0,Ae=null,Le=_.next();ce!==null&&!Le.done;je++,Le=_.next()){ce.index>je?(Ae=ce,ce=null):Ae=ce.sibling;var il=U(k,ce,Le.value,G);if(il===null){ce===null&&(ce=Ae);break}e&&ce&&il.alternate===null&&t(k,ce),A=d(il,A,je),Ue===null?he=il:Ue.sibling=il,Ue=il,ce=Ae}if(Le.done)return a(k,ce),Re&&un(k,je),he;if(ce===null){for(;!Le.done;je++,Le=_.next())Le=V(k,Le.value,G),Le!==null&&(A=d(Le,A,je),Ue===null?he=Le:Ue.sibling=Le,Ue=Le);return Re&&un(k,je),he}for(ce=r(ce);!Le.done;je++,Le=_.next())Le=B(ce,k,je,Le.value,G),Le!==null&&(e&&Le.alternate!==null&&ce.delete(Le.key===null?je:Le.key),A=d(Le,A,je),Ue===null?he=Le:Ue.sibling=Le,Ue=Le);return e&&ce.forEach(function(R0){return t(k,R0)}),Re&&un(k,je),he}function Xe(k,A,_,G){if(typeof _=="object"&&_!==null&&_.type===E&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case N:e:{for(var he=_.key;A!==null;){if(A.key===he){if(he=_.type,he===E){if(A.tag===7){a(k,A.sibling),G=c(A,_.props.children),G.return=k,k=G;break e}}else if(A.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===F&&El(he)===A.type){a(k,A.sibling),G=c(A,_.props),wi(G,_),G.return=k,k=G;break e}a(k,A);break}else t(k,A);A=A.sibling}_.type===E?(G=wl(_.props.children,k.mode,G,_.key),G.return=k,k=G):(G=Us(_.type,_.key,_.props,null,k.mode,G),wi(G,_),G.return=k,k=G)}return m(k);case T:e:{for(he=_.key;A!==null;){if(A.key===he)if(A.tag===4&&A.stateNode.containerInfo===_.containerInfo&&A.stateNode.implementation===_.implementation){a(k,A.sibling),G=c(A,_.children||[]),G.return=k,k=G;break e}else{a(k,A);break}else t(k,A);A=A.sibling}G=Bc(_,k.mode,G),G.return=k,k=G}return m(k);case F:return _=El(_),Xe(k,A,_,G)}if(de(_))return se(k,A,_,G);if(ue(_)){if(he=ue(_),typeof he!="function")throw Error(s(150));return _=he.call(_),ve(k,A,_,G)}if(typeof _.then=="function")return Xe(k,A,Ks(_),G);if(_.$$typeof===q)return Xe(k,A,qs(k,_),G);Ys(k,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,A!==null&&A.tag===6?(a(k,A.sibling),G=c(A,_),G.return=k,k=G):(a(k,A),G=Lc(_,k.mode,G),G.return=k,k=G),m(k)):a(k,A)}return function(k,A,_,G){try{Ni=0;var he=Xe(k,A,_,G);return wr=null,he}catch(ce){if(ce===Nr||ce===$s)throw ce;var Ue=la(29,ce,null,k.mode);return Ue.lanes=G,Ue.return=k,Ue}finally{}}}var Rl=Vm(!0),Fm=Vm(!1),Kn=!1;function Zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Yn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pn(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Be&2)!==0){var c=r.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),r.pending=t,t=Ds(e),zm(e,null,a),t}return Os(e,r,t,a),Ds(e)}function Mi(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,W(e,a)}}function Ic(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var c=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var m={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?c=d=m:d=d.next=m,a=a.next}while(a!==null);d===null?c=d=t:d=d.next=t}else c=d=t;a={baseState:r.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Wc=!1;function Ci(){if(Wc){var e=jr;if(e!==null)throw e}}function Ti(e,t,a,r){Wc=!1;var c=e.updateQueue;Kn=!1;var d=c.firstBaseUpdate,m=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var w=b,D=w.next;w.next=null,m===null?d=D:m.next=D,m=w;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==m&&(b===null?Y.firstBaseUpdate=D:b.next=D,Y.lastBaseUpdate=w))}if(d!==null){var V=c.baseState;m=0,Y=D=w=null,b=d;do{var U=b.lane&-536870913,B=U!==b.lane;if(B?(Te&U)===U:(r&U)===U){U!==0&&U===Sr&&(Wc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var se=e,ve=b;U=t;var Xe=a;switch(ve.tag){case 1:if(se=ve.payload,typeof se=="function"){V=se.call(Xe,V,U);break e}V=se;break e;case 3:se.flags=se.flags&-65537|128;case 0:if(se=ve.payload,U=typeof se=="function"?se.call(Xe,V,U):se,U==null)break e;V=g({},V,U);break e;case 2:Kn=!0}}U=b.callback,U!==null&&(e.flags|=64,B&&(e.flags|=8192),B=c.callbacks,B===null?c.callbacks=[U]:B.push(U))}else B={lane:U,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(D=Y=B,w=V):Y=Y.next=B,m|=U;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;B=b,b=B.next,B.next=null,c.lastBaseUpdate=B,c.shared.pending=null}}while(!0);Y===null&&(w=V),c.baseState=w,c.firstBaseUpdate=D,c.lastBaseUpdate=Y,d===null&&(c.shared.lanes=0),Zn|=m,e.lanes=m,e.memoizedState=V}}function Zm(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function Jm(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Zm(a[e],t)}var Mr=C(null),Ps=C(0);function Im(e,t){e=Sn,I(Ps,e),I(Mr,t),Sn=e|t.baseLanes}function eu(){I(Ps,Sn),I(Mr,Mr.current)}function tu(){Sn=Ps.current,P(Mr),P(Ps)}var ra=C(null),ja=null;function Gn(e){var t=e.alternate;I(st,st.current&1),I(ra,e),ja===null&&(t===null||Mr.current!==null||t.memoizedState!==null)&&(ja=e)}function au(e){I(st,st.current),I(ra,e),ja===null&&(ja=e)}function Wm(e){e.tag===22?(I(st,st.current),I(ra,e),ja===null&&(ja=e)):Xn()}function Xn(){I(st,st.current),I(ra,ra.current)}function ia(e){P(ra),ja===e&&(ja=null),P(st)}var st=C(0);function Gs(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||od(a)||cd(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var mn=0,Se=null,Pe=null,ft=null,Xs=!1,Cr=!1,zl=!1,Vs=0,Ai=0,Tr=null,Sy=0;function at(){throw Error(s(321))}function nu(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!na(e[a],t[a]))return!1;return!0}function lu(e,t,a,r,c,d){return mn=d,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?Uh:gu,zl=!1,d=a(r,c),zl=!1,Cr&&(d=th(t,a,r,c)),eh(e),d}function eh(e){R.H=Ri;var t=Pe!==null&&Pe.next!==null;if(mn=0,ft=Pe=Se=null,Xs=!1,Ai=0,Tr=null,t)throw Error(s(300));e===null||mt||(e=e.dependencies,e!==null&&Bs(e)&&(mt=!0))}function th(e,t,a,r){Se=e;var c=0;do{if(Cr&&(Tr=null),Ai=0,Cr=!1,25<=c)throw Error(s(301));if(c+=1,ft=Pe=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}R.H=Lh,d=t(a,r)}while(Cr);return d}function jy(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?Ei(t):t,e=e.useState()[0],(Pe!==null?Pe.memoizedState:null)!==e&&(Se.flags|=1024),t}function ru(){var e=Vs!==0;return Vs=0,e}function iu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function su(e){if(Xs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Xs=!1}mn=0,ft=Pe=Se=null,Cr=!1,Ai=Vs=0,Tr=null}function Lt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?Se.memoizedState=ft=e:ft=ft.next=e,ft}function ot(){if(Pe===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Pe.next;var t=ft===null?Se.memoizedState:ft.next;if(t!==null)ft=t,Pe=e;else{if(e===null)throw Se.alternate===null?Error(s(467)):Error(s(310));Pe=e,e={memoizedState:Pe.memoizedState,baseState:Pe.baseState,baseQueue:Pe.baseQueue,queue:Pe.queue,next:null},ft===null?Se.memoizedState=ft=e:ft=ft.next=e}return ft}function Fs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ei(e){var t=Ai;return Ai+=1,Tr===null&&(Tr=[]),e=Pm(Tr,e,t),t=Se,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?Uh:gu),e}function Zs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ei(e);if(e.$$typeof===q)return wt(e)}throw Error(s(438,String(e)))}function ou(e){var t=null,a=Se.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=Se.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Fs(),Se.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=le;return t.index++,a}function hn(e,t){return typeof t=="function"?t(e):t}function Js(e){var t=ot();return cu(t,Pe,e)}function cu(e,t,a){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=a;var c=e.baseQueue,d=r.pending;if(d!==null){if(c!==null){var m=c.next;c.next=d.next,d.next=m}t.baseQueue=c=d,r.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var b=m=null,w=null,D=t,Y=!1;do{var V=D.lane&-536870913;if(V!==D.lane?(Te&V)===V:(mn&V)===V){var U=D.revertLane;if(U===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null}),V===Sr&&(Y=!0);else if((mn&U)===U){D=D.next,U===Sr&&(Y=!0);continue}else V={lane:0,revertLane:D.revertLane,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},w===null?(b=w=V,m=d):w=w.next=V,Se.lanes|=U,Zn|=U;V=D.action,zl&&a(d,V),d=D.hasEagerState?D.eagerState:a(d,V)}else U={lane:V,revertLane:D.revertLane,gesture:D.gesture,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},w===null?(b=w=U,m=d):w=w.next=U,Se.lanes|=V,Zn|=V;D=D.next}while(D!==null&&D!==t);if(w===null?m=d:w.next=b,!na(d,e.memoizedState)&&(mt=!0,Y&&(a=jr,a!==null)))throw a;e.memoizedState=d,e.baseState=m,e.baseQueue=w,r.lastRenderedState=d}return c===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function uu(e){var t=ot(),a=t.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=e;var r=a.dispatch,c=a.pending,d=t.memoizedState;if(c!==null){a.pending=null;var m=c=c.next;do d=e(d,m.action),m=m.next;while(m!==c);na(d,t.memoizedState)||(mt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),a.lastRenderedState=d}return[d,r]}function ah(e,t,a){var r=Se,c=ot(),d=Re;if(d){if(a===void 0)throw Error(s(407));a=a()}else a=t();var m=!na((Pe||c).memoizedState,a);if(m&&(c.memoizedState=a,mt=!0),c=c.queue,mu(rh.bind(null,r,c,e),[e]),c.getSnapshot!==t||m||ft!==null&&ft.memoizedState.tag&1){if(r.flags|=2048,Ar(9,{destroy:void 0},lh.bind(null,r,c,a,t),null),Ve===null)throw Error(s(349));d||(mn&127)!==0||nh(r,t,a)}return a}function nh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Se.updateQueue,t===null?(t=Fs(),Se.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function lh(e,t,a,r){t.value=a,t.getSnapshot=r,ih(t)&&sh(e)}function rh(e,t,a){return a(function(){ih(t)&&sh(e)})}function ih(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!na(e,a)}catch{return!0}}function sh(e){var t=Nl(e,2);t!==null&&Ft(t,e,2)}function du(e){var t=Lt();if(typeof e=="function"){var a=e;if(e=a(),zl){ha(!0);try{a()}finally{ha(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hn,lastRenderedState:e},t}function oh(e,t,a,r){return e.baseState=a,cu(e,Pe,typeof r=="function"?r:hn)}function Ny(e,t,a,r,c){if(eo(e))throw Error(s(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){d.listeners.push(m)}};R.T!==null?a(!0):d.isTransition=!1,r(d),a=t.pending,a===null?(d.next=t.pending=d,ch(t,d)):(d.next=a.next,t.pending=a.next=d)}}function ch(e,t){var a=t.action,r=t.payload,c=e.state;if(t.isTransition){var d=R.T,m={};R.T=m;try{var b=a(c,r),w=R.S;w!==null&&w(m,b),uh(e,t,b)}catch(D){fu(e,t,D)}finally{d!==null&&m.types!==null&&(d.types=m.types),R.T=d}}else try{d=a(c,r),uh(e,t,d)}catch(D){fu(e,t,D)}}function uh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){dh(e,t,r)},function(r){return fu(e,t,r)}):dh(e,t,a)}function dh(e,t,a){t.status="fulfilled",t.value=a,fh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,ch(e,a)))}function fu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,fh(t),t=t.next;while(t!==r)}e.action=null}function fh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function mh(e,t){return t}function hh(e,t){if(Re){var a=Ve.formState;if(a!==null){e:{var r=Se;if(Re){if(Fe){t:{for(var c=Fe,d=Sa;c.nodeType!==8;){if(!d){c=null;break t}if(c=Na(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Fe=Na(c.nextSibling),r=c.data==="F!";break e}}$n(r)}r=!1}r&&(t=a[0])}}return a=Lt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mh,lastRenderedState:t},a.queue=r,a=_h.bind(null,Se,r),r.dispatch=a,r=du(!1),d=bu.bind(null,Se,!1,r.queue),r=Lt(),c={state:t,dispatch:null,action:e,pending:null},r.queue=c,a=Ny.bind(null,Se,c,d,a),c.dispatch=a,r.memoizedState=e,[t,a,!1]}function ph(e){var t=ot();return vh(t,Pe,e)}function vh(e,t,a){if(t=cu(e,t,mh)[0],e=Js(hn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Ei(t)}catch(m){throw m===Nr?$s:m}else r=t;t=ot();var c=t.queue,d=c.dispatch;return a!==t.memoizedState&&(Se.flags|=2048,Ar(9,{destroy:void 0},wy.bind(null,c,a),null)),[r,d,e]}function wy(e,t){e.action=t}function xh(e){var t=ot(),a=Pe;if(a!==null)return vh(t,a,e);ot(),t=t.memoizedState,a=ot();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function Ar(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=Se.updateQueue,t===null&&(t=Fs(),Se.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function bh(){return ot().memoizedState}function Is(e,t,a,r){var c=Lt();Se.flags|=e,c.memoizedState=Ar(1|t,{destroy:void 0},a,r===void 0?null:r)}function Ws(e,t,a,r){var c=ot();r=r===void 0?null:r;var d=c.memoizedState.inst;Pe!==null&&r!==null&&nu(r,Pe.memoizedState.deps)?c.memoizedState=Ar(t,d,a,r):(Se.flags|=e,c.memoizedState=Ar(1|t,d,a,r))}function gh(e,t){Is(8390656,8,e,t)}function mu(e,t){Ws(2048,8,e,t)}function My(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=Fs(),Se.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function yh(e){var t=ot().memoizedState;return My({ref:t,nextImpl:e}),function(){if((Be&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Sh(e,t){return Ws(4,2,e,t)}function jh(e,t){return Ws(4,4,e,t)}function Nh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wh(e,t,a){a=a!=null?a.concat([e]):null,Ws(4,4,Nh.bind(null,t,e),a)}function hu(){}function Mh(e,t){var a=ot();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&nu(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Ch(e,t){var a=ot();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&nu(t,r[1]))return r[0];if(r=e(),zl){ha(!0);try{e()}finally{ha(!1)}}return a.memoizedState=[r,t],r}function pu(e,t,a){return a===void 0||(mn&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Tp(),Se.lanes|=e,Zn|=e,a)}function Th(e,t,a,r){return na(a,t)?a:Mr.current!==null?(e=pu(e,a,r),na(e,t)||(mt=!0),e):(mn&42)===0||(mn&1073741824)!==0&&(Te&261930)===0?(mt=!0,e.memoizedState=a):(e=Tp(),Se.lanes|=e,Zn|=e,t)}function Ah(e,t,a,r,c){var d=X.p;X.p=d!==0&&8>d?d:8;var m=R.T,b={};R.T=b,bu(e,!1,t,a);try{var w=c(),D=R.S;if(D!==null&&D(b,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var Y=yy(w,r);ki(e,t,Y,ca(e))}else ki(e,t,r,ca(e))}catch(V){ki(e,t,{then:function(){},status:"rejected",reason:V},ca())}finally{X.p=d,m!==null&&b.types!==null&&(m.types=b.types),R.T=m}}function Cy(){}function vu(e,t,a,r){if(e.tag!==5)throw Error(s(476));var c=Eh(e).queue;Ah(e,c,t,ie,a===null?Cy:function(){return kh(e),a(r)})}function Eh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hn,lastRenderedState:ie},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function kh(e){var t=Eh(e);t.next===null&&(t=e.alternate.memoizedState),ki(e,t.next.queue,{},ca())}function xu(){return wt(Xi)}function Rh(){return ot().memoizedState}function zh(){return ot().memoizedState}function Ty(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=ca();e=Yn(a);var r=Pn(t,e,a);r!==null&&(Ft(r,t,a),Mi(r,t,a)),t={cache:Gc()},e.payload=t;return}t=t.return}}function Ay(e,t,a){var r=ca();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},eo(e)?Oh(t,a):(a=Dc(e,t,a,r),a!==null&&(Ft(a,e,r),Dh(a,t,r)))}function _h(e,t,a){var r=ca();ki(e,t,a,r)}function ki(e,t,a,r){var c={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(eo(e))Oh(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var m=t.lastRenderedState,b=d(m,a);if(c.hasEagerState=!0,c.eagerState=b,na(b,m))return Os(e,t,c,0),Ve===null&&_s(),!1}catch{}finally{}if(a=Dc(e,t,c,r),a!==null)return Ft(a,e,r),Dh(a,t,r),!0}return!1}function bu(e,t,a,r){if(r={lane:2,revertLane:Zu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},eo(e)){if(t)throw Error(s(479))}else t=Dc(e,a,r,2),t!==null&&Ft(t,e,2)}function eo(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Oh(e,t){Cr=Xs=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Dh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,W(e,a)}}var Ri={readContext:wt,use:Zs,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};Ri.useEffectEvent=at;var Uh={readContext:wt,use:Zs,useCallback:function(e,t){return Lt().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:gh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Is(4194308,4,Nh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Is(4194308,4,e,t)},useInsertionEffect:function(e,t){Is(4,2,e,t)},useMemo:function(e,t){var a=Lt();t=t===void 0?null:t;var r=e();if(zl){ha(!0);try{e()}finally{ha(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Lt();if(a!==void 0){var c=a(t);if(zl){ha(!0);try{a(t)}finally{ha(!1)}}}else c=t;return r.memoizedState=r.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},r.queue=e,e=e.dispatch=Ay.bind(null,Se,e),[r.memoizedState,e]},useRef:function(e){var t=Lt();return e={current:e},t.memoizedState=e},useState:function(e){e=du(e);var t=e.queue,a=_h.bind(null,Se,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:hu,useDeferredValue:function(e,t){var a=Lt();return pu(a,e,t)},useTransition:function(){var e=du(!1);return e=Ah.bind(null,Se,e.queue,!0,!1),Lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=Se,c=Lt();if(Re){if(a===void 0)throw Error(s(407));a=a()}else{if(a=t(),Ve===null)throw Error(s(349));(Te&127)!==0||nh(r,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,gh(rh.bind(null,r,d,e),[e]),r.flags|=2048,Ar(9,{destroy:void 0},lh.bind(null,r,d,a,t),null),a},useId:function(){var e=Lt(),t=Ve.identifierPrefix;if(Re){var a=Ya,r=Ka;a=(r&~(1<<32-jt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Vs++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Sy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:xu,useFormState:hh,useActionState:hh,useOptimistic:function(e){var t=Lt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=bu.bind(null,Se,!0,a),a.dispatch=t,[e,t]},useMemoCache:ou,useCacheRefresh:function(){return Lt().memoizedState=Ty.bind(null,Se)},useEffectEvent:function(e){var t=Lt(),a={impl:e};return t.memoizedState=a,function(){if((Be&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},gu={readContext:wt,use:Zs,useCallback:Mh,useContext:wt,useEffect:mu,useImperativeHandle:wh,useInsertionEffect:Sh,useLayoutEffect:jh,useMemo:Ch,useReducer:Js,useRef:bh,useState:function(){return Js(hn)},useDebugValue:hu,useDeferredValue:function(e,t){var a=ot();return Th(a,Pe.memoizedState,e,t)},useTransition:function(){var e=Js(hn)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:Ei(e),t]},useSyncExternalStore:ah,useId:Rh,useHostTransitionStatus:xu,useFormState:ph,useActionState:ph,useOptimistic:function(e,t){var a=ot();return oh(a,Pe,e,t)},useMemoCache:ou,useCacheRefresh:zh};gu.useEffectEvent=yh;var Lh={readContext:wt,use:Zs,useCallback:Mh,useContext:wt,useEffect:mu,useImperativeHandle:wh,useInsertionEffect:Sh,useLayoutEffect:jh,useMemo:Ch,useReducer:uu,useRef:bh,useState:function(){return uu(hn)},useDebugValue:hu,useDeferredValue:function(e,t){var a=ot();return Pe===null?pu(a,e,t):Th(a,Pe.memoizedState,e,t)},useTransition:function(){var e=uu(hn)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:Ei(e),t]},useSyncExternalStore:ah,useId:Rh,useHostTransitionStatus:xu,useFormState:xh,useActionState:xh,useOptimistic:function(e,t){var a=ot();return Pe!==null?oh(a,Pe,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:ou,useCacheRefresh:zh};Lh.useEffectEvent=yh;function yu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:g({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Su={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=ca(),c=Yn(r);c.payload=t,a!=null&&(c.callback=a),t=Pn(e,c,r),t!==null&&(Ft(t,e,r),Mi(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=ca(),c=Yn(r);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=Pn(e,c,r),t!==null&&(Ft(t,e,r),Mi(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=ca(),r=Yn(a);r.tag=2,t!=null&&(r.callback=t),t=Pn(e,r,a),t!==null&&(Ft(t,e,a),Mi(t,e,a))}};function Bh(e,t,a,r,c,d,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,d,m):t.prototype&&t.prototype.isPureReactComponent?!xi(a,r)||!xi(c,d):!0}function qh(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Su.enqueueReplaceState(t,t.state,null)}function _l(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=g({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}function Hh(e){zs(e)}function $h(e){console.error(e)}function Qh(e){zs(e)}function to(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Kh(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function ju(e,t,a){return a=Yn(a),a.tag=3,a.payload={element:null},a.callback=function(){to(e,t)},a}function Yh(e){return e=Yn(e),e.tag=3,e}function Ph(e,t,a,r){var c=a.type.getDerivedStateFromError;if(typeof c=="function"){var d=r.value;e.payload=function(){return c(d)},e.callback=function(){Kh(t,a,r)}}var m=a.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){Kh(t,a,r),typeof c!="function"&&(Jn===null?Jn=new Set([this]):Jn.add(this));var b=r.stack;this.componentDidCatch(r.value,{componentStack:b!==null?b:""})})}function Ey(e,t,a,r,c){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&yr(t,a,c,!0),a=ra.current,a!==null){switch(a.tag){case 31:case 13:return ja===null?ho():a.alternate===null&&nt===0&&(nt=3),a.flags&=-257,a.flags|=65536,a.lanes=c,r===Qs?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),Xu(e,r,c)),!1;case 22:return a.flags|=65536,r===Qs?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),Xu(e,r,c)),!1}throw Error(s(435,a.tag))}return Xu(e,r,c),ho(),!1}if(Re)return t=ra.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,r!==$c&&(e=Error(s(422),{cause:r}),yi(ba(e,a)))):(r!==$c&&(t=Error(s(423),{cause:r}),yi(ba(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,r=ba(r,a),c=ju(e.stateNode,r,c),Ic(e,c),nt!==4&&(nt=2)),!1;var d=Error(s(520),{cause:r});if(d=ba(d,a),qi===null?qi=[d]:qi.push(d),nt!==4&&(nt=2),t===null)return!0;r=ba(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=ju(a.stateNode,r,e),Ic(a,e),!1;case 1:if(t=a.type,d=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Jn===null||!Jn.has(d))))return a.flags|=65536,c&=-c,a.lanes|=c,c=Yh(c),Ph(c,e,a,r),Ic(a,c),!1}a=a.return}while(a!==null);return!1}var Nu=Error(s(461)),mt=!1;function Mt(e,t,a,r){t.child=e===null?Fm(t,null,a,r):Rl(t,e.child,a,r)}function Gh(e,t,a,r,c){a=a.render;var d=t.ref;if("ref"in r){var m={};for(var b in r)b!=="ref"&&(m[b]=r[b])}else m=r;return Tl(t),r=lu(e,t,a,m,d,c),b=ru(),e!==null&&!mt?(iu(e,t,c),pn(e,t,c)):(Re&&b&&qc(t),t.flags|=1,Mt(e,t,r,c),t.child)}function Xh(e,t,a,r,c){if(e===null){var d=a.type;return typeof d=="function"&&!Uc(d)&&d.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=d,Vh(e,t,d,r,c)):(e=Us(a.type,null,r,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Ru(e,c)){var m=d.memoizedProps;if(a=a.compare,a=a!==null?a:xi,a(m,r)&&e.ref===t.ref)return pn(e,t,c)}return t.flags|=1,e=cn(d,r),e.ref=t.ref,e.return=t,t.child=e}function Vh(e,t,a,r,c){if(e!==null){var d=e.memoizedProps;if(xi(d,r)&&e.ref===t.ref)if(mt=!1,t.pendingProps=r=d,Ru(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,pn(e,t,c)}return wu(e,t,a,r,c)}function Fh(e,t,a,r){var c=r.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|a:a,e!==null){for(r=t.child=e.child,c=0;r!==null;)c=c|r.lanes|r.childLanes,r=r.sibling;r=c&~d}else r=0,t.child=null;return Zh(e,t,d,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Hs(t,d!==null?d.cachePool:null),d!==null?Im(t,d):eu(),Wm(t);else return r=t.lanes=536870912,Zh(e,t,d!==null?d.baseLanes|a:a,a,r)}else d!==null?(Hs(t,d.cachePool),Im(t,d),Xn(),t.memoizedState=null):(e!==null&&Hs(t,null),eu(),Xn());return Mt(e,t,c,a),t.child}function zi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Zh(e,t,a,r,c){var d=Vc();return d=d===null?null:{parent:dt._currentValue,pool:d},t.memoizedState={baseLanes:a,cachePool:d},e!==null&&Hs(t,null),eu(),Wm(t),e!==null&&yr(e,t,r,!0),t.childLanes=c,null}function ao(e,t){return t=lo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Jh(e,t,a){return Rl(t,e.child,null,a),e=ao(t,t.pendingProps),e.flags|=2,ia(t),t.memoizedState=null,e}function ky(e,t,a){var r=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(r.mode==="hidden")return e=ao(t,r),t.lanes=536870912,zi(null,e);if(au(t),(e=Fe)?(e=cv(e,Sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qn!==null?{id:Ka,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},a=Om(e),a.return=t,t.child=a,Nt=t,Fe=null)):e=null,e===null)throw $n(t);return t.lanes=536870912,null}return ao(t,r)}var d=e.memoizedState;if(d!==null){var m=d.dehydrated;if(au(t),c)if(t.flags&256)t.flags&=-257,t=Jh(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(mt||yr(e,t,a,!1),c=(a&e.childLanes)!==0,mt||c){if(r=Ve,r!==null&&(m=re(r,a),m!==0&&m!==d.retryLane))throw d.retryLane=m,Nl(e,m),Ft(r,e,m),Nu;ho(),t=Jh(e,t,a)}else e=d.treeContext,Fe=Na(m.nextSibling),Nt=t,Re=!0,Hn=null,Sa=!1,e!==null&&Lm(t,e),t=ao(t,r),t.flags|=4096;return t}return e=cn(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function no(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function wu(e,t,a,r,c){return Tl(t),a=lu(e,t,a,r,void 0,c),r=ru(),e!==null&&!mt?(iu(e,t,c),pn(e,t,c)):(Re&&r&&qc(t),t.flags|=1,Mt(e,t,a,c),t.child)}function Ih(e,t,a,r,c,d){return Tl(t),t.updateQueue=null,a=th(t,r,a,c),eh(e),r=ru(),e!==null&&!mt?(iu(e,t,d),pn(e,t,d)):(Re&&r&&qc(t),t.flags|=1,Mt(e,t,a,d),t.child)}function Wh(e,t,a,r,c){if(Tl(t),t.stateNode===null){var d=vr,m=a.contextType;typeof m=="object"&&m!==null&&(d=wt(m)),d=new a(r,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Su,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=r,d.state=t.memoizedState,d.refs={},Zc(t),m=a.contextType,d.context=typeof m=="object"&&m!==null?wt(m):vr,d.state=t.memoizedState,m=a.getDerivedStateFromProps,typeof m=="function"&&(yu(t,a,m,r),d.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(m=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),m!==d.state&&Su.enqueueReplaceState(d,d.state,null),Ti(t,r,d,c),Ci(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){d=t.stateNode;var b=t.memoizedProps,w=_l(a,b);d.props=w;var D=d.context,Y=a.contextType;m=vr,typeof Y=="object"&&Y!==null&&(m=wt(Y));var V=a.getDerivedStateFromProps;Y=typeof V=="function"||typeof d.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b||D!==m)&&qh(t,d,r,m),Kn=!1;var U=t.memoizedState;d.state=U,Ti(t,r,d,c),Ci(),D=t.memoizedState,b||U!==D||Kn?(typeof V=="function"&&(yu(t,a,V,r),D=t.memoizedState),(w=Kn||Bh(t,a,w,r,U,D,m))?(Y||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=D),d.props=r,d.state=D,d.context=m,r=w):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{d=t.stateNode,Jc(e,t),m=t.memoizedProps,Y=_l(a,m),d.props=Y,V=t.pendingProps,U=d.context,D=a.contextType,w=vr,typeof D=="object"&&D!==null&&(w=wt(D)),b=a.getDerivedStateFromProps,(D=typeof b=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(m!==V||U!==w)&&qh(t,d,r,w),Kn=!1,U=t.memoizedState,d.state=U,Ti(t,r,d,c),Ci();var B=t.memoizedState;m!==V||U!==B||Kn||e!==null&&e.dependencies!==null&&Bs(e.dependencies)?(typeof b=="function"&&(yu(t,a,b,r),B=t.memoizedState),(Y=Kn||Bh(t,a,Y,r,U,B,w)||e!==null&&e.dependencies!==null&&Bs(e.dependencies))?(D||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(r,B,w),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(r,B,w)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=B),d.props=r,d.state=B,d.context=w,r=Y):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),r=!1)}return d=r,no(e,t),r=(t.flags&128)!==0,d||r?(d=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&r?(t.child=Rl(t,e.child,null,c),t.child=Rl(t,null,a,c)):Mt(e,t,a,c),t.memoizedState=d.state,e=t.child):e=pn(e,t,c),e}function ep(e,t,a,r){return Ml(),t.flags|=256,Mt(e,t,a,r),t.child}var Mu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cu(e){return{baseLanes:e,cachePool:Km()}}function Tu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=oa),e}function tp(e,t,a){var r=t.pendingProps,c=!1,d=(t.flags&128)!==0,m;if((m=d)||(m=e!==null&&e.memoizedState===null?!1:(st.current&2)!==0),m&&(c=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(c?Gn(t):Xn(),(e=Fe)?(e=cv(e,Sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qn!==null?{id:Ka,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},a=Om(e),a.return=t,t.child=a,Nt=t,Fe=null)):e=null,e===null)throw $n(t);return cd(e)?t.lanes=32:t.lanes=536870912,null}var b=r.children;return r=r.fallback,c?(Xn(),c=t.mode,b=lo({mode:"hidden",children:b},c),r=wl(r,c,a,null),b.return=t,r.return=t,b.sibling=r,t.child=b,r=t.child,r.memoizedState=Cu(a),r.childLanes=Tu(e,m,a),t.memoizedState=Mu,zi(null,r)):(Gn(t),Au(t,b))}var w=e.memoizedState;if(w!==null&&(b=w.dehydrated,b!==null)){if(d)t.flags&256?(Gn(t),t.flags&=-257,t=Eu(e,t,a)):t.memoizedState!==null?(Xn(),t.child=e.child,t.flags|=128,t=null):(Xn(),b=r.fallback,c=t.mode,r=lo({mode:"visible",children:r.children},c),b=wl(b,c,a,null),b.flags|=2,r.return=t,b.return=t,r.sibling=b,t.child=r,Rl(t,e.child,null,a),r=t.child,r.memoizedState=Cu(a),r.childLanes=Tu(e,m,a),t.memoizedState=Mu,t=zi(null,r));else if(Gn(t),cd(b)){if(m=b.nextSibling&&b.nextSibling.dataset,m)var D=m.dgst;m=D,r=Error(s(419)),r.stack="",r.digest=m,yi({value:r,source:null,stack:null}),t=Eu(e,t,a)}else if(mt||yr(e,t,a,!1),m=(a&e.childLanes)!==0,mt||m){if(m=Ve,m!==null&&(r=re(m,a),r!==0&&r!==w.retryLane))throw w.retryLane=r,Nl(e,r),Ft(m,e,r),Nu;od(b)||ho(),t=Eu(e,t,a)}else od(b)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,Fe=Na(b.nextSibling),Nt=t,Re=!0,Hn=null,Sa=!1,e!==null&&Lm(t,e),t=Au(t,r.children),t.flags|=4096);return t}return c?(Xn(),b=r.fallback,c=t.mode,w=e.child,D=w.sibling,r=cn(w,{mode:"hidden",children:r.children}),r.subtreeFlags=w.subtreeFlags&65011712,D!==null?b=cn(D,b):(b=wl(b,c,a,null),b.flags|=2),b.return=t,r.return=t,r.sibling=b,t.child=r,zi(null,r),r=t.child,b=e.child.memoizedState,b===null?b=Cu(a):(c=b.cachePool,c!==null?(w=dt._currentValue,c=c.parent!==w?{parent:w,pool:w}:c):c=Km(),b={baseLanes:b.baseLanes|a,cachePool:c}),r.memoizedState=b,r.childLanes=Tu(e,m,a),t.memoizedState=Mu,zi(e.child,r)):(Gn(t),a=e.child,e=a.sibling,a=cn(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=a,t.memoizedState=null,a)}function Au(e,t){return t=lo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function lo(e,t){return e=la(22,e,null,t),e.lanes=0,e}function Eu(e,t,a){return Rl(t,e.child,null,a),e=Au(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ap(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yc(e.return,t,a)}function ku(e,t,a,r,c,d){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:c,treeForkCount:d}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=r,m.tail=a,m.tailMode=c,m.treeForkCount=d)}function np(e,t,a){var r=t.pendingProps,c=r.revealOrder,d=r.tail;r=r.children;var m=st.current,b=(m&2)!==0;if(b?(m=m&1|2,t.flags|=128):m&=1,I(st,m),Mt(e,t,r,a),r=Re?gi:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ap(e,a,t);else if(e.tag===19)ap(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(a=t.child,c=null;a!==null;)e=a.alternate,e!==null&&Gs(e)===null&&(c=a),a=a.sibling;a=c,a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),ku(t,!1,c,a,d,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Gs(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}ku(t,!0,a,null,d,r);break;case"together":ku(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function pn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Zn|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(yr(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,a=cn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=cn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Ru(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Bs(e)))}function Ry(e,t,a){switch(t.tag){case 3:_e(t,t.stateNode.containerInfo),Qn(t,dt,e.memoizedState.cache),Ml();break;case 27:case 5:_t(t);break;case 4:_e(t,t.stateNode.containerInfo);break;case 10:Qn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,au(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Gn(t),t.flags|=128,null):(a&t.child.childLanes)!==0?tp(e,t,a):(Gn(t),e=pn(e,t,a),e!==null?e.sibling:null);Gn(t);break;case 19:var c=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(yr(e,t,a,!1),r=(a&t.childLanes)!==0),c){if(r)return np(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),I(st,st.current),r)break;return null;case 22:return t.lanes=0,Fh(e,t,a,t.pendingProps);case 24:Qn(t,dt,e.memoizedState.cache)}return pn(e,t,a)}function lp(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!Ru(e,a)&&(t.flags&128)===0)return mt=!1,Ry(e,t,a);mt=(e.flags&131072)!==0}else mt=!1,Re&&(t.flags&1048576)!==0&&Um(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=El(t.elementType),t.type=e,typeof e=="function")Uc(e)?(r=_l(e,r),t.tag=1,t=Wh(null,t,e,r,a)):(t.tag=0,t=wu(null,t,e,r,a));else{if(e!=null){var c=e.$$typeof;if(c===O){t.tag=11,t=Gh(null,t,e,r,a);break e}else if(c===H){t.tag=14,t=Xh(null,t,e,r,a);break e}}throw t=xe(e)||e,Error(s(306,t,""))}}return t;case 0:return wu(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,c=_l(r,t.pendingProps),Wh(e,t,r,c,a);case 3:e:{if(_e(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var d=t.memoizedState;c=d.element,Jc(e,t),Ti(t,r,null,a);var m=t.memoizedState;if(r=m.cache,Qn(t,dt,r),r!==d.cache&&Pc(t,[dt],a,!0),Ci(),r=m.element,d.isDehydrated)if(d={element:r,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=ep(e,t,r,a);break e}else if(r!==c){c=ba(Error(s(424)),t),yi(c),t=ep(e,t,r,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Fe=Na(e.firstChild),Nt=t,Re=!0,Hn=null,Sa=!0,a=Fm(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ml(),r===c){t=pn(e,t,a);break e}Mt(e,t,r,a)}t=t.child}return t;case 26:return no(e,t),e===null?(a=pv(t.type,null,t.pendingProps,null))?t.memoizedState=a:Re||(a=t.type,e=t.pendingProps,r=So(be.current).createElement(a),r[ke]=t,r[ut]=e,Ct(r,a,e),gt(r),t.stateNode=r):t.memoizedState=pv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _t(t),e===null&&Re&&(r=t.stateNode=fv(t.type,t.pendingProps,be.current),Nt=t,Sa=!0,c=Fe,tl(t.type)?(ud=c,Fe=Na(r.firstChild)):Fe=c),Mt(e,t,t.pendingProps.children,a),no(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((c=r=Fe)&&(r=s0(r,t.type,t.pendingProps,Sa),r!==null?(t.stateNode=r,Nt=t,Fe=Na(r.firstChild),Sa=!1,c=!0):c=!1),c||$n(t)),_t(t),c=t.type,d=t.pendingProps,m=e!==null?e.memoizedProps:null,r=d.children,rd(c,d)?r=null:m!==null&&rd(c,m)&&(t.flags|=32),t.memoizedState!==null&&(c=lu(e,t,jy,null,null,a),Xi._currentValue=c),no(e,t),Mt(e,t,r,a),t.child;case 6:return e===null&&Re&&((e=a=Fe)&&(a=o0(a,t.pendingProps,Sa),a!==null?(t.stateNode=a,Nt=t,Fe=null,e=!0):e=!1),e||$n(t)),null;case 13:return tp(e,t,a);case 4:return _e(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Rl(t,null,r,a):Mt(e,t,r,a),t.child;case 11:return Gh(e,t,t.type,t.pendingProps,a);case 7:return Mt(e,t,t.pendingProps,a),t.child;case 8:return Mt(e,t,t.pendingProps.children,a),t.child;case 12:return Mt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,Qn(t,t.type,r.value),Mt(e,t,r.children,a),t.child;case 9:return c=t.type._context,r=t.pendingProps.children,Tl(t),c=wt(c),r=r(c),t.flags|=1,Mt(e,t,r,a),t.child;case 14:return Xh(e,t,t.type,t.pendingProps,a);case 15:return Vh(e,t,t.type,t.pendingProps,a);case 19:return np(e,t,a);case 31:return ky(e,t,a);case 22:return Fh(e,t,a,t.pendingProps);case 24:return Tl(t),r=wt(dt),e===null?(c=Vc(),c===null&&(c=Ve,d=Gc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=a),c=d),t.memoizedState={parent:r,cache:c},Zc(t),Qn(t,dt,c)):((e.lanes&a)!==0&&(Jc(e,t),Ti(t,null,null,a),Ci()),c=e.memoizedState,d=t.memoizedState,c.parent!==r?(c={parent:r,cache:r},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Qn(t,dt,r)):(r=d.cache,Qn(t,dt,r),r!==c.cache&&Pc(t,[dt],a,!0))),Mt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function vn(e){e.flags|=4}function zu(e,t,a,r,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Rp())e.flags|=8192;else throw kl=Qs,Fc}else e.flags&=-16777217}function rp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!yv(t))if(Rp())e.flags|=8192;else throw kl=Qs,Fc}function ro(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ln():536870912,e.lanes|=t,zr|=t)}function _i(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var c=e.child;c!==null;)a|=c.lanes|c.childLanes,r|=c.subtreeFlags&65011712,r|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)a|=c.lanes|c.childLanes,r|=c.subtreeFlags,r|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function zy(e,t,a){var r=t.pendingProps;switch(Hc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return Ze(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),fn(dt),Ee(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(gr(t)?vn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qc())),Ze(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(vn(t),d!==null?(Ze(t),rp(t,d)):(Ze(t),zu(t,c,null,r,a))):d?d!==e.memoizedState?(vn(t),Ze(t),rp(t,d)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&vn(t),Ze(t),zu(t,c,e,r,a)),null;case 27:if(bt(t),a=be.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&vn(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}e=te.current,gr(t)?Bm(t):(e=fv(c,r,a),t.stateNode=e,vn(t))}return Ze(t),null;case 5:if(bt(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&vn(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}if(d=te.current,gr(t))Bm(t);else{var m=So(be.current);switch(d){case 1:d=m.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=m.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=m.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof r.is=="string"?m.createElement("select",{is:r.is}):m.createElement("select"),r.multiple?d.multiple=!0:r.size&&(d.size=r.size);break;default:d=typeof r.is=="string"?m.createElement(c,{is:r.is}):m.createElement(c)}}d[ke]=t,d[ut]=r;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)d.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=d;e:switch(Ct(d,c,r),c){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&vn(t)}}return Ze(t),zu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&vn(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(s(166));if(e=be.current,gr(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,c=Nt,c!==null)switch(c.tag){case 27:case 5:r=c.memoizedProps}e[ke]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||tv(e.nodeValue,a)),e||$n(t,!0)}else e=So(e).createTextNode(r),e[ke]=t,t.stateNode=e}return Ze(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=gr(t),a!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[ke]=t}else Ml(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else a=Qc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ia(t),t):(ia(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Ze(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=gr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!c)throw Error(s(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(s(317));c[ke]=t}else Ml(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),c=!1}else c=Qc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(ia(t),t):(ia(t),null)}return ia(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,c=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(c=r.alternate.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==c&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),ro(t,t.updateQueue),Ze(t),null);case 4:return Ee(),e===null&&ed(t.stateNode.containerInfo),Ze(t),null;case 10:return fn(t.type),Ze(t),null;case 19:if(P(st),r=t.memoizedState,r===null)return Ze(t),null;if(c=(t.flags&128)!==0,d=r.rendering,d===null)if(c)_i(r,!1);else{if(nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Gs(e),d!==null){for(t.flags|=128,_i(r,!1),e=d.updateQueue,t.updateQueue=e,ro(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)_m(a,e),a=a.sibling;return I(st,st.current&1|2),Re&&un(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ct()>uo&&(t.flags|=128,c=!0,_i(r,!1),t.lanes=4194304)}else{if(!c)if(e=Gs(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,ro(t,e),_i(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!Re)return Ze(t),null}else 2*ct()-r.renderingStartTime>uo&&a!==536870912&&(t.flags|=128,c=!0,_i(r,!1),t.lanes=4194304);r.isBackwards?(d.sibling=t.child,t.child=d):(e=r.last,e!==null?e.sibling=d:t.child=d,r.last=d)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ct(),e.sibling=null,a=st.current,I(st,c?a&1|2:a&1),Re&&un(t,r.treeForkCount),e):(Ze(t),null);case 22:case 23:return ia(t),tu(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),a=t.updateQueue,a!==null&&ro(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&P(Al),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),fn(dt),Ze(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function _y(e,t){switch(Hc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fn(dt),Ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return bt(t),null;case 31:if(t.memoizedState!==null){if(ia(t),t.alternate===null)throw Error(s(340));Ml()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ia(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Ml()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(st),null;case 4:return Ee(),null;case 10:return fn(t.type),null;case 22:case 23:return ia(t),tu(),e!==null&&P(Al),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fn(dt),null;case 25:return null;default:return null}}function ip(e,t){switch(Hc(t),t.tag){case 3:fn(dt),Ee();break;case 26:case 27:case 5:bt(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&ia(t);break;case 13:ia(t);break;case 19:P(st);break;case 10:fn(t.type);break;case 22:case 23:ia(t),tu(),e!==null&&P(Al);break;case 24:fn(dt)}}function Oi(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var c=r.next;a=c;do{if((a.tag&e)===e){r=void 0;var d=a.create,m=a.inst;r=d(),m.destroy=r}a=a.next}while(a!==c)}}catch(b){Ye(t,t.return,b)}}function Vn(e,t,a){try{var r=t.updateQueue,c=r!==null?r.lastEffect:null;if(c!==null){var d=c.next;r=d;do{if((r.tag&e)===e){var m=r.inst,b=m.destroy;if(b!==void 0){m.destroy=void 0,c=t;var w=a,D=b;try{D()}catch(Y){Ye(c,w,Y)}}}r=r.next}while(r!==d)}}catch(Y){Ye(t,t.return,Y)}}function sp(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Jm(t,a)}catch(r){Ye(e,e.return,r)}}}function op(e,t,a){a.props=_l(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Ye(e,t,r)}}function Di(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(c){Ye(e,t,c)}}function Pa(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(c){Ye(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Ye(e,t,c)}else a.current=null}function cp(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(c){Ye(e,e.return,c)}}function _u(e,t,a){try{var r=e.stateNode;t0(r,e.type,a,t),r[ut]=t}catch(c){Ye(e,e.return,c)}}function up(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tl(e.type)||e.tag===4}function Ou(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||up(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Du(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=sn));else if(r!==4&&(r===27&&tl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Du(e,t,a),e=e.sibling;e!==null;)Du(e,t,a),e=e.sibling}function io(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&tl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(io(e,t,a),e=e.sibling;e!==null;)io(e,t,a),e=e.sibling}function dp(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ct(t,r,a),t[ke]=e,t[ut]=a}catch(d){Ye(e,e.return,d)}}var xn=!1,ht=!1,Uu=!1,fp=typeof WeakSet=="function"?WeakSet:Set,yt=null;function Oy(e,t){if(e=e.containerInfo,nd=Ao,e=wm(e),Ec(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var c=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var m=0,b=-1,w=-1,D=0,Y=0,V=e,U=null;t:for(;;){for(var B;V!==a||c!==0&&V.nodeType!==3||(b=m+c),V!==d||r!==0&&V.nodeType!==3||(w=m+r),V.nodeType===3&&(m+=V.nodeValue.length),(B=V.firstChild)!==null;)U=V,V=B;for(;;){if(V===e)break t;if(U===a&&++D===c&&(b=m),U===d&&++Y===r&&(w=m),(B=V.nextSibling)!==null)break;V=U,U=V.parentNode}V=B}a=b===-1||w===-1?null:{start:b,end:w}}else a=null}a=a||{start:0,end:0}}else a=null;for(ld={focusedElem:e,selectionRange:a},Ao=!1,yt=t;yt!==null;)if(t=yt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,yt=e;else for(;yt!==null;){switch(t=yt,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)c=e[a],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,a=t,c=d.memoizedProps,d=d.memoizedState,r=a.stateNode;try{var se=_l(a.type,c);e=r.getSnapshotBeforeUpdate(se,d),r.__reactInternalSnapshotBeforeUpdate=e}catch(ve){Ye(a,a.return,ve)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)sd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":sd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,yt=e;break}yt=t.return}}function mp(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:gn(e,a),r&4&&Oi(5,a);break;case 1:if(gn(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(m){Ye(a,a.return,m)}else{var c=_l(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){Ye(a,a.return,m)}}r&64&&sp(a),r&512&&Di(a,a.return);break;case 3:if(gn(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Jm(e,t)}catch(m){Ye(a,a.return,m)}}break;case 27:t===null&&r&4&&dp(a);case 26:case 5:gn(e,a),t===null&&r&4&&cp(a),r&512&&Di(a,a.return);break;case 12:gn(e,a);break;case 31:gn(e,a),r&4&&vp(e,a);break;case 13:gn(e,a),r&4&&xp(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Ky.bind(null,a),c0(e,a))));break;case 22:if(r=a.memoizedState!==null||xn,!r){t=t!==null&&t.memoizedState!==null||ht,c=xn;var d=ht;xn=r,(ht=t)&&!d?yn(e,a,(a.subtreeFlags&8772)!==0):gn(e,a),xn=c,ht=d}break;case 30:break;default:gn(e,a)}}function hp(e){var t=e.alternate;t!==null&&(e.alternate=null,hp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&fc(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Je=null,Pt=!1;function bn(e,t,a){for(a=a.child;a!==null;)pp(e,t,a),a=a.sibling}function pp(e,t,a){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(He,a)}catch{}switch(a.tag){case 26:ht||Pa(a,t),bn(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ht||Pa(a,t);var r=Je,c=Pt;tl(a.type)&&(Je=a.stateNode,Pt=!1),bn(e,t,a),Yi(a.stateNode),Je=r,Pt=c;break;case 5:ht||Pa(a,t);case 6:if(r=Je,c=Pt,Je=null,bn(e,t,a),Je=r,Pt=c,Je!==null)if(Pt)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(a.stateNode)}catch(d){Ye(a,t,d)}else try{Je.removeChild(a.stateNode)}catch(d){Ye(a,t,d)}break;case 18:Je!==null&&(Pt?(e=Je,sv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Hr(e)):sv(Je,a.stateNode));break;case 4:r=Je,c=Pt,Je=a.stateNode.containerInfo,Pt=!0,bn(e,t,a),Je=r,Pt=c;break;case 0:case 11:case 14:case 15:Vn(2,a,t),ht||Vn(4,a,t),bn(e,t,a);break;case 1:ht||(Pa(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&op(a,t,r)),bn(e,t,a);break;case 21:bn(e,t,a);break;case 22:ht=(r=ht)||a.memoizedState!==null,bn(e,t,a),ht=r;break;default:bn(e,t,a)}}function vp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hr(e)}catch(a){Ye(t,t.return,a)}}}function xp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hr(e)}catch(a){Ye(t,t.return,a)}}function Dy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fp),t;default:throw Error(s(435,e.tag))}}function so(e,t){var a=Dy(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var c=Yy.bind(null,e,r);r.then(c,c)}})}function Gt(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var c=a[r],d=e,m=t,b=m;e:for(;b!==null;){switch(b.tag){case 27:if(tl(b.type)){Je=b.stateNode,Pt=!1;break e}break;case 5:Je=b.stateNode,Pt=!1;break e;case 3:case 4:Je=b.stateNode.containerInfo,Pt=!0;break e}b=b.return}if(Je===null)throw Error(s(160));pp(d,m,c),Je=null,Pt=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bp(t,e),t=t.sibling}var Ra=null;function bp(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Gt(t,e),Xt(e),r&4&&(Vn(3,e,e.return),Oi(3,e),Vn(5,e,e.return));break;case 1:Gt(t,e),Xt(e),r&512&&(ht||a===null||Pa(a,a.return)),r&64&&xn&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var c=Ra;if(Gt(t,e),Xt(e),r&512&&(ht||a===null||Pa(a,a.return)),r&4){var d=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,c=c.ownerDocument||c;t:switch(r){case"title":d=c.getElementsByTagName("title")[0],(!d||d[oi]||d[ke]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(r),c.head.insertBefore(d,c.querySelector("head > title"))),Ct(d,r,a),d[ke]=e,gt(d),r=d;break e;case"link":var m=bv("link","href",c).get(r+(a.href||""));if(m){for(var b=0;b<m.length;b++)if(d=m[b],d.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&d.getAttribute("rel")===(a.rel==null?null:a.rel)&&d.getAttribute("title")===(a.title==null?null:a.title)&&d.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){m.splice(b,1);break t}}d=c.createElement(r),Ct(d,r,a),c.head.appendChild(d);break;case"meta":if(m=bv("meta","content",c).get(r+(a.content||""))){for(b=0;b<m.length;b++)if(d=m[b],d.getAttribute("content")===(a.content==null?null:""+a.content)&&d.getAttribute("name")===(a.name==null?null:a.name)&&d.getAttribute("property")===(a.property==null?null:a.property)&&d.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&d.getAttribute("charset")===(a.charSet==null?null:a.charSet)){m.splice(b,1);break t}}d=c.createElement(r),Ct(d,r,a),c.head.appendChild(d);break;default:throw Error(s(468,r))}d[ke]=e,gt(d),r=d}e.stateNode=r}else gv(c,e.type,e.stateNode);else e.stateNode=xv(c,r,e.memoizedProps);else d!==r?(d===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):d.count--,r===null?gv(c,e.type,e.stateNode):xv(c,r,e.memoizedProps)):r===null&&e.stateNode!==null&&_u(e,e.memoizedProps,a.memoizedProps)}break;case 27:Gt(t,e),Xt(e),r&512&&(ht||a===null||Pa(a,a.return)),a!==null&&r&4&&_u(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Gt(t,e),Xt(e),r&512&&(ht||a===null||Pa(a,a.return)),e.flags&32){c=e.stateNode;try{cr(c,"")}catch(se){Ye(e,e.return,se)}}r&4&&e.stateNode!=null&&(c=e.memoizedProps,_u(e,c,a!==null?a.memoizedProps:c)),r&1024&&(Uu=!0);break;case 6:if(Gt(t,e),Xt(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(se){Ye(e,e.return,se)}}break;case 3:if(wo=null,c=Ra,Ra=jo(t.containerInfo),Gt(t,e),Ra=c,Xt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{Hr(t.containerInfo)}catch(se){Ye(e,e.return,se)}Uu&&(Uu=!1,gp(e));break;case 4:r=Ra,Ra=jo(e.stateNode.containerInfo),Gt(t,e),Xt(e),Ra=r;break;case 12:Gt(t,e),Xt(e);break;case 31:Gt(t,e),Xt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,so(e,r)));break;case 13:Gt(t,e),Xt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(co=ct()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,so(e,r)));break;case 22:c=e.memoizedState!==null;var w=a!==null&&a.memoizedState!==null,D=xn,Y=ht;if(xn=D||c,ht=Y||w,Gt(t,e),ht=Y,xn=D,Xt(e),r&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(a===null||w||xn||ht||Ol(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){w=a=t;try{if(d=w.stateNode,c)m=d.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{b=w.stateNode;var V=w.memoizedProps.style,U=V!=null&&V.hasOwnProperty("display")?V.display:null;b.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(se){Ye(w,w.return,se)}}}else if(t.tag===6){if(a===null){w=t;try{w.stateNode.nodeValue=c?"":w.memoizedProps}catch(se){Ye(w,w.return,se)}}}else if(t.tag===18){if(a===null){w=t;try{var B=w.stateNode;c?ov(B,!0):ov(w.stateNode,!1)}catch(se){Ye(w,w.return,se)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,so(e,a))));break;case 19:Gt(t,e),Xt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,so(e,r)));break;case 30:break;case 21:break;default:Gt(t,e),Xt(e)}}function Xt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(up(r)){a=r;break}r=r.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var c=a.stateNode,d=Ou(e);io(e,d,c);break;case 5:var m=a.stateNode;a.flags&32&&(cr(m,""),a.flags&=-33);var b=Ou(e);io(e,b,m);break;case 3:case 4:var w=a.stateNode.containerInfo,D=Ou(e);Du(e,D,w);break;default:throw Error(s(161))}}catch(Y){Ye(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function gn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)mp(e,t.alternate,t),t=t.sibling}function Ol(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Vn(4,t,t.return),Ol(t);break;case 1:Pa(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&op(t,t.return,a),Ol(t);break;case 27:Yi(t.stateNode);case 26:case 5:Pa(t,t.return),Ol(t);break;case 22:t.memoizedState===null&&Ol(t);break;case 30:Ol(t);break;default:Ol(t)}e=e.sibling}}function yn(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,c=e,d=t,m=d.flags;switch(d.tag){case 0:case 11:case 15:yn(c,d,a),Oi(4,d);break;case 1:if(yn(c,d,a),r=d,c=r.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(D){Ye(r,r.return,D)}if(r=d,c=r.updateQueue,c!==null){var b=r.stateNode;try{var w=c.shared.hiddenCallbacks;if(w!==null)for(c.shared.hiddenCallbacks=null,c=0;c<w.length;c++)Zm(w[c],b)}catch(D){Ye(r,r.return,D)}}a&&m&64&&sp(d),Di(d,d.return);break;case 27:dp(d);case 26:case 5:yn(c,d,a),a&&r===null&&m&4&&cp(d),Di(d,d.return);break;case 12:yn(c,d,a);break;case 31:yn(c,d,a),a&&m&4&&vp(c,d);break;case 13:yn(c,d,a),a&&m&4&&xp(c,d);break;case 22:d.memoizedState===null&&yn(c,d,a),Di(d,d.return);break;case 30:break;default:yn(c,d,a)}t=t.sibling}}function Lu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Si(a))}function Bu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Si(e))}function za(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)yp(e,t,a,r),t=t.sibling}function yp(e,t,a,r){var c=t.flags;switch(t.tag){case 0:case 11:case 15:za(e,t,a,r),c&2048&&Oi(9,t);break;case 1:za(e,t,a,r);break;case 3:za(e,t,a,r),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Si(e)));break;case 12:if(c&2048){za(e,t,a,r),e=t.stateNode;try{var d=t.memoizedProps,m=d.id,b=d.onPostCommit;typeof b=="function"&&b(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(w){Ye(t,t.return,w)}}else za(e,t,a,r);break;case 31:za(e,t,a,r);break;case 13:za(e,t,a,r);break;case 23:break;case 22:d=t.stateNode,m=t.alternate,t.memoizedState!==null?d._visibility&2?za(e,t,a,r):Ui(e,t):d._visibility&2?za(e,t,a,r):(d._visibility|=2,Er(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Lu(m,t);break;case 24:za(e,t,a,r),c&2048&&Bu(t.alternate,t);break;default:za(e,t,a,r)}}function Er(e,t,a,r,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,m=t,b=a,w=r,D=m.flags;switch(m.tag){case 0:case 11:case 15:Er(d,m,b,w,c),Oi(8,m);break;case 23:break;case 22:var Y=m.stateNode;m.memoizedState!==null?Y._visibility&2?Er(d,m,b,w,c):Ui(d,m):(Y._visibility|=2,Er(d,m,b,w,c)),c&&D&2048&&Lu(m.alternate,m);break;case 24:Er(d,m,b,w,c),c&&D&2048&&Bu(m.alternate,m);break;default:Er(d,m,b,w,c)}t=t.sibling}}function Ui(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,c=r.flags;switch(r.tag){case 22:Ui(a,r),c&2048&&Lu(r.alternate,r);break;case 24:Ui(a,r),c&2048&&Bu(r.alternate,r);break;default:Ui(a,r)}t=t.sibling}}var Li=8192;function kr(e,t,a){if(e.subtreeFlags&Li)for(e=e.child;e!==null;)Sp(e,t,a),e=e.sibling}function Sp(e,t,a){switch(e.tag){case 26:kr(e,t,a),e.flags&Li&&e.memoizedState!==null&&S0(a,Ra,e.memoizedState,e.memoizedProps);break;case 5:kr(e,t,a);break;case 3:case 4:var r=Ra;Ra=jo(e.stateNode.containerInfo),kr(e,t,a),Ra=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Li,Li=16777216,kr(e,t,a),Li=r):kr(e,t,a));break;default:kr(e,t,a)}}function jp(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];yt=r,wp(r,e)}jp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Np(e),e=e.sibling}function Np(e){switch(e.tag){case 0:case 11:case 15:Bi(e),e.flags&2048&&Vn(9,e,e.return);break;case 3:Bi(e);break;case 12:Bi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,oo(e)):Bi(e);break;default:Bi(e)}}function oo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];yt=r,wp(r,e)}jp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Vn(8,t,t.return),oo(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,oo(t));break;default:oo(t)}e=e.sibling}}function wp(e,t){for(;yt!==null;){var a=yt;switch(a.tag){case 0:case 11:case 15:Vn(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Si(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,yt=r;else e:for(a=e;yt!==null;){r=yt;var c=r.sibling,d=r.return;if(hp(r),r===a){yt=null;break e}if(c!==null){c.return=d,yt=c;break e}yt=d}}}var Uy={getCacheForType:function(e){var t=wt(dt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return wt(dt).controller.signal}},Ly=typeof WeakMap=="function"?WeakMap:Map,Be=0,Ve=null,Me=null,Te=0,Ke=0,sa=null,Fn=!1,Rr=!1,qu=!1,Sn=0,nt=0,Zn=0,Dl=0,Hu=0,oa=0,zr=0,qi=null,Vt=null,$u=!1,co=0,Mp=0,uo=1/0,fo=null,Jn=null,pt=0,In=null,_r=null,jn=0,Qu=0,Ku=null,Cp=null,Hi=0,Yu=null;function ca(){return(Be&2)!==0&&Te!==0?Te&-Te:R.T!==null?Zu():Qa()}function Tp(){if(oa===0)if((Te&536870912)===0||Re){var e=qa;qa<<=1,(qa&3932160)===0&&(qa=262144),oa=e}else oa=536870912;return e=ra.current,e!==null&&(e.flags|=32),oa}function Ft(e,t,a){(e===Ve&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(Or(e,0),Wn(e,Te,oa,!1)),oe(e,a),((Be&2)===0||e!==Ve)&&(e===Ve&&((Be&2)===0&&(Dl|=a),nt===4&&Wn(e,Te,oa,!1)),Ga(e))}function Ap(e,t,a){if((Be&6)!==0)throw Error(s(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ea(e,t),c=r?Hy(e,t):Gu(e,t,!0),d=r;do{if(c===0){Rr&&!r&&Wn(e,t,0,!1);break}else{if(a=e.current.alternate,d&&!By(a)){c=Gu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var b=e;c=qi;var w=b.current.memoizedState.isDehydrated;if(w&&(Or(b,m).flags|=256),m=Gu(b,m,!1),m!==2){if(qu&&!w){b.errorRecoveryDisabledLanes|=d,Dl|=d,c=4;break e}d=Vt,Vt=c,d!==null&&(Vt===null?Vt=d:Vt.push.apply(Vt,d))}c=m}if(d=!1,c!==2)continue}}if(c===1){Or(e,0),Wn(e,t,0,!0);break}e:{switch(r=e,d=c,d){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:Wn(r,t,oa,!Fn);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(c=co+300-ct(),10<c)){if(Wn(r,t,oa,!Fn),$a(r,0,!0)!==0)break e;jn=t,r.timeoutHandle=rv(Ep.bind(null,r,a,Vt,fo,$u,t,oa,Dl,zr,Fn,d,"Throttled",-0,0),c);break e}Ep(r,a,Vt,fo,$u,t,oa,Dl,zr,Fn,d,null,-0,0)}}break}while(!0);Ga(e)}function Ep(e,t,a,r,c,d,m,b,w,D,Y,V,U,B){if(e.timeoutHandle=-1,V=t.subtreeFlags,V&8192||(V&16785408)===16785408){V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sn},Sp(t,d,V);var se=(d&62914560)===d?co-ct():(d&4194048)===d?Mp-ct():0;if(se=j0(V,se),se!==null){jn=d,e.cancelPendingCommit=se(Lp.bind(null,e,t,d,a,r,c,m,b,w,Y,V,null,U,B)),Wn(e,d,m,!D);return}}Lp(e,t,d,a,r,c,m,b,w)}function By(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var c=a[r],d=c.getSnapshot;c=c.value;try{if(!na(d(),c))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Wn(e,t,a,r){t&=~Hu,t&=~Dl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var c=t;0<c;){var d=31-jt(c),m=1<<d;r[d]=-1,c&=~m}a!==0&&Et(e,a,t)}function mo(){return(Be&6)===0?($i(0),!1):!0}function Pu(){if(Me!==null){if(Ke===0)var e=Me.return;else e=Me,dn=Cl=null,su(e),wr=null,Ni=0,e=Me;for(;e!==null;)ip(e.alternate,e),e=e.return;Me=null}}function Or(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,l0(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),jn=0,Pu(),Ve=e,Me=a=cn(e.current,null),Te=t,Ke=0,sa=null,Fn=!1,Rr=Ea(e,t),qu=!1,zr=oa=Hu=Dl=Zn=nt=0,Vt=qi=null,$u=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var c=31-jt(r),d=1<<c;t|=e[c],r&=~d}return Sn=t,_s(),a}function kp(e,t){Se=null,R.H=Ri,t===Nr||t===$s?(t=Gm(),Ke=3):t===Fc?(t=Gm(),Ke=4):Ke=t===Nu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,sa=t,Me===null&&(nt=1,to(e,ba(t,e.current)))}function Rp(){var e=ra.current;return e===null?!0:(Te&4194048)===Te?ja===null:(Te&62914560)===Te||(Te&536870912)!==0?e===ja:!1}function zp(){var e=R.H;return R.H=Ri,e===null?Ri:e}function _p(){var e=R.A;return R.A=Uy,e}function ho(){nt=4,Fn||(Te&4194048)!==Te&&ra.current!==null||(Rr=!0),(Zn&134217727)===0&&(Dl&134217727)===0||Ve===null||Wn(Ve,Te,oa,!1)}function Gu(e,t,a){var r=Be;Be|=2;var c=zp(),d=_p();(Ve!==e||Te!==t)&&(fo=null,Or(e,t)),t=!1;var m=nt;e:do try{if(Ke!==0&&Me!==null){var b=Me,w=sa;switch(Ke){case 8:Pu(),m=6;break e;case 3:case 2:case 9:case 6:ra.current===null&&(t=!0);var D=Ke;if(Ke=0,sa=null,Dr(e,b,w,D),a&&Rr){m=0;break e}break;default:D=Ke,Ke=0,sa=null,Dr(e,b,w,D)}}qy(),m=nt;break}catch(Y){kp(e,Y)}while(!0);return t&&e.shellSuspendCounter++,dn=Cl=null,Be=r,R.H=c,R.A=d,Me===null&&(Ve=null,Te=0,_s()),m}function qy(){for(;Me!==null;)Op(Me)}function Hy(e,t){var a=Be;Be|=2;var r=zp(),c=_p();Ve!==e||Te!==t?(fo=null,uo=ct()+500,Or(e,t)):Rr=Ea(e,t);e:do try{if(Ke!==0&&Me!==null){t=Me;var d=sa;t:switch(Ke){case 1:Ke=0,sa=null,Dr(e,t,d,1);break;case 2:case 9:if(Ym(d)){Ke=0,sa=null,Dp(t);break}t=function(){Ke!==2&&Ke!==9||Ve!==e||(Ke=7),Ga(e)},d.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:Ym(d)?(Ke=0,sa=null,Dp(t)):(Ke=0,sa=null,Dr(e,t,d,7));break;case 5:var m=null;switch(Me.tag){case 26:m=Me.memoizedState;case 5:case 27:var b=Me;if(m?yv(m):b.stateNode.complete){Ke=0,sa=null;var w=b.sibling;if(w!==null)Me=w;else{var D=b.return;D!==null?(Me=D,po(D)):Me=null}break t}}Ke=0,sa=null,Dr(e,t,d,5);break;case 6:Ke=0,sa=null,Dr(e,t,d,6);break;case 8:Pu(),nt=6;break e;default:throw Error(s(462))}}$y();break}catch(Y){kp(e,Y)}while(!0);return dn=Cl=null,R.H=r,R.A=c,Be=a,Me!==null?0:(Ve=null,Te=0,_s(),nt)}function $y(){for(;Me!==null&&!ta();)Op(Me)}function Op(e){var t=lp(e.alternate,e,Sn);e.memoizedProps=e.pendingProps,t===null?po(e):Me=t}function Dp(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Ih(a,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Ih(a,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:su(t);default:ip(a,t),t=Me=_m(t,Sn),t=lp(a,t,Sn)}e.memoizedProps=e.pendingProps,t===null?po(e):Me=t}function Dr(e,t,a,r){dn=Cl=null,su(t),wr=null,Ni=0;var c=t.return;try{if(Ey(e,c,t,a,Te)){nt=1,to(e,ba(a,e.current)),Me=null;return}}catch(d){if(c!==null)throw Me=c,d;nt=1,to(e,ba(a,e.current)),Me=null;return}t.flags&32768?(Re||r===1?e=!0:Rr||(Te&536870912)!==0?e=!1:(Fn=e=!0,(r===2||r===9||r===3||r===6)&&(r=ra.current,r!==null&&r.tag===13&&(r.flags|=16384))),Up(t,e)):po(t)}function po(e){var t=e;do{if((t.flags&32768)!==0){Up(t,Fn);return}e=t.return;var a=zy(t.alternate,t,Sn);if(a!==null){Me=a;return}if(t=t.sibling,t!==null){Me=t;return}Me=t=e}while(t!==null);nt===0&&(nt=5)}function Up(e,t){do{var a=_y(e.alternate,e);if(a!==null){a.flags&=32767,Me=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Me=e;return}Me=e=a}while(e!==null);nt=6,Me=null}function Lp(e,t,a,r,c,d,m,b,w){e.cancelPendingCommit=null;do vo();while(pt!==0);if((Be&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(d=t.lanes|t.childLanes,d|=Oc,$e(e,a,d,m,b,w),e===Ve&&(Me=Ve=null,Te=0),_r=t,In=e,jn=a,Qu=d,Ku=c,Cp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Py(Aa,function(){return Qp(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=R.T,R.T=null,c=X.p,X.p=2,m=Be,Be|=4;try{Oy(e,t,a)}finally{Be=m,X.p=c,R.T=r}}pt=1,Bp(),qp(),Hp()}}function Bp(){if(pt===1){pt=0;var e=In,t=_r,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=R.T,R.T=null;var r=X.p;X.p=2;var c=Be;Be|=4;try{bp(t,e);var d=ld,m=wm(e.containerInfo),b=d.focusedElem,w=d.selectionRange;if(m!==b&&b&&b.ownerDocument&&Nm(b.ownerDocument.documentElement,b)){if(w!==null&&Ec(b)){var D=w.start,Y=w.end;if(Y===void 0&&(Y=D),"selectionStart"in b)b.selectionStart=D,b.selectionEnd=Math.min(Y,b.value.length);else{var V=b.ownerDocument||document,U=V&&V.defaultView||window;if(U.getSelection){var B=U.getSelection(),se=b.textContent.length,ve=Math.min(w.start,se),Xe=w.end===void 0?ve:Math.min(w.end,se);!B.extend&&ve>Xe&&(m=Xe,Xe=ve,ve=m);var k=jm(b,ve),A=jm(b,Xe);if(k&&A&&(B.rangeCount!==1||B.anchorNode!==k.node||B.anchorOffset!==k.offset||B.focusNode!==A.node||B.focusOffset!==A.offset)){var _=V.createRange();_.setStart(k.node,k.offset),B.removeAllRanges(),ve>Xe?(B.addRange(_),B.extend(A.node,A.offset)):(_.setEnd(A.node,A.offset),B.addRange(_))}}}}for(V=[],B=b;B=B.parentNode;)B.nodeType===1&&V.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<V.length;b++){var G=V[b];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}Ao=!!nd,ld=nd=null}finally{Be=c,X.p=r,R.T=a}}e.current=t,pt=2}}function qp(){if(pt===2){pt=0;var e=In,t=_r,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=R.T,R.T=null;var r=X.p;X.p=2;var c=Be;Be|=4;try{mp(e,t.alternate,t)}finally{Be=c,X.p=r,R.T=a}}pt=3}}function Hp(){if(pt===4||pt===3){pt=0,tn();var e=In,t=_r,a=jn,r=Cp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pt=5:(pt=0,_r=In=null,$p(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Jn=null),tt(a),t=t.stateNode,We&&typeof We.onCommitFiberRoot=="function")try{We.onCommitFiberRoot(He,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=R.T,c=X.p,X.p=2,R.T=null;try{for(var d=e.onRecoverableError,m=0;m<r.length;m++){var b=r[m];d(b.value,{componentStack:b.stack})}}finally{R.T=t,X.p=c}}(jn&3)!==0&&vo(),Ga(e),c=e.pendingLanes,(a&261930)!==0&&(c&42)!==0?e===Yu?Hi++:(Hi=0,Yu=e):Hi=0,$i(0)}}function $p(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Si(t)))}function vo(){return Bp(),qp(),Hp(),Qp()}function Qp(){if(pt!==5)return!1;var e=In,t=Qu;Qu=0;var a=tt(jn),r=R.T,c=X.p;try{X.p=32>a?32:a,R.T=null,a=Ku,Ku=null;var d=In,m=jn;if(pt=0,_r=In=null,jn=0,(Be&6)!==0)throw Error(s(331));var b=Be;if(Be|=4,Np(d.current),yp(d,d.current,m,a),Be=b,$i(0,!1),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(He,d)}catch{}return!0}finally{X.p=c,R.T=r,$p(e,t)}}function Kp(e,t,a){t=ba(a,t),t=ju(e.stateNode,t,2),e=Pn(e,t,2),e!==null&&(oe(e,2),Ga(e))}function Ye(e,t,a){if(e.tag===3)Kp(e,e,a);else for(;t!==null;){if(t.tag===3){Kp(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Jn===null||!Jn.has(r))){e=ba(a,e),a=Yh(2),r=Pn(t,a,2),r!==null&&(Ph(a,r,t,e),oe(r,2),Ga(r));break}}t=t.return}}function Xu(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Ly;var c=new Set;r.set(t,c)}else c=r.get(t),c===void 0&&(c=new Set,r.set(t,c));c.has(a)||(qu=!0,c.add(a),e=Qy.bind(null,e,t,a),t.then(e,e))}function Qy(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ve===e&&(Te&a)===a&&(nt===4||nt===3&&(Te&62914560)===Te&&300>ct()-co?(Be&2)===0&&Or(e,0):Hu|=a,zr===Te&&(zr=0)),Ga(e)}function Yp(e,t){t===0&&(t=Ln()),e=Nl(e,t),e!==null&&(oe(e,t),Ga(e))}function Ky(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Yp(e,a)}function Yy(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,c=e.memoizedState;c!==null&&(a=c.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Yp(e,a)}function Py(e,t){return Ta(e,t)}var xo=null,Ur=null,Vu=!1,bo=!1,Fu=!1,el=0;function Ga(e){e!==Ur&&e.next===null&&(Ur===null?xo=Ur=e:Ur=Ur.next=e),bo=!0,Vu||(Vu=!0,Xy())}function $i(e,t){if(!Fu&&bo){Fu=!0;do for(var a=!1,r=xo;r!==null;){if(e!==0){var c=r.pendingLanes;if(c===0)var d=0;else{var m=r.suspendedLanes,b=r.pingedLanes;d=(1<<31-jt(42|e)+1)-1,d&=c&~(m&~b),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,Vp(r,d))}else d=Te,d=$a(r,r===Ve?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||Ea(r,d)||(a=!0,Vp(r,d));r=r.next}while(a);Fu=!1}}function Gy(){Pp()}function Pp(){bo=Vu=!1;var e=0;el!==0&&n0()&&(e=el);for(var t=ct(),a=null,r=xo;r!==null;){var c=r.next,d=Gp(r,t);d===0?(r.next=null,a===null?xo=c:a.next=c,c===null&&(Ur=a)):(a=r,(e!==0||(d&3)!==0)&&(bo=!0)),r=c}pt!==0&&pt!==5||$i(e),el!==0&&(el=0)}function Gp(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var m=31-jt(d),b=1<<m,w=c[m];w===-1?((b&a)===0||(b&r)!==0)&&(c[m]=bl(b,t)):w<=t&&(e.expiredLanes|=b),d&=~b}if(t=Ve,a=Te,a=$a(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ut(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ea(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Ut(r),tt(a)){case 2:case 8:a=Ua;break;case 32:a=Aa;break;case 268435456:a=nn;break;default:a=Aa}return r=Xp.bind(null,e),a=Ta(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Ut(r),e.callbackPriority=2,e.callbackNode=null,2}function Xp(e,t){if(pt!==0&&pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(vo()&&e.callbackNode!==a)return null;var r=Te;return r=$a(e,e===Ve?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Ap(e,r,t),Gp(e,ct()),e.callbackNode!=null&&e.callbackNode===a?Xp.bind(null,e):null)}function Vp(e,t){if(vo())return null;Ap(e,t,!0)}function Xy(){r0(function(){(Be&6)!==0?Ta(an,Gy):Pp()})}function Zu(){if(el===0){var e=Sr;e===0&&(e=Ba,Ba<<=1,(Ba&261888)===0&&(Ba=256)),el=e}return el}function Fp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ms(""+e)}function Zp(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Vy(e,t,a,r,c){if(t==="submit"&&a&&a.stateNode===c){var d=Fp((c[ut]||null).action),m=r.submitter;m&&(t=(t=m[ut]||null)?Fp(t.formAction):m.getAttribute("formAction"),t!==null&&(d=t,m=null));var b=new Es("action","action",null,r,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(el!==0){var w=m?Zp(c,m):new FormData(c);vu(a,{pending:!0,data:w,method:c.method,action:d},null,w)}}else typeof d=="function"&&(b.preventDefault(),w=m?Zp(c,m):new FormData(c),vu(a,{pending:!0,data:w,method:c.method,action:d},d,w))},currentTarget:c}]})}}for(var Ju=0;Ju<_c.length;Ju++){var Iu=_c[Ju],Fy=Iu.toLowerCase(),Zy=Iu[0].toUpperCase()+Iu.slice(1);ka(Fy,"on"+Zy)}ka(Tm,"onAnimationEnd"),ka(Am,"onAnimationIteration"),ka(Em,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(fy,"onTransitionRun"),ka(my,"onTransitionStart"),ka(hy,"onTransitionCancel"),ka(km,"onTransitionEnd"),sr("onMouseEnter",["mouseout","mouseover"]),sr("onMouseLeave",["mouseout","mouseover"]),sr("onPointerEnter",["pointerout","pointerover"]),sr("onPointerLeave",["pointerout","pointerover"]),gl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gl("onBeforeInput",["compositionend","keypress","textInput","paste"]),gl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qi="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(" "),Jy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qi));function Jp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],c=r.event;r=r.listeners;e:{var d=void 0;if(t)for(var m=r.length-1;0<=m;m--){var b=r[m],w=b.instance,D=b.currentTarget;if(b=b.listener,w!==d&&c.isPropagationStopped())break e;d=b,c.currentTarget=D;try{d(c)}catch(Y){zs(Y)}c.currentTarget=null,d=w}else for(m=0;m<r.length;m++){if(b=r[m],w=b.instance,D=b.currentTarget,b=b.listener,w!==d&&c.isPropagationStopped())break e;d=b,c.currentTarget=D;try{d(c)}catch(Y){zs(Y)}c.currentTarget=null,d=w}}}}function Ce(e,t){var a=t[dc];a===void 0&&(a=t[dc]=new Set);var r=e+"__bubble";a.has(r)||(Ip(t,e,2,!1),a.add(r))}function Wu(e,t,a){var r=0;t&&(r|=4),Ip(a,e,r,t)}var go="_reactListening"+Math.random().toString(36).slice(2);function ed(e){if(!e[go]){e[go]=!0,Pf.forEach(function(a){a!=="selectionchange"&&(Jy.has(a)||Wu(a,!1,e),Wu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[go]||(t[go]=!0,Wu("selectionchange",!1,t))}}function Ip(e,t,a,r){switch(Tv(t)){case 2:var c=M0;break;case 8:c=C0;break;default:c=pd}a=c.bind(null,t,a,e),c=void 0,!yc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),r?c!==void 0?e.addEventListener(t,a,{capture:!0,passive:c}):e.addEventListener(t,a,!0):c!==void 0?e.addEventListener(t,a,{passive:c}):e.addEventListener(t,a,!1)}function td(e,t,a,r,c){var d=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var m=r.tag;if(m===3||m===4){var b=r.stateNode.containerInfo;if(b===c)break;if(m===4)for(m=r.return;m!==null;){var w=m.tag;if((w===3||w===4)&&m.stateNode.containerInfo===c)return;m=m.return}for(;b!==null;){if(m=lr(b),m===null)return;if(w=m.tag,w===5||w===6||w===26||w===27){r=d=m;continue e}b=b.parentNode}}r=r.return}nm(function(){var D=d,Y=bc(a),V=[];e:{var U=Rm.get(e);if(U!==void 0){var B=Es,se=e;switch(e){case"keypress":if(Ts(a)===0)break e;case"keydown":case"keyup":B=Yg;break;case"focusin":se="focus",B=wc;break;case"focusout":se="blur",B=wc;break;case"beforeblur":case"afterblur":B=wc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":B=im;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":B=zg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":B=Xg;break;case Tm:case Am:case Em:B=Dg;break;case km:B=Fg;break;case"scroll":case"scrollend":B=kg;break;case"wheel":B=Jg;break;case"copy":case"cut":case"paste":B=Lg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":B=om;break;case"toggle":case"beforetoggle":B=Wg}var ve=(t&4)!==0,Xe=!ve&&(e==="scroll"||e==="scrollend"),k=ve?U!==null?U+"Capture":null:U;ve=[];for(var A=D,_;A!==null;){var G=A;if(_=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||_===null||k===null||(G=ui(A,k),G!=null&&ve.push(Ki(A,G,_))),Xe)break;A=A.return}0<ve.length&&(U=new B(U,se,null,a,Y),V.push({event:U,listeners:ve}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",B=e==="mouseout"||e==="pointerout",U&&a!==xc&&(se=a.relatedTarget||a.fromElement)&&(lr(se)||se[nr]))break e;if((B||U)&&(U=Y.window===Y?Y:(U=Y.ownerDocument)?U.defaultView||U.parentWindow:window,B?(se=a.relatedTarget||a.toElement,B=D,se=se?lr(se):null,se!==null&&(Xe=f(se),ve=se.tag,se!==Xe||ve!==5&&ve!==27&&ve!==6)&&(se=null)):(B=null,se=D),B!==se)){if(ve=im,G="onMouseLeave",k="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(ve=om,G="onPointerLeave",k="onPointerEnter",A="pointer"),Xe=B==null?U:ci(B),_=se==null?U:ci(se),U=new ve(G,A+"leave",B,a,Y),U.target=Xe,U.relatedTarget=_,G=null,lr(Y)===D&&(ve=new ve(k,A+"enter",se,a,Y),ve.target=_,ve.relatedTarget=Xe,G=ve),Xe=G,B&&se)t:{for(ve=Iy,k=B,A=se,_=0,G=k;G;G=ve(G))_++;G=0;for(var he=A;he;he=ve(he))G++;for(;0<_-G;)k=ve(k),_--;for(;0<G-_;)A=ve(A),G--;for(;_--;){if(k===A||A!==null&&k===A.alternate){ve=k;break t}k=ve(k),A=ve(A)}ve=null}else ve=null;B!==null&&Wp(V,U,B,ve,!1),se!==null&&Xe!==null&&Wp(V,Xe,se,ve,!0)}}e:{if(U=D?ci(D):window,B=U.nodeName&&U.nodeName.toLowerCase(),B==="select"||B==="input"&&U.type==="file")var Ue=vm;else if(hm(U))if(xm)Ue=cy;else{Ue=sy;var ce=iy}else B=U.nodeName,!B||B.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?D&&vc(D.elementType)&&(Ue=vm):Ue=oy;if(Ue&&(Ue=Ue(e,D))){pm(V,Ue,a,Y);break e}ce&&ce(e,U,D),e==="focusout"&&D&&U.type==="number"&&D.memoizedProps.value!=null&&pc(U,"number",U.value)}switch(ce=D?ci(D):window,e){case"focusin":(hm(ce)||ce.contentEditable==="true")&&(mr=ce,kc=D,bi=null);break;case"focusout":bi=kc=mr=null;break;case"mousedown":Rc=!0;break;case"contextmenu":case"mouseup":case"dragend":Rc=!1,Mm(V,a,Y);break;case"selectionchange":if(dy)break;case"keydown":case"keyup":Mm(V,a,Y)}var je;if(Cc)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else fr?fm(e,a)&&(Ae="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ae="onCompositionStart");Ae&&(cm&&a.locale!=="ko"&&(fr||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&fr&&(je=lm()):(Bn=Y,Sc="value"in Bn?Bn.value:Bn.textContent,fr=!0)),ce=yo(D,Ae),0<ce.length&&(Ae=new sm(Ae,e,null,a,Y),V.push({event:Ae,listeners:ce}),je?Ae.data=je:(je=mm(a),je!==null&&(Ae.data=je)))),(je=ty?ay(e,a):ny(e,a))&&(Ae=yo(D,"onBeforeInput"),0<Ae.length&&(ce=new sm("onBeforeInput","beforeinput",null,a,Y),V.push({event:ce,listeners:Ae}),ce.data=je)),Vy(V,e,D,a,Y)}Jp(V,t)})}function Ki(e,t,a){return{instance:e,listener:t,currentTarget:a}}function yo(e,t){for(var a=t+"Capture",r=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=ui(e,a),c!=null&&r.unshift(Ki(e,c,d)),c=ui(e,t),c!=null&&r.push(Ki(e,c,d))),e.tag===3)return r;e=e.return}return[]}function Iy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Wp(e,t,a,r,c){for(var d=t._reactName,m=[];a!==null&&a!==r;){var b=a,w=b.alternate,D=b.stateNode;if(b=b.tag,w!==null&&w===r)break;b!==5&&b!==26&&b!==27||D===null||(w=D,c?(D=ui(a,d),D!=null&&m.unshift(Ki(a,D,w))):c||(D=ui(a,d),D!=null&&m.push(Ki(a,D,w)))),a=a.return}m.length!==0&&e.push({event:t,listeners:m})}var Wy=/\r\n?/g,e0=/\u0000|\uFFFD/g;function ev(e){return(typeof e=="string"?e:""+e).replace(Wy,`
|
|
49
|
-
`).replace(e0,"")}function tv(e,t){return t=ev(t),ev(e)===t}function Ge(e,t,a,r,c,d){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||cr(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&cr(e,""+r);break;case"className":Ns(e,"class",r);break;case"tabIndex":Ns(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Ns(e,a,r);break;case"style":tm(e,r,d);break;case"data":if(t!=="object"){Ns(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Ms(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(a==="formAction"?(t!=="input"&&Ge(e,t,"name",c.name,c,null),Ge(e,t,"formEncType",c.formEncType,c,null),Ge(e,t,"formMethod",c.formMethod,c,null),Ge(e,t,"formTarget",c.formTarget,c,null)):(Ge(e,t,"encType",c.encType,c,null),Ge(e,t,"method",c.method,c,null),Ge(e,t,"target",c.target,c,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Ms(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=sn);break;case"onScroll":r!=null&&Ce("scroll",e);break;case"onScrollEnd":r!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(s(61));if(a=r.__html,a!=null){if(c.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Ms(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),js(e,"popover",r);break;case"xlinkActuate":rn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":rn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":rn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":rn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":rn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":rn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":rn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":rn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":rn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":js(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Ag.get(a)||a,js(e,a,r))}}function ad(e,t,a,r,c,d){switch(a){case"style":tm(e,r,d);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(s(61));if(a=r.__html,a!=null){if(c.children!=null)throw Error(s(60));e.innerHTML=a}}break;case"children":typeof r=="string"?cr(e,r):(typeof r=="number"||typeof r=="bigint")&&cr(e,""+r);break;case"onScroll":r!=null&&Ce("scroll",e);break;case"onScrollEnd":r!=null&&Ce("scrollend",e);break;case"onClick":r!=null&&(e.onclick=sn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Gf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(c=a.endsWith("Capture"),t=a.slice(2,c?a.length-7:void 0),d=e[ut]||null,d=d!=null?d[a]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof r=="function")){typeof d!="function"&&d!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,c);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):js(e,a,r)}}}function Ct(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var r=!1,c=!1,d;for(d in a)if(a.hasOwnProperty(d)){var m=a[d];if(m!=null)switch(d){case"src":r=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ge(e,t,d,m,a,null)}}c&&Ge(e,t,"srcSet",a.srcSet,a,null),r&&Ge(e,t,"src",a.src,a,null);return;case"input":Ce("invalid",e);var b=d=m=c=null,w=null,D=null;for(r in a)if(a.hasOwnProperty(r)){var Y=a[r];if(Y!=null)switch(r){case"name":c=Y;break;case"type":m=Y;break;case"checked":w=Y;break;case"defaultChecked":D=Y;break;case"value":d=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,t));break;default:Ge(e,t,r,Y,a,null)}}Jf(e,d,b,w,D,m,c,!1);return;case"select":Ce("invalid",e),r=m=d=null;for(c in a)if(a.hasOwnProperty(c)&&(b=a[c],b!=null))switch(c){case"value":d=b;break;case"defaultValue":m=b;break;case"multiple":r=b;default:Ge(e,t,c,b,a,null)}t=d,a=m,e.multiple=!!r,t!=null?or(e,!!r,t,!1):a!=null&&or(e,!!r,a,!0);return;case"textarea":Ce("invalid",e),d=c=r=null;for(m in a)if(a.hasOwnProperty(m)&&(b=a[m],b!=null))switch(m){case"value":r=b;break;case"defaultValue":c=b;break;case"children":d=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(s(91));break;default:Ge(e,t,m,b,a,null)}Wf(e,r,c,d);return;case"option":for(w in a)if(a.hasOwnProperty(w)&&(r=a[w],r!=null))switch(w){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Ge(e,t,w,r,a,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(r=0;r<Qi.length;r++)Ce(Qi[r],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(D in a)if(a.hasOwnProperty(D)&&(r=a[D],r!=null))switch(D){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ge(e,t,D,r,a,null)}return;default:if(vc(t)){for(Y in a)a.hasOwnProperty(Y)&&(r=a[Y],r!==void 0&&ad(e,t,Y,r,a,void 0));return}}for(b in a)a.hasOwnProperty(b)&&(r=a[b],r!=null&&Ge(e,t,b,r,a,null))}function t0(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,m=null,b=null,w=null,D=null,Y=null;for(B in a){var V=a[B];if(a.hasOwnProperty(B)&&V!=null)switch(B){case"checked":break;case"value":break;case"defaultValue":w=V;default:r.hasOwnProperty(B)||Ge(e,t,B,null,r,V)}}for(var U in r){var B=r[U];if(V=a[U],r.hasOwnProperty(U)&&(B!=null||V!=null))switch(U){case"type":d=B;break;case"name":c=B;break;case"checked":D=B;break;case"defaultChecked":Y=B;break;case"value":m=B;break;case"defaultValue":b=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(s(137,t));break;default:B!==V&&Ge(e,t,U,B,r,V)}}hc(e,m,b,w,D,Y,d,c);return;case"select":B=m=b=U=null;for(d in a)if(w=a[d],a.hasOwnProperty(d)&&w!=null)switch(d){case"value":break;case"multiple":B=w;default:r.hasOwnProperty(d)||Ge(e,t,d,null,r,w)}for(c in r)if(d=r[c],w=a[c],r.hasOwnProperty(c)&&(d!=null||w!=null))switch(c){case"value":U=d;break;case"defaultValue":b=d;break;case"multiple":m=d;default:d!==w&&Ge(e,t,c,d,r,w)}t=b,a=m,r=B,U!=null?or(e,!!a,U,!1):!!r!=!!a&&(t!=null?or(e,!!a,t,!0):or(e,!!a,a?[]:"",!1));return;case"textarea":B=U=null;for(b in a)if(c=a[b],a.hasOwnProperty(b)&&c!=null&&!r.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Ge(e,t,b,null,r,c)}for(m in r)if(c=r[m],d=a[m],r.hasOwnProperty(m)&&(c!=null||d!=null))switch(m){case"value":U=c;break;case"defaultValue":B=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(s(91));break;default:c!==d&&Ge(e,t,m,c,r,d)}If(e,U,B);return;case"option":for(var se in a)if(U=a[se],a.hasOwnProperty(se)&&U!=null&&!r.hasOwnProperty(se))switch(se){case"selected":e.selected=!1;break;default:Ge(e,t,se,null,r,U)}for(w in r)if(U=r[w],B=a[w],r.hasOwnProperty(w)&&U!==B&&(U!=null||B!=null))switch(w){case"selected":e.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Ge(e,t,w,U,r,B)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ve in a)U=a[ve],a.hasOwnProperty(ve)&&U!=null&&!r.hasOwnProperty(ve)&&Ge(e,t,ve,null,r,U);for(D in r)if(U=r[D],B=a[D],r.hasOwnProperty(D)&&U!==B&&(U!=null||B!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(s(137,t));break;default:Ge(e,t,D,U,r,B)}return;default:if(vc(t)){for(var Xe in a)U=a[Xe],a.hasOwnProperty(Xe)&&U!==void 0&&!r.hasOwnProperty(Xe)&&ad(e,t,Xe,void 0,r,U);for(Y in r)U=r[Y],B=a[Y],!r.hasOwnProperty(Y)||U===B||U===void 0&&B===void 0||ad(e,t,Y,U,r,B);return}}for(var k in a)U=a[k],a.hasOwnProperty(k)&&U!=null&&!r.hasOwnProperty(k)&&Ge(e,t,k,null,r,U);for(V in r)U=r[V],B=a[V],!r.hasOwnProperty(V)||U===B||U==null&&B==null||Ge(e,t,V,U,r,B)}function av(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function a0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var c=a[r],d=c.transferSize,m=c.initiatorType,b=c.duration;if(d&&b&&av(m)){for(m=0,b=c.responseEnd,r+=1;r<a.length;r++){var w=a[r],D=w.startTime;if(D>b)break;var Y=w.transferSize,V=w.initiatorType;Y&&av(V)&&(w=w.responseEnd,m+=Y*(w<b?1:(b-D)/(w-D)))}if(--r,t+=8*(d+m)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var nd=null,ld=null;function So(e){return e.nodeType===9?e:e.ownerDocument}function nv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function rd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var id=null;function n0(){var e=window.event;return e&&e.type==="popstate"?e===id?!1:(id=e,!0):(id=null,!1)}var rv=typeof setTimeout=="function"?setTimeout:void 0,l0=typeof clearTimeout=="function"?clearTimeout:void 0,iv=typeof Promise=="function"?Promise:void 0,r0=typeof queueMicrotask=="function"?queueMicrotask:typeof iv<"u"?function(e){return iv.resolve(null).then(e).catch(i0)}:rv;function i0(e){setTimeout(function(){throw e})}function tl(e){return e==="head"}function sv(e,t){var a=t,r=0;do{var c=a.nextSibling;if(e.removeChild(a),c&&c.nodeType===8)if(a=c.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(c),Hr(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")Yi(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Yi(a);for(var d=a.firstChild;d;){var m=d.nextSibling,b=d.nodeName;d[oi]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&d.rel.toLowerCase()==="stylesheet"||a.removeChild(d),d=m}}else a==="body"&&Yi(e.ownerDocument.body);a=c}while(a);Hr(t)}function ov(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function sd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":sd(a),fc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function s0(e,t,a,r){for(;e.nodeType===1;){var c=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[oi])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Na(e.nextSibling),e===null)break}return null}function o0(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Na(e.nextSibling),e===null))return null;return e}function cv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Na(e.nextSibling),e===null))return null;return e}function od(e){return e.data==="$?"||e.data==="$~"}function cd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function c0(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Na(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var ud=null;function uv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Na(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function dv(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function fv(e,t,a){switch(t=So(a),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function Yi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);fc(e)}var wa=new Map,mv=new Set;function jo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Nn=X.d;X.d={f:u0,r:d0,D:f0,C:m0,L:h0,m:p0,X:x0,S:v0,M:b0};function u0(){var e=Nn.f(),t=mo();return e||t}function d0(e){var t=rr(e);t!==null&&t.tag===5&&t.type==="form"?kh(t):Nn.r(e)}var Lr=typeof document>"u"?null:document;function hv(e,t,a){var r=Lr;if(r&&typeof t=="string"&&t){var c=va(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),mv.has(c)||(mv.add(c),e={rel:e,crossOrigin:a,href:t},r.querySelector(c)===null&&(t=r.createElement("link"),Ct(t,"link",e),gt(t),r.head.appendChild(t)))}}function f0(e){Nn.D(e),hv("dns-prefetch",e,null)}function m0(e,t){Nn.C(e,t),hv("preconnect",e,t)}function h0(e,t,a){Nn.L(e,t,a);var r=Lr;if(r&&e&&t){var c='link[rel="preload"][as="'+va(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+va(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+va(a.imageSizes)+'"]')):c+='[href="'+va(e)+'"]';var d=c;switch(t){case"style":d=Br(e);break;case"script":d=qr(e)}wa.has(d)||(e=g({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),wa.set(d,e),r.querySelector(c)!==null||t==="style"&&r.querySelector(Pi(d))||t==="script"&&r.querySelector(Gi(d))||(t=r.createElement("link"),Ct(t,"link",e),gt(t),r.head.appendChild(t)))}}function p0(e,t){Nn.m(e,t);var a=Lr;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+va(r)+'"][href="'+va(e)+'"]',d=c;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=qr(e)}if(!wa.has(d)&&(e=g({rel:"modulepreload",href:e},t),wa.set(d,e),a.querySelector(c)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Gi(d)))return}r=a.createElement("link"),Ct(r,"link",e),gt(r),a.head.appendChild(r)}}}function v0(e,t,a){Nn.S(e,t,a);var r=Lr;if(r&&e){var c=ir(r).hoistableStyles,d=Br(e);t=t||"default";var m=c.get(d);if(!m){var b={loading:0,preload:null};if(m=r.querySelector(Pi(d)))b.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},a),(a=wa.get(d))&&dd(e,a);var w=m=r.createElement("link");gt(w),Ct(w,"link",e),w._p=new Promise(function(D,Y){w.onload=D,w.onerror=Y}),w.addEventListener("load",function(){b.loading|=1}),w.addEventListener("error",function(){b.loading|=2}),b.loading|=4,No(m,t,r)}m={type:"stylesheet",instance:m,count:1,state:b},c.set(d,m)}}}function x0(e,t){Nn.X(e,t);var a=Lr;if(a&&e){var r=ir(a).hoistableScripts,c=qr(e),d=r.get(c);d||(d=a.querySelector(Gi(c)),d||(e=g({src:e,async:!0},t),(t=wa.get(c))&&fd(e,t),d=a.createElement("script"),gt(d),Ct(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function b0(e,t){Nn.M(e,t);var a=Lr;if(a&&e){var r=ir(a).hoistableScripts,c=qr(e),d=r.get(c);d||(d=a.querySelector(Gi(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=wa.get(c))&&fd(e,t),d=a.createElement("script"),gt(d),Ct(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function pv(e,t,a,r){var c=(c=be.current)?jo(c):null;if(!c)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Br(a.href),a=ir(c).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Br(a.href);var d=ir(c).hoistableStyles,m=d.get(e);if(m||(c=c.ownerDocument||c,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,m),(d=c.querySelector(Pi(e)))&&!d._p&&(m.instance=d,m.state.loading=5),wa.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},wa.set(e,a),d||g0(c,e,a,m.state))),t&&r===null)throw Error(s(528,""));return m}if(t&&r!==null)throw Error(s(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=qr(a),a=ir(c).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Br(e){return'href="'+va(e)+'"'}function Pi(e){return'link[rel="stylesheet"]['+e+"]"}function vv(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function g0(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Ct(t,"link",a),gt(t),e.head.appendChild(t))}function qr(e){return'[src="'+va(e)+'"]'}function Gi(e){return"script[async]"+e}function xv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+va(a.href)+'"]');if(r)return t.instance=r,gt(r),r;var c=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),gt(r),Ct(r,"style",c),No(r,a.precedence,e),t.instance=r;case"stylesheet":c=Br(a.href);var d=e.querySelector(Pi(c));if(d)return t.state.loading|=4,t.instance=d,gt(d),d;r=vv(a),(c=wa.get(c))&&dd(r,c),d=(e.ownerDocument||e).createElement("link"),gt(d);var m=d;return m._p=new Promise(function(b,w){m.onload=b,m.onerror=w}),Ct(d,"link",r),t.state.loading|=4,No(d,a.precedence,e),t.instance=d;case"script":return d=qr(a.src),(c=e.querySelector(Gi(d)))?(t.instance=c,gt(c),c):(r=a,(c=wa.get(d))&&(r=g({},a),fd(r,c)),e=e.ownerDocument||e,c=e.createElement("script"),gt(c),Ct(c,"link",r),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,No(r,a.precedence,e));return t.instance}function No(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=r.length?r[r.length-1]:null,d=c,m=0;m<r.length;m++){var b=r[m];if(b.dataset.precedence===t)d=b;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function dd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function fd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var wo=null;function bv(e,t,a){if(wo===null){var r=new Map,c=wo=new Map;c.set(a,r)}else c=wo,r=c.get(a),r||(r=new Map,c.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),c=0;c<a.length;c++){var d=a[c];if(!(d[oi]||d[ke]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var m=d.getAttribute(t)||"";m=e+m;var b=r.get(m);b?b.push(d):r.set(m,[d])}}return r}function gv(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function y0(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function yv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function S0(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=Br(r.href),d=t.querySelector(Pi(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Mo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=d,gt(d);return}d=t.ownerDocument||t,r=vv(r),(c=wa.get(c))&&dd(r,c),d=d.createElement("link"),gt(d);var m=d;m._p=new Promise(function(b,w){m.onload=b,m.onerror=w}),Ct(d,"link",r),a.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Mo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var md=0;function j0(e,t){return e.stylesheets&&e.count===0&&To(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&To(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&md===0&&(md=62500*a0());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&To(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>md?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(c)}}:null}function Mo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)To(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Co=null;function To(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Co=new Map,t.forEach(N0,e),Co=null,Mo.call(e))}function N0(e,t){if(!(t.state.loading&4)){var a=Co.get(e);if(a)var r=a.get(null);else{a=new Map,Co.set(e,a);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var m=c[d];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(a.set(m.dataset.precedence,m),r=m)}r&&a.set(null,r)}c=t.instance,m=c.getAttribute("data-precedence"),d=a.get(m)||r,d===r&&a.set(null,c),a.set(m,c),this.count++,r=Mo.bind(this),c.addEventListener("load",r),c.addEventListener("error",r),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Xi={$$typeof:q,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function w0(e,t,a,r,c,d,m,b,w){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ln(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ln(0),this.hiddenUpdates=ln(null),this.identifierPrefix=r,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function Sv(e,t,a,r,c,d,m,b,w,D,Y,V){return e=new w0(e,t,a,m,w,D,Y,V,b),t=1,d===!0&&(t|=24),d=la(3,null,null,t),e.current=d,d.stateNode=e,t=Gc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:r,isDehydrated:a,cache:t},Zc(d),e}function jv(e){return e?(e=vr,e):vr}function Nv(e,t,a,r,c,d){c=jv(c),r.context===null?r.context=c:r.pendingContext=c,r=Yn(t),r.payload={element:a},d=d===void 0?null:d,d!==null&&(r.callback=d),a=Pn(e,r,t),a!==null&&(Ft(a,e,t),Mi(a,e,t))}function wv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function hd(e,t){wv(e,t),(e=e.alternate)&&wv(e,t)}function Mv(e){if(e.tag===13||e.tag===31){var t=Nl(e,67108864);t!==null&&Ft(t,e,67108864),hd(e,67108864)}}function Cv(e){if(e.tag===13||e.tag===31){var t=ca();t=we(t);var a=Nl(e,t);a!==null&&Ft(a,e,t),hd(e,t)}}var Ao=!0;function M0(e,t,a,r){var c=R.T;R.T=null;var d=X.p;try{X.p=2,pd(e,t,a,r)}finally{X.p=d,R.T=c}}function C0(e,t,a,r){var c=R.T;R.T=null;var d=X.p;try{X.p=8,pd(e,t,a,r)}finally{X.p=d,R.T=c}}function pd(e,t,a,r){if(Ao){var c=vd(r);if(c===null)td(e,t,r,Eo,a),Av(e,r);else if(A0(c,e,t,a,r))r.stopPropagation();else if(Av(e,r),t&4&&-1<T0.indexOf(e)){for(;c!==null;){var d=rr(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var m=aa(d.pendingLanes);if(m!==0){var b=d;for(b.pendingLanes|=2,b.entangledLanes|=2;m;){var w=1<<31-jt(m);b.entanglements[1]|=w,m&=~w}Ga(d),(Be&6)===0&&(uo=ct()+500,$i(0))}}break;case 31:case 13:b=Nl(d,2),b!==null&&Ft(b,d,2),mo(),hd(d,2)}if(d=vd(r),d===null&&td(e,t,r,Eo,a),d===c)break;c=d}c!==null&&r.stopPropagation()}else td(e,t,r,null,a)}}function vd(e){return e=bc(e),xd(e)}var Eo=null;function xd(e){if(Eo=null,e=lr(e),e!==null){var t=f(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===31){if(e=v(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Eo=e,null}function Tv(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_n()){case an:return 2;case Ua:return 8;case Aa:case On:return 32;case nn:return 268435456;default:return 32}default:return 32}}var bd=!1,al=null,nl=null,ll=null,Vi=new Map,Fi=new Map,rl=[],T0="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".split(" ");function Av(e,t){switch(e){case"focusin":case"focusout":al=null;break;case"dragenter":case"dragleave":nl=null;break;case"mouseover":case"mouseout":ll=null;break;case"pointerover":case"pointerout":Vi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fi.delete(t.pointerId)}}function Zi(e,t,a,r,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:d,targetContainers:[c]},t!==null&&(t=rr(t),t!==null&&Mv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function A0(e,t,a,r,c){switch(t){case"focusin":return al=Zi(al,e,t,a,r,c),!0;case"dragenter":return nl=Zi(nl,e,t,a,r,c),!0;case"mouseover":return ll=Zi(ll,e,t,a,r,c),!0;case"pointerover":var d=c.pointerId;return Vi.set(d,Zi(Vi.get(d)||null,e,t,a,r,c)),!0;case"gotpointercapture":return d=c.pointerId,Fi.set(d,Zi(Fi.get(d)||null,e,t,a,r,c)),!0}return!1}function Ev(e){var t=lr(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,ar(e.priority,function(){Cv(a)});return}}else if(t===31){if(t=v(a),t!==null){e.blockedOn=t,ar(e.priority,function(){Cv(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ko(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=vd(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);xc=r,a.target.dispatchEvent(r),xc=null}else return t=rr(a),t!==null&&Mv(t),e.blockedOn=a,!1;t.shift()}return!0}function kv(e,t,a){ko(e)&&a.delete(t)}function E0(){bd=!1,al!==null&&ko(al)&&(al=null),nl!==null&&ko(nl)&&(nl=null),ll!==null&&ko(ll)&&(ll=null),Vi.forEach(kv),Fi.forEach(kv)}function Ro(e,t){e.blockedOn===t&&(e.blockedOn=null,bd||(bd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,E0)))}var zo=null;function Rv(e){zo!==e&&(zo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){zo===e&&(zo=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],c=e[t+2];if(typeof r!="function"){if(xd(r||a)===null)continue;break}var d=rr(a);d!==null&&(e.splice(t,3),t-=3,vu(d,{pending:!0,data:c,method:a.method,action:r},r,c))}}))}function Hr(e){function t(w){return Ro(w,e)}al!==null&&Ro(al,e),nl!==null&&Ro(nl,e),ll!==null&&Ro(ll,e),Vi.forEach(t),Fi.forEach(t);for(var a=0;a<rl.length;a++){var r=rl[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<rl.length&&(a=rl[0],a.blockedOn===null);)Ev(a),a.blockedOn===null&&rl.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var c=a[r],d=a[r+1],m=c[ut]||null;if(typeof d=="function")m||Rv(a);else if(m){var b=null;if(d&&d.hasAttribute("formAction")){if(c=d,m=d[ut]||null)b=m.formAction;else if(xd(c)!==null)continue}else b=m.action;typeof b=="function"?a[r+1]=b:(a.splice(r,3),r-=3),Rv(a)}}}function zv(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(m){return c=m})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function gd(e){this._internalRoot=e}_o.prototype.render=gd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var a=t.current,r=ca();Nv(a,r,e,t,null,null)},_o.prototype.unmount=gd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nv(e.current,2,null,e,null,null),mo(),t[nr]=null}};function _o(e){this._internalRoot=e}_o.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qa();e={blockedOn:null,target:e,priority:t};for(var a=0;a<rl.length&&t!==0&&t<rl[a].priority;a++);rl.splice(a,0,e),a===0&&Ev(e)}};var _v=l.version;if(_v!=="19.2.7")throw Error(s(527,_v,"19.2.7"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=x(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var k0={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oo.isDisabled&&Oo.supportsFiber)try{He=Oo.inject(k0),We=Oo}catch{}}return Ii.createRoot=function(e,t){if(!u(e))throw Error(s(299));var a=!1,r="",c=Hh,d=$h,m=Qh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=Sv(e,1,!1,null,null,a,r,null,c,d,m,zv),e[nr]=t.current,ed(e),new gd(t)},Ii.hydrateRoot=function(e,t,a){if(!u(e))throw Error(s(299));var r=!1,c="",d=Hh,m=$h,b=Qh,w=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(d=a.onUncaughtError),a.onCaughtError!==void 0&&(m=a.onCaughtError),a.onRecoverableError!==void 0&&(b=a.onRecoverableError),a.formState!==void 0&&(w=a.formState)),t=Sv(e,1,!0,t,a??null,r,c,w,d,m,b,zv),t.context=jv(null),a=t.current,r=ca(),r=we(r),c=Yn(r),c.callback=null,Pn(a,c,r),a=r,t.current.lanes=a,oe(t,a),Ga(t),e[nr]=t.current,ed(e),new _o(t)},Ii.version="19.2.7",Ii}var Yv;function $0(){if(Yv)return wd.exports;Yv=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),wd.exports=H0(),wd.exports}var Q0=$0();/**
|
|
50
|
-
* react-router v7.17.0
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Remix Software Inc.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
-
*
|
|
57
|
-
* @license MIT
|
|
58
|
-
*/var Pv="popstate";function Gv(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function K0(n={}){function l(s,u){var x;let f=(x=u.state)==null?void 0:x.masked,{pathname:h,search:v,hash:p}=f||s.location;return Kd("",{pathname:h,search:v,hash:p},u.state&&u.state.usr||null,u.state&&u.state.key||"default",f?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function i(s,u){return typeof u=="string"?u:ss(u)}return P0(l,i,null,n)}function et(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Da(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function Y0(){return Math.random().toString(36).substring(2,10)}function Xv(n,l){return{usr:n.state,key:n.key,idx:l,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Kd(n,l,i=null,s,u){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?li(l):l,state:i,key:l&&l.key||s||Y0(),mask:u}}function ss({pathname:n="/",search:l="",hash:i=""}){return l&&l!=="?"&&(n+=l.charAt(0)==="?"?l:"?"+l),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function li(n){let l={};if(n){let i=n.indexOf("#");i>=0&&(l.hash=n.substring(i),n=n.substring(0,i));let s=n.indexOf("?");s>=0&&(l.search=n.substring(s),n=n.substring(0,s)),n&&(l.pathname=n)}return l}function P0(n,l,i,s={}){let{window:u=document.defaultView,v5Compat:f=!1}=s,h=u.history,v="POP",p=null,x=y();x==null&&(x=0,h.replaceState({...h.state,idx:x},""));function y(){return(h.state||{idx:null}).idx}function g(){v="POP";let L=y(),z=L==null?null:L-x;x=L,p&&p({action:v,location:E.location,delta:z})}function j(L,z){v="PUSH";let Q=Gv(L)?L:Kd(E.location,L,z);x=y()+1;let q=Xv(Q,x),O=E.createHref(Q.mask||Q);try{h.pushState(q,"",O)}catch(K){if(K instanceof DOMException&&K.name==="DataCloneError")throw K;u.location.assign(O)}f&&p&&p({action:v,location:E.location,delta:1})}function N(L,z){v="REPLACE";let Q=Gv(L)?L:Kd(E.location,L,z);x=y();let q=Xv(Q,x),O=E.createHref(Q.mask||Q);h.replaceState(q,"",O),f&&p&&p({action:v,location:E.location,delta:0})}function T(L){return G0(u,L)}let E={get action(){return v},get location(){return n(u,h)},listen(L){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(Pv,g),p=L,()=>{u.removeEventListener(Pv,g),p=null}},createHref(L){return l(u,L)},createURL:T,encodeLocation(L){let z=T(L);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:j,replace:N,go(L){return h.go(L)}};return E}function G0(n,l,i=!1){let s="http://localhost";n&&(s=n.location.origin!=="null"?n.location.origin:n.location.href),et(s,"No window.location.(origin|href) available to create URL");let u=typeof l=="string"?l:ss(l);return u=u.replace(/ $/,"%20"),!i&&u.startsWith("//")&&(u=s+u),new URL(u,s)}function Jx(n,l,i="/"){return X0(n,l,i,!1)}function X0(n,l,i,s,u){let f=typeof l=="string"?li(l):l,h=kn(f.pathname||"/",i);if(h==null)return null;let v=V0(n),p=null,x=i1(h);for(let y=0;p==null&&y<v.length;++y)p=l1(v[y],x,s);return p}function V0(n){let l=Ix(n);return F0(l),l}function Ix(n,l=[],i=[],s="",u=!1){let f=(h,v,p=u,x)=>{let y={relativePath:x===void 0?h.path||"":x,caseSensitive:h.caseSensitive===!0,childrenIndex:v,route:h};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&p)return;et(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let g=Oa([s,y.relativePath]),j=i.concat(y);h.children&&h.children.length>0&&(et(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Ix(h.children,l,j,g,p)),!(h.path==null&&!h.index)&&l.push({path:g,score:a1(g,h.index),routesMeta:j})};return n.forEach((h,v)=>{var p;if(h.path===""||!((p=h.path)!=null&&p.includes("?")))f(h,v);else for(let x of Wx(h.path))f(h,v,!0,x)}),l}function Wx(n){let l=n.split("/");if(l.length===0)return[];let[i,...s]=l,u=i.endsWith("?"),f=i.replace(/\?$/,"");if(s.length===0)return u?[f,""]:[f];let h=Wx(s.join("/")),v=[];return v.push(...h.map(p=>p===""?f:[f,p].join("/"))),u&&v.push(...h),v.map(p=>n.startsWith("/")&&p===""?"/":p)}function F0(n){n.sort((l,i)=>l.score!==i.score?i.score-l.score:n1(l.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var Z0=/^:[\w-]+$/,J0=3,I0=2,W0=1,e1=10,t1=-2,Vv=n=>n==="*";function a1(n,l){let i=n.split("/"),s=i.length;return i.some(Vv)&&(s+=t1),l&&(s+=I0),i.filter(u=>!Vv(u)).reduce((u,f)=>u+(Z0.test(f)?J0:f===""?W0:e1),s)}function n1(n,l){return n.length===l.length&&n.slice(0,-1).every((s,u)=>s===l[u])?n[n.length-1]-l[l.length-1]:0}function l1(n,l,i=!1){let{routesMeta:s}=n,u={},f="/",h=[];for(let v=0;v<s.length;++v){let p=s[v],x=v===s.length-1,y=f==="/"?l:l.slice(f.length)||"/",g=Go({path:p.relativePath,caseSensitive:p.caseSensitive,end:x},y),j=p.route;if(!g&&x&&i&&!s[s.length-1].route.index&&(g=Go({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},y)),!g)return null;Object.assign(u,g.params),h.push({params:u,pathname:Oa([f,g.pathname]),pathnameBase:u1(Oa([f,g.pathnameBase])),route:j}),g.pathnameBase!=="/"&&(f=Oa([f,g.pathnameBase]))}return h}function Go(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[i,s]=r1(n.path,n.caseSensitive,n.end),u=l.match(i);if(!u)return null;let f=u[0],h=f.replace(/(.)\/+$/,"$1"),v=u.slice(1);return{params:s.reduce((x,{paramName:y,isOptional:g},j)=>{if(y==="*"){let T=v[j]||"";h=f.slice(0,f.length-T.length).replace(/(.)\/+$/,"$1")}const N=v[j];return g&&!N?x[y]=void 0:x[y]=(N||"").replace(/%2F/g,"/"),x},{}),pathname:f,pathnameBase:h,pattern:n}}function r1(n,l=!1,i=!0){Da(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let s=[],u="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,v,p,x,y)=>{if(s.push({paramName:v,isOptional:p!=null}),p){let g=y.charAt(x+h.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(s.push({paramName:"*"}),u+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?u+="\\/*$":n!==""&&n!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,l?void 0:"i"),s]}function i1(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Da(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),n}}function kn(n,l){if(l==="/")return n;if(!n.toLowerCase().startsWith(l.toLowerCase()))return null;let i=l.endsWith("/")?l.length-1:l.length,s=n.charAt(i);return s&&s!=="/"?null:n.slice(i)||"/"}var s1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function o1(n,l="/"){let{pathname:i,search:s="",hash:u=""}=typeof n=="string"?li(n):n,f;return i?(i=tb(i),i.startsWith("/")?f=Fv(i.substring(1),"/"):f=Fv(i,l)):f=l,{pathname:f,search:d1(s),hash:f1(u)}}function Fv(n,l){let i=Xo(l).split("/");return n.split("/").forEach(u=>{u===".."?i.length>1&&i.pop():u!=="."&&i.push(u)}),i.length>1?i.join("/"):"/"}function Ad(n,l,i,s){return`Cannot include a '${n}' character in a manually specified \`to.${l}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function c1(n){return n.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function eb(n){let l=c1(n);return l.map((i,s)=>s===l.length-1?i.pathname:i.pathnameBase)}function bf(n,l,i,s=!1){let u;typeof n=="string"?u=li(n):(u={...n},et(!u.pathname||!u.pathname.includes("?"),Ad("?","pathname","search",u)),et(!u.pathname||!u.pathname.includes("#"),Ad("#","pathname","hash",u)),et(!u.search||!u.search.includes("#"),Ad("#","search","hash",u)));let f=n===""||u.pathname==="",h=f?"/":u.pathname,v;if(h==null)v=i;else{let g=l.length-1;if(!s&&h.startsWith("..")){let j=h.split("/");for(;j[0]==="..";)j.shift(),g-=1;u.pathname=j.join("/")}v=g>=0?l[g]:"/"}let p=o1(u,v),x=h&&h!=="/"&&h.endsWith("/"),y=(f||h===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(x||y)&&(p.pathname+="/"),p}var tb=n=>n.replace(/\/\/+/g,"/"),Oa=n=>tb(n.join("/")),Xo=n=>n.replace(/\/+$/,""),u1=n=>Xo(n).replace(/^\/*/,"/"),d1=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,f1=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,m1=class{constructor(n,l,i,s=!1){this.status=n,this.statusText=l||"",this.internal=s,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function h1(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function p1(n){let l=n.map(i=>i.route.path).filter(Boolean);return Oa(l)||"/"}var ab=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nb(n,l){let i=n;if(typeof i!="string"||!s1.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,u=!1;if(ab)try{let f=new URL(window.location.href),h=i.startsWith("//")?new URL(f.protocol+i):new URL(i),v=kn(h.pathname,l);h.origin===f.origin&&v!=null?i=v+h.search+h.hash:u=!0}catch{Da(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:u,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var lb=["POST","PUT","PATCH","DELETE"];new Set(lb);var v1=["GET",...lb];new Set(v1);var ri=S.createContext(null);ri.displayName="DataRouter";var tc=S.createContext(null);tc.displayName="DataRouterState";var rb=S.createContext(!1);function x1(){return S.useContext(rb)}var ib=S.createContext({isTransitioning:!1});ib.displayName="ViewTransition";var b1=S.createContext(new Map);b1.displayName="Fetchers";var g1=S.createContext(null);g1.displayName="Await";var Ca=S.createContext(null);Ca.displayName="Navigation";var xs=S.createContext(null);xs.displayName="Location";var Rn=S.createContext({outlet:null,matches:[],isDataRoute:!1});Rn.displayName="Route";var gf=S.createContext(null);gf.displayName="RouteError";var sb="REACT_ROUTER_ERROR",y1="REDIRECT",S1="ROUTE_ERROR_RESPONSE";function j1(n){if(n.startsWith(`${sb}:${y1}:{`))try{let l=JSON.parse(n.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function N1(n){if(n.startsWith(`${sb}:${S1}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new m1(l.status,l.statusText,l.data)}catch{}}function w1(n,{relative:l}={}){et(bs(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:s}=S.useContext(Ca),{hash:u,pathname:f,search:h}=gs(n,{relative:l}),v=f;return i!=="/"&&(v=f==="/"?i:Oa([i,f])),s.createHref({pathname:v,search:h,hash:u})}function bs(){return S.useContext(xs)!=null}function Wa(){return et(bs(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(xs).location}var ob="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cb(n){S.useContext(Ca).static||S.useLayoutEffect(n)}function ub(){let{isDataRoute:n}=S.useContext(Rn);return n?L1():M1()}function M1(){et(bs(),"useNavigate() may be used only in the context of a <Router> component.");let n=S.useContext(ri),{basename:l,navigator:i}=S.useContext(Ca),{matches:s}=S.useContext(Rn),{pathname:u}=Wa(),f=JSON.stringify(eb(s)),h=S.useRef(!1);return cb(()=>{h.current=!0}),S.useCallback((p,x={})=>{if(Da(h.current,ob),!h.current)return;if(typeof p=="number"){i.go(p);return}let y=bf(p,JSON.parse(f),u,x.relative==="path");n==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:Oa([l,y.pathname])),(x.replace?i.replace:i.push)(y,x.state,x)},[l,i,f,u,n])}S.createContext(null);function gs(n,{relative:l}={}){let{matches:i}=S.useContext(Rn),{pathname:s}=Wa(),u=JSON.stringify(eb(i));return S.useMemo(()=>bf(n,JSON.parse(u),s,l==="path"),[n,u,s,l])}function C1(n,l){return db(n,l)}function db(n,l,i){var L;et(bs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=S.useContext(Ca),{matches:u}=S.useContext(Rn),f=u[u.length-1],h=f?f.params:{},v=f?f.pathname:"/",p=f?f.pathnameBase:"/",x=f&&f.route;{let z=x&&x.path||"";mb(v,!x||z.endsWith("*")||z.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${v}" (under <Route path="${z}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
-
|
|
60
|
-
Please change the parent <Route path="${z}"> to <Route path="${z==="/"?"*":`${z}/*`}">.`)}let y=Wa(),g;if(l){let z=typeof l=="string"?li(l):l;et(p==="/"||((L=z.pathname)==null?void 0:L.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${z.pathname}" was given in the \`location\` prop.`),g=z}else g=y;let j=g.pathname||"/",N=j;if(p!=="/"){let z=p.replace(/^\//,"").split("/");N="/"+j.replace(/^\//,"").split("/").slice(z.length).join("/")}let T=i&&i.state.matches.length?i.state.matches.map(z=>Object.assign(z,{route:i.manifest[z.route.id]||z.route})):Jx(n,{pathname:N});Da(x||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Da(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=R1(T&&T.map(z=>Object.assign({},z,{params:Object.assign({},h,z.params),pathname:Oa([p,s.encodeLocation?s.encodeLocation(z.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:z.pathname]),pathnameBase:z.pathnameBase==="/"?p:Oa([p,s.encodeLocation?s.encodeLocation(z.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:z.pathnameBase])})),u,i);return l&&E?S.createElement(xs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},E):E}function T1(){let n=U1(),l=h1(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,s="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:s},f={padding:"2px 4px",backgroundColor:s},h=null;return console.error("Error handled by React Router default ErrorBoundary:",n),h=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:f},"ErrorBoundary")," or"," ",S.createElement("code",{style:f},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},l),i?S.createElement("pre",{style:u},i):null,h)}var A1=S.createElement(T1,null),fb=class extends S.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,l){return l.location!==n.location||l.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:l.error,location:l.location,revalidation:n.revalidation||l.revalidation}}componentDidCatch(n,l){this.props.onError?this.props.onError(n,l):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const i=N1(n.digest);i&&(n=i)}let l=n!==void 0?S.createElement(Rn.Provider,{value:this.props.routeContext},S.createElement(gf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?S.createElement(E1,{error:n},l):l}};fb.contextType=rb;var Ed=new WeakMap;function E1({children:n,error:l}){let{basename:i}=S.useContext(Ca);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let s=j1(l.digest);if(s){let u=Ed.get(l);if(u)throw u;let f=nb(s.location,i);if(ab&&!Ed.get(l))if(f.isExternal||s.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:s.replace}));throw Ed.set(l,h),h}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return n}function k1({routeContext:n,match:l,children:i}){let s=S.useContext(ri);return s&&s.static&&s.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=l.route.id),S.createElement(Rn.Provider,{value:n},i)}function R1(n,l=[],i){let s=i==null?void 0:i.state;if(n==null){if(!s)return null;if(s.errors)n=s.matches;else if(l.length===0&&!s.initialized&&s.matches.length>0)n=s.matches;else return null}let u=n,f=s==null?void 0:s.errors;if(f!=null){let y=u.findIndex(g=>g.route.id&&(f==null?void 0:f[g.route.id])!==void 0);et(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),u=u.slice(0,Math.min(u.length,y+1))}let h=!1,v=-1;if(i&&s){h=s.renderFallback;for(let y=0;y<u.length;y++){let g=u[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(v=y),g.route.id){let{loaderData:j,errors:N}=s,T=g.route.loader&&!j.hasOwnProperty(g.route.id)&&(!N||N[g.route.id]===void 0);if(g.route.lazy||T){i.isStatic&&(h=!0),v>=0?u=u.slice(0,v+1):u=[u[0]];break}}}}let p=i==null?void 0:i.onError,x=s&&p?(y,g)=>{var j,N;p(y,{location:s.location,params:((N=(j=s.matches)==null?void 0:j[0])==null?void 0:N.params)??{},pattern:p1(s.matches),errorInfo:g})}:void 0;return u.reduceRight((y,g,j)=>{let N,T=!1,E=null,L=null;s&&(N=f&&g.route.id?f[g.route.id]:void 0,E=g.route.errorElement||A1,h&&(v<0&&j===0?(mb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,L=null):v===j&&(T=!0,L=g.route.hydrateFallbackElement||null)));let z=l.concat(u.slice(0,j+1)),Q=()=>{let q;return N?q=E:T?q=L:g.route.Component?q=S.createElement(g.route.Component,null):g.route.element?q=g.route.element:q=y,S.createElement(k1,{match:g,routeContext:{outlet:y,matches:z,isDataRoute:s!=null},children:q})};return s&&(g.route.ErrorBoundary||g.route.errorElement||j===0)?S.createElement(fb,{location:s.location,revalidation:s.revalidation,component:E,error:N,children:Q(),routeContext:{outlet:null,matches:z,isDataRoute:!0},onError:x}):Q()},null)}function yf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function z1(n){let l=S.useContext(ri);return et(l,yf(n)),l}function _1(n){let l=S.useContext(tc);return et(l,yf(n)),l}function O1(n){let l=S.useContext(Rn);return et(l,yf(n)),l}function Sf(n){let l=O1(n),i=l.matches[l.matches.length-1];return et(i.route.id,`${n} can only be used on routes that contain a unique "id"`),i.route.id}function D1(){return Sf("useRouteId")}function U1(){var s;let n=S.useContext(gf),l=_1("useRouteError"),i=Sf("useRouteError");return n!==void 0?n:(s=l.errors)==null?void 0:s[i]}function L1(){let{router:n}=z1("useNavigate"),l=Sf("useNavigate"),i=S.useRef(!1);return cb(()=>{i.current=!0}),S.useCallback(async(u,f={})=>{Da(i.current,ob),i.current&&(typeof u=="number"?await n.navigate(u):await n.navigate(u,{fromRouteId:l,...f}))},[n,l])}var Zv={};function mb(n,l,i){!l&&!Zv[n]&&(Zv[n]=!0,Da(!1,i))}S.memo(B1);function B1({routes:n,manifest:l,future:i,state:s,isStatic:u,onError:f}){return db(n,void 0,{manifest:l,state:s,isStatic:u,onError:f})}function Bl(n){et(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function q1({basename:n="/",children:l=null,location:i,navigationType:s="POP",navigator:u,static:f=!1,useTransitions:h}){et(!bs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let v=n.replace(/^\/*/,"/"),p=S.useMemo(()=>({basename:v,navigator:u,static:f,useTransitions:h,future:{}}),[v,u,f,h]);typeof i=="string"&&(i=li(i));let{pathname:x="/",search:y="",hash:g="",state:j=null,key:N="default",mask:T}=i,E=S.useMemo(()=>{let L=kn(x,v);return L==null?null:{location:{pathname:L,search:y,hash:g,state:j,key:N,mask:T},navigationType:s}},[v,x,y,g,j,N,s,T]);return Da(E!=null,`<Router basename="${v}"> is not able to match the URL "${x}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:S.createElement(Ca.Provider,{value:p},S.createElement(xs.Provider,{children:l,value:E}))}function H1({children:n,location:l}){return C1(Yd(n),l)}function Yd(n,l=[]){let i=[];return S.Children.forEach(n,(s,u)=>{if(!S.isValidElement(s))return;let f=[...l,u];if(s.type===S.Fragment){i.push.apply(i,Yd(s.props.children,f));return}et(s.type===Bl,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),et(!s.props.index||!s.props.children,"An index route cannot have child routes.");let h={id:s.props.id||f.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(h.children=Yd(s.props.children,f)),i.push(h)}),i}var $o="get",Qo="application/x-www-form-urlencoded";function ac(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function $1(n){return ac(n)&&n.tagName.toLowerCase()==="button"}function Q1(n){return ac(n)&&n.tagName.toLowerCase()==="form"}function K1(n){return ac(n)&&n.tagName.toLowerCase()==="input"}function Y1(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function P1(n,l){return n.button===0&&(!l||l==="_self")&&!Y1(n)}function Pd(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((l,i)=>{let s=n[i];return l.concat(Array.isArray(s)?s.map(u=>[i,u]):[[i,s]])},[]))}function G1(n,l){let i=Pd(n);return l&&l.forEach((s,u)=>{i.has(u)||l.getAll(u).forEach(f=>{i.append(u,f)})}),i}var Uo=null;function X1(){if(Uo===null)try{new FormData(document.createElement("form"),0),Uo=!1}catch{Uo=!0}return Uo}var V1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function kd(n){return n!=null&&!V1.has(n)?(Da(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qo}"`),null):n}function F1(n,l){let i,s,u,f,h;if(Q1(n)){let v=n.getAttribute("action");s=v?kn(v,l):null,i=n.getAttribute("method")||$o,u=kd(n.getAttribute("enctype"))||Qo,f=new FormData(n)}else if($1(n)||K1(n)&&(n.type==="submit"||n.type==="image")){let v=n.form;if(v==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=n.getAttribute("formaction")||v.getAttribute("action");if(s=p?kn(p,l):null,i=n.getAttribute("formmethod")||v.getAttribute("method")||$o,u=kd(n.getAttribute("formenctype"))||kd(v.getAttribute("enctype"))||Qo,f=new FormData(v,n),!X1()){let{name:x,type:y,value:g}=n;if(y==="image"){let j=x?`${x}.`:"";f.append(`${j}x`,"0"),f.append(`${j}y`,"0")}else x&&f.append(x,g)}}else{if(ac(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=$o,s=null,u=Qo,h=n}return f&&u==="text/plain"&&(h=f,f=void 0),{action:s,method:i.toLowerCase(),encType:u,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function jf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function hb(n,l,i,s){let u=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return i?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${s}`:u.pathname=`${u.pathname}.${s}`:u.pathname==="/"?u.pathname=`_root.${s}`:l&&kn(u.pathname,l)==="/"?u.pathname=`${Xo(l)}/_root.${s}`:u.pathname=`${Xo(u.pathname)}.${s}`,u}async function Z1(n,l){if(n.id in l)return l[n.id];try{let i=await import(n.module);return l[n.id]=i,i}catch(i){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function J1(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function I1(n,l,i){let s=await Promise.all(n.map(async u=>{let f=l.routes[u.route.id];if(f){let h=await Z1(f,i);return h.links?h.links():[]}return[]}));return a2(s.flat(1).filter(J1).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function Jv(n,l,i,s,u,f){let h=(p,x)=>i[x]?p.route.id!==i[x].route.id:!0,v=(p,x)=>{var y;return i[x].pathname!==p.pathname||((y=i[x].route.path)==null?void 0:y.endsWith("*"))&&i[x].params["*"]!==p.params["*"]};return f==="assets"?l.filter((p,x)=>h(p,x)||v(p,x)):f==="data"?l.filter((p,x)=>{var g;let y=s.routes[p.route.id];if(!y||!y.hasLoader)return!1;if(h(p,x)||v(p,x))return!0;if(p.route.shouldRevalidate){let j=p.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((g=i[0])==null?void 0:g.params)||{},nextUrl:new URL(n,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof j=="boolean")return j}return!0}):[]}function W1(n,l,{includeHydrateFallback:i}={}){return e2(n.map(s=>{let u=l.routes[s.route.id];if(!u)return[];let f=[u.module];return u.clientActionModule&&(f=f.concat(u.clientActionModule)),u.clientLoaderModule&&(f=f.concat(u.clientLoaderModule)),i&&u.hydrateFallbackModule&&(f=f.concat(u.hydrateFallbackModule)),u.imports&&(f=f.concat(u.imports)),f}).flat(1))}function e2(n){return[...new Set(n)]}function t2(n){let l={},i=Object.keys(n).sort();for(let s of i)l[s]=n[s];return l}function a2(n,l){let i=new Set;return new Set(l),n.reduce((s,u)=>{let f=JSON.stringify(t2(u));return i.has(f)||(i.add(f),s.push({key:f,link:u})),s},[])}function Nf(){let n=S.useContext(ri);return jf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function n2(){let n=S.useContext(tc);return jf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var wf=S.createContext(void 0);wf.displayName="FrameworkContext";function Mf(){let n=S.useContext(wf);return jf(n,"You must render this element inside a <HydratedRouter> element"),n}function l2(n,l){let i=S.useContext(wf),[s,u]=S.useState(!1),[f,h]=S.useState(!1),{onFocus:v,onBlur:p,onMouseEnter:x,onMouseLeave:y,onTouchStart:g}=l,j=S.useRef(null);S.useEffect(()=>{if(n==="render"&&h(!0),n==="viewport"){let E=z=>{z.forEach(Q=>{h(Q.isIntersecting)})},L=new IntersectionObserver(E,{threshold:.5});return j.current&&L.observe(j.current),()=>{L.disconnect()}}},[n]),S.useEffect(()=>{if(s){let E=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(E)}}},[s]);let N=()=>{u(!0)},T=()=>{u(!1),h(!1)};return i?n!=="intent"?[f,j,{}]:[f,j,{onFocus:Wi(v,N),onBlur:Wi(p,T),onMouseEnter:Wi(x,N),onMouseLeave:Wi(y,T),onTouchStart:Wi(g,N)}]:[!1,j,{}]}function Wi(n,l){return i=>{n&&n(i),i.defaultPrevented||l(i)}}function r2({page:n,...l}){let i=x1(),{router:s}=Nf(),u=S.useMemo(()=>Jx(s.routes,n,s.basename),[s.routes,n,s.basename]);return u?i?S.createElement(s2,{page:n,matches:u,...l}):S.createElement(o2,{page:n,matches:u,...l}):null}function i2(n){let{manifest:l,routeModules:i}=Mf(),[s,u]=S.useState([]);return S.useEffect(()=>{let f=!1;return I1(n,l,i).then(h=>{f||u(h)}),()=>{f=!0}},[n,l,i]),s}function s2({page:n,matches:l,...i}){let s=Wa(),{future:u}=Mf(),{basename:f}=Nf(),h=S.useMemo(()=>{if(n===s.pathname+s.search+s.hash)return[];let v=hb(n,f,u.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,x=[];for(let y of l)typeof y.route.shouldRevalidate=="function"?p=!0:x.push(y.route.id);return p&&x.length>0&&v.searchParams.set("_routes",x.join(",")),[v.pathname+v.search]},[f,u.v8_trailingSlashAwareDataRequests,n,s,l]);return S.createElement(S.Fragment,null,h.map(v=>S.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...i})))}function o2({page:n,matches:l,...i}){let s=Wa(),{future:u,manifest:f,routeModules:h}=Mf(),{basename:v}=Nf(),{loaderData:p,matches:x}=n2(),y=S.useMemo(()=>Jv(n,l,x,f,s,"data"),[n,l,x,f,s]),g=S.useMemo(()=>Jv(n,l,x,f,s,"assets"),[n,l,x,f,s]),j=S.useMemo(()=>{if(n===s.pathname+s.search+s.hash)return[];let E=new Set,L=!1;if(l.forEach(Q=>{var O;let q=f.routes[Q.route.id];!q||!q.hasLoader||(!y.some(K=>K.route.id===Q.route.id)&&Q.route.id in p&&((O=h[Q.route.id])!=null&&O.shouldRevalidate)||q.hasClientLoader?L=!0:E.add(Q.route.id))}),E.size===0)return[];let z=hb(n,v,u.v8_trailingSlashAwareDataRequests,"data");return L&&E.size>0&&z.searchParams.set("_routes",l.filter(Q=>E.has(Q.route.id)).map(Q=>Q.route.id).join(",")),[z.pathname+z.search]},[v,u.v8_trailingSlashAwareDataRequests,p,s,f,y,l,n,h]),N=S.useMemo(()=>W1(g,f),[g,f]),T=i2(g);return S.createElement(S.Fragment,null,j.map(E=>S.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...i})),N.map(E=>S.createElement("link",{key:E,rel:"modulepreload",href:E,...i})),T.map(({key:E,link:L})=>S.createElement("link",{key:E,nonce:i.nonce,...L,crossOrigin:L.crossOrigin??i.crossOrigin})))}function c2(...n){return l=>{n.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var u2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{u2&&(window.__reactRouterVersion="7.17.0")}catch{}function d2({basename:n,children:l,useTransitions:i,window:s}){let u=S.useRef();u.current==null&&(u.current=K0({window:s,v5Compat:!0}));let f=u.current,[h,v]=S.useState({action:f.action,location:f.location}),p=S.useCallback(x=>{i===!1?v(x):S.startTransition(()=>v(x))},[i]);return S.useLayoutEffect(()=>f.listen(p),[f,p]),S.createElement(q1,{basename:n,children:l,location:h.location,navigationType:h.action,navigator:f,useTransitions:i})}var pb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Il=S.forwardRef(function({onClick:l,discover:i="render",prefetch:s="none",relative:u,reloadDocument:f,replace:h,mask:v,state:p,target:x,to:y,preventScrollReset:g,viewTransition:j,defaultShouldRevalidate:N,...T},E){let{basename:L,navigator:z,useTransitions:Q}=S.useContext(Ca),q=typeof y=="string"&&pb.test(y),O=nb(y,L);y=O.to;let K=w1(y,{relative:u}),J=Wa(),H=null;if(v){let de=bf(v,[],J.mask?J.mask.pathname:"/",!0);L!=="/"&&(de.pathname=de.pathname==="/"?L:Oa([L,de.pathname])),H=z.createHref(de)}let[F,Z,le]=l2(s,T),$=h2(y,{replace:h,mask:v,state:p,target:x,preventScrollReset:g,relative:u,viewTransition:j,defaultShouldRevalidate:N,useTransitions:Q});function ue(de){l&&l(de),de.defaultPrevented||$(de)}let ee=!(O.isExternal||f),xe=S.createElement("a",{...T,...le,href:(ee?H:void 0)||O.absoluteURL||K,onClick:ee?ue:l,ref:c2(E,Z),target:x,"data-discover":!q&&i==="render"?"true":void 0});return F&&!q?S.createElement(S.Fragment,null,xe,S.createElement(r2,{page:K})):xe});Il.displayName="Link";var Cf=S.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:s="",end:u=!1,style:f,to:h,viewTransition:v,children:p,...x},y){let g=gs(h,{relative:x.relative}),j=Wa(),N=S.useContext(tc),{navigator:T,basename:E}=S.useContext(Ca),L=N!=null&&y2(g)&&v===!0,z=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,Q=j.pathname,q=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;i||(Q=Q.toLowerCase(),q=q?q.toLowerCase():null,z=z.toLowerCase()),q&&E&&(q=kn(q,E)||q);const O=z!=="/"&&z.endsWith("/")?z.length-1:z.length;let K=Q===z||!u&&Q.startsWith(z)&&Q.charAt(O)==="/",J=q!=null&&(q===z||!u&&q.startsWith(z)&&q.charAt(z.length)==="/"),H={isActive:K,isPending:J,isTransitioning:L},F=K?l:void 0,Z;typeof s=="function"?Z=s(H):Z=[s,K?"active":null,J?"pending":null,L?"transitioning":null].filter(Boolean).join(" ");let le=typeof f=="function"?f(H):f;return S.createElement(Il,{...x,"aria-current":F,className:Z,ref:y,style:le,to:h,viewTransition:v},typeof p=="function"?p(H):p)});Cf.displayName="NavLink";var f2=S.forwardRef(({discover:n="render",fetcherKey:l,navigate:i,reloadDocument:s,replace:u,state:f,method:h=$o,action:v,onSubmit:p,relative:x,preventScrollReset:y,viewTransition:g,defaultShouldRevalidate:j,...N},T)=>{let{useTransitions:E}=S.useContext(Ca),L=b2(),z=g2(v,{relative:x}),Q=h.toLowerCase()==="get"?"get":"post",q=typeof v=="string"&&pb.test(v),O=K=>{if(p&&p(K),K.defaultPrevented)return;K.preventDefault();let J=K.nativeEvent.submitter,H=(J==null?void 0:J.getAttribute("formmethod"))||h,F=()=>L(J||K.currentTarget,{fetcherKey:l,method:H,navigate:i,replace:u,state:f,relative:x,preventScrollReset:y,viewTransition:g,defaultShouldRevalidate:j});E&&i!==!1?S.startTransition(()=>F()):F()};return S.createElement("form",{ref:T,method:Q,action:z,onSubmit:s?p:O,...N,"data-discover":!q&&n==="render"?"true":void 0})});f2.displayName="Form";function m2(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vb(n){let l=S.useContext(ri);return et(l,m2(n)),l}function h2(n,{target:l,replace:i,mask:s,state:u,preventScrollReset:f,relative:h,viewTransition:v,defaultShouldRevalidate:p,useTransitions:x}={}){let y=ub(),g=Wa(),j=gs(n,{relative:h});return S.useCallback(N=>{if(P1(N,l)){N.preventDefault();let T=i!==void 0?i:ss(g)===ss(j),E=()=>y(n,{replace:T,mask:s,state:u,preventScrollReset:f,relative:h,viewTransition:v,defaultShouldRevalidate:p});x?S.startTransition(()=>E()):E()}},[g,y,j,i,s,u,l,n,f,h,v,p,x])}function p2(n){Da(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let l=S.useRef(Pd(n)),i=S.useRef(!1),s=Wa(),u=S.useMemo(()=>G1(s.search,i.current?null:l.current),[s.search]),f=ub(),h=S.useCallback((v,p)=>{const x=Pd(typeof v=="function"?v(new URLSearchParams(u)):v);i.current=!0,f("?"+x,p)},[f,u]);return[u,h]}var v2=0,x2=()=>`__${String(++v2)}__`;function b2(){let{router:n}=vb("useSubmit"),{basename:l}=S.useContext(Ca),i=D1(),s=n.fetch,u=n.navigate;return S.useCallback(async(f,h={})=>{let{action:v,method:p,encType:x,formData:y,body:g}=F1(f,l);if(h.navigate===!1){let j=h.fetcherKey||x2();await s(j,i,h.action||v,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:y,body:g,formMethod:h.method||p,formEncType:h.encType||x,flushSync:h.flushSync})}else await u(h.action||v,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:y,body:g,formMethod:h.method||p,formEncType:h.encType||x,replace:h.replace,state:h.state,fromRouteId:i,flushSync:h.flushSync,viewTransition:h.viewTransition})},[s,u,l,i])}function g2(n,{relative:l}={}){let{basename:i}=S.useContext(Ca),s=S.useContext(Rn);et(s,"useFormAction must be used inside a RouteContext");let[u]=s.matches.slice(-1),f={...gs(n||".",{relative:l})},h=Wa();if(n==null){f.search=h.search;let v=new URLSearchParams(f.search),p=v.getAll("index");if(p.some(y=>y==="")){v.delete("index"),p.filter(g=>g).forEach(g=>v.append("index",g));let y=v.toString();f.search=y?`?${y}`:""}}return(!n||n===".")&&u.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(f.pathname=f.pathname==="/"?i:Oa([i,f.pathname])),ss(f)}function y2(n,{relative:l}={}){let i=S.useContext(ib);et(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=vb("useViewTransitionState"),u=gs(n,{relative:l});if(!i.isTransitioning)return!1;let f=kn(i.currentLocation.pathname,s)||i.currentLocation.pathname,h=kn(i.nextLocation.pathname,s)||i.nextLocation.pathname;return Go(u.pathname,h)!=null||Go(u.pathname,f)!=null}var S2=Zx(),ii=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Hl,ol,Pr,qx,j2=(qx=class extends ii{constructor(){super();me(this,Hl);me(this,ol);me(this,Pr);ae(this,Pr,l=>{if(typeof window<"u"&&window.addEventListener){const i=()=>l();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){M(this,ol)||this.setEventListener(M(this,Pr))}onUnsubscribe(){var l;this.hasListeners()||((l=M(this,ol))==null||l.call(this),ae(this,ol,void 0))}setEventListener(l){var i;ae(this,Pr,l),(i=M(this,ol))==null||i.call(this),ae(this,ol,l(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(l){M(this,Hl)!==l&&(ae(this,Hl,l),this.onFocus())}onFocus(){const l=this.isFocused();this.listeners.forEach(i=>{i(l)})}isFocused(){var l;return typeof M(this,Hl)=="boolean"?M(this,Hl):((l=globalThis.document)==null?void 0:l.visibilityState)!=="hidden"}},Hl=new WeakMap,ol=new WeakMap,Pr=new WeakMap,qx),Tf=new j2,N2={setTimeout:(n,l)=>setTimeout(n,l),clearTimeout:n=>clearTimeout(n),setInterval:(n,l)=>setInterval(n,l),clearInterval:n=>clearInterval(n)},cl,vf,Hx,w2=(Hx=class{constructor(){me(this,cl,N2);me(this,vf,!1)}setTimeoutProvider(n){ae(this,cl,n)}setTimeout(n,l){return M(this,cl).setTimeout(n,l)}clearTimeout(n){M(this,cl).clearTimeout(n)}setInterval(n,l){return M(this,cl).setInterval(n,l)}clearInterval(n){M(this,cl).clearInterval(n)}},cl=new WeakMap,vf=new WeakMap,Hx),ql=new w2;function M2(n){setTimeout(n,0)}var C2=typeof window>"u"||"Deno"in globalThis;function qt(){}function T2(n,l){return typeof n=="function"?n(l):n}function Gd(n){return typeof n=="number"&&n>=0&&n!==1/0}function xb(n,l){return Math.max(n+(l||0)-Date.now(),0)}function xl(n,l){return typeof n=="function"?n(l):n}function da(n,l){return typeof n=="function"?n(l):n}function Iv(n,l){const{type:i="all",exact:s,fetchStatus:u,predicate:f,queryKey:h,stale:v}=n;if(h){if(s){if(l.queryHash!==Af(h,l.options))return!1}else if(!os(l.queryKey,h))return!1}if(i!=="all"){const p=l.isActive();if(i==="active"&&!p||i==="inactive"&&p)return!1}return!(typeof v=="boolean"&&l.isStale()!==v||u&&u!==l.state.fetchStatus||f&&!f(l))}function Wv(n,l){const{exact:i,status:s,predicate:u,mutationKey:f}=n;if(f){if(!l.options.mutationKey)return!1;if(i){if(Fl(l.options.mutationKey)!==Fl(f))return!1}else if(!os(l.options.mutationKey,f))return!1}return!(s&&l.state.status!==s||u&&!u(l))}function Af(n,l){return((l==null?void 0:l.queryKeyHashFn)||Fl)(n)}function Fl(n){return JSON.stringify(n,(l,i)=>Xd(i)?Object.keys(i).sort().reduce((s,u)=>(s[u]=i[u],s),{}):i)}function os(n,l){return n===l?!0:typeof n!=typeof l?!1:n&&l&&typeof n=="object"&&typeof l=="object"?Object.keys(l).every(i=>os(n[i],l[i])):!1}var A2=Object.prototype.hasOwnProperty;function bb(n,l,i=0){if(n===l)return n;if(i>500)return l;const s=ex(n)&&ex(l);if(!s&&!(Xd(n)&&Xd(l)))return l;const f=(s?n:Object.keys(n)).length,h=s?l:Object.keys(l),v=h.length,p=s?new Array(v):{};let x=0;for(let y=0;y<v;y++){const g=s?y:h[y],j=n[g],N=l[g];if(j===N){p[g]=j,(s?y<f:A2.call(n,g))&&x++;continue}if(j===null||N===null||typeof j!="object"||typeof N!="object"){p[g]=N;continue}const T=bb(j,N,i+1);p[g]=T,T===j&&x++}return f===v&&x===f?n:p}function Vo(n,l){if(!l||Object.keys(n).length!==Object.keys(l).length)return!1;for(const i in n)if(n[i]!==l[i])return!1;return!0}function ex(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function Xd(n){if(!tx(n))return!1;const l=n.constructor;if(l===void 0)return!0;const i=l.prototype;return!(!tx(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function tx(n){return Object.prototype.toString.call(n)==="[object Object]"}function E2(n){return new Promise(l=>{ql.setTimeout(l,n)})}function Vd(n,l,i){return typeof i.structuralSharing=="function"?i.structuralSharing(n,l):i.structuralSharing!==!1?bb(n,l):l}function k2(n,l,i=0){const s=[...n,l];return i&&s.length>i?s.slice(1):s}function R2(n,l,i=0){const s=[l,...n];return i&&s.length>i?s.slice(0,-1):s}var Ef=Symbol();function gb(n,l){return!n.queryFn&&(l!=null&&l.initialPromise)?()=>l.initialPromise:!n.queryFn||n.queryFn===Ef?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function kf(n,l){return typeof n=="function"?n(...l):!!n}function z2(n,l,i){let s=!1,u;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(u??(u=l()),s||(s=!0,u.aborted?i():u.addEventListener("abort",i,{once:!0})),u)}),n}var cs=(()=>{let n=()=>C2;return{isServer(){return n()},setIsServer(l){n=l}}})();function Fd(){let n,l;const i=new Promise((u,f)=>{n=u,l=f});i.status="pending",i.catch(()=>{});function s(u){Object.assign(i,u),delete i.resolve,delete i.reject}return i.resolve=u=>{s({status:"fulfilled",value:u}),n(u)},i.reject=u=>{s({status:"rejected",reason:u}),l(u)},i}var _2=M2;function O2(){let n=[],l=0,i=v=>{v()},s=v=>{v()},u=_2;const f=v=>{l?n.push(v):u(()=>{i(v)})},h=()=>{const v=n;n=[],v.length&&u(()=>{s(()=>{v.forEach(p=>{i(p)})})})};return{batch:v=>{let p;l++;try{p=v()}finally{l--,l||h()}return p},batchCalls:v=>(...p)=>{f(()=>{v(...p)})},schedule:f,setNotifyFunction:v=>{i=v},setBatchNotifyFunction:v=>{s=v},setScheduler:v=>{u=v}}}var vt=O2(),Gr,ul,Xr,$x,D2=($x=class extends ii{constructor(){super();me(this,Gr,!0);me(this,ul);me(this,Xr);ae(this,Xr,l=>{if(typeof window<"u"&&window.addEventListener){const i=()=>l(!0),s=()=>l(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",s)}}})}onSubscribe(){M(this,ul)||this.setEventListener(M(this,Xr))}onUnsubscribe(){var l;this.hasListeners()||((l=M(this,ul))==null||l.call(this),ae(this,ul,void 0))}setEventListener(l){var i;ae(this,Xr,l),(i=M(this,ul))==null||i.call(this),ae(this,ul,l(this.setOnline.bind(this)))}setOnline(l){M(this,Gr)!==l&&(ae(this,Gr,l),this.listeners.forEach(s=>{s(l)}))}isOnline(){return M(this,Gr)}},Gr=new WeakMap,ul=new WeakMap,Xr=new WeakMap,$x),Fo=new D2;function U2(n){return Math.min(1e3*2**n,3e4)}function yb(n){return(n??"online")==="online"?Fo.isOnline():!0}var Zd=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function Sb(n){let l=!1,i=0,s;const u=Fd(),f=()=>u.status!=="pending",h=E=>{var L;if(!f()){const z=new Zd(E);j(z),(L=n.onCancel)==null||L.call(n,z)}},v=()=>{l=!0},p=()=>{l=!1},x=()=>Tf.isFocused()&&(n.networkMode==="always"||Fo.isOnline())&&n.canRun(),y=()=>yb(n.networkMode)&&n.canRun(),g=E=>{f()||(s==null||s(),u.resolve(E))},j=E=>{f()||(s==null||s(),u.reject(E))},N=()=>new Promise(E=>{var L;s=z=>{(f()||x())&&E(z)},(L=n.onPause)==null||L.call(n)}).then(()=>{var E;s=void 0,f()||(E=n.onContinue)==null||E.call(n)}),T=()=>{if(f())return;let E;const L=i===0?n.initialPromise:void 0;try{E=L??n.fn()}catch(z){E=Promise.reject(z)}Promise.resolve(E).then(g).catch(z=>{var J;if(f())return;const Q=n.retry??(cs.isServer()?0:3),q=n.retryDelay??U2,O=typeof q=="function"?q(i,z):q,K=Q===!0||typeof Q=="number"&&i<Q||typeof Q=="function"&&Q(i,z);if(l||!K){j(z);return}i++,(J=n.onFail)==null||J.call(n,i,z),E2(O).then(()=>x()?void 0:N()).then(()=>{l?j(z):T()})})};return{promise:u,status:()=>u.status,cancel:h,continue:()=>(s==null||s(),u),cancelRetry:v,continueRetry:p,canStart:y,start:()=>(y()?T():N().then(T),u)}}var $l,Qx,jb=(Qx=class{constructor(){me(this,$l)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gd(this.gcTime)&&ae(this,$l,ql.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(cs.isServer()?1/0:300*1e3))}clearGcTimeout(){M(this,$l)!==void 0&&(ql.clearTimeout(M(this,$l)),ae(this,$l,void 0))}},$l=new WeakMap,Qx);function L2(n){return{onFetch:(l,i)=>{var y,g,j,N,T;const s=l.options,u=(j=(g=(y=l.fetchOptions)==null?void 0:y.meta)==null?void 0:g.fetchMore)==null?void 0:j.direction,f=((N=l.state.data)==null?void 0:N.pages)||[],h=((T=l.state.data)==null?void 0:T.pageParams)||[];let v={pages:[],pageParams:[]},p=0;const x=async()=>{let E=!1;const L=q=>{z2(q,()=>l.signal,()=>E=!0)},z=gb(l.options,l.fetchOptions),Q=async(q,O,K)=>{if(E)return Promise.reject(l.signal.reason);if(O==null&&q.pages.length)return Promise.resolve(q);const H=(()=>{const $={client:l.client,queryKey:l.queryKey,pageParam:O,direction:K?"backward":"forward",meta:l.options.meta};return L($),$})(),F=await z(H),{maxPages:Z}=l.options,le=K?R2:k2;return{pages:le(q.pages,F,Z),pageParams:le(q.pageParams,O,Z)}};if(u&&f.length){const q=u==="backward",O=q?B2:ax,K={pages:f,pageParams:h},J=O(s,K);v=await Q(K,J,q)}else{const q=n??f.length;do{const O=p===0?h[0]??s.initialPageParam:ax(s,v);if(p>0&&O==null)break;v=await Q(v,O),p++}while(p<q)}return v};l.options.persister?l.fetchFn=()=>{var E,L;return(L=(E=l.options).persister)==null?void 0:L.call(E,x,{client:l.client,queryKey:l.queryKey,meta:l.options.meta,signal:l.signal},i)}:l.fetchFn=x}}}function ax(n,{pages:l,pageParams:i}){const s=l.length-1;return l.length>0?n.getNextPageParam(l[s],l,i[s],i):void 0}function B2(n,{pages:l,pageParams:i}){var s;return l.length>0?(s=n.getPreviousPageParam)==null?void 0:s.call(n,l[0],l,i[0],i):void 0}var Vr,Ql,Fr,Ma,Kl,St,fs,Yl,ua,Nb,wn,Kx,q2=(Kx=class extends jb{constructor(l){super();me(this,ua);me(this,Vr);me(this,Ql);me(this,Fr);me(this,Ma);me(this,Kl);me(this,St);me(this,fs);me(this,Yl);ae(this,Yl,!1),ae(this,fs,l.defaultOptions),this.setOptions(l.options),this.observers=[],ae(this,Kl,l.client),ae(this,Ma,M(this,Kl).getQueryCache()),this.queryKey=l.queryKey,this.queryHash=l.queryHash,ae(this,Ql,lx(this.options)),this.state=l.state??M(this,Ql),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return M(this,Vr)}get promise(){var l;return(l=M(this,St))==null?void 0:l.promise}setOptions(l){if(this.options={...M(this,fs),...l},l!=null&&l._type&&ae(this,Vr,l._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=lx(this.options);i.data!==void 0&&(this.setState(nx(i.data,i.dataUpdatedAt)),ae(this,Ql,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&M(this,Ma).remove(this)}setData(l,i){const s=Vd(this.state.data,l,this.options);return Ne(this,ua,wn).call(this,{data:s,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),s}setState(l){Ne(this,ua,wn).call(this,{type:"setState",state:l})}cancel(l){var s,u;const i=(s=M(this,St))==null?void 0:s.promise;return(u=M(this,St))==null||u.cancel(l),i?i.then(qt).catch(qt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return M(this,Ql)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(l=>da(l.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ef||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(l=>xl(l.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(l=>l.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(l=0){return this.state.data===void 0?!0:l==="static"?!1:this.state.isInvalidated?!0:!xb(this.state.dataUpdatedAt,l)}onFocus(){var i;const l=this.observers.find(s=>s.shouldFetchOnWindowFocus());l==null||l.refetch({cancelRefetch:!1}),(i=M(this,St))==null||i.continue()}onOnline(){var i;const l=this.observers.find(s=>s.shouldFetchOnReconnect());l==null||l.refetch({cancelRefetch:!1}),(i=M(this,St))==null||i.continue()}addObserver(l){this.observers.includes(l)||(this.observers.push(l),this.clearGcTimeout(),M(this,Ma).notify({type:"observerAdded",query:this,observer:l}))}removeObserver(l){this.observers.includes(l)&&(this.observers=this.observers.filter(i=>i!==l),this.observers.length||(M(this,St)&&(M(this,Yl)||Ne(this,ua,Nb).call(this)?M(this,St).cancel({revert:!0}):M(this,St).cancelRetry()),this.scheduleGc()),M(this,Ma).notify({type:"observerRemoved",query:this,observer:l}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,ua,wn).call(this,{type:"invalidate"})}async fetch(l,i){var x,y,g,j,N,T,E,L,z,Q,q;if(this.state.fetchStatus!=="idle"&&((x=M(this,St))==null?void 0:x.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(M(this,St))return M(this,St).continueRetry(),M(this,St).promise}if(l&&this.setOptions(l),!this.options.queryFn){const O=this.observers.find(K=>K.options.queryFn);O&&this.setOptions(O.options)}const s=new AbortController,u=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(ae(this,Yl,!0),s.signal)})},f=()=>{const O=gb(this.options,i),J=(()=>{const H={client:M(this,Kl),queryKey:this.queryKey,meta:this.meta};return u(H),H})();return ae(this,Yl,!1),this.options.persister?this.options.persister(O,J,this):O(J)},v=(()=>{const O={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:M(this,Kl),state:this.state,fetchFn:f};return u(O),O})(),p=M(this,Vr)==="infinite"?L2(this.options.pages):this.options.behavior;p==null||p.onFetch(v,this),ae(this,Fr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=v.fetchOptions)==null?void 0:y.meta))&&Ne(this,ua,wn).call(this,{type:"fetch",meta:(g=v.fetchOptions)==null?void 0:g.meta}),ae(this,St,Sb({initialPromise:i==null?void 0:i.initialPromise,fn:v.fetchFn,onCancel:O=>{O instanceof Zd&&O.revert&&this.setState({...M(this,Fr),fetchStatus:"idle"}),s.abort()},onFail:(O,K)=>{Ne(this,ua,wn).call(this,{type:"failed",failureCount:O,error:K})},onPause:()=>{Ne(this,ua,wn).call(this,{type:"pause"})},onContinue:()=>{Ne(this,ua,wn).call(this,{type:"continue"})},retry:v.options.retry,retryDelay:v.options.retryDelay,networkMode:v.options.networkMode,canRun:()=>!0}));try{const O=await M(this,St).start();if(O===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(O),(N=(j=M(this,Ma).config).onSuccess)==null||N.call(j,O,this),(E=(T=M(this,Ma).config).onSettled)==null||E.call(T,O,this.state.error,this),O}catch(O){if(O instanceof Zd){if(O.silent)return M(this,St).promise;if(O.revert){if(this.state.data===void 0)throw O;return this.state.data}}throw Ne(this,ua,wn).call(this,{type:"error",error:O}),(z=(L=M(this,Ma).config).onError)==null||z.call(L,O,this),(q=(Q=M(this,Ma).config).onSettled)==null||q.call(Q,this.state.data,O,this),O}finally{this.scheduleGc()}}},Vr=new WeakMap,Ql=new WeakMap,Fr=new WeakMap,Ma=new WeakMap,Kl=new WeakMap,St=new WeakMap,fs=new WeakMap,Yl=new WeakMap,ua=new WeakSet,Nb=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},wn=function(l){const i=s=>{switch(l.type){case"failed":return{...s,fetchFailureCount:l.failureCount,fetchFailureReason:l.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...wb(s.data,this.options),fetchMeta:l.meta??null};case"success":const u={...s,...nx(l.data,l.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!l.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ae(this,Fr,l.manual?u:void 0),u;case"error":const f=l.error;return{...s,error:f,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...l.state}}};this.state=i(this.state),vt.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),M(this,Ma).notify({query:this,type:"updated",action:l})})},Kx);function wb(n,l){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yb(l.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function nx(n,l){return{data:n,dataUpdatedAt:l??Date.now(),error:null,isInvalidated:!1,status:"success"}}function lx(n){const l=typeof n.initialData=="function"?n.initialData():n.initialData,i=l!==void 0,s=i?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:l,dataUpdateCount:0,dataUpdatedAt:i?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var Zt,ze,ms,Bt,Pl,Zr,Mn,dl,hs,Jr,Ir,Gl,Xl,fl,Wr,Qe,ls,Jd,Id,Wd,ef,tf,af,nf,Mb,Yx,H2=(Yx=class extends ii{constructor(l,i){super();me(this,Qe);me(this,Zt);me(this,ze);me(this,ms);me(this,Bt);me(this,Pl);me(this,Zr);me(this,Mn);me(this,dl);me(this,hs);me(this,Jr);me(this,Ir);me(this,Gl);me(this,Xl);me(this,fl);me(this,Wr,new Set);this.options=i,ae(this,Zt,l),ae(this,dl,null),ae(this,Mn,Fd()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(M(this,ze).addObserver(this),rx(M(this,ze),this.options)?Ne(this,Qe,ls).call(this):this.updateResult(),Ne(this,Qe,ef).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lf(M(this,ze),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lf(M(this,ze),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,Qe,tf).call(this),Ne(this,Qe,af).call(this),M(this,ze).removeObserver(this)}setOptions(l){const i=this.options,s=M(this,ze);if(this.options=M(this,Zt).defaultQueryOptions(l),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof da(this.options.enabled,M(this,ze))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,Qe,nf).call(this),M(this,ze).setOptions(this.options),i._defaulted&&!Vo(this.options,i)&&M(this,Zt).getQueryCache().notify({type:"observerOptionsUpdated",query:M(this,ze),observer:this});const u=this.hasListeners();u&&ix(M(this,ze),s,this.options,i)&&Ne(this,Qe,ls).call(this),this.updateResult(),u&&(M(this,ze)!==s||da(this.options.enabled,M(this,ze))!==da(i.enabled,M(this,ze))||xl(this.options.staleTime,M(this,ze))!==xl(i.staleTime,M(this,ze)))&&Ne(this,Qe,Jd).call(this);const f=Ne(this,Qe,Id).call(this);u&&(M(this,ze)!==s||da(this.options.enabled,M(this,ze))!==da(i.enabled,M(this,ze))||f!==M(this,fl))&&Ne(this,Qe,Wd).call(this,f)}getOptimisticResult(l){const i=M(this,Zt).getQueryCache().build(M(this,Zt),l),s=this.createResult(i,l);return Q2(this,s)&&(ae(this,Bt,s),ae(this,Zr,this.options),ae(this,Pl,M(this,ze).state)),s}getCurrentResult(){return M(this,Bt)}trackResult(l,i){return new Proxy(l,{get:(s,u)=>(this.trackProp(u),i==null||i(u),u==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&M(this,Mn).status==="pending"&&M(this,Mn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,u))})}trackProp(l){M(this,Wr).add(l)}getCurrentQuery(){return M(this,ze)}refetch({...l}={}){return this.fetch({...l})}fetchOptimistic(l){const i=M(this,Zt).defaultQueryOptions(l),s=M(this,Zt).getQueryCache().build(M(this,Zt),i);return s.fetch().then(()=>this.createResult(s,i))}fetch(l){return Ne(this,Qe,ls).call(this,{...l,cancelRefetch:l.cancelRefetch??!0}).then(()=>(this.updateResult(),M(this,Bt)))}createResult(l,i){var Z;const s=M(this,ze),u=this.options,f=M(this,Bt),h=M(this,Pl),v=M(this,Zr),x=l!==s?l.state:M(this,ms),{state:y}=l;let g={...y},j=!1,N;if(i._optimisticResults){const le=this.hasListeners(),$=!le&&rx(l,i),ue=le&&ix(l,s,i,u);($||ue)&&(g={...g,...wb(y.data,l.options)}),i._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:T,errorUpdatedAt:E,status:L}=g;N=g.data;let z=!1;if(i.placeholderData!==void 0&&N===void 0&&L==="pending"){let le;f!=null&&f.isPlaceholderData&&i.placeholderData===(v==null?void 0:v.placeholderData)?(le=f.data,z=!0):le=typeof i.placeholderData=="function"?i.placeholderData((Z=M(this,Ir))==null?void 0:Z.state.data,M(this,Ir)):i.placeholderData,le!==void 0&&(L="success",N=Vd(f==null?void 0:f.data,le,i),j=!0)}if(i.select&&N!==void 0&&!z)if(f&&N===(h==null?void 0:h.data)&&i.select===M(this,hs))N=M(this,Jr);else try{ae(this,hs,i.select),N=i.select(N),N=Vd(f==null?void 0:f.data,N,i),ae(this,Jr,N),ae(this,dl,null)}catch(le){ae(this,dl,le)}M(this,dl)&&(T=M(this,dl),N=M(this,Jr),E=Date.now(),L="error");const Q=g.fetchStatus==="fetching",q=L==="pending",O=L==="error",K=q&&Q,J=N!==void 0,F={status:L,fetchStatus:g.fetchStatus,isPending:q,isSuccess:L==="success",isError:O,isInitialLoading:K,isLoading:K,data:N,dataUpdatedAt:g.dataUpdatedAt,error:T,errorUpdatedAt:E,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:l.isFetched(),isFetchedAfterMount:g.dataUpdateCount>x.dataUpdateCount||g.errorUpdateCount>x.errorUpdateCount,isFetching:Q,isRefetching:Q&&!q,isLoadingError:O&&!J,isPaused:g.fetchStatus==="paused",isPlaceholderData:j,isRefetchError:O&&J,isStale:Rf(l,i),refetch:this.refetch,promise:M(this,Mn),isEnabled:da(i.enabled,l)!==!1};if(this.options.experimental_prefetchInRender){const le=F.data!==void 0,$=F.status==="error"&&!le,ue=de=>{$?de.reject(F.error):le&&de.resolve(F.data)},ee=()=>{const de=ae(this,Mn,F.promise=Fd());ue(de)},xe=M(this,Mn);switch(xe.status){case"pending":l.queryHash===s.queryHash&&ue(xe);break;case"fulfilled":($||F.data!==xe.value)&&ee();break;case"rejected":(!$||F.error!==xe.reason)&&ee();break}}return F}updateResult(){const l=M(this,Bt),i=this.createResult(M(this,ze),this.options);if(ae(this,Pl,M(this,ze).state),ae(this,Zr,this.options),M(this,Pl).data!==void 0&&ae(this,Ir,M(this,ze)),Vo(i,l))return;ae(this,Bt,i);const s=()=>{if(!l)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!M(this,Wr).size)return!0;const h=new Set(f??M(this,Wr));return this.options.throwOnError&&h.add("error"),Object.keys(M(this,Bt)).some(v=>{const p=v;return M(this,Bt)[p]!==l[p]&&h.has(p)})};Ne(this,Qe,Mb).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,Qe,ef).call(this)}},Zt=new WeakMap,ze=new WeakMap,ms=new WeakMap,Bt=new WeakMap,Pl=new WeakMap,Zr=new WeakMap,Mn=new WeakMap,dl=new WeakMap,hs=new WeakMap,Jr=new WeakMap,Ir=new WeakMap,Gl=new WeakMap,Xl=new WeakMap,fl=new WeakMap,Wr=new WeakMap,Qe=new WeakSet,ls=function(l){Ne(this,Qe,nf).call(this);let i=M(this,ze).fetch(this.options,l);return l!=null&&l.throwOnError||(i=i.catch(qt)),i},Jd=function(){Ne(this,Qe,tf).call(this);const l=xl(this.options.staleTime,M(this,ze));if(cs.isServer()||M(this,Bt).isStale||!Gd(l))return;const s=xb(M(this,Bt).dataUpdatedAt,l)+1;ae(this,Gl,ql.setTimeout(()=>{M(this,Bt).isStale||this.updateResult()},s))},Id=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(M(this,ze)):this.options.refetchInterval)??!1},Wd=function(l){Ne(this,Qe,af).call(this),ae(this,fl,l),!(cs.isServer()||da(this.options.enabled,M(this,ze))===!1||!Gd(M(this,fl))||M(this,fl)===0)&&ae(this,Xl,ql.setInterval(()=>{(this.options.refetchIntervalInBackground||Tf.isFocused())&&Ne(this,Qe,ls).call(this)},M(this,fl)))},ef=function(){Ne(this,Qe,Jd).call(this),Ne(this,Qe,Wd).call(this,Ne(this,Qe,Id).call(this))},tf=function(){M(this,Gl)!==void 0&&(ql.clearTimeout(M(this,Gl)),ae(this,Gl,void 0))},af=function(){M(this,Xl)!==void 0&&(ql.clearInterval(M(this,Xl)),ae(this,Xl,void 0))},nf=function(){const l=M(this,Zt).getQueryCache().build(M(this,Zt),this.options);if(l===M(this,ze))return;const i=M(this,ze);ae(this,ze,l),ae(this,ms,l.state),this.hasListeners()&&(i==null||i.removeObserver(this),l.addObserver(this))},Mb=function(l){vt.batch(()=>{l.listeners&&this.listeners.forEach(i=>{i(M(this,Bt))}),M(this,Zt).getQueryCache().notify({query:M(this,ze),type:"observerResultsUpdated"})})},Yx);function $2(n,l){return da(l.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&da(l.retryOnMount,n)===!1)}function rx(n,l){return $2(n,l)||n.state.data!==void 0&&lf(n,l,l.refetchOnMount)}function lf(n,l,i){if(da(l.enabled,n)!==!1&&xl(l.staleTime,n)!=="static"){const s=typeof i=="function"?i(n):i;return s==="always"||s!==!1&&Rf(n,l)}return!1}function ix(n,l,i,s){return(n!==l||da(s.enabled,n)===!1)&&(!i.suspense||n.state.status!=="error")&&Rf(n,i)}function Rf(n,l){return da(l.enabled,n)!==!1&&n.isStaleByTime(xl(l.staleTime,n))}function Q2(n,l){return!Vo(n.getCurrentResult(),l)}var ps,Xa,Rt,Vl,Va,sl,Px,K2=(Px=class extends jb{constructor(l){super();me(this,Va);me(this,ps);me(this,Xa);me(this,Rt);me(this,Vl);ae(this,ps,l.client),this.mutationId=l.mutationId,ae(this,Rt,l.mutationCache),ae(this,Xa,[]),this.state=l.state||Cb(),this.setOptions(l.options),this.scheduleGc()}setOptions(l){this.options=l,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(l){M(this,Xa).includes(l)||(M(this,Xa).push(l),this.clearGcTimeout(),M(this,Rt).notify({type:"observerAdded",mutation:this,observer:l}))}removeObserver(l){ae(this,Xa,M(this,Xa).filter(i=>i!==l)),this.scheduleGc(),M(this,Rt).notify({type:"observerRemoved",mutation:this,observer:l})}optionalRemove(){M(this,Xa).length||(this.state.status==="pending"?this.scheduleGc():M(this,Rt).remove(this))}continue(){var l;return((l=M(this,Vl))==null?void 0:l.continue())??this.execute(this.state.variables)}async execute(l){var h,v,p,x,y,g,j,N,T,E,L,z,Q,q,O,K,J,H;const i=()=>{Ne(this,Va,sl).call(this,{type:"continue"})},s={client:M(this,ps),meta:this.options.meta,mutationKey:this.options.mutationKey};ae(this,Vl,Sb({fn:()=>this.options.mutationFn?this.options.mutationFn(l,s):Promise.reject(new Error("No mutationFn found")),onFail:(F,Z)=>{Ne(this,Va,sl).call(this,{type:"failed",failureCount:F,error:Z})},onPause:()=>{Ne(this,Va,sl).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(this,Rt).canRun(this)}));const u=this.state.status==="pending",f=!M(this,Vl).canStart();try{if(u)i();else{Ne(this,Va,sl).call(this,{type:"pending",variables:l,isPaused:f}),M(this,Rt).config.onMutate&&await M(this,Rt).config.onMutate(l,this,s);const Z=await((v=(h=this.options).onMutate)==null?void 0:v.call(h,l,s));Z!==this.state.context&&Ne(this,Va,sl).call(this,{type:"pending",context:Z,variables:l,isPaused:f})}const F=await M(this,Vl).start();return await((x=(p=M(this,Rt).config).onSuccess)==null?void 0:x.call(p,F,l,this.state.context,this,s)),await((g=(y=this.options).onSuccess)==null?void 0:g.call(y,F,l,this.state.context,s)),await((N=(j=M(this,Rt).config).onSettled)==null?void 0:N.call(j,F,null,this.state.variables,this.state.context,this,s)),await((E=(T=this.options).onSettled)==null?void 0:E.call(T,F,null,l,this.state.context,s)),Ne(this,Va,sl).call(this,{type:"success",data:F}),F}catch(F){try{await((z=(L=M(this,Rt).config).onError)==null?void 0:z.call(L,F,l,this.state.context,this,s))}catch(Z){Promise.reject(Z)}try{await((q=(Q=this.options).onError)==null?void 0:q.call(Q,F,l,this.state.context,s))}catch(Z){Promise.reject(Z)}try{await((K=(O=M(this,Rt).config).onSettled)==null?void 0:K.call(O,void 0,F,this.state.variables,this.state.context,this,s))}catch(Z){Promise.reject(Z)}try{await((H=(J=this.options).onSettled)==null?void 0:H.call(J,void 0,F,l,this.state.context,s))}catch(Z){Promise.reject(Z)}throw Ne(this,Va,sl).call(this,{type:"error",error:F}),F}finally{M(this,Rt).runNext(this)}}},ps=new WeakMap,Xa=new WeakMap,Rt=new WeakMap,Vl=new WeakMap,Va=new WeakSet,sl=function(l){const i=s=>{switch(l.type){case"failed":return{...s,failureCount:l.failureCount,failureReason:l.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:l.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:l.isPaused,status:"pending",variables:l.variables,submittedAt:Date.now()};case"success":return{...s,data:l.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:l.error,failureCount:s.failureCount+1,failureReason:l.error,isPaused:!1,status:"error"}}};this.state=i(this.state),vt.batch(()=>{M(this,Xa).forEach(s=>{s.onMutationUpdate(l)}),M(this,Rt).notify({mutation:this,type:"updated",action:l})})},Px);function Cb(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Cn,_a,vs,Gx,Y2=(Gx=class extends ii{constructor(l={}){super();me(this,Cn);me(this,_a);me(this,vs);this.config=l,ae(this,Cn,new Set),ae(this,_a,new Map),ae(this,vs,0)}build(l,i,s){const u=new K2({client:l,mutationCache:this,mutationId:++Do(this,vs)._,options:l.defaultMutationOptions(i),state:s});return this.add(u),u}add(l){M(this,Cn).add(l);const i=Lo(l);if(typeof i=="string"){const s=M(this,_a).get(i);s?s.push(l):M(this,_a).set(i,[l])}this.notify({type:"added",mutation:l})}remove(l){if(M(this,Cn).delete(l)){const i=Lo(l);if(typeof i=="string"){const s=M(this,_a).get(i);if(s)if(s.length>1){const u=s.indexOf(l);u!==-1&&s.splice(u,1)}else s[0]===l&&M(this,_a).delete(i)}}this.notify({type:"removed",mutation:l})}canRun(l){const i=Lo(l);if(typeof i=="string"){const s=M(this,_a).get(i),u=s==null?void 0:s.find(f=>f.state.status==="pending");return!u||u===l}else return!0}runNext(l){var s;const i=Lo(l);if(typeof i=="string"){const u=(s=M(this,_a).get(i))==null?void 0:s.find(f=>f!==l&&f.state.isPaused);return(u==null?void 0:u.continue())??Promise.resolve()}else return Promise.resolve()}clear(){vt.batch(()=>{M(this,Cn).forEach(l=>{this.notify({type:"removed",mutation:l})}),M(this,Cn).clear(),M(this,_a).clear()})}getAll(){return Array.from(M(this,Cn))}find(l){const i={exact:!0,...l};return this.getAll().find(s=>Wv(i,s))}findAll(l={}){return this.getAll().filter(i=>Wv(l,i))}notify(l){vt.batch(()=>{this.listeners.forEach(i=>{i(l)})})}resumePausedMutations(){const l=this.getAll().filter(i=>i.state.isPaused);return vt.batch(()=>Promise.all(l.map(i=>i.continue().catch(qt))))}},Cn=new WeakMap,_a=new WeakMap,vs=new WeakMap,Gx);function Lo(n){var l;return(l=n.options.scope)==null?void 0:l.id}var Tn,ml,Jt,An,En,Ko,rf,Xx,P2=(Xx=class extends ii{constructor(i,s){super();me(this,En);me(this,Tn);me(this,ml);me(this,Jt);me(this,An);ae(this,Tn,i),this.setOptions(s),this.bindMethods(),Ne(this,En,Ko).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(i){var u;const s=this.options;this.options=M(this,Tn).defaultMutationOptions(i),Vo(this.options,s)||M(this,Tn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:M(this,Jt),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Fl(s.mutationKey)!==Fl(this.options.mutationKey)?this.reset():((u=M(this,Jt))==null?void 0:u.state.status)==="pending"&&M(this,Jt).setOptions(this.options)}onUnsubscribe(){var i;this.hasListeners()||(i=M(this,Jt))==null||i.removeObserver(this)}onMutationUpdate(i){Ne(this,En,Ko).call(this),Ne(this,En,rf).call(this,i)}getCurrentResult(){return M(this,ml)}reset(){var i;(i=M(this,Jt))==null||i.removeObserver(this),ae(this,Jt,void 0),Ne(this,En,Ko).call(this),Ne(this,En,rf).call(this)}mutate(i,s){var u;return ae(this,An,s),(u=M(this,Jt))==null||u.removeObserver(this),ae(this,Jt,M(this,Tn).getMutationCache().build(M(this,Tn),this.options)),M(this,Jt).addObserver(this),M(this,Jt).execute(i)}},Tn=new WeakMap,ml=new WeakMap,Jt=new WeakMap,An=new WeakMap,En=new WeakSet,Ko=function(){var s;const i=((s=M(this,Jt))==null?void 0:s.state)??Cb();ae(this,ml,{...i,isPending:i.status==="pending",isSuccess:i.status==="success",isError:i.status==="error",isIdle:i.status==="idle",mutate:this.mutate,reset:this.reset})},rf=function(i){vt.batch(()=>{var s,u,f,h,v,p,x,y;if(M(this,An)&&this.hasListeners()){const g=M(this,ml).variables,j=M(this,ml).context,N={client:M(this,Tn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((i==null?void 0:i.type)==="success"){try{(u=(s=M(this,An)).onSuccess)==null||u.call(s,i.data,g,j,N)}catch(T){Promise.reject(T)}try{(h=(f=M(this,An)).onSettled)==null||h.call(f,i.data,null,g,j,N)}catch(T){Promise.reject(T)}}else if((i==null?void 0:i.type)==="error"){try{(p=(v=M(this,An)).onError)==null||p.call(v,i.error,g,j,N)}catch(T){Promise.reject(T)}try{(y=(x=M(this,An)).onSettled)==null||y.call(x,void 0,i.error,g,j,N)}catch(T){Promise.reject(T)}}}this.listeners.forEach(g=>{g(M(this,ml))})})},Xx),Fa,Vx,G2=(Vx=class extends ii{constructor(l={}){super();me(this,Fa);this.config=l,ae(this,Fa,new Map)}build(l,i,s){const u=i.queryKey,f=i.queryHash??Af(u,i);let h=this.get(f);return h||(h=new q2({client:l,queryKey:u,queryHash:f,options:l.defaultQueryOptions(i),state:s,defaultOptions:l.getQueryDefaults(u)}),this.add(h)),h}add(l){M(this,Fa).has(l.queryHash)||(M(this,Fa).set(l.queryHash,l),this.notify({type:"added",query:l}))}remove(l){const i=M(this,Fa).get(l.queryHash);i&&(l.destroy(),i===l&&M(this,Fa).delete(l.queryHash),this.notify({type:"removed",query:l}))}clear(){vt.batch(()=>{this.getAll().forEach(l=>{this.remove(l)})})}get(l){return M(this,Fa).get(l)}getAll(){return[...M(this,Fa).values()]}find(l){const i={exact:!0,...l};return this.getAll().find(s=>Iv(i,s))}findAll(l={}){const i=this.getAll();return Object.keys(l).length>0?i.filter(s=>Iv(l,s)):i}notify(l){vt.batch(()=>{this.listeners.forEach(i=>{i(l)})})}onFocus(){vt.batch(()=>{this.getAll().forEach(l=>{l.onFocus()})})}onOnline(){vt.batch(()=>{this.getAll().forEach(l=>{l.onOnline()})})}},Fa=new WeakMap,Vx),lt,hl,pl,ei,ti,vl,ai,ni,Fx,X2=(Fx=class{constructor(n={}){me(this,lt);me(this,hl);me(this,pl);me(this,ei);me(this,ti);me(this,vl);me(this,ai);me(this,ni);ae(this,lt,n.queryCache||new G2),ae(this,hl,n.mutationCache||new Y2),ae(this,pl,n.defaultOptions||{}),ae(this,ei,new Map),ae(this,ti,new Map),ae(this,vl,0)}mount(){Do(this,vl)._++,M(this,vl)===1&&(ae(this,ai,Tf.subscribe(async n=>{n&&(await this.resumePausedMutations(),M(this,lt).onFocus())})),ae(this,ni,Fo.subscribe(async n=>{n&&(await this.resumePausedMutations(),M(this,lt).onOnline())})))}unmount(){var n,l;Do(this,vl)._--,M(this,vl)===0&&((n=M(this,ai))==null||n.call(this),ae(this,ai,void 0),(l=M(this,ni))==null||l.call(this),ae(this,ni,void 0))}isFetching(n){return M(this,lt).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return M(this,hl).findAll({...n,status:"pending"}).length}getQueryData(n){var i;const l=this.defaultQueryOptions({queryKey:n});return(i=M(this,lt).get(l.queryHash))==null?void 0:i.state.data}ensureQueryData(n){const l=this.defaultQueryOptions(n),i=M(this,lt).build(this,l),s=i.state.data;return s===void 0?this.fetchQuery(n):(n.revalidateIfStale&&i.isStaleByTime(xl(l.staleTime,i))&&this.prefetchQuery(l),Promise.resolve(s))}getQueriesData(n){return M(this,lt).findAll(n).map(({queryKey:l,state:i})=>{const s=i.data;return[l,s]})}setQueryData(n,l,i){const s=this.defaultQueryOptions({queryKey:n}),u=M(this,lt).get(s.queryHash),f=u==null?void 0:u.state.data,h=T2(l,f);if(h!==void 0)return M(this,lt).build(this,s).setData(h,{...i,manual:!0})}setQueriesData(n,l,i){return vt.batch(()=>M(this,lt).findAll(n).map(({queryKey:s})=>[s,this.setQueryData(s,l,i)]))}getQueryState(n){var i;const l=this.defaultQueryOptions({queryKey:n});return(i=M(this,lt).get(l.queryHash))==null?void 0:i.state}removeQueries(n){const l=M(this,lt);vt.batch(()=>{l.findAll(n).forEach(i=>{l.remove(i)})})}resetQueries(n,l){const i=M(this,lt);return vt.batch(()=>(i.findAll(n).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...n},l)))}cancelQueries(n,l={}){const i={revert:!0,...l},s=vt.batch(()=>M(this,lt).findAll(n).map(u=>u.cancel(i)));return Promise.all(s).then(qt).catch(qt)}invalidateQueries(n,l={}){return vt.batch(()=>(M(this,lt).findAll(n).forEach(i=>{i.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},l)))}refetchQueries(n,l={}){const i={...l,cancelRefetch:l.cancelRefetch??!0},s=vt.batch(()=>M(this,lt).findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,i);return i.throwOnError||(f=f.catch(qt)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(s).then(qt)}fetchQuery(n){const l=this.defaultQueryOptions(n);l.retry===void 0&&(l.retry=!1);const i=M(this,lt).build(this,l);return i.isStaleByTime(xl(l.staleTime,i))?i.fetch(l):Promise.resolve(i.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(qt).catch(qt)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(qt).catch(qt)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Fo.isOnline()?M(this,hl).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(this,lt)}getMutationCache(){return M(this,hl)}getDefaultOptions(){return M(this,pl)}setDefaultOptions(n){ae(this,pl,n)}setQueryDefaults(n,l){M(this,ei).set(Fl(n),{queryKey:n,defaultOptions:l})}getQueryDefaults(n){const l=[...M(this,ei).values()],i={};return l.forEach(s=>{os(n,s.queryKey)&&Object.assign(i,s.defaultOptions)}),i}setMutationDefaults(n,l){M(this,ti).set(Fl(n),{mutationKey:n,defaultOptions:l})}getMutationDefaults(n){const l=[...M(this,ti).values()],i={};return l.forEach(s=>{os(n,s.mutationKey)&&Object.assign(i,s.defaultOptions)}),i}defaultQueryOptions(n){if(n._defaulted)return n;const l={...M(this,pl).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return l.queryHash||(l.queryHash=Af(l.queryKey,l)),l.refetchOnReconnect===void 0&&(l.refetchOnReconnect=l.networkMode!=="always"),l.throwOnError===void 0&&(l.throwOnError=!!l.suspense),!l.networkMode&&l.persister&&(l.networkMode="offlineFirst"),l.queryFn===Ef&&(l.enabled=!1),l}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...M(this,pl).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){M(this,lt).clear(),M(this,hl).clear()}},lt=new WeakMap,hl=new WeakMap,pl=new WeakMap,ei=new WeakMap,ti=new WeakMap,vl=new WeakMap,ai=new WeakMap,ni=new WeakMap,Fx),Tb=S.createContext(void 0),Wt=n=>{const l=S.useContext(Tb);if(!l)throw new Error("No QueryClient set, use QueryClientProvider to set one");return l},V2=({client:n,children:l})=>(S.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),o.jsx(Tb.Provider,{value:n,children:l})),Ab=S.createContext(!1),F2=()=>S.useContext(Ab);Ab.Provider;function Z2(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var J2=S.createContext(Z2()),I2=()=>S.useContext(J2),W2=(n,l,i)=>{const s=i!=null&&i.state.error&&typeof n.throwOnError=="function"?kf(n.throwOnError,[i.state.error,i]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||s)&&(l.isReset()||(n.retryOnMount=!1))},eS=n=>{S.useEffect(()=>{n.clearReset()},[n])},tS=({result:n,errorResetBoundary:l,throwOnError:i,query:s,suspense:u})=>n.isError&&!l.isReset()&&!n.isFetching&&s&&(u&&n.data===void 0||kf(i,[n.error,s])),aS=n=>{if(n.suspense){const i=u=>u==="static"?u:Math.max(u??1e3,1e3),s=n.staleTime;n.staleTime=typeof s=="function"?(...u)=>i(s(...u)):i(s),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},nS=(n,l)=>n.isLoading&&n.isFetching&&!l,lS=(n,l)=>(n==null?void 0:n.suspense)&&l.isPending,sx=(n,l,i)=>l.fetchOptimistic(n).catch(()=>{i.clearReset()});function rS(n,l,i){var N,T,E,L;const s=F2(),u=I2(),f=Wt(),h=f.defaultQueryOptions(n);(T=(N=f.getDefaultOptions().queries)==null?void 0:N._experimental_beforeQuery)==null||T.call(N,h);const v=f.getQueryCache().get(h.queryHash),p=n.subscribed!==!1;h._optimisticResults=s?"isRestoring":p?"optimistic":void 0,aS(h),W2(h,u,v),eS(u);const x=!f.getQueryCache().get(h.queryHash),[y]=S.useState(()=>new l(f,h)),g=y.getOptimisticResult(h),j=!s&&p;if(S.useSyncExternalStore(S.useCallback(z=>{const Q=j?y.subscribe(vt.batchCalls(z)):qt;return y.updateResult(),Q},[y,j]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(h)},[h,y]),lS(h,g))throw sx(h,y,u);if(tS({result:g,errorResetBoundary:u,throwOnError:h.throwOnError,query:v,suspense:h.suspense}))throw g.error;if((L=(E=f.getDefaultOptions().queries)==null?void 0:E._experimental_afterQuery)==null||L.call(E,h,g),h.experimental_prefetchInRender&&!cs.isServer()&&nS(g,s)){const z=x?sx(h,y,u):v==null?void 0:v.promise;z==null||z.catch(qt).finally(()=>{y.updateResult()})}return h.notifyOnChangeProps?g:y.trackResult(g)}function $t(n,l){return rS(n,H2)}function zt(n,l){const i=Wt(),[s]=S.useState(()=>new P2(i,n));S.useEffect(()=>{s.setOptions(n)},[s,n]);const u=S.useSyncExternalStore(S.useCallback(h=>s.subscribe(vt.batchCalls(h)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),f=S.useCallback((h,v)=>{s.mutate(h,v).catch(qt)},[s]);if(u.error&&kf(s.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}/**
|
|
61
|
-
* @license lucide-react v1.17.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const Eb=(...n)=>n.filter((l,i,s)=>!!l&&l.trim()!==""&&s.indexOf(l)===i).join(" ").trim();/**
|
|
66
|
-
* @license lucide-react v1.17.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const iS=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
71
|
-
* @license lucide-react v1.17.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const sS=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(l,i,s)=>s?s.toUpperCase():i.toLowerCase());/**
|
|
76
|
-
* @license lucide-react v1.17.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const ox=n=>{const l=sS(n);return l.charAt(0).toUpperCase()+l.slice(1)};/**
|
|
81
|
-
* @license lucide-react v1.17.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/var Rd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
86
|
-
* @license lucide-react v1.17.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const oS=n=>{for(const l in n)if(l.startsWith("aria-")||l==="role"||l==="title")return!0;return!1},cS=S.createContext({}),uS=()=>S.useContext(cS),dS=S.forwardRef(({color:n,size:l,strokeWidth:i,absoluteStrokeWidth:s,className:u="",children:f,iconNode:h,...v},p)=>{const{size:x=24,strokeWidth:y=2,absoluteStrokeWidth:g=!1,color:j="currentColor",className:N=""}=uS()??{},T=s??g?Number(i??y)*24/Number(l??x):i??y;return S.createElement("svg",{ref:p,...Rd,width:l??x??Rd.width,height:l??x??Rd.height,stroke:n??j,strokeWidth:T,className:Eb("lucide",N,u),...!f&&!oS(v)&&{"aria-hidden":"true"},...v},[...h.map(([E,L])=>S.createElement(E,L)),...Array.isArray(f)?f:[f]])});/**
|
|
91
|
-
* @license lucide-react v1.17.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const De=(n,l)=>{const i=S.forwardRef(({className:s,...u},f)=>S.createElement(dS,{ref:f,iconNode:l,className:Eb(`lucide-${iS(ox(n))}`,`lucide-${n}`,s),...u}));return i.displayName=ox(n),i};/**
|
|
96
|
-
* @license lucide-react v1.17.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const fS=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],mS=De("activity",fS);/**
|
|
101
|
-
* @license lucide-react v1.17.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const hS=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],pS=De("arrow-down",hS);/**
|
|
106
|
-
* @license lucide-react v1.17.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const vS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],nc=De("arrow-right",vS);/**
|
|
111
|
-
* @license lucide-react v1.17.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const xS=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],bS=De("arrow-up-right",xS);/**
|
|
116
|
-
* @license lucide-react v1.17.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const gS=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],kb=De("arrow-up",gS);/**
|
|
121
|
-
* @license lucide-react v1.17.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const yS=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],SS=De("box",yS);/**
|
|
126
|
-
* @license lucide-react v1.17.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const jS=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],NS=De("boxes",jS);/**
|
|
131
|
-
* @license lucide-react v1.17.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const wS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ht=De("check",wS);/**
|
|
136
|
-
* @license lucide-react v1.17.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const MS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],CS=De("chevron-down",MS);/**
|
|
141
|
-
* @license lucide-react v1.17.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const TS=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],sf=De("circle-dashed",TS);/**
|
|
146
|
-
* @license lucide-react v1.17.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const AS=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],ES=De("clipboard",AS);/**
|
|
151
|
-
* @license lucide-react v1.17.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const kS=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],RS=De("copy",kS);/**
|
|
156
|
-
* @license lucide-react v1.17.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const zS=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],_S=De("cpu",zS);/**
|
|
161
|
-
* @license lucide-react v1.17.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const OS=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],us=De("credit-card",OS);/**
|
|
166
|
-
* @license lucide-react v1.17.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const DS=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],US=De("database",DS);/**
|
|
171
|
-
* @license lucide-react v1.17.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const LS=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Rb=De("git-branch",LS);/**
|
|
176
|
-
* @license lucide-react v1.17.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const BS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],qS=De("info",BS);/**
|
|
181
|
-
* @license lucide-react v1.17.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const HS=[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z",key:"yxxwt6"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]],$S=De("landmark",HS);/**
|
|
186
|
-
* @license lucide-react v1.17.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const QS=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],KS=De("list",QS);/**
|
|
191
|
-
* @license lucide-react v1.17.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const YS=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tt=De("loader-circle",YS);/**
|
|
196
|
-
* @license lucide-react v1.17.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const PS=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],GS=De("network",PS);/**
|
|
201
|
-
* @license lucide-react v1.17.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const XS=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],VS=De("pencil",XS);/**
|
|
206
|
-
* @license lucide-react v1.17.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const FS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ds=De("plus",FS);/**
|
|
211
|
-
* @license lucide-react v1.17.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const ZS=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Zo=De("refresh-cw",ZS);/**
|
|
216
|
-
* @license lucide-react v1.17.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const JS=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],IS=De("rotate-ccw",JS);/**
|
|
221
|
-
* @license lucide-react v1.17.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const WS=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ys=De("search",WS);/**
|
|
226
|
-
* @license lucide-react v1.17.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const ej=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],tj=De("settings-2",ej);/**
|
|
231
|
-
* @license lucide-react v1.17.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const aj=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],nj=De("shield-check",aj);/**
|
|
236
|
-
* @license lucide-react v1.17.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const lj=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],rj=De("smartphone",lj);/**
|
|
241
|
-
* @license lucide-react v1.17.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const ij=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],sj=De("terminal",ij);/**
|
|
246
|
-
* @license lucide-react v1.17.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const oj=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],zf=De("trash-2",oj);/**
|
|
251
|
-
* @license lucide-react v1.17.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const cj=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],uj=De("trending-up",cj);/**
|
|
256
|
-
* @license lucide-react v1.17.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const dj=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]],rs=De("wallet-cards",dj);/**
|
|
261
|
-
* @license lucide-react v1.17.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const fj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zl=De("x",fj);class zb extends Error{constructor(i,s,u){super(i);yd(this,"status");yd(this,"code");this.status=s,this.code=u}}async function Qt(n){var i,s;const l=await fetch(n);if(!l.ok){const u=await l.json().catch(()=>({}));throw new zb(((i=u.error)==null?void 0:i.message)??`${n} returned ${l.status}`,l.status,(s=u.error)==null?void 0:s.code)}return l.json()}async function xt(n,l,i){var u,f;const s=await fetch(l,{method:n,headers:i?{"content-type":"application/json"}:void 0,body:i?JSON.stringify(i):void 0});if(!s.ok){const h=await s.json().catch(()=>({}));throw new zb(((u=h.error)==null?void 0:u.message)??`${n} ${l} returned ${s.status}`,s.status,(f=h.error)==null?void 0:f.code)}return s.json()}function lc(){return $t({queryKey:["ledger","inferences"],queryFn:()=>Qt("/ledger/inferences"),refetchInterval:1e4})}function mj(){return $t({queryKey:["ledger","purchases"],queryFn:()=>Qt("/ledger/purchases"),refetchInterval:1e4})}function _f(){return $t({queryKey:["payments"],queryFn:()=>Qt("/payments"),refetchInterval:1e4})}function hj(){const n=Wt();return zt({mutationFn:l=>xt("PUT","/payments/default",{method:l}),onSuccess:()=>{n.invalidateQueries({queryKey:["payments"]}),n.invalidateQueries({queryKey:["routing","provider-mode"]})}})}function Of(){const n=Wt();return zt({mutationFn:()=>xt("POST","/payments/clawtip/activate"),onSuccess:()=>{n.invalidateQueries({queryKey:["payments"]})}})}function Df(){return zt({mutationFn:()=>xt("POST","/payments/clawtip/recharge")})}function _b(){return $t({queryKey:["routing","strategy"],queryFn:()=>Qt("/routing/strategy")})}function pj(){const n=Wt();return zt({mutationFn:l=>xt("PUT","/routing/strategy",l),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","strategy"]})}})}function Ob(){return $t({queryKey:["routing","provider-mode"],queryFn:()=>Qt("/routing/provider-mode")})}function vj(){const n=Wt();return zt({mutationFn:l=>xt("PUT","/routing/provider-mode",{mode:l}),onSuccess:l=>{n.setQueryData(["routing","provider-mode"],l),n.invalidateQueries({queryKey:["routing","provider-mode"]}),n.invalidateQueries({queryKey:["routing","auto-provider"]}),n.invalidateQueries({queryKey:["routing","strategy"]}),n.invalidateQueries({queryKey:["models"]})}})}function Db(){return $t({queryKey:["routing","auto-provider"],queryFn:()=>Qt("/routing/auto-provider")})}function xj(){const n=Wt();return zt({mutationFn:l=>xt("PUT","/routing/auto-provider",l),onSuccess:l=>{n.setQueryData(["routing","auto-provider"],{config:l.config,active:l.autoEnabled,locked:l.locked.auto,paymentReady:l.paymentReady,paymentRequired:l.paymentRequired,paymentLabel:l.paymentLabel}),n.setQueryData(["routing","provider-mode"],l),n.invalidateQueries({queryKey:["routing","auto-provider"]}),n.invalidateQueries({queryKey:["routing","provider-mode"]}),n.invalidateQueries({queryKey:["routing","strategy"]}),n.invalidateQueries({queryKey:["prewarm","focus-set"]}),n.invalidateQueries({queryKey:["models"]})}})}function Ub(){return $t({queryKey:["routing","manual-providers"],queryFn:()=>Qt("/routing/manual-providers")})}function bj(){const n=Wt();return zt({mutationFn:l=>xt("POST","/routing/manual-providers/local",l),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function gj(){const n=Wt();return zt({mutationFn:({providerId:l,input:i})=>xt("PUT",`/routing/manual-providers/local/${encodeURIComponent(l)}`,i),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function yj(){const n=Wt();return zt({mutationFn:l=>xt("DELETE",`/routing/manual-providers/${encodeURIComponent(l)}`),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function Sj(){const n=Wt();return zt({mutationFn:l=>xt("PUT","/routing/manual-providers/order",{providerIds:l}),onSuccess:l=>{n.setQueryData(["routing","manual-providers"],l),n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function jj(){const n=Wt();return zt({mutationFn:l=>xt("PUT","/routing/manual-providers/routing",l),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function Nj(n){return xt("POST","/routing/manual-providers/probe",n)}function wj(n){const l=new URLSearchParams;for(const[i,s]of Object.entries(n))s!=null&&s!==""&&l.set(i,Mj(s));return $t({queryKey:["routing","preview",l.toString()],queryFn:()=>Qt(`/routing/preview?${l.toString()}`),enabled:!1})}function Mj(n){return Array.isArray(n)?n.join(","):typeof n=="object"&&n!==null?Object.entries(n).map(([l,i])=>`${l}:${i}`).join(","):String(n)}function Lb(){return $t({queryKey:["sellers"],queryFn:()=>Qt("/sellers"),refetchInterval:3e4})}function rc(){return $t({queryKey:["models"],queryFn:()=>Qt("/models"),refetchInterval:3e4})}function Cj(){return $t({queryKey:["prewarm","focus-set"],queryFn:()=>Qt("/v1.2/prewarm").then(n=>({ok:!0,focusSet:n.focusSet??[],source:"historical"}))})}async function of(n){const l=Array.isArray(n)?{models:n}:n;return xt("PUT","/prewarm/focus-set",l)}function Uf(){return $t({queryKey:["status"],queryFn:()=>Qt("/status"),refetchInterval:5e3})}function Tj(){return $t({queryKey:["update","status"],queryFn:()=>Qt("/update/status"),refetchInterval:3600*1e3})}function Aj(){return zt({mutationFn:()=>xt("POST","/update/run")})}const Oe="—",en="-",It=n=>n<10?`0${n}`:`${n}`;function cf(n,l={}){if(!Number.isFinite(n))return Oe;const i=n;return i<=0?en:l.compact===!1||i<1e4?Math.round(i).toLocaleString("en-US"):i<1e6?`${(i/1e3).toFixed(1)}K`:i<1e9?`${(i/1e6).toFixed(1)}M`:`${(i/1e9).toFixed(2)}B`}function Yo(n){if(!Number.isFinite(n))return Oe;const l=n;return l<=0?en:l<1e4?Math.round(l).toLocaleString("en-US"):l<1e6?`${(l/1e3).toFixed(2)}K`:l<1e9?`${(l/1e6).toFixed(2)}M`:`${(l/1e9).toFixed(2)}B`}function Bb(n){return Number.isFinite(n)?n<=0?en:`${n.toFixed(1)} tok/s`:Oe}function ic(n){return Number.isFinite(n)?n<=0?en:n.toFixed(1):Oe}function qe(n){return Number.isFinite(n)?n===0?en:Math.round(n).toLocaleString("en-US"):Oe}function Ja(n,l={}){if(!Number.isFinite(n))return Oe;if(n===0)return en;const i=Math.abs(n/1e6),s=l.digits??(l.ledger&&i<.01?6:4),u=`$${(n/1e6).toFixed(s)}`;return l.signed&&n>=0?`+${u}`:u}function Kr(n,l={}){return Ja(n,{digits:l.digits??6})}function Ej(n){var s,u;const l=(s=n.paymentCurrency)==null?void 0:s.trim().toUpperCase(),i=(u=n.paymentAmount)==null?void 0:u.trim();return l==="USD"&&Number.isFinite(n.paymentAmountMinor)?`$${(n.paymentAmountMinor/100).toFixed(4)}`:l==="CNY"&&Number.isFinite(n.paymentAmountMinor)?`¥${(n.paymentAmountMinor/100).toFixed(2)} CNY`:i&&l?l==="USD"?`${cx(l)}${i}`:`${cx(l)}${i} ${l}`:Number.isFinite(n.paymentAmountMinor)&&l?`${qe(n.paymentAmountMinor)} ${l} minor`:Oe}function kj(n,l){if(!Number.isFinite(n)||!l)return Oe;const i=l.trim().toUpperCase();return i==="USD"?`$${(n/100).toFixed(4)}`:i==="CNY"?`¥${(n/100).toFixed(2)} CNY`:`${qe(n)} ${i} minor`}function cx(n){return n==="USD"?"$":n==="CNY"?"¥":n==="EUR"?"€":n==="GBP"?"£":""}function Rj(n,l,i={}){return!Number.isFinite(n)&&!Number.isFinite(l)?Oe:`${Ja(n,i)} / ${Ja(l,i)}`}function Jl(n){if(!Number.isFinite(n))return Oe;const l=Math.max(0,Math.round(n));return l===0?en:l<1e3?`${l}ms`:`${(l/1e3).toFixed(2)}s`}function qb(n){return Number.isFinite(n)?`${Math.round(n*100)}%`:Oe}function Lf(n){if(!Number.isFinite(n))return Oe;const l=Math.max(0,n);return l===0?"免费":Math.abs(l-1)<1e-4?"原价":`${_j(l*10)}折`}function ux(n,l){return Rj(n,l,{digits:4})}function Jo(n){const l=Ja(n,{digits:4});return l===Oe||l===en?l:`${l} / 1M Token`}function zj(n){return Number.isFinite(n)?n<=0?en:`${n.toFixed(2)}x`:Oe}function _j(n){const l=Math.round(n*10)/10;return Number.isInteger(l)?String(l):l.toFixed(1)}function is(n){return n?n.trim().toLowerCase().replaceAll("_"," "):Oe}function zd(n){const l=is(n);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"?"green":l==="fallback"||l==="pending"||l==="degraded"||l==="preview"?"amber":l==="failed"||l==="error"||l==="canceled"||l==="unhealthy"||l==="offline"?"red":l==="running"?"blue":"gray"}function Oj(n){return n?n.startsWith("tbs-")&&n.length>10?n.slice(0,10):n.length<=12?n:n.slice(0,12):Oe}function Dj(n){if(!n)return Oe;const l=new Date(n);if(Number.isNaN(l.getTime()))return Oe;const i=new Date,s=l.getFullYear()===i.getFullYear()&&l.getMonth()===i.getMonth()&&l.getDate()===i.getDate(),u=`${It(l.getHours())}:${It(l.getMinutes())}`;return s?u:`${It(l.getMonth()+1)}/${It(l.getDate())} ${u}`}function sc(n){if(!n)return Oe;const l=new Date(n);return Number.isNaN(l.getTime())?Oe:`${l.getFullYear()}-${It(l.getMonth()+1)}-${It(l.getDate())} ${It(l.getHours())}:${It(l.getMinutes())}:${It(l.getSeconds())}`}function oc(n){if(!n)return Oe;const l=new Date(n);return Number.isNaN(l.getTime())?Oe:`${l.getFullYear()}/${It(l.getMonth()+1)}/${It(l.getDate())} ${It(l.getHours())}:${It(l.getMinutes())}:${It(l.getSeconds())}`}function Uj(n){return Dj(n)}function Hb(n,l){const i=new Map;for(const s of[...l].sort((u,f)=>u.createdAt.localeCompare(f.createdAt)))!s.paymentMethod||s.balanceSnapshotMicros===void 0||i.set(Ia(s.paymentMethod),s.balanceSnapshotMicros);return[...n].filter(s=>Ia(s.method)!=="mock").sort((s,u)=>Number(u.isDefault)-Number(s.isDefault)||s.method.localeCompare(u.method)).map(s=>{const u=Ia(s.method),f=s.enabled||!!(s.config&&Object.keys(s.config).length>0),h=i.get(u),v=u==="clawtip";return{name:Qb(s.method),method:s.method,balance:v?"••••":Ja(h),status:s.enabled?"Bound":"Available",note:f?s.isDefault?"Default wallet":"Configured":"Not bound",action:s.enabled?"Recharge":"Activate",icon:Lj(s.method),balanceHidden:v,config:s.config}})}function $b({modal:n,methods:l,qr:i,loading:s,error:u,onClose:f}){const h=n.kind==="recharge",v=l.find(E=>E.method===n.method),p=h&&Ia(n.method)==="clawtip",x=_d(v==null?void 0:v.config,"resourceUrl"),y=_d(v==null?void 0:v.config,"walletConfigPath"),g=_d(v==null?void 0:v.config,"orderNo"),j=(i==null?void 0:i.walletConfigPresent)===!0||Kb(v==null?void 0:v.config,"walletConfigPresent"),N=!h&&!!(i!=null&&i.qrImageUrl)&&!j&&!u,T=(v==null?void 0:v.name)??Qb(n.method);return o.jsx("div",{className:"fixed inset-0 z-30 grid place-items-center overflow-y-auto bg-[rgba(32,26,56,0.28)] px-4 py-6",children:o.jsxs("div",{className:"w-full max-w-[820px] rounded-[14px] bg-white p-5 shadow-[0_20px_56px_rgba(32,26,56,0.20)] sm:p-6",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-[1.05rem] font-semibold text-[var(--color-ink)]",children:p?"ClawTip wallet QR":h?`Recharge ${T}`:`Activate ${T}`}),o.jsx("p",{className:"mt-1 text-[0.82rem] leading-5 text-[var(--color-muted)]",children:p?"Scan with JD app to view wallet balance or recharge.":h?"Load the fixed ClawTip recharge QR from static assets.":"Reuse the tb init ClawTip flow and wait for wallet binding."})]}),o.jsx("button",{className:"tb-button tb-button-icon tb-button-quiet",onClick:f,"aria-label":"Close payment modal",children:o.jsx(Zl,{className:"size-4"})})]}),o.jsxs("div",{className:"mt-5 flex flex-col gap-4",children:[o.jsx("div",{className:"mx-auto grid min-h-[320px] w-full max-w-[720px] place-items-center overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-3 sm:min-h-[560px] sm:p-4",children:i!=null&&i.qrImageUrl?o.jsx("img",{className:"max-h-[72vh] w-full object-contain",src:i.qrImageUrl,alt:`${T} ${h?"recharge":"activation"} QR code`}):o.jsxs("div",{className:"flex flex-col items-center gap-2 px-3 text-center text-[0.78rem] leading-5 text-[var(--color-muted)]",children:[s?o.jsx(Tt,{className:"size-5 animate-spin text-[var(--color-purple)]"}):null,o.jsx("span",{children:s?"Generating ClawTip QR...":"QR image unavailable"})]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[o.jsx(es,{label:"Method",value:T}),o.jsx(es,{label:"Wallet",value:j?"bound":"waiting",warn:!j}),i!=null&&i.orderNo||g?o.jsx(es,{label:"Order",value:(i==null?void 0:i.orderNo)??g??""}):null,i!=null&&i.walletConfigPath||y?o.jsx(es,{label:"Config",value:qj((i==null?void 0:i.walletConfigPath)??y??"")}):null,i!=null&&i.clawtipId?o.jsx(es,{label:"Device",value:i.clawtipId}):null]}),u?o.jsx("div",{className:"rounded-[8px] border border-rose-100 bg-rose-50 px-3 py-2 text-[0.78rem] leading-5 text-rose-700",children:u instanceof Error?u.message:String(u)}):null,i!=null&&i.qrImageUrl?o.jsx("div",{className:"rounded-[8px] border border-emerald-100 bg-emerald-50 px-3 py-2 text-[0.78rem] leading-5 text-emerald-800",children:h?"Scan with JD app to view wallet balance or recharge.":o.jsxs("span",{className:"flex items-start gap-2",children:[N?o.jsx(Tt,{className:"mt-0.5 size-4 shrink-0 animate-spin"}):null,o.jsx("span",{children:j?"Wallet bound. Closing...":"Scan with JD app. TokenBuddy is waiting for the local wallet config."})]})}):null,i!=null&&i.resourceUrl||x?o.jsx("a",{className:"tb-button tb-button-md tb-button-secondary w-full justify-start overflow-hidden font-mono text-[0.75rem]",href:(i==null?void 0:i.resourceUrl)??x,target:"_blank",rel:"noreferrer",children:Bj((i==null?void 0:i.resourceUrl)??x??"")}):!(i!=null&&i.qrImageUrl)&&!s&&!u?o.jsxs("div",{className:"rounded-[8px] border border-amber-100 bg-amber-50 px-3 py-2 text-[0.78rem] leading-5 text-amber-800",children:["No recharge link is available from the daemon. Run ",o.jsx("span",{className:"font-mono",children:"tb init"})," to bind this payment method."]}):null]})]})]})})}function Qb(n){const l=Ia(n);return l==="clawtip"?"ClawTip":l==="alipay-agent"?"Alipay Agent Payment":l==="wechat-pay"?"WeChat Pay":l==="coinbase-smart-wallet"?"Coinbase Smart Wallet":n.split(/[-_\s]+/).filter(Boolean).map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ")}function Ia(n){return n.trim().toLowerCase()}function Kb(n,l){return(n==null?void 0:n[l])===!0}function es({label:n,value:l,warn:i=!1}){return o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("div",{className:"text-[0.78rem] text-[var(--color-muted)]",children:n}),o.jsx("div",{className:["font-mono text-[0.94rem] font-semibold",i?"text-amber-700":"text-[var(--color-ink)]"].join(" "),children:l})]})}function Lj(n){const l=Ia(n);return l==="clawtip"?"C":l==="wechat-pay"?"W":l==="alipay-agent"?"A":l.charAt(0).toUpperCase()||"P"}function Bj(n){try{const l=new URL(n),i=l.pathname==="/"?"":l.pathname;return`${l.host}${i}`.slice(0,34)}catch{return n.length>34?`${n.slice(0,31)}...`:n}}function qj(n){const l=n.split("/");return l.length<=3?n:`.../${l.slice(-2).join("/")}`}function _d(n,l){const i=n==null?void 0:n[l];return typeof i=="string"&&i.length>0?i:void 0}const Hj=320,Od=12;function $j({inputTokens:n,outputTokens:l,cacheReadTokens:i}){const s=Vb(n,l,i),u=Number.isFinite(i),f=Number.isFinite(i)&&i>0,h=[{label:"输入 Token",value:qe(n)},{label:"输出 Token",value:qe(l)}];return u&&h.push({label:"缓存读取 Token",value:qe(i)}),h.push({label:"总 Token",value:qe(s),dividerBefore:!0,emphasis:!0}),o.jsxs("span",{className:"inline-flex min-w-[13rem] items-center gap-2 align-middle",children:[o.jsxs("span",{className:"grid min-w-0 gap-1",children:[o.jsxs("span",{className:"inline-flex items-center gap-4 whitespace-nowrap font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:[o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx(pS,{className:"size-3.5 text-[var(--color-success)]","aria-hidden":"true"}),qe(n)]}),o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx(kb,{className:"size-3.5 text-[var(--color-primary)]","aria-hidden":"true"}),qe(l)]})]}),f?o.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap font-mono text-[0.78rem] font-semibold text-[var(--color-tokens)]",children:[o.jsx(US,{className:"size-3.5","aria-hidden":"true"}),cf(i)]}):null]}),o.jsx(Gb,{ariaLabel:"Token 明细",children:o.jsx(Xb,{title:"Token 明细",rows:h})})]})}function Qj({inputTokens:n,outputTokens:l}){const i=Vb(n,l);return o.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[o.jsx("div",{className:"grid size-[4.5rem] shrink-0 place-items-center rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] text-[var(--color-tokens)]",children:o.jsx(SS,{className:"size-7","aria-hidden":"true"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-[0.8rem] font-bold uppercase tracking-normal text-[var(--color-muted)]",children:"总 Token"}),o.jsx("div",{className:"mt-1 font-mono text-[2rem] font-bold leading-none tracking-normal text-[var(--color-ink)]",children:Yo(i)}),o.jsxs("div",{className:"mt-1 font-mono text-[0.9rem] font-medium leading-snug tracking-normal text-[var(--color-muted)]",children:["输入: ",Yo(n)," / 输出: ",Yo(l)]})]})]})}function Kj(n){const l=n.settledUsdMicros??n.billedMicros,i=Yj(n,l);return o.jsxs("span",{className:"inline-flex items-center gap-2 align-middle",children:[o.jsx("span",{className:"whitespace-nowrap font-mono text-[0.9rem] font-semibold text-[var(--color-spend)]",children:Kr(l)}),o.jsx(Gb,{ariaLabel:"成本明细",children:o.jsx(Xb,{title:"成本明细",rows:i})})]})}function Yb({inputPriceMicrosPer1m:n,outputPriceMicrosPer1m:l}){return o.jsxs("span",{className:"grid gap-0.5 font-mono text-[0.78rem] leading-snug text-[var(--color-muted)]",children:[o.jsxs("span",{children:["输入 ",Jo(n)]}),o.jsxs("span",{children:["输出 ",Jo(l)]})]})}function Pb({ttftMs:n,tokensPerSecond:l,compact:i=!1}){return i?o.jsxs("span",{className:"font-mono",children:["TTFT ",Jl(n)," / ",Bb(l)]}):o.jsxs("span",{className:"inline-grid gap-0.5 font-mono text-[0.78rem] leading-snug",children:[o.jsxs("span",{children:[o.jsx("span",{className:"text-[var(--color-muted)]",children:"TTFT"})," ",Jl(n)]}),o.jsxs("span",{children:[o.jsx("span",{className:"text-[var(--color-muted)]",children:"Tok/s"})," ",ic(l)]})]})}function Yj(n,l){const i=[];return Ul(i,"输入成本",Kr(n.inputCostMicros),n.inputCostMicros),Ul(i,"输出成本",Kr(n.outputCostMicros),n.outputCostMicros),Ul(i,"输入单价",Jo(n.inputPriceMicrosPer1m),n.inputPriceMicrosPer1m),Ul(i,"输出单价",Jo(n.outputPriceMicrosPer1m),n.outputPriceMicrosPer1m),Ul(i,"缓存读取成本",Kr(n.cacheReadCostMicros),n.cacheReadCostMicros),n.serviceTier&&i.push({label:"服务档位",value:n.serviceTier,dividerBefore:i.length>0}),Ul(i,"倍率",zj(n.billingMultiplier),n.billingMultiplier),Ul(i,"原始",Kr(n.originalUsdMicros),n.originalUsdMicros),i.push({label:"计费",value:Kr(l),dividerBefore:i.length>0,emphasis:!0}),i.length===1&&i.unshift({label:"明细",value:Oe}),i}function Ul(n,l,i,s){Number.isFinite(s)&&n.push({label:l,value:i})}function Gb({ariaLabel:n,children:l}){const i=S.useRef(null),[s,u]=S.useState(!1),[f,h]=S.useState(),v=S.useCallback(()=>{const x=i.current;if(!x)return;const y=x.getBoundingClientRect(),g=window.innerWidth-Hj-Od,j=Math.max(Od,Math.min(g,y.right+8)),N=Math.max(Od,y.top+y.height/2-32);h({top:N,left:j})},[]),p=S.useCallback(()=>{v(),u(!0)},[v]);return S.useEffect(()=>{if(s)return v(),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[s,v]),o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:i,type:"button","aria-label":n,className:"inline-grid size-6 shrink-0 place-items-center rounded-full border border-[var(--color-line)] bg-[var(--color-panel-subtle)] text-[var(--color-muted)] hover:border-[var(--color-primary)] hover:text-[var(--color-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]/30",onMouseEnter:p,onMouseLeave:()=>u(!1),onFocus:p,onBlur:()=>u(!1),onClick:()=>{v(),u(x=>!x)},children:o.jsx(qS,{className:"size-3.5","aria-hidden":"true"})}),s&&f&&typeof document<"u"?S2.createPortal(o.jsx("div",{className:"pointer-events-none fixed z-50 w-[20rem] rounded-[var(--radius-lg)] border border-[var(--color-line)] bg-white p-4 shadow-[var(--shadow-modal)]",style:{top:f.top,left:f.left},children:l}),document.body):null]})}function Xb({title:n,rows:l}){return o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-[0.92rem] font-bold text-[var(--color-ink)]",children:n}),o.jsx("div",{className:"grid gap-1",children:l.map((i,s)=>o.jsxs("div",{className:["grid grid-cols-[1fr_auto] items-baseline gap-4 text-[0.86rem]",i.dividerBefore?"mt-1 border-t border-[var(--color-line-2)] pt-2":""].join(" "),children:[o.jsx("span",{className:"text-[var(--color-muted)]",children:i.label}),o.jsx("span",{className:["font-mono tracking-normal",i.emphasis?"font-bold text-[var(--color-ink)]":"font-semibold text-[var(--color-ink)]",i.value===en?"text-[var(--color-muted)]":""].join(" "),children:i.value})]},`${i.label}-${s}`))})]})}function Vb(...n){return n.reduce((l,i)=>l+(Number.isFinite(i)?i:0),0)}function At({children:n,className:l=""}){return o.jsx("div",{className:["rounded-[var(--radius-xl)] border border-[var(--color-line-2)] bg-white shadow-[var(--shadow-panel)]",l].join(" "),children:n})}function Ss(n){return{router:{card:"border border-[var(--color-hairline-strong)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-lavender-2)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-lavender-2)] bg-[var(--color-lavender)] text-[var(--color-router)]",label:"text-[var(--color-router)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},requests:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-success-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-success-border)] bg-[var(--color-success-soft)] text-[var(--color-success)]",label:"text-[var(--color-success)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},spend:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-spend-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-spend-border)] bg-[var(--color-spend-soft)] text-[var(--color-spend)]",label:"text-[var(--color-spend)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},tokens:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-tokens-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-tokens-border)] bg-[var(--color-tokens-soft)] text-[var(--color-tokens)]",label:"text-[var(--color-tokens)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},inventory:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-inventory-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-inventory-border)] bg-[var(--color-inventory-soft)] text-[var(--color-inventory)]",label:"text-[var(--color-inventory)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"}}[n]}function Bf({tone:n,children:l,className:i="size-7"}){const s=Ss(n);return o.jsx("div",{className:[`grid ${i} place-items-center rounded-[var(--radius-md)]`,s.icon].join(" "),children:l})}function dx({icon:n,label:l,tone:i,rows:s}){const u=Ss(i);return o.jsxs(At,{className:"relative min-h-[9rem] overflow-hidden border-[var(--color-hairline)] bg-white px-4 py-4",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[o.jsx(Bf,{tone:i,className:"size-10",children:n}),o.jsx("div",{className:["text-[0.72rem] font-bold uppercase tracking-[0.08em]",u.label].join(" "),children:l})]}),o.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:s.map(f=>o.jsxs("div",{className:"min-w-0 rounded-[8px] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 py-2",children:[o.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:f.label}),o.jsx("div",{className:["mt-1 truncate font-mono text-[1.15rem] font-bold leading-tight tracking-normal",u.value].join(" "),children:f.value}),o.jsx("div",{className:"mt-1 truncate text-[0.72rem] font-medium text-[var(--color-muted)]",children:f.detail})]},f.key))})]})}function Pj({tone:n="lavender",children:l}){const i={lavender:"bg-[var(--color-lavender)] text-[var(--color-primary)]",green:"bg-[var(--color-success-soft)] text-[var(--color-success)]",amber:"bg-[var(--color-warning-soft)] text-[var(--color-warning)]",red:"bg-[var(--color-danger-soft)] text-[var(--color-danger)]",blue:"bg-[var(--color-tokens-soft)] text-[var(--color-tokens)]",gray:"bg-slate-100 text-slate-600"};return o.jsxs("span",{className:["inline-flex items-center gap-1.5 text-[0.78rem] font-medium px-2.5 py-0.5 rounded-[var(--radius-pill)]",i[n]??i.lavender].join(" "),children:[o.jsx("span",{className:"size-1.5 rounded-full bg-current"}),l]})}const fx="tokenbuddy-ui-language",mx={en:{"nav.overview":"Overview","nav.routing":"Routing","nav.ledger":"Ledger","nav.tools":"Tools","language.label":"Language","language.english":"EN","language.chinese":"中文","language.switchToEnglish":"Switch to English","language.switchToChinese":"切换到中文","common.add":"Add","common.cancel":"Cancel","common.close":"Close","common.save":"Save","common.delete":"Delete","common.edit":"Edit","common.select":"Select","common.search":"Search","common.loading":"Loading...","common.refresh":"Refresh","common.connected":"Connected","common.installed":"Installed","common.manual":"Manual","common.missing":"Missing","common.current":"Current","common.unknown":"unknown","common.active":"Active","common.bind":"Bind {name}","common.recharge":"Recharge","common.notAvailable":"{name} is not available in Manual mode.","overview.providerMode.label":"Provider mode","overview.providerMode.manualValue":"Manual","overview.providerMode.autoValue":"Auto","overview.providerMode.manualStats":"{count} provider{plural} · {policy}","overview.providerMode.manualNote":"Uses your provider list only","overview.providerMode.autoStats":"{range} · {models} model{modelPlural} · {sellers} seller{sellerPlural}","overview.providerMode.autoPolicy":"{scorer} · {payment}","overview.providerMode.autoPolicyNoPayment":"{scorer}","overview.providerMode.recommendedRange":"Recommended","overview.providerMode.customRange":"Custom","overview.providerMode.fallbackPolicy":"fallback","overview.providerMode.fixedProvider":"fixed provider","overview.providerMode.balancedScorer":"balanced","overview.providerMode.speedScorer":"speed first","overview.providerMode.costScorer":"cost first","tools.title":"App connections","tools.connectedSummary":"{configured}/{total} connected","tools.refreshStatus":"Refresh tool status","tools.oneClick":"One-click setup","tools.tool":"Tool","tools.protocol":"Protocol","tools.status":"Status","tools.actions":"Actions","tools.disconnect":"Disconnect","tools.connect":"Connect","tools.getApp":"Get app","tools.importCcSwitch":"Import {name} provider with CC Switch","tools.disconnectFrom":"Disconnect TokenBuddy from {name}","tools.connectTo":"Connect {name} to TokenBuddy","tools.manualSetup":"Compatible agents","tools.appsCount":"{count} apps","tools.searchApps":"Search apps","tools.searchAppsPlaceholder":"Search apps or protocols","tools.noMatchingApp":"No matching app","tools.configuration":"Configuration","tools.openAiBaseUrl":"OpenAI base URL","tools.anthropicBaseUrl":"Anthropic base URL","tools.apiKey":"API key","tools.copyFailed":"Copy failed. Select the value and copy it manually.","tools.fileChangesApplied":"{name}: {count} file change{plural} applied.","tools.noSnapshot":"{name}: no TokenBuddy install snapshot was found.","tools.restoredChanges":"{name}: restored {count} file change{plural}."},zh:{"nav.overview":"看板","nav.routing":"规则","nav.ledger":"账本","nav.tools":"工具","language.label":"语言","language.english":"EN","language.chinese":"中文","language.switchToEnglish":"Switch to English","language.switchToChinese":"切换到中文","common.add":"添加","common.cancel":"取消","common.close":"关闭","common.save":"保存","common.delete":"删除","common.edit":"编辑","common.select":"选择","common.search":"搜索","common.loading":"加载中...","common.refresh":"刷新","common.connected":"已连接","common.installed":"已安装","common.manual":"手动","common.missing":"未安装","common.current":"当前","common.unknown":"未知","common.active":"已启用","common.bind":"绑定 {name}","common.recharge":"充值","common.notAvailable":"{name} 在手动模式下不可用。","overview.providerMode.label":"Provider 模式","overview.providerMode.manualValue":"手动","overview.providerMode.autoValue":"自动","overview.providerMode.manualStats":"{count} 个供应商 · {policy}","overview.providerMode.manualNote":"只使用你的自定义列表","overview.providerMode.autoStats":"{range} · {models} 个模型 · {sellers} 个 Seller","overview.providerMode.autoPolicy":"{scorer} · {payment}","overview.providerMode.autoPolicyNoPayment":"{scorer}","overview.providerMode.recommendedRange":"推荐列表","overview.providerMode.customRange":"自定义列表","overview.providerMode.fallbackPolicy":"失败切换","overview.providerMode.fixedProvider":"固定供应商","overview.providerMode.balancedScorer":"均衡策略","overview.providerMode.speedScorer":"速度优先","overview.providerMode.costScorer":"成本优先","tools.title":"应用连接","tools.connectedSummary":"{configured}/{total} 已连接","tools.refreshStatus":"刷新工具状态","tools.oneClick":"一键配置","tools.tool":"工具","tools.protocol":"协议","tools.status":"状态","tools.actions":"操作","tools.disconnect":"断开","tools.connect":"连接","tools.getApp":"获取应用","tools.importCcSwitch":"用 CC Switch 导入 {name} provider","tools.disconnectFrom":"断开 TokenBuddy 与 {name} 的连接","tools.connectTo":"将 {name} 连接到 TokenBuddy","tools.manualSetup":"可以兼容的其它 agent","tools.appsCount":"{count} 个应用","tools.searchApps":"搜索应用","tools.searchAppsPlaceholder":"搜索应用或协议","tools.noMatchingApp":"没有匹配应用","tools.configuration":"配置","tools.openAiBaseUrl":"OpenAI Base URL","tools.anthropicBaseUrl":"Anthropic Base URL","tools.apiKey":"API Key","tools.copyFailed":"复制失败,请手动选中内容复制。","tools.fileChangesApplied":"{name}: 已写入 {count} 个文件变更。","tools.noSnapshot":"{name}: 没有找到 TokenBuddy 安装快照。","tools.restoredChanges":"{name}: 已恢复 {count} 个文件变更。"}},Fb=S.createContext(null);function Gj({children:n}){const[l,i]=S.useState(()=>{if(typeof window>"u")return"en";const u=window.localStorage.getItem(fx);return u==="zh"||u==="en"?u:"en"});S.useEffect(()=>{document.documentElement.lang=l==="zh"?"zh-CN":"en",window.localStorage.setItem(fx,l)},[l]),S.useEffect(()=>{if(typeof document>"u")return;const u=()=>Zj(l);u();const f=new MutationObserver(()=>{window.requestAnimationFrame(u)});return f.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["placeholder","title","aria-label","alt"]}),()=>f.disconnect()},[l]);const s=S.useMemo(()=>({language:l,setLanguage:i,t:(u,f)=>Xj(mx[l][u]??mx.en[u],f)}),[l]);return o.jsx(Fb.Provider,{value:s,children:n})}function Wl(){const n=S.useContext(Fb);if(!n)throw new Error("useI18n must be used inside I18nProvider");return n}function Xj(n,l){return l?n.replace(/\{(\w+)\}/g,(i,s)=>{const u=l[s];return u===void 0?i:String(u)}):n}const Zb=[["Router","路由器"],["Today requests","今日请求"],["Inference cost","推理成本"],["Total tokens","总 Token"],["Models / Sellers","模型 / Seller"],["Token usage","Token 用量"],["Daily model input and output usage lines","每日模型输入输出用量折线图"],["Daily inference cost curve","每日推理成本曲线"],["Recent model routes","最近模型路由"],["Details","详情"],["Model","模型"],["Seller","Seller"],["Token","Token"],["In","输入"],["Out","输出"],["in","输入"],["out","输出"],["TTFT","首 token"],["Tok/s","Token/s"],["Disc","折扣"],["Last switch","最近切换"],["No model traffic yet.","暂无模型流量。"],["Open Router","打开路由器"],["Open Today requests","打开今日请求"],["Open Inference cost","打开推理成本"],["Open Total tokens","打开总 Token"],["Open Models / Sellers","打开模型 / Seller"],["requests","次请求"],["sellers","个 Seller"],["Inference cost","推理成本"],["30 day inference cost","30 天推理成本"],["Daemon","守护进程"],["Proxy","代理"],["Control","控制台"],["TokenBuddy update","TokenBuddy 更新"],["Updating","更新中"],["Update","更新"],["Installed. tb-proxyd restart is in progress.","已安装,tb-proxyd 正在重启。"],["Installed. Restart needs attention.","已安装,需要检查重启。"],["Update failed.","更新失败。"],["TokenBuddy update available","TokenBuddy 有可用更新"],["Inference tokens","推理 Token"],["Token purchase spend","Token 购买支出"],["Today","今天"],["This week","本周"],["This month","本月"],["Total","总计"],["Usage details","用量明细"],["Inferences","推理"],["Purchases","购买"],["Search request, model, seller...","搜索请求、模型、Seller..."],["Search purchase, method, seller...","搜索购买、方式、Seller..."],["Search model, seller...","搜索模型、Seller..."],["Search seller...","搜索 Seller..."],["Status","状态"],["Method","方式"],["All status","全部状态"],["All model","全部模型"],["All method","全部方式"],["Ledger data could not be loaded. The local daemon may be offline or missing ledger endpoints.","账本数据加载失败。本地 daemon 可能离线或缺少账本接口。"],["TIME","时间"],["REQ","请求"],["MODEL","模型"],["SELLER","Seller"],["TOKENS","Token"],["COST","成本"],["TOTAL","总计"],["STATUS","状态"],["When","时间"],["Input","输入"],["Output","输出"],["Cache hit","缓冲命中"],["Purchase","购买"],["Payment method","支付方式"],["Spent","花费"],["Credit","额度"],["Request ID","请求 ID"],["Created","创建时间"],["Endpoint","端点"],["Route","路由"],["Fallback chain","Fallback 链路"],["Upstream status","上游状态"],["Input / output tokens","输入 / 输出 Token"],["Billed","计费"],["Balance after","之后余额"],["Prompt hash","Prompt Hash"],["Response hash","Response Hash"],["Price version","价格版本"],["Purchase ID","购买 ID"],["Completed","完成时间"],["Payment reference","支付引用"],["Credit micros","额度 micros"],["Currency","币种"],["No matching inference records","没有匹配的推理记录"],["No matching purchase records","没有匹配的购买记录"],["Adjust the query or filters to inspect another slice of the local ledger.","调整搜索或筛选条件以查看本地账本的其他数据。"],["Rows","行数"],["Showing","显示"],["of","共"],["First page","第一页"],["Previous page","上一页"],["Next page","下一页"],["Last page","最后一页"],["Go to","跳转到"],["Go to page","跳转到页面"],["page","页"],["Manual","手动"],["Auto","自动"],["Manual provider mode","手动 Provider 模式"],["Auto provider mode","自动 Provider 模式"],["Loading routing data...","正在加载路由数据..."],["Some routing data could not be loaded. Check that tb-proxyd is running.","部分路由数据加载失败,请确认 tb-proxyd 正在运行。"],["Custom providers","自定义 Provider"],["Provider","Provider"],["Models","模型"],["Last call","最后调用"],["Actions","操作"],["No custom providers yet.","还没有自定义 Provider。"],["Add provider","添加 Provider"],["Fallback on error","失败自动切换"],["Cost first","成本优先"],["Multi-provider concurrent calls","多供应商并发调用"],["Use providers by table order when the current provider fails.","当前 Provider 失败时,按表格顺序切换。"],["Move up","上移"],["Edit","编辑"],["Current","当前"],["Payment route","支付路由"],["Models","模型"],["Choose at least one model.","至少选择一个模型。"],["Models could not be saved.","模型保存失败。"],["Seller list","Seller 列表"],["Loading providers...","正在加载 Provider..."],["Refreshing","刷新中"],["Recommended","推荐"],["Custom","自定义"],["Select","选择"],["Select sellers","选择 Seller"],["Switch to Custom to select sellers","切换到自定义后选择 Seller"],["Discount","折扣"],["No custom sellers selected.","还没有选择自定义 Seller。"],["No warmed sellers available for these models.","这些模型暂无预热 Seller。"],["Routing priority","路由优先级"],["Balanced","均衡"],["Speed","速度"],["Cost","成本"],["Prefers lower TTFT and stronger throughput.","优先选择更低首 token 延迟和更高吞吐。"],["Prefers lower effective cost among healthy providers.","在健康 Provider 中优先选择更低成本。"],["Balances reliability, speed, and cost.","平衡可靠性、速度和成本。"],["Current routes","当前路由"],["PROVIDER","Provider"],["STRATEGY","策略"],["LAST CALL","最后调用"],["Preview","预览"],["Ready","就绪"],["healthy","健康"],["configured","已配置"],["settled","已结算"],["estimated","预估"],["ok","正常"],["online","在线"],["offline","离线"],["degraded","降级"],["Active","已启用"],["Manual fallback","手动 fallback"],["Manual direct","手动直连"],["Auto custom","自动自定义"],["Auto fixed","自动固定"],["Auto cost","自动成本优先"],["Auto speed","自动速度优先"],["Auto balanced","自动均衡"],["Add models","添加模型"],["Search models or payment","搜索模型或支付方式"],["Payment","支付"],["Sellers","Seller"],["No models found.","没有找到模型。"],["Selected","已选择"],["Clear","清空"],["No model selected.","未选择模型。"],["Cancel","取消"],["Save and close","保存并关闭"],["Save selected models","保存已选模型"],["Select custom sellers","选择自定义 Seller"],["Search sellers, payment, notes","搜索 Seller、支付方式或备注"],["Service fee","服务费"],["No sellers found.","没有找到 Seller。"],["No seller selected.","未选择 Seller。"],["Name","名称"],["Base URL","Base URL"],["API key","API key"],["My provider","我的 Provider"],["Leave blank to keep existing key","留空以保留现有 key"],["Probe required before adding.","添加前必须探测接口。"],["Probe required when replacing the key.","替换 key 时必须重新探测。"],["Reading model list...","正在读取模型列表..."],["Model list request failed.","模型列表请求失败。"],["Probe new key","探测新 key"],["Probe models","探测模型"],["Save","保存"],["Add","添加"],["Close","关闭"],["Search models","搜索模型"],["View models","查看模型"],["Delete","删除"],["JD wallet","京东钱包"],["Default wallet","默认钱包"],["Configured","已配置"],["Not bound","未绑定"],["Bound","已绑定"],["Available","可用"],["Recharge","充值"],["Activate","激活"],["ClawTip wallet QR","ClawTip 钱包二维码"],["Close payment modal","关闭支付弹窗"],["Scan with JD app to view wallet balance or recharge.","使用京东 App 扫码查看余额或充值。"],["Load the fixed ClawTip recharge QR from static assets.","加载静态资源中的固定 ClawTip 充值二维码。"],["Reuse the tb init ClawTip flow and wait for wallet binding.","复用 tb init 的 ClawTip 流程并等待钱包绑定。"],["Generating ClawTip QR...","正在生成 ClawTip 二维码..."],["QR image unavailable","二维码不可用"],["Wallet","钱包"],["Order","订单"],["Config","配置"],["Device","设备"],["bound","已绑定"],["waiting","等待中"],["Wallet bound. Closing...","钱包已绑定,正在关闭..."],["Scan with JD app. TokenBuddy is waiting for the local wallet config.","使用京东 App 扫码。TokenBuddy 正在等待本地钱包配置。"],["No recharge link is available from the daemon. Run tb init to bind this payment method.","daemon 没有返回充值链接。请运行 tb init 绑定该支付方式。"],["Scan with JD app to view ClawTip wallet balance","使用京东 App 查看 ClawTip 钱包余额"],["Scan with JD app to view wallet balance","使用京东 App 查看钱包余额"],["activation","激活"],["recharge","充值"],["QR code","二维码"],["选择模型","Select models"],["默认模型","Default models"],["绑定钱包","Bind wallet"],["支付方式","Payment method"],["配置策略","Configure strategy"],["路由规则","Routing rules"],["配置工具","Configure tools"],["终端接入","Tool access"],["全自动","Full auto"],["自动选择可用供应商。","Automatically select available providers."],["固定供应商组","Fixed provider set"],["在指定供应商组内切换。","Switch within selected providers."],["固定供应商","Fixed provider"],["始终使用指定供应商。","Always use the selected provider."],["平衡模式","Balanced"],["综合速度、价格、健康度、余额。","Balance speed, price, health, and balance."],["速度优先","Speed first"],["优先选择更快、吞吐量更高供应商。","Prefer faster providers with higher throughput."],["成本优先","Cost first"],["优先选择更低成本供应商。","Prefer lower-cost providers."],["微信支付入口预留","WeChat Pay entry reserved"],["代理支付入口预留","Agent payment entry reserved"],["USDC 钱包入口预留","USDC wallet entry reserved"],["浏览器已经允许直接安装 TokenBuddy。","The browser is ready to install TokenBuddy."],["TokenBuddy 桌面应用已安装。","TokenBuddy desktop app has been installed."],["关注模型已保存。后续工具配置会优先参考这些模型。","Focus models saved. Tool setup will prefer these models."],["请选择一个固定供应商。","Select a fixed provider."],["请至少选择一个供应商。","Select at least one provider."],["供应商路由策略已保存。","Provider routing strategy saved."],["初始化步骤","Initialization steps"],["模型访问","Model access"],["默认和高频模型","Default and frequent models"],["下一步","Next"],["上一步","Back"],["完成","Finish"],["保存","Save"],["添加模型","Add models"],["推荐模型","Recommended models"],["直接勾选","Quick select"],["搜索添加","Search and add"],["全部模型","All models"],["选择可能使用到的模型","Choose models you may use"],["搜索平台全部模型...","Search all platform models..."],["关闭模型选择","Close model picker"],["完成选择模型","Done selecting models"],["模型已选","Models selected"],["保存关注模型","Save focus models"],["默认供应商策略","Default provider strategy"],["选择支付方式","Choose payment method"],["生成后使用京东 App 扫码绑定。","Scan with JD app after the QR is generated."],["配置终端工具","Configure client tools"],["验证网关","Verify gateway"],["初始化完成","Initialization complete"],["桌面应用","Desktop app"],["安装入口","Install entry"],["地址栏或浏览器菜单。","Address bar or browser menu."],["应用名称","App name"],["本地服务","Local service"],["继续由 tb-proxyd 提供。","Still served by tb-proxyd."],["路由策略已选择","Routing strategy selected"],["状态","Status"],["供应商","Provider"],["价格","Price"],["折扣","Discount"],["响应","Latency"],["加入本次写入","Include in this setup"],["移出本次写入","Remove from this setup"],["写入配置","Write config"],["生成预览","Generate preview"],["安装应用","Install app"]],Jb=Zb.filter(([n])=>!eg(n)),Vj=Zb.filter(([n])=>eg(n)),Ib=new Map(Jb),Wb=new Map([...Jb.map(([n,l])=>[l,n]),...Vj]);function Fj(n,l){return qf(n,l==="zh"?Ib:Wb,l)}function Zj(n){const l=n==="zh"?Ib:Wb;Jj(document.body,l,n)}function Jj(n,l,i){var f;const s=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,{acceptNode(h){var p;const v=h.parentElement;return!v||["SCRIPT","STYLE","NOSCRIPT","TEXTAREA"].includes(v.tagName)||v.closest("[data-no-translate='true']")||!((p=h.textContent)!=null&&p.trim())?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),u=[];for(;s.nextNode();)u.push(s.currentNode);for(const h of u){const v=qf(h.textContent??"",l,i);v!==h.textContent&&(h.textContent=v)}n instanceof Element&&hx(n,l,i);for(const h of Array.from(((f=n.querySelectorAll)==null?void 0:f.call(n,"[placeholder], [title], [aria-label], [alt]"))??[]))hx(h,l,i)}function hx(n,l,i){for(const s of["placeholder","title","aria-label","alt"]){if(n.closest("[data-no-translate='true']"))return;const u=n.getAttribute(s);if(!u)continue;const f=qf(u,l,i);f!==u&&n.setAttribute(s,f)}}function qf(n,l,i){var v,p;const s=((v=n.match(/^\s*/))==null?void 0:v[0])??"",u=((p=n.match(/\s*$/))==null?void 0:p[0])??"",f=n.trim();if(!f)return n;const h=l.get(f);if(h)return`${s}${h}${u}`;if(i==="zh"){const x=f.match(/^Selected (\d+)$/);if(x)return`${s}已选择 ${x[1]}${u}`;const y=f.match(/^(\d+) selected$/);if(y)return`${s}已选择 ${y[1]}${u}`;const g=f.match(/^Page (\d+)$/);if(g)return`${s}第 ${g[1]} 页${u}`;const j=f.match(/^(\d+) of (\d+) providers$/);if(j)return`${s}${j[1]} / ${j[2]} 个 Provider${u}`;const N=f.match(/^(\d+) of (\d+) models$/);if(N)return`${s}${N[1]} / ${N[2]} 个模型${u}`;const T=f.match(/^(\d+) purchases$/);if(T)return`${s}${T[1]} 次购买${u}`;const E=f.match(/^(\d+) requests$/);if(E)return`${s}${E[1]} 次请求${u}`;const L=f.match(/^(\d+) sellers$/);if(L)return`${s}${L[1]} 个 Seller${u}`;const z=f.match(/^In ([\d,]+) \/ Out ([\d,]+)$/);if(z)return`${s}输入 ${z[1]} / 输出 ${z[2]}${u}`;const Q=f.match(/^(.+) total$/);if(Q)return`${s}总计 ${Q[1]}${u}`;const q=f.match(/^Open (.+)$/);if(q)return`${s}打开 ${q[1]}${u}`;const O=f.match(/^Activate (.+)$/);if(O)return`${s}激活 ${O[1]}${u}`;const K=f.match(/^Recharge (.+)$/);if(K)return`${s}充值 ${K[1]}${u}`;const J=f.match(/^Bind (.+)$/);if(J)return`${s}绑定 ${J[1]}${u}`;const H=f.match(/^Remove (.+)$/);if(H)return`${s}移除 ${H[1]}${u}`;const F=f.match(/^View models for (.+)$/);if(F)return`${s}查看 ${F[1]} 的模型${u}`;const Z=f.match(/^Move (.+) up$/);if(Z)return`${s}上移 ${Z[1]}${u}`;const le=f.match(/^Edit provider · (.+)$/);if(le)return`${s}编辑 Provider · ${le[1]}${u}`;const $=f.match(/^Models · (.+)$/);if($)return`${s}模型 · ${$[1]}${u}`;const ue=f.match(/^(.+) ledger records, ([\d,]+) records$/);if(ue)return`${s}${ue[1]}账本记录,${ue[2]} 条记录${u}`;const ee=f.match(/^Input tokens: (.+)$/);if(ee)return`${s}输入 Token: ${ee[1]}${u}`;const xe=f.match(/^Output tokens: (.+)$/);if(xe)return`${s}输出 Token: ${xe[1]}${u}`;const de=f.match(/^Time to first token: (.+)$/);if(de)return`${s}首 token 延迟: ${de[1]}${u}`;const R=f.match(/^Tokens per second: (.+)$/);if(R)return`${s}每秒 Token: ${R[1]}${u}`;const X=f.match(/^Seller discount: (.+)$/);if(X)return`${s}Seller 折扣: ${X[1]}${u}`;const ie=f.match(/^Last seller switch: (.+)$/);if(ie)return`${s}最近 Seller 切换: ${ie[1]}${u}`;const ne=f.match(/^(.+) (recharge|activation) QR code$/);if(ne)return`${s}${ne[1]} ${ne[2]==="recharge"?"充值":"激活"}二维码${u}`}else{const x=f.match(/^已选择 (\d+)$/);if(x)return`${s}Selected ${x[1]}${u}`;const y=f.match(/^第 (\d+) 页$/);if(y)return`${s}Page ${y[1]}${u}`;const g=f.match(/^(\d+) \/ (\d+) 个 Provider$/);if(g)return`${s}${g[1]} of ${g[2]} providers${u}`;const j=f.match(/^(\d+) \/ (\d+) 个模型$/);if(j)return`${s}${j[1]} of ${j[2]} models${u}`;const N=f.match(/^总计 (.+)$/);if(N)return`${s}${N[1]} total${u}`;const T=f.match(/^(\d+) 个 Seller$/);if(T)return`${s}${T[1]} sellers${u}`;const E=f.match(/^输入 ([\d,]+) \/ 输出 ([\d,]+)$/);if(E)return`${s}In ${E[1]} / Out ${E[2]}${u}`;const L=f.match(/^打开 (.+)$/);if(L)return`${s}Open ${L[1]}${u}`;const z=f.match(/^移除 (.+)$/);if(z)return`${s}Remove ${z[1]}${u}`;const Q=f.match(/^查看 (.+) 的模型$/);if(Q)return`${s}View models for ${Q[1]}${u}`;const q=f.match(/^上移 (.+)$/);if(q)return`${s}Move ${q[1]} up${u}`}return n}function eg(n){return/[\u4e00-\u9fff]/.test(n)}function tg({inferences:n,modelsResponse:l,sellersResponse:i,previewPlan:s,activeModelId:u}){const f=eN(l,i),h=[...n].sort(lN),v=new Map,p=new Map;let x=0,y=0,g=0;for(const N of h){const T=N.modelId||Oe,E=N.sellerKey||Oe,L=fa(N.promptTokens)??0,z=fa(N.completionTokens)??0,Q=L+z,q=fa(N.settledUsdMicros)??fa(N.billedMicros)??0;x+=1,y+=Q,g+=q;const O=v.get(T)??tN(T);O.entries.push(N),O.requestCount+=1,O.inputTokens+=L,O.outputTokens+=z,O.totalSpendMicros+=q,O.touchedSellers.add(E),O.sellerCounts.set(E,(O.sellerCounts.get(E)??0)+1),O.fallbackCount+=fa(N.fallbackCount)??0;const K=fa(N.ttftMs);K!==void 0&&(O.ttftTotal+=K,O.ttftCount+=1);const J=fa(N.durationMs);J!==void 0&&(O.durationTotal+=J,O.durationCount+=1,J>0&&(O.speedTokenTotal+=z,O.speedDurationMs+=J)),v.set(T,O);const H=p.get(E)??{requestCount:0,totalTokens:0};H.requestCount+=1,H.totalTokens+=Q,p.set(E,H)}const j=Array.from(v.values()).map(N=>Ij(N,p,f)).sort(rN);if(j.length===0){const N=Wj(u,s,f);N&&j.push(N)}return{rows:j,totalRequests:x,totalTokens:y,totalSpendMicros:g}}function Ij(n,l,i){const s=n.entries[n.entries.length-1],u=(s==null?void 0:s.sellerKey)||Oe,f=ag(u,i),h=n.sellerCounts.get(u)??0,v=l.get(u),p=i.modelsBySellerAndModel.get(`${u}\0${n.modelId}`);return{source:"ledger",modelId:n.modelId,currentSellerId:u,currentSellerName:f.name,currentSellerUrl:f.url,currentSellerStatus:f.status,currentSellerPaymentMethods:f.paymentMethods,sellerDiscount:f.discount,sellerServiceFee:f.serviceFee,sellerModelCount:f.modelCount,requestCount:n.requestCount,currentSellerModelRequests:h,currentSellerRequests:(v==null?void 0:v.requestCount)??h,inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.inputTokens+n.outputTokens,currentSellerTokens:(v==null?void 0:v.totalTokens)??0,totalSpendMicros:n.totalSpendMicros,tokensPerSecond:iN(n.speedTokenTotal,n.speedDurationMs),avgTtftMs:px(n.ttftTotal,n.ttftCount),avgDurationMs:px(n.durationTotal,n.durationCount),lastTtftMs:fa(s==null?void 0:s.ttftMs),lastDurationMs:fa(s==null?void 0:s.durationMs),selectedAt:aN(n.entries,u),lastSellerSwitchAt:nN(n.entries),lastAccessAt:s==null?void 0:s.createdAt,lastRequestId:s==null?void 0:s.requestId,lastStatus:s==null?void 0:s.status,routeReason:s==null?void 0:s.routeReason,upstreamStatus:s==null?void 0:s.upstreamStatus,fallbackCount:n.fallbackCount,falloverChain:(s==null?void 0:s.falloverChain)??[],touchedSellerCount:n.touchedSellers.size,inputPriceMicrosPer1m:p==null?void 0:p.inputPriceMicrosPer1m,outputPriceMicrosPer1m:p==null?void 0:p.outputPriceMicrosPer1m}}function Wj(n,l,i){var p,x,y;const s=(p=l==null?void 0:l.routes)==null?void 0:p[0];if(!s||!n)return;const u=ag(s.seller.id,i,s),f=fa(s.metrics.ttftMs)??fa(s.metrics.avgLatencyMs),h=fa(s.metrics.avgInferenceMs),v=i.modelsBySellerAndModel.get(`${s.seller.id}\0${n}`);return{source:"preview",modelId:n,currentSellerId:s.seller.id,currentSellerName:u.name,currentSellerUrl:u.url,currentSellerStatus:u.status,currentSellerPaymentMethods:u.paymentMethods,sellerDiscount:u.discount,sellerServiceFee:u.serviceFee,sellerModelCount:u.modelCount,requestCount:0,currentSellerModelRequests:0,currentSellerRequests:0,inputTokens:0,outputTokens:0,totalTokens:0,currentSellerTokens:0,totalSpendMicros:0,tokensPerSecond:fa(s.metrics.avgTokensPerSecond),avgTtftMs:f,avgDurationMs:h,lastTtftMs:f,lastDurationMs:h,routeReason:l.reason??l.sourceReason??"Preview route",fallbackCount:0,falloverChain:((x=l.routes)==null?void 0:x.map(g=>g.seller.id))??[],touchedSellerCount:((y=l.routes)==null?void 0:y.length)??1,inputPriceMicrosPer1m:v==null?void 0:v.inputPriceMicrosPer1m,outputPriceMicrosPer1m:v==null?void 0:v.outputPriceMicrosPer1m}}function eN(n,l){const i=new Map;for(const s of(n==null?void 0:n.data)??[]){const u=i.get(s.sellerId)??new Set;u.add(s.id),i.set(s.sellerId,u)}return{registryById:new Map(((l==null?void 0:l.sellers)??[]).map(s=>[s.id,s])),catalogById:new Map(((n==null?void 0:n.sellers)??[]).map(s=>[s.id,s])),modelsBySellerAndModel:new Map(((n==null?void 0:n.data)??[]).map(s=>[`${s.sellerId}\0${s.id}`,s])),modelCountsBySellerId:new Map(Array.from(i.entries()).map(([s,u])=>[s,u.size]))}}function tN(n){return{modelId:n,entries:[],sellerCounts:new Map,touchedSellers:new Set,requestCount:0,inputTokens:0,outputTokens:0,totalSpendMicros:0,ttftTotal:0,ttftCount:0,durationTotal:0,durationCount:0,speedTokenTotal:0,speedDurationMs:0,fallbackCount:0}}function aN(n,l){var i;for(let s=n.length-1;s>=0;s-=1){const u=n[s];if(u.sellerKey!==l)return(i=n[s+1])==null?void 0:i.createdAt;if(s===0)return u.createdAt}}function nN(n){let l;for(let i=1;i<n.length;i+=1)n[i].sellerKey!==n[i-1].sellerKey&&(l=n[i].createdAt);return l}function ag(n,l,i){const s=l.catalogById.get(n),u=l.registryById.get(n),f=(i==null?void 0:i.metrics.discountRatio)??(s==null?void 0:s.discountRatio);return{name:sN((i==null?void 0:i.seller.name)??(s==null?void 0:s.name)??(u==null?void 0:u.name)??n),url:(i==null?void 0:i.seller.url)??(s==null?void 0:s.url)??(u==null?void 0:u.url),status:(s==null?void 0:s.status)??(u==null?void 0:u.status)??Oe,paymentMethods:(s==null?void 0:s.paymentMethods)??(u==null?void 0:u.paymentMethods)??(i==null?void 0:i.seller.paymentMethods)??[],discount:Lf(f),serviceFee:qb(s==null?void 0:s.serviceFeeRatio),modelCount:(s==null?void 0:s.modelCount)??l.modelCountsBySellerId.get(n)}}function lN(n,l){return Io(n.createdAt)-Io(l.createdAt)}function rN(n,l){return Io(l.lastAccessAt)-Io(n.lastAccessAt)}function Io(n){if(!n)return 0;const l=new Date(n).getTime();return Number.isNaN(l)?0:l}function px(n,l){return l>0?n/l:void 0}function iN(n,l){if(!(l<=0))return n<=0?0:n/(l/1e3)}function fa(n){return Number.isFinite(n)?n:void 0}function sN(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function vx(){var te,fe,be,ge,_e,Ee,_t,bt,Ot,rt,Ie,ma,Kt,zn,ea,Dt,Ta,Ut,ta,tn,ct,_n,an,Ua,Aa,On,nn,Dn,Un;const{t:n}=Wl(),[l,i]=S.useState(null),[s,u]=p2(),f=S.useRef(null),h=Uf(),v=_b(),p=Ob(),x=Db(),y=Ub(),g=_f(),j=Of(),N=Df(),T=g.refetch,E=j.reset,L=lc(),z=Lb(),Q=rc(),q=Tj(),O=Aj(),K=((te=L.data)==null?void 0:te.inferences)??[],J=((fe=g.data)==null?void 0:fe.payments)??[],H=new Set((((be=Q.data)==null?void 0:be.data)??[]).map(He=>He.id)).size,F=((ge=z.data)==null?void 0:ge.sellers.length)??((Ee=(_e=Q.data)==null?void 0:_e.sellers)==null?void 0:Ee.length)??0,Z=S.useMemo(()=>wN(K),[K]),le=S.useMemo(()=>Hb(J,K),[K,J]),$=S.useMemo(()=>tg({inferences:K,modelsResponse:Q.data,sellersResponse:z.data}),[K,Q.data,z.data]),ee=J.some(He=>Ia(He.method)==="clawtip"&&(He.enabled||Kb(He.config,"walletConfigPresent")))||((_t=j.data)==null?void 0:_t.walletConfigPresent)===!0,xe=((bt=h.data)==null?void 0:bt.status)==="running"&&!h.isError,de=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),R=le.find(He=>J.some(We=>We.method===He.method&&We.isDefault))??le.find(He=>He.status==="Bound"),X=((Ot=p.data)==null?void 0:Ot.active)??((rt=p.data)==null?void 0:rt.mode)??((Ie=h.data)==null?void 0:Ie.selectionMode),ie=((ma=y.data)==null?void 0:ma.providers.length)??0,ne=((Kt=x.data)==null?void 0:Kt.config.range)??cN((zn=v.data)==null?void 0:zn.strategy.mode),pe=((ea=x.data)==null?void 0:ea.config.modelIds.length)??0,C=ne==="custom"?((Dt=x.data)==null?void 0:Dt.config.sellerIds.length)??((Ut=(Ta=v.data)==null?void 0:Ta.strategy.sellerIds)==null?void 0:Ut.length)??0:F,P=oN({activeMode:X,autoModelCount:pe,autoRange:ne,autoSellerCount:C,manualProviderCount:ie,manualPolicy:(ta=y.data)==null?void 0:ta.routing.policy,paymentName:R==null?void 0:R.name,scorer:((tn=x.data)==null?void 0:tn.config.scorer)??((ct=v.data)==null?void 0:ct.strategy.scorer)??((_n=h.data)==null?void 0:_n.sellerRoutingScorer),t:n}),I=()=>{i(null),j.reset(),N.reset()};return S.useEffect(()=>{const He=s.get("activatePayment");if(!He||Ia(He)!=="clawtip"||f.current===He)return;f.current=He,i({kind:"activate",method:"clawtip"}),j.mutate();const We=new URLSearchParams(s);We.delete("activatePayment"),u(We,{replace:!0})},[j,s,u]),S.useEffect(()=>{if((l==null?void 0:l.kind)!=="activate"||Ia(l.method)!=="clawtip"||ee)return;const He=window.setInterval(()=>{T()},1500);return()=>window.clearInterval(He)},[ee,l==null?void 0:l.kind,l==null?void 0:l.method,T]),S.useEffect(()=>{(l==null?void 0:l.kind)==="activate"&&Ia(l.method)==="clawtip"&&ee&&(i(null),E())},[ee,l==null?void 0:l.kind,l==null?void 0:l.method,E]),o.jsxs("div",{className:"min-w-0 overflow-x-hidden space-y-3",children:[o.jsx(mN,{currentVersion:(an=q.data)==null?void 0:an.currentVersion,latestVersion:(Ua=q.data)==null?void 0:Ua.latestVersion,updateAvailable:(Aa=q.data)==null?void 0:Aa.updateAvailable,running:O.isPending,result:O.data,error:O.error,onUpdate:()=>O.mutate()}),o.jsxs("section",{className:"grid grid-cols-2 gap-2.5 md:grid-cols-3 xl:grid-cols-6",children:[o.jsx(xN,{icon:o.jsx(Rb,{className:"size-4"}),...P}),o.jsx(Dd,{to:"/ledger",icon:o.jsx(mS,{className:"size-4"}),label:"Today requests",value:qe(Z.todayRequestCount),note:`${qe(Z.totalRequestCount)} total`,tone:"requests"}),o.jsx(Dd,{to:"/ledger",icon:o.jsx(us,{className:"size-4"}),label:"Inference cost",value:Ja(Z.todaySpendMicros,{digits:4}),note:`${Ja(Z.totalSpendMicros,{digits:4})} total`,tone:"spend"}),o.jsx(vN,{inputTokens:Z.inputTokens,outputTokens:Z.outputTokens}),o.jsx(Dd,{to:"/routing",icon:o.jsx(NS,{className:"size-4"}),label:"Models / Sellers",value:`${H}`,note:`${F} sellers`,tone:"inventory"})]}),o.jsx("section",{className:"grid min-w-0 gap-3",children:o.jsxs("div",{className:"min-w-0 space-y-3",children:[o.jsx(hN,{rows:$.rows}),o.jsxs(At,{className:"p-3",children:[o.jsxs("div",{className:"mb-2 flex min-w-0 flex-col gap-2",children:[o.jsx("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(uj,{className:"size-4 shrink-0 text-[var(--color-purple)]"}),o.jsx("h2",{className:"truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:"Token usage"})]})}),o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-[0.7rem] text-[var(--color-muted)]",children:[Z.modelUsage.map(He=>o.jsx(SN,{model:He.model,color:He.color},He.model)),o.jsx(gx,{label:"in"}),o.jsx(gx,{label:"out",dashed:!0})]})]}),o.jsxs("div",{className:"grid min-w-0 gap-3 sm:grid-cols-[minmax(0,1fr)_190px]",children:[o.jsx(bN,{days:Z.days,series:Z.modelUsage}),o.jsxs("div",{className:"grid gap-3",children:[o.jsx(gN,{days:Z.days,values:Z.cost,total:Ja(Z.weeklySpendMicros)}),o.jsx(yN,{values:Z.thirtyDaySpend,total:Ja(Z.totalSpendMicros)})]})]})]})]})}),o.jsx(jN,{checkedAt:de,healthy:xe,pid:(On=h.data)==null?void 0:On.pid,status:(nn=h.data)==null?void 0:nn.status,proxyPort:(Dn=h.data)==null?void 0:Dn.proxyPort,controlPort:(Un=h.data)==null?void 0:Un.controlPort}),l?o.jsx($b,{modal:l,methods:le,qr:l.kind==="activate"?j.data:N.data,loading:l.kind==="activate"?j.isPending:N.isPending,error:l.kind==="activate"?j.error:N.error,onClose:I}):null]})}function oN({activeMode:n,autoModelCount:l,autoRange:i,autoSellerCount:s,manualProviderCount:u,manualPolicy:f,paymentName:h,scorer:v,t:p}){const x=n==="auto"?p("overview.providerMode.autoValue"):n==="manual"?p("overview.providerMode.manualValue"):Oe;if(n==="auto"){const y=fN(v,p);return{label:p("overview.providerMode.label"),value:x,detail:p("overview.providerMode.autoStats",{range:uN(i,p),models:l,modelPlural:l===1?"":"s",sellers:s,sellerPlural:s===1?"":"s"}),note:h?p("overview.providerMode.autoPolicy",{scorer:y,payment:h}):p("overview.providerMode.autoPolicyNoPayment",{scorer:y})}}return{label:p("overview.providerMode.label"),value:x,detail:p("overview.providerMode.manualStats",{count:u,plural:u===1?"":"s",policy:dN(f,p)}),note:p("overview.providerMode.manualNote")}}function cN(n){if(n==="fixedSet")return"custom";if(n==="fullAuto")return"recommended"}function uN(n,l){return l(n==="custom"?"overview.providerMode.customRange":"overview.providerMode.recommendedRange")}function dN(n,l){return l(n==="locked"?"overview.providerMode.fixedProvider":"overview.providerMode.fallbackPolicy")}function fN(n,l){return l(n==="speed"?"overview.providerMode.speedScorer":n==="discount"?"overview.providerMode.costScorer":"overview.providerMode.balancedScorer")}function mN({currentVersion:n,latestVersion:l,updateAvailable:i,running:s,result:u,error:f,onUpdate:h}){if(!i&&!s&&!u&&!f)return null;const v=u?u.install.succeeded?u.restart.scheduled||u.restart.restarted?"Installed. tb-proxyd restart is in progress.":u.restart.error??"Installed. Restart needs attention.":u.install.error??"Update failed.":void 0,p=(f==null?void 0:f.message)??v??(n&&l?`TokenBuddy ${n} -> ${l}`:"TokenBuddy update available"),x=!!(f||(u==null?void 0:u.install.succeeded)===!1||u!=null&&u.restart.error);return o.jsxs("section",{className:["flex min-w-0 flex-col gap-2 rounded-[var(--radius-xl)] border px-3 py-2.5 shadow-[var(--shadow-chip)] sm:flex-row sm:items-center sm:justify-between",x?"border-[var(--color-danger)]/30 bg-[var(--color-danger-soft)]":"border-[var(--color-lavender-2)] bg-[var(--color-lavender)]"].join(" "),children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:["grid size-7 shrink-0 place-items-center rounded-[var(--radius-md)] bg-white",x?"text-[var(--color-danger)]":"text-[var(--color-purple)]"].join(" "),children:o.jsx(Zo,{className:["size-4",s?"animate-spin":""].join(" ")})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-[0.82rem] font-semibold text-[var(--color-ink)]",children:"TokenBuddy update"}),o.jsx("div",{className:"truncate text-[0.74rem] text-[var(--color-muted)]",children:p})]})]}),i?o.jsxs("button",{type:"button",onClick:h,disabled:s,className:"tb-button tb-button-sm tb-button-secondary shrink-0 disabled:cursor-wait",children:[o.jsx(Zo,{className:["size-3.5",s?"animate-spin":""].join(" ")}),s?"Updating":"Update"]}):null]})}function hN({rows:n}){const l=n.slice(0,3);return o.jsxs(At,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--color-line-2)] px-3.5 py-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(Rb,{className:"size-4 shrink-0 text-[var(--color-purple)]"}),o.jsx("h2",{className:"truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:"Recent model routes"})]}),o.jsx(Il,{to:"/routing",className:"tb-button tb-button-sm tb-button-secondary shrink-0",children:"Details"})]}),l.length>0?o.jsxs("div",{children:[o.jsxs("div",{className:"hidden grid-cols-[minmax(0,1fr)_minmax(180px,0.85fr)_minmax(116px,0.6fr)_minmax(116px,0.6fr)_70px_96px] gap-2 border-b border-[var(--color-line-2)] bg-[var(--color-page)]/55 px-3.5 py-2 text-[0.64rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)] lg:grid",children:[o.jsx("div",{children:"Model"}),o.jsx("div",{children:"Seller"}),o.jsx("div",{className:"text-right",children:"Token"}),o.jsx("div",{className:"text-right",children:"Speed"}),o.jsx("div",{className:"text-right",children:"Disc"}),o.jsx("div",{className:"text-right",children:"Last switch"})]}),o.jsx("div",{className:"divide-y divide-[var(--color-line-2)]",children:l.map(i=>o.jsx(pN,{row:i},`${i.modelId}-${i.currentSellerId}`))})]}):o.jsx("div",{className:"px-3.5 py-7 text-center text-[0.82rem] text-[var(--color-muted)]",children:"No model traffic yet."})]})}function pN({row:n}){const l=n.lastSellerSwitchAt??n.selectedAt;return o.jsxs("div",{className:"grid min-w-0 grid-cols-2 gap-3 px-3.5 py-3 lg:grid-cols-[minmax(0,1fr)_minmax(180px,0.85fr)_minmax(116px,0.6fr)_minmax(116px,0.6fr)_70px_96px] lg:items-center lg:gap-2",children:[o.jsxs("div",{className:"col-span-2 min-w-0 lg:col-span-1",children:[o.jsx("div",{className:"truncate font-mono text-[0.84rem] font-semibold text-[var(--color-ink)]",title:n.modelId,children:n.modelId}),o.jsxs("div",{className:"mt-0.5 text-[0.72rem] font-medium text-[var(--color-muted)]",children:[qe(n.requestCount)," requests"]})]}),o.jsxs("div",{className:"col-span-2 min-w-0 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white/70 px-2.5 py-2 lg:col-span-1 lg:border-0 lg:bg-transparent lg:px-0 lg:py-0",children:[o.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:"Seller"}),o.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"min-w-0 truncate font-mono text-[0.82rem] font-semibold text-[var(--color-ink)]",title:n.currentSellerName,children:n.currentSellerName}),o.jsx("span",{className:"shrink-0 rounded-full bg-[var(--color-success-soft)] px-1.5 py-0.5 font-mono text-[0.62rem] font-semibold text-[var(--color-success)]",children:n.currentSellerStatus})]})]}),o.jsxs(xx,{label:"Token",title:`Input tokens: ${qe(n.inputTokens)} / Output tokens: ${qe(n.outputTokens)}`,children:[o.jsx(Bo,{label:"In",value:cf(n.inputTokens)}),o.jsx(Bo,{label:"Out",value:cf(n.outputTokens)})]}),o.jsxs(xx,{label:"Speed",title:`Time to first token: ${Jl(n.lastTtftMs??n.avgTtftMs)} / Tokens per second: ${Bb(n.tokensPerSecond)}`,children:[o.jsx(Bo,{label:"TTFT",value:Jl(n.lastTtftMs??n.avgTtftMs)}),o.jsx(Bo,{label:"Tok/s",value:ic(n.tokensPerSecond)})]}),o.jsx(bx,{label:"Disc",value:n.sellerDiscount,title:`Seller discount: ${n.sellerDiscount}`}),o.jsx(bx,{label:"Last switch",value:Uj(l),title:`Last seller switch: ${sc(l)}`})]})}function xx({label:n,title:l,children:i}){return o.jsxs("div",{className:"min-w-0 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-2 py-1 lg:border-0 lg:bg-transparent lg:px-0 lg:py-0 lg:text-right",title:l,children:[o.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:n}),o.jsx("div",{className:"grid gap-0.5 font-mono text-[0.74rem] font-semibold leading-snug text-[var(--color-ink)]",children:i})]})}function Bo({label:n,value:l}){return o.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-2 lg:justify-end",children:[o.jsx("span",{className:"shrink-0 text-[0.6rem] font-semibold uppercase tracking-normal text-[var(--color-muted)]",children:n}),o.jsx("span",{className:"truncate",children:l})]})}function bx({label:n,value:l,title:i}){return o.jsxs("div",{className:"min-w-0 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-2 py-1 lg:border-0 lg:bg-transparent lg:px-0 lg:py-0 lg:text-right",title:i??`${n}: ${l}`,children:[o.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:n}),o.jsx("div",{className:"truncate font-mono text-[0.76rem] font-semibold text-[var(--color-ink)]",children:l})]})}function Dd({to:n,icon:l,label:i,value:s,note:u,tone:f}){const h=Ss(f);return o.jsxs(Il,{to:n,"aria-label":`Open ${i}`,className:["relative block min-h-[94px] overflow-hidden rounded-[var(--radius-xl)] p-3 transition hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",h.card].join(" "),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Bf,{tone:f,children:l}),o.jsx("span",{className:["text-right text-[0.66rem] font-semibold uppercase leading-3 tracking-[0.08em]",h.label].join(" "),children:i})]}),o.jsx("div",{className:["mt-2 text-[1.25rem] font-semibold leading-none tracking-tight",h.value].join(" "),children:s}),o.jsx("div",{className:["mt-1.5 truncate text-[0.72rem] font-medium",h.note].join(" "),children:u})]})}function vN({inputTokens:n,outputTokens:l}){const i=Ss("tokens");return o.jsx(Il,{to:"/ledger","aria-label":"Open Total tokens",className:["relative col-span-2 block min-h-[124px] overflow-hidden rounded-[var(--radius-xl)] p-3 transition hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",i.card].join(" "),children:o.jsx(Qj,{inputTokens:n,outputTokens:l})})}function xN({icon:n,label:l,value:i,detail:s,note:u}){const f=Ss("router");return o.jsxs(Il,{to:"/routing","aria-label":`Open ${l}`,className:["relative block min-h-[94px] overflow-hidden rounded-[var(--radius-xl)] p-3 transition hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",f.card].join(" "),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Bf,{tone:"router",children:n}),o.jsx("span",{className:["text-right text-[0.66rem] font-semibold uppercase leading-3 tracking-[0.08em]",f.label].join(" "),children:l})]}),o.jsx("div",{className:["mt-2 text-[1.25rem] font-semibold leading-none tracking-tight",f.value].join(" "),children:i}),o.jsx("div",{className:["mt-1.5 truncate text-[0.72rem] font-semibold",f.note].join(" "),children:s}),o.jsx("div",{className:"mt-0.5 truncate text-[0.68rem] font-medium text-[var(--color-muted)]",children:u})]})}function bN({days:n,series:l}){const u={top:14,right:18,bottom:26,left:26},f=l.flatMap(x=>[...x.input,...x.output]),h=Math.max(1,...f),v=x=>u.left+x*(680-u.left-u.right)/Math.max(1,n.length-1),p=x=>u.top+(1-x/h)*(150-u.top-u.bottom);return o.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:o.jsxs("svg",{className:"h-[160px] w-full",viewBox:"0 0 680 150",role:"img","aria-label":"Daily model input and output usage lines",children:[[.25,.5,.75,1].map(x=>o.jsx("line",{x1:u.left,x2:680-u.right,y1:u.top+(1-x)*(150-u.top-u.bottom),y2:u.top+(1-x)*(150-u.top-u.bottom),stroke:"var(--color-chart-grid)",strokeWidth:"1"},x)),n.map((x,y)=>o.jsx("text",{x:v(y),y:143,textAnchor:"middle",className:"fill-[var(--color-muted)] text-[10px]",children:x},x)),l.map(x=>o.jsxs("g",{children:[o.jsx("path",{d:uf(x.input.map((y,g)=>[v(g),p(y)])),fill:"none",stroke:x.color,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:uf(x.output.map((y,g)=>[v(g),p(y)])),fill:"none",stroke:x.color,strokeWidth:"2.4",strokeDasharray:"5 5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.75"}),x.input.map((y,g)=>o.jsx("circle",{cx:v(g),cy:p(y),r:"2.7",fill:x.color},`${x.model}-input-${g}`)),x.output.map((y,g)=>o.jsx("circle",{cx:v(g),cy:p(y),r:"2.2",fill:"#fff",stroke:x.color,strokeWidth:"1.8"},`${x.model}-output-${g}`))]},x.model)),l.length===0?o.jsx("text",{x:680/2,y:150/2,textAnchor:"middle",className:"fill-[var(--color-muted)] text-[12px]",children:"No token usage yet"}):null]})})}function gN({days:n,values:l,total:i}){const f={top:10,right:8,bottom:16,left:8},h=Math.max(1,...l),v=x=>f.left+x*(190-f.left-f.right)/Math.max(1,l.length-1),p=x=>f.top+(1-x/h)*(72-f.top-f.bottom);return o.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[o.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-ink)]",children:"Inference cost"}),o.jsx("span",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:i})]}),o.jsxs("svg",{className:"h-[66px] w-full",viewBox:"0 0 190 72",role:"img","aria-label":"Daily inference cost curve",children:[o.jsx("path",{d:uf(l.map((x,y)=>[v(y),p(x)])),fill:"none",stroke:"var(--color-chart-cost)",strokeWidth:"3",strokeLinecap:"round"}),l.map((x,y)=>o.jsx("circle",{cx:v(y),cy:p(x),r:"2.4",fill:"var(--color-chart-cost)"},n[y]))]})]})}function yN({values:n,total:l}){const i=Math.max(1,...n);return o.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[o.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-ink)]",children:"30 day inference cost"}),o.jsx("span",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:l})]}),o.jsx("div",{className:"flex h-[60px] items-end gap-1",children:n.map((s,u)=>o.jsx("span",{className:"flex-1 rounded-t-[3px] bg-[var(--color-tokens)]/75",style:{height:`${Math.max(8,s/i*100)}%`}},u))})]})}function uf(n){return n.length===0?"":n.length===1?`M ${n[0][0]} ${n[0][1]}`:n.reduce((l,i,s)=>{if(s===0)return`M ${i[0]} ${i[1]}`;const u=n[s-1],f=(u[0]+i[0])/2;return`${l} C ${f} ${u[1]}, ${f} ${i[1]}, ${i[0]} ${i[1]}`},"")}function SN({model:n,color:l}){return o.jsxs("span",{className:"inline-flex min-w-0 max-w-[9rem] items-center gap-1.5 rounded-[7px] border border-[var(--color-line-2)] bg-white px-1.5 py-0.5",title:n,children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:l}}),o.jsx("span",{className:"truncate font-mono text-[0.68rem]",children:n})]})}function gx({label:n,dashed:l=!1}){return o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-[7px] border border-[var(--color-line-2)] bg-white px-1.5 py-0.5",children:[o.jsx("span",{className:["h-px w-4 border-t border-[var(--color-ink)]",l?"border-dashed":""].join(" ")}),o.jsx("span",{className:"font-mono text-[0.68rem]",children:n})]})}function jN({checkedAt:n,healthy:l,pid:i,status:s,proxyPort:u,controlPort:f}){const h=[{icon:o.jsx(_S,{className:"size-3"}),label:"Daemon",value:i?`pid ${i}`:s??Oe,tone:l?"green":"amber"},{icon:o.jsx(GS,{className:"size-3"}),label:"Proxy",value:u?`:${u}`:Oe,tone:"blue"},{icon:o.jsx(tj,{className:"size-3"}),label:"Control",value:f?`:${f}`:Oe,tone:"router"}];return o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-[var(--radius-xl)] border border-[var(--color-line-2)] bg-white px-3 py-2 shadow-[var(--shadow-chip)]",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white px-2.5 py-1 text-[0.72rem] font-medium text-[var(--color-muted)]",children:[o.jsx(Zo,{className:"size-3.5"}),n]}),h.map(v=>o.jsx(NN,{...v},v.label))]})}function NN({icon:n,label:l,value:i,tone:s}){const u={green:"bg-[var(--color-success-soft)] text-[var(--color-success)]",blue:"bg-[var(--color-tokens-soft)] text-[var(--color-tokens)]",router:"bg-[var(--color-lavender)] text-[var(--color-router)]",spend:"bg-[var(--color-spend-soft)] text-[var(--color-spend)]",amber:"bg-[var(--color-warning-soft)] text-[var(--color-warning)]"}[s];return o.jsxs("div",{className:"inline-flex min-w-0 max-w-full items-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white px-2.5 py-1",children:[o.jsx("span",{className:["grid size-5 shrink-0 place-items-center rounded-[var(--radius-sm)]",u].join(" "),children:n}),o.jsx("span",{className:"text-[0.72rem] font-semibold text-[var(--color-ink)]",children:l}),o.jsx("span",{className:"min-w-0 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:i})]})}function wN(n){const l=yx(7),i=yx(30),s=df(new Date),u=new Set(l.map(O=>O.key)),f=new Map(i.map((O,K)=>[O.key,K])),h=["var(--color-chart-input)","var(--color-spend)","var(--color-chart-cost)","var(--color-inventory)"],v=new Map,p=l.map(()=>0),x=i.map(()=>0);let y=0,g=0,j=0,N=0,T=0,E=0,L=0,z=0,Q=0;for(const O of n){const K=df(new Date(O.createdAt)),J=O.settledUsdMicros??O.billedMicros??0,H=O.promptTokens??0,F=O.completionTokens??0;Q+=1,g+=J,N+=H,T+=F,K===s&&(z+=1,y+=J,E+=H,L+=F);const Z=l.findIndex($=>$.key===K);if(Z>=0){j+=J,p[Z]+=J/1e6;const $=v.get(O.modelId)??{input:l.map(()=>0),output:l.map(()=>0),total:0};$.input[Z]+=H,$.output[Z]+=F,$.total+=H+F,v.set(O.modelId,$)}else u.has(K)&&(j+=J);const le=f.get(K);le!==void 0&&(x[le]+=J/1e6)}const q=Array.from(v.entries()).sort((O,K)=>K[1].total-O[1].total).slice(0,4).map(([O,K],J)=>({model:O,color:h[J%h.length],input:K.input,output:K.output}));return{days:l.map(O=>O.label),modelUsage:q,cost:p,thirtyDaySpend:x,todaySpendMicros:y,totalSpendMicros:g,weeklySpendMicros:j,inputTokens:N,outputTokens:T,todayInputTokens:E,todayOutputTokens:L,todayRequestCount:z,totalRequestCount:Q}}function yx(n){const l=[],i=new Intl.DateTimeFormat("en",{weekday:"short"});for(let s=n-1;s>=0;s-=1){const u=new Date;u.setHours(0,0,0,0),u.setDate(u.getDate()-s),l.push({key:df(u),label:i.format(u)})}return l}function df(n){if(Number.isNaN(n.getTime()))return"";const l=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),s=String(n.getDate()).padStart(2,"0");return`${l}-${i}-${s}`}const MN=[{value:"balanced",label:"Balanced"},{value:"speed",label:"Speed"},{value:"discount",label:"Cost"}],Sx=10,CN=["clawtip"];function TN(){var Ba,qa,Ha,aa,$a,Ea,bl,Ln,ln,oe,$e,Et;const n=_b(),l=Ob(),i=vj(),s=Db(),u=xj(),f=Ub(),h=jj(),v=bj(),p=gj(),x=yj(),y=Sj(),g=Lb(),j=rc(),N=Cj(),T=lc(),E=_f(),L=hj(),z=Of(),Q=Df(),[q,O]=S.useState({mode:"fullAuto",scorer:"balanced"}),[K,J]=S.useState([]),[H,F]=S.useState(""),[Z,le]=S.useState("manual"),[$,ue]=S.useState("recommended"),[ee,xe]=S.useState(null),[de,R]=S.useState(null),[X,ie]=S.useState(null),ne=wj({...q,modelId:H}),pe=j.data,C=((Ba=f.data)==null?void 0:Ba.providers)??[],P=((qa=f.data)==null?void 0:qa.routing)??{policy:"fallback"},I=((Ha=g.data)==null?void 0:Ha.sellers)??[],te=((aa=N.data)==null?void 0:aa.focusSet)??[],fe=(($a=T.data)==null?void 0:$a.inferences)??[],be=S.useMemo(()=>VN(fe),[fe]),ge=S.useMemo(()=>PN((pe==null?void 0:pe.data)??[],te),[te,pe==null?void 0:pe.data]),_e=JN(ne.data),Ee=S.useMemo(()=>ZN(I,pe,(_e==null?void 0:_e.routes)??[]),[pe,_e==null?void 0:_e.routes,I]),_t=S.useMemo(()=>K.map(W=>ge.find(re=>re.id===W)).filter(Wo),[ge,K]),bt=q.sellerIds??[],Ot=((Ea=E.data)==null?void 0:Ea.payments)??[],rt=S.useMemo(()=>nw(Ot),[Ot]),Ie=S.useMemo(()=>Hb(Ot,fe),[fe,Ot]),ma=S.useMemo(()=>{const W=aw(Ee,K,q.scorer);if($==="recommended")return W;const re=bt.map(we=>Ee.find(tt=>tt.id===we)).filter(Wo);return Hf(re,K,q.scorer)},[$,q.scorer,bt,K,Ee]),Kt=s.isLoading||j.isLoading||g.isLoading||ne.isFetching&&ma.length===0,zn=!Kt&&(s.isFetching||j.isFetching||g.isFetching||ne.isFetching),ea=S.useMemo(()=>tg({inferences:fe,modelsResponse:pe,sellersResponse:g.data,previewPlan:_e,activeModelId:H}),[H,fe,pe,_e,g.data]),Dt=S.useMemo(()=>FN(ea.rows,fe),[fe,ea.rows]),Ut=Ot.some(W=>Za(W.method)==="clawtip"&&(W.enabled||lg(W.config,"walletConfigPresent")))||((bl=z.data)==null?void 0:bl.walletConfigPresent)===!0,ta=Z==="auto"&&rt.active;S.useEffect(()=>{var W,re,we;if((W=n.data)!=null&&W.strategy){if(((re=l.data)==null?void 0:re.active)==="auto"&&((we=s.data)!=null&&we.config))return;O(n.data.strategy)}},[(Ln=s.data)==null?void 0:Ln.config,(ln=l.data)==null?void 0:ln.active,(oe=n.data)==null?void 0:oe.strategy]),S.useEffect(()=>{l.data&&le(l.data.active)},[l.data]),S.useEffect(()=>{var re;const W=(re=s.data)==null?void 0:re.config;W&&(ue(W.range),O(we=>({...we,mode:W.range==="custom"?"fixedSet":"fullAuto",scorer:W.scorer,sellerId:void 0,sellerIds:W.sellerIds})),W.modelIds.length>0&&(J(W.modelIds),F(we=>W.modelIds.includes(we)?we:W.modelIds[0]??"")))},[($e=s.data)==null?void 0:$e.config]),S.useEffect(()=>{const W=!N.isLoading&&!T.isLoading;if(K.length>0||ge.length===0||!W)return;const re=GN({focusModels:te,referencedModelIds:be,modelOptions:ge});re.length!==0&&(J(re),F(re[0]??""))},[te,N.isLoading,T.isLoading,ge,be,K.length]),S.useEffect(()=>{!H||K.includes(H)||F(K[0]??"")},[H,K]),S.useEffect(()=>{H&&ne.refetch()},[H,q.mode,q.scorer,q.sellerId,(Et=q.sellerIds)==null?void 0:Et.join(","),WN(q.fixedByModel)]),S.useEffect(()=>{if((X==null?void 0:X.kind)!=="activate"||Za(X.method)!=="clawtip"||Ut)return;const W=window.setInterval(()=>{E.refetch()},1500);return()=>window.clearInterval(W)},[Ut,X==null?void 0:X.kind,X==null?void 0:X.method,E.refetch]),S.useEffect(()=>{(X==null?void 0:X.kind)==="activate"&&Za(X.method)==="clawtip"&&Ut&&(ie(null),z.reset())},[z,Ut,X==null?void 0:X.kind,X==null?void 0:X.method]);function tn(W){J(re=>{const we=re.filter(tt=>tt!==W);return H===W&&F(we[0]??""),of(we).catch(()=>{}),ta&&La({modelIds:we}),we})}function ct(W){const re=Array.from(new Set(W));J(re),F(we=>re.includes(we)?we:re[0]??""),of(re).catch(()=>{}),ta&&La({modelIds:re})}function _n(W){O(re=>({...re,scorer:W})),ta&&La({scorer:W})}function an(W,re){const we=q.sellerIds??[],tt=we.includes(re)?we.filter(Qa=>Qa!==re):[...we,re];Ua(tt)}function Ua(W){const re={...q,mode:"fixedSet",sellerIds:W,sellerId:void 0};O(re),ta&&$==="custom"&&La({range:"custom",sellerIds:W})}async function Aa(W){await v.mutateAsync({name:W.name.trim()||"Custom provider",baseUrl:W.baseUrl.trim(),apiKey:W.apiKey.trim(),enabled:!0,supportedProtocols:["chat_completions"]}),R(null)}async function On(W,re){await p.mutateAsync({providerId:W,input:{name:re.name.trim()||"Custom provider",baseUrl:re.baseUrl.trim(),apiKey:re.apiKey.trim(),enabled:!0,supportedProtocols:["chat_completions"]}}),R(null)}function nn(W){x.mutateAsync(W).catch(re=>{xe(re instanceof Error?re.message:String(re))})}function Dn(W){h.mutateAsync(W).catch(re=>{xe(re instanceof Error?re.message:String(re))})}function Un(W){const re=C.findIndex(tt=>tt.id===W);if(re<=0)return;const we=C.map(tt=>tt.id);[we[re-1],we[re]]=[we[re],we[re-1]],y.mutateAsync(we).catch(tt=>{xe(tt instanceof Error?tt.message:String(tt))})}function He(W){ue(W),W==="custom"&&bt.length===0&&R({kind:"sellers"}),ta&&La({range:W})}function We(W){le(W),xe(null),i.mutateAsync(W).then(re=>{le(re.active),re.strategy&&O(re.strategy)}).catch(re=>{xe(re instanceof Error?re.message:String(re))})}function ha(W){xe(null),L.mutateAsync(W).catch(re=>{xe(re instanceof Error?re.message:String(re))})}function jt(W){ie({kind:"activate",method:W}),Za(W)==="clawtip"&&z.mutate()}function er(W){ie({kind:"recharge",method:W}),Za(W)==="clawtip"&&Q.mutate()}function tr(){ie(null),z.reset(),Q.reset()}async function La(W={}){var it;if(!rt.active){xe("Bind a payment method to enable Auto provider.");return}const re=W.scorer??q.scorer,we=W.range??$,tt=W.modelIds??K,Qa=W.sellerIds??bt;O(we==="recommended"?{mode:"fullAuto",scorer:re}:{mode:"fixedSet",scorer:re,sellerIds:Qa}),xe(null);try{const ke=await u.mutateAsync(XN({base:(it=s.data)==null?void 0:it.config,enabled:!0,range:we,scorer:re,modelIds:tt,sellerIds:Qa}));le(ke.active),ke.strategy&&O(ke.strategy)}catch(ke){xe(ke instanceof Error?ke.message:String(ke))}}return o.jsxs("div",{className:"space-y-5",children:[o.jsx("section",{children:o.jsxs(At,{className:"overflow-hidden",children:[o.jsx(AN,{activeTab:Z,onChange:We}),o.jsxs("div",{className:"p-4",children:[n.isLoading||l.isLoading||g.isLoading||j.isLoading||f.isLoading?o.jsx("div",{className:"mb-3 rounded-[10px] border border-[var(--color-line-2)] bg-white px-3 py-2 text-[0.82rem] text-[var(--color-muted)]",children:"Loading routing data..."}):null,n.isError||l.isError||g.isError||j.isError||f.isError?o.jsx("div",{className:"mb-3 rounded-[10px] border border-rose-100 bg-rose-50 px-3 py-2 text-[0.82rem] text-rose-700",children:"Some routing data could not be loaded. Check that tb-proxyd is running."}):null,Z==="manual"?o.jsx(EN,{providers:C,routing:P,onAdd:()=>R({kind:"manualProvider"}),onRemove:nn,onSetRouting:Dn,onMoveUp:Un,onViewModels:W=>R({kind:"manualProviderModels",provider:W}),onEdit:W=>R({kind:"manualProviderEdit",provider:W})}):o.jsx(RN,{walletAccess:rt,paymentMethods:Ie,selectedModels:_t,activeModelId:H,range:$,scorer:q.scorer,effectiveSellers:ma,selectedSellerIds:bt,sellerActivityById:Dt,loading:Kt,refreshing:zn,applyError:ee,focusSaveError:N.isError,onSelectPayment:ha,onActivatePayment:jt,onRechargePayment:er,onAddModels:()=>R({kind:"models"}),onSetActiveModel:F,onRemoveModel:tn,onRangeChange:He,onScorerChange:_n,onChooseSellers:()=>R({kind:"sellers"}),onRemoveSeller:W=>an(H,W)})]})]})}),o.jsx(UN,{summary:ea}),(de==null?void 0:de.kind)==="models"?o.jsx(HN,{models:ge,selectedModelIds:K,onClose:()=>R(null),onSave:W=>{ct(W),R(null)}}):null,(de==null?void 0:de.kind)==="sellers"?o.jsx($N,{selectedSellerIds:bt,selectedModelIds:K,scorer:q.scorer,sellers:Ee,onClose:()=>R(null),onSave:W=>{Ua(W),R(null)}}):null,(de==null?void 0:de.kind)==="manualProvider"?o.jsx(wx,{onClose:()=>R(null),onSave:Aa}):null,(de==null?void 0:de.kind)==="manualProviderEdit"?o.jsx(wx,{provider:de.provider,onClose:()=>R(null),onSave:W=>On(de.provider.id,W)}):null,(de==null?void 0:de.kind)==="manualProviderModels"?o.jsx(QN,{provider:de.provider,onClose:()=>R(null)}):null,X?o.jsx($b,{modal:X,methods:Ie,qr:X.kind==="activate"?z.data:Q.data,loading:X.kind==="activate"?z.isPending:Q.isPending,error:X.kind==="activate"?z.error:Q.error,onClose:tr}):null]})}function AN({activeTab:n,onChange:l}){return o.jsx("div",{className:"border-b border-[var(--color-line-2)] bg-white p-2.5",children:o.jsxs("div",{className:["relative grid min-h-[58px] grid-cols-2 overflow-hidden rounded-full border border-[var(--color-line-2)] bg-[var(--color-page)] p-1 shadow-inner","before:absolute before:inset-y-1 before:left-1 before:w-[calc(50%-4px)] before:rounded-full before:shadow-[0_10px_24px_rgba(60,41,112,0.14)] before:transition before:duration-200 before:ease-out",n==="auto"?"border-[var(--color-purple)]/35 before:bg-[var(--color-purple)]":"before:bg-white",n==="auto"?"before:translate-x-full":"before:translate-x-0"].join(" "),children:[o.jsx("button",{type:"button",onClick:()=>l("manual"),"aria-pressed":n==="manual","aria-label":"Manual provider mode",className:["relative z-10 flex min-w-0 items-center justify-center rounded-full px-5 text-center transition",n==="manual"?"text-[var(--color-ink)]":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:o.jsx("span",{className:"min-w-0 truncate text-[1rem] font-semibold",children:"Manual"})}),o.jsx("button",{type:"button",onClick:()=>l("auto"),"aria-pressed":n==="auto","aria-label":"Auto provider mode",className:["relative z-10 flex min-w-0 items-center justify-center rounded-full px-5 text-center transition",n==="auto"?"text-white":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:o.jsx("span",{className:"min-w-0 truncate text-[1rem] font-semibold",children:"Auto"})})]})})}function EN({providers:n,routing:l,onAdd:i,onRemove:s,onSetRouting:u,onMoveUp:f,onViewModels:h,onEdit:v}){const p=l.policy==="fallback";return o.jsxs("div",{className:"overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-white",children:[o.jsx("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--color-line-2)] px-3 py-2.5",children:o.jsx("span",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Custom providers"})}),n.length>0?o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[720px] table-fixed",children:[o.jsx("thead",{className:"border-b border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] text-left text-[0.66rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-[38%] px-3 py-2",children:"Provider"}),o.jsx("th",{className:"w-[9%] px-3 py-2 text-right",children:"Models"}),o.jsx("th",{className:"w-[16%] px-3 py-2",children:"Status"}),o.jsx("th",{className:"w-[21%] px-3 py-2",children:"Last call"}),o.jsx("th",{className:"w-[16%] px-3 py-2 text-right",children:"Actions"})]})}),o.jsx("tbody",{className:"divide-y divide-[var(--color-line-2)]",children:n.map((x,y)=>{var g;return o.jsxs("tr",{className:"align-middle",children:[o.jsx("td",{className:"px-3 py-2.5",children:o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:x.name}),o.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:x.baseUrl})]})}),o.jsx("td",{className:"px-3 py-2.5 text-right",children:o.jsxs("button",{type:"button",onClick:()=>h(x),className:"inline-flex items-center gap-1 rounded-full bg-[var(--color-page)] px-2 py-1 font-mono text-[0.72rem] font-semibold text-[var(--color-purple)] ring-1 ring-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]","aria-label":`View models for ${x.name}`,children:[qe(((g=x.models)==null?void 0:g.length)??0),o.jsx(KS,{size:12})]})}),o.jsx("td",{className:"px-3 py-2.5",children:o.jsx(kN,{provider:x})}),o.jsx("td",{className:"px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-muted)]",children:sc(x.lastAccess)}),o.jsx("td",{className:"px-3 py-2.5",children:o.jsxs("div",{className:"flex justify-end gap-1.5",children:[p?o.jsx("button",{type:"button",onClick:()=>f(x.id),disabled:y===0,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-not-allowed disabled:opacity-35","aria-label":`Move ${x.name} up`,title:"Move up",children:o.jsx(kb,{size:14})}):null,o.jsx("button",{type:"button",onClick:()=>v(x),className:"tb-button tb-button-icon tb-button-quiet","aria-label":`Edit ${x.name}`,title:"Edit",children:o.jsx(VS,{size:14})}),o.jsx("button",{type:"button",onClick:()=>s(x.id),className:"tb-button tb-button-icon tb-button-quiet hover:border-[var(--color-danger)] hover:bg-[var(--color-danger-soft)] hover:text-[var(--color-danger)]","aria-label":`Remove ${x.name}`,children:o.jsx(zf,{size:14})})]})})]},x.id)})})]})}):o.jsx("div",{className:"px-3 py-6 text-center text-[0.84rem] text-[var(--color-muted)]",children:"No custom providers yet."}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[o.jsxs("button",{type:"button",onClick:i,className:"tb-button tb-button-sm tb-button-primary",children:[o.jsx(ds,{size:14}),"Add provider"]}),o.jsxs("div",{className:"ml-auto flex flex-wrap items-center justify-end gap-1.5",children:[o.jsx(Ud,{label:"Fallback on error",state:p?"selected":"enabled",onClick:()=>u({policy:"fallback"})}),o.jsx(Ud,{label:"Cost first",state:"disabled"}),o.jsx(Ud,{label:"Multi-provider concurrent calls",state:"disabled"})]})]})]})}function Ud({label:n,state:l,onClick:i}){const s=l!=="disabled"&&!!i,u={enabled:"border-[var(--color-line-2)] bg-white text-[var(--color-muted)] shadow-[0_1px_3px_rgba(60,41,112,0.05)] hover:border-[var(--color-primary)] hover:bg-[var(--color-primary-soft)] hover:text-[var(--color-primary-deep)]",selected:"border-[var(--color-primary)]/35 bg-[var(--color-primary-soft)] text-[var(--color-primary-deep)] shadow-[0_1px_4px_rgba(60,41,112,0.08)]",disabled:"border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] text-[var(--color-muted-soft)] opacity-70"}[l];return o.jsx("button",{type:"button",onClick:i,disabled:!s,className:["inline-flex h-7 items-center justify-center rounded-full border px-3 text-[0.7rem] font-semibold transition disabled:cursor-not-allowed",u].join(" "),"aria-pressed":l==="selected",title:n==="Fallback on error"?"Use providers by table order when the current provider fails.":`${n} is not available in Manual mode.`,children:n})}function kN({provider:n}){const l=(n.status??"unknown").toLowerCase(),u=l==="healthy"||l==="ok"||l==="online"?"bg-emerald-50 text-emerald-700 ring-emerald-100":l==="unknown"||l===""?"bg-[var(--color-page)] text-[var(--color-muted)] ring-[var(--color-line-2)]":"bg-rose-50 text-rose-700 ring-rose-100";return o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.jsxs("span",{className:["inline-flex h-6 items-center gap-1.5 rounded-full px-2 text-[0.68rem] font-semibold ring-1",u].join(" "),children:[o.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),n.status??"unknown"]}),n.current?o.jsx("span",{className:"inline-flex h-6 items-center rounded-full bg-emerald-50 px-2 text-[0.62rem] font-semibold uppercase text-emerald-700 ring-1 ring-emerald-100",children:"Current"}):null,n.errorClass?o.jsx("span",{className:"text-[0.7rem] text-[var(--color-danger)]",children:n.errorClass}):null]})}function RN({walletAccess:n,paymentMethods:l,selectedModels:i,activeModelId:s,range:u,scorer:f,effectiveSellers:h,selectedSellerIds:v,sellerActivityById:p,loading:x,refreshing:y,applyError:g,focusSaveError:j,onSelectPayment:N,onActivatePayment:T,onRechargePayment:E,onAddModels:L,onSetActiveModel:z,onRemoveModel:Q,onRangeChange:q,onScorerChange:O,onChooseSellers:K,onRemoveSeller:J}){const H=!n.active;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3 rounded-[12px] border border-[var(--color-line-2)] bg-white px-3 py-2",children:[!H&&g?o.jsx("span",{className:"max-w-full truncate rounded-full bg-rose-50 px-2.5 py-1 text-[0.74rem] font-semibold text-rose-700 ring-1 ring-rose-100 sm:max-w-[360px]",title:g,children:g}):null,o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[o.jsx("span",{className:"text-[0.68rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:"Payment route"}),o.jsx("div",{className:"inline-flex min-h-9 flex-wrap items-center gap-1 rounded-full border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] p-0.5",children:n.options.map(F=>o.jsx(zN,{option:F,method:l.find(Z=>Za(Z.method)===Za(F.method)),onSelect:N,onActivate:T,onRecharge:E},F.method))})]})]}),o.jsxs("div",{className:["space-y-3 transition",H?"pointer-events-none select-none opacity-45 grayscale-[0.25]":""].join(" "),"aria-disabled":H,children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-[12px] border border-[var(--color-line-2)] bg-white px-3 py-2",children:[o.jsx("span",{className:"mr-1 text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Models"}),i.map(F=>{const Z=s===F.id;return o.jsxs("span",{className:["inline-flex h-8 items-center gap-1.5 rounded-[8px] border px-2.5 font-mono text-[0.8rem] transition",Z?"border-[var(--color-primary)] bg-[var(--color-primary-soft)] shadow-[inset_0_0_0_1px_rgba(124,61,240,0.18)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)] hover:bg-[var(--color-panel-subtle)]"].join(" "),children:[o.jsx("button",{type:"button",onClick:()=>z(F.id),disabled:H,className:["truncate font-semibold",Z?"text-[var(--color-primary-deep)]":"text-[color-mix(in_srgb,var(--color-primary-deep)_82%,var(--color-muted))]"].join(" "),children:F.id}),o.jsx("span",{className:"rounded-full bg-white px-1.5 text-[0.68rem] text-[var(--color-muted)]",children:F.sellerCount}),o.jsx("button",{type:"button",onClick:()=>Q(F.id),disabled:H,className:"text-[var(--color-muted)] hover:text-rose-700","aria-label":`Remove ${F.id}`,children:o.jsx(zf,{size:12})})]},F.id)}),o.jsxs("button",{type:"button",onClick:L,disabled:H,className:"tb-button tb-button-sm tb-button-secondary",children:[o.jsx(ds,{size:14}),"Add"]}),i.length===0?o.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"Choose at least one model."}):null,j?o.jsx("span",{className:"text-[0.8rem] text-amber-700",children:"Models could not be saved."}):null]}),o.jsx(_N,{range:u,scorer:f,sellers:h,selectedSellerIds:v,sellerActivityById:p,disabled:H,loading:x,refreshing:y,onRangeChange:q,onScorerChange:O,onChooseSellers:K,onRemoveSeller:J})]})]})}function zN({option:n,method:l,onSelect:i,onActivate:s,onRecharge:u}){const[f,h]=S.useState(!1),v=["inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.74rem] font-semibold transition",n.selected?"bg-[var(--color-primary-soft)] text-[var(--color-primary-deep)] shadow-[0_1px_4px_rgba(60,41,112,0.08)]":n.configured?"text-[var(--color-muted)] hover:bg-white hover:text-[var(--color-ink)]":"border border-amber-200 bg-amber-50 text-amber-800 hover:border-amber-300 hover:bg-amber-100"].join(" "),p=["inline-flex size-4 items-center justify-center rounded-full text-[0.58rem] font-black",n.method==="clawtip"?"bg-[var(--color-danger-soft)] text-[var(--color-danger)]":"bg-[var(--color-lavender)] text-[var(--color-primary-deep)]"].join(" "),x=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:p,"aria-hidden":"true",children:n.label.charAt(0)}),o.jsx("span",{children:n.configured?n.label:`Bind ${n.label}`}),n.selected?o.jsx("span",{className:"text-[0.64rem] uppercase tracking-[0.08em] opacity-75",children:"Active"}):null,n.selected?o.jsx(CS,{size:13,"aria-hidden":"true"}):null]});return n.configured?n.selected?o.jsxs("div",{className:"relative",children:[o.jsx("button",{type:"button",onClick:()=>h(y=>!y),className:v,"aria-pressed":!0,"aria-expanded":f,"aria-haspopup":"menu",children:x}),f?o.jsx("div",{className:"absolute right-0 z-20 mt-1 w-40 overflow-hidden rounded-[10px] border border-[var(--color-line-2)] bg-white p-1 shadow-[0_12px_28px_rgba(15,23,42,0.1)]",children:o.jsxs("button",{type:"button",onClick:()=>{h(!1),u((l==null?void 0:l.method)??n.method)},className:"flex h-8 w-full items-center justify-between rounded-[8px] px-2.5 text-left text-[0.76rem] font-semibold text-[var(--color-ink)] transition hover:bg-[var(--color-lavender)]/45",role:"menuitem",children:[o.jsx("span",{children:"Recharge"}),o.jsx("span",{className:"font-mono text-[0.68rem] text-[var(--color-muted)]",children:(l==null?void 0:l.balance)??"••••"})]})}):null]}):o.jsx("button",{type:"button",onClick:()=>i(n.method),className:v,"aria-pressed":!1,children:x}):o.jsx("button",{type:"button",onClick:()=>s(n.method),className:v,"aria-label":`Bind ${n.label}`,children:x})}function _N({range:n,scorer:l,sellers:i,selectedSellerIds:s,sellerActivityById:u,disabled:f=!1,loading:h=!1,refreshing:v=!1,onRangeChange:p,onScorerChange:x,onChooseSellers:y,onRemoveSeller:g}){return o.jsxs("div",{className:"overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-white",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--color-line-2)] px-3 py-2.5",children:[o.jsxs("div",{className:"min-w-[150px]",children:[o.jsx("div",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Seller list"}),o.jsxs("div",{className:"mt-0.5 font-mono text-[0.72rem] text-[var(--color-muted)]",children:[h&&i.length===0?"Loading providers...":`${qe(Math.min(i.length,Sx))} of ${qe(i.length)} providers`,v?o.jsx("span",{className:"ml-2 text-[var(--color-purple)]",children:"Refreshing"}):null]})]}),o.jsxs("div",{className:"ml-auto flex flex-wrap items-center justify-end gap-2",children:[o.jsx(jx,{options:[{value:"recommended",label:"Recommended"},{value:"custom",label:"Custom"}],value:n,onChange:p,disabled:f}),o.jsx("button",{type:"button",onClick:y,disabled:f||n!=="custom",className:"tb-button tb-button-sm tb-button-primary min-w-[72px]",title:n==="custom"?"Select sellers":"Switch to Custom to select sellers",children:"Select"})]})]}),o.jsxs("div",{className:"divide-y divide-[var(--color-line-2)]",children:[h&&i.length===0?o.jsx(ON,{}):null,i.slice(0,Sx).map(j=>{const N=u.get(j.id);return o.jsxs("div",{className:"grid gap-2 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"truncate font-semibold text-[var(--color-ink)]",children:j.name}),N!=null&&N.current?o.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full bg-emerald-50 px-2 py-0.5 text-[0.66rem] font-semibold uppercase text-emerald-700 ring-1 ring-emerald-100",children:"Current"}):null]}),o.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:Oj(j.id)}),o.jsxs("div",{className:"mt-0.5 truncate text-[0.7rem] text-[var(--color-muted)]",children:["Last call ",o.jsx("span",{className:"font-mono",children:sc(N==null?void 0:N.lastAccessAt)})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:justify-end",children:[o.jsx(Ld,{label:"Discount",value:j.discount}),o.jsx(Ld,{label:"TTFT",value:Jl(j.latencyMs)}),o.jsx(Ld,{label:"Tok/s",value:ic(j.tokensPerSecond)}),n==="custom"&&s.includes(j.id)?o.jsx("button",{type:"button",onClick:()=>g(j.id),disabled:f,className:"tb-button tb-button-icon tb-button-quiet hover:border-[var(--color-danger)] hover:bg-[var(--color-danger-soft)] hover:text-[var(--color-danger)]","aria-label":`Remove ${j.name}`,children:o.jsx(zf,{size:14})}):null]})]},j.id)}),!h&&i.length===0?o.jsx("div",{className:"px-3 py-8 text-center text-[0.84rem] text-[var(--color-muted)]",children:n==="custom"?"No custom sellers selected.":"No warmed sellers available for these models."}):null]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2",children:[o.jsx("span",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Routing priority"}),o.jsx(jx,{options:MN,value:l,onChange:x,disabled:f}),o.jsx("span",{className:"ml-auto max-w-full text-right text-[0.74rem] text-[var(--color-muted)] sm:max-w-[420px]",children:DN(l)})]})]})}function ON(){return o.jsx(o.Fragment,{children:[0,1,2].map(n=>o.jsxs("div",{className:"grid gap-2 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[o.jsxs("div",{className:"min-w-0 space-y-2",children:[o.jsx("div",{className:"h-4 w-44 animate-pulse rounded-full bg-[var(--color-line-2)]"}),o.jsx("div",{className:"h-3 w-28 animate-pulse rounded-full bg-[var(--color-page)]"}),o.jsx("div",{className:"h-3 w-52 animate-pulse rounded-full bg-[var(--color-page)]"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:justify-end",children:[o.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"}),o.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"}),o.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"})]})]},n))})}function jx({options:n,value:l,onChange:i,disabled:s=!1}){return o.jsx("div",{className:"inline-flex h-8 rounded-[8px] border border-[var(--color-purple)]/20 bg-[var(--color-page)] p-0.5",children:n.map(u=>o.jsx("button",{type:"button",onClick:()=>i(u.value),disabled:s,className:["rounded-[6px] px-2.5 text-[0.74rem] font-semibold transition disabled:cursor-not-allowed disabled:opacity-60",l===u.value?"bg-[var(--color-purple)] text-white shadow-[0_4px_12px_rgba(124,61,240,0.24)]":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:u.label},String(u.value)))})}function Ld({label:n,value:l}){return o.jsxs("div",{className:"min-w-16 rounded-[8px] bg-[var(--color-page)] px-2.5 py-1.5 text-right",children:[o.jsx("div",{className:"text-[0.6rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:n}),o.jsx("div",{className:"mt-0.5 font-mono text-[0.78rem] font-semibold text-[var(--color-ink)]",children:l})]})}function DN(n){return n==="speed"?"Prefers lower TTFT and stronger throughput.":n==="discount"?"Prefers lower effective cost among healthy providers.":"Balances reliability, speed, and cost."}function UN({summary:n}){return o.jsx("section",{children:o.jsxs(At,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[var(--color-line-2)] px-4 py-3",children:[o.jsx("div",{className:"min-w-0",children:o.jsx("div",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Current routes"})}),o.jsxs("div",{className:"rounded-[8px] border border-[var(--color-line-2)] bg-white px-2.5 py-1.5 font-mono text-[0.74rem] text-[var(--color-muted)]",children:[qe(n.rows.length)," models"]})]}),o.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[760px] border-collapse text-left text-[0.82rem]",children:[o.jsx("thead",{className:"bg-white/70 text-[0.66rem] uppercase tracking-wider text-[var(--color-muted)]",children:o.jsxs("tr",{children:[o.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"MODEL"}),o.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"PROVIDER"}),o.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"STRATEGY"}),o.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"STATUS"}),o.jsx("th",{className:"px-4 py-2.5 text-right font-semibold",children:"TTFT"}),o.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"LAST CALL"})]})}),o.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[n.rows.map(l=>o.jsx(LN,{row:l},`${l.source}-${l.modelId}-${l.currentSellerId}`)),n.rows.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-[var(--color-muted)]",children:"No model traffic yet."})}):null]})]})})]})})}function LN({row:n}){const l=BN(n),i=qN(n.routeReason,n.source);return o.jsxs("tr",{className:"align-middle transition hover:bg-[var(--color-lavender)]/25",children:[o.jsx("td",{className:"px-4 py-3.5",children:o.jsx("div",{className:"max-w-[220px] truncate font-mono text-[0.84rem] font-semibold text-[var(--color-ink)]",title:n.modelId,children:n.modelId})}),o.jsx("td",{className:"px-4 py-3.5",children:o.jsx("div",{className:"max-w-[230px] truncate font-semibold text-[var(--color-purple)]",title:n.currentSellerId,children:n.currentSellerName})}),o.jsx("td",{className:"px-4 py-3.5",children:o.jsx(Nx,{tone:i.tone,children:i.label})}),o.jsx("td",{className:"px-4 py-3.5",children:o.jsx(Nx,{tone:l.tone,children:l.label})}),o.jsx("td",{className:"px-4 py-3.5 text-right",children:o.jsx("div",{className:"font-mono text-[0.84rem] font-semibold text-[var(--color-ink)]",title:"Time to first token",children:Jl(n.lastTtftMs??n.avgTtftMs)})}),o.jsx("td",{className:"whitespace-nowrap px-4 py-3.5",children:o.jsx("div",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:sc(n.lastAccessAt)})})]})}function BN(n){return n.source==="preview"?{label:"Preview",tone:"amber"}:n.upstreamStatus&&!Bd(n.upstreamStatus)?{label:is(n.upstreamStatus),tone:zd(n.upstreamStatus)}:n.lastStatus&&!Bd(n.lastStatus)?{label:is(n.lastStatus),tone:zd(n.lastStatus)}:n.currentSellerStatus&&!Bd(n.currentSellerStatus)?{label:is(n.currentSellerStatus),tone:zd(n.currentSellerStatus)}:{label:"Ready",tone:"green"}}function Bd(n){const l=is(n);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"}function qN(n,l){return n?n.startsWith("manual:fallback")?{label:"Manual fallback",tone:"blue"}:n.startsWith("manual:locked")?{label:"Manual direct",tone:"blue"}:n.startsWith("fixedSet")?{label:"Auto custom",tone:"green"}:n.startsWith("fixed")?{label:"Auto fixed",tone:"green"}:n.startsWith("fullAuto:discount")?{label:"Auto cost",tone:"green"}:n.startsWith("fullAuto:speed")?{label:"Auto speed",tone:"green"}:n.startsWith("fullAuto:balanced")?{label:"Auto balanced",tone:"green"}:n.startsWith("fullAuto")?{label:"Auto",tone:"green"}:l==="preview"?{label:"Preview",tone:"amber"}:{label:"Active",tone:"gray"}:l==="preview"?{label:"Preview",tone:"amber"}:{label:"Active",tone:"gray"}}function Nx({tone:n,children:l}){const i={green:"bg-emerald-50 text-emerald-700",amber:"bg-amber-50 text-amber-700",red:"bg-rose-50 text-rose-700",blue:"bg-blue-50 text-blue-700",gray:"bg-slate-100 text-slate-600"}[n];return o.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.66rem] font-semibold uppercase",i].join(" "),children:l})}function HN({models:n,selectedModelIds:l,onClose:i,onSave:s}){const[u,f]=S.useState(""),[h,v]=S.useState(l),p=S.useMemo(()=>h.map(g=>n.find(j=>j.id===g)).filter(Wo),[h,n]),x=n.filter(g=>rg(u,[g.id,g.paymentMethod,g.enabled?"enabled":"not enabled"]));function y(g){v(j=>j.includes(g)?j.filter(N=>N!==g):[...j,g])}return o.jsxs(cc,{title:"Add models",onClose:i,children:[o.jsx($f,{value:u,onChange:f,placeholder:"Search models or payment"}),o.jsx("div",{className:"mt-3 max-h-[48dvh] overflow-auto rounded-[12px] border border-[var(--color-line-2)]",children:o.jsxs("table",{className:"w-full border-collapse text-left text-[0.84rem]",children:[o.jsx("thead",{className:"sticky top-0 z-[1] bg-white/95 text-[0.7rem] uppercase tracking-wider text-[var(--color-muted)] backdrop-blur",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-10 px-3 py-2 font-semibold"}),o.jsx("th",{className:"px-3 py-2 font-semibold",children:"Model"}),o.jsx("th",{className:"px-3 py-2 font-semibold",children:"Payment"}),o.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Sellers"})]})}),o.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[x.map(g=>{const j=h.includes(g.id);return o.jsxs("tr",{onClick:()=>y(g.id),className:["cursor-pointer",j?"bg-[var(--color-lavender)]/70":"hover:bg-[var(--color-lavender)]/35",g.enabled?"":"opacity-60"].join(" "),children:[o.jsx("td",{className:"px-3 py-2.5",children:o.jsx(ng,{active:j,fixed:!1})}),o.jsx("td",{className:"px-3 py-2.5 font-mono font-semibold text-[var(--color-ink)]",children:g.id}),o.jsx("td",{className:"px-3 py-2.5",children:o.jsx(KN,{enabled:g.enabled,paymentMethod:g.paymentMethod})}),o.jsx("td",{className:"px-3 py-2.5 text-right text-[var(--color-muted)]",children:g.sellerCount})]},g.id)}),x.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:4,className:"px-3 py-8 text-center text-[var(--color-muted)]",children:"No models found."})}):null]})]})}),o.jsxs("div",{className:"mt-3 rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:["Selected ",p.length]}),p.length>0?o.jsx("button",{type:"button",onClick:()=>v([]),className:"ml-auto text-[0.74rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-purple)]",children:"Clear"}):null]}),o.jsxs("div",{className:"mt-2 flex min-h-8 flex-wrap gap-2",children:[p.map(g=>o.jsxs("button",{type:"button",onClick:()=>y(g.id),className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-[var(--color-line-2)] bg-white px-2.5 py-1 text-[0.76rem] font-mono font-semibold text-[var(--color-ink)] shadow-[0_1px_4px_rgba(60,41,112,0.06)] transition hover:border-[var(--color-purple)] hover:text-[var(--color-purple)]",title:`Remove ${g.id}`,children:[o.jsx("span",{className:"truncate",children:g.id}),o.jsx(Zl,{size:13,"aria-hidden":"true"})]},g.id)),p.length===0?o.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"No model selected."}):null]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[o.jsx("button",{type:"button",onClick:i,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),o.jsx("button",{type:"button",onClick:()=>s(h),"aria-label":"Save selected models","data-testid":"routing-model-picker-done",className:"tb-button tb-button-md tb-button-primary",children:"Save and close"})]})]})}function $N({selectedSellerIds:n,selectedModelIds:l,scorer:i,sellers:s,onClose:u,onSave:f}){const[h,v]=S.useState(""),[p,x]=S.useState(n),[y,g]=S.useState({key:"discount",direction:"asc"}),[j,N]=S.useState(1),T=S.useMemo(()=>Hf(s,l,i),[i,l,s]),E=S.useMemo(()=>new Set(T.map($=>$.id)),[T]),L=S.useMemo(()=>p.map($=>s.find(ue=>ue.id===$)).filter(Wo).filter($=>E.has($.id)),[E,p,s]),z=S.useMemo(()=>T.filter($=>rg(h,[$.name,$.id,$.paymentMethods.join(" "),$.health,$.notes.join(" ")])),[T,h]),Q=S.useMemo(()=>YN(z,y.key,y.direction),[z,y.direction,y.key]),q=10,O=Math.max(1,Math.ceil(Q.length/q)),K=Math.min(j,O),J=Q.slice((K-1)*q,K*q),H=Q.length===0?0:(K-1)*q+1,F=Math.min(K*q,Q.length);S.useEffect(()=>{N(1)},[h,y.direction,y.key]),S.useEffect(()=>{j>O&&N(O)},[j,O]);function Z($){x(ue=>ue.includes($)?ue.filter(ee=>ee!==$):[...ue,$])}function le($){g(ue=>({key:$,direction:ue.key===$&&ue.direction==="asc"?"desc":"asc"}))}return o.jsxs(cc,{title:"Select custom sellers",onClose:u,children:[o.jsx($f,{value:h,onChange:v,placeholder:"Search sellers, payment, notes"}),o.jsx("div",{className:"mt-3 overflow-hidden rounded-[12px] border border-[var(--color-line-2)]",children:o.jsxs("table",{className:"w-full border-collapse text-left text-[0.82rem]",children:[o.jsx("thead",{className:"bg-white/70 text-[0.7rem] uppercase tracking-wider text-[var(--color-muted)]",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-10 px-3 py-2 font-semibold"}),o.jsx($r,{label:"Seller",sortKey:"seller",activeSort:y,onSort:le}),o.jsx($r,{label:"Discount",sortKey:"discount",align:"right",activeSort:y,onSort:le}),o.jsx($r,{label:"Service fee",sortKey:"serviceFee",align:"right",activeSort:y,onSort:le}),o.jsx($r,{label:"Payment",sortKey:"payment",activeSort:y,onSort:le}),o.jsx($r,{label:"TTFT",sortKey:"ttft",align:"right",activeSort:y,onSort:le}),o.jsx($r,{label:"Tok/s",sortKey:"tokensPerSecond",align:"right",activeSort:y,onSort:le})]})}),o.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[J.map($=>{const ue=p.includes($.id);return o.jsxs("tr",{onClick:()=>Z($.id),className:["cursor-pointer",ue?"bg-[var(--color-lavender)]/70":"hover:bg-[var(--color-lavender)]/35"].join(" "),children:[o.jsx("td",{className:"px-3 py-2.5",children:o.jsx(ng,{active:ue,fixed:!1})}),o.jsx("td",{className:"px-3 py-2.5 font-semibold text-[var(--color-ink)]",children:$.name}),o.jsxs("td",{className:"whitespace-nowrap px-3 py-2.5 text-right",children:[o.jsx("div",{className:"font-mono font-semibold text-[var(--color-purple)]",children:$.discount}),o.jsx("div",{className:"mt-0.5",children:o.jsx(Yb,{inputPriceMicrosPer1m:$.inputPriceMicrosPer1m,outputPriceMicrosPer1m:$.outputPriceMicrosPer1m})})]}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:$.markupFee}),o.jsx("td",{className:"px-3 py-2.5 text-[var(--color-muted)]",children:$.paymentMethods.join(", ")}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:Jl($.latencyMs)}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:ic($.tokensPerSecond)})]},$.id)}),Q.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:7,className:"px-3 py-8 text-center text-[var(--color-muted)]",children:"No sellers found."})}):null]})]})}),Q.length>q?o.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2 text-[0.74rem] text-[var(--color-muted)]",children:[o.jsxs("span",{children:["Showing ",qe(H),"-",qe(F)," of ",qe(Q.length)]}),o.jsxs("div",{className:"inline-flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>N($=>Math.max(1,$-1)),disabled:K<=1,className:"tb-button tb-button-sm tb-button-secondary disabled:opacity-45",children:"Previous"}),o.jsxs("span",{className:"min-w-16 text-center font-mono text-[0.72rem] font-semibold text-[var(--color-ink)]",children:[K," / ",O]}),o.jsx("button",{type:"button",onClick:()=>N($=>Math.min(O,$+1)),disabled:K>=O,className:"tb-button tb-button-sm tb-button-secondary disabled:opacity-45",children:"Next"})]})]}):null,o.jsxs("div",{className:"mt-3 rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:["Selected ",L.length]}),L.length>0?o.jsx("button",{type:"button",onClick:()=>x($=>$.filter(ue=>!E.has(ue))),className:"ml-auto text-[0.74rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-purple)]",children:"Clear"}):null]}),o.jsxs("div",{className:"mt-2 flex min-h-8 flex-wrap gap-2",children:[L.map($=>o.jsxs("button",{type:"button",onClick:()=>Z($.id),className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-[var(--color-line-2)] bg-white px-2.5 py-1 text-[0.76rem] font-semibold text-[var(--color-ink)] shadow-[0_1px_4px_rgba(60,41,112,0.06)] transition hover:border-[var(--color-purple)] hover:text-[var(--color-purple)]",title:`Remove ${$.name}`,children:[o.jsx("span",{className:"truncate",children:$.name}),o.jsx(Zl,{size:13,"aria-hidden":"true"})]},$.id)),L.length===0?o.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"No seller selected."}):null]})]}),o.jsxs("div",{className:"mt-3 flex justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[o.jsx("button",{type:"button",onClick:u,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),o.jsx("button",{type:"button",onClick:()=>f(p),className:"tb-button tb-button-md tb-button-primary",children:"Save and close"})]})]})}function wx({provider:n,onClose:l,onSave:i}){var J;const s=!!n,[u,f]=S.useState((n==null?void 0:n.name)??""),[h,v]=S.useState((n==null?void 0:n.baseUrl)??""),[p,x]=S.useState(""),[y,g]=S.useState(null),j=s?{status:"passed",message:`${qe(((J=n==null?void 0:n.models)==null?void 0:J.length)??0)} existing models.`,modelIds:(n==null?void 0:n.models)??[],baseUrl:(n==null?void 0:n.baseUrl)??"",apiKey:""}:{status:"idle",message:"Probe required before adding.",modelIds:[],baseUrl:"",apiKey:""},[N,T]=S.useState(j),E=h.trim(),L=p.trim(),z=E.length>0&&L.length>0&&N.status!=="checking",Q=N.status==="passed"&&N.baseUrl===E&&N.apiKey===L,q=s?u.trim().length>0&&E.length>0&&(L.length===0||Q&&N.modelIds.length>0):Q&&N.modelIds.length>0;function O(){var H;if(s&&p.trim().length===0){T({status:"passed",message:`${qe(((H=n==null?void 0:n.models)==null?void 0:H.length)??0)} existing models.`,modelIds:(n==null?void 0:n.models)??[],baseUrl:(n==null?void 0:n.baseUrl)??"",apiKey:""});return}T({status:"idle",message:s?"Probe required when replacing the key.":"Probe required before adding.",modelIds:[],baseUrl:"",apiKey:""})}async function K(){if(z){g(null),T({status:"checking",message:"Reading model list...",modelIds:[],baseUrl:E,apiKey:L});try{const H=await Nj({baseUrl:E,apiKey:L});T({status:"passed",message:`${qe(H.modelIds.length)} models found.`,modelIds:H.modelIds,baseUrl:E,apiKey:L})}catch(H){T({status:"failed",message:H instanceof Error?H.message:"Model list request failed.",modelIds:[],baseUrl:E,apiKey:L})}}}return o.jsxs(cc,{title:s?`Edit provider · ${(n==null?void 0:n.name)??""}`:"Add provider",onClose:l,children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(qd,{label:"Name",value:u,onChange:f,placeholder:"My provider"}),o.jsx(qd,{label:"Base URL",value:h,onChange:H=>{v(H),O()},placeholder:"https://api.example.com/v1"}),o.jsx(qd,{label:"API key",value:p,onChange:H=>{var F;x(H),H.trim().length===0&&s?T({status:"passed",message:`${qe(((F=n==null?void 0:n.models)==null?void 0:F.length)??0)} existing models.`,modelIds:(n==null?void 0:n.models)??[],baseUrl:(n==null?void 0:n.baseUrl)??"",apiKey:""}):O()},placeholder:s?"Leave blank to keep existing key":"sk-...",type:"password"}),o.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:["inline-flex h-7 items-center rounded-full px-2.5 text-[0.7rem] font-semibold ring-1",N.status==="passed"?"bg-emerald-50 text-emerald-700 ring-emerald-100":N.status==="failed"?"bg-rose-50 text-rose-700 ring-rose-100":"bg-white text-[var(--color-muted)] ring-[var(--color-line-2)]"].join(" "),children:N.message}),o.jsx("button",{type:"button",onClick:K,disabled:!z,className:"tb-button tb-button-sm tb-button-secondary ml-auto",children:s?"Probe new key":"Probe models"})]}),Q||s&&N.status==="passed"?o.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:N.modelIds.map(H=>o.jsx("span",{className:"rounded-full bg-white px-2 py-0.5 font-mono text-[0.68rem] text-[var(--color-muted)] ring-1 ring-[var(--color-line-2)]",children:H},H))}):null]}),y?o.jsx("div",{className:"rounded-[10px] border border-rose-100 bg-rose-50 px-3 py-2 text-[0.78rem] font-semibold text-rose-700",children:y}):null]}),o.jsxs("div",{className:"mt-4 flex justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[o.jsx("button",{type:"button",onClick:l,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),o.jsx("button",{type:"button",onClick:async()=>{if(q){g(null);try{await i({name:u,baseUrl:h,apiKey:p})}catch(H){g(H instanceof Error?H.message:String(H))}}},disabled:!q,className:"tb-button tb-button-md tb-button-primary",children:s?"Save":"Add"})]})]})}function QN({provider:n,onClose:l}){var h;const[i,s]=S.useState(""),u=i.trim().toLowerCase(),f=(n.models??[]).filter(v=>v.toLowerCase().includes(u));return o.jsxs(cc,{title:`Models · ${n.name}`,onClose:l,children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx($f,{value:i,onChange:s,placeholder:"Search models"}),o.jsxs("div",{className:"rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2",children:[o.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:[qe(f.length)," of ",qe(((h=n.models)==null?void 0:h.length)??0)," models"]}),o.jsxs("div",{className:"mt-2 flex max-h-[320px] flex-wrap gap-1.5 overflow-y-auto",children:[f.map(v=>o.jsx("span",{className:"rounded-full bg-white px-2 py-1 font-mono text-[0.72rem] text-[var(--color-muted)] ring-1 ring-[var(--color-line-2)]",children:v},v)),f.length===0?o.jsx("span",{className:"text-[0.82rem] text-[var(--color-muted)]",children:"No models found."}):null]})]})]}),o.jsx("div",{className:"mt-4 flex justify-end border-t border-[var(--color-line-2)] pt-3",children:o.jsx("button",{type:"button",onClick:l,className:"tb-button tb-button-md tb-button-secondary",children:"Close"})})]})}function qd({label:n,value:l,onChange:i,placeholder:s,type:u="text"}){return o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:n}),o.jsx("input",{value:l,type:u,onChange:f=>i(f.target.value),placeholder:s,className:"mt-1 h-10 w-full rounded-[9px] border border-[var(--color-line-2)] bg-white px-3 font-mono text-[0.84rem] text-[var(--color-ink)] outline-none transition placeholder:text-[var(--color-faint)] focus:border-[var(--color-purple)]"})]})}function cc({title:n,children:l,onClose:i}){return o.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-[#201a38]/35 px-4 py-6 backdrop-blur-sm",children:o.jsxs("div",{className:"max-h-[86dvh] w-full max-w-[820px] overflow-hidden rounded-[14px] border border-[var(--color-line-2)] bg-white shadow-[0_24px_70px_rgba(32,26,56,0.22)]",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--color-line-2)] px-5 py-4",children:[o.jsx("div",{className:"min-w-0 flex-1 truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:n}),o.jsx("button",{type:"button",onClick:i,className:"tb-button tb-button-icon tb-button-quiet","aria-label":"Close",children:o.jsx(Zl,{size:16})})]}),o.jsx("div",{className:"max-h-[calc(86dvh-65px)] overflow-auto p-4",children:l})]})})}function KN({enabled:n,paymentMethod:l}){return o.jsxs("span",{className:["inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[0.72rem] ring-1",n?"bg-emerald-50 text-emerald-700 ring-emerald-100":"bg-slate-100 text-slate-500 ring-slate-200"].join(" "),children:[n?o.jsx(nj,{size:12}):o.jsx(sf,{size:12}),l," ",n?"enabled":"not enabled"]})}function ng({active:n,fixed:l}){return o.jsx("span",{className:["inline-flex size-5 shrink-0 items-center justify-center border",l?"rounded-full":"rounded-[6px]",n?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line)] bg-white text-transparent"].join(" "),children:o.jsx(Ht,{size:13,strokeWidth:2.4})})}function $r({label:n,sortKey:l,activeSort:i,align:s="left",onSort:u}){const f=i.key===l;return o.jsx("th",{className:["px-3 py-2 font-semibold",s==="right"?"text-right":""].join(" "),children:o.jsxs("button",{type:"button",onClick:()=>u(l),className:["inline-flex items-center gap-1 transition hover:text-[var(--color-primary-deep)]",s==="right"?"justify-end":"",f?"text-[var(--color-primary-deep)]":""].join(" "),children:[o.jsx("span",{children:n}),o.jsx("span",{className:["font-mono text-[0.58rem]",f?"opacity-100":"opacity-35"].join(" "),children:f?i.direction==="asc"?"↑":"↓":"↕"})]})})}function YN(n,l,i){return[...n].sort((s,u)=>l==="seller"?Ll(s.name,u.name):l==="discount"?qo(s.discountRatio,u.discountRatio,i)||Ll(s.name,u.name):l==="serviceFee"?qo(s.serviceFeeRatio,u.serviceFeeRatio,i)||Ll(s.name,u.name):l==="payment"?Ll(s.paymentMethods.join(", "),u.paymentMethods.join(", "))||Ll(s.name,u.name):l==="ttft"?qo(s.latencyMs,u.latencyMs,i)||Ll(s.name,u.name):qo(s.tokensPerSecond,u.tokensPerSecond,i)||Ll(s.name,u.name))}function Hf(n,l,i){return[...n].sort((s,u)=>{const f=Tx(s,l),h=Tx(u,l);return f!==h?h-f:i==="speed"?ff(s.latencyMs,u.latencyMs)||IN(s.tokensPerSecond,u.tokensPerSecond):i==="discount"?ff(s.discountRatio,u.discountRatio):u.healthScore-s.healthScore})}function PN(n,l){const i=new Map;for(const u of n){const f=i.get(u.id)??{sellerIds:new Set,paymentMethods:new Set};f.sellerIds.add(u.sellerId);for(const h of u.paymentMethods)f.paymentMethods.add(h);i.set(u.id,f)}const s=new Map(l.map((u,f)=>[u,f]));return Array.from(i.entries()).map(([u,f])=>({id:u,paymentMethod:Array.from(f.paymentMethods)[0]??Oe,enabled:f.sellerIds.size>0,sellerCount:f.sellerIds.size})).sort((u,f)=>{const h=s.get(u.id),v=s.get(f.id);return h!==void 0||v!==void 0?(h??9999)-(v??9999):u.id.localeCompare(f.id)})}function GN({focusModels:n,referencedModelIds:l,modelOptions:i}){const s=new Set(i.map(f=>f.id)),u=n.filter(f=>s.has(f));return u.length>0?u:l.filter(f=>s.has(f))}function XN({base:n,enabled:l,range:i,scorer:s,modelIds:u,sellerIds:f}){return{enabled:l,range:i,scorer:s,modelIds:Array.from(new Set(u)),sellerIds:Array.from(new Set(f)),maxConcurrentProviders:10,updatedAt:(n==null?void 0:n.updatedAt)??new Date().toISOString()}}function VN(n){const l=new Set;return[...n].sort((i,s)=>ew(i.createdAt,s.createdAt)).flatMap(i=>!i.modelId||l.has(i.modelId)?[]:(l.add(i.modelId),[i.modelId]))}function FN(n,l){const i=new Map;for(const s of l){if(!s.sellerKey)continue;const u=i.get(s.sellerKey)??{current:!1,modelIds:[]};(!u.lastAccessAt||Yr(s.createdAt)>Yr(u.lastAccessAt))&&(u.lastAccessAt=s.createdAt),i.set(s.sellerKey,u)}for(const s of n){if(!s.currentSellerId||s.currentSellerId===Oe)continue;const u=i.get(s.currentSellerId)??{current:!1,modelIds:[]};u.current=!0,s.lastAccessAt&&(!u.lastAccessAt||Yr(s.lastAccessAt)>Yr(u.lastAccessAt))&&(u.lastAccessAt=s.lastAccessAt),u.modelIds.includes(s.modelId)||u.modelIds.push(s.modelId),i.set(s.currentSellerId,u)}return i}function ZN(n,l,i){const s=(l==null?void 0:l.data)??[],u=new Map(n.map(p=>[p.id,p])),f=new Map(((l==null?void 0:l.sellers)??[]).map(p=>[p.id,p])),h=new Map(i.map(p=>[p.seller.id,p])),v=new Set([...n.map(p=>p.id),...((l==null?void 0:l.sellers)??[]).map(p=>p.id),...s.map(p=>p.sellerId)]);return Array.from(v).map((p,x)=>{const y=u.get(p),g=h.get(p),j=f.get(p),N=s.filter(Z=>Z.sellerId===p),T=N[0],E=Array.from(new Set(N.map(Z=>Z.id))),L=Mx(N.map(Z=>Z.inputPriceMicrosPer1m)),z=Mx(N.map(Z=>Z.outputPriceMicrosPer1m)),Q=Object.fromEntries(N.map(Z=>[Z.id,ux(Z.inputPriceMicrosPer1m,Z.outputPriceMicrosPer1m)])),q=(g==null?void 0:g.metrics.ttftMs)??(j==null?void 0:j.ttftMs)??(g==null?void 0:g.metrics.avgLatencyMs),O=(g==null?void 0:g.metrics.avgTokensPerSecond)??(j==null?void 0:j.avgTokensPerSecond),K=g==null?void 0:g.metrics.healthScore,J=(g==null?void 0:g.metrics.discountRatio)??(j==null?void 0:j.discountRatio),H=Cx([...(j==null?void 0:j.paymentMethods)??[],...(y==null?void 0:y.paymentMethods)??[],...N.flatMap(Z=>Z.paymentMethods)]),F=Cx([...(y==null?void 0:y.supportedProtocols)??[],...(j==null?void 0:j.supportedProtocols)??[],...(T==null?void 0:T.supportedProtocols)??[]]);return{id:p,name:tw((y==null?void 0:y.name)??(j==null?void 0:j.name)??(T==null?void 0:T.sellerName)??p),endpoint:(y==null?void 0:y.url)??(j==null?void 0:j.url)??(T==null?void 0:T.sellerUrl)??"",health:(j==null?void 0:j.status)==="error"||(j==null?void 0:j.status)==="manifest_unavailable"||(y==null?void 0:y.status)==="failed"?"offline":(y==null?void 0:y.status)==="degraded"?"degraded":"online",healthScore:Number.isFinite(K)?Math.round(K):0,coverageModelIds:E,paymentMethods:H,discountRatio:J,discount:Lf(J),serviceFeeRatio:j==null?void 0:j.serviceFeeRatio,markupFee:qb(j==null?void 0:j.serviceFeeRatio),price:ux(L,z),priceByModelId:Q,inputPriceMicrosPer1m:L,outputPriceMicrosPer1m:z,latencyMs:Number.isFinite(q)?Math.round(q):void 0,tokensPerSecond:O,notes:[F.join(", ")||"no protocols",`${j?"catalog":"registry"} #${x+1}`]}})}function Mx(n){const l=n.filter(i=>Number.isFinite(i));if(l.length!==0)return Math.min(...l)}function Cx(n){return Array.from(new Set(n.filter(l=>l.trim().length>0)))}function JN(n){if(n)return n.plan??{routes:n.routes,mode:n.mode,scorer:n.scorer,reason:n.reason}}function Tx(n,l){return l.length===0?n.coverageModelIds.length:l.filter(i=>n.coverageModelIds.includes(i)).length}function Ll(n,l){return n.localeCompare(l,void 0,{sensitivity:"base",numeric:!0})}function ff(n,l){const i=Number.isFinite(n),s=Number.isFinite(l);return i&&s?n-l:i?-1:s?1:0}function IN(n,l){return ff(l,n)}function qo(n,l,i){const s=Number.isFinite(n),u=Number.isFinite(l);return!s&&!u?0:s?u?i==="asc"?n-l:l-n:-1:1}function WN(n){return Object.entries(n??{}).sort(([l],[i])=>l.localeCompare(i)).map(([l,i])=>`${l}:${i}`).join(",")}function ew(n,l){return Yr(l)-Yr(n)}function Yr(n){const l=new Date(n).getTime();return Number.isNaN(l)?0:l}function tw(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function aw(n,l,i){const s=l.length===0?n:n.filter(u=>l.some(f=>u.coverageModelIds.includes(f)));return Hf(s,l,i)}function nw(n){var h;const l=new Map(n.map(v=>[Za(v.method),v])),s=Array.from(new Set([...CN,...n.map(v=>Za(v.method)).filter(v=>v&&v!=="mock")])).map(v=>{const p=l.get(v),x=!!p&&((p==null?void 0:p.enabled)===!0||lg(p==null?void 0:p.config,"walletConfigPresent"));return{method:v,label:lw(v),configured:x,selected:x&&(p==null?void 0:p.isDefault)===!0}}),u=s.filter(v=>v.configured),f=s.find(v=>v.selected)??u[0];return f&&!f.selected&&(f.selected=!0),u.length===0?{active:!1,count:0,label:"No payment",options:s}:{active:!0,count:u.length,label:u.length===1?((h=u[0])==null?void 0:h.label)??"Payment ready":`${u.length} payments`,options:s,activeMethod:f==null?void 0:f.method}}function lw(n){const l=Za(n);return l==="clawtip"?"ClawTip":l==="alipay-agent"?"Alipay":l==="wechat-pay"?"WeChat":l==="coinbase-smart-wallet"?"Coinbase":n.split(/[-_\s]+/).filter(Boolean).map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" ")}function Za(n){return n.trim().toLowerCase()}function lg(n,l){const i=n==null?void 0:n[l];return i===!0||i==="true"||i===1||i==="1"}function $f({value:n,onChange:l,placeholder:i}){return o.jsxs("label",{className:"flex items-center gap-2 rounded-[12px] border border-[var(--color-line-2)] bg-white px-3 py-2 text-[0.84rem] text-[var(--color-muted)]",children:[o.jsx(ys,{size:15}),o.jsx("input",{name:"routing-search",value:n,onChange:s=>l(s.target.value),placeholder:i,className:"min-w-0 flex-1 bg-transparent font-mono text-[0.84rem] text-[var(--color-ink)] outline-none placeholder:text-[var(--color-faint)]"})]})}function rg(n,l){const i=n.trim().toLowerCase();return i?l.some(s=>s.toLowerCase().includes(i)):!0}function Wo(n){return n!==void 0}function rw(n,l){const i=sg(l),s=ig(n,i);if(i<=7)return Array.from({length:i},(h,v)=>v+1);const u=[],f=h=>{u[u.length-1]!==h&&u.push(h)};f(1),s>4&&f("…");for(let h=Math.max(2,s-1);h<=Math.min(i-1,s+1);h++)f(h);return s<i-3&&f("…"),f(i),u}function ig(n,l){return Number.isFinite(n)?Math.max(1,Math.min(sg(l),Math.floor(n))):1}function iw(n,l){return Number.isFinite(n)&&n>0?Math.floor(n):Math.max(1,l[0]??25)}function sg(n){return!Number.isFinite(n)||n<1?1:Math.floor(n)}function og({totalItems:n,pageSize:l,page:i,onPageChange:s,onPageSizeChange:u,pageSizeOptions:f=[25,50,100]}){const h=iw(l,f),v=Math.max(1,Math.ceil(n/h)),p=ig(i,v),x=S.useMemo(()=>rw(p,v),[p,v]),[y,g]=S.useState(String(p));if(S.useEffect(()=>{g(String(p))},[p]),S.useEffect(()=>{i!==p&&s(p)},[p,s,i]),n===0)return null;const j=(p-1)*h+1,N=Math.min(p*h,n);return o.jsxs("div",{className:"flex flex-col gap-3 border-t border-[var(--color-line-2)] bg-[var(--color-page)]/60 px-4 py-3 text-[0.85rem] lg:flex-row lg:items-center lg:justify-between",children:[o.jsxs("div",{className:"text-[var(--color-muted)]",children:["Showing ",o.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:j}),"-",o.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:N})," of"," ",o.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:n})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("label",{className:"text-[0.78rem] text-[var(--color-muted)]",children:"Rows"}),o.jsx("select",{className:"bg-[var(--color-card)] border border-[var(--color-line-2)] rounded px-1.5 py-0.5 text-[0.85rem] text-[var(--color-ink)] focus:outline-none focus:border-[var(--color-purple)]",value:h,onChange:T=>{const E=Math.max(1,Number(T.target.value)||25);u==null||u(E),s(1)},children:f.map(T=>o.jsx("option",{value:T,children:T},T))}),o.jsxs("div",{className:"ml-2 flex items-center gap-1",children:[o.jsx("button",{type:"button",disabled:p<=1,onClick:()=>s(1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"First page","aria-label":"First page",children:"«"}),o.jsx("button",{type:"button",disabled:p<=1,onClick:()=>s(p-1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Previous page","aria-label":"Previous page",children:"‹"}),x.map((T,E)=>T==="…"?o.jsx("span",{className:"px-1.5 text-[var(--color-muted)]",children:"…"},`gap-${E}`):o.jsx("button",{type:"button",onClick:()=>s(T),"aria-label":`Page ${T}`,"aria-current":T===p?"page":void 0,className:T===p?"tb-button tb-button-sm tb-button-primary min-w-8 px-2.5":"tb-button tb-button-sm tb-button-secondary min-w-8 px-2.5",children:T},T)),o.jsx("button",{type:"button",disabled:p>=v,onClick:()=>s(p+1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Next page","aria-label":"Next page",children:"›"}),o.jsx("button",{type:"button",disabled:p>=v,onClick:()=>s(v),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Last page","aria-label":"Last page",children:"»"}),o.jsx("span",{className:"ml-2 text-[0.78rem] text-[var(--color-muted)]",children:"Go to"}),o.jsx("input",{type:"number",min:1,max:v,value:y,"aria-label":"Go to page",onChange:T=>g(T.target.value),onKeyDown:T=>{if(T.key==="Enter"){const E=Math.max(1,Math.min(v,Number(T.target.value)||1));g(String(E)),s(E)}},className:"w-14 bg-[var(--color-card)] border border-[var(--color-line-2)] rounded px-1.5 py-0.5 text-[0.85rem] text-[var(--color-ink)] text-center focus:outline-none focus:border-[var(--color-purple)]"}),o.jsx("span",{className:"text-[0.78rem] text-[var(--color-muted)]",children:"page"})]})]})]})}function sw(n,l,i=new Date){const s=ow(i);return{inferenceTokens:s.map(u=>({key:u.key,label:u.label,inputTokens:Ax(n,u,"promptTokens"),outputTokens:Ax(n,u,"completionTokens")})),purchaseSpend:s.map(u=>({key:u.key,label:u.label,paymentTotals:cw(l,u),purchaseCount:uw(l,u)}))}}function ow(n){const l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(l);i.setDate(l.getDate()-(l.getDay()+6)%7);const s=new Date(n.getFullYear(),n.getMonth(),1);return[{key:"today",label:"Today",start:l},{key:"week",label:"This week",start:i},{key:"month",label:"This month",start:s},{key:"total",label:"Total"}]}function Ax(n,l,i){return n.reduce((s,u)=>Qf(u.createdAt,l)?s+(u[i]??0):s,0)}function cw(n,l){const i=n.reduce((s,u)=>{if(!Qf(u.completedAt??u.createdAt,l)||!u.paymentCurrency||!Number.isFinite(u.paymentAmountMinor))return s;const f=u.paymentCurrency.trim().toUpperCase();return f&&s.set(f,(s.get(f)??0)+Math.round(u.paymentAmountMinor)),s},new Map);return Array.from(i.entries()).map(([s,u])=>({paymentCurrency:s,paymentAmountMinor:u})).sort((s,u)=>s.paymentCurrency.localeCompare(u.paymentCurrency))}function uw(n,l){return n.reduce((i,s)=>Qf(s.completedAt??s.createdAt,l)?i+1:i,0)}function Qf(n,l){if(!l.start)return!0;if(!n)return!1;const i=new Date(n);return Number.isNaN(i.getTime())?!1:i>=l.start}function dw(){var $,ue;const{language:n}=Wl(),l=ee=>Fj(ee,n),i=lc(),s=mj(),[u,f]=S.useState("inferences"),[h,v]=S.useState(""),[p,x]=S.useState("all"),[y,g]=S.useState(1),[j,N]=S.useState(1),[T,E]=S.useState(25),L=i.isLoading||s.isLoading,z=(($=i.data)==null?void 0:$.inferences)??[],Q=((ue=s.data)==null?void 0:ue.purchases)??[],q=h.trim().toLowerCase(),O=S.useMemo(()=>sw(z,Q),[z,Q]),K=S.useMemo(()=>vw(z),[z]),J=S.useMemo(()=>z.filter(ee=>p!=="all"&&ee.modelId!==p?!1:bw(ee,q)).sort((ee,xe)=>xe.createdAt.localeCompare(ee.createdAt)),[z,p,q]),H=S.useMemo(()=>Q.filter(ee=>gw(ee,q)).sort((ee,xe)=>xe.createdAt.localeCompare(ee.createdAt)),[Q,q]),F=S.useMemo(()=>kx(J,y,T),[J,y,T]),Z=S.useMemo(()=>kx(H,j,T),[H,j,T]),le=i.isError||s.isError;return S.useEffect(()=>{const ee=Math.max(1,Math.ceil(J.length/T));y>ee&&g(ee)},[J.length,y,T]),S.useEffect(()=>{const ee=Math.max(1,Math.ceil(H.length/T));j>ee&&N(ee)},[H.length,T,j]),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("section",{className:"grid gap-3 xl:grid-cols-2",children:[o.jsx(dx,{icon:o.jsx(us,{className:"size-5"}),label:"Inference tokens",tone:"tokens",rows:O.inferenceTokens.map(ee=>({key:ee.key,label:l(ee.label),value:Yo(ee.inputTokens+ee.outputTokens),detail:l(`In ${qe(ee.inputTokens)} / Out ${qe(ee.outputTokens)}`)}))}),o.jsx(dx,{icon:o.jsx(rs,{className:"size-5"}),label:"Token purchase spend",tone:"spend",rows:O.purchaseSpend.map(ee=>({key:ee.key,label:l(ee.label),value:Sw(ee.paymentTotals),detail:l(`${qe(ee.purchaseCount)} purchases`)}))})]}),o.jsxs(At,{className:"overflow-hidden p-0",children:[o.jsxs("div",{className:"border-b border-[var(--color-line-2)] bg-white px-4 py-3",children:[o.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[o.jsx("div",{children:o.jsx("h1",{className:"text-[1.05rem] font-semibold text-[var(--color-ink)]",children:l("Usage details")})}),o.jsxs("div",{className:"grid grid-cols-2 overflow-hidden rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-1",children:[o.jsx(Ex,{label:l("Inferences"),active:u==="inferences",count:J.length,onClick:()=>f("inferences"),children:l("Inferences")}),o.jsx(Ex,{label:l("Purchases"),active:u==="purchases",count:H.length,onClick:()=>f("purchases"),children:l("Purchases")})]})]}),o.jsxs("div",{className:["mt-3 grid gap-2",u==="inferences"?"lg:grid-cols-[minmax(220px,1fr)_200px]":"lg:grid-cols-1"].join(" "),children:[o.jsxs("label",{className:"relative block",children:[o.jsx(ys,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--color-muted)]"}),o.jsx("input",{className:"h-9 w-full rounded-[8px] border border-[var(--color-line-2)] bg-white pl-9 pr-3 text-[0.86rem] text-[var(--color-ink)] outline-none transition placeholder:text-[var(--color-muted)] focus:border-[var(--color-purple)]",value:h,placeholder:l(u==="inferences"?"Search model, seller...":"Search seller..."),onChange:ee=>{v(ee.target.value),g(1),N(1)}})]}),u==="inferences"?o.jsx(fw,{label:l("Model"),allLabel:l("All model"),value:p,options:K.models,translateOption:l,onChange:ee=>{x(ee),g(1)}}):null]})]}),le?o.jsx("div",{className:"border-b border-rose-100 bg-rose-50 px-4 py-3 text-[0.86rem] text-rose-700",children:"Ledger data could not be loaded. The local daemon may be offline or missing ledger endpoints."}):null,L?o.jsx(pw,{}):u==="inferences"?o.jsx(mw,{entries:F,total:J.length,page:y,pageSize:T,onPageChange:g,onPageSizeChange:ee=>{E(ee),g(1),N(1)}}):o.jsx(hw,{entries:Z,total:H.length,page:j,pageSize:T,onPageChange:N,onPageSizeChange:ee=>{E(ee),g(1),N(1)}})]})]})}function Ex({label:n,active:l,count:i,onClick:s,children:u}){return o.jsxs("button",{type:"button",onClick:s,"aria-label":`${n} ledger records, ${qe(i)} records`,className:["tb-button tb-button-sm gap-2",l?"tb-button-primary":"tb-button-secondary"].join(" "),children:[o.jsx("span",{children:u}),o.jsx("span",{className:"font-mono text-[0.76rem]",children:qe(i)})]})}function fw({label:n,allLabel:l,value:i,options:s,translateOption:u,onChange:f}){return o.jsxs("label",{className:"grid gap-1",children:[o.jsx("span",{className:"sr-only",children:n}),o.jsxs("select",{"aria-label":n,className:"h-9 rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.86rem] text-[var(--color-ink)] outline-none transition focus:border-[var(--color-purple)]",value:i,onChange:h=>f(h.target.value),children:[o.jsx("option",{value:"all",children:l}),s.map(h=>o.jsx("option",{value:h,children:u(h)},h))]})]})}function mw({entries:n,total:l,page:i,pageSize:s,onPageChange:u,onPageSizeChange:f}){return l===0?o.jsx(cg,{label:"inference records"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[980px] text-[0.86rem]",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"bg-[var(--color-page)]/70 text-left text-[0.7rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[o.jsx("th",{className:"px-4 py-2.5",children:"TIME"}),o.jsx("th",{className:"px-4 py-2.5",children:"MODEL"}),o.jsx("th",{className:"px-4 py-2.5",children:"SELLER"}),o.jsx("th",{className:"px-4 py-2.5 text-right",children:"TOKENS"}),o.jsx("th",{className:"px-4 py-2.5 text-right",children:"COST"}),o.jsx("th",{className:"px-4 py-2.5 text-right",children:"SPEED"})]})}),n.map(h=>o.jsx("tbody",{children:o.jsxs("tr",{className:"border-t border-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]/25",children:[o.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[0.76rem] text-[var(--color-muted)]",children:oc(h.createdAt)}),o.jsx("td",{className:"max-w-[190px] truncate px-4 py-3 text-[var(--color-ink)]",children:h.modelId}),o.jsx("td",{className:"px-4 py-3 font-mono text-[0.78rem] text-[var(--color-text)]",children:h.sellerKey}),o.jsx("td",{className:"px-4 py-3 text-right",children:o.jsx($j,{inputTokens:h.promptTokens,outputTokens:h.completionTokens,cacheReadTokens:h.cacheReadTokens})}),o.jsx("td",{className:"px-4 py-3 text-right",children:o.jsx(Kj,{billedMicros:h.billedMicros,settledUsdMicros:h.settledUsdMicros,inputPriceMicrosPer1m:h.inputPriceMicrosPer1m,outputPriceMicrosPer1m:h.outputPriceMicrosPer1m,cacheReadPriceMicrosPer1m:h.cacheReadPriceMicrosPer1m,inputCostMicros:h.inputCostMicros,outputCostMicros:h.outputCostMicros,cacheReadCostMicros:h.cacheReadCostMicros,originalUsdMicros:h.originalUsdMicros,billingMultiplier:h.billingMultiplier,serviceTier:h.serviceTier})}),o.jsx("td",{className:"px-4 py-3 text-right text-[0.78rem] text-[var(--color-ink)]",children:o.jsx(Pb,{ttftMs:h.ttftMs,tokensPerSecond:yw(h)})})]})},h.requestId))]})}),o.jsx(og,{totalItems:l,pageSize:s,page:i,onPageChange:u,onPageSizeChange:f})]})}function hw({entries:n,total:l,page:i,pageSize:s,onPageChange:u,onPageSizeChange:f}){return l===0?o.jsx(cg,{label:"purchase records"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[700px] text-[0.86rem]",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"bg-[var(--color-page)]/70 text-left text-[0.7rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[o.jsx("th",{className:"px-4 py-2.5",children:"When"}),o.jsx("th",{className:"px-4 py-2.5",children:"Seller"}),o.jsx("th",{className:"px-4 py-2.5 text-right",children:"Spent"}),o.jsx("th",{className:"px-4 py-2.5 text-right",children:"Credit"})]})}),n.map(h=>o.jsx("tbody",{children:o.jsxs("tr",{className:"border-t border-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]/25",children:[o.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[0.76rem] text-[var(--color-muted)]",children:oc(h.createdAt)}),o.jsx("td",{className:"px-4 py-3 font-mono text-[0.78rem] text-[var(--color-text)]",children:h.sellerKey}),o.jsx("td",{className:"px-4 py-3 text-right font-mono text-[0.82rem] font-semibold text-[var(--color-ink)]",children:Ej(h)}),o.jsx("td",{className:"px-4 py-3 text-right font-mono text-[0.82rem] font-semibold text-emerald-700",children:Ja(h.creditMicros,{signed:!0})})]})},h.purchaseId))]})}),o.jsx(og,{totalItems:l,pageSize:s,page:i,onPageChange:u,onPageSizeChange:f})]})}function pw(){return o.jsx("div",{className:"space-y-2 px-4 py-4",children:Array.from({length:7},(n,l)=>o.jsx("div",{className:"h-12 rounded-lg bg-[var(--color-lavender)]/35"},l))})}function cg({label:n}){return o.jsxs("div",{className:"flex min-h-[220px] flex-col items-center justify-center px-6 py-10 text-center",children:[o.jsx("div",{className:"grid size-12 place-items-center rounded-xl border border-[var(--color-line-2)] bg-[var(--color-page)] text-[var(--color-purple)]",children:o.jsx(ys,{className:"size-5"})}),o.jsxs("div",{className:"mt-4 font-semibold text-[var(--color-ink)]",children:["No matching ",n]}),o.jsx("div",{className:"mt-1 max-w-[360px] text-[0.86rem] text-[var(--color-muted)]",children:"Adjust the query or filters to inspect another slice of the local ledger."})]})}function vw(n){return{models:xw(n.map(l=>l.modelId))}}function xw(n){return Array.from(new Set(n.filter(Boolean))).sort((l,i)=>l.localeCompare(i))}function bw(n,l){return l?[n.sellerKey,n.modelId,oc(n.createdAt)].some(i=>i==null?void 0:i.toLowerCase().includes(l)):!0}function gw(n,l){return l?[n.sellerKey,oc(n.createdAt)].some(i=>i==null?void 0:i.toLowerCase().includes(l)):!0}function kx(n,l,i){const s=(l-1)*i;return n.slice(s,s+i)}function yw(n){if(!Number.isFinite(n.completionTokens))return;if(n.completionTokens<=0)return 0;if(!Number.isFinite(n.durationMs))return;const l=n.durationMs/1e3;if(!(l<=0))return n.completionTokens/l}function Sw(n){return n.length===0?"-":n.map(l=>kj(l.paymentAmountMinor,l.paymentCurrency)).join(" / ")}function jw(){return $t({queryKey:["init","state"],queryFn:()=>Qt("/init/state"),refetchInterval:1e4})}async function Nw(n){return xt("POST","/init/complete",void 0)}function ww(){return zt({mutationFn:()=>xt("POST","/init/doctor/run")})}function ug(){return $t({queryKey:["providers","status"],queryFn:()=>Qt("/providers/status"),refetchInterval:1e4})}function Mw(){return zt({mutationFn:n=>xt("POST","/providers/install/preview",n)})}function dg(){const n=Wt();return zt({mutationFn:l=>xt("POST","/providers/install/apply",l),onSuccess:()=>{n.invalidateQueries({queryKey:["providers","status"]}),n.invalidateQueries({queryKey:["init","state"]})}})}function Cw(){const n=Wt();return zt({mutationFn:l=>xt("POST","/providers/install/rollback",l),onSuccess:()=>{n.invalidateQueries({queryKey:["providers","status"]}),n.invalidateQueries({queryKey:["init","state"]})}})}const Tw=[{value:"fullAuto",title:"全自动",body:"自动选择可用供应商。"},{value:"fixedSet",title:"固定供应商组",body:"在指定供应商组内切换。"},{value:"fixed",title:"固定供应商",body:"始终使用指定供应商。"}],Aw=[{value:"balanced",title:"平衡模式",body:"综合速度、价格、健康度、余额。"},{value:"speed",title:"速度优先",body:"优先选择更快、吞吐量更高供应商。"},{value:"discount",title:"成本优先",body:"优先选择更低成本供应商。"}],Rx=[{index:1,label:"选择模型",value:"默认模型"},{index:2,label:"绑定钱包",value:"支付方式"},{index:3,label:"配置策略",value:"路由规则"},{index:4,label:"配置工具",value:"终端接入"}],Ew=[{method:"wechat-pay",name:"WeChat Pay",detail:"微信支付入口预留"},{method:"alipay-agent",name:"Alipay Agent Payment",detail:"代理支付入口预留"},{method:"coinbase-smart-wallet",name:"Coinbase Smart Wallet",detail:"USDC 钱包入口预留"}],kw=["GPT","Claude","Gemini","DeepSeek","Kimi","Qwen","MiniMax","GLM","Doubao","Grok"];function Rw(n){const l=new URLSearchParams(n);return l.has("verifyPaymentMethods")?2:(l.has("verifyPickerDom")||l.has("verifyNoIntro")||l.has("verifyCompact"),1)}function zw(){var er,tr,La,Ba,qa,Ha,aa,$a,Ea,bl,Ln,ln;const[n,l]=S.useState(()=>Rw(typeof window>"u"?"":window.location.search)),[i,s]=S.useState([]),[u,f]=S.useState(!1),[h,v]=S.useState(),[p,x]=S.useState(!1),[y,g]=S.useState(!1),[j,N]=S.useState("fullAuto"),[T,E]=S.useState("balanced"),[L,z]=S.useState(""),[Q,q]=S.useState([]),[O,K]=S.useState(),[J,H]=S.useState(""),[F,Z]=S.useState([]),[le,$]=S.useState({}),[ue,ee]=S.useState(),[xe,de]=S.useState(),[R,X]=S.useState(!1),[ie,ne]=S.useState(null),[pe,C]=S.useState(!1),[P,I]=S.useState(),te=jw(),fe=Uf(),be=pj(),ge=_f(),_e=ug(),Ee=Of(),_t=Df(),bt=Mw(),Ot=dg(),rt=ww(),Ie=rc(),ma=lc(),Kt=S.useMemo(()=>{var oe;return Uw(((oe=Ie.data)==null?void 0:oe.data)??[])},[(er=Ie.data)==null?void 0:er.data]),zn=S.useMemo(()=>{var oe,$e,Et;return Iw(((oe=Ie.data)==null?void 0:oe.sellers)??[],(($e=Ie.data)==null?void 0:$e.data)??[],((Et=ma.data)==null?void 0:Et.inferences)??[])},[(tr=ma.data)==null?void 0:tr.inferences,(La=Ie.data)==null?void 0:La.data,(Ba=Ie.data)==null?void 0:Ba.sellers]),ea=S.useMemo(()=>{var oe;return Lw(Kt,i,((oe=te.data)==null?void 0:oe.recommendedModels)??[])},[(qa=te.data)==null?void 0:qa.recommendedModels,Kt,i]),Dt=S.useMemo(()=>i.length>0?i:ea.map(oe=>oe.id),[ea,i]),Ta=`http://127.0.0.1:${((Ha=fe.data)==null?void 0:Ha.proxyPort)??((aa=te.data)==null?void 0:aa.runtime.proxyPort)??17821}`,Ut=S.useMemo(()=>{var oe;return(((oe=_e.data)==null?void 0:oe.clients)??[]).filter($e=>$e.id!=="custom"&&$e.detected)},[($a=_e.data)==null?void 0:$a.clients]),ta=((Ea=ge.data)==null?void 0:Ea.payments.filter(oe=>oe.enabled&&uc(oe.method)!=="mock"))??[],tn=S.useMemo(()=>aM(j,T,L,Q),[L,Q,j,T]),ct=nM({serviceReady:((bl=fe.data)==null?void 0:bl.status)==="running",modelCount:Kt.length,routingMode:j,paymentReady:ta.length>0,configuredTools:((Ln=_e.data)==null?void 0:Ln.summary.configuredCount)??0}),_n=((ln=rt.data)==null?void 0:ln.checks.map(lM))??ct;S.useEffect(()=>{p||!te.data||(s(te.data.focusSet),x(!0))},[te.data,p]),S.useEffect(()=>{J||i.length===0||H(i[0])},[J,i]),S.useEffect(()=>{y||Ut.length===0||g(!0)},[y,Ut]),S.useEffect(()=>{n!==5||rt.data||rt.error||rt.isPending||rt.mutate()},[n,rt]),S.useEffect(()=>{var Et;const oe=W=>{W.preventDefault(),ne(W),I("浏览器已经允许直接安装 TokenBuddy。")},$e=()=>{C(!0),ne(null),I("TokenBuddy 桌面应用已安装。")};return window.addEventListener("beforeinstallprompt",oe),window.addEventListener("appinstalled",$e),(Et=window.matchMedia)!=null&&Et.call(window,"(display-mode: standalone)").matches&&C(!0),()=>{window.removeEventListener("beforeinstallprompt",oe),window.removeEventListener("appinstalled",$e)}},[]);const an=oe=>{v(void 0),s($e=>$e.includes(oe)?$e.filter(Et=>Et!==oe):[...$e,oe])},Ua=async()=>{f(!0),v(void 0);try{await of(i),v("关注模型已保存。后续工具配置会优先参考这些模型。")}catch(oe){v(`保存失败:${oe instanceof Error?oe.message:String(oe)}`)}finally{f(!1)}},Aa=async()=>{if(K(void 0),!tn){K(j==="fixed"?"请选择一个固定供应商。":"请至少选择一个供应商。");return}try{await be.mutateAsync(tn),K("供应商路由策略已保存。"),l(4)}catch(oe){K(`保存失败:${oe instanceof Error?oe.message:String(oe)}`)}},On=async()=>{try{await Ee.mutateAsync()}catch{}},nn=async()=>{try{await _t.mutateAsync()}catch{}},Dn=async()=>{ee(void 0);const oe=J||Dt[0];if(!oe){ee("请先选择一个默认模型。");return}if(F.length===0){ee("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{await bt.mutateAsync({providers:F,proxyUrl:Ta,model:oe,providerSelections:Lx(F,le,Dt,oe)}),ee("已生成写入预览。确认无误后可以写入配置。")}catch($e){ee(`预览失败:${$e instanceof Error?$e.message:String($e)}`)}},Un=async()=>{ee(void 0);const oe=J||Dt[0];if(!oe){ee("请先选择一个默认模型。");return}if(F.length===0){ee("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{const $e=await Ot.mutateAsync({providers:F,proxyUrl:Ta,model:oe,providerSelections:Lx(F,le,Dt,oe)});ee(`已写入 ${$e.applied.length} 个配置文件。`),l(5)}catch($e){ee(`写入失败:${$e instanceof Error?$e.message:String($e)}`)}},He=()=>{fe.refetch(),te.refetch(),ge.refetch(),_e.refetch(),Ie.refetch(),rt.mutate()},We=async()=>{de(void 0),X(!0);try{await Nw(),de("初始化已标记完成。你可以把 TokenBuddy 安装成桌面应用,之后从系统应用入口打开。"),te.refetch()}catch(oe){de(`完成失败:${oe instanceof Error?oe.message:String(oe)}`)}finally{X(!1)}},ha=async()=>{if(!ie){I("请在浏览器地址栏右侧或菜单里选择“安装应用”。");return}try{I(void 0),await ie.prompt();const oe=await ie.userChoice;if(ne(null),oe.outcome==="accepted"){C(!0),I("TokenBuddy 桌面应用已安装。");return}I("你可以稍后继续使用浏览器安装入口。")}catch(oe){I(`安装未完成:${oe instanceof Error?oe.message:String(oe)}`)}},jt=(()=>{var oe,$e,Et,W,re,we,tt,Qa,ar;return n<=1?o.jsx(Ow,{commonModels:ea,allModels:Kt,loading:Ie.isLoading,error:Ie.error,selectedModels:i,saving:u,saveMessage:h,onToggleModel:an,onSave:Ua,onContinue:()=>l(2)}):n===2?o.jsx(Gw,{payments:((oe=ge.data)==null?void 0:oe.payments)??[],enabledPaymentCount:ta.length,loading:ge.isLoading,qrUrl:($e=Ee.data)==null?void 0:$e.qrImageUrl,rechargeQrUrl:(Et=_t.data)==null?void 0:Et.qrImageUrl,walletConfigPresent:(W=Ee.data)==null?void 0:W.walletConfigPresent,error:Ee.error,rechargeError:_t.error,binding:Ee.isPending,rechargeLoading:_t.isPending,onBind:On,onLoadRecharge:nn,onRefreshPayments:()=>{ge.refetch()},onBack:()=>l(1),onContinue:()=>l(3)}):n===3?o.jsx(Yw,{mode:j,scorer:T,sellers:zn,fixedSellerId:L,fixedSetSellerIds:Q,saving:be.isPending,message:O,onModeChange:N,onScorerChange:E,onFixedSellerChange:z,onToggleFixedSetSeller:it=>{q(ke=>ke.includes(it)?ke.filter(ut=>ut!==it):[...ke,it])},onSave:Aa,onBack:()=>l(2)}):n===4?o.jsx(Vw,{clients:((re=_e.data)==null?void 0:re.clients)??[],candidates:Ut,loading:_e.isLoading,selectedProviders:F,selectedModel:J||Dt[0]||"",modelOptions:Dt,providerSelections:le,proxyUrl:Ta,previewChanges:(we=bt.data)==null?void 0:we.changes,applying:Ot.isPending,previewing:bt.isPending,message:ue,onToggleProvider:it=>{Z(ke=>ke.includes(it)?ke.filter(ut=>ut!==it):[...ke,it])},onModelChange:H,onProviderSelectionChange:(it,ke)=>{$(ut=>({...ut,[it]:ke}))},onPreview:Dn,onInstall:Un,onBack:()=>l(3)}):n===5?o.jsx(Zw,{items:_n,status:(tt=rt.data)==null?void 0:tt.status,generatedAt:(Qa=rt.data)==null?void 0:Qa.generatedAt,running:rt.isPending,error:rt.error,onRefresh:He,onBack:()=>l(4),onContinue:()=>l(6)}):o.jsx(Jw,{complete:((ar=te.data)==null?void 0:ar.setup.status)==="completed",message:xe,installMessage:P,canInstall:!!ie,installed:pe,saving:R,onBack:()=>l(5),onComplete:We,onInstall:ha})})();return o.jsxs("div",{className:"min-w-0 space-y-3",children:[o.jsx(_w,{activeStep:n,onSelect:l}),o.jsx("div",{className:"min-w-0",children:jt})]})}function _w({activeStep:n,onSelect:l}){return o.jsx("nav",{"aria-label":"初始化步骤",className:"rounded-[12px] border border-[var(--color-line-2)] bg-white p-2.5 shadow-[0_8px_22px_rgba(60,41,112,0.045)]",children:o.jsx("div",{className:"flex items-stretch gap-2 overflow-x-auto",children:Rx.map(i=>{const s=n===i.index,u=n>i.index;return o.jsxs(S.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>l(i.index),"aria-current":s?"step":void 0,className:["relative flex min-w-[190px] flex-1 items-center gap-2 rounded-[8px] px-3 py-2 text-left transition",s?"bg-[var(--color-lavender)] ring-1 ring-[var(--color-lavender-2)]":"hover:bg-[var(--color-page)]"].join(" "),children:[o.jsx("span",{className:["grid size-6 shrink-0 place-items-center rounded-full border bg-white",s?"border-[var(--color-purple)] text-[var(--color-purple)] shadow-[0_0_0_3px_rgba(124,61,240,0.1)]":"",u?"border-emerald-200 bg-emerald-50 text-emerald-700":"",!s&&!u?"border-[var(--color-line-2)] text-[var(--color-muted)]":""].join(" "),children:u?o.jsx(Ht,{className:"size-3.5"}):o.jsx("span",{className:"size-1.5 rounded-full bg-current"})}),o.jsxs("span",{className:"min-w-0",children:[o.jsxs("span",{className:["block font-mono text-[0.62rem] font-black uppercase tracking-[0.08em]",s?"text-[var(--color-purple)]":"text-[var(--color-muted)]"].join(" "),children:["STEP ",i.index,":"]}),o.jsx("span",{className:["mt-0.5 block text-[0.82rem] font-semibold",s?"text-[var(--color-purple)]":"text-[var(--color-ink)]"].join(" "),children:i.label}),o.jsx("span",{className:"block truncate text-[0.7rem] text-[var(--color-muted)]",children:i.value})]})]}),i.index<Rx.length?o.jsx("div",{className:"hidden min-w-8 items-center justify-center text-[var(--color-purple)]/70 sm:flex",children:o.jsx(nc,{className:"size-5",strokeWidth:2.6})}):null]},i.index)})})})}function si({index:n,title:l,detail:i,meta:s,action:u}){return o.jsxs("div",{className:"flex flex-col gap-2.5 border-b border-[var(--color-line-2)] pb-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("div",{className:"min-w-0",children:o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"rounded-[7px] bg-[var(--color-lavender)] px-2 py-0.5 font-mono text-[0.68rem] font-semibold text-[var(--color-purple)]",children:String(n).padStart(2,"0")}),o.jsx("div",{className:"text-[0.92rem] font-semibold text-[var(--color-ink)]",children:l}),i?o.jsx("span",{className:"text-[0.74rem] text-[var(--color-muted)]",children:i}):null,s?o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:s}):null]})}),u?o.jsx("div",{className:"shrink-0",children:u}):null]})}function Ow({commonModels:n,allModels:l,loading:i,error:s,selectedModels:u,saving:f,saveMessage:h,onToggleModel:v,onSave:p,onContinue:x}){const[y,g]=S.useState(!1),j=u.map(N=>l.find(T=>T.id===N)??{id:N,sellerCount:0,protocols:[],paymentMethods:[]});return o.jsxs("div",{className:"space-y-3",children:[o.jsxs(At,{className:"p-3",children:[o.jsx(si,{index:1,title:"模型访问",detail:"默认和高频模型",meta:`${u.length} selected`,action:o.jsxs("button",{type:"button",disabled:i||!!s,onClick:()=>g(!0),className:"inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-purple)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple-2)] disabled:cursor-not-allowed disabled:opacity-45",children:[o.jsx(ds,{className:"size-3.5"}),"添加模型"]})}),s?o.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.84rem] leading-6 text-rose-700",children:["模型目录加载失败:",s instanceof Error?s.message:String(s)]}):null,j.length===0?o.jsxs("button",{type:"button",disabled:i||!!s,onClick:()=>g(!0),className:"mt-3 flex min-h-[72px] w-full items-center gap-3 rounded-[10px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-3 text-left transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[o.jsx("span",{className:"grid size-8 shrink-0 place-items-center rounded-[8px] bg-white text-[var(--color-purple)]",children:o.jsx(ds,{className:"size-4"})}),o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block text-[0.86rem] font-semibold text-[var(--color-ink)]",children:"添加可能使用到的模型"}),o.jsx("span",{className:"mt-0.5 block text-[0.76rem] text-[var(--color-muted)]",children:"至少选择一个模型后才能保存并继续。"})]})]}):o.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:j.map(N=>o.jsxs("div",{className:"inline-flex min-h-9 max-w-full items-center gap-2 rounded-[9px] border border-[var(--color-lavender-2)] bg-[var(--color-lavender)] px-3 py-1.5",children:[o.jsx("span",{className:"truncate font-mono text-[0.82rem] font-semibold text-[var(--color-purple)]",children:N.id}),o.jsx("span",{className:"rounded-full bg-white/70 px-2 py-0.5 text-[0.68rem] font-semibold text-emerald-700",children:"可用"}),o.jsx("button",{type:"button",onClick:()=>v(N.id),className:"inline-flex size-5 items-center justify-center rounded-[6px] text-[var(--color-purple)]/70 hover:bg-white hover:text-[var(--color-purple)]","aria-label":`Remove ${N.id}`,children:o.jsx(Zl,{className:"size-3"})})]},N.id))}),o.jsxs("div",{className:"mt-3 flex flex-col gap-2.5 border-t border-[var(--color-line-2)] pt-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"min-h-5 text-[0.8rem] leading-5 text-[var(--color-muted)]",children:[i?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(Tt,{className:"size-3.5 animate-spin text-[var(--color-purple)]"})," loading catalog"]}):null,!i&&!s&&u.length===0?o.jsx("span",{children:"请选择至少一个可能使用的模型。"}):null,h?o.jsx("div",{className:"mt-1 font-medium text-[var(--color-ink)]",children:h}):null]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs("button",{type:"button",disabled:f||u.length===0,onClick:p,className:"inline-flex h-9 shrink-0 items-center justify-center gap-2 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[f?o.jsx(Tt,{className:"size-3.5 animate-spin"}):null,"保存"]}),o.jsxs("button",{type:"button",disabled:u.length===0,onClick:x,className:"inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:["下一步",o.jsx(nc,{className:"size-3.5"})]})]})]})]}),y?o.jsx(Dw,{models:n,allModels:l,selectedModelIds:u,onToggle:v,onClose:()=>g(!1)}):null]})}function Dw({models:n,allModels:l,selectedModelIds:i,onToggle:s,onClose:u}){const[f,h]=S.useState("common"),[v,p]=S.useState(""),x=v.trim(),y=f==="common"?n:x?Hw(l,x):[],g=f==="common"?"没有可用的推荐模型。":"输入关键词搜索全部可用模型。",j=[{id:"common",label:"推荐模型",hint:"直接勾选"},{id:"all",label:"搜索添加",hint:"全部模型"}];return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[rgba(32,26,56,0.22)] px-3 py-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex max-h-full w-full max-w-[720px] flex-col overflow-hidden rounded-[14px] border border-[var(--color-line-2)] bg-white shadow-[0_24px_80px_rgba(32,26,56,0.22)]",children:[o.jsxs("div",{className:"flex items-start gap-3 border-b border-[var(--color-line-2)] px-4 py-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Select models"}),o.jsx("h2",{className:"mt-0.5 text-[1rem] font-semibold text-[var(--color-ink)]",children:"选择可能使用到的模型"}),o.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"推荐模型直接勾选;搜索添加用于查找平台全部模型。"})]}),o.jsxs("div",{className:"mt-0.5 rounded-full bg-[var(--color-lavender)] px-2.5 py-1 font-mono text-[0.72rem] font-semibold text-[var(--color-purple)]",children:[i.length," selected"]}),o.jsx("button",{type:"button",onClick:u,className:"inline-flex size-8 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] text-[var(--color-muted)] hover:text-[var(--color-ink)]","aria-label":"Close model picker",children:o.jsx(Zl,{className:"size-4"})})]}),o.jsxs("div",{className:"border-b border-[var(--color-line-2)] px-4 py-2.5",children:[o.jsx("div",{className:"mb-2 text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"已选模型"}),i.length===0?o.jsx("div",{className:"rounded-[9px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.78rem] text-[var(--color-muted)]",children:"还没有选择模型。"}):o.jsx("div",{className:"flex max-h-[92px] flex-wrap gap-1.5 overflow-y-auto pr-1",children:i.map(N=>o.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-[8px] border border-[var(--color-lavender-2)] bg-[var(--color-lavender)] px-2 py-1",children:[o.jsx("span",{className:"max-w-[220px] truncate font-mono text-[0.72rem] font-semibold text-[var(--color-purple)]",children:N}),o.jsx("button",{type:"button",onClick:()=>s(N),className:"inline-flex size-4 items-center justify-center rounded-[5px] text-[var(--color-purple)]/70 hover:bg-white hover:text-[var(--color-purple)]","aria-label":`Remove ${N}`,children:o.jsx(Zl,{className:"size-3"})})]},N))})]}),o.jsxs("div",{className:"border-b border-[var(--color-line-2)] p-3",children:[o.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:j.map(N=>{const T=f===N.id;return o.jsxs("button",{type:"button",onClick:()=>h(N.id),className:["rounded-[9px] border px-3 py-2 text-left transition",T?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[o.jsx("span",{className:["block text-[0.84rem] font-semibold",T?"text-[var(--color-purple)]":"text-[var(--color-ink)]"].join(" "),children:N.label}),o.jsx("span",{className:"mt-0.5 block text-[0.72rem] text-[var(--color-muted)]",children:N.hint})]},N.id)})}),f==="all"?o.jsxs("label",{className:"relative mt-3 block",children:[o.jsx(ys,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--color-muted)]"}),o.jsx("input",{value:v,onChange:N=>p(N.target.value),placeholder:"搜索平台全部模型...",className:"h-10 w-full rounded-[9px] border border-[var(--color-line-2)] bg-white pl-9 pr-3 text-[0.88rem] text-[var(--color-ink)] outline-none transition placeholder:text-[var(--color-muted)] focus:border-[var(--color-purple)]"})]}):null]}),o.jsx("div",{className:"min-h-0 max-h-[320px] overflow-y-auto p-3",children:y.length===0?o.jsx("div",{className:"rounded-[12px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-4 py-8 text-center text-[0.86rem] text-[var(--color-muted)]",children:g}):o.jsx("div",{className:"grid gap-2",children:y.map(N=>{const T=i.includes(N.id);return o.jsxs("button",{type:"button",onClick:()=>s(N.id),"aria-pressed":T,className:["flex items-center gap-3 rounded-[10px] border px-3 py-2 text-left transition",T?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[o.jsx("span",{className:["grid size-6 shrink-0 place-items-center rounded-[7px] border",T?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] bg-white text-transparent"].join(" "),children:o.jsx(Ht,{className:"size-3.5"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:N.id}),o.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[0.72rem] text-[var(--color-muted)]",children:[o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:Kf(N.id)}),o.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 font-semibold text-emerald-700",children:"可用"}),mf(N.paymentMethods)?o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:mf(N.paymentMethods)}):null]})]}),o.jsx("span",{className:["rounded-[7px] px-2 py-1 text-[0.72rem] font-semibold",T?"bg-[var(--color-purple)] text-white":"bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:T?"已选择":"选择"})]},N.id)})})}),o.jsxs("div",{className:"flex flex-col gap-2 border-t border-[var(--color-line-2)] bg-white px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"text-[0.8rem] leading-5 text-[var(--color-muted)]",children:["已选择 ",o.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:i.length})," 个模型"]}),o.jsxs("button",{type:"button",onClick:u,"aria-label":"Done",title:"Done selecting models",className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)]",children:["完成选择",o.jsx(Ht,{className:"size-3.5"})]})]})]})})}function Uw(n){const l=new Map;for(const i of n){const s=l.get(i.id)??{sellers:new Set,protocols:new Set,paymentMethods:new Set};s.sellers.add(i.sellerId);for(const u of i.supportedProtocols)s.protocols.add(u);for(const u of i.paymentMethods)s.paymentMethods.add(u);l.set(i.id,s)}return Array.from(l.entries()).map(([i,s])=>({id:i,sellerCount:s.sellers.size,protocols:Array.from(s.protocols).sort(),paymentMethods:Array.from(s.paymentMethods).sort()})).sort((i,s)=>s.sellerCount!==i.sellerCount?s.sellerCount-i.sellerCount:i.id.localeCompare(s.id))}function Lw(n,l,i){const s=Bw(n,i);if(s.length>0)return s.slice(0,14);const u=new Set(l),f=new Map;for(const p of l){const x=n.find(y=>y.id===p);x&&f.set(x.id,x)}const h=n.map(p=>({model:p,rank:$w(p.id)})).filter(p=>p.rank<100).sort((p,x)=>p.rank!==x.rank?p.rank-x.rank:x.model.sellerCount!==p.model.sellerCount?x.model.sellerCount-p.model.sellerCount:p.model.id.localeCompare(x.model.id)),v=new Map;for(const p of h){const x=Kf(p.model.id),y=v.get(x)??[];y.push(p),v.set(x,y)}for(const p of kw){const x=p==="GPT"?3:p==="Claude"||p==="Gemini"?2:1;for(const y of(v.get(p)??[]).slice(0,x))f.set(y.model.id,y.model)}for(const p of h){if(f.size>=14)break;u.has(p.model.id)||f.set(p.model.id,p.model)}return Array.from(f.values()).slice(0,14)}function Bw(n,l){const i=new Map;for(const s of l){const u=qw(n,s,i);u&&i.set(u.id,u)}return Array.from(i.values())}function qw(n,l,i){const s=Hd(l);if(!s)return;const u=n.find(f=>Hd(f.id)===s&&!i.has(f.id));return u||n.find(f=>{if(i.has(f.id))return!1;const h=Hd(f.id);return h.includes(s)||s.includes(h)})}function Hd(n){return n.trim().toLowerCase().replace(/_/g,"-")}function Hw(n,l){const i=l.trim().toLowerCase();return i?n.filter(s=>[s.id,Kf(s.id),...s.paymentMethods].some(u=>u.toLowerCase().includes(i))):n}function $w(n){const l=n.toLowerCase();return l.includes("gpt-5.5")||l.includes("gpt-5-5")||l.includes("gpt-5_5")?0:l.includes("gpt-5.4")||l.includes("gpt-5-4")||l.includes("gpt-5_4")?1:l.includes("gpt-5")||l.includes("gpt-latest")||l.includes("openai/gpt")?2:l.includes("claude")&&(l.includes("4.8")||l.includes("4-8"))?3:l.includes("claude")&&l.includes("opus")?4:l.includes("claude")&&l.includes("sonnet")?5:l.includes("claude")?6:l.includes("gemini")&&(l.includes("3.1")||l.includes("3-1"))?7:l.includes("gemini")&&l.includes("pro")?8:l.includes("gemini")?9:l.includes("deepseek")?10:l.includes("kimi")||l.includes("moonshot")?11:l.includes("qwen")||l.includes("tongyi")?12:l.includes("minimax")?13:l.includes("glm")||l.includes("zhipu")?14:l.includes("doubao")||l.includes("bytedance")?15:l.includes("grok")?16:100}function Kf(n){const l=n.toLowerCase();return l.includes("gpt")||l.includes("openai")?"GPT":l.includes("claude")||l.includes("anthropic")?"Claude":l.includes("gemini")||l.includes("google")?"Gemini":l.includes("deepseek")?"DeepSeek":l.includes("kimi")||l.includes("moonshot")?"Kimi":l.includes("qwen")||l.includes("tongyi")?"Qwen":l.includes("minimax")?"MiniMax":l.includes("glm")||l.includes("zhipu")?"GLM":l.includes("doubao")||l.includes("bytedance")?"Doubao":l.includes("grok")?"Grok":"Common"}function mf(n){return n.length===0?"":`${Qw(n.map(Kw)).join("、")}`}function Qw(n){return Array.from(new Set(n))}function Kw(n){const l=uc(n);return l.includes("x402")?"X402":l.includes("clawtip")?"ClawTip":l.includes("wallet")?"钱包":l.includes("mock")||l.includes("test")?"测试":"其它"}function uc(n){return n.trim().toLowerCase()}function Yw({mode:n,scorer:l,sellers:i,fixedSellerId:s,fixedSetSellerIds:u,saving:f,message:h,onModeChange:v,onScorerChange:p,onFixedSellerChange:x,onToggleFixedSetSeller:y,onSave:g,onBack:j}){const N=n!=="fullAuto";return o.jsxs("div",{className:"space-y-3",children:[o.jsxs(At,{className:"p-3",children:[o.jsx(si,{index:3,title:"配置策略",detail:"路由规则",meta:`${bg(n)} / ${cM(l)}`}),o.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-2",children:[o.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[o.jsx("div",{className:"mb-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:"路由模式"}),o.jsx("div",{className:"grid gap-2",children:Tw.map(T=>o.jsxs("button",{type:"button",onClick:()=>v(T.value),className:["rounded-[9px] border bg-white p-2.5 text-left transition",n===T.value?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:["grid size-5 place-items-center rounded-full border",n===T.value?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] text-transparent"].join(" "),children:o.jsx(Ht,{className:"size-3"})}),o.jsx("span",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:T.title})]}),o.jsx("p",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:T.body})]},T.value))})]}),o.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[o.jsx("div",{className:"mb-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:"优化目标"}),o.jsx("div",{className:"grid gap-2",children:Aw.map(T=>o.jsxs("button",{type:"button",onClick:()=>p(T.value),className:["rounded-[9px] border bg-white p-2.5 text-left transition",l===T.value?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:["grid size-5 place-items-center rounded-full border",l===T.value?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] text-transparent"].join(" "),children:o.jsx(Ht,{className:"size-3"})}),o.jsx("span",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:T.title})]}),o.jsx("p",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:T.body})]},T.value))})]})]}),N?o.jsxs("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:[o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"选择供应商"}),o.jsx("div",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5 text-[0.72rem] text-[var(--color-muted)]",children:n==="fixed"?s?"已选择 1 个":"尚未选择":`已选择 ${u.length} 个`})]}),i.length===0?o.jsx("div",{className:"mt-2 rounded-[9px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-3 text-[0.8rem] leading-5 text-[var(--color-muted)]",children:"正在等待供应商目录。你也可以先返回上一步确认模型目录是否已经加载完成。"}):o.jsx(Pw,{mode:n,sellers:i,fixedSellerId:s,fixedSetSellerIds:u,onFixedSellerChange:x,onToggleFixedSetSeller:y})]}):o.jsx("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.8rem] leading-5 text-[var(--color-muted)]",children:"当前是全自动模式,TokenBuddy 会根据模型、供应商健康度、速度、价格和余额状态自动规划调用路径。"})]}),o.jsx(fg,{backLabel:"上一步:绑定钱包",nextLabel:"下一步:配置工具",saving:f,message:h,onBack:j,onNext:g})]})}function Pw({mode:n,sellers:l,fixedSellerId:i,fixedSetSellerIds:s,onFixedSellerChange:u,onToggleFixedSetSeller:f}){const[h,v]=S.useState({key:"status",direction:"asc"}),p=S.useMemo(()=>mg(l,h),[l,h]),x=g=>{v(j=>({key:g,direction:j.key===g&&j.direction==="asc"?"desc":"asc"}))},y=g=>{if(n==="fixed"){u(g);return}f(g)};return o.jsx("div",{className:"mt-2 overflow-hidden rounded-[9px] border border-[var(--color-line-2)]",children:o.jsx("div",{className:"max-h-[300px] overflow-auto",children:o.jsxs("table",{className:"min-w-[760px] w-full border-collapse text-left text-[0.78rem]",children:[o.jsx("thead",{className:"sticky top-0 z-10 border-b border-[var(--color-line-2)] bg-[var(--color-page)] text-[0.68rem] uppercase tracking-wider text-[var(--color-muted)]",children:o.jsxs("tr",{children:[o.jsx("th",{className:"w-12 px-2 py-2 font-semibold",children:"选"}),o.jsx(Qr,{label:"供应商",sortKey:"name",sort:h,onSort:x}),o.jsx(Qr,{label:"状态",sortKey:"status",sort:h,onSort:x}),o.jsx(Qr,{label:"模型",sortKey:"models",sort:h,onSort:x,align:"right"}),o.jsx(Qr,{label:"价格",sortKey:"price",sort:h,onSort:x}),o.jsx(Qr,{label:"折扣",sortKey:"discount",sort:h,onSort:x,align:"right"}),o.jsx(Qr,{label:"响应",sortKey:"speed",sort:h,onSort:x,align:"right"}),o.jsx("th",{className:"px-3 py-2 font-semibold",children:"支付"})]})}),o.jsx("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:p.map(g=>{const j=n==="fixed"?i===g.id:s.includes(g.id);return o.jsxs("tr",{onClick:()=>y(g.id),className:["cursor-pointer transition hover:bg-[var(--color-lavender)]/45",j?"bg-[var(--color-lavender)]/70":"bg-white"].join(" "),children:[o.jsx("td",{className:"px-2 py-2.5",children:o.jsx("span",{className:["grid size-5 place-items-center rounded-full border",j?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] text-transparent"].join(" "),children:o.jsx(Ht,{className:"size-3"})})}),o.jsxs("td",{className:"max-w-[210px] px-3 py-2.5",children:[o.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:g.name}),o.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.68rem] text-[var(--color-muted)]",children:g.id})]}),o.jsx("td",{className:"px-3 py-2.5",children:o.jsx("span",{className:["inline-flex whitespace-nowrap rounded-full px-2 py-0.5 text-[0.7rem] font-semibold",dM(g.status)].join(" "),children:uM(g.status)})}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-ink)]",children:g.modelCount}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-ink)]",children:o.jsx(Yb,{inputPriceMicrosPer1m:g.minInputPriceMicrosPer1m,outputPriceMicrosPer1m:g.minOutputPriceMicrosPer1m})}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-purple)]",children:Lf(g.discountRatio)}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:o.jsx(Pb,{ttftMs:g.avgTtftMs,tokensPerSecond:g.avgTokensPerSecond,compact:!0})}),o.jsx("td",{className:"max-w-[150px] px-3 py-2.5",children:o.jsx("div",{className:"truncate text-[0.72rem] text-[var(--color-muted)]",children:mf(g.paymentMethods)||"—"})})]},g.id)})})]})})})}function Qr({label:n,sortKey:l,sort:i,align:s="left",onSort:u}){const f=i.key===l,h=f?i.direction==="asc"?"↑":"↓":"↕";return o.jsx("th",{className:["px-3 py-2 font-semibold",s==="right"?"text-right":"text-left"].join(" "),children:o.jsxs("button",{type:"button",onClick:()=>u(l),className:["inline-flex items-center gap-1 rounded-[6px] px-1.5 py-1 transition hover:bg-white",s==="right"?"justify-end":"justify-start",f?"text-[var(--color-purple)]":"text-[var(--color-muted)]"].join(" "),children:[o.jsx("span",{children:n}),o.jsx("span",{className:"font-mono text-[0.66rem]",children:h})]})})}function Gw({payments:n,enabledPaymentCount:l,loading:i,qrUrl:s,rechargeQrUrl:u,walletConfigPresent:f,error:h,rechargeError:v,binding:p,rechargeLoading:x,onBind:y,onLoadRecharge:g,onRefreshPayments:j,onBack:N,onContinue:T}){const[E,L]=S.useState("clawtip"),[z,Q]=S.useState(!1),[q,O]=S.useState(!1),K=n.find(R=>uc(R.method)==="clawtip"),J=!!(K!=null&&K.enabled||f||Xw(K==null?void 0:K.config,"walletConfigPresent")),H=z&&J,F=[{method:"clawtip",name:"ClawTip",detail:"JD App 扫码 / 微支付",status:J?"已绑定":"可绑定",available:!0},...Ew.map(R=>({...R,status:"Coming soon",available:!1}))],Z=F.find(R=>R.method===E)??F[0],le=Z.method==="clawtip",$=le&&J&&!H,ue=H||$||z,ee=le?ue:!0,xe=()=>{Q(!0),y()},de=()=>{O(!0),g()};return S.useEffect(()=>{if(!le||!z||J)return;const R=window.setInterval(j,1500);return()=>window.clearInterval(R)},[z,J,j,le]),S.useEffect(()=>{!$||u||x||q||(O(!0),g())},[g,x,u,q,$]),o.jsxs("div",{className:"space-y-3",children:[o.jsxs(At,{className:"p-3",children:[o.jsx(si,{index:2,title:"选择支付方式",detail:"钱包和充值通道",meta:i?"checking":`${l} active`,action:le&&$?o.jsxs("button",{type:"button",disabled:x,onClick:de,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[x?o.jsx(Tt,{className:"size-3.5 animate-spin"}):o.jsx(us,{className:"size-3.5"}),"刷新充值码"]}):le&&z&&!J?o.jsxs("button",{type:"button",disabled:p,onClick:xe,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[p?o.jsx(Tt,{className:"size-3.5 animate-spin"}):o.jsx(rs,{className:"size-3.5"}),"重新生成"]}):le&&!z&&!J?o.jsxs("button",{type:"button",disabled:p,onClick:xe,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[p?o.jsx(Tt,{className:"size-3.5 animate-spin"}):o.jsx(rs,{className:"size-3.5"}),"开始绑定"]}):le?null:o.jsx("span",{className:"inline-flex h-8 items-center rounded-[8px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-2.5 font-mono text-[0.72rem] font-semibold text-[var(--color-muted)]",children:"Coming soon"})}),o.jsxs("div",{className:["mt-3 grid gap-3",ee?"lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]":"lg:max-w-[360px]"].join(" "),children:[o.jsx("div",{className:"grid content-start gap-2",children:F.map(R=>{const X=R.method===Z.method;return o.jsxs("button",{type:"button",onClick:()=>L(R.method),"aria-pressed":X,className:["grid min-h-[64px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-[10px] border px-3 py-2 text-left transition",X?"border-[var(--color-purple)] bg-[var(--color-lavender)] shadow-[0_8px_22px_rgba(124,61,240,0.08)]":"border-[var(--color-line-2)] bg-white hover:bg-[var(--color-page)]"].join(" "),children:[o.jsx("span",{className:["grid size-9 shrink-0 place-items-center rounded-[9px] border",X?"border-[var(--color-lavender-2)] bg-white text-[var(--color-purple)]":"border-[var(--color-line-2)] bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:zx(R.method)}),o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block truncate text-[0.86rem] font-semibold text-[var(--color-ink)]",children:R.name}),o.jsx("span",{className:"mt-0.5 block truncate text-[0.73rem] text-[var(--color-muted)]",children:R.detail})]}),o.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.68rem] font-semibold",R.available?"bg-emerald-50 text-emerald-700":"bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:R.status})]},R.method)})}),le?ue?o.jsx("div",{className:"flex min-h-[360px] items-center justify-center rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-4",children:H?o.jsx("div",{className:"grid size-full min-h-[320px] place-items-center rounded-[10px] border border-emerald-100 bg-emerald-50 px-4 py-5 text-center",children:o.jsxs("div",{children:[o.jsx(Ht,{className:"mx-auto size-8 text-emerald-700"}),o.jsx("div",{className:"mt-3 text-[0.92rem] font-semibold text-emerald-900",children:"绑定成功"}),o.jsx("div",{className:"mt-1 text-[0.78rem] leading-5 text-emerald-800",children:"ClawTip 钱包已经写入本机配置,可以继续配置路由策略。"})]})}):$?u?o.jsx("img",{src:u,alt:"ClawTip 充值二维码",className:"max-h-[340px] w-full max-w-[340px] rounded-[10px] border border-[var(--color-line-2)] bg-white p-3 object-contain shadow-[0_12px_28px_rgba(15,23,42,0.1)]"}):o.jsx("div",{className:"grid size-full min-h-[320px] place-items-center rounded-[10px] border border-dashed border-[var(--color-line-2)] bg-white px-3 py-4 text-center",children:o.jsxs("div",{children:[x?o.jsx(Tt,{className:"mx-auto size-6 animate-spin text-[var(--color-purple)]"}):o.jsx(us,{className:"mx-auto size-6 text-[var(--color-purple)]"}),o.jsx("div",{className:"mt-2 text-[0.84rem] font-semibold text-[var(--color-ink)]",children:x?"正在加载充值码":"充值码未加载"}),o.jsx("button",{type:"button",disabled:x,onClick:de,className:"mt-3 inline-flex h-8 items-center justify-center rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:"重新加载"})]})}):z&&s?o.jsx("img",{src:s,alt:"ClawTip 钱包绑定二维码",className:"max-h-[340px] w-full max-w-[340px] rounded-[10px] border border-[var(--color-line-2)] bg-white p-3 object-contain shadow-[0_12px_28px_rgba(15,23,42,0.1)]"}):z?o.jsx("div",{className:"grid size-full min-h-[320px] place-items-center rounded-[10px] border border-dashed border-[var(--color-line-2)] bg-white px-3 py-4 text-center",children:o.jsxs("div",{children:[p?o.jsx(Tt,{className:"mx-auto size-6 animate-spin text-[var(--color-purple)]"}):o.jsx(rs,{className:"mx-auto size-6 text-[var(--color-purple)]"}),o.jsx("div",{className:"mt-2 text-[0.84rem] font-semibold text-[var(--color-ink)]",children:p?"正在生成二维码":"等待二维码"}),o.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"生成后使用京东 App 扫码绑定。"})]})}):null}):null:o.jsx("div",{className:"grid min-h-[220px] place-items-center rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-4 text-center",children:o.jsxs("div",{className:"max-w-[360px]",children:[o.jsx("span",{className:"mx-auto grid size-11 place-items-center rounded-[12px] border border-[var(--color-line-2)] bg-white text-[var(--color-purple)]",children:zx(Z.method)}),o.jsx("div",{className:"mt-3 text-[0.92rem] font-semibold text-[var(--color-ink)]",children:Z.name}),o.jsxs("div",{className:"mt-1 text-[0.78rem] leading-5 text-[var(--color-muted)]",children:[Z.detail,"。当前版本先通过 ClawTip 完成钱包绑定,后续会在这里接入更多支付流程。"]}),o.jsx("div",{className:"mt-3 inline-flex rounded-full bg-white px-3 py-1 font-mono text-[0.7rem] font-semibold text-[var(--color-muted)]",children:"Coming soon"})]})})]}),le&&!J&&z&&h?o.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.84rem] leading-6 text-rose-700",children:["生成二维码失败:",h instanceof Error?h.message:String(h)]}):null,le&&$&&v?o.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.84rem] leading-6 text-rose-700",children:["加载充值二维码失败:",v instanceof Error?v.message:String(v)]}):null]}),o.jsx(fg,{backLabel:"上一步:模型访问",nextLabel:"下一步:配置策略",message:l>0?"支付方式已可用,可以继续配置路由策略。":"如果你暂时跳过绑定,后续首次购买模型额度时仍需要完成支付配置。",onBack:N,onNext:T})]})}function zx(n){const l=uc(n);return l==="wechat-pay"?o.jsx(rj,{className:"size-4"}):l==="alipay-agent"?o.jsx($S,{className:"size-4"}):l==="coinbase-smart-wallet"?o.jsx(us,{className:"size-4"}):o.jsx(rs,{className:"size-4"})}function Xw(n,l){const i=n==null?void 0:n[l];return i===!0||i==="true"||i===1||i==="1"}function Vw({clients:n,candidates:l,loading:i,selectedProviders:s,selectedModel:u,modelOptions:f,providerSelections:h,proxyUrl:v,previewChanges:p,applying:x,previewing:y,message:g,onToggleProvider:j,onModelChange:N,onProviderSelectionChange:T,onPreview:E,onInstall:L,onBack:z}){var le;const Q=new Set(l.map($=>$.id)),q=l.length,O=n.find($=>$.id==="custom")??vg(v),K=[...n.filter($=>$.id!=="custom"),{...O,name:"其他工具"}],J=((le=K[0])==null?void 0:le.id)??"custom",[H,F]=S.useState(J),Z=K.find($=>$.id===H)??K[0]??O;return S.useEffect(()=>{var $;K.some(ue=>ue.id===H)||F((($=K[0])==null?void 0:$.id)??"custom")},[H,K]),o.jsxs("div",{className:"space-y-3",children:[o.jsxs(At,{className:"p-3",children:[o.jsx(si,{index:4,title:"配置工具",detail:"终端接入",meta:`${s.length} 本次写入 / ${q} 已安装`,action:i?o.jsx(Tt,{className:"size-4 animate-spin text-[var(--color-purple)]"}):null}),o.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,320px)_minmax(0,1fr)]",children:[o.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"工具"}),o.jsxs("div",{className:"rounded-full bg-white px-2 py-0.5 text-[0.72rem] text-[var(--color-muted)]",children:[n.length," tools"]})]}),o.jsx("div",{className:"mt-2 grid max-h-[380px] gap-2 overflow-y-auto pr-1",children:K.map($=>{const ue=$.id!=="custom"&&Q.has($.id),ee=s.includes($.id),xe=Z.id===$.id;return o.jsxs("div",{className:["rounded-[10px] border p-2.5 text-left transition",xe?"border-[var(--color-purple)] bg-white shadow-[0_10px_24px_rgba(60,41,112,0.08)]":"border-[var(--color-line-2)] bg-white/70 hover:border-[var(--color-lavender-2)]"].join(" "),children:[o.jsxs("div",{className:"flex items-start gap-2.5",children:[o.jsx("span",{className:["mt-0.5 grid size-6 shrink-0 place-items-center rounded-[8px] border text-[0.72rem] font-semibold",xe?"border-[var(--color-purple)] bg-[var(--color-lavender)] text-[var(--color-purple)]":"border-[var(--color-line-2)] bg-white text-[var(--color-muted)]"].join(" "),children:tM($.name)}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("div",{className:"truncate text-[0.84rem] font-semibold text-[var(--color-ink)]",children:$.name}),ee?o.jsx("span",{className:"rounded-full bg-[var(--color-lavender)] px-1.5 py-0.5 text-[0.66rem] font-semibold text-[var(--color-purple)]",children:"本次写入"}):null]}),o.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[0.68rem] text-[var(--color-muted)]",children:[o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:gg($)}),$.commandName?o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:$.commandName}):null,$.id==="custom"?o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:"复制配置"}):null]})]}),$.id!=="custom"?o.jsx("button",{type:"button",disabled:!ue,className:["mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border",ee?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] bg-white text-transparent",ue?"":"opacity-45"].join(" "),"aria-label":ee?`移出 ${$.name} 本次写入`:`写入 ${$.name} 的 TokenBuddy 配置`,"aria-pressed":ee,title:ee?"移出本次写入":"加入本次写入",onClick:()=>j($.id),children:o.jsx(Ht,{className:"size-3"})}):null]}),o.jsx("button",{type:"button",onClick:()=>F($.id),className:["mt-2 inline-flex h-7 items-center justify-center rounded-[7px] px-2 text-[0.72rem] font-semibold transition",xe?"bg-[var(--color-lavender)] text-[var(--color-purple)]":"border border-[var(--color-line-2)] bg-white text-[var(--color-muted)] hover:border-[var(--color-purple)] hover:text-[var(--color-ink)]"].join(" "),children:"查看配置"})]},$.id)})})]}),o.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:o.jsx(Fw,{client:Z,selected:s.includes(Z.id),installable:Z.id!=="custom"&&Q.has(Z.id),selectedModel:u,modelOptions:f,providerSelections:h,proxyUrl:v,onToggleInstall:()=>j(Z.id),onModelChange:N,onProviderSelectionChange:T})})]}),p?o.jsxs("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:[o.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"配置文件变更"}),p.length===0?o.jsx("div",{className:"mt-2 rounded-[9px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-3 text-[0.8rem] text-[var(--color-muted)]",children:"没有需要写入的配置变更。"}):o.jsx("div",{className:"mt-2 grid max-h-[180px] gap-2 overflow-y-auto pr-1",children:p.map($=>o.jsxs("div",{className:"rounded-[9px] border border-[var(--color-line-2)] bg-white p-2.5",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:[o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:fM($.action)}),o.jsx("span",{children:$.providerId})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:$.path}),o.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:$.summary})]},`${$.providerId}:${$.path}:${$.summary}`))})]}):null]}),o.jsxs(At,{className:"flex flex-col gap-3 p-3 lg:flex-row lg:items-center lg:justify-between",children:[o.jsx("div",{className:"text-[0.84rem] leading-6 text-[var(--color-muted)]",children:g?o.jsx("div",{className:"mt-1 font-medium text-[var(--color-ink)]",children:g}):null}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("button",{type:"button",onClick:z,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:"上一步:配置策略"}),o.jsxs("button",{type:"button",disabled:y||s.length===0,onClick:E,className:"inline-flex h-9 items-center justify-center gap-2 rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[y?o.jsx(Tt,{className:"size-4 animate-spin"}):null,"预览写入"]}),o.jsxs("button",{type:"button",disabled:x||s.length===0,onClick:L,className:"inline-flex h-9 items-center justify-center gap-2 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[x?o.jsx(Tt,{className:"size-4 animate-spin"}):null,"写入 TokenBuddy 配置"]})]})]})]})}function Fw({client:n,selected:l,installable:i,selectedModel:s,modelOptions:u,providerSelections:f,proxyUrl:h,onToggleInstall:v,onModelChange:p,onProviderSelectionChange:x}){var j,N,T;if(n.id==="custom"){const E=n.manualConfig??vg(h).manualConfig;return o.jsxs("div",{className:"space-y-3",children:[o.jsx($d,{client:n,selected:!1,installable:!1}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(as,{label:"OpenAI base URL",value:(E==null?void 0:E.openaiBaseUrl)??xg(h)}),o.jsx(as,{label:"Anthropic base URL",value:(E==null?void 0:E.anthropicBaseUrl)??h}),o.jsx(as,{label:"API key",value:(E==null?void 0:E.apiKey)??"TOKENBUDDY_PROXY"})]}),o.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"其他工具只需要填入本地推理服务接口和 key,不会写入本机配置文件。"})]})}if(n.id==="claude-code"){const E=pg(f[n.id],u,s),L=(Q,q)=>{x(n.id,{...E,fallbackModel:E.fallbackModel||q||s,roles:{...E.roles,[Q]:q?{upstreamModel:q,displayName:q}:void 0}})},z=Q=>{x(n.id,{...E,fallbackModel:Q}),p(Q)};return o.jsxs("div",{className:"space-y-3",children:[o.jsx($d,{client:n,selected:l,installable:i,onToggleInstall:v}),o.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[o.jsx(ts,{label:"Fallback",value:E.fallbackModel??s,modelOptions:u,onChange:z}),o.jsx(ts,{label:"Haiku",value:((j=E.roles.haiku)==null?void 0:j.upstreamModel)??"",modelOptions:u,onChange:Q=>L("haiku",Q)}),o.jsx(ts,{label:"Sonnet",value:((N=E.roles.sonnet)==null?void 0:N.upstreamModel)??"",modelOptions:u,onChange:Q=>L("sonnet",Q)}),o.jsx(ts,{label:"Opus",value:((T=E.roles.opus)==null?void 0:T.upstreamModel)??"",modelOptions:u,onChange:Q=>L("opus",Q)})]}),o.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"Claude Code 会把 Haiku、Sonnet、Opus 三种客户端模型映射到你选择的上游模型。"})]})}const y=hg(n.id,f[n.id],s),g=E=>{p(E),x(n.id,{selectionKind:"single-model",protocolPreference:hf(n.id),defaultModel:E})};return o.jsxs("div",{className:"space-y-3",children:[o.jsx($d,{client:n,selected:l,installable:i,onToggleInstall:v}),o.jsx(ts,{label:"模型",value:y.defaultModel,modelOptions:u,onChange:g}),o.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[o.jsx(as,{label:"Proxy URL",value:h,compact:!0}),o.jsx(as,{label:"API key",value:"TOKENBUDDY_PROXY",compact:!0})]}),n.configPath?o.jsx("div",{className:"truncate rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 font-mono text-[0.72rem] text-[var(--color-muted)]",children:n.configPath}):null]})}function $d({client:n,selected:l,installable:i,onToggleInstall:s}){return o.jsxs("div",{className:"flex flex-col gap-2 border-b border-[var(--color-line-2)] pb-3 sm:flex-row sm:items-start sm:justify-between",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"text-[0.9rem] font-semibold text-[var(--color-ink)]",children:n.name}),o.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.7rem] font-semibold",n.configured?"bg-emerald-50 text-emerald-700":n.status==="installed"?"bg-[var(--color-lavender)] text-[var(--color-purple)]":"bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:gg(n)})]}),o.jsx("div",{className:"mt-1 text-[0.74rem] leading-5 text-[var(--color-muted)]",children:n.reason})]}),n.id!=="custom"?o.jsxs("button",{type:"button",disabled:!i,onClick:s,className:["inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] px-2.5 text-[0.78rem] font-semibold transition disabled:cursor-not-allowed disabled:opacity-45",l?"border border-[var(--color-purple)] bg-white text-[var(--color-purple)] hover:bg-[var(--color-lavender)]":"bg-[var(--color-purple)] text-white hover:bg-[var(--color-purple-2)]"].join(" "),children:[l?o.jsx(Ht,{className:"size-3.5"}):o.jsx(ds,{className:"size-3.5"}),l?"已加入本次写入":"写入 TokenBuddy 配置"]}):null]})}function ts({label:n,value:l,modelOptions:i,onChange:s}){return o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-muted)]",children:n}),o.jsxs("select",{value:l,onChange:u=>s(u.target.value),className:"mt-1 h-9 w-full rounded-[8px] border border-[var(--color-line-2)] bg-white px-2.5 text-[0.82rem] text-[var(--color-ink)] outline-none focus:border-[var(--color-purple)]",children:[o.jsx("option",{value:"",children:"请选择模型"}),i.map(u=>o.jsx("option",{value:u,children:u},u))]})]})}function as({label:n,value:l,compact:i=!1}){const[s,u]=S.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(l),u(!0),window.setTimeout(()=>u(!1),1200)}catch{u(!1)}};return o.jsxs("div",{className:["rounded-[10px] border border-[var(--color-line-2)] bg-white px-3 py-2",i?"min-w-0":""].join(" "),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"text-[0.72rem] font-semibold text-[var(--color-muted)]",children:n}),o.jsxs("button",{type:"button",onClick:f,className:"inline-flex h-7 items-center justify-center gap-1 rounded-[7px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-2 text-[0.7rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)]",children:[o.jsx(RS,{className:"size-3"}),s?"已复制":"复制"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[0.76rem] text-[var(--color-ink)]",children:l})]})}function Zw({items:n,status:l,generatedAt:i,running:s,error:u,onRefresh:f,onBack:h,onContinue:v}){return o.jsx("div",{className:"space-y-3",children:o.jsxs(At,{className:"p-3",children:[o.jsx(si,{index:5,title:"验证网关",detail:"本机状态",meta:s?"checking":Bx(l),action:o.jsxs("button",{type:"button",disabled:s,onClick:f,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border border-[var(--color-line-2)] bg-white px-2.5 text-[0.78rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[s?o.jsx(Tt,{className:"size-3.5 animate-spin"}):o.jsx(sf,{className:"size-3.5"}),"刷新"]})}),o.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[0.76rem] text-[var(--color-muted)]",children:[o.jsx("span",{className:["rounded-full px-2 py-0.5 font-semibold",rM(l)].join(" "),children:s?"正在检查":Bx(l)}),i?o.jsxs("span",{children:["检查时间:",new Date(i).toLocaleString()]}):o.jsx("span",{children:"等待后端检查。"})]}),u?o.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.82rem] leading-6 text-rose-700",children:["检查失败:",u instanceof Error?u.message:String(u)]}):null,o.jsx("div",{className:"mt-3 grid gap-2 xl:grid-cols-2",children:n.map(p=>o.jsxs("div",{className:"flex gap-2.5 rounded-[10px] border border-[var(--color-line-2)] bg-white p-2.5",children:[o.jsx("span",{className:["mt-0.5 grid size-6 shrink-0 place-items-center rounded-full",sM(p.status)].join(" "),children:p.ok?o.jsx(Ht,{className:"size-3.5"}):o.jsx(sf,{className:"size-3.5"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[0.82rem] font-semibold text-[var(--color-ink)]",children:[p.title,o.jsx("span",{className:["rounded-full px-1.5 py-0.5 text-[0.68rem]",oM(p.status)].join(" "),children:iM(p.status)})]}),o.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:p.body})]})]},p.title))}),o.jsxs("div",{className:"mt-3 flex flex-col gap-2 border-t border-[var(--color-line-2)] pt-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:"发现异常时返回对应步骤补齐配置。"}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("button",{type:"button",onClick:h,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:"上一步"}),o.jsxs("button",{type:"button",onClick:v,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)]",children:["下一步",o.jsx(nc,{className:"size-3.5"})]})]})]})]})})}function Jw({complete:n,message:l,installMessage:i,canInstall:s,installed:u,saving:f,onBack:h,onComplete:v,onInstall:p}){return o.jsx("div",{className:"space-y-3",children:o.jsxs(At,{className:"p-3",children:[o.jsx(si,{index:6,title:n?"初始化完成":"桌面应用",detail:u?"已安装":"可选安装",meta:n?"complete":u?"installed":"optional",action:o.jsxs("button",{type:"button",disabled:u,onClick:p,className:"inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[o.jsx(Ht,{className:"size-3.5"}),u?"已安装":"安装应用"]})}),o.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,290px)_minmax(0,1fr)]",children:[o.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-3",children:[o.jsx("div",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:u?"TokenBuddy 桌面应用已安装":s?"浏览器支持直接安装":"可从浏览器菜单安装"}),o.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:u?"你可以从系统应用入口打开 TokenBuddy。":s?"点击右上角安装按钮并确认浏览器弹窗。":"在地址栏右侧或浏览器菜单中找到安装应用入口。"}),i?o.jsx("div",{className:"mt-2 text-[0.78rem] font-medium text-[var(--color-ink)]",children:i}):null]}),o.jsx("div",{className:"grid gap-2 lg:grid-cols-3",children:[{title:"安装入口",body:"地址栏或浏览器菜单。"},{title:"应用名称",body:"TokenBuddy。"},{title:"本地服务",body:"继续由 tb-proxyd 提供。"}].map((x,y)=>o.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-white p-2.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"grid size-5 place-items-center rounded-full bg-[var(--color-lavender)] font-mono text-[0.68rem] font-semibold text-[var(--color-purple)]",children:y+1}),o.jsx("span",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:x.title})]}),o.jsx("div",{className:"mt-1 text-[0.74rem] leading-5 text-[var(--color-muted)]",children:x.body})]},x.title))})]}),o.jsxs("div",{className:"mt-3 flex flex-col gap-2 border-t border-[var(--color-line-2)] pt-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:l?o.jsx("span",{className:"font-medium text-[var(--color-ink)]",children:l}):"完成后可以进入控制台。"}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("button",{type:"button",onClick:h,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:"上一步"}),o.jsxs("button",{type:"button",disabled:f||n,onClick:v,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[f?o.jsx(Tt,{className:"size-3.5 animate-spin"}):o.jsx(Ht,{className:"size-3.5"}),n?"已完成":"完成初始化"]}),o.jsx(Il,{to:"/overview",className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)]",children:"进入控制台"})]})]})]})})}function fg({backLabel:n,nextLabel:l,saving:i=!1,message:s,onBack:u,onNext:f}){return o.jsxs(At,{className:"flex flex-col gap-2.5 p-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:s??"配置完成后继续下一步。"}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("button",{type:"button",onClick:u,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:n}),o.jsxs("button",{type:"button",disabled:i,onClick:f,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[i?o.jsx(Tt,{className:"size-3.5 animate-spin"}):null,l,i?null:o.jsx(nc,{className:"size-3.5"})]})]})]})}function Iw(n,l,i){const s=new Map;for(const h of l){const v=s.get(h.sellerId)??{modelIds:new Set,protocols:new Set,paymentMethods:new Set,ttftMsSamples:[]};v.modelIds.add(h.id);for(const p of h.supportedProtocols)v.protocols.add(p);for(const p of h.paymentMethods)v.paymentMethods.add(p);v.minInputPriceMicrosPer1m=Ox(v.minInputPriceMicrosPer1m,h.inputPriceMicrosPer1m),v.minOutputPriceMicrosPer1m=Ox(v.minOutputPriceMicrosPer1m,h.outputPriceMicrosPer1m),s.set(h.sellerId,v)}for(const h of i){const v=h.sellerKey;if(!v)continue;const p=s.get(v)??{modelIds:new Set,protocols:new Set,paymentMethods:new Set,ttftMsSamples:[]};Number.isFinite(h.ttftMs)&&p.ttftMsSamples.push(h.ttftMs),s.set(v,p)}const u=n.map(h=>{const v=s.get(h.id);return{id:h.id,name:Ux(h.name??h.manifestSellerId??h.id),status:h.status,modelCount:h.modelCount??(v==null?void 0:v.modelIds.size)??0,protocols:h.supportedProtocols??Array.from((v==null?void 0:v.protocols)??[]),paymentMethods:h.paymentMethods??Array.from((v==null?void 0:v.paymentMethods)??[]),discountRatio:h.discountRatio,serviceFeeRatio:h.serviceFeeRatio,minInputPriceMicrosPer1m:v==null?void 0:v.minInputPriceMicrosPer1m,minOutputPriceMicrosPer1m:v==null?void 0:v.minOutputPriceMicrosPer1m,avgTtftMs:h.ttftMs??Dx((v==null?void 0:v.ttftMsSamples)??[]),avgTokensPerSecond:h.avgTokensPerSecond}}),f=new Set(u.map(h=>h.id));for(const[h,v]of s.entries()){if(f.has(h))continue;const p=l.find(x=>x.sellerId===h);u.push({id:h,name:Ux((p==null?void 0:p.sellerName)??h),status:"unknown",modelCount:v.modelIds.size,protocols:Array.from(v.protocols).sort(),paymentMethods:Array.from(v.paymentMethods).sort(),minInputPriceMicrosPer1m:v.minInputPriceMicrosPer1m,minOutputPriceMicrosPer1m:v.minOutputPriceMicrosPer1m,avgTtftMs:Dx(v.ttftMsSamples)})}return mg(u,{key:"status",direction:"asc"})}function mg(n,l){const i=l.direction==="asc"?1:-1;return[...n].sort((s,u)=>{const f=Ww(s,u,l.key);if(f!==0)return f*i;const h=ec(s.status)-ec(u.status);return h!==0?h:u.modelCount!==s.modelCount?u.modelCount-s.modelCount:s.name.localeCompare(u.name)})}function Ww(n,l,i){return i==="status"?ec(n.status)-ec(l.status):i==="name"?n.name.localeCompare(l.name):i==="models"?n.modelCount-l.modelCount:i==="price"?Po(_x(n),_x(l)):i==="discount"?Po(n.discountRatio,l.discountRatio):Po(n.avgTtftMs,l.avgTtftMs)||eM(n.avgTokensPerSecond,l.avgTokensPerSecond)}function _x(n){if(!(!Number.isFinite(n.minInputPriceMicrosPer1m)&&!Number.isFinite(n.minOutputPriceMicrosPer1m)))return(n.minInputPriceMicrosPer1m??0)+(n.minOutputPriceMicrosPer1m??0)}function Ox(n,l){const i=Number.isFinite(n),s=Number.isFinite(l);if(i&&s)return Math.min(n,l);if(i)return n;if(s)return l}function Dx(n){const l=n.filter(i=>Number.isFinite(i));if(l.length!==0)return l.reduce((i,s)=>i+s,0)/l.length}function Po(n,l){const i=Number.isFinite(n),s=Number.isFinite(l);return i&&s?n-l:i?-1:s?1:0}function eM(n,l){return Po(l,n)}function Ux(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function Lx(n,l,i,s){const u=s||i[0]||"",f={};for(const h of n)h!=="custom"&&(f[h]=h==="claude-code"?pg(l[h],i,u):hg(h,l[h],u));return f}function hg(n,l,i){return(l==null?void 0:l.selectionKind)==="single-model"?{...l,protocolPreference:l.protocolPreference??hf(n),defaultModel:l.defaultModel||i}:{selectionKind:"single-model",protocolPreference:hf(n),defaultModel:i}}function pg(n,l,i){var f;const s=(n==null?void 0:n.selectionKind)==="claude-role-mapping"?(f=n.roles.sonnet)==null?void 0:f.upstreamModel:void 0,u=i||s||l[0]||"";return(n==null?void 0:n.selectionKind)==="claude-role-mapping"?{...n,protocolPreference:"messages",fallbackModel:n.fallbackModel||u,roles:{...n.roles,sonnet:n.roles.sonnet??(u?{upstreamModel:u,displayName:u}:void 0)}}:{selectionKind:"claude-role-mapping",protocolPreference:"messages",fallbackModel:u,roles:{sonnet:u?{upstreamModel:u,displayName:u}:void 0}}}function hf(n){if(n==="codex")return"responses";if(n==="claude-code"||n==="claude-desktop")return"messages";if(["openclaw","opencode","hermes"].includes(n))return"chat_completions"}function vg(n){return{id:"custom",name:"其他工具",status:"manual",detected:!0,configured:!1,reason:"复制本地推理服务接口到任意 OpenAI 或 Anthropic 兼容客户端。",manualConfig:{openaiBaseUrl:xg(n),anthropicBaseUrl:n,apiKey:"TOKENBUDDY_PROXY"}}}function xg(n){const l=n.replace(/\/+$/,"");return l.endsWith("/v1")?l:`${l}/v1`}function tM(n){const l=n.trim();return l?l.slice(0,1).toUpperCase():"?"}function aM(n,l,i,s){if(n==="fixed"){const u=i.trim();return u?{mode:n,scorer:l,sellerId:u}:void 0}if(n==="fixedSet"){const u=Array.from(new Set(s.map(f=>f.trim()).filter(Boolean)));return u.length===0?void 0:{mode:n,scorer:l,sellerIds:u}}return{mode:n,scorer:l}}function nM({serviceReady:n,modelCount:l,routingMode:i,paymentReady:s,configuredTools:u}){return[{title:n?"本地网关正在运行":"本地网关尚未就绪",body:n?"控制台服务和本地代理已经响应。":"请确认 tb-proxyd 已启动,并等待控制台刷新状态。",ok:n,status:n?"passed":"failed",details:[]},{title:l>0?"模型目录已加载":"模型目录尚未加载",body:l>0?`已发现 ${l} 个可用模型。`:"请检查供应商注册表或网络连接。",ok:l>0,status:l>0?"passed":"failed",details:[]},{title:"路由策略已选择",body:`当前策略为${bg(i)},TokenBuddy 会按这个策略规划供应商。`,ok:!!i,status:i?"passed":"failed",details:[]},{title:s?"支付方式可用":"支付方式尚未可用",body:s?"已经检测到至少一个可用支付方式。":"请完成 ClawTip 绑定,或稍后在支付页面补充配置。",ok:s,status:s?"passed":"warning",details:[]},{title:u>0?"终端工具已接入":"终端工具尚未接入",body:u>0?`已经写入 ${u} 个终端工具配置。`:"如果你还没有安装终端工具,可以稍后再执行接入。",ok:u>0,status:u>0?"passed":"warning",details:[]}]}function lM(n){return{title:n.label,body:n.message,ok:n.status==="passed"||n.status==="skipped",status:n.status,details:n.details}}function Bx(n){return n==="passed"?"全部通过":n==="warning"?"存在警告":n==="failed"?"需要修复":"等待检查"}function rM(n){return n==="passed"?"bg-emerald-50 text-emerald-700":n==="warning"?"bg-amber-50 text-amber-700":n==="failed"?"bg-rose-50 text-rose-700":"bg-[var(--color-page)] text-[var(--color-muted)]"}function iM(n){return n==="passed"?"通过":n==="warning"?"警告":n==="failed"?"失败":"已跳过"}function sM(n){return n==="passed"?"bg-emerald-50 text-emerald-700":n==="failed"?"bg-rose-50 text-rose-700":n==="skipped"?"bg-slate-100 text-slate-600":"bg-amber-50 text-amber-700"}function oM(n){return n==="passed"?"bg-emerald-50 text-emerald-700":n==="failed"?"bg-rose-50 text-rose-700":n==="skipped"?"bg-slate-100 text-slate-600":"bg-amber-50 text-amber-700"}function bg(n){return n==="fixed"?"固定供应商":n==="fixedSet"?"固定供应商组":"全自动"}function cM(n){return n==="speed"?"速度优先":n==="discount"?"成本优先":"平衡模式"}function uM(n){const l=n.toLowerCase();return["ok","healthy","active","available"].includes(l)?"状态正常":["error","failed","unavailable"].includes(l)?"状态异常":["unknown","pending"].includes(l)?"等待检测":`状态:${n}`}function dM(n){const l=n.toLowerCase();return["ok","healthy","active","available"].includes(l)?"bg-emerald-50 text-emerald-700":["error","failed","unavailable"].includes(l)?"bg-rose-50 text-rose-700":"bg-amber-50 text-amber-700"}function ec(n){const l=n.toLowerCase();return["ok","healthy","active","available"].includes(l)?0:["unknown","pending"].includes(l)?1:2}function gg(n){return n.configured?"已配置":n.status==="installed"?"已安装":n.status==="manual"?"需要手动配置":n.detected?"已检测到":"未检测到"}function fM(n){return n==="create"?"创建":"更新"}function mM({app:n,name:l="TokenBuddy",endpoint:i,apiKey:s,model:u,homepage:f}){const h=new URLSearchParams({resource:"provider",app:n,name:l,endpoint:i,apiKey:s});return u!=null&&u.trim()&&h.set("model",u.trim()),f!=null&&f.trim()&&h.set("homepage",f.trim()),`ccswitch://v1/import?${h.toString()}`}const yg="TOKENBUDDY_PROXY",hM="https://tokenbuddy.ai",pM={codex:{logo:"/tool-logos/codex.svg",tone:"blue",protocol:"Responses"},"claude-code":{logo:"/tool-logos/claude.svg",tone:"lavender",protocol:"Anthropic Messages"},"claude-desktop":{logo:"/tool-logos/claude.svg",tone:"lavender",protocol:"Anthropic Messages"},opencode:{logo:"/tool-logos/opencode.svg",tone:"green",protocol:"OpenAI Chat Completions"},openclaw:{tone:"amber",protocol:"OpenAI Chat Completions"},hermes:{logo:"/tool-logos/hermes.svg",tone:"gray",protocol:"OpenAI Chat Completions"}},vM={codex:{app:"codex",endpointKind:"openai"},"claude-code":{app:"claude",endpointKind:"anthropic"},"claude-desktop":{app:"claude",endpointKind:"anthropic"},opencode:{app:"opencode",endpointKind:"openai"},openclaw:{app:"openclaw",endpointKind:"openai"}},xM={codex:"https://developers.openai.com/codex/cli","claude-code":"https://code.claude.com/docs/en/setup","claude-desktop":"https://claude.com/download",openclaw:"https://docs.openclaw.ai/install",opencode:"https://opencode.ai/docs/",hermes:"https://github.com/NousResearch/hermes-agent"},ns=[{id:"cline",name:"Cline",logo:"/tool-logos/cline.svg",protocol:"OpenAI-compatible"},{id:"goose",name:"goose",logo:"/tool-logos/goose.svg",protocol:"OpenAI / Anthropic / Ollama compatible"},{id:"cursor",name:"Cursor",logo:"/tool-logos/cursor.svg",protocol:"OpenAI / Anthropic base URL"},{id:"qwen-code",name:"Qwen Code",logo:"/tool-logos/qwen-code.png",protocol:"OpenAI / Anthropic / Google compatible"},{id:"kimi",name:"Kimi Code",protocol:"OpenAI / Anthropic / Responses"},{id:"kilo",name:"Kilo Code",logo:"/tool-logos/kilocode.svg",protocol:"OpenAI-compatible"},{id:"omp",name:"Oh My Pi",logo:"/tool-logos/pi.svg",protocol:"40+ providers / OpenAI-compatible"},{id:"pi",name:"Pi Agent",logo:"/tool-logos/pi.svg",protocol:"OpenAI Responses / Chat / Anthropic"},{id:"crow-cli",name:"crow-cli",protocol:"OpenAI-compatible YAML"},{id:"dimcode",name:"DimCode",protocol:"TUI /connect custom provider"},{id:"dirac",name:"Dirac",logo:"/tool-logos/dirac.ico",protocol:"OpenAI-compatible endpoint"},{id:"factory-droid",name:"Factory Droid",logo:"/tool-logos/factory.svg",protocol:"BYOK custom models"},{id:"fast-agent",name:"fast-agent",logo:"/tool-logos/fast-agent.svg",protocol:"Responses / Chat / Anthropic"},{id:"glm",name:"GLM Agent",logo:"/tool-logos/glm.svg",protocol:"ACP_GLM_BASE_URL"},{id:"minion-code",name:"Minion Code",protocol:"YAML / CLI model override"}];function bM(){var Z,le,$,ue,ee,xe,de,R,X,ie;const{t:n}=Wl(),l=ug(),i=Uf(),s=rc(),u=dg(),f=Cw(),[h,v]=S.useState(null),[p,x]=S.useState(null),[y,g]=S.useState(null),j=((Z=i.data)==null?void 0:Z.proxyPort)??17821,N=((ue=($=(le=l.data)==null?void 0:le.clients.find(ne=>ne.id==="custom"))==null?void 0:$.manualConfig)==null?void 0:ue.openaiBaseUrl)??`http://127.0.0.1:${j}/v1`,T=((de=(xe=(ee=l.data)==null?void 0:ee.clients.find(ne=>ne.id==="custom"))==null?void 0:xe.manualConfig)==null?void 0:de.anthropicBaseUrl)??`http://127.0.0.1:${j}`,E=S.useMemo(()=>{var ne;return NM(((ne=s.data)==null?void 0:ne.data.map(pe=>pe.id))??[])},[(R=s.data)==null?void 0:R.data]),L=(((X=l.data)==null?void 0:X.clients)??[]).filter(ne=>ne.id!=="custom"),z=L.length,Q=((ie=l.data)==null?void 0:ie.summary.configuredCount)??0,q=u.isPending||f.isPending,O=wM(u.error,f.error),K=!!(p||O),J=async(ne,pe)=>{try{await navigator.clipboard.writeText(pe),g(ne),x(null),window.setTimeout(()=>g(C=>C===ne?null:C),1600)}catch{x(n("tools.copyFailed"))}},H=async ne=>{v(ne.id),x(null);const pe=await u.mutateAsync({providers:[ne.id],proxyUrl:SM(ne.id)==="messages"?T:N,model:E});x(n("tools.fileChangesApplied",{name:ne.name,count:pe.applied.length,plural:pe.applied.length===1?"":"s"}))},F=async ne=>{v(ne.id),x(null);const pe=await f.mutateAsync({providers:[ne.id]}),C=pe.rolledBack.filter(I=>I.action==="restored"||I.action==="removed").length,P=pe.rolledBack.some(I=>I.action==="missing_snapshot");x(P?n("tools.noSnapshot",{name:ne.name}):n("tools.restoredChanges",{name:ne.name,count:C,plural:C===1?"":"s"}))};return o.jsxs("div",{className:"min-w-0 space-y-4",children:[o.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h1",{className:"text-[1.18rem] font-bold leading-7 text-[var(--color-ink)]",children:n("tools.title")}),o.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[0.78rem] text-[var(--color-muted)]",children:[o.jsx("span",{children:n("tools.connectedSummary",{configured:Q,total:z})}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{className:"font-mono",children:N.replace("http://","")})]})]}),o.jsx("button",{type:"button",title:n("tools.refreshStatus"),"aria-label":n("tools.refreshStatus"),onClick:()=>void l.refetch(),className:"tb-button tb-button-icon tb-button-secondary size-9",children:o.jsx(Zo,{className:["size-4",l.isFetching?"animate-spin":""].join(" ")})})]}),o.jsxs("section",{className:"space-y-3",children:[o.jsxs(At,{className:"overflow-hidden p-0",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--color-line-2)] px-4 py-3",children:[o.jsx("div",{className:"min-w-0",children:o.jsx("h2",{className:"text-[0.96rem] font-bold text-[var(--color-ink)]",children:n("tools.oneClick")})}),l.isLoading?o.jsx(Tt,{className:"size-4 animate-spin text-[var(--color-muted)]"}):null]}),o.jsxs("div",{className:"hidden border-b border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-4 py-2 text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)] md:grid md:grid-cols-[minmax(12rem,1fr)_minmax(10rem,14rem)_8rem_13rem] md:items-center xl:grid-cols-[minmax(18rem,1fr)_minmax(13rem,18rem)_9rem_16rem]",children:[o.jsx("div",{children:n("tools.tool")}),o.jsx("div",{children:n("tools.protocol")}),o.jsx("div",{children:n("tools.status")}),o.jsx("div",{className:"text-right",children:n("tools.actions")})]}),o.jsx("div",{className:"divide-y divide-[var(--color-line-2)]",children:L.map(ne=>o.jsx(gM,{client:ne,busy:q&&h===ne.id,ccSwitchLink:jM(ne.id,N,T,E),onConfigure:()=>void H(ne),onRollback:()=>void F(ne)},ne.id))})]}),K?o.jsx(At,{className:"overflow-hidden",children:o.jsxs("div",{className:"p-3",children:[p?o.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-success-border)] bg-[var(--color-success-soft)] px-3 py-2 text-[0.82rem] font-medium text-emerald-800",children:p}):null,O?o.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-danger)]/25 bg-[var(--color-danger-soft)] px-3 py-2 text-[0.82rem] font-medium text-[var(--color-danger)]",children:O}):null]})}):null]}),o.jsx("section",{children:o.jsx(yM,{openAiBaseUrl:N,anthropicBaseUrl:T,copied:y,onCopy:J})})]})}function gM({client:n,busy:l,ccSwitchLink:i,onConfigure:s,onRollback:u}){const{t:f}=Wl(),h=pM[n.id]??{tone:"gray",protocol:"Custom"},v=n.status!=="missing",p=xM[n.id],x=n.configured?"green":n.status==="installed"?"blue":n.status==="missing"?"gray":"amber",y=n.configured?f("common.connected"):n.status==="installed"?f("common.installed"):n.status==="manual"?f("common.manual"):f("common.missing");return o.jsxs("article",{className:"grid gap-3 px-4 py-2.5 md:grid-cols-[minmax(12rem,1fr)_minmax(10rem,14rem)_8rem_13rem] md:items-center xl:grid-cols-[minmax(18rem,1fr)_minmax(13rem,18rem)_9rem_16rem]",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[o.jsx(pf,{logo:h.logo,name:n.name,tone:h.tone,size:"sm"}),o.jsx("div",{className:"min-w-0",children:o.jsx("h3",{className:"truncate text-[0.92rem] font-medium text-[var(--color-ink)]",children:n.name})})]}),o.jsx("div",{className:"hidden min-w-0 truncate text-[0.76rem] font-medium text-[var(--color-muted)] md:block",children:h.protocol}),o.jsx("div",{children:o.jsx(Pj,{tone:x,children:y})}),o.jsxs("div",{className:"flex items-center gap-2 md:grid md:w-[13rem] md:grid-cols-[2rem_minmax(0,7rem)] md:justify-end xl:w-[16rem]",children:[i?o.jsx("a",{href:i,title:f("tools.importCcSwitch",{name:n.name}),"aria-label":f("tools.importCcSwitch",{name:n.name}),className:"tb-button tb-button-icon tb-button-secondary",children:o.jsx("img",{src:"/tool-logos/cc-switch.png",alt:"","aria-hidden":"true",className:"size-4 rounded-[var(--radius-xs)]"})}):o.jsx("span",{"aria-hidden":"true",className:"hidden size-8 md:block"}),v?n.configured?o.jsxs("button",{type:"button","aria-label":f("tools.disconnectFrom",{name:n.name}),onClick:u,disabled:l,className:"tb-button tb-button-sm tb-button-secondary flex-1 md:w-full",children:[o.jsx(IS,{className:"size-3.5"}),f("tools.disconnect")]}):o.jsxs("button",{type:"button","aria-label":f("tools.connectTo",{name:n.name}),onClick:s,disabled:l,className:"tb-button tb-button-sm tb-button-primary flex-1 md:w-full",children:[l?o.jsx(Tt,{className:"size-3.5 animate-spin"}):o.jsx(Ht,{className:"size-3.5"}),f("tools.connect")]}):p?o.jsxs("a",{href:p,target:"_blank",rel:"noreferrer","aria-label":`${f("tools.getApp")}: ${n.name}`,className:"tb-button tb-button-sm tb-button-primary flex-1 md:w-full",children:[o.jsx(bS,{className:"size-3.5"}),f("tools.getApp")]}):o.jsx("span",{"aria-hidden":"true",className:"hidden h-8 md:block"})]})]})}function pf({logo:n,name:l,tone:i,size:s="md"}){const u={green:"border-[var(--color-success-border)] bg-[var(--color-success-soft)]",blue:"border-[var(--color-tokens-border)] bg-[var(--color-tokens-soft)]",lavender:"border-[var(--color-lavender-2)] bg-[var(--color-lavender)]",amber:"border-amber-100 bg-amber-50",gray:"border-slate-200 bg-slate-50"}[i],f=s==="sm"?"size-8":"size-10",h=s==="sm"?"size-4":"size-5";return o.jsxs("div",{className:["grid shrink-0 place-items-center rounded-[var(--radius-md)] border",f,u].join(" "),children:[n?o.jsx("img",{src:n,alt:"","aria-hidden":"true",className:h}):o.jsx(sj,{className:"size-4 text-[var(--color-muted)]","aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:l})]})}function yM({openAiBaseUrl:n,anthropicBaseUrl:l,copied:i,onCopy:s}){var g;const{t:u}=Wl(),[f,h]=S.useState(((g=ns[0])==null?void 0:g.id)??null),[v,p]=S.useState(""),x=S.useMemo(()=>{const j=v.trim().toLowerCase();return j?ns.filter(N=>`${N.name} ${N.protocol}`.toLowerCase().includes(j)):ns},[v]),y=ns.find(j=>j.id===f);return o.jsxs(At,{className:"overflow-hidden p-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-[var(--color-line-2)] px-4 py-3",children:[o.jsx("h2",{className:"text-[0.96rem] font-bold text-[var(--color-ink)]",children:u("tools.manualSetup")}),o.jsx("span",{className:"text-[0.72rem] font-medium text-[var(--color-muted)]",children:u("tools.appsCount",{count:ns.length})})]}),o.jsxs("div",{className:"grid gap-0 lg:grid-cols-[minmax(0,1fr)_23rem]",children:[o.jsxs("div",{className:"min-w-0 px-4 py-3",children:[o.jsxs("label",{className:"mb-3 flex h-9 items-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 focus-within:border-[var(--color-primary)] focus-within:bg-white",children:[o.jsx(ys,{className:"size-4 shrink-0 text-[var(--color-muted)]","aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:u("tools.searchApps")}),o.jsx("input",{value:v,onChange:j=>p(j.target.value),placeholder:u("tools.searchAppsPlaceholder"),className:"h-full min-w-0 flex-1 bg-transparent text-[0.82rem] font-medium text-[var(--color-ink)] outline-none placeholder:text-[var(--color-muted)]"})]}),o.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:[x.map(j=>{const N=j.id===f;return o.jsxs("button",{type:"button","aria-pressed":N,onClick:()=>h(j.id),className:["flex min-h-[3.75rem] min-w-0 items-center gap-2 rounded-[var(--radius-md)] border px-2.5 py-2 text-left transition",N?"border-[var(--color-primary)] bg-[var(--color-primary-soft)] shadow-[inset_0_0_0_1px_var(--color-primary)]":"border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] hover:border-[var(--color-lavender-2)]"].join(" "),children:[o.jsx(pf,{logo:j.logo,name:j.name,tone:N?"lavender":"gray"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"truncate text-[0.8rem] font-medium text-[var(--color-ink)]",children:j.name}),o.jsx("div",{className:"mt-0.5 truncate text-[0.68rem] text-[var(--color-muted)]",children:j.protocol})]})]},j.id)}),x.length===0?o.jsx("div",{className:"rounded-[var(--radius-md)] border border-dashed border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 py-6 text-center text-[0.78rem] font-medium text-[var(--color-muted)] sm:col-span-2 xl:col-span-3",children:u("tools.noMatchingApp")}):null]})]}),o.jsx("div",{className:"border-t border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-4 py-3 lg:border-l lg:border-t-0",children:o.jsxs("div",{className:"sticky top-3 space-y-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[o.jsx(pf,{logo:y==null?void 0:y.logo,name:(y==null?void 0:y.name)??"Selected app",tone:"lavender"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:u("tools.configuration")}),o.jsx("div",{className:"truncate text-[0.96rem] font-medium text-[var(--color-ink)]",children:(y==null?void 0:y.name)??"Select an app"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Qd,{label:u("tools.openAiBaseUrl"),value:n,copyKey:"manual-openai",copied:i,onCopy:s}),o.jsx(Qd,{label:u("tools.anthropicBaseUrl"),value:l,copyKey:"manual-anthropic",copied:i,onCopy:s}),o.jsx(Qd,{label:u("tools.apiKey"),value:yg,copyKey:"manual-key",copied:i,onCopy:s})]})]})})]})]})}function Qd({label:n,value:l,copyKey:i,copied:s,onCopy:u,compact:f=!1}){return o.jsxs("div",{className:["flex items-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white px-2.5",f?"py-1.5":"py-2"].join(" "),children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:n}),o.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.78rem] text-[var(--color-ink)]",children:l||Oe})]}),o.jsx("button",{type:"button",onClick:()=>void u(i,l),className:"tb-button tb-button-icon tb-button-secondary",children:s===i?o.jsx(Ht,{className:"size-4"}):o.jsx(ES,{className:"size-4"})})]})}function SM(n){return n==="codex"?"responses":n==="claude-code"||n==="claude-desktop"?"messages":"chat_completions"}function jM(n,l,i,s){const u=vM[n];if(u)return mM({app:u.app,endpoint:u.endpointKind==="anthropic"?i:l,apiKey:yg,model:s,homepage:hM})}function NM(n){return n.find(l=>l==="gpt-5.4")??n.find(l=>l.toLowerCase().includes("gpt"))??n[0]??"gpt-5.4"}function wM(...n){const l=n.find(Boolean);return l instanceof Error?l.message:void 0}function MM({compact:n=!1,className:l="",hideTextBelowSm:i=!1,showAi:s=!1}){return o.jsxs("span",{"data-no-translate":"true",className:["inline-flex min-w-0 items-center gap-2",l].join(" "),children:[o.jsx(CM,{className:n?"size-6":"size-7"}),o.jsxs("span",{className:["min-w-0 font-mono text-[0.84rem] font-black uppercase leading-none tracking-[0.12em] text-[var(--color-ink)]",i?"hidden min-[420px]:inline":""].join(" "),children:["Token",o.jsx("span",{className:"text-[var(--color-primary)]",children:"Buddy"}),s?o.jsx("span",{className:"text-[var(--color-muted)]",children:".AI"}):null]})]})}function CM({className:n}){return o.jsxs("svg",{className:n,viewBox:"0 0 32 32","aria-hidden":"true",focusable:"false",children:[o.jsx("rect",{x:"2.5",y:"2.5",width:"27",height:"27",rx:"8",fill:"#ffffff",stroke:"var(--color-line)"}),o.jsx("path",{d:"M9.5 19.5V12.5L16 8.75L22.5 12.5V19.5L16 23.25L9.5 19.5Z",fill:"var(--color-primary-soft)",stroke:"var(--color-primary)",strokeWidth:"1.7",strokeLinejoin:"round"}),o.jsx("path",{d:"M16 8.75V23.25M9.5 12.5L16 16.25L22.5 12.5",fill:"none",stroke:"var(--color-primary-deep)",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"23.25",cy:"8.75",r:"2.35",fill:"var(--color-success)",stroke:"#ffffff",strokeWidth:"1.3"})]})}function TM(){const{t:n}=Wl();return o.jsxs("div",{className:"min-h-full",children:[o.jsxs("nav",{"aria-label":"Primary",className:"sticky top-0 z-10 flex h-12 items-center gap-2 border-b border-[var(--color-line-2)] bg-[var(--color-page)]/95 px-3 backdrop-blur sm:gap-5 sm:px-6",children:[o.jsx(Cf,{to:"/overview","aria-label":"TokenBuddy home",className:"group inline-flex shrink-0 items-center rounded-[var(--radius-md)] px-1 py-1.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",children:o.jsx(MM,{compact:!0,hideTextBelowSm:!0})}),o.jsxs("div",{className:"ml-auto flex min-w-0 gap-0.5 sm:gap-1",children:[o.jsx(Ho,{to:"/overview",children:n("nav.overview")}),o.jsx(Ho,{to:"/routing",children:n("nav.routing")}),o.jsx(Ho,{to:"/ledger",children:n("nav.ledger")}),o.jsx(Ho,{to:"/tools",children:n("nav.tools")})]}),o.jsx(AM,{})]}),o.jsx("main",{className:"mx-auto max-w-[1180px] px-3 py-5 sm:px-6 sm:py-7",children:o.jsxs(H1,{children:[o.jsx(Bl,{path:"/",element:o.jsx(vx,{})}),o.jsx(Bl,{path:"/overview",element:o.jsx(vx,{})}),o.jsx(Bl,{path:"/init",element:o.jsx(zw,{})}),o.jsx(Bl,{path:"/routing",element:o.jsx(TN,{})}),o.jsx(Bl,{path:"/ledger",element:o.jsx(dw,{})}),o.jsx(Bl,{path:"/tools",element:o.jsx(bM,{})})]})})]})}function AM(){const{language:n,setLanguage:l,t:i}=Wl(),s=[{value:"en",label:i("language.english"),ariaLabel:i("language.switchToEnglish")},{value:"zh",label:i("language.chinese"),ariaLabel:i("language.switchToChinese")}];return o.jsx("div",{className:"ml-1 inline-flex h-8 shrink-0 items-center rounded-full border border-[var(--color-line-2)] bg-white p-0.5 shadow-[var(--shadow-chip)]","aria-label":i("language.label"),children:s.map(u=>o.jsx("button",{type:"button",onClick:()=>l(u.value),"aria-label":u.ariaLabel,"aria-pressed":n===u.value,className:["h-6 rounded-full px-2 text-[0.68rem] font-bold transition",n===u.value?"bg-[var(--color-primary)] text-white shadow-[0_1px_5px_rgba(124,61,240,0.26)]":"text-[var(--color-muted)] hover:bg-[var(--color-primary-soft)] hover:text-[var(--color-primary-deep)]"].join(" "),children:u.label},u.value))})}function Ho({to:n,children:l}){return o.jsx(Cf,{to:n,className:({isActive:i})=>["rounded-[var(--radius-md)] px-2 py-1.5 text-[0.82rem] font-medium transition-colors sm:px-3.5 sm:text-[0.92rem]",i?"font-semibold text-[var(--color-ink)] underline decoration-[var(--color-primary)] decoration-2 underline-offset-[10px]":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:l})}function EM(){!("serviceWorker"in navigator)||window.location.port==="5173"||window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})})}const kM=new X2({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1,retry:1}}});Q0.createRoot(document.getElementById("root")).render(o.jsx(S.StrictMode,{children:o.jsx(V2,{client:kM,children:o.jsx(Gj,{children:o.jsx(d2,{children:o.jsx(TM,{})})})})}));EM();
|
|
266
|
-
//# sourceMappingURL=index-Mt3BZFuP.js.map
|