@tokenbuddy/tokenbuddy 1.0.39 → 1.0.41
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 +22 -0
- package/dist/src/buyer-store.js +46 -7
- package/dist/src/daemon.d.ts +16 -0
- package/dist/src/daemon.js +421 -17
- package/dist/src/init-clawtip-activation.js +16 -2
- package/dist/src/provider-install.d.ts +3 -5
- package/dist/src/provider-install.js +33 -425
- package/dist/src/route-failover.js +10 -0
- package/dist/src/seller-pool.d.ts +5 -5
- package/dist/src/seller-pool.js +5 -7
- package/dist/src/seller-route-recommendations.d.ts +110 -0
- package/dist/src/seller-route-recommendations.js +334 -0
- package/package.json +2 -2
- package/static/ui/assets/index-Ca_IcEY6.js +271 -0
- package/static/ui/assets/index-DAq0t0SA.css +1 -0
- package/static/ui/index.html +2 -2
- package/static/ui/assets/index-BAwWDK4H.js +0 -271
- package/static/ui/assets/index-DM9SnAfj.css +0 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
var K0=Object.defineProperty;var ex=n=>{throw TypeError(n)};var Y0=(n,l,o)=>l in n?K0(n,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[l]=o;var qd=(n,l,o)=>Y0(n,typeof l!="symbol"?l+"":l,o),Pd=(n,l,o)=>l.has(n)||ex("Cannot "+o);var C=(n,l,o)=>(Pd(n,l,"read from private field"),o?o.call(n):l.get(n)),me=(n,l,o)=>l.has(n)?ex("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,o),se=(n,l,o,i)=>(Pd(n,l,"write to private field"),i?i.call(n,o):l.set(n,o),o),we=(n,l,o)=>(Pd(n,l,"access private method"),o);var ec=(n,l,o,i)=>({set _(u){se(n,l,u,o)},get _(){return C(n,l,i)}});(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const v of f.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&i(v)}).observe(document,{childList:!0,subtree:!0});function o(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 i(u){if(u.ep)return;u.ep=!0;const f=o(u);fetch(u.href,f)}})();var $d={exports:{}},cs={};/**
|
|
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 tx;function G0(){if(tx)return cs;tx=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function o(i,u,f){var v=null;if(f!==void 0&&(v=""+f),u.key!==void 0&&(v=""+u.key),"key"in u){f={};for(var h in u)h!=="key"&&(f[h]=u[h])}else f=u;return u=f.ref,{$$typeof:n,type:i,key:v,ref:u!==void 0?u:null,props:f}}return cs.Fragment=l,cs.jsx=o,cs.jsxs=o,cs}var nx;function V0(){return nx||(nx=1,$d.exports=G0()),$d.exports}var s=V0(),Qd={exports:{}},Se={};/**
|
|
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 ax;function X0(){if(ax)return Se;ax=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),v=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function M(N){return N===null||typeof N!="object"?null:(N=j&&N[j]||N["@@iterator"],typeof N=="function"?N:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,D={};function R(N,q,X){this.props=N,this.context=q,this.refs=D,this.updater=X||T}R.prototype.isReactComponent={},R.prototype.setState=function(N,q){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,q,"setState")},R.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function U(){}U.prototype=R.prototype;function Q(N,q,X){this.props=N,this.context=q,this.refs=D,this.updater=X||T}var H=Q.prototype=new U;H.constructor=Q,E(H,R.prototype),H.isPureReactComponent=!0;var G=Array.isArray;function K(){}var $={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function Z(N,q,X){var le=X.ref;return{$$typeof:n,type:N,key:q,ref:le!==void 0?le:null,props:X}}function ne(N,q){return Z(N.type,q,N.props)}function B(N){return typeof N=="object"&&N!==null&&N.$$typeof===n}function ie(N){var q={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(X){return q[X]})}var te=/\/+/g;function xe(N,q){return typeof N=="object"&&N!==null&&N.key!=null?ie(""+N.key):q.toString(36)}function fe(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(K,K):(N.status="pending",N.then(function(q){N.status==="pending"&&(N.status="fulfilled",N.value=q)},function(q){N.status==="pending"&&(N.status="rejected",N.reason=q)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function O(N,q,X,le,pe){var de=typeof N;(de==="undefined"||de==="boolean")&&(N=null);var be=!1;if(N===null)be=!0;else switch(de){case"bigint":case"string":case"number":be=!0;break;case"object":switch(N.$$typeof){case n:case l:be=!0;break;case y:return be=N._init,O(be(N._payload),q,X,le,pe)}}if(be)return pe=pe(N),be=le===""?"."+xe(N,0):le,G(pe)?(X="",be!=null&&(X=be.replace(te,"$&/")+"/"),O(pe,q,X,"",function(wt){return wt})):pe!=null&&(B(pe)&&(pe=ne(pe,X+(pe.key==null||N&&N.key===pe.key?"":(""+pe.key).replace(te,"$&/")+"/")+be)),q.push(pe)),1;be=0;var Ve=le===""?".":le+":";if(G(N))for(var Oe=0;Oe<N.length;Oe++)le=N[Oe],de=Ve+xe(le,Oe),be+=O(le,q,X,de,pe);else if(Oe=M(N),typeof Oe=="function")for(N=Oe.call(N),Oe=0;!(le=N.next()).done;)le=le.value,de=Ve+xe(le,Oe++),be+=O(le,q,X,de,pe);else if(de==="object"){if(typeof N.then=="function")return O(fe(N),q,X,le,pe);throw q=String(N),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return be}function ee(N,q,X){if(N==null)return N;var le=[],pe=0;return O(N,le,"","",function(de){return q.call(X,de,pe++)}),le}function re(N){if(N._status===-1){var q=N._result;q=q(),q.then(function(X){(N._status===0||N._status===-1)&&(N._status=1,N._result=X)},function(X){(N._status===0||N._status===-1)&&(N._status=2,N._result=X)}),N._status===-1&&(N._status=0,N._result=q)}if(N._status===1)return N._result.default;throw N._result}var ae=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},ge={map:ee,forEach:function(N,q,X){ee(N,function(){q.apply(this,arguments)},X)},count:function(N){var q=0;return ee(N,function(){q++}),q},toArray:function(N){return ee(N,function(q){return q})||[]},only:function(N){if(!B(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return Se.Activity=g,Se.Children=ge,Se.Component=R,Se.Fragment=o,Se.Profiler=u,Se.PureComponent=Q,Se.StrictMode=i,Se.Suspense=p,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Se.__COMPILER_RUNTIME={__proto__:null,c:function(N){return $.H.useMemoCache(N)}},Se.cache=function(N){return function(){return N.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function(N,q,X){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var le=E({},N.props),pe=N.key;if(q!=null)for(de in q.key!==void 0&&(pe=""+q.key),q)!I.call(q,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&q.ref===void 0||(le[de]=q[de]);var de=arguments.length-2;if(de===1)le.children=X;else if(1<de){for(var be=Array(de),Ve=0;Ve<de;Ve++)be[Ve]=arguments[Ve+2];le.children=be}return Z(N.type,pe,le)},Se.createContext=function(N){return N={$$typeof:v,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:f,_context:N},N},Se.createElement=function(N,q,X){var le,pe={},de=null;if(q!=null)for(le in q.key!==void 0&&(de=""+q.key),q)I.call(q,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(pe[le]=q[le]);var be=arguments.length-2;if(be===1)pe.children=X;else if(1<be){for(var Ve=Array(be),Oe=0;Oe<be;Oe++)Ve[Oe]=arguments[Oe+2];pe.children=Ve}if(N&&N.defaultProps)for(le in be=N.defaultProps,be)pe[le]===void 0&&(pe[le]=be[le]);return Z(N,de,pe)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(N){return{$$typeof:h,render:N}},Se.isValidElement=B,Se.lazy=function(N){return{$$typeof:y,_payload:{_status:-1,_result:N},_init:re}},Se.memo=function(N,q){return{$$typeof:x,type:N,compare:q===void 0?null:q}},Se.startTransition=function(N){var q=$.T,X={};$.T=X;try{var le=N(),pe=$.S;pe!==null&&pe(X,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(K,ae)}catch(de){ae(de)}finally{q!==null&&X.types!==null&&(q.types=X.types),$.T=q}},Se.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Se.use=function(N){return $.H.use(N)},Se.useActionState=function(N,q,X){return $.H.useActionState(N,q,X)},Se.useCallback=function(N,q){return $.H.useCallback(N,q)},Se.useContext=function(N){return $.H.useContext(N)},Se.useDebugValue=function(){},Se.useDeferredValue=function(N,q){return $.H.useDeferredValue(N,q)},Se.useEffect=function(N,q){return $.H.useEffect(N,q)},Se.useEffectEvent=function(N){return $.H.useEffectEvent(N)},Se.useId=function(){return $.H.useId()},Se.useImperativeHandle=function(N,q,X){return $.H.useImperativeHandle(N,q,X)},Se.useInsertionEffect=function(N,q){return $.H.useInsertionEffect(N,q)},Se.useLayoutEffect=function(N,q){return $.H.useLayoutEffect(N,q)},Se.useMemo=function(N,q){return $.H.useMemo(N,q)},Se.useOptimistic=function(N,q){return $.H.useOptimistic(N,q)},Se.useReducer=function(N,q,X){return $.H.useReducer(N,q,X)},Se.useRef=function(N){return $.H.useRef(N)},Se.useState=function(N){return $.H.useState(N)},Se.useSyncExternalStore=function(N,q,X){return $.H.useSyncExternalStore(N,q,X)},Se.useTransition=function(){return $.H.useTransition()},Se.version="19.2.7",Se}var lx;function qf(){return lx||(lx=1,Qd.exports=X0()),Qd.exports}var S=qf(),Hd={exports:{}},us={},Kd={exports:{}},Yd={};/**
|
|
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 rx;function F0(){return rx||(rx=1,(function(n){function l(O,ee){var re=O.length;O.push(ee);e:for(;0<re;){var ae=re-1>>>1,ge=O[ae];if(0<u(ge,ee))O[ae]=ee,O[re]=ge,re=ae;else break e}}function o(O){return O.length===0?null:O[0]}function i(O){if(O.length===0)return null;var ee=O[0],re=O.pop();if(re!==ee){O[0]=re;e:for(var ae=0,ge=O.length,N=ge>>>1;ae<N;){var q=2*(ae+1)-1,X=O[q],le=q+1,pe=O[le];if(0>u(X,re))le<ge&&0>u(pe,X)?(O[ae]=pe,O[le]=re,ae=le):(O[ae]=X,O[q]=re,ae=q);else if(le<ge&&0>u(pe,re))O[ae]=pe,O[le]=re,ae=le;else break e}}return ee}function u(O,ee){var re=O.sortIndex-ee.sortIndex;return re!==0?re:O.id-ee.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 v=Date,h=v.now();n.unstable_now=function(){return v.now()-h}}var p=[],x=[],y=1,g=null,j=3,M=!1,T=!1,E=!1,D=!1,R=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function H(O){for(var ee=o(x);ee!==null;){if(ee.callback===null)i(x);else if(ee.startTime<=O)i(x),ee.sortIndex=ee.expirationTime,l(p,ee);else break;ee=o(x)}}function G(O){if(E=!1,H(O),!T)if(o(p)!==null)T=!0,K||(K=!0,ie());else{var ee=o(x);ee!==null&&fe(G,ee.startTime-O)}}var K=!1,$=-1,I=5,Z=-1;function ne(){return D?!0:!(n.unstable_now()-Z<I)}function B(){if(D=!1,K){var O=n.unstable_now();Z=O;var ee=!0;try{e:{T=!1,E&&(E=!1,U($),$=-1),M=!0;var re=j;try{t:{for(H(O),g=o(p);g!==null&&!(g.expirationTime>O&&ne());){var ae=g.callback;if(typeof ae=="function"){g.callback=null,j=g.priorityLevel;var ge=ae(g.expirationTime<=O);if(O=n.unstable_now(),typeof ge=="function"){g.callback=ge,H(O),ee=!0;break t}g===o(p)&&i(p),H(O)}else i(p);g=o(p)}if(g!==null)ee=!0;else{var N=o(x);N!==null&&fe(G,N.startTime-O),ee=!1}}break e}finally{g=null,j=re,M=!1}ee=void 0}}finally{ee?ie():K=!1}}}var ie;if(typeof Q=="function")ie=function(){Q(B)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,xe=te.port2;te.port1.onmessage=B,ie=function(){xe.postMessage(null)}}else ie=function(){R(B,0)};function fe(O,ee){$=R(function(){O(n.unstable_now())},ee)}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(O){O.callback=null},n.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<O?Math.floor(1e3/O):5},n.unstable_getCurrentPriorityLevel=function(){return j},n.unstable_next=function(O){switch(j){case 1:case 2:case 3:var ee=3;break;default:ee=j}var re=j;j=ee;try{return O()}finally{j=re}},n.unstable_requestPaint=function(){D=!0},n.unstable_runWithPriority=function(O,ee){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var re=j;j=O;try{return ee()}finally{j=re}},n.unstable_scheduleCallback=function(O,ee,re){var ae=n.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?ae+re:ae):re=ae,O){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=re+ge,O={id:y++,callback:ee,priorityLevel:O,startTime:re,expirationTime:ge,sortIndex:-1},re>ae?(O.sortIndex=re,l(x,O),o(p)===null&&O===o(x)&&(E?(U($),$=-1):E=!0,fe(G,re-ae))):(O.sortIndex=ge,l(p,O),T||M||(T=!0,K||(K=!0,ie()))),O},n.unstable_shouldYield=ne,n.unstable_wrapCallback=function(O){var ee=j;return function(){var re=j;j=ee;try{return O.apply(this,arguments)}finally{j=re}}}})(Yd)),Yd}var ix;function Z0(){return ix||(ix=1,Kd.exports=F0()),Kd.exports}var Gd={exports:{}},Bt={};/**
|
|
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 sx;function J0(){if(sx)return Bt;sx=1;var n=qf();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 o(){}var i={d:{f:o,r:function(){throw Error(l(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(p,x,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:p,containerInfo:x,implementation:y}}var v=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,x){if(p==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return Bt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Bt.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)},Bt.flushSync=function(p){var x=v.T,y=i.p;try{if(v.T=null,i.p=2,p)return p()}finally{v.T=x,i.p=y,i.d.f()}},Bt.preconnect=function(p,x){typeof p=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,i.d.C(p,x))},Bt.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},Bt.preinit=function(p,x){if(typeof p=="string"&&x&&typeof x.as=="string"){var y=x.as,g=h(y,x.crossOrigin),j=typeof x.integrity=="string"?x.integrity:void 0,M=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;y==="style"?i.d.S(p,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:M}):y==="script"&&i.d.X(p,{crossOrigin:g,integrity:j,fetchPriority:M,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},Bt.preinitModule=function(p,x){if(typeof p=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var y=h(x.as,x.crossOrigin);i.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&&i.d.M(p)},Bt.preload=function(p,x){if(typeof p=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var y=x.as,g=h(y,x.crossOrigin);i.d.L(p,y,{crossOrigin:g,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},Bt.preloadModule=function(p,x){if(typeof p=="string")if(x){var y=h(x.as,x.crossOrigin);i.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 i.d.m(p)},Bt.requestFormReset=function(p){i.d.r(p)},Bt.unstable_batchedUpdates=function(p,x){return p(x)},Bt.useFormState=function(p,x,y){return v.H.useFormState(p,x,y)},Bt.useFormStatus=function(){return v.H.useHostTransitionStatus()},Bt.version="19.2.7",Bt}var ox;function pg(){if(ox)return Gd.exports;ox=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(),Gd.exports=J0(),Gd.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 cx;function I0(){if(cx)return us;cx=1;var n=Z0(),l=qf(),o=pg();function i(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 v(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 h(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(i(188))}function x(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(i(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(i(188))}if(a.return!==r.return)a=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===a){m=!0,a=c,r=d;break}if(b===r){m=!0,r=c,a=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===a){m=!0,a=d,r=c;break}if(b===r){m=!0,r=d,a=c;break}b=b.sibling}if(!m)throw Error(i(189))}}if(a.alternate!==r)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=B&&e[B]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function xe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case R:return"Profiler";case D:return"StrictMode";case G:return"Suspense";case K:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case Q:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return t=e.displayName||null,t!==null?t:xe(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return xe(e(t))}catch{}}return null}var fe=Array.isArray,O=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ae=[],ge=-1;function N(e){return{current:e}}function q(e){0>ge||(e.current=ae[ge],ae[ge]=null,ge--)}function X(e,t){ge++,ae[ge]=e.current,e.current=t}var le=N(null),pe=N(null),de=N(null),be=N(null);function Ve(e,t){switch(X(de,t),X(pe,e),X(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Nv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Nv(t),e=Mv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}q(le),X(le,e)}function Oe(){q(le),q(pe),q(de)}function wt(e){e.memoizedState!==null&&X(be,e);var t=le.current,a=Mv(t,e.type);t!==a&&(X(pe,e),X(le,a))}function ht(e){pe.current===e&&(q(le),q(pe)),be.current===e&&(q(be),rs._currentValue=re)}var yn,et;function Be(e){if(yn===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);yn=t&&t[1]||"",et=-1<a.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+yn+e+et}var nn=!1;function an(e,t){if(!e||nn)return"";nn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(P){var L=P}Reflect.construct(e,[],F)}else{try{F.call()}catch(P){L=P}e.call(F.prototype)}}else{try{throw Error()}catch(P){L=P}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(P){if(P&&L&&typeof P.stack=="string")return[P.stack,L.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=r.DetermineComponentFrameRoot(),m=d[0],b=d[1];if(m&&b){var w=m.split(`
|
|
44
|
+
`),_=b.split(`
|
|
45
|
+
`);for(c=r=0;r<w.length&&!w[r].includes("DetermineComponentFrameRoot");)r++;for(;c<_.length&&!_[c].includes("DetermineComponentFrameRoot");)c++;if(r===w.length||c===_.length)for(r=w.length-1,c=_.length-1;1<=r&&0<=c&&w[r]!==_[c];)c--;for(;1<=r&&0<=c;r--,c--)if(w[r]!==_[c]){if(r!==1||c!==1)do if(r--,c--,0>c||w[r]!==_[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{nn=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Be(a):""}function Sn(e,t){switch(e.tag){case 26:case 27:case 5:return Be(e.type);case 16:return Be("Lazy");case 13:return e.child!==t&&t!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return an(e.type,!1);case 11:return an(e.type.render,!1);case 1:return an(e.type,!0);case 31:return Be("Activity");default:return""}}function ln(e){try{var t="",a=null;do t+=Sn(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
47
|
+
Error generating stack: `+r.message+`
|
|
48
|
+
`+r.stack}}var Fe=Object.prototype.hasOwnProperty,Dt=n.unstable_scheduleCallback,rn=n.unstable_cancelCallback,Xn=n.unstable_shouldYield,sn=n.unstable_requestPaint,ct=n.unstable_now,Xa=n.unstable_getCurrentPriorityLevel,da=n.unstable_ImmediatePriority,Fn=n.unstable_UserBlockingPriority,qn=n.unstable_NormalPriority,Zn=n.unstable_LowPriority,fa=n.unstable_IdlePriority,Ul=n.log,Pn=n.unstable_setDisableYieldValue,Ut=null,pt=null;function $t(e){if(typeof Ul=="function"&&Pn(e),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(Ut,e)}catch{}}var vt=Math.clz32?Math.clz32:jn,ma=Math.log,De=Math.LN2;function jn(e){return e>>>=0,e===0?32:31-(ma(e)/De|0)|0}var ha=256,pa=262144,va=4194304;function Nn(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 Lt(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var c=0,d=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var b=r&134217727;return b!==0?(r=b&~d,r!==0?c=Nn(r):(m&=b,m!==0?c=Nn(m):a||(a=b&~e,a!==0&&(c=Nn(a))))):(b=r&~d,b!==0?c=Nn(b):m!==0?c=Nn(m):a||(a=r&~e,a!==0&&(c=Nn(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 Jn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function gr(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 Ll(){var e=va;return va<<=1,(va&62914560)===0&&(va=4194304),e}function Fa(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 Ze(e,t,a,r,c,d){var m=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,w=e.expirationTimes,_=e.hiddenUpdates;for(a=m&~a;0<a;){var Y=31-vt(a),F=1<<Y;b[Y]=0,w[Y]=-1;var L=_[Y];if(L!==null)for(_[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}a&=~F}r!==0&&Je(e,r,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(m&~t))}function Je(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-vt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function In(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-vt(a),c=1<<r;c&t|e[r]&t&&(e[r]|=t),a&=~c}}function Bl(e,t){var a=t&-t;return a=(a&42)!==0?1:Za(a),(a&(e.suspendedLanes|t))!==0?0:a}function Za(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 Mn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ja(){var e=ee.p;return e!==0?e:(e=window.event,e===void 0?32:Vv(e.type))}function Ia(e,t){var a=ee.p;try{return ee.p=e,t()}finally{ee.p=a}}var ut=Math.random().toString(36).slice(2),Pe="__reactFiber$"+ut,at="__reactProps$"+ut,xa="__reactContainer$"+ut,br="__reactEvents$"+ut,qs="__reactListeners$"+ut,Ps="__reactHandles$"+ut,yi="__reactResources$"+ut,Wa="__reactMarker$"+ut;function yr(e){delete e[Pe],delete e[at],delete e[br],delete e[qs],delete e[Ps]}function ga(e){var t=e[Pe];if(t)return t;for(var a=e.parentNode;a;){if(t=a[xa]||a[Pe]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Rv(e);e!==null;){if(a=e[Pe])return a;e=Rv(e)}return t}e=a,a=e.parentNode}return null}function ba(e){if(e=e[Pe]||e[xa]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function el(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ya(e){var t=e[yi];return t||(t=e[yi]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function dt(e){e[Wa]=!0}var Si=new Set,J={};function W(e,t){Ce(e,t),Ce(e+"Capture",t)}function Ce(e,t){for(J[e]=t,e=0;e<t.length;e++)Si.add(t[e])}var At=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]*$"),ql={},Rc={};function $s(e){return Fe.call(Rc,e)?!0:Fe.call(ql,e)?!1:At.test(e)?Rc[e]=!0:(ql[e]=!0,!1)}function wn(e,t,a){if($s(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 Qs(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 Sa(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 Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Lb(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 zc(e){if(!e._valueTracker){var t=pm(e)?"checked":"value";e._valueTracker=Lb(e,t,""+e[t])}}function vm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=pm(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function Hs(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 Bb=/[\n"\\]/g;function Tn(e){return e.replace(Bb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function _c(e,t,a,r,c,d,m,b){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cn(t)):e.value!==""+Cn(t)&&(e.value=""+Cn(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?Oc(e,m,Cn(t)):a!=null?Oc(e,m,Cn(a)):r!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Cn(b):e.removeAttribute("name")}function xm(e,t,a,r,c,d,m,b){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){zc(e);return}a=a!=null?""+Cn(a):"",t=t!=null?""+Cn(t):a,b||t===e.value||(e.value=t),e.defaultValue=t}r=r??c,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=b?e.checked:!!r,e.defaultChecked=!!r,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),zc(e)}function Oc(e,t,a){t==="number"&&Hs(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Sr(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=""+Cn(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 gm(e,t,a){if(t!=null&&(t=""+Cn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Cn(a):""}function bm(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(i(92));if(fe(r)){if(1<r.length)throw Error(i(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=Cn(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),zc(e)}function jr(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var qb=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 ym(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||qb.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(i(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&&ym(e,c,r)}else for(var d in t)t.hasOwnProperty(d)&&ym(e,d,t[d])}function Dc(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 Pb=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"]]),$b=/^[\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 Ks(e){return $b.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ja(){}var Uc=null;function Lc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Nr=null,Mr=null;function jm(e){var t=ba(e);if(t&&(e=t.stateNode)){var a=e[at]||null;e:switch(e=t.stateNode,t.type){case"input":if(_c(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="'+Tn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var c=r[at]||null;if(!c)throw Error(i(90));_c(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&&vm(r)}break e;case"textarea":gm(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Sr(e,!!a.multiple,t,!1)}}}var Bc=!1;function Nm(e,t,a){if(Bc)return e(t,a);Bc=!0;try{var r=e(t);return r}finally{if(Bc=!1,(Nr!==null||Mr!==null)&&(zo(),Nr&&(t=Nr,e=Mr,Mr=Nr=null,jm(t),e)))for(t=0;t<e.length;t++)jm(e[t])}}function ji(e,t){var a=e.stateNode;if(a===null)return null;var r=a[at]||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(i(231,t,typeof a));return a}var Na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qc=!1;if(Na)try{var Ni={};Object.defineProperty(Ni,"passive",{get:function(){qc=!0}}),window.addEventListener("test",Ni,Ni),window.removeEventListener("test",Ni,Ni)}catch{qc=!1}var tl=null,Pc=null,Ys=null;function Mm(){if(Ys)return Ys;var e,t=Pc,a=t.length,r,c="value"in tl?tl.value:tl.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 Ys=c.slice(e,1<r?1-r:void 0)}function Gs(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 Vs(){return!0}function wm(){return!1}function Gt(e){function t(a,r,c,d,m){this._reactName=a,this._targetInst=c,this.type=r,this.nativeEvent=d,this.target=m,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(a=e[b],this[b]=a?a(d):d[b]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Vs:wm,this.isPropagationStopped=wm,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Vs)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),t}var Pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xs=Gt(Pl),Mi=g({},Pl,{view:0,detail:0}),Qb=Gt(Mi),$c,Qc,wi,Fs=g({},Mi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kc,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!==wi&&(wi&&e.type==="mousemove"?($c=e.screenX-wi.screenX,Qc=e.screenY-wi.screenY):Qc=$c=0,wi=e),$c)},movementY:function(e){return"movementY"in e?e.movementY:Qc}}),Cm=Gt(Fs),Hb=g({},Fs,{dataTransfer:0}),Kb=Gt(Hb),Yb=g({},Mi,{relatedTarget:0}),Hc=Gt(Yb),Gb=g({},Pl,{animationName:0,elapsedTime:0,pseudoElement:0}),Vb=Gt(Gb),Xb=g({},Pl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Fb=Gt(Xb),Zb=g({},Pl,{data:0}),Tm=Gt(Zb),Jb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ib={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"},Wb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ey(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Wb[e])?!!t[e]:!1}function Kc(){return ey}var ty=g({},Mi,{key:function(e){if(e.key){var t=Jb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Gs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ib[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kc,charCode:function(e){return e.type==="keypress"?Gs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Gs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ny=Gt(ty),ay=g({},Fs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Am=Gt(ay),ly=g({},Mi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kc}),ry=Gt(ly),iy=g({},Pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),sy=Gt(iy),oy=g({},Fs,{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}),cy=Gt(oy),uy=g({},Pl,{newState:0,oldState:0}),dy=Gt(uy),fy=[9,13,27,32],Yc=Na&&"CompositionEvent"in window,Ci=null;Na&&"documentMode"in document&&(Ci=document.documentMode);var my=Na&&"TextEvent"in window&&!Ci,Em=Na&&(!Yc||Ci&&8<Ci&&11>=Ci),km=" ",Rm=!1;function zm(e,t){switch(e){case"keyup":return fy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _m(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wr=!1;function hy(e,t){switch(e){case"compositionend":return _m(t);case"keypress":return t.which!==32?null:(Rm=!0,km);case"textInput":return e=t.data,e===km&&Rm?null:e;default:return null}}function py(e,t){if(wr)return e==="compositionend"||!Yc&&zm(e,t)?(e=Mm(),Ys=Pc=tl=null,wr=!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 Em&&t.locale!=="ko"?null:t.data;default:return null}}var vy={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 Om(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vy[e.type]:t==="textarea"}function Dm(e,t,a,r){Nr?Mr?Mr.push(r):Mr=[r]:Nr=r,t=qo(t,"onChange"),0<t.length&&(a=new Xs("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var Ti=null,Ai=null;function xy(e){xv(e,0)}function Zs(e){var t=el(e);if(vm(t))return e}function Um(e,t){if(e==="change")return t}var Lm=!1;if(Na){var Gc;if(Na){var Vc="oninput"in document;if(!Vc){var Bm=document.createElement("div");Bm.setAttribute("oninput","return;"),Vc=typeof Bm.oninput=="function"}Gc=Vc}else Gc=!1;Lm=Gc&&(!document.documentMode||9<document.documentMode)}function qm(){Ti&&(Ti.detachEvent("onpropertychange",Pm),Ai=Ti=null)}function Pm(e){if(e.propertyName==="value"&&Zs(Ai)){var t=[];Dm(t,Ai,e,Lc(e)),Nm(xy,t)}}function gy(e,t,a){e==="focusin"?(qm(),Ti=t,Ai=a,Ti.attachEvent("onpropertychange",Pm)):e==="focusout"&&qm()}function by(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zs(Ai)}function yy(e,t){if(e==="click")return Zs(t)}function Sy(e,t){if(e==="input"||e==="change")return Zs(t)}function jy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var on=typeof Object.is=="function"?Object.is:jy;function Ei(e,t){if(on(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(!Fe.call(t,c)||!on(e[c],t[c]))return!1}return!0}function $m(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qm(e,t){var a=$m(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=$m(a)}}function Hm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hm(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=Hs(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=Hs(e.document)}return t}function Xc(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 Ny=Na&&"documentMode"in document&&11>=document.documentMode,Cr=null,Fc=null,ki=null,Zc=!1;function Ym(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Zc||Cr==null||Cr!==Hs(r)||(r=Cr,"selectionStart"in r&&Xc(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}),ki&&Ei(ki,r)||(ki=r,r=qo(Fc,"onSelect"),0<r.length&&(t=new Xs("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=Cr)))}function $l(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Tr={animationend:$l("Animation","AnimationEnd"),animationiteration:$l("Animation","AnimationIteration"),animationstart:$l("Animation","AnimationStart"),transitionrun:$l("Transition","TransitionRun"),transitionstart:$l("Transition","TransitionStart"),transitioncancel:$l("Transition","TransitionCancel"),transitionend:$l("Transition","TransitionEnd")},Jc={},Gm={};Na&&(Gm=document.createElement("div").style,"AnimationEvent"in window||(delete Tr.animationend.animation,delete Tr.animationiteration.animation,delete Tr.animationstart.animation),"TransitionEvent"in window||delete Tr.transitionend.transition);function Ql(e){if(Jc[e])return Jc[e];if(!Tr[e])return e;var t=Tr[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Gm)return Jc[e]=t[a];return e}var Vm=Ql("animationend"),Xm=Ql("animationiteration"),Fm=Ql("animationstart"),My=Ql("transitionrun"),wy=Ql("transitionstart"),Cy=Ql("transitioncancel"),Zm=Ql("transitionend"),Jm=new Map,Ic="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(" ");Ic.push("scrollEnd");function $n(e,t){Jm.set(e,t),W(t,[e])}var Js=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)},An=[],Ar=0,Wc=0;function Is(){for(var e=Ar,t=Wc=Ar=0;t<e;){var a=An[t];An[t++]=null;var r=An[t];An[t++]=null;var c=An[t];An[t++]=null;var d=An[t];if(An[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&&Im(a,c,d)}}function Ws(e,t,a,r){An[Ar++]=e,An[Ar++]=t,An[Ar++]=a,An[Ar++]=r,Wc|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function eu(e,t,a,r){return Ws(e,t,a,r),eo(e)}function Hl(e,t){return Ws(e,null,null,t),eo(e)}function Im(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-vt(a),e=d.hiddenUpdates,r=e[c],r===null?e[c]=[t]:r.push(t),t.lane=a|536870912),d):null}function eo(e){if(50<Ii)throw Ii=0,cd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Er={};function Ty(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 cn(e,t,a,r){return new Ty(e,t,a,r)}function tu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ma(e,t){var a=e.alternate;return a===null?(a=cn(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 Wm(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 to(e,t,a,r,c,d){var m=0;if(r=e,typeof e=="function")tu(e)&&(m=1);else if(typeof e=="string")m=z0(e,a,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Z:return e=cn(31,a,t,c),e.elementType=Z,e.lanes=d,e;case E:return Kl(a.children,c,d,t);case D:m=8,c|=24;break;case R:return e=cn(12,a,t,c|2),e.elementType=R,e.lanes=d,e;case G:return e=cn(13,a,t,c),e.elementType=G,e.lanes=d,e;case K:return e=cn(19,a,t,c),e.elementType=K,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Q:m=10;break e;case U:m=9;break e;case H:m=11;break e;case $:m=14;break e;case I:m=16,r=null;break e}m=29,a=Error(i(130,e===null?"null":typeof e,"")),r=null}return t=cn(m,a,t,c),t.elementType=e,t.type=r,t.lanes=d,t}function Kl(e,t,a,r){return e=cn(7,e,r,t),e.lanes=a,e}function nu(e,t,a){return e=cn(6,e,null,t),e.lanes=a,e}function eh(e){var t=cn(18,null,null,0);return t.stateNode=e,t}function au(e,t,a){return t=cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var th=new WeakMap;function En(e,t){if(typeof e=="object"&&e!==null){var a=th.get(e);return a!==void 0?a:(t={value:e,source:t,stack:ln(t)},th.set(e,t),t)}return{value:e,source:t,stack:ln(t)}}var kr=[],Rr=0,no=null,Ri=0,kn=[],Rn=0,nl=null,Wn=1,ea="";function wa(e,t){kr[Rr++]=Ri,kr[Rr++]=no,no=e,Ri=t}function nh(e,t,a){kn[Rn++]=Wn,kn[Rn++]=ea,kn[Rn++]=nl,nl=e;var r=Wn;e=ea;var c=32-vt(r)-1;r&=~(1<<c),a+=1;var d=32-vt(t)+c;if(30<d){var m=c-c%5;d=(r&(1<<m)-1).toString(32),r>>=m,c-=m,Wn=1<<32-vt(t)+c|a<<c|r,ea=d+e}else Wn=1<<d|a<<c|r,ea=e}function lu(e){e.return!==null&&(wa(e,1),nh(e,1,0))}function ru(e){for(;e===no;)no=kr[--Rr],kr[Rr]=null,Ri=kr[--Rr],kr[Rr]=null;for(;e===nl;)nl=kn[--Rn],kn[Rn]=null,ea=kn[--Rn],kn[Rn]=null,Wn=kn[--Rn],kn[Rn]=null}function ah(e,t){kn[Rn++]=Wn,kn[Rn++]=ea,kn[Rn++]=nl,Wn=t.id,ea=t.overflow,nl=e}var Et=null,Ie=null,Re=!1,al=null,zn=!1,iu=Error(i(519));function ll(e){var t=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zi(En(t,e)),iu}function lh(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Pe]=e,t[at]=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<es.length;a++)Ae(es[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),xm(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),bm(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=ja),t=!0):t=!1,t||ll(e,!0)}function rh(e){for(Et=e.return;Et;)switch(Et.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Et=Et.return}}function zr(e){if(e!==Et)return!1;if(!Re)return rh(e),Re=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Md(e.type,e.memoizedProps)),a=!a),a&&Ie&&ll(e),rh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ie=kv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ie=kv(e)}else t===27?(t=Ie,gl(e.type)?(e=Ed,Ed=null,Ie=e):Ie=t):Ie=Et?On(e.stateNode.nextSibling):null;return!0}function Yl(){Ie=Et=null,Re=!1}function su(){var e=al;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),al=null),e}function zi(e){al===null?al=[e]:al.push(e)}var ou=N(null),Gl=null,Ca=null;function rl(e,t,a){X(ou,t._currentValue),t._currentValue=a}function Ta(e){e._currentValue=ou.current,q(ou)}function cu(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 uu(e,t,a,r){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var m=c.child;d=d.firstContext;e:for(;d!==null;){var b=d;d=c;for(var w=0;w<t.length;w++)if(b.context===t[w]){d.lanes|=a,b=d.alternate,b!==null&&(b.lanes|=a),cu(d.return,a,e),r||(m=null);break e}d=b.next}}else if(c.tag===18){if(m=c.return,m===null)throw Error(i(341));m.lanes|=a,d=m.alternate,d!==null&&(d.lanes|=a),cu(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 _r(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(i(387));if(m=m.memoizedProps,m!==null){var b=c.type;on(c.pendingProps.value,m.value)||(e!==null?e.push(b):e=[b])}}else if(c===be.current){if(m=c.alternate,m===null)throw Error(i(387));m.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(rs):e=[rs])}c=c.return}e!==null&&uu(t,e,a,r),t.flags|=262144}function ao(e){for(e=e.firstContext;e!==null;){if(!on(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Vl(e){Gl=e,Ca=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return ih(Gl,e)}function lo(e,t){return Gl===null&&Vl(e),ih(e,t)}function ih(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Ca===null){if(e===null)throw Error(i(308));Ca=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ca=Ca.next=t;return a}var Ay=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()})}},Ey=n.unstable_scheduleCallback,ky=n.unstable_NormalPriority,xt={$$typeof:Q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function du(){return{controller:new Ay,data:new Map,refCount:0}}function _i(e){e.refCount--,e.refCount===0&&Ey(ky,function(){e.controller.abort()})}var Oi=null,fu=0,Or=0,Dr=null;function Ry(e,t){if(Oi===null){var a=Oi=[];fu=0,Or=pd(),Dr={status:"pending",value:void 0,then:function(r){a.push(r)}}}return fu++,t.then(sh,sh),t}function sh(){if(--fu===0&&Oi!==null){Dr!==null&&(Dr.status="fulfilled");var e=Oi;Oi=null,Or=0,Dr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function zy(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 oh=O.S;O.S=function(e,t){Yp=ct(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ry(e,t),oh!==null&&oh(e,t)};var Xl=N(null);function mu(){var e=Xl.current;return e!==null?e:Xe.pooledCache}function ro(e,t){t===null?X(Xl,Xl.current):X(Xl,t.pool)}function ch(){var e=mu();return e===null?null:{parent:xt._currentValue,pool:e}}var Ur=Error(i(460)),hu=Error(i(474)),io=Error(i(542)),so={then:function(){}};function uh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function dh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(ja,ja),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,mh(e),e;default:if(typeof t.status=="string")t.then(ja,ja);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(i(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,mh(e),e}throw Zl=t,Ur}}function Fl(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Zl=a,Ur):a}}var Zl=null;function fh(){if(Zl===null)throw Error(i(459));var e=Zl;return Zl=null,e}function mh(e){if(e===Ur||e===io)throw Error(i(483))}var Lr=null,Di=0;function oo(e){var t=Di;return Di+=1,Lr===null&&(Lr=[]),dh(Lr,e,t)}function Ui(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function co(e,t){throw t.$$typeof===j?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function hh(e){function t(k,A){if(e){var z=k.deletions;z===null?(k.deletions=[A],k.flags|=16):z.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=Ma(k,A),k.index=0,k.sibling=null,k}function d(k,A,z){return k.index=z,e?(z=k.alternate,z!==null?(z=z.index,z<A?(k.flags|=67108866,A):z):(k.flags|=67108866,A)):(k.flags|=1048576,A)}function m(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function b(k,A,z,V){return A===null||A.tag!==6?(A=nu(z,k.mode,V),A.return=k,A):(A=c(A,z),A.return=k,A)}function w(k,A,z,V){var he=z.type;return he===E?Y(k,A,z.props.children,V,z.key):A!==null&&(A.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===I&&Fl(he)===A.type)?(A=c(A,z.props),Ui(A,z),A.return=k,A):(A=to(z.type,z.key,z.props,null,k.mode,V),Ui(A,z),A.return=k,A)}function _(k,A,z,V){return A===null||A.tag!==4||A.stateNode.containerInfo!==z.containerInfo||A.stateNode.implementation!==z.implementation?(A=au(z,k.mode,V),A.return=k,A):(A=c(A,z.children||[]),A.return=k,A)}function Y(k,A,z,V,he){return A===null||A.tag!==7?(A=Kl(z,k.mode,V,he),A.return=k,A):(A=c(A,z),A.return=k,A)}function F(k,A,z){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=nu(""+A,k.mode,z),A.return=k,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case M:return z=to(A.type,A.key,A.props,null,k.mode,z),Ui(z,A),z.return=k,z;case T:return A=au(A,k.mode,z),A.return=k,A;case I:return A=Fl(A),F(k,A,z)}if(fe(A)||ie(A))return A=Kl(A,k.mode,z,null),A.return=k,A;if(typeof A.then=="function")return F(k,oo(A),z);if(A.$$typeof===Q)return F(k,lo(k,A),z);co(k,A)}return null}function L(k,A,z,V){var he=A!==null?A.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return he!==null?null:b(k,A,""+z,V);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case M:return z.key===he?w(k,A,z,V):null;case T:return z.key===he?_(k,A,z,V):null;case I:return z=Fl(z),L(k,A,z,V)}if(fe(z)||ie(z))return he!==null?null:Y(k,A,z,V,null);if(typeof z.then=="function")return L(k,A,oo(z),V);if(z.$$typeof===Q)return L(k,A,lo(k,z),V);co(k,z)}return null}function P(k,A,z,V,he){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return k=k.get(z)||null,b(A,k,""+V,he);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case M:return k=k.get(V.key===null?z:V.key)||null,w(A,k,V,he);case T:return k=k.get(V.key===null?z:V.key)||null,_(A,k,V,he);case I:return V=Fl(V),P(k,A,z,V,he)}if(fe(V)||ie(V))return k=k.get(z)||null,Y(A,k,V,he,null);if(typeof V.then=="function")return P(k,A,z,oo(V),he);if(V.$$typeof===Q)return P(k,A,z,lo(A,V),he);co(A,V)}return null}function oe(k,A,z,V){for(var he=null,Ue=null,ce=A,Me=A=0,ke=null;ce!==null&&Me<z.length;Me++){ce.index>Me?(ke=ce,ce=null):ke=ce.sibling;var Le=L(k,ce,z[Me],V);if(Le===null){ce===null&&(ce=ke);break}e&&ce&&Le.alternate===null&&t(k,ce),A=d(Le,A,Me),Ue===null?he=Le:Ue.sibling=Le,Ue=Le,ce=ke}if(Me===z.length)return a(k,ce),Re&&wa(k,Me),he;if(ce===null){for(;Me<z.length;Me++)ce=F(k,z[Me],V),ce!==null&&(A=d(ce,A,Me),Ue===null?he=ce:Ue.sibling=ce,Ue=ce);return Re&&wa(k,Me),he}for(ce=r(ce);Me<z.length;Me++)ke=P(ce,k,Me,z[Me],V),ke!==null&&(e&&ke.alternate!==null&&ce.delete(ke.key===null?Me:ke.key),A=d(ke,A,Me),Ue===null?he=ke:Ue.sibling=ke,Ue=ke);return e&&ce.forEach(function(Nl){return t(k,Nl)}),Re&&wa(k,Me),he}function ve(k,A,z,V){if(z==null)throw Error(i(151));for(var he=null,Ue=null,ce=A,Me=A=0,ke=null,Le=z.next();ce!==null&&!Le.done;Me++,Le=z.next()){ce.index>Me?(ke=ce,ce=null):ke=ce.sibling;var Nl=L(k,ce,Le.value,V);if(Nl===null){ce===null&&(ce=ke);break}e&&ce&&Nl.alternate===null&&t(k,ce),A=d(Nl,A,Me),Ue===null?he=Nl:Ue.sibling=Nl,Ue=Nl,ce=ke}if(Le.done)return a(k,ce),Re&&wa(k,Me),he;if(ce===null){for(;!Le.done;Me++,Le=z.next())Le=F(k,Le.value,V),Le!==null&&(A=d(Le,A,Me),Ue===null?he=Le:Ue.sibling=Le,Ue=Le);return Re&&wa(k,Me),he}for(ce=r(ce);!Le.done;Me++,Le=z.next())Le=P(ce,k,Me,Le.value,V),Le!==null&&(e&&Le.alternate!==null&&ce.delete(Le.key===null?Me:Le.key),A=d(Le,A,Me),Ue===null?he=Le:Ue.sibling=Le,Ue=Le);return e&&ce.forEach(function(H0){return t(k,H0)}),Re&&wa(k,Me),he}function Ge(k,A,z,V){if(typeof z=="object"&&z!==null&&z.type===E&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case M:e:{for(var he=z.key;A!==null;){if(A.key===he){if(he=z.type,he===E){if(A.tag===7){a(k,A.sibling),V=c(A,z.props.children),V.return=k,k=V;break e}}else if(A.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===I&&Fl(he)===A.type){a(k,A.sibling),V=c(A,z.props),Ui(V,z),V.return=k,k=V;break e}a(k,A);break}else t(k,A);A=A.sibling}z.type===E?(V=Kl(z.props.children,k.mode,V,z.key),V.return=k,k=V):(V=to(z.type,z.key,z.props,null,k.mode,V),Ui(V,z),V.return=k,k=V)}return m(k);case T:e:{for(he=z.key;A!==null;){if(A.key===he)if(A.tag===4&&A.stateNode.containerInfo===z.containerInfo&&A.stateNode.implementation===z.implementation){a(k,A.sibling),V=c(A,z.children||[]),V.return=k,k=V;break e}else{a(k,A);break}else t(k,A);A=A.sibling}V=au(z,k.mode,V),V.return=k,k=V}return m(k);case I:return z=Fl(z),Ge(k,A,z,V)}if(fe(z))return oe(k,A,z,V);if(ie(z)){if(he=ie(z),typeof he!="function")throw Error(i(150));return z=he.call(z),ve(k,A,z,V)}if(typeof z.then=="function")return Ge(k,A,oo(z),V);if(z.$$typeof===Q)return Ge(k,A,lo(k,z),V);co(k,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,A!==null&&A.tag===6?(a(k,A.sibling),V=c(A,z),V.return=k,k=V):(a(k,A),V=nu(z,k.mode,V),V.return=k,k=V),m(k)):a(k,A)}return function(k,A,z,V){try{Di=0;var he=Ge(k,A,z,V);return Lr=null,he}catch(ce){if(ce===Ur||ce===io)throw ce;var Ue=cn(29,ce,null,k.mode);return Ue.lanes=V,Ue.return=k,Ue}finally{}}}var Jl=hh(!0),ph=hh(!1),il=!1;function pu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vu(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 sl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ol(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=eo(e),Im(e,null,a),t}return Ws(e,r,t,a),eo(e)}function Li(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,In(e,a)}}function xu(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 gu=!1;function Bi(){if(gu){var e=Dr;if(e!==null)throw e}}function qi(e,t,a,r){gu=!1;var c=e.updateQueue;il=!1;var d=c.firstBaseUpdate,m=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var w=b,_=w.next;w.next=null,m===null?d=_:m.next=_,m=w;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==m&&(b===null?Y.firstBaseUpdate=_:b.next=_,Y.lastBaseUpdate=w))}if(d!==null){var F=c.baseState;m=0,Y=_=w=null,b=d;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Ee&L)===L:(r&L)===L){L!==0&&L===Or&&(gu=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var oe=e,ve=b;L=t;var Ge=a;switch(ve.tag){case 1:if(oe=ve.payload,typeof oe=="function"){F=oe.call(Ge,F,L);break e}F=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=ve.payload,L=typeof oe=="function"?oe.call(Ge,F,L):oe,L==null)break e;F=g({},F,L);break e;case 2:il=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(_=Y=P,w=F):Y=Y.next=P,m|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(w=F),c.baseState=w,c.firstBaseUpdate=_,c.lastBaseUpdate=Y,d===null&&(c.shared.lanes=0),ml|=m,e.lanes=m,e.memoizedState=F}}function vh(e,t){if(typeof e!="function")throw Error(i(191,e));e.call(t)}function xh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)vh(a[e],t)}var Br=N(null),uo=N(0);function gh(e,t){e=Ua,X(uo,e),X(Br,t),Ua=e|t.baseLanes}function bu(){X(uo,Ua),X(Br,Br.current)}function yu(){Ua=uo.current,q(Br),q(uo)}var un=N(null),_n=null;function cl(e){var t=e.alternate;X(ft,ft.current&1),X(un,e),_n===null&&(t===null||Br.current!==null||t.memoizedState!==null)&&(_n=e)}function Su(e){X(ft,ft.current),X(un,e),_n===null&&(_n=e)}function bh(e){e.tag===22?(X(ft,ft.current),X(un,e),_n===null&&(_n=e)):ul()}function ul(){X(ft,ft.current),X(un,un.current)}function dn(e){q(un),_n===e&&(_n=null),q(ft)}var ft=N(0);function fo(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Td(a)||Ad(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 Aa=0,Ne=null,Ke=null,gt=null,mo=!1,qr=!1,Il=!1,ho=0,Pi=0,Pr=null,_y=0;function rt(){throw Error(i(321))}function ju(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!on(e[a],t[a]))return!1;return!0}function Nu(e,t,a,r,c,d){return Aa=d,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,O.H=e===null||e.memoizedState===null?np:Bu,Il=!1,d=a(r,c),Il=!1,qr&&(d=Sh(t,a,r,c)),yh(e),d}function yh(e){O.H=Hi;var t=Ke!==null&&Ke.next!==null;if(Aa=0,gt=Ke=Ne=null,mo=!1,Pi=0,Pr=null,t)throw Error(i(300));e===null||bt||(e=e.dependencies,e!==null&&ao(e)&&(bt=!0))}function Sh(e,t,a,r){Ne=e;var c=0;do{if(qr&&(Pr=null),Pi=0,qr=!1,25<=c)throw Error(i(301));if(c+=1,gt=Ke=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}O.H=ap,d=t(a,r)}while(qr);return d}function Oy(){var e=O.H,t=e.useState()[0];return t=typeof t.then=="function"?$i(t):t,e=e.useState()[0],(Ke!==null?Ke.memoizedState:null)!==e&&(Ne.flags|=1024),t}function Mu(){var e=ho!==0;return ho=0,e}function wu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Cu(e){if(mo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}mo=!1}Aa=0,gt=Ke=Ne=null,qr=!1,Pi=ho=0,Pr=null}function Qt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Ne.memoizedState=gt=e:gt=gt.next=e,gt}function mt(){if(Ke===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var t=gt===null?Ne.memoizedState:gt.next;if(t!==null)gt=t,Ke=e;else{if(e===null)throw Ne.alternate===null?Error(i(467)):Error(i(310));Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},gt===null?Ne.memoizedState=gt=e:gt=gt.next=e}return gt}function po(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $i(e){var t=Pi;return Pi+=1,Pr===null&&(Pr=[]),e=dh(Pr,e,t),t=Ne,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,O.H=t===null||t.memoizedState===null?np:Bu),e}function vo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $i(e);if(e.$$typeof===Q)return kt(e)}throw Error(i(438,String(e)))}function Tu(e){var t=null,a=Ne.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=Ne.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=po(),Ne.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]=ne;return t.index++,a}function Ea(e,t){return typeof t=="function"?t(e):t}function xo(e){var t=mt();return Au(t,Ke,e)}function Au(e,t,a){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=a;var c=e.baseQueue,d=r.pending;if(d!==null){if(c!==null){var m=c.next;c.next=d.next,d.next=m}t.baseQueue=c=d,r.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var b=m=null,w=null,_=t,Y=!1;do{var F=_.lane&-536870913;if(F!==_.lane?(Ee&F)===F:(Aa&F)===F){var L=_.revertLane;if(L===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),F===Or&&(Y=!0);else if((Aa&L)===L){_=_.next,L===Or&&(Y=!0);continue}else F={lane:0,revertLane:_.revertLane,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},w===null?(b=w=F,m=d):w=w.next=F,Ne.lanes|=L,ml|=L;F=_.action,Il&&a(d,F),d=_.hasEagerState?_.eagerState:a(d,F)}else L={lane:F,revertLane:_.revertLane,gesture:_.gesture,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},w===null?(b=w=L,m=d):w=w.next=L,Ne.lanes|=F,ml|=F;_=_.next}while(_!==null&&_!==t);if(w===null?m=d:w.next=b,!on(d,e.memoizedState)&&(bt=!0,Y&&(a=Dr,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 Eu(e){var t=mt(),a=t.queue;if(a===null)throw Error(i(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);on(d,t.memoizedState)||(bt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),a.lastRenderedState=d}return[d,r]}function jh(e,t,a){var r=Ne,c=mt(),d=Re;if(d){if(a===void 0)throw Error(i(407));a=a()}else a=t();var m=!on((Ke||c).memoizedState,a);if(m&&(c.memoizedState=a,bt=!0),c=c.queue,zu(wh.bind(null,r,c,e),[e]),c.getSnapshot!==t||m||gt!==null&>.memoizedState.tag&1){if(r.flags|=2048,$r(9,{destroy:void 0},Mh.bind(null,r,c,a,t),null),Xe===null)throw Error(i(349));d||(Aa&127)!==0||Nh(r,t,a)}return a}function Nh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Ne.updateQueue,t===null?(t=po(),Ne.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Mh(e,t,a,r){t.value=a,t.getSnapshot=r,Ch(t)&&Th(e)}function wh(e,t,a){return a(function(){Ch(t)&&Th(e)})}function Ch(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!on(e,a)}catch{return!0}}function Th(e){var t=Hl(e,2);t!==null&&Jt(t,e,2)}function ku(e){var t=Qt();if(typeof e=="function"){var a=e;if(e=a(),Il){$t(!0);try{a()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:e},t}function Ah(e,t,a,r){return e.baseState=a,Au(e,Ke,typeof r=="function"?r:Ea)}function Dy(e,t,a,r,c){if(yo(e))throw Error(i(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)}};O.T!==null?a(!0):d.isTransition=!1,r(d),a=t.pending,a===null?(d.next=t.pending=d,Eh(t,d)):(d.next=a.next,t.pending=a.next=d)}}function Eh(e,t){var a=t.action,r=t.payload,c=e.state;if(t.isTransition){var d=O.T,m={};O.T=m;try{var b=a(c,r),w=O.S;w!==null&&w(m,b),kh(e,t,b)}catch(_){Ru(e,t,_)}finally{d!==null&&m.types!==null&&(d.types=m.types),O.T=d}}else try{d=a(c,r),kh(e,t,d)}catch(_){Ru(e,t,_)}}function kh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){Rh(e,t,r)},function(r){return Ru(e,t,r)}):Rh(e,t,a)}function Rh(e,t,a){t.status="fulfilled",t.value=a,zh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Eh(e,a)))}function Ru(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,zh(t),t=t.next;while(t!==r)}e.action=null}function zh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function _h(e,t){return t}function Oh(e,t){if(Re){var a=Xe.formState;if(a!==null){e:{var r=Ne;if(Re){if(Ie){t:{for(var c=Ie,d=zn;c.nodeType!==8;){if(!d){c=null;break t}if(c=On(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Ie=On(c.nextSibling),r=c.data==="F!";break e}}ll(r)}r=!1}r&&(t=a[0])}}return a=Qt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_h,lastRenderedState:t},a.queue=r,a=Wh.bind(null,Ne,r),r.dispatch=a,r=ku(!1),d=Lu.bind(null,Ne,!1,r.queue),r=Qt(),c={state:t,dispatch:null,action:e,pending:null},r.queue=c,a=Dy.bind(null,Ne,c,d,a),c.dispatch=a,r.memoizedState=e,[t,a,!1]}function Dh(e){var t=mt();return Uh(t,Ke,e)}function Uh(e,t,a){if(t=Au(e,t,_h)[0],e=xo(Ea)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=$i(t)}catch(m){throw m===Ur?io:m}else r=t;t=mt();var c=t.queue,d=c.dispatch;return a!==t.memoizedState&&(Ne.flags|=2048,$r(9,{destroy:void 0},Uy.bind(null,c,a),null)),[r,d,e]}function Uy(e,t){e.action=t}function Lh(e){var t=mt(),a=Ke;if(a!==null)return Uh(t,a,e);mt(),t=t.memoizedState,a=mt();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function $r(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=po(),Ne.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function Bh(){return mt().memoizedState}function go(e,t,a,r){var c=Qt();Ne.flags|=e,c.memoizedState=$r(1|t,{destroy:void 0},a,r===void 0?null:r)}function bo(e,t,a,r){var c=mt();r=r===void 0?null:r;var d=c.memoizedState.inst;Ke!==null&&r!==null&&ju(r,Ke.memoizedState.deps)?c.memoizedState=$r(t,d,a,r):(Ne.flags|=e,c.memoizedState=$r(1|t,d,a,r))}function qh(e,t){go(8390656,8,e,t)}function zu(e,t){bo(2048,8,e,t)}function Ly(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=po(),Ne.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function Ph(e){var t=mt().memoizedState;return Ly({ref:t,nextImpl:e}),function(){if((qe&2)!==0)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function $h(e,t){return bo(4,2,e,t)}function Qh(e,t){return bo(4,4,e,t)}function Hh(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,bo(4,4,Hh.bind(null,t,e),a)}function _u(){}function Yh(e,t){var a=mt();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&ju(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Gh(e,t){var a=mt();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&ju(t,r[1]))return r[0];if(r=e(),Il){$t(!0);try{e()}finally{$t(!1)}}return a.memoizedState=[r,t],r}function Ou(e,t,a){return a===void 0||(Aa&1073741824)!==0&&(Ee&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Vp(),Ne.lanes|=e,ml|=e,a)}function Vh(e,t,a,r){return on(a,t)?a:Br.current!==null?(e=Ou(e,a,r),on(e,t)||(bt=!0),e):(Aa&42)===0||(Aa&1073741824)!==0&&(Ee&261930)===0?(bt=!0,e.memoizedState=a):(e=Vp(),Ne.lanes|=e,ml|=e,t)}function Xh(e,t,a,r,c){var d=ee.p;ee.p=d!==0&&8>d?d:8;var m=O.T,b={};O.T=b,Lu(e,!1,t,a);try{var w=c(),_=O.S;if(_!==null&&_(b,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var Y=zy(w,r);Qi(e,t,Y,hn(e))}else Qi(e,t,r,hn(e))}catch(F){Qi(e,t,{then:function(){},status:"rejected",reason:F},hn())}finally{ee.p=d,m!==null&&b.types!==null&&(m.types=b.types),O.T=m}}function By(){}function Du(e,t,a,r){if(e.tag!==5)throw Error(i(476));var c=Fh(e).queue;Xh(e,c,t,re,a===null?By:function(){return Zh(e),a(r)})}function Fh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:re},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Zh(e){var t=Fh(e);t.next===null&&(t=e.alternate.memoizedState),Qi(e,t.next.queue,{},hn())}function Uu(){return kt(rs)}function Jh(){return mt().memoizedState}function Ih(){return mt().memoizedState}function qy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=hn();e=sl(a);var r=ol(t,e,a);r!==null&&(Jt(r,t,a),Li(r,t,a)),t={cache:du()},e.payload=t;return}t=t.return}}function Py(e,t,a){var r=hn();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},yo(e)?ep(t,a):(a=eu(e,t,a,r),a!==null&&(Jt(a,e,r),tp(a,t,r)))}function Wh(e,t,a){var r=hn();Qi(e,t,a,r)}function Qi(e,t,a,r){var c={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(yo(e))ep(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var m=t.lastRenderedState,b=d(m,a);if(c.hasEagerState=!0,c.eagerState=b,on(b,m))return Ws(e,t,c,0),Xe===null&&Is(),!1}catch{}finally{}if(a=eu(e,t,c,r),a!==null)return Jt(a,e,r),tp(a,t,r),!0}return!1}function Lu(e,t,a,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},yo(e)){if(t)throw Error(i(479))}else t=eu(e,a,r,2),t!==null&&Jt(t,e,2)}function yo(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function ep(e,t){qr=mo=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function tp(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,In(e,a)}}var Hi={readContext:kt,use:vo,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};Hi.useEffectEvent=rt;var np={readContext:kt,use:vo,useCallback:function(e,t){return Qt().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:qh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,go(4194308,4,Hh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return go(4194308,4,e,t)},useInsertionEffect:function(e,t){go(4,2,e,t)},useMemo:function(e,t){var a=Qt();t=t===void 0?null:t;var r=e();if(Il){$t(!0);try{e()}finally{$t(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Qt();if(a!==void 0){var c=a(t);if(Il){$t(!0);try{a(t)}finally{$t(!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=Py.bind(null,Ne,e),[r.memoizedState,e]},useRef:function(e){var t=Qt();return e={current:e},t.memoizedState=e},useState:function(e){e=ku(e);var t=e.queue,a=Wh.bind(null,Ne,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:_u,useDeferredValue:function(e,t){var a=Qt();return Ou(a,e,t)},useTransition:function(){var e=ku(!1);return e=Xh.bind(null,Ne,e.queue,!0,!1),Qt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=Ne,c=Qt();if(Re){if(a===void 0)throw Error(i(407));a=a()}else{if(a=t(),Xe===null)throw Error(i(349));(Ee&127)!==0||Nh(r,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,qh(wh.bind(null,r,d,e),[e]),r.flags|=2048,$r(9,{destroy:void 0},Mh.bind(null,r,d,a,t),null),a},useId:function(){var e=Qt(),t=Xe.identifierPrefix;if(Re){var a=ea,r=Wn;a=(r&~(1<<32-vt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ho++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=_y++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Uu,useFormState:Oh,useActionState:Oh,useOptimistic:function(e){var t=Qt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Lu.bind(null,Ne,!0,a),a.dispatch=t,[e,t]},useMemoCache:Tu,useCacheRefresh:function(){return Qt().memoizedState=qy.bind(null,Ne)},useEffectEvent:function(e){var t=Qt(),a={impl:e};return t.memoizedState=a,function(){if((qe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Bu={readContext:kt,use:vo,useCallback:Yh,useContext:kt,useEffect:zu,useImperativeHandle:Kh,useInsertionEffect:$h,useLayoutEffect:Qh,useMemo:Gh,useReducer:xo,useRef:Bh,useState:function(){return xo(Ea)},useDebugValue:_u,useDeferredValue:function(e,t){var a=mt();return Vh(a,Ke.memoizedState,e,t)},useTransition:function(){var e=xo(Ea)[0],t=mt().memoizedState;return[typeof e=="boolean"?e:$i(e),t]},useSyncExternalStore:jh,useId:Jh,useHostTransitionStatus:Uu,useFormState:Dh,useActionState:Dh,useOptimistic:function(e,t){var a=mt();return Ah(a,Ke,e,t)},useMemoCache:Tu,useCacheRefresh:Ih};Bu.useEffectEvent=Ph;var ap={readContext:kt,use:vo,useCallback:Yh,useContext:kt,useEffect:zu,useImperativeHandle:Kh,useInsertionEffect:$h,useLayoutEffect:Qh,useMemo:Gh,useReducer:Eu,useRef:Bh,useState:function(){return Eu(Ea)},useDebugValue:_u,useDeferredValue:function(e,t){var a=mt();return Ke===null?Ou(a,e,t):Vh(a,Ke.memoizedState,e,t)},useTransition:function(){var e=Eu(Ea)[0],t=mt().memoizedState;return[typeof e=="boolean"?e:$i(e),t]},useSyncExternalStore:jh,useId:Jh,useHostTransitionStatus:Uu,useFormState:Lh,useActionState:Lh,useOptimistic:function(e,t){var a=mt();return Ke!==null?Ah(a,Ke,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Tu,useCacheRefresh:Ih};ap.useEffectEvent=Ph;function qu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:g({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Pu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=hn(),c=sl(r);c.payload=t,a!=null&&(c.callback=a),t=ol(e,c,r),t!==null&&(Jt(t,e,r),Li(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=hn(),c=sl(r);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=ol(e,c,r),t!==null&&(Jt(t,e,r),Li(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=hn(),r=sl(a);r.tag=2,t!=null&&(r.callback=t),t=ol(e,r,a),t!==null&&(Jt(t,e,a),Li(t,e,a))}};function lp(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?!Ei(a,r)||!Ei(c,d):!0}function rp(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&&Pu.enqueueReplaceState(t,t.state,null)}function Wl(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=g({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}function ip(e){Js(e)}function sp(e){console.error(e)}function op(e){Js(e)}function So(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function cp(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 $u(e,t,a){return a=sl(a),a.tag=3,a.payload={element:null},a.callback=function(){So(e,t)},a}function up(e){return e=sl(e),e.tag=3,e}function dp(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(){cp(t,a,r)}}var m=a.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){cp(t,a,r),typeof c!="function"&&(hl===null?hl=new Set([this]):hl.add(this));var b=r.stack;this.componentDidCatch(r.value,{componentStack:b!==null?b:""})})}function $y(e,t,a,r,c){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&_r(t,a,c,!0),a=un.current,a!==null){switch(a.tag){case 31:case 13:return _n===null?_o():a.alternate===null&&it===0&&(it=3),a.flags&=-257,a.flags|=65536,a.lanes=c,r===so?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),fd(e,r,c)),!1;case 22:return a.flags|=65536,r===so?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)),fd(e,r,c)),!1}throw Error(i(435,a.tag))}return fd(e,r,c),_o(),!1}if(Re)return t=un.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,r!==iu&&(e=Error(i(422),{cause:r}),zi(En(e,a)))):(r!==iu&&(t=Error(i(423),{cause:r}),zi(En(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,r=En(r,a),c=$u(e.stateNode,r,c),xu(e,c),it!==4&&(it=2)),!1;var d=Error(i(520),{cause:r});if(d=En(d,a),Ji===null?Ji=[d]:Ji.push(d),it!==4&&(it=2),t===null)return!0;r=En(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=$u(a.stateNode,r,e),xu(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"&&(hl===null||!hl.has(d))))return a.flags|=65536,c&=-c,a.lanes|=c,c=up(c),dp(c,e,a,r),xu(a,c),!1}a=a.return}while(a!==null);return!1}var Qu=Error(i(461)),bt=!1;function Rt(e,t,a,r){t.child=e===null?ph(t,null,a,r):Jl(t,e.child,a,r)}function fp(e,t,a,r,c){a=a.render;var d=t.ref;if("ref"in r){var m={};for(var b in r)b!=="ref"&&(m[b]=r[b])}else m=r;return Vl(t),r=Nu(e,t,a,m,d,c),b=Mu(),e!==null&&!bt?(wu(e,t,c),ka(e,t,c)):(Re&&b&&lu(t),t.flags|=1,Rt(e,t,r,c),t.child)}function mp(e,t,a,r,c){if(e===null){var d=a.type;return typeof d=="function"&&!tu(d)&&d.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=d,hp(e,t,d,r,c)):(e=to(a.type,null,r,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Zu(e,c)){var m=d.memoizedProps;if(a=a.compare,a=a!==null?a:Ei,a(m,r)&&e.ref===t.ref)return ka(e,t,c)}return t.flags|=1,e=Ma(d,r),e.ref=t.ref,e.return=t,t.child=e}function hp(e,t,a,r,c){if(e!==null){var d=e.memoizedProps;if(Ei(d,r)&&e.ref===t.ref)if(bt=!1,t.pendingProps=r=d,Zu(e,c))(e.flags&131072)!==0&&(bt=!0);else return t.lanes=e.lanes,ka(e,t,c)}return Hu(e,t,a,r,c)}function pp(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 vp(e,t,d,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ro(t,d!==null?d.cachePool:null),d!==null?gh(t,d):bu(),bh(t);else return r=t.lanes=536870912,vp(e,t,d!==null?d.baseLanes|a:a,a,r)}else d!==null?(ro(t,d.cachePool),gh(t,d),ul(),t.memoizedState=null):(e!==null&&ro(t,null),bu(),ul());return Rt(e,t,c,a),t.child}function Ki(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function vp(e,t,a,r,c){var d=mu();return d=d===null?null:{parent:xt._currentValue,pool:d},t.memoizedState={baseLanes:a,cachePool:d},e!==null&&ro(t,null),bu(),bh(t),e!==null&&_r(e,t,r,!0),t.childLanes=c,null}function jo(e,t){return t=Mo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function xp(e,t,a){return Jl(t,e.child,null,a),e=jo(t,t.pendingProps),e.flags|=2,dn(t),t.memoizedState=null,e}function Qy(e,t,a){var r=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(r.mode==="hidden")return e=jo(t,r),t.lanes=536870912,Ki(null,e);if(Su(t),(e=Ie)?(e=Ev(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:nl!==null?{id:Wn,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},a=eh(e),a.return=t,t.child=a,Et=t,Ie=null)):e=null,e===null)throw ll(t);return t.lanes=536870912,null}return jo(t,r)}var d=e.memoizedState;if(d!==null){var m=d.dehydrated;if(Su(t),c)if(t.flags&256)t.flags&=-257,t=xp(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(bt||_r(e,t,a,!1),c=(a&e.childLanes)!==0,bt||c){if(r=Xe,r!==null&&(m=Bl(r,a),m!==0&&m!==d.retryLane))throw d.retryLane=m,Hl(e,m),Jt(r,e,m),Qu;_o(),t=xp(e,t,a)}else e=d.treeContext,Ie=On(m.nextSibling),Et=t,Re=!0,al=null,zn=!1,e!==null&&ah(t,e),t=jo(t,r),t.flags|=4096;return t}return e=Ma(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function No(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Hu(e,t,a,r,c){return Vl(t),a=Nu(e,t,a,r,void 0,c),r=Mu(),e!==null&&!bt?(wu(e,t,c),ka(e,t,c)):(Re&&r&&lu(t),t.flags|=1,Rt(e,t,a,c),t.child)}function gp(e,t,a,r,c,d){return Vl(t),t.updateQueue=null,a=Sh(t,r,a,c),yh(e),r=Mu(),e!==null&&!bt?(wu(e,t,d),ka(e,t,d)):(Re&&r&&lu(t),t.flags|=1,Rt(e,t,a,d),t.child)}function bp(e,t,a,r,c){if(Vl(t),t.stateNode===null){var d=Er,m=a.contextType;typeof m=="object"&&m!==null&&(d=kt(m)),d=new a(r,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Pu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=r,d.state=t.memoizedState,d.refs={},pu(t),m=a.contextType,d.context=typeof m=="object"&&m!==null?kt(m):Er,d.state=t.memoizedState,m=a.getDerivedStateFromProps,typeof m=="function"&&(qu(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&&Pu.enqueueReplaceState(d,d.state,null),qi(t,r,d,c),Bi(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){d=t.stateNode;var b=t.memoizedProps,w=Wl(a,b);d.props=w;var _=d.context,Y=a.contextType;m=Er,typeof Y=="object"&&Y!==null&&(m=kt(Y));var F=a.getDerivedStateFromProps;Y=typeof F=="function"||typeof d.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b||_!==m)&&rp(t,d,r,m),il=!1;var L=t.memoizedState;d.state=L,qi(t,r,d,c),Bi(),_=t.memoizedState,b||L!==_||il?(typeof F=="function"&&(qu(t,a,F,r),_=t.memoizedState),(w=il||lp(t,a,w,r,L,_,m))?(Y||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=_),d.props=r,d.state=_,d.context=m,r=w):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{d=t.stateNode,vu(e,t),m=t.memoizedProps,Y=Wl(a,m),d.props=Y,F=t.pendingProps,L=d.context,_=a.contextType,w=Er,typeof _=="object"&&_!==null&&(w=kt(_)),b=a.getDerivedStateFromProps,(_=typeof b=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(m!==F||L!==w)&&rp(t,d,r,w),il=!1,L=t.memoizedState,d.state=L,qi(t,r,d,c),Bi();var P=t.memoizedState;m!==F||L!==P||il||e!==null&&e.dependencies!==null&&ao(e.dependencies)?(typeof b=="function"&&(qu(t,a,b,r),P=t.memoizedState),(Y=il||lp(t,a,Y,r,L,P,w)||e!==null&&e.dependencies!==null&&ao(e.dependencies))?(_||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(r,P,w),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(r,P,w)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=P),d.props=r,d.state=P,d.context=w,r=Y):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),r=!1)}return d=r,No(e,t),r=(t.flags&128)!==0,d||r?(d=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&r?(t.child=Jl(t,e.child,null,c),t.child=Jl(t,null,a,c)):Rt(e,t,a,c),t.memoizedState=d.state,e=t.child):e=ka(e,t,c),e}function yp(e,t,a,r){return Yl(),t.flags|=256,Rt(e,t,a,r),t.child}var Ku={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yu(e){return{baseLanes:e,cachePool:ch()}}function Gu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=mn),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:(ft.current&2)!==0),m&&(c=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(c?cl(t):ul(),(e=Ie)?(e=Ev(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:nl!==null?{id:Wn,overflow:ea}:null,retryLane:536870912,hydrationErrors:null},a=eh(e),a.return=t,t.child=a,Et=t,Ie=null)):e=null,e===null)throw ll(t);return Ad(e)?t.lanes=32:t.lanes=536870912,null}var b=r.children;return r=r.fallback,c?(ul(),c=t.mode,b=Mo({mode:"hidden",children:b},c),r=Kl(r,c,a,null),b.return=t,r.return=t,b.sibling=r,t.child=b,r=t.child,r.memoizedState=Yu(a),r.childLanes=Gu(e,m,a),t.memoizedState=Ku,Ki(null,r)):(cl(t),Vu(t,b))}var w=e.memoizedState;if(w!==null&&(b=w.dehydrated,b!==null)){if(d)t.flags&256?(cl(t),t.flags&=-257,t=Xu(e,t,a)):t.memoizedState!==null?(ul(),t.child=e.child,t.flags|=128,t=null):(ul(),b=r.fallback,c=t.mode,r=Mo({mode:"visible",children:r.children},c),b=Kl(b,c,a,null),b.flags|=2,r.return=t,b.return=t,r.sibling=b,t.child=r,Jl(t,e.child,null,a),r=t.child,r.memoizedState=Yu(a),r.childLanes=Gu(e,m,a),t.memoizedState=Ku,t=Ki(null,r));else if(cl(t),Ad(b)){if(m=b.nextSibling&&b.nextSibling.dataset,m)var _=m.dgst;m=_,r=Error(i(419)),r.stack="",r.digest=m,zi({value:r,source:null,stack:null}),t=Xu(e,t,a)}else if(bt||_r(e,t,a,!1),m=(a&e.childLanes)!==0,bt||m){if(m=Xe,m!==null&&(r=Bl(m,a),r!==0&&r!==w.retryLane))throw w.retryLane=r,Hl(e,r),Jt(m,e,r),Qu;Td(b)||_o(),t=Xu(e,t,a)}else Td(b)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,Ie=On(b.nextSibling),Et=t,Re=!0,al=null,zn=!1,e!==null&&ah(t,e),t=Vu(t,r.children),t.flags|=4096);return t}return c?(ul(),b=r.fallback,c=t.mode,w=e.child,_=w.sibling,r=Ma(w,{mode:"hidden",children:r.children}),r.subtreeFlags=w.subtreeFlags&65011712,_!==null?b=Ma(_,b):(b=Kl(b,c,a,null),b.flags|=2),b.return=t,r.return=t,r.sibling=b,t.child=r,Ki(null,r),r=t.child,b=e.child.memoizedState,b===null?b=Yu(a):(c=b.cachePool,c!==null?(w=xt._currentValue,c=c.parent!==w?{parent:w,pool:w}:c):c=ch(),b={baseLanes:b.baseLanes|a,cachePool:c}),r.memoizedState=b,r.childLanes=Gu(e,m,a),t.memoizedState=Ku,Ki(e.child,r)):(cl(t),a=e.child,e=a.sibling,a=Ma(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 Vu(e,t){return t=Mo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Mo(e,t){return e=cn(22,e,null,t),e.lanes=0,e}function Xu(e,t,a){return Jl(t,e.child,null,a),e=Vu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jp(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),cu(e.return,t,a)}function Fu(e,t,a,r,c,d){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:c,treeForkCount:d}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=r,m.tail=a,m.tailMode=c,m.treeForkCount=d)}function Np(e,t,a){var r=t.pendingProps,c=r.revealOrder,d=r.tail;r=r.children;var m=ft.current,b=(m&2)!==0;if(b?(m=m&1|2,t.flags|=128):m&=1,X(ft,m),Rt(e,t,r,a),r=Re?Ri:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jp(e,a,t);else if(e.tag===19)jp(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&&fo(e)===null&&(c=a),a=a.sibling;a=c,a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),Fu(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&&fo(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}Fu(t,!0,a,null,d,r);break;case"together":Fu(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function ka(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),ml|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(_r(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,a=Ma(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Ma(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Zu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ao(e)))}function Hy(e,t,a){switch(t.tag){case 3:Ve(t,t.stateNode.containerInfo),rl(t,xt,e.memoizedState.cache),Yl();break;case 27:case 5:wt(t);break;case 4:Ve(t,t.stateNode.containerInfo);break;case 10:rl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Su(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(cl(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Sp(e,t,a):(cl(t),e=ka(e,t,a),e!==null?e.sibling:null);cl(t);break;case 19:var c=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(_r(e,t,a,!1),r=(a&t.childLanes)!==0),c){if(r)return Np(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),X(ft,ft.current),r)break;return null;case 22:return t.lanes=0,pp(e,t,a,t.pendingProps);case 24:rl(t,xt,e.memoizedState.cache)}return ka(e,t,a)}function Mp(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)bt=!0;else{if(!Zu(e,a)&&(t.flags&128)===0)return bt=!1,Hy(e,t,a);bt=(e.flags&131072)!==0}else bt=!1,Re&&(t.flags&1048576)!==0&&nh(t,Ri,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Fl(t.elementType),t.type=e,typeof e=="function")tu(e)?(r=Wl(e,r),t.tag=1,t=bp(null,t,e,r,a)):(t.tag=0,t=Hu(null,t,e,r,a));else{if(e!=null){var c=e.$$typeof;if(c===H){t.tag=11,t=fp(null,t,e,r,a);break e}else if(c===$){t.tag=14,t=mp(null,t,e,r,a);break e}}throw t=xe(e)||e,Error(i(306,t,""))}}return t;case 0:return Hu(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,c=Wl(r,t.pendingProps),bp(e,t,r,c,a);case 3:e:{if(Ve(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var d=t.memoizedState;c=d.element,vu(e,t),qi(t,r,null,a);var m=t.memoizedState;if(r=m.cache,rl(t,xt,r),r!==d.cache&&uu(t,[xt],a,!0),Bi(),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=yp(e,t,r,a);break e}else if(r!==c){c=En(Error(i(424)),t),zi(c),t=yp(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(Ie=On(e.firstChild),Et=t,Re=!0,al=null,zn=!0,a=ph(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Yl(),r===c){t=ka(e,t,a);break e}Rt(e,t,r,a)}t=t.child}return t;case 26:return No(e,t),e===null?(a=Dv(t.type,null,t.pendingProps,null))?t.memoizedState=a:Re||(a=t.type,e=t.pendingProps,r=Po(de.current).createElement(a),r[Pe]=t,r[at]=e,zt(r,a,e),dt(r),t.stateNode=r):t.memoizedState=Dv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return wt(t),e===null&&Re&&(r=t.stateNode=zv(t.type,t.pendingProps,de.current),Et=t,zn=!0,c=Ie,gl(t.type)?(Ed=c,Ie=On(r.firstChild)):Ie=c),Rt(e,t,t.pendingProps.children,a),No(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((c=r=Ie)&&(r=b0(r,t.type,t.pendingProps,zn),r!==null?(t.stateNode=r,Et=t,Ie=On(r.firstChild),zn=!1,c=!0):c=!1),c||ll(t)),wt(t),c=t.type,d=t.pendingProps,m=e!==null?e.memoizedProps:null,r=d.children,Md(c,d)?r=null:m!==null&&Md(c,m)&&(t.flags|=32),t.memoizedState!==null&&(c=Nu(e,t,Oy,null,null,a),rs._currentValue=c),No(e,t),Rt(e,t,r,a),t.child;case 6:return e===null&&Re&&((e=a=Ie)&&(a=y0(a,t.pendingProps,zn),a!==null?(t.stateNode=a,Et=t,Ie=null,e=!0):e=!1),e||ll(t)),null;case 13:return Sp(e,t,a);case 4:return Ve(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Jl(t,null,r,a):Rt(e,t,r,a),t.child;case 11:return fp(e,t,t.type,t.pendingProps,a);case 7:return Rt(e,t,t.pendingProps,a),t.child;case 8:return Rt(e,t,t.pendingProps.children,a),t.child;case 12:return Rt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,rl(t,t.type,r.value),Rt(e,t,r.children,a),t.child;case 9:return c=t.type._context,r=t.pendingProps.children,Vl(t),c=kt(c),r=r(c),t.flags|=1,Rt(e,t,r,a),t.child;case 14:return mp(e,t,t.type,t.pendingProps,a);case 15:return hp(e,t,t.type,t.pendingProps,a);case 19:return Np(e,t,a);case 31:return Qy(e,t,a);case 22:return pp(e,t,a,t.pendingProps);case 24:return Vl(t),r=kt(xt),e===null?(c=mu(),c===null&&(c=Xe,d=du(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=a),c=d),t.memoizedState={parent:r,cache:c},pu(t),rl(t,xt,c)):((e.lanes&a)!==0&&(vu(e,t),qi(t,null,null,a),Bi()),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),rl(t,xt,r)):(r=d.cache,rl(t,xt,r),r!==c.cache&&uu(t,[xt],a,!0))),Rt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ra(e){e.flags|=4}function Ju(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(Jp())e.flags|=8192;else throw Zl=so,hu}else e.flags&=-16777217}function wp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Pv(t))if(Jp())e.flags|=8192;else throw Zl=so,hu}function wo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ll():536870912,e.lanes|=t,Yr|=t)}function Yi(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function We(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 Ky(e,t,a){var r=t.pendingProps;switch(ru(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ta(xt),Oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(zr(t)?Ra(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,su())),We(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(Ra(t),d!==null?(We(t),wp(t,d)):(We(t),Ju(t,c,null,r,a))):d?d!==e.memoizedState?(Ra(t),We(t),wp(t,d)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ra(t),We(t),Ju(t,c,e,r,a)),null;case 27:if(ht(t),a=de.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ra(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return We(t),null}e=le.current,zr(t)?lh(t):(e=zv(c,r,a),t.stateNode=e,Ra(t))}return We(t),null;case 5:if(ht(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ra(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return We(t),null}if(d=le.current,zr(t))lh(t);else{var m=Po(de.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[Pe]=t,d[at]=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(zt(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&&Ra(t)}}return We(t),Ju(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ra(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(i(166));if(e=de.current,zr(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,c=Et,c!==null)switch(c.tag){case 27:case 5:r=c.memoizedProps}e[Pe]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Sv(e.nodeValue,a)),e||ll(t,!0)}else e=Po(e).createTextNode(r),e[Pe]=t,t.stateNode=e}return We(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=zr(t),a!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Pe]=t}else Yl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else a=su(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(dn(t),t):(dn(t),null);if((t.flags&128)!==0)throw Error(i(558))}return We(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=zr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!c)throw Error(i(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(i(317));c[Pe]=t}else Yl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=su(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(dn(t),t):(dn(t),null)}return dn(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),wo(t,t.updateQueue),We(t),null);case 4:return Oe(),e===null&&bd(t.stateNode.containerInfo),We(t),null;case 10:return Ta(t.type),We(t),null;case 19:if(q(ft),r=t.memoizedState,r===null)return We(t),null;if(c=(t.flags&128)!==0,d=r.rendering,d===null)if(c)Yi(r,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=fo(e),d!==null){for(t.flags|=128,Yi(r,!1),e=d.updateQueue,t.updateQueue=e,wo(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Wm(a,e),a=a.sibling;return X(ft,ft.current&1|2),Re&&wa(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ct()>ko&&(t.flags|=128,c=!0,Yi(r,!1),t.lanes=4194304)}else{if(!c)if(e=fo(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,wo(t,e),Yi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!Re)return We(t),null}else 2*ct()-r.renderingStartTime>ko&&a!==536870912&&(t.flags|=128,c=!0,Yi(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=ft.current,X(ft,c?a&1|2:a&1),Re&&wa(t,r.treeForkCount),e):(We(t),null);case 22:case 23:return dn(t),yu(),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&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),a=t.updateQueue,a!==null&&wo(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&&q(Xl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ta(xt),We(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Yy(e,t){switch(ru(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ta(xt),Oe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ht(t),null;case 31:if(t.memoizedState!==null){if(dn(t),t.alternate===null)throw Error(i(340));Yl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(dn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Yl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(ft),null;case 4:return Oe(),null;case 10:return Ta(t.type),null;case 22:case 23:return dn(t),yu(),e!==null&&q(Xl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ta(xt),null;case 25:return null;default:return null}}function Cp(e,t){switch(ru(t),t.tag){case 3:Ta(xt),Oe();break;case 26:case 27:case 5:ht(t);break;case 4:Oe();break;case 31:t.memoizedState!==null&&dn(t);break;case 13:dn(t);break;case 19:q(ft);break;case 10:Ta(t.type);break;case 22:case 23:dn(t),yu(),e!==null&&q(Xl);break;case 24:Ta(xt)}}function Gi(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var c=r.next;a=c;do{if((a.tag&e)===e){r=void 0;var d=a.create,m=a.inst;r=d(),m.destroy=r}a=a.next}while(a!==c)}}catch(b){He(t,t.return,b)}}function dl(e,t,a){try{var r=t.updateQueue,c=r!==null?r.lastEffect:null;if(c!==null){var d=c.next;r=d;do{if((r.tag&e)===e){var m=r.inst,b=m.destroy;if(b!==void 0){m.destroy=void 0,c=t;var w=a,_=b;try{_()}catch(Y){He(c,w,Y)}}}r=r.next}while(r!==d)}}catch(Y){He(t,t.return,Y)}}function Tp(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{xh(t,a)}catch(r){He(e,e.return,r)}}}function Ap(e,t,a){a.props=Wl(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){He(e,t,r)}}function Vi(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){He(e,t,c)}}function ta(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(c){He(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){He(e,t,c)}else a.current=null}function Ep(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){He(e,e.return,c)}}function Iu(e,t,a){try{var r=e.stateNode;m0(r,e.type,a,t),r[at]=t}catch(c){He(e,e.return,c)}}function kp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&gl(e.type)||e.tag===4}function Wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kp(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&&gl(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 ed(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=ja));else if(r!==4&&(r===27&&gl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(ed(e,t,a),e=e.sibling;e!==null;)ed(e,t,a),e=e.sibling}function Co(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&&gl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Co(e,t,a),e=e.sibling;e!==null;)Co(e,t,a),e=e.sibling}function Rp(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);zt(t,r,a),t[Pe]=e,t[at]=a}catch(d){He(e,e.return,d)}}var za=!1,yt=!1,td=!1,zp=typeof WeakSet=="function"?WeakSet:Set,Ct=null;function Gy(e,t){if(e=e.containerInfo,jd=Vo,e=Km(e),Xc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var c=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var m=0,b=-1,w=-1,_=0,Y=0,F=e,L=null;t:for(;;){for(var P;F!==a||c!==0&&F.nodeType!==3||(b=m+c),F!==d||r!==0&&F.nodeType!==3||(w=m+r),F.nodeType===3&&(m+=F.nodeValue.length),(P=F.firstChild)!==null;)L=F,F=P;for(;;){if(F===e)break t;if(L===a&&++_===c&&(b=m),L===d&&++Y===r&&(w=m),(P=F.nextSibling)!==null)break;F=L,L=F.parentNode}F=P}a=b===-1||w===-1?null:{start:b,end:w}}else a=null}a=a||{start:0,end:0}}else a=null;for(Nd={focusedElem:e,selectionRange:a},Vo=!1,Ct=t;Ct!==null;)if(t=Ct,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ct=e;else for(;Ct!==null;){switch(t=Ct,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=Wl(a.type,c);e=r.getSnapshotBeforeUpdate(oe,d),r.__reactInternalSnapshotBeforeUpdate=e}catch(ve){He(a,a.return,ve)}}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(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Ct=e;break}Ct=t.return}}function _p(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Oa(e,a),r&4&&Gi(5,a);break;case 1:if(Oa(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(m){He(a,a.return,m)}else{var c=Wl(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){He(a,a.return,m)}}r&64&&Tp(a),r&512&&Vi(a,a.return);break;case 3:if(Oa(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{xh(e,t)}catch(m){He(a,a.return,m)}}break;case 27:t===null&&r&4&&Rp(a);case 26:case 5:Oa(e,a),t===null&&r&4&&Ep(a),r&512&&Vi(a,a.return);break;case 12:Oa(e,a);break;case 31:Oa(e,a),r&4&&Up(e,a);break;case 13:Oa(e,a),r&4&&Lp(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=t0.bind(null,a),S0(e,a))));break;case 22:if(r=a.memoizedState!==null||za,!r){t=t!==null&&t.memoizedState!==null||yt,c=za;var d=yt;za=r,(yt=t)&&!d?Da(e,a,(a.subtreeFlags&8772)!==0):Oa(e,a),za=c,yt=d}break;case 30:break;default:Oa(e,a)}}function Op(e){var t=e.alternate;t!==null&&(e.alternate=null,Op(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&yr(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 tt=null,Vt=!1;function _a(e,t,a){for(a=a.child;a!==null;)Dp(e,t,a),a=a.sibling}function Dp(e,t,a){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(Ut,a)}catch{}switch(a.tag){case 26:yt||ta(a,t),_a(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:yt||ta(a,t);var r=tt,c=Vt;gl(a.type)&&(tt=a.stateNode,Vt=!1),_a(e,t,a),ns(a.stateNode),tt=r,Vt=c;break;case 5:yt||ta(a,t);case 6:if(r=tt,c=Vt,tt=null,_a(e,t,a),tt=r,Vt=c,tt!==null)if(Vt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(a.stateNode)}catch(d){He(a,t,d)}else try{tt.removeChild(a.stateNode)}catch(d){He(a,t,d)}break;case 18:tt!==null&&(Vt?(e=tt,Tv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Wr(e)):Tv(tt,a.stateNode));break;case 4:r=tt,c=Vt,tt=a.stateNode.containerInfo,Vt=!0,_a(e,t,a),tt=r,Vt=c;break;case 0:case 11:case 14:case 15:dl(2,a,t),yt||dl(4,a,t),_a(e,t,a);break;case 1:yt||(ta(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&Ap(a,t,r)),_a(e,t,a);break;case 21:_a(e,t,a);break;case 22:yt=(r=yt)||a.memoizedState!==null,_a(e,t,a),yt=r;break;default:_a(e,t,a)}}function Up(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wr(e)}catch(a){He(t,t.return,a)}}}function Lp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wr(e)}catch(a){He(t,t.return,a)}}function Vy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new zp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new zp),t;default:throw Error(i(435,e.tag))}}function To(e,t){var a=Vy(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var c=n0.bind(null,e,r);r.then(c,c)}})}function Xt(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var c=a[r],d=e,m=t,b=m;e:for(;b!==null;){switch(b.tag){case 27:if(gl(b.type)){tt=b.stateNode,Vt=!1;break e}break;case 5:tt=b.stateNode,Vt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,Vt=!0;break e}b=b.return}if(tt===null)throw Error(i(160));Dp(d,m,c),tt=null,Vt=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Bp(t,e),t=t.sibling}var Qn=null;function Bp(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Xt(t,e),Ft(e),r&4&&(dl(3,e,e.return),Gi(3,e),dl(5,e,e.return));break;case 1:Xt(t,e),Ft(e),r&512&&(yt||a===null||ta(a,a.return)),r&64&&za&&(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=Qn;if(Xt(t,e),Ft(e),r&512&&(yt||a===null||ta(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[Wa]||d[Pe]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(r),c.head.insertBefore(d,c.querySelector("head > title"))),zt(d,r,a),d[Pe]=e,dt(d),r=d;break e;case"link":var m=Bv("link","href",c).get(r+(a.href||""));if(m){for(var b=0;b<m.length;b++)if(d=m[b],d.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&d.getAttribute("rel")===(a.rel==null?null:a.rel)&&d.getAttribute("title")===(a.title==null?null:a.title)&&d.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){m.splice(b,1);break t}}d=c.createElement(r),zt(d,r,a),c.head.appendChild(d);break;case"meta":if(m=Bv("meta","content",c).get(r+(a.content||""))){for(b=0;b<m.length;b++)if(d=m[b],d.getAttribute("content")===(a.content==null?null:""+a.content)&&d.getAttribute("name")===(a.name==null?null:a.name)&&d.getAttribute("property")===(a.property==null?null:a.property)&&d.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&d.getAttribute("charset")===(a.charSet==null?null:a.charSet)){m.splice(b,1);break t}}d=c.createElement(r),zt(d,r,a),c.head.appendChild(d);break;default:throw Error(i(468,r))}d[Pe]=e,dt(d),r=d}e.stateNode=r}else qv(c,e.type,e.stateNode);else e.stateNode=Lv(c,r,e.memoizedProps);else d!==r?(d===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):d.count--,r===null?qv(c,e.type,e.stateNode):Lv(c,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Iu(e,e.memoizedProps,a.memoizedProps)}break;case 27:Xt(t,e),Ft(e),r&512&&(yt||a===null||ta(a,a.return)),a!==null&&r&4&&Iu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Xt(t,e),Ft(e),r&512&&(yt||a===null||ta(a,a.return)),e.flags&32){c=e.stateNode;try{jr(c,"")}catch(oe){He(e,e.return,oe)}}r&4&&e.stateNode!=null&&(c=e.memoizedProps,Iu(e,c,a!==null?a.memoizedProps:c)),r&1024&&(td=!0);break;case 6:if(Xt(t,e),Ft(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(oe){He(e,e.return,oe)}}break;case 3:if(Ho=null,c=Qn,Qn=$o(t.containerInfo),Xt(t,e),Qn=c,Ft(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{Wr(t.containerInfo)}catch(oe){He(e,e.return,oe)}td&&(td=!1,qp(e));break;case 4:r=Qn,Qn=$o(e.stateNode.containerInfo),Xt(t,e),Ft(e),Qn=r;break;case 12:Xt(t,e),Ft(e);break;case 31:Xt(t,e),Ft(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,To(e,r)));break;case 13:Xt(t,e),Ft(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Eo=ct()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,To(e,r)));break;case 22:c=e.memoizedState!==null;var w=a!==null&&a.memoizedState!==null,_=za,Y=yt;if(za=_||c,yt=Y||w,Xt(t,e),yt=Y,za=_,Ft(e),r&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(a===null||w||za||yt||er(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){w=a=t;try{if(d=w.stateNode,c)m=d.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{b=w.stateNode;var F=w.memoizedProps.style,L=F!=null&&F.hasOwnProperty("display")?F.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(oe){He(w,w.return,oe)}}}else if(t.tag===6){if(a===null){w=t;try{w.stateNode.nodeValue=c?"":w.memoizedProps}catch(oe){He(w,w.return,oe)}}}else if(t.tag===18){if(a===null){w=t;try{var P=w.stateNode;c?Av(P,!0):Av(w.stateNode,!1)}catch(oe){He(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,To(e,a))));break;case 19:Xt(t,e),Ft(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,To(e,r)));break;case 30:break;case 21:break;default:Xt(t,e),Ft(e)}}function Ft(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(kp(r)){a=r;break}r=r.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var c=a.stateNode,d=Wu(e);Co(e,d,c);break;case 5:var m=a.stateNode;a.flags&32&&(jr(m,""),a.flags&=-33);var b=Wu(e);Co(e,b,m);break;case 3:case 4:var w=a.stateNode.containerInfo,_=Wu(e);ed(e,_,w);break;default:throw Error(i(161))}}catch(Y){He(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Oa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)_p(e,t.alternate,t),t=t.sibling}function er(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:dl(4,t,t.return),er(t);break;case 1:ta(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Ap(t,t.return,a),er(t);break;case 27:ns(t.stateNode);case 26:case 5:ta(t,t.return),er(t);break;case 22:t.memoizedState===null&&er(t);break;case 30:er(t);break;default:er(t)}e=e.sibling}}function Da(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:Da(c,d,a),Gi(4,d);break;case 1:if(Da(c,d,a),r=d,c=r.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(_){He(r,r.return,_)}if(r=d,c=r.updateQueue,c!==null){var b=r.stateNode;try{var w=c.shared.hiddenCallbacks;if(w!==null)for(c.shared.hiddenCallbacks=null,c=0;c<w.length;c++)vh(w[c],b)}catch(_){He(r,r.return,_)}}a&&m&64&&Tp(d),Vi(d,d.return);break;case 27:Rp(d);case 26:case 5:Da(c,d,a),a&&r===null&&m&4&&Ep(d),Vi(d,d.return);break;case 12:Da(c,d,a);break;case 31:Da(c,d,a),a&&m&4&&Up(c,d);break;case 13:Da(c,d,a),a&&m&4&&Lp(c,d);break;case 22:d.memoizedState===null&&Da(c,d,a),Vi(d,d.return);break;case 30:break;default:Da(c,d,a)}t=t.sibling}}function nd(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&&_i(a))}function ad(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_i(e))}function Hn(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Pp(e,t,a,r),t=t.sibling}function Pp(e,t,a,r){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Hn(e,t,a,r),c&2048&&Gi(9,t);break;case 1:Hn(e,t,a,r);break;case 3:Hn(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&&_i(e)));break;case 12:if(c&2048){Hn(e,t,a,r),e=t.stateNode;try{var d=t.memoizedProps,m=d.id,b=d.onPostCommit;typeof b=="function"&&b(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(w){He(t,t.return,w)}}else Hn(e,t,a,r);break;case 31:Hn(e,t,a,r);break;case 13:Hn(e,t,a,r);break;case 23:break;case 22:d=t.stateNode,m=t.alternate,t.memoizedState!==null?d._visibility&2?Hn(e,t,a,r):Xi(e,t):d._visibility&2?Hn(e,t,a,r):(d._visibility|=2,Qr(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),c&2048&&nd(m,t);break;case 24:Hn(e,t,a,r),c&2048&&ad(t.alternate,t);break;default:Hn(e,t,a,r)}}function Qr(e,t,a,r,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,m=t,b=a,w=r,_=m.flags;switch(m.tag){case 0:case 11:case 15:Qr(d,m,b,w,c),Gi(8,m);break;case 23:break;case 22:var Y=m.stateNode;m.memoizedState!==null?Y._visibility&2?Qr(d,m,b,w,c):Xi(d,m):(Y._visibility|=2,Qr(d,m,b,w,c)),c&&_&2048&&nd(m.alternate,m);break;case 24:Qr(d,m,b,w,c),c&&_&2048&&ad(m.alternate,m);break;default:Qr(d,m,b,w,c)}t=t.sibling}}function Xi(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:Xi(a,r),c&2048&&nd(r.alternate,r);break;case 24:Xi(a,r),c&2048&&ad(r.alternate,r);break;default:Xi(a,r)}t=t.sibling}}var Fi=8192;function Hr(e,t,a){if(e.subtreeFlags&Fi)for(e=e.child;e!==null;)$p(e,t,a),e=e.sibling}function $p(e,t,a){switch(e.tag){case 26:Hr(e,t,a),e.flags&Fi&&e.memoizedState!==null&&_0(a,Qn,e.memoizedState,e.memoizedProps);break;case 5:Hr(e,t,a);break;case 3:case 4:var r=Qn;Qn=$o(e.stateNode.containerInfo),Hr(e,t,a),Qn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Fi,Fi=16777216,Hr(e,t,a),Fi=r):Hr(e,t,a));break;default:Hr(e,t,a)}}function Qp(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 Zi(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];Ct=r,Kp(r,e)}Qp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hp(e),e=e.sibling}function Hp(e){switch(e.tag){case 0:case 11:case 15:Zi(e),e.flags&2048&&dl(9,e,e.return);break;case 3:Zi(e);break;case 12:Zi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ao(e)):Zi(e);break;default:Zi(e)}}function Ao(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];Ct=r,Kp(r,e)}Qp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:dl(8,t,t.return),Ao(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Ao(t));break;default:Ao(t)}e=e.sibling}}function Kp(e,t){for(;Ct!==null;){var a=Ct;switch(a.tag){case 0:case 11:case 15:dl(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:_i(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,Ct=r;else e:for(a=e;Ct!==null;){r=Ct;var c=r.sibling,d=r.return;if(Op(r),r===a){Ct=null;break e}if(c!==null){c.return=d,Ct=c;break e}Ct=d}}}var Xy={getCacheForType:function(e){var t=kt(xt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return kt(xt).controller.signal}},Fy=typeof WeakMap=="function"?WeakMap:Map,qe=0,Xe=null,Te=null,Ee=0,Qe=0,fn=null,fl=!1,Kr=!1,ld=!1,Ua=0,it=0,ml=0,tr=0,rd=0,mn=0,Yr=0,Ji=null,Zt=null,id=!1,Eo=0,Yp=0,ko=1/0,Ro=null,hl=null,Nt=0,pl=null,Gr=null,La=0,sd=0,od=null,Gp=null,Ii=0,cd=null;function hn(){return(qe&2)!==0&&Ee!==0?Ee&-Ee:O.T!==null?pd():Ja()}function Vp(){if(mn===0)if((Ee&536870912)===0||Re){var e=pa;pa<<=1,(pa&3932160)===0&&(pa=262144),mn=e}else mn=536870912;return e=un.current,e!==null&&(e.flags|=32),mn}function Jt(e,t,a){(e===Xe&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)&&(Vr(e,0),vl(e,Ee,mn,!1)),ue(e,a),((qe&2)===0||e!==Xe)&&(e===Xe&&((qe&2)===0&&(tr|=a),it===4&&vl(e,Ee,mn,!1)),na(e))}function Xp(e,t,a){if((qe&6)!==0)throw Error(i(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Jn(e,t),c=r?Iy(e,t):dd(e,t,!0),d=r;do{if(c===0){Kr&&!r&&vl(e,t,0,!1);break}else{if(a=e.current.alternate,d&&!Zy(a)){c=dd(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var b=e;c=Ji;var w=b.current.memoizedState.isDehydrated;if(w&&(Vr(b,m).flags|=256),m=dd(b,m,!1),m!==2){if(ld&&!w){b.errorRecoveryDisabledLanes|=d,tr|=d,c=4;break e}d=Zt,Zt=c,d!==null&&(Zt===null?Zt=d:Zt.push.apply(Zt,d))}c=m}if(d=!1,c!==2)continue}}if(c===1){Vr(e,0),vl(e,t,0,!0);break}e:{switch(r=e,d=c,d){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:vl(r,t,mn,!fl);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(c=Eo+300-ct(),10<c)){if(vl(r,t,mn,!fl),Lt(r,0,!0)!==0)break e;La=t,r.timeoutHandle=wv(Fp.bind(null,r,a,Zt,Ro,id,t,mn,tr,Yr,fl,d,"Throttled",-0,0),c);break e}Fp(r,a,Zt,Ro,id,t,mn,tr,Yr,fl,d,null,-0,0)}}break}while(!0);na(e)}function Fp(e,t,a,r,c,d,m,b,w,_,Y,F,L,P){if(e.timeoutHandle=-1,F=t.subtreeFlags,F&8192||(F&16785408)===16785408){F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ja},$p(t,d,F);var oe=(d&62914560)===d?Eo-ct():(d&4194048)===d?Yp-ct():0;if(oe=O0(F,oe),oe!==null){La=d,e.cancelPendingCommit=oe(av.bind(null,e,t,d,a,r,c,m,b,w,Y,F,null,L,P)),vl(e,d,m,!_);return}}av(e,t,d,a,r,c,m,b,w)}function Zy(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(!on(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 vl(e,t,a,r){t&=~rd,t&=~tr,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var c=t;0<c;){var d=31-vt(c),m=1<<d;r[d]=-1,c&=~m}a!==0&&Je(e,a,t)}function zo(){return(qe&6)===0?(Wi(0),!1):!0}function ud(){if(Te!==null){if(Qe===0)var e=Te.return;else e=Te,Ca=Gl=null,Cu(e),Lr=null,Di=0,e=Te;for(;e!==null;)Cp(e.alternate,e),e=e.return;Te=null}}function Vr(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,v0(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),La=0,ud(),Xe=e,Te=a=Ma(e.current,null),Ee=t,Qe=0,fn=null,fl=!1,Kr=Jn(e,t),ld=!1,Yr=mn=rd=tr=ml=it=0,Zt=Ji=null,id=!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-vt(r),d=1<<c;t|=e[c],r&=~d}return Ua=t,Is(),a}function Zp(e,t){Ne=null,O.H=Hi,t===Ur||t===io?(t=fh(),Qe=3):t===hu?(t=fh(),Qe=4):Qe=t===Qu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,fn=t,Te===null&&(it=1,So(e,En(t,e.current)))}function Jp(){var e=un.current;return e===null?!0:(Ee&4194048)===Ee?_n===null:(Ee&62914560)===Ee||(Ee&536870912)!==0?e===_n:!1}function Ip(){var e=O.H;return O.H=Hi,e===null?Hi:e}function Wp(){var e=O.A;return O.A=Xy,e}function _o(){it=4,fl||(Ee&4194048)!==Ee&&un.current!==null||(Kr=!0),(ml&134217727)===0&&(tr&134217727)===0||Xe===null||vl(Xe,Ee,mn,!1)}function dd(e,t,a){var r=qe;qe|=2;var c=Ip(),d=Wp();(Xe!==e||Ee!==t)&&(Ro=null,Vr(e,t)),t=!1;var m=it;e:do try{if(Qe!==0&&Te!==null){var b=Te,w=fn;switch(Qe){case 8:ud(),m=6;break e;case 3:case 2:case 9:case 6:un.current===null&&(t=!0);var _=Qe;if(Qe=0,fn=null,Xr(e,b,w,_),a&&Kr){m=0;break e}break;default:_=Qe,Qe=0,fn=null,Xr(e,b,w,_)}}Jy(),m=it;break}catch(Y){Zp(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Ca=Gl=null,qe=r,O.H=c,O.A=d,Te===null&&(Xe=null,Ee=0,Is()),m}function Jy(){for(;Te!==null;)ev(Te)}function Iy(e,t){var a=qe;qe|=2;var r=Ip(),c=Wp();Xe!==e||Ee!==t?(Ro=null,ko=ct()+500,Vr(e,t)):Kr=Jn(e,t);e:do try{if(Qe!==0&&Te!==null){t=Te;var d=fn;t:switch(Qe){case 1:Qe=0,fn=null,Xr(e,t,d,1);break;case 2:case 9:if(uh(d)){Qe=0,fn=null,tv(t);break}t=function(){Qe!==2&&Qe!==9||Xe!==e||(Qe=7),na(e)},d.then(t,t);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:uh(d)?(Qe=0,fn=null,tv(t)):(Qe=0,fn=null,Xr(e,t,d,7));break;case 5:var m=null;switch(Te.tag){case 26:m=Te.memoizedState;case 5:case 27:var b=Te;if(m?Pv(m):b.stateNode.complete){Qe=0,fn=null;var w=b.sibling;if(w!==null)Te=w;else{var _=b.return;_!==null?(Te=_,Oo(_)):Te=null}break t}}Qe=0,fn=null,Xr(e,t,d,5);break;case 6:Qe=0,fn=null,Xr(e,t,d,6);break;case 8:ud(),it=6;break e;default:throw Error(i(462))}}Wy();break}catch(Y){Zp(e,Y)}while(!0);return Ca=Gl=null,O.H=r,O.A=c,qe=a,Te!==null?0:(Xe=null,Ee=0,Is(),it)}function Wy(){for(;Te!==null&&!Xn();)ev(Te)}function ev(e){var t=Mp(e.alternate,e,Ua);e.memoizedProps=e.pendingProps,t===null?Oo(e):Te=t}function tv(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=gp(a,t,t.pendingProps,t.type,void 0,Ee);break;case 11:t=gp(a,t,t.pendingProps,t.type.render,t.ref,Ee);break;case 5:Cu(t);default:Cp(a,t),t=Te=Wm(t,Ua),t=Mp(a,t,Ua)}e.memoizedProps=e.pendingProps,t===null?Oo(e):Te=t}function Xr(e,t,a,r){Ca=Gl=null,Cu(t),Lr=null,Di=0;var c=t.return;try{if($y(e,c,t,a,Ee)){it=1,So(e,En(a,e.current)),Te=null;return}}catch(d){if(c!==null)throw Te=c,d;it=1,So(e,En(a,e.current)),Te=null;return}t.flags&32768?(Re||r===1?e=!0:Kr||(Ee&536870912)!==0?e=!1:(fl=e=!0,(r===2||r===9||r===3||r===6)&&(r=un.current,r!==null&&r.tag===13&&(r.flags|=16384))),nv(t,e)):Oo(t)}function Oo(e){var t=e;do{if((t.flags&32768)!==0){nv(t,fl);return}e=t.return;var a=Ky(t.alternate,t,Ua);if(a!==null){Te=a;return}if(t=t.sibling,t!==null){Te=t;return}Te=t=e}while(t!==null);it===0&&(it=5)}function nv(e,t){do{var a=Yy(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);it=6,Te=null}function av(e,t,a,r,c,d,m,b,w){e.cancelPendingCommit=null;do Do();while(Nt!==0);if((qe&6)!==0)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(d=t.lanes|t.childLanes,d|=Wc,Ze(e,a,d,m,b,w),e===Xe&&(Te=Xe=null,Ee=0),Gr=t,pl=e,La=a,sd=d,od=c,Gp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,a0(qn,function(){return ov(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=O.T,O.T=null,c=ee.p,ee.p=2,m=qe,qe|=4;try{Gy(e,t,a)}finally{qe=m,ee.p=c,O.T=r}}Nt=1,lv(),rv(),iv()}}function lv(){if(Nt===1){Nt=0;var e=pl,t=Gr,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=O.T,O.T=null;var r=ee.p;ee.p=2;var c=qe;qe|=4;try{Bp(t,e);var d=Nd,m=Km(e.containerInfo),b=d.focusedElem,w=d.selectionRange;if(m!==b&&b&&b.ownerDocument&&Hm(b.ownerDocument.documentElement,b)){if(w!==null&&Xc(b)){var _=w.start,Y=w.end;if(Y===void 0&&(Y=_),"selectionStart"in b)b.selectionStart=_,b.selectionEnd=Math.min(Y,b.value.length);else{var F=b.ownerDocument||document,L=F&&F.defaultView||window;if(L.getSelection){var P=L.getSelection(),oe=b.textContent.length,ve=Math.min(w.start,oe),Ge=w.end===void 0?ve:Math.min(w.end,oe);!P.extend&&ve>Ge&&(m=Ge,Ge=ve,ve=m);var k=Qm(b,ve),A=Qm(b,Ge);if(k&&A&&(P.rangeCount!==1||P.anchorNode!==k.node||P.anchorOffset!==k.offset||P.focusNode!==A.node||P.focusOffset!==A.offset)){var z=F.createRange();z.setStart(k.node,k.offset),P.removeAllRanges(),ve>Ge?(P.addRange(z),P.extend(A.node,A.offset)):(z.setEnd(A.node,A.offset),P.addRange(z))}}}}for(F=[],P=b;P=P.parentNode;)P.nodeType===1&&F.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<F.length;b++){var V=F[b];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}Vo=!!jd,Nd=jd=null}finally{qe=c,ee.p=r,O.T=a}}e.current=t,Nt=2}}function rv(){if(Nt===2){Nt=0;var e=pl,t=Gr,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=O.T,O.T=null;var r=ee.p;ee.p=2;var c=qe;qe|=4;try{_p(e,t.alternate,t)}finally{qe=c,ee.p=r,O.T=a}}Nt=3}}function iv(){if(Nt===4||Nt===3){Nt=0,sn();var e=pl,t=Gr,a=La,r=Gp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Nt=5:(Nt=0,Gr=pl=null,sv(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(hl=null),Mn(a),t=t.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(Ut,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=O.T,c=ee.p,ee.p=2,O.T=null;try{for(var d=e.onRecoverableError,m=0;m<r.length;m++){var b=r[m];d(b.value,{componentStack:b.stack})}}finally{O.T=t,ee.p=c}}(La&3)!==0&&Do(),na(e),c=e.pendingLanes,(a&261930)!==0&&(c&42)!==0?e===cd?Ii++:(Ii=0,cd=e):Ii=0,Wi(0)}}function sv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_i(t)))}function Do(){return lv(),rv(),iv(),ov()}function ov(){if(Nt!==5)return!1;var e=pl,t=sd;sd=0;var a=Mn(La),r=O.T,c=ee.p;try{ee.p=32>a?32:a,O.T=null,a=od,od=null;var d=pl,m=La;if(Nt=0,Gr=pl=null,La=0,(qe&6)!==0)throw Error(i(331));var b=qe;if(qe|=4,Hp(d.current),Pp(d,d.current,m,a),qe=b,Wi(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(Ut,d)}catch{}return!0}finally{ee.p=c,O.T=r,sv(e,t)}}function cv(e,t,a){t=En(a,t),t=$u(e.stateNode,t,2),e=ol(e,t,2),e!==null&&(ue(e,2),na(e))}function He(e,t,a){if(e.tag===3)cv(e,e,a);else for(;t!==null;){if(t.tag===3){cv(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(hl===null||!hl.has(r))){e=En(a,e),a=up(2),r=ol(t,a,2),r!==null&&(dp(a,r,t,e),ue(r,2),na(r));break}}t=t.return}}function fd(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Fy;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)||(ld=!0,c.add(a),e=e0.bind(null,e,t,a),t.then(e,e))}function e0(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Xe===e&&(Ee&a)===a&&(it===4||it===3&&(Ee&62914560)===Ee&&300>ct()-Eo?(qe&2)===0&&Vr(e,0):rd|=a,Yr===Ee&&(Yr=0)),na(e)}function uv(e,t){t===0&&(t=Ll()),e=Hl(e,t),e!==null&&(ue(e,t),na(e))}function t0(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),uv(e,a)}function n0(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(i(314))}r!==null&&r.delete(t),uv(e,a)}function a0(e,t){return Dt(e,t)}var Uo=null,Fr=null,md=!1,Lo=!1,hd=!1,xl=0;function na(e){e!==Fr&&e.next===null&&(Fr===null?Uo=Fr=e:Fr=Fr.next=e),Lo=!0,md||(md=!0,r0())}function Wi(e,t){if(!hd&&Lo){hd=!0;do for(var a=!1,r=Uo;r!==null;){if(e!==0){var c=r.pendingLanes;if(c===0)var d=0;else{var m=r.suspendedLanes,b=r.pingedLanes;d=(1<<31-vt(42|e)+1)-1,d&=c&~(m&~b),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,hv(r,d))}else d=Ee,d=Lt(r,r===Xe?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||Jn(r,d)||(a=!0,hv(r,d));r=r.next}while(a);hd=!1}}function l0(){dv()}function dv(){Lo=md=!1;var e=0;xl!==0&&p0()&&(e=xl);for(var t=ct(),a=null,r=Uo;r!==null;){var c=r.next,d=fv(r,t);d===0?(r.next=null,a===null?Uo=c:a.next=c,c===null&&(Fr=a)):(a=r,(e!==0||(d&3)!==0)&&(Lo=!0)),r=c}Nt!==0&&Nt!==5||Wi(e),xl!==0&&(xl=0)}function fv(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var m=31-vt(d),b=1<<m,w=c[m];w===-1?((b&a)===0||(b&r)!==0)&&(c[m]=gr(b,t)):w<=t&&(e.expiredLanes|=b),d&=~b}if(t=Xe,a=Ee,a=Lt(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&rn(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Jn(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&rn(r),Mn(a)){case 2:case 8:a=Fn;break;case 32:a=qn;break;case 268435456:a=fa;break;default:a=qn}return r=mv.bind(null,e),a=Dt(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&rn(r),e.callbackPriority=2,e.callbackNode=null,2}function mv(e,t){if(Nt!==0&&Nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Do()&&e.callbackNode!==a)return null;var r=Ee;return r=Lt(e,e===Xe?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Xp(e,r,t),fv(e,ct()),e.callbackNode!=null&&e.callbackNode===a?mv.bind(null,e):null)}function hv(e,t){if(Do())return null;Xp(e,t,!0)}function r0(){x0(function(){(qe&6)!==0?Dt(da,l0):dv()})}function pd(){if(xl===0){var e=Or;e===0&&(e=ha,ha<<=1,(ha&261888)===0&&(ha=256)),xl=e}return xl}function pv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ks(""+e)}function vv(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 i0(e,t,a,r,c){if(t==="submit"&&a&&a.stateNode===c){var d=pv((c[at]||null).action),m=r.submitter;m&&(t=(t=m[at]||null)?pv(t.formAction):m.getAttribute("formAction"),t!==null&&(d=t,m=null));var b=new Xs("action","action",null,r,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(xl!==0){var w=m?vv(c,m):new FormData(c);Du(a,{pending:!0,data:w,method:c.method,action:d},null,w)}}else typeof d=="function"&&(b.preventDefault(),w=m?vv(c,m):new FormData(c),Du(a,{pending:!0,data:w,method:c.method,action:d},d,w))},currentTarget:c}]})}}for(var vd=0;vd<Ic.length;vd++){var xd=Ic[vd],s0=xd.toLowerCase(),o0=xd[0].toUpperCase()+xd.slice(1);$n(s0,"on"+o0)}$n(Vm,"onAnimationEnd"),$n(Xm,"onAnimationIteration"),$n(Fm,"onAnimationStart"),$n("dblclick","onDoubleClick"),$n("focusin","onFocus"),$n("focusout","onBlur"),$n(My,"onTransitionRun"),$n(wy,"onTransitionStart"),$n(Cy,"onTransitionCancel"),$n(Zm,"onTransitionEnd"),Ce("onMouseEnter",["mouseout","mouseover"]),Ce("onMouseLeave",["mouseout","mouseover"]),Ce("onPointerEnter",["pointerout","pointerover"]),Ce("onPointerLeave",["pointerout","pointerover"]),W("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),W("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),W("onBeforeInput",["compositionend","keypress","textInput","paste"]),W("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),W("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),W("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var es="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(" "),c0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(es));function xv(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],c=r.event;r=r.listeners;e:{var d=void 0;if(t)for(var m=r.length-1;0<=m;m--){var b=r[m],w=b.instance,_=b.currentTarget;if(b=b.listener,w!==d&&c.isPropagationStopped())break e;d=b,c.currentTarget=_;try{d(c)}catch(Y){Js(Y)}c.currentTarget=null,d=w}else for(m=0;m<r.length;m++){if(b=r[m],w=b.instance,_=b.currentTarget,b=b.listener,w!==d&&c.isPropagationStopped())break e;d=b,c.currentTarget=_;try{d(c)}catch(Y){Js(Y)}c.currentTarget=null,d=w}}}}function Ae(e,t){var a=t[br];a===void 0&&(a=t[br]=new Set);var r=e+"__bubble";a.has(r)||(gv(t,e,2,!1),a.add(r))}function gd(e,t,a){var r=0;t&&(r|=4),gv(a,e,r,t)}var Bo="_reactListening"+Math.random().toString(36).slice(2);function bd(e){if(!e[Bo]){e[Bo]=!0,Si.forEach(function(a){a!=="selectionchange"&&(c0.has(a)||gd(a,!1,e),gd(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Bo]||(t[Bo]=!0,gd("selectionchange",!1,t))}}function gv(e,t,a,r){switch(Vv(t)){case 2:var c=L0;break;case 8:c=B0;break;default:c=Od}a=c.bind(null,t,a,e),c=void 0,!qc||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 yd(e,t,a,r,c){var d=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var m=r.tag;if(m===3||m===4){var b=r.stateNode.containerInfo;if(b===c)break;if(m===4)for(m=r.return;m!==null;){var w=m.tag;if((w===3||w===4)&&m.stateNode.containerInfo===c)return;m=m.return}for(;b!==null;){if(m=ga(b),m===null)return;if(w=m.tag,w===5||w===6||w===26||w===27){r=d=m;continue e}b=b.parentNode}}r=r.return}Nm(function(){var _=d,Y=Lc(a),F=[];e:{var L=Jm.get(e);if(L!==void 0){var P=Xs,oe=e;switch(e){case"keypress":if(Gs(a)===0)break e;case"keydown":case"keyup":P=ny;break;case"focusin":oe="focus",P=Hc;break;case"focusout":oe="blur",P=Hc;break;case"beforeblur":case"afterblur":P=Hc;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":P=Cm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=Kb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=ry;break;case Vm:case Xm:case Fm:P=Vb;break;case Zm:P=sy;break;case"scroll":case"scrollend":P=Qb;break;case"wheel":P=cy;break;case"copy":case"cut":case"paste":P=Fb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Am;break;case"toggle":case"beforetoggle":P=dy}var ve=(t&4)!==0,Ge=!ve&&(e==="scroll"||e==="scrollend"),k=ve?L!==null?L+"Capture":null:L;ve=[];for(var A=_,z;A!==null;){var V=A;if(z=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||z===null||k===null||(V=ji(A,k),V!=null&&ve.push(ts(A,V,z))),Ge)break;A=A.return}0<ve.length&&(L=new P(L,oe,null,a,Y),F.push({event:L,listeners:ve}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&a!==Uc&&(oe=a.relatedTarget||a.fromElement)&&(ga(oe)||oe[xa]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(oe=a.relatedTarget||a.toElement,P=_,oe=oe?ga(oe):null,oe!==null&&(Ge=f(oe),ve=oe.tag,oe!==Ge||ve!==5&&ve!==27&&ve!==6)&&(oe=null)):(P=null,oe=_),P!==oe)){if(ve=Cm,V="onMouseLeave",k="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(ve=Am,V="onPointerLeave",k="onPointerEnter",A="pointer"),Ge=P==null?L:el(P),z=oe==null?L:el(oe),L=new ve(V,A+"leave",P,a,Y),L.target=Ge,L.relatedTarget=z,V=null,ga(Y)===_&&(ve=new ve(k,A+"enter",oe,a,Y),ve.target=z,ve.relatedTarget=Ge,V=ve),Ge=V,P&&oe)t:{for(ve=u0,k=P,A=oe,z=0,V=k;V;V=ve(V))z++;V=0;for(var he=A;he;he=ve(he))V++;for(;0<z-V;)k=ve(k),z--;for(;0<V-z;)A=ve(A),V--;for(;z--;){if(k===A||A!==null&&k===A.alternate){ve=k;break t}k=ve(k),A=ve(A)}ve=null}else ve=null;P!==null&&bv(F,L,P,ve,!1),oe!==null&&Ge!==null&&bv(F,Ge,oe,ve,!0)}}e:{if(L=_?el(_):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Ue=Um;else if(Om(L))if(Lm)Ue=Sy;else{Ue=by;var ce=gy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?_&&Dc(_.elementType)&&(Ue=Um):Ue=yy;if(Ue&&(Ue=Ue(e,_))){Dm(F,Ue,a,Y);break e}ce&&ce(e,L,_),e==="focusout"&&_&&L.type==="number"&&_.memoizedProps.value!=null&&Oc(L,"number",L.value)}switch(ce=_?el(_):window,e){case"focusin":(Om(ce)||ce.contentEditable==="true")&&(Cr=ce,Fc=_,ki=null);break;case"focusout":ki=Fc=Cr=null;break;case"mousedown":Zc=!0;break;case"contextmenu":case"mouseup":case"dragend":Zc=!1,Ym(F,a,Y);break;case"selectionchange":if(Ny)break;case"keydown":case"keyup":Ym(F,a,Y)}var Me;if(Yc)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 wr?zm(e,a)&&(ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ke="onCompositionStart");ke&&(Em&&a.locale!=="ko"&&(wr||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&wr&&(Me=Mm()):(tl=Y,Pc="value"in tl?tl.value:tl.textContent,wr=!0)),ce=qo(_,ke),0<ce.length&&(ke=new Tm(ke,e,null,a,Y),F.push({event:ke,listeners:ce}),Me?ke.data=Me:(Me=_m(a),Me!==null&&(ke.data=Me)))),(Me=my?hy(e,a):py(e,a))&&(ke=qo(_,"onBeforeInput"),0<ke.length&&(ce=new Tm("onBeforeInput","beforeinput",null,a,Y),F.push({event:ce,listeners:ke}),ce.data=Me)),i0(F,e,_,a,Y)}xv(F,t)})}function ts(e,t,a){return{instance:e,listener:t,currentTarget:a}}function qo(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=ji(e,a),c!=null&&r.unshift(ts(e,c,d)),c=ji(e,t),c!=null&&r.push(ts(e,c,d))),e.tag===3)return r;e=e.return}return[]}function u0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function bv(e,t,a,r,c){for(var d=t._reactName,m=[];a!==null&&a!==r;){var b=a,w=b.alternate,_=b.stateNode;if(b=b.tag,w!==null&&w===r)break;b!==5&&b!==26&&b!==27||_===null||(w=_,c?(_=ji(a,d),_!=null&&m.unshift(ts(a,_,w))):c||(_=ji(a,d),_!=null&&m.push(ts(a,_,w)))),a=a.return}m.length!==0&&e.push({event:t,listeners:m})}var d0=/\r\n?/g,f0=/\u0000|\uFFFD/g;function yv(e){return(typeof e=="string"?e:""+e).replace(d0,`
|
|
49
|
+
`).replace(f0,"")}function Sv(e,t){return t=yv(t),yv(e)===t}function Ye(e,t,a,r,c,d){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||jr(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&jr(e,""+r);break;case"className":Qs(e,"class",r);break;case"tabIndex":Qs(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Qs(e,a,r);break;case"style":Sm(e,r,d);break;case"data":if(t!=="object"){Qs(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=Ks(""+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"&&Ye(e,t,"name",c.name,c,null),Ye(e,t,"formEncType",c.formEncType,c,null),Ye(e,t,"formMethod",c.formMethod,c,null),Ye(e,t,"formTarget",c.formTarget,c,null)):(Ye(e,t,"encType",c.encType,c,null),Ye(e,t,"method",c.method,c,null),Ye(e,t,"target",c.target,c,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Ks(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=ja);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(i(61));if(a=r.__html,a!=null){if(c.children!=null)throw Error(i(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=Ks(""+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),wn(e,"popover",r);break;case"xlinkActuate":Sa(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Sa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Sa(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Sa(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Sa(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Sa(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Sa(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Sa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Sa(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":wn(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=Pb.get(a)||a,wn(e,a,r))}}function Sd(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(i(61));if(a=r.__html,a!=null){if(c.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof r=="string"?jr(e,r):(typeof r=="number"||typeof r=="bigint")&&jr(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=ja);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!J.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[at]||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,""):wn(e,a,r)}}}function zt(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(i(137,t));default:Ye(e,t,d,m,a,null)}}c&&Ye(e,t,"srcSet",a.srcSet,a,null),r&&Ye(e,t,"src",a.src,a,null);return;case"input":Ae("invalid",e);var b=d=m=c=null,w=null,_=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":_=Y;break;case"value":d=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,t));break;default:Ye(e,t,r,Y,a,null)}}xm(e,d,b,w,_,m,c,!1);return;case"select":Ae("invalid",e),r=m=d=null;for(c in a)if(a.hasOwnProperty(c)&&(b=a[c],b!=null))switch(c){case"value":d=b;break;case"defaultValue":m=b;break;case"multiple":r=b;default:Ye(e,t,c,b,a,null)}t=d,a=m,e.multiple=!!r,t!=null?Sr(e,!!r,t,!1):a!=null&&Sr(e,!!r,a,!0);return;case"textarea":Ae("invalid",e),d=c=r=null;for(m in a)if(a.hasOwnProperty(m)&&(b=a[m],b!=null))switch(m){case"value":r=b;break;case"defaultValue":c=b;break;case"children":d=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(i(91));break;default:Ye(e,t,m,b,a,null)}bm(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:Ye(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<es.length;r++)Ae(es[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(_ in a)if(a.hasOwnProperty(_)&&(r=a[_],r!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Ye(e,t,_,r,a,null)}return;default:if(Dc(t)){for(Y in a)a.hasOwnProperty(Y)&&(r=a[Y],r!==void 0&&Sd(e,t,Y,r,a,void 0));return}}for(b in a)a.hasOwnProperty(b)&&(r=a[b],r!=null&&Ye(e,t,b,r,a,null))}function m0(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,m=null,b=null,w=null,_=null,Y=null;for(P in a){var F=a[P];if(a.hasOwnProperty(P)&&F!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":w=F;default:r.hasOwnProperty(P)||Ye(e,t,P,null,r,F)}}for(var L in r){var P=r[L];if(F=a[L],r.hasOwnProperty(L)&&(P!=null||F!=null))switch(L){case"type":d=P;break;case"name":c=P;break;case"checked":_=P;break;case"defaultChecked":Y=P;break;case"value":m=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(137,t));break;default:P!==F&&Ye(e,t,L,P,r,F)}}_c(e,m,b,w,_,Y,d,c);return;case"select":P=m=b=L=null;for(d in a)if(w=a[d],a.hasOwnProperty(d)&&w!=null)switch(d){case"value":break;case"multiple":P=w;default:r.hasOwnProperty(d)||Ye(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":L=d;break;case"defaultValue":b=d;break;case"multiple":m=d;default:d!==w&&Ye(e,t,c,d,r,w)}t=b,a=m,r=P,L!=null?Sr(e,!!a,L,!1):!!r!=!!a&&(t!=null?Sr(e,!!a,t,!0):Sr(e,!!a,a?[]:"",!1));return;case"textarea":P=L=null;for(b in a)if(c=a[b],a.hasOwnProperty(b)&&c!=null&&!r.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Ye(e,t,b,null,r,c)}for(m in r)if(c=r[m],d=a[m],r.hasOwnProperty(m)&&(c!=null||d!=null))switch(m){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(i(91));break;default:c!==d&&Ye(e,t,m,c,r,d)}gm(e,L,P);return;case"option":for(var oe in a)if(L=a[oe],a.hasOwnProperty(oe)&&L!=null&&!r.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:Ye(e,t,oe,null,r,L)}for(w in r)if(L=r[w],P=a[w],r.hasOwnProperty(w)&&L!==P&&(L!=null||P!=null))switch(w){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Ye(e,t,w,L,r,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ve in a)L=a[ve],a.hasOwnProperty(ve)&&L!=null&&!r.hasOwnProperty(ve)&&Ye(e,t,ve,null,r,L);for(_ in r)if(L=r[_],P=a[_],r.hasOwnProperty(_)&&L!==P&&(L!=null||P!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(i(137,t));break;default:Ye(e,t,_,L,r,P)}return;default:if(Dc(t)){for(var Ge in a)L=a[Ge],a.hasOwnProperty(Ge)&&L!==void 0&&!r.hasOwnProperty(Ge)&&Sd(e,t,Ge,void 0,r,L);for(Y in r)L=r[Y],P=a[Y],!r.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Sd(e,t,Y,L,r,P);return}}for(var k in a)L=a[k],a.hasOwnProperty(k)&&L!=null&&!r.hasOwnProperty(k)&&Ye(e,t,k,null,r,L);for(F in r)L=r[F],P=a[F],!r.hasOwnProperty(F)||L===P||L==null&&P==null||Ye(e,t,F,L,r,P)}function jv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function h0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var c=a[r],d=c.transferSize,m=c.initiatorType,b=c.duration;if(d&&b&&jv(m)){for(m=0,b=c.responseEnd,r+=1;r<a.length;r++){var w=a[r],_=w.startTime;if(_>b)break;var Y=w.transferSize,F=w.initiatorType;Y&&jv(F)&&(w=w.responseEnd,m+=Y*(w<b?1:(b-_)/(w-_)))}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 jd=null,Nd=null;function Po(e){return e.nodeType===9?e:e.ownerDocument}function Nv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Mv(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 Md(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 wd=null;function p0(){var e=window.event;return e&&e.type==="popstate"?e===wd?!1:(wd=e,!0):(wd=null,!1)}var wv=typeof setTimeout=="function"?setTimeout:void 0,v0=typeof clearTimeout=="function"?clearTimeout:void 0,Cv=typeof Promise=="function"?Promise:void 0,x0=typeof queueMicrotask=="function"?queueMicrotask:typeof Cv<"u"?function(e){return Cv.resolve(null).then(e).catch(g0)}:wv;function g0(e){setTimeout(function(){throw e})}function gl(e){return e==="head"}function Tv(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),Wr(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")ns(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ns(a);for(var d=a.firstChild;d;){var m=d.nextSibling,b=d.nodeName;d[Wa]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&d.rel.toLowerCase()==="stylesheet"||a.removeChild(d),d=m}}else a==="body"&&ns(e.ownerDocument.body);a=c}while(a);Wr(t)}function Av(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),yr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function b0(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[Wa])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=On(e.nextSibling),e===null)break}return null}function y0(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=On(e.nextSibling),e===null))return null;return e}function Ev(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=On(e.nextSibling),e===null))return null;return e}function Td(e){return e.data==="$?"||e.data==="$~"}function Ad(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function S0(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 On(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 Ed=null;function kv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return On(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Rv(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 zv(e,t,a){switch(t=Po(a),e){case"html":if(e=t.documentElement,!e)throw Error(i(452));return e;case"head":if(e=t.head,!e)throw Error(i(453));return e;case"body":if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function ns(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);yr(e)}var Dn=new Map,_v=new Set;function $o(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ba=ee.d;ee.d={f:j0,r:N0,D:M0,C:w0,L:C0,m:T0,X:E0,S:A0,M:k0};function j0(){var e=Ba.f(),t=zo();return e||t}function N0(e){var t=ba(e);t!==null&&t.tag===5&&t.type==="form"?Zh(t):Ba.r(e)}var Zr=typeof document>"u"?null:document;function Ov(e,t,a){var r=Zr;if(r&&typeof t=="string"&&t){var c=Tn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),_v.has(c)||(_v.add(c),e={rel:e,crossOrigin:a,href:t},r.querySelector(c)===null&&(t=r.createElement("link"),zt(t,"link",e),dt(t),r.head.appendChild(t)))}}function M0(e){Ba.D(e),Ov("dns-prefetch",e,null)}function w0(e,t){Ba.C(e,t),Ov("preconnect",e,t)}function C0(e,t,a){Ba.L(e,t,a);var r=Zr;if(r&&e&&t){var c='link[rel="preload"][as="'+Tn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+Tn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+Tn(a.imageSizes)+'"]')):c+='[href="'+Tn(e)+'"]';var d=c;switch(t){case"style":d=Jr(e);break;case"script":d=Ir(e)}Dn.has(d)||(e=g({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Dn.set(d,e),r.querySelector(c)!==null||t==="style"&&r.querySelector(as(d))||t==="script"&&r.querySelector(ls(d))||(t=r.createElement("link"),zt(t,"link",e),dt(t),r.head.appendChild(t)))}}function T0(e,t){Ba.m(e,t);var a=Zr;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Tn(r)+'"][href="'+Tn(e)+'"]',d=c;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Ir(e)}if(!Dn.has(d)&&(e=g({rel:"modulepreload",href:e},t),Dn.set(d,e),a.querySelector(c)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ls(d)))return}r=a.createElement("link"),zt(r,"link",e),dt(r),a.head.appendChild(r)}}}function A0(e,t,a){Ba.S(e,t,a);var r=Zr;if(r&&e){var c=ya(r).hoistableStyles,d=Jr(e);t=t||"default";var m=c.get(d);if(!m){var b={loading:0,preload:null};if(m=r.querySelector(as(d)))b.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Dn.get(d))&&kd(e,a);var w=m=r.createElement("link");dt(w),zt(w,"link",e),w._p=new Promise(function(_,Y){w.onload=_,w.onerror=Y}),w.addEventListener("load",function(){b.loading|=1}),w.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Qo(m,t,r)}m={type:"stylesheet",instance:m,count:1,state:b},c.set(d,m)}}}function E0(e,t){Ba.X(e,t);var a=Zr;if(a&&e){var r=ya(a).hoistableScripts,c=Ir(e),d=r.get(c);d||(d=a.querySelector(ls(c)),d||(e=g({src:e,async:!0},t),(t=Dn.get(c))&&Rd(e,t),d=a.createElement("script"),dt(d),zt(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function k0(e,t){Ba.M(e,t);var a=Zr;if(a&&e){var r=ya(a).hoistableScripts,c=Ir(e),d=r.get(c);d||(d=a.querySelector(ls(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=Dn.get(c))&&Rd(e,t),d=a.createElement("script"),dt(d),zt(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function Dv(e,t,a,r){var c=(c=de.current)?$o(c):null;if(!c)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Jr(a.href),a=ya(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=Jr(a.href);var d=ya(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(as(e)))&&!d._p&&(m.instance=d,m.state.loading=5),Dn.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},Dn.set(e,a),d||R0(c,e,a,m.state))),t&&r===null)throw Error(i(528,""));return m}if(t&&r!==null)throw Error(i(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ir(a),a=ya(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(i(444,e))}}function Jr(e){return'href="'+Tn(e)+'"'}function as(e){return'link[rel="stylesheet"]['+e+"]"}function Uv(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function R0(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}),zt(t,"link",a),dt(t),e.head.appendChild(t))}function Ir(e){return'[src="'+Tn(e)+'"]'}function ls(e){return"script[async]"+e}function Lv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Tn(a.href)+'"]');if(r)return t.instance=r,dt(r),r;var c=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),dt(r),zt(r,"style",c),Qo(r,a.precedence,e),t.instance=r;case"stylesheet":c=Jr(a.href);var d=e.querySelector(as(c));if(d)return t.state.loading|=4,t.instance=d,dt(d),d;r=Uv(a),(c=Dn.get(c))&&kd(r,c),d=(e.ownerDocument||e).createElement("link"),dt(d);var m=d;return m._p=new Promise(function(b,w){m.onload=b,m.onerror=w}),zt(d,"link",r),t.state.loading|=4,Qo(d,a.precedence,e),t.instance=d;case"script":return d=Ir(a.src),(c=e.querySelector(ls(d)))?(t.instance=c,dt(c),c):(r=a,(c=Dn.get(d))&&(r=g({},a),Rd(r,c)),e=e.ownerDocument||e,c=e.createElement("script"),dt(c),zt(c,"link",r),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(i(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Qo(r,a.precedence,e));return t.instance}function Qo(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=r.length?r[r.length-1]:null,d=c,m=0;m<r.length;m++){var b=r[m];if(b.dataset.precedence===t)d=b;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function kd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Rd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ho=null;function Bv(e,t,a){if(Ho===null){var r=new Map,c=Ho=new Map;c.set(a,r)}else c=Ho,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[Wa]||d[Pe]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var m=d.getAttribute(t)||"";m=e+m;var b=r.get(m);b?b.push(d):r.set(m,[d])}}return r}function qv(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function z0(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 Pv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function _0(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=Jr(r.href),d=t.querySelector(as(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ko.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=d,dt(d);return}d=t.ownerDocument||t,r=Uv(r),(c=Dn.get(c))&&kd(r,c),d=d.createElement("link"),dt(d);var m=d;m._p=new Promise(function(b,w){m.onload=b,m.onerror=w}),zt(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=Ko.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var zd=0;function O0(e,t){return e.stylesheets&&e.count===0&&Go(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&zd===0&&(zd=62500*h0());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Go(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>zd?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(c)}}:null}function Ko(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yo=null;function Go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yo=new Map,t.forEach(D0,e),Yo=null,Ko.call(e))}function D0(e,t){if(!(t.state.loading&4)){var a=Yo.get(e);if(a)var r=a.get(null);else{a=new Map,Yo.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=Ko.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 rs={$$typeof:Q,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function U0(e,t,a,r,c,d,m,b,w){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Fa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fa(0),this.hiddenUpdates=Fa(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 $v(e,t,a,r,c,d,m,b,w,_,Y,F){return e=new U0(e,t,a,m,w,_,Y,F,b),t=1,d===!0&&(t|=24),d=cn(3,null,null,t),e.current=d,d.stateNode=e,t=du(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:r,isDehydrated:a,cache:t},pu(d),e}function Qv(e){return e?(e=Er,e):Er}function Hv(e,t,a,r,c,d){c=Qv(c),r.context===null?r.context=c:r.pendingContext=c,r=sl(t),r.payload={element:a},d=d===void 0?null:d,d!==null&&(r.callback=d),a=ol(e,r,t),a!==null&&(Jt(a,e,t),Li(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 _d(e,t){Kv(e,t),(e=e.alternate)&&Kv(e,t)}function Yv(e){if(e.tag===13||e.tag===31){var t=Hl(e,67108864);t!==null&&Jt(t,e,67108864),_d(e,67108864)}}function Gv(e){if(e.tag===13||e.tag===31){var t=hn();t=Za(t);var a=Hl(e,t);a!==null&&Jt(a,e,t),_d(e,t)}}var Vo=!0;function L0(e,t,a,r){var c=O.T;O.T=null;var d=ee.p;try{ee.p=2,Od(e,t,a,r)}finally{ee.p=d,O.T=c}}function B0(e,t,a,r){var c=O.T;O.T=null;var d=ee.p;try{ee.p=8,Od(e,t,a,r)}finally{ee.p=d,O.T=c}}function Od(e,t,a,r){if(Vo){var c=Dd(r);if(c===null)yd(e,t,r,Xo,a),Xv(e,r);else if(P0(c,e,t,a,r))r.stopPropagation();else if(Xv(e,r),t&4&&-1<q0.indexOf(e)){for(;c!==null;){var d=ba(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var m=Nn(d.pendingLanes);if(m!==0){var b=d;for(b.pendingLanes|=2,b.entangledLanes|=2;m;){var w=1<<31-vt(m);b.entanglements[1]|=w,m&=~w}na(d),(qe&6)===0&&(ko=ct()+500,Wi(0))}}break;case 31:case 13:b=Hl(d,2),b!==null&&Jt(b,d,2),zo(),_d(d,2)}if(d=Dd(r),d===null&&yd(e,t,r,Xo,a),d===c)break;c=d}c!==null&&r.stopPropagation()}else yd(e,t,r,null,a)}}function Dd(e){return e=Lc(e),Ud(e)}var Xo=null;function Ud(e){if(Xo=null,e=ga(e),e!==null){var t=f(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=v(t),e!==null)return e;e=null}else if(a===31){if(e=h(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 Xo=e,null}function Vv(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(Xa()){case da:return 2;case Fn:return 8;case qn:case Zn:return 32;case fa:return 268435456;default:return 32}default:return 32}}var Ld=!1,bl=null,yl=null,Sl=null,is=new Map,ss=new Map,jl=[],q0="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 Xv(e,t){switch(e){case"focusin":case"focusout":bl=null;break;case"dragenter":case"dragleave":yl=null;break;case"mouseover":case"mouseout":Sl=null;break;case"pointerover":case"pointerout":is.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ss.delete(t.pointerId)}}function os(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=ba(t),t!==null&&Yv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function P0(e,t,a,r,c){switch(t){case"focusin":return bl=os(bl,e,t,a,r,c),!0;case"dragenter":return yl=os(yl,e,t,a,r,c),!0;case"mouseover":return Sl=os(Sl,e,t,a,r,c),!0;case"pointerover":var d=c.pointerId;return is.set(d,os(is.get(d)||null,e,t,a,r,c)),!0;case"gotpointercapture":return d=c.pointerId,ss.set(d,os(ss.get(d)||null,e,t,a,r,c)),!0}return!1}function Fv(e){var t=ga(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=v(a),t!==null){e.blockedOn=t,Ia(e.priority,function(){Gv(a)});return}}else if(t===31){if(t=h(a),t!==null){e.blockedOn=t,Ia(e.priority,function(){Gv(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 Fo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Dd(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Uc=r,a.target.dispatchEvent(r),Uc=null}else return t=ba(a),t!==null&&Yv(t),e.blockedOn=a,!1;t.shift()}return!0}function Zv(e,t,a){Fo(e)&&a.delete(t)}function $0(){Ld=!1,bl!==null&&Fo(bl)&&(bl=null),yl!==null&&Fo(yl)&&(yl=null),Sl!==null&&Fo(Sl)&&(Sl=null),is.forEach(Zv),ss.forEach(Zv)}function Zo(e,t){e.blockedOn===t&&(e.blockedOn=null,Ld||(Ld=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,$0)))}var Jo=null;function Jv(e){Jo!==e&&(Jo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Jo===e&&(Jo=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(Ud(r||a)===null)continue;break}var d=ba(a);d!==null&&(e.splice(t,3),t-=3,Du(d,{pending:!0,data:c,method:a.method,action:r},r,c))}}))}function Wr(e){function t(w){return Zo(w,e)}bl!==null&&Zo(bl,e),yl!==null&&Zo(yl,e),Sl!==null&&Zo(Sl,e),is.forEach(t),ss.forEach(t);for(var a=0;a<jl.length;a++){var r=jl[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<jl.length&&(a=jl[0],a.blockedOn===null);)Fv(a),a.blockedOn===null&&jl.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[at]||null;if(typeof d=="function")m||Jv(a);else if(m){var b=null;if(d&&d.hasAttribute("formAction")){if(c=d,m=d[at]||null)b=m.formAction;else if(Ud(c)!==null)continue}else b=m.action;typeof b=="function"?a[r+1]=b:(a.splice(r,3),r-=3),Jv(a)}}}function Iv(){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 Bd(e){this._internalRoot=e}Io.prototype.render=Bd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var a=t.current,r=hn();Hv(a,r,e,t,null,null)},Io.prototype.unmount=Bd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Hv(e.current,2,null,e,null,null),zo(),t[xa]=null}};function Io(e){this._internalRoot=e}Io.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ja();e={blockedOn:null,target:e,priority:t};for(var a=0;a<jl.length&&t!==0&&t<jl[a].priority;a++);jl.splice(a,0,e),a===0&&Fv(e)}};var Wv=l.version;if(Wv!=="19.2.7")throw Error(i(527,Wv,"19.2.7"));ee.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=x(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Q0={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wo.isDisabled&&Wo.supportsFiber)try{Ut=Wo.inject(Q0),pt=Wo}catch{}}return us.createRoot=function(e,t){if(!u(e))throw Error(i(299));var a=!1,r="",c=ip,d=sp,m=op;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=$v(e,1,!1,null,null,a,r,null,c,d,m,Iv),e[xa]=t.current,bd(e),new Bd(t)},us.hydrateRoot=function(e,t,a){if(!u(e))throw Error(i(299));var r=!1,c="",d=ip,m=sp,b=op,w=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(d=a.onUncaughtError),a.onCaughtError!==void 0&&(m=a.onCaughtError),a.onRecoverableError!==void 0&&(b=a.onRecoverableError),a.formState!==void 0&&(w=a.formState)),t=$v(e,1,!0,t,a??null,r,c,w,d,m,b,Iv),t.context=Qv(null),a=t.current,r=hn(),r=Za(r),c=sl(r),c.callback=null,ol(a,c,r),a=r,t.current.lanes=a,ue(t,a),na(t),e[xa]=t.current,bd(e),new Io(t)},us.version="19.2.7",us}var ux;function W0(){if(ux)return Hd.exports;ux=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(),Hd.exports=I0(),Hd.exports}var e1=W0();/**
|
|
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 dx="popstate";function fx(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function t1(n={}){function l(i,u){var x;let f=(x=u.state)==null?void 0:x.masked,{pathname:v,search:h,hash:p}=f||i.location;return cf("",{pathname:v,search:h,hash:p},u.state&&u.state.usr||null,u.state&&u.state.key||"default",f?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function o(i,u){return typeof u=="string"?u:ys(u)}return a1(l,o,null,n)}function lt(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Gn(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function n1(){return Math.random().toString(36).substring(2,10)}function mx(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 cf(n,l,o=null,i,u){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?pi(l):l,state:o,key:l&&l.key||i||n1(),mask:u}}function ys({pathname:n="/",search:l="",hash:o=""}){return l&&l!=="?"&&(n+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(n+=o.charAt(0)==="#"?o:"#"+o),n}function pi(n){let l={};if(n){let o=n.indexOf("#");o>=0&&(l.hash=n.substring(o),n=n.substring(0,o));let i=n.indexOf("?");i>=0&&(l.search=n.substring(i),n=n.substring(0,i)),n&&(l.pathname=n)}return l}function a1(n,l,o,i={}){let{window:u=document.defaultView,v5Compat:f=!1}=i,v=u.history,h="POP",p=null,x=y();x==null&&(x=0,v.replaceState({...v.state,idx:x},""));function y(){return(v.state||{idx:null}).idx}function g(){h="POP";let D=y(),R=D==null?null:D-x;x=D,p&&p({action:h,location:E.location,delta:R})}function j(D,R){h="PUSH";let U=fx(D)?D:cf(E.location,D,R);x=y()+1;let Q=mx(U,x),H=E.createHref(U.mask||U);try{v.pushState(Q,"",H)}catch(G){if(G instanceof DOMException&&G.name==="DataCloneError")throw G;u.location.assign(H)}f&&p&&p({action:h,location:E.location,delta:1})}function M(D,R){h="REPLACE";let U=fx(D)?D:cf(E.location,D,R);x=y();let Q=mx(U,x),H=E.createHref(U.mask||U);v.replaceState(Q,"",H),f&&p&&p({action:h,location:E.location,delta:0})}function T(D){return l1(u,D)}let E={get action(){return h},get location(){return n(u,v)},listen(D){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(dx,g),p=D,()=>{u.removeEventListener(dx,g),p=null}},createHref(D){return l(u,D)},createURL:T,encodeLocation(D){let R=T(D);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:j,replace:M,go(D){return v.go(D)}};return E}function l1(n,l,o=!1){let i="http://localhost";n&&(i=n.location.origin!=="null"?n.location.origin:n.location.href),lt(i,"No window.location.(origin|href) available to create URL");let u=typeof l=="string"?l:ys(l);return u=u.replace(/ $/,"%20"),!o&&u.startsWith("//")&&(u=i+u),new URL(u,i)}function vg(n,l,o="/"){return r1(n,l,o,!1)}function r1(n,l,o,i,u){let f=typeof l=="string"?pi(l):l,v=Ga(f.pathname||"/",o);if(v==null)return null;let h=i1(n),p=null,x=g1(v);for(let y=0;p==null&&y<h.length;++y)p=v1(h[y],x,i);return p}function i1(n){let l=xg(n);return s1(l),l}function xg(n,l=[],o=[],i="",u=!1){let f=(v,h,p=u,x)=>{let y={relativePath:x===void 0?v.path||"":x,caseSensitive:v.caseSensitive===!0,childrenIndex:h,route:v};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(i)&&p)return;lt(y.relativePath.startsWith(i),`Absolute route path "${y.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(i.length)}let g=Yn([i,y.relativePath]),j=o.concat(y);v.children&&v.children.length>0&&(lt(v.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),xg(v.children,l,j,g,p)),!(v.path==null&&!v.index)&&l.push({path:g,score:h1(g,v.index),routesMeta:j})};return n.forEach((v,h)=>{var p;if(v.path===""||!((p=v.path)!=null&&p.includes("?")))f(v,h);else for(let x of gg(v.path))f(v,h,!0,x)}),l}function gg(n){let l=n.split("/");if(l.length===0)return[];let[o,...i]=l,u=o.endsWith("?"),f=o.replace(/\?$/,"");if(i.length===0)return u?[f,""]:[f];let v=gg(i.join("/")),h=[];return h.push(...v.map(p=>p===""?f:[f,p].join("/"))),u&&h.push(...v),h.map(p=>n.startsWith("/")&&p===""?"/":p)}function s1(n){n.sort((l,o)=>l.score!==o.score?o.score-l.score:p1(l.routesMeta.map(i=>i.childrenIndex),o.routesMeta.map(i=>i.childrenIndex)))}var o1=/^:[\w-]+$/,c1=3,u1=2,d1=1,f1=10,m1=-2,hx=n=>n==="*";function h1(n,l){let o=n.split("/"),i=o.length;return o.some(hx)&&(i+=m1),l&&(i+=u1),o.filter(u=>!hx(u)).reduce((u,f)=>u+(o1.test(f)?c1:f===""?d1:f1),i)}function p1(n,l){return n.length===l.length&&n.slice(0,-1).every((i,u)=>i===l[u])?n[n.length-1]-l[l.length-1]:0}function v1(n,l,o=!1){let{routesMeta:i}=n,u={},f="/",v=[];for(let h=0;h<i.length;++h){let p=i[h],x=h===i.length-1,y=f==="/"?l:l.slice(f.length)||"/",g=mc({path:p.relativePath,caseSensitive:p.caseSensitive,end:x},y),j=p.route;if(!g&&x&&o&&!i[i.length-1].route.index&&(g=mc({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},y)),!g)return null;Object.assign(u,g.params),v.push({params:u,pathname:Yn([f,g.pathname]),pathnameBase:j1(Yn([f,g.pathnameBase])),route:j}),g.pathnameBase!=="/"&&(f=Yn([f,g.pathnameBase]))}return v}function mc(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[o,i]=x1(n.path,n.caseSensitive,n.end),u=l.match(o);if(!u)return null;let f=u[0],v=f.replace(/(.)\/+$/,"$1"),h=u.slice(1);return{params:i.reduce((x,{paramName:y,isOptional:g},j)=>{if(y==="*"){let T=h[j]||"";v=f.slice(0,f.length-T.length).replace(/(.)\/+$/,"$1")}const M=h[j];return g&&!M?x[y]=void 0:x[y]=(M||"").replace(/%2F/g,"/"),x},{}),pathname:f,pathnameBase:v,pattern:n}}function x1(n,l=!1,o=!0){Gn(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 i=[],u="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(v,h,p,x,y)=>{if(i.push({paramName:h,isOptional:p!=null}),p){let g=y.charAt(x+v.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(i.push({paramName:"*"}),u+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?u+="\\/*$":n!==""&&n!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,l?void 0:"i"),i]}function g1(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Gn(!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 Ga(n,l){if(l==="/")return n;if(!n.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,i=n.charAt(o);return i&&i!=="/"?null:n.slice(o)||"/"}var b1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function y1(n,l="/"){let{pathname:o,search:i="",hash:u=""}=typeof n=="string"?pi(n):n,f;return o?(o=yg(o),o.startsWith("/")?f=px(o.substring(1),"/"):f=px(o,l)):f=l,{pathname:f,search:N1(i),hash:M1(u)}}function px(n,l){let o=hc(l).split("/");return n.split("/").forEach(u=>{u===".."?o.length>1&&o.pop():u!=="."&&o.push(u)}),o.length>1?o.join("/"):"/"}function Vd(n,l,o,i){return`Cannot include a '${n}' character in a manually specified \`to.${l}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function S1(n){return n.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function bg(n){let l=S1(n);return l.map((o,i)=>i===l.length-1?o.pathname:o.pathnameBase)}function Pf(n,l,o,i=!1){let u;typeof n=="string"?u=pi(n):(u={...n},lt(!u.pathname||!u.pathname.includes("?"),Vd("?","pathname","search",u)),lt(!u.pathname||!u.pathname.includes("#"),Vd("#","pathname","hash",u)),lt(!u.search||!u.search.includes("#"),Vd("#","search","hash",u)));let f=n===""||u.pathname==="",v=f?"/":u.pathname,h;if(v==null)h=o;else{let g=l.length-1;if(!i&&v.startsWith("..")){let j=v.split("/");for(;j[0]==="..";)j.shift(),g-=1;u.pathname=j.join("/")}h=g>=0?l[g]:"/"}let p=y1(u,h),x=v&&v!=="/"&&v.endsWith("/"),y=(f||v===".")&&o.endsWith("/");return!p.pathname.endsWith("/")&&(x||y)&&(p.pathname+="/"),p}var yg=n=>n.replace(/\/\/+/g,"/"),Yn=n=>yg(n.join("/")),hc=n=>n.replace(/\/+$/,""),j1=n=>hc(n).replace(/^\/*/,"/"),N1=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,M1=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,w1=class{constructor(n,l,o,i=!1){this.status=n,this.statusText=l||"",this.internal=i,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function C1(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function T1(n){let l=n.map(o=>o.route.path).filter(Boolean);return Yn(l)||"/"}var Sg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function jg(n,l){let o=n;if(typeof o!="string"||!b1.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let i=o,u=!1;if(Sg)try{let f=new URL(window.location.href),v=o.startsWith("//")?new URL(f.protocol+o):new URL(o),h=Ga(v.pathname,l);v.origin===f.origin&&h!=null?o=h+v.search+v.hash:u=!0}catch{Gn(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:u,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ng=["POST","PUT","PATCH","DELETE"];new Set(Ng);var A1=["GET",...Ng];new Set(A1);var vi=S.createContext(null);vi.displayName="DataRouter";var Sc=S.createContext(null);Sc.displayName="DataRouterState";var Mg=S.createContext(!1);function E1(){return S.useContext(Mg)}var wg=S.createContext({isTransitioning:!1});wg.displayName="ViewTransition";var k1=S.createContext(new Map);k1.displayName="Fetchers";var R1=S.createContext(null);R1.displayName="Await";var Bn=S.createContext(null);Bn.displayName="Navigation";var zs=S.createContext(null);zs.displayName="Location";var Va=S.createContext({outlet:null,matches:[],isDataRoute:!1});Va.displayName="Route";var $f=S.createContext(null);$f.displayName="RouteError";var Cg="REACT_ROUTER_ERROR",z1="REDIRECT",_1="ROUTE_ERROR_RESPONSE";function O1(n){if(n.startsWith(`${Cg}:${z1}:{`))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 D1(n){if(n.startsWith(`${Cg}:${_1}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new w1(l.status,l.statusText,l.data)}catch{}}function U1(n,{relative:l}={}){lt(_s(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:i}=S.useContext(Bn),{hash:u,pathname:f,search:v}=Os(n,{relative:l}),h=f;return o!=="/"&&(h=f==="/"?o:Yn([o,f])),i.createHref({pathname:h,search:v,hash:u})}function _s(){return S.useContext(zs)!=null}function ua(){return lt(_s(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(zs).location}var Tg="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ag(n){S.useContext(Bn).static||S.useLayoutEffect(n)}function Eg(){let{isDataRoute:n}=S.useContext(Va);return n?F1():L1()}function L1(){lt(_s(),"useNavigate() may be used only in the context of a <Router> component.");let n=S.useContext(vi),{basename:l,navigator:o}=S.useContext(Bn),{matches:i}=S.useContext(Va),{pathname:u}=ua(),f=JSON.stringify(bg(i)),v=S.useRef(!1);return Ag(()=>{v.current=!0}),S.useCallback((p,x={})=>{if(Gn(v.current,Tg),!v.current)return;if(typeof p=="number"){o.go(p);return}let y=Pf(p,JSON.parse(f),u,x.relative==="path");n==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:Yn([l,y.pathname])),(x.replace?o.replace:o.push)(y,x.state,x)},[l,o,f,u,n])}S.createContext(null);function Os(n,{relative:l}={}){let{matches:o}=S.useContext(Va),{pathname:i}=ua(),u=JSON.stringify(bg(o));return S.useMemo(()=>Pf(n,JSON.parse(u),i,l==="path"),[n,u,i,l])}function B1(n,l){return kg(n,l)}function kg(n,l,o){var D;lt(_s(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=S.useContext(Bn),{matches:u}=S.useContext(Va),f=u[u.length-1],v=f?f.params:{},h=f?f.pathname:"/",p=f?f.pathnameBase:"/",x=f&&f.route;{let R=x&&x.path||"";zg(h,!x||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${R}">) 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="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let y=ua(),g;if(l){let R=typeof l=="string"?pi(l):l;lt(p==="/"||((D=R.pathname)==null?void 0:D.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 "${R.pathname}" was given in the \`location\` prop.`),g=R}else g=y;let j=g.pathname||"/",M=j;if(p!=="/"){let R=p.replace(/^\//,"").split("/");M="/"+j.replace(/^\//,"").split("/").slice(R.length).join("/")}let T=o&&o.state.matches.length?o.state.matches.map(R=>Object.assign(R,{route:o.manifest[R.route.id]||R.route})):vg(n,{pathname:M});Gn(x||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Gn(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=H1(T&&T.map(R=>Object.assign({},R,{params:Object.assign({},v,R.params),pathname:Yn([p,i.encodeLocation?i.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?p:Yn([p,i.encodeLocation?i.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),u,o);return l&&E?S.createElement(zs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},E):E}function q1(){let n=X1(),l=C1(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),o=n instanceof Error?n.stack:null,i="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:i},f={padding:"2px 4px",backgroundColor:i},v=null;return console.error("Error handled by React Router default ErrorBoundary:",n),v=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),o?S.createElement("pre",{style:u},o):null,v)}var P1=S.createElement(q1,null),Rg=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 o=D1(n.digest);o&&(n=o)}let l=n!==void 0?S.createElement(Va.Provider,{value:this.props.routeContext},S.createElement($f.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?S.createElement($1,{error:n},l):l}};Rg.contextType=Mg;var Xd=new WeakMap;function $1({children:n,error:l}){let{basename:o}=S.useContext(Bn);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let i=O1(l.digest);if(i){let u=Xd.get(l);if(u)throw u;let f=jg(i.location,o);if(Sg&&!Xd.get(l))if(f.isExternal||i.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const v=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:i.replace}));throw Xd.set(l,v),v}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return n}function Q1({routeContext:n,match:l,children:o}){let i=S.useContext(vi);return i&&i.static&&i.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=l.route.id),S.createElement(Va.Provider,{value:n},o)}function H1(n,l=[],o){let i=o==null?void 0:o.state;if(n==null){if(!i)return null;if(i.errors)n=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let u=n,f=i==null?void 0:i.errors;if(f!=null){let y=u.findIndex(g=>g.route.id&&(f==null?void 0:f[g.route.id])!==void 0);lt(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 v=!1,h=-1;if(o&&i){v=i.renderFallback;for(let y=0;y<u.length;y++){let g=u[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(h=y),g.route.id){let{loaderData:j,errors:M}=i,T=g.route.loader&&!j.hasOwnProperty(g.route.id)&&(!M||M[g.route.id]===void 0);if(g.route.lazy||T){o.isStatic&&(v=!0),h>=0?u=u.slice(0,h+1):u=[u[0]];break}}}}let p=o==null?void 0:o.onError,x=i&&p?(y,g)=>{var j,M;p(y,{location:i.location,params:((M=(j=i.matches)==null?void 0:j[0])==null?void 0:M.params)??{},pattern:T1(i.matches),errorInfo:g})}:void 0;return u.reduceRight((y,g,j)=>{let M,T=!1,E=null,D=null;i&&(M=f&&g.route.id?f[g.route.id]:void 0,E=g.route.errorElement||P1,v&&(h<0&&j===0?(zg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,D=null):h===j&&(T=!0,D=g.route.hydrateFallbackElement||null)));let R=l.concat(u.slice(0,j+1)),U=()=>{let Q;return M?Q=E:T?Q=D:g.route.Component?Q=S.createElement(g.route.Component,null):g.route.element?Q=g.route.element:Q=y,S.createElement(Q1,{match:g,routeContext:{outlet:y,matches:R,isDataRoute:i!=null},children:Q})};return i&&(g.route.ErrorBoundary||g.route.errorElement||j===0)?S.createElement(Rg,{location:i.location,revalidation:i.revalidation,component:E,error:M,children:U(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:x}):U()},null)}function Qf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function K1(n){let l=S.useContext(vi);return lt(l,Qf(n)),l}function Y1(n){let l=S.useContext(Sc);return lt(l,Qf(n)),l}function G1(n){let l=S.useContext(Va);return lt(l,Qf(n)),l}function Hf(n){let l=G1(n),o=l.matches[l.matches.length-1];return lt(o.route.id,`${n} can only be used on routes that contain a unique "id"`),o.route.id}function V1(){return Hf("useRouteId")}function X1(){var i;let n=S.useContext($f),l=Y1("useRouteError"),o=Hf("useRouteError");return n!==void 0?n:(i=l.errors)==null?void 0:i[o]}function F1(){let{router:n}=K1("useNavigate"),l=Hf("useNavigate"),o=S.useRef(!1);return Ag(()=>{o.current=!0}),S.useCallback(async(u,f={})=>{Gn(o.current,Tg),o.current&&(typeof u=="number"?await n.navigate(u):await n.navigate(u,{fromRouteId:l,...f}))},[n,l])}var vx={};function zg(n,l,o){!l&&!vx[n]&&(vx[n]=!0,Gn(!1,o))}S.memo(Z1);function Z1({routes:n,manifest:l,future:o,state:i,isStatic:u,onError:f}){return kg(n,void 0,{manifest:l,state:i,isStatic:u,onError:f})}function ar(n){lt(!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 J1({basename:n="/",children:l=null,location:o,navigationType:i="POP",navigator:u,static:f=!1,useTransitions:v}){lt(!_s(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),p=S.useMemo(()=>({basename:h,navigator:u,static:f,useTransitions:v,future:{}}),[h,u,f,v]);typeof o=="string"&&(o=pi(o));let{pathname:x="/",search:y="",hash:g="",state:j=null,key:M="default",mask:T}=o,E=S.useMemo(()=>{let D=Ga(x,h);return D==null?null:{location:{pathname:D,search:y,hash:g,state:j,key:M,mask:T},navigationType:i}},[h,x,y,g,j,M,i,T]);return Gn(E!=null,`<Router basename="${h}"> is not able to match the URL "${x}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:S.createElement(Bn.Provider,{value:p},S.createElement(zs.Provider,{children:l,value:E}))}function I1({children:n,location:l}){return B1(uf(n),l)}function uf(n,l=[]){let o=[];return S.Children.forEach(n,(i,u)=>{if(!S.isValidElement(i))return;let f=[...l,u];if(i.type===S.Fragment){o.push.apply(o,uf(i.props.children,f));return}lt(i.type===ar,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),lt(!i.props.index||!i.props.children,"An index route cannot have child routes.");let v={id:i.props.id||f.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(v.children=uf(i.props.children,f)),o.push(v)}),o}var oc="get",cc="application/x-www-form-urlencoded";function jc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function W1(n){return jc(n)&&n.tagName.toLowerCase()==="button"}function e2(n){return jc(n)&&n.tagName.toLowerCase()==="form"}function t2(n){return jc(n)&&n.tagName.toLowerCase()==="input"}function n2(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function a2(n,l){return n.button===0&&(!l||l==="_self")&&!n2(n)}function df(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((l,o)=>{let i=n[o];return l.concat(Array.isArray(i)?i.map(u=>[o,u]):[[o,i]])},[]))}function l2(n,l){let o=df(n);return l&&l.forEach((i,u)=>{o.has(u)||l.getAll(u).forEach(f=>{o.append(u,f)})}),o}var tc=null;function r2(){if(tc===null)try{new FormData(document.createElement("form"),0),tc=!1}catch{tc=!0}return tc}var i2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fd(n){return n!=null&&!i2.has(n)?(Gn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${cc}"`),null):n}function s2(n,l){let o,i,u,f,v;if(e2(n)){let h=n.getAttribute("action");i=h?Ga(h,l):null,o=n.getAttribute("method")||oc,u=Fd(n.getAttribute("enctype"))||cc,f=new FormData(n)}else if(W1(n)||t2(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=n.getAttribute("formaction")||h.getAttribute("action");if(i=p?Ga(p,l):null,o=n.getAttribute("formmethod")||h.getAttribute("method")||oc,u=Fd(n.getAttribute("formenctype"))||Fd(h.getAttribute("enctype"))||cc,f=new FormData(h,n),!r2()){let{name:x,type:y,value:g}=n;if(y==="image"){let j=x?`${x}.`:"";f.append(`${j}x`,"0"),f.append(`${j}y`,"0")}else x&&f.append(x,g)}}else{if(jc(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=oc,i=null,u=cc,v=n}return f&&u==="text/plain"&&(v=f,f=void 0),{action:i,method:o.toLowerCase(),encType:u,formData:f,body:v}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Kf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function _g(n,l,o,i){let u=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return o?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${i}`:u.pathname=`${u.pathname}.${i}`:u.pathname==="/"?u.pathname=`_root.${i}`:l&&Ga(u.pathname,l)==="/"?u.pathname=`${hc(l)}/_root.${i}`:u.pathname=`${hc(u.pathname)}.${i}`,u}async function o2(n,l){if(n.id in l)return l[n.id];try{let o=await import(n.module);return l[n.id]=o,o}catch(o){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function c2(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 u2(n,l,o){let i=await Promise.all(n.map(async u=>{let f=l.routes[u.route.id];if(f){let v=await o2(f,o);return v.links?v.links():[]}return[]}));return h2(i.flat(1).filter(c2).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function xx(n,l,o,i,u,f){let v=(p,x)=>o[x]?p.route.id!==o[x].route.id:!0,h=(p,x)=>{var y;return o[x].pathname!==p.pathname||((y=o[x].route.path)==null?void 0:y.endsWith("*"))&&o[x].params["*"]!==p.params["*"]};return f==="assets"?l.filter((p,x)=>v(p,x)||h(p,x)):f==="data"?l.filter((p,x)=>{var g;let y=i.routes[p.route.id];if(!y||!y.hasLoader)return!1;if(v(p,x)||h(p,x))return!0;if(p.route.shouldRevalidate){let j=p.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((g=o[0])==null?void 0:g.params)||{},nextUrl:new URL(n,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof j=="boolean")return j}return!0}):[]}function d2(n,l,{includeHydrateFallback:o}={}){return f2(n.map(i=>{let u=l.routes[i.route.id];if(!u)return[];let f=[u.module];return u.clientActionModule&&(f=f.concat(u.clientActionModule)),u.clientLoaderModule&&(f=f.concat(u.clientLoaderModule)),o&&u.hydrateFallbackModule&&(f=f.concat(u.hydrateFallbackModule)),u.imports&&(f=f.concat(u.imports)),f}).flat(1))}function f2(n){return[...new Set(n)]}function m2(n){let l={},o=Object.keys(n).sort();for(let i of o)l[i]=n[i];return l}function h2(n,l){let o=new Set;return new Set(l),n.reduce((i,u)=>{let f=JSON.stringify(m2(u));return o.has(f)||(o.add(f),i.push({key:f,link:u})),i},[])}function Yf(){let n=S.useContext(vi);return Kf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function p2(){let n=S.useContext(Sc);return Kf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Gf=S.createContext(void 0);Gf.displayName="FrameworkContext";function Vf(){let n=S.useContext(Gf);return Kf(n,"You must render this element inside a <HydratedRouter> element"),n}function v2(n,l){let o=S.useContext(Gf),[i,u]=S.useState(!1),[f,v]=S.useState(!1),{onFocus:h,onBlur:p,onMouseEnter:x,onMouseLeave:y,onTouchStart:g}=l,j=S.useRef(null);S.useEffect(()=>{if(n==="render"&&v(!0),n==="viewport"){let E=R=>{R.forEach(U=>{v(U.isIntersecting)})},D=new IntersectionObserver(E,{threshold:.5});return j.current&&D.observe(j.current),()=>{D.disconnect()}}},[n]),S.useEffect(()=>{if(i){let E=setTimeout(()=>{v(!0)},100);return()=>{clearTimeout(E)}}},[i]);let M=()=>{u(!0)},T=()=>{u(!1),v(!1)};return o?n!=="intent"?[f,j,{}]:[f,j,{onFocus:ds(h,M),onBlur:ds(p,T),onMouseEnter:ds(x,M),onMouseLeave:ds(y,T),onTouchStart:ds(g,M)}]:[!1,j,{}]}function ds(n,l){return o=>{n&&n(o),o.defaultPrevented||l(o)}}function x2({page:n,...l}){let o=E1(),{router:i}=Yf(),u=S.useMemo(()=>vg(i.routes,n,i.basename),[i.routes,n,i.basename]);return u?o?S.createElement(b2,{page:n,matches:u,...l}):S.createElement(y2,{page:n,matches:u,...l}):null}function g2(n){let{manifest:l,routeModules:o}=Vf(),[i,u]=S.useState([]);return S.useEffect(()=>{let f=!1;return u2(n,l,o).then(v=>{f||u(v)}),()=>{f=!0}},[n,l,o]),i}function b2({page:n,matches:l,...o}){let i=ua(),{future:u}=Vf(),{basename:f}=Yf(),v=S.useMemo(()=>{if(n===i.pathname+i.search+i.hash)return[];let h=_g(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&&h.searchParams.set("_routes",x.join(",")),[h.pathname+h.search]},[f,u.v8_trailingSlashAwareDataRequests,n,i,l]);return S.createElement(S.Fragment,null,v.map(h=>S.createElement("link",{key:h,rel:"prefetch",as:"fetch",href:h,...o})))}function y2({page:n,matches:l,...o}){let i=ua(),{future:u,manifest:f,routeModules:v}=Vf(),{basename:h}=Yf(),{loaderData:p,matches:x}=p2(),y=S.useMemo(()=>xx(n,l,x,f,i,"data"),[n,l,x,f,i]),g=S.useMemo(()=>xx(n,l,x,f,i,"assets"),[n,l,x,f,i]),j=S.useMemo(()=>{if(n===i.pathname+i.search+i.hash)return[];let E=new Set,D=!1;if(l.forEach(U=>{var H;let Q=f.routes[U.route.id];!Q||!Q.hasLoader||(!y.some(G=>G.route.id===U.route.id)&&U.route.id in p&&((H=v[U.route.id])!=null&&H.shouldRevalidate)||Q.hasClientLoader?D=!0:E.add(U.route.id))}),E.size===0)return[];let R=_g(n,h,u.v8_trailingSlashAwareDataRequests,"data");return D&&E.size>0&&R.searchParams.set("_routes",l.filter(U=>E.has(U.route.id)).map(U=>U.route.id).join(",")),[R.pathname+R.search]},[h,u.v8_trailingSlashAwareDataRequests,p,i,f,y,l,n,v]),M=S.useMemo(()=>d2(g,f),[g,f]),T=g2(g);return S.createElement(S.Fragment,null,j.map(E=>S.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...o})),M.map(E=>S.createElement("link",{key:E,rel:"modulepreload",href:E,...o})),T.map(({key:E,link:D})=>S.createElement("link",{key:E,nonce:o.nonce,...D,crossOrigin:D.crossOrigin??o.crossOrigin})))}function S2(...n){return l=>{n.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var j2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{j2&&(window.__reactRouterVersion="7.17.0")}catch{}function N2({basename:n,children:l,useTransitions:o,window:i}){let u=S.useRef();u.current==null&&(u.current=t1({window:i,v5Compat:!0}));let f=u.current,[v,h]=S.useState({action:f.action,location:f.location}),p=S.useCallback(x=>{o===!1?h(x):S.startTransition(()=>h(x))},[o]);return S.useLayoutEffect(()=>f.listen(p),[f,p]),S.createElement(J1,{basename:n,children:l,location:v.location,navigationType:v.action,navigator:f,useTransitions:o})}var Og=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vr=S.forwardRef(function({onClick:l,discover:o="render",prefetch:i="none",relative:u,reloadDocument:f,replace:v,mask:h,state:p,target:x,to:y,preventScrollReset:g,viewTransition:j,defaultShouldRevalidate:M,...T},E){let{basename:D,navigator:R,useTransitions:U}=S.useContext(Bn),Q=typeof y=="string"&&Og.test(y),H=jg(y,D);y=H.to;let G=U1(y,{relative:u}),K=ua(),$=null;if(h){let fe=Pf(h,[],K.mask?K.mask.pathname:"/",!0);D!=="/"&&(fe.pathname=fe.pathname==="/"?D:Yn([D,fe.pathname])),$=R.createHref(fe)}let[I,Z,ne]=v2(i,T),B=C2(y,{replace:v,mask:h,state:p,target:x,preventScrollReset:g,relative:u,viewTransition:j,defaultShouldRevalidate:M,useTransitions:U});function ie(fe){l&&l(fe),fe.defaultPrevented||B(fe)}let te=!(H.isExternal||f),xe=S.createElement("a",{...T,...ne,href:(te?$:void 0)||H.absoluteURL||G,onClick:te?ie:l,ref:S2(E,Z),target:x,"data-discover":!Q&&o==="render"?"true":void 0});return I&&!Q?S.createElement(S.Fragment,null,xe,S.createElement(x2,{page:G})):xe});vr.displayName="Link";var Xf=S.forwardRef(function({"aria-current":l="page",caseSensitive:o=!1,className:i="",end:u=!1,style:f,to:v,viewTransition:h,children:p,...x},y){let g=Os(v,{relative:x.relative}),j=ua(),M=S.useContext(Sc),{navigator:T,basename:E}=S.useContext(Bn),D=M!=null&&z2(g)&&h===!0,R=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,U=j.pathname,Q=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;o||(U=U.toLowerCase(),Q=Q?Q.toLowerCase():null,R=R.toLowerCase()),Q&&E&&(Q=Ga(Q,E)||Q);const H=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let G=U===R||!u&&U.startsWith(R)&&U.charAt(H)==="/",K=Q!=null&&(Q===R||!u&&Q.startsWith(R)&&Q.charAt(R.length)==="/"),$={isActive:G,isPending:K,isTransitioning:D},I=G?l:void 0,Z;typeof i=="function"?Z=i($):Z=[i,G?"active":null,K?"pending":null,D?"transitioning":null].filter(Boolean).join(" ");let ne=typeof f=="function"?f($):f;return S.createElement(vr,{...x,"aria-current":I,className:Z,ref:y,style:ne,to:v,viewTransition:h},typeof p=="function"?p($):p)});Xf.displayName="NavLink";var M2=S.forwardRef(({discover:n="render",fetcherKey:l,navigate:o,reloadDocument:i,replace:u,state:f,method:v=oc,action:h,onSubmit:p,relative:x,preventScrollReset:y,viewTransition:g,defaultShouldRevalidate:j,...M},T)=>{let{useTransitions:E}=S.useContext(Bn),D=k2(),R=R2(h,{relative:x}),U=v.toLowerCase()==="get"?"get":"post",Q=typeof h=="string"&&Og.test(h),H=G=>{if(p&&p(G),G.defaultPrevented)return;G.preventDefault();let K=G.nativeEvent.submitter,$=(K==null?void 0:K.getAttribute("formmethod"))||v,I=()=>D(K||G.currentTarget,{fetcherKey:l,method:$,navigate:o,replace:u,state:f,relative:x,preventScrollReset:y,viewTransition:g,defaultShouldRevalidate:j});E&&o!==!1?S.startTransition(()=>I()):I()};return S.createElement("form",{ref:T,method:U,action:R,onSubmit:i?p:H,...M,"data-discover":!Q&&n==="render"?"true":void 0})});M2.displayName="Form";function w2(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Dg(n){let l=S.useContext(vi);return lt(l,w2(n)),l}function C2(n,{target:l,replace:o,mask:i,state:u,preventScrollReset:f,relative:v,viewTransition:h,defaultShouldRevalidate:p,useTransitions:x}={}){let y=Eg(),g=ua(),j=Os(n,{relative:v});return S.useCallback(M=>{if(a2(M,l)){M.preventDefault();let T=o!==void 0?o:ys(g)===ys(j),E=()=>y(n,{replace:T,mask:i,state:u,preventScrollReset:f,relative:v,viewTransition:h,defaultShouldRevalidate:p});x?S.startTransition(()=>E()):E()}},[g,y,j,o,i,u,l,n,f,v,h,p,x])}function T2(n){Gn(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(df(n)),o=S.useRef(!1),i=ua(),u=S.useMemo(()=>l2(i.search,o.current?null:l.current),[i.search]),f=Eg(),v=S.useCallback((h,p)=>{const x=df(typeof h=="function"?h(new URLSearchParams(u)):h);o.current=!0,f("?"+x,p)},[f,u]);return[u,v]}var A2=0,E2=()=>`__${String(++A2)}__`;function k2(){let{router:n}=Dg("useSubmit"),{basename:l}=S.useContext(Bn),o=V1(),i=n.fetch,u=n.navigate;return S.useCallback(async(f,v={})=>{let{action:h,method:p,encType:x,formData:y,body:g}=s2(f,l);if(v.navigate===!1){let j=v.fetcherKey||E2();await i(j,o,v.action||h,{defaultShouldRevalidate:v.defaultShouldRevalidate,preventScrollReset:v.preventScrollReset,formData:y,body:g,formMethod:v.method||p,formEncType:v.encType||x,flushSync:v.flushSync})}else await u(v.action||h,{defaultShouldRevalidate:v.defaultShouldRevalidate,preventScrollReset:v.preventScrollReset,formData:y,body:g,formMethod:v.method||p,formEncType:v.encType||x,replace:v.replace,state:v.state,fromRouteId:o,flushSync:v.flushSync,viewTransition:v.viewTransition})},[i,u,l,o])}function R2(n,{relative:l}={}){let{basename:o}=S.useContext(Bn),i=S.useContext(Va);lt(i,"useFormAction must be used inside a RouteContext");let[u]=i.matches.slice(-1),f={...Os(n||".",{relative:l})},v=ua();if(n==null){f.search=v.search;let h=new URLSearchParams(f.search),p=h.getAll("index");if(p.some(y=>y==="")){h.delete("index"),p.filter(g=>g).forEach(g=>h.append("index",g));let y=h.toString();f.search=y?`?${y}`:""}}return(!n||n===".")&&u.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(f.pathname=f.pathname==="/"?o:Yn([o,f.pathname])),ys(f)}function z2(n,{relative:l}={}){let o=S.useContext(wg);lt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Dg("useViewTransitionState"),u=Os(n,{relative:l});if(!o.isTransitioning)return!1;let f=Ga(o.currentLocation.pathname,i)||o.currentLocation.pathname,v=Ga(o.nextLocation.pathname,i)||o.nextLocation.pathname;return mc(u.pathname,v)!=null||mc(u.pathname,f)!=null}var _2=pg(),xi=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(){}},rr,wl,ni,lg,O2=(lg=class extends xi{constructor(){super();me(this,rr);me(this,wl);me(this,ni);se(this,ni,l=>{if(typeof window<"u"&&window.addEventListener){const o=()=>l();return window.addEventListener("visibilitychange",o,!1),()=>{window.removeEventListener("visibilitychange",o)}}})}onSubscribe(){C(this,wl)||this.setEventListener(C(this,ni))}onUnsubscribe(){var l;this.hasListeners()||((l=C(this,wl))==null||l.call(this),se(this,wl,void 0))}setEventListener(l){var o;se(this,ni,l),(o=C(this,wl))==null||o.call(this),se(this,wl,l(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(l){C(this,rr)!==l&&(se(this,rr,l),this.onFocus())}onFocus(){const l=this.isFocused();this.listeners.forEach(o=>{o(l)})}isFocused(){var l;return typeof C(this,rr)=="boolean"?C(this,rr):((l=globalThis.document)==null?void 0:l.visibilityState)!=="hidden"}},rr=new WeakMap,wl=new WeakMap,ni=new WeakMap,lg),Ff=new O2,D2={setTimeout:(n,l)=>setTimeout(n,l),clearTimeout:n=>clearTimeout(n),setInterval:(n,l)=>setInterval(n,l),clearInterval:n=>clearInterval(n)},Cl,Bf,rg,U2=(rg=class{constructor(){me(this,Cl,D2);me(this,Bf,!1)}setTimeoutProvider(n){se(this,Cl,n)}setTimeout(n,l){return C(this,Cl).setTimeout(n,l)}clearTimeout(n){C(this,Cl).clearTimeout(n)}setInterval(n,l){return C(this,Cl).setInterval(n,l)}clearInterval(n){C(this,Cl).clearInterval(n)}},Cl=new WeakMap,Bf=new WeakMap,rg),lr=new U2;function L2(n){setTimeout(n,0)}var B2=typeof window>"u"||"Deno"in globalThis;function Kt(){}function q2(n,l){return typeof n=="function"?n(l):n}function ff(n){return typeof n=="number"&&n>=0&&n!==1/0}function Ug(n,l){return Math.max(n+(l||0)-Date.now(),0)}function Ol(n,l){return typeof n=="function"?n(l):n}function gn(n,l){return typeof n=="function"?n(l):n}function gx(n,l){const{type:o="all",exact:i,fetchStatus:u,predicate:f,queryKey:v,stale:h}=n;if(v){if(i){if(l.queryHash!==Zf(v,l.options))return!1}else if(!Ss(l.queryKey,v))return!1}if(o!=="all"){const p=l.isActive();if(o==="active"&&!p||o==="inactive"&&p)return!1}return!(typeof h=="boolean"&&l.isStale()!==h||u&&u!==l.state.fetchStatus||f&&!f(l))}function bx(n,l){const{exact:o,status:i,predicate:u,mutationKey:f}=n;if(f){if(!l.options.mutationKey)return!1;if(o){if(hr(l.options.mutationKey)!==hr(f))return!1}else if(!Ss(l.options.mutationKey,f))return!1}return!(i&&l.state.status!==i||u&&!u(l))}function Zf(n,l){return((l==null?void 0:l.queryKeyHashFn)||hr)(n)}function hr(n){return JSON.stringify(n,(l,o)=>mf(o)?Object.keys(o).sort().reduce((i,u)=>(i[u]=o[u],i),{}):o)}function Ss(n,l){return n===l?!0:typeof n!=typeof l?!1:n&&l&&typeof n=="object"&&typeof l=="object"?Object.keys(l).every(o=>Ss(n[o],l[o])):!1}var P2=Object.prototype.hasOwnProperty;function Lg(n,l,o=0){if(n===l)return n;if(o>500)return l;const i=yx(n)&&yx(l);if(!i&&!(mf(n)&&mf(l)))return l;const f=(i?n:Object.keys(n)).length,v=i?l:Object.keys(l),h=v.length,p=i?new Array(h):{};let x=0;for(let y=0;y<h;y++){const g=i?y:v[y],j=n[g],M=l[g];if(j===M){p[g]=j,(i?y<f:P2.call(n,g))&&x++;continue}if(j===null||M===null||typeof j!="object"||typeof M!="object"){p[g]=M;continue}const T=Lg(j,M,o+1);p[g]=T,T===j&&x++}return f===h&&x===f?n:p}function pc(n,l){if(!l||Object.keys(n).length!==Object.keys(l).length)return!1;for(const o in n)if(n[o]!==l[o])return!1;return!0}function yx(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function mf(n){if(!Sx(n))return!1;const l=n.constructor;if(l===void 0)return!0;const o=l.prototype;return!(!Sx(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function Sx(n){return Object.prototype.toString.call(n)==="[object Object]"}function $2(n){return new Promise(l=>{lr.setTimeout(l,n)})}function hf(n,l,o){return typeof o.structuralSharing=="function"?o.structuralSharing(n,l):o.structuralSharing!==!1?Lg(n,l):l}function Q2(n,l,o=0){const i=[...n,l];return o&&i.length>o?i.slice(1):i}function H2(n,l,o=0){const i=[l,...n];return o&&i.length>o?i.slice(0,-1):i}var Jf=Symbol();function Bg(n,l){return!n.queryFn&&(l!=null&&l.initialPromise)?()=>l.initialPromise:!n.queryFn||n.queryFn===Jf?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function If(n,l){return typeof n=="function"?n(...l):!!n}function K2(n,l,o){let i=!1,u;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(u??(u=l()),i||(i=!0,u.aborted?o():u.addEventListener("abort",o,{once:!0})),u)}),n}var js=(()=>{let n=()=>B2;return{isServer(){return n()},setIsServer(l){n=l}}})();function pf(){let n,l;const o=new Promise((u,f)=>{n=u,l=f});o.status="pending",o.catch(()=>{});function i(u){Object.assign(o,u),delete o.resolve,delete o.reject}return o.resolve=u=>{i({status:"fulfilled",value:u}),n(u)},o.reject=u=>{i({status:"rejected",reason:u}),l(u)},o}var Y2=L2;function G2(){let n=[],l=0,o=h=>{h()},i=h=>{h()},u=Y2;const f=h=>{l?n.push(h):u(()=>{o(h)})},v=()=>{const h=n;n=[],h.length&&u(()=>{i(()=>{h.forEach(p=>{o(p)})})})};return{batch:h=>{let p;l++;try{p=h()}finally{l--,l||v()}return p},batchCalls:h=>(...p)=>{f(()=>{h(...p)})},schedule:f,setNotifyFunction:h=>{o=h},setBatchNotifyFunction:h=>{i=h},setScheduler:h=>{u=h}}}var Mt=G2(),ai,Tl,li,ig,V2=(ig=class extends xi{constructor(){super();me(this,ai,!0);me(this,Tl);me(this,li);se(this,li,l=>{if(typeof window<"u"&&window.addEventListener){const o=()=>l(!0),i=()=>l(!1);return window.addEventListener("online",o,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",i)}}})}onSubscribe(){C(this,Tl)||this.setEventListener(C(this,li))}onUnsubscribe(){var l;this.hasListeners()||((l=C(this,Tl))==null||l.call(this),se(this,Tl,void 0))}setEventListener(l){var o;se(this,li,l),(o=C(this,Tl))==null||o.call(this),se(this,Tl,l(this.setOnline.bind(this)))}setOnline(l){C(this,ai)!==l&&(se(this,ai,l),this.listeners.forEach(i=>{i(l)}))}isOnline(){return C(this,ai)}},ai=new WeakMap,Tl=new WeakMap,li=new WeakMap,ig),vc=new V2;function X2(n){return Math.min(1e3*2**n,3e4)}function qg(n){return(n??"online")==="online"?vc.isOnline():!0}var vf=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function Pg(n){let l=!1,o=0,i;const u=pf(),f=()=>u.status!=="pending",v=E=>{var D;if(!f()){const R=new vf(E);j(R),(D=n.onCancel)==null||D.call(n,R)}},h=()=>{l=!0},p=()=>{l=!1},x=()=>Ff.isFocused()&&(n.networkMode==="always"||vc.isOnline())&&n.canRun(),y=()=>qg(n.networkMode)&&n.canRun(),g=E=>{f()||(i==null||i(),u.resolve(E))},j=E=>{f()||(i==null||i(),u.reject(E))},M=()=>new Promise(E=>{var D;i=R=>{(f()||x())&&E(R)},(D=n.onPause)==null||D.call(n)}).then(()=>{var E;i=void 0,f()||(E=n.onContinue)==null||E.call(n)}),T=()=>{if(f())return;let E;const D=o===0?n.initialPromise:void 0;try{E=D??n.fn()}catch(R){E=Promise.reject(R)}Promise.resolve(E).then(g).catch(R=>{var K;if(f())return;const U=n.retry??(js.isServer()?0:3),Q=n.retryDelay??X2,H=typeof Q=="function"?Q(o,R):Q,G=U===!0||typeof U=="number"&&o<U||typeof U=="function"&&U(o,R);if(l||!G){j(R);return}o++,(K=n.onFail)==null||K.call(n,o,R),$2(H).then(()=>x()?void 0:M()).then(()=>{l?j(R):T()})})};return{promise:u,status:()=>u.status,cancel:v,continue:()=>(i==null||i(),u),cancelRetry:h,continueRetry:p,canStart:y,start:()=>(y()?T():M().then(T),u)}}var ir,sg,$g=(sg=class{constructor(){me(this,ir)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ff(this.gcTime)&&se(this,ir,lr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(js.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,ir)!==void 0&&(lr.clearTimeout(C(this,ir)),se(this,ir,void 0))}},ir=new WeakMap,sg);function F2(n){return{onFetch:(l,o)=>{var y,g,j,M,T;const i=l.options,u=(j=(g=(y=l.fetchOptions)==null?void 0:y.meta)==null?void 0:g.fetchMore)==null?void 0:j.direction,f=((M=l.state.data)==null?void 0:M.pages)||[],v=((T=l.state.data)==null?void 0:T.pageParams)||[];let h={pages:[],pageParams:[]},p=0;const x=async()=>{let E=!1;const D=Q=>{K2(Q,()=>l.signal,()=>E=!0)},R=Bg(l.options,l.fetchOptions),U=async(Q,H,G)=>{if(E)return Promise.reject(l.signal.reason);if(H==null&&Q.pages.length)return Promise.resolve(Q);const $=(()=>{const B={client:l.client,queryKey:l.queryKey,pageParam:H,direction:G?"backward":"forward",meta:l.options.meta};return D(B),B})(),I=await R($),{maxPages:Z}=l.options,ne=G?H2:Q2;return{pages:ne(Q.pages,I,Z),pageParams:ne(Q.pageParams,H,Z)}};if(u&&f.length){const Q=u==="backward",H=Q?Z2:jx,G={pages:f,pageParams:v},K=H(i,G);h=await U(G,K,Q)}else{const Q=n??f.length;do{const H=p===0?v[0]??i.initialPageParam:jx(i,h);if(p>0&&H==null)break;h=await U(h,H),p++}while(p<Q)}return h};l.options.persister?l.fetchFn=()=>{var E,D;return(D=(E=l.options).persister)==null?void 0:D.call(E,x,{client:l.client,queryKey:l.queryKey,meta:l.options.meta,signal:l.signal},o)}:l.fetchFn=x}}}function jx(n,{pages:l,pageParams:o}){const i=l.length-1;return l.length>0?n.getNextPageParam(l[i],l,o[i],o):void 0}function Z2(n,{pages:l,pageParams:o}){var i;return l.length>0?(i=n.getPreviousPageParam)==null?void 0:i.call(n,l[0],l,o[0],o):void 0}var ri,sr,ii,Un,or,Tt,Ts,cr,xn,Qg,qa,og,J2=(og=class extends $g{constructor(l){super();me(this,xn);me(this,ri);me(this,sr);me(this,ii);me(this,Un);me(this,or);me(this,Tt);me(this,Ts);me(this,cr);se(this,cr,!1),se(this,Ts,l.defaultOptions),this.setOptions(l.options),this.observers=[],se(this,or,l.client),se(this,Un,C(this,or).getQueryCache()),this.queryKey=l.queryKey,this.queryHash=l.queryHash,se(this,sr,Mx(this.options)),this.state=l.state??C(this,sr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,ri)}get promise(){var l;return(l=C(this,Tt))==null?void 0:l.promise}setOptions(l){if(this.options={...C(this,Ts),...l},l!=null&&l._type&&se(this,ri,l._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const o=Mx(this.options);o.data!==void 0&&(this.setState(Nx(o.data,o.dataUpdatedAt)),se(this,sr,o))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,Un).remove(this)}setData(l,o){const i=hf(this.state.data,l,this.options);return we(this,xn,qa).call(this,{data:i,type:"success",dataUpdatedAt:o==null?void 0:o.updatedAt,manual:o==null?void 0:o.manual}),i}setState(l){we(this,xn,qa).call(this,{type:"setState",state:l})}cancel(l){var i,u;const o=(i=C(this,Tt))==null?void 0:i.promise;return(u=C(this,Tt))==null||u.cancel(l),o?o.then(Kt).catch(Kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,sr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(l=>gn(l.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(l=>Ol(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:!Ug(this.state.dataUpdatedAt,l)}onFocus(){var o;const l=this.observers.find(i=>i.shouldFetchOnWindowFocus());l==null||l.refetch({cancelRefetch:!1}),(o=C(this,Tt))==null||o.continue()}onOnline(){var o;const l=this.observers.find(i=>i.shouldFetchOnReconnect());l==null||l.refetch({cancelRefetch:!1}),(o=C(this,Tt))==null||o.continue()}addObserver(l){this.observers.includes(l)||(this.observers.push(l),this.clearGcTimeout(),C(this,Un).notify({type:"observerAdded",query:this,observer:l}))}removeObserver(l){this.observers.includes(l)&&(this.observers=this.observers.filter(o=>o!==l),this.observers.length||(C(this,Tt)&&(C(this,cr)||we(this,xn,Qg).call(this)?C(this,Tt).cancel({revert:!0}):C(this,Tt).cancelRetry()),this.scheduleGc()),C(this,Un).notify({type:"observerRemoved",query:this,observer:l}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||we(this,xn,qa).call(this,{type:"invalidate"})}async fetch(l,o){var x,y,g,j,M,T,E,D,R,U,Q;if(this.state.fetchStatus!=="idle"&&((x=C(this,Tt))==null?void 0:x.status())!=="rejected"){if(this.state.data!==void 0&&(o!=null&&o.cancelRefetch))this.cancel({silent:!0});else if(C(this,Tt))return C(this,Tt).continueRetry(),C(this,Tt).promise}if(l&&this.setOptions(l),!this.options.queryFn){const H=this.observers.find(G=>G.options.queryFn);H&&this.setOptions(H.options)}const i=new AbortController,u=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(se(this,cr,!0),i.signal)})},f=()=>{const H=Bg(this.options,o),K=(()=>{const $={client:C(this,or),queryKey:this.queryKey,meta:this.meta};return u($),$})();return se(this,cr,!1),this.options.persister?this.options.persister(H,K,this):H(K)},h=(()=>{const H={fetchOptions:o,options:this.options,queryKey:this.queryKey,client:C(this,or),state:this.state,fetchFn:f};return u(H),H})(),p=C(this,ri)==="infinite"?F2(this.options.pages):this.options.behavior;p==null||p.onFetch(h,this),se(this,ii,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=h.fetchOptions)==null?void 0:y.meta))&&we(this,xn,qa).call(this,{type:"fetch",meta:(g=h.fetchOptions)==null?void 0:g.meta}),se(this,Tt,Pg({initialPromise:o==null?void 0:o.initialPromise,fn:h.fetchFn,onCancel:H=>{H instanceof vf&&H.revert&&this.setState({...C(this,ii),fetchStatus:"idle"}),i.abort()},onFail:(H,G)=>{we(this,xn,qa).call(this,{type:"failed",failureCount:H,error:G})},onPause:()=>{we(this,xn,qa).call(this,{type:"pause"})},onContinue:()=>{we(this,xn,qa).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const H=await C(this,Tt).start();if(H===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(H),(M=(j=C(this,Un).config).onSuccess)==null||M.call(j,H,this),(E=(T=C(this,Un).config).onSettled)==null||E.call(T,H,this.state.error,this),H}catch(H){if(H instanceof vf){if(H.silent)return C(this,Tt).promise;if(H.revert){if(this.state.data===void 0)throw H;return this.state.data}}throw we(this,xn,qa).call(this,{type:"error",error:H}),(R=(D=C(this,Un).config).onError)==null||R.call(D,H,this),(Q=(U=C(this,Un).config).onSettled)==null||Q.call(U,this.state.data,H,this),H}finally{this.scheduleGc()}}},ri=new WeakMap,sr=new WeakMap,ii=new WeakMap,Un=new WeakMap,or=new WeakMap,Tt=new WeakMap,Ts=new WeakMap,cr=new WeakMap,xn=new WeakSet,Qg=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},qa=function(l){const o=i=>{switch(l.type){case"failed":return{...i,fetchFailureCount:l.failureCount,fetchFailureReason:l.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Hg(i.data,this.options),fetchMeta:l.meta??null};case"success":const u={...i,...Nx(l.data,l.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!l.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return se(this,ii,l.manual?u:void 0),u;case"error":const f=l.error;return{...i,error:f,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...l.state}}};this.state=o(this.state),Mt.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),C(this,Un).notify({query:this,type:"updated",action:l})})},og);function Hg(n,l){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qg(l.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function Nx(n,l){return{data:n,dataUpdatedAt:l??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Mx(n){const l=typeof n.initialData=="function"?n.initialData():n.initialData,o=l!==void 0,i=o?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:l,dataUpdateCount:0,dataUpdatedAt:o?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var It,ze,As,Ht,ur,si,Pa,Al,Es,oi,ci,dr,fr,El,ui,$e,vs,xf,gf,bf,yf,Sf,jf,Nf,Kg,cg,I2=(cg=class extends xi{constructor(l,o){super();me(this,$e);me(this,It);me(this,ze);me(this,As);me(this,Ht);me(this,ur);me(this,si);me(this,Pa);me(this,Al);me(this,Es);me(this,oi);me(this,ci);me(this,dr);me(this,fr);me(this,El);me(this,ui,new Set);this.options=o,se(this,It,l),se(this,Al,null),se(this,Pa,pf()),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ze).addObserver(this),wx(C(this,ze),this.options)?we(this,$e,vs).call(this):this.updateResult(),we(this,$e,yf).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Mf(C(this,ze),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Mf(C(this,ze),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,we(this,$e,Sf).call(this),we(this,$e,jf).call(this),C(this,ze).removeObserver(this)}setOptions(l){const o=this.options,i=C(this,ze);if(this.options=C(this,It).defaultQueryOptions(l),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof gn(this.options.enabled,C(this,ze))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");we(this,$e,Nf).call(this),C(this,ze).setOptions(this.options),o._defaulted&&!pc(this.options,o)&&C(this,It).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ze),observer:this});const u=this.hasListeners();u&&Cx(C(this,ze),i,this.options,o)&&we(this,$e,vs).call(this),this.updateResult(),u&&(C(this,ze)!==i||gn(this.options.enabled,C(this,ze))!==gn(o.enabled,C(this,ze))||Ol(this.options.staleTime,C(this,ze))!==Ol(o.staleTime,C(this,ze)))&&we(this,$e,xf).call(this);const f=we(this,$e,gf).call(this);u&&(C(this,ze)!==i||gn(this.options.enabled,C(this,ze))!==gn(o.enabled,C(this,ze))||f!==C(this,El))&&we(this,$e,bf).call(this,f)}getOptimisticResult(l){const o=C(this,It).getQueryCache().build(C(this,It),l),i=this.createResult(o,l);return eS(this,i)&&(se(this,Ht,i),se(this,si,this.options),se(this,ur,C(this,ze).state)),i}getCurrentResult(){return C(this,Ht)}trackResult(l,o){return new Proxy(l,{get:(i,u)=>(this.trackProp(u),o==null||o(u),u==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,Pa).status==="pending"&&C(this,Pa).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,u))})}trackProp(l){C(this,ui).add(l)}getCurrentQuery(){return C(this,ze)}refetch({...l}={}){return this.fetch({...l})}fetchOptimistic(l){const o=C(this,It).defaultQueryOptions(l),i=C(this,It).getQueryCache().build(C(this,It),o);return i.fetch().then(()=>this.createResult(i,o))}fetch(l){return we(this,$e,vs).call(this,{...l,cancelRefetch:l.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,Ht)))}createResult(l,o){var Z;const i=C(this,ze),u=this.options,f=C(this,Ht),v=C(this,ur),h=C(this,si),x=l!==i?l.state:C(this,As),{state:y}=l;let g={...y},j=!1,M;if(o._optimisticResults){const ne=this.hasListeners(),B=!ne&&wx(l,o),ie=ne&&Cx(l,i,o,u);(B||ie)&&(g={...g,...Hg(y.data,l.options)}),o._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:T,errorUpdatedAt:E,status:D}=g;M=g.data;let R=!1;if(o.placeholderData!==void 0&&M===void 0&&D==="pending"){let ne;f!=null&&f.isPlaceholderData&&o.placeholderData===(h==null?void 0:h.placeholderData)?(ne=f.data,R=!0):ne=typeof o.placeholderData=="function"?o.placeholderData((Z=C(this,ci))==null?void 0:Z.state.data,C(this,ci)):o.placeholderData,ne!==void 0&&(D="success",M=hf(f==null?void 0:f.data,ne,o),j=!0)}if(o.select&&M!==void 0&&!R)if(f&&M===(v==null?void 0:v.data)&&o.select===C(this,Es))M=C(this,oi);else try{se(this,Es,o.select),M=o.select(M),M=hf(f==null?void 0:f.data,M,o),se(this,oi,M),se(this,Al,null)}catch(ne){se(this,Al,ne)}C(this,Al)&&(T=C(this,Al),M=C(this,oi),E=Date.now(),D="error");const U=g.fetchStatus==="fetching",Q=D==="pending",H=D==="error",G=Q&&U,K=M!==void 0,I={status:D,fetchStatus:g.fetchStatus,isPending:Q,isSuccess:D==="success",isError:H,isInitialLoading:G,isLoading:G,data:M,dataUpdatedAt:g.dataUpdatedAt,error:T,errorUpdatedAt:E,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:l.isFetched(),isFetchedAfterMount:g.dataUpdateCount>x.dataUpdateCount||g.errorUpdateCount>x.errorUpdateCount,isFetching:U,isRefetching:U&&!Q,isLoadingError:H&&!K,isPaused:g.fetchStatus==="paused",isPlaceholderData:j,isRefetchError:H&&K,isStale:Wf(l,o),refetch:this.refetch,promise:C(this,Pa),isEnabled:gn(o.enabled,l)!==!1};if(this.options.experimental_prefetchInRender){const ne=I.data!==void 0,B=I.status==="error"&&!ne,ie=fe=>{B?fe.reject(I.error):ne&&fe.resolve(I.data)},te=()=>{const fe=se(this,Pa,I.promise=pf());ie(fe)},xe=C(this,Pa);switch(xe.status){case"pending":l.queryHash===i.queryHash&&ie(xe);break;case"fulfilled":(B||I.data!==xe.value)&&te();break;case"rejected":(!B||I.error!==xe.reason)&&te();break}}return I}updateResult(){const l=C(this,Ht),o=this.createResult(C(this,ze),this.options);if(se(this,ur,C(this,ze).state),se(this,si,this.options),C(this,ur).data!==void 0&&se(this,ci,C(this,ze)),pc(o,l))return;se(this,Ht,o);const i=()=>{if(!l)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!C(this,ui).size)return!0;const v=new Set(f??C(this,ui));return this.options.throwOnError&&v.add("error"),Object.keys(C(this,Ht)).some(h=>{const p=h;return C(this,Ht)[p]!==l[p]&&v.has(p)})};we(this,$e,Kg).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&we(this,$e,yf).call(this)}},It=new WeakMap,ze=new WeakMap,As=new WeakMap,Ht=new WeakMap,ur=new WeakMap,si=new WeakMap,Pa=new WeakMap,Al=new WeakMap,Es=new WeakMap,oi=new WeakMap,ci=new WeakMap,dr=new WeakMap,fr=new WeakMap,El=new WeakMap,ui=new WeakMap,$e=new WeakSet,vs=function(l){we(this,$e,Nf).call(this);let o=C(this,ze).fetch(this.options,l);return l!=null&&l.throwOnError||(o=o.catch(Kt)),o},xf=function(){we(this,$e,Sf).call(this);const l=Ol(this.options.staleTime,C(this,ze));if(js.isServer()||C(this,Ht).isStale||!ff(l))return;const i=Ug(C(this,Ht).dataUpdatedAt,l)+1;se(this,dr,lr.setTimeout(()=>{C(this,Ht).isStale||this.updateResult()},i))},gf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ze)):this.options.refetchInterval)??!1},bf=function(l){we(this,$e,jf).call(this),se(this,El,l),!(js.isServer()||gn(this.options.enabled,C(this,ze))===!1||!ff(C(this,El))||C(this,El)===0)&&se(this,fr,lr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ff.isFocused())&&we(this,$e,vs).call(this)},C(this,El)))},yf=function(){we(this,$e,xf).call(this),we(this,$e,bf).call(this,we(this,$e,gf).call(this))},Sf=function(){C(this,dr)!==void 0&&(lr.clearTimeout(C(this,dr)),se(this,dr,void 0))},jf=function(){C(this,fr)!==void 0&&(lr.clearInterval(C(this,fr)),se(this,fr,void 0))},Nf=function(){const l=C(this,It).getQueryCache().build(C(this,It),this.options);if(l===C(this,ze))return;const o=C(this,ze);se(this,ze,l),se(this,As,l.state),this.hasListeners()&&(o==null||o.removeObserver(this),l.addObserver(this))},Kg=function(l){Mt.batch(()=>{l.listeners&&this.listeners.forEach(o=>{o(C(this,Ht))}),C(this,It).getQueryCache().notify({query:C(this,ze),type:"observerResultsUpdated"})})},cg);function W2(n,l){return gn(l.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&gn(l.retryOnMount,n)===!1)}function wx(n,l){return W2(n,l)||n.state.data!==void 0&&Mf(n,l,l.refetchOnMount)}function Mf(n,l,o){if(gn(l.enabled,n)!==!1&&Ol(l.staleTime,n)!=="static"){const i=typeof o=="function"?o(n):o;return i==="always"||i!==!1&&Wf(n,l)}return!1}function Cx(n,l,o,i){return(n!==l||gn(i.enabled,n)===!1)&&(!o.suspense||n.state.status!=="error")&&Wf(n,o)}function Wf(n,l){return gn(l.enabled,n)!==!1&&n.isStaleByTime(Ol(l.staleTime,n))}function eS(n,l){return!pc(n.getCurrentResult(),l)}var ks,la,qt,mr,ra,Ml,ug,tS=(ug=class extends $g{constructor(l){super();me(this,ra);me(this,ks);me(this,la);me(this,qt);me(this,mr);se(this,ks,l.client),this.mutationId=l.mutationId,se(this,qt,l.mutationCache),se(this,la,[]),this.state=l.state||Yg(),this.setOptions(l.options),this.scheduleGc()}setOptions(l){this.options=l,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(l){C(this,la).includes(l)||(C(this,la).push(l),this.clearGcTimeout(),C(this,qt).notify({type:"observerAdded",mutation:this,observer:l}))}removeObserver(l){se(this,la,C(this,la).filter(o=>o!==l)),this.scheduleGc(),C(this,qt).notify({type:"observerRemoved",mutation:this,observer:l})}optionalRemove(){C(this,la).length||(this.state.status==="pending"?this.scheduleGc():C(this,qt).remove(this))}continue(){var l;return((l=C(this,mr))==null?void 0:l.continue())??this.execute(this.state.variables)}async execute(l){var v,h,p,x,y,g,j,M,T,E,D,R,U,Q,H,G,K,$;const o=()=>{we(this,ra,Ml).call(this,{type:"continue"})},i={client:C(this,ks),meta:this.options.meta,mutationKey:this.options.mutationKey};se(this,mr,Pg({fn:()=>this.options.mutationFn?this.options.mutationFn(l,i):Promise.reject(new Error("No mutationFn found")),onFail:(I,Z)=>{we(this,ra,Ml).call(this,{type:"failed",failureCount:I,error:Z})},onPause:()=>{we(this,ra,Ml).call(this,{type:"pause"})},onContinue:o,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,qt).canRun(this)}));const u=this.state.status==="pending",f=!C(this,mr).canStart();try{if(u)o();else{we(this,ra,Ml).call(this,{type:"pending",variables:l,isPaused:f}),C(this,qt).config.onMutate&&await C(this,qt).config.onMutate(l,this,i);const Z=await((h=(v=this.options).onMutate)==null?void 0:h.call(v,l,i));Z!==this.state.context&&we(this,ra,Ml).call(this,{type:"pending",context:Z,variables:l,isPaused:f})}const I=await C(this,mr).start();return await((x=(p=C(this,qt).config).onSuccess)==null?void 0:x.call(p,I,l,this.state.context,this,i)),await((g=(y=this.options).onSuccess)==null?void 0:g.call(y,I,l,this.state.context,i)),await((M=(j=C(this,qt).config).onSettled)==null?void 0:M.call(j,I,null,this.state.variables,this.state.context,this,i)),await((E=(T=this.options).onSettled)==null?void 0:E.call(T,I,null,l,this.state.context,i)),we(this,ra,Ml).call(this,{type:"success",data:I}),I}catch(I){try{await((R=(D=C(this,qt).config).onError)==null?void 0:R.call(D,I,l,this.state.context,this,i))}catch(Z){Promise.reject(Z)}try{await((Q=(U=this.options).onError)==null?void 0:Q.call(U,I,l,this.state.context,i))}catch(Z){Promise.reject(Z)}try{await((G=(H=C(this,qt).config).onSettled)==null?void 0:G.call(H,void 0,I,this.state.variables,this.state.context,this,i))}catch(Z){Promise.reject(Z)}try{await(($=(K=this.options).onSettled)==null?void 0:$.call(K,void 0,I,l,this.state.context,i))}catch(Z){Promise.reject(Z)}throw we(this,ra,Ml).call(this,{type:"error",error:I}),I}finally{C(this,qt).runNext(this)}}},ks=new WeakMap,la=new WeakMap,qt=new WeakMap,mr=new WeakMap,ra=new WeakSet,Ml=function(l){const o=i=>{switch(l.type){case"failed":return{...i,failureCount:l.failureCount,failureReason:l.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,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{...i,data:l.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:l.error,failureCount:i.failureCount+1,failureReason:l.error,isPaused:!1,status:"error"}}};this.state=o(this.state),Mt.batch(()=>{C(this,la).forEach(i=>{i.onMutationUpdate(l)}),C(this,qt).notify({mutation:this,type:"updated",action:l})})},ug);function Yg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $a,Kn,Rs,dg,nS=(dg=class extends xi{constructor(l={}){super();me(this,$a);me(this,Kn);me(this,Rs);this.config=l,se(this,$a,new Set),se(this,Kn,new Map),se(this,Rs,0)}build(l,o,i){const u=new tS({client:l,mutationCache:this,mutationId:++ec(this,Rs)._,options:l.defaultMutationOptions(o),state:i});return this.add(u),u}add(l){C(this,$a).add(l);const o=nc(l);if(typeof o=="string"){const i=C(this,Kn).get(o);i?i.push(l):C(this,Kn).set(o,[l])}this.notify({type:"added",mutation:l})}remove(l){if(C(this,$a).delete(l)){const o=nc(l);if(typeof o=="string"){const i=C(this,Kn).get(o);if(i)if(i.length>1){const u=i.indexOf(l);u!==-1&&i.splice(u,1)}else i[0]===l&&C(this,Kn).delete(o)}}this.notify({type:"removed",mutation:l})}canRun(l){const o=nc(l);if(typeof o=="string"){const i=C(this,Kn).get(o),u=i==null?void 0:i.find(f=>f.state.status==="pending");return!u||u===l}else return!0}runNext(l){var i;const o=nc(l);if(typeof o=="string"){const u=(i=C(this,Kn).get(o))==null?void 0:i.find(f=>f!==l&&f.state.isPaused);return(u==null?void 0:u.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Mt.batch(()=>{C(this,$a).forEach(l=>{this.notify({type:"removed",mutation:l})}),C(this,$a).clear(),C(this,Kn).clear()})}getAll(){return Array.from(C(this,$a))}find(l){const o={exact:!0,...l};return this.getAll().find(i=>bx(o,i))}findAll(l={}){return this.getAll().filter(o=>bx(l,o))}notify(l){Mt.batch(()=>{this.listeners.forEach(o=>{o(l)})})}resumePausedMutations(){const l=this.getAll().filter(o=>o.state.isPaused);return Mt.batch(()=>Promise.all(l.map(o=>o.continue().catch(Kt))))}},$a=new WeakMap,Kn=new WeakMap,Rs=new WeakMap,dg);function nc(n){var l;return(l=n.options.scope)==null?void 0:l.id}var Qa,kl,Wt,Ha,Ya,uc,wf,fg,aS=(fg=class extends xi{constructor(o,i){super();me(this,Ya);me(this,Qa);me(this,kl);me(this,Wt);me(this,Ha);se(this,Qa,o),this.setOptions(i),this.bindMethods(),we(this,Ya,uc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(o){var u;const i=this.options;this.options=C(this,Qa).defaultMutationOptions(o),pc(this.options,i)||C(this,Qa).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,Wt),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&hr(i.mutationKey)!==hr(this.options.mutationKey)?this.reset():((u=C(this,Wt))==null?void 0:u.state.status)==="pending"&&C(this,Wt).setOptions(this.options)}onUnsubscribe(){var o;this.hasListeners()||(o=C(this,Wt))==null||o.removeObserver(this)}onMutationUpdate(o){we(this,Ya,uc).call(this),we(this,Ya,wf).call(this,o)}getCurrentResult(){return C(this,kl)}reset(){var o;(o=C(this,Wt))==null||o.removeObserver(this),se(this,Wt,void 0),we(this,Ya,uc).call(this),we(this,Ya,wf).call(this)}mutate(o,i){var u;return se(this,Ha,i),(u=C(this,Wt))==null||u.removeObserver(this),se(this,Wt,C(this,Qa).getMutationCache().build(C(this,Qa),this.options)),C(this,Wt).addObserver(this),C(this,Wt).execute(o)}},Qa=new WeakMap,kl=new WeakMap,Wt=new WeakMap,Ha=new WeakMap,Ya=new WeakSet,uc=function(){var i;const o=((i=C(this,Wt))==null?void 0:i.state)??Yg();se(this,kl,{...o,isPending:o.status==="pending",isSuccess:o.status==="success",isError:o.status==="error",isIdle:o.status==="idle",mutate:this.mutate,reset:this.reset})},wf=function(o){Mt.batch(()=>{var i,u,f,v,h,p,x,y;if(C(this,Ha)&&this.hasListeners()){const g=C(this,kl).variables,j=C(this,kl).context,M={client:C(this,Qa),meta:this.options.meta,mutationKey:this.options.mutationKey};if((o==null?void 0:o.type)==="success"){try{(u=(i=C(this,Ha)).onSuccess)==null||u.call(i,o.data,g,j,M)}catch(T){Promise.reject(T)}try{(v=(f=C(this,Ha)).onSettled)==null||v.call(f,o.data,null,g,j,M)}catch(T){Promise.reject(T)}}else if((o==null?void 0:o.type)==="error"){try{(p=(h=C(this,Ha)).onError)==null||p.call(h,o.error,g,j,M)}catch(T){Promise.reject(T)}try{(y=(x=C(this,Ha)).onSettled)==null||y.call(x,void 0,o.error,g,j,M)}catch(T){Promise.reject(T)}}}this.listeners.forEach(g=>{g(C(this,kl))})})},fg),ia,mg,lS=(mg=class extends xi{constructor(l={}){super();me(this,ia);this.config=l,se(this,ia,new Map)}build(l,o,i){const u=o.queryKey,f=o.queryHash??Zf(u,o);let v=this.get(f);return v||(v=new J2({client:l,queryKey:u,queryHash:f,options:l.defaultQueryOptions(o),state:i,defaultOptions:l.getQueryDefaults(u)}),this.add(v)),v}add(l){C(this,ia).has(l.queryHash)||(C(this,ia).set(l.queryHash,l),this.notify({type:"added",query:l}))}remove(l){const o=C(this,ia).get(l.queryHash);o&&(l.destroy(),o===l&&C(this,ia).delete(l.queryHash),this.notify({type:"removed",query:l}))}clear(){Mt.batch(()=>{this.getAll().forEach(l=>{this.remove(l)})})}get(l){return C(this,ia).get(l)}getAll(){return[...C(this,ia).values()]}find(l){const o={exact:!0,...l};return this.getAll().find(i=>gx(o,i))}findAll(l={}){const o=this.getAll();return Object.keys(l).length>0?o.filter(i=>gx(l,i)):o}notify(l){Mt.batch(()=>{this.listeners.forEach(o=>{o(l)})})}onFocus(){Mt.batch(()=>{this.getAll().forEach(l=>{l.onFocus()})})}onOnline(){Mt.batch(()=>{this.getAll().forEach(l=>{l.onOnline()})})}},ia=new WeakMap,mg),st,Rl,zl,di,fi,_l,mi,hi,hg,rS=(hg=class{constructor(n={}){me(this,st);me(this,Rl);me(this,zl);me(this,di);me(this,fi);me(this,_l);me(this,mi);me(this,hi);se(this,st,n.queryCache||new lS),se(this,Rl,n.mutationCache||new nS),se(this,zl,n.defaultOptions||{}),se(this,di,new Map),se(this,fi,new Map),se(this,_l,0)}mount(){ec(this,_l)._++,C(this,_l)===1&&(se(this,mi,Ff.subscribe(async n=>{n&&(await this.resumePausedMutations(),C(this,st).onFocus())})),se(this,hi,vc.subscribe(async n=>{n&&(await this.resumePausedMutations(),C(this,st).onOnline())})))}unmount(){var n,l;ec(this,_l)._--,C(this,_l)===0&&((n=C(this,mi))==null||n.call(this),se(this,mi,void 0),(l=C(this,hi))==null||l.call(this),se(this,hi,void 0))}isFetching(n){return C(this,st).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return C(this,Rl).findAll({...n,status:"pending"}).length}getQueryData(n){var o;const l=this.defaultQueryOptions({queryKey:n});return(o=C(this,st).get(l.queryHash))==null?void 0:o.state.data}ensureQueryData(n){const l=this.defaultQueryOptions(n),o=C(this,st).build(this,l),i=o.state.data;return i===void 0?this.fetchQuery(n):(n.revalidateIfStale&&o.isStaleByTime(Ol(l.staleTime,o))&&this.prefetchQuery(l),Promise.resolve(i))}getQueriesData(n){return C(this,st).findAll(n).map(({queryKey:l,state:o})=>{const i=o.data;return[l,i]})}setQueryData(n,l,o){const i=this.defaultQueryOptions({queryKey:n}),u=C(this,st).get(i.queryHash),f=u==null?void 0:u.state.data,v=q2(l,f);if(v!==void 0)return C(this,st).build(this,i).setData(v,{...o,manual:!0})}setQueriesData(n,l,o){return Mt.batch(()=>C(this,st).findAll(n).map(({queryKey:i})=>[i,this.setQueryData(i,l,o)]))}getQueryState(n){var o;const l=this.defaultQueryOptions({queryKey:n});return(o=C(this,st).get(l.queryHash))==null?void 0:o.state}removeQueries(n){const l=C(this,st);Mt.batch(()=>{l.findAll(n).forEach(o=>{l.remove(o)})})}resetQueries(n,l){const o=C(this,st);return Mt.batch(()=>(o.findAll(n).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...n},l)))}cancelQueries(n,l={}){const o={revert:!0,...l},i=Mt.batch(()=>C(this,st).findAll(n).map(u=>u.cancel(o)));return Promise.all(i).then(Kt).catch(Kt)}invalidateQueries(n,l={}){return Mt.batch(()=>(C(this,st).findAll(n).forEach(o=>{o.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 o={...l,cancelRefetch:l.cancelRefetch??!0},i=Mt.batch(()=>C(this,st).findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,o);return o.throwOnError||(f=f.catch(Kt)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(i).then(Kt)}fetchQuery(n){const l=this.defaultQueryOptions(n);l.retry===void 0&&(l.retry=!1);const o=C(this,st).build(this,l);return o.isStaleByTime(Ol(l.staleTime,o))?o.fetch(l):Promise.resolve(o.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Kt).catch(Kt)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Kt).catch(Kt)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return vc.isOnline()?C(this,Rl).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,st)}getMutationCache(){return C(this,Rl)}getDefaultOptions(){return C(this,zl)}setDefaultOptions(n){se(this,zl,n)}setQueryDefaults(n,l){C(this,di).set(hr(n),{queryKey:n,defaultOptions:l})}getQueryDefaults(n){const l=[...C(this,di).values()],o={};return l.forEach(i=>{Ss(n,i.queryKey)&&Object.assign(o,i.defaultOptions)}),o}setMutationDefaults(n,l){C(this,fi).set(hr(n),{mutationKey:n,defaultOptions:l})}getMutationDefaults(n){const l=[...C(this,fi).values()],o={};return l.forEach(i=>{Ss(n,i.mutationKey)&&Object.assign(o,i.defaultOptions)}),o}defaultQueryOptions(n){if(n._defaulted)return n;const l={...C(this,zl).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return l.queryHash||(l.queryHash=Zf(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===Jf&&(l.enabled=!1),l}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...C(this,zl).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){C(this,st).clear(),C(this,Rl).clear()}},st=new WeakMap,Rl=new WeakMap,zl=new WeakMap,di=new WeakMap,fi=new WeakMap,_l=new WeakMap,mi=new WeakMap,hi=new WeakMap,hg),Gg=S.createContext(void 0),jt=n=>{const l=S.useContext(Gg);if(!l)throw new Error("No QueryClient set, use QueryClientProvider to set one");return l},iS=({client:n,children:l})=>(S.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),s.jsx(Gg.Provider,{value:n,children:l})),Vg=S.createContext(!1),sS=()=>S.useContext(Vg);Vg.Provider;function oS(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var cS=S.createContext(oS()),uS=()=>S.useContext(cS),dS=(n,l,o)=>{const i=o!=null&&o.state.error&&typeof n.throwOnError=="function"?If(n.throwOnError,[o.state.error,o]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||i)&&(l.isReset()||(n.retryOnMount=!1))},fS=n=>{S.useEffect(()=>{n.clearReset()},[n])},mS=({result:n,errorResetBoundary:l,throwOnError:o,query:i,suspense:u})=>n.isError&&!l.isReset()&&!n.isFetching&&i&&(u&&n.data===void 0||If(o,[n.error,i])),hS=n=>{if(n.suspense){const o=u=>u==="static"?u:Math.max(u??1e3,1e3),i=n.staleTime;n.staleTime=typeof i=="function"?(...u)=>o(i(...u)):o(i),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},pS=(n,l)=>n.isLoading&&n.isFetching&&!l,vS=(n,l)=>(n==null?void 0:n.suspense)&&l.isPending,Tx=(n,l,o)=>l.fetchOptimistic(n).catch(()=>{o.clearReset()});function xS(n,l,o){var M,T,E,D;const i=sS(),u=uS(),f=jt(),v=f.defaultQueryOptions(n);(T=(M=f.getDefaultOptions().queries)==null?void 0:M._experimental_beforeQuery)==null||T.call(M,v);const h=f.getQueryCache().get(v.queryHash),p=n.subscribed!==!1;v._optimisticResults=i?"isRestoring":p?"optimistic":void 0,hS(v),dS(v,u,h),fS(u);const x=!f.getQueryCache().get(v.queryHash),[y]=S.useState(()=>new l(f,v)),g=y.getOptimisticResult(v),j=!i&&p;if(S.useSyncExternalStore(S.useCallback(R=>{const U=j?y.subscribe(Mt.batchCalls(R)):Kt;return y.updateResult(),U},[y,j]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(v)},[v,y]),vS(v,g))throw Tx(v,y,u);if(mS({result:g,errorResetBoundary:u,throwOnError:v.throwOnError,query:h,suspense:v.suspense}))throw g.error;if((D=(E=f.getDefaultOptions().queries)==null?void 0:E._experimental_afterQuery)==null||D.call(E,v,g),v.experimental_prefetchInRender&&!js.isServer()&&pS(g,i)){const R=x?Tx(v,y,u):h==null?void 0:h.promise;R==null||R.catch(Kt).finally(()=>{y.updateResult()})}return v.notifyOnChangeProps?g:y.trackResult(g)}function Pt(n,l){return xS(n,I2)}function ot(n,l){const o=jt(),[i]=S.useState(()=>new aS(o,n));S.useEffect(()=>{i.setOptions(n)},[i,n]);const u=S.useSyncExternalStore(S.useCallback(v=>i.subscribe(Mt.batchCalls(v)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),f=S.useCallback((v,h)=>{i.mutate(v,h).catch(Kt)},[i]);if(u.error&&If(i.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 Xg=(...n)=>n.filter((l,o,i)=>!!l&&l.trim()!==""&&i.indexOf(l)===o).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 gS=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 bS=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(l,o,i)=>i?i.toUpperCase():o.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 Ax=n=>{const l=bS(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 Zd={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 yS=n=>{for(const l in n)if(l.startsWith("aria-")||l==="role"||l==="title")return!0;return!1},SS=S.createContext({}),jS=()=>S.useContext(SS),NS=S.forwardRef(({color:n,size:l,strokeWidth:o,absoluteStrokeWidth:i,className:u="",children:f,iconNode:v,...h},p)=>{const{size:x=24,strokeWidth:y=2,absoluteStrokeWidth:g=!1,color:j="currentColor",className:M=""}=jS()??{},T=i??g?Number(o??y)*24/Number(l??x):o??y;return S.createElement("svg",{ref:p,...Zd,width:l??x??Zd.width,height:l??x??Zd.height,stroke:n??j,strokeWidth:T,className:Xg("lucide",M,u),...!f&&!yS(h)&&{"aria-hidden":"true"},...h},[...v.map(([E,D])=>S.createElement(E,D)),...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 _e=(n,l)=>{const o=S.forwardRef(({className:i,...u},f)=>S.createElement(NS,{ref:f,iconNode:l,className:Xg(`lucide-${gS(Ax(n))}`,`lucide-${n}`,i),...u}));return o.displayName=Ax(n),o};/**
|
|
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 MS=[["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"}]],em=_e("activity",MS);/**
|
|
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 wS=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],CS=_e("arrow-down",wS);/**
|
|
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 TS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Nc=_e("arrow-right",TS);/**
|
|
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 AS=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],ES=_e("arrow-up-right",AS);/**
|
|
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 kS=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Fg=_e("arrow-up",kS);/**
|
|
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 RS=[["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"}]],zS=_e("box",RS);/**
|
|
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 _S=[["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"}]],OS=_e("boxes",_S);/**
|
|
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 DS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Yt=_e("check",DS);/**
|
|
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 US=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],LS=_e("chevron-down",US);/**
|
|
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 BS=[["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=_e("circle-dashed",BS);/**
|
|
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 qS=[["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"}]],PS=_e("clipboard",qS);/**
|
|
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"}]],QS=_e("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 HS=[["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"}]],KS=_e("cpu",HS);/**
|
|
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 YS=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Ns=_e("credit-card",YS);/**
|
|
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 GS=[["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"}]],Ex=_e("database",GS);/**
|
|
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 VS=[["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"}]],Zg=_e("git-branch",VS);/**
|
|
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 XS=[["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"}]],FS=_e("image",XS);/**
|
|
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 ZS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],JS=_e("info",ZS);/**
|
|
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 IS=[["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"}]],WS=_e("landmark",IS);/**
|
|
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 ej=[["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"}]],tj=_e("list",ej);/**
|
|
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 nj=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],St=_e("loader-circle",nj);/**
|
|
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 aj=[["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"}]],lj=_e("network",aj);/**
|
|
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 rj=[["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"}]],ij=_e("pencil",rj);/**
|
|
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 sj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ms=_e("plus",sj);/**
|
|
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 oj=[["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"}]],pr=_e("refresh-cw",oj);/**
|
|
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 cj=[["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"}]],uj=_e("rotate-ccw",cj);/**
|
|
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 dj=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ds=_e("search",dj);/**
|
|
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 fj=[["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"}]],mj=_e("settings-2",fj);/**
|
|
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 hj=[["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"}]],pj=_e("shield-check",hj);/**
|
|
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 vj=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],xj=_e("smartphone",vj);/**
|
|
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 gj=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],bj=_e("terminal",gj);/**
|
|
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 yj=[["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"}]],tm=_e("trash-2",yj);/**
|
|
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 Sj=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],jj=_e("trending-up",Sj);/**
|
|
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 Nj=[["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"}]],gs=_e("wallet-cards",Nj);/**
|
|
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 Mj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Dl=_e("x",Mj);class Jg extends Error{constructor(o,i,u){super(o);qd(this,"status");qd(this,"code");this.status=i,this.code=u}}async function Ot(n){var o,i;const l=await fetch(n);if(!l.ok){const u=await l.json().catch(()=>({}));throw new Jg(((o=u.error)==null?void 0:o.message)??`${n} returned ${l.status}`,l.status,(i=u.error)==null?void 0:i.code)}return l.json()}async function nt(n,l,o){var u,f;const i=await fetch(l,{method:n,headers:o?{"content-type":"application/json"}:void 0,body:o?JSON.stringify(o):void 0});if(!i.ok){const v=await i.json().catch(()=>({}));throw new Jg(((u=v.error)==null?void 0:u.message)??`${n} ${l} returned ${i.status}`,i.status,(f=v.error)==null?void 0:f.code)}return i.json()}function Mc(){return Pt({queryKey:["ledger","inferences"],queryFn:()=>Ot("/ledger/inferences"),refetchInterval:1e4})}function wj(){return Pt({queryKey:["ledger","purchases"],queryFn:()=>Ot("/ledger/purchases"),refetchInterval:1e4})}function nm(){return Pt({queryKey:["payments"],queryFn:()=>Ot("/payments"),refetchInterval:1e4})}function Cj(){const n=jt();return ot({mutationFn:l=>nt("PUT","/payments/default",{method:l}),onSuccess:()=>{n.invalidateQueries({queryKey:["payments"]}),n.invalidateQueries({queryKey:["routing","provider-mode"]})}})}function am(){const n=jt();return ot({mutationFn:()=>nt("POST","/payments/clawtip/activate"),onSuccess:()=>{n.invalidateQueries({queryKey:["payments"]})}})}function lm(){return ot({mutationFn:()=>nt("POST","/payments/clawtip/recharge")})}function Ig(){return Pt({queryKey:["routing","strategy"],queryFn:()=>Ot("/routing/strategy")})}function Tj(){const n=jt();return ot({mutationFn:l=>nt("PUT","/routing/strategy",l),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","strategy"]}),n.invalidateQueries({queryKey:["routing","recommendations"]})}})}function Wg(){return Pt({queryKey:["routing","provider-mode"],queryFn:()=>Ot("/routing/provider-mode")})}function Aj(){const n=jt();return ot({mutationFn:l=>nt("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:["routing","recommendations"]}),n.invalidateQueries({queryKey:["models"]})}})}function eb(){return Pt({queryKey:["routing","auto-provider"],queryFn:()=>Ot("/routing/auto-provider")})}function Ej(){const n=jt();return ot({mutationFn:l=>nt("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:["routing","recommendations"]}),n.invalidateQueries({queryKey:["prewarm","focus-set"]}),n.invalidateQueries({queryKey:["models"]})}})}function kj(n){const l=new URLSearchParams;n.modelIds&&n.modelIds.length>0&&l.set("modelIds",Tf(n.modelIds)),n.scope&&l.set("scope",n.scope),n.sellerIds&&n.sellerIds.length>0&&l.set("sellerIds",Tf(n.sellerIds)),n.scorer&&l.set("scorer",n.scorer),n.protocol&&l.set("protocol",n.protocol),n.paymentMethod&&l.set("paymentMethod",n.paymentMethod),l.set("topK",String(n.topK));const o=l.toString();return Pt({queryKey:["routing","recommendations",o],queryFn:()=>Ot(`/routing/recommendations?${o}`),enabled:n.enabled??!0,refetchInterval:3e4})}function rm(){return Pt({queryKey:["routing","manual-providers"],queryFn:()=>Ot("/routing/manual-providers")})}function Rj(){const n=jt();return ot({mutationFn:l=>nt("POST","/routing/manual-providers/local",l),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function zj(){const n=jt();return ot({mutationFn:({providerId:l,input:o})=>nt("PUT",`/routing/manual-providers/local/${encodeURIComponent(l)}`,o),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function _j(){const n=jt();return ot({mutationFn:l=>nt("DELETE",`/routing/manual-providers/${encodeURIComponent(l)}`),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function Oj(){const n=jt();return ot({mutationFn:l=>nt("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 Dj(){const n=jt();return ot({mutationFn:l=>nt("PUT","/routing/manual-providers/routing",l),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function Uj(n){return nt("POST","/routing/manual-providers/probe",n)}function Lj(){const n=jt();return ot({mutationFn:l=>nt("POST",`/routing/manual-providers/${encodeURIComponent(l)}/test`),onSuccess:()=>{n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["ledger","inferences"]})}})}function Bj(){const n=jt();return ot({mutationFn:l=>nt("POST",`/routing/manual-providers/${encodeURIComponent(l)}/models/refresh`),onSuccess:l=>{n.setQueryData(["routing","manual-providers"],{version:1,updatedAt:new Date().toISOString(),routing:l.routing,providers:l.providers}),n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["models"]})}})}function qj(n){const l=new URLSearchParams;for(const[o,i]of Object.entries(n))i!=null&&i!==""&&l.set(o,Tf(i));return Pt({queryKey:["routing","preview",l.toString()],queryFn:()=>Ot(`/routing/preview?${l.toString()}`),enabled:!1})}function Tf(n){return Array.isArray(n)?n.join(","):typeof n=="object"&&n!==null?Object.entries(n).map(([l,o])=>`${l}:${o}`).join(","):String(n)}function im(){return Pt({queryKey:["sellers"],queryFn:()=>Ot("/sellers"),refetchInterval:3e4})}function Us(){return Pt({queryKey:["models"],queryFn:()=>Ot("/models"),refetchInterval:3e4})}function Pj(){const n=jt();return ot({mutationFn:l=>nt("POST",`/sellers/${encodeURIComponent(l)}/test`),onSuccess:()=>{n.invalidateQueries({queryKey:["models"]}),n.invalidateQueries({queryKey:["routing","recommendations"]})}})}function $j(){const n=jt();return ot({mutationFn:()=>Ot("/models"),onSuccess:l=>{n.setQueryData(["models"],l),n.invalidateQueries({queryKey:["models"]}),n.invalidateQueries({queryKey:["sellers"]}),n.invalidateQueries({queryKey:["routing","recommendations"]})}})}function Qj(){return Pt({queryKey:["prewarm","focus-set"],queryFn:()=>Ot("/v1.2/prewarm").then(n=>({ok:!0,focusSet:n.focusSet??[],source:"historical"}))})}async function Af(n){const l=Array.isArray(n)?{models:n}:n;return nt("PUT","/prewarm/focus-set",l)}function sm(){return Pt({queryKey:["status"],queryFn:()=>Ot("/status"),refetchInterval:5e3})}function Hj(){return Pt({queryKey:["update","status"],queryFn:()=>Ot("/update/status"),refetchInterval:3600*1e3})}function Kj(){return ot({mutationFn:()=>nt("POST","/update/run")})}const je="—",Vn="-",tn=n=>n<10?`0${n}`:`${n}`;function xc(n,l={}){if(!Number.isFinite(n))return je;const o=n;return o<=0?Vn:l.compact===!1||o<1e4?Math.round(o).toLocaleString("en-US"):o<1e6?`${(o/1e3).toFixed(1)}K`:o<1e9?`${(o/1e6).toFixed(1)}M`:`${(o/1e9).toFixed(2)}B`}function dc(n){if(!Number.isFinite(n))return je;const l=n;return l<=0?Vn: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 ws(n){return Number.isFinite(n)?n<=0?Vn:`${n.toFixed(1)} tok/s`:je}function tb(n){return Number.isFinite(n)?n<=0?Vn:n.toFixed(1):je}function ye(n){return Number.isFinite(n)?n===0?Vn:Math.round(n).toLocaleString("en-US"):je}function Ka(n,l={}){if(!Number.isFinite(n))return je;if(n===0)return Vn;const o=Math.abs(n/1e6),i=l.digits??(l.ledger&&o<.01?6:4),u=`$${(n/1e6).toFixed(i)}`;return l.signed&&n>=0?`+${u}`:u}function Yj(n,l={}){if(!Number.isFinite(n))return je;if(n===0)return Vn;const i=`${Math.abs(n/1e6).toFixed(l.digits??4)} credit`;return l.signed?n>=0?`+${i}`:`-${i}`:n<0?`-${i}`:i}function aa(n,l={}){return Ka(n,{digits:l.digits??6})}function Gj(n){var i,u;const l=(i=n.paymentCurrency)==null?void 0:i.trim().toUpperCase(),o=(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`:o&&l?l==="USD"?`${kx(l)}${o}`:`${kx(l)}${o} ${l}`:Number.isFinite(n.paymentAmountMinor)&&l?`${ye(n.paymentAmountMinor)} ${l} minor`:je}function Vj(n,l){if(!Number.isFinite(n)||!l)return je;const o=l.trim().toUpperCase();return o==="USD"?`$${(n/100).toFixed(4)}`:o==="CNY"?`¥${(n/100).toFixed(2)} CNY`:`${ye(n)} ${o} minor`}function kx(n){return n==="USD"?"$":n==="CNY"?"¥":n==="EUR"?"€":n==="GBP"?"£":""}function Xj(n,l,o={}){return!Number.isFinite(n)&&!Number.isFinite(l)?je:`${Ka(n,o)} / ${Ka(l,o)}`}function ca(n){if(!Number.isFinite(n))return je;const l=Math.max(0,Math.round(n));return l===0?Vn:l<1e3?`${l}ms`:`${(l/1e3).toFixed(2)}s`}function Fj(n){return Number.isFinite(n)?`${Math.round(n*100)}%`:je}function Cs(n){if(!Number.isFinite(n))return je;const l=Math.max(0,n);return Jj(l)}function xs(n,l){return Xj(n,l,{digits:4})}function bs(n){const l=Ka(n,{digits:4});return l===je||l===Vn?l:`${l} / 1M Token`}function Zj(n){return Number.isFinite(n)?n<=0?Vn:`${n.toFixed(2)}x`:je}function Jj(n){return String(n)}function bn(n){return n?n.trim().toLowerCase().replaceAll("_"," "):je}function sa(n){const l=bn(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"||l==="cooldown"||l==="full"?"amber":l==="failed"||l==="error"||l==="canceled"||l==="unhealthy"||l==="offline"?"red":l==="running"?"blue":"gray"}function Ls(n){return n?n.startsWith("tbs-")&&n.length>10?n.slice(0,10):n.length<=12?n:n.slice(0,12):je}function Ij(n){if(!n)return je;const l=new Date(n);if(Number.isNaN(l.getTime()))return je;const o=new Date,i=l.getFullYear()===o.getFullYear()&&l.getMonth()===o.getMonth()&&l.getDate()===o.getDate(),u=`${tn(l.getHours())}:${tn(l.getMinutes())}`;return i?u:`${tn(l.getMonth()+1)}/${tn(l.getDate())} ${u}`}function wc(n){if(!n)return je;const l=new Date(n);return Number.isNaN(l.getTime())?je:`${l.getFullYear()}-${tn(l.getMonth()+1)}-${tn(l.getDate())} ${tn(l.getHours())}:${tn(l.getMinutes())}:${tn(l.getSeconds())}`}function Cc(n){if(!n)return je;const l=new Date(n);return Number.isNaN(l.getTime())?je:`${l.getFullYear()}/${tn(l.getMonth()+1)}/${tn(l.getDate())} ${tn(l.getHours())}:${tn(l.getMinutes())}:${tn(l.getSeconds())}`}function Wj(n){return Ij(n)}function nb(n,l){const o=new Map;for(const i of[...l].sort((u,f)=>u.createdAt.localeCompare(f.createdAt)))!i.paymentMethod||i.balanceSnapshotMicros===void 0||o.set(oa(i.paymentMethod),i.balanceSnapshotMicros);return[...n].filter(i=>oa(i.method)!=="mock").sort((i,u)=>Number(u.isDefault)-Number(i.isDefault)||i.method.localeCompare(u.method)).map(i=>{const u=oa(i.method),f=i.enabled||!!(i.config&&Object.keys(i.config).length>0),v=o.get(u),h=u==="clawtip";return{name:lb(i.method),method:i.method,balance:h?"••••":Ka(v),status:i.enabled?"Bound":"Available",note:f?i.isDefault?"Default wallet":"Configured":"Not bound",action:i.enabled?"Recharge":"Activate",icon:eN(i.method),balanceHidden:h,config:i.config}})}function ab({modal:n,methods:l,qr:o,loading:i,error:u,onClose:f}){const v=n.kind==="recharge",h=l.find(M=>M.method===n.method),p=v&&oa(n.method)==="clawtip",x=tN(h==null?void 0:h.config,"orderNo"),y=(o==null?void 0:o.walletConfigPresent)===!0||rb(h==null?void 0:h.config,"walletConfigPresent"),g=!v&&!!(o!=null&&o.qrImageUrl)&&!y&&!u,j=(h==null?void 0:h.name)??lb(n.method);return s.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:s.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:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-[1.05rem] font-semibold text-[var(--color-ink)]",children:p?"ClawTip wallet QR":v?`Recharge ${j}`:`Activate ${j}`}),s.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.":v?"Load the fixed ClawTip recharge QR from static assets.":"Reuse the tb init ClawTip flow and wait for wallet binding."})]}),s.jsx("button",{className:"tb-button tb-button-icon tb-button-quiet",onClick:f,"aria-label":"Close payment modal",children:s.jsx(Dl,{className:"size-4"})})]}),s.jsxs("div",{className:"mt-5 flex flex-col gap-4",children:[s.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:o!=null&&o.qrImageUrl?s.jsx("img",{className:"max-h-[72vh] w-full object-contain",src:o.qrImageUrl,alt:`${j} ${v?"recharge":"activation"} QR code`}):s.jsxs("div",{className:"flex flex-col items-center gap-2 px-3 text-center text-[0.78rem] leading-5 text-[var(--color-muted)]",children:[i?s.jsx(St,{className:"size-5 animate-spin text-[var(--color-purple)]"}):null,s.jsx("span",{children:i?"Generating ClawTip QR...":"QR image unavailable"})]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsx(ac,{label:"Method",value:j}),s.jsx(ac,{label:"Wallet",value:y?"bound":"waiting",warn:!y}),o!=null&&o.orderNo||x?s.jsx(ac,{label:"Order",value:(o==null?void 0:o.orderNo)??x??""}):null,o!=null&&o.clawtipId?s.jsx(ac,{label:"Device",value:o.clawtipId}):null]}),u?s.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,o!=null&&o.qrImageUrl?s.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:v?"Scan with JD app to view wallet balance or recharge.":s.jsxs("span",{className:"flex items-start gap-2",children:[g?s.jsx(St,{className:"mt-0.5 size-4 shrink-0 animate-spin"}):null,s.jsx("span",{children:y?"Wallet bound. Closing...":"Scan with JD app. TokenBuddy is waiting for the local wallet config."})]})}):null,!(o!=null&&o.qrImageUrl)&&!i&&!u?s.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 ",s.jsx("span",{className:"font-mono",children:"tb init"})," to bind this payment method."]}):null]})]})]})})}function lb(n){const l=oa(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(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}function oa(n){return n.trim().toLowerCase()}function rb(n,l){return(n==null?void 0:n[l])===!0}function ac({label:n,value:l,warn:o=!1}){return s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("div",{className:"text-[0.78rem] text-[var(--color-muted)]",children:n}),s.jsx("div",{className:["font-mono text-[0.94rem] font-semibold",o?"text-amber-700":"text-[var(--color-ink)]"].join(" "),children:l})]})}function eN(n){const l=oa(n);return l==="clawtip"?"C":l==="wechat-pay"?"W":l==="alipay-agent"?"A":l.charAt(0).toUpperCase()||"P"}function tN(n,l){const o=n==null?void 0:n[l];return typeof o=="string"&&o.length>0?o:void 0}const nN=320,Jd=12;function aN({inputTokens:n,outputTokens:l,cacheReadTokens:o,cacheWriteTokens:i,showCacheRead:u=!0}){const f=u?o:void 0,v=ib(n,l,f,i),h=Number.isFinite(f),p=Number.isFinite(f)&&f>0,x=Number.isFinite(i)&&i>0,y=[{label:"输入 Token",value:ye(n)},{label:"输出 Token",value:ye(l)}];return Number.isFinite(i)&&y.push({label:"缓存创建 Token",value:ye(i)}),h&&y.push({label:"缓存读取 Token",value:ye(f)}),y.push({label:"总 Token",value:ye(v),dividerBefore:!0,emphasis:!0}),s.jsxs("span",{className:"inline-flex min-w-[13rem] items-center gap-2 align-middle",children:[s.jsxs("span",{className:"grid min-w-0 gap-1",children:[s.jsxs("span",{className:"inline-flex items-center gap-4 whitespace-nowrap font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(CS,{className:"size-3.5 text-[var(--color-success)]","aria-hidden":"true"}),ye(n)]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Fg,{className:"size-3.5 text-[var(--color-primary)]","aria-hidden":"true"}),ye(l)]})]}),p?s.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap font-mono text-[0.78rem] font-semibold text-[var(--color-tokens)]",children:[s.jsx(Ex,{className:"size-3.5","aria-hidden":"true"}),xc(f)]}):null,x?s.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap font-mono text-[0.78rem] font-semibold text-amber-600",children:[s.jsx(Ex,{className:"size-3.5","aria-hidden":"true"}),xc(i)]}):null]}),s.jsx(om,{ariaLabel:"Token 明细",children:s.jsx(cm,{title:"Token 明细",rows:y})})]})}function lN({imageCount:n,imageSize:l,imageQuality:o,imageOutputFormat:i}){const u=[{label:"图片数量",value:ye(n)},{label:"尺寸",value:l||je},{label:"质量",value:o||je},{label:"输出格式",value:i||je}];return s.jsxs("span",{className:"inline-flex min-w-[13rem] items-center gap-2 align-middle",children:[s.jsxs("span",{className:"grid min-w-0 gap-1",children:[s.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:[s.jsx(FS,{className:"size-3.5 text-[var(--color-primary)]","aria-hidden":"true"}),ye(n)," image",n===1?"":"s"]}),s.jsx("span",{className:"whitespace-nowrap font-mono text-[0.78rem] font-semibold text-[var(--color-muted)]",children:[l,o,i].filter(Boolean).join(" / ")||je})]}),s.jsx(om,{ariaLabel:"图片明细",children:s.jsx(cm,{title:"图片明细",rows:u})})]})}function rN({inputTokens:n,outputTokens:l}){const o=ib(n,l);return s.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[s.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:s.jsx(zS,{className:"size-7","aria-hidden":"true"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[0.8rem] font-bold uppercase tracking-normal text-[var(--color-muted)]",children:"总 Token"}),s.jsx("div",{className:"mt-1 font-mono text-[2rem] font-bold leading-none tracking-normal text-[var(--color-ink)]",children:dc(o)}),s.jsxs("div",{className:"mt-1 font-mono text-[0.9rem] font-medium leading-snug tracking-normal text-[var(--color-muted)]",children:["输入: ",dc(n)," / 输出: ",dc(l)]})]})]})}function iN(n){const l=n.settledUsdMicros??n.billedMicros,o=oN(n,l);return s.jsxs("span",{className:"inline-flex items-center gap-2 align-middle",children:[s.jsx("span",{className:"whitespace-nowrap font-mono text-[0.9rem] font-semibold text-[var(--color-spend)]",children:aa(l)}),s.jsx(om,{ariaLabel:"成本明细",children:s.jsx(cm,{title:"成本明细",rows:o})})]})}function sN({inputPriceMicrosPer1m:n,outputPriceMicrosPer1m:l}){return s.jsxs("span",{className:"grid gap-0.5 font-mono text-[0.78rem] leading-snug text-[var(--color-muted)]",children:[s.jsxs("span",{children:["输入 ",bs(n)]}),s.jsxs("span",{children:["输出 ",bs(l)]})]})}function Tc({ttftMs:n,tokensPerSecond:l,compact:o=!1}){return o?s.jsxs("span",{className:"font-mono",children:["TTFT ",ca(n)," / ",ws(l)]}):s.jsxs("span",{className:"inline-grid gap-0.5 font-mono text-[0.78rem] leading-snug",children:[s.jsxs("span",{children:[s.jsx("span",{className:"text-[var(--color-muted)]",children:"TTFT"})," ",ca(n)]}),s.jsxs("span",{children:[s.jsx("span",{className:"text-[var(--color-muted)]",children:"Tok/s"})," ",tb(l)]})]})}function oN(n,l){const o=[];return n.billingSource&&o.push({label:"计费来源",value:cN(n.billingSource)}),pn(o,"上游计费",aa(n.reportedCostUsdMicros),n.reportedCostUsdMicros),n.billingUnit==="images"&&(o.push({label:"图片数量",value:ye(n.imageCount)}),n.imageSize&&o.push({label:"尺寸",value:n.imageSize}),n.imageQuality&&o.push({label:"质量",value:n.imageQuality}),n.imageOutputFormat&&o.push({label:"输出格式",value:n.imageOutputFormat}),pn(o,"图片输出成本",aa(n.imageOutputCostMicros),n.imageOutputCostMicros),pn(o,"单张折算",aa(n.imageCostMicrosPerImage),n.imageCostMicrosPerImage),pn(o,"图片输出 Token",ye(n.imageOutputTokens),n.imageOutputTokens)),pn(o,"输入成本",aa(n.inputCostMicros),n.inputCostMicros),pn(o,"输出成本",aa(n.outputCostMicros),n.outputCostMicros),pn(o,"输入单价",bs(n.inputPriceMicrosPer1m),n.inputPriceMicrosPer1m),pn(o,"输出单价",bs(n.outputPriceMicrosPer1m),n.outputPriceMicrosPer1m),pn(o,"缓存读取成本",aa(n.cacheReadCostMicros),n.cacheReadCostMicros),pn(o,"缓存创建成本",aa(n.cacheWriteCostMicros),n.cacheWriteCostMicros),pn(o,"缓存创建单价",bs(n.cacheWritePriceMicrosPer1m),n.cacheWritePriceMicrosPer1m),n.serviceTier&&o.push({label:"服务档位",value:n.serviceTier,dividerBefore:o.length>0}),pn(o,"倍率",Zj(n.billingMultiplier),n.billingMultiplier),pn(o,"原始",aa(n.originalUsdMicros),n.originalUsdMicros),o.push({label:"计费",value:aa(l),dividerBefore:o.length>0,emphasis:!0}),o.length===1&&o.unshift({label:"明细",value:je}),o}function cN(n){return n==="provider_reported"?"Provider":n==="seller_computed"?"Seller":n==="reservation_fallback"?"Reserved":n==="buyer_estimated"?"Estimated":n}function pn(n,l,o,i){Number.isFinite(i)&&n.push({label:l,value:o})}function om({ariaLabel:n,children:l}){const o=S.useRef(null),[i,u]=S.useState(!1),[f,v]=S.useState(),h=S.useCallback(()=>{const x=o.current;if(!x)return;const y=x.getBoundingClientRect(),g=window.innerWidth-nN-Jd,j=Math.max(Jd,Math.min(g,y.right+8)),M=Math.max(Jd,y.top+y.height/2-32);v({top:M,left:j})},[]),p=S.useCallback(()=>{h(),u(!0)},[h]);return S.useEffect(()=>{if(i)return h(),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[i,h]),s.jsxs(s.Fragment,{children:[s.jsx("button",{ref:o,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:()=>{h(),u(x=>!x)},children:s.jsx(JS,{className:"size-3.5","aria-hidden":"true"})}),i&&f&&typeof document<"u"?_2.createPortal(s.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 cm({title:n,rows:l}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{className:"text-[0.92rem] font-bold text-[var(--color-ink)]",children:n}),s.jsx("div",{className:"grid gap-1",children:l.map((o,i)=>s.jsxs("div",{className:["grid grid-cols-[1fr_auto] items-baseline gap-4 text-[0.86rem]",o.dividerBefore?"mt-1 border-t border-[var(--color-line-2)] pt-2":""].join(" "),children:[s.jsx("span",{className:"text-[var(--color-muted)]",children:o.label}),s.jsx("span",{className:["font-mono tracking-normal",o.emphasis?"font-bold text-[var(--color-ink)]":"font-semibold text-[var(--color-ink)]",o.value===Vn?"text-[var(--color-muted)]":""].join(" "),children:o.value})]},`${o.label}-${i}`))})]})}function ib(...n){return n.reduce((l,o)=>l+(Number.isFinite(o)?o:0),0)}function _t({children:n,className:l=""}){return s.jsx("div",{className:["rounded-[var(--radius-xl)] border border-[var(--color-line-2)] bg-white shadow-[var(--shadow-panel)]",l].join(" "),children:n})}function Bs(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 um({tone:n,children:l,className:o="size-7"}){const i=Bs(n);return s.jsx("div",{className:[`grid ${o} place-items-center rounded-[var(--radius-md)]`,i.icon].join(" "),children:l})}function Rx({icon:n,label:l,tone:o,rows:i}){const u=Bs(o);return s.jsxs(_t,{className:"relative min-h-[9rem] overflow-hidden border-[var(--color-hairline)] bg-white px-4 py-4",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(um,{tone:o,className:"size-10",children:n}),s.jsx("div",{className:["text-[0.72rem] font-bold uppercase tracking-[0.08em]",u.label].join(" "),children:l})]}),s.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:i.map(f=>s.jsxs("div",{className:"min-w-0 rounded-[8px] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 py-2",children:[s.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:f.label}),s.jsx("div",{className:["mt-1 truncate font-mono text-[1.15rem] font-bold leading-tight tracking-normal",u.value].join(" "),children:f.value}),s.jsx("div",{className:"mt-1 truncate text-[0.72rem] font-medium text-[var(--color-muted)]",children:f.detail})]},f.key))})]})}function uN({tone:n="lavender",children:l}){const o={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 s.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)]",o[n]??o.lavender].join(" "),children:[s.jsx("span",{className:"size-1.5 rounded-full bg-current"}),l]})}const zx="tokenbuddy-ui-language",_x={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":"Routing mode","overview.providerMode.manualValue":"Manual","overview.providerMode.autoValue":"Auto","overview.providerMode.manualStats":"{count} node{plural} · {policy}","overview.providerMode.manualNote":"Uses your node list only","overview.providerMode.autoStats":"{range} · {models} model{modelPlural} · {sellers} node{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 node","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 models and 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.reconnect":"Reconnect","tools.getApp":"Get app","tools.importCcSwitch":"Import {name} provider with CC Switch","tools.disconnectFrom":"Disconnect TokenBuddy from {name}","tools.disconnectConfirm":"Disconnect {name}? TokenBuddy will restore the config files to their state before Connect. Any changes made to those files after Connect may be lost.","tools.connectTo":"Connect {name} to TokenBuddy","tools.reconnectTo":"Refresh models and reconnect {name}","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.modelsRefreshed":"Model list refreshed: {count} model{plural} available.","tools.noSnapshot":"{name}: no TokenBuddy install snapshot was found.","tools.noCompatibleModel":"{name}: no {protocol} compatible model is available.","tools.disconnectedChanges":"{name}: disconnected with {count} file change{plural}.","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":"路由模式","overview.providerMode.manualValue":"手动","overview.providerMode.autoValue":"自动","overview.providerMode.manualStats":"{count} 个节点 · {policy}","overview.providerMode.manualNote":"只使用你的节点列表","overview.providerMode.autoStats":"{range} · {models} 个模型 · {sellers} 个节点","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.reconnect":"重连","tools.getApp":"获取应用","tools.importCcSwitch":"用 CC Switch 导入 {name} provider","tools.disconnectFrom":"断开 TokenBuddy 与 {name} 的连接","tools.disconnectConfirm":"确定要断开 {name} 吗?TokenBuddy 会把配置文件恢复到连接前的状态;连接后对这些文件做过的其它修改可能会丢失。","tools.connectTo":"将 {name} 连接到 TokenBuddy","tools.reconnectTo":"刷新模型并重连 {name}","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.modelsRefreshed":"模型列表已刷新:当前可用 {count} 个模型。","tools.noSnapshot":"{name}: 没有找到 TokenBuddy 安装快照。","tools.noCompatibleModel":"{name}: 没有可用的 {protocol} 兼容模型。","tools.disconnectedChanges":"{name}: 已断开,处理了 {count} 个文件变更。","tools.restoredChanges":"{name}: 已恢复 {count} 个文件变更。"}},sb=S.createContext(null);function dN({children:n}){const[l,o]=S.useState(()=>{if(typeof window>"u")return"en";const u=window.localStorage.getItem(zx);return u==="zh"||u==="en"?u:"en"});S.useEffect(()=>{document.documentElement.lang=l==="zh"?"zh-CN":"en",window.localStorage.setItem(zx,l)},[l]),S.useEffect(()=>{if(typeof document>"u")return;const u=()=>pN(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 i=S.useMemo(()=>({language:l,setLanguage:o,t:(u,f)=>fN(_x[l][u]??_x.en[u],f)}),[l]);return s.jsx(sb.Provider,{value:i,children:n})}function xr(){const n=S.useContext(sb);if(!n)throw new Error("useI18n must be used inside I18nProvider");return n}function fN(n,l){return l?n.replace(/\{(\w+)\}/g,(o,i)=>{const u=l[i];return u===void 0?o:String(u)}):n}const ob=[["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","当前"],["Agent payment","智能体支付"],["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 nodes.","在健康节点中优先选择更低成本。"],["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","激活"],["Bind ClawTip wallet to enable Auto mode","绑定 ClawTip 钱包启用自动模式"],["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"]],cb=ob.filter(([n])=>!fb(n)),mN=ob.filter(([n])=>fb(n)),ub=new Map(cb),db=new Map([...cb.map(([n,l])=>[l,n]),...mN]);function hN(n,l){return dm(n,l==="zh"?ub:db,l)}function pN(n){const l=n==="zh"?ub:db;vN(document.body,l,n)}function vN(n,l,o){var f;const i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,{acceptNode(v){var p;const h=v.parentElement;return!h||["SCRIPT","STYLE","NOSCRIPT","TEXTAREA"].includes(h.tagName)||h.closest("[data-no-translate='true']")||!((p=v.textContent)!=null&&p.trim())?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),u=[];for(;i.nextNode();)u.push(i.currentNode);for(const v of u){const h=dm(v.textContent??"",l,o);h!==v.textContent&&(v.textContent=h)}n instanceof Element&&Ox(n,l,o);for(const v of Array.from(((f=n.querySelectorAll)==null?void 0:f.call(n,"[placeholder], [title], [aria-label], [alt]"))??[]))Ox(v,l,o)}function Ox(n,l,o){for(const i of["placeholder","title","aria-label","alt"]){if(n.closest("[data-no-translate='true']"))return;const u=n.getAttribute(i);if(!u)continue;const f=dm(u,l,o);f!==u&&n.setAttribute(i,f)}}function dm(n,l,o){var h,p;const i=((h=n.match(/^\s*/))==null?void 0:h[0])??"",u=((p=n.match(/\s*$/))==null?void 0:p[0])??"",f=n.trim();if(!f)return n;const v=l.get(f);if(v)return`${i}${v}${u}`;if(o==="zh"){const x=f.match(/^Selected (\d+)$/);if(x)return`${i}已选择 ${x[1]}${u}`;const y=f.match(/^(\d+) selected$/);if(y)return`${i}已选择 ${y[1]}${u}`;const g=f.match(/^Page (\d+)$/);if(g)return`${i}第 ${g[1]} 页${u}`;const j=f.match(/^(\d+) of (\d+) providers$/);if(j)return`${i}${j[1]} / ${j[2]} 个 Provider${u}`;const M=f.match(/^(\d+) of (\d+) models$/);if(M)return`${i}${M[1]} / ${M[2]} 个模型${u}`;const T=f.match(/^(\d+) purchases$/);if(T)return`${i}${T[1]} 次购买${u}`;const E=f.match(/^(\d+) requests$/);if(E)return`${i}${E[1]} 次请求${u}`;const D=f.match(/^(\d+) sellers$/);if(D)return`${i}${D[1]} 个 Seller${u}`;const R=f.match(/^In ([\d,]+) \/ Out ([\d,]+)$/);if(R)return`${i}输入 ${R[1]} / 输出 ${R[2]}${u}`;const U=f.match(/^(.+) total$/);if(U)return`${i}总计 ${U[1]}${u}`;const Q=f.match(/^Open (.+)$/);if(Q)return`${i}打开 ${Q[1]}${u}`;const H=f.match(/^Activate (.+)$/);if(H)return`${i}激活 ${H[1]}${u}`;const G=f.match(/^Recharge (.+)$/);if(G)return`${i}充值 ${G[1]}${u}`;const K=f.match(/^Bind (.+)$/);if(K)return`${i}绑定 ${K[1]}${u}`;const $=f.match(/^Remove (.+)$/);if($)return`${i}移除 ${$[1]}${u}`;const I=f.match(/^View models for (.+)$/);if(I)return`${i}查看 ${I[1]} 的模型${u}`;const Z=f.match(/^Move (.+) up$/);if(Z)return`${i}上移 ${Z[1]}${u}`;const ne=f.match(/^Edit provider · (.+)$/);if(ne)return`${i}编辑 Provider · ${ne[1]}${u}`;const B=f.match(/^Models · (.+)$/);if(B)return`${i}模型 · ${B[1]}${u}`;const ie=f.match(/^(.+) ledger records, ([\d,]+) records$/);if(ie)return`${i}${ie[1]}账本记录,${ie[2]} 条记录${u}`;const te=f.match(/^Input tokens: (.+)$/);if(te)return`${i}输入 Token: ${te[1]}${u}`;const xe=f.match(/^Output tokens: (.+)$/);if(xe)return`${i}输出 Token: ${xe[1]}${u}`;const fe=f.match(/^Time to first token: (.+)$/);if(fe)return`${i}首 token 延迟: ${fe[1]}${u}`;const O=f.match(/^Tokens per second: (.+)$/);if(O)return`${i}每秒 Token: ${O[1]}${u}`;const ee=f.match(/^Seller discount: (.+)$/);if(ee)return`${i}Seller 折扣: ${ee[1]}${u}`;const re=f.match(/^Last seller switch: (.+)$/);if(re)return`${i}最近 Seller 切换: ${re[1]}${u}`;const ae=f.match(/^(.+) (recharge|activation) QR code$/);if(ae)return`${i}${ae[1]} ${ae[2]==="recharge"?"充值":"激活"}二维码${u}`}else{const x=f.match(/^已选择 (\d+)$/);if(x)return`${i}Selected ${x[1]}${u}`;const y=f.match(/^第 (\d+) 页$/);if(y)return`${i}Page ${y[1]}${u}`;const g=f.match(/^(\d+) \/ (\d+) 个 Provider$/);if(g)return`${i}${g[1]} of ${g[2]} providers${u}`;const j=f.match(/^(\d+) \/ (\d+) 个模型$/);if(j)return`${i}${j[1]} of ${j[2]} models${u}`;const M=f.match(/^总计 (.+)$/);if(M)return`${i}${M[1]} total${u}`;const T=f.match(/^(\d+) 个 Seller$/);if(T)return`${i}${T[1]} sellers${u}`;const E=f.match(/^输入 ([\d,]+) \/ 输出 ([\d,]+)$/);if(E)return`${i}In ${E[1]} / Out ${E[2]}${u}`;const D=f.match(/^打开 (.+)$/);if(D)return`${i}Open ${D[1]}${u}`;const R=f.match(/^移除 (.+)$/);if(R)return`${i}Remove ${R[1]}${u}`;const U=f.match(/^查看 (.+) 的模型$/);if(U)return`${i}View models for ${U[1]}${u}`;const Q=f.match(/^上移 (.+)$/);if(Q)return`${i}Move ${Q[1]} up${u}`}return n}function fb(n){return/[\u4e00-\u9fff]/.test(n)}function mb({inferences:n,modelsResponse:l,sellersResponse:o,manualProviders:i,previewPlan:u,activeModelId:f}){const v=bN(l,o,i),h=[...n].sort(NN),p=new Map,x=new Map;let y=0,g=0,j=0;for(const T of h){const E=T.modelId||je,D=T.sellerKey||je,R=T.billingUnit==="images"||T.endpoint==="/v1/images/generations",U=R?0:en(T.promptTokens)??0,Q=R?0:en(T.completionTokens)??0,H=U+Q,G=en(T.settledUsdMicros)??en(T.billedMicros)??0;y+=1,g+=H,j+=G;const K=p.get(E)??yN(E);K.entries.push(T),K.requestCount+=1,K.inputTokens+=U,K.outputTokens+=Q,K.totalSpendMicros+=G,K.touchedSellers.add(D),K.sellerCounts.set(D,(K.sellerCounts.get(D)??0)+1),K.fallbackCount+=en(T.fallbackCount)??0;const $=en(T.ttftMs);$!==void 0&&(K.ttftTotal+=$,K.ttftCount+=1);const I=en(T.durationMs);I!==void 0&&(K.durationTotal+=I,K.durationCount+=1);const Z=en(T.avgOutputTokensPerSecond);Z!==void 0&&(K.outputSpeedTotal+=Z,K.outputSpeedCount+=1),p.set(E,K);const ne=x.get(D)??{requestCount:0,totalTokens:0};ne.requestCount+=1,ne.totalTokens+=H,x.set(D,ne)}const M=Array.from(p.values()).map(T=>xN(T,x,v)).sort(MN);if(M.length===0){const T=gN(f,u,v);T&&M.push(T)}return{rows:M,totalRequests:y,totalTokens:g,totalSpendMicros:j}}function xN(n,l,o){const i=n.entries[n.entries.length-1],u=(i==null?void 0:i.sellerKey)||je,f=hb(u,o),v=n.sellerCounts.get(u)??0,h=l.get(u),p=o.modelsBySellerAndModel.get(`${u}\0${n.modelId}`);return{source:"ledger",modelId:n.modelId,currentSellerId:u,currentSellerName:f.name,currentSellerUrl:f.url,currentSellerStatus:f.status,routeState:f.routeState,currentSellerPaymentMethods:f.paymentMethods,sellerDiscount:f.discount,sellerServiceFee:f.serviceFee,sellerModelCount:f.modelCount,requestCount:n.requestCount,currentSellerModelRequests:v,currentSellerRequests:(h==null?void 0:h.requestCount)??v,inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.inputTokens+n.outputTokens,currentSellerTokens:(h==null?void 0:h.totalTokens)??0,totalSpendMicros:n.totalSpendMicros,tokensPerSecond:Id(n.outputSpeedTotal,n.outputSpeedCount),avgTtftMs:Id(n.ttftTotal,n.ttftCount),avgDurationMs:Id(n.durationTotal,n.durationCount),lastTtftMs:en(i==null?void 0:i.ttftMs),lastDurationMs:en(i==null?void 0:i.durationMs),selectedAt:SN(n.entries,u),lastSellerSwitchAt:jN(n.entries),lastAccessAt:i==null?void 0:i.createdAt,lastRequestId:i==null?void 0:i.requestId,lastStatus:i==null?void 0:i.status,routeReason:i==null?void 0:i.routeReason,upstreamStatus:i==null?void 0:i.upstreamStatus,fallbackCount:n.fallbackCount,falloverChain:(i==null?void 0:i.falloverChain)??[],touchedSellerCount:n.touchedSellers.size,inputPriceMicrosPer1m:p==null?void 0:p.inputPriceMicrosPer1m,outputPriceMicrosPer1m:p==null?void 0:p.outputPriceMicrosPer1m}}function gN(n,l,o){var p,x,y;const i=(p=l==null?void 0:l.routes)==null?void 0:p[0];if(!i||!n)return;const u=hb(i.seller.id,o,i),f=en(i.metrics.ttftMs)??en(i.metrics.avgLatencyMs),v=en(i.metrics.avgInferenceMs),h=o.modelsBySellerAndModel.get(`${i.seller.id}\0${n}`);return{source:"preview",modelId:n,currentSellerId:i.seller.id,currentSellerName:u.name,currentSellerUrl:u.url,currentSellerStatus:u.status,routeState:i.metrics.routeState??u.routeState,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:en(i.metrics.avgTokensPerSecond),avgTtftMs:f,avgDurationMs:v,lastTtftMs:f,lastDurationMs:v,routeReason:l.reason??l.sourceReason??"Preview route",fallbackCount:0,falloverChain:((x=l.routes)==null?void 0:x.map(g=>g.seller.id))??[],touchedSellerCount:((y=l.routes)==null?void 0:y.length)??1,inputPriceMicrosPer1m:h==null?void 0:h.inputPriceMicrosPer1m,outputPriceMicrosPer1m:h==null?void 0:h.outputPriceMicrosPer1m}}function bN(n,l,o){const i=new Map;for(const u of(n==null?void 0:n.data)??[]){const f=i.get(u.sellerId)??new Set;f.add(u.id),i.set(u.sellerId,f)}return{registryById:new Map(((l==null?void 0:l.sellers)??[]).map(u=>[u.id,u])),catalogById:new Map(((n==null?void 0:n.sellers)??[]).map(u=>[u.id,u])),manualProvidersById:new Map((o??[]).map(u=>[u.id,u])),modelsBySellerAndModel:new Map(((n==null?void 0:n.data)??[]).map(u=>[`${u.sellerId}\0${u.id}`,u])),modelCountsBySellerId:new Map(Array.from(i.entries()).map(([u,f])=>[u,f.size]))}}function yN(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,outputSpeedTotal:0,outputSpeedCount:0,fallbackCount:0}}function SN(n,l){var o;for(let i=n.length-1;i>=0;i-=1){const u=n[i];if(u.sellerKey!==l)return(o=n[i+1])==null?void 0:o.createdAt;if(i===0)return u.createdAt}}function jN(n){let l;for(let o=1;o<n.length;o+=1)n[o].sellerKey!==n[o-1].sellerKey&&(l=n[o].createdAt);return l}function hb(n,l,o){const i=l.catalogById.get(n),u=l.registryById.get(n),f=l.manualProvidersById.get(n),v=(o==null?void 0:o.metrics.discountRatio)??(i==null?void 0:i.discountRatio);return{name:wN((o==null?void 0:o.seller.name)??(i==null?void 0:i.name)??(u==null?void 0:u.name)??(f==null?void 0:f.name)??n),url:(o==null?void 0:o.seller.url)??(i==null?void 0:i.url)??(u==null?void 0:u.url)??(f==null?void 0:f.baseUrl),status:(i==null?void 0:i.status)??(u==null?void 0:u.status)??(f==null?void 0:f.status)??je,routeState:(o==null?void 0:o.metrics.routeState)??(i==null?void 0:i.routeState),paymentMethods:(i==null?void 0:i.paymentMethods)??(u==null?void 0:u.paymentMethods)??(o==null?void 0:o.seller.paymentMethods)??[],discount:Cs(v),serviceFee:Fj(i==null?void 0:i.serviceFeeRatio),modelCount:(i==null?void 0:i.modelCount)??l.modelCountsBySellerId.get(n)}}function NN(n,l){return gc(n.createdAt)-gc(l.createdAt)}function MN(n,l){return gc(l.lastAccessAt)-gc(n.lastAccessAt)}function gc(n){if(!n)return 0;const l=new Date(n).getTime();return Number.isNaN(l)?0:l}function Id(n,l){return l>0?n/l:void 0}function en(n){return Number.isFinite(n)?n:void 0}function wN(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function Dx(){var be,Ve,Oe,wt,ht,yn,et,Be,nn,an,Sn,ln,Fe,Dt,rn,Xn,sn,ct,Xa,da,Fn,qn,Zn,fa,Ul,Pn,Ut,pt,$t,vt,ma;const{t:n}=xr(),[l,o]=S.useState(null),[i,u]=T2(),f=S.useRef(null),v=sm(),h=Ig(),p=Wg(),x=eb(),y=rm(),g=nm(),j=am(),M=lm(),T=g.refetch,E=j.reset,D=Mc(),R=im(),U=Us(),Q=Hj(),H=Kj(),G=((be=D.data)==null?void 0:be.inferences)??[],K=((Ve=g.data)==null?void 0:Ve.payments)??[],$=new Set((((Oe=U.data)==null?void 0:Oe.data)??[]).map(De=>De.id)).size,I=((wt=R.data)==null?void 0:wt.sellers.length)??((yn=(ht=U.data)==null?void 0:ht.sellers)==null?void 0:yn.length)??0,Z=S.useMemo(()=>KN(G),[G]),ne=S.useMemo(()=>nb(K,G),[G,K]),B=S.useMemo(()=>{var De;return mb({inferences:G,manualProviders:(De=y.data)==null?void 0:De.providers,modelsResponse:U.data,sellersResponse:R.data})},[G,(et=y.data)==null?void 0:et.providers,U.data,R.data]),te=K.some(De=>oa(De.method)==="clawtip"&&(De.enabled||rb(De.config,"walletConfigPresent")))||((Be=j.data)==null?void 0:Be.walletConfigPresent)===!0,xe=((nn=v.data)==null?void 0:nn.status)==="running"&&!v.isError,fe=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),O=ne.find(De=>K.some(jn=>jn.method===De.method&&jn.isDefault))??ne.find(De=>De.status==="Bound"),ee=((an=p.data)==null?void 0:an.active)??((Sn=p.data)==null?void 0:Sn.mode)??((ln=v.data)==null?void 0:ln.selectionMode),re=((Fe=y.data)==null?void 0:Fe.providers.length)??0,ae=new Set((((Dt=y.data)==null?void 0:Dt.providers)??[]).flatMap(De=>De.models)).size,ge=((rn=x.data)==null?void 0:rn.config.range)??TN((Xn=h.data)==null?void 0:Xn.strategy.mode),N=((sn=x.data)==null?void 0:sn.config.modelIds.length)??0,q=ge==="custom"?((ct=x.data)==null?void 0:ct.config.sellerIds.length)??((da=(Xa=h.data)==null?void 0:Xa.strategy.sellerIds)==null?void 0:da.length)??0:I,X=ee==="manual"?re:q||I||re,le=ee==="manual"?ae:N||$||ae,pe=CN({activeMode:ee,autoModelCount:N,autoRange:ge,autoSellerCount:q,manualProviderCount:re,manualPolicy:(Fn=y.data)==null?void 0:Fn.routing.policy,paymentName:O==null?void 0:O.name,scorer:((qn=x.data)==null?void 0:qn.config.scorer)??((Zn=h.data)==null?void 0:Zn.strategy.scorer)??((fa=v.data)==null?void 0:fa.sellerRoutingScorer),t:n}),de=()=>{o(null),j.reset(),M.reset()};return S.useEffect(()=>{const De=i.get("activatePayment");if(!De||oa(De)!=="clawtip"||f.current===De)return;f.current=De,o({kind:"activate",method:"clawtip"}),j.mutate();const jn=new URLSearchParams(i);jn.delete("activatePayment"),u(jn,{replace:!0})},[j,i,u]),S.useEffect(()=>{if((l==null?void 0:l.kind)!=="activate"||oa(l.method)!=="clawtip"||te)return;const De=window.setInterval(()=>{T()},1500);return()=>window.clearInterval(De)},[te,l==null?void 0:l.kind,l==null?void 0:l.method,T]),S.useEffect(()=>{(l==null?void 0:l.kind)==="activate"&&oa(l.method)==="clawtip"&&te&&(o(null),E())},[te,l==null?void 0:l.kind,l==null?void 0:l.method,E]),s.jsxs("div",{className:"min-w-0 overflow-x-hidden space-y-3",children:[s.jsx(RN,{currentVersion:(Ul=Q.data)==null?void 0:Ul.currentVersion,latestVersion:(Pn=Q.data)==null?void 0:Pn.latestVersion,updateAvailable:(Ut=Q.data)==null?void 0:Ut.updateAvailable,running:H.isPending,result:H.data,error:H.error,onUpdate:()=>H.mutate()}),s.jsxs("section",{className:"grid grid-cols-2 gap-2.5 md:grid-cols-3 xl:grid-cols-6",children:[s.jsx(LN,{icon:s.jsx(Zg,{className:"size-4"}),...pe}),s.jsx(ef,{to:"/ledger",icon:s.jsx(em,{className:"size-4"}),label:"Today requests",value:ye(Z.todayRequestCount),note:`${ye(Z.totalRequestCount)} total`,tone:"requests"}),s.jsx(ef,{to:"/ledger",icon:s.jsx(Ns,{className:"size-4"}),label:"Inference cost",value:Ka(Z.todaySpendMicros,{digits:4}),note:`${Ka(Z.totalSpendMicros,{digits:4})} total`,tone:"spend"}),s.jsx(UN,{inputTokens:Z.inputTokens,outputTokens:Z.outputTokens}),s.jsx(ef,{to:"/routing",icon:s.jsx(OS,{className:"size-4"}),label:"Nodes",value:ye(X),note:`${ye(le)} models`,tone:"inventory"})]}),s.jsx("section",{className:"grid min-w-0 gap-3",children:s.jsxs("div",{className:"min-w-0 space-y-3",children:[s.jsx(zN,{rows:B.rows}),s.jsxs(_t,{className:"p-3",children:[s.jsxs("div",{className:"mb-2 flex min-w-0 flex-col gap-2",children:[s.jsx("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(jj,{className:"size-4 shrink-0 text-[var(--color-purple)]"}),s.jsx("h2",{className:"truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:"Token usage"})]})}),s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-[0.7rem] text-[var(--color-muted)]",children:[Z.modelUsage.map(De=>s.jsx($N,{model:De.model,color:De.color},De.model)),s.jsx(Bx,{label:"in"}),s.jsx(Bx,{label:"out",dashed:!0})]})]}),s.jsxs("div",{className:"grid min-w-0 gap-3 sm:grid-cols-[minmax(0,1fr)_190px]",children:[s.jsx(BN,{days:Z.days,series:Z.modelUsage}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx(qN,{days:Z.days,values:Z.cost,total:Ka(Z.weeklySpendMicros)}),s.jsx(PN,{values:Z.thirtyDaySpend,total:Ka(Z.totalSpendMicros)})]})]})]})]})}),s.jsx(QN,{checkedAt:fe,healthy:xe,pid:(pt=v.data)==null?void 0:pt.pid,status:($t=v.data)==null?void 0:$t.status,proxyPort:(vt=v.data)==null?void 0:vt.proxyPort,controlPort:(ma=v.data)==null?void 0:ma.controlPort}),l?s.jsx(ab,{modal:l,methods:ne,qr:l.kind==="activate"?j.data:M.data,loading:l.kind==="activate"?j.isPending:M.isPending,error:l.kind==="activate"?j.error:M.error,onClose:de}):null]})}function CN({activeMode:n,autoModelCount:l,autoRange:o,autoSellerCount:i,manualProviderCount:u,manualPolicy:f,paymentName:v,scorer:h,t:p}){const x=n==="auto"?p("overview.providerMode.autoValue"):n==="manual"?p("overview.providerMode.manualValue"):je;if(n==="auto"){const y=kN(h,p);return{label:p("overview.providerMode.label"),value:x,detail:p("overview.providerMode.autoStats",{range:AN(o,p),models:l,modelPlural:l===1?"":"s",sellers:i,sellerPlural:i===1?"":"s"}),note:v?p("overview.providerMode.autoPolicy",{scorer:y,payment:v}):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:EN(f,p)}),note:p("overview.providerMode.manualNote")}}function TN(n){if(n==="fixedSet")return"custom";if(n==="fullAuto")return"recommended"}function AN(n,l){return l(n==="custom"?"overview.providerMode.customRange":"overview.providerMode.recommendedRange")}function EN(n,l){return l(n==="locked"?"overview.providerMode.fixedProvider":"overview.providerMode.fallbackPolicy")}function kN(n,l){return l(n==="speed"?"overview.providerMode.speedScorer":n==="discount"?"overview.providerMode.costScorer":"overview.providerMode.balancedScorer")}function RN({currentVersion:n,latestVersion:l,updateAvailable:o,running:i,result:u,error:f,onUpdate:v}){if(!o&&!i&&!u&&!f)return null;const h=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)??h??(n&&l?`TokenBuddy ${n} -> ${l}`:"TokenBuddy update available"),x=!!(f||(u==null?void 0:u.install.succeeded)===!1||u!=null&&u.restart.error);return s.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:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.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:s.jsx(pr,{className:["size-4",i?"animate-spin":""].join(" ")})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[0.82rem] font-semibold text-[var(--color-ink)]",children:"TokenBuddy update"}),s.jsx("div",{className:"truncate text-[0.74rem] text-[var(--color-muted)]",children:p})]})]}),o?s.jsxs("button",{type:"button",onClick:v,disabled:i,className:"tb-button tb-button-sm tb-button-secondary shrink-0 disabled:cursor-wait",children:[s.jsx(pr,{className:["size-3.5",i?"animate-spin":""].join(" ")}),i?"Updating":"Update"]}):null]})}function zN({rows:n}){const l=n.slice(0,3);return s.jsxs(_t,{className:"overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--color-line-2)] px-3.5 py-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(Zg,{className:"size-4 shrink-0 text-[var(--color-purple)]"}),s.jsx("h2",{className:"truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:"Recent model routes"})]}),s.jsx(vr,{to:"/routing",className:"tb-button tb-button-sm tb-button-secondary shrink-0",children:"Details"})]}),l.length>0?s.jsxs("div",{children:[s.jsxs("div",{className:"hidden grid-cols-[minmax(0,1fr)_minmax(180px,0.85fr)_70px_minmax(116px,0.6fr)_minmax(116px,0.6fr)_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:[s.jsx("div",{children:"Model"}),s.jsx("div",{children:"Node"}),s.jsx("div",{className:"text-right",children:"Disc"}),s.jsx("div",{className:"text-right",children:"Token"}),s.jsx("div",{className:"text-right",children:"Speed"}),s.jsx("div",{className:"text-right",children:"Switch"})]}),s.jsx("div",{className:"divide-y divide-[var(--color-line-2)]",children:l.map(o=>s.jsx(_N,{row:o},`${o.modelId}-${o.currentSellerId}`))})]}):s.jsx("div",{className:"px-3.5 py-7 text-center text-[0.82rem] text-[var(--color-muted)]",children:"No model traffic yet."})]})}function _N({row:n}){const l=n.lastSellerSwitchAt??n.selectedAt;return s.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)_70px_minmax(116px,0.6fr)_minmax(116px,0.6fr)_96px] lg:items-center lg:gap-2",children:[s.jsxs("div",{className:"col-span-2 min-w-0 lg:col-span-1",children:[s.jsx("div",{className:"truncate font-mono text-[0.84rem] font-semibold text-[var(--color-ink)]",title:n.modelId,children:n.modelId}),s.jsxs("div",{className:"mt-0.5 text-[0.72rem] font-medium text-[var(--color-muted)]",children:[ye(n.requestCount)," requests"]})]}),s.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:[s.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:"Node"}),s.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:"min-w-0 truncate text-[0.82rem] font-semibold text-[var(--color-ink)]",title:n.currentSellerName,children:n.currentSellerName}),s.jsx(ON,{row:n})]}),s.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.68rem] text-[var(--color-muted)]",title:n.currentSellerId,children:Ls(n.currentSellerId)})]}),s.jsx(Lx,{label:"Disc",value:n.sellerDiscount,title:`Node discount: ${n.sellerDiscount}`}),s.jsxs(Ux,{label:"Token",title:`Input tokens: ${ye(n.inputTokens)} / Output tokens: ${ye(n.outputTokens)}`,children:[s.jsx(lc,{label:"In",value:xc(n.inputTokens)}),s.jsx(lc,{label:"Out",value:xc(n.outputTokens)})]}),s.jsxs(Ux,{label:"Speed",title:`Time to first token: ${ca(n.lastTtftMs??n.avgTtftMs)} / Tokens per second: ${ws(n.tokensPerSecond)}`,children:[s.jsx(lc,{label:"TTFT",value:ca(n.lastTtftMs??n.avgTtftMs)}),s.jsx(lc,{label:"Tok/s",value:tb(n.tokensPerSecond)})]}),s.jsx(Lx,{label:"Switch",value:Wj(l),title:`Last node switch: ${wc(l)}`})]})}function ON({row:n}){const l=DN(n),o={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"}[l.tone];return s.jsx("span",{className:["shrink-0 rounded-full px-1.5 py-0.5 text-[0.62rem] font-semibold uppercase",o].join(" "),children:l.label})}function DN(n){return n.source==="preview"?{label:"preview",tone:"amber"}:n.routeState?{label:bn(n.routeState),tone:sa(n.routeState)}:n.upstreamStatus&&!Wd(n.upstreamStatus)?{label:bn(n.upstreamStatus),tone:sa(n.upstreamStatus)}:n.lastStatus&&!Wd(n.lastStatus)?{label:bn(n.lastStatus),tone:sa(n.lastStatus)}:n.currentSellerStatus&&!Wd(n.currentSellerStatus)?{label:bn(n.currentSellerStatus),tone:sa(n.currentSellerStatus)}:{label:"ok",tone:"green"}}function Wd(n){const l=bn(n);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"}function Ux({label:n,title:l,children:o}){return s.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:[s.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:n}),s.jsx("div",{className:"grid gap-0.5 font-mono text-[0.74rem] font-semibold leading-snug text-[var(--color-ink)]",children:o})]})}function lc({label:n,value:l}){return s.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-2 lg:justify-end",children:[s.jsx("span",{className:"shrink-0 text-[0.6rem] font-semibold uppercase tracking-normal text-[var(--color-muted)]",children:n}),s.jsx("span",{className:"truncate",children:l})]})}function Lx({label:n,value:l,title:o}){return s.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:o??`${n}: ${l}`,children:[s.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:n}),s.jsx("div",{className:"truncate font-mono text-[0.76rem] font-semibold text-[var(--color-ink)]",children:l})]})}function ef({to:n,icon:l,label:o,value:i,note:u,tone:f}){const v=Bs(f);return s.jsxs(vr,{to:n,"aria-label":`Open ${o}`,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)]",v.card].join(" "),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(um,{tone:f,children:l}),s.jsx("span",{className:["text-right text-[0.66rem] font-semibold uppercase leading-3 tracking-[0.08em]",v.label].join(" "),children:o})]}),s.jsx("div",{className:["mt-2 text-[1.25rem] font-semibold leading-none tracking-tight",v.value].join(" "),children:i}),s.jsx("div",{className:["mt-1.5 truncate text-[0.72rem] font-medium",v.note].join(" "),children:u})]})}function UN({inputTokens:n,outputTokens:l}){const o=Bs("tokens");return s.jsx(vr,{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)]",o.card].join(" "),children:s.jsx(rN,{inputTokens:n,outputTokens:l})})}function LN({icon:n,label:l,value:o,detail:i,note:u}){const f=Bs("router");return s.jsxs(vr,{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:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(um,{tone:"router",children:n}),s.jsx("span",{className:["text-right text-[0.66rem] font-semibold uppercase leading-3 tracking-[0.08em]",f.label].join(" "),children:l})]}),s.jsx("div",{className:["mt-2 text-[1.25rem] font-semibold leading-none tracking-tight",f.value].join(" "),children:o}),s.jsx("div",{className:["mt-1.5 truncate text-[0.72rem] font-semibold",f.note].join(" "),children:i}),s.jsx("div",{className:"mt-0.5 truncate text-[0.68rem] font-medium text-[var(--color-muted)]",children:u})]})}function BN({days:n,series:l}){const u={top:14,right:18,bottom:26,left:26},f=l.flatMap(x=>[...x.input,...x.output]),v=Math.max(1,...f),h=x=>u.left+x*(680-u.left-u.right)/Math.max(1,n.length-1),p=x=>u.top+(1-x/v)*(150-u.top-u.bottom);return s.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:s.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=>s.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)=>s.jsx("text",{x:h(y),y:143,textAnchor:"middle",className:"fill-[var(--color-muted)] text-[10px]",children:x},x)),l.map(x=>s.jsxs("g",{children:[s.jsx("path",{d:Ef(x.input.map((y,g)=>[h(g),p(y)])),fill:"none",stroke:x.color,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:Ef(x.output.map((y,g)=>[h(g),p(y)])),fill:"none",stroke:x.color,strokeWidth:"2.4",strokeDasharray:"5 5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.75"}),x.input.map((y,g)=>s.jsx("circle",{cx:h(g),cy:p(y),r:"2.7",fill:x.color},`${x.model}-input-${g}`)),x.output.map((y,g)=>s.jsx("circle",{cx:h(g),cy:p(y),r:"2.2",fill:"#fff",stroke:x.color,strokeWidth:"1.8"},`${x.model}-output-${g}`))]},x.model)),l.length===0?s.jsx("text",{x:680/2,y:150/2,textAnchor:"middle",className:"fill-[var(--color-muted)] text-[12px]",children:"No token usage yet"}):null]})})}function qN({days:n,values:l,total:o}){const f={top:10,right:8,bottom:16,left:8},v=Math.max(1,...l),h=x=>f.left+x*(190-f.left-f.right)/Math.max(1,l.length-1),p=x=>f.top+(1-x/v)*(72-f.top-f.bottom);return s.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[s.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-ink)]",children:"Inference cost"}),s.jsx("span",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:o})]}),s.jsxs("svg",{className:"h-[66px] w-full",viewBox:"0 0 190 72",role:"img","aria-label":"Daily inference cost curve",children:[s.jsx("path",{d:Ef(l.map((x,y)=>[h(y),p(x)])),fill:"none",stroke:"var(--color-chart-cost)",strokeWidth:"3",strokeLinecap:"round"}),l.map((x,y)=>s.jsx("circle",{cx:h(y),cy:p(x),r:"2.4",fill:"var(--color-chart-cost)"},n[y]))]})]})}function PN({values:n,total:l}){const o=Math.max(1,...n);return s.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-ink)]",children:"30 day inference cost"}),s.jsx("span",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:l})]}),s.jsx("div",{className:"flex h-[60px] items-end gap-1",children:n.map((i,u)=>s.jsx("span",{className:"flex-1 rounded-t-[3px] bg-[var(--color-tokens)]/75",style:{height:`${Math.max(8,i/o*100)}%`}},u))})]})}function Ef(n){return n.length===0?"":n.length===1?`M ${n[0][0]} ${n[0][1]}`:n.reduce((l,o,i)=>{if(i===0)return`M ${o[0]} ${o[1]}`;const u=n[i-1],f=(u[0]+o[0])/2;return`${l} C ${f} ${u[1]}, ${f} ${o[1]}, ${o[0]} ${o[1]}`},"")}function $N({model:n,color:l}){return s.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:[s.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:l}}),s.jsx("span",{className:"truncate font-mono text-[0.68rem]",children:n})]})}function Bx({label:n,dashed:l=!1}){return s.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:[s.jsx("span",{className:["h-px w-4 border-t border-[var(--color-ink)]",l?"border-dashed":""].join(" ")}),s.jsx("span",{className:"font-mono text-[0.68rem]",children:n})]})}function QN({checkedAt:n,healthy:l,pid:o,status:i,proxyPort:u,controlPort:f}){const v=[{icon:s.jsx(KS,{className:"size-3"}),label:"Daemon",value:o?`pid ${o}`:i??je,tone:l?"green":"amber"},{icon:s.jsx(lj,{className:"size-3"}),label:"Proxy",value:u?`:${u}`:je,tone:"blue"},{icon:s.jsx(mj,{className:"size-3"}),label:"Control",value:f?`:${f}`:je,tone:"router"}];return s.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:[s.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:[s.jsx(pr,{className:"size-3.5"}),n]}),v.map(h=>s.jsx(HN,{...h},h.label))]})}function HN({icon:n,label:l,value:o,tone:i}){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)]"}[i];return s.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:[s.jsx("span",{className:["grid size-5 shrink-0 place-items-center rounded-[var(--radius-sm)]",u].join(" "),children:n}),s.jsx("span",{className:"text-[0.72rem] font-semibold text-[var(--color-ink)]",children:l}),s.jsx("span",{className:"min-w-0 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:o})]})}function KN(n){const l=qx(7),o=qx(30),i=kf(new Date),u=new Set(l.map(K=>K.key)),f=new Map(o.map((K,$)=>[K.key,$])),v=["var(--color-chart-input)","var(--color-spend)","var(--color-chart-cost)","var(--color-inventory)"],h=new Map,p=l.map(()=>0),x=o.map(()=>0);let y=0,g=0,j=0,M=0,T=0,E=0,D=0,R=0,U=0,Q=0,H=0;for(const K of n){const $=kf(new Date(K.createdAt)),I=K.settledUsdMicros??K.billedMicros??0,Z=YN(K),ne=Z?0:K.promptTokens??0,B=Z?0:K.completionTokens??0,ie=Z?Number.isFinite(K.imageCount)?K.imageCount:1:0;H+=1,g+=I,U+=ie,M+=ne,T+=B,$===i&&(Q+=1,y+=I,R+=ie,E+=ne,D+=B);const te=l.findIndex(fe=>fe.key===$);if(te>=0){j+=I,p[te]+=I/1e6;const fe=h.get(K.modelId)??{input:l.map(()=>0),output:l.map(()=>0),total:0};fe.input[te]+=ne,fe.output[te]+=B,fe.total+=ne+B,h.set(K.modelId,fe)}else u.has($)&&(j+=I);const xe=f.get($);xe!==void 0&&(x[xe]+=I/1e6)}const G=Array.from(h.entries()).sort((K,$)=>$[1].total-K[1].total).slice(0,4).map(([K,$],I)=>({model:K,color:v[I%v.length],input:$.input,output:$.output}));return{days:l.map(K=>K.label),modelUsage:G,cost:p,thirtyDaySpend:x,todaySpendMicros:y,totalSpendMicros:g,weeklySpendMicros:j,inputTokens:M,outputTokens:T,todayInputTokens:E,todayOutputTokens:D,todayImageCount:R,totalImageCount:U,todayRequestCount:Q,totalRequestCount:H}}function YN(n){return n.billingUnit==="images"||n.endpoint==="/v1/images/generations"}function qx(n){const l=[],o=new Intl.DateTimeFormat("en",{weekday:"short"});for(let i=n-1;i>=0;i-=1){const u=new Date;u.setHours(0,0,0,0),u.setDate(u.getDate()-i),l.push({key:kf(u),label:o.format(u)})}return l}function kf(n){if(Number.isNaN(n.getTime()))return"";const l=n.getFullYear(),o=String(n.getMonth()+1).padStart(2,"0"),i=String(n.getDate()).padStart(2,"0");return`${l}-${o}-${i}`}const GN=[{value:"balanced",label:"Balanced"},{value:"speed",label:"Speed"},{value:"discount",label:"Cost"}],Rf=10,VN=["clawtip"];function XN(){var Ja,Ia,ut,Pe,at,xa,br,qs,Ps,yi,Wa,yr,ga,ba,el,ya,dt,Si;const n=Ig(),l=Wg(),o=Aj(),i=eb(),u=Ej(),f=rm(),v=Dj(),h=Rj(),p=zj(),x=_j(),y=Oj(),g=Lj(),j=Bj(),M=im(),T=Us(),E=Pj(),D=$j(),R=Qj(),U=Mc(),Q=nm(),H=Cj(),G=am(),K=lm(),[$,I]=S.useState({mode:"fullAuto",scorer:"balanced"}),[Z,ne]=S.useState([]),[B,ie]=S.useState(""),[te,xe]=S.useState("manual"),[fe,O]=S.useState("recommended"),[ee,re]=S.useState(null),[ae,ge]=S.useState(null),[N,q]=S.useState(null),[X,le]=S.useState(null),pe=qj({...$,modelId:B}),de=T.data,be=((Ja=f.data)==null?void 0:Ja.providers)??[],Ve=((Ia=f.data)==null?void 0:Ia.routing)??{policy:"fallback"},Oe=((ut=M.data)==null?void 0:ut.sellers)??[],wt=((Pe=R.data)==null?void 0:Pe.focusSet)??[],ht=((at=U.data)==null?void 0:at.inferences)??[],yn=S.useMemo(()=>MM(ht),[ht]),et=S.useMemo(()=>SM((de==null?void 0:de.data)??[],wt),[wt,de==null?void 0:de.data]),Be=kM(pe.data),nn=S.useMemo(()=>AM(Oe,de,(Be==null?void 0:Be.routes)??[]),[de,Be==null?void 0:Be.routes,Oe]),an=S.useMemo(()=>Z.map(J=>et.find(W=>W.id===J)).filter(mm),[et,Z]),Sn=$.sellerIds??[],ln=te==="auto"&&Z.length>0,Fe=kj({modelIds:Z,scope:fe,sellerIds:fe==="custom"?Sn:void 0,scorer:$.scorer,topK:Rf,enabled:ln}),Dt=((xa=Q.data)==null?void 0:xa.payments)??[],rn=((br=l.data)==null?void 0:br.paymentReady)===!0||((qs=i.data)==null?void 0:qs.paymentReady)===!0,Xn=((Ps=i.data)==null?void 0:Ps.paymentLabel)??((yi=l.data)==null?void 0:yi.paymentLabel),sn=S.useMemo(()=>OM(Dt,{ready:rn,label:Xn}),[Dt,Xn,rn]),ct=S.useMemo(()=>nb(Dt,ht),[ht,Dt]),Xa=S.useMemo(()=>{var J,W;return Z.length>0?CM({recommended:((J=Fe.data)==null?void 0:J.sellers)??[],excluded:fe==="custom"?((W=Fe.data)==null?void 0:W.excludedSellers)??[]:[],baseSellers:nn}):[]},[fe,(Wa=Fe.data)==null?void 0:Wa.excludedSellers,(yr=Fe.data)==null?void 0:yr.sellers,Z.length,nn]),da=Fe.isError?Fe.error instanceof Error?Fe.error.message:String(Fe.error):null,Fn=i.isLoading||T.isLoading||M.isLoading||ln&&Fe.isLoading,qn=!Fn&&(i.isFetching||T.isFetching||M.isFetching||ln&&Fe.isFetching),Zn=S.useMemo(()=>mb({inferences:ht,modelsResponse:de,sellersResponse:M.data,manualProviders:be,previewPlan:Be,activeModelId:B}),[B,ht,be,de,Be,M.data]),fa=S.useMemo(()=>wM(Zn.rows,ht),[ht,Zn.rows]),Pn=Dt.some(J=>Ln(J.method)==="clawtip"&&(J.enabled||xb(J.config,"walletConfigPresent")))||((ga=G.data)==null?void 0:ga.walletConfigPresent)===!0,Ut=te==="auto"&&sn.active;S.useEffect(()=>{if(!ae)return;const J=window.setTimeout(()=>ge(null),4200);return()=>window.clearTimeout(J)},[ae]),S.useEffect(()=>{var J,W,Ce;if((J=n.data)!=null&&J.strategy){if(((W=l.data)==null?void 0:W.active)==="auto"&&((Ce=i.data)!=null&&Ce.config))return;I(n.data.strategy)}},[(ba=i.data)==null?void 0:ba.config,(el=l.data)==null?void 0:el.active,(ya=n.data)==null?void 0:ya.strategy]),S.useEffect(()=>{l.data&&xe(l.data.active)},[l.data]),S.useEffect(()=>{!sn.active||!ee||!LM(ee)||re(null)},[ee,sn.active]),S.useEffect(()=>{var W;const J=(W=i.data)==null?void 0:W.config;J&&(O(J.range),I(Ce=>({...Ce,mode:J.range==="custom"?"fixedSet":"fullAuto",scorer:J.scorer,sellerId:void 0,sellerIds:J.sellerIds})),J.modelIds.length>0&&(ne(J.modelIds),ie(Ce=>J.modelIds.includes(Ce)?Ce:J.modelIds[0]??"")))},[(dt=i.data)==null?void 0:dt.config]),S.useEffect(()=>{const J=!R.isLoading&&!U.isLoading;if(Z.length>0||et.length===0||!J)return;const W=jM({focusModels:wt,referencedModelIds:yn,modelOptions:et});W.length!==0&&(ne(W),ie(W[0]??""))},[wt,R.isLoading,U.isLoading,et,yn,Z.length]),S.useEffect(()=>{!B||Z.includes(B)||ie(Z[0]??"")},[B,Z]),S.useEffect(()=>{B&&pe.refetch()},[B,$.mode,$.scorer,$.sellerId,(Si=$.sellerIds)==null?void 0:Si.join(","),zM($.fixedByModel)]),S.useEffect(()=>{if((X==null?void 0:X.kind)!=="activate"||Ln(X.method)!=="clawtip"||Pn)return;const J=window.setInterval(()=>{Q.refetch()},1500);return()=>window.clearInterval(J)},[Pn,X==null?void 0:X.kind,X==null?void 0:X.method,Q.refetch]),S.useEffect(()=>{(X==null?void 0:X.kind)==="activate"&&Ln(X.method)==="clawtip"&&Pn&&(le(null),G.reset())},[G,Pn,X==null?void 0:X.kind,X==null?void 0:X.method]);function pt(J){ne(W=>{const Ce=W.filter(At=>At!==J);return B===J&&ie(Ce[0]??""),Af(Ce).catch(()=>{}),Ut&&Mn({modelIds:Ce}),Ce})}function $t(J){const W=Array.from(new Set(J));ne(W),ie(Ce=>W.includes(Ce)?Ce:W[0]??""),Af(W).catch(()=>{}),Ut&&Mn({modelIds:W})}function vt(J){I(W=>({...W,scorer:J})),Ut&&Mn({scorer:J})}function ma(J,W){const Ce=$.sellerIds??[],At=Ce.includes(W)?Ce.filter(ql=>ql!==W):[...Ce,W];De(At)}function De(J){const W={...$,mode:"fixedSet",sellerIds:J,sellerId:void 0};I(W),Ut&&fe==="custom"&&Mn({range:"custom",sellerIds:J})}async function jn(J){await h.mutateAsync({name:J.name.trim()||"Custom endpoint",baseUrl:J.baseUrl.trim(),apiKey:J.apiKey.trim(),enabled:!0}),q(null)}async function ha(J,W){await p.mutateAsync({providerId:J,input:{name:W.name.trim()||"Custom endpoint",baseUrl:W.baseUrl.trim(),apiKey:W.apiKey.trim(),enabled:!0}}),q(null)}function pa(J){x.mutateAsync(J).catch(W=>{re(W instanceof Error?W.message:String(W))})}function va(J){v.mutateAsync(J).catch(W=>{re(W instanceof Error?W.message:String(W))})}function Nn(J){const W=be.findIndex(At=>At.id===J);if(W<=0)return;const Ce=be.map(At=>At.id);[Ce[W-1],Ce[W]]=[Ce[W],Ce[W-1]],y.mutateAsync(Ce).catch(At=>{re(At instanceof Error?At.message:String(At))})}function Lt(J){ge(J)}function Jn(J){g.mutateAsync(J.id).then(W=>{Lt({tone:"success",title:`${J.name} is healthy`,detail:`say hi · ${W.modelId} · ${ca(W.elapsedMs)}`})}).catch(W=>{Lt({tone:"error",title:`${J.name} test failed`,detail:W instanceof Error?W.message:String(W)})})}function gr(J){j.mutateAsync(J.id).then(W=>{Lt({tone:"success",title:`${J.name} models refreshed`,detail:`${ye(W.modelIds.length)} models · ${ca(W.elapsedMs)}`})}).catch(W=>{Lt({tone:"error",title:`${J.name} model refresh failed`,detail:W instanceof Error?W.message:String(W)})})}function Ll(J){E.mutateAsync(J.id).then(W=>{Fe.refetch(),Lt({tone:"success",title:`${J.name} is healthy`,detail:`say hi · ${W.modelId} · ${ca(W.elapsedMs)}`})}).catch(W=>{Lt({tone:"error",title:`${J.name} test failed`,detail:W instanceof Error?W.message:String(W)})})}function Fa(J){D.mutateAsync().then(W=>{Fe.refetch();const Ce=W.data.filter(At=>At.sellerId===J.id).length;Lt({tone:"success",title:`${J.name} models refreshed`,detail:`${ye(Ce)} node models · ${ye(W.data.length)} total`})}).catch(W=>{Lt({tone:"error",title:`${J.name} model refresh failed`,detail:W instanceof Error?W.message:String(W)})})}function ue(J){O(J),J==="custom"&&Sn.length===0&&q({kind:"sellers"}),Ut&&Mn({range:J})}function Ze(J){xe(J),re(null),o.mutateAsync(J).then(W=>{xe(W.active),W.strategy&&I(W.strategy)}).catch(W=>{re(W instanceof Error?W.message:String(W))})}function Je(J){re(null),H.mutateAsync(J).catch(W=>{re(W instanceof Error?W.message:String(W))})}function In(J){le({kind:"activate",method:J}),Ln(J)==="clawtip"&&G.mutate()}function Bl(J){le({kind:"recharge",method:J}),Ln(J)==="clawtip"&&K.mutate()}function Za(){le(null),G.reset(),K.reset()}async function Mn(J={}){var $s;if(!sn.active){re("Bind a payment method to enable Auto routing.");return}const W=J.scorer??$.scorer,Ce=J.range??fe,At=J.modelIds??Z,ql=J.sellerIds??Sn;I(Ce==="recommended"?{mode:"fullAuto",scorer:W}:{mode:"fixedSet",scorer:W,sellerIds:ql}),re(null);try{const wn=await u.mutateAsync(NM({base:($s=i.data)==null?void 0:$s.config,enabled:!0,range:Ce,scorer:W,modelIds:At,sellerIds:ql}));xe(wn.active),wn.strategy&&I(wn.strategy)}catch(wn){re(wn instanceof Error?wn.message:String(wn))}}return s.jsxs("div",{className:"space-y-5",children:[s.jsx("section",{children:s.jsxs(_t,{className:"overflow-hidden",children:[s.jsx(FN,{activeTab:te,onChange:Ze}),s.jsxs("div",{className:"p-4",children:[n.isLoading||l.isLoading||M.isLoading||T.isLoading||f.isLoading?s.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||M.isError||T.isError||f.isError?s.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,te==="manual"?s.jsx(ZN,{providers:be,routing:Ve,onAdd:()=>q({kind:"manualProvider"}),onRemove:pa,onSetRouting:va,onMoveUp:Nn,onTest:Jn,onRefreshModels:gr,onViewModels:J=>q({kind:"manualProviderModels",provider:J}),onEdit:J=>q({kind:"manualProviderEdit",provider:J}),testingProviderId:g.isPending?g.variables:void 0,refreshingModelsProviderId:j.isPending?j.variables:void 0}):s.jsx(nM,{walletAccess:sn,paymentMethods:ct,selectedModels:an,activeModelId:B,range:fe,scorer:$.scorer,effectiveSellers:Xa,selectedSellerIds:Sn,sellerActivityById:fa,loading:Fn,refreshing:qn,applyError:ee,recommendationError:da,focusSaveError:R.isError,onSelectPayment:Je,onActivatePayment:In,onRechargePayment:Bl,onAddModels:()=>q({kind:"models"}),onSetActiveModel:ie,onRemoveModel:pt,onRangeChange:ue,onScorerChange:vt,onChooseSellers:()=>q({kind:"sellers"}),onRemoveSeller:J=>ma(B,J),onTestSeller:Ll,onRefreshSellerModels:Fa,testingSellerId:E.isPending?E.variables:void 0,refreshingSellerModels:D.isPending})]})]})}),s.jsx(oM,{summary:Zn}),(N==null?void 0:N.kind)==="models"?s.jsx(hM,{models:et,selectedModelIds:Z,onClose:()=>q(null),onSave:J=>{$t(J),q(null)}}):null,(N==null?void 0:N.kind)==="sellers"?s.jsx(pM,{selectedSellerIds:Sn,selectedModelIds:Z,scorer:$.scorer,sellers:nn,onClose:()=>q(null),onSave:J=>{De(J),q(null)}}):null,(N==null?void 0:N.kind)==="manualProvider"?s.jsx(Hx,{onClose:()=>q(null),onSave:jn}):null,(N==null?void 0:N.kind)==="manualProviderEdit"?s.jsx(Hx,{provider:N.provider,onClose:()=>q(null),onSave:J=>ha(N.provider.id,J)}):null,(N==null?void 0:N.kind)==="manualProviderModels"?s.jsx(vM,{provider:N.provider,onClose:()=>q(null)}):null,X?s.jsx(ab,{modal:X,methods:ct,qr:X.kind==="activate"?G.data:K.data,loading:X.kind==="activate"?G.isPending:K.isPending,error:X.kind==="activate"?G.error:K.error,onClose:Za}):null,ae?s.jsx(mM,{toast:ae,onClose:()=>ge(null)}):null]})}function FN({activeTab:n,onChange:l}){return s.jsx("div",{className:"border-b border-[var(--color-line-2)] bg-white p-2.5",children:s.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:[s.jsx("button",{type:"button",onClick:()=>l("manual"),"aria-pressed":n==="manual","aria-label":"Manual endpoint 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:s.jsx("span",{className:"min-w-0 truncate text-[1rem] font-semibold",children:"Manual"})}),s.jsx("button",{type:"button",onClick:()=>l("auto"),"aria-pressed":n==="auto","aria-label":"Auto node 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:s.jsx("span",{className:"min-w-0 truncate text-[1rem] font-semibold",children:"Auto"})})]})})}function ZN({providers:n,routing:l,onAdd:o,onRemove:i,onSetRouting:u,onMoveUp:f,onTest:v,onRefreshModels:h,onViewModels:p,onEdit:x,testingProviderId:y,refreshingModelsProviderId:g}){const j=l.policy==="fallback";return s.jsxs("div",{className:"overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-white",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--color-line-2)] px-3 py-2.5",children:s.jsx("span",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Custom endpoints"})}),n.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[720px] table-fixed",children:[s.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:s.jsxs("tr",{children:[s.jsx("th",{className:"w-[30%] px-3 py-2",children:"Endpoint"}),s.jsx("th",{className:"w-[9%] px-3 py-2 text-right",children:"Models"}),s.jsx("th",{className:"w-[15%] px-3 py-2",children:"Status"}),s.jsx("th",{className:"w-[15%] px-3 py-2",children:"Speed"}),s.jsx("th",{className:"w-[16%] px-3 py-2",children:"Last call"}),s.jsx("th",{className:"w-[15%] px-3 py-2 text-right",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y divide-[var(--color-line-2)]",children:n.map((M,T)=>{var E;return s.jsxs("tr",{className:"align-middle",children:[s.jsx("td",{className:"px-3 py-2.5",children:s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:M.name}),s.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:M.baseUrl})]})}),s.jsx("td",{className:"px-3 py-2.5 text-right",children:s.jsxs("button",{type:"button",onClick:()=>p(M),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 ${M.name}`,children:[ye(((E=M.models)==null?void 0:E.length)??0),s.jsx(tj,{size:12})]})}),s.jsx("td",{className:"px-3 py-2.5",children:s.jsx(JN,{provider:M})}),s.jsx("td",{className:"px-3 py-2.5",children:s.jsx(Tc,{ttftMs:M.ttftMs,tokensPerSecond:M.avgTokensPerSecond})}),s.jsx("td",{className:"px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-muted)]",children:wc(M.lastAccess)}),s.jsx("td",{className:"px-3 py-2.5",children:s.jsxs("div",{className:"flex justify-end gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>v(M),disabled:y===M.id,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Test ${M.name}`,title:"Run say hi test",children:y===M.id?s.jsx(St,{size:14,className:"animate-spin"}):s.jsx(em,{size:14})}),s.jsx("button",{type:"button",onClick:()=>h(M),disabled:g===M.id,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Refresh models for ${M.name}`,title:"Refresh model list",children:s.jsx(pr,{size:14,className:g===M.id?"animate-spin":""})}),j?s.jsx("button",{type:"button",onClick:()=>f(M.id),disabled:T===0,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-not-allowed disabled:opacity-35","aria-label":`Move ${M.name} up`,title:"Move up",children:s.jsx(Fg,{size:14})}):null,s.jsx("button",{type:"button",onClick:()=>x(M),className:"tb-button tb-button-icon tb-button-quiet","aria-label":`Edit ${M.name}`,title:"Edit",children:s.jsx(ij,{size:14})}),s.jsx("button",{type:"button",onClick:()=>i(M.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 ${M.name}`,children:s.jsx(tm,{size:14})})]})})]},M.id)})})]})}):s.jsx("div",{className:"px-3 py-6 text-center text-[0.84rem] text-[var(--color-muted)]",children:"No custom endpoints yet."}),s.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:[s.jsxs("button",{type:"button",onClick:o,className:"tb-button tb-button-sm tb-button-primary",children:[s.jsx(Ms,{size:14}),"Add endpoint"]}),s.jsxs("div",{className:"ml-auto flex flex-wrap items-center justify-end gap-1.5",children:[s.jsx(tf,{label:"Fallback on error",state:j?"selected":"enabled",onClick:()=>u({policy:"fallback"})}),s.jsx(tf,{label:"Cost first",state:"disabled"}),s.jsx(tf,{label:"Multi-endpoint concurrent calls",state:"disabled"})]})]})]})}function tf({label:n,state:l,onClick:o}){const i=l!=="disabled"&&!!o,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 s.jsx("button",{type:"button",onClick:o,disabled:!i,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 endpoints by table order when the current endpoint fails.":`${n} is not available in Manual mode.`,children:n})}function JN({provider:n}){const l=(n.status??"unknown").toLowerCase(),o=l==="healthy"||l==="ok"||l==="online",i=l==="unknown"||l==="",u=IN(n),f=o?"bg-emerald-50 text-emerald-700 ring-emerald-100":i?"bg-[var(--color-page)] text-[var(--color-muted)] ring-[var(--color-line-2)]":"bg-rose-50 text-rose-700 ring-rose-100";return s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsxs("span",{className:["inline-flex h-6 items-center gap-1.5 rounded-full px-2 text-[0.68rem] font-semibold ring-1",u?"cursor-help":"",f].join(" "),title:u,"aria-label":u?`${n.status??"unknown"}: ${u}`:n.status??"unknown",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),n.status??"unknown"]}),n.current?s.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]})}function IN(n){return[n.errorClass,n.errorMessage].filter(l=>!!(l!=null&&l.trim())).join(": ")||void 0}function pb({seller:n,current:l}){const o=zf(n),i={green:"bg-emerald-50 text-emerald-700 ring-emerald-100",amber:"bg-amber-50 text-amber-700 ring-amber-100",red:"bg-rose-50 text-rose-700 ring-rose-100",blue:"bg-blue-50 text-blue-700 ring-blue-100",gray:"bg-slate-100 text-slate-600 ring-slate-200"}[o.tone];return s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:["inline-flex h-6 items-center rounded-full px-2 text-[0.62rem] font-semibold uppercase ring-1",i].join(" "),children:o.label}),l?s.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]})}function zf(n){return n.recommendationStatus?WN(n.recommendationStatus):n.routeState?{label:bn(n.routeState),tone:sa(n.routeState)}:n.health==="offline"?{label:"error",tone:"red"}:n.health==="degraded"?{label:"degraded",tone:"amber"}:n.coverageModelIds.length<=0?{label:"unknown",tone:"gray"}:{label:"ok",tone:"green"}}function WN(n){return n==="ready"?{label:"ready",tone:"green"}:n==="limited"?{label:"limited",tone:"amber"}:{label:"unavailable",tone:"red"}}function eM(n,l){if(l.length===0)return"available";const o=l.filter(i=>n.coverageModelIds.includes(i)).length;return`${ye(o)}/${ye(l.length)} selected`}function tM({value:n}){return s.jsx("div",{className:"min-w-0 font-mono text-[0.72rem] text-[var(--color-muted)]",children:s.jsx("div",{className:"truncate",children:wc(n)})})}function nM({walletAccess:n,paymentMethods:l,selectedModels:o,activeModelId:i,range:u,scorer:f,effectiveSellers:v,selectedSellerIds:h,sellerActivityById:p,loading:x,refreshing:y,applyError:g,recommendationError:j,focusSaveError:M,onSelectPayment:T,onActivatePayment:E,onRechargePayment:D,onAddModels:R,onSetActiveModel:U,onRemoveModel:Q,onRangeChange:H,onScorerChange:G,onChooseSellers:K,onRemoveSeller:$,onTestSeller:I,onRefreshSellerModels:Z,testingSellerId:ne,refreshingSellerModels:B=!1}){const ie=!n.active;return s.jsxs("div",{className:"space-y-3",children:[s.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:[!ie&&g?s.jsx("span",{className:"max-w-full truncate rounded-full bg-rose-50 px-2.5 py-1 text-[0.74rem] font-semibold text-rose-700 ring-1 ring-rose-100 sm:max-w-[360px]",title:g,children:g}):null,s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[s.jsx("span",{className:"text-[0.68rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:"Agent payment"}),s.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(te=>s.jsx(aM,{option:te,method:l.find(xe=>Ln(xe.method)===Ln(te.method)),onSelect:T,onActivate:E,onRecharge:D},te.method))})]})]}),s.jsxs("div",{className:["space-y-3 transition",ie?"pointer-events-none select-none opacity-45 grayscale-[0.25]":""].join(" "),"aria-disabled":ie,children:[s.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:[s.jsx("span",{className:"mr-1 text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Recent models"}),o.map(te=>{const xe=i===te.id;return s.jsxs("span",{className:["inline-flex h-8 items-center gap-1.5 rounded-[8px] border px-2.5 font-mono text-[0.8rem] transition",xe?"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:[s.jsx("button",{type:"button",onClick:()=>U(te.id),disabled:ie,className:["truncate font-semibold",xe?"text-[var(--color-primary-deep)]":"text-[color-mix(in_srgb,var(--color-primary-deep)_82%,var(--color-muted))]"].join(" "),children:te.id}),s.jsx("span",{className:"rounded-full bg-white px-1.5 text-[0.68rem] text-[var(--color-muted)]",children:te.sellerCount}),s.jsx("button",{type:"button",onClick:()=>Q(te.id),disabled:ie,className:"text-[var(--color-muted)] hover:text-rose-700","aria-label":`Remove ${te.id}`,children:s.jsx(tm,{size:12})})]},te.id)}),s.jsxs("button",{type:"button",onClick:R,disabled:ie,className:"tb-button tb-button-sm tb-button-secondary",children:[s.jsx(Ms,{size:14}),"Manage"]}),o.length===0?s.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"Choose at least one model."}):null,M?s.jsx("span",{className:"text-[0.8rem] text-amber-700",children:"Models could not be saved."}):null]}),s.jsx(lM,{range:u,scorer:f,sellers:v,selectedSellerIds:h,selectedModelIds:o.map(te=>te.id),sellerActivityById:p,disabled:ie,loading:x,refreshing:y,recommendationError:j,onRangeChange:H,onScorerChange:G,onChooseSellers:K,onRemoveSeller:$,onTestSeller:I,onRefreshSellerModels:Z,testingSellerId:ne,refreshingSellerModels:B})]})]})}function aM({option:n,method:l,onSelect:o,onActivate:i,onRecharge:u}){const[f,v]=S.useState(!1),h=["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=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:p,"aria-hidden":"true",children:n.label.charAt(0)}),s.jsx("span",{children:Px(n)}),n.selected?s.jsx("span",{className:"text-[0.64rem] uppercase tracking-[0.08em] opacity-75",children:"Active"}):null,n.selected?s.jsx(LS,{size:13,"aria-hidden":"true"}):null]});return n.configured?n.selected?s.jsxs("div",{className:"relative",children:[s.jsx("button",{type:"button",onClick:()=>v(y=>!y),className:h,"aria-pressed":!0,"aria-expanded":f,"aria-haspopup":"menu",children:x}),f?s.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:s.jsxs("button",{type:"button",onClick:()=>{v(!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:[s.jsx("span",{children:"Recharge"}),s.jsx("span",{className:"font-mono text-[0.68rem] text-[var(--color-muted)]",children:(l==null?void 0:l.balance)??"••••"})]})}):null]}):s.jsx("button",{type:"button",onClick:()=>o(n.method),className:h,"aria-pressed":!1,children:x}):s.jsx("button",{type:"button",onClick:()=>i(n.method),className:h,"aria-label":Px(n),children:x})}function Px(n){return n.configured?n.label:Ln(n.method)==="clawtip"?"Bind ClawTip wallet to enable Auto mode":`Bind ${n.label}`}function lM({range:n,scorer:l,sellers:o,selectedSellerIds:i,selectedModelIds:u,sellerActivityById:f,disabled:v=!1,loading:h=!1,refreshing:p=!1,recommendationError:x,onRangeChange:y,onScorerChange:g,onChooseSellers:j,onRemoveSeller:M,onTestSeller:T,onRefreshSellerModels:E,testingSellerId:D,refreshingSellerModels:R=!1}){return s.jsxs("div",{className:"overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-white",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--color-line-2)] px-3 py-2.5",children:[s.jsxs("div",{className:"min-w-[150px]",children:[s.jsx("div",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Node list"}),s.jsxs("div",{className:"mt-0.5 font-mono text-[0.72rem] text-[var(--color-muted)]",children:[h&&o.length===0?"Loading nodes...":`${ye(Math.min(o.length,Rf))} of ${ye(o.length)} nodes`,p?s.jsx("span",{className:"ml-2 text-[var(--color-purple)]",children:"Refreshing"}):null]})]}),s.jsxs("div",{className:"ml-auto flex flex-wrap items-center justify-end gap-2",children:[s.jsx($x,{options:[{value:"recommended",label:"Recommended"},{value:"custom",label:"Custom"}],value:n,onChange:y,disabled:v}),s.jsx("button",{type:"button",onClick:j,disabled:v||n!=="custom",className:"tb-button tb-button-sm tb-button-primary min-w-[72px]",title:n==="custom"?"Select nodes":"Switch to Custom to select nodes",children:"Select"})]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("div",{className:"min-w-[820px]",children:[o.length>0?s.jsxs("div",{className:"grid grid-cols-[minmax(210px,1.35fr)_90px_128px_74px_132px_130px_80px] gap-2 border-b border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 py-2 text-[0.62rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[s.jsx("div",{children:"Node"}),s.jsx("div",{className:"text-center",children:"Models"}),s.jsx("div",{children:"Status"}),s.jsx("div",{className:"text-right",children:"Disc"}),s.jsx("div",{className:"text-right",children:"Speed"}),s.jsx("div",{children:"Last inspect"}),s.jsx("div",{className:"text-right",children:"Actions"})]}):null,s.jsxs("div",{className:"divide-y divide-[var(--color-line-2)]",children:[x?s.jsx("div",{className:"px-3 py-3 text-[0.8rem] font-medium text-amber-700",children:x}):null,h&&o.length===0?s.jsx(rM,{}):null,o.slice(0,Rf).map(U=>{const Q=f.get(U.id),H=(Q==null?void 0:Q.averageTtftMs)??U.latencyMs,G=(Q==null?void 0:Q.tokensPerSecond)??U.tokensPerSecond;return s.jsxs("div",{className:"grid grid-cols-[minmax(210px,1.35fr)_90px_128px_74px_132px_130px_80px] items-center gap-2 px-3 py-2.5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:U.name}),s.jsxs("div",{className:"mt-0.5 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:[U.recommendationRank?`#${U.recommendationRank} · `:"",Ls(U.id)]}),U.recommendationReason?s.jsx("div",{className:"mt-0.5 truncate text-[0.68rem] font-medium text-[var(--color-muted)]",title:U.recommendationReason,children:U.recommendationReason}):null]}),s.jsxs("div",{className:"min-w-0 text-center font-mono text-[0.72rem] font-semibold leading-snug text-[var(--color-ink)]",children:[s.jsx("div",{children:ye(U.coverageModelIds.length)}),s.jsx("div",{className:"text-[0.66rem] font-medium text-[var(--color-muted)]",children:eM(U,u)})]}),s.jsx(pb,{seller:U,current:(Q==null?void 0:Q.current)===!0}),s.jsx(iM,{value:U.discount}),s.jsxs("div",{className:"min-w-0 text-right font-mono text-[0.72rem] font-semibold leading-snug text-[var(--color-ink)]",children:[s.jsxs("div",{children:["TTFT ",ca(H)]}),s.jsx("div",{children:ws(G)})]}),s.jsx(tM,{value:U.lastInspectAt}),s.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>T(U),disabled:v||D===U.id,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Test ${U.name}`,title:"Run say hi test",children:D===U.id?s.jsx(St,{size:14,className:"animate-spin"}):s.jsx(em,{size:14})}),s.jsx("button",{type:"button",onClick:()=>E(U),disabled:v||R,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Refresh models for ${U.name}`,title:"Refresh model list",children:s.jsx(pr,{size:14,className:R?"animate-spin":""})}),n==="custom"&&i.includes(U.id)?s.jsx("button",{type:"button",onClick:()=>M(U.id),disabled:v,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 ${U.name}`,children:s.jsx(tm,{size:14})}):null]})]},U.id)}),!h&&!x&&o.length===0?s.jsx("div",{className:"px-3 py-8 text-center text-[0.84rem] text-[var(--color-muted)]",children:n==="custom"&&i.length>0?"No selected nodes are routable for these models.":n==="custom"?"No custom nodes selected.":"No recommended nodes for these models."}):null]})]})}),s.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:[s.jsx("span",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Routing priority"}),s.jsx($x,{options:GN,value:l,onChange:g,disabled:v}),s.jsx("span",{className:"ml-auto max-w-full text-right text-[0.74rem] text-[var(--color-muted)] sm:max-w-[420px]",children:sM(l)})]})]})}function rM(){return s.jsx(s.Fragment,{children:[0,1,2].map(n=>s.jsxs("div",{className:"grid gap-2 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[s.jsxs("div",{className:"min-w-0 space-y-2",children:[s.jsx("div",{className:"h-4 w-44 animate-pulse rounded-full bg-[var(--color-line-2)]"}),s.jsx("div",{className:"h-3 w-28 animate-pulse rounded-full bg-[var(--color-page)]"}),s.jsx("div",{className:"h-3 w-52 animate-pulse rounded-full bg-[var(--color-page)]"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:justify-end",children:[s.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"}),s.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"}),s.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"})]})]},n))})}function $x({options:n,value:l,onChange:o,disabled:i=!1}){return s.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=>s.jsx("button",{type:"button",onClick:()=>o(u.value),disabled:i,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 iM({value:n}){return s.jsx("div",{className:"min-w-0 text-right",children:s.jsx("div",{className:"truncate font-mono text-[0.76rem] font-semibold text-[var(--color-ink)]",children:n})})}function sM(n){return n==="speed"?"Prefers lower TTFT and stronger throughput.":n==="discount"?"Prefers lower effective cost among healthy nodes.":"Balances reliability, speed, and cost."}function oM({summary:n}){return s.jsx("section",{children:s.jsxs(_t,{className:"overflow-hidden",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[var(--color-line-2)] px-4 py-3",children:[s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Current routes"})}),s.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:[ye(n.rows.length)," models"]})]}),s.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[840px] border-collapse text-left text-[0.82rem]",children:[s.jsx("thead",{className:"bg-white/70 text-[0.66rem] uppercase tracking-wider text-[var(--color-muted)]",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"MODEL"}),s.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"TARGET"}),s.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"STRATEGY"}),s.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"STATUS"}),s.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"EVIDENCE"}),s.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"LAST CALL"})]})}),s.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[n.rows.map(l=>s.jsx(cM,{row:l},`${l.source}-${l.modelId}-${l.currentSellerId}`)),n.rows.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-[var(--color-muted)]",children:"No model traffic yet."})}):null]})]})})]})})}function cM({row:n}){const l=dM(n),o=fM(n.routeReason,n.source);return s.jsxs("tr",{className:"align-middle transition hover:bg-[var(--color-lavender)]/25",children:[s.jsx("td",{className:"px-4 py-3.5",children:s.jsx("div",{className:"max-w-[220px] truncate font-mono text-[0.84rem] font-semibold text-[var(--color-ink)]",title:n.modelId,children:n.modelId})}),s.jsxs("td",{className:"px-4 py-3.5",children:[s.jsx("div",{className:"max-w-[230px] truncate font-semibold text-[var(--color-purple)]",title:n.currentSellerId,children:n.currentSellerName}),s.jsx("div",{className:"mt-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:Ls(n.currentSellerId)})]}),s.jsx("td",{className:"px-4 py-3.5",children:s.jsx(Qx,{tone:o.tone,children:o.label})}),s.jsx("td",{className:"px-4 py-3.5",children:s.jsx(Qx,{tone:l.tone,children:l.label})}),s.jsx("td",{className:"px-4 py-3.5",children:s.jsx(uM,{row:n})}),s.jsx("td",{className:"whitespace-nowrap px-4 py-3.5",children:s.jsx("div",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:wc(n.lastAccessAt)})})]})}function uM({row:n}){const l=xs(n.inputPriceMicrosPer1m,n.outputPriceMicrosPer1m);return s.jsxs("div",{className:"grid gap-0.5 font-mono text-[0.72rem] leading-snug",children:[s.jsxs("div",{className:"truncate font-semibold text-[var(--color-ink)]",title:`Disc ${n.sellerDiscount} / Price ${l}`,children:["Disc ",n.sellerDiscount," / ",l]}),s.jsxs("div",{className:"truncate text-[var(--color-muted)]",title:`TTFT ${ca(n.lastTtftMs??n.avgTtftMs)} / ${ws(n.tokensPerSecond)}`,children:["TTFT ",ca(n.lastTtftMs??n.avgTtftMs)," / ",ws(n.tokensPerSecond)]})]})}function dM(n){return n.source==="preview"?{label:"Preview",tone:"amber"}:n.routeState?{label:bn(n.routeState),tone:sa(n.routeState)}:n.upstreamStatus&&!nf(n.upstreamStatus)?{label:bn(n.upstreamStatus),tone:sa(n.upstreamStatus)}:n.lastStatus&&!nf(n.lastStatus)?{label:bn(n.lastStatus),tone:sa(n.lastStatus)}:n.currentSellerStatus&&!nf(n.currentSellerStatus)?{label:bn(n.currentSellerStatus),tone:sa(n.currentSellerStatus)}:{label:"Ready",tone:"green"}}function nf(n){const l=bn(n);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"}function fM(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 Qx({tone:n,children:l}){const o={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 s.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.66rem] font-semibold uppercase",o].join(" "),children:l})}function mM({toast:n,onClose:l}){const o=n.tone==="success"?"border-emerald-100 bg-emerald-50 text-emerald-800":"border-rose-100 bg-rose-50 text-rose-800";return s.jsx("div",{className:"fixed bottom-5 right-5 z-40 w-[min(360px,calc(100vw-2rem))]",children:s.jsx("div",{className:["rounded-[12px] border px-3 py-2.5 shadow-[0_14px_34px_rgba(32,26,56,0.16)]",o].join(" "),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate text-[0.82rem] font-semibold",children:n.title}),s.jsx("div",{className:"mt-0.5 line-clamp-3 text-[0.74rem] leading-5 opacity-90",children:n.detail})]}),s.jsx("button",{type:"button",onClick:l,className:"grid size-6 shrink-0 place-items-center rounded-full bg-white/70 transition hover:bg-white","aria-label":"Close notification",children:s.jsx(Dl,{size:13})})]})})})}function hM({models:n,selectedModelIds:l,onClose:o,onSave:i}){const[u,f]=S.useState(""),[v,h]=S.useState(l),p=S.useMemo(()=>v.map(g=>n.find(j=>j.id===g)).filter(mm),[v,n]),x=n.filter(g=>gb(u,[g.id,g.paymentMethod,g.enabled?"enabled":"not enabled"]));function y(g){h(j=>j.includes(g)?j.filter(M=>M!==g):[...j,g])}return s.jsxs(Ac,{title:"Add models",onClose:o,children:[s.jsx(fm,{value:u,onChange:f,placeholder:"Search models or payment"}),s.jsx("div",{className:"mt-3 max-h-[48dvh] overflow-auto rounded-[12px] border border-[var(--color-line-2)]",children:s.jsxs("table",{className:"w-full border-collapse text-left text-[0.84rem]",children:[s.jsx("thead",{className:"sticky top-0 z-[1] bg-white/95 text-[0.7rem] uppercase tracking-wider text-[var(--color-muted)] backdrop-blur",children:s.jsxs("tr",{children:[s.jsx("th",{className:"w-16 px-3 py-2 font-semibold",children:"Select"}),s.jsx("th",{className:"px-3 py-2 font-semibold",children:"Model"}),s.jsx("th",{className:"px-3 py-2 font-semibold",children:"Payment"}),s.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Nodes"})]})}),s.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[x.map(g=>{const j=v.includes(g.id);return s.jsxs("tr",{onClick:()=>y(g.id),className:["cursor-pointer",j?"bg-[var(--color-lavender)]/70":"hover:bg-[var(--color-lavender)]/35",g.enabled?"":"opacity-60"].join(" "),children:[s.jsx("td",{className:"px-3 py-2.5",children:s.jsx(vb,{active:j,fixed:!1})}),s.jsx("td",{className:"px-3 py-2.5 font-mono font-semibold text-[var(--color-ink)]",children:g.id}),s.jsx("td",{className:"px-3 py-2.5",children:s.jsx(gM,{enabled:g.enabled,paymentMethod:g.paymentMethod})}),s.jsx("td",{className:"px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-ink)]",children:ye(g.sellerCount)})]},g.id)}),x.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"px-3 py-8 text-center text-[var(--color-muted)]",children:"No models found."})}):null]})]})}),s.jsxs("div",{className:"mt-3 rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:["Selected ",p.length]}),p.length>0?s.jsx("button",{type:"button",onClick:()=>h([]),className:"ml-auto text-[0.74rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-purple)]",children:"Clear"}):null]}),s.jsxs("div",{className:"mt-2 flex min-h-8 flex-wrap gap-2",children:[p.map(g=>s.jsxs("button",{type:"button",onClick:()=>y(g.id),className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-[var(--color-line-2)] bg-white px-2.5 py-1 text-[0.76rem] font-mono font-semibold text-[var(--color-ink)] shadow-[0_1px_4px_rgba(60,41,112,0.06)] transition hover:border-[var(--color-purple)] hover:text-[var(--color-purple)]",title:`Remove ${g.id}`,children:[s.jsx("span",{className:"truncate",children:g.id}),s.jsx(Dl,{size:13,"aria-hidden":"true"})]},g.id)),p.length===0?s.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"No model selected."}):null]})]}),s.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[s.jsx("button",{type:"button",onClick:o,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),s.jsx("button",{type:"button",onClick:()=>i(v),"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 pM({selectedSellerIds:n,selectedModelIds:l,scorer:o,sellers:i,onClose:u,onSave:f}){const[v,h]=S.useState(""),[p,x]=S.useState(n),[y,g]=S.useState({key:"discount",direction:"asc"}),[j,M]=S.useState(1),T=S.useMemo(()=>yM(i,l,o),[o,l,i]),E=S.useMemo(()=>new Set(T.map(B=>B.id)),[T]),D=S.useMemo(()=>p.map(B=>i.find(ie=>ie.id===B)).filter(mm).filter(B=>E.has(B.id)),[E,p,i]),R=S.useMemo(()=>T.filter(B=>gb(v,[B.name,B.id,B.paymentMethods.join(" "),B.health,B.notes.join(" ")])),[T,v]),U=S.useMemo(()=>bM(R,y.key,y.direction),[R,y.direction,y.key]),Q=10,H=Math.max(1,Math.ceil(U.length/Q)),G=Math.min(j,H),K=U.slice((G-1)*Q,G*Q),$=U.length===0?0:(G-1)*Q+1,I=Math.min(G*Q,U.length);S.useEffect(()=>{M(1)},[v,y.direction,y.key]),S.useEffect(()=>{j>H&&M(H)},[j,H]);function Z(B){x(ie=>ie.includes(B)?ie.filter(te=>te!==B):[...ie,B])}function ne(B){g(ie=>({key:B,direction:ie.key===B&&ie.direction==="asc"?"desc":"asc"}))}return s.jsxs(Ac,{title:"Select custom nodes",onClose:u,children:[s.jsx(fm,{value:v,onChange:h,placeholder:"Search nodes, payment, notes"}),s.jsx("div",{className:"mt-3 overflow-hidden rounded-[12px] border border-[var(--color-line-2)]",children:s.jsxs("table",{className:"w-full border-collapse text-left text-[0.82rem]",children:[s.jsx("thead",{className:"bg-white/70 text-[0.7rem] uppercase tracking-wider text-[var(--color-muted)]",children:s.jsxs("tr",{children:[s.jsx("th",{className:"w-16 px-3 py-2 font-semibold",children:"Select"}),s.jsx(fs,{label:"Node",sortKey:"seller",activeSort:y,onSort:ne}),s.jsx(fs,{label:"Status",sortKey:"status",activeSort:y,onSort:ne}),s.jsx(fs,{label:"Disc",sortKey:"discount",align:"right",activeSort:y,onSort:ne}),s.jsx(fs,{label:"Payment",sortKey:"payment",activeSort:y,onSort:ne}),s.jsx(fs,{label:"Speed",sortKey:"speed",align:"right",activeSort:y,onSort:ne})]})}),s.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[K.map(B=>{const ie=p.includes(B.id);return s.jsxs("tr",{onClick:()=>Z(B.id),className:["cursor-pointer",ie?"bg-[var(--color-lavender)]/70":"hover:bg-[var(--color-lavender)]/35"].join(" "),children:[s.jsx("td",{className:"px-3 py-2.5",children:s.jsx(vb,{active:ie,fixed:!1})}),s.jsxs("td",{className:"px-3 py-2.5",children:[s.jsx("div",{className:"font-semibold text-[var(--color-ink)]",children:B.name}),s.jsx("div",{className:"mt-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:Ls(B.id)})]}),s.jsx("td",{className:"px-3 py-2.5",children:s.jsx(pb,{seller:B,current:!1})}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-purple)]",children:B.discount}),s.jsx("td",{className:"px-3 py-2.5 text-[var(--color-muted)]",children:B.paymentMethods.join(", ")}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right text-[var(--color-ink)]",children:s.jsx(Tc,{ttftMs:B.latencyMs,tokensPerSecond:B.tokensPerSecond})})]},B.id)}),U.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-3 py-8 text-center text-[var(--color-muted)]",children:"No nodes found."})}):null]})]})}),U.length>Q?s.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2 text-[0.74rem] text-[var(--color-muted)]",children:[s.jsxs("span",{children:["Showing ",ye($),"-",ye(I)," of ",ye(U.length)]}),s.jsxs("div",{className:"inline-flex items-center gap-1",children:[s.jsx("button",{type:"button",onClick:()=>M(B=>Math.max(1,B-1)),disabled:G<=1,className:"tb-button tb-button-sm tb-button-secondary disabled:opacity-45",children:"Previous"}),s.jsxs("span",{className:"min-w-16 text-center font-mono text-[0.72rem] font-semibold text-[var(--color-ink)]",children:[G," / ",H]}),s.jsx("button",{type:"button",onClick:()=>M(B=>Math.min(H,B+1)),disabled:G>=H,className:"tb-button tb-button-sm tb-button-secondary disabled:opacity-45",children:"Next"})]})]}):null,s.jsxs("div",{className:"mt-3 rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:["Selected ",D.length]}),D.length>0?s.jsx("button",{type:"button",onClick:()=>x(B=>B.filter(ie=>!E.has(ie))),className:"ml-auto text-[0.74rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-purple)]",children:"Clear"}):null]}),s.jsxs("div",{className:"mt-2 flex min-h-8 flex-wrap gap-2",children:[D.map(B=>s.jsxs("button",{type:"button",onClick:()=>Z(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-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.name}`,children:[s.jsx("span",{className:"truncate",children:B.name}),s.jsx(Dl,{size:13,"aria-hidden":"true"})]},B.id)),D.length===0?s.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"No node selected."}):null]})]}),s.jsxs("div",{className:"mt-3 flex justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[s.jsx("button",{type:"button",onClick:u,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),s.jsx("button",{type:"button",onClick:()=>f(p),className:"tb-button tb-button-md tb-button-primary",children:"Save and close"})]})]})}function Hx({provider:n,onClose:l,onSave:o}){var K;const i=!!n,[u,f]=S.useState((n==null?void 0:n.name)??""),[v,h]=S.useState((n==null?void 0:n.baseUrl)??""),[p,x]=S.useState(""),[y,g]=S.useState(null),j=i?{status:"passed",message:`${ye(((K=n==null?void 0:n.models)==null?void 0:K.length)??0)} existing models.`,modelIds:(n==null?void 0:n.models)??[],supportedProtocols:(n==null?void 0:n.supportedProtocols)??[],baseUrl:(n==null?void 0:n.baseUrl)??"",apiKey:""}:{status:"idle",message:"Probe required before adding.",modelIds:[],supportedProtocols:[],baseUrl:"",apiKey:""},[M,T]=S.useState(j),E=v.trim(),D=p.trim(),R=E.length>0&&D.length>0&&M.status!=="checking",U=M.status==="passed"&&M.baseUrl===E&&M.apiKey===D,Q=i?u.trim().length>0&&E.length>0&&(D.length===0||U&&M.modelIds.length>0&&M.supportedProtocols.length>0):U&&M.modelIds.length>0&&M.supportedProtocols.length>0;function H(){var $;if(i&&p.trim().length===0){T({status:"passed",message:`${ye((($=n==null?void 0:n.models)==null?void 0:$.length)??0)} existing models.`,modelIds:(n==null?void 0:n.models)??[],supportedProtocols:(n==null?void 0:n.supportedProtocols)??[],baseUrl:(n==null?void 0:n.baseUrl)??"",apiKey:""});return}T({status:"idle",message:i?"Probe required when replacing the key.":"Probe required before adding.",modelIds:[],supportedProtocols:[],baseUrl:"",apiKey:""})}async function G(){if(R){g(null),T({status:"checking",message:"Reading model list...",modelIds:[],supportedProtocols:[],baseUrl:E,apiKey:D});try{const $=await Uj({baseUrl:E,apiKey:D});T({status:"passed",message:`${ye($.modelIds.length)} models · ${xM($.supportedProtocols)}.`,modelIds:$.modelIds,supportedProtocols:$.supportedProtocols,baseUrl:E,apiKey:D})}catch($){T({status:"failed",message:$ instanceof Error?$.message:"Model list request failed.",modelIds:[],supportedProtocols:[],baseUrl:E,apiKey:D})}}}return s.jsxs(Ac,{title:i?`Edit endpoint · ${(n==null?void 0:n.name)??""}`:"Add endpoint",onClose:l,children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(af,{label:"Name",value:u,onChange:f,placeholder:"My endpoint"}),s.jsx(af,{label:"Base URL",value:v,onChange:$=>{h($),H()},placeholder:"https://api.example.com/v1"}),s.jsx(af,{label:"API key",value:p,onChange:$=>{var I;x($),$.trim().length===0&&i?T({status:"passed",message:`${ye(((I=n==null?void 0:n.models)==null?void 0:I.length)??0)} existing models.`,modelIds:(n==null?void 0:n.models)??[],supportedProtocols:(n==null?void 0:n.supportedProtocols)??[],baseUrl:(n==null?void 0:n.baseUrl)??"",apiKey:""}):H()},placeholder:i?"Leave blank to keep existing key":"sk-...",type:"password"}),s.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:["inline-flex h-7 items-center rounded-full px-2.5 text-[0.7rem] font-semibold ring-1",M.status==="passed"?"bg-emerald-50 text-emerald-700 ring-emerald-100":M.status==="failed"?"bg-rose-50 text-rose-700 ring-rose-100":"bg-white text-[var(--color-muted)] ring-[var(--color-line-2)]"].join(" "),children:M.message}),s.jsx("button",{type:"button",onClick:G,disabled:!R,className:"tb-button tb-button-sm tb-button-secondary ml-auto",children:i?"Probe new key":"Probe models"})]}),U||i&&M.status==="passed"?s.jsxs("div",{className:"mt-2 space-y-2",children:[s.jsx("div",{className:"flex flex-wrap gap-1.5",children:M.supportedProtocols.map($=>s.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 font-mono text-[0.68rem] font-semibold text-emerald-700 ring-1 ring-emerald-100",children:$},$))}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:M.modelIds.map($=>s.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:$},$))})]}):null]}),y?s.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]}),s.jsxs("div",{className:"mt-4 flex justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[s.jsx("button",{type:"button",onClick:l,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),s.jsx("button",{type:"button",onClick:async()=>{if(Q){g(null);try{await o({name:u,baseUrl:v,apiKey:p})}catch($){g($ instanceof Error?$.message:String($))}}},disabled:!Q,className:"tb-button tb-button-md tb-button-primary",children:i?"Save":"Add"})]})]})}function vM({provider:n,onClose:l}){var v;const[o,i]=S.useState(""),u=o.trim().toLowerCase(),f=(n.models??[]).filter(h=>h.toLowerCase().includes(u));return s.jsxs(Ac,{title:`Models · ${n.name}`,onClose:l,children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(fm,{value:o,onChange:i,placeholder:"Search models"}),s.jsxs("div",{className:"rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2",children:[s.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:[ye(f.length)," of ",ye(((v=n.models)==null?void 0:v.length)??0)," models"]}),s.jsxs("div",{className:"mt-2 flex max-h-[320px] flex-wrap gap-1.5 overflow-y-auto",children:[f.map(h=>s.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:h},h)),f.length===0?s.jsx("span",{className:"text-[0.82rem] text-[var(--color-muted)]",children:"No models found."}):null]})]})]}),s.jsx("div",{className:"mt-4 flex justify-end border-t border-[var(--color-line-2)] pt-3",children:s.jsx("button",{type:"button",onClick:l,className:"tb-button tb-button-md tb-button-secondary",children:"Close"})})]})}function xM(n){return n.length>0?n.join(", "):"no protocols"}function af({label:n,value:l,onChange:o,placeholder:i,type:u="text"}){return s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:n}),s.jsx("input",{value:l,type:u,onChange:f=>o(f.target.value),placeholder:i,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 Ac({title:n,children:l,onClose:o}){return s.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-[#201a38]/35 px-4 py-6 backdrop-blur-sm",children:s.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:[s.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--color-line-2)] px-5 py-4",children:[s.jsx("div",{className:"min-w-0 flex-1 truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:n}),s.jsx("button",{type:"button",onClick:o,className:"tb-button tb-button-icon tb-button-quiet","aria-label":"Close",children:s.jsx(Dl,{size:16})})]}),s.jsx("div",{className:"max-h-[calc(86dvh-65px)] overflow-auto p-4",children:l})]})})}function gM({enabled:n,paymentMethod:l}){return s.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?s.jsx(pj,{size:12}):s.jsx(Cf,{size:12}),l," ",n?"enabled":"not enabled"]})}function vb({active:n,fixed:l}){return s.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:s.jsx(Yt,{size:13,strokeWidth:2.4})})}function fs({label:n,sortKey:l,activeSort:o,align:i="left",onSort:u}){const f=o.key===l;return s.jsx("th",{className:["px-3 py-2 font-semibold",i==="right"?"text-right":""].join(" "),children:s.jsxs("button",{type:"button",onClick:()=>u(l),className:["inline-flex items-center gap-1 transition hover:text-[var(--color-primary-deep)]",i==="right"?"justify-end":"",f?"text-[var(--color-primary-deep)]":""].join(" "),children:[s.jsx("span",{children:n}),s.jsx("span",{className:["font-mono text-[0.58rem]",f?"opacity-100":"opacity-35"].join(" "),children:f?o.direction==="asc"?"↑":"↓":"↕"})]})})}function bM(n,l,o){return[...n].sort((i,u)=>l==="seller"?nr(i.name,u.name):l==="status"?nr(zf(i).label,zf(u).label)||nr(i.name,u.name):l==="discount"?lf(i.discountRatio,u.discountRatio,o)||nr(i.name,u.name):l==="payment"?nr(i.paymentMethods.join(", "),u.paymentMethods.join(", "))||nr(i.name,u.name):lf(i.latencyMs,u.latencyMs,o)||lf(u.tokensPerSecond,i.tokensPerSecond,o)||nr(i.name,u.name))}function yM(n,l,o){return[...n].sort((i,u)=>{const f=Vx(i,l),v=Vx(u,l);return f!==v?v-f:o==="speed"?_f(i.latencyMs,u.latencyMs)||RM(i.tokensPerSecond,u.tokensPerSecond):o==="discount"?_f(i.discountRatio,u.discountRatio):u.healthScore-i.healthScore})}function SM(n,l){const o=new Map;for(const u of n){const f=o.get(u.id)??{sellerIds:new Set,paymentMethods:new Set};f.sellerIds.add(u.sellerId);for(const v of u.paymentMethods)f.paymentMethods.add(v);o.set(u.id,f)}const i=new Map(l.map((u,f)=>[u,f]));return Array.from(o.entries()).map(([u,f])=>({id:u,paymentMethod:Array.from(f.paymentMethods)[0]??je,enabled:f.sellerIds.size>0,sellerCount:f.sellerIds.size})).sort((u,f)=>{const v=i.get(u.id),h=i.get(f.id);return v!==void 0||h!==void 0?(v??9999)-(h??9999):u.id.localeCompare(f.id)})}function jM({focusModels:n,referencedModelIds:l,modelOptions:o}){const i=new Set(o.map(f=>f.id)),u=n.filter(f=>i.has(f));return u.length>0?u:l.filter(f=>i.has(f))}function NM({base:n,enabled:l,range:o,scorer:i,modelIds:u,sellerIds:f}){return{enabled:l,range:o,scorer:i,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 MM(n){const l=new Set;return[...n].sort((o,i)=>_M(o.createdAt,i.createdAt)).flatMap(o=>!o.modelId||l.has(o.modelId)?[]:(l.add(o.modelId),[o.modelId]))}function wM(n,l){const o=new Map;for(const i of l){if(!i.sellerKey)continue;const u=o.get(i.sellerKey)??Kx();(!u.lastAccessAt||ti(i.createdAt)>ti(u.lastAccessAt))&&(u.lastAccessAt=i.createdAt),u.requestCount+=1,u.modelIds.includes(i.modelId)||u.modelIds.push(i.modelId),i.billingUnit!=="images"&&i.endpoint!=="/v1/images/generations"&&(u.inputTokens+=vn(i.promptTokens)??0,u.outputTokens+=vn(i.completionTokens)??0),u.totalSpendMicros+=vn(i.settledUsdMicros)??vn(i.billedMicros)??vn(i.estimatedMicros)??0;const f=vn(i.ttftMs);f!==void 0&&(u.ttftTotal+=f,u.ttftCount+=1);const v=vn(i.durationMs),h=vn(i.completionTokens)??0;v!==void 0&&v>0&&h>0&&(u.speedOutputTokens+=h,u.speedDurationMs+=v),o.set(i.sellerKey,u)}for(const i of n){if(!i.currentSellerId||i.currentSellerId===je)continue;const u=o.get(i.currentSellerId)??Kx();u.current=!0,i.lastAccessAt&&(!u.lastAccessAt||ti(i.lastAccessAt)>ti(u.lastAccessAt))&&(u.lastAccessAt=i.lastAccessAt),u.modelIds.includes(i.modelId)||u.modelIds.push(i.modelId),o.set(i.currentSellerId,u)}return new Map(Array.from(o.entries()).map(([i,u])=>{const{ttftTotal:f,ttftCount:v,speedOutputTokens:h,speedDurationMs:p,...x}=u;return[i,{...x,averageTtftMs:v>0?f/v:void 0,tokensPerSecond:p>0?h/(p/1e3):void 0}]}))}function Kx(){return{current:!1,modelIds:[],requestCount:0,inputTokens:0,outputTokens:0,totalSpendMicros:0,ttftTotal:0,ttftCount:0,speedOutputTokens:0,speedDurationMs:0}}function CM(n){const{recommended:l,excluded:o,baseSellers:i}=n,u=new Map(i.map(h=>[h.id,h])),f=l.map(h=>{const p=u.get(h.sellerId),x=vn(h.metrics.discountRatio)??(p==null?void 0:p.discountRatio),y=vn(h.metrics.ttftMs)??vn(h.metrics.avgLatencyMs)??(p==null?void 0:p.latencyMs),g=vn(h.metrics.healthScore),j=vn(h.metrics.avgTokensPerSecond)??(p==null?void 0:p.tokensPerSecond);return{id:h.sellerId,name:Of(h.name??(p==null?void 0:p.name)??h.sellerId),endpoint:h.url||(p==null?void 0:p.endpoint)||"",routeState:p==null?void 0:p.routeState,health:TM(h.status),healthScore:g!==void 0?Math.round(g):(p==null?void 0:p.healthScore)??0,coverageModelIds:h.routableModels,paymentMethods:(p==null?void 0:p.paymentMethods)??[],discountRatio:x,discount:Cs(x),price:(p==null?void 0:p.price)??je,priceByModelId:(p==null?void 0:p.priceByModelId)??{},originalPrice:(p==null?void 0:p.originalPrice)??je,originalPriceByModelId:(p==null?void 0:p.originalPriceByModelId)??{},originalInputPriceMicrosPer1m:p==null?void 0:p.originalInputPriceMicrosPer1m,originalOutputPriceMicrosPer1m:p==null?void 0:p.originalOutputPriceMicrosPer1m,inputPriceMicrosPer1m:p==null?void 0:p.inputPriceMicrosPer1m,outputPriceMicrosPer1m:p==null?void 0:p.outputPriceMicrosPer1m,latencyMs:y,tokensPerSecond:j,lastInspectAt:p==null?void 0:p.lastInspectAt,notes:[h.reasonText,...(p==null?void 0:p.notes)??[]],recommendationStatus:h.status,recommendationRank:h.rank,recommendationReason:h.reasonText}}),v=o.map((h,p)=>{const x=u.get(h.sellerId);return{id:h.sellerId,name:Of(h.name??(x==null?void 0:x.name)??h.sellerId),endpoint:h.url||(x==null?void 0:x.endpoint)||"",routeState:x==null?void 0:x.routeState,health:"offline",healthScore:(x==null?void 0:x.healthScore)??0,coverageModelIds:[],paymentMethods:(x==null?void 0:x.paymentMethods)??[],discountRatio:x==null?void 0:x.discountRatio,discount:Cs(x==null?void 0:x.discountRatio),price:(x==null?void 0:x.price)??je,priceByModelId:(x==null?void 0:x.priceByModelId)??{},originalPrice:(x==null?void 0:x.originalPrice)??je,originalPriceByModelId:(x==null?void 0:x.originalPriceByModelId)??{},originalInputPriceMicrosPer1m:x==null?void 0:x.originalInputPriceMicrosPer1m,originalOutputPriceMicrosPer1m:x==null?void 0:x.originalOutputPriceMicrosPer1m,inputPriceMicrosPer1m:x==null?void 0:x.inputPriceMicrosPer1m,outputPriceMicrosPer1m:x==null?void 0:x.outputPriceMicrosPer1m,latencyMs:x==null?void 0:x.latencyMs,tokensPerSecond:x==null?void 0:x.tokensPerSecond,lastInspectAt:x==null?void 0:x.lastInspectAt,notes:[h.reasonText,...(x==null?void 0:x.notes)??[]],recommendationStatus:h.status,recommendationRank:f.length+p+1,recommendationReason:h.reasonText}});return[...f,...v].sort((h,p)=>(h.recommendationRank??Number.MAX_SAFE_INTEGER)-(p.recommendationRank??Number.MAX_SAFE_INTEGER))}function TM(n){return n==="ready"?"online":n==="limited"?"degraded":"offline"}function vn(n){return Number.isFinite(n)?n:void 0}function AM(n,l,o){const i=(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])),v=new Map(o.map(p=>[p.seller.id,p])),h=new Set([...n.map(p=>p.id),...((l==null?void 0:l.sellers)??[]).map(p=>p.id),...i.map(p=>p.sellerId)]);return Array.from(h).map((p,x)=>{const y=u.get(p),g=v.get(p),j=f.get(p),M=i.filter(te=>te.sellerId===p),T=M[0],E=Array.from(new Set(M.map(te=>te.id))),D=Yx(M.map(te=>te.inputPriceMicrosPer1m)),R=Yx(M.map(te=>te.outputPriceMicrosPer1m)),U=(g==null?void 0:g.metrics.ttftMs)??(j==null?void 0:j.ttftMs)??(g==null?void 0:g.metrics.avgLatencyMs),Q=(g==null?void 0:g.metrics.avgTokensPerSecond)??(j==null?void 0:j.avgTokensPerSecond),H=g==null?void 0:g.metrics.healthScore,G=(g==null?void 0:g.metrics.discountRatio)??(j==null?void 0:j.discountRatio),K=rc(D,G),$=rc(R,G),I=Object.fromEntries(M.map(te=>[te.id,xs(te.inputPriceMicrosPer1m,te.outputPriceMicrosPer1m)])),Z=Object.fromEntries(M.map(te=>[te.id,xs(rc(te.inputPriceMicrosPer1m,G),rc(te.outputPriceMicrosPer1m,G))])),ne=(g==null?void 0:g.metrics.routeState)??(j==null?void 0:j.routeState),B=Gx([...(j==null?void 0:j.paymentMethods)??[],...(y==null?void 0:y.paymentMethods)??[],...M.flatMap(te=>te.paymentMethods)]),ie=Gx([...(y==null?void 0:y.supportedProtocols)??[],...(j==null?void 0:j.supportedProtocols)??[],...(T==null?void 0:T.supportedProtocols)??[]]);return{id:p,name:Of((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)??"",routeState:ne,health:ne?EM(ne):(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(H)?Math.round(H):0,coverageModelIds:E,paymentMethods:B,discountRatio:G,discount:Cs(G),price:xs(D,R),priceByModelId:I,originalPrice:xs(K,$),originalPriceByModelId:Z,originalInputPriceMicrosPer1m:K,originalOutputPriceMicrosPer1m:$,inputPriceMicrosPer1m:D,outputPriceMicrosPer1m:R,latencyMs:Number.isFinite(U)?Math.round(U):void 0,tokensPerSecond:Q,lastInspectAt:j==null?void 0:j.lastModelInspectionAt,notes:[ie.join(", ")||"no protocols",`${j?"catalog":"registry"} #${x+1}`]}})}function rc(n,l){if(Number.isFinite(n))return!Number.isFinite(l)||l<=0?n:Math.round(n/l)}function EM(n){return n==="error"?"offline":n==="degraded"||n==="cooldown"||n==="full"?"degraded":"online"}function Yx(n){const l=n.filter(o=>Number.isFinite(o));if(l.length!==0)return Math.min(...l)}function Gx(n){return Array.from(new Set(n.filter(l=>l.trim().length>0)))}function kM(n){if(n)return n.plan??{routes:n.routes,mode:n.mode,scorer:n.scorer,reason:n.reason}}function Vx(n,l){return l.length===0?n.coverageModelIds.length:l.filter(o=>n.coverageModelIds.includes(o)).length}function nr(n,l){return n.localeCompare(l,void 0,{sensitivity:"base",numeric:!0})}function _f(n,l){const o=Number.isFinite(n),i=Number.isFinite(l);return o&&i?n-l:o?-1:i?1:0}function RM(n,l){return _f(l,n)}function lf(n,l,o){const i=Number.isFinite(n),u=Number.isFinite(l);return!i&&!u?0:i?u?o==="asc"?n-l:l-n:-1:1}function zM(n){return Object.entries(n??{}).sort(([l],[o])=>l.localeCompare(o)).map(([l,o])=>`${l}:${o}`).join(",")}function _M(n,l){return ti(l)-ti(n)}function ti(n){const l=new Date(n).getTime();return Number.isNaN(l)?0:l}function Of(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function OM(n,l){var p;const o=new Map(n.map(x=>[Ln(x.method),x])),i=l.ready?DM(l.label):void 0,f=Array.from(new Set([...VN,...n.map(x=>Ln(x.method)).filter(x=>x&&x!=="mock"),...i?[i]:[]])).map(x=>{const y=o.get(x),g=x===i||!!y&&((y==null?void 0:y.enabled)===!0||xb(y==null?void 0:y.config,"walletConfigPresent"));return{method:x,label:UM(x),configured:g,selected:g&&((y==null?void 0:y.isDefault)===!0||x===i)}}),v=f.filter(x=>x.configured),h=f.find(x=>x.selected)??v[0];return h&&!h.selected&&(h.selected=!0),v.length===0?{active:!1,count:0,label:"No payment",options:f}:{active:!0,count:v.length,label:v.length===1?((p=v[0])==null?void 0:p.label)??"Payment ready":`${v.length} payments`,options:f,activeMethod:h==null?void 0:h.method}}function DM(n){if(!n)return;const l=Ln(n);if(l)return l.includes("clawtip")?"clawtip":l}function UM(n){const l=Ln(n);return l==="clawtip"?"ClawTip":l==="alipay-agent"?"Alipay":l==="wechat-pay"?"WeChat":l==="coinbase-smart-wallet"?"Coinbase":n.split(/[-_\s]+/).filter(Boolean).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}function Ln(n){return n.trim().toLowerCase()}function xb(n,l){const o=n==null?void 0:n[l];return o===!0||o==="true"||o===1||o==="1"}function LM(n){const l=n.trim().toLowerCase();return l.includes("bind a payment method")||l.includes("bind clawtip wallet")}function fm({value:n,onChange:l,placeholder:o}){return s.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:[s.jsx(Ds,{size:15}),s.jsx("input",{name:"routing-search",value:n,onChange:i=>l(i.target.value),placeholder:o,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 gb(n,l){const o=n.trim().toLowerCase();return o?l.some(i=>i.toLowerCase().includes(o)):!0}function mm(n){return n!==void 0}function BM(n,l){const o=yb(l),i=bb(n,o);if(o<=7)return Array.from({length:o},(v,h)=>h+1);const u=[],f=v=>{u[u.length-1]!==v&&u.push(v)};f(1),i>4&&f("…");for(let v=Math.max(2,i-1);v<=Math.min(o-1,i+1);v++)f(v);return i<o-3&&f("…"),f(o),u}function bb(n,l){return Number.isFinite(n)?Math.max(1,Math.min(yb(l),Math.floor(n))):1}function qM(n,l){return Number.isFinite(n)&&n>0?Math.floor(n):Math.max(1,l[0]??25)}function yb(n){return!Number.isFinite(n)||n<1?1:Math.floor(n)}function Sb({totalItems:n,pageSize:l,page:o,onPageChange:i,onPageSizeChange:u,pageSizeOptions:f=[25,50,100]}){const v=qM(l,f),h=Math.max(1,Math.ceil(n/v)),p=bb(o,h),x=S.useMemo(()=>BM(p,h),[p,h]),[y,g]=S.useState(String(p));if(S.useEffect(()=>{g(String(p))},[p]),S.useEffect(()=>{o!==p&&i(p)},[p,i,o]),n===0)return null;const j=(p-1)*v+1,M=Math.min(p*v,n);return s.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:[s.jsxs("div",{className:"text-[var(--color-muted)]",children:["Showing ",s.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:j}),"-",s.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:M})," of"," ",s.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:n})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("label",{className:"text-[0.78rem] text-[var(--color-muted)]",children:"Rows"}),s.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:v,onChange:T=>{const E=Math.max(1,Number(T.target.value)||25);u==null||u(E),i(1)},children:f.map(T=>s.jsx("option",{value:T,children:T},T))}),s.jsxs("div",{className:"ml-2 flex items-center gap-1",children:[s.jsx("button",{type:"button",disabled:p<=1,onClick:()=>i(1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"First page","aria-label":"First page",children:"«"}),s.jsx("button",{type:"button",disabled:p<=1,onClick:()=>i(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==="…"?s.jsx("span",{className:"px-1.5 text-[var(--color-muted)]",children:"…"},`gap-${E}`):s.jsx("button",{type:"button",onClick:()=>i(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)),s.jsx("button",{type:"button",disabled:p>=h,onClick:()=>i(p+1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Next page","aria-label":"Next page",children:"›"}),s.jsx("button",{type:"button",disabled:p>=h,onClick:()=>i(h),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Last page","aria-label":"Last page",children:"»"}),s.jsx("span",{className:"ml-2 text-[0.78rem] text-[var(--color-muted)]",children:"Go to"}),s.jsx("input",{type:"number",min:1,max:h,value:y,"aria-label":"Go to page",onChange:T=>g(T.target.value),onKeyDown:T=>{if(T.key==="Enter"){const E=Math.max(1,Math.min(h,Number(T.target.value)||1));g(String(E)),i(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)]"}),s.jsx("span",{className:"text-[0.78rem] text-[var(--color-muted)]",children:"page"})]})]})]})}function PM(n,l,o=new Date){const i=$M(o);return{inferenceTokens:i.map(u=>({key:u.key,label:u.label,inputTokens:HM(n,u),outputTokens:QM(n,u,"completionTokens")})),imageGenerations:i.map(u=>({key:u.key,label:u.label,imageCount:KM(n,u),requestCount:YM(n,u)})),purchaseSpend:i.map(u=>({key:u.key,label:u.label,paymentTotals:GM(l,u),purchaseCount:VM(l,u)}))}}function $M(n){const l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),o=new Date(l);o.setDate(l.getDate()-(l.getDay()+6)%7);const i=new Date(n.getFullYear(),n.getMonth(),1);return[{key:"today",label:"Today",start:l},{key:"week",label:"This week",start:o},{key:"month",label:"This month",start:i},{key:"total",label:"Total"}]}function QM(n,l,o){return n.reduce((i,u)=>!gi(u.createdAt,l)||Ec(u)?i:i+(u[o]??0),0)}function HM(n,l){return n.reduce((o,i)=>!gi(i.createdAt,l)||Ec(i)?o:o+Math.max(0,(i.promptTokens??0)-(i.cacheReadTokens??0)),0)}function KM(n,l){return n.reduce((o,i)=>!gi(i.createdAt,l)||!Ec(i)?o:o+(Number.isFinite(i.imageCount)?i.imageCount:1),0)}function YM(n,l){return n.reduce((o,i)=>!gi(i.createdAt,l)||!Ec(i)?o:o+1,0)}function Ec(n){return n.billingUnit==="images"||n.endpoint==="/v1/images/generations"}function GM(n,l){const o=n.reduce((i,u)=>{if(!gi(u.completedAt??u.createdAt,l)||!u.paymentCurrency||!Number.isFinite(u.paymentAmountMinor))return i;const f=u.paymentCurrency.trim().toUpperCase();return f&&i.set(f,(i.get(f)??0)+Math.round(u.paymentAmountMinor)),i},new Map);return Array.from(o.entries()).map(([i,u])=>({paymentCurrency:i,paymentAmountMinor:u})).sort((i,u)=>i.paymentCurrency.localeCompare(u.paymentCurrency))}function VM(n,l){return n.reduce((o,i)=>gi(i.completedAt??i.createdAt,l)?o+1:o,0)}function gi(n,l){if(!l.start)return!0;if(!n)return!1;const o=new Date(n);return Number.isNaN(o.getTime())?!1:o>=l.start}function XM(){var fe,O,ee,re;const{language:n}=xr(),l=ae=>hN(ae,n),o=Mc(),i=wj(),u=rm(),f=im(),v=Us(),[h,p]=S.useState("inferences"),[x,y]=S.useState(""),[g,j]=S.useState("all"),[M,T]=S.useState(1),[E,D]=S.useState(1),[R,U]=S.useState(25),Q=o.isLoading||i.isLoading,H=((fe=o.data)==null?void 0:fe.inferences)??[],G=((O=i.data)==null?void 0:O.purchases)??[],K=x.trim().toLowerCase(),$=S.useMemo(()=>PM(H,G),[H,G]),I=S.useMemo(()=>lw(H),[H]),Z=S.useMemo(()=>{var ae,ge;return uw({manualProviders:(ae=u.data)==null?void 0:ae.providers,modelsResponse:v.data,registrySellers:(ge=f.data)==null?void 0:ge.sellers})},[(ee=u.data)==null?void 0:ee.providers,v.data,(re=f.data)==null?void 0:re.sellers]),ne=S.useMemo(()=>H.filter(ae=>g!=="all"&&ae.modelId!==g?!1:iw(ae,K,Z)).sort((ae,ge)=>ge.createdAt.localeCompare(ae.createdAt)),[H,g,Z,K]),B=S.useMemo(()=>G.filter(ae=>sw(ae,K,Z)).sort((ae,ge)=>ge.createdAt.localeCompare(ae.createdAt)),[Z,G,K]),ie=S.useMemo(()=>Fx(ne,M,R),[ne,M,R]),te=S.useMemo(()=>Fx(B,E,R),[B,E,R]),xe=o.isError||i.isError;return S.useEffect(()=>{const ae=Math.max(1,Math.ceil(ne.length/R));M>ae&&T(ae)},[ne.length,M,R]),S.useEffect(()=>{const ae=Math.max(1,Math.ceil(B.length/R));E>ae&&D(ae)},[B.length,R,E]),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("section",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(Rx,{icon:s.jsx(Ns,{className:"size-5"}),label:"Inference tokens",tone:"tokens",rows:$.inferenceTokens.map(ae=>({key:ae.key,label:l(ae.label),value:dc(ae.inputTokens+ae.outputTokens),detail:l(`In ${ye(ae.inputTokens)} / Out ${ye(ae.outputTokens)}`)}))}),s.jsx(Rx,{icon:s.jsx(gs,{className:"size-5"}),label:"Token purchase spend",tone:"spend",rows:$.purchaseSpend.map(ae=>({key:ae.key,label:l(ae.label),value:dw(ae.paymentTotals),detail:l(`${ye(ae.purchaseCount)} purchases`)}))})]}),s.jsxs(_t,{className:"overflow-hidden p-0",children:[s.jsxs("div",{className:"border-b border-[var(--color-line-2)] bg-white px-4 py-3",children:[s.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[s.jsx("div",{children:s.jsx("h1",{className:"text-[1.05rem] font-semibold text-[var(--color-ink)]",children:l("Usage details")})}),s.jsxs("div",{className:"grid grid-cols-2 overflow-hidden rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-1",children:[s.jsx(Xx,{label:l("Inferences"),active:h==="inferences",count:ne.length,onClick:()=>p("inferences"),children:l("Inferences")}),s.jsx(Xx,{label:l("Purchases"),active:h==="purchases",count:B.length,onClick:()=>p("purchases"),children:l("Purchases")})]})]}),s.jsxs("div",{className:["mt-3 grid gap-2",h==="inferences"?"lg:grid-cols-[minmax(220px,1fr)_200px]":"lg:grid-cols-1"].join(" "),children:[s.jsxs("label",{className:"relative block",children:[s.jsx(Ds,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--color-muted)]"}),s.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:x,placeholder:l(h==="inferences"?"Search model, node...":"Search node..."),onChange:ae=>{y(ae.target.value),T(1),D(1)}})]}),h==="inferences"?s.jsx(FM,{label:l("Model"),allLabel:l("All model"),value:g,options:I.models,translateOption:l,onChange:ae=>{j(ae),T(1)}}):null]})]}),xe?s.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,Q?s.jsx(IM,{}):h==="inferences"?s.jsx(ZM,{entries:ie,nodeNameById:Z,total:ne.length,page:M,pageSize:R,onPageChange:T,onPageSizeChange:ae=>{U(ae),T(1),D(1)}}):s.jsx(JM,{entries:te,nodeNameById:Z,total:B.length,page:E,pageSize:R,onPageChange:D,onPageSizeChange:ae=>{U(ae),T(1),D(1)}})]})]})}function Xx({label:n,active:l,count:o,onClick:i,children:u}){return s.jsxs("button",{type:"button",onClick:i,"aria-label":`${n} ledger records, ${ye(o)} records`,className:["tb-button tb-button-sm gap-2",l?"tb-button-primary":"tb-button-secondary"].join(" "),children:[s.jsx("span",{children:u}),s.jsx("span",{className:"font-mono text-[0.76rem]",children:ye(o)})]})}function FM({label:n,allLabel:l,value:o,options:i,translateOption:u,onChange:f}){return s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"sr-only",children:n}),s.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:o,onChange:v=>f(v.target.value),children:[s.jsx("option",{value:"all",children:l}),i.map(v=>s.jsx("option",{value:v,children:u(v)},v))]})]})}function ZM({entries:n,nodeNameById:l,total:o,page:i,pageSize:u,onPageChange:f,onPageSizeChange:v}){return o===0?s.jsx(jb,{label:"inference records"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[960px] text-[0.86rem]",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[var(--color-page)]/70 text-left text-[0.7rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[s.jsx("th",{className:"px-4 py-2.5",children:"TIME"}),s.jsx("th",{className:"px-4 py-2.5",children:"MODEL"}),s.jsx("th",{className:"px-4 py-2.5",children:"NODE"}),s.jsx("th",{className:"px-4 py-2.5",children:"TOKENS"}),s.jsx("th",{className:"px-4 py-2.5",children:"SPEED"}),s.jsx("th",{className:"px-4 py-2.5 text-right",children:"COST"})]})}),n.map(h=>s.jsx("tbody",{children:s.jsxs("tr",{className:"border-t border-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]/25",children:[s.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[0.76rem] text-[var(--color-muted)]",children:Cc(h.createdAt)}),s.jsx("td",{className:"max-w-[190px] truncate px-4 py-3 text-[var(--color-ink)]",children:h.modelId}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(Nb,{nodeId:h.sellerKey,nodeName:l.get(h.sellerKey)})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(WM,{entry:h})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(Tc,{ttftMs:h.ttftMs,tokensPerSecond:aw(h)})}),s.jsx("td",{className:"px-4 py-3 text-right",children:s.jsx(iN,{billingSource:h.billingSource,reportedCostUsdMicros:h.reportedCostUsdMicros,billingUnit:h.billingUnit,billedMicros:h.billedMicros,settledUsdMicros:h.settledUsdMicros,inputPriceMicrosPer1m:h.inputPriceMicrosPer1m,outputPriceMicrosPer1m:h.outputPriceMicrosPer1m,cacheReadPriceMicrosPer1m:h.cacheReadPriceMicrosPer1m,cacheWritePriceMicrosPer1m:h.cacheWritePriceMicrosPer1m,inputCostMicros:h.inputCostMicros,outputCostMicros:h.outputCostMicros,cacheReadCostMicros:h.cacheReadCostMicros,cacheWriteCostMicros:h.cacheWriteCostMicros,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})})]})},h.requestId))]})}),s.jsx(Sb,{totalItems:o,pageSize:u,page:i,onPageChange:f,onPageSizeChange:v})]})}function JM({entries:n,nodeNameById:l,total:o,page:i,pageSize:u,onPageChange:f,onPageSizeChange:v}){return o===0?s.jsx(jb,{label:"purchase records"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[940px] text-[0.86rem]",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[var(--color-page)]/70 text-left text-[0.7rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[s.jsx("th",{className:"px-4 py-2.5",children:"TIME"}),s.jsx("th",{className:"px-4 py-2.5",children:"NODE"}),s.jsx("th",{className:"px-4 py-2.5",children:"METHOD"}),s.jsx("th",{className:"px-4 py-2.5 text-right",children:"SPENT"}),s.jsx("th",{className:"px-4 py-2.5 text-right",children:"CREDIT"}),s.jsx("th",{className:"px-4 py-2.5",children:"STATUS"}),s.jsx("th",{className:"px-4 py-2.5",children:"SCOPE"})]})}),n.map(h=>s.jsx("tbody",{children:s.jsxs("tr",{className:"border-t border-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]/25",children:[s.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[0.76rem] text-[var(--color-muted)]",children:Cc(h.completedAt??h.createdAt)}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(Nb,{nodeId:h.sellerKey,nodeName:l.get(h.sellerKey)})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(tw,{method:h.paymentMethod})}),s.jsx("td",{className:"px-4 py-3 text-right font-mono text-[0.82rem] font-semibold text-[var(--color-ink)]",children:Gj(h)}),s.jsx("td",{className:"px-4 py-3 text-right font-mono text-[0.82rem] font-semibold text-emerald-700",children:Yj(h.creditMicros)}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(ew,{status:h.status})}),s.jsx("td",{className:"max-w-[180px] truncate px-4 py-3 font-mono text-[0.78rem] text-[var(--color-muted)]",title:h.modelId,children:nw(h.modelId)})]})},h.purchaseId))]})}),s.jsx(Sb,{totalItems:o,pageSize:u,page:i,onPageChange:f,onPageSizeChange:v})]})}function IM(){return s.jsx("div",{className:"space-y-2 px-4 py-4",children:Array.from({length:7},(n,l)=>s.jsx("div",{className:"h-12 rounded-lg bg-[var(--color-lavender)]/35"},l))})}function jb({label:n}){return s.jsxs("div",{className:"flex min-h-[220px] flex-col items-center justify-center px-6 py-10 text-center",children:[s.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:s.jsx(Ds,{className:"size-5"})}),s.jsxs("div",{className:"mt-4 font-semibold text-[var(--color-ink)]",children:["No matching ",n]}),s.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 Nb({nodeId:n,nodeName:l}){const o=l??n;return s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"max-w-[220px] truncate font-semibold text-[var(--color-ink)]",title:o,children:o}),s.jsx("div",{className:"mt-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:Ls(n)})]})}function WM({entry:n}){if(Mb(n))return s.jsx(lN,{imageCount:n.imageCount,imageSize:n.imageSize,imageQuality:n.imageQuality,imageOutputFormat:n.imageOutputFormat});const l=!ow(n);return s.jsx(aN,{inputTokens:l?n.promptTokens:cw(n),outputTokens:n.completionTokens,cacheReadTokens:n.cacheReadTokens,cacheWriteTokens:n.cacheWriteTokens,showCacheRead:l})}function ew({status:n}){const l=sa(n),o={green:"bg-emerald-50 text-emerald-700 ring-emerald-100",amber:"bg-amber-50 text-amber-700 ring-amber-100",red:"bg-rose-50 text-rose-700 ring-rose-100",blue:"bg-blue-50 text-blue-700 ring-blue-100",gray:"bg-slate-100 text-slate-600 ring-slate-200"}[l];return s.jsx("span",{className:["inline-flex h-6 w-fit items-center rounded-full px-2 text-[0.66rem] font-semibold uppercase ring-1",o].join(" "),children:bn(n)})}function tw({method:n}){return s.jsx("span",{className:"inline-flex max-w-[160px] rounded-full bg-[var(--color-page)] px-2 py-1 font-mono text-[0.72rem] font-semibold text-[var(--color-ink)] ring-1 ring-[var(--color-line-2)]",children:s.jsx("span",{className:"truncate",children:n||"—"})})}function nw(n){return n||"All models"}function aw(n){if(!Mb(n))return Number.isFinite(n.avgOutputTokensPerSecond)?n.avgOutputTokensPerSecond:void 0}function lw(n){return{models:rw(n.map(l=>l.modelId))}}function rw(n){return Array.from(new Set(n.filter(Boolean))).sort((l,o)=>l.localeCompare(o))}function iw(n,l,o){return l?[n.sellerKey,o.get(n.sellerKey),n.modelId,n.status,n.balanceSource,n.paymentMethod,Cc(n.createdAt)].some(i=>i==null?void 0:i.toLowerCase().includes(l)):!0}function sw(n,l,o){return l?[n.sellerKey,o.get(n.sellerKey),n.paymentMethod,n.status,n.modelId,Cc(n.createdAt)].some(i=>i==null?void 0:i.toLowerCase().includes(l)):!0}function Fx(n,l,o){const i=(l-1)*o;return n.slice(i,i+o)}function Mb(n){return n.billingUnit==="images"||n.endpoint==="/v1/images/generations"}function ow(n){var l;return n.balanceSource==="self_funded_provider"||n.paymentMethod==="provider_key"||((l=n.priceVersion)==null?void 0:l.startsWith("local-provider:"))===!0}function cw(n){return Math.max(0,n.promptTokens-(n.cacheReadTokens??0))}function uw({manualProviders:n,modelsResponse:l,registrySellers:o}){const i=new Map;for(const u of o??[])i.set(u.id,ic(u.name??u.id));for(const u of(l==null?void 0:l.sellers)??[])i.set(u.id,ic(u.name??u.id));for(const u of(l==null?void 0:l.data)??[])u.sellerName&&i.set(u.sellerId,ic(u.sellerName));for(const u of n??[])i.set(u.id,ic(u.name||u.id));return i}function ic(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function dw(n){return n.length===0?"-":n.map(l=>Vj(l.paymentAmountMinor,l.paymentCurrency)).join(" / ")}function fw(){return Pt({queryKey:["init","state"],queryFn:()=>Ot("/init/state"),refetchInterval:1e4})}async function mw(n){return nt("POST","/init/complete",void 0)}function hw(){return ot({mutationFn:()=>nt("POST","/init/doctor/run")})}function wb(){return Pt({queryKey:["providers","status"],queryFn:()=>Ot("/providers/status"),refetchInterval:1e4})}function pw(){return ot({mutationFn:n=>nt("POST","/providers/install/preview",n)})}function vw(){const n=jt();return ot({mutationFn:l=>nt("POST","/providers/install/apply",l),onSuccess:()=>{n.invalidateQueries({queryKey:["providers","status"]}),n.invalidateQueries({queryKey:["init","state"]})}})}function xw(){const n=jt();return ot({mutationFn:l=>nt("POST","/providers/reconnect",l),onSuccess:()=>{n.invalidateQueries({queryKey:["providers","status"]}),n.invalidateQueries({queryKey:["models"]}),n.invalidateQueries({queryKey:["routing","manual-providers"]}),n.invalidateQueries({queryKey:["init","state"]})}})}function gw(){const n=jt();return ot({mutationFn:()=>nt("POST","/models/refresh",{}),onSuccess:()=>{n.invalidateQueries({queryKey:["models"]}),n.invalidateQueries({queryKey:["routing","manual-providers"]})}})}function bw(){const n=jt();return ot({mutationFn:l=>nt("POST","/providers/install/rollback",l),onSuccess:()=>{n.invalidateQueries({queryKey:["providers","status"]}),n.invalidateQueries({queryKey:["init","state"]})}})}const yw=[{value:"fullAuto",title:"全自动",body:"自动选择可用节点。"},{value:"fixedSet",title:"固定节点组",body:"在指定节点组内切换。"},{value:"fixed",title:"固定节点",body:"始终使用指定节点。"}],Sw=["chat_completions","responses","messages"],Df="tbp_local_17821_d7f4c9a2b8e1",jw=[{value:"balanced",title:"平衡模式",body:"综合速度、价格、健康度、余额。"},{value:"speed",title:"速度优先",body:"优先选择更快、吞吐量更高节点。"},{value:"discount",title:"成本优先",body:"优先选择更低成本节点。"}],Zx=[{index:1,label:"选择模型",value:"默认模型"},{index:2,label:"绑定钱包",value:"支付方式"},{index:3,label:"配置策略",value:"路由规则"},{index:4,label:"配置工具",value:"终端接入"}],Nw=[{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 钱包入口预留"}],Mw=["GPT","Claude","Gemini","DeepSeek","Kimi","Qwen","MiniMax","GLM","Doubao","Grok"];function ww(n){const l=new URLSearchParams(n);return l.has("verifyPaymentMethods")?2:(l.has("verifyPickerDom")||l.has("verifyNoIntro")||l.has("verifyCompact"),1)}function Cw(){var ma,De,jn,ha,pa,va,Nn,Lt,Jn,gr,Ll,Fa;const[n,l]=S.useState(()=>ww(typeof window>"u"?"":window.location.search)),[o,i]=S.useState([]),[u,f]=S.useState(!1),[v,h]=S.useState(),[p,x]=S.useState(!1),[y,g]=S.useState(!1),[j,M]=S.useState("fullAuto"),[T,E]=S.useState("balanced"),[D,R]=S.useState(""),[U,Q]=S.useState([]),[H,G]=S.useState(),[K,$]=S.useState(""),[I,Z]=S.useState([]),[ne,B]=S.useState({}),[ie,te]=S.useState(),[xe,fe]=S.useState(),[O,ee]=S.useState(!1),[re,ae]=S.useState(null),[ge,N]=S.useState(!1),[q,X]=S.useState(),le=fw(),pe=sm(),de=Tj(),be=nm(),Ve=wb(),Oe=am(),wt=lm(),ht=pw(),yn=vw(),et=hw(),Be=Us(),nn=Mc(),an=S.useMemo(()=>{var ue;return kw(((ue=Be.data)==null?void 0:ue.data)??[])},[(ma=Be.data)==null?void 0:ma.data]),Sn=S.useMemo(()=>{var ue,Ze,Je;return Gw(((ue=Be.data)==null?void 0:ue.sellers)??[],((Ze=Be.data)==null?void 0:Ze.data)??[],((Je=nn.data)==null?void 0:Je.inferences)??[])},[(De=nn.data)==null?void 0:De.inferences,(jn=Be.data)==null?void 0:jn.data,(ha=Be.data)==null?void 0:ha.sellers]),ln=S.useMemo(()=>{var ue;return Rw(an,o,((ue=le.data)==null?void 0:ue.recommendedModels)??[])},[(pa=le.data)==null?void 0:pa.recommendedModels,an,o]),Fe=S.useMemo(()=>o.length>0?o:ln.map(ue=>ue.id),[ln,o]),Dt=`http://127.0.0.1:${((va=pe.data)==null?void 0:va.proxyPort)??((Nn=le.data)==null?void 0:Nn.runtime.proxyPort)??17821}`,rn=S.useMemo(()=>{var ue;return(((ue=Ve.data)==null?void 0:ue.clients)??[]).filter(Ze=>Ze.id!=="custom"&&Ze.detected)},[(Lt=Ve.data)==null?void 0:Lt.clients]),Xn=((Jn=be.data)==null?void 0:Jn.payments.filter(ue=>ue.enabled&&kc(ue.method)!=="mock"))??[],sn=S.useMemo(()=>e3(j,T,D,U),[D,U,j,T]),ct=t3({serviceReady:((gr=pe.data)==null?void 0:gr.status)==="running",modelCount:an.length,routingMode:j,paymentReady:Xn.length>0,configuredTools:((Ll=Ve.data)==null?void 0:Ll.summary.configuredCount)??0}),Xa=((Fa=et.data)==null?void 0:Fa.checks.map(n3))??ct;S.useEffect(()=>{p||!le.data||(i(le.data.focusSet),x(!0))},[le.data,p]),S.useEffect(()=>{K||o.length===0||$(o[0])},[K,o]),S.useEffect(()=>{y||rn.length===0||g(!0)},[y,rn]),S.useEffect(()=>{n!==5||et.data||et.error||et.isPending||et.mutate()},[n,et]),S.useEffect(()=>{var Je;const ue=In=>{In.preventDefault(),ae(In),X("浏览器已经允许直接安装 TokenBuddy。")},Ze=()=>{N(!0),ae(null),X("TokenBuddy 桌面应用已安装。")};return window.addEventListener("beforeinstallprompt",ue),window.addEventListener("appinstalled",Ze),(Je=window.matchMedia)!=null&&Je.call(window,"(display-mode: standalone)").matches&&N(!0),()=>{window.removeEventListener("beforeinstallprompt",ue),window.removeEventListener("appinstalled",Ze)}},[]);const da=ue=>{h(void 0),i(Ze=>Ze.includes(ue)?Ze.filter(Je=>Je!==ue):[...Ze,ue])},Fn=async()=>{f(!0),h(void 0);try{await Af(o),h("关注模型已保存。后续工具配置会优先参考这些模型。")}catch(ue){h(`保存失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{f(!1)}},qn=async()=>{if(G(void 0),!sn){G(j==="fixed"?"请选择一个固定节点。":"请至少选择一个节点。");return}try{await de.mutateAsync(sn),G("节点路由策略已保存。"),l(4)}catch(ue){G(`保存失败:${ue instanceof Error?ue.message:String(ue)}`)}},Zn=async()=>{try{await Oe.mutateAsync()}catch{}},fa=async()=>{try{await wt.mutateAsync()}catch{}},Ul=async()=>{var Ze;te(void 0);const ue=K||Fe[0];if(!ue){te("请先选择一个默认模型。");return}if(I.length===0){te("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{await ht.mutateAsync({providers:I,proxyUrl:Dt,model:ue,providerSelections:ng(I,ne,Fe,ue,((Ze=Be.data)==null?void 0:Ze.data)??[])}),te("已生成写入预览。确认无误后可以写入配置。")}catch(Je){te(`预览失败:${Je instanceof Error?Je.message:String(Je)}`)}},Pn=async()=>{var Ze;te(void 0);const ue=K||Fe[0];if(!ue){te("请先选择一个默认模型。");return}if(I.length===0){te("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{const Je=await yn.mutateAsync({providers:I,proxyUrl:Dt,model:ue,providerSelections:ng(I,ne,Fe,ue,((Ze=Be.data)==null?void 0:Ze.data)??[])});te(`已写入 ${Je.applied.length} 个配置文件。`),l(5)}catch(Je){te(`写入失败:${Je instanceof Error?Je.message:String(Je)}`)}},Ut=()=>{pe.refetch(),le.refetch(),be.refetch(),Ve.refetch(),Be.refetch(),et.mutate()},pt=async()=>{fe(void 0),ee(!0);try{await mw(),fe("初始化已标记完成。你可以把 TokenBuddy 安装成桌面应用,之后从系统应用入口打开。"),le.refetch()}catch(ue){fe(`完成失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{ee(!1)}},$t=async()=>{if(!re){X("请在浏览器地址栏右侧或菜单里选择“安装应用”。");return}try{X(void 0),await re.prompt();const ue=await re.userChoice;if(ae(null),ue.outcome==="accepted"){N(!0),X("TokenBuddy 桌面应用已安装。");return}X("你可以稍后继续使用浏览器安装入口。")}catch(ue){X(`安装未完成:${ue instanceof Error?ue.message:String(ue)}`)}},vt=(()=>{var ue,Ze,Je,In,Bl,Za,Mn,Ja,Ia;return n<=1?s.jsx(Aw,{commonModels:ln,allModels:an,loading:Be.isLoading,error:Be.error,selectedModels:o,saving:u,saveMessage:v,onToggleModel:da,onSave:Fn,onContinue:()=>l(2)}):n===2?s.jsx(Pw,{payments:((ue=be.data)==null?void 0:ue.payments)??[],enabledPaymentCount:Xn.length,loading:be.isLoading,qrUrl:(Ze=Oe.data)==null?void 0:Ze.qrImageUrl,rechargeQrUrl:(Je=wt.data)==null?void 0:Je.qrImageUrl,walletConfigPresent:(In=Oe.data)==null?void 0:In.walletConfigPresent,error:Oe.error,rechargeError:wt.error,binding:Oe.isPending,rechargeLoading:wt.isPending,onBind:Zn,onLoadRecharge:fa,onRefreshPayments:()=>{be.refetch()},onBack:()=>l(1),onContinue:()=>l(3)}):n===3?s.jsx(Bw,{mode:j,scorer:T,sellers:Sn,fixedSellerId:D,fixedSetSellerIds:U,saving:de.isPending,message:H,onModeChange:M,onScorerChange:E,onFixedSellerChange:R,onToggleFixedSetSeller:ut=>{Q(Pe=>Pe.includes(ut)?Pe.filter(at=>at!==ut):[...Pe,ut])},onSave:qn,onBack:()=>l(2)}):n===4?s.jsx(Qw,{clients:((Bl=Ve.data)==null?void 0:Bl.clients)??[],candidates:rn,loading:Ve.isLoading,selectedProviders:I,selectedModel:K||Fe[0]||"",modelOptions:Fe,providerSelections:ne,proxyUrl:Dt,previewChanges:(Za=ht.data)==null?void 0:Za.changes,applying:yn.isPending,previewing:ht.isPending,message:ie,onToggleProvider:ut=>{Z(Pe=>Pe.includes(ut)?Pe.filter(at=>at!==ut):[...Pe,ut])},onModelChange:$,onProviderSelectionChange:(ut,Pe)=>{B(at=>({...at,[ut]:Pe}))},onPreview:Ul,onInstall:Pn,onBack:()=>l(3)}):n===5?s.jsx(Kw,{items:Xa,status:(Mn=et.data)==null?void 0:Mn.status,generatedAt:(Ja=et.data)==null?void 0:Ja.generatedAt,running:et.isPending,error:et.error,onRefresh:Ut,onBack:()=>l(4),onContinue:()=>l(6)}):s.jsx(Yw,{complete:((Ia=le.data)==null?void 0:Ia.setup.status)==="completed",message:xe,installMessage:q,canInstall:!!re,installed:ge,saving:O,onBack:()=>l(5),onComplete:pt,onInstall:$t})})();return s.jsxs("div",{className:"min-w-0 space-y-3",children:[s.jsx(Tw,{activeStep:n,onSelect:l}),s.jsx("div",{className:"min-w-0",children:vt})]})}function Tw({activeStep:n,onSelect:l}){return s.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:s.jsx("div",{className:"flex items-stretch gap-2 overflow-x-auto",children:Zx.map(o=>{const i=n===o.index,u=n>o.index;return s.jsxs(S.Fragment,{children:[s.jsxs("button",{type:"button",onClick:()=>l(o.index),"aria-current":i?"step":void 0,className:["relative flex min-w-[190px] flex-1 items-center gap-2 rounded-[8px] px-3 py-2 text-left transition",i?"bg-[var(--color-lavender)] ring-1 ring-[var(--color-lavender-2)]":"hover:bg-[var(--color-page)]"].join(" "),children:[s.jsx("span",{className:["grid size-6 shrink-0 place-items-center rounded-full border bg-white",i?"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":"",!i&&!u?"border-[var(--color-line-2)] text-[var(--color-muted)]":""].join(" "),children:u?s.jsx(Yt,{className:"size-3.5"}):s.jsx("span",{className:"size-1.5 rounded-full bg-current"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsxs("span",{className:["block font-mono text-[0.62rem] font-black uppercase tracking-[0.08em]",i?"text-[var(--color-purple)]":"text-[var(--color-muted)]"].join(" "),children:["STEP ",o.index,":"]}),s.jsx("span",{className:["mt-0.5 block text-[0.82rem] font-semibold",i?"text-[var(--color-purple)]":"text-[var(--color-ink)]"].join(" "),children:o.label}),s.jsx("span",{className:"block truncate text-[0.7rem] text-[var(--color-muted)]",children:o.value})]})]}),o.index<Zx.length?s.jsx("div",{className:"hidden min-w-8 items-center justify-center text-[var(--color-purple)]/70 sm:flex",children:s.jsx(Nc,{className:"size-5",strokeWidth:2.6})}):null]},o.index)})})})}function bi({index:n,title:l,detail:o,meta:i,action:u}){return s.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:[s.jsx("div",{className:"min-w-0",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.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")}),s.jsx("div",{className:"text-[0.92rem] font-semibold text-[var(--color-ink)]",children:l}),o?s.jsx("span",{className:"text-[0.74rem] text-[var(--color-muted)]",children:o}):null,i?s.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:i}):null]})}),u?s.jsx("div",{className:"shrink-0",children:u}):null]})}function Aw({commonModels:n,allModels:l,loading:o,error:i,selectedModels:u,saving:f,saveMessage:v,onToggleModel:h,onSave:p,onContinue:x}){const[y,g]=S.useState(!1),j=u.map(M=>l.find(T=>T.id===M)??{id:M,sellerCount:0,protocols:[],paymentMethods:[]});return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(_t,{className:"p-3",children:[s.jsx(bi,{index:1,title:"模型访问",detail:"默认和高频模型",meta:`${u.length} selected`,action:s.jsxs("button",{type:"button",disabled:o||!!i,onClick:()=>g(!0),className:"inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-purple)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple-2)] disabled:cursor-not-allowed disabled:opacity-45",children:[s.jsx(Ms,{className:"size-3.5"}),"添加模型"]})}),i?s.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.84rem] leading-6 text-rose-700",children:["模型目录加载失败:",i instanceof Error?i.message:String(i)]}):null,j.length===0?s.jsxs("button",{type:"button",disabled:o||!!i,onClick:()=>g(!0),className:"mt-3 flex min-h-[72px] w-full items-center gap-3 rounded-[10px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-3 text-left transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[s.jsx("span",{className:"grid size-8 shrink-0 place-items-center rounded-[8px] bg-white text-[var(--color-purple)]",children:s.jsx(Ms,{className:"size-4"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block text-[0.86rem] font-semibold text-[var(--color-ink)]",children:"添加可能使用到的模型"}),s.jsx("span",{className:"mt-0.5 block text-[0.76rem] text-[var(--color-muted)]",children:"至少选择一个模型后才能保存并继续。"})]})]}):s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:j.map(M=>s.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:[s.jsx("span",{className:"truncate font-mono text-[0.82rem] font-semibold text-[var(--color-purple)]",children:M.id}),s.jsx("span",{className:"rounded-full bg-white/70 px-2 py-0.5 text-[0.68rem] font-semibold text-emerald-700",children:"可用"}),s.jsx("button",{type:"button",onClick:()=>h(M.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 ${M.id}`,children:s.jsx(Dl,{className:"size-3"})})]},M.id))}),s.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:[s.jsxs("div",{className:"min-h-5 text-[0.8rem] leading-5 text-[var(--color-muted)]",children:[o?s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(St,{className:"size-3.5 animate-spin text-[var(--color-purple)]"})," loading catalog"]}):null,!o&&!i&&u.length===0?s.jsx("span",{children:"请选择至少一个可能使用的模型。"}):null,v?s.jsx("div",{className:"mt-1 font-medium text-[var(--color-ink)]",children:v}):null]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.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?s.jsx(St,{className:"size-3.5 animate-spin"}):null,"保存"]}),s.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:["下一步",s.jsx(Nc,{className:"size-3.5"})]})]})]})]}),y?s.jsx(Ew,{models:n,allModels:l,selectedModelIds:u,onToggle:h,onClose:()=>g(!1)}):null]})}function Ew({models:n,allModels:l,selectedModelIds:o,onToggle:i,onClose:u}){const[f,v]=S.useState("common"),[h,p]=S.useState(""),x=h.trim(),y=f==="common"?n:x?Ow(l,x):[],g=f==="common"?"没有可用的推荐模型。":"输入关键词搜索全部可用模型。",j=[{id:"common",label:"推荐模型",hint:"直接勾选"},{id:"all",label:"搜索添加",hint:"全部模型"}];return s.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:s.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:[s.jsxs("div",{className:"flex items-start gap-3 border-b border-[var(--color-line-2)] px-4 py-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Select models"}),s.jsx("h2",{className:"mt-0.5 text-[1rem] font-semibold text-[var(--color-ink)]",children:"选择可能使用到的模型"}),s.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"推荐模型直接勾选;搜索添加用于查找平台全部模型。"})]}),s.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:[o.length," selected"]}),s.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:s.jsx(Dl,{className:"size-4"})})]}),s.jsxs("div",{className:"border-b border-[var(--color-line-2)] px-4 py-2.5",children:[s.jsx("div",{className:"mb-2 text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"已选模型"}),o.length===0?s.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:"还没有选择模型。"}):s.jsx("div",{className:"flex max-h-[92px] flex-wrap gap-1.5 overflow-y-auto pr-1",children:o.map(M=>s.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:[s.jsx("span",{className:"max-w-[220px] truncate font-mono text-[0.72rem] font-semibold text-[var(--color-purple)]",children:M}),s.jsx("button",{type:"button",onClick:()=>i(M),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 ${M}`,children:s.jsx(Dl,{className:"size-3"})})]},M))})]}),s.jsxs("div",{className:"border-b border-[var(--color-line-2)] p-3",children:[s.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:j.map(M=>{const T=f===M.id;return s.jsxs("button",{type:"button",onClick:()=>v(M.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:[s.jsx("span",{className:["block text-[0.84rem] font-semibold",T?"text-[var(--color-purple)]":"text-[var(--color-ink)]"].join(" "),children:M.label}),s.jsx("span",{className:"mt-0.5 block text-[0.72rem] text-[var(--color-muted)]",children:M.hint})]},M.id)})}),f==="all"?s.jsxs("label",{className:"relative mt-3 block",children:[s.jsx(Ds,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--color-muted)]"}),s.jsx("input",{value:h,onChange:M=>p(M.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]}),s.jsx("div",{className:"min-h-0 max-h-[320px] overflow-y-auto p-3",children:y.length===0?s.jsx("div",{className:"rounded-[12px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-4 py-8 text-center text-[0.86rem] text-[var(--color-muted)]",children:g}):s.jsx("div",{className:"grid gap-2",children:y.map(M=>{const T=o.includes(M.id);return s.jsxs("button",{type:"button",onClick:()=>i(M.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:[s.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:s.jsx(Yt,{className:"size-3.5"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:M.id}),s.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[0.72rem] text-[var(--color-muted)]",children:[s.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:hm(M.id)}),s.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 font-semibold text-emerald-700",children:"可用"}),Uf(M.paymentMethods)?s.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:Uf(M.paymentMethods)}):null]})]}),s.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?"已选择":"选择"})]},M.id)})})}),s.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:[s.jsxs("div",{className:"text-[0.8rem] leading-5 text-[var(--color-muted)]",children:["已选择 ",s.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:o.length})," 个模型"]}),s.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:["完成选择",s.jsx(Yt,{className:"size-3.5"})]})]})]})})}function kw(n){const l=new Map;for(const o of n){const i=l.get(o.id)??{sellers:new Set,protocols:new Set,paymentMethods:new Set};i.sellers.add(o.sellerId);for(const u of o.supportedProtocols)i.protocols.add(u);for(const u of o.paymentMethods)i.paymentMethods.add(u);l.set(o.id,i)}return Array.from(l.entries()).map(([o,i])=>({id:o,sellerCount:i.sellers.size,protocols:Array.from(i.protocols).sort(),paymentMethods:Array.from(i.paymentMethods).sort()})).sort((o,i)=>i.sellerCount!==o.sellerCount?i.sellerCount-o.sellerCount:o.id.localeCompare(i.id))}function Rw(n,l,o){const i=zw(n,o);if(i.length>0)return i.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 v=n.map(p=>({model:p,rank:Dw(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)),h=new Map;for(const p of v){const x=hm(p.model.id),y=h.get(x)??[];y.push(p),h.set(x,y)}for(const p of Mw){const x=p==="GPT"?3:p==="Claude"||p==="Gemini"?2:1;for(const y of(h.get(p)??[]).slice(0,x))f.set(y.model.id,y.model)}for(const p of v){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 zw(n,l){const o=new Map;for(const i of l){const u=_w(n,i,o);u&&o.set(u.id,u)}return Array.from(o.values())}function _w(n,l,o){const i=rf(l);if(!i)return;const u=n.find(f=>rf(f.id)===i&&!o.has(f.id));return u||n.find(f=>{if(o.has(f.id))return!1;const v=rf(f.id);return v.includes(i)||i.includes(v)})}function rf(n){return n.trim().toLowerCase().replace(/_/g,"-")}function Ow(n,l){const o=l.trim().toLowerCase();return o?n.filter(i=>[i.id,hm(i.id),...i.paymentMethods].some(u=>u.toLowerCase().includes(o))):n}function Dw(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 hm(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 Uf(n){return n.length===0?"":`${Uw(n.map(Lw)).join("、")}`}function Uw(n){return Array.from(new Set(n))}function Lw(n){const l=kc(n);return l.includes("x402")?"X402":l.includes("clawtip")?"ClawTip":l.includes("wallet")?"钱包":l.includes("mock")||l.includes("test")?"测试":"其它"}function kc(n){return n.trim().toLowerCase()}function Bw({mode:n,scorer:l,sellers:o,fixedSellerId:i,fixedSetSellerIds:u,saving:f,message:v,onModeChange:h,onScorerChange:p,onFixedSellerChange:x,onToggleFixedSetSeller:y,onSave:g,onBack:j}){const M=n!=="fullAuto";return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(_t,{className:"p-3",children:[s.jsx(bi,{index:3,title:"配置策略",detail:"路由规则",meta:`${zb(n)} / ${s3(l)}`}),s.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-2",children:[s.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[s.jsx("div",{className:"mb-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:"路由模式"}),s.jsx("div",{className:"grid gap-2",children:yw.map(T=>s.jsxs("button",{type:"button",onClick:()=>h(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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.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:s.jsx(Yt,{className:"size-3"})}),s.jsx("span",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:T.title})]}),s.jsx("p",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:T.body})]},T.value))})]}),s.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[s.jsx("div",{className:"mb-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:"优化目标"}),s.jsx("div",{className:"grid gap-2",children:jw.map(T=>s.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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.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:s.jsx(Yt,{className:"size-3"})}),s.jsx("span",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:T.title})]}),s.jsx("p",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:T.body})]},T.value))})]})]}),M?s.jsxs("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"选择节点"}),s.jsx("div",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5 text-[0.72rem] text-[var(--color-muted)]",children:n==="fixed"?i?"已选择 1 个":"尚未选择":`已选择 ${u.length} 个`})]}),o.length===0?s.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:"正在等待节点目录。你也可以先返回上一步确认模型目录是否已经加载完成。"}):s.jsx(qw,{mode:n,sellers:o,fixedSellerId:i,fixedSetSellerIds:u,onFixedSellerChange:x,onToggleFixedSetSeller:y})]}):s.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 会根据模型、节点健康度、速度、价格和余额状态自动规划调用路径。"})]}),s.jsx(Cb,{backLabel:"上一步:绑定钱包",nextLabel:"下一步:配置工具",saving:f,message:v,onBack:j,onNext:g})]})}function qw({mode:n,sellers:l,fixedSellerId:o,fixedSetSellerIds:i,onFixedSellerChange:u,onToggleFixedSetSeller:f}){const[v,h]=S.useState({key:"status",direction:"asc"}),p=S.useMemo(()=>Tb(l,v),[l,v]),x=g=>{h(j=>({key:g,direction:j.key===g&&j.direction==="asc"?"desc":"asc"}))},y=g=>{if(n==="fixed"){u(g);return}f(g)};return s.jsx("div",{className:"mt-2 overflow-hidden rounded-[9px] border border-[var(--color-line-2)]",children:s.jsx("div",{className:"max-h-[300px] overflow-auto",children:s.jsxs("table",{className:"min-w-[760px] w-full border-collapse text-left text-[0.78rem]",children:[s.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:s.jsxs("tr",{children:[s.jsx("th",{className:"w-12 px-2 py-2 font-semibold",children:"选"}),s.jsx(ei,{label:"节点",sortKey:"name",sort:v,onSort:x}),s.jsx(ei,{label:"状态",sortKey:"status",sort:v,onSort:x}),s.jsx(ei,{label:"模型",sortKey:"models",sort:v,onSort:x,align:"right"}),s.jsx(ei,{label:"价格",sortKey:"price",sort:v,onSort:x}),s.jsx(ei,{label:"折扣",sortKey:"discount",sort:v,onSort:x,align:"right"}),s.jsx(ei,{label:"响应",sortKey:"speed",sort:v,onSort:x,align:"right"}),s.jsx("th",{className:"px-3 py-2 font-semibold",children:"支付"})]})}),s.jsx("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:p.map(g=>{const j=n==="fixed"?o===g.id:i.includes(g.id);return s.jsxs("tr",{onClick:()=>y(g.id),className:["cursor-pointer transition hover:bg-[var(--color-lavender)]/45",j?"bg-[var(--color-lavender)]/70":"bg-white"].join(" "),children:[s.jsx("td",{className:"px-2 py-2.5",children:s.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:s.jsx(Yt,{className:"size-3"})})}),s.jsxs("td",{className:"max-w-[210px] px-3 py-2.5",children:[s.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:g.name}),s.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.68rem] text-[var(--color-muted)]",children:g.id})]}),s.jsx("td",{className:"px-3 py-2.5",children:s.jsx("span",{className:["inline-flex whitespace-nowrap rounded-full px-2 py-0.5 text-[0.7rem] font-semibold",c3(g.status)].join(" "),children:o3(g.status)})}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-ink)]",children:g.modelCount}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-ink)]",children:s.jsx(sN,{inputPriceMicrosPer1m:g.minInputPriceMicrosPer1m,outputPriceMicrosPer1m:g.minOutputPriceMicrosPer1m})}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-purple)]",children:Cs(g.discountRatio)}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:s.jsx(Tc,{ttftMs:g.avgTtftMs,tokensPerSecond:g.avgTokensPerSecond,compact:!0})}),s.jsx("td",{className:"max-w-[150px] px-3 py-2.5",children:s.jsx("div",{className:"truncate text-[0.72rem] text-[var(--color-muted)]",children:Uf(g.paymentMethods)||"—"})})]},g.id)})})]})})})}function ei({label:n,sortKey:l,sort:o,align:i="left",onSort:u}){const f=o.key===l,v=f?o.direction==="asc"?"↑":"↓":"↕";return s.jsx("th",{className:["px-3 py-2 font-semibold",i==="right"?"text-right":"text-left"].join(" "),children:s.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",i==="right"?"justify-end":"justify-start",f?"text-[var(--color-purple)]":"text-[var(--color-muted)]"].join(" "),children:[s.jsx("span",{children:n}),s.jsx("span",{className:"font-mono text-[0.66rem]",children:v})]})})}function Pw({payments:n,enabledPaymentCount:l,loading:o,qrUrl:i,rechargeQrUrl:u,walletConfigPresent:f,error:v,rechargeError:h,binding:p,rechargeLoading:x,onBind:y,onLoadRecharge:g,onRefreshPayments:j,onBack:M,onContinue:T}){const[E,D]=S.useState("clawtip"),[R,U]=S.useState(!1),[Q,H]=S.useState(!1),G=n.find(O=>kc(O.method)==="clawtip"),K=!!(G!=null&&G.enabled||f||$w(G==null?void 0:G.config,"walletConfigPresent")),$=R&&K,I=[{method:"clawtip",name:"ClawTip",detail:"JD App 扫码 / 微支付",status:K?"已绑定":"可绑定",available:!0},...Nw.map(O=>({...O,status:"Coming soon",available:!1}))],Z=I.find(O=>O.method===E)??I[0],ne=Z.method==="clawtip",B=ne&&K&&!$,ie=$||B||R,te=ne?ie:!0,xe=()=>{U(!0),y()},fe=()=>{H(!0),g()};return S.useEffect(()=>{if(!ne||!R||K)return;const O=window.setInterval(j,1500);return()=>window.clearInterval(O)},[R,K,j,ne]),S.useEffect(()=>{!B||u||x||Q||(H(!0),g())},[g,x,u,Q,B]),s.jsxs("div",{className:"space-y-3",children:[s.jsxs(_t,{className:"p-3",children:[s.jsx(bi,{index:2,title:"选择支付方式",detail:"钱包和充值通道",meta:o?"checking":`${l} active`,action:ne&&B?s.jsxs("button",{type:"button",disabled:x,onClick:fe,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?s.jsx(St,{className:"size-3.5 animate-spin"}):s.jsx(Ns,{className:"size-3.5"}),"刷新充值码"]}):ne&&R&&!K?s.jsxs("button",{type:"button",disabled:p,onClick:xe,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[p?s.jsx(St,{className:"size-3.5 animate-spin"}):s.jsx(gs,{className:"size-3.5"}),"重新生成"]}):ne&&!R&&!K?s.jsxs("button",{type:"button",disabled:p,onClick:xe,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[p?s.jsx(St,{className:"size-3.5 animate-spin"}):s.jsx(gs,{className:"size-3.5"}),"开始绑定"]}):ne?null:s.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"})}),s.jsxs("div",{className:["mt-3 grid gap-3",te?"lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]":"lg:max-w-[360px]"].join(" "),children:[s.jsx("div",{className:"grid content-start gap-2",children:I.map(O=>{const ee=O.method===Z.method;return s.jsxs("button",{type:"button",onClick:()=>D(O.method),"aria-pressed":ee,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",ee?"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:[s.jsx("span",{className:["grid size-9 shrink-0 place-items-center rounded-[9px] border",ee?"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:Jx(O.method)}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-[0.86rem] font-semibold text-[var(--color-ink)]",children:O.name}),s.jsx("span",{className:"mt-0.5 block truncate text-[0.73rem] text-[var(--color-muted)]",children:O.detail})]}),s.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.68rem] font-semibold",O.available?"bg-emerald-50 text-emerald-700":"bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:O.status})]},O.method)})}),ne?ie?s.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:$?s.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:s.jsxs("div",{children:[s.jsx(Yt,{className:"mx-auto size-8 text-emerald-700"}),s.jsx("div",{className:"mt-3 text-[0.92rem] font-semibold text-emerald-900",children:"绑定成功"}),s.jsx("div",{className:"mt-1 text-[0.78rem] leading-5 text-emerald-800",children:"ClawTip 钱包已经写入本机配置,可以继续配置路由策略。"})]})}):B?u?s.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)]"}):s.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:s.jsxs("div",{children:[x?s.jsx(St,{className:"mx-auto size-6 animate-spin text-[var(--color-purple)]"}):s.jsx(Ns,{className:"mx-auto size-6 text-[var(--color-purple)]"}),s.jsx("div",{className:"mt-2 text-[0.84rem] font-semibold text-[var(--color-ink)]",children:x?"正在加载充值码":"充值码未加载"}),s.jsx("button",{type:"button",disabled:x,onClick:fe,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:"重新加载"})]})}):R&&i?s.jsx("img",{src:i,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)]"}):R?s.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:s.jsxs("div",{children:[p?s.jsx(St,{className:"mx-auto size-6 animate-spin text-[var(--color-purple)]"}):s.jsx(gs,{className:"mx-auto size-6 text-[var(--color-purple)]"}),s.jsx("div",{className:"mt-2 text-[0.84rem] font-semibold text-[var(--color-ink)]",children:p?"正在生成二维码":"等待二维码"}),s.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"生成后使用京东 App 扫码绑定。"})]})}):null}):null:s.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:s.jsxs("div",{className:"max-w-[360px]",children:[s.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:Jx(Z.method)}),s.jsx("div",{className:"mt-3 text-[0.92rem] font-semibold text-[var(--color-ink)]",children:Z.name}),s.jsxs("div",{className:"mt-1 text-[0.78rem] leading-5 text-[var(--color-muted)]",children:[Z.detail,"。当前版本先通过 ClawTip 完成钱包绑定,后续会在这里接入更多支付流程。"]}),s.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"})]})})]}),ne&&!K&&R&&v?s.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,ne&&B&&h?s.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]}),s.jsx(Cb,{backLabel:"上一步:模型访问",nextLabel:"下一步:配置策略",message:l>0?"支付方式已可用,可以继续配置路由策略。":"如果你暂时跳过绑定,后续首次购买模型额度时仍需要完成支付配置。",onBack:M,onNext:T})]})}function Jx(n){const l=kc(n);return l==="wechat-pay"?s.jsx(xj,{className:"size-4"}):l==="alipay-agent"?s.jsx(WS,{className:"size-4"}):l==="coinbase-smart-wallet"?s.jsx(Ns,{className:"size-4"}):s.jsx(gs,{className:"size-4"})}function $w(n,l){const o=n==null?void 0:n[l];return o===!0||o==="true"||o===1||o==="1"}function Qw({clients:n,candidates:l,loading:o,selectedProviders:i,selectedModel:u,modelOptions:f,providerSelections:v,proxyUrl:h,previewChanges:p,applying:x,previewing:y,message:g,onToggleProvider:j,onModelChange:M,onProviderSelectionChange:T,onPreview:E,onInstall:D,onBack:R}){var ne;const U=new Set(l.map(B=>B.id)),Q=l.length,H=n.find(B=>B.id==="custom")??kb(h),G=[...n.filter(B=>B.id!=="custom"),{...H,name:"其他工具"}],K=((ne=G[0])==null?void 0:ne.id)??"custom",[$,I]=S.useState(K),Z=G.find(B=>B.id===$)??G[0]??H;return S.useEffect(()=>{var B;G.some(ie=>ie.id===$)||I(((B=G[0])==null?void 0:B.id)??"custom")},[$,G]),s.jsxs("div",{className:"space-y-3",children:[s.jsxs(_t,{className:"p-3",children:[s.jsx(bi,{index:4,title:"配置工具",detail:"终端接入",meta:`${i.length} 本次写入 / ${Q} 已安装`,action:o?s.jsx(St,{className:"size-4 animate-spin text-[var(--color-purple)]"}):null}),s.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,320px)_minmax(0,1fr)]",children:[s.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"工具"}),s.jsxs("div",{className:"rounded-full bg-white px-2 py-0.5 text-[0.72rem] text-[var(--color-muted)]",children:[n.length," tools"]})]}),s.jsx("div",{className:"mt-2 grid max-h-[380px] gap-2 overflow-y-auto pr-1",children:G.map(B=>{const ie=B.id!=="custom"&&U.has(B.id),te=i.includes(B.id),xe=Z.id===B.id;return s.jsxs("div",{className:["rounded-[10px] border p-2.5 text-left transition",xe?"border-[var(--color-purple)] bg-white shadow-[0_10px_24px_rgba(60,41,112,0.08)]":"border-[var(--color-line-2)] bg-white/70 hover:border-[var(--color-lavender-2)]"].join(" "),children:[s.jsxs("div",{className:"flex items-start gap-2.5",children:[s.jsx("span",{className:["mt-0.5 grid size-6 shrink-0 place-items-center rounded-[8px] border text-[0.72rem] font-semibold",xe?"border-[var(--color-purple)] bg-[var(--color-lavender)] text-[var(--color-purple)]":"border-[var(--color-line-2)] bg-white text-[var(--color-muted)]"].join(" "),children:Ww(B.name)}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("div",{className:"truncate text-[0.84rem] font-semibold text-[var(--color-ink)]",children:B.name}),te?s.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]}),s.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[0.68rem] text-[var(--color-muted)]",children:[s.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:_b(B)}),B.commandName?s.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:B.commandName}):null,B.id==="custom"?s.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:"复制配置"}):null]})]}),B.id!=="custom"?s.jsx("button",{type:"button",disabled:!ie,className:["mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border",te?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] bg-white text-transparent",ie?"":"opacity-45"].join(" "),"aria-label":te?`移出 ${B.name} 本次写入`:`写入 ${B.name} 的 TokenBuddy 配置`,"aria-pressed":te,title:te?"移出本次写入":"加入本次写入",onClick:()=>j(B.id),children:s.jsx(Yt,{className:"size-3"})}):null]}),s.jsx("button",{type:"button",onClick:()=>I(B.id),className:["mt-2 inline-flex h-7 items-center justify-center rounded-[7px] px-2 text-[0.72rem] font-semibold transition",xe?"bg-[var(--color-lavender)] text-[var(--color-purple)]":"border border-[var(--color-line-2)] bg-white text-[var(--color-muted)] hover:border-[var(--color-purple)] hover:text-[var(--color-ink)]"].join(" "),children:"查看配置"})]},B.id)})})]}),s.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:s.jsx(Hw,{client:Z,selected:i.includes(Z.id),installable:Z.id!=="custom"&&U.has(Z.id),selectedModel:u,modelOptions:f,providerSelections:v,proxyUrl:h,onToggleInstall:()=>j(Z.id),onModelChange:M,onProviderSelectionChange:T})})]}),p?s.jsxs("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:[s.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"配置文件变更"}),p.length===0?s.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:"没有需要写入的配置变更。"}):s.jsx("div",{className:"mt-2 grid max-h-[180px] gap-2 overflow-y-auto pr-1",children:p.map(B=>s.jsxs("div",{className:"rounded-[9px] border border-[var(--color-line-2)] bg-white p-2.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:[s.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:u3(B.action)}),s.jsx("span",{children:B.providerId})]}),s.jsx("div",{className:"mt-1 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:B.path}),s.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:B.summary})]},`${B.providerId}:${B.path}:${B.summary}`))})]}):null]}),s.jsxs(_t,{className:"flex flex-col gap-3 p-3 lg:flex-row lg:items-center lg:justify-between",children:[s.jsx("div",{className:"text-[0.84rem] leading-6 text-[var(--color-muted)]",children:g?s.jsx("div",{className:"mt-1 font-medium text-[var(--color-ink)]",children:g}):null}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",onClick:R,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:"上一步:配置策略"}),s.jsxs("button",{type:"button",disabled:y||i.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?s.jsx(St,{className:"size-4 animate-spin"}):null,"预览写入"]}),s.jsxs("button",{type:"button",disabled:x||i.length===0,onClick:D,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?s.jsx(St,{className:"size-4 animate-spin"}):null,"写入 TokenBuddy 配置"]})]})]})]})}function Hw({client:n,selected:l,installable:o,selectedModel:i,modelOptions:u,providerSelections:f,proxyUrl:v,onToggleInstall:h,onModelChange:p,onProviderSelectionChange:x}){var j,M,T;if(n.id==="custom"){const E=n.manualConfig??kb(v).manualConfig;return s.jsxs("div",{className:"space-y-3",children:[s.jsx(sf,{client:n,selected:!1,installable:!1}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(hs,{label:"OpenAI base URL",value:(E==null?void 0:E.openaiBaseUrl)??Rb(v)}),s.jsx(hs,{label:"Anthropic base URL",value:(E==null?void 0:E.anthropicBaseUrl)??v}),s.jsx(hs,{label:"API key",value:(E==null?void 0:E.apiKey)??Df})]}),s.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=Eb(f[n.id],u,i),D=(U,Q)=>{x(n.id,{...E,fallbackModel:E.fallbackModel||Q||i,roles:{...E.roles,[U]:Q?{upstreamModel:Q,displayName:Q}:void 0}})},R=U=>{x(n.id,{...E,fallbackModel:U}),p(U)};return s.jsxs("div",{className:"space-y-3",children:[s.jsx(sf,{client:n,selected:l,installable:o,onToggleInstall:h}),s.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[s.jsx(ms,{label:"Fallback",value:E.fallbackModel??i,modelOptions:u,onChange:R}),s.jsx(ms,{label:"Haiku",value:((j=E.roles.haiku)==null?void 0:j.upstreamModel)??"",modelOptions:u,onChange:U=>D("haiku",U)}),s.jsx(ms,{label:"Sonnet",value:((M=E.roles.sonnet)==null?void 0:M.upstreamModel)??"",modelOptions:u,onChange:U=>D("sonnet",U)}),s.jsx(ms,{label:"Opus",value:((T=E.roles.opus)==null?void 0:T.upstreamModel)??"",modelOptions:u,onChange:U=>D("opus",U)})]}),s.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=Ab(n.id,f[n.id],i,[]),g=E=>{p(E),x(n.id,{selectionKind:"single-model",protocolPreference:bc(n.id),defaultModel:E})};return s.jsxs("div",{className:"space-y-3",children:[s.jsx(sf,{client:n,selected:l,installable:o,onToggleInstall:h}),s.jsx(ms,{label:"模型",value:y.defaultModel,modelOptions:u,onChange:g}),s.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[s.jsx(hs,{label:"Proxy URL",value:v,compact:!0}),s.jsx(hs,{label:"API key",value:Df,compact:!0})]}),n.configPath?s.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 sf({client:n,selected:l,installable:o,onToggleInstall:i}){return s.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:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("div",{className:"text-[0.9rem] font-semibold text-[var(--color-ink)]",children:n.name}),s.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:_b(n)})]}),s.jsx("div",{className:"mt-1 text-[0.74rem] leading-5 text-[var(--color-muted)]",children:n.reason})]}),n.id!=="custom"?s.jsxs("button",{type:"button",disabled:!o,onClick:i,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?s.jsx(Yt,{className:"size-3.5"}):s.jsx(Ms,{className:"size-3.5"}),l?"已加入本次写入":"写入 TokenBuddy 配置"]}):null]})}function ms({label:n,value:l,modelOptions:o,onChange:i}){return s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-muted)]",children:n}),s.jsxs("select",{value:l,onChange:u=>i(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:[s.jsx("option",{value:"",children:"请选择模型"}),o.map(u=>s.jsx("option",{value:u,children:u},u))]})]})}function hs({label:n,value:l,compact:o=!1}){const[i,u]=S.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(l),u(!0),window.setTimeout(()=>u(!1),1200)}catch{u(!1)}};return s.jsxs("div",{className:["rounded-[10px] border border-[var(--color-line-2)] bg-white px-3 py-2",o?"min-w-0":""].join(" "),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[0.72rem] font-semibold text-[var(--color-muted)]",children:n}),s.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:[s.jsx(QS,{className:"size-3"}),i?"已复制":"复制"]})]}),s.jsx("div",{className:"mt-1 truncate font-mono text-[0.76rem] text-[var(--color-ink)]",children:l})]})}function Kw({items:n,status:l,generatedAt:o,running:i,error:u,onRefresh:f,onBack:v,onContinue:h}){return s.jsx("div",{className:"space-y-3",children:s.jsxs(_t,{className:"p-3",children:[s.jsx(bi,{index:5,title:"验证网关",detail:"本机状态",meta:i?"checking":ag(l),action:s.jsxs("button",{type:"button",disabled:i,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:[i?s.jsx(St,{className:"size-3.5 animate-spin"}):s.jsx(Cf,{className:"size-3.5"}),"刷新"]})}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[0.76rem] text-[var(--color-muted)]",children:[s.jsx("span",{className:["rounded-full px-2 py-0.5 font-semibold",a3(l)].join(" "),children:i?"正在检查":ag(l)}),o?s.jsxs("span",{children:["检查时间:",new Date(o).toLocaleString()]}):s.jsx("span",{children:"等待后端检查。"})]}),u?s.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,s.jsx("div",{className:"mt-3 grid gap-2 xl:grid-cols-2",children:n.map(p=>s.jsxs("div",{className:"flex gap-2.5 rounded-[10px] border border-[var(--color-line-2)] bg-white p-2.5",children:[s.jsx("span",{className:["mt-0.5 grid size-6 shrink-0 place-items-center rounded-full",r3(p.status)].join(" "),children:p.ok?s.jsx(Yt,{className:"size-3.5"}):s.jsx(Cf,{className:"size-3.5"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[0.82rem] font-semibold text-[var(--color-ink)]",children:[p.title,s.jsx("span",{className:["rounded-full px-1.5 py-0.5 text-[0.68rem]",i3(p.status)].join(" "),children:l3(p.status)})]}),s.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:p.body})]})]},p.title))}),s.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:[s.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:"发现异常时返回对应步骤补齐配置。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",onClick:v,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:"上一步"}),s.jsxs("button",{type:"button",onClick:h,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:["下一步",s.jsx(Nc,{className:"size-3.5"})]})]})]})]})})}function Yw({complete:n,message:l,installMessage:o,canInstall:i,installed:u,saving:f,onBack:v,onComplete:h,onInstall:p}){return s.jsx("div",{className:"space-y-3",children:s.jsxs(_t,{className:"p-3",children:[s.jsx(bi,{index:6,title:n?"初始化完成":"桌面应用",detail:u?"已安装":"可选安装",meta:n?"complete":u?"installed":"optional",action:s.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:[s.jsx(Yt,{className:"size-3.5"}),u?"已安装":"安装应用"]})}),s.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,290px)_minmax(0,1fr)]",children:[s.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-3",children:[s.jsx("div",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:u?"TokenBuddy 桌面应用已安装":i?"浏览器支持直接安装":"可从浏览器菜单安装"}),s.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:u?"你可以从系统应用入口打开 TokenBuddy。":i?"点击右上角安装按钮并确认浏览器弹窗。":"在地址栏右侧或浏览器菜单中找到安装应用入口。"}),o?s.jsx("div",{className:"mt-2 text-[0.78rem] font-medium text-[var(--color-ink)]",children:o}):null]}),s.jsx("div",{className:"grid gap-2 lg:grid-cols-3",children:[{title:"安装入口",body:"地址栏或浏览器菜单。"},{title:"应用名称",body:"TokenBuddy。"},{title:"本地服务",body:"继续由 tb-proxyd 提供。"}].map((x,y)=>s.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-white p-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.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}),s.jsx("span",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:x.title})]}),s.jsx("div",{className:"mt-1 text-[0.74rem] leading-5 text-[var(--color-muted)]",children:x.body})]},x.title))})]}),s.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:[s.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:l?s.jsx("span",{className:"font-medium text-[var(--color-ink)]",children:l}):"完成后可以进入控制台。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",onClick:v,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:"上一步"}),s.jsxs("button",{type:"button",disabled:f||n,onClick:h,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?s.jsx(St,{className:"size-3.5 animate-spin"}):s.jsx(Yt,{className:"size-3.5"}),n?"已完成":"完成初始化"]}),s.jsx(vr,{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 Cb({backLabel:n,nextLabel:l,saving:o=!1,message:i,onBack:u,onNext:f}){return s.jsxs(_t,{className:"flex flex-col gap-2.5 p-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:i??"配置完成后继续下一步。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.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}),s.jsxs("button",{type:"button",disabled:o,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:[o?s.jsx(St,{className:"size-3.5 animate-spin"}):null,l,o?null:s.jsx(Nc,{className:"size-3.5"})]})]})]})}function Gw(n,l,o){const i=new Map;for(const v of l){const h=i.get(v.sellerId)??{modelIds:new Set,protocols:new Set,paymentMethods:new Set,ttftMsSamples:[]};h.modelIds.add(v.id);for(const p of v.supportedProtocols)h.protocols.add(p);for(const p of v.paymentMethods)h.paymentMethods.add(p);h.minInputPriceMicrosPer1m=Wx(h.minInputPriceMicrosPer1m,v.inputPriceMicrosPer1m),h.minOutputPriceMicrosPer1m=Wx(h.minOutputPriceMicrosPer1m,v.outputPriceMicrosPer1m),i.set(v.sellerId,h)}for(const v of o){const h=v.sellerKey;if(!h)continue;const p=i.get(h)??{modelIds:new Set,protocols:new Set,paymentMethods:new Set,ttftMsSamples:[]};Number.isFinite(v.ttftMs)&&p.ttftMsSamples.push(v.ttftMs),i.set(h,p)}const u=n.map(v=>{const h=i.get(v.id);return{id:v.id,name:tg(v.name??v.manifestSellerId??v.id),status:v.status,modelCount:v.modelCount??(h==null?void 0:h.modelIds.size)??0,protocols:v.supportedProtocols??Array.from((h==null?void 0:h.protocols)??[]),paymentMethods:v.paymentMethods??Array.from((h==null?void 0:h.paymentMethods)??[]),discountRatio:v.discountRatio,serviceFeeRatio:v.serviceFeeRatio,minInputPriceMicrosPer1m:h==null?void 0:h.minInputPriceMicrosPer1m,minOutputPriceMicrosPer1m:h==null?void 0:h.minOutputPriceMicrosPer1m,avgTtftMs:v.ttftMs??eg((h==null?void 0:h.ttftMsSamples)??[]),avgTokensPerSecond:v.avgTokensPerSecond}}),f=new Set(u.map(v=>v.id));for(const[v,h]of i.entries()){if(f.has(v))continue;const p=l.find(x=>x.sellerId===v);u.push({id:v,name:tg((p==null?void 0:p.sellerName)??v),status:"unknown",modelCount:h.modelIds.size,protocols:Array.from(h.protocols).sort(),paymentMethods:Array.from(h.paymentMethods).sort(),minInputPriceMicrosPer1m:h.minInputPriceMicrosPer1m,minOutputPriceMicrosPer1m:h.minOutputPriceMicrosPer1m,avgTtftMs:eg(h.ttftMsSamples)})}return Tb(u,{key:"status",direction:"asc"})}function Tb(n,l){const o=l.direction==="asc"?1:-1;return[...n].sort((i,u)=>{const f=Vw(i,u,l.key);if(f!==0)return f*o;const v=yc(i.status)-yc(u.status);return v!==0?v:u.modelCount!==i.modelCount?u.modelCount-i.modelCount:i.name.localeCompare(u.name)})}function Vw(n,l,o){return o==="status"?yc(n.status)-yc(l.status):o==="name"?n.name.localeCompare(l.name):o==="models"?n.modelCount-l.modelCount:o==="price"?fc(Ix(n),Ix(l)):o==="discount"?fc(n.discountRatio,l.discountRatio):fc(n.avgTtftMs,l.avgTtftMs)||Xw(n.avgTokensPerSecond,l.avgTokensPerSecond)}function Ix(n){if(!(!Number.isFinite(n.minInputPriceMicrosPer1m)&&!Number.isFinite(n.minOutputPriceMicrosPer1m)))return(n.minInputPriceMicrosPer1m??0)+(n.minOutputPriceMicrosPer1m??0)}function Wx(n,l){const o=Number.isFinite(n),i=Number.isFinite(l);if(o&&i)return Math.min(n,l);if(o)return n;if(i)return l}function eg(n){const l=n.filter(o=>Number.isFinite(o));if(l.length!==0)return l.reduce((o,i)=>o+i,0)/l.length}function fc(n,l){const o=Number.isFinite(n),i=Number.isFinite(l);return o&&i?n-l:o?-1:i?1:0}function Xw(n,l){return fc(l,n)}function tg(n){var l;return((l=n.split("(")[0])==null?void 0:l.trim())||n}function ng(n,l,o,i,u){const f=i||o[0]||"",v={};for(const h of n)h!=="custom"&&(v[h]=h==="claude-code"?Eb(l[h],o,f):Ab(h,l[h],f,u));return v}function Ab(n,l,o,i){const u=Zw(i,Fw(n));return(l==null?void 0:l.selectionKind)==="single-model"?{...l,protocolPreference:l.protocolPreference??bc(n),defaultModel:l.defaultModel||o,...u?{availableModelsByProtocol:u}:{}}:{selectionKind:"single-model",protocolPreference:bc(n),defaultModel:o,...u?{availableModelsByProtocol:u}:{}}}function Eb(n,l,o){var f;const i=(n==null?void 0:n.selectionKind)==="claude-role-mapping"?(f=n.roles.sonnet)==null?void 0:f.upstreamModel:void 0,u=o||i||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 bc(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 Fw(n){if(n==="opencode")return Sw;const l=bc(n);return l?[l]:[]}function Zw(n,l){const o={};for(const i of l){const u=Jw(n.filter(f=>Iw(f,i)).map(f=>f.id));u.length>0&&(o[i]=u)}return Object.keys(o).length>0?o:void 0}function Jw(n){const l=new Set,o=[];for(const i of n){const u=i.trim();!u||l.has(u)||(l.add(u),o.push(u))}return o}function Iw(n,l){return l==="messages"?n.supportedProtocols.includes("messages")||n.supportedProtocols.includes("anthropic_messages"):n.supportedProtocols.includes(l)}function kb(n){return{id:"custom",name:"其他工具",status:"manual",detected:!0,configured:!1,reason:"复制本地推理服务接口到任意 OpenAI 或 Anthropic 兼容客户端。",manualConfig:{openaiBaseUrl:Rb(n),anthropicBaseUrl:n,apiKey:Df}}}function Rb(n){const l=n.replace(/\/+$/,"");return l.endsWith("/v1")?l:`${l}/v1`}function Ww(n){const l=n.trim();return l?l.slice(0,1).toUpperCase():"?"}function e3(n,l,o,i){if(n==="fixed"){const u=o.trim();return u?{mode:n,scorer:l,sellerId:u}:void 0}if(n==="fixedSet"){const u=Array.from(new Set(i.map(f=>f.trim()).filter(Boolean)));return u.length===0?void 0:{mode:n,scorer:l,sellerIds:u}}return{mode:n,scorer:l}}function t3({serviceReady:n,modelCount:l,routingMode:o,paymentReady:i,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:`当前策略为${zb(o)},TokenBuddy 会按这个策略规划节点。`,ok:!!o,status:o?"passed":"failed",details:[]},{title:i?"支付方式可用":"支付方式尚未可用",body:i?"已经检测到至少一个可用支付方式。":"请完成 ClawTip 绑定,或稍后在支付页面补充配置。",ok:i,status:i?"passed":"warning",details:[]},{title:u>0?"终端工具已接入":"终端工具尚未接入",body:u>0?`已经写入 ${u} 个终端工具配置。`:"如果你还没有安装终端工具,可以稍后再执行接入。",ok:u>0,status:u>0?"passed":"warning",details:[]}]}function n3(n){return{title:n.label,body:n.message,ok:n.status==="passed"||n.status==="skipped",status:n.status,details:n.details}}function ag(n){return n==="passed"?"全部通过":n==="warning"?"存在警告":n==="failed"?"需要修复":"等待检查"}function a3(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 l3(n){return n==="passed"?"通过":n==="warning"?"警告":n==="failed"?"失败":"已跳过"}function r3(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 i3(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 zb(n){return n==="fixed"?"固定节点":n==="fixedSet"?"固定节点组":"全自动"}function s3(n){return n==="speed"?"速度优先":n==="discount"?"成本优先":"平衡模式"}function o3(n){const l=n.toLowerCase();return["ok","healthy","active","available"].includes(l)?"状态正常":["error","failed","unavailable"].includes(l)?"状态异常":["unknown","pending"].includes(l)?"等待检测":`状态:${n}`}function c3(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 yc(n){const l=n.toLowerCase();return["ok","healthy","active","available"].includes(l)?0:["unknown","pending"].includes(l)?1:2}function _b(n){return n.configured?"已配置":n.status==="installed"?"已安装":n.status==="manual"?"需要手动配置":n.detected?"已检测到":"未检测到"}function u3(n){return n==="create"?"创建":"更新"}function d3({app:n,name:l="TokenBuddy",endpoint:o,apiKey:i,model:u,homepage:f}){const v=new URLSearchParams({resource:"provider",app:n,name:l,endpoint:o,apiKey:i});return u!=null&&u.trim()&&v.set("model",u.trim()),f!=null&&f.trim()&&v.set("homepage",f.trim()),`ccswitch://v1/import?${v.toString()}`}const Ob="tbp_local_17821_d7f4c9a2b8e1",f3="https://tokenbuddy.ai",m3=["chat_completions","responses","messages"],h3={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 / Responses / Messages"},openclaw:{tone:"amber",protocol:"OpenAI Chat Completions"},hermes:{logo:"/tool-logos/hermes.svg",tone:"gray",protocol:"OpenAI Chat Completions"}},p3={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"}},v3={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"},ps=[{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 x3(){var B,ie,te,xe,fe,O,ee,re,ae,ge;const{t:n}=xr(),l=wb(),o=sm(),i=Us(),u=xw(),f=gw(),v=bw(),[h,p]=S.useState(null),[x,y]=S.useState(null),[g,j]=S.useState(null),M=((B=o.data)==null?void 0:B.proxyPort)??17821,T=((xe=(te=(ie=l.data)==null?void 0:ie.clients.find(N=>N.id==="custom"))==null?void 0:te.manualConfig)==null?void 0:xe.openaiBaseUrl)??`http://127.0.0.1:${M}/v1`,E=((ee=(O=(fe=l.data)==null?void 0:fe.clients.find(N=>N.id==="custom"))==null?void 0:O.manualConfig)==null?void 0:ee.anthropicBaseUrl)??`http://127.0.0.1:${M}`,D=((re=i.data)==null?void 0:re.data)??[],R=(((ae=l.data)==null?void 0:ae.clients)??[]).filter(N=>N.id!=="custom"),U=R.length,Q=((ge=l.data)==null?void 0:ge.summary.configuredCount)??0,H=u.isPending||v.isPending,G=M3(u.error,v.error,f.error),K=!!(x||G),$=async(N,q)=>{try{await navigator.clipboard.writeText(q),j(N),y(null),window.setTimeout(()=>j(X=>X===N?null:X),1600)}catch{y(n("tools.copyFailed"))}},I=async N=>{p(N.id),y(null);const q=await u.mutateAsync({providers:[N.id],refreshModels:N.configured});y(n("tools.fileChangesApplied",{name:N.name,count:q.applied.length,plural:q.applied.length===1?"":"s"}))},Z=async()=>{p(null),y(null);const N=await f.mutateAsync();await Promise.all([l.refetch(),i.refetch()]),y(n("tools.modelsRefreshed",{count:N.data.length,plural:N.data.length===1?"":"s"}))},ne=async N=>{if(!window.confirm(n("tools.disconnectConfirm",{name:N.name})))return;p(N.id),y(null);const X=await v.mutateAsync({providers:[N.id]}),le=X.rolledBack.filter(de=>de.action==="restored"||de.action==="removed"||de.action==="cleaned").length,pe=X.rolledBack.some(de=>de.action==="missing_snapshot");y(pe&&le===0?n("tools.noSnapshot",{name:N.name}):n("tools.disconnectedChanges",{name:N.name,count:le,plural:le===1?"":"s"}))};return s.jsxs("div",{className:"min-w-0 space-y-4",children:[s.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"text-[1.18rem] font-bold leading-7 text-[var(--color-ink)]",children:n("tools.title")}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[0.78rem] text-[var(--color-muted)]",children:[s.jsx("span",{children:n("tools.connectedSummary",{configured:Q,total:U})}),s.jsx("span",{"aria-hidden":"true",children:"·"}),s.jsx("span",{className:"font-mono",children:T.replace("http://","")})]})]}),s.jsx("button",{type:"button",title:n("tools.refreshStatus"),"aria-label":n("tools.refreshStatus"),onClick:()=>void Z(),disabled:f.isPending,className:"tb-button tb-button-icon tb-button-secondary size-9",children:s.jsx(pr,{className:["size-4",l.isFetching||f.isPending?"animate-spin":""].join(" ")})})]}),s.jsxs("section",{className:"space-y-3",children:[s.jsxs(_t,{className:"overflow-hidden p-0",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--color-line-2)] px-4 py-3",children:[s.jsx("div",{className:"min-w-0",children:s.jsx("h2",{className:"text-[0.96rem] font-bold text-[var(--color-ink)]",children:n("tools.oneClick")})}),l.isLoading?s.jsx(St,{className:"size-4 animate-spin text-[var(--color-muted)]"}):null]}),s.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:[s.jsx("div",{children:n("tools.tool")}),s.jsx("div",{children:n("tools.protocol")}),s.jsx("div",{children:n("tools.status")}),s.jsx("div",{className:"text-right",children:n("tools.actions")})]}),s.jsx("div",{className:"divide-y divide-[var(--color-line-2)]",children:R.map(N=>{const q=N3(D,N.id);return s.jsx(g3,{client:N,busy:H&&h===N.id,ccSwitchLink:q?S3(N.id,T,E,q):void 0,onConfigure:()=>void I(N),onRollback:()=>void ne(N)},N.id)})})]}),K?s.jsx(_t,{className:"overflow-hidden",children:s.jsxs("div",{className:"p-3",children:[x?s.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:x}):null,G?s.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:G}):null]})}):null]}),s.jsx("section",{children:s.jsx(b3,{openAiBaseUrl:T,anthropicBaseUrl:E,copied:g,onCopy:$})})]})}function g3({client:n,busy:l,ccSwitchLink:o,onConfigure:i,onRollback:u}){const{t:f}=xr(),v=h3[n.id]??{tone:"gray",protocol:"Custom"},h=n.status!=="missing",p=v3[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 s.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:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(Lf,{logo:v.logo,name:n.name,tone:v.tone,size:"sm"}),s.jsx("div",{className:"min-w-0",children:s.jsx("h3",{className:"truncate text-[0.92rem] font-medium text-[var(--color-ink)]",children:n.name})})]}),s.jsx("div",{className:"hidden min-w-0 truncate text-[0.76rem] font-medium text-[var(--color-muted)] md:block",children:v.protocol}),s.jsx("div",{children:s.jsx(uN,{tone:x,children:y})}),s.jsxs("div",{className:"flex items-center gap-2 md:grid md:w-[13rem] md:grid-cols-[2rem_minmax(0,7rem)_2rem] md:justify-end xl:w-[16rem] xl:grid-cols-[2rem_minmax(0,9rem)_2rem]",children:[o?s.jsx("a",{href:o,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:s.jsx("img",{src:"/tool-logos/cc-switch.png",alt:"","aria-hidden":"true",className:"size-4 rounded-[var(--radius-xs)]"})}):s.jsx("span",{"aria-hidden":"true",className:"hidden size-8 md:block"}),h?n.configured?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button","aria-label":f("tools.reconnectTo",{name:n.name}),onClick:i,disabled:l,className:"tb-button tb-button-sm tb-button-primary flex-1 md:w-full",children:[l?s.jsx(St,{className:"size-3.5 animate-spin"}):s.jsx(pr,{className:"size-3.5"}),f("tools.reconnect")]}),s.jsx("button",{type:"button",title:f("tools.disconnectFrom",{name:n.name}),"aria-label":f("tools.disconnectFrom",{name:n.name}),onClick:u,disabled:l,className:"tb-button tb-button-icon tb-button-secondary",children:s.jsx(uj,{className:"size-3.5"})})]}):s.jsxs("button",{type:"button","aria-label":f("tools.connectTo",{name:n.name}),onClick:i,disabled:l,className:"tb-button tb-button-sm tb-button-primary flex-1 md:w-full",children:[l?s.jsx(St,{className:"size-3.5 animate-spin"}):s.jsx(Yt,{className:"size-3.5"}),f("tools.connect")]}):p?s.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 md:col-span-2",children:[s.jsx(ES,{className:"size-3.5"}),f("tools.getApp")]}):s.jsx("span",{"aria-hidden":"true",className:"hidden h-8 md:col-span-2 md:block"})]})]})}function Lf({logo:n,name:l,tone:o,size:i="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"}[o],f=i==="sm"?"size-8":"size-10",v=i==="sm"?"size-4":"size-5";return s.jsxs("div",{className:["grid shrink-0 place-items-center rounded-[var(--radius-md)] border",f,u].join(" "),children:[n?s.jsx("img",{src:n,alt:"","aria-hidden":"true",className:v}):s.jsx(bj,{className:"size-4 text-[var(--color-muted)]","aria-hidden":"true"}),s.jsx("span",{className:"sr-only",children:l})]})}function b3({openAiBaseUrl:n,anthropicBaseUrl:l,copied:o,onCopy:i}){var g;const{t:u}=xr(),[f,v]=S.useState(((g=ps[0])==null?void 0:g.id)??null),[h,p]=S.useState(""),x=S.useMemo(()=>{const j=h.trim().toLowerCase();return j?ps.filter(M=>`${M.name} ${M.protocol}`.toLowerCase().includes(j)):ps},[h]),y=ps.find(j=>j.id===f);return s.jsxs(_t,{className:"overflow-hidden p-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-[var(--color-line-2)] px-4 py-3",children:[s.jsx("h2",{className:"text-[0.96rem] font-bold text-[var(--color-ink)]",children:u("tools.manualSetup")}),s.jsx("span",{className:"text-[0.72rem] font-medium text-[var(--color-muted)]",children:u("tools.appsCount",{count:ps.length})})]}),s.jsxs("div",{className:"grid gap-0 lg:grid-cols-[minmax(0,1fr)_23rem]",children:[s.jsxs("div",{className:"min-w-0 px-4 py-3",children:[s.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:[s.jsx(Ds,{className:"size-4 shrink-0 text-[var(--color-muted)]","aria-hidden":"true"}),s.jsx("span",{className:"sr-only",children:u("tools.searchApps")}),s.jsx("input",{value:h,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)]"})]}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:[x.map(j=>{const M=j.id===f;return s.jsxs("button",{type:"button","aria-pressed":M,onClick:()=>v(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",M?"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:[s.jsx(Lf,{logo:j.logo,name:j.name,tone:M?"lavender":"gray"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-[0.8rem] font-medium text-[var(--color-ink)]",children:j.name}),s.jsx("div",{className:"mt-0.5 truncate text-[0.68rem] text-[var(--color-muted)]",children:j.protocol})]})]},j.id)}),x.length===0?s.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]})]}),s.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:s.jsxs("div",{className:"sticky top-3 space-y-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(Lf,{logo:y==null?void 0:y.logo,name:(y==null?void 0:y.name)??"Selected app",tone:"lavender"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:u("tools.configuration")}),s.jsx("div",{className:"truncate text-[0.96rem] font-medium text-[var(--color-ink)]",children:(y==null?void 0:y.name)??"Select an app"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(of,{label:u("tools.openAiBaseUrl"),value:n,copyKey:"manual-openai",copied:o,onCopy:i}),s.jsx(of,{label:u("tools.anthropicBaseUrl"),value:l,copyKey:"manual-anthropic",copied:o,onCopy:i}),s.jsx(of,{label:u("tools.apiKey"),value:Ob,copyKey:"manual-key",copied:o,onCopy:i})]})]})})]})]})}function of({label:n,value:l,copyKey:o,copied:i,onCopy:u,compact:f=!1}){return s.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:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:n}),s.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.78rem] text-[var(--color-ink)]",children:l||je})]}),s.jsx("button",{type:"button",onClick:()=>void u(o,l),className:"tb-button tb-button-icon tb-button-secondary",children:i===o?s.jsx(Yt,{className:"size-4"}):s.jsx(PS,{className:"size-4"})})]})}function y3(n){return n==="codex"?"responses":n==="claude-code"||n==="claude-desktop"?"messages":"chat_completions"}function S3(n,l,o,i){const u=p3[n];if(u)return d3({app:u.app,endpoint:u.endpointKind==="anthropic"?o:l,apiKey:Ob,model:i,homepage:f3})}function j3(n,l){const o=n.filter(i=>Db(i,l)).map(i=>i.id);return Ub(o)}function N3(n,l){if(l!=="opencode")return j3(n,y3(l));const o=n.filter(i=>m3.some(u=>Db(i,u))).map(i=>i.id);return Ub(o)}function Db(n,l){return l==="messages"?n.supportedProtocols.includes("messages")||n.supportedProtocols.includes("anthropic_messages"):n.supportedProtocols.includes(l)}function Ub(n){return n.find(l=>l==="gpt-5.4")??n.find(l=>l.toLowerCase().includes("gpt"))??n[0]??void 0}function M3(...n){const l=n.find(Boolean);return l instanceof Error?l.message:void 0}function w3({compact:n=!1,className:l="",hideTextBelowSm:o=!1,showAi:i=!1}){return s.jsxs("span",{"data-no-translate":"true",className:["inline-flex min-w-0 items-center gap-2",l].join(" "),children:[s.jsx(C3,{className:n?"size-6":"size-7"}),s.jsxs("span",{className:["min-w-0 font-mono text-[0.84rem] font-black uppercase leading-none tracking-[0.12em] text-[var(--color-ink)]",o?"hidden min-[420px]:inline":""].join(" "),children:["Token",s.jsx("span",{className:"text-[var(--color-primary)]",children:"Buddy"}),i?s.jsx("span",{className:"text-[var(--color-muted)]",children:".AI"}):null]})]})}function C3({className:n}){return s.jsxs("svg",{className:n,viewBox:"0 0 32 32","aria-hidden":"true",focusable:"false",children:[s.jsx("rect",{x:"2.5",y:"2.5",width:"27",height:"27",rx:"8",fill:"#ffffff",stroke:"var(--color-line)"}),s.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"}),s.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"}),s.jsx("circle",{cx:"23.25",cy:"8.75",r:"2.35",fill:"var(--color-success)",stroke:"#ffffff",strokeWidth:"1.3"})]})}function T3(){const{t:n}=xr();return s.jsxs("div",{className:"min-h-full",children:[s.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:[s.jsx(Xf,{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:s.jsx(w3,{compact:!0,hideTextBelowSm:!0})}),s.jsxs("div",{className:"ml-auto flex min-w-0 gap-0.5 sm:gap-1",children:[s.jsx(sc,{to:"/overview",children:n("nav.overview")}),s.jsx(sc,{to:"/routing",children:n("nav.routing")}),s.jsx(sc,{to:"/ledger",children:n("nav.ledger")}),s.jsx(sc,{to:"/tools",children:n("nav.tools")})]}),s.jsx(A3,{})]}),s.jsx("main",{className:"mx-auto max-w-[1180px] px-3 py-5 sm:px-6 sm:py-7",children:s.jsxs(I1,{children:[s.jsx(ar,{path:"/",element:s.jsx(Dx,{})}),s.jsx(ar,{path:"/overview",element:s.jsx(Dx,{})}),s.jsx(ar,{path:"/init",element:s.jsx(Cw,{})}),s.jsx(ar,{path:"/routing",element:s.jsx(XN,{})}),s.jsx(ar,{path:"/ledger",element:s.jsx(XM,{})}),s.jsx(ar,{path:"/tools",element:s.jsx(x3,{})})]})})]})}function A3(){const{language:n,setLanguage:l,t:o}=xr(),i=[{value:"en",label:o("language.english"),ariaLabel:o("language.switchToEnglish")},{value:"zh",label:o("language.chinese"),ariaLabel:o("language.switchToChinese")}];return s.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":o("language.label"),children:i.map(u=>s.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 sc({to:n,children:l}){return s.jsx(Xf,{to:n,className:({isActive:o})=>["rounded-[var(--radius-md)] px-2 py-1.5 text-[0.82rem] font-medium transition-colors sm:px-3.5 sm:text-[0.92rem]",o?"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 E3(){!("serviceWorker"in navigator)||window.location.port==="5173"||window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})})}const k3=new rS({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1,retry:1}}});e1.createRoot(document.getElementById("root")).render(s.jsx(S.StrictMode,{children:s.jsx(iS,{client:k3,children:s.jsx(dN,{children:s.jsx(N2,{children:s.jsx(T3,{})})})})}));E3();
|
|
271
|
+
//# sourceMappingURL=index-Ca_IcEY6.js.map
|