@tokenbuddy/tokenbuddy 1.0.34 → 1.0.36
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 +2 -2
- 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
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
var D0=Object.defineProperty;var Hv=n=>{throw TypeError(n)};var U0=(n,l,i)=>l in n?D0(n,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[l]=i;var jd=(n,l,i)=>U0(n,typeof l!="symbol"?l+"":l,i),Nd=(n,l,i)=>l.has(n)||Hv("Cannot "+i);var M=(n,l,i)=>(Nd(n,l,"read from private field"),i?i.call(n):l.get(n)),me=(n,l,i)=>l.has(n)?Hv("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,i),ne=(n,l,i,s)=>(Nd(n,l,"write to private field"),s?s.call(n,i):l.set(n,i),i),Ne=(n,l,i)=>(Nd(n,l,"access private method"),i);var Uo=(n,l,i,s)=>({set _(u){ne(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 wd={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 $v;function L0(){if($v)return Ji;$v=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 Qv;function B0(){return Qv||(Qv=1,wd.exports=L0()),wd.exports}var o=B0(),Md={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 Kv;function q0(){if(Kv)return ye;Kv=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"),b=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,U={};function z(C,P,W){this.props=C,this.context=P,this.refs=U,this.updater=W||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 H(){}H.prototype=z.prototype;function L(C,P,W){this.props=C,this.context=P,this.refs=U,this.updater=W||T}var $=L.prototype=new H;$.constructor=L,E($,z.prototype),$.isPureReactComponent=!0;var Q=Array.isArray;function F(){}var B={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function J(C,P,W){var te=W.ref;return{$$typeof:n,type:C,key:P,ref:te!==void 0?te:null,props:W}}function ae(C,P){return J(C.type,P,C.props)}function K(C){return typeof C=="object"&&C!==null&&C.$$typeof===n}function ce(C){var P={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(W){return P[W]})}var I=/\/+/g;function pe(C,P){return typeof C=="object"&&C!==null&&C.key!=null?ce(""+C.key):P.toString(36)}function ie(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(F,F):(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,W,te,fe){var ge=typeof C;(ge==="undefined"||ge==="boolean")&&(C=null);var be=!1;if(C===null)be=!0;else switch(ge){case"bigint":case"string":case"number":be=!0;break;case"object":switch(C.$$typeof){case n:case l:be=!0;break;case y:return be=C._init,R(be(C._payload),P,W,te,fe)}}if(be)return fe=fe(C),be=te===""?"."+pe(C,0):te,Q(fe)?(W="",be!=null&&(W=be.replace(I,"$&/")+"/"),R(fe,P,W,"",function(_t){return _t})):fe!=null&&(K(fe)&&(fe=ae(fe,W+(fe.key==null||C&&C.key===fe.key?"":(""+fe.key).replace(I,"$&/")+"/")+be)),P.push(fe)),1;be=0;var Ue=te===""?".":te+":";if(Q(C))for(var Re=0;Re<C.length;Re++)te=C[Re],ge=Ue+pe(te,Re),be+=R(te,P,W,ge,fe);else if(Re=N(C),typeof Re=="function")for(C=Re.call(C),Re=0;!(te=C.next()).done;)te=te.value,ge=Ue+pe(te,Re++),be+=R(te,P,W,ge,fe);else if(ge==="object"){if(typeof C.then=="function")return R(ie(C),P,W,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 be}function X(C,P,W){if(C==null)return C;var te=[],fe=0;return R(C,te,"","",function(ge){return P.call(W,ge,fe++)}),te}function se(C){if(C._status===-1){var P=C._result;P=P(),P.then(function(W){(C._status===0||C._status===-1)&&(C._status=1,C._result=W)},function(W){(C._status===0||C._status===-1)&&(C._status=2,C._result=W)}),C._status===-1&&(C._status=0,C._result=P)}if(C._status===1)return C._result.default;throw C._result}var le=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)},ve={map:X,forEach:function(C,P,W){X(C,function(){P.apply(this,arguments)},W)},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(!K(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return ye.Activity=b,ye.Children=ve,ye.Component=z,ye.Fragment=i,ye.Profiler=u,ye.PureComponent=L,ye.StrictMode=s,ye.Suspense=p,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,ye.__COMPILER_RUNTIME={__proto__:null,c:function(C){return B.H.useMemoCache(C)}},ye.cache=function(C){return function(){return C.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(C,P,W){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(ge in P.key!==void 0&&(fe=""+P.key),P)!Z.call(P,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&P.ref===void 0||(te[ge]=P[ge]);var ge=arguments.length-2;if(ge===1)te.children=W;else if(1<ge){for(var be=Array(ge),Ue=0;Ue<ge;Ue++)be[Ue]=arguments[Ue+2];te.children=be}return J(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,W){var te,fe={},ge=null;if(P!=null)for(te in P.key!==void 0&&(ge=""+P.key),P)Z.call(P,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(fe[te]=P[te]);var be=arguments.length-2;if(be===1)fe.children=W;else if(1<be){for(var Ue=Array(be),Re=0;Re<be;Re++)Ue[Re]=arguments[Re+2];fe.children=Ue}if(C&&C.defaultProps)for(te in be=C.defaultProps,be)fe[te]===void 0&&(fe[te]=be[te]);return J(C,ge,fe)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(C){return{$$typeof:v,render:C}},ye.isValidElement=K,ye.lazy=function(C){return{$$typeof:y,_payload:{_status:-1,_result:C},_init:se}},ye.memo=function(C,P){return{$$typeof:x,type:C,compare:P===void 0?null:P}},ye.startTransition=function(C){var P=B.T,W={};B.T=W;try{var te=C(),fe=B.S;fe!==null&&fe(W,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(F,le)}catch(ge){le(ge)}finally{P!==null&&W.types!==null&&(P.types=W.types),B.T=P}},ye.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},ye.use=function(C){return B.H.use(C)},ye.useActionState=function(C,P,W){return B.H.useActionState(C,P,W)},ye.useCallback=function(C,P){return B.H.useCallback(C,P)},ye.useContext=function(C){return B.H.useContext(C)},ye.useDebugValue=function(){},ye.useDeferredValue=function(C,P){return B.H.useDeferredValue(C,P)},ye.useEffect=function(C,P){return B.H.useEffect(C,P)},ye.useEffectEvent=function(C){return B.H.useEffectEvent(C)},ye.useId=function(){return B.H.useId()},ye.useImperativeHandle=function(C,P,W){return B.H.useImperativeHandle(C,P,W)},ye.useInsertionEffect=function(C,P){return B.H.useInsertionEffect(C,P)},ye.useLayoutEffect=function(C,P){return B.H.useLayoutEffect(C,P)},ye.useMemo=function(C,P){return B.H.useMemo(C,P)},ye.useOptimistic=function(C,P){return B.H.useOptimistic(C,P)},ye.useReducer=function(C,P,W){return B.H.useReducer(C,P,W)},ye.useRef=function(C){return B.H.useRef(C)},ye.useState=function(C){return B.H.useState(C)},ye.useSyncExternalStore=function(C,P,W){return B.H.useSyncExternalStore(C,P,W)},ye.useTransition=function(){return B.H.useTransition()},ye.version="19.2.7",ye}var Yv;function yf(){return Yv||(Yv=1,Md.exports=q0()),Md.exports}var S=yf(),Cd={exports:{}},Ii={},Td={exports:{}},Ad={};/**
|
|
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 Pv;function H0(){return Pv||(Pv=1,(function(n){function l(R,X){var se=R.length;R.push(X);e:for(;0<se;){var le=se-1>>>1,ve=R[le];if(0<u(ve,X))R[le]=X,R[se]=ve,se=le;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],se=R.pop();if(se!==X){R[0]=se;e:for(var le=0,ve=R.length,C=ve>>>1;le<C;){var P=2*(le+1)-1,W=R[P],te=P+1,fe=R[te];if(0>u(W,se))te<ve&&0>u(fe,W)?(R[le]=fe,R[te]=se,le=te):(R[le]=W,R[P]=se,le=P);else if(te<ve&&0>u(fe,se))R[le]=fe,R[te]=se,le=te;else break e}}return X}function u(R,X){var se=R.sortIndex-X.sortIndex;return se!==0?se: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,b=null,j=3,N=!1,T=!1,E=!1,U=!1,z=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function $(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 Q(R){if(E=!1,$(R),!T)if(i(p)!==null)T=!0,F||(F=!0,ce());else{var X=i(x);X!==null&&ie(Q,X.startTime-R)}}var F=!1,B=-1,Z=5,J=-1;function ae(){return U?!0:!(n.unstable_now()-J<Z)}function K(){if(U=!1,F){var R=n.unstable_now();J=R;var X=!0;try{e:{T=!1,E&&(E=!1,H(B),B=-1),N=!0;var se=j;try{t:{for($(R),b=i(p);b!==null&&!(b.expirationTime>R&&ae());){var le=b.callback;if(typeof le=="function"){b.callback=null,j=b.priorityLevel;var ve=le(b.expirationTime<=R);if(R=n.unstable_now(),typeof ve=="function"){b.callback=ve,$(R),X=!0;break t}b===i(p)&&s(p),$(R)}else s(p);b=i(p)}if(b!==null)X=!0;else{var C=i(x);C!==null&&ie(Q,C.startTime-R),X=!1}}break e}finally{b=null,j=se,N=!1}X=void 0}}finally{X?ce():F=!1}}}var ce;if(typeof L=="function")ce=function(){L(K)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,pe=I.port2;I.port1.onmessage=K,ce=function(){pe.postMessage(null)}}else ce=function(){z(K,0)};function ie(R,X){B=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"):Z=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 se=j;j=X;try{return R()}finally{j=se}},n.unstable_requestPaint=function(){U=!0},n.unstable_runWithPriority=function(R,X){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var se=j;j=R;try{return X()}finally{j=se}},n.unstable_scheduleCallback=function(R,X,se){var le=n.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?le+se:le):se=le,R){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=se+ve,R={id:y++,callback:X,priorityLevel:R,startTime:se,expirationTime:ve,sortIndex:-1},se>le?(R.sortIndex=se,l(x,R),i(p)===null&&R===i(x)&&(E?(H(B),B=-1):E=!0,ie(Q,se-le))):(R.sortIndex=ve,l(p,R),T||N||(T=!0,F||(F=!0,ce()))),R},n.unstable_shouldYield=ae,n.unstable_wrapCallback=function(R){var X=j;return function(){var se=j;j=X;try{return R.apply(this,arguments)}finally{j=se}}}})(Ad)),Ad}var Gv;function $0(){return Gv||(Gv=1,Td.exports=H0()),Td.exports}var Ed={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 Xv;function Q0(){if(Xv)return kt;Xv=1;var n=yf();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 b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:b==null?null:""+b,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,b=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:b,integrity:j,fetchPriority:N}):y==="script"&&s.d.X(p,{crossOrigin:b,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,b=v(y,x.crossOrigin);s.d.L(p,y,{crossOrigin:b,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 Vv;function tg(){if(Vv)return Ed.exports;Vv=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(),Ed.exports=Q0(),Ed.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 Fv;function K0(){if(Fv)return Ii;Fv=1;var n=$0(),l=yf(),i=tg();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,g=c.child;g;){if(g===a){m=!0,a=c,r=d;break}if(g===r){m=!0,r=c,a=d;break}g=g.sibling}if(!m){for(g=d.child;g;){if(g===a){m=!0,a=d,r=c;break}if(g===r){m=!0,r=d,a=c;break}g=g.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 b=Object.assign,j=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),L=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function ce(e){return e===null||typeof e!="object"?null:(e=K&&e[K]||e["@@iterator"],typeof e=="function"?e:null)}var I=Symbol.for("react.client.reference");function pe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===I?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case z:return"Profiler";case U:return"StrictMode";case Q:return"Suspense";case F:return"SuspenseList";case J:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case L:return e.displayName||"Context";case H:return(e._context.displayName||"Context")+".Consumer";case $:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return t=e.displayName||null,t!==null?t:pe(e.type)||"Memo";case Z:t=e._payload,e=e._init;try{return pe(e(t))}catch{}}return null}var ie=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,se={pending:!1,data:null,method:null,action:null},le=[],ve=-1;function C(e){return{current:e}}function P(e){0>ve||(e.current=le[ve],le[ve]=null,ve--)}function W(e,t){ve++,le[ve]=e.current,e.current=t}var te=C(null),fe=C(null),ge=C(null),be=C(null);function Ue(e,t){switch(W(ge,t),W(fe,e),W(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?cv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=cv(t),e=uv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(te),W(te,e)}function Re(){P(te),P(fe),P(ge)}function _t(e){e.memoizedState!==null&&W(be,e);var t=te.current,a=uv(t,e.type);t!==a&&(W(fe,e),W(te,a))}function gt(e){fe.current===e&&(P(te),P(fe)),be.current===e&&(P(be),Xi._currentValue=se)}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(q){var D=q}Reflect.construct(e,[],V)}else{try{V.call()}catch(q){D=q}e.call(V.prototype)}}else{try{throw Error()}catch(q){D=q}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(q){if(q&&D&&typeof q.stack=="string")return[q.stack,D.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],g=d[1];if(m&&g){var w=m.split(`
|
|
44
|
+
`),O=g.split(`
|
|
45
|
+
`);for(c=r=0;r<w.length&&!w[r].includes("DetermineComponentFrameRoot");)r++;for(;c<O.length&&!O[c].includes("DetermineComponentFrameRoot");)c++;if(r===w.length||c===O.length)for(r=w.length-1,c=O.length-1;1<=r&&0<=c&&w[r]!==O[c];)c--;for(;1<=r&&0<=c;r--,c--)if(w[r]!==O[c]){if(r!==1||c!==1)do if(r--,c--,0>c||w[r]!==O[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 On(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+=On(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,an=n.unstable_requestPaint,ct=n.unstable_now,Dn=n.unstable_getCurrentPriorityLevel,nn=n.unstable_ImmediatePriority,Ua=n.unstable_UserBlockingPriority,Aa=n.unstable_NormalPriority,Un=n.unstable_LowPriority,ln=n.unstable_IdlePriority,Ln=n.log,Bn=n.unstable_setDisableYieldValue,He=null,We=null;function ha(e){if(typeof Ln=="function"&&Bn(e),We&&typeof We.setStrictMode=="function")try{We.setStrictMode(He,e)}catch{}}var jt=Math.clz32?Math.clz32:La,tr=Math.log,ar=Math.LN2;function La(e){return e>>>=0,e===0?32:31-(tr(e)/ar|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 g=r&134217727;return g!==0?(r=g&~d,r!==0?c=aa(r):(m&=g,m!==0?c=aa(m):a||(a=g&~e,a!==0&&(c=aa(a))))):(g=r&~d,g!==0?c=aa(g):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 Sl(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 qn(){var e=Ha;return Ha<<=1,(Ha&62914560)===0&&(Ha=4194304),e}function rn(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ue(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 g=e.entanglements,w=e.expirationTimes,O=e.hiddenUpdates;for(a=m&~a;0<a;){var Y=31-jt(a),V=1<<Y;g[Y]=0,w[Y]=-1;var D=O[Y];if(D!==null)for(O[Y]=null,Y=0;Y<D.length;Y++){var q=D[Y];q!==null&&(q.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 ee(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:Ce(a),(a&(e.suspendedLanes|t))!==0?0:a}function Ce(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:_v(e.type))}function nr(e,t){var a=X.p;try{return X.p=e,t()}finally{X.p=a}}var it=Math.random().toString(36).slice(2),ze="__reactFiber$"+it,ut="__reactProps$"+it,lr="__reactContainer$"+it,mc="__reactEvents$"+it,wb="__reactListeners$"+it,Mb="__reactHandles$"+it,Zf="__reactResources$"+it,oi="__reactMarker$"+it;function hc(e){delete e[ze],delete e[ut],delete e[mc],delete e[wb],delete e[Mb]}function rr(e){var t=e[ze];if(t)return t;for(var a=e.parentNode;a;){if(t=a[lr]||a[ze]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=xv(e);e!==null;){if(a=e[ze])return a;e=xv(e)}return t}e=a,a=e.parentNode}return null}function ir(e){if(e=e[ze]||e[lr]){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 sr(e){var t=e[Zf];return t||(t=e[Zf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function bt(e){e[oi]=!0}var Jf=new Set,If={};function jl(e,t){or(e,t),or(e+"Capture",t)}function or(e,t){for(If[e]=t,e=0;e<t.length;e++)Jf.add(t[e])}var Cb=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]*$"),Wf={},em={};function Tb(e){return Dt.call(em,e)?!0:Dt.call(Wf,e)?!1:Cb.test(e)?em[e]=!0:(Wf[e]=!0,!1)}function Ns(e,t,a){if(Tb(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 ws(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 sn(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 tm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ab(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 pc(e){if(!e._valueTracker){var t=tm(e)?"checked":"value";e._valueTracker=Ab(e,t,""+e[t])}}function am(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=tm(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function Ms(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 Eb=/[\n"\\]/g;function va(e){return e.replace(Eb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function vc(e,t,a,r,c,d,m,g){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?xc(e,m,pa(t)):a!=null?xc(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"),g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.name=""+pa(g):e.removeAttribute("name")}function nm(e,t,a,r,c,d,m,g){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)){pc(e);return}a=a!=null?""+pa(a):"",t=t!=null?""+pa(t):a,g||t===e.value||(e.value=t),e.defaultValue=t}r=r??c,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=g?e.checked:!!r,e.defaultChecked=!!r,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),pc(e)}function xc(e,t,a){t==="number"&&Ms(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function cr(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 lm(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 rm(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(s(92));if(ie(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),pc(e)}function ur(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var kb=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 im(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||kb.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function sm(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&&im(e,c,r)}else for(var d in t)t.hasOwnProperty(d)&&im(e,d,t[d])}function gc(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 Rb=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"]]),zb=/^[\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 Cs(e){return zb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function on(){}var bc=null;function yc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dr=null,fr=null;function om(e){var t=ir(e);if(t&&(e=t.stateNode)){var a=e[ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(vc(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));vc(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&&am(r)}break e;case"textarea":lm(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&cr(e,!!a.multiple,t,!1)}}}var Sc=!1;function cm(e,t,a){if(Sc)return e(t,a);Sc=!0;try{var r=e(t);return r}finally{if(Sc=!1,(dr!==null||fr!==null)&&(ho(),dr&&(t=dr,e=fr,fr=dr=null,om(t),e)))for(t=0;t<e.length;t++)om(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 cn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jc=!1;if(cn)try{var di={};Object.defineProperty(di,"passive",{get:function(){jc=!0}}),window.addEventListener("test",di,di),window.removeEventListener("test",di,di)}catch{jc=!1}var Hn=null,Nc=null,Ts=null;function um(){if(Ts)return Ts;var e,t=Nc,a=t.length,r,c="value"in Hn?Hn.value:Hn.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 Ts=c.slice(e,1<r?1-r:void 0)}function As(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 Es(){return!0}function dm(){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 g in e)e.hasOwnProperty(g)&&(a=e[g],this[g]=a?a(d):d[g]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Es:dm,this.isPropagationStopped=dm,this}return b(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=Es)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Es)},persist:function(){},isPersistent:Es}),t}var Nl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ks=Yt(Nl),fi=b({},Nl,{view:0,detail:0}),_b=Yt(fi),wc,Mc,mi,Rs=b({},fi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tc,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"?(wc=e.screenX-mi.screenX,Mc=e.screenY-mi.screenY):Mc=wc=0,mi=e),wc)},movementY:function(e){return"movementY"in e?e.movementY:Mc}}),fm=Yt(Rs),Ob=b({},Rs,{dataTransfer:0}),Db=Yt(Ob),Ub=b({},fi,{relatedTarget:0}),Cc=Yt(Ub),Lb=b({},Nl,{animationName:0,elapsedTime:0,pseudoElement:0}),Bb=Yt(Lb),qb=b({},Nl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Hb=Yt(qb),$b=b({},Nl,{data:0}),mm=Yt($b),Qb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kb={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"},Yb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Yb[e])?!!t[e]:!1}function Tc(){return Pb}var Gb=b({},fi,{key:function(e){if(e.key){var t=Qb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=As(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Kb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tc,charCode:function(e){return e.type==="keypress"?As(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?As(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Xb=Yt(Gb),Vb=b({},Rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hm=Yt(Vb),Fb=b({},fi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tc}),Zb=Yt(Fb),Jb=b({},Nl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ib=Yt(Jb),Wb=b({},Rs,{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}),ey=Yt(Wb),ty=b({},Nl,{newState:0,oldState:0}),ay=Yt(ty),ny=[9,13,27,32],Ac=cn&&"CompositionEvent"in window,hi=null;cn&&"documentMode"in document&&(hi=document.documentMode);var ly=cn&&"TextEvent"in window&&!hi,pm=cn&&(!Ac||hi&&8<hi&&11>=hi),vm=" ",xm=!1;function gm(e,t){switch(e){case"keyup":return ny.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mr=!1;function ry(e,t){switch(e){case"compositionend":return bm(t);case"keypress":return t.which!==32?null:(xm=!0,vm);case"textInput":return e=t.data,e===vm&&xm?null:e;default:return null}}function iy(e,t){if(mr)return e==="compositionend"||!Ac&&gm(e,t)?(e=um(),Ts=Nc=Hn=null,mr=!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 pm&&t.locale!=="ko"?null:t.data;default:return null}}var sy={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 ym(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sy[e.type]:t==="textarea"}function Sm(e,t,a,r){dr?fr?fr.push(r):fr=[r]:dr=r,t=So(t,"onChange"),0<t.length&&(a=new ks("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var pi=null,vi=null;function oy(e){nv(e,0)}function zs(e){var t=ci(e);if(am(t))return e}function jm(e,t){if(e==="change")return t}var Nm=!1;if(cn){var Ec;if(cn){var kc="oninput"in document;if(!kc){var wm=document.createElement("div");wm.setAttribute("oninput","return;"),kc=typeof wm.oninput=="function"}Ec=kc}else Ec=!1;Nm=Ec&&(!document.documentMode||9<document.documentMode)}function Mm(){pi&&(pi.detachEvent("onpropertychange",Cm),vi=pi=null)}function Cm(e){if(e.propertyName==="value"&&zs(vi)){var t=[];Sm(t,vi,e,yc(e)),cm(oy,t)}}function cy(e,t,a){e==="focusin"?(Mm(),pi=t,vi=a,pi.attachEvent("onpropertychange",Cm)):e==="focusout"&&Mm()}function uy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return zs(vi)}function dy(e,t){if(e==="click")return zs(t)}function fy(e,t){if(e==="input"||e==="change")return zs(t)}function my(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var na=typeof Object.is=="function"?Object.is:my;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 Tm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Am(e,t){var a=Tm(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=Tm(a)}}function Em(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Em(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function km(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ms(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=Ms(e.document)}return t}function Rc(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 hy=cn&&"documentMode"in document&&11>=document.documentMode,hr=null,zc=null,gi=null,_c=!1;function Rm(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;_c||hr==null||hr!==Ms(r)||(r=hr,"selectionStart"in r&&Rc(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}),gi&&xi(gi,r)||(gi=r,r=So(zc,"onSelect"),0<r.length&&(t=new ks("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=hr)))}function wl(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var pr={animationend:wl("Animation","AnimationEnd"),animationiteration:wl("Animation","AnimationIteration"),animationstart:wl("Animation","AnimationStart"),transitionrun:wl("Transition","TransitionRun"),transitionstart:wl("Transition","TransitionStart"),transitioncancel:wl("Transition","TransitionCancel"),transitionend:wl("Transition","TransitionEnd")},Oc={},zm={};cn&&(zm=document.createElement("div").style,"AnimationEvent"in window||(delete pr.animationend.animation,delete pr.animationiteration.animation,delete pr.animationstart.animation),"TransitionEvent"in window||delete pr.transitionend.transition);function Ml(e){if(Oc[e])return Oc[e];if(!pr[e])return e;var t=pr[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in zm)return Oc[e]=t[a];return e}var _m=Ml("animationend"),Om=Ml("animationiteration"),Dm=Ml("animationstart"),py=Ml("transitionrun"),vy=Ml("transitionstart"),xy=Ml("transitioncancel"),Um=Ml("transitionend"),Lm=new Map,Dc="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(" ");Dc.push("scrollEnd");function ka(e,t){Lm.set(e,t),jl(t,[e])}var _s=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=[],vr=0,Uc=0;function Os(){for(var e=vr,t=Uc=vr=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&&Bm(a,c,d)}}function Ds(e,t,a,r){xa[vr++]=e,xa[vr++]=t,xa[vr++]=a,xa[vr++]=r,Uc|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Lc(e,t,a,r){return Ds(e,t,a,r),Us(e)}function Cl(e,t){return Ds(e,null,null,t),Us(e)}function Bm(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 Us(e){if(50<Hi)throw Hi=0,Gu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var xr={};function gy(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 gy(e,t,a,r)}function Bc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function un(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 qm(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 Ls(e,t,a,r,c,d){var m=0;if(r=e,typeof e=="function")Bc(e)&&(m=1);else if(typeof e=="string")m=N0(e,a,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case J:return e=la(31,a,t,c),e.elementType=J,e.lanes=d,e;case E:return Tl(a.children,c,d,t);case U:m=8,c|=24;break;case z:return e=la(12,a,t,c|2),e.elementType=z,e.lanes=d,e;case Q:return e=la(13,a,t,c),e.elementType=Q,e.lanes=d,e;case F:return e=la(19,a,t,c),e.elementType=F,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L:m=10;break e;case H:m=9;break e;case $:m=11;break e;case B:m=14;break e;case Z: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 Tl(e,t,a,r){return e=la(7,e,r,t),e.lanes=a,e}function qc(e,t,a){return e=la(6,e,null,t),e.lanes=a,e}function Hm(e){var t=la(18,null,null,0);return t.stateNode=e,t}function Hc(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 $m=new WeakMap;function ga(e,t){if(typeof e=="object"&&e!==null){var a=$m.get(e);return a!==void 0?a:(t={value:e,source:t,stack:ea(t)},$m.set(e,t),t)}return{value:e,source:t,stack:ea(t)}}var gr=[],br=0,Bs=null,bi=0,ba=[],ya=0,$n=null,Ka=1,Ya="";function dn(e,t){gr[br++]=bi,gr[br++]=Bs,Bs=e,bi=t}function Qm(e,t,a){ba[ya++]=Ka,ba[ya++]=Ya,ba[ya++]=$n,$n=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 $c(e){e.return!==null&&(dn(e,1),Qm(e,1,0))}function Qc(e){for(;e===Bs;)Bs=gr[--br],gr[br]=null,bi=gr[--br],gr[br]=null;for(;e===$n;)$n=ba[--ya],ba[ya]=null,Ya=ba[--ya],ba[ya]=null,Ka=ba[--ya],ba[ya]=null}function Km(e,t){ba[ya++]=Ka,ba[ya++]=Ya,ba[ya++]=$n,Ka=t.id,Ya=t.overflow,$n=e}var Nt=null,Fe=null,_e=!1,Qn=null,Sa=!1,Kc=Error(s(519));function Kn(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yi(ga(t,e)),Kc}function Ym(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[ze]=e,t[ut]=r,a){case"dialog":Ae("cancel",t),Ae("close",t);break;case"iframe":case"object":case"embed":Ae("load",t);break;case"video":case"audio":for(a=0;a<Qi.length;a++)Ae(Qi[a],t);break;case"source":Ae("error",t);break;case"img":case"image":case"link":Ae("error",t),Ae("load",t);break;case"details":Ae("toggle",t);break;case"input":Ae("invalid",t),nm(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ae("invalid",t);break;case"textarea":Ae("invalid",t),rm(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||sv(t.textContent,a)?(r.popover!=null&&(Ae("beforetoggle",t),Ae("toggle",t)),r.onScroll!=null&&Ae("scroll",t),r.onScrollEnd!=null&&Ae("scrollend",t),r.onClick!=null&&(t.onclick=on),t=!0):t=!1,t||Kn(e,!0)}function Pm(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 yr(e){if(e!==Nt)return!1;if(!_e)return Pm(e),_e=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||sd(e.type,e.memoizedProps)),a=!a),a&&Fe&&Kn(e),Pm(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Fe=vv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Fe=vv(e)}else t===27?(t=Fe,nl(e.type)?(e=fd,fd=null,Fe=e):Fe=t):Fe=Nt?Na(e.stateNode.nextSibling):null;return!0}function Al(){Fe=Nt=null,_e=!1}function Yc(){var e=Qn;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),Qn=null),e}function yi(e){Qn===null?Qn=[e]:Qn.push(e)}var Pc=C(null),El=null,fn=null;function Yn(e,t,a){W(Pc,t._currentValue),t._currentValue=a}function mn(e){e._currentValue=Pc.current,P(Pc)}function Gc(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 Xc(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 g=d;d=c;for(var w=0;w<t.length;w++)if(g.context===t[w]){d.lanes|=a,g=d.alternate,g!==null&&(g.lanes|=a),Gc(d.return,a,e),r||(m=null);break e}d=g.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),Gc(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 Sr(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 g=c.type;na(c.pendingProps.value,m.value)||(e!==null?e.push(g):e=[g])}}else if(c===be.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&&Xc(t,e,a,r),t.flags|=262144}function qs(e){for(e=e.firstContext;e!==null;){if(!na(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function kl(e){El=e,fn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wt(e){return Gm(El,e)}function Hs(e,t){return El===null&&kl(e),Gm(e,t)}function Gm(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},fn===null){if(e===null)throw Error(s(308));fn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else fn=fn.next=t;return a}var by=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()})}},yy=n.unstable_scheduleCallback,Sy=n.unstable_NormalPriority,dt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vc(){return{controller:new by,data:new Map,refCount:0}}function Si(e){e.refCount--,e.refCount===0&&yy(Sy,function(){e.controller.abort()})}var ji=null,Fc=0,jr=0,Nr=null;function jy(e,t){if(ji===null){var a=ji=[];Fc=0,jr=Iu(),Nr={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Fc++,t.then(Xm,Xm),t}function Xm(){if(--Fc===0&&ji!==null){Nr!==null&&(Nr.status="fulfilled");var e=ji;ji=null,jr=0,Nr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ny(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 Vm=R.S;R.S=function(e,t){Rp=ct(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&jy(e,t),Vm!==null&&Vm(e,t)};var Rl=C(null);function Zc(){var e=Rl.current;return e!==null?e:Ve.pooledCache}function $s(e,t){t===null?W(Rl,Rl.current):W(Rl,t.pool)}function Fm(){var e=Zc();return e===null?null:{parent:dt._currentValue,pool:e}}var wr=Error(s(460)),Jc=Error(s(474)),Qs=Error(s(542)),Ks={then:function(){}};function Zm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Jm(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(on,on),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Wm(e),e;default:if(typeof t.status=="string")t.then(on,on);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,Wm(e),e}throw _l=t,wr}}function zl(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(_l=a,wr):a}}var _l=null;function Im(){if(_l===null)throw Error(s(459));var e=_l;return _l=null,e}function Wm(e){if(e===wr||e===Qs)throw Error(s(483))}var Mr=null,Ni=0;function Ys(e){var t=Ni;return Ni+=1,Mr===null&&(Mr=[]),Jm(Mr,e,t)}function wi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ps(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 eh(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=un(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 g(k,A,_,G){return A===null||A.tag!==6?(A=qc(_,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===Z&&zl(he)===A.type)?(A=c(A,_.props),wi(A,_),A.return=k,A):(A=Ls(_.type,_.key,_.props,null,k.mode,G),wi(A,_),A.return=k,A)}function O(k,A,_,G){return A===null||A.tag!==4||A.stateNode.containerInfo!==_.containerInfo||A.stateNode.implementation!==_.implementation?(A=Hc(_,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=Tl(_,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=qc(""+A,k.mode,_),A.return=k,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case N:return _=Ls(A.type,A.key,A.props,null,k.mode,_),wi(_,A),_.return=k,_;case T:return A=Hc(A,k.mode,_),A.return=k,A;case Z:return A=zl(A),V(k,A,_)}if(ie(A)||ce(A))return A=Tl(A,k.mode,_,null),A.return=k,A;if(typeof A.then=="function")return V(k,Ys(A),_);if(A.$$typeof===L)return V(k,Hs(k,A),_);Ps(k,A)}return null}function D(k,A,_,G){var he=A!==null?A.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return he!==null?null:g(k,A,""+_,G);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case N:return _.key===he?w(k,A,_,G):null;case T:return _.key===he?O(k,A,_,G):null;case Z:return _=zl(_),D(k,A,_,G)}if(ie(_)||ce(_))return he!==null?null:Y(k,A,_,G,null);if(typeof _.then=="function")return D(k,A,Ys(_),G);if(_.$$typeof===L)return D(k,A,Hs(k,_),G);Ps(k,_)}return null}function q(k,A,_,G,he){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return k=k.get(_)||null,g(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,O(A,k,G,he);case Z:return G=zl(G),q(k,A,_,G,he)}if(ie(G)||ce(G))return k=k.get(_)||null,Y(A,k,G,he,null);if(typeof G.then=="function")return q(k,A,_,Ys(G),he);if(G.$$typeof===L)return q(k,A,_,Hs(A,G),he);Ps(A,G)}return null}function oe(k,A,_,G){for(var he=null,Le=null,de=A,je=A=0,ke=null;de!==null&&je<_.length;je++){de.index>je?(ke=de,de=null):ke=de.sibling;var Be=D(k,de,_[je],G);if(Be===null){de===null&&(de=ke);break}e&&de&&Be.alternate===null&&t(k,de),A=d(Be,A,je),Le===null?he=Be:Le.sibling=Be,Le=Be,de=ke}if(je===_.length)return a(k,de),_e&&dn(k,je),he;if(de===null){for(;je<_.length;je++)de=V(k,_[je],G),de!==null&&(A=d(de,A,je),Le===null?he=de:Le.sibling=de,Le=de);return _e&&dn(k,je),he}for(de=r(de);je<_.length;je++)ke=q(de,k,je,_[je],G),ke!==null&&(e&&ke.alternate!==null&&de.delete(ke.key===null?je:ke.key),A=d(ke,A,je),Le===null?he=ke:Le.sibling=ke,Le=ke);return e&&de.forEach(function(ol){return t(k,ol)}),_e&&dn(k,je),he}function xe(k,A,_,G){if(_==null)throw Error(s(151));for(var he=null,Le=null,de=A,je=A=0,ke=null,Be=_.next();de!==null&&!Be.done;je++,Be=_.next()){de.index>je?(ke=de,de=null):ke=de.sibling;var ol=D(k,de,Be.value,G);if(ol===null){de===null&&(de=ke);break}e&&de&&ol.alternate===null&&t(k,de),A=d(ol,A,je),Le===null?he=ol:Le.sibling=ol,Le=ol,de=ke}if(Be.done)return a(k,de),_e&&dn(k,je),he;if(de===null){for(;!Be.done;je++,Be=_.next())Be=V(k,Be.value,G),Be!==null&&(A=d(Be,A,je),Le===null?he=Be:Le.sibling=Be,Le=Be);return _e&&dn(k,je),he}for(de=r(de);!Be.done;je++,Be=_.next())Be=q(de,k,je,Be.value,G),Be!==null&&(e&&Be.alternate!==null&&de.delete(Be.key===null?je:Be.key),A=d(Be,A,je),Le===null?he=Be:Le.sibling=Be,Le=Be);return e&&de.forEach(function(O0){return t(k,O0)}),_e&&dn(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===Z&&zl(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=Tl(_.props.children,k.mode,G,_.key),G.return=k,k=G):(G=Ls(_.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=Hc(_,k.mode,G),G.return=k,k=G}return m(k);case Z:return _=zl(_),Xe(k,A,_,G)}if(ie(_))return oe(k,A,_,G);if(ce(_)){if(he=ce(_),typeof he!="function")throw Error(s(150));return _=he.call(_),xe(k,A,_,G)}if(typeof _.then=="function")return Xe(k,A,Ys(_),G);if(_.$$typeof===L)return Xe(k,A,Hs(k,_),G);Ps(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=qc(_,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 Mr=null,he}catch(de){if(de===wr||de===Qs)throw de;var Le=la(29,de,null,k.mode);return Le.lanes=G,Le.return=k,Le}finally{}}}var Ol=eh(!0),th=eh(!1),Pn=!1;function Ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wc(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 Gn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Xn(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(qe&2)!==0){var c=r.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),r.pending=t,t=Us(e),Bm(e,null,a),t}return Ds(e,r,t,a),Us(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,ee(e,a)}}function eu(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 tu=!1;function Ci(){if(tu){var e=Nr;if(e!==null)throw e}}function Ti(e,t,a,r){tu=!1;var c=e.updateQueue;Pn=!1;var d=c.firstBaseUpdate,m=c.lastBaseUpdate,g=c.shared.pending;if(g!==null){c.shared.pending=null;var w=g,O=w.next;w.next=null,m===null?d=O:m.next=O,m=w;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,g=Y.lastBaseUpdate,g!==m&&(g===null?Y.firstBaseUpdate=O:g.next=O,Y.lastBaseUpdate=w))}if(d!==null){var V=c.baseState;m=0,Y=O=w=null,g=d;do{var D=g.lane&-536870913,q=D!==g.lane;if(q?(Ee&D)===D:(r&D)===D){D!==0&&D===jr&&(tu=!0),Y!==null&&(Y=Y.next={lane:0,tag:g.tag,payload:g.payload,callback:null,next:null});e:{var oe=e,xe=g;D=t;var Xe=a;switch(xe.tag){case 1:if(oe=xe.payload,typeof oe=="function"){V=oe.call(Xe,V,D);break e}V=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=xe.payload,D=typeof oe=="function"?oe.call(Xe,V,D):oe,D==null)break e;V=b({},V,D);break e;case 2:Pn=!0}}D=g.callback,D!==null&&(e.flags|=64,q&&(e.flags|=8192),q=c.callbacks,q===null?c.callbacks=[D]:q.push(D))}else q={lane:D,tag:g.tag,payload:g.payload,callback:g.callback,next:null},Y===null?(O=Y=q,w=V):Y=Y.next=q,m|=D;if(g=g.next,g===null){if(g=c.shared.pending,g===null)break;q=g,g=q.next,q.next=null,c.lastBaseUpdate=q,c.shared.pending=null}}while(!0);Y===null&&(w=V),c.baseState=w,c.firstBaseUpdate=O,c.lastBaseUpdate=Y,d===null&&(c.shared.lanes=0),In|=m,e.lanes=m,e.memoizedState=V}}function ah(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function nh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)ah(a[e],t)}var Cr=C(null),Gs=C(0);function lh(e,t){e=jn,W(Gs,e),W(Cr,t),jn=e|t.baseLanes}function au(){W(Gs,jn),W(Cr,Cr.current)}function nu(){jn=Gs.current,P(Cr),P(Gs)}var ra=C(null),ja=null;function Vn(e){var t=e.alternate;W(st,st.current&1),W(ra,e),ja===null&&(t===null||Cr.current!==null||t.memoizedState!==null)&&(ja=e)}function lu(e){W(st,st.current),W(ra,e),ja===null&&(ja=e)}function rh(e){e.tag===22?(W(st,st.current),W(ra,e),ja===null&&(ja=e)):Fn()}function Fn(){W(st,st.current),W(ra,ra.current)}function ia(e){P(ra),ja===e&&(ja=null),P(st)}var st=C(0);function Xs(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ud(a)||dd(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 hn=0,Se=null,Pe=null,ft=null,Vs=!1,Tr=!1,Dl=!1,Fs=0,Ai=0,Ar=null,wy=0;function at(){throw Error(s(321))}function ru(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 iu(e,t,a,r,c,d){return hn=d,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?Qh:Su,Dl=!1,d=a(r,c),Dl=!1,Tr&&(d=sh(t,a,r,c)),ih(e),d}function ih(e){R.H=Ri;var t=Pe!==null&&Pe.next!==null;if(hn=0,ft=Pe=Se=null,Vs=!1,Ai=0,Ar=null,t)throw Error(s(300));e===null||mt||(e=e.dependencies,e!==null&&qs(e)&&(mt=!0))}function sh(e,t,a,r){Se=e;var c=0;do{if(Tr&&(Ar=null),Ai=0,Tr=!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=Kh,d=t(a,r)}while(Tr);return d}function My(){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 su(){var e=Fs!==0;return Fs=0,e}function ou(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function cu(e){if(Vs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Vs=!1}hn=0,ft=Pe=Se=null,Tr=!1,Ai=Fs=0,Ar=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 Zs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ei(e){var t=Ai;return Ai+=1,Ar===null&&(Ar=[]),e=Jm(Ar,e,t),t=Se,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?Qh:Su),e}function Js(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ei(e);if(e.$$typeof===L)return wt(e)}throw Error(s(438,String(e)))}function uu(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=Zs(),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]=ae;return t.index++,a}function pn(e,t){return typeof t=="function"?t(e):t}function Is(e){var t=ot();return du(t,Pe,e)}function du(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 g=m=null,w=null,O=t,Y=!1;do{var V=O.lane&-536870913;if(V!==O.lane?(Ee&V)===V:(hn&V)===V){var D=O.revertLane;if(D===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null}),V===jr&&(Y=!0);else if((hn&D)===D){O=O.next,D===jr&&(Y=!0);continue}else V={lane:0,revertLane:O.revertLane,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},w===null?(g=w=V,m=d):w=w.next=V,Se.lanes|=D,In|=D;V=O.action,Dl&&a(d,V),d=O.hasEagerState?O.eagerState:a(d,V)}else D={lane:V,revertLane:O.revertLane,gesture:O.gesture,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},w===null?(g=w=D,m=d):w=w.next=D,Se.lanes|=V,In|=V;O=O.next}while(O!==null&&O!==t);if(w===null?m=d:w.next=g,!na(d,e.memoizedState)&&(mt=!0,Y&&(a=Nr,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 fu(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 oh(e,t,a){var r=Se,c=ot(),d=_e;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,pu(dh.bind(null,r,c,e),[e]),c.getSnapshot!==t||m||ft!==null&&ft.memoizedState.tag&1){if(r.flags|=2048,Er(9,{destroy:void 0},uh.bind(null,r,c,a,t),null),Ve===null)throw Error(s(349));d||(hn&127)!==0||ch(r,t,a)}return a}function ch(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Se.updateQueue,t===null?(t=Zs(),Se.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function uh(e,t,a,r){t.value=a,t.getSnapshot=r,fh(t)&&mh(e)}function dh(e,t,a){return a(function(){fh(t)&&mh(e)})}function fh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!na(e,a)}catch{return!0}}function mh(e){var t=Cl(e,2);t!==null&&Ft(t,e,2)}function mu(e){var t=Lt();if(typeof e=="function"){var a=e;if(e=a(),Dl){ha(!0);try{a()}finally{ha(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pn,lastRenderedState:e},t}function hh(e,t,a,r){return e.baseState=a,du(e,Pe,typeof r=="function"?r:pn)}function Cy(e,t,a,r,c){if(to(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,ph(t,d)):(d.next=a.next,t.pending=a.next=d)}}function ph(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 g=a(c,r),w=R.S;w!==null&&w(m,g),vh(e,t,g)}catch(O){hu(e,t,O)}finally{d!==null&&m.types!==null&&(d.types=m.types),R.T=d}}else try{d=a(c,r),vh(e,t,d)}catch(O){hu(e,t,O)}}function vh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){xh(e,t,r)},function(r){return hu(e,t,r)}):xh(e,t,a)}function xh(e,t,a){t.status="fulfilled",t.value=a,gh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,ph(e,a)))}function hu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,gh(t),t=t.next;while(t!==r)}e.action=null}function gh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function bh(e,t){return t}function yh(e,t){if(_e){var a=Ve.formState;if(a!==null){e:{var r=Se;if(_e){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}}Kn(r)}r=!1}r&&(t=a[0])}}return a=Lt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bh,lastRenderedState:t},a.queue=r,a=qh.bind(null,Se,r),r.dispatch=a,r=mu(!1),d=yu.bind(null,Se,!1,r.queue),r=Lt(),c={state:t,dispatch:null,action:e,pending:null},r.queue=c,a=Cy.bind(null,Se,c,d,a),c.dispatch=a,r.memoizedState=e,[t,a,!1]}function Sh(e){var t=ot();return jh(t,Pe,e)}function jh(e,t,a){if(t=du(e,t,bh)[0],e=Is(pn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Ei(t)}catch(m){throw m===wr?Qs:m}else r=t;t=ot();var c=t.queue,d=c.dispatch;return a!==t.memoizedState&&(Se.flags|=2048,Er(9,{destroy:void 0},Ty.bind(null,c,a),null)),[r,d,e]}function Ty(e,t){e.action=t}function Nh(e){var t=ot(),a=Pe;if(a!==null)return jh(t,a,e);ot(),t=t.memoizedState,a=ot();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function Er(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=Se.updateQueue,t===null&&(t=Zs(),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 wh(){return ot().memoizedState}function Ws(e,t,a,r){var c=Lt();Se.flags|=e,c.memoizedState=Er(1|t,{destroy:void 0},a,r===void 0?null:r)}function eo(e,t,a,r){var c=ot();r=r===void 0?null:r;var d=c.memoizedState.inst;Pe!==null&&r!==null&&ru(r,Pe.memoizedState.deps)?c.memoizedState=Er(t,d,a,r):(Se.flags|=e,c.memoizedState=Er(1|t,d,a,r))}function Mh(e,t){Ws(8390656,8,e,t)}function pu(e,t){eo(2048,8,e,t)}function Ay(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=Zs(),Se.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Ch(e){var t=ot().memoizedState;return Ay({ref:t,nextImpl:e}),function(){if((qe&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Th(e,t){return eo(4,2,e,t)}function Ah(e,t){return eo(4,4,e,t)}function Eh(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 kh(e,t,a){a=a!=null?a.concat([e]):null,eo(4,4,Eh.bind(null,t,e),a)}function vu(){}function Rh(e,t){var a=ot();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&ru(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function zh(e,t){var a=ot();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&ru(t,r[1]))return r[0];if(r=e(),Dl){ha(!0);try{e()}finally{ha(!1)}}return a.memoizedState=[r,t],r}function xu(e,t,a){return a===void 0||(hn&1073741824)!==0&&(Ee&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=_p(),Se.lanes|=e,In|=e,a)}function _h(e,t,a,r){return na(a,t)?a:Cr.current!==null?(e=xu(e,a,r),na(e,t)||(mt=!0),e):(hn&42)===0||(hn&1073741824)!==0&&(Ee&261930)===0?(mt=!0,e.memoizedState=a):(e=_p(),Se.lanes|=e,In|=e,t)}function Oh(e,t,a,r,c){var d=X.p;X.p=d!==0&&8>d?d:8;var m=R.T,g={};R.T=g,yu(e,!1,t,a);try{var w=c(),O=R.S;if(O!==null&&O(g,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var Y=Ny(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&&g.types!==null&&(m.types=g.types),R.T=m}}function Ey(){}function gu(e,t,a,r){if(e.tag!==5)throw Error(s(476));var c=Dh(e).queue;Oh(e,c,t,se,a===null?Ey:function(){return Uh(e),a(r)})}function Dh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pn,lastRenderedState:se},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Uh(e){var t=Dh(e);t.next===null&&(t=e.alternate.memoizedState),ki(e,t.next.queue,{},ca())}function bu(){return wt(Xi)}function Lh(){return ot().memoizedState}function Bh(){return ot().memoizedState}function ky(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=ca();e=Gn(a);var r=Xn(t,e,a);r!==null&&(Ft(r,t,a),Mi(r,t,a)),t={cache:Vc()},e.payload=t;return}t=t.return}}function Ry(e,t,a){var r=ca();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},to(e)?Hh(t,a):(a=Lc(e,t,a,r),a!==null&&(Ft(a,e,r),$h(a,t,r)))}function qh(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(to(e))Hh(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,g=d(m,a);if(c.hasEagerState=!0,c.eagerState=g,na(g,m))return Ds(e,t,c,0),Ve===null&&Os(),!1}catch{}finally{}if(a=Lc(e,t,c,r),a!==null)return Ft(a,e,r),$h(a,t,r),!0}return!1}function yu(e,t,a,r){if(r={lane:2,revertLane:Iu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},to(e)){if(t)throw Error(s(479))}else t=Lc(e,a,r,2),t!==null&&Ft(t,e,2)}function to(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Hh(e,t){Tr=Vs=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function $h(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,ee(e,a)}}var Ri={readContext:wt,use:Js,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 Qh={readContext:wt,use:Js,useCallback:function(e,t){return Lt().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:Mh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ws(4194308,4,Eh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ws(4194308,4,e,t)},useInsertionEffect:function(e,t){Ws(4,2,e,t)},useMemo:function(e,t){var a=Lt();t=t===void 0?null:t;var r=e();if(Dl){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(Dl){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=Ry.bind(null,Se,e),[r.memoizedState,e]},useRef:function(e){var t=Lt();return e={current:e},t.memoizedState=e},useState:function(e){e=mu(e);var t=e.queue,a=qh.bind(null,Se,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:vu,useDeferredValue:function(e,t){var a=Lt();return xu(a,e,t)},useTransition:function(){var e=mu(!1);return e=Oh.bind(null,Se,e.queue,!0,!1),Lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=Se,c=Lt();if(_e){if(a===void 0)throw Error(s(407));a=a()}else{if(a=t(),Ve===null)throw Error(s(349));(Ee&127)!==0||ch(r,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,Mh(dh.bind(null,r,d,e),[e]),r.flags|=2048,Er(9,{destroy:void 0},uh.bind(null,r,d,a,t),null),a},useId:function(){var e=Lt(),t=Ve.identifierPrefix;if(_e){var a=Ya,r=Ka;a=(r&~(1<<32-jt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Fs++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=wy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:bu,useFormState:yh,useActionState:yh,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=yu.bind(null,Se,!0,a),a.dispatch=t,[e,t]},useMemoCache:uu,useCacheRefresh:function(){return Lt().memoizedState=ky.bind(null,Se)},useEffectEvent:function(e){var t=Lt(),a={impl:e};return t.memoizedState=a,function(){if((qe&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Su={readContext:wt,use:Js,useCallback:Rh,useContext:wt,useEffect:pu,useImperativeHandle:kh,useInsertionEffect:Th,useLayoutEffect:Ah,useMemo:zh,useReducer:Is,useRef:wh,useState:function(){return Is(pn)},useDebugValue:vu,useDeferredValue:function(e,t){var a=ot();return _h(a,Pe.memoizedState,e,t)},useTransition:function(){var e=Is(pn)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:Ei(e),t]},useSyncExternalStore:oh,useId:Lh,useHostTransitionStatus:bu,useFormState:Sh,useActionState:Sh,useOptimistic:function(e,t){var a=ot();return hh(a,Pe,e,t)},useMemoCache:uu,useCacheRefresh:Bh};Su.useEffectEvent=Ch;var Kh={readContext:wt,use:Js,useCallback:Rh,useContext:wt,useEffect:pu,useImperativeHandle:kh,useInsertionEffect:Th,useLayoutEffect:Ah,useMemo:zh,useReducer:fu,useRef:wh,useState:function(){return fu(pn)},useDebugValue:vu,useDeferredValue:function(e,t){var a=ot();return Pe===null?xu(a,e,t):_h(a,Pe.memoizedState,e,t)},useTransition:function(){var e=fu(pn)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:Ei(e),t]},useSyncExternalStore:oh,useId:Lh,useHostTransitionStatus:bu,useFormState:Nh,useActionState:Nh,useOptimistic:function(e,t){var a=ot();return Pe!==null?hh(a,Pe,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:uu,useCacheRefresh:Bh};Kh.useEffectEvent=Ch;function ju(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Nu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=ca(),c=Gn(r);c.payload=t,a!=null&&(c.callback=a),t=Xn(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=Gn(r);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=Xn(e,c,r),t!==null&&(Ft(t,e,r),Mi(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=ca(),r=Gn(a);r.tag=2,t!=null&&(r.callback=t),t=Xn(e,r,a),t!==null&&(Ft(t,e,a),Mi(t,e,a))}};function Yh(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 Ph(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&&Nu.enqueueReplaceState(t,t.state,null)}function Ul(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=b({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}function Gh(e){_s(e)}function Xh(e){console.error(e)}function Vh(e){_s(e)}function ao(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Fh(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 wu(e,t,a){return a=Gn(a),a.tag=3,a.payload={element:null},a.callback=function(){ao(e,t)},a}function Zh(e){return e=Gn(e),e.tag=3,e}function Jh(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(){Fh(t,a,r)}}var m=a.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){Fh(t,a,r),typeof c!="function"&&(Wn===null?Wn=new Set([this]):Wn.add(this));var g=r.stack;this.componentDidCatch(r.value,{componentStack:g!==null?g:""})})}function zy(e,t,a,r,c){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&Sr(t,a,c,!0),a=ra.current,a!==null){switch(a.tag){case 31:case 13:return ja===null?po():a.alternate===null&&nt===0&&(nt=3),a.flags&=-257,a.flags|=65536,a.lanes=c,r===Ks?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),Fu(e,r,c)),!1;case 22:return a.flags|=65536,r===Ks?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)),Fu(e,r,c)),!1}throw Error(s(435,a.tag))}return Fu(e,r,c),po(),!1}if(_e)return t=ra.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,r!==Kc&&(e=Error(s(422),{cause:r}),yi(ga(e,a)))):(r!==Kc&&(t=Error(s(423),{cause:r}),yi(ga(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,r=ga(r,a),c=wu(e.stateNode,r,c),eu(e,c),nt!==4&&(nt=2)),!1;var d=Error(s(520),{cause:r});if(d=ga(d,a),qi===null?qi=[d]:qi.push(d),nt!==4&&(nt=2),t===null)return!0;r=ga(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=wu(a.stateNode,r,e),eu(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"&&(Wn===null||!Wn.has(d))))return a.flags|=65536,c&=-c,a.lanes|=c,c=Zh(c),Jh(c,e,a,r),eu(a,c),!1}a=a.return}while(a!==null);return!1}var Mu=Error(s(461)),mt=!1;function Mt(e,t,a,r){t.child=e===null?th(t,null,a,r):Ol(t,e.child,a,r)}function Ih(e,t,a,r,c){a=a.render;var d=t.ref;if("ref"in r){var m={};for(var g in r)g!=="ref"&&(m[g]=r[g])}else m=r;return kl(t),r=iu(e,t,a,m,d,c),g=su(),e!==null&&!mt?(ou(e,t,c),vn(e,t,c)):(_e&&g&&$c(t),t.flags|=1,Mt(e,t,r,c),t.child)}function Wh(e,t,a,r,c){if(e===null){var d=a.type;return typeof d=="function"&&!Bc(d)&&d.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=d,ep(e,t,d,r,c)):(e=Ls(a.type,null,r,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!_u(e,c)){var m=d.memoizedProps;if(a=a.compare,a=a!==null?a:xi,a(m,r)&&e.ref===t.ref)return vn(e,t,c)}return t.flags|=1,e=un(d,r),e.ref=t.ref,e.return=t,t.child=e}function ep(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,_u(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,vn(e,t,c)}return Cu(e,t,a,r,c)}function tp(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 ap(e,t,d,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$s(t,d!==null?d.cachePool:null),d!==null?lh(t,d):au(),rh(t);else return r=t.lanes=536870912,ap(e,t,d!==null?d.baseLanes|a:a,a,r)}else d!==null?($s(t,d.cachePool),lh(t,d),Fn(),t.memoizedState=null):(e!==null&&$s(t,null),au(),Fn());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 ap(e,t,a,r,c){var d=Zc();return d=d===null?null:{parent:dt._currentValue,pool:d},t.memoizedState={baseLanes:a,cachePool:d},e!==null&&$s(t,null),au(),rh(t),e!==null&&Sr(e,t,r,!0),t.childLanes=c,null}function no(e,t){return t=ro({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function np(e,t,a){return Ol(t,e.child,null,a),e=no(t,t.pendingProps),e.flags|=2,ia(t),t.memoizedState=null,e}function _y(e,t,a){var r=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(_e){if(r.mode==="hidden")return e=no(t,r),t.lanes=536870912,zi(null,e);if(lu(t),(e=Fe)?(e=pv(e,Sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$n!==null?{id:Ka,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},a=Hm(e),a.return=t,t.child=a,Nt=t,Fe=null)):e=null,e===null)throw Kn(t);return t.lanes=536870912,null}return no(t,r)}var d=e.memoizedState;if(d!==null){var m=d.dehydrated;if(lu(t),c)if(t.flags&256)t.flags&=-257,t=np(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||Sr(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,Cl(e,m),Ft(r,e,m),Mu;po(),t=np(e,t,a)}else e=d.treeContext,Fe=Na(m.nextSibling),Nt=t,_e=!0,Qn=null,Sa=!1,e!==null&&Km(t,e),t=no(t,r),t.flags|=4096;return t}return e=un(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lo(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 Cu(e,t,a,r,c){return kl(t),a=iu(e,t,a,r,void 0,c),r=su(),e!==null&&!mt?(ou(e,t,c),vn(e,t,c)):(_e&&r&&$c(t),t.flags|=1,Mt(e,t,a,c),t.child)}function lp(e,t,a,r,c,d){return kl(t),t.updateQueue=null,a=sh(t,r,a,c),ih(e),r=su(),e!==null&&!mt?(ou(e,t,d),vn(e,t,d)):(_e&&r&&$c(t),t.flags|=1,Mt(e,t,a,d),t.child)}function rp(e,t,a,r,c){if(kl(t),t.stateNode===null){var d=xr,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=Nu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=r,d.state=t.memoizedState,d.refs={},Ic(t),m=a.contextType,d.context=typeof m=="object"&&m!==null?wt(m):xr,d.state=t.memoizedState,m=a.getDerivedStateFromProps,typeof m=="function"&&(ju(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&&Nu.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 g=t.memoizedProps,w=Ul(a,g);d.props=w;var O=d.context,Y=a.contextType;m=xr,typeof Y=="object"&&Y!==null&&(m=wt(Y));var V=a.getDerivedStateFromProps;Y=typeof V=="function"||typeof d.getSnapshotBeforeUpdate=="function",g=t.pendingProps!==g,Y||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g||O!==m)&&Ph(t,d,r,m),Pn=!1;var D=t.memoizedState;d.state=D,Ti(t,r,d,c),Ci(),O=t.memoizedState,g||D!==O||Pn?(typeof V=="function"&&(ju(t,a,V,r),O=t.memoizedState),(w=Pn||Yh(t,a,w,r,D,O,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=O),d.props=r,d.state=O,d.context=m,r=w):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{d=t.stateNode,Wc(e,t),m=t.memoizedProps,Y=Ul(a,m),d.props=Y,V=t.pendingProps,D=d.context,O=a.contextType,w=xr,typeof O=="object"&&O!==null&&(w=wt(O)),g=a.getDerivedStateFromProps,(O=typeof g=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(m!==V||D!==w)&&Ph(t,d,r,w),Pn=!1,D=t.memoizedState,d.state=D,Ti(t,r,d,c),Ci();var q=t.memoizedState;m!==V||D!==q||Pn||e!==null&&e.dependencies!==null&&qs(e.dependencies)?(typeof g=="function"&&(ju(t,a,g,r),q=t.memoizedState),(Y=Pn||Yh(t,a,Y,r,D,q,w)||e!==null&&e.dependencies!==null&&qs(e.dependencies))?(O||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(r,q,w),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(r,q,w)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&D===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&D===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=q),d.props=r,d.state=q,d.context=w,r=Y):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&D===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&D===e.memoizedState||(t.flags|=1024),r=!1)}return d=r,lo(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=Ol(t,e.child,null,c),t.child=Ol(t,null,a,c)):Mt(e,t,a,c),t.memoizedState=d.state,e=t.child):e=vn(e,t,c),e}function ip(e,t,a,r){return Al(),t.flags|=256,Mt(e,t,a,r),t.child}var Tu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Au(e){return{baseLanes:e,cachePool:Fm()}}function Eu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=oa),e}function sp(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(_e){if(c?Vn(t):Fn(),(e=Fe)?(e=pv(e,Sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$n!==null?{id:Ka,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},a=Hm(e),a.return=t,t.child=a,Nt=t,Fe=null)):e=null,e===null)throw Kn(t);return dd(e)?t.lanes=32:t.lanes=536870912,null}var g=r.children;return r=r.fallback,c?(Fn(),c=t.mode,g=ro({mode:"hidden",children:g},c),r=Tl(r,c,a,null),g.return=t,r.return=t,g.sibling=r,t.child=g,r=t.child,r.memoizedState=Au(a),r.childLanes=Eu(e,m,a),t.memoizedState=Tu,zi(null,r)):(Vn(t),ku(t,g))}var w=e.memoizedState;if(w!==null&&(g=w.dehydrated,g!==null)){if(d)t.flags&256?(Vn(t),t.flags&=-257,t=Ru(e,t,a)):t.memoizedState!==null?(Fn(),t.child=e.child,t.flags|=128,t=null):(Fn(),g=r.fallback,c=t.mode,r=ro({mode:"visible",children:r.children},c),g=Tl(g,c,a,null),g.flags|=2,r.return=t,g.return=t,r.sibling=g,t.child=r,Ol(t,e.child,null,a),r=t.child,r.memoizedState=Au(a),r.childLanes=Eu(e,m,a),t.memoizedState=Tu,t=zi(null,r));else if(Vn(t),dd(g)){if(m=g.nextSibling&&g.nextSibling.dataset,m)var O=m.dgst;m=O,r=Error(s(419)),r.stack="",r.digest=m,yi({value:r,source:null,stack:null}),t=Ru(e,t,a)}else if(mt||Sr(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,Cl(e,r),Ft(m,e,r),Mu;ud(g)||po(),t=Ru(e,t,a)}else ud(g)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,Fe=Na(g.nextSibling),Nt=t,_e=!0,Qn=null,Sa=!1,e!==null&&Km(t,e),t=ku(t,r.children),t.flags|=4096);return t}return c?(Fn(),g=r.fallback,c=t.mode,w=e.child,O=w.sibling,r=un(w,{mode:"hidden",children:r.children}),r.subtreeFlags=w.subtreeFlags&65011712,O!==null?g=un(O,g):(g=Tl(g,c,a,null),g.flags|=2),g.return=t,r.return=t,r.sibling=g,t.child=r,zi(null,r),r=t.child,g=e.child.memoizedState,g===null?g=Au(a):(c=g.cachePool,c!==null?(w=dt._currentValue,c=c.parent!==w?{parent:w,pool:w}:c):c=Fm(),g={baseLanes:g.baseLanes|a,cachePool:c}),r.memoizedState=g,r.childLanes=Eu(e,m,a),t.memoizedState=Tu,zi(e.child,r)):(Vn(t),a=e.child,e=a.sibling,a=un(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 ku(e,t){return t=ro({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ro(e,t){return e=la(22,e,null,t),e.lanes=0,e}function Ru(e,t,a){return Ol(t,e.child,null,a),e=ku(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function op(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gc(e.return,t,a)}function zu(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 cp(e,t,a){var r=t.pendingProps,c=r.revealOrder,d=r.tail;r=r.children;var m=st.current,g=(m&2)!==0;if(g?(m=m&1|2,t.flags|=128):m&=1,W(st,m),Mt(e,t,r,a),r=_e?bi:0,!g&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&op(e,a,t);else if(e.tag===19)op(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&&Xs(e)===null&&(c=a),a=a.sibling;a=c,a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),zu(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&&Xs(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}zu(t,!0,a,null,d,r);break;case"together":zu(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function vn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),In|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Sr(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=un(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=un(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function _u(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&qs(e)))}function Oy(e,t,a){switch(t.tag){case 3:Ue(t,t.stateNode.containerInfo),Yn(t,dt,e.memoizedState.cache),Al();break;case 27:case 5:_t(t);break;case 4:Ue(t,t.stateNode.containerInfo);break;case 10:Yn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,lu(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Vn(t),t.flags|=128,null):(a&t.child.childLanes)!==0?sp(e,t,a):(Vn(t),e=vn(e,t,a),e!==null?e.sibling:null);Vn(t);break;case 19:var c=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(Sr(e,t,a,!1),r=(a&t.childLanes)!==0),c){if(r)return cp(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),W(st,st.current),r)break;return null;case 22:return t.lanes=0,tp(e,t,a,t.pendingProps);case 24:Yn(t,dt,e.memoizedState.cache)}return vn(e,t,a)}function up(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!_u(e,a)&&(t.flags&128)===0)return mt=!1,Oy(e,t,a);mt=(e.flags&131072)!==0}else mt=!1,_e&&(t.flags&1048576)!==0&&Qm(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=zl(t.elementType),t.type=e,typeof e=="function")Bc(e)?(r=Ul(e,r),t.tag=1,t=rp(null,t,e,r,a)):(t.tag=0,t=Cu(null,t,e,r,a));else{if(e!=null){var c=e.$$typeof;if(c===$){t.tag=11,t=Ih(null,t,e,r,a);break e}else if(c===B){t.tag=14,t=Wh(null,t,e,r,a);break e}}throw t=pe(e)||e,Error(s(306,t,""))}}return t;case 0:return Cu(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,c=Ul(r,t.pendingProps),rp(e,t,r,c,a);case 3:e:{if(Ue(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var d=t.memoizedState;c=d.element,Wc(e,t),Ti(t,r,null,a);var m=t.memoizedState;if(r=m.cache,Yn(t,dt,r),r!==d.cache&&Xc(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=ip(e,t,r,a);break e}else if(r!==c){c=ga(Error(s(424)),t),yi(c),t=ip(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,_e=!0,Qn=null,Sa=!0,a=th(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Al(),r===c){t=vn(e,t,a);break e}Mt(e,t,r,a)}t=t.child}return t;case 26:return lo(e,t),e===null?(a=Sv(t.type,null,t.pendingProps,null))?t.memoizedState=a:_e||(a=t.type,e=t.pendingProps,r=jo(ge.current).createElement(a),r[ze]=t,r[ut]=e,Ct(r,a,e),bt(r),t.stateNode=r):t.memoizedState=Sv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _t(t),e===null&&_e&&(r=t.stateNode=gv(t.type,t.pendingProps,ge.current),Nt=t,Sa=!0,c=Fe,nl(t.type)?(fd=c,Fe=Na(r.firstChild)):Fe=c),Mt(e,t,t.pendingProps.children,a),lo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&_e&&((c=r=Fe)&&(r=u0(r,t.type,t.pendingProps,Sa),r!==null?(t.stateNode=r,Nt=t,Fe=Na(r.firstChild),Sa=!1,c=!0):c=!1),c||Kn(t)),_t(t),c=t.type,d=t.pendingProps,m=e!==null?e.memoizedProps:null,r=d.children,sd(c,d)?r=null:m!==null&&sd(c,m)&&(t.flags|=32),t.memoizedState!==null&&(c=iu(e,t,My,null,null,a),Xi._currentValue=c),lo(e,t),Mt(e,t,r,a),t.child;case 6:return e===null&&_e&&((e=a=Fe)&&(a=d0(a,t.pendingProps,Sa),a!==null?(t.stateNode=a,Nt=t,Fe=null,e=!0):e=!1),e||Kn(t)),null;case 13:return sp(e,t,a);case 4:return Ue(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ol(t,null,r,a):Mt(e,t,r,a),t.child;case 11:return Ih(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,Yn(t,t.type,r.value),Mt(e,t,r.children,a),t.child;case 9:return c=t.type._context,r=t.pendingProps.children,kl(t),c=wt(c),r=r(c),t.flags|=1,Mt(e,t,r,a),t.child;case 14:return Wh(e,t,t.type,t.pendingProps,a);case 15:return ep(e,t,t.type,t.pendingProps,a);case 19:return cp(e,t,a);case 31:return _y(e,t,a);case 22:return tp(e,t,a,t.pendingProps);case 24:return kl(t),r=wt(dt),e===null?(c=Zc(),c===null&&(c=Ve,d=Vc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=a),c=d),t.memoizedState={parent:r,cache:c},Ic(t),Yn(t,dt,c)):((e.lanes&a)!==0&&(Wc(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),Yn(t,dt,r)):(r=d.cache,Yn(t,dt,r),r!==c.cache&&Xc(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 xn(e){e.flags|=4}function Ou(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(Lp())e.flags|=8192;else throw _l=Ks,Jc}else e.flags&=-16777217}function dp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Cv(t))if(Lp())e.flags|=8192;else throw _l=Ks,Jc}function io(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?qn():536870912,e.lanes|=t,_r|=t)}function _i(e,t){if(!_e)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 Dy(e,t,a){var r=t.pendingProps;switch(Qc(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),mn(dt),Re(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(yr(t)?xn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Yc())),Ze(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(xn(t),d!==null?(Ze(t),dp(t,d)):(Ze(t),Ou(t,c,null,r,a))):d?d!==e.memoizedState?(xn(t),Ze(t),dp(t,d)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&xn(t),Ze(t),Ou(t,c,e,r,a)),null;case 27:if(gt(t),a=ge.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&xn(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}e=te.current,yr(t)?Ym(t):(e=gv(c,r,a),t.stateNode=e,xn(t))}return Ze(t),null;case 5:if(gt(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&xn(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}if(d=te.current,yr(t))Ym(t);else{var m=jo(ge.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[ze]=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&&xn(t)}}return Ze(t),Ou(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&xn(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(s(166));if(e=ge.current,yr(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[ze]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||sv(e.nodeValue,a)),e||Kn(t,!0)}else e=jo(e).createTextNode(r),e[ze]=t,t.stateNode=e}return Ze(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=yr(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[ze]=t}else Al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else a=Yc(),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=yr(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[ze]=t}else Al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),c=!1}else c=Yc(),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),io(t,t.updateQueue),Ze(t),null);case 4:return Re(),e===null&&ad(t.stateNode.containerInfo),Ze(t),null;case 10:return mn(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=Xs(e),d!==null){for(t.flags|=128,_i(r,!1),e=d.updateQueue,t.updateQueue=e,io(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)qm(a,e),a=a.sibling;return W(st,st.current&1|2),_e&&dn(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ct()>fo&&(t.flags|=128,c=!0,_i(r,!1),t.lanes=4194304)}else{if(!c)if(e=Xs(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,io(t,e),_i(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!_e)return Ze(t),null}else 2*ct()-r.renderingStartTime>fo&&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,W(st,c?a&1|2:a&1),_e&&dn(t,r.treeForkCount),e):(Ze(t),null);case 22:case 23:return ia(t),nu(),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&&io(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(Rl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),mn(dt),Ze(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Uy(e,t){switch(Qc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mn(dt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return gt(t),null;case 31:if(t.memoizedState!==null){if(ia(t),t.alternate===null)throw Error(s(340));Al()}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));Al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(st),null;case 4:return Re(),null;case 10:return mn(t.type),null;case 22:case 23:return ia(t),nu(),e!==null&&P(Rl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return mn(dt),null;case 25:return null;default:return null}}function fp(e,t){switch(Qc(t),t.tag){case 3:mn(dt),Re();break;case 26:case 27:case 5:gt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&ia(t);break;case 13:ia(t);break;case 19:P(st);break;case 10:mn(t.type);break;case 22:case 23:ia(t),nu(),e!==null&&P(Rl);break;case 24:mn(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(g){Ye(t,t.return,g)}}function Zn(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,g=m.destroy;if(g!==void 0){m.destroy=void 0,c=t;var w=a,O=g;try{O()}catch(Y){Ye(c,w,Y)}}}r=r.next}while(r!==d)}}catch(Y){Ye(t,t.return,Y)}}function mp(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{nh(t,a)}catch(r){Ye(e,e.return,r)}}}function hp(e,t,a){a.props=Ul(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 pp(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 Du(e,t,a){try{var r=e.stateNode;l0(r,e.type,a,t),r[ut]=t}catch(c){Ye(e,e.return,c)}}function vp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&nl(e.type)||e.tag===4}function Uu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vp(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&&nl(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 Lu(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=on));else if(r!==4&&(r===27&&nl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Lu(e,t,a),e=e.sibling;e!==null;)Lu(e,t,a),e=e.sibling}function so(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&&nl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(so(e,t,a),e=e.sibling;e!==null;)so(e,t,a),e=e.sibling}function xp(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[ze]=e,t[ut]=a}catch(d){Ye(e,e.return,d)}}var gn=!1,ht=!1,Bu=!1,gp=typeof WeakSet=="function"?WeakSet:Set,yt=null;function Ly(e,t){if(e=e.containerInfo,rd=Eo,e=km(e),Rc(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,g=-1,w=-1,O=0,Y=0,V=e,D=null;t:for(;;){for(var q;V!==a||c!==0&&V.nodeType!==3||(g=m+c),V!==d||r!==0&&V.nodeType!==3||(w=m+r),V.nodeType===3&&(m+=V.nodeValue.length),(q=V.firstChild)!==null;)D=V,V=q;for(;;){if(V===e)break t;if(D===a&&++O===c&&(g=m),D===d&&++Y===r&&(w=m),(q=V.nextSibling)!==null)break;V=D,D=V.parentNode}V=q}a=g===-1||w===-1?null:{start:g,end:w}}else a=null}a=a||{start:0,end:0}}else a=null;for(id={focusedElem:e,selectionRange:a},Eo=!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 oe=Ul(a.type,c);e=r.getSnapshotBeforeUpdate(oe,d),r.__reactInternalSnapshotBeforeUpdate=e}catch(xe){Ye(a,a.return,xe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)cd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":cd(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 bp(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:yn(e,a),r&4&&Oi(5,a);break;case 1:if(yn(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(m){Ye(a,a.return,m)}else{var c=Ul(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){Ye(a,a.return,m)}}r&64&&mp(a),r&512&&Di(a,a.return);break;case 3:if(yn(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{nh(e,t)}catch(m){Ye(a,a.return,m)}}break;case 27:t===null&&r&4&&xp(a);case 26:case 5:yn(e,a),t===null&&r&4&&pp(a),r&512&&Di(a,a.return);break;case 12:yn(e,a);break;case 31:yn(e,a),r&4&&jp(e,a);break;case 13:yn(e,a),r&4&&Np(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Gy.bind(null,a),f0(e,a))));break;case 22:if(r=a.memoizedState!==null||gn,!r){t=t!==null&&t.memoizedState!==null||ht,c=gn;var d=ht;gn=r,(ht=t)&&!d?Sn(e,a,(a.subtreeFlags&8772)!==0):yn(e,a),gn=c,ht=d}break;case 30:break;default:yn(e,a)}}function yp(e){var t=e.alternate;t!==null&&(e.alternate=null,yp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&hc(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;)Sp(e,t,a),a=a.sibling}function Sp(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;nl(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,mv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),$r(e)):mv(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:Zn(2,a,t),ht||Zn(4,a,t),bn(e,t,a);break;case 1:ht||(Pa(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&hp(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 jp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{$r(e)}catch(a){Ye(t,t.return,a)}}}function Np(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{$r(e)}catch(a){Ye(t,t.return,a)}}function By(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new gp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new gp),t;default:throw Error(s(435,e.tag))}}function oo(e,t){var a=By(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var c=Xy.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,g=m;e:for(;g!==null;){switch(g.tag){case 27:if(nl(g.type)){Je=g.stateNode,Pt=!1;break e}break;case 5:Je=g.stateNode,Pt=!1;break e;case 3:case 4:Je=g.stateNode.containerInfo,Pt=!0;break e}g=g.return}if(Je===null)throw Error(s(160));Sp(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;)wp(t,e),t=t.sibling}var Ra=null;function wp(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&&(Zn(3,e,e.return),Oi(3,e),Zn(5,e,e.return));break;case 1:Gt(t,e),Xt(e),r&512&&(ht||a===null||Pa(a,a.return)),r&64&&gn&&(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[ze]||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[ze]=e,bt(d),r=d;break e;case"link":var m=wv("link","href",c).get(r+(a.href||""));if(m){for(var g=0;g<m.length;g++)if(d=m[g],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(g,1);break t}}d=c.createElement(r),Ct(d,r,a),c.head.appendChild(d);break;case"meta":if(m=wv("meta","content",c).get(r+(a.content||""))){for(g=0;g<m.length;g++)if(d=m[g],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(g,1);break t}}d=c.createElement(r),Ct(d,r,a),c.head.appendChild(d);break;default:throw Error(s(468,r))}d[ze]=e,bt(d),r=d}e.stateNode=r}else Mv(c,e.type,e.stateNode);else e.stateNode=Nv(c,r,e.memoizedProps);else d!==r?(d===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):d.count--,r===null?Mv(c,e.type,e.stateNode):Nv(c,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Du(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&&Du(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{ur(c,"")}catch(oe){Ye(e,e.return,oe)}}r&4&&e.stateNode!=null&&(c=e.memoizedProps,Du(e,c,a!==null?a.memoizedProps:c)),r&1024&&(Bu=!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(oe){Ye(e,e.return,oe)}}break;case 3:if(Mo=null,c=Ra,Ra=No(t.containerInfo),Gt(t,e),Ra=c,Xt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{$r(t.containerInfo)}catch(oe){Ye(e,e.return,oe)}Bu&&(Bu=!1,Mp(e));break;case 4:r=Ra,Ra=No(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,oo(e,r)));break;case 13:Gt(t,e),Xt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(uo=ct()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,oo(e,r)));break;case 22:c=e.memoizedState!==null;var w=a!==null&&a.memoizedState!==null,O=gn,Y=ht;if(gn=O||c,ht=Y||w,Gt(t,e),ht=Y,gn=O,Xt(e),r&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(a===null||w||gn||ht||Ll(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{g=w.stateNode;var V=w.memoizedProps.style,D=V!=null&&V.hasOwnProperty("display")?V.display:null;g.style.display=D==null||typeof D=="boolean"?"":(""+D).trim()}}catch(oe){Ye(w,w.return,oe)}}}else if(t.tag===6){if(a===null){w=t;try{w.stateNode.nodeValue=c?"":w.memoizedProps}catch(oe){Ye(w,w.return,oe)}}}else if(t.tag===18){if(a===null){w=t;try{var q=w.stateNode;c?hv(q,!0):hv(w.stateNode,!1)}catch(oe){Ye(w,w.return,oe)}}}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,oo(e,a))));break;case 19:Gt(t,e),Xt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,oo(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(vp(r)){a=r;break}r=r.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var c=a.stateNode,d=Uu(e);so(e,d,c);break;case 5:var m=a.stateNode;a.flags&32&&(ur(m,""),a.flags&=-33);var g=Uu(e);so(e,g,m);break;case 3:case 4:var w=a.stateNode.containerInfo,O=Uu(e);Lu(e,O,w);break;default:throw Error(s(161))}}catch(Y){Ye(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Mp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function yn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bp(e,t.alternate,t),t=t.sibling}function Ll(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Zn(4,t,t.return),Ll(t);break;case 1:Pa(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&hp(t,t.return,a),Ll(t);break;case 27:Yi(t.stateNode);case 26:case 5:Pa(t,t.return),Ll(t);break;case 22:t.memoizedState===null&&Ll(t);break;case 30:Ll(t);break;default:Ll(t)}e=e.sibling}}function Sn(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:Sn(c,d,a),Oi(4,d);break;case 1:if(Sn(c,d,a),r=d,c=r.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(O){Ye(r,r.return,O)}if(r=d,c=r.updateQueue,c!==null){var g=r.stateNode;try{var w=c.shared.hiddenCallbacks;if(w!==null)for(c.shared.hiddenCallbacks=null,c=0;c<w.length;c++)ah(w[c],g)}catch(O){Ye(r,r.return,O)}}a&&m&64&&mp(d),Di(d,d.return);break;case 27:xp(d);case 26:case 5:Sn(c,d,a),a&&r===null&&m&4&&pp(d),Di(d,d.return);break;case 12:Sn(c,d,a);break;case 31:Sn(c,d,a),a&&m&4&&jp(c,d);break;case 13:Sn(c,d,a),a&&m&4&&Np(c,d);break;case 22:d.memoizedState===null&&Sn(c,d,a),Di(d,d.return);break;case 30:break;default:Sn(c,d,a)}t=t.sibling}}function qu(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 Hu(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;)Cp(e,t,a,r),t=t.sibling}function Cp(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,g=d.onPostCommit;typeof g=="function"&&g(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,kr(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),c&2048&&qu(m,t);break;case 24:za(e,t,a,r),c&2048&&Hu(t.alternate,t);break;default:za(e,t,a,r)}}function kr(e,t,a,r,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,m=t,g=a,w=r,O=m.flags;switch(m.tag){case 0:case 11:case 15:kr(d,m,g,w,c),Oi(8,m);break;case 23:break;case 22:var Y=m.stateNode;m.memoizedState!==null?Y._visibility&2?kr(d,m,g,w,c):Ui(d,m):(Y._visibility|=2,kr(d,m,g,w,c)),c&&O&2048&&qu(m.alternate,m);break;case 24:kr(d,m,g,w,c),c&&O&2048&&Hu(m.alternate,m);break;default:kr(d,m,g,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&&qu(r.alternate,r);break;case 24:Ui(a,r),c&2048&&Hu(r.alternate,r);break;default:Ui(a,r)}t=t.sibling}}var Li=8192;function Rr(e,t,a){if(e.subtreeFlags&Li)for(e=e.child;e!==null;)Tp(e,t,a),e=e.sibling}function Tp(e,t,a){switch(e.tag){case 26:Rr(e,t,a),e.flags&Li&&e.memoizedState!==null&&w0(a,Ra,e.memoizedState,e.memoizedProps);break;case 5:Rr(e,t,a);break;case 3:case 4:var r=Ra;Ra=No(e.stateNode.containerInfo),Rr(e,t,a),Ra=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Li,Li=16777216,Rr(e,t,a),Li=r):Rr(e,t,a));break;default:Rr(e,t,a)}}function Ap(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,kp(r,e)}Ap(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ep(e),e=e.sibling}function Ep(e){switch(e.tag){case 0:case 11:case 15:Bi(e),e.flags&2048&&Zn(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,co(e)):Bi(e);break;default:Bi(e)}}function co(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,kp(r,e)}Ap(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Zn(8,t,t.return),co(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,co(t));break;default:co(t)}e=e.sibling}}function kp(e,t){for(;yt!==null;){var a=yt;switch(a.tag){case 0:case 11:case 15:Zn(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(yp(r),r===a){yt=null;break e}if(c!==null){c.return=d,yt=c;break e}yt=d}}}var qy={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}},Hy=typeof WeakMap=="function"?WeakMap:Map,qe=0,Ve=null,Te=null,Ee=0,Ke=0,sa=null,Jn=!1,zr=!1,$u=!1,jn=0,nt=0,In=0,Bl=0,Qu=0,oa=0,_r=0,qi=null,Vt=null,Ku=!1,uo=0,Rp=0,fo=1/0,mo=null,Wn=null,pt=0,el=null,Or=null,Nn=0,Yu=0,Pu=null,zp=null,Hi=0,Gu=null;function ca(){return(qe&2)!==0&&Ee!==0?Ee&-Ee:R.T!==null?Iu():Qa()}function _p(){if(oa===0)if((Ee&536870912)===0||_e){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)&&(Dr(e,0),tl(e,Ee,oa,!1)),ue(e,a),((qe&2)===0||e!==Ve)&&(e===Ve&&((qe&2)===0&&(Bl|=a),nt===4&&tl(e,Ee,oa,!1)),Ga(e))}function Op(e,t,a){if((qe&6)!==0)throw Error(s(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ea(e,t),c=r?Ky(e,t):Vu(e,t,!0),d=r;do{if(c===0){zr&&!r&&tl(e,t,0,!1);break}else{if(a=e.current.alternate,d&&!$y(a)){c=Vu(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 g=e;c=qi;var w=g.current.memoizedState.isDehydrated;if(w&&(Dr(g,m).flags|=256),m=Vu(g,m,!1),m!==2){if($u&&!w){g.errorRecoveryDisabledLanes|=d,Bl|=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){Dr(e,0),tl(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:tl(r,t,oa,!Jn);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(c=uo+300-ct(),10<c)){if(tl(r,t,oa,!Jn),$a(r,0,!0)!==0)break e;Nn=t,r.timeoutHandle=dv(Dp.bind(null,r,a,Vt,mo,Ku,t,oa,Bl,_r,Jn,d,"Throttled",-0,0),c);break e}Dp(r,a,Vt,mo,Ku,t,oa,Bl,_r,Jn,d,null,-0,0)}}break}while(!0);Ga(e)}function Dp(e,t,a,r,c,d,m,g,w,O,Y,V,D,q){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:on},Tp(t,d,V);var oe=(d&62914560)===d?uo-ct():(d&4194048)===d?Rp-ct():0;if(oe=M0(V,oe),oe!==null){Nn=d,e.cancelPendingCommit=oe(Kp.bind(null,e,t,d,a,r,c,m,g,w,Y,V,null,D,q)),tl(e,d,m,!O);return}}Kp(e,t,d,a,r,c,m,g,w)}function $y(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 tl(e,t,a,r){t&=~Qu,t&=~Bl,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 ho(){return(qe&6)===0?($i(0),!1):!0}function Xu(){if(Te!==null){if(Ke===0)var e=Te.return;else e=Te,fn=El=null,cu(e),Mr=null,Ni=0,e=Te;for(;e!==null;)fp(e.alternate,e),e=e.return;Te=null}}function Dr(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,s0(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Nn=0,Xu(),Ve=e,Te=a=un(e.current,null),Ee=t,Ke=0,sa=null,Jn=!1,zr=Ea(e,t),$u=!1,_r=oa=Qu=Bl=In=nt=0,Vt=qi=null,Ku=!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 jn=t,Os(),a}function Up(e,t){Se=null,R.H=Ri,t===wr||t===Qs?(t=Im(),Ke=3):t===Jc?(t=Im(),Ke=4):Ke=t===Mu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,sa=t,Te===null&&(nt=1,ao(e,ga(t,e.current)))}function Lp(){var e=ra.current;return e===null?!0:(Ee&4194048)===Ee?ja===null:(Ee&62914560)===Ee||(Ee&536870912)!==0?e===ja:!1}function Bp(){var e=R.H;return R.H=Ri,e===null?Ri:e}function qp(){var e=R.A;return R.A=qy,e}function po(){nt=4,Jn||(Ee&4194048)!==Ee&&ra.current!==null||(zr=!0),(In&134217727)===0&&(Bl&134217727)===0||Ve===null||tl(Ve,Ee,oa,!1)}function Vu(e,t,a){var r=qe;qe|=2;var c=Bp(),d=qp();(Ve!==e||Ee!==t)&&(mo=null,Dr(e,t)),t=!1;var m=nt;e:do try{if(Ke!==0&&Te!==null){var g=Te,w=sa;switch(Ke){case 8:Xu(),m=6;break e;case 3:case 2:case 9:case 6:ra.current===null&&(t=!0);var O=Ke;if(Ke=0,sa=null,Ur(e,g,w,O),a&&zr){m=0;break e}break;default:O=Ke,Ke=0,sa=null,Ur(e,g,w,O)}}Qy(),m=nt;break}catch(Y){Up(e,Y)}while(!0);return t&&e.shellSuspendCounter++,fn=El=null,qe=r,R.H=c,R.A=d,Te===null&&(Ve=null,Ee=0,Os()),m}function Qy(){for(;Te!==null;)Hp(Te)}function Ky(e,t){var a=qe;qe|=2;var r=Bp(),c=qp();Ve!==e||Ee!==t?(mo=null,fo=ct()+500,Dr(e,t)):zr=Ea(e,t);e:do try{if(Ke!==0&&Te!==null){t=Te;var d=sa;t:switch(Ke){case 1:Ke=0,sa=null,Ur(e,t,d,1);break;case 2:case 9:if(Zm(d)){Ke=0,sa=null,$p(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:Zm(d)?(Ke=0,sa=null,$p(t)):(Ke=0,sa=null,Ur(e,t,d,7));break;case 5:var m=null;switch(Te.tag){case 26:m=Te.memoizedState;case 5:case 27:var g=Te;if(m?Cv(m):g.stateNode.complete){Ke=0,sa=null;var w=g.sibling;if(w!==null)Te=w;else{var O=g.return;O!==null?(Te=O,vo(O)):Te=null}break t}}Ke=0,sa=null,Ur(e,t,d,5);break;case 6:Ke=0,sa=null,Ur(e,t,d,6);break;case 8:Xu(),nt=6;break e;default:throw Error(s(462))}}Yy();break}catch(Y){Up(e,Y)}while(!0);return fn=El=null,R.H=r,R.A=c,qe=a,Te!==null?0:(Ve=null,Ee=0,Os(),nt)}function Yy(){for(;Te!==null&&!ta();)Hp(Te)}function Hp(e){var t=up(e.alternate,e,jn);e.memoizedProps=e.pendingProps,t===null?vo(e):Te=t}function $p(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=lp(a,t,t.pendingProps,t.type,void 0,Ee);break;case 11:t=lp(a,t,t.pendingProps,t.type.render,t.ref,Ee);break;case 5:cu(t);default:fp(a,t),t=Te=qm(t,jn),t=up(a,t,jn)}e.memoizedProps=e.pendingProps,t===null?vo(e):Te=t}function Ur(e,t,a,r){fn=El=null,cu(t),Mr=null,Ni=0;var c=t.return;try{if(zy(e,c,t,a,Ee)){nt=1,ao(e,ga(a,e.current)),Te=null;return}}catch(d){if(c!==null)throw Te=c,d;nt=1,ao(e,ga(a,e.current)),Te=null;return}t.flags&32768?(_e||r===1?e=!0:zr||(Ee&536870912)!==0?e=!1:(Jn=e=!0,(r===2||r===9||r===3||r===6)&&(r=ra.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qp(t,e)):vo(t)}function vo(e){var t=e;do{if((t.flags&32768)!==0){Qp(t,Jn);return}e=t.return;var a=Dy(t.alternate,t,jn);if(a!==null){Te=a;return}if(t=t.sibling,t!==null){Te=t;return}Te=t=e}while(t!==null);nt===0&&(nt=5)}function Qp(e,t){do{var a=Uy(e.alternate,e);if(a!==null){a.flags&=32767,Te=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Te=e;return}Te=e=a}while(e!==null);nt=6,Te=null}function Kp(e,t,a,r,c,d,m,g,w){e.cancelPendingCommit=null;do xo();while(pt!==0);if((qe&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(d=t.lanes|t.childLanes,d|=Uc,$e(e,a,d,m,g,w),e===Ve&&(Te=Ve=null,Ee=0),Or=t,el=e,Nn=a,Yu=d,Pu=c,zp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Vy(Aa,function(){return Vp(),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=qe,qe|=4;try{Ly(e,t,a)}finally{qe=m,X.p=c,R.T=r}}pt=1,Yp(),Pp(),Gp()}}function Yp(){if(pt===1){pt=0;var e=el,t=Or,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=qe;qe|=4;try{wp(t,e);var d=id,m=km(e.containerInfo),g=d.focusedElem,w=d.selectionRange;if(m!==g&&g&&g.ownerDocument&&Em(g.ownerDocument.documentElement,g)){if(w!==null&&Rc(g)){var O=w.start,Y=w.end;if(Y===void 0&&(Y=O),"selectionStart"in g)g.selectionStart=O,g.selectionEnd=Math.min(Y,g.value.length);else{var V=g.ownerDocument||document,D=V&&V.defaultView||window;if(D.getSelection){var q=D.getSelection(),oe=g.textContent.length,xe=Math.min(w.start,oe),Xe=w.end===void 0?xe:Math.min(w.end,oe);!q.extend&&xe>Xe&&(m=Xe,Xe=xe,xe=m);var k=Am(g,xe),A=Am(g,Xe);if(k&&A&&(q.rangeCount!==1||q.anchorNode!==k.node||q.anchorOffset!==k.offset||q.focusNode!==A.node||q.focusOffset!==A.offset)){var _=V.createRange();_.setStart(k.node,k.offset),q.removeAllRanges(),xe>Xe?(q.addRange(_),q.extend(A.node,A.offset)):(_.setEnd(A.node,A.offset),q.addRange(_))}}}}for(V=[],q=g;q=q.parentNode;)q.nodeType===1&&V.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<V.length;g++){var G=V[g];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}Eo=!!rd,id=rd=null}finally{qe=c,X.p=r,R.T=a}}e.current=t,pt=2}}function Pp(){if(pt===2){pt=0;var e=el,t=Or,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=qe;qe|=4;try{bp(e,t.alternate,t)}finally{qe=c,X.p=r,R.T=a}}pt=3}}function Gp(){if(pt===4||pt===3){pt=0,an();var e=el,t=Or,a=Nn,r=zp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pt=5:(pt=0,Or=el=null,Xp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Wn=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 g=r[m];d(g.value,{componentStack:g.stack})}}finally{R.T=t,X.p=c}}(Nn&3)!==0&&xo(),Ga(e),c=e.pendingLanes,(a&261930)!==0&&(c&42)!==0?e===Gu?Hi++:(Hi=0,Gu=e):Hi=0,$i(0)}}function Xp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Si(t)))}function xo(){return Yp(),Pp(),Gp(),Vp()}function Vp(){if(pt!==5)return!1;var e=el,t=Yu;Yu=0;var a=tt(Nn),r=R.T,c=X.p;try{X.p=32>a?32:a,R.T=null,a=Pu,Pu=null;var d=el,m=Nn;if(pt=0,Or=el=null,Nn=0,(qe&6)!==0)throw Error(s(331));var g=qe;if(qe|=4,Ep(d.current),Cp(d,d.current,m,a),qe=g,$i(0,!1),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(He,d)}catch{}return!0}finally{X.p=c,R.T=r,Xp(e,t)}}function Fp(e,t,a){t=ga(a,t),t=wu(e.stateNode,t,2),e=Xn(e,t,2),e!==null&&(ue(e,2),Ga(e))}function Ye(e,t,a){if(e.tag===3)Fp(e,e,a);else for(;t!==null;){if(t.tag===3){Fp(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Wn===null||!Wn.has(r))){e=ga(a,e),a=Zh(2),r=Xn(t,a,2),r!==null&&(Jh(a,r,t,e),ue(r,2),Ga(r));break}}t=t.return}}function Fu(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Hy;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)||($u=!0,c.add(a),e=Py.bind(null,e,t,a),t.then(e,e))}function Py(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ve===e&&(Ee&a)===a&&(nt===4||nt===3&&(Ee&62914560)===Ee&&300>ct()-uo?(qe&2)===0&&Dr(e,0):Qu|=a,_r===Ee&&(_r=0)),Ga(e)}function Zp(e,t){t===0&&(t=qn()),e=Cl(e,t),e!==null&&(ue(e,t),Ga(e))}function Gy(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Zp(e,a)}function Xy(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),Zp(e,a)}function Vy(e,t){return Ta(e,t)}var go=null,Lr=null,Zu=!1,bo=!1,Ju=!1,al=0;function Ga(e){e!==Lr&&e.next===null&&(Lr===null?go=Lr=e:Lr=Lr.next=e),bo=!0,Zu||(Zu=!0,Zy())}function $i(e,t){if(!Ju&&bo){Ju=!0;do for(var a=!1,r=go;r!==null;){if(e!==0){var c=r.pendingLanes;if(c===0)var d=0;else{var m=r.suspendedLanes,g=r.pingedLanes;d=(1<<31-jt(42|e)+1)-1,d&=c&~(m&~g),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,ev(r,d))}else d=Ee,d=$a(r,r===Ve?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||Ea(r,d)||(a=!0,ev(r,d));r=r.next}while(a);Ju=!1}}function Fy(){Jp()}function Jp(){bo=Zu=!1;var e=0;al!==0&&i0()&&(e=al);for(var t=ct(),a=null,r=go;r!==null;){var c=r.next,d=Ip(r,t);d===0?(r.next=null,a===null?go=c:a.next=c,c===null&&(Lr=a)):(a=r,(e!==0||(d&3)!==0)&&(bo=!0)),r=c}pt!==0&&pt!==5||$i(e),al!==0&&(al=0)}function Ip(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var m=31-jt(d),g=1<<m,w=c[m];w===-1?((g&a)===0||(g&r)!==0)&&(c[m]=Sl(g,t)):w<=t&&(e.expiredLanes|=g),d&=~g}if(t=Ve,a=Ee,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=ln;break;default:a=Aa}return r=Wp.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 Wp(e,t){if(pt!==0&&pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(xo()&&e.callbackNode!==a)return null;var r=Ee;return r=$a(e,e===Ve?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Op(e,r,t),Ip(e,ct()),e.callbackNode!=null&&e.callbackNode===a?Wp.bind(null,e):null)}function ev(e,t){if(xo())return null;Op(e,t,!0)}function Zy(){o0(function(){(qe&6)!==0?Ta(nn,Fy):Jp()})}function Iu(){if(al===0){var e=jr;e===0&&(e=Ba,Ba<<=1,(Ba&261888)===0&&(Ba=256)),al=e}return al}function tv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Cs(""+e)}function av(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 Jy(e,t,a,r,c){if(t==="submit"&&a&&a.stateNode===c){var d=tv((c[ut]||null).action),m=r.submitter;m&&(t=(t=m[ut]||null)?tv(t.formAction):m.getAttribute("formAction"),t!==null&&(d=t,m=null));var g=new ks("action","action",null,r,c);e.push({event:g,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(al!==0){var w=m?av(c,m):new FormData(c);gu(a,{pending:!0,data:w,method:c.method,action:d},null,w)}}else typeof d=="function"&&(g.preventDefault(),w=m?av(c,m):new FormData(c),gu(a,{pending:!0,data:w,method:c.method,action:d},d,w))},currentTarget:c}]})}}for(var Wu=0;Wu<Dc.length;Wu++){var ed=Dc[Wu],Iy=ed.toLowerCase(),Wy=ed[0].toUpperCase()+ed.slice(1);ka(Iy,"on"+Wy)}ka(_m,"onAnimationEnd"),ka(Om,"onAnimationIteration"),ka(Dm,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(py,"onTransitionRun"),ka(vy,"onTransitionStart"),ka(xy,"onTransitionCancel"),ka(Um,"onTransitionEnd"),or("onMouseEnter",["mouseout","mouseover"]),or("onMouseLeave",["mouseout","mouseover"]),or("onPointerEnter",["pointerout","pointerover"]),or("onPointerLeave",["pointerout","pointerover"]),jl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),jl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),jl("onBeforeInput",["compositionend","keypress","textInput","paste"]),jl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),jl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),jl("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(" "),e0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qi));function nv(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 g=r[m],w=g.instance,O=g.currentTarget;if(g=g.listener,w!==d&&c.isPropagationStopped())break e;d=g,c.currentTarget=O;try{d(c)}catch(Y){_s(Y)}c.currentTarget=null,d=w}else for(m=0;m<r.length;m++){if(g=r[m],w=g.instance,O=g.currentTarget,g=g.listener,w!==d&&c.isPropagationStopped())break e;d=g,c.currentTarget=O;try{d(c)}catch(Y){_s(Y)}c.currentTarget=null,d=w}}}}function Ae(e,t){var a=t[mc];a===void 0&&(a=t[mc]=new Set);var r=e+"__bubble";a.has(r)||(lv(t,e,2,!1),a.add(r))}function td(e,t,a){var r=0;t&&(r|=4),lv(a,e,r,t)}var yo="_reactListening"+Math.random().toString(36).slice(2);function ad(e){if(!e[yo]){e[yo]=!0,Jf.forEach(function(a){a!=="selectionchange"&&(e0.has(a)||td(a,!1,e),td(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[yo]||(t[yo]=!0,td("selectionchange",!1,t))}}function lv(e,t,a,r){switch(_v(t)){case 2:var c=A0;break;case 8:c=E0;break;default:c=xd}a=c.bind(null,t,a,e),c=void 0,!jc||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 nd(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 g=r.stateNode.containerInfo;if(g===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(;g!==null;){if(m=rr(g),m===null)return;if(w=m.tag,w===5||w===6||w===26||w===27){r=d=m;continue e}g=g.parentNode}}r=r.return}cm(function(){var O=d,Y=yc(a),V=[];e:{var D=Lm.get(e);if(D!==void 0){var q=ks,oe=e;switch(e){case"keypress":if(As(a)===0)break e;case"keydown":case"keyup":q=Xb;break;case"focusin":oe="focus",q=Cc;break;case"focusout":oe="blur",q=Cc;break;case"beforeblur":case"afterblur":q=Cc;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":q=fm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=Db;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=Zb;break;case _m:case Om:case Dm:q=Bb;break;case Um:q=Ib;break;case"scroll":case"scrollend":q=_b;break;case"wheel":q=ey;break;case"copy":case"cut":case"paste":q=Hb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=hm;break;case"toggle":case"beforetoggle":q=ay}var xe=(t&4)!==0,Xe=!xe&&(e==="scroll"||e==="scrollend"),k=xe?D!==null?D+"Capture":null:D;xe=[];for(var A=O,_;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&&xe.push(Ki(A,G,_))),Xe)break;A=A.return}0<xe.length&&(D=new q(D,oe,null,a,Y),V.push({event:D,listeners:xe}))}}if((t&7)===0){e:{if(D=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",D&&a!==bc&&(oe=a.relatedTarget||a.fromElement)&&(rr(oe)||oe[lr]))break e;if((q||D)&&(D=Y.window===Y?Y:(D=Y.ownerDocument)?D.defaultView||D.parentWindow:window,q?(oe=a.relatedTarget||a.toElement,q=O,oe=oe?rr(oe):null,oe!==null&&(Xe=f(oe),xe=oe.tag,oe!==Xe||xe!==5&&xe!==27&&xe!==6)&&(oe=null)):(q=null,oe=O),q!==oe)){if(xe=fm,G="onMouseLeave",k="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(xe=hm,G="onPointerLeave",k="onPointerEnter",A="pointer"),Xe=q==null?D:ci(q),_=oe==null?D:ci(oe),D=new xe(G,A+"leave",q,a,Y),D.target=Xe,D.relatedTarget=_,G=null,rr(Y)===O&&(xe=new xe(k,A+"enter",oe,a,Y),xe.target=_,xe.relatedTarget=Xe,G=xe),Xe=G,q&&oe)t:{for(xe=t0,k=q,A=oe,_=0,G=k;G;G=xe(G))_++;G=0;for(var he=A;he;he=xe(he))G++;for(;0<_-G;)k=xe(k),_--;for(;0<G-_;)A=xe(A),G--;for(;_--;){if(k===A||A!==null&&k===A.alternate){xe=k;break t}k=xe(k),A=xe(A)}xe=null}else xe=null;q!==null&&rv(V,D,q,xe,!1),oe!==null&&Xe!==null&&rv(V,Xe,oe,xe,!0)}}e:{if(D=O?ci(O):window,q=D.nodeName&&D.nodeName.toLowerCase(),q==="select"||q==="input"&&D.type==="file")var Le=jm;else if(ym(D))if(Nm)Le=fy;else{Le=uy;var de=cy}else q=D.nodeName,!q||q.toLowerCase()!=="input"||D.type!=="checkbox"&&D.type!=="radio"?O&&gc(O.elementType)&&(Le=jm):Le=dy;if(Le&&(Le=Le(e,O))){Sm(V,Le,a,Y);break e}de&&de(e,D,O),e==="focusout"&&O&&D.type==="number"&&O.memoizedProps.value!=null&&xc(D,"number",D.value)}switch(de=O?ci(O):window,e){case"focusin":(ym(de)||de.contentEditable==="true")&&(hr=de,zc=O,gi=null);break;case"focusout":gi=zc=hr=null;break;case"mousedown":_c=!0;break;case"contextmenu":case"mouseup":case"dragend":_c=!1,Rm(V,a,Y);break;case"selectionchange":if(hy)break;case"keydown":case"keyup":Rm(V,a,Y)}var je;if(Ac)e:{switch(e){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else mr?gm(e,a)&&(ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ke="onCompositionStart");ke&&(pm&&a.locale!=="ko"&&(mr||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&mr&&(je=um()):(Hn=Y,Nc="value"in Hn?Hn.value:Hn.textContent,mr=!0)),de=So(O,ke),0<de.length&&(ke=new mm(ke,e,null,a,Y),V.push({event:ke,listeners:de}),je?ke.data=je:(je=bm(a),je!==null&&(ke.data=je)))),(je=ly?ry(e,a):iy(e,a))&&(ke=So(O,"onBeforeInput"),0<ke.length&&(de=new mm("onBeforeInput","beforeinput",null,a,Y),V.push({event:de,listeners:ke}),de.data=je)),Jy(V,e,O,a,Y)}nv(V,t)})}function Ki(e,t,a){return{instance:e,listener:t,currentTarget:a}}function So(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 t0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function rv(e,t,a,r,c){for(var d=t._reactName,m=[];a!==null&&a!==r;){var g=a,w=g.alternate,O=g.stateNode;if(g=g.tag,w!==null&&w===r)break;g!==5&&g!==26&&g!==27||O===null||(w=O,c?(O=ui(a,d),O!=null&&m.unshift(Ki(a,O,w))):c||(O=ui(a,d),O!=null&&m.push(Ki(a,O,w)))),a=a.return}m.length!==0&&e.push({event:t,listeners:m})}var a0=/\r\n?/g,n0=/\u0000|\uFFFD/g;function iv(e){return(typeof e=="string"?e:""+e).replace(a0,`
|
|
49
|
+
`).replace(n0,"")}function sv(e,t){return t=iv(t),iv(e)===t}function Ge(e,t,a,r,c,d){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ur(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ur(e,""+r);break;case"className":ws(e,"class",r);break;case"tabIndex":ws(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":ws(e,a,r);break;case"style":sm(e,r,d);break;case"data":if(t!=="object"){ws(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=Cs(""+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=Cs(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=on);break;case"onScroll":r!=null&&Ae("scroll",e);break;case"onScrollEnd":r!=null&&Ae("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=Cs(""+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":Ae("beforetoggle",e),Ae("toggle",e),Ns(e,"popover",r);break;case"xlinkActuate":sn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":sn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":sn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":sn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":sn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":sn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":sn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":sn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":sn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ns(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=Rb.get(a)||a,Ns(e,a,r))}}function ld(e,t,a,r,c,d){switch(a){case"style":sm(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"?ur(e,r):(typeof r=="number"||typeof r=="bigint")&&ur(e,""+r);break;case"onScroll":r!=null&&Ae("scroll",e);break;case"onScrollEnd":r!=null&&Ae("scrollend",e);break;case"onClick":r!=null&&(e.onclick=on);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!If.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,""):Ns(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":Ae("error",e),Ae("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":Ae("invalid",e);var g=d=m=c=null,w=null,O=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":O=Y;break;case"value":d=Y;break;case"defaultValue":g=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,t));break;default:Ge(e,t,r,Y,a,null)}}nm(e,d,g,w,O,m,c,!1);return;case"select":Ae("invalid",e),r=m=d=null;for(c in a)if(a.hasOwnProperty(c)&&(g=a[c],g!=null))switch(c){case"value":d=g;break;case"defaultValue":m=g;break;case"multiple":r=g;default:Ge(e,t,c,g,a,null)}t=d,a=m,e.multiple=!!r,t!=null?cr(e,!!r,t,!1):a!=null&&cr(e,!!r,a,!0);return;case"textarea":Ae("invalid",e),d=c=r=null;for(m in a)if(a.hasOwnProperty(m)&&(g=a[m],g!=null))switch(m){case"value":r=g;break;case"defaultValue":c=g;break;case"children":d=g;break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(s(91));break;default:Ge(e,t,m,g,a,null)}rm(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":Ae("beforetoggle",e),Ae("toggle",e),Ae("cancel",e),Ae("close",e);break;case"iframe":case"object":Ae("load",e);break;case"video":case"audio":for(r=0;r<Qi.length;r++)Ae(Qi[r],e);break;case"image":Ae("error",e),Ae("load",e);break;case"details":Ae("toggle",e);break;case"embed":case"source":case"link":Ae("error",e),Ae("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(O in a)if(a.hasOwnProperty(O)&&(r=a[O],r!=null))switch(O){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ge(e,t,O,r,a,null)}return;default:if(gc(t)){for(Y in a)a.hasOwnProperty(Y)&&(r=a[Y],r!==void 0&&ld(e,t,Y,r,a,void 0));return}}for(g in a)a.hasOwnProperty(g)&&(r=a[g],r!=null&&Ge(e,t,g,r,a,null))}function l0(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,g=null,w=null,O=null,Y=null;for(q in a){var V=a[q];if(a.hasOwnProperty(q)&&V!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":w=V;default:r.hasOwnProperty(q)||Ge(e,t,q,null,r,V)}}for(var D in r){var q=r[D];if(V=a[D],r.hasOwnProperty(D)&&(q!=null||V!=null))switch(D){case"type":d=q;break;case"name":c=q;break;case"checked":O=q;break;case"defaultChecked":Y=q;break;case"value":m=q;break;case"defaultValue":g=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(137,t));break;default:q!==V&&Ge(e,t,D,q,r,V)}}vc(e,m,g,w,O,Y,d,c);return;case"select":q=m=g=D=null;for(d in a)if(w=a[d],a.hasOwnProperty(d)&&w!=null)switch(d){case"value":break;case"multiple":q=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":D=d;break;case"defaultValue":g=d;break;case"multiple":m=d;default:d!==w&&Ge(e,t,c,d,r,w)}t=g,a=m,r=q,D!=null?cr(e,!!a,D,!1):!!r!=!!a&&(t!=null?cr(e,!!a,t,!0):cr(e,!!a,a?[]:"",!1));return;case"textarea":q=D=null;for(g in a)if(c=a[g],a.hasOwnProperty(g)&&c!=null&&!r.hasOwnProperty(g))switch(g){case"value":break;case"children":break;default:Ge(e,t,g,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":D=c;break;case"defaultValue":q=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)}lm(e,D,q);return;case"option":for(var oe in a)if(D=a[oe],a.hasOwnProperty(oe)&&D!=null&&!r.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:Ge(e,t,oe,null,r,D)}for(w in r)if(D=r[w],q=a[w],r.hasOwnProperty(w)&&D!==q&&(D!=null||q!=null))switch(w){case"selected":e.selected=D&&typeof D!="function"&&typeof D!="symbol";break;default:Ge(e,t,w,D,r,q)}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 xe in a)D=a[xe],a.hasOwnProperty(xe)&&D!=null&&!r.hasOwnProperty(xe)&&Ge(e,t,xe,null,r,D);for(O in r)if(D=r[O],q=a[O],r.hasOwnProperty(O)&&D!==q&&(D!=null||q!=null))switch(O){case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(s(137,t));break;default:Ge(e,t,O,D,r,q)}return;default:if(gc(t)){for(var Xe in a)D=a[Xe],a.hasOwnProperty(Xe)&&D!==void 0&&!r.hasOwnProperty(Xe)&&ld(e,t,Xe,void 0,r,D);for(Y in r)D=r[Y],q=a[Y],!r.hasOwnProperty(Y)||D===q||D===void 0&&q===void 0||ld(e,t,Y,D,r,q);return}}for(var k in a)D=a[k],a.hasOwnProperty(k)&&D!=null&&!r.hasOwnProperty(k)&&Ge(e,t,k,null,r,D);for(V in r)D=r[V],q=a[V],!r.hasOwnProperty(V)||D===q||D==null&&q==null||Ge(e,t,V,D,r,q)}function ov(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function r0(){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,g=c.duration;if(d&&g&&ov(m)){for(m=0,g=c.responseEnd,r+=1;r<a.length;r++){var w=a[r],O=w.startTime;if(O>g)break;var Y=w.transferSize,V=w.initiatorType;Y&&ov(V)&&(w=w.responseEnd,m+=Y*(w<g?1:(g-O)/(w-O)))}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 rd=null,id=null;function jo(e){return e.nodeType===9?e:e.ownerDocument}function cv(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 uv(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 sd(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 od=null;function i0(){var e=window.event;return e&&e.type==="popstate"?e===od?!1:(od=e,!0):(od=null,!1)}var dv=typeof setTimeout=="function"?setTimeout:void 0,s0=typeof clearTimeout=="function"?clearTimeout:void 0,fv=typeof Promise=="function"?Promise:void 0,o0=typeof queueMicrotask=="function"?queueMicrotask:typeof fv<"u"?function(e){return fv.resolve(null).then(e).catch(c0)}:dv;function c0(e){setTimeout(function(){throw e})}function nl(e){return e==="head"}function mv(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),$r(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,g=d.nodeName;d[oi]||g==="SCRIPT"||g==="STYLE"||g==="LINK"&&d.rel.toLowerCase()==="stylesheet"||a.removeChild(d),d=m}}else a==="body"&&Yi(e.ownerDocument.body);a=c}while(a);$r(t)}function hv(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 cd(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":cd(a),hc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function u0(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 d0(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 pv(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 ud(e){return e.data==="$?"||e.data==="$~"}function dd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function f0(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 fd=null;function vv(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 xv(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 gv(e,t,a){switch(t=jo(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]);hc(e)}var wa=new Map,bv=new Set;function No(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wn=X.d;X.d={f:m0,r:h0,D:p0,C:v0,L:x0,m:g0,X:y0,S:b0,M:S0};function m0(){var e=wn.f(),t=ho();return e||t}function h0(e){var t=ir(e);t!==null&&t.tag===5&&t.type==="form"?Uh(t):wn.r(e)}var Br=typeof document>"u"?null:document;function yv(e,t,a){var r=Br;if(r&&typeof t=="string"&&t){var c=va(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),bv.has(c)||(bv.add(c),e={rel:e,crossOrigin:a,href:t},r.querySelector(c)===null&&(t=r.createElement("link"),Ct(t,"link",e),bt(t),r.head.appendChild(t)))}}function p0(e){wn.D(e),yv("dns-prefetch",e,null)}function v0(e,t){wn.C(e,t),yv("preconnect",e,t)}function x0(e,t,a){wn.L(e,t,a);var r=Br;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=qr(e);break;case"script":d=Hr(e)}wa.has(d)||(e=b({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),bt(t),r.head.appendChild(t)))}}function g0(e,t){wn.m(e,t);var a=Br;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=Hr(e)}if(!wa.has(d)&&(e=b({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),bt(r),a.head.appendChild(r)}}}function b0(e,t,a){wn.S(e,t,a);var r=Br;if(r&&e){var c=sr(r).hoistableStyles,d=qr(e);t=t||"default";var m=c.get(d);if(!m){var g={loading:0,preload:null};if(m=r.querySelector(Pi(d)))g.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=wa.get(d))&&md(e,a);var w=m=r.createElement("link");bt(w),Ct(w,"link",e),w._p=new Promise(function(O,Y){w.onload=O,w.onerror=Y}),w.addEventListener("load",function(){g.loading|=1}),w.addEventListener("error",function(){g.loading|=2}),g.loading|=4,wo(m,t,r)}m={type:"stylesheet",instance:m,count:1,state:g},c.set(d,m)}}}function y0(e,t){wn.X(e,t);var a=Br;if(a&&e){var r=sr(a).hoistableScripts,c=Hr(e),d=r.get(c);d||(d=a.querySelector(Gi(c)),d||(e=b({src:e,async:!0},t),(t=wa.get(c))&&hd(e,t),d=a.createElement("script"),bt(d),Ct(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function S0(e,t){wn.M(e,t);var a=Br;if(a&&e){var r=sr(a).hoistableScripts,c=Hr(e),d=r.get(c);d||(d=a.querySelector(Gi(c)),d||(e=b({src:e,async:!0,type:"module"},t),(t=wa.get(c))&&hd(e,t),d=a.createElement("script"),bt(d),Ct(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function Sv(e,t,a,r){var c=(c=ge.current)?No(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=qr(a.href),a=sr(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=qr(a.href);var d=sr(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||j0(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=Hr(a),a=sr(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 qr(e){return'href="'+va(e)+'"'}function Pi(e){return'link[rel="stylesheet"]['+e+"]"}function jv(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function j0(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),bt(t),e.head.appendChild(t))}function Hr(e){return'[src="'+va(e)+'"]'}function Gi(e){return"script[async]"+e}function Nv(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,bt(r),r;var c=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),bt(r),Ct(r,"style",c),wo(r,a.precedence,e),t.instance=r;case"stylesheet":c=qr(a.href);var d=e.querySelector(Pi(c));if(d)return t.state.loading|=4,t.instance=d,bt(d),d;r=jv(a),(c=wa.get(c))&&md(r,c),d=(e.ownerDocument||e).createElement("link"),bt(d);var m=d;return m._p=new Promise(function(g,w){m.onload=g,m.onerror=w}),Ct(d,"link",r),t.state.loading|=4,wo(d,a.precedence,e),t.instance=d;case"script":return d=Hr(a.src),(c=e.querySelector(Gi(d)))?(t.instance=c,bt(c),c):(r=a,(c=wa.get(d))&&(r=b({},a),hd(r,c)),e=e.ownerDocument||e,c=e.createElement("script"),bt(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,wo(r,a.precedence,e));return t.instance}function wo(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 g=r[m];if(g.dataset.precedence===t)d=g;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 md(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function hd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Mo=null;function wv(e,t,a){if(Mo===null){var r=new Map,c=Mo=new Map;c.set(a,r)}else c=Mo,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[ze]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var m=d.getAttribute(t)||"";m=e+m;var g=r.get(m);g?g.push(d):r.set(m,[d])}}return r}function Mv(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function N0(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 Cv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function w0(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=qr(r.href),d=t.querySelector(Pi(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Co.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=d,bt(d);return}d=t.ownerDocument||t,r=jv(r),(c=wa.get(c))&&md(r,c),d=d.createElement("link"),bt(d);var m=d;m._p=new Promise(function(g,w){m.onload=g,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=Co.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var pd=0;function M0(e,t){return e.stylesheets&&e.count===0&&Ao(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Ao(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&pd===0&&(pd=62500*r0());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ao(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>pd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(c)}}:null}function Co(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ao(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var To=null;function Ao(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,To=new Map,t.forEach(C0,e),To=null,Co.call(e))}function C0(e,t){if(!(t.state.loading&4)){var a=To.get(e);if(a)var r=a.get(null);else{a=new Map,To.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=Co.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:L,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function T0(e,t,a,r,c,d,m,g,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=rn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rn(0),this.hiddenUpdates=rn(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 Tv(e,t,a,r,c,d,m,g,w,O,Y,V){return e=new T0(e,t,a,m,w,O,Y,V,g),t=1,d===!0&&(t|=24),d=la(3,null,null,t),e.current=d,d.stateNode=e,t=Vc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:r,isDehydrated:a,cache:t},Ic(d),e}function Av(e){return e?(e=xr,e):xr}function Ev(e,t,a,r,c,d){c=Av(c),r.context===null?r.context=c:r.pendingContext=c,r=Gn(t),r.payload={element:a},d=d===void 0?null:d,d!==null&&(r.callback=d),a=Xn(e,r,t),a!==null&&(Ft(a,e,t),Mi(a,e,t))}function kv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function vd(e,t){kv(e,t),(e=e.alternate)&&kv(e,t)}function Rv(e){if(e.tag===13||e.tag===31){var t=Cl(e,67108864);t!==null&&Ft(t,e,67108864),vd(e,67108864)}}function zv(e){if(e.tag===13||e.tag===31){var t=ca();t=Ce(t);var a=Cl(e,t);a!==null&&Ft(a,e,t),vd(e,t)}}var Eo=!0;function A0(e,t,a,r){var c=R.T;R.T=null;var d=X.p;try{X.p=2,xd(e,t,a,r)}finally{X.p=d,R.T=c}}function E0(e,t,a,r){var c=R.T;R.T=null;var d=X.p;try{X.p=8,xd(e,t,a,r)}finally{X.p=d,R.T=c}}function xd(e,t,a,r){if(Eo){var c=gd(r);if(c===null)nd(e,t,r,ko,a),Ov(e,r);else if(R0(c,e,t,a,r))r.stopPropagation();else if(Ov(e,r),t&4&&-1<k0.indexOf(e)){for(;c!==null;){var d=ir(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 g=d;for(g.pendingLanes|=2,g.entangledLanes|=2;m;){var w=1<<31-jt(m);g.entanglements[1]|=w,m&=~w}Ga(d),(qe&6)===0&&(fo=ct()+500,$i(0))}}break;case 31:case 13:g=Cl(d,2),g!==null&&Ft(g,d,2),ho(),vd(d,2)}if(d=gd(r),d===null&&nd(e,t,r,ko,a),d===c)break;c=d}c!==null&&r.stopPropagation()}else nd(e,t,r,null,a)}}function gd(e){return e=yc(e),bd(e)}var ko=null;function bd(e){if(ko=null,e=rr(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 ko=e,null}function _v(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(Dn()){case nn:return 2;case Ua:return 8;case Aa:case Un:return 32;case ln:return 268435456;default:return 32}default:return 32}}var yd=!1,ll=null,rl=null,il=null,Vi=new Map,Fi=new Map,sl=[],k0="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 Ov(e,t){switch(e){case"focusin":case"focusout":ll=null;break;case"dragenter":case"dragleave":rl=null;break;case"mouseover":case"mouseout":il=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=ir(t),t!==null&&Rv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function R0(e,t,a,r,c){switch(t){case"focusin":return ll=Zi(ll,e,t,a,r,c),!0;case"dragenter":return rl=Zi(rl,e,t,a,r,c),!0;case"mouseover":return il=Zi(il,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 Dv(e){var t=rr(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,nr(e.priority,function(){zv(a)});return}}else if(t===31){if(t=v(a),t!==null){e.blockedOn=t,nr(e.priority,function(){zv(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 Ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=gd(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);bc=r,a.target.dispatchEvent(r),bc=null}else return t=ir(a),t!==null&&Rv(t),e.blockedOn=a,!1;t.shift()}return!0}function Uv(e,t,a){Ro(e)&&a.delete(t)}function z0(){yd=!1,ll!==null&&Ro(ll)&&(ll=null),rl!==null&&Ro(rl)&&(rl=null),il!==null&&Ro(il)&&(il=null),Vi.forEach(Uv),Fi.forEach(Uv)}function zo(e,t){e.blockedOn===t&&(e.blockedOn=null,yd||(yd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,z0)))}var _o=null;function Lv(e){_o!==e&&(_o=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){_o===e&&(_o=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(bd(r||a)===null)continue;break}var d=ir(a);d!==null&&(e.splice(t,3),t-=3,gu(d,{pending:!0,data:c,method:a.method,action:r},r,c))}}))}function $r(e){function t(w){return zo(w,e)}ll!==null&&zo(ll,e),rl!==null&&zo(rl,e),il!==null&&zo(il,e),Vi.forEach(t),Fi.forEach(t);for(var a=0;a<sl.length;a++){var r=sl[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<sl.length&&(a=sl[0],a.blockedOn===null);)Dv(a),a.blockedOn===null&&sl.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||Lv(a);else if(m){var g=null;if(d&&d.hasAttribute("formAction")){if(c=d,m=d[ut]||null)g=m.formAction;else if(bd(c)!==null)continue}else g=m.action;typeof g=="function"?a[r+1]=g:(a.splice(r,3),r-=3),Lv(a)}}}function Bv(){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 Sd(e){this._internalRoot=e}Oo.prototype.render=Sd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var a=t.current,r=ca();Ev(a,r,e,t,null,null)},Oo.prototype.unmount=Sd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ev(e.current,2,null,e,null,null),ho(),t[lr]=null}};function Oo(e){this._internalRoot=e}Oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qa();e={blockedOn:null,target:e,priority:t};for(var a=0;a<sl.length&&t!==0&&t<sl[a].priority;a++);sl.splice(a,0,e),a===0&&Dv(e)}};var qv=l.version;if(qv!=="19.2.7")throw Error(s(527,qv,"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 _0={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Do=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Do.isDisabled&&Do.supportsFiber)try{He=Do.inject(_0),We=Do}catch{}}return Ii.createRoot=function(e,t){if(!u(e))throw Error(s(299));var a=!1,r="",c=Gh,d=Xh,m=Vh;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=Tv(e,1,!1,null,null,a,r,null,c,d,m,Bv),e[lr]=t.current,ad(e),new Sd(t)},Ii.hydrateRoot=function(e,t,a){if(!u(e))throw Error(s(299));var r=!1,c="",d=Gh,m=Xh,g=Vh,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&&(g=a.onRecoverableError),a.formState!==void 0&&(w=a.formState)),t=Tv(e,1,!0,t,a??null,r,c,w,d,m,g,Bv),t.context=Av(null),a=t.current,r=ca(),r=Ce(r),c=Gn(r),c.callback=null,Xn(a,c,r),a=r,t.current.lanes=a,ue(t,a),Ga(t),e[lr]=t.current,ad(e),new Oo(t)},Ii.version="19.2.7",Ii}var Zv;function Y0(){if(Zv)return Cd.exports;Zv=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(),Cd.exports=K0(),Cd.exports}var P0=Y0();/**
|
|
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 Jv="popstate";function Iv(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function G0(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 Pd("",{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 V0(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 X0(){return Math.random().toString(36).substring(2,10)}function Wv(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 Pd(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||X0(),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 V0(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 b(){v="POP";let U=y(),z=U==null?null:U-x;x=U,p&&p({action:v,location:E.location,delta:z})}function j(U,z){v="PUSH";let H=Iv(U)?U:Pd(E.location,U,z);x=y()+1;let L=Wv(H,x),$=E.createHref(H.mask||H);try{h.pushState(L,"",$)}catch(Q){if(Q instanceof DOMException&&Q.name==="DataCloneError")throw Q;u.location.assign($)}f&&p&&p({action:v,location:E.location,delta:1})}function N(U,z){v="REPLACE";let H=Iv(U)?U:Pd(E.location,U,z);x=y();let L=Wv(H,x),$=E.createHref(H.mask||H);h.replaceState(L,"",$),f&&p&&p({action:v,location:E.location,delta:0})}function T(U){return F0(u,U)}let E={get action(){return v},get location(){return n(u,h)},listen(U){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(Jv,b),p=U,()=>{u.removeEventListener(Jv,b),p=null}},createHref(U){return l(u,U)},createURL:T,encodeLocation(U){let z=T(U);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:j,replace:N,go(U){return h.go(U)}};return E}function F0(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 ag(n,l,i="/"){return Z0(n,l,i,!1)}function Z0(n,l,i,s,u){let f=typeof l=="string"?li(l):l,h=Rn(f.pathname||"/",i);if(h==null)return null;let v=J0(n),p=null,x=c1(h);for(let y=0;p==null&&y<v.length;++y)p=s1(v[y],x,s);return p}function J0(n){let l=ng(n);return I0(l),l}function ng(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 b=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 "${b}".`),ng(h.children,l,j,b,p)),!(h.path==null&&!h.index)&&l.push({path:b,score:r1(b,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 lg(h.path))f(h,v,!0,x)}),l}function lg(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=lg(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 I0(n){n.sort((l,i)=>l.score!==i.score?i.score-l.score:i1(l.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var W0=/^:[\w-]+$/,e1=3,t1=2,a1=1,n1=10,l1=-2,ex=n=>n==="*";function r1(n,l){let i=n.split("/"),s=i.length;return i.some(ex)&&(s+=l1),l&&(s+=t1),i.filter(u=>!ex(u)).reduce((u,f)=>u+(W0.test(f)?e1:f===""?a1:n1),s)}function i1(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 s1(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)||"/",b=Vo({path:p.relativePath,caseSensitive:p.caseSensitive,end:x},y),j=p.route;if(!b&&x&&i&&!s[s.length-1].route.index&&(b=Vo({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},y)),!b)return null;Object.assign(u,b.params),h.push({params:u,pathname:Oa([f,b.pathname]),pathnameBase:m1(Oa([f,b.pathnameBase])),route:j}),b.pathnameBase!=="/"&&(f=Oa([f,b.pathnameBase]))}return h}function Vo(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[i,s]=o1(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:b},j)=>{if(y==="*"){let T=v[j]||"";h=f.slice(0,f.length-T.length).replace(/(.)\/+$/,"$1")}const N=v[j];return b&&!N?x[y]=void 0:x[y]=(N||"").replace(/%2F/g,"/"),x},{}),pathname:f,pathnameBase:h,pattern:n}}function o1(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 b=y.charAt(x+h.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 c1(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 Rn(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 u1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function d1(n,l="/"){let{pathname:i,search:s="",hash:u=""}=typeof n=="string"?li(n):n,f;return i?(i=ig(i),i.startsWith("/")?f=tx(i.substring(1),"/"):f=tx(i,l)):f=l,{pathname:f,search:h1(s),hash:p1(u)}}function tx(n,l){let i=Fo(l).split("/");return n.split("/").forEach(u=>{u===".."?i.length>1&&i.pop():u!=="."&&i.push(u)}),i.length>1?i.join("/"):"/"}function kd(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 f1(n){return n.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function rg(n){let l=f1(n);return l.map((i,s)=>s===l.length-1?i.pathname:i.pathnameBase)}function Sf(n,l,i,s=!1){let u;typeof n=="string"?u=li(n):(u={...n},et(!u.pathname||!u.pathname.includes("?"),kd("?","pathname","search",u)),et(!u.pathname||!u.pathname.includes("#"),kd("#","pathname","hash",u)),et(!u.search||!u.search.includes("#"),kd("#","search","hash",u)));let f=n===""||u.pathname==="",h=f?"/":u.pathname,v;if(h==null)v=i;else{let b=l.length-1;if(!s&&h.startsWith("..")){let j=h.split("/");for(;j[0]==="..";)j.shift(),b-=1;u.pathname=j.join("/")}v=b>=0?l[b]:"/"}let p=d1(u,v),x=h&&h!=="/"&&h.endsWith("/"),y=(f||h===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(x||y)&&(p.pathname+="/"),p}var ig=n=>n.replace(/\/\/+/g,"/"),Oa=n=>ig(n.join("/")),Fo=n=>n.replace(/\/+$/,""),m1=n=>Fo(n).replace(/^\/*/,"/"),h1=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,p1=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,v1=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 x1(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function g1(n){let l=n.map(i=>i.route.path).filter(Boolean);return Oa(l)||"/"}var sg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function og(n,l){let i=n;if(typeof i!="string"||!u1.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,u=!1;if(sg)try{let f=new URL(window.location.href),h=i.startsWith("//")?new URL(f.protocol+i):new URL(i),v=Rn(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 cg=["POST","PUT","PATCH","DELETE"];new Set(cg);var b1=["GET",...cg];new Set(b1);var ri=S.createContext(null);ri.displayName="DataRouter";var nc=S.createContext(null);nc.displayName="DataRouterState";var ug=S.createContext(!1);function y1(){return S.useContext(ug)}var dg=S.createContext({isTransitioning:!1});dg.displayName="ViewTransition";var S1=S.createContext(new Map);S1.displayName="Fetchers";var j1=S.createContext(null);j1.displayName="Await";var Ca=S.createContext(null);Ca.displayName="Navigation";var xs=S.createContext(null);xs.displayName="Location";var _n=S.createContext({outlet:null,matches:[],isDataRoute:!1});_n.displayName="Route";var jf=S.createContext(null);jf.displayName="RouteError";var fg="REACT_ROUTER_ERROR",N1="REDIRECT",w1="ROUTE_ERROR_RESPONSE";function M1(n){if(n.startsWith(`${fg}:${N1}:{`))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 C1(n){if(n.startsWith(`${fg}:${w1}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new v1(l.status,l.statusText,l.data)}catch{}}function T1(n,{relative:l}={}){et(gs(),"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}=bs(n,{relative:l}),v=f;return i!=="/"&&(v=f==="/"?i:Oa([i,f])),s.createHref({pathname:v,search:h,hash:u})}function gs(){return S.useContext(xs)!=null}function en(){return et(gs(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(xs).location}var mg="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function hg(n){S.useContext(Ca).static||S.useLayoutEffect(n)}function pg(){let{isDataRoute:n}=S.useContext(_n);return n?H1():A1()}function A1(){et(gs(),"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(_n),{pathname:u}=en(),f=JSON.stringify(rg(s)),h=S.useRef(!1);return hg(()=>{h.current=!0}),S.useCallback((p,x={})=>{if(Da(h.current,mg),!h.current)return;if(typeof p=="number"){i.go(p);return}let y=Sf(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 bs(n,{relative:l}={}){let{matches:i}=S.useContext(_n),{pathname:s}=en(),u=JSON.stringify(rg(i));return S.useMemo(()=>Sf(n,JSON.parse(u),s,l==="path"),[n,u,s,l])}function E1(n,l){return vg(n,l)}function vg(n,l,i){var U;et(gs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=S.useContext(Ca),{matches:u}=S.useContext(_n),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||"";gg(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=en(),b;if(l){let z=typeof l=="string"?li(l):l;et(p==="/"||((U=z.pathname)==null?void 0:U.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.`),b=z}else b=y;let j=b.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})):ag(n,{pathname:N});Da(x||T!=null,`No routes matched location "${b.pathname}${b.search}${b.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 "${b.pathname}${b.search}${b.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=O1(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,...b},navigationType:"POP"}},E):E}function k1(){let n=q1(),l=x1(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 R1=S.createElement(k1,null),xg=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=C1(n.digest);i&&(n=i)}let l=n!==void 0?S.createElement(_n.Provider,{value:this.props.routeContext},S.createElement(jf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?S.createElement(z1,{error:n},l):l}};xg.contextType=ug;var Rd=new WeakMap;function z1({children:n,error:l}){let{basename:i}=S.useContext(Ca);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let s=M1(l.digest);if(s){let u=Rd.get(l);if(u)throw u;let f=og(s.location,i);if(sg&&!Rd.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 Rd.set(l,h),h}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return n}function _1({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(_n.Provider,{value:n},i)}function O1(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(b=>b.route.id&&(f==null?void 0:f[b.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 b=u[y];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(v=y),b.route.id){let{loaderData:j,errors:N}=s,T=b.route.loader&&!j.hasOwnProperty(b.route.id)&&(!N||N[b.route.id]===void 0);if(b.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,b)=>{var j,N;p(y,{location:s.location,params:((N=(j=s.matches)==null?void 0:j[0])==null?void 0:N.params)??{},pattern:g1(s.matches),errorInfo:b})}:void 0;return u.reduceRight((y,b,j)=>{let N,T=!1,E=null,U=null;s&&(N=f&&b.route.id?f[b.route.id]:void 0,E=b.route.errorElement||R1,h&&(v<0&&j===0?(gg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,U=null):v===j&&(T=!0,U=b.route.hydrateFallbackElement||null)));let z=l.concat(u.slice(0,j+1)),H=()=>{let L;return N?L=E:T?L=U:b.route.Component?L=S.createElement(b.route.Component,null):b.route.element?L=b.route.element:L=y,S.createElement(_1,{match:b,routeContext:{outlet:y,matches:z,isDataRoute:s!=null},children:L})};return s&&(b.route.ErrorBoundary||b.route.errorElement||j===0)?S.createElement(xg,{location:s.location,revalidation:s.revalidation,component:E,error:N,children:H(),routeContext:{outlet:null,matches:z,isDataRoute:!0},onError:x}):H()},null)}function Nf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function D1(n){let l=S.useContext(ri);return et(l,Nf(n)),l}function U1(n){let l=S.useContext(nc);return et(l,Nf(n)),l}function L1(n){let l=S.useContext(_n);return et(l,Nf(n)),l}function wf(n){let l=L1(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 B1(){return wf("useRouteId")}function q1(){var s;let n=S.useContext(jf),l=U1("useRouteError"),i=wf("useRouteError");return n!==void 0?n:(s=l.errors)==null?void 0:s[i]}function H1(){let{router:n}=D1("useNavigate"),l=wf("useNavigate"),i=S.useRef(!1);return hg(()=>{i.current=!0}),S.useCallback(async(u,f={})=>{Da(i.current,mg),i.current&&(typeof u=="number"?await n.navigate(u):await n.navigate(u,{fromRouteId:l,...f}))},[n,l])}var ax={};function gg(n,l,i){!l&&!ax[n]&&(ax[n]=!0,Da(!1,i))}S.memo($1);function $1({routes:n,manifest:l,future:i,state:s,isStatic:u,onError:f}){return vg(n,void 0,{manifest:l,state:s,isStatic:u,onError:f})}function Hl(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(!gs(),"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:b="",state:j=null,key:N="default",mask:T}=i,E=S.useMemo(()=>{let U=Rn(x,v);return U==null?null:{location:{pathname:U,search:y,hash:b,state:j,key:N,mask:T},navigationType:s}},[v,x,y,b,j,N,s,T]);return Da(E!=null,`<Router basename="${v}"> is not able to match the URL "${x}${y}${b}" 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 K1({children:n,location:l}){return E1(Gd(n),l)}function Gd(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,Gd(s.props.children,f));return}et(s.type===Hl,`[${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=Gd(s.props.children,f)),i.push(h)}),i}var Ko="get",Yo="application/x-www-form-urlencoded";function lc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Y1(n){return lc(n)&&n.tagName.toLowerCase()==="button"}function P1(n){return lc(n)&&n.tagName.toLowerCase()==="form"}function G1(n){return lc(n)&&n.tagName.toLowerCase()==="input"}function X1(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function V1(n,l){return n.button===0&&(!l||l==="_self")&&!X1(n)}function Xd(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 F1(n,l){let i=Xd(n);return l&&l.forEach((s,u)=>{i.has(u)||l.getAll(u).forEach(f=>{i.append(u,f)})}),i}var Lo=null;function Z1(){if(Lo===null)try{new FormData(document.createElement("form"),0),Lo=!1}catch{Lo=!0}return Lo}var J1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function zd(n){return n!=null&&!J1.has(n)?(Da(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yo}"`),null):n}function I1(n,l){let i,s,u,f,h;if(P1(n)){let v=n.getAttribute("action");s=v?Rn(v,l):null,i=n.getAttribute("method")||Ko,u=zd(n.getAttribute("enctype"))||Yo,f=new FormData(n)}else if(Y1(n)||G1(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?Rn(p,l):null,i=n.getAttribute("formmethod")||v.getAttribute("method")||Ko,u=zd(n.getAttribute("formenctype"))||zd(v.getAttribute("enctype"))||Yo,f=new FormData(v,n),!Z1()){let{name:x,type:y,value:b}=n;if(y==="image"){let j=x?`${x}.`:"";f.append(`${j}x`,"0"),f.append(`${j}y`,"0")}else x&&f.append(x,b)}}else{if(lc(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Ko,s=null,u=Yo,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 Mf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function bg(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&&Rn(u.pathname,l)==="/"?u.pathname=`${Fo(l)}/_root.${s}`:u.pathname=`${Fo(u.pathname)}.${s}`,u}async function W1(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 e2(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 t2(n,l,i){let s=await Promise.all(n.map(async u=>{let f=l.routes[u.route.id];if(f){let h=await W1(f,i);return h.links?h.links():[]}return[]}));return r2(s.flat(1).filter(e2).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function nx(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 b;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:((b=i[0])==null?void 0:b.params)||{},nextUrl:new URL(n,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof j=="boolean")return j}return!0}):[]}function a2(n,l,{includeHydrateFallback:i}={}){return n2(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 n2(n){return[...new Set(n)]}function l2(n){let l={},i=Object.keys(n).sort();for(let s of i)l[s]=n[s];return l}function r2(n,l){let i=new Set;return new Set(l),n.reduce((s,u)=>{let f=JSON.stringify(l2(u));return i.has(f)||(i.add(f),s.push({key:f,link:u})),s},[])}function Cf(){let n=S.useContext(ri);return Mf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function i2(){let n=S.useContext(nc);return Mf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Tf=S.createContext(void 0);Tf.displayName="FrameworkContext";function Af(){let n=S.useContext(Tf);return Mf(n,"You must render this element inside a <HydratedRouter> element"),n}function s2(n,l){let i=S.useContext(Tf),[s,u]=S.useState(!1),[f,h]=S.useState(!1),{onFocus:v,onBlur:p,onMouseEnter:x,onMouseLeave:y,onTouchStart:b}=l,j=S.useRef(null);S.useEffect(()=>{if(n==="render"&&h(!0),n==="viewport"){let E=z=>{z.forEach(H=>{h(H.isIntersecting)})},U=new IntersectionObserver(E,{threshold:.5});return j.current&&U.observe(j.current),()=>{U.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(b,N)}]:[!1,j,{}]}function Wi(n,l){return i=>{n&&n(i),i.defaultPrevented||l(i)}}function o2({page:n,...l}){let i=y1(),{router:s}=Cf(),u=S.useMemo(()=>ag(s.routes,n,s.basename),[s.routes,n,s.basename]);return u?i?S.createElement(u2,{page:n,matches:u,...l}):S.createElement(d2,{page:n,matches:u,...l}):null}function c2(n){let{manifest:l,routeModules:i}=Af(),[s,u]=S.useState([]);return S.useEffect(()=>{let f=!1;return t2(n,l,i).then(h=>{f||u(h)}),()=>{f=!0}},[n,l,i]),s}function u2({page:n,matches:l,...i}){let s=en(),{future:u}=Af(),{basename:f}=Cf(),h=S.useMemo(()=>{if(n===s.pathname+s.search+s.hash)return[];let v=bg(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 d2({page:n,matches:l,...i}){let s=en(),{future:u,manifest:f,routeModules:h}=Af(),{basename:v}=Cf(),{loaderData:p,matches:x}=i2(),y=S.useMemo(()=>nx(n,l,x,f,s,"data"),[n,l,x,f,s]),b=S.useMemo(()=>nx(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,U=!1;if(l.forEach(H=>{var $;let L=f.routes[H.route.id];!L||!L.hasLoader||(!y.some(Q=>Q.route.id===H.route.id)&&H.route.id in p&&(($=h[H.route.id])!=null&&$.shouldRevalidate)||L.hasClientLoader?U=!0:E.add(H.route.id))}),E.size===0)return[];let z=bg(n,v,u.v8_trailingSlashAwareDataRequests,"data");return U&&E.size>0&&z.searchParams.set("_routes",l.filter(H=>E.has(H.route.id)).map(H=>H.route.id).join(",")),[z.pathname+z.search]},[v,u.v8_trailingSlashAwareDataRequests,p,s,f,y,l,n,h]),N=S.useMemo(()=>a2(b,f),[b,f]),T=c2(b);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:U})=>S.createElement("link",{key:E,nonce:i.nonce,...U,crossOrigin:U.crossOrigin??i.crossOrigin})))}function f2(...n){return l=>{n.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var m2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{m2&&(window.__reactRouterVersion="7.17.0")}catch{}function h2({basename:n,children:l,useTransitions:i,window:s}){let u=S.useRef();u.current==null&&(u.current=G0({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 yg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Wl=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:b,viewTransition:j,defaultShouldRevalidate:N,...T},E){let{basename:U,navigator:z,useTransitions:H}=S.useContext(Ca),L=typeof y=="string"&&yg.test(y),$=og(y,U);y=$.to;let Q=T1(y,{relative:u}),F=en(),B=null;if(v){let ie=Sf(v,[],F.mask?F.mask.pathname:"/",!0);U!=="/"&&(ie.pathname=ie.pathname==="/"?U:Oa([U,ie.pathname])),B=z.createHref(ie)}let[Z,J,ae]=s2(s,T),K=x2(y,{replace:h,mask:v,state:p,target:x,preventScrollReset:b,relative:u,viewTransition:j,defaultShouldRevalidate:N,useTransitions:H});function ce(ie){l&&l(ie),ie.defaultPrevented||K(ie)}let I=!($.isExternal||f),pe=S.createElement("a",{...T,...ae,href:(I?B:void 0)||$.absoluteURL||Q,onClick:I?ce:l,ref:f2(E,J),target:x,"data-discover":!L&&i==="render"?"true":void 0});return Z&&!L?S.createElement(S.Fragment,null,pe,S.createElement(o2,{page:Q})):pe});Wl.displayName="Link";var Ef=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 b=bs(h,{relative:x.relative}),j=en(),N=S.useContext(nc),{navigator:T,basename:E}=S.useContext(Ca),U=N!=null&&N2(b)&&v===!0,z=T.encodeLocation?T.encodeLocation(b).pathname:b.pathname,H=j.pathname,L=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;i||(H=H.toLowerCase(),L=L?L.toLowerCase():null,z=z.toLowerCase()),L&&E&&(L=Rn(L,E)||L);const $=z!=="/"&&z.endsWith("/")?z.length-1:z.length;let Q=H===z||!u&&H.startsWith(z)&&H.charAt($)==="/",F=L!=null&&(L===z||!u&&L.startsWith(z)&&L.charAt(z.length)==="/"),B={isActive:Q,isPending:F,isTransitioning:U},Z=Q?l:void 0,J;typeof s=="function"?J=s(B):J=[s,Q?"active":null,F?"pending":null,U?"transitioning":null].filter(Boolean).join(" ");let ae=typeof f=="function"?f(B):f;return S.createElement(Wl,{...x,"aria-current":Z,className:J,ref:y,style:ae,to:h,viewTransition:v},typeof p=="function"?p(B):p)});Ef.displayName="NavLink";var p2=S.forwardRef(({discover:n="render",fetcherKey:l,navigate:i,reloadDocument:s,replace:u,state:f,method:h=Ko,action:v,onSubmit:p,relative:x,preventScrollReset:y,viewTransition:b,defaultShouldRevalidate:j,...N},T)=>{let{useTransitions:E}=S.useContext(Ca),U=S2(),z=j2(v,{relative:x}),H=h.toLowerCase()==="get"?"get":"post",L=typeof v=="string"&&yg.test(v),$=Q=>{if(p&&p(Q),Q.defaultPrevented)return;Q.preventDefault();let F=Q.nativeEvent.submitter,B=(F==null?void 0:F.getAttribute("formmethod"))||h,Z=()=>U(F||Q.currentTarget,{fetcherKey:l,method:B,navigate:i,replace:u,state:f,relative:x,preventScrollReset:y,viewTransition:b,defaultShouldRevalidate:j});E&&i!==!1?S.startTransition(()=>Z()):Z()};return S.createElement("form",{ref:T,method:H,action:z,onSubmit:s?p:$,...N,"data-discover":!L&&n==="render"?"true":void 0})});p2.displayName="Form";function v2(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sg(n){let l=S.useContext(ri);return et(l,v2(n)),l}function x2(n,{target:l,replace:i,mask:s,state:u,preventScrollReset:f,relative:h,viewTransition:v,defaultShouldRevalidate:p,useTransitions:x}={}){let y=pg(),b=en(),j=bs(n,{relative:h});return S.useCallback(N=>{if(V1(N,l)){N.preventDefault();let T=i!==void 0?i:ss(b)===ss(j),E=()=>y(n,{replace:T,mask:s,state:u,preventScrollReset:f,relative:h,viewTransition:v,defaultShouldRevalidate:p});x?S.startTransition(()=>E()):E()}},[b,y,j,i,s,u,l,n,f,h,v,p,x])}function g2(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(Xd(n)),i=S.useRef(!1),s=en(),u=S.useMemo(()=>F1(s.search,i.current?null:l.current),[s.search]),f=pg(),h=S.useCallback((v,p)=>{const x=Xd(typeof v=="function"?v(new URLSearchParams(u)):v);i.current=!0,f("?"+x,p)},[f,u]);return[u,h]}var b2=0,y2=()=>`__${String(++b2)}__`;function S2(){let{router:n}=Sg("useSubmit"),{basename:l}=S.useContext(Ca),i=B1(),s=n.fetch,u=n.navigate;return S.useCallback(async(f,h={})=>{let{action:v,method:p,encType:x,formData:y,body:b}=I1(f,l);if(h.navigate===!1){let j=h.fetcherKey||y2();await s(j,i,h.action||v,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:y,body:b,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:b,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 j2(n,{relative:l}={}){let{basename:i}=S.useContext(Ca),s=S.useContext(_n);et(s,"useFormAction must be used inside a RouteContext");let[u]=s.matches.slice(-1),f={...bs(n||".",{relative:l})},h=en();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(b=>b).forEach(b=>v.append("index",b));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 N2(n,{relative:l}={}){let i=S.useContext(dg);et(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Sg("useViewTransitionState"),u=bs(n,{relative:l});if(!i.isTransitioning)return!1;let f=Rn(i.currentLocation.pathname,s)||i.currentLocation.pathname,h=Rn(i.nextLocation.pathname,s)||i.nextLocation.pathname;return Vo(u.pathname,h)!=null||Vo(u.pathname,f)!=null}var w2=tg(),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(){}},Ql,dl,Pr,Yx,M2=(Yx=class extends ii{constructor(){super();me(this,Ql);me(this,dl);me(this,Pr);ne(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,dl)||this.setEventListener(M(this,Pr))}onUnsubscribe(){var l;this.hasListeners()||((l=M(this,dl))==null||l.call(this),ne(this,dl,void 0))}setEventListener(l){var i;ne(this,Pr,l),(i=M(this,dl))==null||i.call(this),ne(this,dl,l(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(l){M(this,Ql)!==l&&(ne(this,Ql,l),this.onFocus())}onFocus(){const l=this.isFocused();this.listeners.forEach(i=>{i(l)})}isFocused(){var l;return typeof M(this,Ql)=="boolean"?M(this,Ql):((l=globalThis.document)==null?void 0:l.visibilityState)!=="hidden"}},Ql=new WeakMap,dl=new WeakMap,Pr=new WeakMap,Yx),kf=new M2,C2={setTimeout:(n,l)=>setTimeout(n,l),clearTimeout:n=>clearTimeout(n),setInterval:(n,l)=>setInterval(n,l),clearInterval:n=>clearInterval(n)},fl,bf,Px,T2=(Px=class{constructor(){me(this,fl,C2);me(this,bf,!1)}setTimeoutProvider(n){ne(this,fl,n)}setTimeout(n,l){return M(this,fl).setTimeout(n,l)}clearTimeout(n){M(this,fl).clearTimeout(n)}setInterval(n,l){return M(this,fl).setInterval(n,l)}clearInterval(n){M(this,fl).clearInterval(n)}},fl=new WeakMap,bf=new WeakMap,Px),$l=new T2;function A2(n){setTimeout(n,0)}var E2=typeof window>"u"||"Deno"in globalThis;function qt(){}function k2(n,l){return typeof n=="function"?n(l):n}function Vd(n){return typeof n=="number"&&n>=0&&n!==1/0}function jg(n,l){return Math.max(n+(l||0)-Date.now(),0)}function yl(n,l){return typeof n=="function"?n(l):n}function da(n,l){return typeof n=="function"?n(l):n}function lx(n,l){const{type:i="all",exact:s,fetchStatus:u,predicate:f,queryKey:h,stale:v}=n;if(h){if(s){if(l.queryHash!==Rf(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 rx(n,l){const{exact:i,status:s,predicate:u,mutationKey:f}=n;if(f){if(!l.options.mutationKey)return!1;if(i){if(Jl(l.options.mutationKey)!==Jl(f))return!1}else if(!os(l.options.mutationKey,f))return!1}return!(s&&l.state.status!==s||u&&!u(l))}function Rf(n,l){return((l==null?void 0:l.queryKeyHashFn)||Jl)(n)}function Jl(n){return JSON.stringify(n,(l,i)=>Fd(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 R2=Object.prototype.hasOwnProperty;function Ng(n,l,i=0){if(n===l)return n;if(i>500)return l;const s=ix(n)&&ix(l);if(!s&&!(Fd(n)&&Fd(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 b=s?y:h[y],j=n[b],N=l[b];if(j===N){p[b]=j,(s?y<f:R2.call(n,b))&&x++;continue}if(j===null||N===null||typeof j!="object"||typeof N!="object"){p[b]=N;continue}const T=Ng(j,N,i+1);p[b]=T,T===j&&x++}return f===v&&x===f?n:p}function Zo(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 ix(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function Fd(n){if(!sx(n))return!1;const l=n.constructor;if(l===void 0)return!0;const i=l.prototype;return!(!sx(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function sx(n){return Object.prototype.toString.call(n)==="[object Object]"}function z2(n){return new Promise(l=>{$l.setTimeout(l,n)})}function Zd(n,l,i){return typeof i.structuralSharing=="function"?i.structuralSharing(n,l):i.structuralSharing!==!1?Ng(n,l):l}function _2(n,l,i=0){const s=[...n,l];return i&&s.length>i?s.slice(1):s}function O2(n,l,i=0){const s=[l,...n];return i&&s.length>i?s.slice(0,-1):s}var zf=Symbol();function wg(n,l){return!n.queryFn&&(l!=null&&l.initialPromise)?()=>l.initialPromise:!n.queryFn||n.queryFn===zf?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function _f(n,l){return typeof n=="function"?n(...l):!!n}function D2(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=()=>E2;return{isServer(){return n()},setIsServer(l){n=l}}})();function Jd(){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 U2=A2;function L2(){let n=[],l=0,i=v=>{v()},s=v=>{v()},u=U2;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=L2(),Gr,ml,Xr,Gx,B2=(Gx=class extends ii{constructor(){super();me(this,Gr,!0);me(this,ml);me(this,Xr);ne(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,ml)||this.setEventListener(M(this,Xr))}onUnsubscribe(){var l;this.hasListeners()||((l=M(this,ml))==null||l.call(this),ne(this,ml,void 0))}setEventListener(l){var i;ne(this,Xr,l),(i=M(this,ml))==null||i.call(this),ne(this,ml,l(this.setOnline.bind(this)))}setOnline(l){M(this,Gr)!==l&&(ne(this,Gr,l),this.listeners.forEach(s=>{s(l)}))}isOnline(){return M(this,Gr)}},Gr=new WeakMap,ml=new WeakMap,Xr=new WeakMap,Gx),Jo=new B2;function q2(n){return Math.min(1e3*2**n,3e4)}function Mg(n){return(n??"online")==="online"?Jo.isOnline():!0}var Id=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function Cg(n){let l=!1,i=0,s;const u=Jd(),f=()=>u.status!=="pending",h=E=>{var U;if(!f()){const z=new Id(E);j(z),(U=n.onCancel)==null||U.call(n,z)}},v=()=>{l=!0},p=()=>{l=!1},x=()=>kf.isFocused()&&(n.networkMode==="always"||Jo.isOnline())&&n.canRun(),y=()=>Mg(n.networkMode)&&n.canRun(),b=E=>{f()||(s==null||s(),u.resolve(E))},j=E=>{f()||(s==null||s(),u.reject(E))},N=()=>new Promise(E=>{var U;s=z=>{(f()||x())&&E(z)},(U=n.onPause)==null||U.call(n)}).then(()=>{var E;s=void 0,f()||(E=n.onContinue)==null||E.call(n)}),T=()=>{if(f())return;let E;const U=i===0?n.initialPromise:void 0;try{E=U??n.fn()}catch(z){E=Promise.reject(z)}Promise.resolve(E).then(b).catch(z=>{var F;if(f())return;const H=n.retry??(cs.isServer()?0:3),L=n.retryDelay??q2,$=typeof L=="function"?L(i,z):L,Q=H===!0||typeof H=="number"&&i<H||typeof H=="function"&&H(i,z);if(l||!Q){j(z);return}i++,(F=n.onFail)==null||F.call(n,i,z),z2($).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 Kl,Xx,Tg=(Xx=class{constructor(){me(this,Kl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vd(this.gcTime)&&ne(this,Kl,$l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(cs.isServer()?1/0:300*1e3))}clearGcTimeout(){M(this,Kl)!==void 0&&($l.clearTimeout(M(this,Kl)),ne(this,Kl,void 0))}},Kl=new WeakMap,Xx);function H2(n){return{onFetch:(l,i)=>{var y,b,j,N,T;const s=l.options,u=(j=(b=(y=l.fetchOptions)==null?void 0:y.meta)==null?void 0:b.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 U=L=>{D2(L,()=>l.signal,()=>E=!0)},z=wg(l.options,l.fetchOptions),H=async(L,$,Q)=>{if(E)return Promise.reject(l.signal.reason);if($==null&&L.pages.length)return Promise.resolve(L);const B=(()=>{const K={client:l.client,queryKey:l.queryKey,pageParam:$,direction:Q?"backward":"forward",meta:l.options.meta};return U(K),K})(),Z=await z(B),{maxPages:J}=l.options,ae=Q?O2:_2;return{pages:ae(L.pages,Z,J),pageParams:ae(L.pageParams,$,J)}};if(u&&f.length){const L=u==="backward",$=L?$2:ox,Q={pages:f,pageParams:h},F=$(s,Q);v=await H(Q,F,L)}else{const L=n??f.length;do{const $=p===0?h[0]??s.initialPageParam:ox(s,v);if(p>0&&$==null)break;v=await H(v,$),p++}while(p<L)}return v};l.options.persister?l.fetchFn=()=>{var E,U;return(U=(E=l.options).persister)==null?void 0:U.call(E,x,{client:l.client,queryKey:l.queryKey,meta:l.options.meta,signal:l.signal},i)}:l.fetchFn=x}}}function ox(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 $2(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,Yl,Fr,Ma,Pl,St,fs,Gl,ua,Ag,Mn,Vx,Q2=(Vx=class extends Tg{constructor(l){super();me(this,ua);me(this,Vr);me(this,Yl);me(this,Fr);me(this,Ma);me(this,Pl);me(this,St);me(this,fs);me(this,Gl);ne(this,Gl,!1),ne(this,fs,l.defaultOptions),this.setOptions(l.options),this.observers=[],ne(this,Pl,l.client),ne(this,Ma,M(this,Pl).getQueryCache()),this.queryKey=l.queryKey,this.queryHash=l.queryHash,ne(this,Yl,ux(this.options)),this.state=l.state??M(this,Yl),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&&ne(this,Vr,l._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=ux(this.options);i.data!==void 0&&(this.setState(cx(i.data,i.dataUpdatedAt)),ne(this,Yl,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&M(this,Ma).remove(this)}setData(l,i){const s=Zd(this.state.data,l,this.options);return Ne(this,ua,Mn).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,Mn).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,Yl)}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===zf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(l=>yl(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:!jg(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,Gl)||Ne(this,ua,Ag).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,Mn).call(this,{type:"invalidate"})}async fetch(l,i){var x,y,b,j,N,T,E,U,z,H,L;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 $=this.observers.find(Q=>Q.options.queryFn);$&&this.setOptions($.options)}const s=new AbortController,u=$=>{Object.defineProperty($,"signal",{enumerable:!0,get:()=>(ne(this,Gl,!0),s.signal)})},f=()=>{const $=wg(this.options,i),F=(()=>{const B={client:M(this,Pl),queryKey:this.queryKey,meta:this.meta};return u(B),B})();return ne(this,Gl,!1),this.options.persister?this.options.persister($,F,this):$(F)},v=(()=>{const $={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:M(this,Pl),state:this.state,fetchFn:f};return u($),$})(),p=M(this,Vr)==="infinite"?H2(this.options.pages):this.options.behavior;p==null||p.onFetch(v,this),ne(this,Fr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=v.fetchOptions)==null?void 0:y.meta))&&Ne(this,ua,Mn).call(this,{type:"fetch",meta:(b=v.fetchOptions)==null?void 0:b.meta}),ne(this,St,Cg({initialPromise:i==null?void 0:i.initialPromise,fn:v.fetchFn,onCancel:$=>{$ instanceof Id&&$.revert&&this.setState({...M(this,Fr),fetchStatus:"idle"}),s.abort()},onFail:($,Q)=>{Ne(this,ua,Mn).call(this,{type:"failed",failureCount:$,error:Q})},onPause:()=>{Ne(this,ua,Mn).call(this,{type:"pause"})},onContinue:()=>{Ne(this,ua,Mn).call(this,{type:"continue"})},retry:v.options.retry,retryDelay:v.options.retryDelay,networkMode:v.options.networkMode,canRun:()=>!0}));try{const $=await M(this,St).start();if($===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData($),(N=(j=M(this,Ma).config).onSuccess)==null||N.call(j,$,this),(E=(T=M(this,Ma).config).onSettled)==null||E.call(T,$,this.state.error,this),$}catch($){if($ instanceof Id){if($.silent)return M(this,St).promise;if($.revert){if(this.state.data===void 0)throw $;return this.state.data}}throw Ne(this,ua,Mn).call(this,{type:"error",error:$}),(z=(U=M(this,Ma).config).onError)==null||z.call(U,$,this),(L=(H=M(this,Ma).config).onSettled)==null||L.call(H,this.state.data,$,this),$}finally{this.scheduleGc()}}},Vr=new WeakMap,Yl=new WeakMap,Fr=new WeakMap,Ma=new WeakMap,Pl=new WeakMap,St=new WeakMap,fs=new WeakMap,Gl=new WeakMap,ua=new WeakSet,Ag=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Mn=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,...Eg(s.data,this.options),fetchMeta:l.meta??null};case"success":const u={...s,...cx(l.data,l.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!l.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(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})})},Vx);function Eg(n,l){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Mg(l.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function cx(n,l){return{data:n,dataUpdatedAt:l??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ux(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,Oe,ms,Bt,Xl,Zr,Cn,hl,hs,Jr,Ir,Vl,Fl,pl,Wr,Qe,ls,Wd,ef,tf,af,nf,lf,rf,kg,Fx,K2=(Fx=class extends ii{constructor(l,i){super();me(this,Qe);me(this,Zt);me(this,Oe);me(this,ms);me(this,Bt);me(this,Xl);me(this,Zr);me(this,Cn);me(this,hl);me(this,hs);me(this,Jr);me(this,Ir);me(this,Vl);me(this,Fl);me(this,pl);me(this,Wr,new Set);this.options=i,ne(this,Zt,l),ne(this,hl,null),ne(this,Cn,Jd()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(M(this,Oe).addObserver(this),dx(M(this,Oe),this.options)?Ne(this,Qe,ls).call(this):this.updateResult(),Ne(this,Qe,af).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sf(M(this,Oe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sf(M(this,Oe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,Qe,nf).call(this),Ne(this,Qe,lf).call(this),M(this,Oe).removeObserver(this)}setOptions(l){const i=this.options,s=M(this,Oe);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,Oe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,Qe,rf).call(this),M(this,Oe).setOptions(this.options),i._defaulted&&!Zo(this.options,i)&&M(this,Zt).getQueryCache().notify({type:"observerOptionsUpdated",query:M(this,Oe),observer:this});const u=this.hasListeners();u&&fx(M(this,Oe),s,this.options,i)&&Ne(this,Qe,ls).call(this),this.updateResult(),u&&(M(this,Oe)!==s||da(this.options.enabled,M(this,Oe))!==da(i.enabled,M(this,Oe))||yl(this.options.staleTime,M(this,Oe))!==yl(i.staleTime,M(this,Oe)))&&Ne(this,Qe,Wd).call(this);const f=Ne(this,Qe,ef).call(this);u&&(M(this,Oe)!==s||da(this.options.enabled,M(this,Oe))!==da(i.enabled,M(this,Oe))||f!==M(this,pl))&&Ne(this,Qe,tf).call(this,f)}getOptimisticResult(l){const i=M(this,Zt).getQueryCache().build(M(this,Zt),l),s=this.createResult(i,l);return P2(this,s)&&(ne(this,Bt,s),ne(this,Zr,this.options),ne(this,Xl,M(this,Oe).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,Cn).status==="pending"&&M(this,Cn).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,Oe)}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 J;const s=M(this,Oe),u=this.options,f=M(this,Bt),h=M(this,Xl),v=M(this,Zr),x=l!==s?l.state:M(this,ms),{state:y}=l;let b={...y},j=!1,N;if(i._optimisticResults){const ae=this.hasListeners(),K=!ae&&dx(l,i),ce=ae&&fx(l,s,i,u);(K||ce)&&(b={...b,...Eg(y.data,l.options)}),i._optimisticResults==="isRestoring"&&(b.fetchStatus="idle")}let{error:T,errorUpdatedAt:E,status:U}=b;N=b.data;let z=!1;if(i.placeholderData!==void 0&&N===void 0&&U==="pending"){let ae;f!=null&&f.isPlaceholderData&&i.placeholderData===(v==null?void 0:v.placeholderData)?(ae=f.data,z=!0):ae=typeof i.placeholderData=="function"?i.placeholderData((J=M(this,Ir))==null?void 0:J.state.data,M(this,Ir)):i.placeholderData,ae!==void 0&&(U="success",N=Zd(f==null?void 0:f.data,ae,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{ne(this,hs,i.select),N=i.select(N),N=Zd(f==null?void 0:f.data,N,i),ne(this,Jr,N),ne(this,hl,null)}catch(ae){ne(this,hl,ae)}M(this,hl)&&(T=M(this,hl),N=M(this,Jr),E=Date.now(),U="error");const H=b.fetchStatus==="fetching",L=U==="pending",$=U==="error",Q=L&&H,F=N!==void 0,Z={status:U,fetchStatus:b.fetchStatus,isPending:L,isSuccess:U==="success",isError:$,isInitialLoading:Q,isLoading:Q,data:N,dataUpdatedAt:b.dataUpdatedAt,error:T,errorUpdatedAt:E,failureCount:b.fetchFailureCount,failureReason:b.fetchFailureReason,errorUpdateCount:b.errorUpdateCount,isFetched:l.isFetched(),isFetchedAfterMount:b.dataUpdateCount>x.dataUpdateCount||b.errorUpdateCount>x.errorUpdateCount,isFetching:H,isRefetching:H&&!L,isLoadingError:$&&!F,isPaused:b.fetchStatus==="paused",isPlaceholderData:j,isRefetchError:$&&F,isStale:Of(l,i),refetch:this.refetch,promise:M(this,Cn),isEnabled:da(i.enabled,l)!==!1};if(this.options.experimental_prefetchInRender){const ae=Z.data!==void 0,K=Z.status==="error"&&!ae,ce=ie=>{K?ie.reject(Z.error):ae&&ie.resolve(Z.data)},I=()=>{const ie=ne(this,Cn,Z.promise=Jd());ce(ie)},pe=M(this,Cn);switch(pe.status){case"pending":l.queryHash===s.queryHash&&ce(pe);break;case"fulfilled":(K||Z.data!==pe.value)&&I();break;case"rejected":(!K||Z.error!==pe.reason)&&I();break}}return Z}updateResult(){const l=M(this,Bt),i=this.createResult(M(this,Oe),this.options);if(ne(this,Xl,M(this,Oe).state),ne(this,Zr,this.options),M(this,Xl).data!==void 0&&ne(this,Ir,M(this,Oe)),Zo(i,l))return;ne(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,kg).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,Qe,af).call(this)}},Zt=new WeakMap,Oe=new WeakMap,ms=new WeakMap,Bt=new WeakMap,Xl=new WeakMap,Zr=new WeakMap,Cn=new WeakMap,hl=new WeakMap,hs=new WeakMap,Jr=new WeakMap,Ir=new WeakMap,Vl=new WeakMap,Fl=new WeakMap,pl=new WeakMap,Wr=new WeakMap,Qe=new WeakSet,ls=function(l){Ne(this,Qe,rf).call(this);let i=M(this,Oe).fetch(this.options,l);return l!=null&&l.throwOnError||(i=i.catch(qt)),i},Wd=function(){Ne(this,Qe,nf).call(this);const l=yl(this.options.staleTime,M(this,Oe));if(cs.isServer()||M(this,Bt).isStale||!Vd(l))return;const s=jg(M(this,Bt).dataUpdatedAt,l)+1;ne(this,Vl,$l.setTimeout(()=>{M(this,Bt).isStale||this.updateResult()},s))},ef=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(M(this,Oe)):this.options.refetchInterval)??!1},tf=function(l){Ne(this,Qe,lf).call(this),ne(this,pl,l),!(cs.isServer()||da(this.options.enabled,M(this,Oe))===!1||!Vd(M(this,pl))||M(this,pl)===0)&&ne(this,Fl,$l.setInterval(()=>{(this.options.refetchIntervalInBackground||kf.isFocused())&&Ne(this,Qe,ls).call(this)},M(this,pl)))},af=function(){Ne(this,Qe,Wd).call(this),Ne(this,Qe,tf).call(this,Ne(this,Qe,ef).call(this))},nf=function(){M(this,Vl)!==void 0&&($l.clearTimeout(M(this,Vl)),ne(this,Vl,void 0))},lf=function(){M(this,Fl)!==void 0&&($l.clearInterval(M(this,Fl)),ne(this,Fl,void 0))},rf=function(){const l=M(this,Zt).getQueryCache().build(M(this,Zt),this.options);if(l===M(this,Oe))return;const i=M(this,Oe);ne(this,Oe,l),ne(this,ms,l.state),this.hasListeners()&&(i==null||i.removeObserver(this),l.addObserver(this))},kg=function(l){vt.batch(()=>{l.listeners&&this.listeners.forEach(i=>{i(M(this,Bt))}),M(this,Zt).getQueryCache().notify({query:M(this,Oe),type:"observerResultsUpdated"})})},Fx);function Y2(n,l){return da(l.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&da(l.retryOnMount,n)===!1)}function dx(n,l){return Y2(n,l)||n.state.data!==void 0&&sf(n,l,l.refetchOnMount)}function sf(n,l,i){if(da(l.enabled,n)!==!1&&yl(l.staleTime,n)!=="static"){const s=typeof i=="function"?i(n):i;return s==="always"||s!==!1&&Of(n,l)}return!1}function fx(n,l,i,s){return(n!==l||da(s.enabled,n)===!1)&&(!i.suspense||n.state.status!=="error")&&Of(n,i)}function Of(n,l){return da(l.enabled,n)!==!1&&n.isStaleByTime(yl(l.staleTime,n))}function P2(n,l){return!Zo(n.getCurrentResult(),l)}var ps,Va,Rt,Zl,Fa,cl,Zx,G2=(Zx=class extends Tg{constructor(l){super();me(this,Fa);me(this,ps);me(this,Va);me(this,Rt);me(this,Zl);ne(this,ps,l.client),this.mutationId=l.mutationId,ne(this,Rt,l.mutationCache),ne(this,Va,[]),this.state=l.state||Rg(),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,Va).includes(l)||(M(this,Va).push(l),this.clearGcTimeout(),M(this,Rt).notify({type:"observerAdded",mutation:this,observer:l}))}removeObserver(l){ne(this,Va,M(this,Va).filter(i=>i!==l)),this.scheduleGc(),M(this,Rt).notify({type:"observerRemoved",mutation:this,observer:l})}optionalRemove(){M(this,Va).length||(this.state.status==="pending"?this.scheduleGc():M(this,Rt).remove(this))}continue(){var l;return((l=M(this,Zl))==null?void 0:l.continue())??this.execute(this.state.variables)}async execute(l){var h,v,p,x,y,b,j,N,T,E,U,z,H,L,$,Q,F,B;const i=()=>{Ne(this,Fa,cl).call(this,{type:"continue"})},s={client:M(this,ps),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,Zl,Cg({fn:()=>this.options.mutationFn?this.options.mutationFn(l,s):Promise.reject(new Error("No mutationFn found")),onFail:(Z,J)=>{Ne(this,Fa,cl).call(this,{type:"failed",failureCount:Z,error:J})},onPause:()=>{Ne(this,Fa,cl).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,Zl).canStart();try{if(u)i();else{Ne(this,Fa,cl).call(this,{type:"pending",variables:l,isPaused:f}),M(this,Rt).config.onMutate&&await M(this,Rt).config.onMutate(l,this,s);const J=await((v=(h=this.options).onMutate)==null?void 0:v.call(h,l,s));J!==this.state.context&&Ne(this,Fa,cl).call(this,{type:"pending",context:J,variables:l,isPaused:f})}const Z=await M(this,Zl).start();return await((x=(p=M(this,Rt).config).onSuccess)==null?void 0:x.call(p,Z,l,this.state.context,this,s)),await((b=(y=this.options).onSuccess)==null?void 0:b.call(y,Z,l,this.state.context,s)),await((N=(j=M(this,Rt).config).onSettled)==null?void 0:N.call(j,Z,null,this.state.variables,this.state.context,this,s)),await((E=(T=this.options).onSettled)==null?void 0:E.call(T,Z,null,l,this.state.context,s)),Ne(this,Fa,cl).call(this,{type:"success",data:Z}),Z}catch(Z){try{await((z=(U=M(this,Rt).config).onError)==null?void 0:z.call(U,Z,l,this.state.context,this,s))}catch(J){Promise.reject(J)}try{await((L=(H=this.options).onError)==null?void 0:L.call(H,Z,l,this.state.context,s))}catch(J){Promise.reject(J)}try{await((Q=($=M(this,Rt).config).onSettled)==null?void 0:Q.call($,void 0,Z,this.state.variables,this.state.context,this,s))}catch(J){Promise.reject(J)}try{await((B=(F=this.options).onSettled)==null?void 0:B.call(F,void 0,Z,l,this.state.context,s))}catch(J){Promise.reject(J)}throw Ne(this,Fa,cl).call(this,{type:"error",error:Z}),Z}finally{M(this,Rt).runNext(this)}}},ps=new WeakMap,Va=new WeakMap,Rt=new WeakMap,Zl=new WeakMap,Fa=new WeakSet,cl=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,Va).forEach(s=>{s.onMutationUpdate(l)}),M(this,Rt).notify({mutation:this,type:"updated",action:l})})},Zx);function Rg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Tn,_a,vs,Jx,X2=(Jx=class extends ii{constructor(l={}){super();me(this,Tn);me(this,_a);me(this,vs);this.config=l,ne(this,Tn,new Set),ne(this,_a,new Map),ne(this,vs,0)}build(l,i,s){const u=new G2({client:l,mutationCache:this,mutationId:++Uo(this,vs)._,options:l.defaultMutationOptions(i),state:s});return this.add(u),u}add(l){M(this,Tn).add(l);const i=Bo(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,Tn).delete(l)){const i=Bo(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=Bo(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=Bo(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,Tn).forEach(l=>{this.notify({type:"removed",mutation:l})}),M(this,Tn).clear(),M(this,_a).clear()})}getAll(){return Array.from(M(this,Tn))}find(l){const i={exact:!0,...l};return this.getAll().find(s=>rx(i,s))}findAll(l={}){return this.getAll().filter(i=>rx(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))))}},Tn=new WeakMap,_a=new WeakMap,vs=new WeakMap,Jx);function Bo(n){var l;return(l=n.options.scope)==null?void 0:l.id}var An,vl,Jt,En,kn,Po,of,Ix,V2=(Ix=class extends ii{constructor(i,s){super();me(this,kn);me(this,An);me(this,vl);me(this,Jt);me(this,En);ne(this,An,i),this.setOptions(s),this.bindMethods(),Ne(this,kn,Po).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,An).defaultMutationOptions(i),Zo(this.options,s)||M(this,An).getMutationCache().notify({type:"observerOptionsUpdated",mutation:M(this,Jt),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Jl(s.mutationKey)!==Jl(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,kn,Po).call(this),Ne(this,kn,of).call(this,i)}getCurrentResult(){return M(this,vl)}reset(){var i;(i=M(this,Jt))==null||i.removeObserver(this),ne(this,Jt,void 0),Ne(this,kn,Po).call(this),Ne(this,kn,of).call(this)}mutate(i,s){var u;return ne(this,En,s),(u=M(this,Jt))==null||u.removeObserver(this),ne(this,Jt,M(this,An).getMutationCache().build(M(this,An),this.options)),M(this,Jt).addObserver(this),M(this,Jt).execute(i)}},An=new WeakMap,vl=new WeakMap,Jt=new WeakMap,En=new WeakMap,kn=new WeakSet,Po=function(){var s;const i=((s=M(this,Jt))==null?void 0:s.state)??Rg();ne(this,vl,{...i,isPending:i.status==="pending",isSuccess:i.status==="success",isError:i.status==="error",isIdle:i.status==="idle",mutate:this.mutate,reset:this.reset})},of=function(i){vt.batch(()=>{var s,u,f,h,v,p,x,y;if(M(this,En)&&this.hasListeners()){const b=M(this,vl).variables,j=M(this,vl).context,N={client:M(this,An),meta:this.options.meta,mutationKey:this.options.mutationKey};if((i==null?void 0:i.type)==="success"){try{(u=(s=M(this,En)).onSuccess)==null||u.call(s,i.data,b,j,N)}catch(T){Promise.reject(T)}try{(h=(f=M(this,En)).onSettled)==null||h.call(f,i.data,null,b,j,N)}catch(T){Promise.reject(T)}}else if((i==null?void 0:i.type)==="error"){try{(p=(v=M(this,En)).onError)==null||p.call(v,i.error,b,j,N)}catch(T){Promise.reject(T)}try{(y=(x=M(this,En)).onSettled)==null||y.call(x,void 0,i.error,b,j,N)}catch(T){Promise.reject(T)}}}this.listeners.forEach(b=>{b(M(this,vl))})})},Ix),Za,Wx,F2=(Wx=class extends ii{constructor(l={}){super();me(this,Za);this.config=l,ne(this,Za,new Map)}build(l,i,s){const u=i.queryKey,f=i.queryHash??Rf(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,Za).has(l.queryHash)||(M(this,Za).set(l.queryHash,l),this.notify({type:"added",query:l}))}remove(l){const i=M(this,Za).get(l.queryHash);i&&(l.destroy(),i===l&&M(this,Za).delete(l.queryHash),this.notify({type:"removed",query:l}))}clear(){vt.batch(()=>{this.getAll().forEach(l=>{this.remove(l)})})}get(l){return M(this,Za).get(l)}getAll(){return[...M(this,Za).values()]}find(l){const i={exact:!0,...l};return this.getAll().find(s=>lx(i,s))}findAll(l={}){const i=this.getAll();return Object.keys(l).length>0?i.filter(s=>lx(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()})})}},Za=new WeakMap,Wx),lt,xl,gl,ei,ti,bl,ai,ni,eg,Z2=(eg=class{constructor(n={}){me(this,lt);me(this,xl);me(this,gl);me(this,ei);me(this,ti);me(this,bl);me(this,ai);me(this,ni);ne(this,lt,n.queryCache||new F2),ne(this,xl,n.mutationCache||new X2),ne(this,gl,n.defaultOptions||{}),ne(this,ei,new Map),ne(this,ti,new Map),ne(this,bl,0)}mount(){Uo(this,bl)._++,M(this,bl)===1&&(ne(this,ai,kf.subscribe(async n=>{n&&(await this.resumePausedMutations(),M(this,lt).onFocus())})),ne(this,ni,Jo.subscribe(async n=>{n&&(await this.resumePausedMutations(),M(this,lt).onOnline())})))}unmount(){var n,l;Uo(this,bl)._--,M(this,bl)===0&&((n=M(this,ai))==null||n.call(this),ne(this,ai,void 0),(l=M(this,ni))==null||l.call(this),ne(this,ni,void 0))}isFetching(n){return M(this,lt).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return M(this,xl).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(yl(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=k2(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(yl(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 Jo.isOnline()?M(this,xl).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(this,lt)}getMutationCache(){return M(this,xl)}getDefaultOptions(){return M(this,gl)}setDefaultOptions(n){ne(this,gl,n)}setQueryDefaults(n,l){M(this,ei).set(Jl(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(Jl(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,gl).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return l.queryHash||(l.queryHash=Rf(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===zf&&(l.enabled=!1),l}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...M(this,gl).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){M(this,lt).clear(),M(this,xl).clear()}},lt=new WeakMap,xl=new WeakMap,gl=new WeakMap,ei=new WeakMap,ti=new WeakMap,bl=new WeakMap,ai=new WeakMap,ni=new WeakMap,eg),zg=S.createContext(void 0),Wt=n=>{const l=S.useContext(zg);if(!l)throw new Error("No QueryClient set, use QueryClientProvider to set one");return l},J2=({client:n,children:l})=>(S.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),o.jsx(zg.Provider,{value:n,children:l})),_g=S.createContext(!1),I2=()=>S.useContext(_g);_g.Provider;function W2(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var eS=S.createContext(W2()),tS=()=>S.useContext(eS),aS=(n,l,i)=>{const s=i!=null&&i.state.error&&typeof n.throwOnError=="function"?_f(n.throwOnError,[i.state.error,i]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||s)&&(l.isReset()||(n.retryOnMount=!1))},nS=n=>{S.useEffect(()=>{n.clearReset()},[n])},lS=({result:n,errorResetBoundary:l,throwOnError:i,query:s,suspense:u})=>n.isError&&!l.isReset()&&!n.isFetching&&s&&(u&&n.data===void 0||_f(i,[n.error,s])),rS=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))}},iS=(n,l)=>n.isLoading&&n.isFetching&&!l,sS=(n,l)=>(n==null?void 0:n.suspense)&&l.isPending,mx=(n,l,i)=>l.fetchOptimistic(n).catch(()=>{i.clearReset()});function oS(n,l,i){var N,T,E,U;const s=I2(),u=tS(),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,rS(h),aS(h,u,v),nS(u);const x=!f.getQueryCache().get(h.queryHash),[y]=S.useState(()=>new l(f,h)),b=y.getOptimisticResult(h),j=!s&&p;if(S.useSyncExternalStore(S.useCallback(z=>{const H=j?y.subscribe(vt.batchCalls(z)):qt;return y.updateResult(),H},[y,j]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(h)},[h,y]),sS(h,b))throw mx(h,y,u);if(lS({result:b,errorResetBoundary:u,throwOnError:h.throwOnError,query:v,suspense:h.suspense}))throw b.error;if((U=(E=f.getDefaultOptions().queries)==null?void 0:E._experimental_afterQuery)==null||U.call(E,h,b),h.experimental_prefetchInRender&&!cs.isServer()&&iS(b,s)){const z=x?mx(h,y,u):v==null?void 0:v.promise;z==null||z.catch(qt).finally(()=>{y.updateResult()})}return h.notifyOnChangeProps?b:y.trackResult(b)}function $t(n,l){return oS(n,K2)}function zt(n,l){const i=Wt(),[s]=S.useState(()=>new V2(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&&_f(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 Og=(...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 cS=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 uS=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 hx=n=>{const l=uS(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 _d={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 dS=n=>{for(const l in n)if(l.startsWith("aria-")||l==="role"||l==="title")return!0;return!1},fS=S.createContext({}),mS=()=>S.useContext(fS),hS=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:b=!1,color:j="currentColor",className:N=""}=mS()??{},T=s??b?Number(i??y)*24/Number(l??x):i??y;return S.createElement("svg",{ref:p,..._d,width:l??x??_d.width,height:l??x??_d.height,stroke:n??j,strokeWidth:T,className:Og("lucide",N,u),...!f&&!dS(v)&&{"aria-hidden":"true"},...v},[...h.map(([E,U])=>S.createElement(E,U)),...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(hS,{ref:f,iconNode:l,className:Og(`lucide-${cS(hx(n))}`,`lucide-${n}`,s),...u}));return i.displayName=hx(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 pS=[["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"}]],vS=De("activity",pS);/**
|
|
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 xS=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],gS=De("arrow-down",xS);/**
|
|
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 bS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],rc=De("arrow-right",bS);/**
|
|
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 yS=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],SS=De("arrow-up-right",yS);/**
|
|
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 jS=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Dg=De("arrow-up",jS);/**
|
|
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 NS=[["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"}]],wS=De("box",NS);/**
|
|
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 MS=[["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"}]],CS=De("boxes",MS);/**
|
|
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 TS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ht=De("check",TS);/**
|
|
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 AS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ES=De("chevron-down",AS);/**
|
|
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 kS=[["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"}]],cf=De("circle-dashed",kS);/**
|
|
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 RS=[["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"}]],zS=De("clipboard",RS);/**
|
|
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 _S=[["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"}]],OS=De("copy",_S);/**
|
|
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 DS=[["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"}]],US=De("cpu",DS);/**
|
|
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 LS=[["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",LS);/**
|
|
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 BS=[["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"}]],qS=De("database",BS);/**
|
|
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 HS=[["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"}]],Ug=De("git-branch",HS);/**
|
|
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 $S=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Df=De("image",$S);/**
|
|
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 QS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],KS=De("info",QS);/**
|
|
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 YS=[["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"}]],PS=De("landmark",YS);/**
|
|
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 GS=[["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"}]],XS=De("list",GS);/**
|
|
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 VS=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tt=De("loader-circle",VS);/**
|
|
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 FS=[["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"}]],ZS=De("network",FS);/**
|
|
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 JS=[["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"}]],IS=De("pencil",JS);/**
|
|
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 WS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ds=De("plus",WS);/**
|
|
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 ej=[["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"}]],Io=De("refresh-cw",ej);/**
|
|
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 tj=[["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"}]],aj=De("rotate-ccw",tj);/**
|
|
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 nj=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ys=De("search",nj);/**
|
|
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 lj=[["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"}]],rj=De("settings-2",lj);/**
|
|
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 ij=[["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"}]],sj=De("shield-check",ij);/**
|
|
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 oj=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],cj=De("smartphone",oj);/**
|
|
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 uj=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],dj=De("terminal",uj);/**
|
|
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 fj=[["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"}]],Uf=De("trash-2",fj);/**
|
|
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 mj=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],hj=De("trending-up",mj);/**
|
|
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 pj=[["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",pj);/**
|
|
266
|
+
* @license lucide-react v1.17.0 - ISC
|
|
267
|
+
*
|
|
268
|
+
* This source code is licensed under the ISC license.
|
|
269
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
+
*/const vj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Il=De("x",vj);class Lg extends Error{constructor(i,s,u){super(i);jd(this,"status");jd(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 Lg(((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 Lg(((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 ic(){return $t({queryKey:["ledger","inferences"],queryFn:()=>Qt("/ledger/inferences"),refetchInterval:1e4})}function xj(){return $t({queryKey:["ledger","purchases"],queryFn:()=>Qt("/ledger/purchases"),refetchInterval:1e4})}function Lf(){return $t({queryKey:["payments"],queryFn:()=>Qt("/payments"),refetchInterval:1e4})}function gj(){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 Bf(){const n=Wt();return zt({mutationFn:()=>xt("POST","/payments/clawtip/activate"),onSuccess:()=>{n.invalidateQueries({queryKey:["payments"]})}})}function qf(){return zt({mutationFn:()=>xt("POST","/payments/clawtip/recharge")})}function Bg(){return $t({queryKey:["routing","strategy"],queryFn:()=>Qt("/routing/strategy")})}function bj(){const n=Wt();return zt({mutationFn:l=>xt("PUT","/routing/strategy",l),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","strategy"]})}})}function qg(){return $t({queryKey:["routing","provider-mode"],queryFn:()=>Qt("/routing/provider-mode")})}function yj(){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 Hg(){return $t({queryKey:["routing","auto-provider"],queryFn:()=>Qt("/routing/auto-provider")})}function Sj(){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 $g(){return $t({queryKey:["routing","manual-providers"],queryFn:()=>Qt("/routing/manual-providers")})}function jj(){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 Nj(){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 wj(){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 Mj(){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 Cj(){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 Tj(n){return xt("POST","/routing/manual-providers/probe",n)}function Aj(n){const l=new URLSearchParams;for(const[i,s]of Object.entries(n))s!=null&&s!==""&&l.set(i,Ej(s));return $t({queryKey:["routing","preview",l.toString()],queryFn:()=>Qt(`/routing/preview?${l.toString()}`),enabled:!1})}function Ej(n){return Array.isArray(n)?n.join(","):typeof n=="object"&&n!==null?Object.entries(n).map(([l,i])=>`${l}:${i}`).join(","):String(n)}function Qg(){return $t({queryKey:["sellers"],queryFn:()=>Qt("/sellers"),refetchInterval:3e4})}function sc(){return $t({queryKey:["models"],queryFn:()=>Qt("/models"),refetchInterval:3e4})}function kj(){return $t({queryKey:["prewarm","focus-set"],queryFn:()=>Qt("/v1.2/prewarm").then(n=>({ok:!0,focusSet:n.focusSet??[],source:"historical"}))})}async function uf(n){const l=Array.isArray(n)?{models:n}:n;return xt("PUT","/prewarm/focus-set",l)}function Hf(){return $t({queryKey:["status"],queryFn:()=>Qt("/status"),refetchInterval:5e3})}function Rj(){return $t({queryKey:["update","status"],queryFn:()=>Qt("/update/status"),refetchInterval:3600*1e3})}function zj(){return zt({mutationFn:()=>xt("POST","/update/run")})}const Me="—",tn="-",It=n=>n<10?`0${n}`:`${n}`;function df(n,l={}){if(!Number.isFinite(n))return Me;const i=n;return i<=0?tn: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 Go(n){if(!Number.isFinite(n))return Me;const l=n;return l<=0?tn: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 Kg(n){return Number.isFinite(n)?n<=0?tn:`${n.toFixed(1)} tok/s`:Me}function oc(n){return Number.isFinite(n)?n<=0?tn:n.toFixed(1):Me}function we(n){return Number.isFinite(n)?n===0?tn:Math.round(n).toLocaleString("en-US"):Me}function Ia(n,l={}){if(!Number.isFinite(n))return Me;if(n===0)return tn;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 ul(n,l={}){return Ia(n,{digits:l.digits??6})}function _j(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"?`${px(l)}${i}`:`${px(l)}${i} ${l}`:Number.isFinite(n.paymentAmountMinor)&&l?`${we(n.paymentAmountMinor)} ${l} minor`:Me}function Oj(n,l){if(!Number.isFinite(n)||!l)return Me;const i=l.trim().toUpperCase();return i==="USD"?`$${(n/100).toFixed(4)}`:i==="CNY"?`¥${(n/100).toFixed(2)} CNY`:`${we(n)} ${i} minor`}function px(n){return n==="USD"?"$":n==="CNY"?"¥":n==="EUR"?"€":n==="GBP"?"£":""}function Dj(n,l,i={}){return!Number.isFinite(n)&&!Number.isFinite(l)?Me:`${Ia(n,i)} / ${Ia(l,i)}`}function zn(n){if(!Number.isFinite(n))return Me;const l=Math.max(0,Math.round(n));return l===0?tn:l<1e3?`${l}ms`:`${(l/1e3).toFixed(2)}s`}function Yg(n){return Number.isFinite(n)?`${Math.round(n*100)}%`:Me}function $f(n){if(!Number.isFinite(n))return Me;const l=Math.max(0,n);return l===0?"免费":Math.abs(l-1)<1e-4?"原价":`${Lj(l*10)}折`}function vx(n,l){return Dj(n,l,{digits:4})}function Wo(n){const l=Ia(n,{digits:4});return l===Me||l===tn?l:`${l} / 1M Token`}function Uj(n){return Number.isFinite(n)?n<=0?tn:`${n.toFixed(2)}x`:Me}function Lj(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("_"," "):Me}function Od(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 Bj(n){return n?n.startsWith("tbs-")&&n.length>10?n.slice(0,10):n.length<=12?n:n.slice(0,12):Me}function qj(n){if(!n)return Me;const l=new Date(n);if(Number.isNaN(l.getTime()))return Me;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 cc(n){if(!n)return Me;const l=new Date(n);return Number.isNaN(l.getTime())?Me:`${l.getFullYear()}-${It(l.getMonth()+1)}-${It(l.getDate())} ${It(l.getHours())}:${It(l.getMinutes())}:${It(l.getSeconds())}`}function uc(n){if(!n)return Me;const l=new Date(n);return Number.isNaN(l.getTime())?Me:`${l.getFullYear()}/${It(l.getMonth()+1)}/${It(l.getDate())} ${It(l.getHours())}:${It(l.getMinutes())}:${It(l.getSeconds())}`}function Hj(n){return qj(n)}function Pg(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(Wa(s.paymentMethod),s.balanceSnapshotMicros);return[...n].filter(s=>Wa(s.method)!=="mock").sort((s,u)=>Number(u.isDefault)-Number(s.isDefault)||s.method.localeCompare(u.method)).map(s=>{const u=Wa(s.method),f=s.enabled||!!(s.config&&Object.keys(s.config).length>0),h=i.get(u),v=u==="clawtip";return{name:Xg(s.method),method:s.method,balance:v?"••••":Ia(h),status:s.enabled?"Bound":"Available",note:f?s.isDefault?"Default wallet":"Configured":"Not bound",action:s.enabled?"Recharge":"Activate",icon:$j(s.method),balanceHidden:v,config:s.config}})}function Gg({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&&Wa(n.method)==="clawtip",x=Dd(v==null?void 0:v.config,"resourceUrl"),y=Dd(v==null?void 0:v.config,"walletConfigPath"),b=Dd(v==null?void 0:v.config,"orderNo"),j=(i==null?void 0:i.walletConfigPresent)===!0||Vg(v==null?void 0:v.config,"walletConfigPresent"),N=!h&&!!(i!=null&&i.qrImageUrl)&&!j&&!u,T=(v==null?void 0:v.name)??Xg(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(Il,{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||b?o.jsx(es,{label:"Order",value:(i==null?void 0:i.orderNo)??b??""}):null,i!=null&&i.walletConfigPath||y?o.jsx(es,{label:"Config",value:Kj((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:Qj((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 Xg(n){const l=Wa(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 Wa(n){return n.trim().toLowerCase()}function Vg(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 $j(n){const l=Wa(n);return l==="clawtip"?"C":l==="wechat-pay"?"W":l==="alipay-agent"?"A":l.charAt(0).toUpperCase()||"P"}function Qj(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 Kj(n){const l=n.split("/");return l.length<=3?n:`.../${l.slice(-2).join("/")}`}function Dd(n,l){const i=n==null?void 0:n[l];return typeof i=="string"&&i.length>0?i:void 0}const Yj=320,Ud=12;function Pj({inputTokens:n,outputTokens:l,cacheReadTokens:i}){const s=Jg(n,l,i),u=Number.isFinite(i),f=Number.isFinite(i)&&i>0,h=[{label:"输入 Token",value:we(n)},{label:"输出 Token",value:we(l)}];return u&&h.push({label:"缓存读取 Token",value:we(i)}),h.push({label:"总 Token",value:we(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(gS,{className:"size-3.5 text-[var(--color-success)]","aria-hidden":"true"}),we(n)]}),o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx(Dg,{className:"size-3.5 text-[var(--color-primary)]","aria-hidden":"true"}),we(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(qS,{className:"size-3.5","aria-hidden":"true"}),df(i)]}):null]}),o.jsx(Qf,{ariaLabel:"Token 明细",children:o.jsx(Kf,{title:"Token 明细",rows:h})})]})}function Gj({imageCount:n,imageSize:l,imageQuality:i,imageOutputFormat:s}){const u=[{label:"图片数量",value:we(n)},{label:"尺寸",value:l||Me},{label:"质量",value:i||Me},{label:"输出格式",value:s||Me}];return 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 justify-end gap-1 whitespace-nowrap font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:[o.jsx(Df,{className:"size-3.5 text-[var(--color-primary)]","aria-hidden":"true"}),we(n)," image",n===1?"":"s"]}),o.jsx("span",{className:"whitespace-nowrap font-mono text-[0.78rem] font-semibold text-[var(--color-muted)]",children:[l,i,s].filter(Boolean).join(" / ")||Me})]}),o.jsx(Qf,{ariaLabel:"图片明细",children:o.jsx(Kf,{title:"图片明细",rows:u})})]})}function Xj({inputTokens:n,outputTokens:l}){const i=Jg(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(wS,{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:Go(i)}),o.jsxs("div",{className:"mt-1 font-mono text-[0.9rem] font-medium leading-snug tracking-normal text-[var(--color-muted)]",children:["输入: ",Go(n)," / 输出: ",Go(l)]})]})]})}function Vj(n){const l=n.settledUsdMicros??n.billedMicros,i=Zj(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:ul(l)}),o.jsx(Qf,{ariaLabel:"成本明细",children:o.jsx(Kf,{title:"成本明细",rows:i})})]})}function Fg({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:["输入 ",Wo(n)]}),o.jsxs("span",{children:["输出 ",Wo(l)]})]})}function Zg({ttftMs:n,tokensPerSecond:l,compact:i=!1}){return i?o.jsxs("span",{className:"font-mono",children:["TTFT ",zn(n)," / ",Kg(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"})," ",zn(n)]}),o.jsxs("span",{children:[o.jsx("span",{className:"text-[var(--color-muted)]",children:"Tok/s"})," ",oc(l)]})]})}function Fj({ttftMs:n,durationMs:l}){return 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"})," ",zn(n)]}),o.jsxs("span",{children:[o.jsx("span",{className:"text-[var(--color-muted)]",children:"Duration"})," ",zn(l)]})]})}function Zj(n,l){const i=[];return n.billingUnit==="images"&&(i.push({label:"图片数量",value:we(n.imageCount)}),n.imageSize&&i.push({label:"尺寸",value:n.imageSize}),n.imageQuality&&i.push({label:"质量",value:n.imageQuality}),n.imageOutputFormat&&i.push({label:"输出格式",value:n.imageOutputFormat}),Xa(i,"图片输出成本",ul(n.imageOutputCostMicros),n.imageOutputCostMicros),Xa(i,"单张折算",ul(n.imageCostMicrosPerImage),n.imageCostMicrosPerImage),Xa(i,"图片输出 Token",we(n.imageOutputTokens),n.imageOutputTokens)),Xa(i,"输入成本",ul(n.inputCostMicros),n.inputCostMicros),Xa(i,"输出成本",ul(n.outputCostMicros),n.outputCostMicros),Xa(i,"输入单价",Wo(n.inputPriceMicrosPer1m),n.inputPriceMicrosPer1m),Xa(i,"输出单价",Wo(n.outputPriceMicrosPer1m),n.outputPriceMicrosPer1m),Xa(i,"缓存读取成本",ul(n.cacheReadCostMicros),n.cacheReadCostMicros),n.serviceTier&&i.push({label:"服务档位",value:n.serviceTier,dividerBefore:i.length>0}),Xa(i,"倍率",Uj(n.billingMultiplier),n.billingMultiplier),Xa(i,"原始",ul(n.originalUsdMicros),n.originalUsdMicros),i.push({label:"计费",value:ul(l),dividerBefore:i.length>0,emphasis:!0}),i.length===1&&i.unshift({label:"明细",value:Me}),i}function Xa(n,l,i,s){Number.isFinite(s)&&n.push({label:l,value:i})}function Qf({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(),b=window.innerWidth-Yj-Ud,j=Math.max(Ud,Math.min(b,y.right+8)),N=Math.max(Ud,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(KS,{className:"size-3.5","aria-hidden":"true"})}),s&&f&&typeof document<"u"?w2.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 Kf({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===tn?"text-[var(--color-muted)]":""].join(" "),children:i.value})]},`${i.label}-${s}`))})]})}function Jg(...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 Yf({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 Ld({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(Yf,{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 Jj({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 xx="tokenbuddy-ui-language",gx={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} 个文件变更。"}},Ig=S.createContext(null);function Ij({children:n}){const[l,i]=S.useState(()=>{if(typeof window>"u")return"en";const u=window.localStorage.getItem(xx);return u==="zh"||u==="en"?u:"en"});S.useEffect(()=>{document.documentElement.lang=l==="zh"?"zh-CN":"en",window.localStorage.setItem(xx,l)},[l]),S.useEffect(()=>{if(typeof document>"u")return;const u=()=>aN(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)=>Wj(gx[l][u]??gx.en[u],f)}),[l]);return o.jsx(Ig.Provider,{value:s,children:n})}function er(){const n=S.useContext(Ig);if(!n)throw new Error("useI18n must be used inside I18nProvider");return n}function Wj(n,l){return l?n.replace(/\{(\w+)\}/g,(i,s)=>{const u=l[s];return u===void 0?i:String(u)}):n}const Wg=[["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"],["Image generations","图片生成"],["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"],["USAGE","用量"],["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","计费"],["Images","图片"],["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"]],eb=Wg.filter(([n])=>!nb(n)),eN=Wg.filter(([n])=>nb(n)),tb=new Map(eb),ab=new Map([...eb.map(([n,l])=>[l,n]),...eN]);function tN(n,l){return Pf(n,l==="zh"?tb:ab,l)}function aN(n){const l=n==="zh"?tb:ab;nN(document.body,l,n)}function nN(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=Pf(h.textContent??"",l,i);v!==h.textContent&&(h.textContent=v)}n instanceof Element&&bx(n,l,i);for(const h of Array.from(((f=n.querySelectorAll)==null?void 0:f.call(n,"[placeholder], [title], [aria-label], [alt]"))??[]))bx(h,l,i)}function bx(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=Pf(u,l,i);f!==u&&n.setAttribute(s,f)}}function Pf(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 b=f.match(/^Page (\d+)$/);if(b)return`${s}第 ${b[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 U=f.match(/^(\d+) sellers$/);if(U)return`${s}${U[1]} 个 Seller${u}`;const z=f.match(/^In ([\d,]+) \/ Out ([\d,]+)$/);if(z)return`${s}输入 ${z[1]} / 输出 ${z[2]}${u}`;const H=f.match(/^(.+) total$/);if(H)return`${s}总计 ${H[1]}${u}`;const L=f.match(/^Open (.+)$/);if(L)return`${s}打开 ${L[1]}${u}`;const $=f.match(/^Activate (.+)$/);if($)return`${s}激活 ${$[1]}${u}`;const Q=f.match(/^Recharge (.+)$/);if(Q)return`${s}充值 ${Q[1]}${u}`;const F=f.match(/^Bind (.+)$/);if(F)return`${s}绑定 ${F[1]}${u}`;const B=f.match(/^Remove (.+)$/);if(B)return`${s}移除 ${B[1]}${u}`;const Z=f.match(/^View models for (.+)$/);if(Z)return`${s}查看 ${Z[1]} 的模型${u}`;const J=f.match(/^Move (.+) up$/);if(J)return`${s}上移 ${J[1]}${u}`;const ae=f.match(/^Edit provider · (.+)$/);if(ae)return`${s}编辑 Provider · ${ae[1]}${u}`;const K=f.match(/^Models · (.+)$/);if(K)return`${s}模型 · ${K[1]}${u}`;const ce=f.match(/^(.+) ledger records, ([\d,]+) records$/);if(ce)return`${s}${ce[1]}账本记录,${ce[2]} 条记录${u}`;const I=f.match(/^Input tokens: (.+)$/);if(I)return`${s}输入 Token: ${I[1]}${u}`;const pe=f.match(/^Output tokens: (.+)$/);if(pe)return`${s}输出 Token: ${pe[1]}${u}`;const ie=f.match(/^Time to first token: (.+)$/);if(ie)return`${s}首 token 延迟: ${ie[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 se=f.match(/^Last seller switch: (.+)$/);if(se)return`${s}最近 Seller 切换: ${se[1]}${u}`;const le=f.match(/^(.+) (recharge|activation) QR code$/);if(le)return`${s}${le[1]} ${le[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 b=f.match(/^(\d+) \/ (\d+) 个 Provider$/);if(b)return`${s}${b[1]} of ${b[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 U=f.match(/^打开 (.+)$/);if(U)return`${s}Open ${U[1]}${u}`;const z=f.match(/^移除 (.+)$/);if(z)return`${s}Remove ${z[1]}${u}`;const H=f.match(/^查看 (.+) 的模型$/);if(H)return`${s}View models for ${H[1]}${u}`;const L=f.match(/^上移 (.+)$/);if(L)return`${s}Move ${L[1]} up${u}`}return n}function nb(n){return/[\u4e00-\u9fff]/.test(n)}function lb({inferences:n,modelsResponse:l,sellersResponse:i,previewPlan:s,activeModelId:u}){const f=iN(l,i),h=[...n].sort(uN),v=new Map,p=new Map;let x=0,y=0,b=0;for(const N of h){const T=N.modelId||Me,E=N.sellerKey||Me,U=N.billingUnit==="images"||N.endpoint==="/v1/images/generations",z=U?0:fa(N.promptTokens)??0,H=U?0:fa(N.completionTokens)??0,L=z+H,$=fa(N.settledUsdMicros)??fa(N.billedMicros)??0;x+=1,y+=L,b+=$;const Q=v.get(T)??sN(T);Q.entries.push(N),Q.requestCount+=1,Q.inputTokens+=z,Q.outputTokens+=H,Q.totalSpendMicros+=$,Q.touchedSellers.add(E),Q.sellerCounts.set(E,(Q.sellerCounts.get(E)??0)+1),Q.fallbackCount+=fa(N.fallbackCount)??0;const F=fa(N.ttftMs);F!==void 0&&(Q.ttftTotal+=F,Q.ttftCount+=1);const B=fa(N.durationMs);B!==void 0&&(Q.durationTotal+=B,Q.durationCount+=1,B>0&&(Q.speedTokenTotal+=H,Q.speedDurationMs+=B)),v.set(T,Q);const Z=p.get(E)??{requestCount:0,totalTokens:0};Z.requestCount+=1,Z.totalTokens+=L,p.set(E,Z)}const j=Array.from(v.values()).map(N=>lN(N,p,f)).sort(dN);if(j.length===0){const N=rN(u,s,f);N&&j.push(N)}return{rows:j,totalRequests:x,totalTokens:y,totalSpendMicros:b}}function lN(n,l,i){const s=n.entries[n.entries.length-1],u=(s==null?void 0:s.sellerKey)||Me,f=rb(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:fN(n.speedTokenTotal,n.speedDurationMs),avgTtftMs:yx(n.ttftTotal,n.ttftCount),avgDurationMs:yx(n.durationTotal,n.durationCount),lastTtftMs:fa(s==null?void 0:s.ttftMs),lastDurationMs:fa(s==null?void 0:s.durationMs),selectedAt:oN(n.entries,u),lastSellerSwitchAt:cN(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 rN(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=rb(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(b=>b.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 iN(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 sN(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 oN(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 cN(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 rb(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:mN((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)??Me,paymentMethods:(s==null?void 0:s.paymentMethods)??(u==null?void 0:u.paymentMethods)??(i==null?void 0:i.seller.paymentMethods)??[],discount:$f(f),serviceFee:Yg(s==null?void 0:s.serviceFeeRatio),modelCount:(s==null?void 0:s.modelCount)??l.modelCountsBySellerId.get(n)}}function uN(n,l){return ec(n.createdAt)-ec(l.createdAt)}function dN(n,l){return ec(l.lastAccessAt)-ec(n.lastAccessAt)}function ec(n){if(!n)return 0;const l=new Date(n).getTime();return Number.isNaN(l)?0:l}function yx(n,l){return l>0?n/l:void 0}function fN(n,l){if(!(l<=0))return n<=0?0:n/(l/1e3)}function fa(n){return Number.isFinite(n)?n:void 0}function mN(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function Sx(){var te,fe,ge,be,Ue,Re,_t,gt,Ot,rt,Ie,ma,Kt,On,ea,Dt,Ta,Ut,ta,an,ct,Dn,nn,Ua,Aa,Un,ln,Ln,Bn;const{t:n}=er(),[l,i]=S.useState(null),[s,u]=g2(),f=S.useRef(null),h=Hf(),v=Bg(),p=qg(),x=Hg(),y=$g(),b=Lf(),j=Bf(),N=qf(),T=b.refetch,E=j.reset,U=ic(),z=Qg(),H=sc(),L=Rj(),$=zj(),Q=((te=U.data)==null?void 0:te.inferences)??[],F=((fe=b.data)==null?void 0:fe.payments)??[],B=new Set((((ge=H.data)==null?void 0:ge.data)??[]).map(He=>He.id)).size,Z=((be=z.data)==null?void 0:be.sellers.length)??((Re=(Ue=H.data)==null?void 0:Ue.sellers)==null?void 0:Re.length)??0,J=S.useMemo(()=>kN(Q),[Q]),ae=S.useMemo(()=>Pg(F,Q),[Q,F]),K=S.useMemo(()=>lb({inferences:Q,modelsResponse:H.data,sellersResponse:z.data}),[Q,H.data,z.data]),I=F.some(He=>Wa(He.method)==="clawtip"&&(He.enabled||Vg(He.config,"walletConfigPresent")))||((_t=j.data)==null?void 0:_t.walletConfigPresent)===!0,pe=((gt=h.data)==null?void 0:gt.status)==="running"&&!h.isError,ie=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),R=ae.find(He=>F.some(We=>We.method===He.method&&We.isDefault))??ae.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),se=((ma=y.data)==null?void 0:ma.providers.length)??0,le=((Kt=x.data)==null?void 0:Kt.config.range)??pN((On=v.data)==null?void 0:On.strategy.mode),ve=((ea=x.data)==null?void 0:ea.config.modelIds.length)??0,C=le==="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:Z,P=hN({activeMode:X,autoModelCount:ve,autoRange:le,autoSellerCount:C,manualProviderCount:se,manualPolicy:(ta=y.data)==null?void 0:ta.routing.policy,paymentName:R==null?void 0:R.name,scorer:((an=x.data)==null?void 0:an.config.scorer)??((ct=v.data)==null?void 0:ct.strategy.scorer)??((Dn=h.data)==null?void 0:Dn.sellerRoutingScorer),t:n}),W=()=>{i(null),j.reset(),N.reset()};return S.useEffect(()=>{const He=s.get("activatePayment");if(!He||Wa(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"||Wa(l.method)!=="clawtip"||I)return;const He=window.setInterval(()=>{T()},1500);return()=>window.clearInterval(He)},[I,l==null?void 0:l.kind,l==null?void 0:l.method,T]),S.useEffect(()=>{(l==null?void 0:l.kind)==="activate"&&Wa(l.method)==="clawtip"&&I&&(i(null),E())},[I,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(bN,{currentVersion:(nn=L.data)==null?void 0:nn.currentVersion,latestVersion:(Ua=L.data)==null?void 0:Ua.latestVersion,updateAvailable:(Aa=L.data)==null?void 0:Aa.updateAvailable,running:$.isPending,result:$.data,error:$.error,onUpdate:()=>$.mutate()}),o.jsxs("section",{className:"grid grid-cols-2 gap-2.5 md:grid-cols-3 xl:grid-cols-6",children:[o.jsx(NN,{icon:o.jsx(Ug,{className:"size-4"}),...P}),o.jsx(Ho,{to:"/ledger",icon:o.jsx(vS,{className:"size-4"}),label:"Today requests",value:we(J.todayRequestCount),note:`${we(J.totalRequestCount)} total`,tone:"requests"}),o.jsx(Ho,{to:"/ledger",icon:o.jsx(us,{className:"size-4"}),label:"Inference cost",value:Ia(J.todaySpendMicros,{digits:4}),note:`${Ia(J.totalSpendMicros,{digits:4})} total`,tone:"spend"}),o.jsx(jN,{inputTokens:J.inputTokens,outputTokens:J.outputTokens}),o.jsx(Ho,{to:"/ledger",icon:o.jsx(Df,{className:"size-4"}),label:"Images",value:we(J.todayImageCount),note:`${we(J.totalImageCount)} total`,tone:"inventory"}),o.jsx(Ho,{to:"/routing",icon:o.jsx(CS,{className:"size-4"}),label:"Models / Sellers",value:`${B}`,note:`${Z} 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(yN,{rows:K.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(hj,{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:[J.modelUsage.map(He=>o.jsx(TN,{model:He.model,color:He.color},He.model)),o.jsx(wx,{label:"in"}),o.jsx(wx,{label:"out",dashed:!0})]})]}),o.jsxs("div",{className:"grid min-w-0 gap-3 sm:grid-cols-[minmax(0,1fr)_190px]",children:[o.jsx(wN,{days:J.days,series:J.modelUsage}),o.jsxs("div",{className:"grid gap-3",children:[o.jsx(MN,{days:J.days,values:J.cost,total:Ia(J.weeklySpendMicros)}),o.jsx(CN,{values:J.thirtyDaySpend,total:Ia(J.totalSpendMicros)})]})]})]})]})}),o.jsx(AN,{checkedAt:ie,healthy:pe,pid:(Un=h.data)==null?void 0:Un.pid,status:(ln=h.data)==null?void 0:ln.status,proxyPort:(Ln=h.data)==null?void 0:Ln.proxyPort,controlPort:(Bn=h.data)==null?void 0:Bn.controlPort}),l?o.jsx(Gg,{modal:l,methods:ae,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:W}):null]})}function hN({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"):Me;if(n==="auto"){const y=gN(v,p);return{label:p("overview.providerMode.label"),value:x,detail:p("overview.providerMode.autoStats",{range:vN(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:xN(f,p)}),note:p("overview.providerMode.manualNote")}}function pN(n){if(n==="fixedSet")return"custom";if(n==="fullAuto")return"recommended"}function vN(n,l){return l(n==="custom"?"overview.providerMode.customRange":"overview.providerMode.recommendedRange")}function xN(n,l){return l(n==="locked"?"overview.providerMode.fixedProvider":"overview.providerMode.fallbackPolicy")}function gN(n,l){return l(n==="speed"?"overview.providerMode.speedScorer":n==="discount"?"overview.providerMode.costScorer":"overview.providerMode.balancedScorer")}function bN({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(Io,{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(Io,{className:["size-3.5",s?"animate-spin":""].join(" ")}),s?"Updating":"Update"]}):null]})}function yN({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(Ug,{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(Wl,{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(SN,{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 SN({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:[we(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(jx,{label:"Token",title:`Input tokens: ${we(n.inputTokens)} / Output tokens: ${we(n.outputTokens)}`,children:[o.jsx(qo,{label:"In",value:df(n.inputTokens)}),o.jsx(qo,{label:"Out",value:df(n.outputTokens)})]}),o.jsxs(jx,{label:"Speed",title:`Time to first token: ${zn(n.lastTtftMs??n.avgTtftMs)} / Tokens per second: ${Kg(n.tokensPerSecond)}`,children:[o.jsx(qo,{label:"TTFT",value:zn(n.lastTtftMs??n.avgTtftMs)}),o.jsx(qo,{label:"Tok/s",value:oc(n.tokensPerSecond)})]}),o.jsx(Nx,{label:"Disc",value:n.sellerDiscount,title:`Seller discount: ${n.sellerDiscount}`}),o.jsx(Nx,{label:"Last switch",value:Hj(l),title:`Last seller switch: ${cc(l)}`})]})}function jx({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 qo({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 Nx({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 Ho({to:n,icon:l,label:i,value:s,note:u,tone:f}){const h=Ss(f);return o.jsxs(Wl,{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(Yf,{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 jN({inputTokens:n,outputTokens:l}){const i=Ss("tokens");return o.jsx(Wl,{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(Xj,{inputTokens:n,outputTokens:l})})}function NN({icon:n,label:l,value:i,detail:s,note:u}){const f=Ss("router");return o.jsxs(Wl,{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(Yf,{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 wN({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:ff(x.input.map((y,b)=>[v(b),p(y)])),fill:"none",stroke:x.color,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:ff(x.output.map((y,b)=>[v(b),p(y)])),fill:"none",stroke:x.color,strokeWidth:"2.4",strokeDasharray:"5 5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.75"}),x.input.map((y,b)=>o.jsx("circle",{cx:v(b),cy:p(y),r:"2.7",fill:x.color},`${x.model}-input-${b}`)),x.output.map((y,b)=>o.jsx("circle",{cx:v(b),cy:p(y),r:"2.2",fill:"#fff",stroke:x.color,strokeWidth:"1.8"},`${x.model}-output-${b}`))]},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 MN({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:ff(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 CN({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 ff(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 TN({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 wx({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 AN({checkedAt:n,healthy:l,pid:i,status:s,proxyPort:u,controlPort:f}){const h=[{icon:o.jsx(US,{className:"size-3"}),label:"Daemon",value:i?`pid ${i}`:s??Me,tone:l?"green":"amber"},{icon:o.jsx(ZS,{className:"size-3"}),label:"Proxy",value:u?`:${u}`:Me,tone:"blue"},{icon:o.jsx(rj,{className:"size-3"}),label:"Control",value:f?`:${f}`:Me,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(Io,{className:"size-3.5"}),n]}),h.map(v=>o.jsx(EN,{...v},v.label))]})}function EN({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 kN(n){const l=Mx(7),i=Mx(30),s=mf(new Date),u=new Set(l.map(F=>F.key)),f=new Map(i.map((F,B)=>[F.key,B])),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,b=0,j=0,N=0,T=0,E=0,U=0,z=0,H=0,L=0,$=0;for(const F of n){const B=mf(new Date(F.createdAt)),Z=F.settledUsdMicros??F.billedMicros??0,J=RN(F),ae=J?0:F.promptTokens??0,K=J?0:F.completionTokens??0,ce=J?Number.isFinite(F.imageCount)?F.imageCount:1:0;$+=1,b+=Z,H+=ce,N+=ae,T+=K,B===s&&(L+=1,y+=Z,z+=ce,E+=ae,U+=K);const I=l.findIndex(ie=>ie.key===B);if(I>=0){j+=Z,p[I]+=Z/1e6;const ie=v.get(F.modelId)??{input:l.map(()=>0),output:l.map(()=>0),total:0};ie.input[I]+=ae,ie.output[I]+=K,ie.total+=ae+K,v.set(F.modelId,ie)}else u.has(B)&&(j+=Z);const pe=f.get(B);pe!==void 0&&(x[pe]+=Z/1e6)}const Q=Array.from(v.entries()).sort((F,B)=>B[1].total-F[1].total).slice(0,4).map(([F,B],Z)=>({model:F,color:h[Z%h.length],input:B.input,output:B.output}));return{days:l.map(F=>F.label),modelUsage:Q,cost:p,thirtyDaySpend:x,todaySpendMicros:y,totalSpendMicros:b,weeklySpendMicros:j,inputTokens:N,outputTokens:T,todayInputTokens:E,todayOutputTokens:U,todayImageCount:z,totalImageCount:H,todayRequestCount:L,totalRequestCount:$}}function RN(n){return n.billingUnit==="images"||n.endpoint==="/v1/images/generations"}function Mx(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:mf(u),label:i.format(u)})}return l}function mf(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 zN=[{value:"balanced",label:"Balanced"},{value:"speed",label:"Speed"},{value:"discount",label:"Cost"}],Cx=10,_N=["clawtip"];function ON(){var Ba,qa,Ha,aa,$a,Ea,Sl,qn,rn,ue,$e,Et;const n=Bg(),l=qg(),i=yj(),s=Hg(),u=Sj(),f=$g(),h=Cj(),v=jj(),p=Nj(),x=wj(),y=Mj(),b=Qg(),j=sc(),N=kj(),T=ic(),E=Lf(),U=gj(),z=Bf(),H=qf(),[L,$]=S.useState({mode:"fullAuto",scorer:"balanced"}),[Q,F]=S.useState([]),[B,Z]=S.useState(""),[J,ae]=S.useState("manual"),[K,ce]=S.useState("recommended"),[I,pe]=S.useState(null),[ie,R]=S.useState(null),[X,se]=S.useState(null),le=Aj({...L,modelId:B}),ve=j.data,C=((Ba=f.data)==null?void 0:Ba.providers)??[],P=((qa=f.data)==null?void 0:qa.routing)??{policy:"fallback"},W=((Ha=b.data)==null?void 0:Ha.sellers)??[],te=((aa=N.data)==null?void 0:aa.focusSet)??[],fe=(($a=T.data)==null?void 0:$a.inferences)??[],ge=S.useMemo(()=>tw(fe),[fe]),be=S.useMemo(()=>IN((ve==null?void 0:ve.data)??[],te),[te,ve==null?void 0:ve.data]),Ue=lw(le.data),Re=S.useMemo(()=>nw(W,ve,(Ue==null?void 0:Ue.routes)??[]),[ve,Ue==null?void 0:Ue.routes,W]),_t=S.useMemo(()=>Q.map(ee=>be.find(re=>re.id===ee)).filter(tc),[be,Q]),gt=L.sellerIds??[],Ot=((Ea=E.data)==null?void 0:Ea.payments)??[],rt=S.useMemo(()=>uw(Ot),[Ot]),Ie=S.useMemo(()=>Pg(Ot,fe),[fe,Ot]),ma=S.useMemo(()=>{const ee=cw(Re,Q,L.scorer);if(K==="recommended")return ee;const re=gt.map(Ce=>Re.find(tt=>tt.id===Ce)).filter(tc);return Gf(re,Q,L.scorer)},[K,L.scorer,gt,Q,Re]),Kt=s.isLoading||j.isLoading||b.isLoading||le.isFetching&&ma.length===0,On=!Kt&&(s.isFetching||j.isFetching||b.isFetching||le.isFetching),ea=S.useMemo(()=>lb({inferences:fe,modelsResponse:ve,sellersResponse:b.data,previewPlan:Ue,activeModelId:B}),[B,fe,ve,Ue,b.data]),Dt=S.useMemo(()=>aw(ea.rows,fe),[fe,ea.rows]),Ut=Ot.some(ee=>Ja(ee.method)==="clawtip"&&(ee.enabled||sb(ee.config,"walletConfigPresent")))||((Sl=z.data)==null?void 0:Sl.walletConfigPresent)===!0,ta=J==="auto"&&rt.active;S.useEffect(()=>{var ee,re,Ce;if((ee=n.data)!=null&&ee.strategy){if(((re=l.data)==null?void 0:re.active)==="auto"&&((Ce=s.data)!=null&&Ce.config))return;$(n.data.strategy)}},[(qn=s.data)==null?void 0:qn.config,(rn=l.data)==null?void 0:rn.active,(ue=n.data)==null?void 0:ue.strategy]),S.useEffect(()=>{l.data&&ae(l.data.active)},[l.data]),S.useEffect(()=>{var re;const ee=(re=s.data)==null?void 0:re.config;ee&&(ce(ee.range),$(Ce=>({...Ce,mode:ee.range==="custom"?"fixedSet":"fullAuto",scorer:ee.scorer,sellerId:void 0,sellerIds:ee.sellerIds})),ee.modelIds.length>0&&(F(ee.modelIds),Z(Ce=>ee.modelIds.includes(Ce)?Ce:ee.modelIds[0]??"")))},[($e=s.data)==null?void 0:$e.config]),S.useEffect(()=>{const ee=!N.isLoading&&!T.isLoading;if(Q.length>0||be.length===0||!ee)return;const re=WN({focusModels:te,referencedModelIds:ge,modelOptions:be});re.length!==0&&(F(re),Z(re[0]??""))},[te,N.isLoading,T.isLoading,be,ge,Q.length]),S.useEffect(()=>{!B||Q.includes(B)||Z(Q[0]??"")},[B,Q]),S.useEffect(()=>{B&&le.refetch()},[B,L.mode,L.scorer,L.sellerId,(Et=L.sellerIds)==null?void 0:Et.join(","),iw(L.fixedByModel)]),S.useEffect(()=>{if((X==null?void 0:X.kind)!=="activate"||Ja(X.method)!=="clawtip"||Ut)return;const ee=window.setInterval(()=>{E.refetch()},1500);return()=>window.clearInterval(ee)},[Ut,X==null?void 0:X.kind,X==null?void 0:X.method,E.refetch]),S.useEffect(()=>{(X==null?void 0:X.kind)==="activate"&&Ja(X.method)==="clawtip"&&Ut&&(se(null),z.reset())},[z,Ut,X==null?void 0:X.kind,X==null?void 0:X.method]);function an(ee){F(re=>{const Ce=re.filter(tt=>tt!==ee);return B===ee&&Z(Ce[0]??""),uf(Ce).catch(()=>{}),ta&&La({modelIds:Ce}),Ce})}function ct(ee){const re=Array.from(new Set(ee));F(re),Z(Ce=>re.includes(Ce)?Ce:re[0]??""),uf(re).catch(()=>{}),ta&&La({modelIds:re})}function Dn(ee){$(re=>({...re,scorer:ee})),ta&&La({scorer:ee})}function nn(ee,re){const Ce=L.sellerIds??[],tt=Ce.includes(re)?Ce.filter(Qa=>Qa!==re):[...Ce,re];Ua(tt)}function Ua(ee){const re={...L,mode:"fixedSet",sellerIds:ee,sellerId:void 0};$(re),ta&&K==="custom"&&La({range:"custom",sellerIds:ee})}async function Aa(ee){await v.mutateAsync({name:ee.name.trim()||"Custom provider",baseUrl:ee.baseUrl.trim(),apiKey:ee.apiKey.trim(),enabled:!0,supportedProtocols:["chat_completions"]}),R(null)}async function Un(ee,re){await p.mutateAsync({providerId:ee,input:{name:re.name.trim()||"Custom provider",baseUrl:re.baseUrl.trim(),apiKey:re.apiKey.trim(),enabled:!0,supportedProtocols:["chat_completions"]}}),R(null)}function ln(ee){x.mutateAsync(ee).catch(re=>{pe(re instanceof Error?re.message:String(re))})}function Ln(ee){h.mutateAsync(ee).catch(re=>{pe(re instanceof Error?re.message:String(re))})}function Bn(ee){const re=C.findIndex(tt=>tt.id===ee);if(re<=0)return;const Ce=C.map(tt=>tt.id);[Ce[re-1],Ce[re]]=[Ce[re],Ce[re-1]],y.mutateAsync(Ce).catch(tt=>{pe(tt instanceof Error?tt.message:String(tt))})}function He(ee){ce(ee),ee==="custom"&>.length===0&&R({kind:"sellers"}),ta&&La({range:ee})}function We(ee){ae(ee),pe(null),i.mutateAsync(ee).then(re=>{ae(re.active),re.strategy&&$(re.strategy)}).catch(re=>{pe(re instanceof Error?re.message:String(re))})}function ha(ee){pe(null),U.mutateAsync(ee).catch(re=>{pe(re instanceof Error?re.message:String(re))})}function jt(ee){se({kind:"activate",method:ee}),Ja(ee)==="clawtip"&&z.mutate()}function tr(ee){se({kind:"recharge",method:ee}),Ja(ee)==="clawtip"&&H.mutate()}function ar(){se(null),z.reset(),H.reset()}async function La(ee={}){var it;if(!rt.active){pe("Bind a payment method to enable Auto provider.");return}const re=ee.scorer??L.scorer,Ce=ee.range??K,tt=ee.modelIds??Q,Qa=ee.sellerIds??gt;$(Ce==="recommended"?{mode:"fullAuto",scorer:re}:{mode:"fixedSet",scorer:re,sellerIds:Qa}),pe(null);try{const ze=await u.mutateAsync(ew({base:(it=s.data)==null?void 0:it.config,enabled:!0,range:Ce,scorer:re,modelIds:tt,sellerIds:Qa}));ae(ze.active),ze.strategy&&$(ze.strategy)}catch(ze){pe(ze instanceof Error?ze.message:String(ze))}}return o.jsxs("div",{className:"space-y-5",children:[o.jsx("section",{children:o.jsxs(At,{className:"overflow-hidden",children:[o.jsx(DN,{activeTab:J,onChange:We}),o.jsxs("div",{className:"p-4",children:[n.isLoading||l.isLoading||b.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||b.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,J==="manual"?o.jsx(UN,{providers:C,routing:P,onAdd:()=>R({kind:"manualProvider"}),onRemove:ln,onSetRouting:Ln,onMoveUp:Bn,onViewModels:ee=>R({kind:"manualProviderModels",provider:ee}),onEdit:ee=>R({kind:"manualProviderEdit",provider:ee})}):o.jsx(BN,{walletAccess:rt,paymentMethods:Ie,selectedModels:_t,activeModelId:B,range:K,scorer:L.scorer,effectiveSellers:ma,selectedSellerIds:gt,sellerActivityById:Dt,loading:Kt,refreshing:On,applyError:I,focusSaveError:N.isError,onSelectPayment:ha,onActivatePayment:jt,onRechargePayment:tr,onAddModels:()=>R({kind:"models"}),onSetActiveModel:Z,onRemoveModel:an,onRangeChange:He,onScorerChange:Dn,onChooseSellers:()=>R({kind:"sellers"}),onRemoveSeller:ee=>nn(B,ee)})]})]})}),o.jsx(KN,{summary:ea}),(ie==null?void 0:ie.kind)==="models"?o.jsx(XN,{models:be,selectedModelIds:Q,onClose:()=>R(null),onSave:ee=>{ct(ee),R(null)}}):null,(ie==null?void 0:ie.kind)==="sellers"?o.jsx(VN,{selectedSellerIds:gt,selectedModelIds:Q,scorer:L.scorer,sellers:Re,onClose:()=>R(null),onSave:ee=>{Ua(ee),R(null)}}):null,(ie==null?void 0:ie.kind)==="manualProvider"?o.jsx(Ex,{onClose:()=>R(null),onSave:Aa}):null,(ie==null?void 0:ie.kind)==="manualProviderEdit"?o.jsx(Ex,{provider:ie.provider,onClose:()=>R(null),onSave:ee=>Un(ie.provider.id,ee)}):null,(ie==null?void 0:ie.kind)==="manualProviderModels"?o.jsx(FN,{provider:ie.provider,onClose:()=>R(null)}):null,X?o.jsx(Gg,{modal:X,methods:Ie,qr:X.kind==="activate"?z.data:H.data,loading:X.kind==="activate"?z.isPending:H.isPending,error:X.kind==="activate"?z.error:H.error,onClose:ar}):null]})}function DN({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 UN({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 b;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:[we(((b=x.models)==null?void 0:b.length)??0),o.jsx(XS,{size:12})]})}),o.jsx("td",{className:"px-3 py-2.5",children:o.jsx(LN,{provider:x})}),o.jsx("td",{className:"px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-muted)]",children:cc(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(Dg,{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(IS,{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(Uf,{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(Bd,{label:"Fallback on error",state:p?"selected":"enabled",onClick:()=>u({policy:"fallback"})}),o.jsx(Bd,{label:"Cost first",state:"disabled"}),o.jsx(Bd,{label:"Multi-provider concurrent calls",state:"disabled"})]})]})]})}function Bd({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 LN({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 BN({walletAccess:n,paymentMethods:l,selectedModels:i,activeModelId:s,range:u,scorer:f,effectiveSellers:h,selectedSellerIds:v,sellerActivityById:p,loading:x,refreshing:y,applyError:b,focusSaveError:j,onSelectPayment:N,onActivatePayment:T,onRechargePayment:E,onAddModels:U,onSetActiveModel:z,onRemoveModel:H,onRangeChange:L,onScorerChange:$,onChooseSellers:Q,onRemoveSeller:F}){const B=!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:[!B&&b?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:b,children:b}):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(Z=>o.jsx(qN,{option:Z,method:l.find(J=>Ja(J.method)===Ja(Z.method)),onSelect:N,onActivate:T,onRecharge:E},Z.method))})]})]}),o.jsxs("div",{className:["space-y-3 transition",B?"pointer-events-none select-none opacity-45 grayscale-[0.25]":""].join(" "),"aria-disabled":B,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(Z=>{const J=s===Z.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",J?"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(Z.id),disabled:B,className:["truncate font-semibold",J?"text-[var(--color-primary-deep)]":"text-[color-mix(in_srgb,var(--color-primary-deep)_82%,var(--color-muted))]"].join(" "),children:Z.id}),o.jsx("span",{className:"rounded-full bg-white px-1.5 text-[0.68rem] text-[var(--color-muted)]",children:Z.sellerCount}),o.jsx("button",{type:"button",onClick:()=>H(Z.id),disabled:B,className:"text-[var(--color-muted)] hover:text-rose-700","aria-label":`Remove ${Z.id}`,children:o.jsx(Uf,{size:12})})]},Z.id)}),o.jsxs("button",{type:"button",onClick:U,disabled:B,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(HN,{range:u,scorer:f,sellers:h,selectedSellerIds:v,sellerActivityById:p,disabled:B,loading:x,refreshing:y,onRangeChange:L,onScorerChange:$,onChooseSellers:Q,onRemoveSeller:F})]})]})}function qN({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(ES,{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 HN({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:b}){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...":`${we(Math.min(i.length,Cx))} of ${we(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(Tx,{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($N,{}):null,i.slice(0,Cx).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:Bj(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:cc(N==null?void 0:N.lastAccessAt)})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:justify-end",children:[o.jsx(qd,{label:"Discount",value:j.discount}),o.jsx(qd,{label:"TTFT",value:zn(j.latencyMs)}),o.jsx(qd,{label:"Tok/s",value:oc(j.tokensPerSecond)}),n==="custom"&&s.includes(j.id)?o.jsx("button",{type:"button",onClick:()=>b(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(Uf,{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(Tx,{options:zN,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:QN(l)})]})]})}function $N(){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 Tx({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 qd({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 QN(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 KN({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:[we(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(YN,{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 YN({row:n}){const l=PN(n),i=GN(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(Ax,{tone:i.tone,children:i.label})}),o.jsx("td",{className:"px-4 py-3.5",children:o.jsx(Ax,{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:zn(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:cc(n.lastAccessAt)})})]})}function PN(n){return n.source==="preview"?{label:"Preview",tone:"amber"}:n.upstreamStatus&&!Hd(n.upstreamStatus)?{label:is(n.upstreamStatus),tone:Od(n.upstreamStatus)}:n.lastStatus&&!Hd(n.lastStatus)?{label:is(n.lastStatus),tone:Od(n.lastStatus)}:n.currentSellerStatus&&!Hd(n.currentSellerStatus)?{label:is(n.currentSellerStatus),tone:Od(n.currentSellerStatus)}:{label:"Ready",tone:"green"}}function Hd(n){const l=is(n);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"}function GN(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 Ax({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 XN({models:n,selectedModelIds:l,onClose:i,onSave:s}){const[u,f]=S.useState(""),[h,v]=S.useState(l),p=S.useMemo(()=>h.map(b=>n.find(j=>j.id===b)).filter(tc),[h,n]),x=n.filter(b=>ob(u,[b.id,b.paymentMethod,b.enabled?"enabled":"not enabled"]));function y(b){v(j=>j.includes(b)?j.filter(N=>N!==b):[...j,b])}return o.jsxs(dc,{title:"Add models",onClose:i,children:[o.jsx(Xf,{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(b=>{const j=h.includes(b.id);return o.jsxs("tr",{onClick:()=>y(b.id),className:["cursor-pointer",j?"bg-[var(--color-lavender)]/70":"hover:bg-[var(--color-lavender)]/35",b.enabled?"":"opacity-60"].join(" "),children:[o.jsx("td",{className:"px-3 py-2.5",children:o.jsx(ib,{active:j,fixed:!1})}),o.jsx("td",{className:"px-3 py-2.5 font-mono font-semibold text-[var(--color-ink)]",children:b.id}),o.jsx("td",{className:"px-3 py-2.5",children:o.jsx(ZN,{enabled:b.enabled,paymentMethod:b.paymentMethod})}),o.jsx("td",{className:"px-3 py-2.5 text-right text-[var(--color-muted)]",children:b.sellerCount})]},b.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(b=>o.jsxs("button",{type:"button",onClick:()=>y(b.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 ${b.id}`,children:[o.jsx("span",{className:"truncate",children:b.id}),o.jsx(Il,{size:13,"aria-hidden":"true"})]},b.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 VN({selectedSellerIds:n,selectedModelIds:l,scorer:i,sellers:s,onClose:u,onSave:f}){const[h,v]=S.useState(""),[p,x]=S.useState(n),[y,b]=S.useState({key:"discount",direction:"asc"}),[j,N]=S.useState(1),T=S.useMemo(()=>Gf(s,l,i),[i,l,s]),E=S.useMemo(()=>new Set(T.map(K=>K.id)),[T]),U=S.useMemo(()=>p.map(K=>s.find(ce=>ce.id===K)).filter(tc).filter(K=>E.has(K.id)),[E,p,s]),z=S.useMemo(()=>T.filter(K=>ob(h,[K.name,K.id,K.paymentMethods.join(" "),K.health,K.notes.join(" ")])),[T,h]),H=S.useMemo(()=>JN(z,y.key,y.direction),[z,y.direction,y.key]),L=10,$=Math.max(1,Math.ceil(H.length/L)),Q=Math.min(j,$),F=H.slice((Q-1)*L,Q*L),B=H.length===0?0:(Q-1)*L+1,Z=Math.min(Q*L,H.length);S.useEffect(()=>{N(1)},[h,y.direction,y.key]),S.useEffect(()=>{j>$&&N($)},[j,$]);function J(K){x(ce=>ce.includes(K)?ce.filter(I=>I!==K):[...ce,K])}function ae(K){b(ce=>({key:K,direction:ce.key===K&&ce.direction==="asc"?"desc":"asc"}))}return o.jsxs(dc,{title:"Select custom sellers",onClose:u,children:[o.jsx(Xf,{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(Qr,{label:"Seller",sortKey:"seller",activeSort:y,onSort:ae}),o.jsx(Qr,{label:"Discount",sortKey:"discount",align:"right",activeSort:y,onSort:ae}),o.jsx(Qr,{label:"Service fee",sortKey:"serviceFee",align:"right",activeSort:y,onSort:ae}),o.jsx(Qr,{label:"Payment",sortKey:"payment",activeSort:y,onSort:ae}),o.jsx(Qr,{label:"TTFT",sortKey:"ttft",align:"right",activeSort:y,onSort:ae}),o.jsx(Qr,{label:"Tok/s",sortKey:"tokensPerSecond",align:"right",activeSort:y,onSort:ae})]})}),o.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[F.map(K=>{const ce=p.includes(K.id);return o.jsxs("tr",{onClick:()=>J(K.id),className:["cursor-pointer",ce?"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(ib,{active:ce,fixed:!1})}),o.jsx("td",{className:"px-3 py-2.5 font-semibold text-[var(--color-ink)]",children:K.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:K.discount}),o.jsx("div",{className:"mt-0.5",children:o.jsx(Fg,{inputPriceMicrosPer1m:K.inputPriceMicrosPer1m,outputPriceMicrosPer1m:K.outputPriceMicrosPer1m})})]}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:K.markupFee}),o.jsx("td",{className:"px-3 py-2.5 text-[var(--color-muted)]",children:K.paymentMethods.join(", ")}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:zn(K.latencyMs)}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:oc(K.tokensPerSecond)})]},K.id)}),H.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]})]})}),H.length>L?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 ",we(B),"-",we(Z)," of ",we(H.length)]}),o.jsxs("div",{className:"inline-flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>N(K=>Math.max(1,K-1)),disabled:Q<=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:[Q," / ",$]}),o.jsx("button",{type:"button",onClick:()=>N(K=>Math.min($,K+1)),disabled:Q>=$,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 ",U.length]}),U.length>0?o.jsx("button",{type:"button",onClick:()=>x(K=>K.filter(ce=>!E.has(ce))),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:[U.map(K=>o.jsxs("button",{type:"button",onClick:()=>J(K.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 ${K.name}`,children:[o.jsx("span",{className:"truncate",children:K.name}),o.jsx(Il,{size:13,"aria-hidden":"true"})]},K.id)),U.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 Ex({provider:n,onClose:l,onSave:i}){var F;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,b]=S.useState(null),j=s?{status:"passed",message:`${we(((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:""}:{status:"idle",message:"Probe required before adding.",modelIds:[],baseUrl:"",apiKey:""},[N,T]=S.useState(j),E=h.trim(),U=p.trim(),z=E.length>0&&U.length>0&&N.status!=="checking",H=N.status==="passed"&&N.baseUrl===E&&N.apiKey===U,L=s?u.trim().length>0&&E.length>0&&(U.length===0||H&&N.modelIds.length>0):H&&N.modelIds.length>0;function $(){var B;if(s&&p.trim().length===0){T({status:"passed",message:`${we(((B=n==null?void 0:n.models)==null?void 0:B.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 Q(){if(z){b(null),T({status:"checking",message:"Reading model list...",modelIds:[],baseUrl:E,apiKey:U});try{const B=await Tj({baseUrl:E,apiKey:U});T({status:"passed",message:`${we(B.modelIds.length)} models found.`,modelIds:B.modelIds,baseUrl:E,apiKey:U})}catch(B){T({status:"failed",message:B instanceof Error?B.message:"Model list request failed.",modelIds:[],baseUrl:E,apiKey:U})}}}return o.jsxs(dc,{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($d,{label:"Name",value:u,onChange:f,placeholder:"My provider"}),o.jsx($d,{label:"Base URL",value:h,onChange:B=>{v(B),$()},placeholder:"https://api.example.com/v1"}),o.jsx($d,{label:"API key",value:p,onChange:B=>{var Z;x(B),B.trim().length===0&&s?T({status:"passed",message:`${we(((Z=n==null?void 0:n.models)==null?void 0:Z.length)??0)} existing models.`,modelIds:(n==null?void 0:n.models)??[],baseUrl:(n==null?void 0:n.baseUrl)??"",apiKey:""}):$()},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:Q,disabled:!z,className:"tb-button tb-button-sm tb-button-secondary ml-auto",children:s?"Probe new key":"Probe models"})]}),H||s&&N.status==="passed"?o.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:N.modelIds.map(B=>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:B},B))}):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(L){b(null);try{await i({name:u,baseUrl:h,apiKey:p})}catch(B){b(B instanceof Error?B.message:String(B))}}},disabled:!L,className:"tb-button tb-button-md tb-button-primary",children:s?"Save":"Add"})]})]})}function FN({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(dc,{title:`Models · ${n.name}`,onClose:l,children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Xf,{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:[we(f.length)," of ",we(((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 $d({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 dc({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(Il,{size:16})})]}),o.jsx("div",{className:"max-h-[calc(86dvh-65px)] overflow-auto p-4",children:l})]})})}function ZN({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(sj,{size:12}):o.jsx(cf,{size:12}),l," ",n?"enabled":"not enabled"]})}function ib({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 Qr({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 JN(n,l,i){return[...n].sort((s,u)=>l==="seller"?ql(s.name,u.name):l==="discount"?$o(s.discountRatio,u.discountRatio,i)||ql(s.name,u.name):l==="serviceFee"?$o(s.serviceFeeRatio,u.serviceFeeRatio,i)||ql(s.name,u.name):l==="payment"?ql(s.paymentMethods.join(", "),u.paymentMethods.join(", "))||ql(s.name,u.name):l==="ttft"?$o(s.latencyMs,u.latencyMs,i)||ql(s.name,u.name):$o(s.tokensPerSecond,u.tokensPerSecond,i)||ql(s.name,u.name))}function Gf(n,l,i){return[...n].sort((s,u)=>{const f=zx(s,l),h=zx(u,l);return f!==h?h-f:i==="speed"?hf(s.latencyMs,u.latencyMs)||rw(s.tokensPerSecond,u.tokensPerSecond):i==="discount"?hf(s.discountRatio,u.discountRatio):u.healthScore-s.healthScore})}function IN(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]??Me,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 WN({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 ew({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 tw(n){const l=new Set;return[...n].sort((i,s)=>sw(i.createdAt,s.createdAt)).flatMap(i=>!i.modelId||l.has(i.modelId)?[]:(l.add(i.modelId),[i.modelId]))}function aw(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===Me)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 nw(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),b=h.get(p),j=f.get(p),N=s.filter(J=>J.sellerId===p),T=N[0],E=Array.from(new Set(N.map(J=>J.id))),U=kx(N.map(J=>J.inputPriceMicrosPer1m)),z=kx(N.map(J=>J.outputPriceMicrosPer1m)),H=Object.fromEntries(N.map(J=>[J.id,vx(J.inputPriceMicrosPer1m,J.outputPriceMicrosPer1m)])),L=(b==null?void 0:b.metrics.ttftMs)??(j==null?void 0:j.ttftMs)??(b==null?void 0:b.metrics.avgLatencyMs),$=(b==null?void 0:b.metrics.avgTokensPerSecond)??(j==null?void 0:j.avgTokensPerSecond),Q=b==null?void 0:b.metrics.healthScore,F=(b==null?void 0:b.metrics.discountRatio)??(j==null?void 0:j.discountRatio),B=Rx([...(j==null?void 0:j.paymentMethods)??[],...(y==null?void 0:y.paymentMethods)??[],...N.flatMap(J=>J.paymentMethods)]),Z=Rx([...(y==null?void 0:y.supportedProtocols)??[],...(j==null?void 0:j.supportedProtocols)??[],...(T==null?void 0:T.supportedProtocols)??[]]);return{id:p,name:ow((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(Q)?Math.round(Q):0,coverageModelIds:E,paymentMethods:B,discountRatio:F,discount:$f(F),serviceFeeRatio:j==null?void 0:j.serviceFeeRatio,markupFee:Yg(j==null?void 0:j.serviceFeeRatio),price:vx(U,z),priceByModelId:H,inputPriceMicrosPer1m:U,outputPriceMicrosPer1m:z,latencyMs:Number.isFinite(L)?Math.round(L):void 0,tokensPerSecond:$,notes:[Z.join(", ")||"no protocols",`${j?"catalog":"registry"} #${x+1}`]}})}function kx(n){const l=n.filter(i=>Number.isFinite(i));if(l.length!==0)return Math.min(...l)}function Rx(n){return Array.from(new Set(n.filter(l=>l.trim().length>0)))}function lw(n){if(n)return n.plan??{routes:n.routes,mode:n.mode,scorer:n.scorer,reason:n.reason}}function zx(n,l){return l.length===0?n.coverageModelIds.length:l.filter(i=>n.coverageModelIds.includes(i)).length}function ql(n,l){return n.localeCompare(l,void 0,{sensitivity:"base",numeric:!0})}function hf(n,l){const i=Number.isFinite(n),s=Number.isFinite(l);return i&&s?n-l:i?-1:s?1:0}function rw(n,l){return hf(l,n)}function $o(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 iw(n){return Object.entries(n??{}).sort(([l],[i])=>l.localeCompare(i)).map(([l,i])=>`${l}:${i}`).join(",")}function sw(n,l){return Yr(l)-Yr(n)}function Yr(n){const l=new Date(n).getTime();return Number.isNaN(l)?0:l}function ow(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function cw(n,l,i){const s=l.length===0?n:n.filter(u=>l.some(f=>u.coverageModelIds.includes(f)));return Gf(s,l,i)}function uw(n){var h;const l=new Map(n.map(v=>[Ja(v.method),v])),s=Array.from(new Set([..._N,...n.map(v=>Ja(v.method)).filter(v=>v&&v!=="mock")])).map(v=>{const p=l.get(v),x=!!p&&((p==null?void 0:p.enabled)===!0||sb(p==null?void 0:p.config,"walletConfigPresent"));return{method:v,label:dw(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 dw(n){const l=Ja(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 Ja(n){return n.trim().toLowerCase()}function sb(n,l){const i=n==null?void 0:n[l];return i===!0||i==="true"||i===1||i==="1"}function Xf({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 ob(n,l){const i=n.trim().toLowerCase();return i?l.some(s=>s.toLowerCase().includes(i)):!0}function tc(n){return n!==void 0}function fw(n,l){const i=ub(l),s=cb(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 cb(n,l){return Number.isFinite(n)?Math.max(1,Math.min(ub(l),Math.floor(n))):1}function mw(n,l){return Number.isFinite(n)&&n>0?Math.floor(n):Math.max(1,l[0]??25)}function ub(n){return!Number.isFinite(n)||n<1?1:Math.floor(n)}function db({totalItems:n,pageSize:l,page:i,onPageChange:s,onPageSizeChange:u,pageSizeOptions:f=[25,50,100]}){const h=mw(l,f),v=Math.max(1,Math.ceil(n/h)),p=cb(i,v),x=S.useMemo(()=>fw(p,v),[p,v]),[y,b]=S.useState(String(p));if(S.useEffect(()=>{b(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=>b(T.target.value),onKeyDown:T=>{if(T.key==="Enter"){const E=Math.max(1,Math.min(v,Number(T.target.value)||1));b(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 hw(n,l,i=new Date){const s=pw(i);return{inferenceTokens:s.map(u=>({key:u.key,label:u.label,inputTokens:_x(n,u,"promptTokens"),outputTokens:_x(n,u,"completionTokens")})),imageGenerations:s.map(u=>({key:u.key,label:u.label,imageCount:vw(n,u),requestCount:xw(n,u)})),purchaseSpend:s.map(u=>({key:u.key,label:u.label,paymentTotals:gw(l,u),purchaseCount:bw(l,u)}))}}function pw(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 _x(n,l,i){return n.reduce((s,u)=>!js(u.createdAt,l)||Vf(u)?s:s+(u[i]??0),0)}function vw(n,l){return n.reduce((i,s)=>!js(s.createdAt,l)||!Vf(s)?i:i+(Number.isFinite(s.imageCount)?s.imageCount:1),0)}function xw(n,l){return n.reduce((i,s)=>!js(s.createdAt,l)||!Vf(s)?i:i+1,0)}function Vf(n){return n.billingUnit==="images"||n.endpoint==="/v1/images/generations"}function gw(n,l){const i=n.reduce((s,u)=>{if(!js(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 bw(n,l){return n.reduce((i,s)=>js(s.completedAt??s.createdAt,l)?i+1:i,0)}function js(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 yw(){var K,ce;const{language:n}=er(),l=I=>tN(I,n),i=ic(),s=xj(),[u,f]=S.useState("inferences"),[h,v]=S.useState(""),[p,x]=S.useState("all"),[y,b]=S.useState(1),[j,N]=S.useState(1),[T,E]=S.useState(25),U=i.isLoading||s.isLoading,z=((K=i.data)==null?void 0:K.inferences)??[],H=((ce=s.data)==null?void 0:ce.purchases)??[],L=h.trim().toLowerCase(),$=S.useMemo(()=>hw(z,H),[z,H]),Q=S.useMemo(()=>Mw(z),[z]),F=S.useMemo(()=>z.filter(I=>p!=="all"&&I.modelId!==p?!1:Tw(I,L)).sort((I,pe)=>pe.createdAt.localeCompare(I.createdAt)),[z,p,L]),B=S.useMemo(()=>H.filter(I=>Aw(I,L)).sort((I,pe)=>pe.createdAt.localeCompare(I.createdAt)),[H,L]),Z=S.useMemo(()=>Dx(F,y,T),[F,y,T]),J=S.useMemo(()=>Dx(B,j,T),[B,j,T]),ae=i.isError||s.isError;return S.useEffect(()=>{const I=Math.max(1,Math.ceil(F.length/T));y>I&&b(I)},[F.length,y,T]),S.useEffect(()=>{const I=Math.max(1,Math.ceil(B.length/T));j>I&&N(I)},[B.length,T,j]),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("section",{className:"grid gap-3 xl:grid-cols-3",children:[o.jsx(Ld,{icon:o.jsx(us,{className:"size-5"}),label:"Inference tokens",tone:"tokens",rows:$.inferenceTokens.map(I=>({key:I.key,label:l(I.label),value:Go(I.inputTokens+I.outputTokens),detail:l(`In ${we(I.inputTokens)} / Out ${we(I.outputTokens)}`)}))}),o.jsx(Ld,{icon:o.jsx(Df,{className:"size-5"}),label:"Image generations",tone:"tokens",rows:$.imageGenerations.map(I=>({key:I.key,label:l(I.label),value:`${we(I.imageCount)} img`,detail:l(`${we(I.requestCount)} requests`)}))}),o.jsx(Ld,{icon:o.jsx(rs,{className:"size-5"}),label:"Token purchase spend",tone:"spend",rows:$.purchaseSpend.map(I=>({key:I.key,label:l(I.label),value:kw(I.paymentTotals),detail:l(`${we(I.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(Ox,{label:l("Inferences"),active:u==="inferences",count:F.length,onClick:()=>f("inferences"),children:l("Inferences")}),o.jsx(Ox,{label:l("Purchases"),active:u==="purchases",count:B.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:I=>{v(I.target.value),b(1),N(1)}})]}),u==="inferences"?o.jsx(Sw,{label:l("Model"),allLabel:l("All model"),value:p,options:Q.models,translateOption:l,onChange:I=>{x(I),b(1)}}):null]})]}),ae?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,U?o.jsx(ww,{}):u==="inferences"?o.jsx(jw,{entries:Z,total:F.length,page:y,pageSize:T,onPageChange:b,onPageSizeChange:I=>{E(I),b(1),N(1)}}):o.jsx(Nw,{entries:J,total:B.length,page:j,pageSize:T,onPageChange:N,onPageSizeChange:I=>{E(I),b(1),N(1)}})]})]})}function Ox({label:n,active:l,count:i,onClick:s,children:u}){return o.jsxs("button",{type:"button",onClick:s,"aria-label":`${n} ledger records, ${we(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:we(i)})]})}function Sw({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 jw({entries:n,total:l,page:i,pageSize:s,onPageChange:u,onPageSizeChange:f}){return l===0?o.jsx(fb,{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:"USAGE"}),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:uc(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:pf(h)?o.jsx(Gj,{imageCount:h.imageCount,imageSize:h.imageSize,imageQuality:h.imageQuality,imageOutputFormat:h.imageOutputFormat}):o.jsx(Pj,{inputTokens:h.promptTokens,outputTokens:h.completionTokens,cacheReadTokens:h.cacheReadTokens})}),o.jsx("td",{className:"px-4 py-3 text-right",children:o.jsx(Vj,{billingUnit:h.billingUnit,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,imageCount:h.imageCount,imageSize:h.imageSize,imageQuality:h.imageQuality,imageOutputFormat:h.imageOutputFormat,imageOutputTokens:h.imageOutputTokens,imageOutputCostMicros:h.imageOutputCostMicros,imageCostMicrosPerImage:h.imageCostMicrosPerImage})}),o.jsx("td",{className:"px-4 py-3 text-right text-[0.78rem] text-[var(--color-ink)]",children:pf(h)?o.jsx(Fj,{ttftMs:h.ttftMs,durationMs:h.durationMs}):o.jsx(Zg,{ttftMs:h.ttftMs,tokensPerSecond:Ew(h)})})]})},h.requestId))]})}),o.jsx(db,{totalItems:l,pageSize:s,page:i,onPageChange:u,onPageSizeChange:f})]})}function Nw({entries:n,total:l,page:i,pageSize:s,onPageChange:u,onPageSizeChange:f}){return l===0?o.jsx(fb,{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:uc(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:_j(h)}),o.jsx("td",{className:"px-4 py-3 text-right font-mono text-[0.82rem] font-semibold text-emerald-700",children:Ia(h.creditMicros,{signed:!0})})]})},h.purchaseId))]})}),o.jsx(db,{totalItems:l,pageSize:s,page:i,onPageChange:u,onPageSizeChange:f})]})}function ww(){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 fb({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 Mw(n){return{models:Cw(n.map(l=>l.modelId))}}function Cw(n){return Array.from(new Set(n.filter(Boolean))).sort((l,i)=>l.localeCompare(i))}function Tw(n,l){return l?[n.sellerKey,n.modelId,uc(n.createdAt)].some(i=>i==null?void 0:i.toLowerCase().includes(l)):!0}function Aw(n,l){return l?[n.sellerKey,uc(n.createdAt)].some(i=>i==null?void 0:i.toLowerCase().includes(l)):!0}function Dx(n,l,i){const s=(l-1)*i;return n.slice(s,s+i)}function Ew(n){if(pf(n)||!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 pf(n){return n.billingUnit==="images"||n.endpoint==="/v1/images/generations"}function kw(n){return n.length===0?"-":n.map(l=>Oj(l.paymentAmountMinor,l.paymentCurrency)).join(" / ")}function Rw(){return $t({queryKey:["init","state"],queryFn:()=>Qt("/init/state"),refetchInterval:1e4})}async function zw(n){return xt("POST","/init/complete",void 0)}function _w(){return zt({mutationFn:()=>xt("POST","/init/doctor/run")})}function mb(){return $t({queryKey:["providers","status"],queryFn:()=>Qt("/providers/status"),refetchInterval:1e4})}function Ow(){return zt({mutationFn:n=>xt("POST","/providers/install/preview",n)})}function hb(){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 Dw(){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 Uw=[{value:"fullAuto",title:"全自动",body:"自动选择可用供应商。"},{value:"fixedSet",title:"固定供应商组",body:"在指定供应商组内切换。"},{value:"fixed",title:"固定供应商",body:"始终使用指定供应商。"}],Lw=[{value:"balanced",title:"平衡模式",body:"综合速度、价格、健康度、余额。"},{value:"speed",title:"速度优先",body:"优先选择更快、吞吐量更高供应商。"},{value:"discount",title:"成本优先",body:"优先选择更低成本供应商。"}],Ux=[{index:1,label:"选择模型",value:"默认模型"},{index:2,label:"绑定钱包",value:"支付方式"},{index:3,label:"配置策略",value:"路由规则"},{index:4,label:"配置工具",value:"终端接入"}],Bw=[{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 钱包入口预留"}],qw=["GPT","Claude","Gemini","DeepSeek","Kimi","Qwen","MiniMax","GLM","Doubao","Grok"];function Hw(n){const l=new URLSearchParams(n);return l.has("verifyPaymentMethods")?2:(l.has("verifyPickerDom")||l.has("verifyNoIntro")||l.has("verifyCompact"),1)}function $w(){var tr,ar,La,Ba,qa,Ha,aa,$a,Ea,Sl,qn,rn;const[n,l]=S.useState(()=>Hw(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,b]=S.useState(!1),[j,N]=S.useState("fullAuto"),[T,E]=S.useState("balanced"),[U,z]=S.useState(""),[H,L]=S.useState([]),[$,Q]=S.useState(),[F,B]=S.useState(""),[Z,J]=S.useState([]),[ae,K]=S.useState({}),[ce,I]=S.useState(),[pe,ie]=S.useState(),[R,X]=S.useState(!1),[se,le]=S.useState(null),[ve,C]=S.useState(!1),[P,W]=S.useState(),te=Rw(),fe=Hf(),ge=bj(),be=Lf(),Ue=mb(),Re=Bf(),_t=qf(),gt=Ow(),Ot=hb(),rt=_w(),Ie=sc(),ma=ic(),Kt=S.useMemo(()=>{var ue;return Pw(((ue=Ie.data)==null?void 0:ue.data)??[])},[(tr=Ie.data)==null?void 0:tr.data]),On=S.useMemo(()=>{var ue,$e,Et;return sM(((ue=Ie.data)==null?void 0:ue.sellers)??[],(($e=Ie.data)==null?void 0:$e.data)??[],((Et=ma.data)==null?void 0:Et.inferences)??[])},[(ar=ma.data)==null?void 0:ar.inferences,(La=Ie.data)==null?void 0:La.data,(Ba=Ie.data)==null?void 0:Ba.sellers]),ea=S.useMemo(()=>{var ue;return Gw(Kt,i,((ue=te.data)==null?void 0:ue.recommendedModels)??[])},[(qa=te.data)==null?void 0:qa.recommendedModels,Kt,i]),Dt=S.useMemo(()=>i.length>0?i:ea.map(ue=>ue.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 ue;return(((ue=Ue.data)==null?void 0:ue.clients)??[]).filter($e=>$e.id!=="custom"&&$e.detected)},[($a=Ue.data)==null?void 0:$a.clients]),ta=((Ea=be.data)==null?void 0:Ea.payments.filter(ue=>ue.enabled&&fc(ue.method)!=="mock"))??[],an=S.useMemo(()=>dM(j,T,U,H),[U,H,j,T]),ct=fM({serviceReady:((Sl=fe.data)==null?void 0:Sl.status)==="running",modelCount:Kt.length,routingMode:j,paymentReady:ta.length>0,configuredTools:((qn=Ue.data)==null?void 0:qn.summary.configuredCount)??0}),Dn=((rn=rt.data)==null?void 0:rn.checks.map(mM))??ct;S.useEffect(()=>{p||!te.data||(s(te.data.focusSet),x(!0))},[te.data,p]),S.useEffect(()=>{F||i.length===0||B(i[0])},[F,i]),S.useEffect(()=>{y||Ut.length===0||b(!0)},[y,Ut]),S.useEffect(()=>{n!==5||rt.data||rt.error||rt.isPending||rt.mutate()},[n,rt]),S.useEffect(()=>{var Et;const ue=ee=>{ee.preventDefault(),le(ee),W("浏览器已经允许直接安装 TokenBuddy。")},$e=()=>{C(!0),le(null),W("TokenBuddy 桌面应用已安装。")};return window.addEventListener("beforeinstallprompt",ue),window.addEventListener("appinstalled",$e),(Et=window.matchMedia)!=null&&Et.call(window,"(display-mode: standalone)").matches&&C(!0),()=>{window.removeEventListener("beforeinstallprompt",ue),window.removeEventListener("appinstalled",$e)}},[]);const nn=ue=>{v(void 0),s($e=>$e.includes(ue)?$e.filter(Et=>Et!==ue):[...$e,ue])},Ua=async()=>{f(!0),v(void 0);try{await uf(i),v("关注模型已保存。后续工具配置会优先参考这些模型。")}catch(ue){v(`保存失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{f(!1)}},Aa=async()=>{if(Q(void 0),!an){Q(j==="fixed"?"请选择一个固定供应商。":"请至少选择一个供应商。");return}try{await ge.mutateAsync(an),Q("供应商路由策略已保存。"),l(4)}catch(ue){Q(`保存失败:${ue instanceof Error?ue.message:String(ue)}`)}},Un=async()=>{try{await Re.mutateAsync()}catch{}},ln=async()=>{try{await _t.mutateAsync()}catch{}},Ln=async()=>{I(void 0);const ue=F||Dt[0];if(!ue){I("请先选择一个默认模型。");return}if(Z.length===0){I("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{await gt.mutateAsync({providers:Z,proxyUrl:Ta,model:ue,providerSelections:Qx(Z,ae,Dt,ue)}),I("已生成写入预览。确认无误后可以写入配置。")}catch($e){I(`预览失败:${$e instanceof Error?$e.message:String($e)}`)}},Bn=async()=>{I(void 0);const ue=F||Dt[0];if(!ue){I("请先选择一个默认模型。");return}if(Z.length===0){I("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{const $e=await Ot.mutateAsync({providers:Z,proxyUrl:Ta,model:ue,providerSelections:Qx(Z,ae,Dt,ue)});I(`已写入 ${$e.applied.length} 个配置文件。`),l(5)}catch($e){I(`写入失败:${$e instanceof Error?$e.message:String($e)}`)}},He=()=>{fe.refetch(),te.refetch(),be.refetch(),Ue.refetch(),Ie.refetch(),rt.mutate()},We=async()=>{ie(void 0),X(!0);try{await zw(),ie("初始化已标记完成。你可以把 TokenBuddy 安装成桌面应用,之后从系统应用入口打开。"),te.refetch()}catch(ue){ie(`完成失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{X(!1)}},ha=async()=>{if(!se){W("请在浏览器地址栏右侧或菜单里选择“安装应用”。");return}try{W(void 0),await se.prompt();const ue=await se.userChoice;if(le(null),ue.outcome==="accepted"){C(!0),W("TokenBuddy 桌面应用已安装。");return}W("你可以稍后继续使用浏览器安装入口。")}catch(ue){W(`安装未完成:${ue instanceof Error?ue.message:String(ue)}`)}},jt=(()=>{var ue,$e,Et,ee,re,Ce,tt,Qa,nr;return n<=1?o.jsx(Kw,{commonModels:ea,allModels:Kt,loading:Ie.isLoading,error:Ie.error,selectedModels:i,saving:u,saveMessage:h,onToggleModel:nn,onSave:Ua,onContinue:()=>l(2)}):n===2?o.jsx(tM,{payments:((ue=be.data)==null?void 0:ue.payments)??[],enabledPaymentCount:ta.length,loading:be.isLoading,qrUrl:($e=Re.data)==null?void 0:$e.qrImageUrl,rechargeQrUrl:(Et=_t.data)==null?void 0:Et.qrImageUrl,walletConfigPresent:(ee=Re.data)==null?void 0:ee.walletConfigPresent,error:Re.error,rechargeError:_t.error,binding:Re.isPending,rechargeLoading:_t.isPending,onBind:Un,onLoadRecharge:ln,onRefreshPayments:()=>{be.refetch()},onBack:()=>l(1),onContinue:()=>l(3)}):n===3?o.jsx(Ww,{mode:j,scorer:T,sellers:On,fixedSellerId:U,fixedSetSellerIds:H,saving:ge.isPending,message:$,onModeChange:N,onScorerChange:E,onFixedSellerChange:z,onToggleFixedSetSeller:it=>{L(ze=>ze.includes(it)?ze.filter(ut=>ut!==it):[...ze,it])},onSave:Aa,onBack:()=>l(2)}):n===4?o.jsx(nM,{clients:((re=Ue.data)==null?void 0:re.clients)??[],candidates:Ut,loading:Ue.isLoading,selectedProviders:Z,selectedModel:F||Dt[0]||"",modelOptions:Dt,providerSelections:ae,proxyUrl:Ta,previewChanges:(Ce=gt.data)==null?void 0:Ce.changes,applying:Ot.isPending,previewing:gt.isPending,message:ce,onToggleProvider:it=>{J(ze=>ze.includes(it)?ze.filter(ut=>ut!==it):[...ze,it])},onModelChange:B,onProviderSelectionChange:(it,ze)=>{K(ut=>({...ut,[it]:ze}))},onPreview:Ln,onInstall:Bn,onBack:()=>l(3)}):n===5?o.jsx(rM,{items:Dn,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(iM,{complete:((nr=te.data)==null?void 0:nr.setup.status)==="completed",message:pe,installMessage:P,canInstall:!!se,installed:ve,saving:R,onBack:()=>l(5),onComplete:We,onInstall:ha})})();return o.jsxs("div",{className:"min-w-0 space-y-3",children:[o.jsx(Qw,{activeStep:n,onSelect:l}),o.jsx("div",{className:"min-w-0",children:jt})]})}function Qw({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:Ux.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<Ux.length?o.jsx("div",{className:"hidden min-w-8 items-center justify-center text-[var(--color-purple)]/70 sm:flex",children:o.jsx(rc,{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 Kw({commonModels:n,allModels:l,loading:i,error:s,selectedModels:u,saving:f,saveMessage:h,onToggleModel:v,onSave:p,onContinue:x}){const[y,b]=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:()=>b(!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:()=>b(!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(Il,{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(rc,{className:"size-3.5"})]})]})]})]}),y?o.jsx(Yw,{models:n,allModels:l,selectedModelIds:u,onToggle:v,onClose:()=>b(!1)}):null]})}function Yw({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?Fw(l,x):[],b=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(Il,{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(Il,{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:b}):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:Ff(N.id)}),o.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 font-semibold text-emerald-700",children:"可用"}),vf(N.paymentMethods)?o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:vf(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 Pw(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 Gw(n,l,i){const s=Xw(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:Zw(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=Ff(p.model.id),y=v.get(x)??[];y.push(p),v.set(x,y)}for(const p of qw){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 Xw(n,l){const i=new Map;for(const s of l){const u=Vw(n,s,i);u&&i.set(u.id,u)}return Array.from(i.values())}function Vw(n,l,i){const s=Qd(l);if(!s)return;const u=n.find(f=>Qd(f.id)===s&&!i.has(f.id));return u||n.find(f=>{if(i.has(f.id))return!1;const h=Qd(f.id);return h.includes(s)||s.includes(h)})}function Qd(n){return n.trim().toLowerCase().replace(/_/g,"-")}function Fw(n,l){const i=l.trim().toLowerCase();return i?n.filter(s=>[s.id,Ff(s.id),...s.paymentMethods].some(u=>u.toLowerCase().includes(i))):n}function Zw(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 Ff(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 vf(n){return n.length===0?"":`${Jw(n.map(Iw)).join("、")}`}function Jw(n){return Array.from(new Set(n))}function Iw(n){const l=fc(n);return l.includes("x402")?"X402":l.includes("clawtip")?"ClawTip":l.includes("wallet")?"钱包":l.includes("mock")||l.includes("test")?"测试":"其它"}function fc(n){return n.trim().toLowerCase()}function Ww({mode:n,scorer:l,sellers:i,fixedSellerId:s,fixedSetSellerIds:u,saving:f,message:h,onModeChange:v,onScorerChange:p,onFixedSellerChange:x,onToggleFixedSetSeller:y,onSave:b,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:`${Sb(n)} / ${gM(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:Uw.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:Lw.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(eM,{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(pb,{backLabel:"上一步:绑定钱包",nextLabel:"下一步:配置工具",saving:f,message:h,onBack:j,onNext:b})]})}function eM({mode:n,sellers:l,fixedSellerId:i,fixedSetSellerIds:s,onFixedSellerChange:u,onToggleFixedSetSeller:f}){const[h,v]=S.useState({key:"status",direction:"asc"}),p=S.useMemo(()=>vb(l,h),[l,h]),x=b=>{v(j=>({key:b,direction:j.key===b&&j.direction==="asc"?"desc":"asc"}))},y=b=>{if(n==="fixed"){u(b);return}f(b)};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(Kr,{label:"供应商",sortKey:"name",sort:h,onSort:x}),o.jsx(Kr,{label:"状态",sortKey:"status",sort:h,onSort:x}),o.jsx(Kr,{label:"模型",sortKey:"models",sort:h,onSort:x,align:"right"}),o.jsx(Kr,{label:"价格",sortKey:"price",sort:h,onSort:x}),o.jsx(Kr,{label:"折扣",sortKey:"discount",sort:h,onSort:x,align:"right"}),o.jsx(Kr,{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(b=>{const j=n==="fixed"?i===b.id:s.includes(b.id);return o.jsxs("tr",{onClick:()=>y(b.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:b.name}),o.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.68rem] text-[var(--color-muted)]",children:b.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",yM(b.status)].join(" "),children:bM(b.status)})}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-ink)]",children:b.modelCount}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-ink)]",children:o.jsx(Fg,{inputPriceMicrosPer1m:b.minInputPriceMicrosPer1m,outputPriceMicrosPer1m:b.minOutputPriceMicrosPer1m})}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-purple)]",children:$f(b.discountRatio)}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:o.jsx(Zg,{ttftMs:b.avgTtftMs,tokensPerSecond:b.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:vf(b.paymentMethods)||"—"})})]},b.id)})})]})})})}function Kr({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 tM({payments:n,enabledPaymentCount:l,loading:i,qrUrl:s,rechargeQrUrl:u,walletConfigPresent:f,error:h,rechargeError:v,binding:p,rechargeLoading:x,onBind:y,onLoadRecharge:b,onRefreshPayments:j,onBack:N,onContinue:T}){const[E,U]=S.useState("clawtip"),[z,H]=S.useState(!1),[L,$]=S.useState(!1),Q=n.find(R=>fc(R.method)==="clawtip"),F=!!(Q!=null&&Q.enabled||f||aM(Q==null?void 0:Q.config,"walletConfigPresent")),B=z&&F,Z=[{method:"clawtip",name:"ClawTip",detail:"JD App 扫码 / 微支付",status:F?"已绑定":"可绑定",available:!0},...Bw.map(R=>({...R,status:"Coming soon",available:!1}))],J=Z.find(R=>R.method===E)??Z[0],ae=J.method==="clawtip",K=ae&&F&&!B,ce=B||K||z,I=ae?ce:!0,pe=()=>{H(!0),y()},ie=()=>{$(!0),b()};return S.useEffect(()=>{if(!ae||!z||F)return;const R=window.setInterval(j,1500);return()=>window.clearInterval(R)},[z,F,j,ae]),S.useEffect(()=>{!K||u||x||L||($(!0),b())},[b,x,u,L,K]),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:ae&&K?o.jsxs("button",{type:"button",disabled:x,onClick:ie,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"}),"刷新充值码"]}):ae&&z&&!F?o.jsxs("button",{type:"button",disabled:p,onClick:pe,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"}),"重新生成"]}):ae&&!z&&!F?o.jsxs("button",{type:"button",disabled:p,onClick:pe,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"}),"开始绑定"]}):ae?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",I?"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:Z.map(R=>{const X=R.method===J.method;return o.jsxs("button",{type:"button",onClick:()=>U(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:Lx(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)})}),ae?ce?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:B?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 钱包已经写入本机配置,可以继续配置路由策略。"})]})}):K?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:ie,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:Lx(J.method)}),o.jsx("div",{className:"mt-3 text-[0.92rem] font-semibold text-[var(--color-ink)]",children:J.name}),o.jsxs("div",{className:"mt-1 text-[0.78rem] leading-5 text-[var(--color-muted)]",children:[J.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"})]})})]}),ae&&!F&&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,ae&&K&&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(pb,{backLabel:"上一步:模型访问",nextLabel:"下一步:配置策略",message:l>0?"支付方式已可用,可以继续配置路由策略。":"如果你暂时跳过绑定,后续首次购买模型额度时仍需要完成支付配置。",onBack:N,onNext:T})]})}function Lx(n){const l=fc(n);return l==="wechat-pay"?o.jsx(cj,{className:"size-4"}):l==="alipay-agent"?o.jsx(PS,{className:"size-4"}):l==="coinbase-smart-wallet"?o.jsx(us,{className:"size-4"}):o.jsx(rs,{className:"size-4"})}function aM(n,l){const i=n==null?void 0:n[l];return i===!0||i==="true"||i===1||i==="1"}function nM({clients:n,candidates:l,loading:i,selectedProviders:s,selectedModel:u,modelOptions:f,providerSelections:h,proxyUrl:v,previewChanges:p,applying:x,previewing:y,message:b,onToggleProvider:j,onModelChange:N,onProviderSelectionChange:T,onPreview:E,onInstall:U,onBack:z}){var ae;const H=new Set(l.map(K=>K.id)),L=l.length,$=n.find(K=>K.id==="custom")??bb(v),Q=[...n.filter(K=>K.id!=="custom"),{...$,name:"其他工具"}],F=((ae=Q[0])==null?void 0:ae.id)??"custom",[B,Z]=S.useState(F),J=Q.find(K=>K.id===B)??Q[0]??$;return S.useEffect(()=>{var K;Q.some(ce=>ce.id===B)||Z(((K=Q[0])==null?void 0:K.id)??"custom")},[B,Q]),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} 本次写入 / ${L} 已安装`,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:Q.map(K=>{const ce=K.id!=="custom"&&H.has(K.id),I=s.includes(K.id),pe=J.id===K.id;return o.jsxs("div",{className:["rounded-[10px] border p-2.5 text-left transition",pe?"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",pe?"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:uM(K.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:K.name}),I?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:jb(K)}),K.commandName?o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:K.commandName}):null,K.id==="custom"?o.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:"复制配置"}):null]})]}),K.id!=="custom"?o.jsx("button",{type:"button",disabled:!ce,className:["mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border",I?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] bg-white text-transparent",ce?"":"opacity-45"].join(" "),"aria-label":I?`移出 ${K.name} 本次写入`:`写入 ${K.name} 的 TokenBuddy 配置`,"aria-pressed":I,title:I?"移出本次写入":"加入本次写入",onClick:()=>j(K.id),children:o.jsx(Ht,{className:"size-3"})}):null]}),o.jsx("button",{type:"button",onClick:()=>Z(K.id),className:["mt-2 inline-flex h-7 items-center justify-center rounded-[7px] px-2 text-[0.72rem] font-semibold transition",pe?"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:"查看配置"})]},K.id)})})]}),o.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:o.jsx(lM,{client:J,selected:s.includes(J.id),installable:J.id!=="custom"&&H.has(J.id),selectedModel:u,modelOptions:f,providerSelections:h,proxyUrl:v,onToggleInstall:()=>j(J.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(K=>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:SM(K.action)}),o.jsx("span",{children:K.providerId})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:K.path}),o.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:K.summary})]},`${K.providerId}:${K.path}:${K.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:b?o.jsx("div",{className:"mt-1 font-medium text-[var(--color-ink)]",children:b}):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:U,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 lM({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??bb(h).manualConfig;return o.jsxs("div",{className:"space-y-3",children:[o.jsx(Kd,{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)??yb(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=gb(f[n.id],u,s),U=(H,L)=>{x(n.id,{...E,fallbackModel:E.fallbackModel||L||s,roles:{...E.roles,[H]:L?{upstreamModel:L,displayName:L}:void 0}})},z=H=>{x(n.id,{...E,fallbackModel:H}),p(H)};return o.jsxs("div",{className:"space-y-3",children:[o.jsx(Kd,{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:H=>U("haiku",H)}),o.jsx(ts,{label:"Sonnet",value:((N=E.roles.sonnet)==null?void 0:N.upstreamModel)??"",modelOptions:u,onChange:H=>U("sonnet",H)}),o.jsx(ts,{label:"Opus",value:((T=E.roles.opus)==null?void 0:T.upstreamModel)??"",modelOptions:u,onChange:H=>U("opus",H)})]}),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=xb(n.id,f[n.id],s),b=E=>{p(E),x(n.id,{selectionKind:"single-model",protocolPreference:xf(n.id),defaultModel:E})};return o.jsxs("div",{className:"space-y-3",children:[o.jsx(Kd,{client:n,selected:l,installable:i,onToggleInstall:v}),o.jsx(ts,{label:"模型",value:y.defaultModel,modelOptions:u,onChange:b}),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 Kd({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:jb(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(OS,{className:"size-3"}),s?"已复制":"复制"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[0.76rem] text-[var(--color-ink)]",children:l})]})}function rM({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":Kx(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(cf,{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",hM(l)].join(" "),children:s?"正在检查":Kx(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",vM(p.status)].join(" "),children:p.ok?o.jsx(Ht,{className:"size-3.5"}):o.jsx(cf,{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]",xM(p.status)].join(" "),children:pM(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(rc,{className:"size-3.5"})]})]})]})]})})}function iM({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(Wl,{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 pb({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(rc,{className:"size-3.5"})]})]})]})}function sM(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=qx(v.minInputPriceMicrosPer1m,h.inputPriceMicrosPer1m),v.minOutputPriceMicrosPer1m=qx(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:$x(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??Hx((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:$x((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:Hx(v.ttftMsSamples)})}return vb(u,{key:"status",direction:"asc"})}function vb(n,l){const i=l.direction==="asc"?1:-1;return[...n].sort((s,u)=>{const f=oM(s,u,l.key);if(f!==0)return f*i;const h=ac(s.status)-ac(u.status);return h!==0?h:u.modelCount!==s.modelCount?u.modelCount-s.modelCount:s.name.localeCompare(u.name)})}function oM(n,l,i){return i==="status"?ac(n.status)-ac(l.status):i==="name"?n.name.localeCompare(l.name):i==="models"?n.modelCount-l.modelCount:i==="price"?Xo(Bx(n),Bx(l)):i==="discount"?Xo(n.discountRatio,l.discountRatio):Xo(n.avgTtftMs,l.avgTtftMs)||cM(n.avgTokensPerSecond,l.avgTokensPerSecond)}function Bx(n){if(!(!Number.isFinite(n.minInputPriceMicrosPer1m)&&!Number.isFinite(n.minOutputPriceMicrosPer1m)))return(n.minInputPriceMicrosPer1m??0)+(n.minOutputPriceMicrosPer1m??0)}function qx(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 Hx(n){const l=n.filter(i=>Number.isFinite(i));if(l.length!==0)return l.reduce((i,s)=>i+s,0)/l.length}function Xo(n,l){const i=Number.isFinite(n),s=Number.isFinite(l);return i&&s?n-l:i?-1:s?1:0}function cM(n,l){return Xo(l,n)}function $x(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function Qx(n,l,i,s){const u=s||i[0]||"",f={};for(const h of n)h!=="custom"&&(f[h]=h==="claude-code"?gb(l[h],i,u):xb(h,l[h],u));return f}function xb(n,l,i){return(l==null?void 0:l.selectionKind)==="single-model"?{...l,protocolPreference:l.protocolPreference??xf(n),defaultModel:l.defaultModel||i}:{selectionKind:"single-model",protocolPreference:xf(n),defaultModel:i}}function gb(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 xf(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 bb(n){return{id:"custom",name:"其他工具",status:"manual",detected:!0,configured:!1,reason:"复制本地推理服务接口到任意 OpenAI 或 Anthropic 兼容客户端。",manualConfig:{openaiBaseUrl:yb(n),anthropicBaseUrl:n,apiKey:"TOKENBUDDY_PROXY"}}}function yb(n){const l=n.replace(/\/+$/,"");return l.endsWith("/v1")?l:`${l}/v1`}function uM(n){const l=n.trim();return l?l.slice(0,1).toUpperCase():"?"}function dM(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 fM({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:`当前策略为${Sb(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 mM(n){return{title:n.label,body:n.message,ok:n.status==="passed"||n.status==="skipped",status:n.status,details:n.details}}function Kx(n){return n==="passed"?"全部通过":n==="warning"?"存在警告":n==="failed"?"需要修复":"等待检查"}function hM(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 pM(n){return n==="passed"?"通过":n==="warning"?"警告":n==="failed"?"失败":"已跳过"}function vM(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 xM(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 Sb(n){return n==="fixed"?"固定供应商":n==="fixedSet"?"固定供应商组":"全自动"}function gM(n){return n==="speed"?"速度优先":n==="discount"?"成本优先":"平衡模式"}function bM(n){const l=n.toLowerCase();return["ok","healthy","active","available"].includes(l)?"状态正常":["error","failed","unavailable"].includes(l)?"状态异常":["unknown","pending"].includes(l)?"等待检测":`状态:${n}`}function yM(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 ac(n){const l=n.toLowerCase();return["ok","healthy","active","available"].includes(l)?0:["unknown","pending"].includes(l)?1:2}function jb(n){return n.configured?"已配置":n.status==="installed"?"已安装":n.status==="manual"?"需要手动配置":n.detected?"已检测到":"未检测到"}function SM(n){return n==="create"?"创建":"更新"}function jM({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 Nb="TOKENBUDDY_PROXY",NM="https://tokenbuddy.ai",wM={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"}},MM={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"}},CM={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 TM(){var J,ae,K,ce,I,pe,ie,R,X,se;const{t:n}=er(),l=mb(),i=Hf(),s=sc(),u=hb(),f=Dw(),[h,v]=S.useState(null),[p,x]=S.useState(null),[y,b]=S.useState(null),j=((J=i.data)==null?void 0:J.proxyPort)??17821,N=((ce=(K=(ae=l.data)==null?void 0:ae.clients.find(le=>le.id==="custom"))==null?void 0:K.manualConfig)==null?void 0:ce.openaiBaseUrl)??`http://127.0.0.1:${j}/v1`,T=((ie=(pe=(I=l.data)==null?void 0:I.clients.find(le=>le.id==="custom"))==null?void 0:pe.manualConfig)==null?void 0:ie.anthropicBaseUrl)??`http://127.0.0.1:${j}`,E=S.useMemo(()=>{var le;return zM(((le=s.data)==null?void 0:le.data.map(ve=>ve.id))??[])},[(R=s.data)==null?void 0:R.data]),U=(((X=l.data)==null?void 0:X.clients)??[]).filter(le=>le.id!=="custom"),z=U.length,H=((se=l.data)==null?void 0:se.summary.configuredCount)??0,L=u.isPending||f.isPending,$=_M(u.error,f.error),Q=!!(p||$),F=async(le,ve)=>{try{await navigator.clipboard.writeText(ve),b(le),x(null),window.setTimeout(()=>b(C=>C===le?null:C),1600)}catch{x(n("tools.copyFailed"))}},B=async le=>{v(le.id),x(null);const ve=await u.mutateAsync({providers:[le.id],proxyUrl:kM(le.id)==="messages"?T:N,model:E});x(n("tools.fileChangesApplied",{name:le.name,count:ve.applied.length,plural:ve.applied.length===1?"":"s"}))},Z=async le=>{v(le.id),x(null);const ve=await f.mutateAsync({providers:[le.id]}),C=ve.rolledBack.filter(W=>W.action==="restored"||W.action==="removed").length,P=ve.rolledBack.some(W=>W.action==="missing_snapshot");x(P?n("tools.noSnapshot",{name:le.name}):n("tools.restoredChanges",{name:le.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:H,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(Io,{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:U.map(le=>o.jsx(AM,{client:le,busy:L&&h===le.id,ccSwitchLink:RM(le.id,N,T,E),onConfigure:()=>void B(le),onRollback:()=>void Z(le)},le.id))})]}),Q?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.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:$}):null]})}):null]}),o.jsx("section",{children:o.jsx(EM,{openAiBaseUrl:N,anthropicBaseUrl:T,copied:y,onCopy:F})})]})}function AM({client:n,busy:l,ccSwitchLink:i,onConfigure:s,onRollback:u}){const{t:f}=er(),h=wM[n.id]??{tone:"gray",protocol:"Custom"},v=n.status!=="missing",p=CM[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(gf,{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(Jj,{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(aj,{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(SS,{className:"size-3.5"}),f("tools.getApp")]}):o.jsx("span",{"aria-hidden":"true",className:"hidden h-8 md:block"})]})]})}function gf({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(dj,{className:"size-4 text-[var(--color-muted)]","aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:l})]})}function EM({openAiBaseUrl:n,anthropicBaseUrl:l,copied:i,onCopy:s}){var b;const{t:u}=er(),[f,h]=S.useState(((b=ns[0])==null?void 0:b.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(gf,{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(gf,{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(Yd,{label:u("tools.openAiBaseUrl"),value:n,copyKey:"manual-openai",copied:i,onCopy:s}),o.jsx(Yd,{label:u("tools.anthropicBaseUrl"),value:l,copyKey:"manual-anthropic",copied:i,onCopy:s}),o.jsx(Yd,{label:u("tools.apiKey"),value:Nb,copyKey:"manual-key",copied:i,onCopy:s})]})]})})]})]})}function Yd({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||Me})]}),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(zS,{className:"size-4"})})]})}function kM(n){return n==="codex"?"responses":n==="claude-code"||n==="claude-desktop"?"messages":"chat_completions"}function RM(n,l,i,s){const u=MM[n];if(u)return jM({app:u.app,endpoint:u.endpointKind==="anthropic"?i:l,apiKey:Nb,model:s,homepage:NM})}function zM(n){return n.find(l=>l==="gpt-5.4")??n.find(l=>l.toLowerCase().includes("gpt"))??n[0]??"gpt-5.4"}function _M(...n){const l=n.find(Boolean);return l instanceof Error?l.message:void 0}function OM({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(DM,{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 DM({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 UM(){const{t:n}=er();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(Ef,{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(OM,{compact:!0,hideTextBelowSm:!0})}),o.jsxs("div",{className:"ml-auto flex min-w-0 gap-0.5 sm:gap-1",children:[o.jsx(Qo,{to:"/overview",children:n("nav.overview")}),o.jsx(Qo,{to:"/routing",children:n("nav.routing")}),o.jsx(Qo,{to:"/ledger",children:n("nav.ledger")}),o.jsx(Qo,{to:"/tools",children:n("nav.tools")})]}),o.jsx(LM,{})]}),o.jsx("main",{className:"mx-auto max-w-[1180px] px-3 py-5 sm:px-6 sm:py-7",children:o.jsxs(K1,{children:[o.jsx(Hl,{path:"/",element:o.jsx(Sx,{})}),o.jsx(Hl,{path:"/overview",element:o.jsx(Sx,{})}),o.jsx(Hl,{path:"/init",element:o.jsx($w,{})}),o.jsx(Hl,{path:"/routing",element:o.jsx(ON,{})}),o.jsx(Hl,{path:"/ledger",element:o.jsx(yw,{})}),o.jsx(Hl,{path:"/tools",element:o.jsx(TM,{})})]})})]})}function LM(){const{language:n,setLanguage:l,t:i}=er(),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 Qo({to:n,children:l}){return o.jsx(Ef,{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 BM(){!("serviceWorker"in navigator)||window.location.port==="5173"||window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})})}const qM=new Z2({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1,retry:1}}});P0.createRoot(document.getElementById("root")).render(o.jsx(S.StrictMode,{children:o.jsx(J2,{client:qM,children:o.jsx(Ij,{children:o.jsx(h2,{children:o.jsx(UM,{})})})})}));BM();
|
|
271
|
+
//# sourceMappingURL=index-BVbeDEwq.js.map
|