@prismshadow/penguin-server 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/types.d.ts +39 -10
- package/dist/index.js +699 -348
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/web-dist/assets/index-C9EZP9d7.js +101 -0
- package/web-dist/assets/{index-7oqK2MPp.js → index-CukW1Teq.js} +1 -1
- package/web-dist/assets/index-XqmoUN63.css +1 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-DGY2Myoq.js +0 -51
- package/web-dist/assets/index-SaWO9NKB.css +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function U1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pf={exports:{}},li={};var wx;function Uw(){if(wx)return li;wx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:e,type:l,key:d,ref:o!==void 0?o:null,props:u}}return li.Fragment=n,li.jsx=r,li.jsxs=r,li}var Sx;function $w(){return Sx||(Sx=1,pf.exports=Uw()),pf.exports}var i=$w(),gf={exports:{}},Be={};var jx;function Bw(){if(jx)return Be;jx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),k=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=k&&I[k]||I["@@iterator"],typeof I=="function"?I:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function M(I,B,T){this.props=I,this.context=B,this.refs=N,this.updater=T||j}M.prototype.isReactComponent={},M.prototype.setState=function(I,B){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,B,"setState")},M.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function O(){}O.prototype=M.prototype;function R(I,B,T){this.props=I,this.context=B,this.refs=N,this.updater=T||j}var $=R.prototype=new O;$.constructor=R,C($,M.prototype),$.isPureReactComponent=!0;var H=Array.isArray;function _(){}var V={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function W(I,B,T){var re=T.ref;return{$$typeof:e,type:I,key:B,ref:re!==void 0?re:null,props:T}}function z(I,B){return W(I.type,B,I.props)}function q(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function A(I){var B={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(T){return B[T]})}var L=/\/+/g;function X(I,B){return typeof I=="object"&&I!==null&&I.key!=null?A(""+I.key):B.toString(36)}function F(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(_,_):(I.status="pending",I.then(function(B){I.status==="pending"&&(I.status="fulfilled",I.value=B)},function(B){I.status==="pending"&&(I.status="rejected",I.reason=B)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function D(I,B,T,re,de){var fe=typeof I;(fe==="undefined"||fe==="boolean")&&(I=null);var he=!1;if(I===null)he=!0;else switch(fe){case"bigint":case"string":case"number":he=!0;break;case"object":switch(I.$$typeof){case e:case n:he=!0;break;case g:return he=I._init,D(he(I._payload),B,T,re,de)}}if(he)return de=de(I),he=re===""?"."+X(I,0):re,H(de)?(T="",he!=null&&(T=he.replace(L,"$&/")+"/"),D(de,B,T,"",function(me){return me})):de!=null&&(q(de)&&(de=z(de,T+(de.key==null||I&&I.key===de.key?"":(""+de.key).replace(L,"$&/")+"/")+he)),B.push(de)),1;he=0;var Ce=re===""?".":re+":";if(H(I))for(var ne=0;ne<I.length;ne++)re=I[ne],fe=Ce+X(re,ne),he+=D(re,B,T,fe,de);else if(ne=w(I),typeof ne=="function")for(I=ne.call(I),ne=0;!(re=I.next()).done;)re=re.value,fe=Ce+X(re,ne++),he+=D(re,B,T,fe,de);else if(fe==="object"){if(typeof I.then=="function")return D(F(I),B,T,re,de);throw B=String(I),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return he}function te(I,B,T){if(I==null)return I;var re=[],de=0;return D(I,re,"","",function(fe){return B.call(T,fe,de++)}),re}function ee(I){if(I._status===-1){var B=I._result;B=B(),B.then(function(T){(I._status===0||I._status===-1)&&(I._status=1,I._result=T)},function(T){(I._status===0||I._status===-1)&&(I._status=2,I._result=T)}),I._status===-1&&(I._status=0,I._result=B)}if(I._status===1)return I._result.default;throw I._result}var we=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},U={map:te,forEach:function(I,B,T){te(I,function(){B.apply(this,arguments)},T)},count:function(I){var B=0;return te(I,function(){B++}),B},toArray:function(I){return te(I,function(B){return B})||[]},only:function(I){if(!q(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Be.Activity=v,Be.Children=U,Be.Component=M,Be.Fragment=r,Be.Profiler=o,Be.PureComponent=R,Be.StrictMode=l,Be.Suspense=m,Be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,Be.__COMPILER_RUNTIME={__proto__:null,c:function(I){return V.H.useMemoCache(I)}},Be.cache=function(I){return function(){return I.apply(null,arguments)}},Be.cacheSignal=function(){return null},Be.cloneElement=function(I,B,T){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var re=C({},I.props),de=I.key;if(B!=null)for(fe in B.key!==void 0&&(de=""+B.key),B)!G.call(B,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&B.ref===void 0||(re[fe]=B[fe]);var fe=arguments.length-2;if(fe===1)re.children=T;else if(1<fe){for(var he=Array(fe),Ce=0;Ce<fe;Ce++)he[Ce]=arguments[Ce+2];re.children=he}return W(I.type,de,re)},Be.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:u,_context:I},I},Be.createElement=function(I,B,T){var re,de={},fe=null;if(B!=null)for(re in B.key!==void 0&&(fe=""+B.key),B)G.call(B,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(de[re]=B[re]);var he=arguments.length-2;if(he===1)de.children=T;else if(1<he){for(var Ce=Array(he),ne=0;ne<he;ne++)Ce[ne]=arguments[ne+2];de.children=Ce}if(I&&I.defaultProps)for(re in he=I.defaultProps,he)de[re]===void 0&&(de[re]=he[re]);return W(I,fe,de)},Be.createRef=function(){return{current:null}},Be.forwardRef=function(I){return{$$typeof:f,render:I}},Be.isValidElement=q,Be.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:ee}},Be.memo=function(I,B){return{$$typeof:h,type:I,compare:B===void 0?null:B}},Be.startTransition=function(I){var B=V.T,T={};V.T=T;try{var re=I(),de=V.S;de!==null&&de(T,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(_,we)}catch(fe){we(fe)}finally{B!==null&&T.types!==null&&(B.types=T.types),V.T=B}},Be.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},Be.use=function(I){return V.H.use(I)},Be.useActionState=function(I,B,T){return V.H.useActionState(I,B,T)},Be.useCallback=function(I,B){return V.H.useCallback(I,B)},Be.useContext=function(I){return V.H.useContext(I)},Be.useDebugValue=function(){},Be.useDeferredValue=function(I,B){return V.H.useDeferredValue(I,B)},Be.useEffect=function(I,B){return V.H.useEffect(I,B)},Be.useEffectEvent=function(I){return V.H.useEffectEvent(I)},Be.useId=function(){return V.H.useId()},Be.useImperativeHandle=function(I,B,T){return V.H.useImperativeHandle(I,B,T)},Be.useInsertionEffect=function(I,B){return V.H.useInsertionEffect(I,B)},Be.useLayoutEffect=function(I,B){return V.H.useLayoutEffect(I,B)},Be.useMemo=function(I,B){return V.H.useMemo(I,B)},Be.useOptimistic=function(I,B){return V.H.useOptimistic(I,B)},Be.useReducer=function(I,B,T){return V.H.useReducer(I,B,T)},Be.useRef=function(I){return V.H.useRef(I)},Be.useState=function(I){return V.H.useState(I)},Be.useSyncExternalStore=function(I,B,T){return V.H.useSyncExternalStore(I,B,T)},Be.useTransition=function(){return V.H.useTransition()},Be.version="19.2.7",Be}var Nx;function $m(){return Nx||(Nx=1,gf.exports=Bw()),gf.exports}var b=$m(),xf={exports:{}},si={},yf={exports:{}},vf={};var Cx;function Hw(){return Cx||(Cx=1,(function(e){function n(D,te){var ee=D.length;D.push(te);e:for(;0<ee;){var we=ee-1>>>1,U=D[we];if(0<o(U,te))D[we]=te,D[ee]=U,ee=we;else break e}}function r(D){return D.length===0?null:D[0]}function l(D){if(D.length===0)return null;var te=D[0],ee=D.pop();if(ee!==te){D[0]=ee;e:for(var we=0,U=D.length,I=U>>>1;we<I;){var B=2*(we+1)-1,T=D[B],re=B+1,de=D[re];if(0>o(T,ee))re<U&&0>o(de,T)?(D[we]=de,D[re]=ee,we=re):(D[we]=T,D[B]=ee,we=B);else if(re<U&&0>o(de,ee))D[we]=de,D[re]=ee,we=re;else break e}}return te}function o(D,te){var ee=D.sortIndex-te.sortIndex;return ee!==0?ee:D.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],g=1,v=null,k=3,w=!1,j=!1,C=!1,N=!1,M=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function $(D){for(var te=r(h);te!==null;){if(te.callback===null)l(h);else if(te.startTime<=D)l(h),te.sortIndex=te.expirationTime,n(m,te);else break;te=r(h)}}function H(D){if(C=!1,$(D),!j)if(r(m)!==null)j=!0,_||(_=!0,A());else{var te=r(h);te!==null&&F(H,te.startTime-D)}}var _=!1,V=-1,G=5,W=-1;function z(){return N?!0:!(e.unstable_now()-W<G)}function q(){if(N=!1,_){var D=e.unstable_now();W=D;var te=!0;try{e:{j=!1,C&&(C=!1,O(V),V=-1),w=!0;var ee=k;try{t:{for($(D),v=r(m);v!==null&&!(v.expirationTime>D&&z());){var we=v.callback;if(typeof we=="function"){v.callback=null,k=v.priorityLevel;var U=we(v.expirationTime<=D);if(D=e.unstable_now(),typeof U=="function"){v.callback=U,$(D),te=!0;break t}v===r(m)&&l(m),$(D)}else l(m);v=r(m)}if(v!==null)te=!0;else{var I=r(h);I!==null&&F(H,I.startTime-D),te=!1}}break e}finally{v=null,k=ee,w=!1}te=void 0}}finally{te?A():_=!1}}}var A;if(typeof R=="function")A=function(){R(q)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,X=L.port2;L.port1.onmessage=q,A=function(){X.postMessage(null)}}else A=function(){M(q,0)};function F(D,te){V=M(function(){D(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return k},e.unstable_next=function(D){switch(k){case 1:case 2:case 3:var te=3;break;default:te=k}var ee=k;k=te;try{return D()}finally{k=ee}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(D,te){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var ee=k;k=D;try{return te()}finally{k=ee}},e.unstable_scheduleCallback=function(D,te,ee){var we=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?we+ee:we):ee=we,D){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=ee+U,D={id:g++,callback:te,priorityLevel:D,startTime:ee,expirationTime:U,sortIndex:-1},ee>we?(D.sortIndex=ee,n(h,D),r(m)===null&&D===r(h)&&(C?(O(V),V=-1):C=!0,F(H,ee-we))):(D.sortIndex=U,n(m,D),j||w||(j=!0,_||(_=!0,A()))),D},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(D){var te=k;return function(){var ee=k;k=te;try{return D.apply(this,arguments)}finally{k=ee}}}})(vf)),vf}var Tx;function Pw(){return Tx||(Tx=1,yf.exports=Hw()),yf.exports}var bf={exports:{}},un={};var Ex;function qw(){if(Ex)return un;Ex=1;var e=$m();function n(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(m,h,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:m,containerInfo:h,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return un.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,un.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(n(299));return u(m,h,null,g)},un.flushSync=function(m){var h=d.T,g=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=h,l.p=g,l.d.f()}},un.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,l.d.C(m,h))},un.prefetchDNS=function(m){typeof m=="string"&&l.d.D(m)},un.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,v=f(g,h.crossOrigin),k=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?l.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:k,fetchPriority:w}):g==="script"&&l.d.X(m,{crossOrigin:v,integrity:k,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},un.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);l.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&l.d.M(m)},un.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,v=f(g,h.crossOrigin);l.d.L(m,g,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},un.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=f(h.as,h.crossOrigin);l.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else l.d.m(m)},un.requestFormReset=function(m){l.d.r(m)},un.unstable_batchedUpdates=function(m,h){return m(h)},un.useFormState=function(m,h,g){return d.H.useFormState(m,h,g)},un.useFormStatus=function(){return d.H.useHostTransitionStatus()},un.version="19.2.7",un}var Mx;function $1(){if(Mx)return bf.exports;Mx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),bf.exports=qw(),bf.exports}var Ax;function Fw(){if(Ax)return si;Ax=1;var e=Pw(),n=$m(),r=$1();function l(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)a+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var a=t,s=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(s=a.return),t=a.return;while(t)}return a.tag===3?s:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function f(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(l(188))}function h(t){var a=t.alternate;if(!a){if(a=u(t),a===null)throw Error(l(188));return a!==t?null:t}for(var s=t,c=a;;){var p=s.return;if(p===null)break;var y=p.alternate;if(y===null){if(c=p.return,c!==null){s=c;continue}break}if(p.child===y.child){for(y=p.child;y;){if(y===s)return m(p),t;if(y===c)return m(p),a;y=y.sibling}throw Error(l(188))}if(s.return!==c.return)s=p,c=y;else{for(var S=!1,E=p.child;E;){if(E===s){S=!0,s=p,c=y;break}if(E===c){S=!0,c=p,s=y;break}E=E.sibling}if(!S){for(E=y.child;E;){if(E===s){S=!0,s=y,c=p;break}if(E===c){S=!0,c=y,s=p;break}E=E.sibling}if(!S)throw Error(l(189))}}if(s.alternate!==c)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?t:a}function g(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=g(t),a!==null)return a;t=t.sibling}return null}var v=Object.assign,k=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),R=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function A(t){return t===null||typeof t!="object"?null:(t=q&&t[q]||t["@@iterator"],typeof t=="function"?t:null)}var L=Symbol.for("react.client.reference");function X(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===L?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case M:return"Profiler";case N:return"StrictMode";case H:return"Suspense";case _:return"SuspenseList";case W:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case j:return"Portal";case R:return t.displayName||"Context";case O:return(t._context.displayName||"Context")+".Consumer";case $:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return a=t.displayName||null,a!==null?a:X(t.type)||"Memo";case G:a=t._payload,t=t._init;try{return X(t(a))}catch{}}return null}var F=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},we=[],U=-1;function I(t){return{current:t}}function B(t){0>U||(t.current=we[U],we[U]=null,U--)}function T(t,a){U++,we[U]=t.current,t.current=a}var re=I(null),de=I(null),fe=I(null),he=I(null);function Ce(t,a){switch(T(fe,a),T(de,t),T(re,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Vg(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Vg(a),t=Gg(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}B(re),T(re,t)}function ne(){B(re),B(de),B(fe)}function me(t){t.memoizedState!==null&&T(he,t);var a=re.current,s=Gg(a,t.type);a!==s&&(T(de,t),T(re,s))}function be(t){de.current===t&&(B(re),B(de)),he.current===t&&(B(he),ti._currentValue=ee)}var De,Fe;function Ie(t){if(De===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);De=a&&a[1]||"",Fe=-1<s.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+De+t+Fe}var Lt=!1;function Kt(t,a){if(!t||Lt)return"";Lt=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ae){var J=ae}Reflect.construct(t,[],ue)}else{try{ue.call()}catch(ae){J=ae}t.call(ue.prototype)}}else{try{throw Error()}catch(ae){J=ae}(ue=t())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ae){if(ae&&J&&typeof ae.stack=="string")return[ae.stack,J.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=c.DetermineComponentFrameRoot(),S=y[0],E=y[1];if(S&&E){var P=S.split(`
|
|
4
|
+
`),Z=E.split(`
|
|
5
|
+
`);for(p=c=0;c<P.length&&!P[c].includes("DetermineComponentFrameRoot");)c++;for(;p<Z.length&&!Z[p].includes("DetermineComponentFrameRoot");)p++;if(c===P.length||p===Z.length)for(c=P.length-1,p=Z.length-1;1<=c&&0<=p&&P[c]!==Z[p];)p--;for(;1<=c&&0<=p;c--,p--)if(P[c]!==Z[p]){if(c!==1||p!==1)do if(c--,p--,0>p||P[c]!==Z[p]){var ie=`
|
|
6
|
+
`+P[c].replace(" at new "," at ");return t.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",t.displayName)),ie}while(1<=c&&0<=p);break}}}finally{Lt=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?Ie(s):""}function _t(t,a){switch(t.tag){case 26:case 27:case 5:return Ie(t.type);case 16:return Ie("Lazy");case 13:return t.child!==a&&a!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("SuspenseList");case 0:case 15:return Kt(t.type,!1);case 11:return Kt(t.type.render,!1);case 1:return Kt(t.type,!0);case 31:return Ie("Activity");default:return""}}function Pn(t){try{var a="",s=null;do a+=_t(t,s),s=t,t=t.return;while(t);return a}catch(c){return`
|
|
7
|
+
Error generating stack: `+c.message+`
|
|
8
|
+
`+c.stack}}var je=Object.prototype.hasOwnProperty,$e=e.unstable_scheduleCallback,rt=e.unstable_cancelCallback,pt=e.unstable_shouldYield,$t=e.unstable_requestPaint,bt=e.unstable_now,on=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,pe=e.unstable_UserBlockingPriority,Ee=e.unstable_NormalPriority,ge=e.unstable_LowPriority,ve=e.unstable_IdlePriority,Xe=e.log,lt=e.unstable_setDisableYieldValue,Ve=null,et=null;function ot(t){if(typeof Xe=="function"&<(t),et&&typeof et.setStrictMode=="function")try{et.setStrictMode(Ve,t)}catch{}}var tt=Math.clz32?Math.clz32:Br,en=Math.log,mn=Math.LN2;function Br(t){return t>>>=0,t===0?32:31-(en(t)/mn|0)|0}var Ma=256,ar=262144,oe=4194304;function ke(t){var a=t&42;if(a!==0)return a;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Oe(t,a,s){var c=t.pendingLanes;if(c===0)return 0;var p=0,y=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var E=c&134217727;return E!==0?(c=E&~y,c!==0?p=ke(c):(S&=E,S!==0?p=ke(S):s||(s=E&~t,s!==0&&(p=ke(s))))):(E=c&~y,E!==0?p=ke(E):S!==0?p=ke(S):s||(s=c&~t,s!==0&&(p=ke(s)))),p===0?0:a!==0&&a!==p&&(a&y)===0&&(y=p&-p,s=a&-a,y>=s||y===32&&(s&4194048)!==0)?a:p}function dt(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function Tt(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 oa(){var t=oe;return oe<<=1,(oe&62914560)===0&&(oe=4194304),t}function pa(t){for(var a=[],s=0;31>s;s++)a.push(t);return a}function rr(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function su(t,a,s,c,p,y){var S=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var E=t.entanglements,P=t.expirationTimes,Z=t.hiddenUpdates;for(s=S&~s;0<s;){var ie=31-tt(s),ue=1<<ie;E[ie]=0,P[ie]=-1;var J=Z[ie];if(J!==null)for(Z[ie]=null,ie=0;ie<J.length;ie++){var ae=J[ie];ae!==null&&(ae.lane&=-536870913)}s&=~ue}c!==0&&Fi(t,c,0),y!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=y&~(S&~a))}function Fi(t,a,s){t.pendingLanes|=a,t.suspendedLanes&=~a;var c=31-tt(a);t.entangledLanes|=a,t.entanglements[c]=t.entanglements[c]|1073741824|s&261930}function Vi(t,a){var s=t.entangledLanes|=a;for(t=t.entanglements;s;){var c=31-tt(s),p=1<<c;p&a|t[c]&a&&(t[c]|=a),s&=~p}}function bl(t,a){var s=a&-a;return s=(s&42)!==0?1:Hr(s),(s&(t.suspendedLanes|a))!==0?0:s}function Hr(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function kl(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Gi(){var t=te.p;return t!==0?t:(t=window.event,t===void 0?32:px(t.type))}function gs(t,a){var s=te.p;try{return te.p=t,a()}finally{te.p=s}}var ga=Math.random().toString(36).slice(2),Wt="__reactFiber$"+ga,cn="__reactProps$"+ga,lr="__reactContainer$"+ga,xs="__reactEvents$"+ga,se="__reactListeners$"+ga,Se="__reactHandles$"+ga,ze="__reactResources$"+ga,ct="__reactMarker$"+ga;function Bt(t){delete t[Wt],delete t[cn],delete t[xs],delete t[se],delete t[Se]}function Aa(t){var a=t[Wt];if(a)return a;for(var s=t.parentNode;s;){if(a=s[lr]||s[Wt]){if(s=a.alternate,a.child!==null||s!==null&&s.child!==null)for(t=Jg(t);t!==null;){if(s=t[Wt])return s;t=Jg(t)}return a}t=s,s=t.parentNode}return null}function sr(t){if(t=t[Wt]||t[lr]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function Pr(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(l(33))}function ir(t){var a=t[ze];return a||(a=t[ze]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Xt(t){t[ct]=!0}var _h=new Set,Ih={};function qr(t,a){wl(t,a),wl(t+"Capture",a)}function wl(t,a){for(Ih[t]=a,t=0;t<a.length;t++)_h.add(a[t])}var Mk=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]*$"),zh={},Dh={};function Ak(t){return je.call(Dh,t)?!0:je.call(zh,t)?!1:Mk.test(t)?Dh[t]=!0:(zh[t]=!0,!1)}function Ki(t,a,s){if(Ak(a))if(s===null)t.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+s)}}function Wi(t,a,s){if(s===null)t.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+s)}}function Ra(t,a,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(a,s,""+c)}}function qn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Oh(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Rk(t,a,s){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,y=c.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return p.call(this)},set:function(S){s=""+S,y.call(this,S)}}),Object.defineProperty(t,a,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(S){s=""+S},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function iu(t){if(!t._valueTracker){var a=Oh(t)?"checked":"value";t._valueTracker=Rk(t,a,""+t[a])}}function Uh(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var s=a.getValue(),c="";return t&&(c=Oh(t)?t.checked?"true":"false":t.value),t=c,t!==s?(a.setValue(t),!0):!1}function Yi(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Lk=/[\n"\\]/g;function Fn(t){return t.replace(Lk,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function ou(t,a,s,c,p,y,S,E){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),a!=null?S==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+qn(a)):t.value!==""+qn(a)&&(t.value=""+qn(a)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),a!=null?cu(t,S,qn(a)):s!=null?cu(t,S,qn(s)):c!=null&&t.removeAttribute("value"),p==null&&y!=null&&(t.defaultChecked=!!y),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?t.name=""+qn(E):t.removeAttribute("name")}function $h(t,a,s,c,p,y,S,E){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),a!=null||s!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){iu(t);return}s=s!=null?""+qn(s):"",a=a!=null?""+qn(a):s,E||a===t.value||(t.value=a),t.defaultValue=a}c=c??p,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=E?t.checked:!!c,t.defaultChecked=!!c,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S),iu(t)}function cu(t,a,s){a==="number"&&Yi(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function Sl(t,a,s,c){if(t=t.options,a){a={};for(var p=0;p<s.length;p++)a["$"+s[p]]=!0;for(s=0;s<t.length;s++)p=a.hasOwnProperty("$"+t[s].value),t[s].selected!==p&&(t[s].selected=p),p&&c&&(t[s].defaultSelected=!0)}else{for(s=""+qn(s),a=null,p=0;p<t.length;p++){if(t[p].value===s){t[p].selected=!0,c&&(t[p].defaultSelected=!0);return}a!==null||t[p].disabled||(a=t[p])}a!==null&&(a.selected=!0)}}function Bh(t,a,s){if(a!=null&&(a=""+qn(a),a!==t.value&&(t.value=a),s==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=s!=null?""+qn(s):""}function Hh(t,a,s,c){if(a==null){if(c!=null){if(s!=null)throw Error(l(92));if(F(c)){if(1<c.length)throw Error(l(93));c=c[0]}s=c}s==null&&(s=""),a=s}s=qn(a),t.defaultValue=s,c=t.textContent,c===s&&c!==""&&c!==null&&(t.value=c),iu(t)}function jl(t,a){if(a){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=a;return}}t.textContent=a}var _k=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 Ph(t,a,s){var c=a.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":c?t.setProperty(a,s):typeof s!="number"||s===0||_k.has(a)?a==="float"?t.cssFloat=s:t[a]=(""+s).trim():t[a]=s+"px"}function qh(t,a,s){if(a!=null&&typeof a!="object")throw Error(l(62));if(t=t.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var p in a)c=a[p],a.hasOwnProperty(p)&&s[p]!==c&&Ph(t,p,c)}else for(var y in a)a.hasOwnProperty(y)&&Ph(t,y,a[y])}function uu(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Ik=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"]]),zk=/^[\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 Xi(t){return zk.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function La(){}var du=null;function fu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Nl=null,Cl=null;function Fh(t){var a=sr(t);if(a&&(t=a.stateNode)){var s=t[cn]||null;e:switch(t=a.stateNode,a.type){case"input":if(ou(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),a=s.name,s.type==="radio"&&a!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Fn(""+a)+'"][type="radio"]'),a=0;a<s.length;a++){var c=s[a];if(c!==t&&c.form===t.form){var p=c[cn]||null;if(!p)throw Error(l(90));ou(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<s.length;a++)c=s[a],c.form===t.form&&Uh(c)}break e;case"textarea":Bh(t,s.value,s.defaultValue);break e;case"select":a=s.value,a!=null&&Sl(t,!!s.multiple,a,!1)}}}var mu=!1;function Vh(t,a,s){if(mu)return t(a,s);mu=!0;try{var c=t(a);return c}finally{if(mu=!1,(Nl!==null||Cl!==null)&&(Uo(),Nl&&(a=Nl,t=Cl,Cl=Nl=null,Fh(a),t)))for(a=0;a<t.length;a++)Fh(t[a])}}function ys(t,a){var s=t.stateNode;if(s===null)return null;var c=s[cn]||null;if(c===null)return null;s=c[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(l(231,a,typeof s));return s}var _a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hu=!1;if(_a)try{var vs={};Object.defineProperty(vs,"passive",{get:function(){hu=!0}}),window.addEventListener("test",vs,vs),window.removeEventListener("test",vs,vs)}catch{hu=!1}var or=null,pu=null,Qi=null;function Gh(){if(Qi)return Qi;var t,a=pu,s=a.length,c,p="value"in or?or.value:or.textContent,y=p.length;for(t=0;t<s&&a[t]===p[t];t++);var S=s-t;for(c=1;c<=S&&a[s-c]===p[y-c];c++);return Qi=p.slice(t,1<c?1-c:void 0)}function Zi(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function Ji(){return!0}function Kh(){return!1}function gn(t){function a(s,c,p,y,S){this._reactName=s,this._targetInst=p,this.type=c,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var E in t)t.hasOwnProperty(E)&&(s=t[E],this[E]=s?s(y):y[E]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Ji:Kh,this.isPropagationStopped=Kh,this}return v(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Ji)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ji)},persist:function(){},isPersistent:Ji}),a}var Fr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=gn(Fr),bs=v({},Fr,{view:0,detail:0}),Dk=gn(bs),gu,xu,ks,to=v({},bs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ks&&(ks&&t.type==="mousemove"?(gu=t.screenX-ks.screenX,xu=t.screenY-ks.screenY):xu=gu=0,ks=t),gu)},movementY:function(t){return"movementY"in t?t.movementY:xu}}),Wh=gn(to),Ok=v({},to,{dataTransfer:0}),Uk=gn(Ok),$k=v({},bs,{relatedTarget:0}),yu=gn($k),Bk=v({},Fr,{animationName:0,elapsedTime:0,pseudoElement:0}),Hk=gn(Bk),Pk=v({},Fr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),qk=gn(Pk),Fk=v({},Fr,{data:0}),Yh=gn(Fk),Vk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gk={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"},Kk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wk(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Kk[t])?!!a[t]:!1}function vu(){return Wk}var Yk=v({},bs,{key:function(t){if(t.key){var a=Vk[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Zi(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Gk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vu,charCode:function(t){return t.type==="keypress"?Zi(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Zi(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Xk=gn(Yk),Qk=v({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xh=gn(Qk),Zk=v({},bs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vu}),Jk=gn(Zk),e2=v({},Fr,{propertyName:0,elapsedTime:0,pseudoElement:0}),t2=gn(e2),n2=v({},to,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),a2=gn(n2),r2=v({},Fr,{newState:0,oldState:0}),l2=gn(r2),s2=[9,13,27,32],bu=_a&&"CompositionEvent"in window,ws=null;_a&&"documentMode"in document&&(ws=document.documentMode);var i2=_a&&"TextEvent"in window&&!ws,Qh=_a&&(!bu||ws&&8<ws&&11>=ws),Zh=" ",Jh=!1;function ep(t,a){switch(t){case"keyup":return s2.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tp(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Tl=!1;function o2(t,a){switch(t){case"compositionend":return tp(a);case"keypress":return a.which!==32?null:(Jh=!0,Zh);case"textInput":return t=a.data,t===Zh&&Jh?null:t;default:return null}}function c2(t,a){if(Tl)return t==="compositionend"||!bu&&ep(t,a)?(t=Gh(),Qi=pu=or=null,Tl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Qh&&a.locale!=="ko"?null:a.data;default:return null}}var u2={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 np(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!u2[t.type]:a==="textarea"}function ap(t,a,s,c){Nl?Cl?Cl.push(c):Cl=[c]:Nl=c,a=Vo(a,"onChange"),0<a.length&&(s=new eo("onChange","change",null,s,c),t.push({event:s,listeners:a}))}var Ss=null,js=null;function d2(t){$g(t,0)}function no(t){var a=Pr(t);if(Uh(a))return t}function rp(t,a){if(t==="change")return a}var lp=!1;if(_a){var ku;if(_a){var wu="oninput"in document;if(!wu){var sp=document.createElement("div");sp.setAttribute("oninput","return;"),wu=typeof sp.oninput=="function"}ku=wu}else ku=!1;lp=ku&&(!document.documentMode||9<document.documentMode)}function ip(){Ss&&(Ss.detachEvent("onpropertychange",op),js=Ss=null)}function op(t){if(t.propertyName==="value"&&no(js)){var a=[];ap(a,js,t,fu(t)),Vh(d2,a)}}function f2(t,a,s){t==="focusin"?(ip(),Ss=a,js=s,Ss.attachEvent("onpropertychange",op)):t==="focusout"&&ip()}function m2(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return no(js)}function h2(t,a){if(t==="click")return no(a)}function p2(t,a){if(t==="input"||t==="change")return no(a)}function g2(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var Tn=typeof Object.is=="function"?Object.is:g2;function Ns(t,a){if(Tn(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var s=Object.keys(t),c=Object.keys(a);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var p=s[c];if(!je.call(a,p)||!Tn(t[p],a[p]))return!1}return!0}function cp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function up(t,a){var s=cp(t);t=0;for(var c;s;){if(s.nodeType===3){if(c=t+s.textContent.length,t<=a&&c>=a)return{node:s,offset:a-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=cp(s)}}function dp(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?dp(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function fp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Yi(t.document);a instanceof t.HTMLIFrameElement;){try{var s=typeof a.contentWindow.location.href=="string"}catch{s=!1}if(s)t=a.contentWindow;else break;a=Yi(t.document)}return a}function Su(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var x2=_a&&"documentMode"in document&&11>=document.documentMode,El=null,ju=null,Cs=null,Nu=!1;function mp(t,a,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Nu||El==null||El!==Yi(c)||(c=El,"selectionStart"in c&&Su(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Cs&&Ns(Cs,c)||(Cs=c,c=Vo(ju,"onSelect"),0<c.length&&(a=new eo("onSelect","select",null,a,s),t.push({event:a,listeners:c}),a.target=El)))}function Vr(t,a){var s={};return s[t.toLowerCase()]=a.toLowerCase(),s["Webkit"+t]="webkit"+a,s["Moz"+t]="moz"+a,s}var Ml={animationend:Vr("Animation","AnimationEnd"),animationiteration:Vr("Animation","AnimationIteration"),animationstart:Vr("Animation","AnimationStart"),transitionrun:Vr("Transition","TransitionRun"),transitionstart:Vr("Transition","TransitionStart"),transitioncancel:Vr("Transition","TransitionCancel"),transitionend:Vr("Transition","TransitionEnd")},Cu={},hp={};_a&&(hp=document.createElement("div").style,"AnimationEvent"in window||(delete Ml.animationend.animation,delete Ml.animationiteration.animation,delete Ml.animationstart.animation),"TransitionEvent"in window||delete Ml.transitionend.transition);function Gr(t){if(Cu[t])return Cu[t];if(!Ml[t])return t;var a=Ml[t],s;for(s in a)if(a.hasOwnProperty(s)&&s in hp)return Cu[t]=a[s];return t}var pp=Gr("animationend"),gp=Gr("animationiteration"),xp=Gr("animationstart"),y2=Gr("transitionrun"),v2=Gr("transitionstart"),b2=Gr("transitioncancel"),yp=Gr("transitionend"),vp=new Map,Tu="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(" ");Tu.push("scrollEnd");function ca(t,a){vp.set(t,a),qr(a,[t])}var ao=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Vn=[],Al=0,Eu=0;function ro(){for(var t=Al,a=Eu=Al=0;a<t;){var s=Vn[a];Vn[a++]=null;var c=Vn[a];Vn[a++]=null;var p=Vn[a];Vn[a++]=null;var y=Vn[a];if(Vn[a++]=null,c!==null&&p!==null){var S=c.pending;S===null?p.next=p:(p.next=S.next,S.next=p),c.pending=p}y!==0&&bp(s,p,y)}}function lo(t,a,s,c){Vn[Al++]=t,Vn[Al++]=a,Vn[Al++]=s,Vn[Al++]=c,Eu|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function Mu(t,a,s,c){return lo(t,a,s,c),so(t)}function Kr(t,a){return lo(t,null,null,a),so(t)}function bp(t,a,s){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s);for(var p=!1,y=t.return;y!==null;)y.childLanes|=s,c=y.alternate,c!==null&&(c.childLanes|=s),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(p=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,p&&a!==null&&(p=31-tt(s),t=y.hiddenUpdates,c=t[p],c===null?t[p]=[a]:c.push(a),a.lane=s|536870912),y):null}function so(t){if(50<Ws)throw Ws=0,Ud=null,Error(l(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var Rl={};function k2(t,a,s,c){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function En(t,a,s,c){return new k2(t,a,s,c)}function Au(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ia(t,a){var s=t.alternate;return s===null?(s=En(t.tag,a,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=a,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,a=t.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function kp(t,a){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,a=s.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function io(t,a,s,c,p,y){var S=0;if(c=t,typeof t=="function")Au(t)&&(S=1);else if(typeof t=="string")S=Cw(t,s,re.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case W:return t=En(31,s,a,p),t.elementType=W,t.lanes=y,t;case C:return Wr(s.children,p,y,a);case N:S=8,p|=24;break;case M:return t=En(12,s,a,p|2),t.elementType=M,t.lanes=y,t;case H:return t=En(13,s,a,p),t.elementType=H,t.lanes=y,t;case _:return t=En(19,s,a,p),t.elementType=_,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case R:S=10;break e;case O:S=9;break e;case $:S=11;break e;case V:S=14;break e;case G:S=16,c=null;break e}S=29,s=Error(l(130,t===null?"null":typeof t,"")),c=null}return a=En(S,s,a,p),a.elementType=t,a.type=c,a.lanes=y,a}function Wr(t,a,s,c){return t=En(7,t,c,a),t.lanes=s,t}function Ru(t,a,s){return t=En(6,t,null,a),t.lanes=s,t}function wp(t){var a=En(18,null,null,0);return a.stateNode=t,a}function Lu(t,a,s){return a=En(4,t.children!==null?t.children:[],t.key,a),a.lanes=s,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Sp=new WeakMap;function Gn(t,a){if(typeof t=="object"&&t!==null){var s=Sp.get(t);return s!==void 0?s:(a={value:t,source:a,stack:Pn(a)},Sp.set(t,a),a)}return{value:t,source:a,stack:Pn(a)}}var Ll=[],_l=0,oo=null,Ts=0,Kn=[],Wn=0,cr=null,xa=1,ya="";function za(t,a){Ll[_l++]=Ts,Ll[_l++]=oo,oo=t,Ts=a}function jp(t,a,s){Kn[Wn++]=xa,Kn[Wn++]=ya,Kn[Wn++]=cr,cr=t;var c=xa;t=ya;var p=32-tt(c)-1;c&=~(1<<p),s+=1;var y=32-tt(a)+p;if(30<y){var S=p-p%5;y=(c&(1<<S)-1).toString(32),c>>=S,p-=S,xa=1<<32-tt(a)+p|s<<p|c,ya=y+t}else xa=1<<y|s<<p|c,ya=t}function _u(t){t.return!==null&&(za(t,1),jp(t,1,0))}function Iu(t){for(;t===oo;)oo=Ll[--_l],Ll[_l]=null,Ts=Ll[--_l],Ll[_l]=null;for(;t===cr;)cr=Kn[--Wn],Kn[Wn]=null,ya=Kn[--Wn],Kn[Wn]=null,xa=Kn[--Wn],Kn[Wn]=null}function Np(t,a){Kn[Wn++]=xa,Kn[Wn++]=ya,Kn[Wn++]=cr,xa=a.id,ya=a.overflow,cr=t}var tn=null,jt=null,nt=!1,ur=null,Yn=!1,zu=Error(l(519));function dr(t){var a=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Es(Gn(a,t)),zu}function Cp(t){var a=t.stateNode,s=t.type,c=t.memoizedProps;switch(a[Wt]=t,a[cn]=c,s){case"dialog":Ke("cancel",a),Ke("close",a);break;case"iframe":case"object":case"embed":Ke("load",a);break;case"video":case"audio":for(s=0;s<Xs.length;s++)Ke(Xs[s],a);break;case"source":Ke("error",a);break;case"img":case"image":case"link":Ke("error",a),Ke("load",a);break;case"details":Ke("toggle",a);break;case"input":Ke("invalid",a),$h(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Ke("invalid",a);break;case"textarea":Ke("invalid",a),Hh(a,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||a.textContent===""+s||c.suppressHydrationWarning===!0||qg(a.textContent,s)?(c.popover!=null&&(Ke("beforetoggle",a),Ke("toggle",a)),c.onScroll!=null&&Ke("scroll",a),c.onScrollEnd!=null&&Ke("scrollend",a),c.onClick!=null&&(a.onclick=La),a=!0):a=!1,a||dr(t,!0)}function Tp(t){for(tn=t.return;tn;)switch(tn.tag){case 5:case 31:case 13:Yn=!1;return;case 27:case 3:Yn=!0;return;default:tn=tn.return}}function Il(t){if(t!==tn)return!1;if(!nt)return Tp(t),nt=!0,!1;var a=t.tag,s;if((s=a!==3&&a!==27)&&((s=a===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Jd(t.type,t.memoizedProps)),s=!s),s&&jt&&dr(t),Tp(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));jt=Zg(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));jt=Zg(t)}else a===27?(a=jt,Nr(t.type)?(t=rf,rf=null,jt=t):jt=a):jt=tn?Qn(t.stateNode.nextSibling):null;return!0}function Yr(){jt=tn=null,nt=!1}function Du(){var t=ur;return t!==null&&(bn===null?bn=t:bn.push.apply(bn,t),ur=null),t}function Es(t){ur===null?ur=[t]:ur.push(t)}var Ou=I(null),Xr=null,Da=null;function fr(t,a,s){T(Ou,a._currentValue),a._currentValue=s}function Oa(t){t._currentValue=Ou.current,B(Ou)}function Uu(t,a,s){for(;t!==null;){var c=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),t===s)break;t=t.return}}function $u(t,a,s,c){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var y=p.dependencies;if(y!==null){var S=p.child;y=y.firstContext;e:for(;y!==null;){var E=y;y=p;for(var P=0;P<a.length;P++)if(E.context===a[P]){y.lanes|=s,E=y.alternate,E!==null&&(E.lanes|=s),Uu(y.return,s,t),c||(S=null);break e}y=E.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(l(341));S.lanes|=s,y=S.alternate,y!==null&&(y.lanes|=s),Uu(S,s,t),S=null}else S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===t){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function zl(t,a,s,c){t=null;for(var p=a,y=!1;p!==null;){if(!y){if((p.flags&524288)!==0)y=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(l(387));if(S=S.memoizedProps,S!==null){var E=p.type;Tn(p.pendingProps.value,S.value)||(t!==null?t.push(E):t=[E])}}else if(p===he.current){if(S=p.alternate,S===null)throw Error(l(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(ti):t=[ti])}p=p.return}t!==null&&$u(a,t,s,c),a.flags|=262144}function co(t){for(t=t.firstContext;t!==null;){if(!Tn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Qr(t){Xr=t,Da=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function nn(t){return Ep(Xr,t)}function uo(t,a){return Xr===null&&Qr(t),Ep(t,a)}function Ep(t,a){var s=a._currentValue;if(a={context:a,memoizedValue:s,next:null},Da===null){if(t===null)throw Error(l(308));Da=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else Da=Da.next=a;return s}var w2=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(s,c){t.push(c)}};this.abort=function(){a.aborted=!0,t.forEach(function(s){return s()})}},S2=e.unstable_scheduleCallback,j2=e.unstable_NormalPriority,Ht={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bu(){return{controller:new w2,data:new Map,refCount:0}}function Ms(t){t.refCount--,t.refCount===0&&S2(j2,function(){t.controller.abort()})}var As=null,Hu=0,Dl=0,Ol=null;function N2(t,a){if(As===null){var s=As=[];Hu=0,Dl=Fd(),Ol={status:"pending",value:void 0,then:function(c){s.push(c)}}}return Hu++,a.then(Mp,Mp),a}function Mp(){if(--Hu===0&&As!==null){Ol!==null&&(Ol.status="fulfilled");var t=As;As=null,Dl=0,Ol=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function C2(t,a){var s=[],c={status:"pending",value:null,reason:null,then:function(p){s.push(p)}};return t.then(function(){c.status="fulfilled",c.value=a;for(var p=0;p<s.length;p++)(0,s[p])(a)},function(p){for(c.status="rejected",c.reason=p,p=0;p<s.length;p++)(0,s[p])(void 0)}),c}var Ap=D.S;D.S=function(t,a){mg=bt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&N2(t,a),Ap!==null&&Ap(t,a)};var Zr=I(null);function Pu(){var t=Zr.current;return t!==null?t:kt.pooledCache}function fo(t,a){a===null?T(Zr,Zr.current):T(Zr,a.pool)}function Rp(){var t=Pu();return t===null?null:{parent:Ht._currentValue,pool:t}}var Ul=Error(l(460)),qu=Error(l(474)),mo=Error(l(542)),ho={then:function(){}};function Lp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function _p(t,a,s){switch(s=t[s],s===void 0?t.push(a):s!==a&&(a.then(La,La),a=s),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,zp(t),t;default:if(typeof a.status=="string")a.then(La,La);else{if(t=kt,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=a,t.status="pending",t.then(function(c){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=c}},function(c){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,zp(t),t}throw el=a,Ul}}function Jr(t){try{var a=t._init;return a(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(el=s,Ul):s}}var el=null;function Ip(){if(el===null)throw Error(l(459));var t=el;return el=null,t}function zp(t){if(t===Ul||t===mo)throw Error(l(483))}var $l=null,Rs=0;function po(t){var a=Rs;return Rs+=1,$l===null&&($l=[]),_p($l,t,a)}function Ls(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function go(t,a){throw a.$$typeof===k?Error(l(525)):(t=Object.prototype.toString.call(a),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Dp(t){function a(Y,K){if(t){var Q=Y.deletions;Q===null?(Y.deletions=[K],Y.flags|=16):Q.push(K)}}function s(Y,K){if(!t)return null;for(;K!==null;)a(Y,K),K=K.sibling;return null}function c(Y){for(var K=new Map;Y!==null;)Y.key!==null?K.set(Y.key,Y):K.set(Y.index,Y),Y=Y.sibling;return K}function p(Y,K){return Y=Ia(Y,K),Y.index=0,Y.sibling=null,Y}function y(Y,K,Q){return Y.index=Q,t?(Q=Y.alternate,Q!==null?(Q=Q.index,Q<K?(Y.flags|=67108866,K):Q):(Y.flags|=67108866,K)):(Y.flags|=1048576,K)}function S(Y){return t&&Y.alternate===null&&(Y.flags|=67108866),Y}function E(Y,K,Q,ce){return K===null||K.tag!==6?(K=Ru(Q,Y.mode,ce),K.return=Y,K):(K=p(K,Q),K.return=Y,K)}function P(Y,K,Q,ce){var Me=Q.type;return Me===C?ie(Y,K,Q.props.children,ce,Q.key):K!==null&&(K.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===G&&Jr(Me)===K.type)?(K=p(K,Q.props),Ls(K,Q),K.return=Y,K):(K=io(Q.type,Q.key,Q.props,null,Y.mode,ce),Ls(K,Q),K.return=Y,K)}function Z(Y,K,Q,ce){return K===null||K.tag!==4||K.stateNode.containerInfo!==Q.containerInfo||K.stateNode.implementation!==Q.implementation?(K=Lu(Q,Y.mode,ce),K.return=Y,K):(K=p(K,Q.children||[]),K.return=Y,K)}function ie(Y,K,Q,ce,Me){return K===null||K.tag!==7?(K=Wr(Q,Y.mode,ce,Me),K.return=Y,K):(K=p(K,Q),K.return=Y,K)}function ue(Y,K,Q){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=Ru(""+K,Y.mode,Q),K.return=Y,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case w:return Q=io(K.type,K.key,K.props,null,Y.mode,Q),Ls(Q,K),Q.return=Y,Q;case j:return K=Lu(K,Y.mode,Q),K.return=Y,K;case G:return K=Jr(K),ue(Y,K,Q)}if(F(K)||A(K))return K=Wr(K,Y.mode,Q,null),K.return=Y,K;if(typeof K.then=="function")return ue(Y,po(K),Q);if(K.$$typeof===R)return ue(Y,uo(Y,K),Q);go(Y,K)}return null}function J(Y,K,Q,ce){var Me=K!==null?K.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Me!==null?null:E(Y,K,""+Q,ce);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return Q.key===Me?P(Y,K,Q,ce):null;case j:return Q.key===Me?Z(Y,K,Q,ce):null;case G:return Q=Jr(Q),J(Y,K,Q,ce)}if(F(Q)||A(Q))return Me!==null?null:ie(Y,K,Q,ce,null);if(typeof Q.then=="function")return J(Y,K,po(Q),ce);if(Q.$$typeof===R)return J(Y,K,uo(Y,Q),ce);go(Y,Q)}return null}function ae(Y,K,Q,ce,Me){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Y=Y.get(Q)||null,E(K,Y,""+ce,Me);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case w:return Y=Y.get(ce.key===null?Q:ce.key)||null,P(K,Y,ce,Me);case j:return Y=Y.get(ce.key===null?Q:ce.key)||null,Z(K,Y,ce,Me);case G:return ce=Jr(ce),ae(Y,K,Q,ce,Me)}if(F(ce)||A(ce))return Y=Y.get(Q)||null,ie(K,Y,ce,Me,null);if(typeof ce.then=="function")return ae(Y,K,Q,po(ce),Me);if(ce.$$typeof===R)return ae(Y,K,Q,uo(K,ce),Me);go(K,ce)}return null}function Ne(Y,K,Q,ce){for(var Me=null,st=null,Te=K,qe=K=0,Ze=null;Te!==null&&qe<Q.length;qe++){Te.index>qe?(Ze=Te,Te=null):Ze=Te.sibling;var it=J(Y,Te,Q[qe],ce);if(it===null){Te===null&&(Te=Ze);break}t&&Te&&it.alternate===null&&a(Y,Te),K=y(it,K,qe),st===null?Me=it:st.sibling=it,st=it,Te=Ze}if(qe===Q.length)return s(Y,Te),nt&&za(Y,qe),Me;if(Te===null){for(;qe<Q.length;qe++)Te=ue(Y,Q[qe],ce),Te!==null&&(K=y(Te,K,qe),st===null?Me=Te:st.sibling=Te,st=Te);return nt&&za(Y,qe),Me}for(Te=c(Te);qe<Q.length;qe++)Ze=ae(Te,Y,qe,Q[qe],ce),Ze!==null&&(t&&Ze.alternate!==null&&Te.delete(Ze.key===null?qe:Ze.key),K=y(Ze,K,qe),st===null?Me=Ze:st.sibling=Ze,st=Ze);return t&&Te.forEach(function(Ar){return a(Y,Ar)}),nt&&za(Y,qe),Me}function Le(Y,K,Q,ce){if(Q==null)throw Error(l(151));for(var Me=null,st=null,Te=K,qe=K=0,Ze=null,it=Q.next();Te!==null&&!it.done;qe++,it=Q.next()){Te.index>qe?(Ze=Te,Te=null):Ze=Te.sibling;var Ar=J(Y,Te,it.value,ce);if(Ar===null){Te===null&&(Te=Ze);break}t&&Te&&Ar.alternate===null&&a(Y,Te),K=y(Ar,K,qe),st===null?Me=Ar:st.sibling=Ar,st=Ar,Te=Ze}if(it.done)return s(Y,Te),nt&&za(Y,qe),Me;if(Te===null){for(;!it.done;qe++,it=Q.next())it=ue(Y,it.value,ce),it!==null&&(K=y(it,K,qe),st===null?Me=it:st.sibling=it,st=it);return nt&&za(Y,qe),Me}for(Te=c(Te);!it.done;qe++,it=Q.next())it=ae(Te,Y,qe,it.value,ce),it!==null&&(t&&it.alternate!==null&&Te.delete(it.key===null?qe:it.key),K=y(it,K,qe),st===null?Me=it:st.sibling=it,st=it);return t&&Te.forEach(function(Ow){return a(Y,Ow)}),nt&&za(Y,qe),Me}function yt(Y,K,Q,ce){if(typeof Q=="object"&&Q!==null&&Q.type===C&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:e:{for(var Me=Q.key;K!==null;){if(K.key===Me){if(Me=Q.type,Me===C){if(K.tag===7){s(Y,K.sibling),ce=p(K,Q.props.children),ce.return=Y,Y=ce;break e}}else if(K.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===G&&Jr(Me)===K.type){s(Y,K.sibling),ce=p(K,Q.props),Ls(ce,Q),ce.return=Y,Y=ce;break e}s(Y,K);break}else a(Y,K);K=K.sibling}Q.type===C?(ce=Wr(Q.props.children,Y.mode,ce,Q.key),ce.return=Y,Y=ce):(ce=io(Q.type,Q.key,Q.props,null,Y.mode,ce),Ls(ce,Q),ce.return=Y,Y=ce)}return S(Y);case j:e:{for(Me=Q.key;K!==null;){if(K.key===Me)if(K.tag===4&&K.stateNode.containerInfo===Q.containerInfo&&K.stateNode.implementation===Q.implementation){s(Y,K.sibling),ce=p(K,Q.children||[]),ce.return=Y,Y=ce;break e}else{s(Y,K);break}else a(Y,K);K=K.sibling}ce=Lu(Q,Y.mode,ce),ce.return=Y,Y=ce}return S(Y);case G:return Q=Jr(Q),yt(Y,K,Q,ce)}if(F(Q))return Ne(Y,K,Q,ce);if(A(Q)){if(Me=A(Q),typeof Me!="function")throw Error(l(150));return Q=Me.call(Q),Le(Y,K,Q,ce)}if(typeof Q.then=="function")return yt(Y,K,po(Q),ce);if(Q.$$typeof===R)return yt(Y,K,uo(Y,Q),ce);go(Y,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,K!==null&&K.tag===6?(s(Y,K.sibling),ce=p(K,Q),ce.return=Y,Y=ce):(s(Y,K),ce=Ru(Q,Y.mode,ce),ce.return=Y,Y=ce),S(Y)):s(Y,K)}return function(Y,K,Q,ce){try{Rs=0;var Me=yt(Y,K,Q,ce);return $l=null,Me}catch(Te){if(Te===Ul||Te===mo)throw Te;var st=En(29,Te,null,Y.mode);return st.lanes=ce,st.return=Y,st}}}var tl=Dp(!0),Op=Dp(!1),mr=!1;function Fu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vu(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function hr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function pr(t,a,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(ut&2)!==0){var p=c.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),c.pending=a,a=so(t),bp(t,null,s),a}return lo(t,c,a,s),so(t)}function _s(t,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var c=a.lanes;c&=t.pendingLanes,s|=c,a.lanes=s,Vi(t,s)}}function Gu(t,a){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var p=null,y=null;if(s=s.firstBaseUpdate,s!==null){do{var S={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};y===null?p=y=S:y=y.next=S,s=s.next}while(s!==null);y===null?p=y=a:y=y.next=a}else p=y=a;s={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:y,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=a:t.next=a,s.lastBaseUpdate=a}var Ku=!1;function Is(){if(Ku){var t=Ol;if(t!==null)throw t}}function zs(t,a,s,c){Ku=!1;var p=t.updateQueue;mr=!1;var y=p.firstBaseUpdate,S=p.lastBaseUpdate,E=p.shared.pending;if(E!==null){p.shared.pending=null;var P=E,Z=P.next;P.next=null,S===null?y=Z:S.next=Z,S=P;var ie=t.alternate;ie!==null&&(ie=ie.updateQueue,E=ie.lastBaseUpdate,E!==S&&(E===null?ie.firstBaseUpdate=Z:E.next=Z,ie.lastBaseUpdate=P))}if(y!==null){var ue=p.baseState;S=0,ie=Z=P=null,E=y;do{var J=E.lane&-536870913,ae=J!==E.lane;if(ae?(Qe&J)===J:(c&J)===J){J!==0&&J===Dl&&(Ku=!0),ie!==null&&(ie=ie.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var Ne=t,Le=E;J=a;var yt=s;switch(Le.tag){case 1:if(Ne=Le.payload,typeof Ne=="function"){ue=Ne.call(yt,ue,J);break e}ue=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Le.payload,J=typeof Ne=="function"?Ne.call(yt,ue,J):Ne,J==null)break e;ue=v({},ue,J);break e;case 2:mr=!0}}J=E.callback,J!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=p.callbacks,ae===null?p.callbacks=[J]:ae.push(J))}else ae={lane:J,tag:E.tag,payload:E.payload,callback:E.callback,next:null},ie===null?(Z=ie=ae,P=ue):ie=ie.next=ae,S|=J;if(E=E.next,E===null){if(E=p.shared.pending,E===null)break;ae=E,E=ae.next,ae.next=null,p.lastBaseUpdate=ae,p.shared.pending=null}}while(!0);ie===null&&(P=ue),p.baseState=P,p.firstBaseUpdate=Z,p.lastBaseUpdate=ie,y===null&&(p.shared.lanes=0),br|=S,t.lanes=S,t.memoizedState=ue}}function Up(t,a){if(typeof t!="function")throw Error(l(191,t));t.call(a)}function $p(t,a){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)Up(s[t],a)}var Bl=I(null),xo=I(0);function Bp(t,a){t=Ga,T(xo,t),T(Bl,a),Ga=t|a.baseLanes}function Wu(){T(xo,Ga),T(Bl,Bl.current)}function Yu(){Ga=xo.current,B(Bl),B(xo)}var Mn=I(null),Xn=null;function gr(t){var a=t.alternate;T(Ot,Ot.current&1),T(Mn,t),Xn===null&&(a===null||Bl.current!==null||a.memoizedState!==null)&&(Xn=t)}function Xu(t){T(Ot,Ot.current),T(Mn,t),Xn===null&&(Xn=t)}function Hp(t){t.tag===22?(T(Ot,Ot.current),T(Mn,t),Xn===null&&(Xn=t)):xr()}function xr(){T(Ot,Ot.current),T(Mn,Mn.current)}function An(t){B(Mn),Xn===t&&(Xn=null),B(Ot)}var Ot=I(0);function yo(t){for(var a=t;a!==null;){if(a.tag===13){var s=a.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||nf(s)||af(s)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ua=0,Pe=null,gt=null,Pt=null,vo=!1,Hl=!1,nl=!1,bo=0,Ds=0,Pl=null,T2=0;function It(){throw Error(l(321))}function Qu(t,a){if(a===null)return!1;for(var s=0;s<a.length&&s<t.length;s++)if(!Tn(t[s],a[s]))return!1;return!0}function Zu(t,a,s,c,p,y){return Ua=y,Pe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,D.H=t===null||t.memoizedState===null?j0:md,nl=!1,y=s(c,p),nl=!1,Hl&&(y=qp(a,s,c,p)),Pp(t),y}function Pp(t){D.H=$s;var a=gt!==null&>.next!==null;if(Ua=0,Pt=gt=Pe=null,vo=!1,Ds=0,Pl=null,a)throw Error(l(300));t===null||qt||(t=t.dependencies,t!==null&&co(t)&&(qt=!0))}function qp(t,a,s,c){Pe=t;var p=0;do{if(Hl&&(Pl=null),Ds=0,Hl=!1,25<=p)throw Error(l(301));if(p+=1,Pt=gt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}D.H=N0,y=a(s,c)}while(Hl);return y}function E2(){var t=D.H,a=t.useState()[0];return a=typeof a.then=="function"?Os(a):a,t=t.useState()[0],(gt!==null?gt.memoizedState:null)!==t&&(Pe.flags|=1024),a}function Ju(){var t=bo!==0;return bo=0,t}function ed(t,a,s){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~s}function td(t){if(vo){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}vo=!1}Ua=0,Pt=gt=Pe=null,Hl=!1,Ds=bo=0,Pl=null}function hn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Pe.memoizedState=Pt=t:Pt=Pt.next=t,Pt}function Ut(){if(gt===null){var t=Pe.alternate;t=t!==null?t.memoizedState:null}else t=gt.next;var a=Pt===null?Pe.memoizedState:Pt.next;if(a!==null)Pt=a,gt=t;else{if(t===null)throw Pe.alternate===null?Error(l(467)):Error(l(310));gt=t,t={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Pt===null?Pe.memoizedState=Pt=t:Pt=Pt.next=t}return Pt}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Os(t){var a=Ds;return Ds+=1,Pl===null&&(Pl=[]),t=_p(Pl,t,a),a=Pe,(Pt===null?a.memoizedState:Pt.next)===null&&(a=a.alternate,D.H=a===null||a.memoizedState===null?j0:md),t}function wo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Os(t);if(t.$$typeof===R)return nn(t)}throw Error(l(438,String(t)))}function nd(t){var a=null,s=Pe.updateQueue;if(s!==null&&(a=s.memoCache),a==null){var c=Pe.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),s===null&&(s=ko(),Pe.updateQueue=s),s.memoCache=a,s=a.data[a.index],s===void 0)for(s=a.data[a.index]=Array(t),c=0;c<t;c++)s[c]=z;return a.index++,s}function $a(t,a){return typeof a=="function"?a(t):a}function So(t){var a=Ut();return ad(a,gt,t)}function ad(t,a,s){var c=t.queue;if(c===null)throw Error(l(311));c.lastRenderedReducer=s;var p=t.baseQueue,y=c.pending;if(y!==null){if(p!==null){var S=p.next;p.next=y.next,y.next=S}a.baseQueue=p=y,c.pending=null}if(y=t.baseState,p===null)t.memoizedState=y;else{a=p.next;var E=S=null,P=null,Z=a,ie=!1;do{var ue=Z.lane&-536870913;if(ue!==Z.lane?(Qe&ue)===ue:(Ua&ue)===ue){var J=Z.revertLane;if(J===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),ue===Dl&&(ie=!0);else if((Ua&J)===J){Z=Z.next,J===Dl&&(ie=!0);continue}else ue={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(E=P=ue,S=y):P=P.next=ue,Pe.lanes|=J,br|=J;ue=Z.action,nl&&s(y,ue),y=Z.hasEagerState?Z.eagerState:s(y,ue)}else J={lane:ue,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(E=P=J,S=y):P=P.next=J,Pe.lanes|=ue,br|=ue;Z=Z.next}while(Z!==null&&Z!==a);if(P===null?S=y:P.next=E,!Tn(y,t.memoizedState)&&(qt=!0,ie&&(s=Ol,s!==null)))throw s;t.memoizedState=y,t.baseState=S,t.baseQueue=P,c.lastRenderedState=y}return p===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function rd(t){var a=Ut(),s=a.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=t;var c=s.dispatch,p=s.pending,y=a.memoizedState;if(p!==null){s.pending=null;var S=p=p.next;do y=t(y,S.action),S=S.next;while(S!==p);Tn(y,a.memoizedState)||(qt=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),s.lastRenderedState=y}return[y,c]}function Fp(t,a,s){var c=Pe,p=Ut(),y=nt;if(y){if(s===void 0)throw Error(l(407));s=s()}else s=a();var S=!Tn((gt||p).memoizedState,s);if(S&&(p.memoizedState=s,qt=!0),p=p.queue,id(Kp.bind(null,c,p,t),[t]),p.getSnapshot!==a||S||Pt!==null&&Pt.memoizedState.tag&1){if(c.flags|=2048,ql(9,{destroy:void 0},Gp.bind(null,c,p,s,a),null),kt===null)throw Error(l(349));y||(Ua&127)!==0||Vp(c,a,s)}return s}function Vp(t,a,s){t.flags|=16384,t={getSnapshot:a,value:s},a=Pe.updateQueue,a===null?(a=ko(),Pe.updateQueue=a,a.stores=[t]):(s=a.stores,s===null?a.stores=[t]:s.push(t))}function Gp(t,a,s,c){a.value=s,a.getSnapshot=c,Wp(a)&&Yp(t)}function Kp(t,a,s){return s(function(){Wp(a)&&Yp(t)})}function Wp(t){var a=t.getSnapshot;t=t.value;try{var s=a();return!Tn(t,s)}catch{return!0}}function Yp(t){var a=Kr(t,2);a!==null&&kn(a,t,2)}function ld(t){var a=hn();if(typeof t=="function"){var s=t;if(t=s(),nl){ot(!0);try{s()}finally{ot(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$a,lastRenderedState:t},a}function Xp(t,a,s,c){return t.baseState=s,ad(t,gt,typeof c=="function"?c:$a)}function M2(t,a,s,c,p){if(Co(t))throw Error(l(485));if(t=a.action,t!==null){var y={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};D.T!==null?s(!0):y.isTransition=!1,c(y),s=a.pending,s===null?(y.next=a.pending=y,Qp(a,y)):(y.next=s.next,a.pending=s.next=y)}}function Qp(t,a){var s=a.action,c=a.payload,p=t.state;if(a.isTransition){var y=D.T,S={};D.T=S;try{var E=s(p,c),P=D.S;P!==null&&P(S,E),Zp(t,a,E)}catch(Z){sd(t,a,Z)}finally{y!==null&&S.types!==null&&(y.types=S.types),D.T=y}}else try{y=s(p,c),Zp(t,a,y)}catch(Z){sd(t,a,Z)}}function Zp(t,a,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){Jp(t,a,c)},function(c){return sd(t,a,c)}):Jp(t,a,s)}function Jp(t,a,s){a.status="fulfilled",a.value=s,e0(a),t.state=s,a=t.pending,a!==null&&(s=a.next,s===a?t.pending=null:(s=s.next,a.next=s,Qp(t,s)))}function sd(t,a,s){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=s,e0(a),a=a.next;while(a!==c)}t.action=null}function e0(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function t0(t,a){return a}function n0(t,a){if(nt){var s=kt.formState;if(s!==null){e:{var c=Pe;if(nt){if(jt){t:{for(var p=jt,y=Yn;p.nodeType!==8;){if(!y){p=null;break t}if(p=Qn(p.nextSibling),p===null){p=null;break t}}y=p.data,p=y==="F!"||y==="F"?p:null}if(p){jt=Qn(p.nextSibling),c=p.data==="F!";break e}}dr(c)}c=!1}c&&(a=s[0])}}return s=hn(),s.memoizedState=s.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t0,lastRenderedState:a},s.queue=c,s=k0.bind(null,Pe,c),c.dispatch=s,c=ld(!1),y=fd.bind(null,Pe,!1,c.queue),c=hn(),p={state:a,dispatch:null,action:t,pending:null},c.queue=p,s=M2.bind(null,Pe,p,y,s),p.dispatch=s,c.memoizedState=t,[a,s,!1]}function a0(t){var a=Ut();return r0(a,gt,t)}function r0(t,a,s){if(a=ad(t,a,t0)[0],t=So($a)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Os(a)}catch(S){throw S===Ul?mo:S}else c=a;a=Ut();var p=a.queue,y=p.dispatch;return s!==a.memoizedState&&(Pe.flags|=2048,ql(9,{destroy:void 0},A2.bind(null,p,s),null)),[c,y,t]}function A2(t,a){t.action=a}function l0(t){var a=Ut(),s=gt;if(s!==null)return r0(a,s,t);Ut(),a=a.memoizedState,s=Ut();var c=s.queue.dispatch;return s.memoizedState=t,[a,c,!1]}function ql(t,a,s,c){return t={tag:t,create:s,deps:c,inst:a,next:null},a=Pe.updateQueue,a===null&&(a=ko(),Pe.updateQueue=a),s=a.lastEffect,s===null?a.lastEffect=t.next=t:(c=s.next,s.next=t,t.next=c,a.lastEffect=t),t}function s0(){return Ut().memoizedState}function jo(t,a,s,c){var p=hn();Pe.flags|=t,p.memoizedState=ql(1|a,{destroy:void 0},s,c===void 0?null:c)}function No(t,a,s,c){var p=Ut();c=c===void 0?null:c;var y=p.memoizedState.inst;gt!==null&&c!==null&&Qu(c,gt.memoizedState.deps)?p.memoizedState=ql(a,y,s,c):(Pe.flags|=t,p.memoizedState=ql(1|a,y,s,c))}function i0(t,a){jo(8390656,8,t,a)}function id(t,a){No(2048,8,t,a)}function R2(t){Pe.flags|=4;var a=Pe.updateQueue;if(a===null)a=ko(),Pe.updateQueue=a,a.events=[t];else{var s=a.events;s===null?a.events=[t]:s.push(t)}}function o0(t){var a=Ut().memoizedState;return R2({ref:a,nextImpl:t}),function(){if((ut&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}function c0(t,a){return No(4,2,t,a)}function u0(t,a){return No(4,4,t,a)}function d0(t,a){if(typeof a=="function"){t=t();var s=a(t);return function(){typeof s=="function"?s():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function f0(t,a,s){s=s!=null?s.concat([t]):null,No(4,4,d0.bind(null,a,t),s)}function od(){}function m0(t,a){var s=Ut();a=a===void 0?null:a;var c=s.memoizedState;return a!==null&&Qu(a,c[1])?c[0]:(s.memoizedState=[t,a],t)}function h0(t,a){var s=Ut();a=a===void 0?null:a;var c=s.memoizedState;if(a!==null&&Qu(a,c[1]))return c[0];if(c=t(),nl){ot(!0);try{t()}finally{ot(!1)}}return s.memoizedState=[c,a],c}function cd(t,a,s){return s===void 0||(Ua&1073741824)!==0&&(Qe&261930)===0?t.memoizedState=a:(t.memoizedState=s,t=pg(),Pe.lanes|=t,br|=t,s)}function p0(t,a,s,c){return Tn(s,a)?s:Bl.current!==null?(t=cd(t,s,c),Tn(t,a)||(qt=!0),t):(Ua&42)===0||(Ua&1073741824)!==0&&(Qe&261930)===0?(qt=!0,t.memoizedState=s):(t=pg(),Pe.lanes|=t,br|=t,a)}function g0(t,a,s,c,p){var y=te.p;te.p=y!==0&&8>y?y:8;var S=D.T,E={};D.T=E,fd(t,!1,a,s);try{var P=p(),Z=D.S;if(Z!==null&&Z(E,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var ie=C2(P,c);Us(t,a,ie,_n(t))}else Us(t,a,c,_n(t))}catch(ue){Us(t,a,{then:function(){},status:"rejected",reason:ue},_n())}finally{te.p=y,S!==null&&E.types!==null&&(S.types=E.types),D.T=S}}function L2(){}function ud(t,a,s,c){if(t.tag!==5)throw Error(l(476));var p=x0(t).queue;g0(t,p,a,ee,s===null?L2:function(){return y0(t),s(c)})}function x0(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$a,lastRenderedState:ee},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$a,lastRenderedState:s},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function y0(t){var a=x0(t);a.next===null&&(a=t.alternate.memoizedState),Us(t,a.next.queue,{},_n())}function dd(){return nn(ti)}function v0(){return Ut().memoizedState}function b0(){return Ut().memoizedState}function _2(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var s=_n();t=hr(s);var c=pr(a,t,s);c!==null&&(kn(c,a,s),_s(c,a,s)),a={cache:Bu()},t.payload=a;return}a=a.return}}function I2(t,a,s){var c=_n();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Co(t)?w0(a,s):(s=Mu(t,a,s,c),s!==null&&(kn(s,t,c),S0(s,a,c)))}function k0(t,a,s){var c=_n();Us(t,a,s,c)}function Us(t,a,s,c){var p={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Co(t))w0(a,p);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var S=a.lastRenderedState,E=y(S,s);if(p.hasEagerState=!0,p.eagerState=E,Tn(E,S))return lo(t,a,p,0),kt===null&&ro(),!1}catch{}if(s=Mu(t,a,p,c),s!==null)return kn(s,t,c),S0(s,a,c),!0}return!1}function fd(t,a,s,c){if(c={lane:2,revertLane:Fd(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Co(t)){if(a)throw Error(l(479))}else a=Mu(t,s,c,2),a!==null&&kn(a,t,2)}function Co(t){var a=t.alternate;return t===Pe||a!==null&&a===Pe}function w0(t,a){Hl=vo=!0;var s=t.pending;s===null?a.next=a:(a.next=s.next,s.next=a),t.pending=a}function S0(t,a,s){if((s&4194048)!==0){var c=a.lanes;c&=t.pendingLanes,s|=c,a.lanes=s,Vi(t,s)}}var $s={readContext:nn,use:wo,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};$s.useEffectEvent=It;var j0={readContext:nn,use:wo,useCallback:function(t,a){return hn().memoizedState=[t,a===void 0?null:a],t},useContext:nn,useEffect:i0,useImperativeHandle:function(t,a,s){s=s!=null?s.concat([t]):null,jo(4194308,4,d0.bind(null,a,t),s)},useLayoutEffect:function(t,a){return jo(4194308,4,t,a)},useInsertionEffect:function(t,a){jo(4,2,t,a)},useMemo:function(t,a){var s=hn();a=a===void 0?null:a;var c=t();if(nl){ot(!0);try{t()}finally{ot(!1)}}return s.memoizedState=[c,a],c},useReducer:function(t,a,s){var c=hn();if(s!==void 0){var p=s(a);if(nl){ot(!0);try{s(a)}finally{ot(!1)}}}else p=a;return c.memoizedState=c.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},c.queue=t,t=t.dispatch=I2.bind(null,Pe,t),[c.memoizedState,t]},useRef:function(t){var a=hn();return t={current:t},a.memoizedState=t},useState:function(t){t=ld(t);var a=t.queue,s=k0.bind(null,Pe,a);return a.dispatch=s,[t.memoizedState,s]},useDebugValue:od,useDeferredValue:function(t,a){var s=hn();return cd(s,t,a)},useTransition:function(){var t=ld(!1);return t=g0.bind(null,Pe,t.queue,!0,!1),hn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,s){var c=Pe,p=hn();if(nt){if(s===void 0)throw Error(l(407));s=s()}else{if(s=a(),kt===null)throw Error(l(349));(Qe&127)!==0||Vp(c,a,s)}p.memoizedState=s;var y={value:s,getSnapshot:a};return p.queue=y,i0(Kp.bind(null,c,y,t),[t]),c.flags|=2048,ql(9,{destroy:void 0},Gp.bind(null,c,y,s,a),null),s},useId:function(){var t=hn(),a=kt.identifierPrefix;if(nt){var s=ya,c=xa;s=(c&~(1<<32-tt(c)-1)).toString(32)+s,a="_"+a+"R_"+s,s=bo++,0<s&&(a+="H"+s.toString(32)),a+="_"}else s=T2++,a="_"+a+"r_"+s.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:dd,useFormState:n0,useActionState:n0,useOptimistic:function(t){var a=hn();a.memoizedState=a.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=s,a=fd.bind(null,Pe,!0,s),s.dispatch=a,[t,a]},useMemoCache:nd,useCacheRefresh:function(){return hn().memoizedState=_2.bind(null,Pe)},useEffectEvent:function(t){var a=hn(),s={impl:t};return a.memoizedState=s,function(){if((ut&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},md={readContext:nn,use:wo,useCallback:m0,useContext:nn,useEffect:id,useImperativeHandle:f0,useInsertionEffect:c0,useLayoutEffect:u0,useMemo:h0,useReducer:So,useRef:s0,useState:function(){return So($a)},useDebugValue:od,useDeferredValue:function(t,a){var s=Ut();return p0(s,gt.memoizedState,t,a)},useTransition:function(){var t=So($a)[0],a=Ut().memoizedState;return[typeof t=="boolean"?t:Os(t),a]},useSyncExternalStore:Fp,useId:v0,useHostTransitionStatus:dd,useFormState:a0,useActionState:a0,useOptimistic:function(t,a){var s=Ut();return Xp(s,gt,t,a)},useMemoCache:nd,useCacheRefresh:b0};md.useEffectEvent=o0;var N0={readContext:nn,use:wo,useCallback:m0,useContext:nn,useEffect:id,useImperativeHandle:f0,useInsertionEffect:c0,useLayoutEffect:u0,useMemo:h0,useReducer:rd,useRef:s0,useState:function(){return rd($a)},useDebugValue:od,useDeferredValue:function(t,a){var s=Ut();return gt===null?cd(s,t,a):p0(s,gt.memoizedState,t,a)},useTransition:function(){var t=rd($a)[0],a=Ut().memoizedState;return[typeof t=="boolean"?t:Os(t),a]},useSyncExternalStore:Fp,useId:v0,useHostTransitionStatus:dd,useFormState:l0,useActionState:l0,useOptimistic:function(t,a){var s=Ut();return gt!==null?Xp(s,gt,t,a):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:nd,useCacheRefresh:b0};N0.useEffectEvent=o0;function hd(t,a,s,c){a=t.memoizedState,s=s(c,a),s=s==null?a:v({},a,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var pd={enqueueSetState:function(t,a,s){t=t._reactInternals;var c=_n(),p=hr(c);p.payload=a,s!=null&&(p.callback=s),a=pr(t,p,c),a!==null&&(kn(a,t,c),_s(a,t,c))},enqueueReplaceState:function(t,a,s){t=t._reactInternals;var c=_n(),p=hr(c);p.tag=1,p.payload=a,s!=null&&(p.callback=s),a=pr(t,p,c),a!==null&&(kn(a,t,c),_s(a,t,c))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var s=_n(),c=hr(s);c.tag=2,a!=null&&(c.callback=a),a=pr(t,c,s),a!==null&&(kn(a,t,s),_s(a,t,s))}};function C0(t,a,s,c,p,y,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,y,S):a.prototype&&a.prototype.isPureReactComponent?!Ns(s,c)||!Ns(p,y):!0}function T0(t,a,s,c){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(s,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(s,c),a.state!==t&&pd.enqueueReplaceState(a,a.state,null)}function al(t,a){var s=a;if("ref"in a){s={};for(var c in a)c!=="ref"&&(s[c]=a[c])}if(t=t.defaultProps){s===a&&(s=v({},s));for(var p in t)s[p]===void 0&&(s[p]=t[p])}return s}function E0(t){ao(t)}function M0(t){console.error(t)}function A0(t){ao(t)}function To(t,a){try{var s=t.onUncaughtError;s(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function R0(t,a,s){try{var c=t.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function gd(t,a,s){return s=hr(s),s.tag=3,s.payload={element:null},s.callback=function(){To(t,a)},s}function L0(t){return t=hr(t),t.tag=3,t}function _0(t,a,s,c){var p=s.type.getDerivedStateFromError;if(typeof p=="function"){var y=c.value;t.payload=function(){return p(y)},t.callback=function(){R0(a,s,c)}}var S=s.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){R0(a,s,c),typeof p!="function"&&(kr===null?kr=new Set([this]):kr.add(this));var E=c.stack;this.componentDidCatch(c.value,{componentStack:E!==null?E:""})})}function z2(t,a,s,c,p){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=s.alternate,a!==null&&zl(a,s,p,!0),s=Mn.current,s!==null){switch(s.tag){case 31:case 13:return Xn===null?$o():s.alternate===null&&zt===0&&(zt=3),s.flags&=-257,s.flags|=65536,s.lanes=p,c===ho?s.flags|=16384:(a=s.updateQueue,a===null?s.updateQueue=new Set([c]):a.add(c),Hd(t,c,p)),!1;case 22:return s.flags|=65536,c===ho?s.flags|=16384:(a=s.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=a):(s=a.retryQueue,s===null?a.retryQueue=new Set([c]):s.add(c)),Hd(t,c,p)),!1}throw Error(l(435,s.tag))}return Hd(t,c,p),$o(),!1}if(nt)return a=Mn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,c!==zu&&(t=Error(l(422),{cause:c}),Es(Gn(t,s)))):(c!==zu&&(a=Error(l(423),{cause:c}),Es(Gn(a,s))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,c=Gn(c,s),p=gd(t.stateNode,c,p),Gu(t,p),zt!==4&&(zt=2)),!1;var y=Error(l(520),{cause:c});if(y=Gn(y,s),Ks===null?Ks=[y]:Ks.push(y),zt!==4&&(zt=2),a===null)return!0;c=Gn(c,s),s=a;do{switch(s.tag){case 3:return s.flags|=65536,t=p&-p,s.lanes|=t,t=gd(s.stateNode,c,t),Gu(s,t),!1;case 1:if(a=s.type,y=s.stateNode,(s.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(kr===null||!kr.has(y))))return s.flags|=65536,p&=-p,s.lanes|=p,p=L0(p),_0(p,t,s,c),Gu(s,p),!1}s=s.return}while(s!==null);return!1}var xd=Error(l(461)),qt=!1;function an(t,a,s,c){a.child=t===null?Op(a,null,s,c):tl(a,t.child,s,c)}function I0(t,a,s,c,p){s=s.render;var y=a.ref;if("ref"in c){var S={};for(var E in c)E!=="ref"&&(S[E]=c[E])}else S=c;return Qr(a),c=Zu(t,a,s,S,y,p),E=Ju(),t!==null&&!qt?(ed(t,a,p),Ba(t,a,p)):(nt&&E&&_u(a),a.flags|=1,an(t,a,c,p),a.child)}function z0(t,a,s,c,p){if(t===null){var y=s.type;return typeof y=="function"&&!Au(y)&&y.defaultProps===void 0&&s.compare===null?(a.tag=15,a.type=y,D0(t,a,y,c,p)):(t=io(s.type,null,c,a,a.mode,p),t.ref=a.ref,t.return=a,a.child=t)}if(y=t.child,!Nd(t,p)){var S=y.memoizedProps;if(s=s.compare,s=s!==null?s:Ns,s(S,c)&&t.ref===a.ref)return Ba(t,a,p)}return a.flags|=1,t=Ia(y,c),t.ref=a.ref,t.return=a,a.child=t}function D0(t,a,s,c,p){if(t!==null){var y=t.memoizedProps;if(Ns(y,c)&&t.ref===a.ref)if(qt=!1,a.pendingProps=c=y,Nd(t,p))(t.flags&131072)!==0&&(qt=!0);else return a.lanes=t.lanes,Ba(t,a,p)}return yd(t,a,s,c,p)}function O0(t,a,s,c){var p=c.children,y=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|s:s,t!==null){for(c=a.child=t.child,p=0;c!==null;)p=p|c.lanes|c.childLanes,c=c.sibling;c=p&~y}else c=0,a.child=null;return U0(t,a,y,s,c)}if((s&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&fo(a,y!==null?y.cachePool:null),y!==null?Bp(a,y):Wu(),Hp(a);else return c=a.lanes=536870912,U0(t,a,y!==null?y.baseLanes|s:s,s,c)}else y!==null?(fo(a,y.cachePool),Bp(a,y),xr(),a.memoizedState=null):(t!==null&&fo(a,null),Wu(),xr());return an(t,a,p,s),a.child}function Bs(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function U0(t,a,s,c,p){var y=Pu();return y=y===null?null:{parent:Ht._currentValue,pool:y},a.memoizedState={baseLanes:s,cachePool:y},t!==null&&fo(a,null),Wu(),Hp(a),t!==null&&zl(t,a,c,!0),a.childLanes=p,null}function Eo(t,a){return a=Ao({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function $0(t,a,s){return tl(a,t.child,null,s),t=Eo(a,a.pendingProps),t.flags|=2,An(a),a.memoizedState=null,t}function D2(t,a,s){var c=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(nt){if(c.mode==="hidden")return t=Eo(a,c),a.lanes=536870912,Bs(null,t);if(Xu(a),(t=jt)?(t=Qg(t,Yn),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:cr!==null?{id:xa,overflow:ya}:null,retryLane:536870912,hydrationErrors:null},s=wp(t),s.return=a,a.child=s,tn=a,jt=null)):t=null,t===null)throw dr(a);return a.lanes=536870912,null}return Eo(a,c)}var y=t.memoizedState;if(y!==null){var S=y.dehydrated;if(Xu(a),p)if(a.flags&256)a.flags&=-257,a=$0(t,a,s);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(l(558));else if(qt||zl(t,a,s,!1),p=(s&t.childLanes)!==0,qt||p){if(c=kt,c!==null&&(S=bl(c,s),S!==0&&S!==y.retryLane))throw y.retryLane=S,Kr(t,S),kn(c,t,S),xd;$o(),a=$0(t,a,s)}else t=y.treeContext,jt=Qn(S.nextSibling),tn=a,nt=!0,ur=null,Yn=!1,t!==null&&Np(a,t),a=Eo(a,c),a.flags|=4096;return a}return t=Ia(t.child,{mode:c.mode,children:c.children}),t.ref=a.ref,a.child=t,t.return=a,t}function Mo(t,a){var s=a.ref;if(s===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(t===null||t.ref!==s)&&(a.flags|=4194816)}}function yd(t,a,s,c,p){return Qr(a),s=Zu(t,a,s,c,void 0,p),c=Ju(),t!==null&&!qt?(ed(t,a,p),Ba(t,a,p)):(nt&&c&&_u(a),a.flags|=1,an(t,a,s,p),a.child)}function B0(t,a,s,c,p,y){return Qr(a),a.updateQueue=null,s=qp(a,c,s,p),Pp(t),c=Ju(),t!==null&&!qt?(ed(t,a,y),Ba(t,a,y)):(nt&&c&&_u(a),a.flags|=1,an(t,a,s,y),a.child)}function H0(t,a,s,c,p){if(Qr(a),a.stateNode===null){var y=Rl,S=s.contextType;typeof S=="object"&&S!==null&&(y=nn(S)),y=new s(c,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=pd,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=c,y.state=a.memoizedState,y.refs={},Fu(a),S=s.contextType,y.context=typeof S=="object"&&S!==null?nn(S):Rl,y.state=a.memoizedState,S=s.getDerivedStateFromProps,typeof S=="function"&&(hd(a,s,S,c),y.state=a.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&pd.enqueueReplaceState(y,y.state,null),zs(a,c,y,p),Is(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(t===null){y=a.stateNode;var E=a.memoizedProps,P=al(s,E);y.props=P;var Z=y.context,ie=s.contextType;S=Rl,typeof ie=="object"&&ie!==null&&(S=nn(ie));var ue=s.getDerivedStateFromProps;ie=typeof ue=="function"||typeof y.getSnapshotBeforeUpdate=="function",E=a.pendingProps!==E,ie||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E||Z!==S)&&T0(a,y,c,S),mr=!1;var J=a.memoizedState;y.state=J,zs(a,c,y,p),Is(),Z=a.memoizedState,E||J!==Z||mr?(typeof ue=="function"&&(hd(a,s,ue,c),Z=a.memoizedState),(P=mr||C0(a,s,P,c,J,Z,S))?(ie||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=Z),y.props=c,y.state=Z,y.context=S,c=P):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{y=a.stateNode,Vu(t,a),S=a.memoizedProps,ie=al(s,S),y.props=ie,ue=a.pendingProps,J=y.context,Z=s.contextType,P=Rl,typeof Z=="object"&&Z!==null&&(P=nn(Z)),E=s.getDerivedStateFromProps,(Z=typeof E=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==ue||J!==P)&&T0(a,y,c,P),mr=!1,J=a.memoizedState,y.state=J,zs(a,c,y,p),Is();var ae=a.memoizedState;S!==ue||J!==ae||mr||t!==null&&t.dependencies!==null&&co(t.dependencies)?(typeof E=="function"&&(hd(a,s,E,c),ae=a.memoizedState),(ie=mr||C0(a,s,ie,c,J,ae,P)||t!==null&&t.dependencies!==null&&co(t.dependencies))?(Z||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,ae,P),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,ae,P)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=ae),y.props=c,y.state=ae,y.context=P,c=ie):(typeof y.componentDidUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(a.flags|=1024),c=!1)}return y=c,Mo(t,a),c=(a.flags&128)!==0,y||c?(y=a.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,t!==null&&c?(a.child=tl(a,t.child,null,p),a.child=tl(a,null,s,p)):an(t,a,s,p),a.memoizedState=y.state,t=a.child):t=Ba(t,a,p),t}function P0(t,a,s,c){return Yr(),a.flags|=256,an(t,a,s,c),a.child}var vd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bd(t){return{baseLanes:t,cachePool:Rp()}}function kd(t,a,s){return t=t!==null?t.childLanes&~s:0,a&&(t|=Ln),t}function q0(t,a,s){var c=a.pendingProps,p=!1,y=(a.flags&128)!==0,S;if((S=y)||(S=t!==null&&t.memoizedState===null?!1:(Ot.current&2)!==0),S&&(p=!0,a.flags&=-129),S=(a.flags&32)!==0,a.flags&=-33,t===null){if(nt){if(p?gr(a):xr(),(t=jt)?(t=Qg(t,Yn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:cr!==null?{id:xa,overflow:ya}:null,retryLane:536870912,hydrationErrors:null},s=wp(t),s.return=a,a.child=s,tn=a,jt=null)):t=null,t===null)throw dr(a);return af(t)?a.lanes=32:a.lanes=536870912,null}var E=c.children;return c=c.fallback,p?(xr(),p=a.mode,E=Ao({mode:"hidden",children:E},p),c=Wr(c,p,s,null),E.return=a,c.return=a,E.sibling=c,a.child=E,c=a.child,c.memoizedState=bd(s),c.childLanes=kd(t,S,s),a.memoizedState=vd,Bs(null,c)):(gr(a),wd(a,E))}var P=t.memoizedState;if(P!==null&&(E=P.dehydrated,E!==null)){if(y)a.flags&256?(gr(a),a.flags&=-257,a=Sd(t,a,s)):a.memoizedState!==null?(xr(),a.child=t.child,a.flags|=128,a=null):(xr(),E=c.fallback,p=a.mode,c=Ao({mode:"visible",children:c.children},p),E=Wr(E,p,s,null),E.flags|=2,c.return=a,E.return=a,c.sibling=E,a.child=c,tl(a,t.child,null,s),c=a.child,c.memoizedState=bd(s),c.childLanes=kd(t,S,s),a.memoizedState=vd,a=Bs(null,c));else if(gr(a),af(E)){if(S=E.nextSibling&&E.nextSibling.dataset,S)var Z=S.dgst;S=Z,c=Error(l(419)),c.stack="",c.digest=S,Es({value:c,source:null,stack:null}),a=Sd(t,a,s)}else if(qt||zl(t,a,s,!1),S=(s&t.childLanes)!==0,qt||S){if(S=kt,S!==null&&(c=bl(S,s),c!==0&&c!==P.retryLane))throw P.retryLane=c,Kr(t,c),kn(S,t,c),xd;nf(E)||$o(),a=Sd(t,a,s)}else nf(E)?(a.flags|=192,a.child=t.child,a=null):(t=P.treeContext,jt=Qn(E.nextSibling),tn=a,nt=!0,ur=null,Yn=!1,t!==null&&Np(a,t),a=wd(a,c.children),a.flags|=4096);return a}return p?(xr(),E=c.fallback,p=a.mode,P=t.child,Z=P.sibling,c=Ia(P,{mode:"hidden",children:c.children}),c.subtreeFlags=P.subtreeFlags&65011712,Z!==null?E=Ia(Z,E):(E=Wr(E,p,s,null),E.flags|=2),E.return=a,c.return=a,c.sibling=E,a.child=c,Bs(null,c),c=a.child,E=t.child.memoizedState,E===null?E=bd(s):(p=E.cachePool,p!==null?(P=Ht._currentValue,p=p.parent!==P?{parent:P,pool:P}:p):p=Rp(),E={baseLanes:E.baseLanes|s,cachePool:p}),c.memoizedState=E,c.childLanes=kd(t,S,s),a.memoizedState=vd,Bs(t.child,c)):(gr(a),s=t.child,t=s.sibling,s=Ia(s,{mode:"visible",children:c.children}),s.return=a,s.sibling=null,t!==null&&(S=a.deletions,S===null?(a.deletions=[t],a.flags|=16):S.push(t)),a.child=s,a.memoizedState=null,s)}function wd(t,a){return a=Ao({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function Ao(t,a){return t=En(22,t,null,a),t.lanes=0,t}function Sd(t,a,s){return tl(a,t.child,null,s),t=wd(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function F0(t,a,s){t.lanes|=a;var c=t.alternate;c!==null&&(c.lanes|=a),Uu(t.return,a,s)}function jd(t,a,s,c,p,y){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:p,treeForkCount:y}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=s,S.tailMode=p,S.treeForkCount=y)}function V0(t,a,s){var c=a.pendingProps,p=c.revealOrder,y=c.tail;c=c.children;var S=Ot.current,E=(S&2)!==0;if(E?(S=S&1|2,a.flags|=128):S&=1,T(Ot,S),an(t,a,c,s),c=nt?Ts:0,!E&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&F0(t,s,a);else if(t.tag===19)F0(t,s,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(p){case"forwards":for(s=a.child,p=null;s!==null;)t=s.alternate,t!==null&&yo(t)===null&&(p=s),s=s.sibling;s=p,s===null?(p=a.child,a.child=null):(p=s.sibling,s.sibling=null),jd(a,!1,p,s,y,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,p=a.child,a.child=null;p!==null;){if(t=p.alternate,t!==null&&yo(t)===null){a.child=p;break}t=p.sibling,p.sibling=s,s=p,p=t}jd(a,!0,s,null,y,c);break;case"together":jd(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function Ba(t,a,s){if(t!==null&&(a.dependencies=t.dependencies),br|=a.lanes,(s&a.childLanes)===0)if(t!==null){if(zl(t,a,s,!1),(s&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(l(153));if(a.child!==null){for(t=a.child,s=Ia(t,t.pendingProps),a.child=s,s.return=a;t.sibling!==null;)t=t.sibling,s=s.sibling=Ia(t,t.pendingProps),s.return=a;s.sibling=null}return a.child}function Nd(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&co(t)))}function O2(t,a,s){switch(a.tag){case 3:Ce(a,a.stateNode.containerInfo),fr(a,Ht,t.memoizedState.cache),Yr();break;case 27:case 5:me(a);break;case 4:Ce(a,a.stateNode.containerInfo);break;case 10:fr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Xu(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(gr(a),a.flags|=128,null):(s&a.child.childLanes)!==0?q0(t,a,s):(gr(a),t=Ba(t,a,s),t!==null?t.sibling:null);gr(a);break;case 19:var p=(t.flags&128)!==0;if(c=(s&a.childLanes)!==0,c||(zl(t,a,s,!1),c=(s&a.childLanes)!==0),p){if(c)return V0(t,a,s);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),T(Ot,Ot.current),c)break;return null;case 22:return a.lanes=0,O0(t,a,s,a.pendingProps);case 24:fr(a,Ht,t.memoizedState.cache)}return Ba(t,a,s)}function G0(t,a,s){if(t!==null)if(t.memoizedProps!==a.pendingProps)qt=!0;else{if(!Nd(t,s)&&(a.flags&128)===0)return qt=!1,O2(t,a,s);qt=(t.flags&131072)!==0}else qt=!1,nt&&(a.flags&1048576)!==0&&jp(a,Ts,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(t=Jr(a.elementType),a.type=t,typeof t=="function")Au(t)?(c=al(t,c),a.tag=1,a=H0(null,a,t,c,s)):(a.tag=0,a=yd(null,a,t,c,s));else{if(t!=null){var p=t.$$typeof;if(p===$){a.tag=11,a=I0(null,a,t,c,s);break e}else if(p===V){a.tag=14,a=z0(null,a,t,c,s);break e}}throw a=X(t)||t,Error(l(306,a,""))}}return a;case 0:return yd(t,a,a.type,a.pendingProps,s);case 1:return c=a.type,p=al(c,a.pendingProps),H0(t,a,c,p,s);case 3:e:{if(Ce(a,a.stateNode.containerInfo),t===null)throw Error(l(387));c=a.pendingProps;var y=a.memoizedState;p=y.element,Vu(t,a),zs(a,c,null,s);var S=a.memoizedState;if(c=S.cache,fr(a,Ht,c),c!==y.cache&&$u(a,[Ht],s,!0),Is(),c=S.element,y.isDehydrated)if(y={element:c,isDehydrated:!1,cache:S.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=P0(t,a,c,s);break e}else if(c!==p){p=Gn(Error(l(424)),a),Es(p),a=P0(t,a,c,s);break e}else for(t=a.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,jt=Qn(t.firstChild),tn=a,nt=!0,ur=null,Yn=!0,s=Op(a,null,c,s),a.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Yr(),c===p){a=Ba(t,a,s);break e}an(t,a,c,s)}a=a.child}return a;case 26:return Mo(t,a),t===null?(s=ax(a.type,null,a.pendingProps,null))?a.memoizedState=s:nt||(s=a.type,t=a.pendingProps,c=Go(fe.current).createElement(s),c[Wt]=a,c[cn]=t,rn(c,s,t),Xt(c),a.stateNode=c):a.memoizedState=ax(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return me(a),t===null&&nt&&(c=a.stateNode=ex(a.type,a.pendingProps,fe.current),tn=a,Yn=!0,p=jt,Nr(a.type)?(rf=p,jt=Qn(c.firstChild)):jt=p),an(t,a,a.pendingProps.children,s),Mo(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&nt&&((p=c=jt)&&(c=mw(c,a.type,a.pendingProps,Yn),c!==null?(a.stateNode=c,tn=a,jt=Qn(c.firstChild),Yn=!1,p=!0):p=!1),p||dr(a)),me(a),p=a.type,y=a.pendingProps,S=t!==null?t.memoizedProps:null,c=y.children,Jd(p,y)?c=null:S!==null&&Jd(p,S)&&(a.flags|=32),a.memoizedState!==null&&(p=Zu(t,a,E2,null,null,s),ti._currentValue=p),Mo(t,a),an(t,a,c,s),a.child;case 6:return t===null&&nt&&((t=s=jt)&&(s=hw(s,a.pendingProps,Yn),s!==null?(a.stateNode=s,tn=a,jt=null,t=!0):t=!1),t||dr(a)),null;case 13:return q0(t,a,s);case 4:return Ce(a,a.stateNode.containerInfo),c=a.pendingProps,t===null?a.child=tl(a,null,c,s):an(t,a,c,s),a.child;case 11:return I0(t,a,a.type,a.pendingProps,s);case 7:return an(t,a,a.pendingProps,s),a.child;case 8:return an(t,a,a.pendingProps.children,s),a.child;case 12:return an(t,a,a.pendingProps.children,s),a.child;case 10:return c=a.pendingProps,fr(a,a.type,c.value),an(t,a,c.children,s),a.child;case 9:return p=a.type._context,c=a.pendingProps.children,Qr(a),p=nn(p),c=c(p),a.flags|=1,an(t,a,c,s),a.child;case 14:return z0(t,a,a.type,a.pendingProps,s);case 15:return D0(t,a,a.type,a.pendingProps,s);case 19:return V0(t,a,s);case 31:return D2(t,a,s);case 22:return O0(t,a,s,a.pendingProps);case 24:return Qr(a),c=nn(Ht),t===null?(p=Pu(),p===null&&(p=kt,y=Bu(),p.pooledCache=y,y.refCount++,y!==null&&(p.pooledCacheLanes|=s),p=y),a.memoizedState={parent:c,cache:p},Fu(a),fr(a,Ht,p)):((t.lanes&s)!==0&&(Vu(t,a),zs(a,null,null,s),Is()),p=t.memoizedState,y=a.memoizedState,p.parent!==c?(p={parent:c,cache:c},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),fr(a,Ht,c)):(c=y.cache,fr(a,Ht,c),c!==p.cache&&$u(a,[Ht],s,!0))),an(t,a,a.pendingProps.children,s),a.child;case 29:throw a.pendingProps}throw Error(l(156,a.tag))}function Ha(t){t.flags|=4}function Cd(t,a,s,c,p){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(p&335544128)===p)if(t.stateNode.complete)t.flags|=8192;else if(vg())t.flags|=8192;else throw el=ho,qu}else t.flags&=-16777217}function K0(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!ox(a))if(vg())t.flags|=8192;else throw el=ho,qu}function Ro(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?oa():536870912,t.lanes|=a,Kl|=a)}function Hs(t,a){if(!nt)switch(t.tailMode){case"hidden":a=t.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function Nt(t){var a=t.alternate!==null&&t.alternate.child===t.child,s=0,c=0;if(a)for(var p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags&65011712,c|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=c,t.childLanes=s,a}function U2(t,a,s){var c=a.pendingProps;switch(Iu(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nt(a),null;case 1:return Nt(a),null;case 3:return s=a.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Oa(Ht),ne(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Il(a)?Ha(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Du())),Nt(a),null;case 26:var p=a.type,y=a.memoizedState;return t===null?(Ha(a),y!==null?(Nt(a),K0(a,y)):(Nt(a),Cd(a,p,null,c,s))):y?y!==t.memoizedState?(Ha(a),Nt(a),K0(a,y)):(Nt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==c&&Ha(a),Nt(a),Cd(a,p,t,c,s)),null;case 27:if(be(a),s=fe.current,p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==c&&Ha(a);else{if(!c){if(a.stateNode===null)throw Error(l(166));return Nt(a),null}t=re.current,Il(a)?Cp(a):(t=ex(p,c,s),a.stateNode=t,Ha(a))}return Nt(a),null;case 5:if(be(a),p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==c&&Ha(a);else{if(!c){if(a.stateNode===null)throw Error(l(166));return Nt(a),null}if(y=re.current,Il(a))Cp(a);else{var S=Go(fe.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof c.is=="string"?S.createElement("select",{is:c.is}):S.createElement("select"),c.multiple?y.multiple=!0:c.size&&(y.size=c.size);break;default:y=typeof c.is=="string"?S.createElement(p,{is:c.is}):S.createElement(p)}}y[Wt]=a,y[cn]=c;e:for(S=a.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===a)break e;for(;S.sibling===null;){if(S.return===null||S.return===a)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}a.stateNode=y;e:switch(rn(y,p,c),p){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Ha(a)}}return Nt(a),Cd(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,s),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==c&&Ha(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(l(166));if(t=fe.current,Il(a)){if(t=a.stateNode,s=a.memoizedProps,c=null,p=tn,p!==null)switch(p.tag){case 27:case 5:c=p.memoizedProps}t[Wt]=a,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||qg(t.nodeValue,s)),t||dr(a,!0)}else t=Go(t).createTextNode(c),t[Wt]=a,a.stateNode=t}return Nt(a),null;case 31:if(s=a.memoizedState,t===null||t.memoizedState!==null){if(c=Il(a),s!==null){if(t===null){if(!c)throw Error(l(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Wt]=a}else Yr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Nt(a),t=!1}else s=Du(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return a.flags&256?(An(a),a):(An(a),null);if((a.flags&128)!==0)throw Error(l(558))}return Nt(a),null;case 13:if(c=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=Il(a),c!==null&&c.dehydrated!==null){if(t===null){if(!p)throw Error(l(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(l(317));p[Wt]=a}else Yr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Nt(a),p=!1}else p=Du(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(An(a),a):(An(a),null)}return An(a),(a.flags&128)!==0?(a.lanes=s,a):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=a.child,p=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(p=c.alternate.memoizedState.cachePool.pool),y=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(y=c.memoizedState.cachePool.pool),y!==p&&(c.flags|=2048)),s!==t&&s&&(a.child.flags|=8192),Ro(a,a.updateQueue),Nt(a),null);case 4:return ne(),t===null&&Wd(a.stateNode.containerInfo),Nt(a),null;case 10:return Oa(a.type),Nt(a),null;case 19:if(B(Ot),c=a.memoizedState,c===null)return Nt(a),null;if(p=(a.flags&128)!==0,y=c.rendering,y===null)if(p)Hs(c,!1);else{if(zt!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(y=yo(t),y!==null){for(a.flags|=128,Hs(c,!1),t=y.updateQueue,a.updateQueue=t,Ro(a,t),a.subtreeFlags=0,t=s,s=a.child;s!==null;)kp(s,t),s=s.sibling;return T(Ot,Ot.current&1|2),nt&&za(a,c.treeForkCount),a.child}t=t.sibling}c.tail!==null&&bt()>Do&&(a.flags|=128,p=!0,Hs(c,!1),a.lanes=4194304)}else{if(!p)if(t=yo(y),t!==null){if(a.flags|=128,p=!0,t=t.updateQueue,a.updateQueue=t,Ro(a,t),Hs(c,!0),c.tail===null&&c.tailMode==="hidden"&&!y.alternate&&!nt)return Nt(a),null}else 2*bt()-c.renderingStartTime>Do&&s!==536870912&&(a.flags|=128,p=!0,Hs(c,!1),a.lanes=4194304);c.isBackwards?(y.sibling=a.child,a.child=y):(t=c.last,t!==null?t.sibling=y:a.child=y,c.last=y)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=bt(),t.sibling=null,s=Ot.current,T(Ot,p?s&1|2:s&1),nt&&za(a,c.treeForkCount),t):(Nt(a),null);case 22:case 23:return An(a),Yu(),c=a.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(s&536870912)!==0&&(a.flags&128)===0&&(Nt(a),a.subtreeFlags&6&&(a.flags|=8192)):Nt(a),s=a.updateQueue,s!==null&&Ro(a,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==s&&(a.flags|=2048),t!==null&&B(Zr),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),Oa(Ht),Nt(a),null;case 25:return null;case 30:return null}throw Error(l(156,a.tag))}function $2(t,a){switch(Iu(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return Oa(Ht),ne(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return be(a),null;case 31:if(a.memoizedState!==null){if(An(a),a.alternate===null)throw Error(l(340));Yr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(An(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(l(340));Yr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return B(Ot),null;case 4:return ne(),null;case 10:return Oa(a.type),null;case 22:case 23:return An(a),Yu(),t!==null&&B(Zr),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return Oa(Ht),null;case 25:return null;default:return null}}function W0(t,a){switch(Iu(a),a.tag){case 3:Oa(Ht),ne();break;case 26:case 27:case 5:be(a);break;case 4:ne();break;case 31:a.memoizedState!==null&&An(a);break;case 13:An(a);break;case 19:B(Ot);break;case 10:Oa(a.type);break;case 22:case 23:An(a),Yu(),t!==null&&B(Zr);break;case 24:Oa(Ht)}}function Ps(t,a){try{var s=a.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var p=c.next;s=p;do{if((s.tag&t)===t){c=void 0;var y=s.create,S=s.inst;c=y(),S.destroy=c}s=s.next}while(s!==p)}}catch(E){ht(a,a.return,E)}}function yr(t,a,s){try{var c=a.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var y=p.next;c=y;do{if((c.tag&t)===t){var S=c.inst,E=S.destroy;if(E!==void 0){S.destroy=void 0,p=a;var P=s,Z=E;try{Z()}catch(ie){ht(p,P,ie)}}}c=c.next}while(c!==y)}}catch(ie){ht(a,a.return,ie)}}function Y0(t){var a=t.updateQueue;if(a!==null){var s=t.stateNode;try{$p(a,s)}catch(c){ht(t,t.return,c)}}}function X0(t,a,s){s.props=al(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){ht(t,a,c)}}function qs(t,a){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof s=="function"?t.refCleanup=s(c):s.current=c}}catch(p){ht(t,a,p)}}function va(t,a){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(p){ht(t,a,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(p){ht(t,a,p)}else s.current=null}function Q0(t){var a=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(p){ht(t,t.return,p)}}function Td(t,a,s){try{var c=t.stateNode;iw(c,t.type,s,a),c[cn]=a}catch(p){ht(t,t.return,p)}}function Z0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Nr(t.type)||t.tag===4}function Ed(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Z0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Nr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Md(t,a,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,a):(a=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.appendChild(t),s=s._reactRootContainer,s!=null||a.onclick!==null||(a.onclick=La));else if(c!==4&&(c===27&&Nr(t.type)&&(s=t.stateNode,a=null),t=t.child,t!==null))for(Md(t,a,s),t=t.sibling;t!==null;)Md(t,a,s),t=t.sibling}function Lo(t,a,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?s.insertBefore(t,a):s.appendChild(t);else if(c!==4&&(c===27&&Nr(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(Lo(t,a,s),t=t.sibling;t!==null;)Lo(t,a,s),t=t.sibling}function J0(t){var a=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);rn(a,c,s),a[Wt]=t,a[cn]=s}catch(y){ht(t,t.return,y)}}var Pa=!1,Ft=!1,Ad=!1,eg=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function B2(t,a){if(t=t.containerInfo,Qd=Jo,t=fp(t),Su(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var p=c.anchorOffset,y=c.focusNode;c=c.focusOffset;try{s.nodeType,y.nodeType}catch{s=null;break e}var S=0,E=-1,P=-1,Z=0,ie=0,ue=t,J=null;t:for(;;){for(var ae;ue!==s||p!==0&&ue.nodeType!==3||(E=S+p),ue!==y||c!==0&&ue.nodeType!==3||(P=S+c),ue.nodeType===3&&(S+=ue.nodeValue.length),(ae=ue.firstChild)!==null;)J=ue,ue=ae;for(;;){if(ue===t)break t;if(J===s&&++Z===p&&(E=S),J===y&&++ie===c&&(P=S),(ae=ue.nextSibling)!==null)break;ue=J,J=ue.parentNode}ue=ae}s=E===-1||P===-1?null:{start:E,end:P}}else s=null}s=s||{start:0,end:0}}else s=null;for(Zd={focusedElem:t,selectionRange:s},Jo=!1,Qt=a;Qt!==null;)if(a=Qt,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,Qt=t;else for(;Qt!==null;){switch(a=Qt,y=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)p=t[s],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,s=a,p=y.memoizedProps,y=y.memoizedState,c=s.stateNode;try{var Ne=al(s.type,p);t=c.getSnapshotBeforeUpdate(Ne,y),c.__reactInternalSnapshotBeforeUpdate=t}catch(Le){ht(s,s.return,Le)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,s=t.nodeType,s===9)tf(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":tf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(l(163))}if(t=a.sibling,t!==null){t.return=a.return,Qt=t;break}Qt=a.return}}function tg(t,a,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:Fa(t,s),c&4&&Ps(5,s);break;case 1:if(Fa(t,s),c&4)if(t=s.stateNode,a===null)try{t.componentDidMount()}catch(S){ht(s,s.return,S)}else{var p=al(s.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(p,a,t.__reactInternalSnapshotBeforeUpdate)}catch(S){ht(s,s.return,S)}}c&64&&Y0(s),c&512&&qs(s,s.return);break;case 3:if(Fa(t,s),c&64&&(t=s.updateQueue,t!==null)){if(a=null,s.child!==null)switch(s.child.tag){case 27:case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}try{$p(t,a)}catch(S){ht(s,s.return,S)}}break;case 27:a===null&&c&4&&J0(s);case 26:case 5:Fa(t,s),a===null&&c&4&&Q0(s),c&512&&qs(s,s.return);break;case 12:Fa(t,s);break;case 31:Fa(t,s),c&4&&rg(t,s);break;case 13:Fa(t,s),c&4&&lg(t,s),c&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=Y2.bind(null,s),pw(t,s))));break;case 22:if(c=s.memoizedState!==null||Pa,!c){a=a!==null&&a.memoizedState!==null||Ft,p=Pa;var y=Ft;Pa=c,(Ft=a)&&!y?Va(t,s,(s.subtreeFlags&8772)!==0):Fa(t,s),Pa=p,Ft=y}break;case 30:break;default:Fa(t,s)}}function ng(t){var a=t.alternate;a!==null&&(t.alternate=null,ng(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&Bt(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Et=null,xn=!1;function qa(t,a,s){for(s=s.child;s!==null;)ag(t,a,s),s=s.sibling}function ag(t,a,s){if(et&&typeof et.onCommitFiberUnmount=="function")try{et.onCommitFiberUnmount(Ve,s)}catch{}switch(s.tag){case 26:Ft||va(s,a),qa(t,a,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Ft||va(s,a);var c=Et,p=xn;Nr(s.type)&&(Et=s.stateNode,xn=!1),qa(t,a,s),Zs(s.stateNode),Et=c,xn=p;break;case 5:Ft||va(s,a);case 6:if(c=Et,p=xn,Et=null,qa(t,a,s),Et=c,xn=p,Et!==null)if(xn)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(s.stateNode)}catch(y){ht(s,a,y)}else try{Et.removeChild(s.stateNode)}catch(y){ht(s,a,y)}break;case 18:Et!==null&&(xn?(t=Et,Yg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),ts(t)):Yg(Et,s.stateNode));break;case 4:c=Et,p=xn,Et=s.stateNode.containerInfo,xn=!0,qa(t,a,s),Et=c,xn=p;break;case 0:case 11:case 14:case 15:yr(2,s,a),Ft||yr(4,s,a),qa(t,a,s);break;case 1:Ft||(va(s,a),c=s.stateNode,typeof c.componentWillUnmount=="function"&&X0(s,a,c)),qa(t,a,s);break;case 21:qa(t,a,s);break;case 22:Ft=(c=Ft)||s.memoizedState!==null,qa(t,a,s),Ft=c;break;default:qa(t,a,s)}}function rg(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ts(t)}catch(s){ht(a,a.return,s)}}}function lg(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ts(t)}catch(s){ht(a,a.return,s)}}function H2(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new eg),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new eg),a;default:throw Error(l(435,t.tag))}}function _o(t,a){var s=H2(t);a.forEach(function(c){if(!s.has(c)){s.add(c);var p=X2.bind(null,t,c);c.then(p,p)}})}function yn(t,a){var s=a.deletions;if(s!==null)for(var c=0;c<s.length;c++){var p=s[c],y=t,S=a,E=S;e:for(;E!==null;){switch(E.tag){case 27:if(Nr(E.type)){Et=E.stateNode,xn=!1;break e}break;case 5:Et=E.stateNode,xn=!1;break e;case 3:case 4:Et=E.stateNode.containerInfo,xn=!0;break e}E=E.return}if(Et===null)throw Error(l(160));ag(y,S,p),Et=null,xn=!1,y=p.alternate,y!==null&&(y.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)sg(a,t),a=a.sibling}var ua=null;function sg(t,a){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:yn(a,t),vn(t),c&4&&(yr(3,t,t.return),Ps(3,t),yr(5,t,t.return));break;case 1:yn(a,t),vn(t),c&512&&(Ft||s===null||va(s,s.return)),c&64&&Pa&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var p=ua;if(yn(a,t),vn(t),c&512&&(Ft||s===null||va(s,s.return)),c&4){var y=s!==null?s.memoizedState:null;if(c=t.memoizedState,s===null)if(c===null)if(t.stateNode===null){e:{c=t.type,s=t.memoizedProps,p=p.ownerDocument||p;t:switch(c){case"title":y=p.getElementsByTagName("title")[0],(!y||y[ct]||y[Wt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=p.createElement(c),p.head.insertBefore(y,p.querySelector("head > title"))),rn(y,c,s),y[Wt]=t,Xt(y),c=y;break e;case"link":var S=sx("link","href",p).get(c+(s.href||""));if(S){for(var E=0;E<S.length;E++)if(y=S[E],y.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&y.getAttribute("rel")===(s.rel==null?null:s.rel)&&y.getAttribute("title")===(s.title==null?null:s.title)&&y.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){S.splice(E,1);break t}}y=p.createElement(c),rn(y,c,s),p.head.appendChild(y);break;case"meta":if(S=sx("meta","content",p).get(c+(s.content||""))){for(E=0;E<S.length;E++)if(y=S[E],y.getAttribute("content")===(s.content==null?null:""+s.content)&&y.getAttribute("name")===(s.name==null?null:s.name)&&y.getAttribute("property")===(s.property==null?null:s.property)&&y.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&y.getAttribute("charset")===(s.charSet==null?null:s.charSet)){S.splice(E,1);break t}}y=p.createElement(c),rn(y,c,s),p.head.appendChild(y);break;default:throw Error(l(468,c))}y[Wt]=t,Xt(y),c=y}t.stateNode=c}else ix(p,t.type,t.stateNode);else t.stateNode=lx(p,c,t.memoizedProps);else y!==c?(y===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):y.count--,c===null?ix(p,t.type,t.stateNode):lx(p,c,t.memoizedProps)):c===null&&t.stateNode!==null&&Td(t,t.memoizedProps,s.memoizedProps)}break;case 27:yn(a,t),vn(t),c&512&&(Ft||s===null||va(s,s.return)),s!==null&&c&4&&Td(t,t.memoizedProps,s.memoizedProps);break;case 5:if(yn(a,t),vn(t),c&512&&(Ft||s===null||va(s,s.return)),t.flags&32){p=t.stateNode;try{jl(p,"")}catch(Ne){ht(t,t.return,Ne)}}c&4&&t.stateNode!=null&&(p=t.memoizedProps,Td(t,p,s!==null?s.memoizedProps:p)),c&1024&&(Ad=!0);break;case 6:if(yn(a,t),vn(t),c&4){if(t.stateNode===null)throw Error(l(162));c=t.memoizedProps,s=t.stateNode;try{s.nodeValue=c}catch(Ne){ht(t,t.return,Ne)}}break;case 3:if(Yo=null,p=ua,ua=Ko(a.containerInfo),yn(a,t),ua=p,vn(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{ts(a.containerInfo)}catch(Ne){ht(t,t.return,Ne)}Ad&&(Ad=!1,ig(t));break;case 4:c=ua,ua=Ko(t.stateNode.containerInfo),yn(a,t),vn(t),ua=c;break;case 12:yn(a,t),vn(t);break;case 31:yn(a,t),vn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,_o(t,c)));break;case 13:yn(a,t),vn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(zo=bt()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,_o(t,c)));break;case 22:p=t.memoizedState!==null;var P=s!==null&&s.memoizedState!==null,Z=Pa,ie=Ft;if(Pa=Z||p,Ft=ie||P,yn(a,t),Ft=ie,Pa=Z,vn(t),c&8192)e:for(a=t.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(s===null||P||Pa||Ft||rl(t)),s=null,a=t;;){if(a.tag===5||a.tag===26){if(s===null){P=s=a;try{if(y=P.stateNode,p)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{E=P.stateNode;var ue=P.memoizedProps.style,J=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;E.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(Ne){ht(P,P.return,Ne)}}}else if(a.tag===6){if(s===null){P=a;try{P.stateNode.nodeValue=p?"":P.memoizedProps}catch(Ne){ht(P,P.return,Ne)}}}else if(a.tag===18){if(s===null){P=a;try{var ae=P.stateNode;p?Xg(ae,!0):Xg(P.stateNode,!1)}catch(Ne){ht(P,P.return,Ne)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;s===a&&(s=null),a=a.return}s===a&&(s=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=t.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,_o(t,s))));break;case 19:yn(a,t),vn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,_o(t,c)));break;case 30:break;case 21:break;default:yn(a,t),vn(t)}}function vn(t){var a=t.flags;if(a&2){try{for(var s,c=t.return;c!==null;){if(Z0(c)){s=c;break}c=c.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var p=s.stateNode,y=Ed(t);Lo(t,y,p);break;case 5:var S=s.stateNode;s.flags&32&&(jl(S,""),s.flags&=-33);var E=Ed(t);Lo(t,E,S);break;case 3:case 4:var P=s.stateNode.containerInfo,Z=Ed(t);Md(t,Z,P);break;default:throw Error(l(161))}}catch(ie){ht(t,t.return,ie)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function ig(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;ig(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Fa(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)tg(t,a.alternate,a),a=a.sibling}function rl(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:yr(4,a,a.return),rl(a);break;case 1:va(a,a.return);var s=a.stateNode;typeof s.componentWillUnmount=="function"&&X0(a,a.return,s),rl(a);break;case 27:Zs(a.stateNode);case 26:case 5:va(a,a.return),rl(a);break;case 22:a.memoizedState===null&&rl(a);break;case 30:rl(a);break;default:rl(a)}t=t.sibling}}function Va(t,a,s){for(s=s&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,p=t,y=a,S=y.flags;switch(y.tag){case 0:case 11:case 15:Va(p,y,s),Ps(4,y);break;case 1:if(Va(p,y,s),c=y,p=c.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(Z){ht(c,c.return,Z)}if(c=y,p=c.updateQueue,p!==null){var E=c.stateNode;try{var P=p.shared.hiddenCallbacks;if(P!==null)for(p.shared.hiddenCallbacks=null,p=0;p<P.length;p++)Up(P[p],E)}catch(Z){ht(c,c.return,Z)}}s&&S&64&&Y0(y),qs(y,y.return);break;case 27:J0(y);case 26:case 5:Va(p,y,s),s&&c===null&&S&4&&Q0(y),qs(y,y.return);break;case 12:Va(p,y,s);break;case 31:Va(p,y,s),s&&S&4&&rg(p,y);break;case 13:Va(p,y,s),s&&S&4&&lg(p,y);break;case 22:y.memoizedState===null&&Va(p,y,s),qs(y,y.return);break;case 30:break;default:Va(p,y,s)}a=a.sibling}}function Rd(t,a){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Ms(s))}function Ld(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Ms(t))}function da(t,a,s,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)og(t,a,s,c),a=a.sibling}function og(t,a,s,c){var p=a.flags;switch(a.tag){case 0:case 11:case 15:da(t,a,s,c),p&2048&&Ps(9,a);break;case 1:da(t,a,s,c);break;case 3:da(t,a,s,c),p&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Ms(t)));break;case 12:if(p&2048){da(t,a,s,c),t=a.stateNode;try{var y=a.memoizedProps,S=y.id,E=y.onPostCommit;typeof E=="function"&&E(S,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(P){ht(a,a.return,P)}}else da(t,a,s,c);break;case 31:da(t,a,s,c);break;case 13:da(t,a,s,c);break;case 23:break;case 22:y=a.stateNode,S=a.alternate,a.memoizedState!==null?y._visibility&2?da(t,a,s,c):Fs(t,a):y._visibility&2?da(t,a,s,c):(y._visibility|=2,Fl(t,a,s,c,(a.subtreeFlags&10256)!==0||!1)),p&2048&&Rd(S,a);break;case 24:da(t,a,s,c),p&2048&&Ld(a.alternate,a);break;default:da(t,a,s,c)}}function Fl(t,a,s,c,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=t,S=a,E=s,P=c,Z=S.flags;switch(S.tag){case 0:case 11:case 15:Fl(y,S,E,P,p),Ps(8,S);break;case 23:break;case 22:var ie=S.stateNode;S.memoizedState!==null?ie._visibility&2?Fl(y,S,E,P,p):Fs(y,S):(ie._visibility|=2,Fl(y,S,E,P,p)),p&&Z&2048&&Rd(S.alternate,S);break;case 24:Fl(y,S,E,P,p),p&&Z&2048&&Ld(S.alternate,S);break;default:Fl(y,S,E,P,p)}a=a.sibling}}function Fs(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var s=t,c=a,p=c.flags;switch(c.tag){case 22:Fs(s,c),p&2048&&Rd(c.alternate,c);break;case 24:Fs(s,c),p&2048&&Ld(c.alternate,c);break;default:Fs(s,c)}a=a.sibling}}var Vs=8192;function Vl(t,a,s){if(t.subtreeFlags&Vs)for(t=t.child;t!==null;)cg(t,a,s),t=t.sibling}function cg(t,a,s){switch(t.tag){case 26:Vl(t,a,s),t.flags&Vs&&t.memoizedState!==null&&Tw(s,ua,t.memoizedState,t.memoizedProps);break;case 5:Vl(t,a,s);break;case 3:case 4:var c=ua;ua=Ko(t.stateNode.containerInfo),Vl(t,a,s),ua=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=Vs,Vs=16777216,Vl(t,a,s),Vs=c):Vl(t,a,s));break;default:Vl(t,a,s)}}function ug(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function Gs(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var c=a[s];Qt=c,fg(c,t)}ug(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)dg(t),t=t.sibling}function dg(t){switch(t.tag){case 0:case 11:case 15:Gs(t),t.flags&2048&&yr(9,t,t.return);break;case 3:Gs(t);break;case 12:Gs(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Io(t)):Gs(t);break;default:Gs(t)}}function Io(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var c=a[s];Qt=c,fg(c,t)}ug(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:yr(8,a,a.return),Io(a);break;case 22:s=a.stateNode,s._visibility&2&&(s._visibility&=-3,Io(a));break;default:Io(a)}t=t.sibling}}function fg(t,a){for(;Qt!==null;){var s=Qt;switch(s.tag){case 0:case 11:case 15:yr(8,s,a);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Ms(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,Qt=c;else e:for(s=t;Qt!==null;){c=Qt;var p=c.sibling,y=c.return;if(ng(c),c===s){Qt=null;break e}if(p!==null){p.return=y,Qt=p;break e}Qt=y}}}var P2={getCacheForType:function(t){var a=nn(Ht),s=a.data.get(t);return s===void 0&&(s=t(),a.data.set(t,s)),s},cacheSignal:function(){return nn(Ht).controller.signal}},q2=typeof WeakMap=="function"?WeakMap:Map,ut=0,kt=null,Ge=null,Qe=0,mt=0,Rn=null,vr=!1,Gl=!1,_d=!1,Ga=0,zt=0,br=0,ll=0,Id=0,Ln=0,Kl=0,Ks=null,bn=null,zd=!1,zo=0,mg=0,Do=1/0,Oo=null,kr=null,Yt=0,wr=null,Wl=null,Ka=0,Dd=0,Od=null,hg=null,Ws=0,Ud=null;function _n(){return(ut&2)!==0&&Qe!==0?Qe&-Qe:D.T!==null?Fd():Gi()}function pg(){if(Ln===0)if((Qe&536870912)===0||nt){var t=ar;ar<<=1,(ar&3932160)===0&&(ar=262144),Ln=t}else Ln=536870912;return t=Mn.current,t!==null&&(t.flags|=32),Ln}function kn(t,a,s){(t===kt&&(mt===2||mt===9)||t.cancelPendingCommit!==null)&&(Yl(t,0),Sr(t,Qe,Ln,!1)),rr(t,s),((ut&2)===0||t!==kt)&&(t===kt&&((ut&2)===0&&(ll|=s),zt===4&&Sr(t,Qe,Ln,!1)),ba(t))}function gg(t,a,s){if((ut&6)!==0)throw Error(l(327));var c=!s&&(a&127)===0&&(a&t.expiredLanes)===0||dt(t,a),p=c?G2(t,a):Bd(t,a,!0),y=c;do{if(p===0){Gl&&!c&&Sr(t,a,0,!1);break}else{if(s=t.current.alternate,y&&!F2(s)){p=Bd(t,a,!1),y=!1;continue}if(p===2){if(y=a,t.errorRecoveryDisabledLanes&y)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){a=S;e:{var E=t;p=Ks;var P=E.current.memoizedState.isDehydrated;if(P&&(Yl(E,S).flags|=256),S=Bd(E,S,!1),S!==2){if(_d&&!P){E.errorRecoveryDisabledLanes|=y,ll|=y,p=4;break e}y=bn,bn=p,y!==null&&(bn===null?bn=y:bn.push.apply(bn,y))}p=S}if(y=!1,p!==2)continue}}if(p===1){Yl(t,0),Sr(t,a,0,!0);break}e:{switch(c=t,y=p,y){case 0:case 1:throw Error(l(345));case 4:if((a&4194048)!==a)break;case 6:Sr(c,a,Ln,!vr);break e;case 2:bn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((a&62914560)===a&&(p=zo+300-bt(),10<p)){if(Sr(c,a,Ln,!vr),Oe(c,0,!0)!==0)break e;Ka=a,c.timeoutHandle=Kg(xg.bind(null,c,s,bn,Oo,zd,a,Ln,ll,Kl,vr,y,"Throttled",-0,0),p);break e}xg(c,s,bn,Oo,zd,a,Ln,ll,Kl,vr,y,null,-0,0)}}break}while(!0);ba(t)}function xg(t,a,s,c,p,y,S,E,P,Z,ie,ue,J,ae){if(t.timeoutHandle=-1,ue=a.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:La},cg(a,y,ue);var Ne=(y&62914560)===y?zo-bt():(y&4194048)===y?mg-bt():0;if(Ne=Ew(ue,Ne),Ne!==null){Ka=y,t.cancelPendingCommit=Ne(Ng.bind(null,t,a,y,s,c,p,S,E,P,ie,ue,null,J,ae)),Sr(t,y,S,!Z);return}}Ng(t,a,y,s,c,p,S,E,P)}function F2(t){for(var a=t;;){var s=a.tag;if((s===0||s===11||s===15)&&a.flags&16384&&(s=a.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var p=s[c],y=p.getSnapshot;p=p.value;try{if(!Tn(y(),p))return!1}catch{return!1}}if(s=a.child,a.subtreeFlags&16384&&s!==null)s.return=a,a=s;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Sr(t,a,s,c){a&=~Id,a&=~ll,t.suspendedLanes|=a,t.pingedLanes&=~a,c&&(t.warmLanes|=a),c=t.expirationTimes;for(var p=a;0<p;){var y=31-tt(p),S=1<<y;c[y]=-1,p&=~S}s!==0&&Fi(t,s,a)}function Uo(){return(ut&6)===0?(Ys(0),!1):!0}function $d(){if(Ge!==null){if(mt===0)var t=Ge.return;else t=Ge,Da=Xr=null,td(t),$l=null,Rs=0,t=Ge;for(;t!==null;)W0(t.alternate,t),t=t.return;Ge=null}}function Yl(t,a){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,uw(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Ka=0,$d(),kt=t,Ge=s=Ia(t.current,null),Qe=a,mt=0,Rn=null,vr=!1,Gl=dt(t,a),_d=!1,Kl=Ln=Id=ll=br=zt=0,bn=Ks=null,zd=!1,(a&8)!==0&&(a|=a&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=a;0<c;){var p=31-tt(c),y=1<<p;a|=t[p],c&=~y}return Ga=a,ro(),s}function yg(t,a){Pe=null,D.H=$s,a===Ul||a===mo?(a=Ip(),mt=3):a===qu?(a=Ip(),mt=4):mt=a===xd?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Rn=a,Ge===null&&(zt=1,To(t,Gn(a,t.current)))}function vg(){var t=Mn.current;return t===null?!0:(Qe&4194048)===Qe?Xn===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?t===Xn:!1}function bg(){var t=D.H;return D.H=$s,t===null?$s:t}function kg(){var t=D.A;return D.A=P2,t}function $o(){zt=4,vr||(Qe&4194048)!==Qe&&Mn.current!==null||(Gl=!0),(br&134217727)===0&&(ll&134217727)===0||kt===null||Sr(kt,Qe,Ln,!1)}function Bd(t,a,s){var c=ut;ut|=2;var p=bg(),y=kg();(kt!==t||Qe!==a)&&(Oo=null,Yl(t,a)),a=!1;var S=zt;e:do try{if(mt!==0&&Ge!==null){var E=Ge,P=Rn;switch(mt){case 8:$d(),S=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(a=!0);var Z=mt;if(mt=0,Rn=null,Xl(t,E,P,Z),s&&Gl){S=0;break e}break;default:Z=mt,mt=0,Rn=null,Xl(t,E,P,Z)}}V2(),S=zt;break}catch(ie){yg(t,ie)}while(!0);return a&&t.shellSuspendCounter++,Da=Xr=null,ut=c,D.H=p,D.A=y,Ge===null&&(kt=null,Qe=0,ro()),S}function V2(){for(;Ge!==null;)wg(Ge)}function G2(t,a){var s=ut;ut|=2;var c=bg(),p=kg();kt!==t||Qe!==a?(Oo=null,Do=bt()+500,Yl(t,a)):Gl=dt(t,a);e:do try{if(mt!==0&&Ge!==null){a=Ge;var y=Rn;t:switch(mt){case 1:mt=0,Rn=null,Xl(t,a,y,1);break;case 2:case 9:if(Lp(y)){mt=0,Rn=null,Sg(a);break}a=function(){mt!==2&&mt!==9||kt!==t||(mt=7),ba(t)},y.then(a,a);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:Lp(y)?(mt=0,Rn=null,Sg(a)):(mt=0,Rn=null,Xl(t,a,y,7));break;case 5:var S=null;switch(Ge.tag){case 26:S=Ge.memoizedState;case 5:case 27:var E=Ge;if(S?ox(S):E.stateNode.complete){mt=0,Rn=null;var P=E.sibling;if(P!==null)Ge=P;else{var Z=E.return;Z!==null?(Ge=Z,Bo(Z)):Ge=null}break t}}mt=0,Rn=null,Xl(t,a,y,5);break;case 6:mt=0,Rn=null,Xl(t,a,y,6);break;case 8:$d(),zt=6;break e;default:throw Error(l(462))}}K2();break}catch(ie){yg(t,ie)}while(!0);return Da=Xr=null,D.H=c,D.A=p,ut=s,Ge!==null?0:(kt=null,Qe=0,ro(),zt)}function K2(){for(;Ge!==null&&!pt();)wg(Ge)}function wg(t){var a=G0(t.alternate,t,Ga);t.memoizedProps=t.pendingProps,a===null?Bo(t):Ge=a}function Sg(t){var a=t,s=a.alternate;switch(a.tag){case 15:case 0:a=B0(s,a,a.pendingProps,a.type,void 0,Qe);break;case 11:a=B0(s,a,a.pendingProps,a.type.render,a.ref,Qe);break;case 5:td(a);default:W0(s,a),a=Ge=kp(a,Ga),a=G0(s,a,Ga)}t.memoizedProps=t.pendingProps,a===null?Bo(t):Ge=a}function Xl(t,a,s,c){Da=Xr=null,td(a),$l=null,Rs=0;var p=a.return;try{if(z2(t,p,a,s,Qe)){zt=1,To(t,Gn(s,t.current)),Ge=null;return}}catch(y){if(p!==null)throw Ge=p,y;zt=1,To(t,Gn(s,t.current)),Ge=null;return}a.flags&32768?(nt||c===1?t=!0:Gl||(Qe&536870912)!==0?t=!1:(vr=t=!0,(c===2||c===9||c===3||c===6)&&(c=Mn.current,c!==null&&c.tag===13&&(c.flags|=16384))),jg(a,t)):Bo(a)}function Bo(t){var a=t;do{if((a.flags&32768)!==0){jg(a,vr);return}t=a.return;var s=U2(a.alternate,a,Ga);if(s!==null){Ge=s;return}if(a=a.sibling,a!==null){Ge=a;return}Ge=a=t}while(a!==null);zt===0&&(zt=5)}function jg(t,a){do{var s=$2(t.alternate,t);if(s!==null){s.flags&=32767,Ge=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!a&&(t=t.sibling,t!==null)){Ge=t;return}Ge=t=s}while(t!==null);zt=6,Ge=null}function Ng(t,a,s,c,p,y,S,E,P){t.cancelPendingCommit=null;do Ho();while(Yt!==0);if((ut&6)!==0)throw Error(l(327));if(a!==null){if(a===t.current)throw Error(l(177));if(y=a.lanes|a.childLanes,y|=Eu,su(t,s,y,S,E,P),t===kt&&(Ge=kt=null,Qe=0),Wl=a,wr=t,Ka=s,Dd=y,Od=p,hg=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Q2(Ee,function(){return Ag(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=D.T,D.T=null,p=te.p,te.p=2,S=ut,ut|=4;try{B2(t,a,s)}finally{ut=S,te.p=p,D.T=c}}Yt=1,Cg(),Tg(),Eg()}}function Cg(){if(Yt===1){Yt=0;var t=wr,a=Wl,s=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||s){s=D.T,D.T=null;var c=te.p;te.p=2;var p=ut;ut|=4;try{sg(a,t);var y=Zd,S=fp(t.containerInfo),E=y.focusedElem,P=y.selectionRange;if(S!==E&&E&&E.ownerDocument&&dp(E.ownerDocument.documentElement,E)){if(P!==null&&Su(E)){var Z=P.start,ie=P.end;if(ie===void 0&&(ie=Z),"selectionStart"in E)E.selectionStart=Z,E.selectionEnd=Math.min(ie,E.value.length);else{var ue=E.ownerDocument||document,J=ue&&ue.defaultView||window;if(J.getSelection){var ae=J.getSelection(),Ne=E.textContent.length,Le=Math.min(P.start,Ne),yt=P.end===void 0?Le:Math.min(P.end,Ne);!ae.extend&&Le>yt&&(S=yt,yt=Le,Le=S);var Y=up(E,Le),K=up(E,yt);if(Y&&K&&(ae.rangeCount!==1||ae.anchorNode!==Y.node||ae.anchorOffset!==Y.offset||ae.focusNode!==K.node||ae.focusOffset!==K.offset)){var Q=ue.createRange();Q.setStart(Y.node,Y.offset),ae.removeAllRanges(),Le>yt?(ae.addRange(Q),ae.extend(K.node,K.offset)):(Q.setEnd(K.node,K.offset),ae.addRange(Q))}}}}for(ue=[],ae=E;ae=ae.parentNode;)ae.nodeType===1&&ue.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ue.length;E++){var ce=ue[E];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Jo=!!Qd,Zd=Qd=null}finally{ut=p,te.p=c,D.T=s}}t.current=a,Yt=2}}function Tg(){if(Yt===2){Yt=0;var t=wr,a=Wl,s=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||s){s=D.T,D.T=null;var c=te.p;te.p=2;var p=ut;ut|=4;try{tg(t,a.alternate,a)}finally{ut=p,te.p=c,D.T=s}}Yt=3}}function Eg(){if(Yt===4||Yt===3){Yt=0,$t();var t=wr,a=Wl,s=Ka,c=hg;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Yt=5:(Yt=0,Wl=wr=null,Mg(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(kr=null),kl(s),a=a.stateNode,et&&typeof et.onCommitFiberRoot=="function")try{et.onCommitFiberRoot(Ve,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=D.T,p=te.p,te.p=2,D.T=null;try{for(var y=t.onRecoverableError,S=0;S<c.length;S++){var E=c[S];y(E.value,{componentStack:E.stack})}}finally{D.T=a,te.p=p}}(Ka&3)!==0&&Ho(),ba(t),p=t.pendingLanes,(s&261930)!==0&&(p&42)!==0?t===Ud?Ws++:(Ws=0,Ud=t):Ws=0,Ys(0)}}function Mg(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,Ms(a)))}function Ho(){return Cg(),Tg(),Eg(),Ag()}function Ag(){if(Yt!==5)return!1;var t=wr,a=Dd;Dd=0;var s=kl(Ka),c=D.T,p=te.p;try{te.p=32>s?32:s,D.T=null,s=Od,Od=null;var y=wr,S=Ka;if(Yt=0,Wl=wr=null,Ka=0,(ut&6)!==0)throw Error(l(331));var E=ut;if(ut|=4,dg(y.current),og(y,y.current,S,s),ut=E,Ys(0,!1),et&&typeof et.onPostCommitFiberRoot=="function")try{et.onPostCommitFiberRoot(Ve,y)}catch{}return!0}finally{te.p=p,D.T=c,Mg(t,a)}}function Rg(t,a,s){a=Gn(s,a),a=gd(t.stateNode,a,2),t=pr(t,a,2),t!==null&&(rr(t,2),ba(t))}function ht(t,a,s){if(t.tag===3)Rg(t,t,s);else for(;a!==null;){if(a.tag===3){Rg(a,t,s);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(kr===null||!kr.has(c))){t=Gn(s,t),s=L0(2),c=pr(a,s,2),c!==null&&(_0(s,c,a,t),rr(c,2),ba(c));break}}a=a.return}}function Hd(t,a,s){var c=t.pingCache;if(c===null){c=t.pingCache=new q2;var p=new Set;c.set(a,p)}else p=c.get(a),p===void 0&&(p=new Set,c.set(a,p));p.has(s)||(_d=!0,p.add(s),t=W2.bind(null,t,a,s),a.then(t,t))}function W2(t,a,s){var c=t.pingCache;c!==null&&c.delete(a),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,kt===t&&(Qe&s)===s&&(zt===4||zt===3&&(Qe&62914560)===Qe&&300>bt()-zo?(ut&2)===0&&Yl(t,0):Id|=s,Kl===Qe&&(Kl=0)),ba(t)}function Lg(t,a){a===0&&(a=oa()),t=Kr(t,a),t!==null&&(rr(t,a),ba(t))}function Y2(t){var a=t.memoizedState,s=0;a!==null&&(s=a.retryLane),Lg(t,s)}function X2(t,a){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,p=t.memoizedState;p!==null&&(s=p.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(l(314))}c!==null&&c.delete(a),Lg(t,s)}function Q2(t,a){return $e(t,a)}var Po=null,Ql=null,Pd=!1,qo=!1,qd=!1,jr=0;function ba(t){t!==Ql&&t.next===null&&(Ql===null?Po=Ql=t:Ql=Ql.next=t),qo=!0,Pd||(Pd=!0,J2())}function Ys(t,a){if(!qd&&qo){qd=!0;do for(var s=!1,c=Po;c!==null;){if(t!==0){var p=c.pendingLanes;if(p===0)var y=0;else{var S=c.suspendedLanes,E=c.pingedLanes;y=(1<<31-tt(42|t)+1)-1,y&=p&~(S&~E),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(s=!0,Dg(c,y))}else y=Qe,y=Oe(c,c===kt?y:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(y&3)===0||dt(c,y)||(s=!0,Dg(c,y));c=c.next}while(s);qd=!1}}function Z2(){_g()}function _g(){qo=Pd=!1;var t=0;jr!==0&&cw()&&(t=jr);for(var a=bt(),s=null,c=Po;c!==null;){var p=c.next,y=Ig(c,a);y===0?(c.next=null,s===null?Po=p:s.next=p,p===null&&(Ql=s)):(s=c,(t!==0||(y&3)!==0)&&(qo=!0)),c=p}Yt!==0&&Yt!==5||Ys(t),jr!==0&&(jr=0)}function Ig(t,a){for(var s=t.suspendedLanes,c=t.pingedLanes,p=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var S=31-tt(y),E=1<<S,P=p[S];P===-1?((E&s)===0||(E&c)!==0)&&(p[S]=Tt(E,a)):P<=a&&(t.expiredLanes|=E),y&=~E}if(a=kt,s=Qe,s=Oe(t,t===a?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,s===0||t===a&&(mt===2||mt===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&rt(c),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||dt(t,s)){if(a=s&-s,a===t.callbackPriority)return a;switch(c!==null&&rt(c),kl(s)){case 2:case 8:s=pe;break;case 32:s=Ee;break;case 268435456:s=ve;break;default:s=Ee}return c=zg.bind(null,t),s=$e(s,c),t.callbackPriority=a,t.callbackNode=s,a}return c!==null&&c!==null&&rt(c),t.callbackPriority=2,t.callbackNode=null,2}function zg(t,a){if(Yt!==0&&Yt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(Ho()&&t.callbackNode!==s)return null;var c=Qe;return c=Oe(t,t===kt?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(gg(t,c,a),Ig(t,bt()),t.callbackNode!=null&&t.callbackNode===s?zg.bind(null,t):null)}function Dg(t,a){if(Ho())return null;gg(t,a,!0)}function J2(){dw(function(){(ut&6)!==0?$e(le,Z2):_g()})}function Fd(){if(jr===0){var t=Dl;t===0&&(t=Ma,Ma<<=1,(Ma&261888)===0&&(Ma=256)),jr=t}return jr}function Og(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Xi(""+t)}function Ug(t,a){var s=a.ownerDocument.createElement("input");return s.name=a.name,s.value=a.value,t.id&&s.setAttribute("form",t.id),a.parentNode.insertBefore(s,a),t=new FormData(t),s.parentNode.removeChild(s),t}function ew(t,a,s,c,p){if(a==="submit"&&s&&s.stateNode===p){var y=Og((p[cn]||null).action),S=c.submitter;S&&(a=(a=S[cn]||null)?Og(a.formAction):S.getAttribute("formAction"),a!==null&&(y=a,S=null));var E=new eo("action","action",null,c,p);t.push({event:E,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(jr!==0){var P=S?Ug(p,S):new FormData(p);ud(s,{pending:!0,data:P,method:p.method,action:y},null,P)}}else typeof y=="function"&&(E.preventDefault(),P=S?Ug(p,S):new FormData(p),ud(s,{pending:!0,data:P,method:p.method,action:y},y,P))},currentTarget:p}]})}}for(var Vd=0;Vd<Tu.length;Vd++){var Gd=Tu[Vd],tw=Gd.toLowerCase(),nw=Gd[0].toUpperCase()+Gd.slice(1);ca(tw,"on"+nw)}ca(pp,"onAnimationEnd"),ca(gp,"onAnimationIteration"),ca(xp,"onAnimationStart"),ca("dblclick","onDoubleClick"),ca("focusin","onFocus"),ca("focusout","onBlur"),ca(y2,"onTransitionRun"),ca(v2,"onTransitionStart"),ca(b2,"onTransitionCancel"),ca(yp,"onTransitionEnd"),wl("onMouseEnter",["mouseout","mouseover"]),wl("onMouseLeave",["mouseout","mouseover"]),wl("onPointerEnter",["pointerout","pointerover"]),wl("onPointerLeave",["pointerout","pointerover"]),qr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qr("onBeforeInput",["compositionend","keypress","textInput","paste"]),qr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xs="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(" "),aw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xs));function $g(t,a){a=(a&4)!==0;for(var s=0;s<t.length;s++){var c=t[s],p=c.event;c=c.listeners;e:{var y=void 0;if(a)for(var S=c.length-1;0<=S;S--){var E=c[S],P=E.instance,Z=E.currentTarget;if(E=E.listener,P!==y&&p.isPropagationStopped())break e;y=E,p.currentTarget=Z;try{y(p)}catch(ie){ao(ie)}p.currentTarget=null,y=P}else for(S=0;S<c.length;S++){if(E=c[S],P=E.instance,Z=E.currentTarget,E=E.listener,P!==y&&p.isPropagationStopped())break e;y=E,p.currentTarget=Z;try{y(p)}catch(ie){ao(ie)}p.currentTarget=null,y=P}}}}function Ke(t,a){var s=a[xs];s===void 0&&(s=a[xs]=new Set);var c=t+"__bubble";s.has(c)||(Bg(a,t,2,!1),s.add(c))}function Kd(t,a,s){var c=0;a&&(c|=4),Bg(s,t,c,a)}var Fo="_reactListening"+Math.random().toString(36).slice(2);function Wd(t){if(!t[Fo]){t[Fo]=!0,_h.forEach(function(s){s!=="selectionchange"&&(aw.has(s)||Kd(s,!1,t),Kd(s,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Fo]||(a[Fo]=!0,Kd("selectionchange",!1,a))}}function Bg(t,a,s,c){switch(px(a)){case 2:var p=Rw;break;case 8:p=Lw;break;default:p=uf}s=p.bind(null,a,s,t),p=void 0,!hu||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),c?p!==void 0?t.addEventListener(a,s,{capture:!0,passive:p}):t.addEventListener(a,s,!0):p!==void 0?t.addEventListener(a,s,{passive:p}):t.addEventListener(a,s,!1)}function Yd(t,a,s,c,p){var y=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var E=c.stateNode.containerInfo;if(E===p)break;if(S===4)for(S=c.return;S!==null;){var P=S.tag;if((P===3||P===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;E!==null;){if(S=Aa(E),S===null)return;if(P=S.tag,P===5||P===6||P===26||P===27){c=y=S;continue e}E=E.parentNode}}c=c.return}Vh(function(){var Z=y,ie=fu(s),ue=[];e:{var J=vp.get(t);if(J!==void 0){var ae=eo,Ne=t;switch(t){case"keypress":if(Zi(s)===0)break e;case"keydown":case"keyup":ae=Xk;break;case"focusin":Ne="focus",ae=yu;break;case"focusout":Ne="blur",ae=yu;break;case"beforeblur":case"afterblur":ae=yu;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Wh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=Uk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=Jk;break;case pp:case gp:case xp:ae=Hk;break;case yp:ae=t2;break;case"scroll":case"scrollend":ae=Dk;break;case"wheel":ae=a2;break;case"copy":case"cut":case"paste":ae=qk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Xh;break;case"toggle":case"beforetoggle":ae=l2}var Le=(a&4)!==0,yt=!Le&&(t==="scroll"||t==="scrollend"),Y=Le?J!==null?J+"Capture":null:J;Le=[];for(var K=Z,Q;K!==null;){var ce=K;if(Q=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Q===null||Y===null||(ce=ys(K,Y),ce!=null&&Le.push(Qs(K,ce,Q))),yt)break;K=K.return}0<Le.length&&(J=new ae(J,Ne,null,s,ie),ue.push({event:J,listeners:Le}))}}if((a&7)===0){e:{if(J=t==="mouseover"||t==="pointerover",ae=t==="mouseout"||t==="pointerout",J&&s!==du&&(Ne=s.relatedTarget||s.fromElement)&&(Aa(Ne)||Ne[lr]))break e;if((ae||J)&&(J=ie.window===ie?ie:(J=ie.ownerDocument)?J.defaultView||J.parentWindow:window,ae?(Ne=s.relatedTarget||s.toElement,ae=Z,Ne=Ne?Aa(Ne):null,Ne!==null&&(yt=u(Ne),Le=Ne.tag,Ne!==yt||Le!==5&&Le!==27&&Le!==6)&&(Ne=null)):(ae=null,Ne=Z),ae!==Ne)){if(Le=Wh,ce="onMouseLeave",Y="onMouseEnter",K="mouse",(t==="pointerout"||t==="pointerover")&&(Le=Xh,ce="onPointerLeave",Y="onPointerEnter",K="pointer"),yt=ae==null?J:Pr(ae),Q=Ne==null?J:Pr(Ne),J=new Le(ce,K+"leave",ae,s,ie),J.target=yt,J.relatedTarget=Q,ce=null,Aa(ie)===Z&&(Le=new Le(Y,K+"enter",Ne,s,ie),Le.target=Q,Le.relatedTarget=yt,ce=Le),yt=ce,ae&&Ne)t:{for(Le=rw,Y=ae,K=Ne,Q=0,ce=Y;ce;ce=Le(ce))Q++;ce=0;for(var Me=K;Me;Me=Le(Me))ce++;for(;0<Q-ce;)Y=Le(Y),Q--;for(;0<ce-Q;)K=Le(K),ce--;for(;Q--;){if(Y===K||K!==null&&Y===K.alternate){Le=Y;break t}Y=Le(Y),K=Le(K)}Le=null}else Le=null;ae!==null&&Hg(ue,J,ae,Le,!1),Ne!==null&&yt!==null&&Hg(ue,yt,Ne,Le,!0)}}e:{if(J=Z?Pr(Z):window,ae=J.nodeName&&J.nodeName.toLowerCase(),ae==="select"||ae==="input"&&J.type==="file")var st=rp;else if(np(J))if(lp)st=p2;else{st=m2;var Te=f2}else ae=J.nodeName,!ae||ae.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Z&&uu(Z.elementType)&&(st=rp):st=h2;if(st&&(st=st(t,Z))){ap(ue,st,s,ie);break e}Te&&Te(t,J,Z),t==="focusout"&&Z&&J.type==="number"&&Z.memoizedProps.value!=null&&cu(J,"number",J.value)}switch(Te=Z?Pr(Z):window,t){case"focusin":(np(Te)||Te.contentEditable==="true")&&(El=Te,ju=Z,Cs=null);break;case"focusout":Cs=ju=El=null;break;case"mousedown":Nu=!0;break;case"contextmenu":case"mouseup":case"dragend":Nu=!1,mp(ue,s,ie);break;case"selectionchange":if(x2)break;case"keydown":case"keyup":mp(ue,s,ie)}var qe;if(bu)e:{switch(t){case"compositionstart":var Ze="onCompositionStart";break e;case"compositionend":Ze="onCompositionEnd";break e;case"compositionupdate":Ze="onCompositionUpdate";break e}Ze=void 0}else Tl?ep(t,s)&&(Ze="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(Ze="onCompositionStart");Ze&&(Qh&&s.locale!=="ko"&&(Tl||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Tl&&(qe=Gh()):(or=ie,pu="value"in or?or.value:or.textContent,Tl=!0)),Te=Vo(Z,Ze),0<Te.length&&(Ze=new Yh(Ze,t,null,s,ie),ue.push({event:Ze,listeners:Te}),qe?Ze.data=qe:(qe=tp(s),qe!==null&&(Ze.data=qe)))),(qe=i2?o2(t,s):c2(t,s))&&(Ze=Vo(Z,"onBeforeInput"),0<Ze.length&&(Te=new Yh("onBeforeInput","beforeinput",null,s,ie),ue.push({event:Te,listeners:Ze}),Te.data=qe)),ew(ue,t,Z,s,ie)}$g(ue,a)})}function Qs(t,a,s){return{instance:t,listener:a,currentTarget:s}}function Vo(t,a){for(var s=a+"Capture",c=[];t!==null;){var p=t,y=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||y===null||(p=ys(t,s),p!=null&&c.unshift(Qs(t,p,y)),p=ys(t,a),p!=null&&c.push(Qs(t,p,y))),t.tag===3)return c;t=t.return}return[]}function rw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Hg(t,a,s,c,p){for(var y=a._reactName,S=[];s!==null&&s!==c;){var E=s,P=E.alternate,Z=E.stateNode;if(E=E.tag,P!==null&&P===c)break;E!==5&&E!==26&&E!==27||Z===null||(P=Z,p?(Z=ys(s,y),Z!=null&&S.unshift(Qs(s,Z,P))):p||(Z=ys(s,y),Z!=null&&S.push(Qs(s,Z,P)))),s=s.return}S.length!==0&&t.push({event:a,listeners:S})}var lw=/\r\n?/g,sw=/\u0000|\uFFFD/g;function Pg(t){return(typeof t=="string"?t:""+t).replace(lw,`
|
|
9
|
+
`).replace(sw,"")}function qg(t,a){return a=Pg(a),Pg(t)===a}function xt(t,a,s,c,p,y){switch(s){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||jl(t,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&jl(t,""+c);break;case"className":Wi(t,"class",c);break;case"tabIndex":Wi(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Wi(t,s,c);break;case"style":qh(t,c,y);break;case"data":if(a!=="object"){Wi(t,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||s!=="href")){t.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=Xi(""+c),t.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(s,"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 y=="function"&&(s==="formAction"?(a!=="input"&&xt(t,a,"name",p.name,p,null),xt(t,a,"formEncType",p.formEncType,p,null),xt(t,a,"formMethod",p.formMethod,p,null),xt(t,a,"formTarget",p.formTarget,p,null)):(xt(t,a,"encType",p.encType,p,null),xt(t,a,"method",p.method,p,null),xt(t,a,"target",p.target,p,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=Xi(""+c),t.setAttribute(s,c);break;case"onClick":c!=null&&(t.onclick=La);break;case"onScroll":c!=null&&Ke("scroll",t);break;case"onScrollEnd":c!=null&&Ke("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(l(60));t.innerHTML=s}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}s=Xi(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""+c):t.removeAttribute(s);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":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":c===!0?t.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,c):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(s,c):t.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(s):t.setAttribute(s,c);break;case"popover":Ke("beforetoggle",t),Ke("toggle",t),Ki(t,"popover",c);break;case"xlinkActuate":Ra(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Ra(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Ra(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Ra(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Ra(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Ra(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Ki(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Ik.get(s)||s,Ki(t,s,c))}}function Xd(t,a,s,c,p,y){switch(s){case"style":qh(t,c,y);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(l(60));t.innerHTML=s}}break;case"children":typeof c=="string"?jl(t,c):(typeof c=="number"||typeof c=="bigint")&&jl(t,""+c);break;case"onScroll":c!=null&&Ke("scroll",t);break;case"onScrollEnd":c!=null&&Ke("scrollend",t);break;case"onClick":c!=null&&(t.onclick=La);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ih.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(p=s.endsWith("Capture"),a=s.slice(2,p?s.length-7:void 0),y=t[cn]||null,y=y!=null?y[s]:null,typeof y=="function"&&t.removeEventListener(a,y,p),typeof c=="function")){typeof y!="function"&&y!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(a,c,p);break e}s in t?t[s]=c:c===!0?t.setAttribute(s,""):Ki(t,s,c)}}}function rn(t,a,s){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",t),Ke("load",t);var c=!1,p=!1,y;for(y in s)if(s.hasOwnProperty(y)){var S=s[y];if(S!=null)switch(y){case"src":c=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,a));default:xt(t,a,y,S,s,null)}}p&&xt(t,a,"srcSet",s.srcSet,s,null),c&&xt(t,a,"src",s.src,s,null);return;case"input":Ke("invalid",t);var E=y=S=p=null,P=null,Z=null;for(c in s)if(s.hasOwnProperty(c)){var ie=s[c];if(ie!=null)switch(c){case"name":p=ie;break;case"type":S=ie;break;case"checked":P=ie;break;case"defaultChecked":Z=ie;break;case"value":y=ie;break;case"defaultValue":E=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(l(137,a));break;default:xt(t,a,c,ie,s,null)}}$h(t,y,E,P,Z,S,p,!1);return;case"select":Ke("invalid",t),c=S=y=null;for(p in s)if(s.hasOwnProperty(p)&&(E=s[p],E!=null))switch(p){case"value":y=E;break;case"defaultValue":S=E;break;case"multiple":c=E;default:xt(t,a,p,E,s,null)}a=y,s=S,t.multiple=!!c,a!=null?Sl(t,!!c,a,!1):s!=null&&Sl(t,!!c,s,!0);return;case"textarea":Ke("invalid",t),y=p=c=null;for(S in s)if(s.hasOwnProperty(S)&&(E=s[S],E!=null))switch(S){case"value":c=E;break;case"defaultValue":p=E;break;case"children":y=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(l(91));break;default:xt(t,a,S,E,s,null)}Hh(t,c,p,y);return;case"option":for(P in s)s.hasOwnProperty(P)&&(c=s[P],c!=null)&&(P==="selected"?t.selected=c&&typeof c!="function"&&typeof c!="symbol":xt(t,a,P,c,s,null));return;case"dialog":Ke("beforetoggle",t),Ke("toggle",t),Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":Ke("load",t);break;case"video":case"audio":for(c=0;c<Xs.length;c++)Ke(Xs[c],t);break;case"image":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"embed":case"source":case"link":Ke("error",t),Ke("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in s)if(s.hasOwnProperty(Z)&&(c=s[Z],c!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,a));default:xt(t,a,Z,c,s,null)}return;default:if(uu(a)){for(ie in s)s.hasOwnProperty(ie)&&(c=s[ie],c!==void 0&&Xd(t,a,ie,c,s,void 0));return}}for(E in s)s.hasOwnProperty(E)&&(c=s[E],c!=null&&xt(t,a,E,c,s,null))}function iw(t,a,s,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,y=null,S=null,E=null,P=null,Z=null,ie=null;for(ae in s){var ue=s[ae];if(s.hasOwnProperty(ae)&&ue!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":P=ue;default:c.hasOwnProperty(ae)||xt(t,a,ae,null,c,ue)}}for(var J in c){var ae=c[J];if(ue=s[J],c.hasOwnProperty(J)&&(ae!=null||ue!=null))switch(J){case"type":y=ae;break;case"name":p=ae;break;case"checked":Z=ae;break;case"defaultChecked":ie=ae;break;case"value":S=ae;break;case"defaultValue":E=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(l(137,a));break;default:ae!==ue&&xt(t,a,J,ae,c,ue)}}ou(t,S,E,P,Z,ie,y,p);return;case"select":ae=S=E=J=null;for(y in s)if(P=s[y],s.hasOwnProperty(y)&&P!=null)switch(y){case"value":break;case"multiple":ae=P;default:c.hasOwnProperty(y)||xt(t,a,y,null,c,P)}for(p in c)if(y=c[p],P=s[p],c.hasOwnProperty(p)&&(y!=null||P!=null))switch(p){case"value":J=y;break;case"defaultValue":E=y;break;case"multiple":S=y;default:y!==P&&xt(t,a,p,y,c,P)}a=E,s=S,c=ae,J!=null?Sl(t,!!s,J,!1):!!c!=!!s&&(a!=null?Sl(t,!!s,a,!0):Sl(t,!!s,s?[]:"",!1));return;case"textarea":ae=J=null;for(E in s)if(p=s[E],s.hasOwnProperty(E)&&p!=null&&!c.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:xt(t,a,E,null,c,p)}for(S in c)if(p=c[S],y=s[S],c.hasOwnProperty(S)&&(p!=null||y!=null))switch(S){case"value":J=p;break;case"defaultValue":ae=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(l(91));break;default:p!==y&&xt(t,a,S,p,c,y)}Bh(t,J,ae);return;case"option":for(var Ne in s)J=s[Ne],s.hasOwnProperty(Ne)&&J!=null&&!c.hasOwnProperty(Ne)&&(Ne==="selected"?t.selected=!1:xt(t,a,Ne,null,c,J));for(P in c)J=c[P],ae=s[P],c.hasOwnProperty(P)&&J!==ae&&(J!=null||ae!=null)&&(P==="selected"?t.selected=J&&typeof J!="function"&&typeof J!="symbol":xt(t,a,P,J,c,ae));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 Le in s)J=s[Le],s.hasOwnProperty(Le)&&J!=null&&!c.hasOwnProperty(Le)&&xt(t,a,Le,null,c,J);for(Z in c)if(J=c[Z],ae=s[Z],c.hasOwnProperty(Z)&&J!==ae&&(J!=null||ae!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(l(137,a));break;default:xt(t,a,Z,J,c,ae)}return;default:if(uu(a)){for(var yt in s)J=s[yt],s.hasOwnProperty(yt)&&J!==void 0&&!c.hasOwnProperty(yt)&&Xd(t,a,yt,void 0,c,J);for(ie in c)J=c[ie],ae=s[ie],!c.hasOwnProperty(ie)||J===ae||J===void 0&&ae===void 0||Xd(t,a,ie,J,c,ae);return}}for(var Y in s)J=s[Y],s.hasOwnProperty(Y)&&J!=null&&!c.hasOwnProperty(Y)&&xt(t,a,Y,null,c,J);for(ue in c)J=c[ue],ae=s[ue],!c.hasOwnProperty(ue)||J===ae||J==null&&ae==null||xt(t,a,ue,J,c,ae)}function Fg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ow(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var p=s[c],y=p.transferSize,S=p.initiatorType,E=p.duration;if(y&&E&&Fg(S)){for(S=0,E=p.responseEnd,c+=1;c<s.length;c++){var P=s[c],Z=P.startTime;if(Z>E)break;var ie=P.transferSize,ue=P.initiatorType;ie&&Fg(ue)&&(P=P.responseEnd,S+=ie*(P<E?1:(E-Z)/(P-Z)))}if(--c,a+=8*(y+S)/(p.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Qd=null,Zd=null;function Go(t){return t.nodeType===9?t:t.ownerDocument}function Vg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Gg(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function Jd(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var ef=null;function cw(){var t=window.event;return t&&t.type==="popstate"?t===ef?!1:(ef=t,!0):(ef=null,!1)}var Kg=typeof setTimeout=="function"?setTimeout:void 0,uw=typeof clearTimeout=="function"?clearTimeout:void 0,Wg=typeof Promise=="function"?Promise:void 0,dw=typeof queueMicrotask=="function"?queueMicrotask:typeof Wg<"u"?function(t){return Wg.resolve(null).then(t).catch(fw)}:Kg;function fw(t){setTimeout(function(){throw t})}function Nr(t){return t==="head"}function Yg(t,a){var s=a,c=0;do{var p=s.nextSibling;if(t.removeChild(s),p&&p.nodeType===8)if(s=p.data,s==="/$"||s==="/&"){if(c===0){t.removeChild(p),ts(a);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")Zs(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,Zs(s);for(var y=s.firstChild;y;){var S=y.nextSibling,E=y.nodeName;y[ct]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&y.rel.toLowerCase()==="stylesheet"||s.removeChild(y),y=S}}else s==="body"&&Zs(t.ownerDocument.body);s=p}while(s);ts(a)}function Xg(t,a){var s=t;t=0;do{var c=s.nextSibling;if(s.nodeType===1?a?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(a?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=c}while(s)}function tf(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var s=a;switch(a=a.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":tf(s),Bt(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function mw(t,a,s,c){for(;t.nodeType===1;){var p=s;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[ct])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var y=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Qn(t.nextSibling),t===null)break}return null}function hw(t,a,s){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Qn(t.nextSibling),t===null))return null;return t}function Qg(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Qn(t.nextSibling),t===null))return null;return t}function nf(t){return t.data==="$?"||t.data==="$~"}function af(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function pw(t,a){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||s.readyState!=="loading")a();else{var c=function(){a(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function Qn(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var rf=null;function Zg(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(a===0)return Qn(t.nextSibling);a--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||a++}t=t.nextSibling}return null}function Jg(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(a===0)return t;a--}else s!=="/$"&&s!=="/&"||a++}t=t.previousSibling}return null}function ex(t,a,s){switch(a=Go(s),t){case"html":if(t=a.documentElement,!t)throw Error(l(452));return t;case"head":if(t=a.head,!t)throw Error(l(453));return t;case"body":if(t=a.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function Zs(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Bt(t)}var Zn=new Map,tx=new Set;function Ko(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Wa=te.d;te.d={f:gw,r:xw,D:yw,C:vw,L:bw,m:kw,X:Sw,S:ww,M:jw};function gw(){var t=Wa.f(),a=Uo();return t||a}function xw(t){var a=sr(t);a!==null&&a.tag===5&&a.type==="form"?y0(a):Wa.r(t)}var Zl=typeof document>"u"?null:document;function nx(t,a,s){var c=Zl;if(c&&typeof a=="string"&&a){var p=Fn(a);p='link[rel="'+t+'"][href="'+p+'"]',typeof s=="string"&&(p+='[crossorigin="'+s+'"]'),tx.has(p)||(tx.add(p),t={rel:t,crossOrigin:s,href:a},c.querySelector(p)===null&&(a=c.createElement("link"),rn(a,"link",t),Xt(a),c.head.appendChild(a)))}}function yw(t){Wa.D(t),nx("dns-prefetch",t,null)}function vw(t,a){Wa.C(t,a),nx("preconnect",t,a)}function bw(t,a,s){Wa.L(t,a,s);var c=Zl;if(c&&t&&a){var p='link[rel="preload"][as="'+Fn(a)+'"]';a==="image"&&s&&s.imageSrcSet?(p+='[imagesrcset="'+Fn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(p+='[imagesizes="'+Fn(s.imageSizes)+'"]')):p+='[href="'+Fn(t)+'"]';var y=p;switch(a){case"style":y=Jl(t);break;case"script":y=es(t)}Zn.has(y)||(t=v({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:t,as:a},s),Zn.set(y,t),c.querySelector(p)!==null||a==="style"&&c.querySelector(Js(y))||a==="script"&&c.querySelector(ei(y))||(a=c.createElement("link"),rn(a,"link",t),Xt(a),c.head.appendChild(a)))}}function kw(t,a){Wa.m(t,a);var s=Zl;if(s&&t){var c=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+Fn(c)+'"][href="'+Fn(t)+'"]',y=p;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=es(t)}if(!Zn.has(y)&&(t=v({rel:"modulepreload",href:t},a),Zn.set(y,t),s.querySelector(p)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(ei(y)))return}c=s.createElement("link"),rn(c,"link",t),Xt(c),s.head.appendChild(c)}}}function ww(t,a,s){Wa.S(t,a,s);var c=Zl;if(c&&t){var p=ir(c).hoistableStyles,y=Jl(t);a=a||"default";var S=p.get(y);if(!S){var E={loading:0,preload:null};if(S=c.querySelector(Js(y)))E.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":a},s),(s=Zn.get(y))&&lf(t,s);var P=S=c.createElement("link");Xt(P),rn(P,"link",t),P._p=new Promise(function(Z,ie){P.onload=Z,P.onerror=ie}),P.addEventListener("load",function(){E.loading|=1}),P.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Wo(S,a,c)}S={type:"stylesheet",instance:S,count:1,state:E},p.set(y,S)}}}function Sw(t,a){Wa.X(t,a);var s=Zl;if(s&&t){var c=ir(s).hoistableScripts,p=es(t),y=c.get(p);y||(y=s.querySelector(ei(p)),y||(t=v({src:t,async:!0},a),(a=Zn.get(p))&&sf(t,a),y=s.createElement("script"),Xt(y),rn(y,"link",t),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(p,y))}}function jw(t,a){Wa.M(t,a);var s=Zl;if(s&&t){var c=ir(s).hoistableScripts,p=es(t),y=c.get(p);y||(y=s.querySelector(ei(p)),y||(t=v({src:t,async:!0,type:"module"},a),(a=Zn.get(p))&&sf(t,a),y=s.createElement("script"),Xt(y),rn(y,"link",t),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(p,y))}}function ax(t,a,s,c){var p=(p=fe.current)?Ko(p):null;if(!p)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(a=Jl(s.href),s=ir(p).hoistableStyles,c=s.get(a),c||(c={type:"style",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Jl(s.href);var y=ir(p).hoistableStyles,S=y.get(t);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,S),(y=p.querySelector(Js(t)))&&!y._p&&(S.instance=y,S.state.loading=5),Zn.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Zn.set(t,s),y||Nw(p,t,s,S.state))),a&&c===null)throw Error(l(528,""));return S}if(a&&c!==null)throw Error(l(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=es(s),s=ir(p).hoistableScripts,c=s.get(a),c||(c={type:"script",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Jl(t){return'href="'+Fn(t)+'"'}function Js(t){return'link[rel="stylesheet"]['+t+"]"}function rx(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function Nw(t,a,s,c){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=t.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),rn(a,"link",s),Xt(a),t.head.appendChild(a))}function es(t){return'[src="'+Fn(t)+'"]'}function ei(t){return"script[async]"+t}function lx(t,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var c=t.querySelector('style[data-href~="'+Fn(s.href)+'"]');if(c)return a.instance=c,Xt(c),c;var p=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Xt(c),rn(c,"style",p),Wo(c,s.precedence,t),a.instance=c;case"stylesheet":p=Jl(s.href);var y=t.querySelector(Js(p));if(y)return a.state.loading|=4,a.instance=y,Xt(y),y;c=rx(s),(p=Zn.get(p))&&lf(c,p),y=(t.ownerDocument||t).createElement("link"),Xt(y);var S=y;return S._p=new Promise(function(E,P){S.onload=E,S.onerror=P}),rn(y,"link",c),a.state.loading|=4,Wo(y,s.precedence,t),a.instance=y;case"script":return y=es(s.src),(p=t.querySelector(ei(y)))?(a.instance=p,Xt(p),p):(c=s,(p=Zn.get(y))&&(c=v({},s),sf(c,p)),t=t.ownerDocument||t,p=t.createElement("script"),Xt(p),rn(p,"link",c),t.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(l(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,Wo(c,s.precedence,t));return a.instance}function Wo(t,a,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=c.length?c[c.length-1]:null,y=p,S=0;S<c.length;S++){var E=c[S];if(E.dataset.precedence===a)y=E;else if(y!==p)break}y?y.parentNode.insertBefore(t,y.nextSibling):(a=s.nodeType===9?s.head:s,a.insertBefore(t,a.firstChild))}function lf(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function sf(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Yo=null;function sx(t,a,s){if(Yo===null){var c=new Map,p=Yo=new Map;p.set(s,c)}else p=Yo,c=p.get(s),c||(c=new Map,p.set(s,c));if(c.has(t))return c;for(c.set(t,null),s=s.getElementsByTagName(t),p=0;p<s.length;p++){var y=s[p];if(!(y[ct]||y[Wt]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(a)||"";S=t+S;var E=c.get(S);E?E.push(y):c.set(S,[y])}}return c}function ix(t,a,s){t=t.ownerDocument||t,t.head.insertBefore(s,a==="title"?t.querySelector("head > title"):null)}function Cw(t,a,s){if(s===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(t=a.disabled,typeof a.precedence=="string"&&t==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function ox(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Tw(t,a,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var p=Jl(c.href),y=a.querySelector(Js(p));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Xo.bind(t),a.then(t,t)),s.state.loading|=4,s.instance=y,Xt(y);return}y=a.ownerDocument||a,c=rx(c),(p=Zn.get(p))&&lf(c,p),y=y.createElement("link"),Xt(y);var S=y;S._p=new Promise(function(E,P){S.onload=E,S.onerror=P}),rn(y,"link",c),s.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=Xo.bind(t),a.addEventListener("load",s),a.addEventListener("error",s))}}var of=0;function Ew(t,a){return t.stylesheets&&t.count===0&&Zo(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var c=setTimeout(function(){if(t.stylesheets&&Zo(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+a);0<t.imgBytes&&of===0&&(of=62500*ow());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Zo(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>of?50:800)+a);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(p)}}:null}function Xo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zo(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Qo=null;function Zo(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Qo=new Map,a.forEach(Mw,t),Qo=null,Xo.call(t))}function Mw(t,a){if(!(a.state.loading&4)){var s=Qo.get(t);if(s)var c=s.get(null);else{s=new Map,Qo.set(t,s);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<p.length;y++){var S=p[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(s.set(S.dataset.precedence,S),c=S)}c&&s.set(null,c)}p=a.instance,S=p.getAttribute("data-precedence"),y=s.get(S)||c,y===c&&s.set(null,p),s.set(S,p),this.count++,c=Xo.bind(this),p.addEventListener("load",c),p.addEventListener("error",c),y?y.parentNode.insertBefore(p,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),a.state.loading|=4}}var ti={$$typeof:R,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function Aw(t,a,s,c,p,y,S,E,P){this.tag=1,this.containerInfo=t,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=pa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pa(0),this.hiddenUpdates=pa(null),this.identifierPrefix=c,this.onUncaughtError=p,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function cx(t,a,s,c,p,y,S,E,P,Z,ie,ue){return t=new Aw(t,a,s,S,P,Z,ie,ue,E),a=1,y===!0&&(a|=24),y=En(3,null,null,a),t.current=y,y.stateNode=t,a=Bu(),a.refCount++,t.pooledCache=a,a.refCount++,y.memoizedState={element:c,isDehydrated:s,cache:a},Fu(y),t}function ux(t){return t?(t=Rl,t):Rl}function dx(t,a,s,c,p,y){p=ux(p),c.context===null?c.context=p:c.pendingContext=p,c=hr(a),c.payload={element:s},y=y===void 0?null:y,y!==null&&(c.callback=y),s=pr(t,c,a),s!==null&&(kn(s,t,a),_s(s,t,a))}function fx(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<a?s:a}}function cf(t,a){fx(t,a),(t=t.alternate)&&fx(t,a)}function mx(t){if(t.tag===13||t.tag===31){var a=Kr(t,67108864);a!==null&&kn(a,t,67108864),cf(t,67108864)}}function hx(t){if(t.tag===13||t.tag===31){var a=_n();a=Hr(a);var s=Kr(t,a);s!==null&&kn(s,t,a),cf(t,a)}}var Jo=!0;function Rw(t,a,s,c){var p=D.T;D.T=null;var y=te.p;try{te.p=2,uf(t,a,s,c)}finally{te.p=y,D.T=p}}function Lw(t,a,s,c){var p=D.T;D.T=null;var y=te.p;try{te.p=8,uf(t,a,s,c)}finally{te.p=y,D.T=p}}function uf(t,a,s,c){if(Jo){var p=df(c);if(p===null)Yd(t,a,c,ec,s),gx(t,c);else if(Iw(p,t,a,s,c))c.stopPropagation();else if(gx(t,c),a&4&&-1<_w.indexOf(t)){for(;p!==null;){var y=sr(p);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=ke(y.pendingLanes);if(S!==0){var E=y;for(E.pendingLanes|=2,E.entangledLanes|=2;S;){var P=1<<31-tt(S);E.entanglements[1]|=P,S&=~P}ba(y),(ut&6)===0&&(Do=bt()+500,Ys(0))}}break;case 31:case 13:E=Kr(y,2),E!==null&&kn(E,y,2),Uo(),cf(y,2)}if(y=df(c),y===null&&Yd(t,a,c,ec,s),y===p)break;p=y}p!==null&&c.stopPropagation()}else Yd(t,a,c,null,s)}}function df(t){return t=fu(t),ff(t)}var ec=null;function ff(t){if(ec=null,t=Aa(t),t!==null){var a=u(t);if(a===null)t=null;else{var s=a.tag;if(s===13){if(t=d(a),t!==null)return t;t=null}else if(s===31){if(t=f(a),t!==null)return t;t=null}else if(s===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return ec=t,null}function px(t){switch(t){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(on()){case le:return 2;case pe:return 8;case Ee:case ge:return 32;case ve:return 268435456;default:return 32}default:return 32}}var mf=!1,Cr=null,Tr=null,Er=null,ni=new Map,ai=new Map,Mr=[],_w="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 gx(t,a){switch(t){case"focusin":case"focusout":Cr=null;break;case"dragenter":case"dragleave":Tr=null;break;case"mouseover":case"mouseout":Er=null;break;case"pointerover":case"pointerout":ni.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ai.delete(a.pointerId)}}function ri(t,a,s,c,p,y){return t===null||t.nativeEvent!==y?(t={blockedOn:a,domEventName:s,eventSystemFlags:c,nativeEvent:y,targetContainers:[p]},a!==null&&(a=sr(a),a!==null&&mx(a)),t):(t.eventSystemFlags|=c,a=t.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),t)}function Iw(t,a,s,c,p){switch(a){case"focusin":return Cr=ri(Cr,t,a,s,c,p),!0;case"dragenter":return Tr=ri(Tr,t,a,s,c,p),!0;case"mouseover":return Er=ri(Er,t,a,s,c,p),!0;case"pointerover":var y=p.pointerId;return ni.set(y,ri(ni.get(y)||null,t,a,s,c,p)),!0;case"gotpointercapture":return y=p.pointerId,ai.set(y,ri(ai.get(y)||null,t,a,s,c,p)),!0}return!1}function xx(t){var a=Aa(t.target);if(a!==null){var s=u(a);if(s!==null){if(a=s.tag,a===13){if(a=d(s),a!==null){t.blockedOn=a,gs(t.priority,function(){hx(s)});return}}else if(a===31){if(a=f(s),a!==null){t.blockedOn=a,gs(t.priority,function(){hx(s)});return}}else if(a===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function tc(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var s=df(t.nativeEvent);if(s===null){s=t.nativeEvent;var c=new s.constructor(s.type,s);du=c,s.target.dispatchEvent(c),du=null}else return a=sr(s),a!==null&&mx(a),t.blockedOn=s,!1;a.shift()}return!0}function yx(t,a,s){tc(t)&&s.delete(a)}function zw(){mf=!1,Cr!==null&&tc(Cr)&&(Cr=null),Tr!==null&&tc(Tr)&&(Tr=null),Er!==null&&tc(Er)&&(Er=null),ni.forEach(yx),ai.forEach(yx)}function nc(t,a){t.blockedOn===a&&(t.blockedOn=null,mf||(mf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,zw)))}var ac=null;function vx(t){ac!==t&&(ac=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ac===t&&(ac=null);for(var a=0;a<t.length;a+=3){var s=t[a],c=t[a+1],p=t[a+2];if(typeof c!="function"){if(ff(c||s)===null)continue;break}var y=sr(s);y!==null&&(t.splice(a,3),a-=3,ud(y,{pending:!0,data:p,method:s.method,action:c},c,p))}}))}function ts(t){function a(P){return nc(P,t)}Cr!==null&&nc(Cr,t),Tr!==null&&nc(Tr,t),Er!==null&&nc(Er,t),ni.forEach(a),ai.forEach(a);for(var s=0;s<Mr.length;s++){var c=Mr[s];c.blockedOn===t&&(c.blockedOn=null)}for(;0<Mr.length&&(s=Mr[0],s.blockedOn===null);)xx(s),s.blockedOn===null&&Mr.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var p=s[c],y=s[c+1],S=p[cn]||null;if(typeof y=="function")S||vx(s);else if(S){var E=null;if(y&&y.hasAttribute("formAction")){if(p=y,S=y[cn]||null)E=S.formAction;else if(ff(p)!==null)continue}else E=S.action;typeof E=="function"?s[c+1]=E:(s.splice(c,3),c-=3),vx(s)}}}function bx(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function hf(t){this._internalRoot=t}rc.prototype.render=hf.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(l(409));var s=a.current,c=_n();dx(s,c,t,a,null,null)},rc.prototype.unmount=hf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;dx(t.current,2,null,t,null,null),Uo(),a[lr]=null}};function rc(t){this._internalRoot=t}rc.prototype.unstable_scheduleHydration=function(t){if(t){var a=Gi();t={blockedOn:null,target:t,priority:a};for(var s=0;s<Mr.length&&a!==0&&a<Mr[s].priority;s++);Mr.splice(s,0,t),s===0&&xx(t)}};var kx=n.version;if(kx!=="19.2.7")throw Error(l(527,kx,"19.2.7"));te.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=h(a),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var Dw={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lc.isDisabled&&lc.supportsFiber)try{Ve=lc.inject(Dw),et=lc}catch{}}return si.createRoot=function(t,a){if(!o(t))throw Error(l(299));var s=!1,c="",p=E0,y=M0,S=A0;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError)),a=cx(t,1,!1,null,null,s,c,null,p,y,S,bx),t[lr]=a.current,Wd(t),new hf(a)},si.hydrateRoot=function(t,a,s){if(!o(t))throw Error(l(299));var c=!1,p="",y=E0,S=M0,E=A0,P=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(p=s.identifierPrefix),s.onUncaughtError!==void 0&&(y=s.onUncaughtError),s.onCaughtError!==void 0&&(S=s.onCaughtError),s.onRecoverableError!==void 0&&(E=s.onRecoverableError),s.formState!==void 0&&(P=s.formState)),a=cx(t,1,!0,a,s??null,c,p,P,y,S,E,bx),a.context=ux(null),s=a.current,c=_n(),c=Hr(c),p=hr(c),p.callback=null,pr(s,p,c),s=c,a.current.lanes=s,rr(a,s),ba(a),t[lr]=a.current,Wd(t),new rc(a)},si.version="19.2.7",si}var Rx;function Vw(){if(Rx)return xf.exports;Rx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),xf.exports=Fw(),xf.exports}var Gw=Vw();const B1={appName:"PenguinHarness",nav:{chat:"对话",newChat:"新对话",agents:"智能体仓库",skills:"技能库",models:"模型仓库",usage:"成本中心",traces:"轨迹观测",benchmark:"评估中心",lastConversation:"最近一次对话",railAgents:"智能体",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",collapseGroup:"折叠",expandGroup:"展开",pinGroup:"置顶分组",unpinGroup:"取消置顶"},settings:{language:"语言",theme:"主题",themeLight:"浅色",themeDark:"深色",followSystem:"跟随系统",langZh:"中文",langEn:"English",fontSize:"字号",fontSmall:"小",fontMedium:"中",fontLarge:"大",accent:"主题色",accentNames:{neutral:"灰白",blue:"蓝",green:"绿",violet:"紫",rose:"红",amber:"橙"}},common:{save:"保存",cancel:"取消",create:"创建",delete:"删除",edit:"编辑",settings:"设置",confirm:"确认",close:"关闭",loading:"加载中…",loadMore:"加载更多",saved:"已保存",saving:"保存中…",none:"(无)",retry:"重试",unknownError:"请求失败,请稍后重试",requiredField:"此项必填",copied:"已复制",ownerOnly:"仅 owner 可修改"},auth:{loginTitle:"登录 PenguinHarness",username:"用户名",usernameHint:"2~32 位:小写字母开头,仅小写字母、数字与下划线",password:"密码",passwordHint:"至少 8 个字符",showPassword:"显示密码",hidePassword:"隐藏密码",login:"登录",logout:"登出",admin:"管理员",defaultAdminNote:"首次使用请以内置管理员登录:admin / penguin-2026,登录后请尽快修改密码"},account:{changePassword:"修改密码",oldPassword:"当前密码",oldPasswordHint:"内置管理员的默认初始密码为 penguin-2026",newPassword:"新密码",confirmPassword:"确认新密码",passwordMismatch:"两次输入的新密码不一致",initialPasswordBanner:"当前账号正在使用初始密码,建议尽快修改",changeNow:"去修改"},admin:{users:"用户管理",userId:"用户名",role:"角色",roleAdmin:"管理员",roleUser:"用户",createdAt:"创建时间",actions:"操作",createUser:"新增用户",initialPassword:"初始密码",initialPasswordFlag:"初始密码",defaultProjectNote:e=>`将自动创建默认 Project:${e}`,resetPassword:"重置密码",resetPasswordTitle:e=>`重置 ${e} 的密码`,resetPasswordNote:"重置后该用户的登录会话全部失效,需用新密码重新登录",deleteUser:"删除",deleteUserTitle:e=>`删除用户 ${e}`,deleteUserConfirm:e=>`将删除用户 ${e} 及其名下全部 Project(含数据目录),不可恢复。`},project:{switcher:"Project",create:"新建 Project",createTitle:"新建 Project",id:"Project id",idHint:"2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",idPrefixHint:"id 固定以「用户名-」为前缀,后接小写字母、数字或下划线;创建后不可修改",name:"显示名(可选,缺省为 Project id)",settings:"Project 设置",settingsTitle:"Project 设置",members:"成员",addMember:"添加成员",memberUsername:"用户名",memberRole:"角色",memberActions:"操作",removeMember:"移除",owner:"owner",member:"member",deleteProject:"删除 Project",deleteConfirm:"确认删除该 Project?项目目录将被递归删除,不可恢复。",deleteDefaultForbidden:"default_project 与 CLI 共用,不允许在 Web 端删除",deleteLastForbidden:"这是当前账号最后一个 Project,删除后将无 Project 可用;请先创建新的 Project",noCredentialTitle:"尚未配置模型 credential",noCredentialBody:"当前 Project 的默认模型尚未配置 API key,发起对话前请先前往模型页配置。",goToModels:"前往模型页",later:"稍后再说"},agent:{listTitle:"Agents",create:"创建 Agent",createTitle:"创建 Agent",id:"Agent id",idHint:"2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",name:"名称",nameHint:"留空则使用 Agent id 作为名称",description:"描述",activeSessions:"活跃 Session",sessionCount:e=>`${e} 个 Session`,toolCount:e=>`${e} 个工具`,vaultKeyCount:e=>`${e} 个密钥`,scheduleCount:e=>`${e} 个定时任务`,updatedAt:"最后修改",activity:e=>`近 ${e} 天 Session 活跃度`,settings:"Agent 设置",backToList:"返回 Agents",tabOverview:"概览",tabPrompt:"Prompt",tabRuntime:"运行参数",tabTools:"工具",tabVault:"密钥保险柜",tabSchedules:"定时任务",stateDir:"State 路径",agentsMd:"AGENTS.md",systemPrompt:"system_prompt 模板",placeholdersTitle:"可用占位符(点击插入)",insertPlaceholder:"插入到 system_prompt 光标处",placeholders:[["{{AGENTS_MD}}","注入 AGENTS.md 内容"],["{{VAULT_KEYS}}","注入密钥保险柜的键名小节(无键时为空)"],["{{PLATFORM}}","运行平台"],["{{OS_VERSION}}","操作系统版本"],["{{DATE}}","当前日期"],["{{CWD}}","Workspace 绝对路径"],["{{AGENT_ID}}","当前 Agent id"],["{{PROJECT_DIR}}","Project 目录绝对路径(Agent State/scratchpad 由此拼出)"],["{{SESSION_ID}}","当前 Session id"]],maxTurns:"max_turns(单 Task 最大轮次,-1 不限制)",maxTokens:"model.max_tokens",thinkingLevel:"model.thinking_level",thinkingLevelOptions:[["","不提交覆盖值,沿用当前生效的配置。"],["low","开启较低强度的扩展推理。"],["medium","开启中等强度的扩展推理(新建 Agent 的缺省档位)。"],["high","开启较高强度的扩展推理,响应更慢。"],["xhigh","开启最高强度的扩展推理,部分模型上效果与 high 相同。"]],thinkingLevelNoneKept:"已存的历史档位:新选择不再提供关闭档(多数模型不支持关闭思考)。",timeoutMs:"model.timeoutMs",timeoutMsHint:"单次 Request 超时,毫秒",compaction:"上下文压缩(compaction)",maxContextLength:"max_context_length",maxContextLengthHint:"触发压缩的上下文阈值",maxSessionTurns:"max_session_turns",maxSessionTurnsHint:"触发压缩的轮数阈值",compactionMode:"mode(压缩方式)",compactionModeOptions:[["","不提交覆盖值,沿用当前生效的配置。"],["summarize","先让模型为旧上下文生成摘要,再从摘要续接新的上下文窗口(缺省)。"],["discard","不生成摘要,直接丢弃旧上下文,下一轮从新窗口重新开始。"]],compactionPrompt:"prompt(摘要提示词)",maxTurnsInvalid:"max_turns 必须 > 0 或为 -1",timeoutInvalid:"timeoutMs 必须 > 0 或为 -1",toolFieldInvalid:(e,n)=>`${e}: ${n} 必须是 > 0 的整数或 -1`,builtinTools:"内置工具",toolName:"名称",toolPermission:"permission",permissionReadLabel:"Read-only",permissionReadDescription:"仅读取。审批模式为 read-only 时自动放行,无需确认。",permissionReadWriteLabel:"Read & write",permissionReadWriteDescription:"可修改。审批模式为 read-only 时需人工确认。",toolTimeout:"timeoutMs",toolMaxOutput:"maxOutputLength",mcpServers:"MCP Server(只读)",defaultValue:"(缺省)",resetToDefault:"恢复缺省",deleteAgent:"删除 Agent",builtinUndeletable:"内置 Agent 不可被删除",deleteConfirm:e=>`确认删除 Agent「${e}」?其目录(含全部 Trace)将被递归删除,不可恢复。`,stateVersion:"Agent State 版本",transferTitle:"导出 / 导入",transferDesc:"导出当前 Agent State 快照包(tar.gz);导入整目录覆盖,并以包内版本为准。",exportSnapshot:"导出快照",importSnapshot:"导入快照",importing:"导入中…",importDone:e=>`导入完成,Agent State 版本 v${e}`,importConflictTitle:"版本冲突",importConflictBody:"快照包版本不高于当前版本,导入将覆盖现有 Agent State。确认继续?"},models:{title:"模型配置",addCustom:"添加自定义模型",addToGroup:"新增模型",editTitle:"模型配置",addTitle:"新增模型(OpenAI 协议)",addTitleVendor:"新增模型(按 id 自动路由)",addProtocolHint:"新增模型固定走 OpenAI Chat Completions 兼容协议(不按模型 id 自动路由),base URL 填其兼容端点",addAutoRouteHint:"该分组的新模型按上游 id 由 AgentHub 自动路由到厂商官方客户端:base URL 留空即官方端点,API key 留空按解析出的客户端读取环境变量",autoRouteNone:"该 id 无法被 AgentHub 自动路由:请核对 id,或改在 Custom / 自建分组下以 OpenAI 协议接入",addGroup:"新增分组",addGroupTitle:"新增分组",addGroupDesc:"自建分组与 Custom 同语义:组内模型走 OpenAI Chat Completions 兼容协议(base URL 必填,API key 留空读取 OPENAI_API_KEY)。分组由模型条目承载,保存首个模型后即出现。",groupNameLabel:"分组名",groupNameHint:"小写字母 / 数字开头,可含 - 与 _",groupNameInvalid:"分组名只能用小写字母、数字、- 与 _(首字符为字母或数字),长度不超过 32",groupNameExists:"该分组名已被内置分组或既有条目占用",groupEmptyHint:"该分组暂无模型,点「新增模型」添加",searchPlaceholder:"搜索模型:id / 名称 / 厂商",noSearchResults:"没有匹配的模型",syncCatalog:"同步预置",syncCatalogHint:"用内置目录更新预置模型:新增缺失条目、以目录字段为准刷新差异;本地新增模型与 API key 保持不变",syncDone:(e,n)=>`预置模型已同步:新增 ${e}、更新 ${n}`,syncUpToDate:"预置模型已是最新",homepage:"模型主页",speedTest:"测速",speedTestTitle:"分组测速",speedTestConfirm:e=>`将对该分组的 ${e} 个模型逐个发起一次真实请求,测量首 token 延迟(TTFT)与输出速率(TPS),会消耗少量 API 额度。是否继续?`,speedTestStart:"开始测速",speedPending:"测速中…",speedFailed:"测速失败",ttftTitle:"首 token 延迟(TTFT)",tpsTitle:"输出速率(TPS)",modelCount:e=>`${e} 个模型`,modelId:"模型 ID",modelIdHint:"上游 API 使用的模型 id,如 gpt-5.5",displayName:"模型名称",displayNameHint:"留空则展示模型 ID",providerGroup:"分组",contextWindow:"上下文窗口",tokenUnit:"Token",contextWindowHint:"留空表示未知",maxTokens:"最大输出长度",maxTokensHint:"留空沿用 Agent 设置",maxTokensTitle:"按模型限制单次请求的最大输出 Token 数;留空沿用 Agent 设置,小上下文模型建议调低",maxTokensInvalid:"必须为正整数",clientTypeLocked:e=>`协议:${e}(沿用原配置,不可修改)`,vision:"支持视觉",visionOffProxyHint:"使用视觉代理模型读图",visionBadge:"视觉",visionModelBadge:"视觉代理",setVisionModel:"设为视觉代理模型",visionModelHint:"供不支持图片的模型经 describe_image 代读图片",priceUnitShort:"/M tok",testConnection:"测试连通性",testing:"测试中…",testOk:e=>`连通正常(${e} ms)`,testFailed:e=>`连通失败:${e}`,modelIdRenameHint:"改 id 后原配置与 API key 一并迁移",priceCacheRead:"缓存读取价格",priceCacheWrite:"缓存写入价格",priceOutput:"输出价格",priceUnit:"每百万 Token",currency:"币种",currencyUsd:"美元 $",currencyCny:"人民币 ¥",currencyHint:"价格按 1 美元 ≈ 7 人民币折算;存储始终为美元",firstModelDefault:"已自动设为默认模型",credential:"凭据",apiKey:"API key",apiKeyKeepHint:"留空保留现有 key",apiKeyEnvHint:e=>`留空则使用环境变量 ${e}`,useEnvVar:e=>`环境变量 ${e}`,keyConfigured:"已配置 key",clearApiKey:"清除已存 API key",baseUrl:"自定义 base URL",baseUrlHint:"留空使用厂商默认地址",baseUrlRequired:"必须填写 base URL",contextWindowDefaultHint:e=>`留空按 ${e} 计`,confirmDeleteTitle:"删除模型",confirmDelete:e=>`确定删除「${e}」?该模型的配置与 API key 将一并移除。`,groupApiKey:"统一配置 API key",groupApiKeyTitle:e=>`为「${e}」统一配置 API key`,groupApiKeyHint:e=>`将写入该分组下全部 ${e} 个模型;留空不改动。`,getApiKey:"获取 API key",getModelIds:"获取模型 id",groupKeyApplied:e=>`已为 ${e} 个模型配置 API key`,providerEnvNotes:{zhipu:"缺省端点为 Z.AI 国际版(api.z.ai);智谱开放平台(bigmodel.cn)的 key 需填 base URL https://open.bigmodel.cn/api/paas/v4",moonshot:"缺省端点为国内版(api.moonshot.cn);platform.kimi.com(国际)的 key 需填 base URL https://api.moonshot.ai/v1"},confirmVisionModelTitle:"设为视觉代理模型",confirmVisionModel:e=>`确定把「${e}」设为视觉代理模型?不支持图片的模型将由它经 describe_image 代读图片。`,confirmSaveTitle:"保存模型配置",confirmSave:e=>`确定保存对「${e}」的配置修改?`,confirmDefaultTitle:"设为默认模型",confirmDefault:e=>`确定把「${e}」设为默认模型?新建的 Session 将默认使用它。`,createdAt:"创建时间",default:"默认",setDefault:"设为默认模型",remove:"删除模型",saveAll:"保存全部",readOnlyHint:"member 只读;模型与 credential 修改仅 owner 可执行",empty:"尚未配置任何模型",noKey:"未配置 key",showModelsWithoutKey:e=>`显示未配置 key 的模型(${e} 个)`,pendingSave:"(待保存)",modelIdExists:"该模型 id 已存在",pricingAllOrNone:"三项价格需一并填写",pricingInvalid:"必须为数字",contextWindowInvalid:"必须为数字"},vault:{desc:"本 Agent 专属的环境变量(存于 agent_state/.vault.toml):键值对注入其 shell 命令(exec_command)的子进程环境;键名会告知模型,值不进入模型上下文。子 Agent 使用各自的保险柜,不继承。保存后自下一个任务起生效(进行中的任务不受影响)。",key:"键名",value:"值",valueMasked:"值(掩码)",add:"添加",addTitle:"添加环境变量",remove:"删除",deleteTitle:"删除环境变量",deleteConfirm:e=>`确认删除环境变量「${e}」?值不可恢复。`,empty:"尚未配置任何环境变量",readOnlyHint:"member 只读;Vault 修改仅 owner 可执行",keyHint:"字母、数字与下划线,不能以数字开头",keyInvalid:"键名不合法:仅字母、数字与下划线,且不能以数字开头",valueRequired:"值不能为空"},schedule:{desc:"定时任务(agent_state/schedule/*.toml):到点自动向目标 Session 发送 prompt;文件亦可手工编辑,Web 端修改后即时生效。",readOnlyHint:"member 只读;定时任务修改仅 owner 可执行",colName:"名称",colStatus:"状态",colPeriod:"周期",colTarget:"目标",colFireTimes:"下次 / 最近触发",colQueued:"排队",statusNames:{active:"生效",disabled:"停用",expired:"已过期",done:"已完成",missed:"已错过",invalid:"无效"},queued:"排队中",once:"一次性",newSession:"新建会话",invalidFiles:"解析失败的文件(已跳过调度)",empty:"尚未配置定时任务",enable:"启用",disable:"停用",addTitle:"新建定时任务",editTitle:e=>`编辑定时任务「${e}」`,name:"名称",nameHint:"即文件名(不含 .toml),创建后不可改",prompt:"Prompt",enabled:"启用",startAt:"开始时间",endAt:"结束时间(可选)",period:"周期",periodPlaceholder:"30m / 12h / 7d,留空为一次性",target:"目标",targetNew:"每次新建会话",targetSession:"绑定 Session",sessionId:"Session id",workspace:"Workspace(可选,留空自动创建)",model:"Model",modelDefault:"Project 默认",deleteTitle:"删除定时任务",deleteConfirm:e=>`确认删除定时任务「${e}」?`},skills:{pageTitle:"技能库",pageDesc:"内置 Skill 库:浏览、快捷调用,或安装到 Agent。",quickInvoke:"快捷调用",quickInvokeText:e=>`使用 ${e} 技能`,manageInstall:"管理安装",manageInstallTitle:e=>`管理安装:${e}`,install:"安装",installed:"已安装",uninstall:"卸载",skillCount:e=>`${e} 个技能`,usedByAgents:e=>e===0?"未被使用":`${e} 个 Agent 在用`,installedToast:(e,n)=>`已将 ${e} 安装到 ${n}`,updateOutdated:e=>`有新版本:更新 ${e} 个 Agent 的安装`,updateAction:"更新",updatedToast:(e,n)=>`已将 ${e} 更新到最新版(${n} 个 Agent)`,uninstalledToast:(e,n)=>`已从 ${n} 卸载 ${e}`},chat:{newSessionMenu:"新建对话",chooseAgent:"选择 Agent",chooseModel:"选择模型",thinkingLevel:"思考等级",thinkingLevelNames:{none:"无",low:"低",medium:"中",high:"高",xhigh:"极高"},workspaceUseThis:"使用此目录",workspaceUp:"上级目录",workspaceNoSubdirs:"无子目录",workspaceAuto:"自动临时目录",workspaceClear:"改用自动临时目录",workspaceDirInvalid:"目录不存在或无法访问,已回退",groupByWorkspace:"按工作区分组",groupByAgent:"按 Agent 分组",tempWorkspaces:"临时工作区",newSessionInWorkspace:"在此工作区新建对话",draftSubtitle:"最擅长 AI 开发任务的自进化 Agent",exampleTasks:{game:{label:"示例:2D 企鹅雪橇越野小游戏",desc:"可爱南极企鹅滑雪橇跳石头,难度由易到难的 2D 纯前端小游戏",prompt:"做一个可爱的南极企鹅滑雪橇越野 2D 小游戏:按空格键起跳,跃过冰面上迎面而来的石头;开局要足够简单、上手无压力,滑行速度与障碍密度随时间平滑、循序渐进地上升,避免突然变难,实时计分,撞上石头即结束并可一键重新开始。2D 横版画面、可爱卡通风,纯前端实现(单个 HTML 文件即可),界面遵循 web-design 技能。完成后在浏览器里自测一次,确认开局能轻松玩过几秒,并告诉我怎么打开和怎么玩。"},lol:{label:"示例:英雄联盟音乐播放器",desc:"用 SoundCloud Widget API 播放历届 Worlds 主题曲,单文件即开即用",prompt:`用 SoundCloud Widget API(见 https://developers.soundcloud.com/docs/api/html5-widget)做一个英雄联盟 Worlds 主题曲播放器,单文件 index.html,file:// 打开即用。
|
|
10
|
+
|
|
11
|
+
## 技术约束
|
|
12
|
+
- 使用 SC.Widget JS API(widget.load / widget.toggle / widget.setVolume / widget.seekTo),引入 https://w.soundcloud.com/player/api.js
|
|
13
|
+
- iframe 必须可见(180px 高),visual=true color=f0b90b single_active=true
|
|
14
|
+
- 仅包含以下 8 首已确认可播曲目(oEmbed 验证通过),不要添加未经 oEmbed 验证的曲目:
|
|
15
|
+
- Warriors (S4) — soundcloud.com/leagueoflegends/warriors
|
|
16
|
+
- Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
|
|
17
|
+
- Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
|
|
18
|
+
- Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
|
|
19
|
+
- Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
|
|
20
|
+
- GODS (S13) — soundcloud.com/leagueoflegends/gods
|
|
21
|
+
- Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
|
|
22
|
+
- Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
|
|
23
|
+
|
|
24
|
+
## 布局
|
|
25
|
+
- 左侧 260px 粘性侧边栏:曲目列表(S4/S5/… 标签 + emoji + 曲名 + 年份),点击高亮金色边框,SC.Widget.load() 切歌 + auto_play
|
|
26
|
+
- 右侧主区域:Hero 标题 + 桌面时钟(80px 等宽金色 HH:MM:SS,每秒刷新,冒号闪烁)+ 心情标签
|
|
27
|
+
- 播放器卡片:SoundCloud iframe + 自定义控制栏(⏮ ▶/⏸ ⏭ + 曲目信息 + 音量滑块,点击喇叭图标静音切换)
|
|
28
|
+
- 心情波动区:15 根金色动画柱,切歌时重新随机生成
|
|
29
|
+
- 键盘快捷键:空格播放暂停、← → 切歌、↑ ↓ 调音量
|
|
30
|
+
|
|
31
|
+
## 设计
|
|
32
|
+
Penguin 视觉风格(见 web-design 技能),深色/浅色主题(<html data-theme>),默认深色,localStorage 记忆。响应式:手机端侧边栏变为顶部横向滚动。
|
|
33
|
+
|
|
34
|
+
完成后在浏览器打开 index.html 自测一次。`},rag:{label:"示例:构建 Claude Code 文档专家",desc:"收集 claude-code-docs 仓库,生成可对话、带来源引用的 RAG 知识应用",prompt:"收集 https://github.com/ericbuess/claude-code-docs 的文档,构建一个 RAG 知识应用:克隆仓库并整理语料,建立检索索引;应用化身 Claude Code 配置专家,检索增强回答 Claude Code 相关问题并标注可点击的来源引用——引用要能展示命中的原文片段,并链接到真实文档;按 web-design 技能提供美观的 Web 聊天界面,空态展示几个示例问题。完成后运行应用、自测一个问题验证流式回答,并告诉我访问方式。"}},sessionList:"Session",defaultSessionTitle:"新对话",model:"Model",workspace:"Workspace",workspaceHint:"留空自动创建临时目录;指定时必须是服务器上已存在的目录",approvalMode:"审批模式",approvalModeNames:{"allow-all":"全部放行","deny-all":"全部拒绝","read-only":"放行只读","always-ask":"总是询问"},approvalModes:{"allow-all":"全部放行(allow-all)","deny-all":"全部拒绝(deny-all)","read-only":"放行只读(read-only)","always-ask":"总是询问(always-ask)"},statusIdle:"空闲",statusRunning:"运行中",statusCompacting:"压缩中",pendingApprovals:e=>`${e} 个待审批`,jumpToLatest:"回到最新消息",inputPlaceholder:"输入消息,Enter 发送,Shift+Enter 换行,可粘贴图片",inputPlaceholderShort:"输入消息…",send:"发送",stop:"停止",compactingHint:"上下文压缩中,暂不接受新输入",compact:"压缩上下文",approve:"允许",deny:"拒绝",decisionAllow:"已批准",decisionDeny:"已拒绝",decisionManual:"手动",decisionAuto:"自动",thinking:"思考",subagent:"子会话",subagentRunning:"运行中",aborted:e=>`[已中断]${e?`:${e}`:""}`,reconnect:(e,n,r)=>{const l=e==="timeout"?"连接超时或网络中断":"响应不完整或无法解析",o=n==="gaveUp"?"已停止重试":n==="retried"?`已发起第 ${r} 次重试`:`正在发起第 ${r} 次重试…`;return`[重试] ${l},${o}`},imageAlt:"用户上传的图片",toolImageAlt:"工具输出的图片",imagesAsPathHint:"当前模型不支持直接查看图片:发送时图片将保存到会话临时目录,以文件路径转交(模型经 describe_image 查看)",infoPanel:"Session 信息",sessionStats:"统计",statTokens:"Token 累计",statCost:"成本",statElapsed:"用时",statInput:"输入 tokens",statCached:"已缓存",statOutput:"输出 tokens",statTps:"输出 TPS",statParenOpen:"(",statParenClose:")",noSessions:"还没有 Session",emptyStream:"发送一条消息开始对话",historyLoadFailed:"历史消息加载失败",sessionHealed:"Session 已自愈为新 id",statsLabel:"统计信息",removeImage:"移除图片",openWorkspace:"打开工作区",filesInMessage:e=>`${e} 个文件`,openPreview:"点击预览",showMoreFiles:e=>`显示其余 ${e} 个文件`,showLess:"收起",contextUsage:"上下文占用",contextUnknown:"上下文占用:压缩后待下次请求回报",slashHint:"输入 / 使用命令",mentionHint:"@ handoff 给其他 Agent",mentionRemove:"移除 @ 目标",skillsSelect:"技能",skillRemove:"移除技能",skillsSearchPlaceholder:"搜索技能",skillsNoMatch:"没有匹配的技能",skillsEmptyHint:"暂无已装技能,去技能库添加",skillsAutoMessage:e=>`使用 ${e.join("、")} 技能`,handoffFrom:e=>`由 ${e} 的对话交接而来`,handoffBack:e=>e?`回到原对话:${e}`:"回到原对话",scheduledFrom:e=>`由定时任务「${e}」触发`,sourceNames:{schedule:"定时",subagent:"子"},commandCompact:"/compact",emptyGreeting:"开始一段新对话",compactionRunning:e=>`压缩进行中(${e})…`,compactionDone:e=>e==="discard"?"[压缩] 完成,旧上下文已丢弃":"[压缩] 完成,已切换到摘要后的新上下文",compactionFailed:e=>`[压缩] ${e==="aborted"?"已中断":"失败"},保留当前上下文`,unknownTool:"(未知工具)",toolCall:"工具调用",workGroupTitle:"推理与工具",workRunning:"运行中",workDone:"运行完毕",workGroupSteps:e=>`${e} 步`,approvalWaiting:"待审批",copyCode:"复制代码",copyStats:"复制统计",copyReply:"复制回复",copyMessage:"复制消息",copied:"已复制",deleteSession:"删除对话",renameSession:"重命名对话",renameSessionLabel:"标题",deleteSessionConfirm:e=>`确定删除「${e}」?该对话的消息与 Trace 将被移除,且不可恢复。`,archiveSession:"归档",unarchiveSession:"取消归档",archivedGroup:e=>`已归档(${e})`,loadMore:"更多",sourceGroups:{subagent:e=>`子智能体(${e})`,schedule:e=>`定时任务(${e})`},skillsBanner:e=>`使用技能:${e.join("、")}`},files:{title:"文件",upload:"上传",download:"下载",openInNewTab:"新页面打开",refresh:"刷新",root:"根目录",empty:"空目录",name:"名称",size:"大小",modified:"修改时间",previewUnsupported:"该类型不支持预览,请下载查看",uploaded:"已上传",loadFailed:"加载失败",previewTruncated:"内容过大,预览已截断,请下载查看完整文件",details:"详情",workspacePath:"Workspace 路径",htmlRendered:"渲染视图",htmlSource:"源码",backToList:"返回列表",resizeHandle:"拖拽调整宽度,双击恢复默认"},usage:{title:"成本与统计",today:"今日",last7d:"近 7 天",total:"累计",tokens:"Token",cost:"成本",requests:"Requests",from:"起始日期",to:"结束日期",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",colCost:"成本",trendTitle:"近 30 天趋势",uncostedNote:"* 含未配置 pricing 的记录,成本为不完全统计",filterAllAgents:"全部 Agent",filterAllModels:"全部模型",chartAgentCalls:"各 Agent 调用次数",chartSuccessRate:"各模型成功率",chartTokenTrend:"Token 逐日变化",chartCostTrend:"成本逐日变化",empty:"暂无用量记录",successAborted:"已中断(不计入)",errors:"异常",errorsTotal:"总数",errorsUnexpected:"未预期",errorsExpected:"预期内",errorsTopCode:"最常见",errorsColTime:"时间",errorsColCode:"来源 · 错误码",errorsColKind:"类型",errorsColMessage:"消息",errorsEmpty:"暂无异常"},traces:{title:"轨迹观测",filterAll:"全部",filterModel:"model_msg",filterEvent:"event_msg",analysis:"轨迹观测",timeline:"执行时间线",laneLLM:"模型",laneTools:"工具",phaseApproval:"审批",phaseExec:"执行",kindThinking:"思考",kindModelReply:"模型回复",kindToolGen:"工具调用生成",legendToolExec:"工具调用执行",legendApprovalWait:"审批等待",task:e=>`第 ${e} 轮`,globalSummary:"全局统计",tasksLabel:"轮次",messages:"消息",truncatedNote:(e,n)=>`仅展示前 ${e} / ${n} 条消息`,zoom:"缩放",zoomReset:"双击复位缩放",zoomOut:"缩小",zoomIn:"放大",linkHint:"鼠标移到时间线段或消息行即可联动高亮,点击时间线段跳转到对应消息;图例可高亮同类;拖动下方滑块平移/缩放",filesTitle:"Trace 文件",selectSession:"在左侧选择一个 Session",toolCalls:"工具调用",taskInput:"本轮输入 tokens",taskOutput:"本轮输出 tokens",cacheHit:"命中缓存",hitRate:"命中率",toolFailRate:"失败率",compactions:"压缩次数",compactionRound:"压缩",usageTrend:"Token 用量趋势",selectFile:"在左侧选择一个 Trace 文件",empty:"该 Agent 暂无 Trace",colTime:"时间",colType:"类型",colSummary:"摘要",lines:e=>`${e} 行`,inProgress:"进行中",systemPrompt:"系统提示词",toolDefs:e=>`工具定义(${e})`},benchmark:{title:"评估中心",selectBenchmark:"在左侧选择一个 Benchmark",emptyAgent:"该 Agent 暂无 Benchmark",caseCount:e=>`${e} 题`,trendTitle:e=>`${e}随时间变化`,evaluations:"评估明细",noEvaluations:"暂无评估记录",summaryLabel:"评估说明",legendUnlabeled:"未标注模型",colTime:"时间",colVersion:"版本",colModel:"模型",colScore:"总分",colCost:"成本",colDuration:"耗时",colCase:"题目",colRun:"运行",colSession:"Session"},errors:{unauthorized:"登录已过期,请重新登录",networkError:"网络错误,请检查连接",modelCredentialMissing:e=>`模型 ${e} 还没有可用的 API key,请先在「模型」页为它配置`,noDefaultModel:"该 Project 还没有默认模型,请先在「模型」页添加模型并设为默认"}};let x=B1;function Kw(e){x=e}const Ww={appName:"PenguinHarness",nav:{chat:"Chat",newChat:"New chat",agents:"Agents",skills:"Skills",models:"Models",usage:"Costs",traces:"Trajectory",benchmark:"Evaluation Center",lastConversation:"Last conversation",railAgents:"Agents",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",collapseGroup:"Collapse",expandGroup:"Expand",pinGroup:"Pin group",unpinGroup:"Unpin group"},settings:{language:"Language",theme:"Theme",themeLight:"Light",themeDark:"Dark",followSystem:"System",langZh:"中文",langEn:"English",fontSize:"Font size",fontSmall:"S",fontMedium:"M",fontLarge:"L",accent:"Accent",accentNames:{neutral:"Neutral",blue:"Blue",green:"Green",violet:"Violet",rose:"Rose",amber:"Amber"}},common:{save:"Save",cancel:"Cancel",create:"Create",delete:"Delete",edit:"Edit",settings:"Settings",confirm:"Confirm",close:"Close",loading:"Loading…",loadMore:"Load more",saved:"Saved",saving:"Saving…",none:"(none)",retry:"Retry",unknownError:"Request failed, please try again later",requiredField:"This field is required",copied:"Copied",ownerOnly:"Only the owner can modify this"},auth:{loginTitle:"Sign in to PenguinHarness",username:"Username",usernameHint:"2–32 chars: starts with a lowercase letter; lowercase letters, digits and underscores only",password:"Password",passwordHint:"At least 8 characters",showPassword:"Show password",hidePassword:"Hide password",login:"Sign in",logout:"Sign out",admin:"Admin",defaultAdminNote:"First run: sign in as the built-in admin (admin / penguin-2026), then change the password soon"},account:{changePassword:"Change password",oldPassword:"Current password",oldPasswordHint:"The built-in admin's default initial password is penguin-2026",newPassword:"New password",confirmPassword:"Confirm new password",passwordMismatch:"New passwords do not match",initialPasswordBanner:"This account is using its initial password. Please change it soon.",changeNow:"Change now"},admin:{users:"Users",userId:"Username",role:"Role",roleAdmin:"Admin",roleUser:"User",createdAt:"Created",actions:"Actions",createUser:"Add user",initialPassword:"Initial password",initialPasswordFlag:"initial password",defaultProjectNote:e=>`A default Project will be created: ${e}`,resetPassword:"Reset password",resetPasswordTitle:e=>`Reset password for ${e}`,resetPasswordNote:"All sign-in sessions of this user will be revoked; they must sign in with the new password",deleteUser:"Delete",deleteUserTitle:e=>`Delete user ${e}`,deleteUserConfirm:e=>`This deletes user ${e} and every Project they own (including data directories). This cannot be undone.`},project:{switcher:"Project",create:"New Project",createTitle:"New Project",id:"Project id",idHint:"2–64 chars: starts with a lowercase letter; lowercase letters, digits and underscores only. Cannot be changed later.",idPrefixHint:"The id is prefixed with your username and a hyphen; append lowercase letters, digits or underscores. Cannot be changed later.",name:"Display name (optional, defaults to the Project id)",settings:"Project settings",settingsTitle:"Project settings",members:"Members",addMember:"Add member",memberUsername:"Username",memberRole:"Role",memberActions:"Actions",removeMember:"Remove",owner:"owner",member:"member",deleteProject:"Delete Project",deleteConfirm:"Delete this Project? Its directory will be removed recursively and cannot be recovered.",deleteLastForbidden:"This is the last Project on this account; create another Project before deleting it",deleteDefaultForbidden:"default_project is shared with the CLI and cannot be deleted from the web",noCredentialTitle:"No model credential configured",noCredentialBody:"The default model of this Project has no API key yet. Configure it on the Models page before chatting.",goToModels:"Go to Models",later:"Later"},agent:{listTitle:"Agents",create:"Create Agent",createTitle:"Create Agent",id:"Agent id",idHint:"2–64 chars: starts with a lowercase letter; lowercase letters, digits and underscores only. Cannot be changed later.",name:"Name",nameHint:"Leave empty to use the Agent id as the name",description:"Description",activeSessions:"Active Sessions",sessionCount:e=>`${e} session${e===1?"":"s"}`,toolCount:e=>`${e} tool${e===1?"":"s"}`,vaultKeyCount:e=>`${e} vault key${e===1?"":"s"}`,scheduleCount:e=>`${e} scheduled task${e===1?"":"s"}`,updatedAt:"Last modified",activity:e=>`${e}-day session activity`,settings:"Agent settings",backToList:"Back to Agents",tabOverview:"Overview",tabPrompt:"Prompt",tabRuntime:"Runtime",tabTools:"Tools",tabVault:"Vault",tabSchedules:"Schedules",stateDir:"State path",agentsMd:"AGENTS.md",systemPrompt:"system_prompt template",placeholdersTitle:"Available placeholders (click to insert)",insertPlaceholder:"Insert at the system_prompt cursor",placeholders:[["{{AGENTS_MD}}","Injects the AGENTS.md content"],["{{VAULT_KEYS}}","Injects the vault key-name section (empty when no keys)"],["{{PLATFORM}}","Runtime platform"],["{{OS_VERSION}}","Operating system version"],["{{DATE}}","Current date"],["{{CWD}}","Absolute Workspace path"],["{{AGENT_ID}}","Current Agent id"],["{{PROJECT_DIR}}","Absolute Project directory (Agent State/scratchpad derive from it)"],["{{SESSION_ID}}","Current Session id"]],maxTurns:"max_turns (max turns per Task, -1 = unlimited)",maxTokens:"model.max_tokens",thinkingLevel:"model.thinking_level",thinkingLevelOptions:[["","Send no override — keep whatever is currently configured."],["low","Enables a lower tier of extended reasoning."],["medium","Enables a medium tier of extended reasoning (the default tier for a newly created agent)."],["high","Enables a higher tier of extended reasoning; slower responses."],["xhigh","Enables the highest tier of extended reasoning; identical to high on some models."]],thinkingLevelNoneKept:"Stored legacy tier: new selections no longer offer the off tier (many models cannot disable thinking).",timeoutMs:"model.timeoutMs",timeoutMsHint:"Per-request timeout, ms",compaction:"Context compaction",maxContextLength:"max_context_length",maxContextLengthHint:"Context threshold that triggers compaction",maxSessionTurns:"max_session_turns",maxSessionTurnsHint:"Turn threshold that triggers compaction",compactionMode:"mode (compaction strategy)",compactionModeOptions:[["","Send no override — keep whatever is currently configured."],["summarize","Summarizes the old context with the model, then continues from that summary in a fresh window (default)."],["discard","Drops the old context without summarizing; the next turn starts fresh in a new window."]],compactionPrompt:"prompt (summarization prompt)",maxTurnsInvalid:"max_turns must be > 0 or -1",timeoutInvalid:"timeoutMs must be > 0 or -1",toolFieldInvalid:(e,n)=>`${e}: ${n} must be a positive integer or -1`,builtinTools:"Built-in tools",toolName:"Name",toolPermission:"permission",permissionReadLabel:"Read-only",permissionReadDescription:"Only reads. Auto-approved when the approval mode is read-only.",permissionReadWriteLabel:"Read & write",permissionReadWriteDescription:"Can modify things. Needs manual confirmation when the approval mode is read-only.",toolTimeout:"timeoutMs",toolMaxOutput:"maxOutputLength",mcpServers:"MCP Servers (read-only)",defaultValue:"(default)",resetToDefault:"Reset to default",deleteAgent:"Delete Agent",builtinUndeletable:"Built-in Agents cannot be deleted",deleteConfirm:e=>`Delete Agent "${e}"? Its directory (including all Traces) will be removed recursively and cannot be recovered.`,stateVersion:"Agent State version",transferTitle:"Export / import",transferDesc:"Export the current Agent State snapshot (tar.gz); importing overwrites the whole directory and adopts the version inside the package.",exportSnapshot:"Export snapshot",importSnapshot:"Import snapshot",importing:"Importing…",importDone:e=>`Import finished, Agent State version v${e}`,importConflictTitle:"Version conflict",importConflictBody:"The snapshot's version is not newer than the current one; importing will overwrite the existing Agent State. Continue?"},models:{title:"Models",addCustom:"Add custom model",addToGroup:"Add model",editTitle:"Model settings",addTitle:"Add model (OpenAI protocol)",addTitleVendor:"Add model (auto-routed by id)",addProtocolHint:"New models always use the OpenAI Chat Completions protocol (no auto-routing by model id); set the base URL to a compatible endpoint",addAutoRouteHint:"New models in this group are auto-routed by their upstream id to the vendor's official client: leave the base URL empty for the official endpoint, and an empty API key falls back to the resolved client's environment variable",autoRouteNone:"AgentHub cannot auto-route this id: double-check it, or add the model under Custom / a user-defined group with the OpenAI protocol",addGroup:"Add group",addGroupTitle:"Add group",addGroupDesc:"User-defined groups share Custom semantics: models use the OpenAI Chat Completions protocol (base URL required; an empty API key reads OPENAI_API_KEY). Groups live on model entries — the group appears once its first model is saved.",groupNameLabel:"Group name",groupNameHint:"Starts with a lowercase letter / digit; may contain - and _",groupNameInvalid:"Group names may only use lowercase letters, digits, - and _ (starting with a letter or digit), up to 32 characters",groupNameExists:"This name is taken by a built-in group or an existing entry",groupEmptyHint:"No models in this group yet; use “Add model” to create one",searchPlaceholder:"Search models: id / name / provider",noSearchResults:"No matching models",syncCatalog:"Sync presets",syncCatalogHint:"Update preset models from the built-in catalog: add missing entries and reset differing ones to the catalog's fields; locally added models and API keys are left untouched",syncDone:(e,n)=>`Presets synced: ${e} added, ${n} updated`,syncUpToDate:"Presets are already up to date",homepage:"Model page",speedTest:"Speed test",speedTestTitle:"Speed test",speedTestConfirm:e=>`This sends one real request to each of the ${e} models in this group, one at a time, to measure time-to-first-token (TTFT) and output rate (TPS). It consumes a small amount of API quota. Continue?`,speedTestStart:"Start",speedPending:"Testing…",speedFailed:"Test failed",ttftTitle:"Time to first token (TTFT)",tpsTitle:"Output rate (TPS)",modelCount:e=>`${e} model${e===1?"":"s"}`,modelId:"Model ID",modelIdHint:"The upstream API model id, e.g. gpt-5.5",displayName:"Display name",displayNameHint:"Defaults to the model ID",providerGroup:"Group",contextWindow:"Context window",tokenUnit:"Token",contextWindowHint:"Leave empty if unknown",maxTokens:"Max output tokens",maxTokensHint:"Empty = inherit agent setting",maxTokensTitle:"Caps output tokens per request; leave empty to inherit the agent setting — lower it for small-context models",maxTokensInvalid:"Must be a positive integer",clientTypeLocked:e=>`Protocol: ${e} (kept as configured; not editable)`,vision:"Vision support",visionOffProxyHint:"Images are read via the vision proxy model",visionBadge:"Vision",visionModelBadge:"Proxy vision",setVisionModel:"Set as proxy vision model",visionModelHint:"Describes images via describe_image for models without vision",priceUnitShort:"/M tok",testConnection:"Test connection",testing:"Testing…",testOk:e=>`Connected (${e} ms)`,testFailed:e=>`Failed: ${e}`,modelIdRenameHint:"Renaming migrates the existing config and API key",priceCacheRead:"Cache read price",priceCacheWrite:"Cache write price",priceOutput:"Output price",priceUnit:"per 1M tokens",currency:"Currency",currencyUsd:"USD $",currencyCny:"CNY ¥",currencyHint:"Prices convert at 1 USD ≈ 7 CNY; always stored in USD",firstModelDefault:"Set as the default model",credential:"Credential",apiKey:"API key",apiKeyKeepHint:"Leave empty to keep the current key",apiKeyEnvHint:e=>`Leave empty to use the ${e} env var`,useEnvVar:e=>`env ${e}`,keyConfigured:"Key configured",clearApiKey:"Clear stored API key",baseUrl:"Custom base URL",baseUrlHint:"Leave empty to use the provider default",baseUrlRequired:"A base URL is required",contextWindowDefaultHint:e=>`Defaults to ${e} if empty`,confirmDeleteTitle:"Delete model",confirmDelete:e=>`Delete "${e}"? Its configuration and API key will be removed.`,groupApiKey:"Set API key for group",groupApiKeyTitle:e=>`Set the API key for ${e}`,groupApiKeyHint:e=>`Applies to all ${e} models in this group; leave empty to keep them unchanged.`,getApiKey:"Get API key",getModelIds:"Get model IDs",groupKeyApplied:e=>`API key set for ${e} models`,providerEnvNotes:{zhipu:"Defaults to the Z.AI global endpoint (api.z.ai); keys from bigmodel.cn need base URL https://open.bigmodel.cn/api/paas/v4",moonshot:"Defaults to the China endpoint (api.moonshot.cn); keys from platform.kimi.com need base URL https://api.moonshot.ai/v1"},confirmVisionModelTitle:"Set as proxy vision model",confirmVisionModel:e=>`Make "${e}" the proxy vision model? Models without vision will read images through it via describe_image.`,confirmSaveTitle:"Save model settings",confirmSave:e=>`Save the changes to "${e}"?`,confirmDefaultTitle:"Set as default model",confirmDefault:e=>`Make "${e}" the default model? New sessions will use it by default.`,createdAt:"Created",default:"Default",setDefault:"Set as default model",remove:"Delete model",saveAll:"Save all",readOnlyHint:"Members have read-only access; only owners can change models and credentials",empty:"No models configured yet",noKey:"No key",showModelsWithoutKey:e=>`Show model${e===1?"":"s"} without a key (${e})`,pendingSave:"(pending save)",modelIdExists:"This model id already exists",pricingAllOrNone:"Fill all three prices",pricingInvalid:"Must be a number",contextWindowInvalid:"Must be a number"},vault:{desc:"Environment variables owned by this Agent (stored in agent_state/.vault.toml), injected into the environment of its shell commands (exec_command); key names are shared with the model, values never enter the model context. Subagents use their own vaults and do not inherit this one. Saved changes take effect from the next task (a task already running is unaffected).",key:"Name",value:"Value",valueMasked:"Value (masked)",add:"Add",addTitle:"Add variable",remove:"Remove",deleteTitle:"Delete variable",deleteConfirm:e=>`Delete variable "${e}"? Its value cannot be recovered.`,empty:"No variables configured yet",readOnlyHint:"Members are read-only; only the owner can edit the vault",keyHint:"Letters, digits and underscores; must not start with a digit",keyInvalid:"Invalid name: only letters, digits and underscores, not starting with a digit",valueRequired:"Value must not be empty"},schedule:{desc:"Scheduled tasks (agent_state/schedule/*.toml): the prompt is sent to the target Session on schedule; files can also be edited by hand, and changes made here take effect immediately.",readOnlyHint:"Members are read-only; only the owner can modify schedules",colName:"Name",colStatus:"Status",colPeriod:"Period",colTarget:"Target",colFireTimes:"Next / last fired",colQueued:"Queue",statusNames:{active:"Active",disabled:"Disabled",expired:"Expired",done:"Done",missed:"Missed",invalid:"Invalid"},queued:"Queued",once:"One-off",newSession:"New session",invalidFiles:"Files that failed to parse (skipped by the scheduler)",empty:"No scheduled tasks yet",enable:"Enable",disable:"Disable",addTitle:"New scheduled task",editTitle:e=>`Edit scheduled task "${e}"`,name:"Name",nameHint:"The file name (without .toml); cannot be changed later",prompt:"Prompt",enabled:"Enabled",startAt:"Start at",endAt:"End at (optional)",period:"Period",periodPlaceholder:"30m / 12h / 7d; leave empty for a one-off task",target:"Target",targetNew:"New session each time",targetSession:"Bound Session",sessionId:"Session id",workspace:"Workspace (optional, auto-created when empty)",model:"Model",modelDefault:"Project default",deleteTitle:"Delete scheduled task",deleteConfirm:e=>`Delete scheduled task "${e}"?`},skills:{pageTitle:"Skill library",pageDesc:"Built-in skill library: browse, quick-start a chat, or install to agents.",quickInvoke:"Quick start",quickInvokeText:e=>`use the ${e} skill`,manageInstall:"Manage installs",manageInstallTitle:e=>`Manage installs: ${e}`,install:"Install",installed:"Installed",uninstall:"Uninstall",skillCount:e=>e===1?"1 skill":`${e} skills`,usedByAgents:e=>e===0?"not used yet":e===1?"used by 1 agent":`used by ${e} agents`,installedToast:(e,n)=>`Installed ${e} to ${n}`,updateOutdated:e=>`Update available: update ${e} Agent install(s)`,updateAction:"Update",updatedToast:(e,n)=>`Updated ${e} to the latest version (${n} Agent(s))`,uninstalledToast:(e,n)=>`Uninstalled ${e} from ${n}`},chat:{newSessionMenu:"New chat",chooseAgent:"Choose agent",chooseModel:"Choose model",thinkingLevel:"Thinking level",thinkingLevelNames:{none:"None",low:"Low",medium:"Medium",high:"High",xhigh:"Extreme High"},workspaceUseThis:"Use this dir",workspaceUp:"Parent dir",workspaceNoSubdirs:"No subdirectories",workspaceAuto:"Auto temp directory",workspaceClear:"Use auto temp directory instead",workspaceDirInvalid:"Directory does not exist or is inaccessible; reverted",groupByWorkspace:"Group by workspace",groupByAgent:"Group by agent",tempWorkspaces:"Temp workspaces",newSessionInWorkspace:"New chat in this workspace",draftSubtitle:"The self-evolving agent that excels at AI development tasks",exampleTasks:{game:{label:"Example: 2D penguin sled game",desc:"A cute Antarctic penguin sleds over rocks, easy start with a gentle difficulty ramp — a 2D pure-frontend mini game",prompt:"Build a cute Antarctic penguin sledding 2D game: press Space to jump over the rocks coming up on the ice; start easy and forgiving, with sled speed and obstacle density ramping up smoothly and gradually over time (no sudden spikes), live scoring, and hitting a rock ending the run with one-click restart. A 2D side-scroller with a cute cartoon look, pure frontend (a single HTML file is fine), styled per the web-design skill. When done, test it in a browser once, confirm the first few seconds are easy to clear, and tell me how to open it and how to play."},lol:{label:"Example: League of Legends music player",desc:"Worlds anthems on the SoundCloud Widget API — a single file that opens from file://",prompt:`Build a League of Legends Worlds anthem player with the SoundCloud Widget API (see https://developers.soundcloud.com/docs/api/html5-widget): a single index.html that works when opened from file://.
|
|
35
|
+
|
|
36
|
+
## Technical constraints
|
|
37
|
+
- Use the SC.Widget JS API (widget.load / widget.toggle / widget.setVolume / widget.seekTo), loading https://w.soundcloud.com/player/api.js
|
|
38
|
+
- The iframe must stay visible (180px tall), with visual=true color=f0b90b single_active=true
|
|
39
|
+
- Include ONLY these 8 tracks confirmed playable (oEmbed-verified); do not add tracks that are not oEmbed-verified:
|
|
40
|
+
- Warriors (S4) — soundcloud.com/leagueoflegends/warriors
|
|
41
|
+
- Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
|
|
42
|
+
- Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
|
|
43
|
+
- Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
|
|
44
|
+
- Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
|
|
45
|
+
- GODS (S13) — soundcloud.com/leagueoflegends/gods
|
|
46
|
+
- Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
|
|
47
|
+
- Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
|
|
48
|
+
|
|
49
|
+
## Layout
|
|
50
|
+
- Left 260px sticky sidebar: the track list (S4/S5/… badge + emoji + title + year); clicking highlights with a gold border and switches tracks via SC.Widget.load() with auto_play
|
|
51
|
+
- Right main area: hero title + a desktop clock (80px monospace gold HH:MM:SS, refreshed every second, blinking colons) + a mood tag
|
|
52
|
+
- Player card: the SoundCloud iframe + a custom control bar (⏮ ▶/⏸ ⏭ + track info + a volume slider; clicking the speaker icon toggles mute)
|
|
53
|
+
- Mood-wave section: 15 gold animated bars, re-randomized on every track switch
|
|
54
|
+
- Keyboard shortcuts: Space play/pause, ← → previous/next, ↑ ↓ volume
|
|
55
|
+
|
|
56
|
+
## Design
|
|
57
|
+
Penguin visual style (see the web-design skill), dark/light themes via <html data-theme>, dark by default, remembered in localStorage. Responsive: on phones the sidebar becomes a horizontally scrolling top bar.
|
|
58
|
+
|
|
59
|
+
When done, open index.html in a browser and self-test once.`},rag:{label:"Example: build a Claude Code docs expert",desc:"Collect the claude-code-docs repo into a conversational RAG knowledge app with source citations",prompt:"Collect the docs from https://github.com/ericbuess/claude-code-docs and build a RAG knowledge app: clone the repo and prepare the corpus, then build a retrieval index; the app acts as a Claude Code configuration expert, answering Claude Code questions with retrieval-augmented replies and clickable citations that reveal the matched original text chunk and link to the real documents; give it a beautiful web chat UI following the web-design skill, with a few example questions in the empty state. When done, run the app, verify one streamed answer yourself, and tell me how to access it."}},sessionList:"Sessions",defaultSessionTitle:"New chat",model:"Model",workspace:"Workspace",workspaceHint:"Leave empty for an auto-created temp directory; if set, it must be an existing directory on the server",approvalMode:"Approval mode",approvalModeNames:{"allow-all":"Approve everything","deny-all":"Deny everything","read-only":"Approve read-only","always-ask":"Ask every time"},approvalModes:{"allow-all":"Approve everything (allow-all)","deny-all":"Deny everything (deny-all)","read-only":"Approve read-only (read-only)","always-ask":"Ask every time (always-ask)"},statusIdle:"Idle",statusRunning:"Running",statusCompacting:"Compacting",pendingApprovals:e=>`${e} pending approval${e>1?"s":""}`,jumpToLatest:"Jump to latest",inputPlaceholder:"Type a message. Enter to send, Shift+Enter for newline, paste images",inputPlaceholderShort:"Type a message…",send:"Send",stop:"Stop",compactingHint:"Compacting context, input is temporarily disabled",compact:"Compact context",approve:"Allow",deny:"Deny",decisionAllow:"Approved",decisionDeny:"Denied",decisionManual:"manual",decisionAuto:"auto",thinking:"Thinking",subagent:"Subagent",subagentRunning:"Running",aborted:e=>`[Aborted]${e?`: ${e}`:""}`,reconnect:(e,n,r)=>{const l=e==="timeout"?"Connection timed out":"Response incomplete or unparseable",o=n==="gaveUp"?"no further retries":n==="retried"?`retry #${r} sent`:`starting retry #${r}…`;return`[Retry] ${l}; ${o}`},imageAlt:"Image uploaded by user",toolImageAlt:"Image from tool output",imagesAsPathHint:"This model cannot view images directly: on send, images are saved to the session scratchpad and passed as file paths (viewed via describe_image)",infoPanel:"Session info",sessionStats:"Stats",statTokens:"Total Tokens",statCost:"Cost",statElapsed:"Elapsed",statInput:"Input tokens",statCached:"cached",statOutput:"Output tokens",statTps:"Output TPS",statParenOpen:" (",statParenClose:")",noSessions:"No Sessions yet",emptyStream:"Send a message to start the conversation",historyLoadFailed:"Failed to load history",sessionHealed:"Session healed with a new id",statsLabel:"Stats",removeImage:"Remove image",openWorkspace:"Open workspace",filesInMessage:e=>`${e} ${e===1?"file":"files"}`,openPreview:"Click to preview",showMoreFiles:e=>`Show ${e} more ${e===1?"file":"files"}`,showLess:"Show less",contextUsage:"Context usage",contextUnknown:"Context usage: unknown until the next request reports it",slashHint:"Type / for commands",mentionHint:"@ to handoff to another agent",mentionRemove:"Remove @ target",skillsSelect:"Skills",skillRemove:"Remove skill",skillsSearchPlaceholder:"Search skills",skillsNoMatch:"No matching skills",skillsEmptyHint:"No skills installed yet — add some from the skill library",skillsAutoMessage:e=>e.length===1?`use the ${e[0]} skill`:`use the ${e.join(", ")} skills`,handoffFrom:e=>`Handed off from ${e}'s conversation`,handoffBack:e=>e?`Back to the original conversation: ${e}`:"Back to the original conversation",scheduledFrom:e=>`Triggered by scheduled task "${e}"`,sourceNames:{schedule:"Scheduled",subagent:"Sub"},commandCompact:"/compact",emptyGreeting:"Start a new conversation",compactionRunning:e=>`Compaction in progress (${e})…`,compactionDone:e=>e==="discard"?"[Compaction] done, old context discarded":"[Compaction] done, switched to the summarized context",compactionFailed:e=>`[Compaction] ${e==="aborted"?"aborted":"failed"}, keeping current context`,unknownTool:"(unknown tool)",toolCall:"Tool call",workGroupTitle:"Reasoning & tools",workRunning:"Running",workDone:"Done",workGroupSteps:e=>`${e} ${e===1?"step":"steps"}`,approvalWaiting:"awaiting approval",copyCode:"Copy code",copyStats:"Copy stats",copyReply:"Copy reply",copyMessage:"Copy message",copied:"Copied",deleteSession:"Delete chat",renameSession:"Rename chat",renameSessionLabel:"Title",deleteSessionConfirm:e=>`Delete "${e}"? Its messages and Trace will be removed permanently.`,archiveSession:"Archive",unarchiveSession:"Unarchive",archivedGroup:e=>`Archived (${e})`,loadMore:"More",sourceGroups:{subagent:e=>`Subagents (${e})`,schedule:e=>`Scheduled (${e})`},skillsBanner:e=>`Using skill${e.length===1?"":"s"}: ${e.join(", ")}`},files:{title:"Files",upload:"Upload",download:"Download",openInNewTab:"Open in new tab",refresh:"Refresh",root:"Workspace root",empty:"Empty directory",name:"Name",size:"Size",modified:"Modified",previewUnsupported:"Preview not supported for this type; download instead",uploaded:"Uploaded",loadFailed:"Failed to load",previewTruncated:"File too large; preview truncated, download for the full file",details:"Details",workspacePath:"Workspace path",htmlRendered:"Rendered",htmlSource:"Source",backToList:"Back to list",resizeHandle:"Drag to resize, double-click to reset"},usage:{title:"Costs & usage",today:"Today",last7d:"Last 7 days",total:"Total",tokens:"Tokens",cost:"Cost",requests:"Requests",from:"From",to:"To",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",colCost:"Cost",trendTitle:"30-day trend",uncostedNote:"* Includes records without pricing; cost is a partial figure",filterAllAgents:"All Agents",filterAllModels:"All models",chartAgentCalls:"Calls per Agent",chartSuccessRate:"Model success rate",chartTokenTrend:"Daily token trend",chartCostTrend:"Daily cost trend",empty:"No usage records",successAborted:"Aborted (excluded)",errors:"Errors",errorsTotal:"Total",errorsUnexpected:"Unexpected",errorsExpected:"Expected",errorsTopCode:"Most common",errorsColTime:"Time",errorsColCode:"Source · code",errorsColKind:"Type",errorsColMessage:"Message",errorsEmpty:"No errors"},traces:{title:"Traces",filterAll:"All",filterModel:"model_msg",filterEvent:"event_msg",analysis:"Trajectory view",timeline:"Execution timeline",laneLLM:"Model",laneTools:"Tools",phaseApproval:"approval",phaseExec:"exec",kindThinking:"thinking",kindModelReply:"model reply",kindToolGen:"tool call gen",legendToolExec:"tool exec",legendApprovalWait:"approval wait",task:e=>`Turn ${e}`,globalSummary:"Overall",tasksLabel:"Turns",messages:"Messages",truncatedNote:(e,n)=>`Showing first ${e} / ${n} messages`,zoom:"Zoom",zoomReset:"Double-click to reset zoom",zoomOut:"Zoom out",zoomIn:"Zoom in",linkHint:"Hover a timeline segment or event row to cross-highlight, click a segment to jump to its message; legend highlights its kind; drag the bar below to pan/zoom",filesTitle:"Trace files",selectSession:"Select a Session on the left",toolCalls:"Tool calls",taskInput:"Input tokens this turn",taskOutput:"Output tokens this turn",cacheHit:"Cache hits",hitRate:"Hit rate",toolFailRate:"failure rate",compactions:"compactions",compactionRound:"Compaction",usageTrend:"Token usage trend",selectFile:"Select a Trace file on the left",empty:"No Traces for this Agent",colTime:"Time",colType:"Type",colSummary:"Summary",lines:e=>`${e} lines`,inProgress:"in progress",systemPrompt:"System prompt",toolDefs:e=>`Tool definitions (${e})`},benchmark:{title:"Evaluation Center",selectBenchmark:"Select a Benchmark on the left",emptyAgent:"No Benchmarks for this Agent",caseCount:e=>`${e} case${e===1?"":"s"}`,trendTitle:e=>`${e} over time`,evaluations:"Evaluations",noEvaluations:"No evaluations yet",summaryLabel:"Summary",legendUnlabeled:"unlabeled model",colTime:"Time",colVersion:"Version",colModel:"Model",colScore:"Score",colCost:"Cost",colDuration:"Duration",colCase:"Case",colRun:"Run",colSession:"Session"},errors:{unauthorized:"Session expired, please sign in again",networkError:"Network error, please check your connection",modelCredentialMissing:e=>`Model ${e} has no API key yet — configure it on the Models page first`,noDefaultModel:"This project has no default model yet — add one on the Models page first"}},H1="penguin.lang",P1=b.createContext(null);function Yw(e){return e?.toLowerCase().startsWith("zh")?"zh":"en"}function Xw(){return Yw(navigator.language)}function Qw(e){return e==="system"?Xw():e}function Zw(){const e=localStorage.getItem(H1);return e==="zh"||e==="en"||e==="system"?e:"system"}function Jw({children:e}){const[n,r]=b.useState(Zw),[,l]=b.useState(0),o=Qw(n);Kw(o==="en"?Ww:B1),b.useEffect(()=>{if(n!=="system")return;const d=()=>l(f=>f+1);return window.addEventListener("languagechange",d),()=>window.removeEventListener("languagechange",d)},[n]);const u=b.useCallback(d=>{localStorage.setItem(H1,d),r(d)},[]);return i.jsx(P1.Provider,{value:{lang:n,locale:o,setLang:u},children:e})}function eS({children:e}){const{locale:n}=Ca();return i.jsx("div",{className:"contents",children:e},n)}function Ca(){const e=b.useContext(P1);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}const Bm=7,q1="penguin.theme",F1="penguin.fontScale",V1="penguin.accent",G1="penguin.currency",tS={sm:"16px",md:"18px",lg:"20px"},K1=b.createContext(null);function nS(){const e=localStorage.getItem(q1);return e==="light"||e==="dark"||e==="system"?e:"system"}function aS(){const e=localStorage.getItem(F1);return e==="sm"||e==="md"||e==="lg"?e:"md"}function rS(){const e=localStorage.getItem(V1);return e==="neutral"||e==="blue"||e==="green"||e==="violet"||e==="rose"||e==="amber"?e:"neutral"}function lS(){return localStorage.getItem(G1)==="CNY"?"CNY":"USD"}function sS(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function iS({children:e}){const[n,r]=b.useState(nS),[l,o]=b.useState(sS),[u,d]=b.useState(aS),[f,m]=b.useState(rS),[h,g]=b.useState(lS),v=n==="system"?l:n==="dark";b.useEffect(()=>{document.documentElement.classList.toggle("dark",v)},[v]),b.useEffect(()=>{document.documentElement.style.fontSize=tS[u]},[u]),b.useEffect(()=>{f==="neutral"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=f},[f]),b.useEffect(()=>{if(n!=="system")return;const N=window.matchMedia("(prefers-color-scheme: dark)"),M=O=>o(O.matches);return o(N.matches),N.addEventListener("change",M),()=>N.removeEventListener("change",M)},[n]);const k=b.useCallback(N=>{localStorage.setItem(q1,N),r(N)},[]),w=b.useCallback(N=>{localStorage.setItem(F1,N),d(N)},[]),j=b.useCallback(N=>{localStorage.setItem(V1,N),m(N)},[]),C=b.useCallback(N=>{localStorage.setItem(G1,N),g(N)},[]);return i.jsx(K1.Provider,{value:{mode:n,dark:v,setMode:k,fontScale:u,setFontScale:w,accent:f,setAccent:j,currency:h,setCurrency:C},children:e})}function xl(){const e=b.useContext(K1);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}const oS=[{value:"neutral",color:"#6b7280"},{value:"blue",color:"#2563eb"},{value:"green",color:"#15803d"},{value:"violet",color:"#7c3aed"},{value:"rose",color:"#be123c"},{value:"amber",color:"#b45309"}];class He extends Error{status;code;constructor(n,r,l){super(l),this.name="ApiError",this.status=n,this.code=r}}let W1=null;function Lx(e){W1=e}function cS(e){return e.startsWith("/api/auth/")}async function Ae(e,n={}){let r=e;if(n.query){const u=new URLSearchParams;for(const[f,m]of Object.entries(n.query))m!==void 0&&u.set(f,String(m));const d=u.toString();d&&(r+=`?${d}`)}let l;try{l=await fetch(r,{method:n.method??"GET",credentials:"same-origin",...n.body!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(n.body)}:{}})}catch{throw new He(0,"network_error",x.errors.networkError)}if(!l.ok){let u="http_error",d=x.common.unknownError;try{const f=await l.json();f.error?.code&&(u=f.error.code),f.error?.message&&(d=f.error.message)}catch{}throw l.status===401&&!cS(e)&&W1?.(),new He(l.status,u,d)}if(l.status===204)return;const o=await l.text();if(o)return JSON.parse(o)}const uS=e=>Ae("/api/auth/login",{method:"POST",body:e}),dS=()=>Ae("/api/auth/logout",{method:"POST",body:{}}),rm=()=>Ae("/api/me"),fS=e=>Ae("/api/me/password",{method:"PUT",body:e}),mS=()=>Ae("/api/me/prefs"),Y1=e=>Ae("/api/me/prefs",{method:"PUT",body:e}),hS=()=>Ae("/api/admin/users"),pS=e=>Ae("/api/admin/users",{method:"POST",body:e}),gS=(e,n)=>Ae(`/api/admin/users/${encodeURIComponent(e)}/password`,{method:"POST",body:n}),xS=e=>Ae(`/api/admin/users/${encodeURIComponent(e)}`,{method:"DELETE"}),yS=()=>Ae("/api/projects"),vS=e=>Ae("/api/projects",{method:"POST",body:e}),bS=e=>Ae(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE"}),kf=e=>Ae(`/api/projects/${encodeURIComponent(e)}/members`),kS=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:n}),wS=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(n)}`,{method:"DELETE"}),Fc=e=>Ae(`/api/projects/${encodeURIComponent(e)}/models`),SS=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/models`,{method:"PUT",body:n}),X1=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/models/test`,{method:"POST",body:n}),jS=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`),NS=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`,{method:"PUT",body:r}),CS=e=>Ae(`/api/projects/${encodeURIComponent(e)}/agents`),TS=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents`,{method:"POST",body:n}),Q1=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`),Z1=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`,{method:"PUT",body:r}),ES=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces`),_x=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions${r?`?limit=${r.limit}&offset=${r.offset}`:""}`),Ix=(e,n="")=>Ae(`/api/projects/${encodeURIComponent(e)}/dirs?path=${encodeURIComponent(n)}`),lm=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions`,{method:"POST",body:r}),MS=e=>Ae(`/api/sessions/${encodeURIComponent(e)}`),sm=(e,n)=>Ae(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),Ec=e=>Ae(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),AS=e=>Ae(`/api/sessions/${encodeURIComponent(e)}/messages`),Mc=(e,n)=>Ae(`/api/sessions/${encodeURIComponent(e)}/tasks`,{method:"POST",body:n}),RS=(e,n,r)=>Ae(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(n)}`,{method:"POST",body:r}),LS=e=>Ae(`/api/sessions/${encodeURIComponent(e)}/abort`,{method:"POST",body:{}}),_S=e=>Ae(`/api/sessions/${encodeURIComponent(e)}/compact`,{method:"POST",body:{}}),IS=(e,n,r,l,o,u)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${l}`,{query:{offset:o,limit:u}}),zS=(e,n,r,l)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${l}/analysis`),J1=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/usage`,{query:{from:n.from,to:n.to,groupBy:n.groupBy,agentId:n.agentId,provider:n.provider,modelId:n.modelId}}),DS=(e,n)=>Ae(`/api/projects/${e}/agents/${n}`,{method:"DELETE"}),OS=(e,n)=>Ae(`/api/sessions/${e}/files`,{query:{path:n}}),sl=(e,n,r=!1)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(n)}${r?"&download=1":""}`,US=(e,n)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(n)}&preview=1`,$S=(e,n,r)=>Ae(`/api/sessions/${e}/files/content`,{method:"PUT",body:{dataBase64:r},query:{path:n}}),BS=(e,n)=>Ae(`/api/sessions/${e}/files/stat`,{method:"POST",body:{paths:n}}),HS=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`),PS=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`,{method:"POST",body:r}),zx=(e,n,r,l)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"PUT",body:l}),qS=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"DELETE"}),FS=()=>Ae("/api/skills"),Hm=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`),Dx=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`,{method:"POST",body:{names:r}}),VS=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/${encodeURIComponent(r)}`,{method:"DELETE"}),GS=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks`),KS=(e,n)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/export`,WS=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/import`,{method:"POST",body:r}),ev=b.createContext(null);function YS({children:e}){const[n,r]=b.useState(void 0);b.useEffect(()=>(Lx(()=>r(null)),()=>Lx(null)),[]),b.useEffect(()=>{let d=!1;return rm().then(f=>{d||r(f.user)}).catch(f=>{d||(f instanceof He&&f.status,r(null))}),()=>{d=!0}},[]);const l=b.useCallback(async(d,f)=>{const m=await uS({userId:d,password:f});r(m.user)},[]),o=b.useCallback(async()=>{try{await dS()}finally{r(null)}},[]),u=b.useCallback(async()=>{const d=await rm();r(d.user)},[]);return i.jsx(ev.Provider,{value:{user:n,login:l,logout:o,refresh:u},children:e})}function Nn(){const e=b.useContext(ev);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}var Pm=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,tv=/^[\\/]{2}/;function XS(e,n){return n+e.replace(/\\/g,"/")}var Ox="popstate";function Ux(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function QS(e={}){function n(l,o){let u=o.state?.masked,{pathname:d,search:f,hash:m}=u||l.location;return im("",{pathname:d,search:f,hash:m},o.state&&o.state.usr||null,o.state&&o.state.key||"default",u?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function r(l,o){return typeof o=="string"?o:Ei(o)}return JS(n,r,null,e)}function Ct(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function ra(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function ZS(){return Math.random().toString(36).substring(2,10)}function $x(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function im(e,n,r=null,l,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?fs(n):n,state:r,key:n&&n.key||l||ZS(),mask:o}}function Ei({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function fs(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let l=e.indexOf("?");l>=0&&(n.search=e.substring(l),e=e.substring(0,l)),e&&(n.pathname=e)}return n}function JS(e,n,r,l={}){let{window:o=document.defaultView,v5Compat:u=!1}=l,d=o.history,f="POP",m=null,h=g();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function g(){return(d.state||{idx:null}).idx}function v(){f="POP";let N=g(),M=N==null?null:N-h;h=N,m&&m({action:f,location:C.location,delta:M})}function k(N,M){f="PUSH";let O=Ux(N)?N:im(C.location,N,M);h=g()+1;let R=$x(O,h),$=C.createHref(O.mask||O);try{d.pushState(R,"",$)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;o.location.assign($)}u&&m&&m({action:f,location:C.location,delta:1})}function w(N,M){f="REPLACE";let O=Ux(N)?N:im(C.location,N,M);h=g();let R=$x(O,h),$=C.createHref(O.mask||O);d.replaceState(R,"",$),u&&m&&m({action:f,location:C.location,delta:0})}function j(N){return ej(o,N)}let C={get action(){return f},get location(){return e(o,d)},listen(N){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(Ox,v),m=N,()=>{o.removeEventListener(Ox,v),m=null}},createHref(N){return n(o,N)},createURL:j,encodeLocation(N){let M=j(N);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:k,replace:w,go(N){return d.go(N)}};return C}function ej(e,n,r=!1){let l="http://localhost";e&&(l=e.location.origin!=="null"?e.location.origin:e.location.href),Ct(l,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:Ei(n);return o=o.replace(/ $/,"%20"),!r&&tv.test(o)&&(o=l+o),new URL(o,l)}function nv(e,n,r="/"){return tj(e,n,r,!1)}function tj(e,n,r,l,o){let u=typeof n=="string"?fs(n):n,d=tr(u.pathname||"/",r);if(d==null)return null;let f=nj(e),m=null,h=iv(d);for(let g=0;m==null&&g<f.length;++g)m=fj(f[g],h,l);return m}function nj(e){let n=av(e);return aj(n),n}function av(e,n=[],r=[],l="",o=!1){let u=(d,f,m=o,h)=>{let g={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(l)&&m)return;Ct(g.relativePath.startsWith(l),`Absolute route path "${g.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(l.length)}let v=ma([l,g.relativePath]),k=r.concat(g);d.children&&d.children.length>0&&(Ct(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),av(d.children,n,k,v,m)),!(d.path==null&&!d.index)&&n.push({path:v,score:uj(v,d.index),routesMeta:k.map((w,j)=>{let[C,N]=sv(w.relativePath,w.caseSensitive,j===k.length-1);return{...w,matcher:C,compiledParams:N}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))u(d,f);else for(let m of rv(d.path))u(d,f,!0,m)}),n}function rv(e){let n=e.split("/");if(n.length===0)return[];let[r,...l]=n,o=r.endsWith("?"),u=r.replace(/\?$/,"");if(l.length===0)return o?[u,""]:[u];let d=rv(l.join("/")),f=[];return f.push(...d.map(m=>m===""?u:[u,m].join("/"))),o&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function aj(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:dj(n.routesMeta.map(l=>l.childrenIndex),r.routesMeta.map(l=>l.childrenIndex)))}var rj=/^:[\w-]+$/,lj=3,sj=2,ij=1,oj=10,cj=-2,Bx=e=>e==="*";function uj(e,n){let r=e.split("/"),l=r.length;return r.some(Bx)&&(l+=cj),n&&(l+=sj),r.filter(o=>!Bx(o)).reduce((o,u)=>o+(rj.test(u)?lj:u===""?ij:oj),l)}function dj(e,n){return e.length===n.length&&e.slice(0,-1).every((l,o)=>l===n[o])?e[e.length-1]-n[n.length-1]:0}function fj(e,n,r=!1){let{routesMeta:l}=e,o={},u="/",d=[];for(let f=0;f<l.length;++f){let m=l[f],h=f===l.length-1,g=u==="/"?n:n.slice(u.length)||"/",v={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},k=m.matcher&&m.compiledParams?lv(v,g,m.matcher,m.compiledParams):Mi(v,g),w=m.route;if(!k&&h&&r&&!l[l.length-1].route.index&&(k=Mi({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!k)return null;Object.assign(o,k.params),d.push({params:o,pathname:ma([u,k.pathname]),pathnameBase:pj(ma([u,k.pathnameBase])),route:w}),k.pathnameBase!=="/"&&(u=ma([u,k.pathnameBase]))}return d}function Mi(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,l]=sv(e.path,e.caseSensitive,e.end);return lv(e,n,r,l)}function lv(e,n,r,l){let o=n.match(r);if(!o)return null;let u=o[0],d=u.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:l.reduce((h,{paramName:g,isOptional:v},k)=>{if(g==="*"){let j=f[k]||"";d=u.slice(0,u.length-j.length).replace(/(.)\/+$/,"$1")}const w=f[k];return v&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:u,pathnameBase:d,pattern:e}}function sv(e,n=!1,r=!0){ra(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let l=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m,h,g)=>{if(l.push({paramName:f,isOptional:m!=null}),m){let v=g.charAt(h+d.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(l.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),l]}function iv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return ra(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function tr(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,l=e.charAt(r);return l&&l!=="/"?null:e.slice(r)||"/"}function mj(e,n="/"){let{pathname:r,search:l="",hash:o=""}=typeof e=="string"?fs(e):e,u;return r?(r=ov(r),r.startsWith("/")?u=Hx(r.substring(1),"/"):u=Hx(r,n)):u=n,{pathname:u,search:gj(l),hash:xj(o)}}function Hx(e,n){let r=Ac(n).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function wf(e,n,r,l){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function hj(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function qm(e){let n=hj(e);return n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase)}function Vc(e,n,r,l=!1){let o;typeof e=="string"?o=fs(e):(o={...e},Ct(!o.pathname||!o.pathname.includes("?"),wf("?","pathname","search",o)),Ct(!o.pathname||!o.pathname.includes("#"),wf("#","pathname","hash",o)),Ct(!o.search||!o.search.includes("#"),wf("#","search","hash",o)));let u=e===""||o.pathname==="",d=u?"/":o.pathname,f;if(d==null)f=r;else{let v=n.length-1;if(!l&&d.startsWith("..")){let k=d.split("/");for(;k[0]==="..";)k.shift(),v-=1;o.pathname=k.join("/")}f=v>=0?n[v]:"/"}let m=mj(o,f),h=d&&d!=="/"&&d.endsWith("/"),g=(u||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var ov=e=>e.replace(/[\\/]{2,}/g,"/"),ma=e=>ov(e.join("/")),Ac=e=>e.replace(/\/+$/,""),pj=e=>Ac(e).replace(/^\/*/,"/"),gj=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,xj=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,yj=class{constructor(e,n,r,l=!1){this.status=e,this.statusText=n||"",this.internal=l,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function vj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function bj(e){let n=e.map(r=>r.route.path).filter(Boolean);return ma(n)||"/"}var cv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function uv(e,n){let r=e;if(typeof r!="string"||!Pm.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let l=r,o=!1;if(cv)try{let u=new URL(window.location.href),d=tv.test(r)?new URL(XS(r,u.protocol)):new URL(r),f=tr(d.pathname,n);d.origin===u.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{ra(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:o,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var dv=["POST","PUT","PATCH","DELETE"];new Set(dv);var kj=["GET",...dv];new Set(kj);var wj=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Sj(e){try{return wj.includes(new URL(e).protocol)}catch{return!1}}var ms=b.createContext(null);ms.displayName="DataRouter";var Gc=b.createContext(null);Gc.displayName="DataRouterState";var fv=b.createContext(!1);function jj(){return b.useContext(fv)}var mv=b.createContext({isTransitioning:!1});mv.displayName="ViewTransition";var Nj=b.createContext(new Map);Nj.displayName="Fetchers";var Cj=b.createContext(null);Cj.displayName="Await";var Bn=b.createContext(null);Bn.displayName="Navigation";var Di=b.createContext(null);Di.displayName="Location";var sa=b.createContext({outlet:null,matches:[],isDataRoute:!1});sa.displayName="Route";var Fm=b.createContext(null);Fm.displayName="RouteError";var hv="REACT_ROUTER_ERROR",Tj="REDIRECT",Ej="ROUTE_ERROR_RESPONSE";function Mj(e){if(e.startsWith(`${hv}:${Tj}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function Aj(e){if(e.startsWith(`${hv}:${Ej}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new yj(n.status,n.statusText,n.data)}catch{}}function Rj(e,{relative:n}={}){Ct(yl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:l}=b.useContext(Bn),{hash:o,pathname:u,search:d}=Oi(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:ma([r,u])),l.createHref({pathname:f,search:d,hash:o})}function yl(){return b.useContext(Di)!=null}function Hn(){return Ct(yl(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Di).location}function pv(e){Ct(yl(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:n}=Hn();return b.useMemo(()=>Mi(e,iv(n)),[n,e])}var gv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function xv(e){b.useContext(Bn).static||b.useLayoutEffect(e)}function ia(){let{isDataRoute:e}=b.useContext(sa);return e?Gj():Lj()}function Lj(){Ct(yl(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(ms),{basename:n,navigator:r}=b.useContext(Bn),{matches:l}=b.useContext(sa),{pathname:o}=Hn(),u=JSON.stringify(qm(l)),d=b.useRef(!1);return xv(()=>{d.current=!0}),b.useCallback((m,h={})=>{if(ra(d.current,gv),!d.current)return;if(typeof m=="number"){r.go(m);return}let g=Vc(m,JSON.parse(u),o,h.relative==="path");e==null&&n!=="/"&&(g.pathname=g.pathname==="/"?n:ma([n,g.pathname])),(h.replace?r.replace:r.push)(g,h.state,h)},[n,r,u,o,e])}var _j=b.createContext(null);function Ij(e){let n=b.useContext(sa).outlet;return b.useMemo(()=>n&&b.createElement(_j.Provider,{value:e},n),[n,e])}function yv(){let{matches:e}=b.useContext(sa);return e[e.length-1]?.params??{}}function Oi(e,{relative:n}={}){let{matches:r}=b.useContext(sa),{pathname:l}=Hn(),o=JSON.stringify(qm(r));return b.useMemo(()=>Vc(e,JSON.parse(o),l,n==="path"),[e,o,l,n])}function zj(e,n){return vv(e,n)}function vv(e,n,r){Ct(yl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=b.useContext(Bn),{matches:o}=b.useContext(sa),u=o[o.length-1],d=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",h=u&&u.route;{let N=h&&h.path||"";kv(f,!h||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${N}">) 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.
|
|
60
|
+
|
|
61
|
+
Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let g=Hn(),v;if(n){let N=typeof n=="string"?fs(n):n;Ct(m==="/"||N.pathname?.startsWith(m),`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 "${m}" but pathname "${N.pathname}" was given in the \`location\` prop.`),v=N}else v=g;let k=v.pathname||"/",w=k;if(m!=="/"){let N=m.replace(/^\//,"").split("/");w="/"+k.replace(/^\//,"").split("/").slice(N.length).join("/")}let j=r&&r.state.matches.length?r.state.matches.map(N=>Object.assign(N,{route:r.manifest[N.route.id]||N.route})):nv(e,{pathname:w});ra(h||j!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),ra(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.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 C=Bj(j&&j.map(N=>Object.assign({},N,{params:Object.assign({},d,N.params),pathname:ma([m,l.encodeLocation?l.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?m:ma([m,l.encodeLocation?l.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),o,r);return n&&C?b.createElement(Di.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...v},navigationType:"POP"}},C):C}function Dj(){let e=Vj(),n=vj(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:u},"ErrorBoundary")," or"," ",b.createElement("code",{style:u},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},n),r?b.createElement("pre",{style:o},r):null,d)}var Oj=b.createElement(Dj,null),bv=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=Aj(e.digest);r&&(e=r)}let n=e!==void 0?b.createElement(sa.Provider,{value:this.props.routeContext},b.createElement(Fm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(Uj,{error:e},n):n}};bv.contextType=fv;var Sf=new WeakMap;function Uj({children:e,error:n}){let{basename:r}=b.useContext(Bn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let l=Mj(n.digest);if(l){let o=Sf.get(n);if(o)throw o;let u=uv(l.location,r),d=u.absoluteURL||u.to;if(Sj(d))throw new Error("Invalid redirect location");if(cv&&!Sf.get(n))if(u.isExternal||l.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw Sf.set(n,f),f}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function $j({routeContext:e,match:n,children:r}){let l=b.useContext(ms);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(sa.Provider,{value:e},r)}function Bj(e,n=[],r){let l=r?.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(n.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let o=e,u=l?.errors;if(u!=null){let g=o.findIndex(v=>v.route.id&&u?.[v.route.id]!==void 0);Ct(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),o=o.slice(0,Math.min(o.length,g+1))}let d=!1,f=-1;if(r&&l){d=l.renderFallback;for(let g=0;g<o.length;g++){let v=o[g];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(f=g),v.route.id){let{loaderData:k,errors:w}=l,j=v.route.loader&&!k.hasOwnProperty(v.route.id)&&(!w||w[v.route.id]===void 0);if(v.route.lazy||j){r.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let m=r?.onError,h=l&&m?(g,v)=>{m(g,{location:l.location,params:l.matches?.[0]?.params??{},pattern:bj(l.matches),errorInfo:v})}:void 0;return o.reduceRight((g,v,k)=>{let w,j=!1,C=null,N=null;l&&(w=u&&v.route.id?u[v.route.id]:void 0,C=v.route.errorElement||Oj,d&&(f<0&&k===0?(kv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,N=null):f===k&&(j=!0,N=v.route.hydrateFallbackElement||null)));let M=n.concat(o.slice(0,k+1)),O=()=>{let R;return w?R=C:j?R=N:v.route.Component?R=b.createElement(v.route.Component,null):v.route.element?R=v.route.element:R=g,b.createElement($j,{match:v,routeContext:{outlet:g,matches:M,isDataRoute:l!=null},children:R})};return l&&(v.route.ErrorBoundary||v.route.errorElement||k===0)?b.createElement(bv,{location:l.location,revalidation:l.revalidation,component:C,error:w,children:O(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:h}):O()},null)}function Vm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Hj(e){let n=b.useContext(ms);return Ct(n,Vm(e)),n}function Pj(e){let n=b.useContext(Gc);return Ct(n,Vm(e)),n}function qj(e){let n=b.useContext(sa);return Ct(n,Vm(e)),n}function Gm(e){let n=qj(e),r=n.matches[n.matches.length-1];return Ct(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Fj(){return Gm("useRouteId")}function Vj(){let e=b.useContext(Fm),n=Pj("useRouteError"),r=Gm("useRouteError");return e!==void 0?e:n.errors?.[r]}function Gj(){let{router:e}=Hj("useNavigate"),n=Gm("useNavigate"),r=b.useRef(!1);return xv(()=>{r.current=!0}),b.useCallback(async(o,u={})=>{ra(r.current,gv),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:n,...u}))},[e,n])}var Px={};function kv(e,n,r){!n&&!Px[e]&&(Px[e]=!0,ra(!1,r))}b.memo(Kj);function Kj({routes:e,manifest:n,future:r,state:l,isStatic:o,onError:u}){return vv(e,void 0,{manifest:n,state:l,isStatic:o,onError:u})}function Ai({to:e,replace:n,state:r,relative:l}){Ct(yl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=b.useContext(Bn);ra(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=b.useContext(sa),{pathname:d}=Hn(),f=ia(),m=Vc(e,qm(u),d,l==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:n,state:r,relative:l})},[f,h,l,n,r]),null}function Wj(e){return Ij(e.context)}function wn(e){Ct(!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 Yj({basename:e="/",children:n=null,location:r,navigationType:l="POP",navigator:o,static:u=!1,useTransitions:d}){Ct(!yl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:o,static:u,useTransitions:d,future:{}}),[f,o,u,d]);typeof r=="string"&&(r=fs(r));let{pathname:h="/",search:g="",hash:v="",state:k=null,key:w="default",mask:j}=r,C=b.useMemo(()=>{let N=tr(h,f);return N==null?null:{location:{pathname:N,search:g,hash:v,state:k,key:w,mask:j},navigationType:l}},[f,h,g,v,k,w,l,j]);return ra(C!=null,`<Router basename="${f}"> is not able to match the URL "${h}${g}${v}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:b.createElement(Bn.Provider,{value:m},b.createElement(Di.Provider,{children:n,value:C}))}function Xj({children:e,location:n}){return zj(om(e),n)}function om(e,n=[]){let r=[];return b.Children.forEach(e,(l,o)=>{if(!b.isValidElement(l))return;let u=[...n,o];if(l.type===b.Fragment){r.push.apply(r,om(l.props.children,u));return}Ct(l.type===wn,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ct(!l.props.index||!l.props.children,"An index route cannot have child routes.");let d={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(d.children=om(l.props.children,u)),r.push(d)}),r}var jc="get",Nc="application/x-www-form-urlencoded";function Kc(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Qj(e){return Kc(e)&&e.tagName.toLowerCase()==="button"}function Zj(e){return Kc(e)&&e.tagName.toLowerCase()==="form"}function Jj(e){return Kc(e)&&e.tagName.toLowerCase()==="input"}function e5(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function t5(e,n){return e.button===0&&(!n||n==="_self")&&!e5(e)}function cm(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let l=e[r];return n.concat(Array.isArray(l)?l.map(o=>[r,o]):[[r,l]])},[]))}function n5(e,n){let r=cm(e);return n&&n.forEach((l,o)=>{r.has(o)||n.getAll(o).forEach(u=>{r.append(o,u)})}),r}var sc=null;function a5(){if(sc===null)try{new FormData(document.createElement("form"),0),sc=!1}catch{sc=!0}return sc}var r5=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jf(e){return e!=null&&!r5.has(e)?(ra(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Nc}"`),null):e}function l5(e,n){let r,l,o,u,d;if(Zj(e)){let f=e.getAttribute("action");l=f?tr(f,n):null,r=e.getAttribute("method")||jc,o=jf(e.getAttribute("enctype"))||Nc,u=new FormData(e)}else if(Qj(e)||Jj(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(l=m?tr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||jc,o=jf(e.getAttribute("formenctype"))||jf(f.getAttribute("enctype"))||Nc,u=new FormData(f,e),!a5()){let{name:h,type:g,value:v}=e;if(g==="image"){let k=h?`${h}.`:"";u.append(`${k}x`,"0"),u.append(`${k}y`,"0")}else h&&u.append(h,v)}}else{if(Kc(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=jc,l=null,o=Nc,d=e}return u&&o==="text/plain"&&(d=u,u=void 0),{action:l,method:r.toLowerCase(),encType:o,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Km(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function wv(e,n,r,l){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${l}`:o.pathname=`${o.pathname}.${l}`:o.pathname==="/"?o.pathname=`_root.${l}`:n&&tr(o.pathname,n)==="/"?o.pathname=`${Ac(n)}/_root.${l}`:o.pathname=`${Ac(o.pathname)}.${l}`,o}async function s5(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function i5(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function o5(e,n,r){let l=await Promise.all(e.map(async o=>{let u=n.routes[o.route.id];if(u){let d=await s5(u,r);return d.links?d.links():[]}return[]}));return f5(l.flat(1).filter(i5).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function qx(e,n,r,l,o,u){let d=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,f=(m,h)=>r[h].pathname!==m.pathname||r[h].route.path?.endsWith("*")&&r[h].params["*"]!==m.params["*"];return u==="assets"?n.filter((m,h)=>d(m,h)||f(m,h)):u==="data"?n.filter((m,h)=>{let g=l.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(d(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let v=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function c5(e,n,{includeHydrateFallback:r}={}){return u5(e.map(l=>{let o=n.routes[l.route.id];if(!o)return[];let u=[o.module];return o.clientActionModule&&(u=u.concat(o.clientActionModule)),o.clientLoaderModule&&(u=u.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(u=u.concat(o.hydrateFallbackModule)),o.imports&&(u=u.concat(o.imports)),u}).flat(1))}function u5(e){return[...new Set(e)]}function d5(e){let n={},r=Object.keys(e).sort();for(let l of r)n[l]=e[l];return n}function f5(e,n){let r=new Set;return new Set(n),e.reduce((l,o)=>{let u=JSON.stringify(d5(o));return r.has(u)||(r.add(u),l.push({key:u,link:o})),l},[])}function Wm(){let e=b.useContext(ms);return Km(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function m5(){let e=b.useContext(Gc);return Km(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ym=b.createContext(void 0);Ym.displayName="FrameworkContext";function Wc(){let e=b.useContext(Ym);return Km(e,"You must render this element inside a <HydratedRouter> element"),e}function h5(e,n){let r=b.useContext(Ym),[l,o]=b.useState(!1),[u,d]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:v}=n,k=b.useRef(null);b.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let C=M=>{M.forEach(O=>{d(O.isIntersecting)})},N=new IntersectionObserver(C,{threshold:.5});return k.current&&N.observe(k.current),()=>{N.disconnect()}}},[e]),b.useEffect(()=>{if(l){let C=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(C)}}},[l]);let w=()=>{o(!0)},j=()=>{o(!1),d(!1)};return r?e!=="intent"?[u,k,{}]:[u,k,{onFocus:ii(f,w),onBlur:ii(m,j),onMouseEnter:ii(h,w),onMouseLeave:ii(g,j),onTouchStart:ii(v,w)}]:[!1,k,{}]}function ii(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function p5({page:e,...n}){let r=jj(),{nonce:l}=Wc(),{router:o}=Wm(),u=b.useMemo(()=>nv(o.routes,e,o.basename),[o.routes,e,o.basename]);return u?(n.nonce==null&&l&&(n={...n,nonce:l}),r?b.createElement(x5,{page:e,matches:u,...n}):b.createElement(y5,{page:e,matches:u,...n})):null}function g5(e){let{manifest:n,routeModules:r}=Wc(),[l,o]=b.useState([]);return b.useEffect(()=>{let u=!1;return o5(e,n,r).then(d=>{u||o(d)}),()=>{u=!0}},[e,n,r]),l}function x5({page:e,matches:n,...r}){let l=Hn(),{future:o}=Wc(),{basename:u}=Wm(),d=b.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let f=wv(e,u,o.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let g of n)typeof g.route.shouldRevalidate=="function"?m=!0:h.push(g.route.id);return m&&h.length>0&&f.searchParams.set("_routes",h.join(",")),[f.pathname+f.search]},[u,o.v8_trailingSlashAwareDataRequests,e,l,n]);return b.createElement(b.Fragment,null,d.map(f=>b.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...r})))}function y5({page:e,matches:n,...r}){let l=Hn(),{future:o,manifest:u,routeModules:d}=Wc(),{basename:f}=Wm(),{loaderData:m,matches:h}=m5(),g=b.useMemo(()=>qx(e,n,h,u,l,"data"),[e,n,h,u,l]),v=b.useMemo(()=>qx(e,n,h,u,l,"assets"),[e,n,h,u,l]),k=b.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let C=new Set,N=!1;if(n.forEach(O=>{let R=u.routes[O.route.id];!R||!R.hasLoader||(!g.some($=>$.route.id===O.route.id)&&O.route.id in m&&d[O.route.id]?.shouldRevalidate||R.hasClientLoader?N=!0:C.add(O.route.id))}),C.size===0)return[];let M=wv(e,f,o.v8_trailingSlashAwareDataRequests,"data");return N&&C.size>0&&M.searchParams.set("_routes",n.filter(O=>C.has(O.route.id)).map(O=>O.route.id).join(",")),[M.pathname+M.search]},[f,o.v8_trailingSlashAwareDataRequests,m,l,u,g,n,e,d]),w=b.useMemo(()=>c5(v,u),[v,u]),j=g5(v);return b.createElement(b.Fragment,null,k.map(C=>b.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),w.map(C=>b.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),j.map(({key:C,link:N})=>b.createElement("link",{key:C,nonce:r.nonce,...N,crossOrigin:N.crossOrigin??r.crossOrigin})))}function v5(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var b5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{b5&&(window.__reactRouterVersion="7.18.1")}catch{}function k5({basename:e,children:n,useTransitions:r,window:l}){let o=b.useRef();o.current==null&&(o.current=QS({window:l,v5Compat:!0}));let u=o.current,[d,f]=b.useState({action:u.action,location:u.location}),m=b.useCallback(h=>{r===!1?f(h):b.startTransition(()=>f(h))},[r]);return b.useLayoutEffect(()=>u.listen(m),[u,m]),b.createElement(Yj,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:u,useTransitions:r})}var Xm=b.forwardRef(function({onClick:n,discover:r="render",prefetch:l="none",relative:o,reloadDocument:u,replace:d,mask:f,state:m,target:h,to:g,preventScrollReset:v,viewTransition:k,defaultShouldRevalidate:w,...j},C){let{basename:N,navigator:M,useTransitions:O}=b.useContext(Bn),R=typeof g=="string"&&Pm.test(g),$=uv(g,N);g=$.to;let H=Rj(g,{relative:o}),_=Hn(),V=null;if(f){let F=Vc(f,[],_.mask?_.mask.pathname:"/",!0);N!=="/"&&(F.pathname=F.pathname==="/"?N:ma([N,F.pathname])),V=M.createHref(F)}let[G,W,z]=h5(l,j),q=j5(g,{replace:d,mask:f,state:m,target:h,preventScrollReset:v,relative:o,viewTransition:k,defaultShouldRevalidate:w,useTransitions:O});function A(F){n&&n(F),F.defaultPrevented||q(F)}let L=!($.isExternal||u),X=b.createElement("a",{...j,...z,href:(L?V:void 0)||$.absoluteURL||H,onClick:L?A:n,ref:v5(C,W),target:h,"data-discover":!R&&r==="render"?"true":void 0});return G&&!R?b.createElement(b.Fragment,null,X,b.createElement(p5,{page:H})):X});Xm.displayName="Link";var Qm=b.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:l="",end:o=!1,style:u,to:d,viewTransition:f,children:m,...h},g){let v=Oi(d,{relative:h.relative}),k=Hn(),w=b.useContext(Gc),{navigator:j,basename:C}=b.useContext(Bn),N=w!=null&&M5(v)&&f===!0,M=j.encodeLocation?j.encodeLocation(v).pathname:v.pathname,O=k.pathname,R=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(O=O.toLowerCase(),R=R?R.toLowerCase():null,M=M.toLowerCase()),R&&C&&(R=tr(R,C)||R);const $=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let H=O===M||!o&&O.startsWith(M)&&O.charAt($)==="/",_=R!=null&&(R===M||!o&&R.startsWith(M)&&R.charAt(M.length)==="/"),V={isActive:H,isPending:_,isTransitioning:N},G=H?n:void 0,W;typeof l=="function"?W=l(V):W=[l,H?"active":null,_?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let z=typeof u=="function"?u(V):u;return b.createElement(Xm,{...h,"aria-current":G,className:W,ref:g,style:z,to:d,viewTransition:f},typeof m=="function"?m(V):m)});Qm.displayName="NavLink";var w5=b.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:l,replace:o,state:u,method:d=jc,action:f,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:v,defaultShouldRevalidate:k,...w},j)=>{let{useTransitions:C}=b.useContext(Bn),N=T5(),M=E5(f,{relative:h}),O=d.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&Pm.test(f),$=H=>{if(m&&m(H),H.defaultPrevented)return;H.preventDefault();let _=H.nativeEvent.submitter,V=_?.getAttribute("formmethod")||d,G=()=>N(_||H.currentTarget,{fetcherKey:n,method:V,navigate:r,replace:o,state:u,relative:h,preventScrollReset:g,viewTransition:v,defaultShouldRevalidate:k});C&&r!==!1?b.startTransition(()=>G()):G()};return b.createElement("form",{ref:j,method:O,action:M,onSubmit:l?m:$,...w,"data-discover":!R&&e==="render"?"true":void 0})});w5.displayName="Form";function S5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sv(e){let n=b.useContext(ms);return Ct(n,S5(e)),n}function j5(e,{target:n,replace:r,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:h}={}){let g=ia(),v=Hn(),k=Oi(e,{relative:d});return b.useCallback(w=>{if(t5(w,n)){w.preventDefault();let j=r!==void 0?r:Ei(v)===Ei(k),C=()=>g(e,{replace:j,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:f,defaultShouldRevalidate:m});h?b.startTransition(()=>C()):C()}},[v,g,k,r,l,o,n,e,u,d,f,m,h])}function Zm(e){ra(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 n=b.useRef(cm(e)),r=b.useRef(!1),l=Hn(),o=b.useMemo(()=>n5(l.search,r.current?null:n.current),[l.search]),u=ia(),d=b.useCallback((f,m)=>{const h=cm(typeof f=="function"?f(new URLSearchParams(o)):f);r.current=!0,u("?"+h,m)},[u,o]);return[o,d]}var N5=0,C5=()=>`__${String(++N5)}__`;function T5(){let{router:e}=Sv("useSubmit"),{basename:n}=b.useContext(Bn),r=Fj(),l=e.fetch,o=e.navigate;return b.useCallback(async(u,d={})=>{let{action:f,method:m,encType:h,formData:g,body:v}=l5(u,n);if(d.navigate===!1){let k=d.fetcherKey||C5();await l(k,r,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:v,formMethod:d.method||m,formEncType:d.encType||h,flushSync:d.flushSync})}else await o(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:v,formMethod:d.method||m,formEncType:d.encType||h,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[l,o,n,r])}function E5(e,{relative:n}={}){let{basename:r}=b.useContext(Bn),l=b.useContext(sa);Ct(l,"useFormAction must be used inside a RouteContext");let[o]=l.matches.slice(-1),u={...Oi(e||".",{relative:n})},d=Hn();if(e==null){u.search=d.search;let f=new URLSearchParams(u.search),m=f.getAll("index");if(m.some(g=>g==="")){f.delete("index"),m.filter(v=>v).forEach(v=>f.append("index",v));let g=f.toString();u.search=g?`?${g}`:""}}return(!e||e===".")&&o.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:ma([r,u.pathname])),Ei(u)}function M5(e,{relative:n}={}){let r=b.useContext(mv);Ct(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=Sv("useViewTransitionState"),o=Oi(e,{relative:n});if(!r.isTransitioning)return!1;let u=tr(r.currentLocation.pathname,l)||r.currentLocation.pathname,d=tr(r.nextLocation.pathname,l)||r.nextLocation.pathname;return Mi(o.pathname,d)!=null||Mi(o.pathname,u)!=null}const Fx="penguin.lastProjectId",Vx=e=>`penguin.lastAgentId.${e}`,jv=b.createContext(null);function um(e){return e.name??e.projectId}function jn(e){return e.name??e.agentId}function A5({children:e}){const[n,r]=b.useState([]),[l,o]=b.useState(!0),[u,d]=b.useState(null),[f,m]=b.useState([]),[h,g]=b.useState(!0),[v,k]=b.useState(null),w=b.useCallback(async()=>{o(!0);try{const O=await yS();r(O.projects),d(R=>{const $=R??localStorage.getItem(Fx);return(O.projects.find(_=>_.projectId===$)??O.projects[0])?.projectId??null})}finally{o(!1)}},[]);b.useEffect(()=>{w()},[w]);const j=b.useCallback(O=>{O!==u&&(localStorage.setItem(Fx,O),d(O),k(null),m([]),g(!0),Y1({lastProjectId:O}).catch(()=>{}))},[u]),C=b.useCallback(async()=>{if(u){g(!0);try{const O=await CS(u);m(O.agents),k(R=>{const $=R??localStorage.getItem(Vx(u)),H=O.agents.find(V=>V.agentId===$),_=O.agents.find(V=>V.agentId==="default_agent")??O.agents[0]??null;return(H??_)?.agentId??null})}finally{g(!1)}}},[u]);b.useEffect(()=>{m([]),C()},[C]);const N=b.useCallback(O=>{u&&localStorage.setItem(Vx(u),O),k(O)},[u]),M=b.useMemo(()=>{const O=n.find($=>$.projectId===u)??null,R=f.find($=>$.agentId===v)??null;return{projects:n,projectsLoading:l,currentProject:O,setCurrentProjectId:j,reloadProjects:w,agents:f,agentsLoading:h,currentAgent:R,setCurrentAgentId:N,reloadAgents:C}},[n,l,u,j,w,f,h,v,N,C]);return i.jsx(jv.Provider,{value:M,children:e})}function sn(){const e=b.useContext(jv);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function Nv(e,n){const r=new EventSource(e);r.onmessage=o=>{try{n.onOmniMessage(JSON.parse(o.data))}catch{}},r.addEventListener("server_event",o=>{try{n.onServerEvent(JSON.parse(o.data))}catch{}}),n.onOpen&&(r.onopen=n.onOpen);const{onError:l}=n;return l&&(r.onerror=()=>l(r.readyState===EventSource.CLOSED)),{close:()=>r.close()}}function R5(e,n){return Nv(`/api/sessions/${encodeURIComponent(e)}/stream`,n)}function L5(e){return Nv("/api/events",e)}const Cv="\0temp-workspaces",_5=/[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;function I5(e){const n=e.trim();return n===""||_5.test(n)}function dm(e){return I5(e)?Cv:e.trim()}function z5(e){const n=e.trim().split(/[/\\]+/).filter(Boolean);return n[n.length-1]??"/"}const ul=20;function Gx(e,n){return e.length>n?{items:e.slice(0,n),hasMore:!0}:{items:e,hasMore:!1}}function D5(e,n){const r=[];for(const l of e)n.get(l.agentId)===!0&&!r.includes(l.agentId)&&r.push(l.agentId);return r}function Kx(e){const n={active:[],subagent:[],schedule:[],archived:[]};for(const r of e)r.archived?n.archived.push(r):r.source==="subagent"?n.subagent.push(r):r.source==="schedule"?n.schedule.push(r):n.active.push(r);return n}function O5(e){const n=new Map;for(const o of e){const u=dm(o.workspace);let d=n.get(u);if(!d){const f=u===Cv;d={key:u,label:f?"":z5(o.workspace),fullPath:f?null:o.workspace.trim(),temp:f,sessions:[]},n.set(u,d)}d.sessions.push(o)}const r=(o,u)=>o<u?1:o>u?-1:0,l=[...n.values()];for(const o of l)o.sessions.sort((u,d)=>r(u.createdAt,d.createdAt));return l.sort((o,u)=>o.temp!==u.temp?o.temp?1:-1:r(o.sessions[0]?.createdAt??"",u.sessions[0]?.createdAt??"")),l}function Wx(e,n,r){if(r.size===0)return[...e];const l=[],o=[];for(const u of e)(r.has(n(u))?l:o).push(u);return[...l,...o]}const Tv=b.createContext(null);function U5({children:e}){const{currentProject:n,agents:r}=sn(),l=n?.projectId??null,o=r.map(G=>G.agentId).join(","),[u,d]=b.useState([]),[f,m]=b.useState(new Map),[h,g]=b.useState(!0),v=b.useRef(0),k=b.useRef([]);k.current=u;const w=b.useRef(f);w.current=f;const j=b.useCallback(async()=>{const G=o===""?[]:o.split(",");if(!l||G.length===0)return;const W=++v.current;g(!0);try{const z=await Promise.all(G.map(async q=>{try{const A=(await _x(l,q,{offset:0,limit:ul+1})).sessions;return{agentId:q,...Gx(A,ul)}}catch{return{agentId:q,items:[],hasMore:!1}}}));if(W!==v.current)return;d(z.flatMap(q=>q.items)),m(new Map(z.map(q=>[q.agentId,q.hasMore])))}finally{W===v.current&&g(!1)}},[l,o]);b.useEffect(()=>{d([]),m(new Map),j()},[j]);const C=b.useCallback(async G=>{if(!l)return;const W=[...new Set(G)].filter(A=>w.current.get(A)===!0);if(W.length===0)return;const z=v.current,q=await Promise.all(W.map(async A=>{const L=k.current.filter(X=>X.agentId===A).length;try{const X=(await _x(l,A,{offset:L,limit:ul+1})).sessions;return{agentId:A,...Gx(X,ul)}}catch{return{agentId:A,items:[],hasMore:!0}}}));z===v.current&&(d(A=>{const L=new Set(A.map(F=>F.sessionId)),X=q.flatMap(F=>F.items.filter(D=>!L.has(D.sessionId)));return X.length>0?[...A,...X]:A}),m(A=>{const L=new Map(A);for(const X of q)L.set(X.agentId,X.hasMore);return L}))},[l]),N=b.useRef(j);N.current=j;const M=b.useRef(l);M.current=l,b.useEffect(()=>{const G=L5({onOmniMessage:()=>{},onServerEvent:W=>{W.type==="schedule_fired"&&W.projectId===M.current&&N.current()}});return()=>G.close()},[]);const O=b.useCallback(G=>{v.current+=1,d(W=>[G,...W.filter(z=>z.sessionId!==G.sessionId)])},[]),R=b.useCallback(G=>{v.current+=1,d(W=>W.filter(z=>z.sessionId!==G))},[]),$=b.useCallback(G=>{d(W=>W.map(z=>z.sessionId===G.sessionId?G:z))},[]),H=b.useCallback((G,W)=>{d(z=>{const q=z.find(A=>A.sessionId===G);return!q||q.status===W?z:z.map(A=>A.sessionId===G?{...A,status:W}:A)})},[]),_=b.useCallback((G,W)=>{d(z=>z.map(q=>q.sessionId===G?{...q,title:W}:q))},[]),V=b.useMemo(()=>{const G=new Map;for(const W of u){const z=G.get(W.agentId);z?z.push(W):G.set(W.agentId,[W])}for(const W of G.values())W.sort((z,q)=>q.createdAt.localeCompare(z.createdAt)||q.sessionId.localeCompare(z.sessionId));return{sessions:u,byAgent:G,hasMoreByAgent:f,loading:h,reload:j,loadMoreFor:C,add:O,remove:R,replace:$,setStatus:H,setTitle:_}},[u,f,h,j,C,O,R,$,H,_]);return i.jsx(Tv.Provider,{value:V,children:e})}function Ui(){const e=b.useContext(Tv);if(!e)throw new Error("useSessions must be used within a SessionsProvider");return e}function $5({open:e,side:n="left",title:r,onClose:l,children:o,widthClass:u}){return b.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&l()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l]),e?i.jsxs("div",{className:"fixed inset-0 z-50",children:[i.jsx("div",{className:"anim-fade absolute inset-0 bg-black/45",onMouseDown:l}),i.jsxs("div",{className:`absolute inset-y-0 flex w-[80vw] flex-col bg-white shadow-xl dark:bg-gray-900 ${u??"max-w-xs"} ${n==="left"?"anim-drawer-left left-0 border-r border-gray-200 dark:border-gray-800":"anim-drawer-right right-0 border-l border-gray-200 dark:border-gray-800"}`,children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[i.jsx("span",{className:"text-base font-semibold",children:r??""}),i.jsx("button",{type:"button","aria-label":x.common.close,onClick:l,className:"rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-[env(safe-area-inset-bottom)]",children:o})]})]}):null}function We({d:e,size:n=13,className:r=""}){return i.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:`block shrink-0 ${r}`,"aria-hidden":!0,children:i.jsx("path",{d:e})})}function Na({button:e,open:n,setOpen:r,children:l,menuClass:o,menuStyle:u,className:d}){const f=b.useRef(null);return b.useEffect(()=>{if(!n)return;const m=g=>{f.current&&!f.current.contains(g.target)&&r(!1)},h=g=>{g.key==="Escape"&&r(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[n,r]),i.jsxs("div",{className:`relative ${d??""}`,ref:f,children:[e,n&&i.jsx("div",{...u!==void 0?{style:u}:{},className:`anim-pop absolute z-40 max-h-[70vh] overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900 ${o??"left-0 top-full mt-1 w-64 max-w-[calc(100vw-2rem)] origin-top-left"}`,children:l})]})}function B5(e){let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return n>>>0}function H5(e){return B5(e)%360}function Ev(e){const n=H5(e);return{bg:`hsl(${n} 55% 50% / 0.14)`,fg:`hsl(${n} 55% 28%)`,fgDark:`hsl(${n} 55% 73%)`}}const Yx=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function Xx(e){if(e){if(!Yx)return Array.from(e)[0];for(const n of Yx.segment(e))return n.segment}}function Mv(e,n){const r=Xx(e.trim())??Xx((n??"").trim());return r?r.toUpperCase():"?"}function zr({id:e,name:n,size:r=18,className:l}){const o=Ev(e);return i.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",className:l,style:{"--tile-fg":o.fg,"--tile-fg-dark":o.fgDark},"aria-hidden":!0,role:"img",children:[i.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:o.bg}),i.jsx("text",{x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",fontSize:"13",fontWeight:"700",className:"[fill:var(--tile-fg)] dark:[fill:var(--tile-fg-dark)]",children:Mv(n??"",e)})]})}function ln({open:e,size:n=14,className:r=""}){return i.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:`block shrink-0 transition-transform duration-200 ${e?"rotate-90":""} ${r}`,children:i.jsx("path",{d:"M9 5l7 7-7 7"})})}function Yc({text:e,className:n=""}){const r=b.useRef(null),[l,o]=b.useState(!1);return b.useLayoutEffect(()=>{const u=r.current;if(!u)return;const d=()=>o(u.scrollWidth>u.clientWidth+1);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(u),()=>f.disconnect()},[e,n]),i.jsx("span",{ref:r,className:`truncate ${n}`,...l?{title:e}:{},children:e})}const P5={gray:"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300",brand:"bg-gray-200/80 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",green:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",amber:"bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-300",red:"bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-300"};function Rt({tone:e="gray",children:n}){return i.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ${P5[e]}`,children:n})}function fm(e){switch(e){case"completed":return"green";case"aborted":return"amber";default:return"red"}}var $i=$1();const oi=[];function Dt({open:e,title:n,onClose:r,children:l,footer:o,widthClass:u}){return b.useEffect(()=>{if(!e)return;const d=Symbol("modal");oi.push(d);const f=m=>{m.key==="Escape"&&oi[oi.length-1]===d&&r()};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);const m=oi.lastIndexOf(d);m!==-1&&oi.splice(m,1)}},[e,r]),e?$i.createPortal(i.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-end justify-center bg-black/45 p-0 sm:items-center sm:p-4",onMouseDown:d=>{d.target===d.currentTarget&&r()},children:i.jsxs("div",{className:`anim-pop w-full ${u??"sm:max-w-md"} rounded-t-lg border border-gray-200 bg-white pb-[env(safe-area-inset-bottom)] shadow-xl sm:rounded-lg sm:pb-0 dark:border-gray-800 dark:bg-gray-900`,children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[i.jsx("h2",{className:"text-base font-semibold",children:n}),i.jsx("button",{type:"button","aria-label":x.common.close,onClick:r,className:"rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),i.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-4 py-4",children:l}),o&&i.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-200 px-4 py-3 dark:border-gray-800",children:o})]})}),document.body):null}const q5={primary:"bg-[var(--accent-bg)] text-[var(--accent-fg)] border border-[var(--accent-bg)] transition-opacity hover:opacity-90 disabled:opacity-50",secondary:"bg-white text-gray-800 border border-gray-300 hover:bg-gray-50 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800",danger:"bg-white text-red-600 border border-gray-300 hover:border-red-300 hover:bg-red-50 dark:bg-gray-900 dark:text-red-400 dark:border-gray-700 dark:hover:bg-red-950",ghost:"bg-transparent text-gray-600 border border-transparent hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"},F5={sm:"px-2.5 py-1 text-xs rounded-md",md:"px-3 py-1.5 text-sm rounded-md",icon:"p-1.5 rounded-md"};function ye({variant:e="secondary",size:n="md",className:r,...l}){return i.jsx("button",{type:"button",className:`inline-flex items-center justify-center gap-1 font-medium transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-60 ${q5[e]} ${F5[n]} ${r??""}`,...l})}const Av="w-full rounded-md border border-gray-300 bg-white text-gray-900 placeholder:text-gray-400 transition-[border-color,box-shadow] duration-200 hover:border-gray-400 focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:placeholder:text-gray-500 dark:hover:border-gray-600 dark:focus:border-gray-400 dark:focus:ring-gray-500/30",Jm={base:"px-3 py-2 text-base",sm:"px-2 py-1 text-xs"},V5="!border-red-400 !bg-red-50 hover:!border-red-500 focus:!border-red-500 focus:!ring-red-400/30 dark:!border-red-800 dark:!bg-red-950/40 dark:hover:!border-red-700 dark:focus:!border-red-600";function Je({label:e,hint:n,error:r,invalid:l,size:o="base",className:u,...d}){const f=!!r||!!l,m=i.jsx("input",{className:`${Av} ${Jm[o]} ${f?V5:""} ${u??""}`,"aria-invalid":f?!0:void 0,...d});return!e&&!n&&!r?m:i.jsxs("label",{className:"block",children:[e&&i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:e}),m,r?i.jsx("span",{className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:r}):n?i.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:n}):null]})}const cs=b.forwardRef(function({label:n,hint:r,mono:l,size:o="base",className:u,...d},f){const m=i.jsx("textarea",{ref:f,className:`${Av} px-3 py-2 ${o==="sm"?"text-xs leading-relaxed":"text-base"} ${l?"font-mono":""} ${u??""}`,...d});return!n&&!r?m:i.jsxs("label",{className:"block",children:[n&&i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:n}),m,r&&i.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:r})]})});function dl({options:e,value:n,onChange:r,cols:l=3}){return i.jsx("div",{className:`grid ${l===2?"grid-cols-2":"grid-cols-3"} gap-0.5 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800`,children:e.map(o=>i.jsx("button",{type:"button",onClick:()=>r(o.value),className:`rounded px-1 py-1 text-xs transition-colors duration-150 ${n===o.value?"bg-white font-medium text-gray-900 shadow-sm dark:bg-gray-600 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:o.label},o.value))})}function At({className:e}){return i.jsx("div",{className:`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${e??"h-4 w-full"}`})}function Dr({rows:e=3}){return i.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:e},(n,r)=>i.jsx(At,{className:"h-8 w-full"},r))})}function Rv({className:e,children:n}){return i.jsx("div",{className:`rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900 ${e??"p-4"}`,children:n??i.jsxs(i.Fragment,{children:[i.jsx(At,{className:"h-3 w-20"}),i.jsx(At,{className:"mt-2.5 h-6 w-28"}),i.jsx(At,{className:"mt-2.5 h-3 w-24"})]})})}function er(e,n){if(!(e instanceof He))return x.common.unknownError;switch(e.code){case"model_credential_missing":return n?.modelId?x.errors.modelCredentialMissing(n.modelId):e.message;case"no_default_model":return x.errors.noDefaultModel;default:return e.message}}function Ta(e){b.useEffect(()=>{document.title=e?`${e} · ${x.appName}`:x.appName},[e])}function _r(e){const n=e.toFixed(1);return n.endsWith(".0")?n.slice(0,-2):n}function ft(e){const n=Math.abs(e);return n<1e3?`${e}`:n<1e6?`${_r(e/1e3)}k`:`${_r(e/1e6)}M`}function Jt(e){if(e<1e3)return`${Math.round(e)}ms`;const n=e/1e3;return n<60?`${_r(n)}s`:`${Math.floor(n/60)}m${Math.round(n%60)}s`}function G5(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m${n%60}s`}function mm(e,n){return n>0?e/(n/1e3):null}function Rc(e){return e==null||!Number.isFinite(e)?"—":`${Math.abs(e)<1e3?_r(e):ft(e)} tok/s`}function Lv(e,n){const r=e+n;return r>0?e/r:null}function eh(e){return e==null||!Number.isFinite(e)?"—":`${Math.round(e*100)}%`}function la(e,n="USD"){if(e==null)return"—";const r=n==="CNY"?"¥":"$",l=n==="CNY"?e*7:e;if(l===0)return`${r}0`;const o=Math.abs(l),u=o>=100?0:o>=1?2:4;return`${r}${l.toFixed(u)}`}function Lc(e){return Number.isInteger(e)?`${e}`:_r(e)}function hm(e){return e<1024?`${e}B`:e<1024*1024?`${_r(e/1024)}KB`:e<1024*1024*1024?`${_r(e/(1024*1024))}MB`:`${_r(e/(1024*1024*1024))}GB`}function fl(e){return e<10?`0${e}`:`${e}`}function $n(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${n.getFullYear()}-${fl(n.getMonth()+1)}-${fl(n.getDate())} ${fl(n.getHours())}:${fl(n.getMinutes())}`}function _v(e,n){const r=new Date(e);return Number.isNaN(r.getTime())?"":r.toLocaleString(n==="en"?"en-US":"zh-CN",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function _c(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function K5(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const l=Math.round((_c(new Date)-_c(r))/864e5);return l<0?$n(e):l===0?n==="en"?"today":"今天":l===1?n==="en"?"yesterday":"昨天":n==="en"?`${l} days ago`:`${l} 天前`}function W5(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const l=Math.round((_c(new Date)-_c(r))/864e5);return l<0?e:l===0?n==="en"?"updated today":"今天更新":l===1?n==="en"?"updated yesterday":"昨天更新":n==="en"?`updated ${l} days ago`:`${l} 天前更新`}function Y5(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${fl(n.getHours())}:${fl(n.getMinutes())}:${fl(n.getSeconds())}`}var X5=["partial_text","partial_thinking","partial_tool_call","partial_tool_call_output"];function th(e){return X5.includes(e.type??"")}function nh(e){return e.type==="event_msg"}function Q5(){return{contextNow:0,contextStale:!1,contextAtLastStats:0,sessionTotal:0,subagentTotal:0,taskTokens:0,taskCacheRead:0,taskCacheWrite:0,taskOutput:0,taskMainOutput:0,taskLlmMs:0,pendingCompactionTokens:0,pendingCompactionCacheRead:0,pendingCompactionCacheWrite:0,pendingCompactionOutput:0,hasUsage:!1,sessionElapsedMs:0,compactionActive:!1}}function Iv(e,n){e.taskCacheRead+=n.request.cache_read,e.taskCacheWrite+=n.request.cache_write,e.taskOutput+=n.request.output}function Z5(e,n){if(e.sessionTotal=n.session.total,e.compactionActive){e.pendingCompactionTokens+=n.request.total,e.pendingCompactionCacheRead+=n.request.cache_read,e.pendingCompactionCacheWrite+=n.request.cache_write,e.pendingCompactionOutput+=n.request.output;return}e.taskTokens+=n.request.total,Iv(e,n),e.contextNow=n.request.total,e.contextStale=!1,e.taskMainOutput+=n.request.output,e.hasUsage=!0}function J5(e){e.pendingCompactionTokens!==0&&(e.taskTokens+=e.pendingCompactionTokens,e.taskCacheRead+=e.pendingCompactionCacheRead,e.taskCacheWrite+=e.pendingCompactionCacheWrite,e.taskOutput+=e.pendingCompactionOutput,e.hasUsage=!0,ah(e))}function ah(e){e.pendingCompactionTokens=0,e.pendingCompactionCacheRead=0,e.pendingCompactionCacheWrite=0,e.pendingCompactionOutput=0}function e4(e,n){n>0&&(e.taskLlmMs+=n)}function t4(e,n){e.taskTokens+=n.request.total,Iv(e,n),e.subagentTotal+=n.request.total,e.hasUsage=!0}function n4(e){e.compactionActive=!0}function a4(e,n){e.compactionActive=!1,n==="completed"&&(e.contextStale=!0)}function r4(e){e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,ah(e),e.hasUsage=!1,e.compactionActive=!1}function l4(e,n){if(e.sessionElapsedMs+=n,ah(e),!e.hasUsage)return e.taskTokens=0,null;const r={context:e.contextNow,contextDelta:e.contextNow-e.contextAtLastStats,tokens:e.sessionTotal+e.subagentTotal,tokensDelta:e.taskTokens,elapsedMs:e.sessionElapsedMs,elapsedDeltaMs:n,tokensByBucket:{cacheRead:e.taskCacheRead,cacheWrite:e.taskCacheWrite,output:e.taskOutput},outputTps:mm(e.taskMainOutput,e.taskLlmMs)};return e.contextAtLastStats=e.contextNow,e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,e.hasUsage=!1,e.compactionActive=!1,r}function s4(e,n){const r=e.tokensByBucket;return`[${n.stats}] ${n.input} ${ft(r.cacheRead+r.cacheWrite)}${n.parenOpen}${n.cached} ${ft(r.cacheRead)}${n.parenClose} · ${n.output} ${ft(r.output)} · ${Rc(e.outputTps)}`}function zv(e,n){return{items:[],nested:e,thinkingLevel:null,stats:Q5(),openText:null,openThinking:null,pendingText:null,pendingThinking:null,toolCards:new Map,subagents:new Map,localDecisions:n,pendingDecisions:new Map,pendingDecisionTs:new Map,lastTsMs:0,openRequestBeginMs:null,openApprovalWaitMs:0,reconnectRun:0,taskOpen:!1,taskStartLocalMs:0,taskFirstTsMs:0,taskLastTsMs:0,taskLastReqEndMs:null,nextItemId:1}}function Cc(e=new Set){return zv(!1,e)}function Dn(e){return e.nextItemId++}function Ic(e,n,r=Date.now()){if(n.origin&&n.origin.length>0){x4(e,n,r);return}if(n.type==="model_msg"){if(e.stats.compactionActive){Sa(e,n.timestamp),Nf(e,n.timestamp);return}if(th(n.payload)){Sa(e,n.timestamp),m4(e,n.payload,Za(n.timestamp));return}h4(e,n.payload,n.timestamp,r),Nf(e,n.timestamp);return}if(nh(n)){Sa(e,n.timestamp),p4(e,n.payload,Za(n.timestamp)),Nf(e,n.timestamp);return}if(n.type==="session_meta"){const l=n.payload.thinking_level;typeof l=="string"&&l&&(e.thinkingLevel=l)}}function Za(e){const n=Date.parse(e);return Number.isFinite(n)?n:void 0}function Nf(e,n){const r=Date.parse(n);Number.isFinite(r)&&(e.lastTsMs=r)}function i4(e,n,r=Date.now()){for(const l of n)Ic(e,l,r)}function o4(e,n=Date.now()){rh(e,"live",n)}function c4(e){rh(e,"history")}function u4(e,n){e.localDecisions.add(n)}function us(e,n){return`${e?.join("/")??""} ${n}`}function d4(e,n,r){let l=e;for(const o of n??[])if(l=l.subagents.get(o),!l)return null;return l.toolCards.get(r)??null}function Sa(e,n){if(!e.taskOpen||e.stats.compactionActive)return;const r=Date.parse(n);!Number.isFinite(r)||r<=e.taskLastTsMs||(e.taskLastTsMs=r)}function Qx(e,n,r){rh(e,"history");const l=ym(e);l&&(l.gaveUp=!0),e.reconnectRun=0,e.openRequestBeginMs=null,e.openApprovalWaitMs=0,e.taskOpen=!0,e.taskStartLocalMs=r;const o=Date.parse(n);e.taskFirstTsMs=Number.isFinite(o)?o:r,e.taskLastTsMs=e.taskFirstTsMs,e.taskLastReqEndMs=null,r4(e.stats)}function rh(e,n,r){if(!e.taskOpen)return;e.taskOpen=!1,Dv(e);const l=e.taskLastReqEndMs??e.taskLastTsMs,o=Math.max(0,l-e.taskFirstTsMs);let u;e.taskLastReqEndMs!==null?u=o:n==="live"?u=Math.max((r??Date.now())-e.taskStartLocalMs,o):u=o;const d=l4(e.stats,u);if(e.nested)return;const f=f4(e);if(d===null&&f.text==="")return;const m={kind:"task_stats",id:Dn(e),stats:d,assistantText:f.text,...f.atMs!==void 0?{atMs:f.atMs}:{}};let h=e.items.length;for(;h>0&&e.items[h-1].kind==="compaction";)h--;e.items.splice(h,0,m)}function f4(e){const n=[];let r;for(let l=e.items.length-1;l>=0;l--){const o=e.items[l];if(o.kind==="task_stats")break;o.kind==="assistant_text"&&o.text.trim()&&(n.push(o.text),r===void 0&&(r=o.atMs))}return{text:n.reverse().join(`
|
|
62
|
+
|
|
63
|
+
`),...r!==void 0?{atMs:r}:{}}}function m4(e,n,r){switch(n.type){case"partial_text":{if(n.event_type==="start"){e.pendingText=null;const o={kind:"assistant_text",id:Dn(e),text:n.text??"",streaming:!0,...r!==void 0?{atMs:r}:{}};e.openText=o,e.items.push(o);return}const l=e.openText;if(!l)return;n.text&&(l.text+=n.text),n.event_type==="stop"&&(l.streaming=!1,n.stop_reason!==void 0&&(l.stopReason=n.stop_reason),e.pendingText=l,e.openText=null);return}case"partial_thinking":{if(n.event_type==="start"){e.pendingThinking=null;const o={kind:"thinking",id:Dn(e),thinking:n.thinking??"",streaming:!0};r!==void 0&&(o.startedAtMs=r),e.openThinking=o,e.items.push(o);return}const l=e.openThinking;if(!l)return;n.thinking&&(l.thinking+=n.thinking),n.event_type==="stop"&&(l.streaming=!1,n.stop_reason!==void 0&&(l.stopReason=n.stop_reason),pm(l,r),e.pendingThinking=l,e.openThinking=null);return}case"partial_tool_call":{const l=e.toolCards.get(n.tool_call_id);if(l?.callComplete)return;if(n.event_type==="start"){if(l){l.name=n.name||l.name,l.argumentsText=n.arguments??"",l.callStreaming=!0,r!==void 0&&l.argStartedAtMs===void 0&&(l.argStartedAtMs=r);return}const o=xm(e,{toolCallId:n.tool_call_id,name:n.name,argumentsText:n.arguments??"",callStreaming:!0});r!==void 0&&(o.argStartedAtMs=r);return}if(!l)return;n.name&&!l.name&&(l.name=n.name),n.arguments&&(l.argumentsText+=n.arguments),n.event_type==="stop"&&(l.callStreaming=!1,n.stop_reason!==void 0&&(l.callStopReason=n.stop_reason),r!==void 0&&(l.callStartedAtMs=r));return}case"partial_tool_call_output":{const l=e.toolCards.get(n.tool_call_id);if(!l||l.outputComplete)return;if(n.event_type==="start"){l.outputStreaming=!0,n.output&&(l.output+=n.output);return}if(!l.outputStreaming)return;n.output&&(l.output+=n.output),n.images&&n.images.length>0&&(l.images=n.images),n.event_type==="stop"&&(l.outputStreaming=!1,n.stop_reason!==void 0&&(l.outputStopReason=n.stop_reason),Ov(l,r));return}}}function h4(e,n,r,l){switch(n.type){case"text":{if(n.role==="user"){if(n.text.startsWith("<context_summary>")){Sa(e,r);return}Qx(e,r,l);const f=Za(r);e.items.push({kind:"user_text",id:Dn(e),text:n.text,...f!==void 0?{atMs:f}:{}});return}Sa(e,r);const o=e.pendingText??e.openText;if(o){o.text=n.text,o.streaming=!1;const f=Za(r);f!==void 0&&(o.atMs=f),n.stop_reason!==void 0&&(o.stopReason=n.stop_reason),o===e.openText&&(e.openText=null),e.pendingText=null;return}const u=Za(r),d={kind:"assistant_text",id:Dn(e),text:n.text,streaming:!1,...u!==void 0?{atMs:u}:{}};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.items.push(d);return}case"image_url":{Qx(e,r,l);const o=Za(r);e.items.push({kind:"user_image",id:Dn(e),imageUrl:n.image_url,...o!==void 0?{atMs:o}:{}});return}case"thinking":{Sa(e,r);const o=Za(r),u=e.pendingThinking??e.openThinking;if(u){u.thinking=n.thinking,u.streaming=!1,n.stop_reason!==void 0&&(u.stopReason=n.stop_reason),pm(u,o),u===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}const d={kind:"thinking",id:Dn(e),thinking:n.thinking,streaming:!1};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.lastTsMs>0&&(d.startedAtMs=e.lastTsMs),pm(d,o),e.items.push(d);return}case"tool_call":{Sa(e,r);const o=Za(r),u=e.toolCards.get(n.tool_call_id),d=u?.callComplete?void 0:u;if(d){d.name=n.name,d.argumentsText=n.arguments,d.callStreaming=!1,d.callComplete=!0,n.stop_reason!==void 0&&(d.callStopReason=n.stop_reason),o!==void 0&&(d.callStartedAtMs=o),gm(e,d),Zx(d);return}u&&!u.outputComplete&&(u.outputComplete=!0,u.outputStreaming=!1,u.outputStopReason??="aborted");const f=xm(e,{toolCallId:n.tool_call_id,name:n.name,argumentsText:n.arguments,callStreaming:!1});f.callComplete=!0,n.stop_reason!==void 0&&(f.callStopReason=n.stop_reason),o!==void 0&&(f.callStartedAtMs=o),gm(e,f),e.lastTsMs>0&&(f.argStartedAtMs=e.lastTsMs),Zx(f);return}case"tool_call_output":{Sa(e,r);let o=e.toolCards.get(n.tool_call_id);o||(o=xm(e,{toolCallId:n.tool_call_id,name:"",argumentsText:"",callStreaming:!1})),o.output=n.output,n.images&&n.images.length>0&&(o.images=n.images),o.outputStreaming=!1,o.outputComplete=!0,n.stop_reason!==void 0&&(o.outputStopReason=n.stop_reason),Ov(o,Za(r));return}case"inline_data":case"inline_thinking":Sa(e,r);return}}function Dv(e){for(const n of e.toolCards.values())n.callComplete&&!n.outputComplete&&(n.outputComplete=!0,n.outputStreaming=!1,n.outputStopReason??="aborted")}function Zx(e){!e.callStopReason||e.callStopReason==="completed"||e.outputComplete||(e.outputComplete=!0,e.outputStreaming=!1,e.outputStopReason??=e.callStopReason)}function pm(e,n){n===void 0||e.startedAtMs===void 0||(e.durationMs=Math.max(0,n-e.startedAtMs))}function Ov(e,n){if(n===void 0)return;const r=e.approvalAtMs??e.callStartedAtMs;if(r===void 0)return;const l=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0;e.durationMs=l+Math.max(0,n-r)}function gm(e,n){if(n.approvalWaitCounted)return;const{callStartedAtMs:r,approvalAtMs:l}=n;if(r===void 0||l===void 0)return;n.approvalWaitCounted=!0;const o=l-r;o>0&&(e.openApprovalWaitMs+=o)}function xm(e,n){const r={kind:"tool_call",id:Dn(e),toolCallId:n.toolCallId,name:n.name,argumentsText:n.argumentsText,callStreaming:n.callStreaming,callComplete:!1,output:"",outputStreaming:!1,outputComplete:!1},l=e.pendingDecisions.get(n.toolCallId);if(l!==void 0){r.decision=l,r.decisionSource=e.localDecisions.has(n.toolCallId)?"manual":"remote",e.pendingDecisions.delete(n.toolCallId);const o=e.pendingDecisionTs.get(n.toolCallId);o!==void 0&&(r.approvalAtMs=o,e.pendingDecisionTs.delete(n.toolCallId))}return e.toolCards.set(n.toolCallId,r),e.items.push(r),r}function p4(e,n,r){switch(n.type){case"approval_decision":{const l=e.toolCards.get(n.tool_call_id);l?(l.decision=n.decision,l.decisionSource=e.localDecisions.has(n.tool_call_id)?"manual":"remote",r!==void 0&&l.approvalAtMs===void 0&&(l.approvalAtMs=r),gm(e,l)):(e.pendingDecisions.set(n.tool_call_id,n.decision),r!==void 0&&e.pendingDecisionTs.set(n.tool_call_id,r));return}case"abort":{Dv(e);const l=ym(e);l&&(l.gaveUp=!0),e.reconnectRun=0;const o={kind:"abort",id:Dn(e)};n.reason!=null&&(o.reason=n.reason),e.items.push(o);return}case"token_usage":Z5(e.stats,n);return;case"compaction_begin":{n4(e.stats),e.items.push({kind:"compaction",id:Dn(e),reason:n.reason,mode:n.mode,running:!0});return}case"compaction_end":{a4(e.stats,n.status);const l=g4(e);if(l)l.running=!1,l.status=n.status;else{const o={kind:"compaction",id:Dn(e),reason:n.reason,mode:n.mode,running:!1,status:n.status};e.items.push(o)}return}case"request_begin":{const l=ym(e);l&&(l.retrying=!0),e.stats.compactionActive||(e.openRequestBeginMs=r??null,e.openApprovalWaitMs=0);return}case"request_end":{if(e.stats.compactionActive)return;e.openRequestBeginMs!==null&&r!==void 0&&e4(e.stats,r-e.openRequestBeginMs-e.openApprovalWaitMs),e.openRequestBeginMs=null,e.openApprovalWaitMs=0,r!==void 0&&(e.taskLastReqEndMs=r),J5(e.stats),n.status==="timeout"||n.status==="malformed"?(e.reconnectRun+=1,e.items.push({kind:"reconnect",id:Dn(e),status:n.status,attempt:e.reconnectRun,retrying:!1})):e.reconnectRun=0;return}}}function g4(e){for(let n=e.items.length-1;n>=0;n--){const r=e.items[n];if(r.kind==="compaction"&&r.running)return r}return null}function ym(e){for(let n=e.items.length-1;n>=0;n--){const r=e.items[n];if(r.kind==="reconnect")return!r.retrying&&!r.gaveUp?r:null}return null}function x4(e,n,r){const l=n.origin[0];nh(n)&&n.payload.type==="token_usage"&&t4(e.stats,n.payload),Sa(e,n.timestamp);let o=e.subagents.get(l);o||(o=zv(!0,e.localDecisions),e.subagents.set(l,o),y4(e,l,o));const u=n.origin.slice(1),d={...n};u.length>0?d.origin=u:delete d.origin,Ic(o,d,r)}function y4(e,n,r){for(let l=e.items.length-1;l>=0;l--){const o=e.items[l];if(o.kind==="tool_call"&&o.name==="run_subagent"&&!o.subagent&&!o.outputComplete&&o.decision==="allow"){o.subagent=r,o.subagentSessionId=n;return}}e.items.push({kind:"subagent",id:Dn(e),sessionId:n,model:r})}function v4(e,n=100){const r=new Set;for(let l=Math.max(0,e.length-n);l<e.length;l++)r.add(JSON.stringify(e[l]));return r}function b4(e,n){return e.has(JSON.stringify(n))}function Uv(e,n){if(n.origin&&n.origin.length>0){const l=e.subagents.get(n.origin[0]);if(!l)return;const o=n.origin.slice(1),u={...n};o.length>0?u.origin=o:delete u.origin,Uv(l,u);return}if(n.type!=="model_msg"||th(n.payload))return;const r=n.payload;switch(r.type){case"text":{if(r.role!=="assistant")return;const l=e.pendingText??e.openText;l&&(Cf(e,l),l===e.openText&&(e.openText=null),e.pendingText=null);return}case"thinking":{const l=e.pendingThinking??e.openThinking;l&&(Cf(e,l),l===e.openThinking&&(e.openThinking=null),e.pendingThinking=null);return}case"tool_call":{const l=e.toolCards.get(r.tool_call_id);l&&!l.callComplete&&(Cf(e,l),e.toolCards.delete(r.tool_call_id));return}case"tool_call_output":{const l=e.toolCards.get(r.tool_call_id);l&&!l.outputComplete&&(l.output="",l.outputStreaming=!1);return}default:return}}function Cf(e,n){const r=e.items.indexOf(n);r>=0&&e.items.splice(r,1)}function Or({title:e,description:n,action:r}){return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[i.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:e}),n&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:n}),r&&i.jsx("div",{className:"mt-2",children:r})]})}const k4={success:2500,error:6e3};let Ja=[],w4=1;const vm=new Set;function bm(){for(const e of vm)e(Ja)}const S4=160;function $v(e){const n=Ja.find(r=>r.id===e);!n||n.leaving||(Ja=Ja.map(r=>r.id===e?{...r,leaving:!0}:r),bm(),setTimeout(()=>{Ja=Ja.filter(r=>r.id!==e),bm()},S4))}function Bv(e,n){if(!n)return;const r=w4++;Ja=[...Ja,{id:r,kind:e,text:n}],bm(),setTimeout(()=>$v(r),k4[e])}const os=e=>Bv("success",e),On=e=>Bv("error",e),j4={success:"border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200",error:"border-red-200 bg-red-50 text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200"};function N4(){const[e,n]=b.useState(Ja);return b.useEffect(()=>(vm.add(n),()=>{vm.delete(n)}),[]),e.length===0?null:$i.createPortal(i.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4",children:e.map(r=>i.jsx("button",{type:"button",onClick:()=>$v(r.id),className:`pointer-events-auto max-w-lg break-words rounded-md border px-3 py-2 text-left text-sm shadow-lg ${r.leaving?"anim-toast-out":"anim-toast-in"} ${j4[r.kind]}`,children:r.text},r.id))}),document.body)}const Gt={input:"M12 15V5m0 0L8 9m4-4l4 4M4 19h16",output:"M12 3v10m0 0l-4-4m4 4l4-4M4 19h16",cacheHit:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-5a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-3a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",toolCalls:"M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",tps:"M5 18a8 8 0 1 1 14 0M12 12l4-3",elapsed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",cost:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",copy:"M9 9h9v9a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V9zM7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1",check:"M5 13l4 4L19 7"},C4=/^\[attached image: (.+)\]$/,T4=/[/\\]scratchpad[/\\]([^/\\]+)[/\\]([A-Za-z0-9._-]+)$/;function E4(e){if(/^https?:\/\//i.test(e))return e;const n=T4.exec(e);return n?`/api/sessions/${encodeURIComponent(n[1])}/scratchpad/${encodeURIComponent(n[2])}`:null}function M4(e){if(!e.includes("[attached image: "))return{text:e,images:[]};const n=[],r=[];for(const l of e.split(`
|
|
64
|
+
`)){const o=C4.exec(l.trim()),u=o?E4(o[1]):null;u?r.push(u):n.push(l)}return{text:n.join(`
|
|
65
|
+
`).replace(/\n+$/,""),images:r}}function A4(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const R4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,L4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_4={};function Jx(e,n){return(_4.jsx?L4:R4).test(e)}const I4=/[ \t\n\f\r]/g;function z4(e){return typeof e=="object"?e.type==="text"?ey(e.value):!1:ey(e)}function ey(e){return e.replace(I4,"")===""}class Bi{constructor(n,r,l){this.normal=r,this.property=n,l&&(this.space=l)}}Bi.prototype.normal={};Bi.prototype.property={};Bi.prototype.space=void 0;function Hv(e,n){const r={},l={};for(const o of e)Object.assign(r,o.property),Object.assign(l,o.normal);return new Bi(r,l,n)}function km(e){return e.toLowerCase()}class Cn{constructor(n,r){this.attribute=r,this.property=n}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let D4=0;const Ue=vl(),Vt=vl(),wm=vl(),xe=vl(),wt=vl(),ml=vl(),In=vl();function vl(){return 2**++D4}const Sm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ue,booleanish:Vt,commaOrSpaceSeparated:In,commaSeparated:ml,number:xe,overloadedBoolean:wm,spaceSeparated:wt},Symbol.toStringTag,{value:"Module"})),Tf=Object.keys(Sm);class lh extends Cn{constructor(n,r,l,o){let u=-1;if(super(n,r),ty(this,"space",o),typeof l=="number")for(;++u<Tf.length;){const d=Tf[u];ty(this,Tf[u],(l&Sm[d])===Sm[d])}}}lh.prototype.defined=!0;function ty(e,n,r){r&&(e[n]=r)}function hs(e){const n={},r={};for(const[l,o]of Object.entries(e.properties)){const u=new lh(l,e.transform(e.attributes||{},l),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),n[l]=u,r[km(l)]=l,r[km(u.attribute)]=l}return new Bi(n,r,e.space)}const Pv=hs({properties:{ariaActiveDescendant:null,ariaAtomic:Vt,ariaAutoComplete:null,ariaBusy:Vt,ariaChecked:Vt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:Vt,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:Vt,ariaFlowTo:wt,ariaGrabbed:Vt,ariaHasPopup:null,ariaHidden:Vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:xe,ariaLive:null,ariaModal:Vt,ariaMultiLine:Vt,ariaMultiSelectable:Vt,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Vt,ariaReadOnly:Vt,ariaRelevant:null,ariaRequired:Vt,ariaRoleDescription:wt,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Vt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function qv(e,n){return n in e?e[n]:n}function Fv(e,n){return qv(e,n.toLowerCase())}const O4=hs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ml,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:Ue,allowPaymentRequest:Ue,allowUserMedia:Ue,alpha:Ue,alt:null,as:null,async:Ue,autoCapitalize:null,autoComplete:wt,autoFocus:Ue,autoPlay:Ue,blocking:wt,capture:null,charSet:null,checked:Ue,cite:null,className:wt,closedBy:null,colorSpace:null,cols:xe,colSpan:xe,command:null,commandFor:null,content:null,contentEditable:Vt,controls:Ue,controlsList:wt,coords:xe|ml,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ue,defer:Ue,dir:null,dirName:null,disabled:Ue,download:wm,draggable:Vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ue,formTarget:null,headers:wt,height:xe,hidden:wm,high:xe,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:Ue,inputMode:null,integrity:null,is:null,isMap:Ue,itemId:null,itemProp:wt,itemRef:wt,itemScope:Ue,itemType:wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ue,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:Ue,muted:Ue,name:null,nonce:null,noModule:Ue,noValidate:Ue,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ue,optimum:xe,pattern:null,ping:wt,placeholder:null,playsInline:Ue,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ue,referrerPolicy:null,rel:wt,required:Ue,reversed:Ue,rows:xe,rowSpan:xe,sandbox:wt,scope:null,scoped:Ue,seamless:Ue,selected:Ue,shadowRootClonable:Ue,shadowRootCustomElementRegistry:Ue,shadowRootDelegatesFocus:Ue,shadowRootMode:null,shadowRootSerializable:Ue,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:Ue,useMap:null,value:Vt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wt,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ue,declare:Ue,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:Ue,noHref:Ue,noShade:Ue,noWrap:Ue,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Vt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ue,disablePictureInPicture:Ue,disableRemotePlayback:Ue,exportParts:ml,part:wt,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:Fv}),U4=hs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:In,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:wt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:Ue,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ml,g2:ml,glyphName:ml,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:In,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:xe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:In,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:In,rev:In,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:In,requiredFeatures:In,requiredFonts:In,requiredFormats:In,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:In,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:In,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:In,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:qv}),Vv=hs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),Gv=hs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fv}),Kv=hs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),$4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},B4=/[A-Z]/g,ny=/-[a-z]/g,H4=/^data[-\w.:]+$/i;function P4(e,n){const r=km(n);let l=n,o=Cn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&H4.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(ny,F4);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!ny.test(u)){let d=u.replace(B4,q4);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=lh}return new o(l,n)}function q4(e){return"-"+e.toLowerCase()}function F4(e){return e.charAt(1).toUpperCase()}const V4=Hv([Pv,O4,Vv,Gv,Kv],"html"),sh=Hv([Pv,U4,Vv,Gv,Kv],"svg");function G4(e){return e.join(" ").trim()}var ns={},Ef,ay;function K4(){if(ay)return Ef;ay=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
66
|
+
`,h="/",g="*",v="",k="comment",w="declaration";function j(N,M){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];M=M||{};var O=1,R=1;function $(X){var F=X.match(n);F&&(O+=F.length);var D=X.lastIndexOf(m);R=~D?X.length-D:R+X.length}function H(){var X={line:O,column:R};return function(F){return F.position=new _(X),W(),F}}function _(X){this.start=X,this.end={line:O,column:R},this.source=M.source}_.prototype.content=N;function V(X){var F=new Error(M.source+":"+O+":"+R+": "+X);if(F.reason=X,F.filename=M.source,F.line=O,F.column=R,F.source=N,!M.silent)throw F}function G(X){var F=X.exec(N);if(F){var D=F[0];return $(D),N=N.slice(D.length),F}}function W(){G(r)}function z(X){var F;for(X=X||[];F=q();)F!==!1&&X.push(F);return X}function q(){var X=H();if(!(h!=N.charAt(0)||g!=N.charAt(1))){for(var F=2;v!=N.charAt(F)&&(g!=N.charAt(F)||h!=N.charAt(F+1));)++F;if(F+=2,v===N.charAt(F-1))return V("End of comment missing");var D=N.slice(2,F-2);return R+=2,$(D),N=N.slice(F),R+=2,X({type:k,comment:D})}}function A(){var X=H(),F=G(l);if(F){if(q(),!G(o))return V("property missing ':'");var D=G(u),te=X({type:w,property:C(F[0].replace(e,v)),value:D?C(D[0].replace(e,v)):v});return G(d),te}}function L(){var X=[];z(X);for(var F;F=A();)F!==!1&&(X.push(F),z(X));return X}return W(),L()}function C(N){return N?N.replace(f,v):v}return Ef=j,Ef}var ry;function W4(){if(ry)return ns;ry=1;var e=ns&&ns.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=r;const n=e(K4());function r(l,o){let u=null;if(!l||typeof l!="string")return u;const d=(0,n.default)(l),f=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:g}=m;f?o(h,g,m):g&&(u=u||{},u[h]=g)}),u}return ns}var ci={},ly;function Y4(){if(ly)return ci;ly=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||r.test(h)||e.test(h)},d=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},m=function(h,g){return g===void 0&&(g={}),u(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,f):h=h.replace(l,f),h.replace(n,d))};return ci.camelCase=m,ci}var ui,sy;function X4(){if(sy)return ui;sy=1;var e=ui&&ui.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(W4()),r=Y4();function l(o,u){var d={};return!o||typeof o!="string"||(0,n.default)(o,function(f,m){f&&m&&(d[(0,r.camelCase)(f,u)]=m)}),d}return l.default=l,ui=l,ui}var Q4=X4();const Z4=U1(Q4),Wv=Yv("end"),ih=Yv("start");function Yv(e){return n;function n(r){const l=r&&r.position&&r.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function J4(e){const n=ih(e),r=Wv(e);if(n&&r)return{start:n,end:r}}function Si(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?iy(e.position):"start"in e||"end"in e?iy(e):"line"in e||"column"in e?jm(e):""}function jm(e){return oy(e&&e.line)+":"+oy(e&&e.column)}function iy(e){return jm(e&&e.start)+"-"+jm(e&&e.end)}function oy(e){return e&&typeof e=="number"?e:1}class fn extends Error{constructor(n,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let o="",u={},d=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?o=n:!u.cause&&n&&(d=!0,o=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof l=="string"){const m=l.indexOf(":");m===-1?u.ruleId=l:(u.source=l.slice(0,m),u.ruleId=l.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=Si(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}fn.prototype.file="";fn.prototype.name="";fn.prototype.reason="";fn.prototype.message="";fn.prototype.stack="";fn.prototype.column=void 0;fn.prototype.line=void 0;fn.prototype.ancestors=void 0;fn.prototype.cause=void 0;fn.prototype.fatal=void 0;fn.prototype.place=void 0;fn.prototype.ruleId=void 0;fn.prototype.source=void 0;const oh={}.hasOwnProperty,eN=new Map,tN=/[A-Z]/g,nN=new Set(["table","tbody","thead","tfoot","tr"]),aN=new Set(["td","th"]),Xv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function rN(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let l;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=fN(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=dN(r,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?sh:V4,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Qv(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function Qv(e,n,r){if(n.type==="element")return lN(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return sN(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return oN(e,n,r);if(n.type==="mdxjsEsm")return iN(e,n);if(n.type==="root")return cN(e,n,r);if(n.type==="text")return uN(e,n)}function lN(e,n,r){const l=e.schema;let o=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=sh,e.schema=o),e.ancestors.push(n);const u=Jv(e,n.tagName,!1),d=mN(e,n);let f=uh(e,n);return nN.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!z4(m):!0})),Zv(e,d,u,n),ch(d,f),e.ancestors.pop(),e.schema=l,e.create(n,u,d,r)}function sN(e,n){if(n.data&&n.data.estree&&e.evaluater){const l=n.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}Ri(e,n.position)}function iN(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Ri(e,n.position)}function oN(e,n,r){const l=e.schema;let o=l;n.name==="svg"&&l.space==="html"&&(o=sh,e.schema=o),e.ancestors.push(n);const u=n.name===null?e.Fragment:Jv(e,n.name,!0),d=hN(e,n),f=uh(e,n);return Zv(e,d,u,n),ch(d,f),e.ancestors.pop(),e.schema=l,e.create(n,u,d,r)}function cN(e,n,r){const l={};return ch(l,uh(e,n)),e.create(n,e.Fragment,l,r)}function uN(e,n){return n.value}function Zv(e,n,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=l)}function ch(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function dN(e,n,r){return l;function l(o,u,d,f){const h=Array.isArray(d.children)?r:n;return f?h(u,d,f):h(u,d)}}function fN(e,n){return r;function r(l,o,u,d){const f=Array.isArray(u.children),m=ih(l);return n(o,u,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function mN(e,n){const r={};let l,o;for(o in n.properties)if(o!=="children"&&oh.call(n.properties,o)){const u=pN(e,o,n.properties[o]);if(u){const[d,f]=u;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&aN.has(n.tagName)?l=f:r[d]=f}}if(l){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function hN(e,n){const r={};for(const l of n.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const u=l.data.estree.body[0];u.type;const d=u.expression;d.type;const f=d.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else Ri(e,n.position);else{const o=l.name;let u;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const f=l.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else Ri(e,n.position);else u=l.value===null?!0:l.value;r[o]=u}return r}function uh(e,n){const r=[];let l=-1;const o=e.passKeys?new Map:eN;for(;++l<n.children.length;){const u=n.children[l];let d;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const h=o.get(m)||0;d=m+"-"+h,o.set(m,h+1)}}const f=Qv(e,u,d);f!==void 0&&r.push(f)}return r}function pN(e,n,r){const l=P4(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=l.commaSeparated?A4(r):G4(r)),l.property==="style"){let o=typeof r=="object"?r:gN(e,String(r));return e.stylePropertyNameCase==="css"&&(o=xN(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&l.space?$4[l.property]||l.property:l.attribute,r]}}function gN(e,n){try{return Z4(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,o=new fn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Xv+"#cannot-parse-style-attribute",o}}function Jv(e,n,r){let l;if(!r)l={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let u=-1,d;for(;++u<o.length;){const f=Jx(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}l=d}else l=Jx(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(l.type==="Literal"){const o=l.value;return oh.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(l);Ri(e)}function Ri(e,n){const r=new fn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Xv+"#cannot-handle-mdx-estrees-without-createevaluater",r}function xN(e){const n={};let r;for(r in e)oh.call(e,r)&&(n[yN(r)]=e[r]);return n}function yN(e){let n=e.replace(tN,vN);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function vN(e){return"-"+e.toLowerCase()}const Mf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},bN={};function dh(e,n){const r=bN,l=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return eb(e,l,o)}function eb(e,n,r){if(kN(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return cy(e.children,n,r)}return Array.isArray(e)?cy(e,n,r):""}function cy(e,n,r){const l=[];let o=-1;for(;++o<e.length;)l[o]=eb(e[o],n,r);return l.join("")}function kN(e){return!!(e&&typeof e=="object")}const uy=document.createElement("i");function fh(e){const n="&"+e+";";uy.innerHTML=n;const r=uy.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Un(e,n,r,l){const o=e.length;let u=0,d;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,r=r>0?r:0,l.length<1e4)d=Array.from(l),d.unshift(n,r),e.splice(...d);else for(r&&e.splice(n,r);u<l.length;)d=l.slice(u,u+1e4),d.unshift(n,0),e.splice(...d),u+=1e4,n+=1e4}function na(e,n){return e.length>0?(Un(e,e.length,0,n),e):n}const dy={}.hasOwnProperty;function tb(e){const n={};let r=-1;for(;++r<e.length;)wN(n,e[r]);return n}function wN(e,n){let r;for(r in n){const o=(dy.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let d;if(u)for(d in u){dy.call(o,d)||(o[d]=[]);const f=u[d];SN(o[d],Array.isArray(f)?f:f?[f]:[])}}}function SN(e,n){let r=-1;const l=[];for(;++r<n.length;)(n[r].add==="after"?e:l).push(n[r]);Un(e,0,0,l)}function nb(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function ha(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pn=$r(/[A-Za-z]/),dn=$r(/[\dA-Za-z]/),jN=$r(/[#-'*+\--9=?A-Z^-~]/);function zc(e){return e!==null&&(e<32||e===127)}const Nm=$r(/\d/),NN=$r(/[\dA-Fa-f]/),CN=$r(/[!-/:-@[-`{-~]/);function Re(e){return e!==null&&e<-2}function St(e){return e!==null&&(e<0||e===32)}function Ye(e){return e===-2||e===-1||e===32}const Xc=$r(new RegExp("\\p{P}|\\p{S}","u")),gl=$r(/\s/);function $r(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ps(e){const n=[];let r=-1,l=0,o=0;for(;++r<e.length;){const u=e.charCodeAt(r);let d="";if(u===37&&dn(e.charCodeAt(r+1))&&dn(e.charCodeAt(r+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(d=String.fromCharCode(u,f),o=1):d="�"}else d=String.fromCharCode(u);d&&(n.push(e.slice(l,r),encodeURIComponent(d)),l=r+o+1,d=""),o&&(r+=o,o=0)}return n.join("")+e.slice(l)}function at(e,n,r,l){const o=l?l-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(m){return Ye(m)?(e.enter(r),f(m)):n(m)}function f(m){return Ye(m)&&u++<o?(e.consume(m),f):(e.exit(r),n(m))}}const TN={tokenize:EN};function EN(e){const n=e.attempt(this.parser.constructs.contentInitial,l,o);let r;return n;function l(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),at(e,n,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,d(f)}function d(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Re(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),d)}}const MN={tokenize:AN},fy={tokenize:RN};function AN(e){const n=this,r=[];let l=0,o,u,d;return f;function f(R){if(l<r.length){const $=r[l];return n.containerState=$[1],e.attempt($[0].continuation,m,h)(R)}return h(R)}function m(R){if(l++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&O();const $=n.events.length;let H=$,_;for(;H--;)if(n.events[H][0]==="exit"&&n.events[H][1].type==="chunkFlow"){_=n.events[H][1].end;break}M(l);let V=$;for(;V<n.events.length;)n.events[V][1].end={..._},V++;return Un(n.events,H+1,0,n.events.slice($)),n.events.length=V,h(R)}return f(R)}function h(R){if(l===r.length){if(!o)return k(R);if(o.currentConstruct&&o.currentConstruct.concrete)return j(R);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(fy,g,v)(R)}function g(R){return o&&O(),M(l),k(R)}function v(R){return n.parser.lazy[n.now().line]=l!==r.length,d=n.now().offset,j(R)}function k(R){return n.containerState={},e.attempt(fy,w,j)(R)}function w(R){return l++,r.push([n.currentConstruct,n.containerState]),k(R)}function j(R){if(R===null){o&&O(),M(0),e.consume(R);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),C(R)}function C(R){if(R===null){N(e.exit("chunkFlow"),!0),M(0),e.consume(R);return}return Re(R)?(e.consume(R),N(e.exit("chunkFlow")),l=0,n.interrupt=void 0,f):(e.consume(R),C)}function N(R,$){const H=n.sliceStream(R);if($&&H.push(null),R.previous=u,u&&(u.next=R),u=R,o.defineSkip(R.start),o.write(H),n.parser.lazy[R.start.line]){let _=o.events.length;for(;_--;)if(o.events[_][1].start.offset<d&&(!o.events[_][1].end||o.events[_][1].end.offset>d))return;const V=n.events.length;let G=V,W,z;for(;G--;)if(n.events[G][0]==="exit"&&n.events[G][1].type==="chunkFlow"){if(W){z=n.events[G][1].end;break}W=!0}for(M(l),_=V;_<n.events.length;)n.events[_][1].end={...z},_++;Un(n.events,G+1,0,n.events.slice(V)),n.events.length=_}}function M(R){let $=r.length;for(;$-- >R;){const H=r[$];n.containerState=H[1],H[0].exit.call(n,e)}r.length=R}function O(){o.write([null]),u=void 0,o=void 0,n.containerState._closeFlow=void 0}}function RN(e,n,r){return at(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ds(e){if(e===null||St(e)||gl(e))return 1;if(Xc(e))return 2}function Qc(e,n,r){const l=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!l.includes(u)&&(n=u(n,r),l.push(u))}return n}const Cm={name:"attention",resolveAll:LN,tokenize:_N};function LN(e,n){let r=-1,l,o,u,d,f,m,h,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(l=r;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&n.sliceSerialize(e[l][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[l][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[l][1].end.offset-e[l][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const v={...e[l][1].end},k={...e[r][1].start};my(v,-m),my(k,m),d={type:m>1?"strongSequence":"emphasisSequence",start:v,end:{...e[l][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:k},u={type:m>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[l][1].end={...d.start},e[r][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=na(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=na(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",u,n]]),h=na(h,Qc(n.parser.constructs.insideSpan.null,e.slice(l+1,r),n)),h=na(h,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,h=na(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):g=0,Un(e,l-1,r-l+3,h),r=l+h.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function _N(e,n){const r=this.parser.constructs.attentionMarkers.null,l=this.previous,o=ds(l);let u;return d;function d(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const h=e.exit("attentionSequence"),g=ds(m),v=!g||g===2&&o||r.includes(m),k=!o||o===2&&g||r.includes(l);return h._open=!!(u===42?v:v&&(o||!k)),h._close=!!(u===42?k:k&&(g||!v)),n(m)}}function my(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const IN={name:"autolink",tokenize:zN};function zN(e,n,r){let l=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return pn(w)?(e.consume(w),d):w===64?r(w):h(w)}function d(w){return w===43||w===45||w===46||dn(w)?(l=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),l=0,m):(w===43||w===45||w===46||dn(w))&&l++<32?(e.consume(w),f):(l=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||zc(w)?r(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),g):jN(w)?(e.consume(w),h):r(w)}function g(w){return dn(w)?v(w):r(w)}function v(w){return w===46?(e.consume(w),l=0,g):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):k(w)}function k(w){if((w===45||dn(w))&&l++<63){const j=w===45?k:v;return e.consume(w),j}return r(w)}}const Hi={partial:!0,tokenize:DN};function DN(e,n,r){return l;function l(u){return Ye(u)?at(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||Re(u)?n(u):r(u)}}const ab={continuation:{tokenize:UN},exit:$N,name:"blockQuote",tokenize:ON};function ON(e,n,r){const l=this;return o;function o(d){if(d===62){const f=l.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return r(d)}function u(d){return Ye(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function UN(e,n,r){const l=this;return o;function o(d){return Ye(d)?at(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(ab,n,r)(d)}}function $N(e){e.exit("blockQuote")}const rb={name:"characterEscape",tokenize:BN};function BN(e,n,r){return l;function l(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return CN(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const lb={name:"characterReference",tokenize:HN};function HN(e,n,r){const l=this;let o=0,u,d;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),m}function m(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),u=31,d=dn,g(v))}function h(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=NN,g):(e.enter("characterReferenceValue"),u=7,d=Nm,g(v))}function g(v){if(v===59&&o){const k=e.exit("characterReferenceValue");return d===dn&&!fh(l.sliceSerialize(k))?r(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(v)&&o++<u?(e.consume(v),g):r(v)}}const hy={partial:!0,tokenize:qN},py={concrete:!0,name:"codeFenced",tokenize:PN};function PN(e,n,r){const l=this,o={partial:!0,tokenize:H};let u=0,d=0,f;return m;function m(_){return h(_)}function h(_){const V=l.events[l.events.length-1];return u=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,f=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(_)}function g(_){return _===f?(d++,e.consume(_),g):d<3?r(_):(e.exit("codeFencedFenceSequence"),Ye(_)?at(e,v,"whitespace")(_):v(_))}function v(_){return _===null||Re(_)?(e.exit("codeFencedFence"),l.interrupt?n(_):e.check(hy,C,$)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),k(_))}function k(_){return _===null||Re(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(_)):Ye(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),at(e,w,"whitespace")(_)):_===96&&_===f?r(_):(e.consume(_),k)}function w(_){return _===null||Re(_)?v(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(_))}function j(_){return _===null||Re(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(_)):_===96&&_===f?r(_):(e.consume(_),j)}function C(_){return e.attempt(o,$,N)(_)}function N(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return u>0&&Ye(_)?at(e,O,"linePrefix",u+1)(_):O(_)}function O(_){return _===null||Re(_)?e.check(hy,C,$)(_):(e.enter("codeFlowValue"),R(_))}function R(_){return _===null||Re(_)?(e.exit("codeFlowValue"),O(_)):(e.consume(_),R)}function $(_){return e.exit("codeFenced"),n(_)}function H(_,V,G){let W=0;return z;function z(F){return _.enter("lineEnding"),_.consume(F),_.exit("lineEnding"),q}function q(F){return _.enter("codeFencedFence"),Ye(F)?at(_,A,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):A(F)}function A(F){return F===f?(_.enter("codeFencedFenceSequence"),L(F)):G(F)}function L(F){return F===f?(W++,_.consume(F),L):W>=d?(_.exit("codeFencedFenceSequence"),Ye(F)?at(_,X,"whitespace")(F):X(F)):G(F)}function X(F){return F===null||Re(F)?(_.exit("codeFencedFence"),V(F)):G(F)}}}function qN(e,n,r){const l=this;return o;function o(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return l.parser.lazy[l.now().line]?r(d):n(d)}}const Af={name:"codeIndented",tokenize:VN},FN={partial:!0,tokenize:GN};function VN(e,n,r){const l=this;return o;function o(h){return e.enter("codeIndented"),at(e,u,"linePrefix",5)(h)}function u(h){const g=l.events[l.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(h):r(h)}function d(h){return h===null?m(h):Re(h)?e.attempt(FN,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Re(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),n(h)}}function GN(e,n,r){const l=this;return o;function o(d){return l.parser.lazy[l.now().line]?r(d):Re(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):at(e,u,"linePrefix",5)(d)}function u(d){const f=l.events[l.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):Re(d)?o(d):r(d)}}const KN={name:"codeText",previous:YN,resolve:WN,tokenize:XN};function WN(e){let n=e.length-4,r=3,l,o;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=r;++l<n;)if(e[l][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(l=r-1,n++;++l<=n;)o===void 0?l!==n&&e[l][1].type!=="lineEnding"&&(o=l):(l===n||e[l][1].type==="lineEnding")&&(e[o][1].type="codeTextData",l!==o+2&&(e[o][1].end=e[l-1][1].end,e.splice(o+2,l-o-2),n-=l-o-2,l=o+2),o=void 0);return e}function YN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function XN(e,n,r){let l=0,o,u;return d;function d(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),l++,f):(e.exit("codeTextSequence"),m(v))}function m(v){return v===null?r(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),m):v===96?(u=e.enter("codeTextSequence"),o=0,g(v)):Re(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(v))}function h(v){return v===null||v===32||v===96||Re(v)?(e.exit("codeTextData"),m(v)):(e.consume(v),h)}function g(v){return v===96?(e.consume(v),o++,g):o===l?(e.exit("codeTextSequence"),e.exit("codeText"),n(v)):(u.type="codeTextData",h(v))}}class QN{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const l=r??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(n,l):n>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(n,r,l){const o=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&di(this.left,l),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),di(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),di(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);di(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);di(this.left,r.reverse())}}}function di(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function sb(e){const n={};let r=-1,l,o,u,d,f,m,h;const g=new QN(e);for(;++r<g.length;){for(;r in n;)r=n[r];if(l=g.get(r),r&&l[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(m=l[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(n,ZN(g,r)),r=n[r],h=!0);else if(l[1]._container){for(u=r,o=void 0;u--;)if(d=g.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(l[1].end={...g.get(o)[1].start},f=g.slice(o,r),f.unshift(l),g.splice(o,r-o+1,f))}}return Un(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function ZN(e,n){const r=e.get(n)[1],l=e.get(n)[2];let o=n-1;const u=[];let d=r._tokenizer;d||(d=l.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let g,v,k=-1,w=r,j=0,C=0;const N=[C];for(;w;){for(;e.get(++o)[1]!==w;);u.push(o),w._tokenizer||(g=l.sliceStream(w),w.next||g.push(null),v&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),v=w,w=w.next}for(w=r;++k<f.length;)f[k][0]==="exit"&&f[k-1][0]==="enter"&&f[k][1].type===f[k-1][1].type&&f[k][1].start.line!==f[k][1].end.line&&(C=k+1,N.push(C),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(d.events=[],w?(w._tokenizer=void 0,w.previous=void 0):N.pop(),k=N.length;k--;){const M=f.slice(N[k],N[k+1]),O=u.pop();m.push([O,O+M.length-1]),e.splice(O,2,M)}for(m.reverse(),k=-1;++k<m.length;)h[j+m[k][0]]=j+m[k][1],j+=m[k][1]-m[k][0]-1;return h}const JN={resolve:tC,tokenize:nC},eC={partial:!0,tokenize:aC};function tC(e){return sb(e),e}function nC(e,n){let r;return l;function l(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):Re(f)?e.check(eC,d,u)(f):(e.consume(f),o)}function u(f){return e.exit("chunkContent"),e.exit("content"),n(f)}function d(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,o}}function aC(e,n,r){const l=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),at(e,u,"linePrefix")}function u(d){if(d===null||Re(d))return r(d);const f=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):e.interrupt(l.parser.constructs.flow,r,n)(d)}}function ib(e,n,r,l,o,u,d,f,m){const h=m||Number.POSITIVE_INFINITY;let g=0;return v;function v(M){return M===60?(e.enter(l),e.enter(o),e.enter(u),e.consume(M),e.exit(u),k):M===null||M===32||M===41||zc(M)?r(M):(e.enter(l),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(M))}function k(M){return M===62?(e.enter(u),e.consume(M),e.exit(u),e.exit(o),e.exit(l),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(M))}function w(M){return M===62?(e.exit("chunkString"),e.exit(f),k(M)):M===null||M===60||Re(M)?r(M):(e.consume(M),M===92?j:w)}function j(M){return M===60||M===62||M===92?(e.consume(M),w):w(M)}function C(M){return!g&&(M===null||M===41||St(M))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(l),n(M)):g<h&&M===40?(e.consume(M),g++,C):M===41?(e.consume(M),g--,C):M===null||M===32||M===40||zc(M)?r(M):(e.consume(M),M===92?N:C)}function N(M){return M===40||M===41||M===92?(e.consume(M),C):C(M)}}function ob(e,n,r,l,o,u){const d=this;let f=0,m;return h;function h(w){return e.enter(l),e.enter(o),e.consume(w),e.exit(o),e.enter(u),g}function g(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?r(w):w===93?(e.exit(u),e.enter(o),e.consume(w),e.exit(o),e.exit(l),n):Re(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(w))}function v(w){return w===null||w===91||w===93||Re(w)||f++>999?(e.exit("chunkString"),g(w)):(e.consume(w),m||(m=!Ye(w)),w===92?k:v)}function k(w){return w===91||w===92||w===93?(e.consume(w),f++,v):v(w)}}function cb(e,n,r,l,o,u){let d;return f;function f(k){return k===34||k===39||k===40?(e.enter(l),e.enter(o),e.consume(k),e.exit(o),d=k===40?41:k,m):r(k)}function m(k){return k===d?(e.enter(o),e.consume(k),e.exit(o),e.exit(l),n):(e.enter(u),h(k))}function h(k){return k===d?(e.exit(u),m(d)):k===null?r(k):Re(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),at(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===d||k===null||Re(k)?(e.exit("chunkString"),h(k)):(e.consume(k),k===92?v:g)}function v(k){return k===d||k===92?(e.consume(k),g):g(k)}}function ji(e,n){let r;return l;function l(o){return Re(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,l):Ye(o)?at(e,l,r?"linePrefix":"lineSuffix")(o):n(o)}}const rC={name:"definition",tokenize:sC},lC={partial:!0,tokenize:iC};function sC(e,n,r){const l=this;let o;return u;function u(w){return e.enter("definition"),d(w)}function d(w){return ob.call(l,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return o=ha(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return St(w)?ji(e,h)(w):h(w)}function h(w){return ib(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(lC,v,v)(w)}function v(w){return Ye(w)?at(e,k,"whitespace")(w):k(w)}function k(w){return w===null||Re(w)?(e.exit("definition"),l.parser.defined.push(o),n(w)):r(w)}}function iC(e,n,r){return l;function l(f){return St(f)?ji(e,o)(f):r(f)}function o(f){return cb(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Ye(f)?at(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Re(f)?n(f):r(f)}}const oC={name:"hardBreakEscape",tokenize:cC};function cC(e,n,r){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return Re(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const uC={name:"headingAtx",resolve:dC,tokenize:fC};function dC(e,n){let r=e.length-2,l=3,o,u;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(o={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},u={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},Un(e,l,r-l+1,[["enter",o,n],["enter",u,n],["exit",u,n],["exit",o,n]])),e}function fC(e,n,r){let l=0;return o;function o(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&l++<6?(e.consume(g),d):g===null||St(g)?(e.exit("atxHeadingSequence"),f(g)):r(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),m(g)):g===null||Re(g)?(e.exit("atxHeading"),n(g)):Ye(g)?at(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function m(g){return g===35?(e.consume(g),m):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||St(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const mC=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],gy=["pre","script","style","textarea"],hC={concrete:!0,name:"htmlFlow",resolveTo:xC,tokenize:yC},pC={partial:!0,tokenize:bC},gC={partial:!0,tokenize:vC};function xC(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function yC(e,n,r){const l=this;let o,u,d,f,m;return h;function h(T){return g(T)}function g(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),v}function v(T){return T===33?(e.consume(T),k):T===47?(e.consume(T),u=!0,C):T===63?(e.consume(T),o=3,l.interrupt?n:U):pn(T)?(e.consume(T),d=String.fromCharCode(T),N):r(T)}function k(T){return T===45?(e.consume(T),o=2,w):T===91?(e.consume(T),o=5,f=0,j):pn(T)?(e.consume(T),o=4,l.interrupt?n:U):r(T)}function w(T){return T===45?(e.consume(T),l.interrupt?n:U):r(T)}function j(T){const re="CDATA[";return T===re.charCodeAt(f++)?(e.consume(T),f===re.length?l.interrupt?n:A:j):r(T)}function C(T){return pn(T)?(e.consume(T),d=String.fromCharCode(T),N):r(T)}function N(T){if(T===null||T===47||T===62||St(T)){const re=T===47,de=d.toLowerCase();return!re&&!u&&gy.includes(de)?(o=1,l.interrupt?n(T):A(T)):mC.includes(d.toLowerCase())?(o=6,re?(e.consume(T),M):l.interrupt?n(T):A(T)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(T):u?O(T):R(T))}return T===45||dn(T)?(e.consume(T),d+=String.fromCharCode(T),N):r(T)}function M(T){return T===62?(e.consume(T),l.interrupt?n:A):r(T)}function O(T){return Ye(T)?(e.consume(T),O):z(T)}function R(T){return T===47?(e.consume(T),z):T===58||T===95||pn(T)?(e.consume(T),$):Ye(T)?(e.consume(T),R):z(T)}function $(T){return T===45||T===46||T===58||T===95||dn(T)?(e.consume(T),$):H(T)}function H(T){return T===61?(e.consume(T),_):Ye(T)?(e.consume(T),H):R(T)}function _(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(e.consume(T),m=T,V):Ye(T)?(e.consume(T),_):G(T)}function V(T){return T===m?(e.consume(T),m=null,W):T===null||Re(T)?r(T):(e.consume(T),V)}function G(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||St(T)?H(T):(e.consume(T),G)}function W(T){return T===47||T===62||Ye(T)?R(T):r(T)}function z(T){return T===62?(e.consume(T),q):r(T)}function q(T){return T===null||Re(T)?A(T):Ye(T)?(e.consume(T),q):r(T)}function A(T){return T===45&&o===2?(e.consume(T),D):T===60&&o===1?(e.consume(T),te):T===62&&o===4?(e.consume(T),I):T===63&&o===3?(e.consume(T),U):T===93&&o===5?(e.consume(T),we):Re(T)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(pC,B,L)(T)):T===null||Re(T)?(e.exit("htmlFlowData"),L(T)):(e.consume(T),A)}function L(T){return e.check(gC,X,B)(T)}function X(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),F}function F(T){return T===null||Re(T)?L(T):(e.enter("htmlFlowData"),A(T))}function D(T){return T===45?(e.consume(T),U):A(T)}function te(T){return T===47?(e.consume(T),d="",ee):A(T)}function ee(T){if(T===62){const re=d.toLowerCase();return gy.includes(re)?(e.consume(T),I):A(T)}return pn(T)&&d.length<8?(e.consume(T),d+=String.fromCharCode(T),ee):A(T)}function we(T){return T===93?(e.consume(T),U):A(T)}function U(T){return T===62?(e.consume(T),I):T===45&&o===2?(e.consume(T),U):A(T)}function I(T){return T===null||Re(T)?(e.exit("htmlFlowData"),B(T)):(e.consume(T),I)}function B(T){return e.exit("htmlFlow"),n(T)}}function vC(e,n,r){const l=this;return o;function o(d){return Re(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):r(d)}function u(d){return l.parser.lazy[l.now().line]?r(d):n(d)}}function bC(e,n,r){return l;function l(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Hi,n,r)}}const kC={name:"htmlText",tokenize:wC};function wC(e,n,r){const l=this;let o,u,d;return f;function f(U){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(U),m}function m(U){return U===33?(e.consume(U),h):U===47?(e.consume(U),H):U===63?(e.consume(U),R):pn(U)?(e.consume(U),G):r(U)}function h(U){return U===45?(e.consume(U),g):U===91?(e.consume(U),u=0,j):pn(U)?(e.consume(U),O):r(U)}function g(U){return U===45?(e.consume(U),w):r(U)}function v(U){return U===null?r(U):U===45?(e.consume(U),k):Re(U)?(d=v,te(U)):(e.consume(U),v)}function k(U){return U===45?(e.consume(U),w):v(U)}function w(U){return U===62?D(U):U===45?k(U):v(U)}function j(U){const I="CDATA[";return U===I.charCodeAt(u++)?(e.consume(U),u===I.length?C:j):r(U)}function C(U){return U===null?r(U):U===93?(e.consume(U),N):Re(U)?(d=C,te(U)):(e.consume(U),C)}function N(U){return U===93?(e.consume(U),M):C(U)}function M(U){return U===62?D(U):U===93?(e.consume(U),M):C(U)}function O(U){return U===null||U===62?D(U):Re(U)?(d=O,te(U)):(e.consume(U),O)}function R(U){return U===null?r(U):U===63?(e.consume(U),$):Re(U)?(d=R,te(U)):(e.consume(U),R)}function $(U){return U===62?D(U):R(U)}function H(U){return pn(U)?(e.consume(U),_):r(U)}function _(U){return U===45||dn(U)?(e.consume(U),_):V(U)}function V(U){return Re(U)?(d=V,te(U)):Ye(U)?(e.consume(U),V):D(U)}function G(U){return U===45||dn(U)?(e.consume(U),G):U===47||U===62||St(U)?W(U):r(U)}function W(U){return U===47?(e.consume(U),D):U===58||U===95||pn(U)?(e.consume(U),z):Re(U)?(d=W,te(U)):Ye(U)?(e.consume(U),W):D(U)}function z(U){return U===45||U===46||U===58||U===95||dn(U)?(e.consume(U),z):q(U)}function q(U){return U===61?(e.consume(U),A):Re(U)?(d=q,te(U)):Ye(U)?(e.consume(U),q):W(U)}function A(U){return U===null||U===60||U===61||U===62||U===96?r(U):U===34||U===39?(e.consume(U),o=U,L):Re(U)?(d=A,te(U)):Ye(U)?(e.consume(U),A):(e.consume(U),X)}function L(U){return U===o?(e.consume(U),o=void 0,F):U===null?r(U):Re(U)?(d=L,te(U)):(e.consume(U),L)}function X(U){return U===null||U===34||U===39||U===60||U===61||U===96?r(U):U===47||U===62||St(U)?W(U):(e.consume(U),X)}function F(U){return U===47||U===62||St(U)?W(U):r(U)}function D(U){return U===62?(e.consume(U),e.exit("htmlTextData"),e.exit("htmlText"),n):r(U)}function te(U){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),ee}function ee(U){return Ye(U)?at(e,we,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):we(U)}function we(U){return e.enter("htmlTextData"),d(U)}}const mh={name:"labelEnd",resolveAll:CC,resolveTo:TC,tokenize:EC},SC={tokenize:MC},jC={tokenize:AC},NC={tokenize:RC};function CC(e){let n=-1;const r=[];for(;++n<e.length;){const l=e[n][1];if(r.push(e[n]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const o=l.type==="labelImage"?4:2;l.type="data",n+=o}}return e.length!==r.length&&Un(e,0,e.length,r),e}function TC(e,n){let r=e.length,l=0,o,u,d,f;for(;r--;)if(o=e[r][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[r][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[r][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=r,o.type!=="labelLink")){l=2;break}}else o.type==="labelEnd"&&(d=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[u][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[u+l+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=na(f,e.slice(u+1,u+l+3)),f=na(f,[["enter",g,n]]),f=na(f,Qc(n.parser.constructs.insideSpan.null,e.slice(u+l+4,d-3),n)),f=na(f,[["exit",g,n],e[d-2],e[d-1],["exit",h,n]]),f=na(f,e.slice(d+1)),f=na(f,[["exit",m,n]]),Un(e,u,e.length,f),e}function EC(e,n,r){const l=this;let o=l.events.length,u,d;for(;o--;)if((l.events[o][1].type==="labelImage"||l.events[o][1].type==="labelLink")&&!l.events[o][1]._balanced){u=l.events[o][1];break}return f;function f(k){return u?u._inactive?v(k):(d=l.parser.defined.includes(ha(l.sliceSerialize({start:u.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(k),e.exit("labelMarker"),e.exit("labelEnd"),m):r(k)}function m(k){return k===40?e.attempt(SC,g,d?g:v)(k):k===91?e.attempt(jC,g,d?h:v)(k):d?g(k):v(k)}function h(k){return e.attempt(NC,g,v)(k)}function g(k){return n(k)}function v(k){return u._balanced=!0,r(k)}}function MC(e,n,r){return l;function l(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),o}function o(v){return St(v)?ji(e,u)(v):u(v)}function u(v){return v===41?g(v):ib(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function d(v){return St(v)?ji(e,m)(v):g(v)}function f(v){return r(v)}function m(v){return v===34||v===39||v===40?cb(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function h(v){return St(v)?ji(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),n):r(v)}}function AC(e,n,r){const l=this;return o;function o(f){return ob.call(l,e,u,d,"reference","referenceMarker","referenceString")(f)}function u(f){return l.parser.defined.includes(ha(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function d(f){return r(f)}}function RC(e,n,r){return l;function l(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):r(u)}}const LC={name:"labelStartImage",resolveAll:mh.resolveAll,tokenize:_C};function _C(e,n,r){const l=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),d):r(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(f):n(f)}}const IC={name:"labelStartLink",resolveAll:mh.resolveAll,tokenize:zC};function zC(e,n,r){const l=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(d):n(d)}}const Rf={name:"lineEnding",tokenize:DC};function DC(e,n){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),at(e,n,"linePrefix")}}const Tc={name:"thematicBreak",tokenize:OC};function OC(e,n,r){let l=0,o;return u;function u(h){return e.enter("thematicBreak"),d(h)}function d(h){return o=h,f(h)}function f(h){return h===o?(e.enter("thematicBreakSequence"),m(h)):l>=3&&(h===null||Re(h))?(e.exit("thematicBreak"),n(h)):r(h)}function m(h){return h===o?(e.consume(h),l++,m):(e.exit("thematicBreakSequence"),Ye(h)?at(e,f,"whitespace")(h):f(h))}}const Sn={continuation:{tokenize:HC},exit:qC,name:"list",tokenize:BC},UC={partial:!0,tokenize:FC},$C={partial:!0,tokenize:PC};function BC(e,n,r){const l=this,o=l.events[l.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return f;function f(w){const j=l.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!l.containerState.marker||w===l.containerState.marker:Nm(w)){if(l.containerState.type||(l.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Tc,r,h)(w):h(w);if(!l.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return Nm(w)&&++d<10?(e.consume(w),m):(!l.interrupt||d<2)&&(l.containerState.marker?w===l.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):r(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||w,e.check(Hi,l.interrupt?r:g,e.attempt(UC,k,v))}function g(w){return l.containerState.initialBlankLine=!0,u++,k(w)}function v(w){return Ye(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),k):r(w)}function k(w){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function HC(e,n,r){const l=this;return l.containerState._closeFlow=void 0,e.check(Hi,o,u);function o(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,at(e,n,"listItemIndent",l.containerState.size+1)(f)}function u(f){return l.containerState.furtherBlankLines||!Ye(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,d(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt($C,n,d)(f))}function d(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,at(e,e.attempt(Sn,n,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function PC(e,n,r){const l=this;return at(e,o,"listItemIndent",l.containerState.size+1);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===l.containerState.size?n(u):r(u)}}function qC(e){e.exit(this.containerState.type)}function FC(e,n,r){const l=this;return at(e,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const d=l.events[l.events.length-1];return!Ye(u)&&d&&d[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const xy={name:"setextUnderline",resolveTo:VC,tokenize:GC};function VC(e,n){let r=e.length,l,o,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const d={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",d,n]),e.splice(u+1,0,["exit",e[l][1],n]),e[l][1].end={...e[u][1].end}):e[l][1]=d,e.push(["exit",d,n]),e}function GC(e,n,r){const l=this;let o;return u;function u(h){let g=l.events.length,v;for(;g--;)if(l.events[g][1].type!=="lineEnding"&&l.events[g][1].type!=="linePrefix"&&l.events[g][1].type!=="content"){v=l.events[g][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||v)?(e.enter("setextHeadingLine"),o=h,d(h)):r(h)}function d(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Ye(h)?at(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Re(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const KC={tokenize:WC};function WC(e){const n=this,r=e.attempt(Hi,l,e.attempt(this.parser.constructs.flowInitial,o,at(e,e.attempt(this.parser.constructs.flow,o,e.attempt(JN,o)),"linePrefix")));return r;function l(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const YC={resolveAll:db()},XC=ub("string"),QC=ub("text");function ub(e){return{resolveAll:db(e==="text"?ZC:void 0),tokenize:n};function n(r){const l=this,o=this.parser.constructs[e],u=r.attempt(o,d,f);return d;function d(g){return h(g)?u(g):f(g)}function f(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),m}function m(g){return h(g)?(r.exit("data"),u(g)):(r.consume(g),m)}function h(g){if(g===null)return!0;const v=o[g];let k=-1;if(v)for(;++k<v.length;){const w=v[k];if(!w.previous||w.previous.call(l,l.previous))return!0}return!1}}}function db(e){return n;function n(r,l){let o=-1,u;for(;++o<=r.length;)u===void 0?r[o]&&r[o][1].type==="data"&&(u=o,o++):(!r[o]||r[o][1].type!=="data")&&(o!==u+2&&(r[u][1].end=r[o-1][1].end,r.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(r,l):r}}function ZC(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const l=e[r-1][1],o=n.sliceStream(l);let u=o.length,d=-1,f=0,m;for(;u--;){const h=o[u];if(typeof h=="string"){for(d=h.length;h.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-1}else if(h===-2)m=!0,f++;else if(h!==-1){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const h={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:l.start._bufferIndex+d,_index:l.start._index+u,line:l.end.line,column:l.end.column-f,offset:l.end.offset-f},end:{...l.end}};l.end={...h.start},l.start.offset===l.end.offset?Object.assign(l,h):(e.splice(r,0,["enter",h,n],["exit",h,n]),r+=2)}r++}return e}const JC={42:Sn,43:Sn,45:Sn,48:Sn,49:Sn,50:Sn,51:Sn,52:Sn,53:Sn,54:Sn,55:Sn,56:Sn,57:Sn,62:ab},e3={91:rC},t3={[-2]:Af,[-1]:Af,32:Af},n3={35:uC,42:Tc,45:[xy,Tc],60:hC,61:xy,95:Tc,96:py,126:py},a3={38:lb,92:rb},r3={[-5]:Rf,[-4]:Rf,[-3]:Rf,33:LC,38:lb,42:Cm,60:[IN,kC],91:IC,92:[oC,rb],93:mh,95:Cm,96:KN},l3={null:[Cm,YC]},s3={null:[42,95]},i3={null:[]},o3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:s3,contentInitial:e3,disable:i3,document:JC,flow:n3,flowInitial:t3,insideSpan:l3,string:a3,text:r3},Symbol.toStringTag,{value:"Module"}));function c3(e,n,r){let l={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const o={},u=[];let d=[],f=[];const m={attempt:V(H),check:V(_),consume:O,enter:R,exit:$,interrupt:V(_,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:j,parser:e,previous:null,sliceSerialize:k,sliceStream:w,write:v};let g=n.tokenize.call(h,m);return n.resolveAll&&u.push(n),h;function v(q){return d=na(d,q),N(),d[d.length-1]!==null?[]:(G(n,0),h.events=Qc(u,h.events,h),h.events)}function k(q,A){return d3(w(q),A)}function w(q){return u3(d,q)}function j(){const{_bufferIndex:q,_index:A,line:L,column:X,offset:F}=l;return{_bufferIndex:q,_index:A,line:L,column:X,offset:F}}function C(q){o[q.line]=q.column,z()}function N(){let q;for(;l._index<d.length;){const A=d[l._index];if(typeof A=="string")for(q=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===q&&l._bufferIndex<A.length;)M(A.charCodeAt(l._bufferIndex));else M(A)}}function M(q){g=g(q)}function O(q){Re(q)?(l.line++,l.column=1,l.offset+=q===-3?2:1,z()):q!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===d[l._index].length&&(l._bufferIndex=-1,l._index++)),h.previous=q}function R(q,A){const L=A||{};return L.type=q,L.start=j(),h.events.push(["enter",L,h]),f.push(L),L}function $(q){const A=f.pop();return A.end=j(),h.events.push(["exit",A,h]),A}function H(q,A){G(q,A.from)}function _(q,A){A.restore()}function V(q,A){return L;function L(X,F,D){let te,ee,we,U;return Array.isArray(X)?B(X):"tokenize"in X?B([X]):I(X);function I(fe){return he;function he(Ce){const ne=Ce!==null&&fe[Ce],me=Ce!==null&&fe.null,be=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(me)?me:me?[me]:[]];return B(be)(Ce)}}function B(fe){return te=fe,ee=0,fe.length===0?D:T(fe[ee])}function T(fe){return he;function he(Ce){return U=W(),we=fe,fe.partial||(h.currentConstruct=fe),fe.name&&h.parser.constructs.disable.null.includes(fe.name)?de():fe.tokenize.call(A?Object.assign(Object.create(h),A):h,m,re,de)(Ce)}}function re(fe){return q(we,U),F}function de(fe){return U.restore(),++ee<te.length?T(te[ee]):D}}}function G(q,A){q.resolveAll&&!u.includes(q)&&u.push(q),q.resolve&&Un(h.events,A,h.events.length-A,q.resolve(h.events.slice(A),h)),q.resolveTo&&(h.events=q.resolveTo(h.events,h))}function W(){const q=j(),A=h.previous,L=h.currentConstruct,X=h.events.length,F=Array.from(f);return{from:X,restore:D};function D(){l=q,h.previous=A,h.currentConstruct=L,h.events.length=X,f=F,z()}}function z(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function u3(e,n){const r=n.start._index,l=n.start._bufferIndex,o=n.end._index,u=n.end._bufferIndex;let d;if(r===o)d=[e[r].slice(l,u)];else{if(d=e.slice(r,o),l>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(l):d.shift()}u>0&&d.push(e[o].slice(0,u))}return d}function d3(e,n){let r=-1;const l=[];let o;for(;++r<e.length;){const u=e[r];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
67
|
+
`;break}case-3:{d=`\r
|
|
68
|
+
`;break}case-2:{d=n?" ":" ";break}case-1:{if(!n&&o)continue;d=" ";break}default:d=String.fromCharCode(u)}o=u===-2,l.push(d)}return l.join("")}function f3(e){const l={constructs:tb([o3,...(e||{}).extensions||[]]),content:o(TN),defined:[],document:o(MN),flow:o(KC),lazy:{},string:o(XC),text:o(QC)};return l;function o(u){return d;function d(f){return c3(l,u,f)}}}function m3(e){for(;!sb(e););return e}const yy=/[\0\t\n\r]/g;function h3(){let e=1,n="",r=!0,l;return o;function o(u,d,f){const m=[];let h,g,v,k,w;for(u=n+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),v=0,n="",r&&(u.charCodeAt(0)===65279&&v++,r=void 0);v<u.length;){if(yy.lastIndex=v,h=yy.exec(u),k=h&&h.index!==void 0?h.index:u.length,w=u.charCodeAt(k),!h){n=u.slice(v);break}if(w===10&&v===k&&l)m.push(-3),l=void 0;else switch(l&&(m.push(-5),l=void 0),v<k&&(m.push(u.slice(v,k)),e+=k-v),w){case 0:{m.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,m.push(-2);e++<g;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:l=!0,e=1}v=k+1}return f&&(l&&m.push(-5),n&&m.push(n),m.push(null)),m}}const p3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function g3(e){return e.replace(p3,x3)}function x3(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),u=o===120||o===88;return nb(r.slice(u?2:1),u?16:10)}return fh(r)||e}const fb={}.hasOwnProperty;function y3(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),v3(r)(m3(f3(r).document().write(h3()(e,n,!0))))}function v3(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:W,autolinkEmail:W,atxHeading:u(Lt),blockQuote:u(me),characterEscape:W,characterReference:W,codeFenced:u(be),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(be,d),codeText:u(De,d),codeTextData:W,data:W,codeFlowValue:W,definition:u(Fe),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(Ie),hardBreakEscape:u(Kt),hardBreakTrailing:u(Kt),htmlFlow:u(_t,d),htmlFlowData:W,htmlText:u(_t,d),htmlTextData:W,image:u(Pn),label:d,link:u(je),listItem:u(rt),listItemValue:k,listOrdered:u($e,v),listUnordered:u($e),paragraph:u(pt),reference:T,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(Lt),strong:u($t),thematicBreak:u(on)},exit:{atxHeading:m(),atxHeadingSequence:H,autolink:m(),autolinkEmail:ne,autolinkProtocol:Ce,blockQuote:m(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:fe,characterReference:he,codeFenced:m(N),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:j,codeFlowValue:z,codeIndented:m(M),codeText:m(F),codeTextData:z,data:z,definition:m(),definitionDestinationString:$,definitionLabelString:O,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(A),hardBreakTrailing:m(A),htmlFlow:m(L),htmlFlowData:z,htmlText:m(X),htmlTextData:z,image:m(te),label:we,labelText:ee,lineEnding:q,link:m(D),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:re,resourceDestinationString:U,resourceTitleString:I,resource:B,setextHeading:m(G),setextHeadingLineSequence:V,setextHeadingText:_,strong:m(),thematicBreak:m()}};mb(n,(e||{}).mdastExtensions||[]);const r={};return l;function l(le){let pe={type:"root",children:[]};const Ee={stack:[pe],tokenStack:[],config:n,enter:f,exit:h,buffer:d,resume:g,data:r},ge=[];let ve=-1;for(;++ve<le.length;)if(le[ve][1].type==="listOrdered"||le[ve][1].type==="listUnordered")if(le[ve][0]==="enter")ge.push(ve);else{const Xe=ge.pop();ve=o(le,Xe,ve)}for(ve=-1;++ve<le.length;){const Xe=n[le[ve][0]];fb.call(Xe,le[ve][1].type)&&Xe[le[ve][1].type].call(Object.assign({sliceSerialize:le[ve][2].sliceSerialize},Ee),le[ve][1])}if(Ee.tokenStack.length>0){const Xe=Ee.tokenStack[Ee.tokenStack.length-1];(Xe[1]||vy).call(Ee,void 0,Xe[0])}for(pe.position={start:Rr(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Rr(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ve=-1;++ve<n.transforms.length;)pe=n.transforms[ve](pe)||pe;return pe}function o(le,pe,Ee){let ge=pe-1,ve=-1,Xe=!1,lt,Ve,et,ot;for(;++ge<=Ee;){const tt=le[ge];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?ve++:ve--,ot=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(lt&&!ot&&!ve&&!et&&(et=ge),ot=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ot=void 0}if(!ve&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||ve===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(lt){let en=ge;for(Ve=void 0;en--;){const mn=le[en];if(mn[1].type==="lineEnding"||mn[1].type==="lineEndingBlank"){if(mn[0]==="exit")continue;Ve&&(le[Ve][1].type="lineEndingBlank",Xe=!0),mn[1].type="lineEnding",Ve=en}else if(!(mn[1].type==="linePrefix"||mn[1].type==="blockQuotePrefix"||mn[1].type==="blockQuotePrefixWhitespace"||mn[1].type==="blockQuoteMarker"||mn[1].type==="listItemIndent"))break}et&&(!Ve||et<Ve)&&(lt._spread=!0),lt.end=Object.assign({},Ve?le[Ve][1].start:tt[1].end),le.splice(Ve||ge,0,["exit",lt,tt[2]]),ge++,Ee++}if(tt[1].type==="listItemPrefix"){const en={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};lt=en,le.splice(ge,0,["enter",en,tt[2]]),ge++,Ee++,et=void 0,ot=!0}}}return le[pe][1]._spread=Xe,Ee}function u(le,pe){return Ee;function Ee(ge){f.call(this,le(ge),ge),pe&&pe.call(this,ge)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(le,pe,Ee){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([pe,Ee||void 0]),le.position={start:Rr(pe.start),end:void 0}}function m(le){return pe;function pe(Ee){le&&le.call(this,Ee),h.call(this,Ee)}}function h(le,pe){const Ee=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==le.type&&(pe?pe.call(this,le,ge[0]):(ge[1]||vy).call(this,le,ge[0]));else throw new Error("Cannot close `"+le.type+"` ("+Si({start:le.start,end:le.end})+"): it’s not open");Ee.position.end=Rr(le.end)}function g(){return dh(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function k(le){if(this.data.expectingFirstListItemValue){const pe=this.stack[this.stack.length-2];pe.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function w(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.lang=le}function j(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.meta=le}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.value=le.replace(/(\r?\n|\r)$/g,"")}function O(le){const pe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=pe,Ee.identifier=ha(this.sliceSerialize(le)).toLowerCase()}function R(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.title=le}function $(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.url=le}function H(le){const pe=this.stack[this.stack.length-1];if(!pe.depth){const Ee=this.sliceSerialize(le).length;pe.depth=Ee}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function V(le){const pe=this.stack[this.stack.length-1];pe.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function W(le){const Ee=this.stack[this.stack.length-1].children;let ge=Ee[Ee.length-1];(!ge||ge.type!=="text")&&(ge=bt(),ge.position={start:Rr(le.start),end:void 0},Ee.push(ge)),this.stack.push(ge)}function z(le){const pe=this.stack.pop();pe.value+=this.sliceSerialize(le),pe.position.end=Rr(le.end)}function q(le){const pe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=pe.children[pe.children.length-1];Ee.position.end=Rr(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(pe.type)&&(W.call(this,le),z.call(this,le))}function A(){this.data.atHardBreak=!0}function L(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.value=le}function X(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.value=le}function F(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.value=le}function D(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=pe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function te(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=pe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ee(le){const pe=this.sliceSerialize(le),Ee=this.stack[this.stack.length-2];Ee.label=g3(pe),Ee.identifier=ha(pe).toLowerCase()}function we(){const le=this.stack[this.stack.length-1],pe=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){const ge=le.children;Ee.children=ge}else Ee.alt=pe}function U(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.url=le}function I(){const le=this.resume(),pe=this.stack[this.stack.length-1];pe.title=le}function B(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function re(le){const pe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=pe,Ee.identifier=ha(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function de(le){this.data.characterReferenceType=le.type}function fe(le){const pe=this.sliceSerialize(le),Ee=this.data.characterReferenceType;let ge;Ee?(ge=nb(pe,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=fh(pe);const ve=this.stack[this.stack.length-1];ve.value+=ge}function he(le){const pe=this.stack.pop();pe.position.end=Rr(le.end)}function Ce(le){z.call(this,le);const pe=this.stack[this.stack.length-1];pe.url=this.sliceSerialize(le)}function ne(le){z.call(this,le);const pe=this.stack[this.stack.length-1];pe.url="mailto:"+this.sliceSerialize(le)}function me(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function De(){return{type:"inlineCode",value:""}}function Fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function Lt(){return{type:"heading",depth:0,children:[]}}function Kt(){return{type:"break"}}function _t(){return{type:"html",value:""}}function Pn(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function $e(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function rt(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function pt(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function on(){return{type:"thematicBreak"}}}function Rr(e){return{line:e.line,column:e.column,offset:e.offset}}function mb(e,n){let r=-1;for(;++r<n.length;){const l=n[r];Array.isArray(l)?mb(e,l):b3(e,l)}}function b3(e,n){let r;for(r in n)if(fb.call(n,r))switch(r){case"canContainEols":{const l=n[r];l&&e[r].push(...l);break}case"transforms":{const l=n[r];l&&e[r].push(...l);break}case"enter":case"exit":{const l=n[r];l&&Object.assign(e[r],l);break}}}function vy(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Si({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Si({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Si({start:n.start,end:n.end})+") is still open")}function k3(e){const n=this;n.parser=r;function r(l){return y3(l,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function w3(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function S3(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
69
|
+
`}]}function j3(e,n){const r=n.value?n.value+`
|
|
70
|
+
`:"",l={},o=n.lang?n.lang.split(/\s+/):[];o.length>0&&(l.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:l,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function N3(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function C3(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function T3(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),o=ps(l.toLowerCase()),u=e.footnoteOrder.indexOf(l);let d,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),d=e.footnoteOrder.length):d=u+1,f+=1,e.footnoteCounts.set(l,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(n,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,h),e.applyData(n,h)}function E3(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function M3(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function hb(e,n){const r=n.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const o=e.all(n),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=l:o.push({type:"text",value:l}),o}function A3(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return hb(e,n);const o={src:ps(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,u),e.applyData(n,u)}function R3(e,n){const r={src:ps(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,l),e.applyData(n,l)}function L3(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,l),e.applyData(n,l)}function _3(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return hb(e,n);const o={href:ps(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function I3(e,n){const r={href:ps(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function z3(e,n,r){const l=e.all(n),o=r?D3(r):pb(n),u={},d=[];if(typeof n.checked=="boolean"){const g=l[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},l.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<l.length;){const g=l[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
|
|
71
|
+
`}),g.type==="element"&&g.tagName==="p"&&!o?d.push(...g.children):d.push(g)}const m=l[l.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
|
|
72
|
+
`});const h={type:"element",tagName:"li",properties:u,children:d};return e.patch(n,h),e.applyData(n,h)}function D3(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let l=-1;for(;!n&&++l<r.length;)n=pb(r[l])}return n}function pb(e){const n=e.spread;return n??e.children.length>1}function O3(e,n){const r={},l=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++o<l.length;){const d=l[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(l,!0)};return e.patch(n,u),e.applyData(n,u)}function U3(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function $3(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function B3(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function H3(e,n){const r=e.all(n),l=r.shift(),o=[];if(l){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([l],!0)};e.patch(n.children[0],d),o.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=ih(n.children[1]),m=Wv(n.children[n.children.length-1]);f&&m&&(d.position={start:f,end:m}),o.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,u),e.applyData(n,u)}function P3(e,n,r){const l=r?r.children:void 0,u=(l?l.indexOf(n):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,f=d?d.length:n.children.length;let m=-1;const h=[];for(;++m<f;){const v=n.children[m],k={},w=d?d[m]:void 0;w&&(k.align=w);let j={type:"element",tagName:u,properties:k,children:[]};v&&(j.children=e.all(v),e.patch(v,j),j=e.applyData(v,j)),h.push(j)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(n,g),e.applyData(n,g)}function q3(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const by=9,ky=32;function F3(e){const n=String(e),r=/\r?\n|\r/g;let l=r.exec(n),o=0;const u=[];for(;l;)u.push(wy(n.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=r.exec(n);return u.push(wy(n.slice(o),o>0,!1)),u.join("")}function wy(e,n,r){let l=0,o=e.length;if(n){let u=e.codePointAt(l);for(;u===by||u===ky;)l++,u=e.codePointAt(l)}if(r){let u=e.codePointAt(o-1);for(;u===by||u===ky;)o--,u=e.codePointAt(o-1)}return o>l?e.slice(l,o):""}function V3(e,n){const r={type:"text",value:F3(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function G3(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const K3={blockquote:w3,break:S3,code:j3,delete:N3,emphasis:C3,footnoteReference:T3,heading:E3,html:M3,imageReference:A3,image:R3,inlineCode:L3,linkReference:_3,link:I3,listItem:z3,list:O3,paragraph:U3,root:$3,strong:B3,table:H3,tableCell:q3,tableRow:P3,text:V3,thematicBreak:G3,toml:ic,yaml:ic,definition:ic,footnoteDefinition:ic};function ic(){}const gb=-1,Zc=0,Ni=1,Dc=2,hh=3,ph=4,gh=5,xh=6,xb=7,yb=8,W3=typeof self=="object"?self:globalThis,Sy=(e,n)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new W3[e](n)},Y3=(e,n)=>{const r=(o,u)=>(e.set(u,o),o),l=o=>{if(e.has(o))return e.get(o);const[u,d]=n[o];switch(u){case Zc:case gb:return r(d,o);case Ni:{const f=r([],o);for(const m of d)f.push(l(m));return f}case Dc:{const f=r({},o);for(const[m,h]of d)f[l(m)]=l(h);return f}case hh:return r(new Date(d),o);case ph:{const{source:f,flags:m}=d;return r(new RegExp(f,m),o)}case gh:{const f=r(new Map,o);for(const[m,h]of d)f.set(l(m),l(h));return f}case xh:{const f=r(new Set,o);for(const m of d)f.add(l(m));return f}case xb:{const{name:f,message:m}=d;return r(Sy(f,m),o)}case yb:return r(BigInt(d),o);case"BigInt":return r(Object(BigInt(d)),o);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:f}=new Uint8Array(d);return r(new DataView(f),d)}}return r(Sy(u,d),o)};return l},jy=e=>Y3(new Map,e)(0),ol="",{toString:X3}={},{keys:Q3}=Object,fi=e=>{const n=typeof e;if(n!=="object"||!e)return[Zc,n];const r=X3.call(e).slice(8,-1);switch(r){case"Array":return[Ni,ol];case"Object":return[Dc,ol];case"Date":return[hh,ol];case"RegExp":return[ph,ol];case"Map":return[gh,ol];case"Set":return[xh,ol];case"DataView":return[Ni,r]}return r.includes("Array")?[Ni,r]:r.includes("Error")?[xb,r]:[Dc,r]},oc=([e,n])=>e===Zc&&(n==="function"||n==="symbol"),Z3=(e,n,r,l)=>{const o=(d,f)=>{const m=l.push(d)-1;return r.set(f,m),m},u=d=>{if(r.has(d))return r.get(d);let[f,m]=fi(d);switch(f){case Zc:{let g=d;switch(m){case"bigint":f=yb,g=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return o([gb],d)}return o([f,g],d)}case Ni:{if(m){let k=d;return m==="DataView"?k=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(k=new Uint8Array(d)),o([m,[...k]],d)}const g=[],v=o([f,g],d);for(const k of d)g.push(u(k));return v}case Dc:{if(m)switch(m){case"BigInt":return o([m,d.toString()],d);case"Boolean":case"Number":case"String":return o([m,d.valueOf()],d)}if(n&&"toJSON"in d)return u(d.toJSON());const g=[],v=o([f,g],d);for(const k of Q3(d))(e||!oc(fi(d[k])))&&g.push([u(k),u(d[k])]);return v}case hh:return o([f,isNaN(d.getTime())?ol:d.toISOString()],d);case ph:{const{source:g,flags:v}=d;return o([f,{source:g,flags:v}],d)}case gh:{const g=[],v=o([f,g],d);for(const[k,w]of d)(e||!(oc(fi(k))||oc(fi(w))))&&g.push([u(k),u(w)]);return v}case xh:{const g=[],v=o([f,g],d);for(const k of d)(e||!oc(fi(k)))&&g.push(u(k));return v}}const{message:h}=d;return o([f,{name:m,message:h}],d)};return u},Ny=(e,{json:n,lossy:r}={})=>{const l=[];return Z3(!(n||r),!!n,new Map,l)(e),l},Oc=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?jy(Ny(e,n)):structuredClone(e):(e,n)=>jy(Ny(e,n));function J3(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function eT(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function tT(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||J3,l=e.options.footnoteBackLabel||eT,o=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const g=e.all(h),v=String(h.identifier).toUpperCase(),k=ps(v.toLowerCase());let w=0;const j=[],C=e.footnoteCounts.get(v);for(;C!==void 0&&++w<=C;){j.length>0&&j.push({type:"text",value:" "});let O=typeof r=="string"?r:r(m,w);typeof O=="string"&&(O={type:"text",value:O}),j.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+k+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(m,w),className:["data-footnote-backref"]},children:Array.isArray(O)?O:[O]})}const N=g[g.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const O=N.children[N.children.length-1];O&&O.type==="text"?O.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...j)}else g.push(...j);const M={type:"element",tagName:"li",properties:{id:n+"fn-"+k},children:e.wrap(g,!0)};e.patch(h,M),f.push(M)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Oc(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
73
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
74
|
+
`}]}}const Jc=(function(e){if(e==null)return lT;if(typeof e=="function")return eu(e);if(typeof e=="object")return Array.isArray(e)?nT(e):aT(e);if(typeof e=="string")return rT(e);throw new Error("Expected function, string, or object as test")});function nT(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Jc(e[r]);return eu(l);function l(...o){let u=-1;for(;++u<n.length;)if(n[u].apply(this,o))return!0;return!1}}function aT(e){const n=e;return eu(r);function r(l){const o=l;let u;for(u in e)if(o[u]!==n[u])return!1;return!0}}function rT(e){return eu(n);function n(r){return r&&r.type===e}}function eu(e){return n;function n(r,l,o){return!!(sT(r)&&e.call(this,r,typeof l=="number"?l:void 0,o||void 0))}}function lT(){return!0}function sT(e){return e!==null&&typeof e=="object"&&"type"in e}const vb=[],iT=!0,Tm=!1,oT="skip";function bb(e,n,r,l){let o;typeof n=="function"&&typeof r!="function"?(l=r,r=n):o=n;const u=Jc(o),d=l?-1:1;f(e,void 0,[])();function f(m,h,g){const v=m&&typeof m=="object"?m:{};if(typeof v.type=="string"){const w=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(k,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return k;function k(){let w=vb,j,C,N;if((!n||u(m,h,g[g.length-1]||void 0))&&(w=cT(r(m,g)),w[0]===Tm))return w;if("children"in m&&m.children){const M=m;if(M.children&&w[0]!==oT)for(C=(l?M.children.length:-1)+d,N=g.concat(M);C>-1&&C<M.children.length;){const O=M.children[C];if(j=f(O,C,N)(),j[0]===Tm)return j;C=typeof j[1]=="number"?j[1]:C+d}}return w}}}function cT(e){return Array.isArray(e)?e:typeof e=="number"?[iT,e]:e==null?vb:[e]}function yh(e,n,r,l){let o,u,d;typeof n=="function"&&typeof r!="function"?(u=void 0,d=n,o=r):(u=n,d=r,o=l),bb(e,u,f,o);function f(m,h){const g=h[h.length-1],v=g?g.children.indexOf(m):void 0;return d(m,v,g)}}const Em={}.hasOwnProperty,uT={};function dT(e,n){const r=n||uT,l=new Map,o=new Map,u=new Map,d={...K3,...r.handlers},f={all:h,applyData:mT,definitionById:l,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:d,one:m,options:r,patch:fT,wrap:pT};return yh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const v=g.type==="definition"?l:o,k=String(g.identifier).toUpperCase();v.has(k)||v.set(k,g)}}),f;function m(g,v){const k=g.type,w=f.handlers[k];if(Em.call(f.handlers,k)&&w)return w(f,g,v);if(f.options.passThrough&&f.options.passThrough.includes(k)){if("children"in g){const{children:C,...N}=g,M=Oc(N);return M.children=f.all(g),M}return Oc(g)}return(f.options.unknownHandler||hT)(f,g,v)}function h(g){const v=[];if("children"in g){const k=g.children;let w=-1;for(;++w<k.length;){const j=f.one(k[w],g);if(j){if(w&&k[w-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=Cy(j.value)),!Array.isArray(j)&&j.type==="element")){const C=j.children[0];C&&C.type==="text"&&(C.value=Cy(C.value))}Array.isArray(j)?v.push(...j):v.push(j)}}}return v}}function fT(e,n){e.position&&(n.position=J4(e))}function mT(e,n){let r=n;if(e&&e.data){const l=e.data.hName,o=e.data.hChildren,u=e.data.hProperties;if(typeof l=="string")if(r.type==="element")r.tagName=l;else{const d="children"in r?r.children:[r];r={type:"element",tagName:l,properties:{},children:d}}r.type==="element"&&u&&Object.assign(r.properties,Oc(u)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function hT(e,n){const r=n.data||{},l="value"in n&&!(Em.call(r,"hProperties")||Em.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function pT(e,n){const r=[];let l=-1;for(n&&r.push({type:"text",value:`
|
|
75
|
+
`});++l<e.length;)l&&r.push({type:"text",value:`
|
|
76
|
+
`}),r.push(e[l]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
77
|
+
`}),r}function Cy(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Ty(e,n){const r=dT(e,n),l=r.one(e,void 0),o=tT(r),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
78
|
+
`},o),u}function gT(e,n){return e&&"run"in e?async function(r,l){const o=Ty(r,{file:l,...n});await e.run(o,l)}:function(r,l){return Ty(r,{file:l,...e||n})}}function Ey(e){if(e)throw e}var Lf,My;function xT(){if(My)return Lf;My=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},u=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),v=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!v)return!1;var k;for(k in h);return typeof k>"u"||e.call(h,k)},d=function(h,g){r&&g.name==="__proto__"?r(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(l)return l(h,g).value}else return;return h[g]};return Lf=function m(){var h,g,v,k,w,j,C=arguments[0],N=1,M=arguments.length,O=!1;for(typeof C=="boolean"&&(O=C,C=arguments[1]||{},N=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});N<M;++N)if(h=arguments[N],h!=null)for(g in h)v=f(C,g),k=f(h,g),C!==k&&(O&&k&&(u(k)||(w=o(k)))?(w?(w=!1,j=v&&o(v)?v:[]):j=v&&u(v)?v:{},d(C,{name:g,newValue:m(O,j,k)})):typeof k<"u"&&d(C,{name:g,newValue:k}));return C},Lf}var yT=xT();const _f=U1(yT);function Mm(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function vT(){const e=[],n={run:r,use:l};return n;function r(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);f(null,...o);function f(m,...h){const g=e[++u];let v=-1;if(m){d(m);return}for(;++v<o.length;)(h[v]===null||h[v]===void 0)&&(h[v]=o[v]);o=h,g?bT(g,f)(...h):d(null,...h)}}function l(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function bT(e,n){let r;return l;function l(...d){const f=e.length>d.length;let m;f&&d.push(o);try{m=e.apply(this,d)}catch(h){const g=h;if(f&&r)throw g;return o(g)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,o):m instanceof Error?o(m):u(m))}function o(d,...f){r||(r=!0,n(d,...f))}function u(d){o(null,d)}}const wa={basename:kT,dirname:wT,extname:ST,join:jT,sep:"/"};function kT(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Pi(e);let r=0,l=-1,o=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else l<0&&(u=!0,l=o+1);return l<0?"":e.slice(r,l)}if(n===e)return"";let d=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else d<0&&(u=!0,d=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(l=o):(f=-1,l=d));return r===l?l=d:l<0&&(l=e.length),e.slice(r,l)}function wT(e){if(Pi(e),e.length===0)return".";let n=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){n=r;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function ST(e){Pi(e);let n=e.length,r=-1,l=0,o=-1,u=0,d;for(;n--;){const f=e.codePointAt(n);if(f===47){if(d){l=n+1;break}continue}r<0&&(d=!0,r=n+1),f===46?o<0?o=n:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||r<0||u===0||u===1&&o===r-1&&o===l+1?"":e.slice(o,r)}function jT(...e){let n=-1,r;for(;++n<e.length;)Pi(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":NT(r)}function NT(e){Pi(e);const n=e.codePointAt(0)===47;let r=CT(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function CT(e,n){let r="",l=0,o=-1,u=0,d=-1,f,m;for(;++d<=e.length;){if(d<e.length)f=e.codePointAt(d);else{if(f===47)break;f=47}if(f===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(r.length<2||l!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",l=0):(r=r.slice(0,m),l=r.length-1-r.lastIndexOf("/")),o=d,u=0;continue}}else if(r.length>0){r="",l=0,o=d,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),l=d-o-1;o=d,u=0}else f===46&&u>-1?u++:u=-1}return r}function Pi(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const TT={cwd:ET};function ET(){return"/"}function Am(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function MT(e){if(typeof e=="string")e=new URL(e);else if(!Am(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return AT(e)}function AT(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const l=n.codePointAt(r+2);if(l===70||l===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(n)}const If=["history","path","basename","stem","extname","dirname"];class kb{constructor(n){let r;n?Am(n)?r={path:n}:typeof n=="string"||RT(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":TT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<If.length;){const u=If[l];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let o;for(o in r)If.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?wa.basename(this.path):void 0}set basename(n){Df(n,"basename"),zf(n,"basename"),this.path=wa.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?wa.dirname(this.path):void 0}set dirname(n){Ay(this.basename,"dirname"),this.path=wa.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?wa.extname(this.path):void 0}set extname(n){if(zf(n,"extname"),Ay(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=wa.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Am(n)&&(n=MT(n)),Df(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?wa.basename(this.path,this.extname):void 0}set stem(n){Df(n,"stem"),zf(n,"stem"),this.path=wa.join(this.dirname||"",n+(this.extname||""))}fail(n,r,l){const o=this.message(n,r,l);throw o.fatal=!0,o}info(n,r,l){const o=this.message(n,r,l);return o.fatal=void 0,o}message(n,r,l){const o=new fn(n,r,l);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function zf(e,n){if(e&&e.includes(wa.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+wa.sep+"`")}function Df(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Ay(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function RT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const LT=(function(e){const l=this.constructor.prototype,o=l[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,l),u}),_T={}.hasOwnProperty;class vh extends LT{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=vT()}copy(){const n=new vh;let r=-1;for(;++r<this.attachers.length;){const l=this.attachers[r];n.use(...l)}return n.data(_f(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?($f("data",this.frozen),this.namespace[n]=r,this):_T.call(this.namespace,n)&&this.namespace[n]||void 0:n?($f("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const o=r.call(n,...l);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=cc(n),l=this.parser||this.Parser;return Of("parse",l),l(String(r),r)}process(n,r){const l=this;return this.freeze(),Of("process",this.parser||this.Parser),Uf("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(u,d){const f=cc(n),m=l.parse(f);l.run(m,f,function(g,v,k){if(g||!v||!k)return h(g);const w=v,j=l.stringify(w,k);DT(j)?k.value=j:k.result=j,h(g,k)});function h(g,v){g||!v?d(g):u?u(v):r(void 0,v)}}}processSync(n){let r=!1,l;return this.freeze(),Of("processSync",this.parser||this.Parser),Uf("processSync",this.compiler||this.Compiler),this.process(n,o),Ly("processSync","process",r),l;function o(u,d){r=!0,Ey(u),l=d}}run(n,r,l){Ry(n),this.freeze();const o=this.transformers;return!l&&typeof r=="function"&&(l=r,r=void 0),l?u(void 0,l):new Promise(u);function u(d,f){const m=cc(r);o.run(n,m,h);function h(g,v,k){const w=v||n;g?f(g):d?d(w):l(void 0,w,k)}}}runSync(n,r){let l=!1,o;return this.run(n,r,u),Ly("runSync","run",l),o;function u(d,f){Ey(d),o=f,l=!0}}stringify(n,r){this.freeze();const l=cc(r),o=this.compiler||this.Compiler;return Uf("stringify",o),Ry(n),o(n,l)}use(n,...r){const l=this.attachers,o=this.namespace;if($f("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):d(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...v]=h;m(g,v)}else d(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function d(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(o.settings=_f(!0,o.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const v=h[g];u(v)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,g){let v=-1,k=-1;for(;++v<l.length;)if(l[v][0]===h){k=v;break}if(k===-1)l.push([h,...g]);else if(g.length>0){let[w,...j]=g;const C=l[k][1];Mm(C)&&Mm(w)&&(w=_f(!0,C,w)),l[k]=[h,w,...j]}}}}const IT=new vh().freeze();function Of(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Uf(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $f(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ry(e){if(!Mm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ly(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function cc(e){return zT(e)?e:new kb(e)}function zT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function DT(e){return typeof e=="string"||OT(e)}function OT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const UT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_y=[],Iy={allowDangerousHtml:!0},$T=/^(https?|ircs?|mailto|xmpp)$/i,BT=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function tu(e){const n=HT(e),r=PT(e);return qT(n.runSync(n.parse(r),r),e)}function HT(e){const n=e.rehypePlugins||_y,r=e.remarkPlugins||_y,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Iy}:Iy;return IT().use(k3).use(r).use(gT,l).use(n)}function PT(e){const n=e.children||"",r=new kb;return typeof n=="string"&&(r.value=n),r}function qT(e,n){const r=n.allowedElements,l=n.allowElement,o=n.components,u=n.disallowedElements,d=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||FT;for(const g of BT)Object.hasOwn(n,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+UT+g.id,void 0);return yh(e,h),rN(e,{Fragment:i.Fragment,components:o,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function h(g,v,k){if(g.type==="raw"&&k&&typeof v=="number")return d?k.children.splice(v,1):k.children[v]={type:"text",value:g.value},v;if(g.type==="element"){let w;for(w in Mf)if(Object.hasOwn(Mf,w)&&Object.hasOwn(g.properties,w)){const j=g.properties[w],C=Mf[w];(C===null||C.includes(g.tagName))&&(g.properties[w]=m(String(j||""),w,g))}}if(g.type==="element"){let w=r?!r.includes(g.tagName):u?u.includes(g.tagName):!1;if(!w&&l&&typeof v=="number"&&(w=!l(g,v,k)),w&&k&&typeof v=="number")return f&&g.children?k.children.splice(v,1,...g.children):k.children.splice(v,1),v}}}function FT(e){const n=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||r!==-1&&n>r||l!==-1&&n>l||$T.test(e.slice(0,n))?e:""}function zy(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let l=0,o=r.indexOf(n);for(;o!==-1;)l++,o=r.indexOf(n,o+n.length);return l}function VT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function GT(e,n,r){const o=Jc((r||{}).ignore||[]),u=KT(n);let d=-1;for(;++d<u.length;)bb(e,"text",f);function f(h,g){let v=-1,k;for(;++v<g.length;){const w=g[v],j=k?k.children:void 0;if(o(w,j?j.indexOf(w):void 0,k))return;k=w}if(k)return m(h,g)}function m(h,g){const v=g[g.length-1],k=u[d][0],w=u[d][1];let j=0;const N=v.children.indexOf(h);let M=!1,O=[];k.lastIndex=0;let R=k.exec(h.value);for(;R;){const $=R.index,H={index:R.index,input:R.input,stack:[...g,h]};let _=w(...R,H);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?k.lastIndex=$+1:(j!==$&&O.push({type:"text",value:h.value.slice(j,$)}),Array.isArray(_)?O.push(..._):_&&O.push(_),j=$+R[0].length,M=!0),!k.global)break;R=k.exec(h.value)}return M?(j<h.value.length&&O.push({type:"text",value:h.value.slice(j)}),v.children.splice(N,1,...O)):O=[h],N+O.length}}function KT(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let l=-1;for(;++l<r.length;){const o=r[l];n.push([WT(o[0]),YT(o[1])])}return n}function WT(e){return typeof e=="string"?new RegExp(VT(e),"g"):e}function YT(e){return typeof e=="function"?e:function(){return e}}const Bf="phrasing",Hf=["autolink","link","image","label"];function XT(){return{transforms:[aE],enter:{literalAutolink:ZT,literalAutolinkEmail:Pf,literalAutolinkHttp:Pf,literalAutolinkWww:Pf},exit:{literalAutolink:nE,literalAutolinkEmail:tE,literalAutolinkHttp:JT,literalAutolinkWww:eE}}}function QT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bf,notInConstruct:Hf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bf,notInConstruct:Hf},{character:":",before:"[ps]",after:"\\/",inConstruct:Bf,notInConstruct:Hf}]}}function ZT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Pf(e){this.config.enter.autolinkProtocol.call(this,e)}function JT(e){this.config.exit.autolinkProtocol.call(this,e)}function eE(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function tE(e){this.config.exit.autolinkEmail.call(this,e)}function nE(e){this.exit(e)}function aE(e){GT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,rE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),lE]],{ignore:["link","linkReference"]})}function rE(e,n,r,l,o){let u="";if(!wb(o)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!sE(r)))return!1;const d=iE(r+l);if(!d[0])return!1;const f={type:"link",title:null,url:u+n+d[0],children:[{type:"text",value:n+d[0]}]};return d[1]?[f,{type:"text",value:d[1]}]:f}function lE(e,n,r,l){return!wb(l,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function sE(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function iE(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],l=r.indexOf(")");const o=zy(e,"(");let u=zy(e,")");for(;l!==-1&&o>u;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),u++;return[e,r]}function wb(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||gl(r)||Xc(r))&&(!n||r!==47)}Sb.peek=gE;function oE(){this.buffer()}function cE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function uE(){this.buffer()}function dE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function fE(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ha(this.sliceSerialize(e)).toLowerCase(),r.label=n}function mE(e){this.exit(e)}function hE(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ha(this.sliceSerialize(e)).toLowerCase(),r.label=n}function pE(e){this.exit(e)}function gE(){return"["}function Sb(e,n,r,l){const o=r.createTracker(l);let u=o.move("[^");const d=r.enter("footnoteReference"),f=r.enter("reference");return u+=o.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),d(),u+=o.move("]"),u}function xE(){return{enter:{gfmFootnoteCallString:oE,gfmFootnoteCall:cE,gfmFootnoteDefinitionLabelString:uE,gfmFootnoteDefinition:dE},exit:{gfmFootnoteCallString:fE,gfmFootnoteCall:mE,gfmFootnoteDefinitionLabelString:hE,gfmFootnoteDefinition:pE}}}function yE(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:Sb},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,o,u,d){const f=u.createTracker(d);let m=f.move("[^");const h=u.enter("footnoteDefinition"),g=u.enter("label");return m+=f.move(u.safe(u.associationId(l),{before:m,after:"]"})),g(),m+=f.move("]:"),l.children&&l.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
79
|
+
`:" ")+u.indentLines(u.containerFlow(l,f.current()),n?jb:vE))),h(),m}}function vE(e,n,r){return n===0?e:jb(e,n,r)}function jb(e,n,r){return(r?"":" ")+e}const bE=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Nb.peek=NE;function kE(){return{canContainEols:["delete"],enter:{strikethrough:SE},exit:{strikethrough:jE}}}function wE(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:bE}],handlers:{delete:Nb}}}function SE(e){this.enter({type:"delete",children:[]},e)}function jE(e){this.exit(e)}function Nb(e,n,r,l){const o=r.createTracker(l),u=r.enter("strikethrough");let d=o.move("~~");return d+=r.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),u(),d}function NE(){return"~"}function CE(e){return e.length}function TE(e,n){const r=n||{},l=(r.align||[]).concat(),o=r.stringLength||CE,u=[],d=[],f=[],m=[];let h=0,g=-1;for(;++g<e.length;){const C=[],N=[];let M=-1;for(e[g].length>h&&(h=e[g].length);++M<e[g].length;){const O=EE(e[g][M]);if(r.alignDelimiters!==!1){const R=o(O);N[M]=R,(m[M]===void 0||R>m[M])&&(m[M]=R)}C.push(O)}d[g]=C,f[g]=N}let v=-1;if(typeof l=="object"&&"length"in l)for(;++v<h;)u[v]=Dy(l[v]);else{const C=Dy(l);for(;++v<h;)u[v]=C}v=-1;const k=[],w=[];for(;++v<h;){const C=u[v];let N="",M="";C===99?(N=":",M=":"):C===108?N=":":C===114&&(M=":");let O=r.alignDelimiters===!1?1:Math.max(1,m[v]-N.length-M.length);const R=N+"-".repeat(O)+M;r.alignDelimiters!==!1&&(O=N.length+O+M.length,O>m[v]&&(m[v]=O),w[v]=O),k[v]=R}d.splice(1,0,k),f.splice(1,0,w),g=-1;const j=[];for(;++g<d.length;){const C=d[g],N=f[g];v=-1;const M=[];for(;++v<h;){const O=C[v]||"";let R="",$="";if(r.alignDelimiters!==!1){const H=m[v]-(N[v]||0),_=u[v];_===114?R=" ".repeat(H):_===99?H%2?(R=" ".repeat(H/2+.5),$=" ".repeat(H/2-.5)):(R=" ".repeat(H/2),$=R):$=" ".repeat(H)}r.delimiterStart!==!1&&!v&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&O==="")&&(r.delimiterStart!==!1||v)&&M.push(" "),r.alignDelimiters!==!1&&M.push(R),M.push(O),r.alignDelimiters!==!1&&M.push($),r.padding!==!1&&M.push(" "),(r.delimiterEnd!==!1||v!==h-1)&&M.push("|")}j.push(r.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return j.join(`
|
|
80
|
+
`)}function EE(e){return e==null?"":String(e)}function Dy(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function ME(e,n,r,l){const o=r.enter("blockquote"),u=r.createTracker(l);u.move("> "),u.shift(2);const d=r.indentLines(r.containerFlow(e,u.current()),AE);return o(),d}function AE(e,n,r){return">"+(r?"":" ")+e}function RE(e,n){return Oy(e,n.inConstruct,!0)&&!Oy(e,n.notInConstruct,!1)}function Oy(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let l=-1;for(;++l<n.length;)if(e.includes(n[l]))return!0;return!1}function Uy(e,n,r,l){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
|
|
81
|
+
`&&RE(r.stack,r.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
|
|
82
|
+
`}function LE(e,n){const r=String(e);let l=r.indexOf(n),o=l,u=0,d=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===o?++u>d&&(d=u):u=1,o=l+n.length,l=r.indexOf(n,o);return d}function _E(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function IE(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function zE(e,n,r,l){const o=IE(r),u=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(_E(e,r)){const v=r.enter("codeIndented"),k=r.indentLines(u,DE);return v(),k}const f=r.createTracker(l),m=o.repeat(Math.max(LE(u,o)+1,3)),h=r.enter("codeFenced");let g=f.move(m);if(e.lang){const v=r.enter(`codeFencedLang${d}`);g+=f.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),v()}if(e.lang&&e.meta){const v=r.enter(`codeFencedMeta${d}`);g+=f.move(" "),g+=f.move(r.safe(e.meta,{before:g,after:`
|
|
83
|
+
`,encode:["`"],...f.current()})),v()}return g+=f.move(`
|
|
84
|
+
`),u&&(g+=f.move(u+`
|
|
85
|
+
`)),g+=f.move(m),h(),g}function DE(e,n,r){return(r?"":" ")+e}function bh(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function OE(e,n,r,l){const o=bh(r),u=o==='"'?"Quote":"Apostrophe",d=r.enter("definition");let f=r.enter("label");const m=r.createTracker(l);let h=m.move("[");return h+=m.move(r.safe(r.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":`
|
|
86
|
+
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),h+=m.move(" "+o),h+=m.move(r.safe(e.title,{before:h,after:o,...m.current()})),h+=m.move(o),f()),d(),h}function UE(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function Li(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Uc(e,n,r){const l=ds(e),o=ds(n);return l===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Cb.peek=$E;function Cb(e,n,r,l){const o=UE(r),u=r.enter("emphasis"),d=r.createTracker(l),f=d.move(o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=Uc(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(m=Li(h)+m.slice(1));const v=m.charCodeAt(m.length-1),k=Uc(l.after.charCodeAt(0),v,o);k.inside&&(m=m.slice(0,-1)+Li(v));const w=d.move(o);return u(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function $E(e,n,r){return r.options.emphasis||"*"}function BE(e,n){let r=!1;return yh(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,Tm}),!!((!e.depth||e.depth<3)&&dh(e)&&(n.options.setext||r))}function HE(e,n,r,l){const o=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(l);if(BE(e,r)){const g=r.enter("headingSetext"),v=r.enter("phrasing"),k=r.containerPhrasing(e,{...u.current(),before:`
|
|
87
|
+
`,after:`
|
|
88
|
+
`});return v(),g(),k+`
|
|
89
|
+
`+(o===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(`
|
|
90
|
+
`))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(d+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
|
|
91
|
+
`,...u.current()});return/^[\t ]/.test(h)&&(h=Li(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,r.options.closeAtx&&(h+=" "+d),m(),f(),h}Tb.peek=PE;function Tb(e){return e.value||""}function PE(){return"<"}Eb.peek=qE;function Eb(e,n,r,l){const o=bh(r),u=o==='"'?"Quote":"Apostrophe",d=r.enter("image");let f=r.enter("label");const m=r.createTracker(l);let h=m.move("![");return h+=m.move(r.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),h+=m.move(" "+o),h+=m.move(r.safe(e.title,{before:h,after:o,...m.current()})),h+=m.move(o),f()),h+=m.move(")"),d(),h}function qE(){return"!"}Mb.peek=FE;function Mb(e,n,r,l){const o=e.referenceType,u=r.enter("imageReference");let d=r.enter("label");const f=r.createTracker(l);let m=f.move("![");const h=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const v=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,u(),o==="full"||!h||h!==v?m+=f.move(v+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function FE(){return"!"}Ab.peek=VE;function Ab(e,n,r){let l=e.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++u<r.unsafe.length;){const d=r.unsafe[u],f=r.compilePattern(d);let m;if(d.atBreak)for(;m=f.exec(l);){let h=m.index;l.charCodeAt(h)===10&&l.charCodeAt(h-1)===13&&h--,l=l.slice(0,h)+" "+l.slice(m.index+1)}}return o+l+o}function VE(){return"`"}function Rb(e,n){const r=dh(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Lb.peek=GE;function Lb(e,n,r,l){const o=bh(r),u=o==='"'?"Quote":"Apostrophe",d=r.createTracker(l);let f,m;if(Rb(e,r)){const g=r.stack;r.stack=[],f=r.enter("autolink");let v=d.move("<");return v+=d.move(r.containerPhrasing(e,{before:v,after:">",...d.current()})),v+=d.move(">"),f(),r.stack=g,v}f=r.enter("link"),m=r.enter("label");let h=d.move("[");return h+=d.move(r.containerPhrasing(e,{before:h,after:"](",...d.current()})),h+=d.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(m=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),m(),e.title&&(m=r.enter(`title${u}`),h+=d.move(" "+o),h+=d.move(r.safe(e.title,{before:h,after:o,...d.current()})),h+=d.move(o),m()),h+=d.move(")"),f(),h}function GE(e,n,r){return Rb(e,r)?"<":"["}_b.peek=KE;function _b(e,n,r,l){const o=e.referenceType,u=r.enter("linkReference");let d=r.enter("label");const f=r.createTracker(l);let m=f.move("[");const h=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const v=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,u(),o==="full"||!h||h!==v?m+=f.move(v+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function KE(){return"["}function kh(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function WE(e){const n=kh(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function YE(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function Ib(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function XE(e,n,r,l){const o=r.enter("list"),u=r.bulletCurrent;let d=e.ordered?YE(r):kh(r);const f=e.ordered?d==="."?")":".":WE(r);let m=n&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),Ib(r)===d&&g){let v=-1;for(;++v<e.children.length;){const k=e.children[v];if(k&&k.type==="listItem"&&k.children&&k.children[0]&&k.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=f),r.bulletCurrent=d;const h=r.containerFlow(e,l);return r.bulletLastUsed=d,r.bulletCurrent=u,o(),h}function QE(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function ZE(e,n,r,l){const o=QE(r);let u=r.bulletCurrent||kh(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let d=u.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=r.createTracker(l);f.move(u+" ".repeat(d-u.length)),f.shift(d);const m=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,f.current()),g);return m(),h;function g(v,k,w){return k?(w?"":" ".repeat(d))+v:(w?u:u+" ".repeat(d-u.length))+v}}function JE(e,n,r,l){const o=r.enter("paragraph"),u=r.enter("phrasing"),d=r.containerPhrasing(e,l);return u(),o(),d}const eM=Jc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function tM(e,n,r,l){return(e.children.some(function(d){return eM(d)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function nM(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}zb.peek=aM;function zb(e,n,r,l){const o=nM(r),u=r.enter("strong"),d=r.createTracker(l),f=d.move(o+o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=Uc(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(m=Li(h)+m.slice(1));const v=m.charCodeAt(m.length-1),k=Uc(l.after.charCodeAt(0),v,o);k.inside&&(m=m.slice(0,-1)+Li(v));const w=d.move(o+o);return u(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function aM(e,n,r){return r.options.strong||"*"}function rM(e,n,r,l){return r.safe(e.value,l)}function lM(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function sM(e,n,r){const l=(Ib(r)+(r.options.ruleSpaces?" ":"")).repeat(lM(r));return r.options.ruleSpaces?l.slice(0,-1):l}const Db={blockquote:ME,break:Uy,code:zE,definition:OE,emphasis:Cb,hardBreak:Uy,heading:HE,html:Tb,image:Eb,imageReference:Mb,inlineCode:Ab,link:Lb,linkReference:_b,list:XE,listItem:ZE,paragraph:JE,root:tM,strong:zb,text:rM,thematicBreak:sM};function iM(){return{enter:{table:oM,tableData:$y,tableHeader:$y,tableRow:uM},exit:{codeText:dM,table:cM,tableData:qf,tableHeader:qf,tableRow:qf}}}function oM(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function cM(e){this.exit(e),this.data.inTable=void 0}function uM(e){this.enter({type:"tableRow",children:[]},e)}function qf(e){this.exit(e)}function $y(e){this.enter({type:"tableCell",children:[]},e)}function dM(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,fM));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function fM(e,n){return n==="|"?n:e}function mM(e){const n=e||{},r=n.tableCellPadding,l=n.tablePipeAlign,o=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
92
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:k,table:d,tableCell:m,tableRow:f}};function d(w,j,C,N){return h(g(w,C,N),w.align)}function f(w,j,C,N){const M=v(w,C,N),O=h([M]);return O.slice(0,O.indexOf(`
|
|
93
|
+
`))}function m(w,j,C,N){const M=C.enter("tableCell"),O=C.enter("phrasing"),R=C.containerPhrasing(w,{...N,before:u,after:u});return O(),M(),R}function h(w,j){return TE(w,{align:j,alignDelimiters:l,padding:r,stringLength:o})}function g(w,j,C){const N=w.children;let M=-1;const O=[],R=j.enter("table");for(;++M<N.length;)O[M]=v(N[M],j,C);return R(),O}function v(w,j,C){const N=w.children;let M=-1;const O=[],R=j.enter("tableRow");for(;++M<N.length;)O[M]=m(N[M],w,j,C);return R(),O}function k(w,j,C){let N=Db.inlineCode(w,j,C);return C.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function hM(){return{exit:{taskListCheckValueChecked:By,taskListCheckValueUnchecked:By,paragraph:gM}}}function pM(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:xM}}}function By(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function gM(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const l=r.children[0];if(l&&l.type==="text"){const o=n.children;let u=-1,d;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){d=f;break}}d===r&&(l.value=l.value.slice(1),l.value.length===0?r.children.shift():r.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,r.position.start=Object.assign({},l.position.start)))}}this.exit(e)}function xM(e,n,r,l){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=r.createTracker(l);u&&f.move(d);let m=Db.listItem(e,n,r,{...l,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(g){return g+d}}function yM(){return[XT(),xE(),kE(),iM(),hM()]}function vM(e){return{extensions:[QT(),yE(e),wE(),mM(e),pM()]}}const bM={tokenize:CM,partial:!0},Ob={tokenize:TM,partial:!0},Ub={tokenize:EM,partial:!0},$b={tokenize:MM,partial:!0},kM={tokenize:AM,partial:!0},Bb={name:"wwwAutolink",tokenize:jM,previous:Pb},Hb={name:"protocolAutolink",tokenize:NM,previous:qb},nr={name:"emailAutolink",tokenize:SM,previous:Fb},Ea={};function wM(){return{text:Ea}}let il=48;for(;il<123;)Ea[il]=nr,il++,il===58?il=65:il===91&&(il=97);Ea[43]=nr;Ea[45]=nr;Ea[46]=nr;Ea[95]=nr;Ea[72]=[nr,Hb];Ea[104]=[nr,Hb];Ea[87]=[nr,Bb];Ea[119]=[nr,Bb];function SM(e,n,r){const l=this;let o,u;return d;function d(v){return!Rm(v)||!Fb.call(l,l.previous)||wh(l.events)?r(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(v))}function f(v){return Rm(v)?(e.consume(v),f):v===64?(e.consume(v),m):r(v)}function m(v){return v===46?e.check(kM,g,h)(v):v===45||v===95||dn(v)?(u=!0,e.consume(v),m):g(v)}function h(v){return e.consume(v),o=!0,m}function g(v){return u&&o&&pn(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(v)):r(v)}}function jM(e,n,r){const l=this;return o;function o(d){return d!==87&&d!==119||!Pb.call(l,l.previous)||wh(l.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(bM,e.attempt(Ob,e.attempt(Ub,u),r),r)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(d)}}function NM(e,n,r){const l=this;let o="",u=!1;return d;function d(v){return(v===72||v===104)&&qb.call(l,l.previous)&&!wh(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(v),e.consume(v),f):r(v)}function f(v){if(pn(v)&&o.length<5)return o+=String.fromCodePoint(v),e.consume(v),f;if(v===58){const k=o.toLowerCase();if(k==="http"||k==="https")return e.consume(v),m}return r(v)}function m(v){return v===47?(e.consume(v),u?h:(u=!0,m)):r(v)}function h(v){return v===null||zc(v)||St(v)||gl(v)||Xc(v)?r(v):e.attempt(Ob,e.attempt(Ub,g),r)(v)}function g(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(v)}}function CM(e,n,r){let l=0;return o;function o(d){return(d===87||d===119)&&l<3?(l++,e.consume(d),o):d===46&&l===3?(e.consume(d),u):r(d)}function u(d){return d===null?r(d):n(d)}}function TM(e,n,r){let l,o,u;return d;function d(h){return h===46||h===95?e.check($b,m,f)(h):h===null||St(h)||gl(h)||h!==45&&Xc(h)?m(h):(u=!0,e.consume(h),d)}function f(h){return h===95?l=!0:(o=l,l=void 0),e.consume(h),d}function m(h){return o||l||!u?r(h):n(h)}}function EM(e,n){let r=0,l=0;return o;function o(d){return d===40?(r++,e.consume(d),o):d===41&&l<r?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check($b,n,u)(d):d===null||St(d)||gl(d)?n(d):(e.consume(d),o)}function u(d){return d===41&&l++,e.consume(d),o}}function MM(e,n,r){return l;function l(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),l):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||St(f)||gl(f)?n(f):r(f)}function o(f){return f===null||f===40||f===91||St(f)||gl(f)?n(f):l(f)}function u(f){return pn(f)?d(f):r(f)}function d(f){return f===59?(e.consume(f),l):pn(f)?(e.consume(f),d):r(f)}}function AM(e,n,r){return l;function l(u){return e.consume(u),o}function o(u){return dn(u)?r(u):n(u)}}function Pb(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||St(e)}function qb(e){return!pn(e)}function Fb(e){return!(e===47||Rm(e))}function Rm(e){return e===43||e===45||e===46||e===95||dn(e)}function wh(e){let n=e.length,r=!1;for(;n--;){const l=e[n][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){r=!0;break}if(l._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const RM={tokenize:$M,partial:!0};function LM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:DM,continuation:{tokenize:OM},exit:UM}},text:{91:{name:"gfmFootnoteCall",tokenize:zM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_M,resolveTo:IM}}}}function _M(e,n,r){const l=this;let o=l.events.length;const u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;o--;){const m=l.events[o][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!d||!d._balanced)return r(m);const h=ha(l.sliceSerialize({start:d.end,end:l.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function IM(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",l,n],e[r+3],e[r+4],["enter",o,n],["exit",o,n],["enter",u,n],["enter",d,n],["exit",d,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",l,n]];return e.splice(r,e.length-r+1,...f),e}function zM(e,n,r){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u=0,d;return f;function f(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),m}function m(v){return v!==94?r(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(v){if(u>999||v===93&&!d||v===null||v===91||St(v))return r(v);if(v===93){e.exit("chunkString");const k=e.exit("gfmFootnoteCallString");return o.includes(ha(l.sliceSerialize(k)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(v)}return St(v)||(d=!0),u++,e.consume(v),v===92?g:h}function g(v){return v===91||v===92||v===93?(e.consume(v),u++,h):h(v)}}function DM(e,n,r){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u,d=0,f;return m;function m(j){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(j){return j===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(j)}function g(j){if(d>999||j===93&&!f||j===null||j===91||St(j))return r(j);if(j===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=ha(l.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),k}return St(j)||(f=!0),d++,e.consume(j),j===92?v:g}function v(j){return j===91||j===92||j===93?(e.consume(j),d++,g):g(j)}function k(j){return j===58?(e.enter("definitionMarker"),e.consume(j),e.exit("definitionMarker"),o.includes(u)||o.push(u),at(e,w,"gfmFootnoteDefinitionWhitespace")):r(j)}function w(j){return n(j)}}function OM(e,n,r){return e.check(Hi,n,e.attempt(RM,n,r))}function UM(e){e.exit("gfmFootnoteDefinition")}function $M(e,n,r){const l=this;return at(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?n(u):r(u)}}function BM(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:u,resolveAll:o};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function o(d,f){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let h=m;for(;h--;)if(d[h][0]==="exit"&&d[h][1].type==="strikethroughSequenceTemporary"&&d[h][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[h][1].end.offset-d[h][1].start.offset){d[m][1].type="strikethroughSequence",d[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},d[h][1].start),end:Object.assign({},d[m][1].end)},v={type:"strikethroughText",start:Object.assign({},d[h][1].end),end:Object.assign({},d[m][1].start)},k=[["enter",g,f],["enter",d[h][1],f],["exit",d[h][1],f],["enter",v,f]],w=f.parser.constructs.insideSpan.null;w&&Un(k,k.length,0,Qc(w,d.slice(h+1,m),f)),Un(k,k.length,0,[["exit",v,f],["enter",d[m][1],f],["exit",d[m][1],f],["exit",g,f]]),Un(d,h-1,m-h+3,k),m=h+k.length-2;break}}for(m=-1;++m<d.length;)d[m][1].type==="strikethroughSequenceTemporary"&&(d[m][1].type="data");return d}function u(d,f,m){const h=this.previous,g=this.events;let v=0;return k;function k(j){return h===126&&g[g.length-1][1].type!=="characterEscape"?m(j):(d.enter("strikethroughSequenceTemporary"),w(j))}function w(j){const C=ds(h);if(j===126)return v>1?m(j):(d.consume(j),v++,w);if(v<2&&!r)return m(j);const N=d.exit("strikethroughSequenceTemporary"),M=ds(j);return N._open=!M||M===2&&!!C,N._close=!C||C===2&&!!M,f(j)}}}class HM{constructor(){this.map=[]}add(n,r,l){PM(this,n,r,l)}consume(n){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const l=[];for(;r>0;)r-=1,l.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];l.push(n.slice()),n.length=0;let o=l.pop();for(;o;){for(const u of o)n.push(u);o=l.pop()}this.map.length=0}}function PM(e,n,r,l){let o=0;if(!(r===0&&l.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=r,e.map[o][2].push(...l);return}o+=1}e.map.push([n,r,l])}}function qM(e,n){let r=!1;const l=[];for(;n<e.length;){const o=e[n];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=l.length-1;l[u]=l[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return l}function FM(){return{flow:{null:{name:"table",tokenize:VM,resolveAll:GM}}}}function VM(e,n,r){const l=this;let o=0,u=0,d;return f;function f(z){let q=l.events.length-1;for(;q>-1;){const X=l.events[q][1].type;if(X==="lineEnding"||X==="linePrefix")q--;else break}const A=q>-1?l.events[q][1].type:null,L=A==="tableHead"||A==="tableRow"?_:m;return L===_&&l.parser.lazy[l.now().line]?r(z):L(z)}function m(z){return e.enter("tableHead"),e.enter("tableRow"),h(z)}function h(z){return z===124||(d=!0,u+=1),g(z)}function g(z){return z===null?r(z):Re(z)?u>1?(u=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),w):r(z):Ye(z)?at(e,g,"whitespace")(z):(u+=1,d&&(d=!1,o+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),d=!0,g):(e.enter("data"),v(z)))}function v(z){return z===null||z===124||St(z)?(e.exit("data"),g(z)):(e.consume(z),z===92?k:v)}function k(z){return z===92||z===124?(e.consume(z),v):v(z)}function w(z){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(z):(e.enter("tableDelimiterRow"),d=!1,Ye(z)?at(e,j,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):j(z))}function j(z){return z===45||z===58?N(z):z===124?(d=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),C):H(z)}function C(z){return Ye(z)?at(e,N,"whitespace")(z):N(z)}function N(z){return z===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),M):z===45?(u+=1,M(z)):z===null||Re(z)?$(z):H(z)}function M(z){return z===45?(e.enter("tableDelimiterFiller"),O(z)):H(z)}function O(z){return z===45?(e.consume(z),O):z===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(z))}function R(z){return Ye(z)?at(e,$,"whitespace")(z):$(z)}function $(z){return z===124?j(z):z===null||Re(z)?!d||o!==u?H(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(z)):H(z)}function H(z){return r(z)}function _(z){return e.enter("tableRow"),V(z)}function V(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),V):z===null||Re(z)?(e.exit("tableRow"),n(z)):Ye(z)?at(e,V,"whitespace")(z):(e.enter("data"),G(z))}function G(z){return z===null||z===124||St(z)?(e.exit("data"),V(z)):(e.consume(z),z===92?W:G)}function W(z){return z===92||z===124?(e.consume(z),G):G(z)}}function GM(e,n){let r=-1,l=!0,o=0,u=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,g,v;const k=new HM;for(;++r<e.length;){const w=e[r],j=w[1];w[0]==="enter"?j.type==="tableHead"?(f=!1,m!==0&&(Hy(k,n,m,h,g),g=void 0,m=0),h={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},k.add(r,0,[["enter",h,n]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(l=!0,v=void 0,u=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},k.add(r,0,[["enter",g,n]])),o=j.type==="tableDelimiterRow"?2:g?3:1):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(l=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],v=uc(k,n,u,o,void 0,v),u=[0,0,0,0]),d[2]=r)):j.type==="tableCellDivider"&&(l?l=!1:(u[1]!==0&&(d[0]=d[1],v=uc(k,n,u,o,void 0,v)),u=d,d=[u[1],r,0,0])):j.type==="tableHead"?(f=!0,m=r):j.type==="tableRow"||j.type==="tableDelimiterRow"?(m=r,u[1]!==0?(d[0]=d[1],v=uc(k,n,u,o,r,v)):d[1]!==0&&(v=uc(k,n,d,o,r,v)),o=0):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&Hy(k,n,m,h,g),k.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=qM(n.events,r))}return e}function uc(e,n,r,l,o,u){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},rs(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=rs(n.events,r[1]);if(u={type:d,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,n]]),r[2]!==0){const h=rs(n.events,r[2]),g=rs(n.events,r[3]),v={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",v,n]]),l!==2){const k=n.events[r[2]],w=n.events[r[3]];if(k[1].end=Object.assign({},w[1].end),k[1].type="chunkText",k[1].contentType="text",r[3]>r[2]+1){const j=r[2]+1,C=r[3]-r[2]-1;e.add(j,C,[])}}e.add(r[3]+1,0,[["exit",v,n]])}return o!==void 0&&(u.end=Object.assign({},rs(n.events,o)),e.add(o,0,[["exit",u,n]]),u=void 0),u}function Hy(e,n,r,l,o){const u=[],d=rs(n.events,r);o&&(o.end=Object.assign({},d),u.push(["exit",o,n])),l.end=Object.assign({},d),u.push(["exit",l,n]),e.add(r+1,0,u)}function rs(e,n){const r=e[n],l=r[0]==="enter"?"start":"end";return r[1][l]}const KM={name:"tasklistCheck",tokenize:YM};function WM(){return{text:{91:KM}}}function YM(e,n,r){const l=this;return o;function o(m){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return St(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),d):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),d):r(m)}function d(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Re(m)?n(m):Ye(m)?e.check({tokenize:XM},n,r)(m):r(m)}}function XM(e,n,r){return at(e,l,"whitespace");function l(o){return o===null?r(o):n(o)}}function QM(e){return tb([wM(),LM(),BM(e),FM(),WM()])}const ZM={};function nu(e){const n=this,r=e||ZM,l=n.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(QM(r)),u.push(yM()),d.push(vM(r))}const JM="modulepreload",e6=function(e){return"/"+e},Py={},t6=function(n,r,l){let o=Promise.resolve();if(r&&r.length>0){let m=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=d?.nonce||d?.getAttribute("nonce");o=m(r.map(h=>{if(h=e6(h),h in Py)return;Py[h]=!0;const g=h.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${v}`))return;const k=document.createElement("link");if(k.rel=g?"stylesheet":JM,g||(k.as="script"),k.crossOrigin="",k.href=h,f&&k.setAttribute("nonce",f),document.head.appendChild(k),g)return new Promise((w,j)=>{k.addEventListener("load",w),k.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return o.then(d=>{for(const f of d||[])f.status==="rejected"&&u(f.reason);return n().catch(u)})},n6=1500;function a6({code:e}){const[n,r]=b.useState(!1),l=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),n6)};return i.jsx("button",{type:"button",title:n?x.common.copied:x.chat.copyCode,"aria-label":x.chat.copyCode,onClick:l,className:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:i.jsx(We,{d:n?Gt.check:Gt.copy})})}function Vb({language:e,code:n,highlight:r=!0}){const[l,o]=b.useState(null);return b.useEffect(()=>{if(!r){o(null);return}let u=!0;return t6(()=>import("./index-CukW1Teq.js"),[]).then(d=>d.codeToHtml(n,{lang:e||"text",themes:{light:"github-light",dark:"github-dark"}})).then(d=>{u&&o(d)}).catch(()=>{u&&o(null)}),()=>{u=!1}},[n,e,r]),i.jsxs("div",{className:"code-block my-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 bg-gray-50 px-3 py-1 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("span",{className:"font-mono text-xs lowercase text-gray-500 dark:text-gray-400",children:e||"text"}),i.jsx(a6,{code:n})]}),i.jsx("div",{className:"overflow-x-auto bg-white text-[13px] leading-relaxed dark:bg-gray-950",children:l?i.jsx("div",{dangerouslySetInnerHTML:{__html:l}}):i.jsx("pre",{className:"m-0 px-3 py-2.5 font-mono text-gray-800 dark:text-gray-200",children:i.jsx("code",{children:n})})})]})}function r6(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(n=>typeof n=="string").join(""):""}function Gb({children:e,streaming:n}){if(b.isValidElement(e)){const r=e.props,l=/language-([\w+-]+)/.exec(r.className??"")?.[1]??"";return i.jsx(Vb,{language:l,code:r6(r.children).replace(/\n$/,""),highlight:!n})}return i.jsx("pre",{children:e})}function Kb({node:e,children:n,...r}){return i.jsx("a",{...r,target:"_blank",rel:"noreferrer",children:n})}const l6={pre:e=>i.jsx(Gb,{streaming:!0,children:e.children}),a:Kb},s6={pre:e=>i.jsx(Gb,{streaming:!1,children:e.children}),a:Kb},Wb=b.memo(function({text:n,streaming:r=!1}){return i.jsx(tu,{remarkPlugins:[nu],components:r?l6:s6,children:n})});function hl({src:e,alt:n,className:r}){const[l,o]=b.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"block cursor-zoom-in",onClick:()=>o(!0),children:i.jsx("img",{src:e,alt:n,className:r})}),l&&i.jsx(i6,{src:e,alt:n,onClose:()=>o(!1)})]})}function i6({src:e,alt:n,onClose:r}){return b.useEffect(()=>{const l=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),$i.createPortal(i.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-10",onMouseDown:l=>{l.target===l.currentTarget&&r()},children:i.jsxs("div",{className:"anim-pop relative",children:[i.jsx("button",{type:"button","aria-label":x.common.close,onClick:r,className:"absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full bg-black/50 text-white transition-colors duration-150 hover:bg-black/70",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}),i.jsx("img",{src:e,alt:n,className:"max-h-[85vh] max-w-[88vw] rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900"})]})}),document.body)}const o6=new Set(["txt","md","json","js","mjs","cjs","ts","tsx","jsx","py","sh","bash","yaml","yml","toml","css","html","htm","csv","log","xml","ini","conf","rs","go","java","c","h","cpp","hpp","sql","rb","php","png","jpg","jpeg","gif","webp","svg","pdf","doc","docx","xls","xlsx","ppt","pptx","zip","tar","gz","mp4","mp3","wav"]),c6=/^[a-z][a-z0-9+.-]*:\/\//i;function u6(e){const n=e.trim();if(n.length===0||n.length>200||/\s/.test(n)||c6.test(n)||n.startsWith("www."))return!1;const r=/\.([A-Za-z0-9]{1,8})$/.exec(n);if(!r)return!1;const l=r[1].toLowerCase();return/^\d+$/.test(l)?!1:o6.has(l)}const d6=512;function f6(e,n){const r=e.trim();if(r.length===0||r.length>d6||r.startsWith("~"))return null;const l=n!==null&&n.length>0?n:null,o=l?.includes("\\")??!1,u=o?"\\":"/",d=r.startsWith("/")||o&&(/^[A-Za-z]:/.test(r)||r.startsWith("\\"));let f=r;if(d){if(l===null||!r.startsWith(`${l}${u}`))return null;f=r.slice(l.length+u.length),u==="\\"&&(f=f.replaceAll("\\","/"))}const m=[];for(const h of f.split("/"))if(!(h===""||h===".")){if(h===".."){if(m.length===0)return null;m.pop();continue}m.push(h)}return m.length>0?m.join("/"):null}const qy=3;function m6(e){const n=[],r=new Set;for(const l of e.matchAll(/`([^`\n]+)`/g)){const o=l[1].trim();!u6(o)||r.has(o)||(r.add(o),n.push(o))}return n}function h6({path:e}){const n=e.lastIndexOf("/"),r=n>=0?e.slice(0,n+1):"",l=n>=0?e.slice(n+1):e;return i.jsxs("span",{className:"flex min-w-0 items-baseline font-mono text-sm",children:[r&&i.jsx("span",{className:"min-w-0 shrink-[9999] truncate text-gray-400 dark:text-gray-500",children:r}),i.jsx("span",{className:"min-w-0 truncate font-semibold text-gray-800 dark:text-gray-100",children:l})]})}function p6({text:e,workspace:n,statFiles:r,onOpenFile:l}){const o=b.useMemo(()=>{const v=[],k=new Set;for(const w of m6(e)){const j=f6(w,n);j===null||k.has(j)||(k.add(j),v.push(j))}return v},[e,n]),[u,d]=b.useState(null);b.useEffect(()=>{if(d(null),o.length===0)return;let v=!1;return r(o).then(k=>{v||d(o.filter(w=>k.has(w)))}).catch(()=>{}),()=>{v=!0}},[o,r]);const[f,m]=b.useState(!1);if(u===null||u.length===0)return null;const h=f?u:u.slice(0,qy),g=u.length-h.length;return i.jsxs("div",{className:"anim-msg my-3 overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800/60 dark:bg-gray-800/40",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,className:"shrink-0 text-gray-400",children:i.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:x.chat.filesInMessage(u.length)})]}),i.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[h.map(v=>i.jsxs("button",{type:"button",title:v,onClick:()=>l(v),className:"group flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,className:"shrink-0 text-gray-400",children:i.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),i.jsx(h6,{path:v}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-xs text-gray-400 transition-colors duration-150 group-hover:text-gray-600 dark:text-gray-500 dark:group-hover:text-gray-300",children:x.chat.openPreview})]},v)),(g>0||f)&&u.length>qy&&i.jsxs("button",{type:"button",onClick:()=>m(v=>!v),className:"flex w-full items-center gap-1.5 px-3 py-2 text-left text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50",children:[f?x.chat.showLess:x.chat.showMoreFiles(g),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:`transition-transform duration-200 ${f?"rotate-180":""}`,children:i.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})]})}const g6={waiting:"M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",done:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm-3.5-9.2 2.4 2.5 4.6-4.8",failed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9 9l6 6m0-6-6 6"},Fy={running:"text-emerald-500 dark:text-emerald-400",waiting:"text-amber-500 dark:text-amber-400",done:"text-gray-400 dark:text-gray-500",failed:"text-red-500 dark:text-red-400"};function Sh({state:e,size:n=13,label:r}){return e==="running"?i.jsx("span",{...r?{title:r,"aria-label":r,role:"status"}:{"aria-hidden":!0},style:{width:n,height:n},className:`inline-block shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent ${Fy.running}`}):i.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",...r?{role:"img","aria-label":r}:{"aria-hidden":!0},className:`block shrink-0 ${Fy[e]}`,children:[r&&i.jsx("title",{children:r}),i.jsx("path",{d:g6[e]})]})}function $c({sinceMs:e,offsetMs:n=0}){const[r,l]=b.useState(()=>Date.now());return b.useEffect(()=>{const o=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(o)},[]),e===void 0?i.jsx("span",{className:"animate-pulse",children:"…"}):i.jsx(i.Fragment,{children:G5(Math.max(0,n)+Math.max(0,r-e))})}function x6({item:e}){const[n,r]=b.useState(!1),l=e.stopReason!==void 0&&e.stopReason!=="completed",o=e.streaming?"running":l?"failed":"done",u=e.streaming?x.chat.workRunning:l?e.stopReason:x.chat.workDone;return i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>r(d=>!d),"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx(Sh,{state:o,label:u}),i.jsx("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:x.chat.thinking}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.streaming?i.jsx($c,{sinceMs:e.startedAtMs}):e.durationMs!==void 0?Jt(e.durationMs):null}),l&&i.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(ln,{open:n,className:"text-gray-400"})]}),n&&i.jsx("div",{className:"md-body anim-fade mx-3 mb-2 rounded-md bg-gray-50 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:bg-gray-900/60 dark:text-gray-400",children:i.jsx(Wb,{text:e.thinking,streaming:e.streaming})})]})}function y6({onDecide:e}){const[n,r]=b.useState(!1),l=async o=>{r(!0);try{await e(o)}finally{r(!1)}};return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ye,{size:"sm",variant:"primary",disabled:n,onClick:()=>{l("allow")},children:x.chat.approve}),i.jsx(ye,{size:"sm",disabled:n,onClick:()=>{l("deny")},children:x.chat.deny})]})}function Yb({sessionId:e,model:n,running:r,ctx:l}){const[o,u]=b.useState(r),d=b.useRef(!1),f=b.useRef(r),m={...l,...e?{origin:[...l.origin,e]}:{},taskRunning:r};return b.useEffect(()=>{f.current&&!r&&!d.current&&u(!1),f.current=r},[r]),i.jsxs("div",{className:"rounded-md border border-dashed border-gray-300 bg-gray-50/60 dark:border-gray-700 dark:bg-gray-900/40",children:[i.jsxs("button",{type:"button",onClick:()=>{d.current=!0,u(h=>!h)},className:"flex w-full items-center gap-2 rounded-t-md px-3 py-1.5 text-left text-xs text-gray-500 transition-colors duration-200 hover:bg-gray-100/70 dark:text-gray-400 dark:hover:bg-gray-800/50",children:[i.jsx(ln,{open:o}),i.jsx("span",{className:"font-semibold text-gray-700 dark:text-gray-300",children:x.chat.subagent}),e&&i.jsx("span",{className:"truncate font-mono text-gray-400",children:e}),r&&i.jsxs("span",{className:"ml-auto flex items-center gap-1 text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border border-gray-400 border-t-transparent"}),x.chat.subagentRunning]})]}),o&&i.jsx("div",{className:"anim-fade border-t border-dashed border-gray-200 px-3 py-1 dark:border-gray-800",children:i.jsx(Jb,{items:n.items,ctx:m})})]})}function v6(e,n){if(e==="exec_command"){const r=b6(n,"cmd");if(r!==null)return`$ ${r.replace(/\s+/g," ").trim()}`}return n.replace(/\s+/g," ").trim()}function b6(e,n){const r=`"${n}"`,l=e.indexOf(r);if(l===-1)return null;let o=l+r.length;for(;/\s/.test(e[o]??"");)o+=1;if(e[o]!==":")return null;for(o+=1;/\s/.test(e[o]??"");)o+=1;if(e[o]!=='"')return null;o+=1;let u="",d=!1;for(;o<e.length;o+=1){const f=e[o];if(d){u+=f==="n"?`
|
|
94
|
+
`:f==="t"?" ":f,d=!1;continue}if(f==="\\"){d=!0;continue}if(f==='"')return u;u+=f}return u}function k6({item:e,ctx:n}){const[r,l]=b.useState(!1),o=b.useRef(!1),u=n.pendingApprovals.get(us(n.origin,e.toolCallId)),d=e.subagentSessionId?[...n.origin,e.subagentSessionId].join("/"):null,f=d!==null&&[...n.pendingApprovals.keys()].some(j=>j.startsWith(`${d} `)||j.startsWith(`${d}/`));b.useEffect(()=>{f&&!o.current&&l(!0)},[f]);const m=v6(e.name,e.argumentsText),h=e.callComplete&&!e.outputComplete&&!u,g=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0,v=e.callStopReason!==void 0&&e.callStopReason!=="completed"||e.outputStopReason!==void 0&&e.outputStopReason!=="completed",k=u?"waiting":h||e.callStreaming?"running":v?"failed":"done",w=u?x.chat.approvalWaiting:k==="running"?x.chat.workRunning:k==="done"?x.chat.workDone:e.outputStopReason??e.callStopReason;return i.jsxs("div",{children:[i.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{o.current=!0,l(j=>!j)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx(Sh,{state:k,label:w}),i.jsx("span",{className:"shrink-0 truncate font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:e.name||x.chat.unknownTool}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.durationMs!==void 0?Jt(e.durationMs):h?i.jsx($c,{sinceMs:e.approvalAtMs??e.callStartedAtMs,offsetMs:g}):u?g>0?Jt(g):null:e.callStreaming?e.argStartedAtMs!==void 0?i.jsx($c,{sinceMs:e.argStartedAtMs}):i.jsx("span",{className:"animate-pulse",children:"…"}):null}),u&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-amber-600 dark:text-amber-400",children:x.chat.approvalWaiting}),e.callStopReason&&e.callStopReason!=="completed"&&i.jsx(Rt,{tone:fm(e.callStopReason),children:e.callStopReason}),e.outputStopReason&&e.outputStopReason!=="completed"&&i.jsx(Rt,{tone:fm(e.outputStopReason),children:e.outputStopReason}),e.decision&&i.jsxs(Rt,{tone:e.decision==="allow"?"green":"red",children:[e.decision==="allow"?x.chat.decisionAllow:x.chat.decisionDeny," · ",e.decisionSource==="manual"?x.chat.decisionManual:x.chat.decisionAuto]}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(ln,{open:r,className:"text-gray-400"})]}),u&&i.jsxs("div",{className:"border-t border-gray-100 bg-amber-50 px-3 py-2 dark:border-gray-800 dark:bg-amber-950/30",children:[i.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"shrink-0 rounded-md bg-white px-1.5 py-0.5 font-mono text-xs font-semibold text-gray-700 dark:bg-gray-900 dark:text-gray-300",children:e.name||x.chat.unknownTool}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-600 dark:text-gray-400",children:m})]}),i.jsx(y6,{onDecide:j=>n.onApprove(e.toolCallId,j,n.origin)})]}),r&&i.jsxs("div",{className:"anim-fade",children:[e.argumentsText&&i.jsx("pre",{className:"whitespace-pre-wrap break-all border-t border-gray-100 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-400",children:e.argumentsText}),(e.output||e.outputStreaming)&&i.jsxs("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap border-t border-gray-100 px-3 py-2 text-xs leading-5 text-gray-600 dark:border-gray-800 dark:text-gray-300",children:[e.output,e.outputStreaming&&i.jsx("span",{className:"animate-pulse",children:"▌"})]}),e.images&&e.images.length>0&&i.jsx("div",{className:"flex flex-wrap gap-2 border-t border-gray-100 px-3 py-2 dark:border-gray-800",children:e.images.map((j,C)=>i.jsx(hl,{src:j,alt:x.chat.toolImageAlt,className:"max-h-40 max-w-full rounded-md border border-gray-200 dark:border-gray-700"},C))})]}),e.subagent&&i.jsx("div",{className:"px-3 pb-2 pt-2",children:i.jsx(Yb,{sessionId:e.subagentSessionId??"",model:e.subagent,running:!e.outputComplete,ctx:n})})]})}function w6({item:e}){if(e.running)return i.jsxs("div",{className:"anim-msg my-2 flex items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300",children:[i.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}),x.chat.compactionRunning(e.mode)]});const n=e.status==="completed"?x.chat.compactionDone(e.mode):x.chat.compactionFailed(e.status??"failed");return i.jsx("p",{className:"my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:n})}function S6(e){return e.agentName&&e.agentName!==e.agentId?`${e.agentName} (@${e.agentId})`:`@${e.agentId}`}function j6({origin:e}){const n=ia(),r=x.chat.handoffFrom(S6(e)),l="anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400";if(!e.sessionId)return i.jsx("p",{className:l,children:r});const o=e.sessionId;return i.jsxs("button",{type:"button",title:x.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${o}`),className:`${l} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[r,i.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function N6({origin:e}){return i.jsxs("p",{className:"anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[x.chat.scheduledFrom(e.name),e.firedAt&&i.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:$n(e.firedAt)})]})}const jh="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z";function Xb(e,n){if(e.length===0)return n;const r=`<use_skills>
|
|
95
|
+
skills: ${e.join(", ")}
|
|
96
|
+
</use_skills>`;return n?`${r}
|
|
97
|
+
|
|
98
|
+
${n}`:r}function C6(e){const n=/^<use_skills>\nskills: ([^\n]+)\n<\/use_skills>/.exec(e);if(!n)return null;const r=n[1].split(",").map(l=>l.trim()).filter(l=>l.length>0);return r.length===0?null:{skills:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}}function T6(e,n,r){return e==="zh"&&r?r:n}function qi(e,n){return e==="zh"?n.shortDescriptionZh||n.shortDescription||n.description:n.shortDescription||n.description}function E6(e,n,r){const l=r.trim().toLowerCase();return l?e.filter(o=>o.name.toLowerCase().includes(l)||qi(n,o).toLowerCase().includes(l)):e}function M6(e,n){return e.map(r=>({name:r.name,cmd:`/${r.name}`,desc:qi(n,r)}))}function A6({names:e}){return i.jsxs("p",{className:"anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[i.jsx(We,{d:jh,className:"text-gray-400 dark:text-gray-500"}),x.chat.skillsBanner(e)]})}const R6=/^[\w-]*$/;function Vy(e,n){const r=e.slice(0,n),l=r.lastIndexOf("@");if(l<0||l>0&&!/\s/.test(r[l-1]))return null;const o=r.slice(l+1);if(!R6.test(o))return null;const u=/^[\w-]*/.exec(e.slice(n))[0];return{start:l,end:n+u.length,query:o}}function L6(e,n){const r=n.toLowerCase();return e.filter(l=>l.agentId.toLowerCase().startsWith(r)||(l.name??"").toLowerCase().startsWith(r))}function _6(e,n){const r=/^@([\w-]+)([\s\S]*)$/.exec(e);if(!r)return null;const l=n.find(o=>o.agentId===r[1]);return l?{agent:l,rest:r[2].trimStart()}:null}function Qb(e){const n=e.agentName&&e.agentName!==e.agentId?` (${e.agentName})`:"",r=[`agent: ${e.agentId}${n}`];if(e.sessionId){const l=e.sessionTitle?` (${e.sessionTitle})`:"";r.push(`session: ${e.sessionId}${l}`)}return e.workspace&&r.push(`workspace: ${e.workspace}`),["<handoff_from>","This conversation was opened by @-mentioning you from another conversation; its origin is listed below and the user's message, if any, follows. When the request refers to an agent, session, or files without naming them, it means this origin.",...r,"</handoff_from>"].join(`
|
|
99
|
+
`)}function I6(e){const n=/^<handoff_from>\n([\s\S]*)\n<\/handoff_from>$/.exec(e.trim());if(!n)return null;const r={agentId:""};for(const l of n[1].split(`
|
|
100
|
+
`)){const o=/^(agent|session|workspace): (.+)$/.exec(l);if(!o)continue;const u=o[1],d=o[2];if(u==="workspace"){r.workspace=d;continue}const f=/^([\w-]+) \((.*)\)$/.exec(d),m=f?f[1]:d,h=f?.[2];u==="agent"?(r.agentId=m,h!==void 0&&(r.agentName=h)):(r.sessionId=m,h!==void 0&&(r.sessionTitle=h))}return r.agentId?r:null}function z6(e){const n=/^<scheduled_task>\n([\s\S]*?)\n<\/scheduled_task>/.exec(e);if(!n)return null;const r={name:"",firedAt:""};for(const l of n[1].split(`
|
|
101
|
+
`)){const o=/^(schedule|fired_at): (.+)$/.exec(l);o&&(o[1]==="schedule"?r.name=o[2]:r.firedAt=o[2])}return r.name?{origin:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}:null}function mi({icon:e,value:n,label:r}){return i.jsxs("span",{title:r,"aria-label":r,className:"flex items-center gap-1",children:[i.jsx(We,{d:e}),n]})}function D6({stats:e,assistantText:n,cost:r,atMs:l}){const[o,u]=b.useState(!1),{currency:d}=xl(),{locale:f}=Ca(),m=e?.tokensByBucket,h=m?m.cacheRead+m.cacheWrite:0,g=()=>{const v=n?.trim()||e===null?n??"":s4(e,{stats:x.chat.statsLabel,input:x.chat.statInput,cached:x.chat.statCached,output:x.chat.statOutput,parenOpen:x.chat.statParenOpen,parenClose:x.chat.statParenClose});navigator.clipboard?.writeText(v).then(()=>{u(!0),setTimeout(()=>u(!1),1500)})};return i.jsxs("div",{className:"-mt-2 flex h-5 flex-wrap items-center justify-start gap-x-3 text-[11px] text-gray-400 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 dark:text-gray-500",children:[l!==void 0&&i.jsx("span",{children:_v(l,f)}),e&&m&&i.jsxs(i.Fragment,{children:[i.jsx(mi,{icon:Gt.input,value:ft(h),label:x.chat.statInput}),i.jsx(mi,{icon:Gt.output,value:ft(m.output),label:x.chat.statOutput}),i.jsx(mi,{icon:Gt.tps,value:Rc(e.outputTps),label:x.chat.statTps}),r!=null&&i.jsx(mi,{icon:Gt.cost,value:la(r,d),label:`${x.chat.statCost}(${d})`}),i.jsx(mi,{icon:Gt.elapsed,value:Jt(e.elapsedDeltaMs),label:x.chat.statElapsed})]}),i.jsx("button",{type:"button",title:o?x.chat.copied:x.chat.copyReply,"aria-label":x.chat.copyReply,onClick:g,className:"flex h-5 w-5 items-center justify-center rounded transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:i.jsx(We,{d:o?Gt.check:Gt.copy})})]})}const O6=1200;function Ff({atMs:e,text:n,align:r="left"}){const{locale:l}=Ca(),[o,u]=b.useState(!1),d=()=>{n!==void 0&&(navigator.clipboard.writeText(n),u(!0),setTimeout(()=>u(!1),O6))};return i.jsxs("div",{className:`flex h-5 items-center gap-2 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 ${r==="right"?"justify-end":"justify-start"}`,children:[e!==void 0&&i.jsx("span",{className:"text-[11px] text-gray-400",children:_v(e,l)}),n!==void 0&&i.jsx("button",{type:"button",title:o?x.chat.copied:x.chat.copyMessage,"aria-label":x.chat.copyMessage,onClick:d,className:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:i.jsx(We,{d:o?Gt.check:Gt.copy})})]})}function Zb({item:e,ctx:n}){switch(e.kind){case"user_text":{const r=I6(e.text);if(r)return i.jsx(j6,{origin:r});const l=z6(e.text),o=l?l.rest:e.text,u=C6(o),{text:d,images:f}=M4(u?u.rest:o);return i.jsxs(i.Fragment,{children:[l&&i.jsx(N6,{origin:l.origin}),u&&i.jsx(A6,{names:u.skills}),d&&i.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[i.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 px-4 py-2.5 md:max-w-[75%] dark:bg-gray-800",children:i.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:d})}),i.jsx(Ff,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:d,align:"right"})]}),f.map((m,h)=>i.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[i.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:i.jsx(hl,{src:m,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),i.jsx(Ff,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]},h))]})}case"user_image":return i.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[i.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:i.jsx(hl,{src:e.imageUrl,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),i.jsx(Ff,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]});case"assistant_text":return i.jsxs("div",{className:"md-body anim-msg my-3 text-base leading-relaxed text-gray-800 dark:text-gray-100",children:[i.jsx(Wb,{text:e.text,streaming:e.streaming}),e.streaming&&i.jsx("span",{className:"animate-pulse text-gray-400",children:"▌"}),e.stopReason&&e.stopReason!=="completed"&&i.jsxs("span",{className:"ml-1 font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),!e.streaming&&n.onOpenFile&&n.statFiles&&i.jsx(p6,{text:e.text,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile})]});case"thinking":return i.jsx(x6,{item:e});case"tool_call":return i.jsx(k6,{item:e,ctx:n});case"subagent":return i.jsx("div",{className:"anim-msg my-2",children:i.jsx(Yb,{sessionId:e.sessionId,model:e.model,running:!1,ctx:n})});case"abort":return i.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:x.chat.aborted(e.reason)});case"reconnect":return i.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-amber-600 dark:text-amber-500",children:x.chat.reconnect(e.status,e.gaveUp?"gaveUp":e.retrying?"retried":"waiting",e.attempt)});case"compaction":return i.jsx(w6,{item:e});case"task_stats":return i.jsx(D6,{stats:e.stats,assistantText:e.assistantText,cost:e.stats?n.taskCost?.(e.stats)??null:null,...e.atMs!==void 0?{atMs:e.atMs}:{}})}}function U6(e){let n=0,r=0,l,o;const u=m=>{m!==void 0&&(l===void 0||m<l)&&(l=m)},d=(m,h)=>{if(h<=0)return;if(m===void 0){r+=h;return}u(m);const g=m+h;(o===void 0||g>o)&&(o=g)};for(const m of e){if(m.kind==="thinking"){u(m.startedAtMs),m.durationMs!==void 0&&d(m.startedAtMs,m.durationMs);continue}if(m.kind!=="tool_call"||(n+=1,u(m.argStartedAtMs??m.callStartedAtMs??m.approvalAtMs),m.durationMs===void 0))continue;const h=m.argStartedAtMs!==void 0&&m.callStartedAtMs!==void 0?Math.min(m.durationMs,Math.max(0,m.callStartedAtMs-m.argStartedAtMs)):0;d(m.argStartedAtMs,h),d(m.approvalAtMs??m.callStartedAtMs,m.durationMs-h)}const f=l!==void 0&&o!==void 0?o-l:0;return{steps:n,durationMs:f+r,...l!==void 0?{startMs:l}:{}}}function $6(e){return e.kind==="thinking"||e.kind==="tool_call"}function B6(e,n){return e.kind==="thinking"?e.streaming:e.kind==="tool_call"?e.callStreaming||e.outputStreaming||e.callComplete&&!e.outputComplete?!0:n.pendingApprovals.has(us(n.origin,e.toolCallId)):!1}function H6(e,n){return e.some(r=>r.kind==="tool_call"&&n.pendingApprovals.has(us(n.origin,r.toolCallId)))}function P6({items:e,ctx:n,isLast:r}){const l=e.some(w=>B6(w,n)),o=r&&n.taskRunning||l,u=H6(e,n),[d,f]=b.useState(r),m=b.useRef(!1);b.useEffect(()=>{m.current||f(r)},[r]);const h=d||u,{steps:g,durationMs:v,startMs:k}=U6(e);return i.jsxs("div",{className:"anim-msg my-2 overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("button",{type:"button","aria-expanded":h,onClick:()=>{m.current=!0,f(w=>!w)},className:"flex w-full items-center gap-2 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[i.jsx(Sh,{state:o?"running":"done",size:12}),i.jsx("span",{className:`shrink-0 text-[11px] font-semibold uppercase tracking-wide ${o?"text-emerald-600 dark:text-emerald-400":"text-gray-500 dark:text-gray-400"}`,children:o?x.chat.workRunning:x.chat.workDone}),g>0&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:x.chat.workGroupSteps(g)}),l?k!==void 0&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:i.jsx($c,{sinceMs:k})}):v>0&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:Jt(v)}),u&&!h&&i.jsx("span",{className:"shrink-0 rounded bg-amber-100 px-1 text-[10px] font-medium text-amber-700 dark:bg-amber-950/50 dark:text-amber-300",children:x.chat.approvalWaiting}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(ln,{open:h,className:"text-gray-400"})]}),h&&i.jsx("div",{className:"anim-fade divide-y divide-gray-100 border-t border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:e.map(w=>i.jsx(Zb,{item:w,ctx:n},w.id))})]})}function q6(){let e=!0,n=null,r=null;return{get stick(){return e},wheel(l){l<0&&(e=!1)},touchStart(l){r=l},touchMove(l){r!==null&&l>r&&(e=!1),r=l},touchEnd(){r=null},scrolled(l){const o=l.scrollHeight-l.scrollTop-l.clientHeight,u=n;if(n=l.scrollTop,u===null){e=o<80;return}if(l.scrollTop<u&&o>1){e=!1;return}o<80&&(e=!0)},resume(){e=!0,n=null}}}function Jb({items:e,ctx:n}){const r=[];let l=[];const o=()=>{l.length>0&&(r.push({type:"group",items:l}),l=[])};for(const h of e)$6(h)?l.push(h):(o(),r.push({type:"single",item:h}));o();const u=(h,g)=>h.type==="group"?i.jsx(P6,{items:h.items,ctx:n,isLast:g===r.length-1},`wg-${h.items[0].id}`):i.jsx(Zb,{item:h.item,ctx:n},h.item.id),d=[];let f=[];const m=()=>{if(f.length===0)return;const h=f[0].seg,g=h.type==="group"?h.items[0].id:h.item.id,v=f;f=[],d.push(i.jsx("div",{className:"group",children:v.map(k=>u(k.seg,k.i))},`turn-${g}`))};for(let h=0;h<r.length;h++){const g=r[h];if(g.type==="single"&&(g.item.kind==="user_text"||g.item.kind==="user_image")){m(),d.push(u(g,h));continue}f.push({seg:g,i:h}),g.type==="single"&&g.item.kind==="task_stats"&&m()}return m(),i.jsx(i.Fragment,{children:d})}function F6({items:e,version:n,ctx:r}){const l=b.useRef(null),o=b.useRef(null),u=o.current??=q6(),[d,f]=b.useState(!1),m=b.useRef(!1),h=b.useRef(null),g=()=>{h.current!==null&&(cancelAnimationFrame(h.current),h.current=null),m.current=!1};b.useEffect(()=>()=>g(),[]);const v=b.useRef(null),k=()=>{const C=l.current;f(!m.current&&!u.stick&&C!==null&&C.scrollHeight-C.scrollTop-C.clientHeight>1)},w=()=>{const C=l.current;if(!C)return;const N=v.current;v.current=C.scrollTop,m.current&&N!==null&&C.scrollTop<N-1&&g(),u.scrolled({scrollTop:C.scrollTop,scrollHeight:C.scrollHeight,clientHeight:C.clientHeight}),k()};b.useLayoutEffect(()=>{const C=l.current;C&&u.stick&&!m.current&&(C.scrollTop=C.scrollHeight),k()},[n,u]);const j=()=>{const C=l.current;if(!C)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){u.resume(),C.scrollTop=C.scrollHeight,k();return}g(),m.current=!0,C.scrollHeight-C.clientHeight-C.scrollTop>3*C.clientHeight&&(C.scrollTop=C.scrollHeight-4*C.clientHeight);let M=performance.now();const O=R=>{h.current=null;const $=l.current;if(!$||!m.current)return;const H=Math.min(.05,Math.max(.001,(R-M)/1e3));M=R;const _=$.scrollHeight-$.clientHeight-$.scrollTop;if(_<=1){m.current=!1,u.resume(),$.scrollTop=$.scrollHeight,k();return}const V=Math.max(_*Math.min(1,H*10),3200*H);$.scrollTop+=Math.min(V,_),h.current=requestAnimationFrame(O)};h.current=requestAnimationFrame(O),k()};return i.jsxs("div",{className:"relative h-full min-h-0",children:[i.jsx("div",{ref:l,onScroll:w,onWheel:C=>{u.wheel(C.deltaY),C.deltaY<0&&g(),k()},onTouchStart:C=>{const N=C.touches[0];N&&u.touchStart(N.clientY)},onTouchMove:C=>{const N=C.touches[0];N&&u.touchMove(N.clientY),m.current&&g(),k()},onTouchEnd:()=>u.touchEnd(),className:"anim-fade h-full overflow-y-auto px-4 py-4 md:px-6",children:i.jsx("div",{className:"mx-auto max-w-3xl",children:e.length===0?i.jsx(Or,{title:x.chat.emptyStream}):i.jsx(Jb,{items:e,ctx:r})})}),d&&i.jsx("button",{type:"button","aria-label":x.chat.jumpToLatest,title:x.chat.jumpToLatest,onClick:j,className:"anim-pop absolute bottom-3 left-1/2 z-10 -translate-x-1/2 rounded-full border border-gray-300 bg-white p-1.5 text-gray-500 shadow-sm transition-colors duration-150 hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M12 5v14M6 13l6 6 6-6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}const V6=128e3;function ek(e){const n=typeof e=="string"?Number(e):e;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:V6}const G6=/[\s"'/]on[a-z]+\s*=/i,K6=/href\s*=/i;function W6(e){if(!e)return null;const n=e.trim();if(!/^<svg[\s>]/i.test(n))return null;const r=n.toLowerCase();return r.includes("<script")||r.includes("foreignobject")||K6.test(n)||G6.test(n)?null:n}const Vf=["bg-sky-50 text-sky-600 dark:bg-sky-950/60 dark:text-sky-400","bg-emerald-50 text-emerald-600 dark:bg-emerald-950/60 dark:text-emerald-400","bg-violet-50 text-violet-600 dark:bg-violet-950/60 dark:text-violet-400","bg-amber-50 text-amber-600 dark:bg-amber-950/60 dark:text-amber-400","bg-rose-50 text-rose-600 dark:bg-rose-950/60 dark:text-rose-400","bg-cyan-50 text-cyan-600 dark:bg-cyan-950/60 dark:text-cyan-400","bg-indigo-50 text-indigo-600 dark:bg-indigo-950/60 dark:text-indigo-400","bg-teal-50 text-teal-600 dark:bg-teal-950/60 dark:text-teal-400"],Y6={firecrawl:3,"data-analysis":1,"web-design":2,"penguin-sdk":0};function X6(e){const n=Y6[e];if(n!==void 0)return Vf[n];let r=0;for(let l=0;l<e.length;l++)r=r*31+e.charCodeAt(l)>>>0;return Vf[r%Vf.length]}function Nh({icon:e,size:n=20,className:r=""}){const l=W6(e);return l?i.jsx("span",{"aria-hidden":!0,style:{width:n,height:n},className:`block shrink-0 [&>svg]:block [&>svg]:h-full [&>svg]:w-full ${r}`,dangerouslySetInnerHTML:{__html:l}}):i.jsx(We,{d:jh,size:n,className:r})}const Gy={viewBox:"-0.76 -0.47 28.6 28.6",path:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M26.59,15.92L22.82,13.75C22.92,13.59,22.97,13.4,22.97,13.21L22.97,12.05C22.97,11.66,22.76,11.31,22.43,11.12L21.42,10.54C21.09,10.34,20.68,10.34,20.35,10.54L17.26,12.32C16.93,12.51,16.73,12.86,16.73,13.25L16.73,14.41C16.73,14.79,16.93,15.15,17.26,15.34L24.51,19.53C24.84,19.72,25.25,19.72,25.58,19.53L26.59,18.94C26.92,18.75,27.13,18.4,27.13,18.01L27.13,16.85C27.13,16.47,26.92,16.11,26.59,15.92L26.59,15.92Z"}),i.jsx("path",{d:"M21.88,3.58L18.11,5.75C18.02,5.59,17.89,5.46,17.72,5.36L16.71,4.78C16.38,4.59,15.97,4.59,15.64,4.78L14.63,5.36C14.3,5.55,14.09,5.9,14.09,6.29L14.09,9.86C14.09,10.24,14.3,10.59,14.63,10.78L15.64,11.37C15.97,11.56,16.38,11.56,16.71,11.37L23.96,7.18C24.29,6.99,24.5,6.64,24.5,6.25L24.5,5.09C24.5,4.71,24.29,4.35,23.96,4.16L22.95,3.58C22.62,3.39,22.21,3.39,21.88,3.58L21.88,3.58Z"}),i.jsx("path",{d:"M8.83,1.48L8.83,5.83C8.65,5.83,8.46,5.88,8.3,5.98L7.29,6.56C6.95,6.75,6.75,7.11,6.75,7.49L6.75,8.65C6.75,9.04,6.95,9.39,7.29,9.58L10.37,11.37C10.71,11.56,11.11,11.56,11.45,11.37L12.45,10.78C12.79,10.59,12.99,10.24,12.99,9.85L12.99,1.48C12.99,1.1,12.79,0.75,12.45,0.56L11.45,-0.03C11.11,-0.22,10.71,-0.22,10.37,-0.03L9.37,0.56C9.03,0.75,8.83,1.1,8.83,1.48L8.83,1.48Z"}),i.jsx("path",{d:"M0.5,11.74L4.26,13.91C4.17,14.07,4.12,14.26,4.12,14.45L4.12,15.61C4.12,16,4.32,16.35,4.65,16.54L5.66,17.13C6,17.32,6.4,17.32,6.73,17.13L9.82,15.34C10.15,15.15,10.36,14.8,10.36,14.41L10.36,13.25C10.36,12.87,10.15,12.51,9.82,12.32L2.57,8.14C2.24,7.94,1.84,7.94,1.5,8.14L0.5,8.72C0.16,8.91,-0.04,9.26,-0.04,9.65L-0.04,10.81C-0.04,11.19,0.16,11.55,0.5,11.74Z"}),i.jsx("path",{d:"M5.21,24.08L8.97,21.91C9.07,22.07,9.2,22.21,9.37,22.3L10.38,22.88C10.71,23.08,11.11,23.08,11.45,22.88L12.46,22.3C12.79,22.11,12.99,21.76,12.99,21.37L12.99,17.81C12.99,17.42,12.79,17.07,12.46,16.88L11.45,16.29C11.11,16.1,10.71,16.1,10.38,16.29L3.13,20.48C2.8,20.67,2.59,21.02,2.59,21.41L2.59,22.57C2.59,22.95,2.8,23.31,3.13,23.5L4.14,24.08C4.47,24.28,4.88,24.28,5.21,24.08L5.21,24.08Z"}),i.jsx("path",{d:"M18.26,26.18L18.26,21.83C18.44,21.83,18.63,21.78,18.79,21.68L19.8,21.1C20.13,20.91,20.34,20.56,20.34,20.17L20.34,19.01C20.34,18.62,20.13,18.27,19.8,18.08L16.71,16.3C16.38,16.1,15.97,16.1,15.64,16.3L14.63,16.88C14.3,17.07,14.1,17.42,14.1,17.81L14.1,26.18C14.1,26.56,14.3,26.91,14.63,27.11L15.64,27.69C15.97,27.88,16.38,27.88,16.71,27.69L17.72,27.11C18.05,26.91,18.26,26.56,18.26,26.18L18.26,26.18Z"})]})},Q6={anthropic:{path:i.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})},openai:{path:i.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})},google:{path:i.jsx("path",{d:"M12 24A14.304 14.304 0 0 0 0 12 14.304 14.304 0 0 0 12 0a14.305 14.305 0 0 0 12 12 14.305 14.305 0 0 0-12 12"})},deepseek:{path:i.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.328.14a5.526 5.526 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 0 1-.465.137 9.597 9.597 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.034-.237.23-.256a4.173 4.173 0 0 0 1.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.615zm1-6.44a.306.306 0 0 1 .415-.287.302.302 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 0 1-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.191-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.196-.02.354-.25.452z"})},zhipu:{path:i.jsx("path",{d:"M4.6 3.2h14.8a.9.9 0 0 1 .73 1.43L9.9 18.6h9.2a.9.9 0 0 1 0 1.8H4.6a.9.9 0 0 1-.73-1.43L14.1 5.4H4.6a1.1 1.1 0 0 1 0-2.2Z"})},moonshot:{path:i.jsx("path",{d:"m1.053 16.91 9.538 2.55a21 20.981 0 0 0 .06 2.031l5.956 1.592a12 11.99 0 0 1-15.554-6.172m-1.02-5.79 11.352 3.035a21 20.981 0 0 0-.469 2.01l10.817 2.89a12 11.99 0 0 1-1.845 2.004L.658 15.918a12 11.99 0 0 1-.625-4.796m1.593-5.146L13.573 9.17a21 20.981 0 0 0-1.01 1.874l11.297 3.02a21 20.981 0 0 1-.67 2.362l-11.55-3.087L.125 10.26a12 11.99 0 0 1 1.499-4.285ZM6.067 1.58l11.285 3.016a21 20.981 0 0 0-1.688 1.719l7.824 2.091a21 20.981 0 0 1 .513 2.664L2.107 5.218a12 11.99 0 0 1 3.96-3.638M21.68 4.866 7.222 1.003A12 11.99 0 0 1 21.68 4.866"})},openrouter:{path:i.jsx("path",{d:"M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z"})},siliconflow:{viewBox:"0 0 53.021 25.354",path:i.jsx("path",{d:"M50.7172 0H27.6622C26.3877 0 25.3586 1.03397 25.3586 2.30358V9.21911C25.3586 10.4935 24.3294 11.5227 23.055 11.5227H2.30357C1.02914 11.5227 0 12.5567 0 13.8263V23.0502C0 24.3246 1.03395 25.3538 2.30357 25.3538H25.3586C26.633 25.3538 27.6622 24.3198 27.6622 23.0502V16.1347C27.6622 14.8602 28.6913 13.8311 29.9657 13.8311H50.7172C51.9916 13.8311 53.0207 12.7971 53.0207 11.5275V2.30358C53.0207 1.02916 51.9868 0 50.7172 0Z"})},"qwen-token-plan":Gy,"qwen-pay-as-you-go":Gy,fireworks:{viewBox:"0 0 638 315",path:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M318.563 221.755C300.863 221.755 284.979 211.247 278.206 194.978L196.549 0H244.342L318.842 178.361L393.273 0H441.066L358.92 195.048C352.112 211.247 336.263 221.755 318.563 221.755Z"}),i.jsx("path",{d:"M425.111 314.933C407.481 314.933 391.667 304.494 384.824 288.366C377.947 272.097 381.507 253.524 393.936 240.921L542.657 90.2803L561.229 134.094L425.076 271.748L619.147 270.666L637.72 314.479L425.146 315.003L425.076 314.933H425.111Z"}),i.jsx("path",{d:"M0 314.408L18.5727 270.595L212.643 271.677L76.525 133.988L95.0977 90.1748L243.819 240.816C256.247 253.384 259.843 272.026 252.93 288.26C246.088 304.424 230.203 314.827 212.643 314.827L0.0698221 314.339L0 314.408Z"})]})},custom:{stroke:!0,path:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 2.8 20.5 7.4v9.2L12 21.2 3.5 16.6V7.4L12 2.8Z"}),i.jsx("path",{d:"M3.5 7.4 12 12l8.5-4.6M12 12v9.2"})]})}};function _i({provider:e,className:n}){const r=Q6[e];if(!r){const l=Ev(e);return i.jsxs("svg",{viewBox:"0 0 24 24",className:n,style:{"--tile-fg":l.fg,"--tile-fg-dark":l.fgDark},"aria-hidden":!0,children:[i.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:l.bg}),i.jsx("text",{x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",fontSize:"13",fontWeight:"700",className:"[fill:var(--tile-fg)] dark:[fill:var(--tile-fg-dark)]",children:Mv(e)})]})}return i.jsx("svg",{viewBox:r.viewBox??"0 0 24 24",className:n,"aria-hidden":!0,...r.stroke?{fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinejoin:"round"}:{fill:"currentColor"},children:r.path})}var Mt="https://openrouter.ai/api/v1",Qa="https://api.siliconflow.cn/v1",ls="https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",bi="https://dashscope.aliyuncs.com/compatible-mode/v1",ss="https://api.fireworks.ai/inference/v1",Ur=[{id:"deepseek",label:"DeepSeek",envKey:"DEEPSEEK_API_KEY",envBaseUrlKey:"DEEPSEEK_BASE_URL",apiKeyUrl:"https://platform.deepseek.com/api_keys",modelsUrl:"https://api-docs.deepseek.com/quick_start/pricing"},{id:"openrouter",label:"OpenRouter",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://openrouter.ai/workspaces/default/keys",modelsUrl:"https://openrouter.ai/models",gatewayBaseUrl:Mt},{id:"fireworks",label:"Fireworks AI",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://app.fireworks.ai/settings/users/api-keys",modelsUrl:"https://app.fireworks.ai/models",gatewayBaseUrl:ss},{id:"siliconflow",label:"SiliconFlow",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://cloud.siliconflow.cn/me/account/ak",modelsUrl:"https://cloud.siliconflow.cn/models",gatewayBaseUrl:Qa},{id:"qwen-token-plan",label:"Qwen Token Plan",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://platform.qianwenai.com/pricing/token-plan",modelsUrl:"https://platform.qianwenai.com/docs/token-plan/personal/token-plan-personal-overview",gatewayBaseUrl:ls},{id:"qwen-pay-as-you-go",label:"Qwen Pay-As-You-Go",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://platform.qianwenai.com/docs/api-reference/preparation/api-key",modelsUrl:"https://www.qianwenai.com/models",gatewayBaseUrl:bi},{id:"google",label:"Google Gemini",envKey:"GEMINI_API_KEY",envBaseUrlKey:"GEMINI_BASE_URL",apiKeyUrl:"https://aistudio.google.com/api-keys",modelsUrl:"https://ai.google.dev/gemini-api/docs/models"},{id:"anthropic",label:"Anthropic",envKey:"ANTHROPIC_API_KEY",envBaseUrlKey:"ANTHROPIC_BASE_URL",apiKeyUrl:"https://platform.claude.com/settings/keys",modelsUrl:"https://docs.claude.com/en/docs/about-claude/models/overview"},{id:"openai",label:"OpenAI",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://platform.openai.com/api-keys",modelsUrl:"https://platform.openai.com/docs/models"},{id:"zhipu",label:"Z.AI (GLM)",envKey:"ZAI_API_KEY",envBaseUrlKey:"ZAI_BASE_URL",apiKeyUrl:"https://open.bigmodel.cn/apikey/platform",modelsUrl:"https://docs.z.ai/guides/overview/pricing"},{id:"moonshot",label:"Moonshot (Kimi)",envKey:"MOONSHOT_API_KEY",envBaseUrlKey:"MOONSHOT_BASE_URL",apiKeyUrl:"https://platform.kimi.com/console/api-keys",modelsUrl:"https://platform.kimi.com/docs/pricing"},{id:"custom",label:"Custom",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}];function Zt(e,n,r){const l=o=>Math.round(o/7*1e6)/1e6;return _e(l(e),l(n),l(r))}function _e(e,n,r){return{unit:"usd_per_mtok",cache_read:e,cache_write:n,output:r}}var tk=[{modelId:"deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"deepseek",contextWindow:1e6,pricing:Zt(.02,1,2),supportsVision:!1},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"deepseek",contextWindow:1e6,pricing:Zt(.025,3,6),supportsVision:!1},{modelId:"anthropic/claude-fable-5",displayName:"Claude Fable 5",provider:"openrouter",contextWindow:1e6,pricing:_e(10,10,50),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"anthropic/claude-opus-4.8",displayName:"Claude Opus 4.8",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,25),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"anthropic/claude-opus-4.7",displayName:"Claude Opus 4.7",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,25),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"anthropic/claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"openrouter",contextWindow:1e6,pricing:_e(2,2,10),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"deepseek/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"openrouter",contextWindow:1e6,pricing:_e(.09,.09,.18),supportsVision:!1,clientType:"openai",baseUrl:Mt},{modelId:"deepseek/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"openrouter",contextWindow:1e6,pricing:_e(.435,.435,.87),supportsVision:!1,clientType:"openai",baseUrl:Mt},{modelId:"google/gemini-3.6-flash",displayName:"Gemini 3.6 Flash",provider:"openrouter",contextWindow:1048576,pricing:_e(.15,1.5,7.5),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"google/gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"openrouter",contextWindow:1048576,pricing:_e(1.5,1.5,9),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"google/gemini-3.5-flash-lite",displayName:"Gemini 3.5 Flash-Lite",provider:"openrouter",contextWindow:1048576,pricing:_e(.03,.3,2.5),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"minimax/minimax-m3",displayName:"MiniMax M3",provider:"openrouter",contextWindow:1048576,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"moonshotai/kimi-k3",displayName:"Kimi K3",provider:"openrouter",contextWindow:1e6,pricing:_e(3,3,15),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"moonshotai/kimi-k2.6",displayName:"Kimi K2.6",provider:"openrouter",contextWindow:262144,pricing:_e(.144,.684,3.42),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"nvidia/nemotron-3-ultra-550b-a55b:free",displayName:"Nemotron 3 Ultra (free)",provider:"openrouter",contextWindow:1e6,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:Mt},{modelId:"openai/gpt-5.6-sol",displayName:"GPT-5.6 Sol",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,30),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"openai/gpt-5.6-terra",displayName:"GPT-5.6 Terra",provider:"openrouter",contextWindow:1e6,pricing:_e(2.5,2.5,15),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"openai/gpt-5.5",displayName:"GPT-5.5",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,30),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"qwen/qwen3.6-35b-a3b",displayName:"Qwen 3.6 35B A3B",provider:"openrouter",contextWindow:262144,pricing:_e(.14,.14,1),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"stepfun/step-3.7-flash",displayName:"Step 3.7 Flash",provider:"openrouter",contextWindow:256e3,pricing:_e(.04,.2,1.15),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"tencent/hy3",displayName:"Hy3",provider:"openrouter",contextWindow:262144,pricing:_e(.035,.14,.58),supportsVision:!1,clientType:"openai",baseUrl:Mt},{modelId:"x-ai/grok-4.5",displayName:"Grok 4.5",provider:"openrouter",contextWindow:5e5,pricing:_e(2,2,6),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"xiaomi/mimo-v2.5",displayName:"MiMo-V2.5",provider:"openrouter",contextWindow:1048576,pricing:_e(.0028,.14,.28),supportsVision:!0,clientType:"openai",baseUrl:Mt},{modelId:"z-ai/glm-5.2",displayName:"GLM-5.2",provider:"openrouter",contextWindow:1e6,pricing:_e(.93,.93,3),supportsVision:!1,clientType:"openai",baseUrl:Mt},{modelId:"z-ai/glm-5.1",displayName:"GLM-5.1",provider:"openrouter",contextWindow:204800,pricing:_e(.1794,.966,3.036),supportsVision:!1,clientType:"openai",baseUrl:Mt},{modelId:"accounts/fireworks/models/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"fireworks",contextWindow:1e6,pricing:_e(.03,.14,.28),supportsVision:!1,clientType:"openai",baseUrl:ss},{modelId:"accounts/fireworks/models/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"fireworks",contextWindow:1e6,pricing:_e(.15,1.74,3.48),supportsVision:!1,clientType:"openai",baseUrl:ss},{modelId:"accounts/fireworks/models/glm-5p2",displayName:"GLM-5.2",provider:"fireworks",contextWindow:1e6,pricing:_e(.14,1.4,4.4),supportsVision:!1,clientType:"openai",baseUrl:ss},{modelId:"accounts/fireworks/models/kimi-k2p7-code",displayName:"Kimi K2.7 Code",provider:"fireworks",contextWindow:262144,pricing:_e(.19,.95,4),supportsVision:!0,clientType:"openai",baseUrl:ss},{modelId:"accounts/fireworks/models/minimax-m3",displayName:"MiniMax M3",provider:"fireworks",contextWindow:524288,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:ss},{modelId:"deepseek-ai/DeepSeek-V4-Flash",displayName:"DeepSeek V4 Flash",provider:"siliconflow",contextWindow:1e6,pricing:Zt(.02,1,2),supportsVision:!1,clientType:"openai",baseUrl:Qa},{modelId:"deepseek-ai/DeepSeek-V4-Pro",displayName:"DeepSeek V4 Pro",provider:"siliconflow",contextWindow:1e6,pricing:Zt(.1,12,24),supportsVision:!1,clientType:"openai",baseUrl:Qa},{modelId:"meituan-longcat/LongCat-2.0",displayName:"LongCat 2.0",provider:"siliconflow",contextWindow:1e6,pricing:Zt(.1,5,20),supportsVision:!1,clientType:"openai",baseUrl:Qa},{modelId:"moonshotai/Kimi-K2.7-Code",displayName:"Kimi K2.7 Code",provider:"siliconflow",contextWindow:262144,pricing:Zt(1.3,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:Qa},{modelId:"Pro/moonshotai/Kimi-K2.6",displayName:"Kimi K2.6",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:Qa},{modelId:"Pro/zai-org/GLM-5.1",displayName:"GLM-5.1",provider:"siliconflow",contextWindow:2e5,supportsVision:!1,clientType:"openai",baseUrl:Qa},{modelId:"Qwen/Qwen3.6-35B-A3B",displayName:"Qwen 3.6 35B A3B",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:Qa},{modelId:"zai-org/GLM-5.2",displayName:"GLM-5.2",provider:"siliconflow",contextWindow:1e6,pricing:Zt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Qa},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"qwen-token-plan",contextWindow:1e6,pricing:Zt(1,12,24),supportsVision:!1,clientType:"openai",baseUrl:ls},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"qwen-token-plan",contextWindow:1048576,pricing:Zt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:ls},{modelId:"qwen3.8-max-preview",displayName:"Qwen 3.8 Max Preview",provider:"qwen-token-plan",contextWindow:1e6,supportsVision:!0,clientType:"openai",baseUrl:ls},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-token-plan",contextWindow:1e6,pricing:Zt(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:ls},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-token-plan",contextWindow:1e6,pricing:Zt(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:ls},{modelId:"kimi/kimi-k3",displayName:"Kimi K3",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:Zt(2,20,100),supportsVision:!0,clientType:"openai",baseUrl:bi},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Zt(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:bi},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Zt(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:bi},{modelId:"ZHIPU/GLM-5.2",displayName:"GLM-5.2",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:Zt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:bi},{modelId:"gemini-3.6-flash",displayName:"Gemini 3.6 Flash",provider:"google",contextWindow:1048576,pricing:_e(.15,1.5,7.5),supportsVision:!0},{modelId:"gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"google",contextWindow:1048576,pricing:_e(.15,1.5,9),supportsVision:!0},{modelId:"gemini-3.5-flash-lite",displayName:"Gemini 3.5 Flash-Lite",provider:"google",contextWindow:1048576,pricing:_e(.03,.3,2.5),supportsVision:!0},{modelId:"gemini-3.1-flash-lite",displayName:"Gemini 3.1 Flash-Lite",provider:"google",contextWindow:1048576,pricing:_e(.025,.25,1.5),supportsVision:!0},{modelId:"gemini-3.1-pro-preview",displayName:"Gemini 3.1 Pro (Preview)",provider:"google",contextWindow:1048576,pricing:_e(.2,2,12),supportsVision:!0},{modelId:"gemini-3-flash-preview",displayName:"Gemini 3 Flash (Preview)",provider:"google",contextWindow:1048576,pricing:_e(.05,.5,3),supportsVision:!0},{modelId:"claude-fable-5",displayName:"Claude Fable 5",provider:"anthropic",contextWindow:1e6,pricing:_e(1,12.5,50),supportsVision:!0},{modelId:"claude-opus-4-8",displayName:"Claude Opus 4.8",provider:"anthropic",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0},{modelId:"claude-opus-4-7",displayName:"Claude Opus 4.7",provider:"anthropic",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0},{modelId:"claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"anthropic",contextWindow:1e6,pricing:_e(.2,2.5,10),supportsVision:!0},{modelId:"claude-sonnet-4-6",displayName:"Claude Sonnet 4.6",provider:"anthropic",contextWindow:1e6,pricing:_e(.3,3.75,15),supportsVision:!0},{modelId:"gpt-5.5",displayName:"GPT-5.5",provider:"openai",contextWindow:105e4,pricing:_e(.5,5,30),supportsVision:!0},{modelId:"gpt-5.5-pro",displayName:"GPT-5.5 Pro",provider:"openai",contextWindow:105e4,pricing:_e(30,30,180),supportsVision:!0},{modelId:"gpt-5.4",displayName:"GPT-5.4",provider:"openai",contextWindow:105e4,pricing:_e(.25,2.5,15),supportsVision:!0},{modelId:"gpt-5.4-mini",displayName:"GPT-5.4 mini",provider:"openai",contextWindow:4e5,pricing:_e(.075,.75,4.5),supportsVision:!0},{modelId:"gpt-5.4-nano",displayName:"GPT-5.4 nano",provider:"openai",contextWindow:4e5,pricing:_e(.02,.2,1.25),supportsVision:!0},{modelId:"gpt-5.4-pro",displayName:"GPT-5.4 Pro",provider:"openai",contextWindow:105e4,pricing:_e(30,30,180),supportsVision:!0},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"zhipu",contextWindow:1e6,pricing:_e(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5.1",displayName:"GLM-5.1",provider:"zhipu",contextWindow:2e5,pricing:_e(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5",displayName:"GLM-5",provider:"zhipu",contextWindow:2e5,pricing:_e(.2,1,3.2),supportsVision:!1},{modelId:"kimi-k3",displayName:"Kimi K3",provider:"moonshot",contextWindow:1048576,pricing:Zt(2,20,100),supportsVision:!0},{modelId:"kimi-k2.6",displayName:"Kimi K2.6",provider:"moonshot",contextWindow:262144,pricing:Zt(1.1,6.5,27),supportsVision:!0},{modelId:"kimi-k2.5",displayName:"Kimi K2.5",provider:"moonshot",contextWindow:262144,pricing:Zt(.7,4,21),supportsVision:!0}];function Ch(e,n){return tk.find(r=>r.provider===e&&r.modelId===n)}function aa(e){return Ur.find(n=>n.id===e)}function Z6(e,n){const r=(n||e).toLowerCase(),l=o=>({envKey:`${o}_API_KEY`,envBaseUrlKey:`${o}_BASE_URL`});if(r.includes("gemini-3")||r.includes("gemini-embedding"))return l("GEMINI");if(r.includes("claude")&&(r.includes("4-7")||r.includes("4-8")||r.includes("-5")||r.includes("4-6")))return l("ANTHROPIC");if(r.includes("gpt-5.4")||r.includes("gpt-5.5"))return l("OPENAI");if(r.includes("glm-5"))return l("ZAI");if(r.includes("kimi-k3")||r.includes("kimi-k2.5")||r.includes("kimi-k2.6"))return l("MOONSHOT");if(r.includes("deepseek-v4"))return l("DEEPSEEK");if(r.includes("openai"))return l("OPENAI")}function J6(){return tk.map(e=>({provider:e.provider,model_id:e.modelId,...e.contextWindow!==void 0?{context_window:e.contextWindow}:{},...e.clientType!==void 0?{client_type:e.clientType}:{},...e.pricing?{pricing:{...e.pricing}}:{},...e.supportsVision?{}:{vision:!1},...e.baseUrl!==void 0?{base_url:e.baseUrl}:{}}))}function Ky(e,n){if(e==="openrouter")return`https://openrouter.ai/${n}`;if(e==="qwen-token-plan")return n==="qwen3.8-max-preview"?aa(e)?.modelsUrl:`https://www.qianwenai.com/models/${n}`;if(e==="fireworks"){const r=/^accounts\/([^/]+)\/models\/(.+)$/.exec(n);return r?`https://app.fireworks.ai/models/${r[1]}/${r[2]}`:aa(e)?.modelsUrl}if(e==="qwen-pay-as-you-go")return`https://www.qianwenai.com/models/${encodeURIComponent(n)}`;if(e==="zhipu")return`https://docs.z.ai/guides/llm/${n}`;if(e==="moonshot"){const r=/^kimi-k(\d+)\.(\d+)$/.exec(n);return r?`https://platform.kimi.com/docs/pricing/chat-k${r[1]}${r[2]}`:aa(e)?.modelsUrl}if(e!=="custom")return aa(e)?.modelsUrl}function vt(e,n){return!!e&&!!n&&e.provider===n.provider&&e.modelId===n.modelId}function nk(e){return{id:e,label:e,envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}}function ak(e,n){const r=n.trim().toLowerCase();if(!r)return!0;const l=Ur.find(o=>o.id===e.provider);return e.modelId.toLowerCase().includes(r)||(e.displayName??"").toLowerCase().includes(r)||e.provider.toLowerCase().includes(r)||(l?.label??"").toLowerCase().includes(r)}function rk(e,n){const r=n.trim()!=="",l=e.filter(f=>ak(f,n)),o=Ur.map(f=>({provider:f,rows:l.filter(m=>m.provider===f.id)})),d=[...new Set(l.map(f=>f.provider).filter(f=>!Ur.some(m=>m.id===f)))].sort().map(f=>({provider:nk(f),rows:l.filter(m=>m.provider===f)}));return[...o,...d].filter(f=>f.rows.length>0||!r&&f.provider.id==="custom")}function eA(e){return rk(e,"").flatMap(n=>n.rows)}function Lm(e){return!!e.credential?.apiKeyMasked}function Wy(e,{showAll:n,query:r,selected:l,defaultModel:o}){const u=eA(e);return(n||!u.some(Lm)?u:u.filter(f=>Lm(f)||vt(f,l)||vt(f,o))).filter(f=>ak(f,r))}const tA=/^[\w-]*$/;function Yy(e,n){const r=e.slice(0,n),l=r.lastIndexOf("/");if(l<0||l>0&&!/\s/.test(r[l-1]))return null;const o=r.slice(l+1);if(!tA.test(o))return null;const u=/^[\w-]*/.exec(e.slice(n))[0];return{start:l,end:n+u.length,query:o}}function nA(e,n){const r=e.slice(0,n.start),l=e.slice(n.end),o=r.endsWith(" ")&&l.startsWith(" ")?r+l.slice(1):r+l;return/^\s*$/.test(o)?"":o}const aA=["none","low","medium","high","xhigh"],rA=["low","medium","high","xhigh"];function lk(e,n){return n&&aA.includes(n)?e[n]??n:null}function lA(e,n,r){const l=e.filter(([o])=>o!=="").map(([o,u])=>({value:o,triggerLabel:o,label:o,description:u}));return r==="none"&&l.push({value:"none",triggerLabel:"none",label:"none",description:n}),l}const sA=["always-ask","read-only","allow-all","deny-all"],Xy={"allow-all":"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4m0 4h.01","deny-all":"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM5.64 5.64l12.72 12.72","read-only":"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z","always-ask":"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9.1 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3m.07 4h.01"};function iA({value:e,onChange:n,disabled:r,direction:l="up"}){const[o,u]=b.useState(!1);return i.jsx(Na,{open:o,setOpen:u,menuClass:l==="down"?"left-0 top-full mt-1 w-max max-w-[calc(100vw-2rem)] origin-top-left":"bottom-full left-0 mb-1 w-max max-w-[calc(100vw-2rem)] origin-bottom-left",button:i.jsxs("button",{type:"button","aria-label":x.chat.approvalMode,title:`${x.chat.approvalMode}:${x.chat.approvalModeNames[e]??e}`,disabled:r,onClick:()=>u(d=>!d),className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0",children:i.jsx("path",{d:Xy[e]})}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:x.chat.approvalModeNames[e]??e}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:sA.map(d=>i.jsxs("button",{type:"button",onClick:()=>{n(d),u(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${d===e?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0 text-gray-400 dark:text-gray-500",children:i.jsx("path",{d:Xy[d]})}),i.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-nowrap",children:x.chat.approvalModes[d]??d}),i.jsx("span",{className:"w-3 shrink-0 text-center",children:d===e?"✓":""})]},d))})}function _m(e){return e.displayName??e.modelId}const oA="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4M2 2l20 20";function cA({models:e,value:n,defaultModel:r,onChange:l,disabled:o}){const[u,d]=b.useState(!1),[f,m]=b.useState(""),[h,g]=b.useState(!1),v=e.find(C=>vt(C,n)),k=v?_m(v):n?.modelId??"…",w=Wy(e,{showAll:h,query:f,selected:n,defaultModel:r}),j=h?0:Wy(e,{showAll:!0,query:f,selected:n,defaultModel:r}).length-w.length;return i.jsxs(Na,{open:u,setOpen:d,menuClass:"right-0 top-full mt-1 w-max min-w-56 max-w-[calc(100vw-6rem)] origin-top-right",button:i.jsxs("button",{type:"button",title:`${x.chat.chooseModel}:${k}`,"aria-label":x.chat.chooseModel,disabled:o||e.length===0,onClick:()=>{const C=!u;d(C),C&&(m(""),g(!1))},className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[i.jsx(_i,{provider:v?.provider??n?.provider??"custom",className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:k}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[i.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:i.jsx("input",{autoFocus:!0,value:f,onChange:C=>m(C.target.value),placeholder:x.models.searchPlaceholder,"aria-label":x.models.searchPlaceholder,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"})}),i.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[w.length===0&&i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.models.noSearchResults}),w.map(C=>i.jsxs("button",{type:"button",onClick:()=>{l({provider:C.provider,modelId:C.modelId}),d(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${vt(C,n)?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[i.jsx(_i,{provider:C.provider,className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:_m(C)}),!Lm(C)&&i.jsx("span",{role:"img",title:x.models.noKey,"aria-label":x.models.noKey,className:"shrink-0 text-gray-400 dark:text-gray-500",children:i.jsx(We,{d:oA,size:13})}),vt(C,r)&&i.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:x.models.default}),i.jsx("span",{className:"w-3 shrink-0 text-center text-xs",children:vt(C,n)?"✓":""})]},`${C.provider}:${C.modelId}`))]}),j>0&&i.jsx("div",{className:"border-t border-gray-100 dark:border-gray-800",children:i.jsx("button",{type:"button",onClick:()=>g(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:x.models.showModelsWithoutKey(j)})})]})}const sk="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z";function uA({value:e,onChange:n,disabled:r}){const[l,o]=b.useState(!1),u=e===null?"…":lk(x.chat.thinkingLevelNames,e)??"—";return i.jsxs(Na,{open:l,setOpen:o,menuClass:"right-0 top-full mt-1 w-36 origin-top-right",button:i.jsxs("button",{type:"button",title:`${x.chat.thinkingLevel}:${u}`,"aria-label":x.chat.thinkingLevel,disabled:r||e===null,onClick:()=>o(!l),className:"flex h-8 max-w-36 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[i.jsx(We,{d:sk,size:14,className:"shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:u}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[i.jsx("div",{className:"border-b border-gray-100 px-3 pb-1.5 pt-0.5 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:text-gray-400",children:x.chat.thinkingLevel}),rA.map(d=>i.jsxs("button",{type:"button",onClick:()=>{n(d),o(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${d===e?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[i.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.chat.thinkingLevelNames[d]??d}),i.jsx("span",{className:"w-3 shrink-0 text-center",children:d===e?"✓":""})]},d))]})}function dA({skills:e,selected:n,onToggle:r,disabled:l,direction:o="up"}){const{locale:u}=Ca(),[d,f]=b.useState(!1),[m,h]=b.useState(""),g=E6(e,u,m);return i.jsxs(Na,{open:d,setOpen:f,menuClass:o==="down"?"left-0 top-full mt-1 w-[26rem] max-w-[calc(100vw-10rem)] @md:max-w-[calc(100vw-17rem)] origin-top-left":"bottom-full left-0 mb-1 w-[26rem] max-w-[calc(100vw-10rem)] @md:max-w-[calc(100vw-17rem)] origin-bottom-left",button:i.jsxs("button",{type:"button","aria-label":x.chat.skillsSelect,title:x.chat.skillsSelect,disabled:l,onClick:()=>{const v=!d;f(v),v&&h("")},className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[i.jsx(We,{d:jh,size:14,className:"shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:x.chat.skillsSelect}),n.length>0&&i.jsx("span",{className:"shrink-0 rounded-full bg-gray-200/80 px-1.5 py-px font-mono text-[10px] font-semibold text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",children:n.length}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[i.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:i.jsx("input",{autoFocus:!0,value:m,onChange:v=>h(v.target.value),placeholder:x.chat.skillsSearchPlaceholder,"aria-label":x.chat.skillsSearchPlaceholder,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"})}),i.jsx("div",{className:"max-h-56 overflow-y-auto",children:e.length===0?i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.chat.skillsEmptyHint}):g.length===0?i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.chat.skillsNoMatch}):g.map(v=>{const k=n.includes(v.name);return i.jsxs("button",{type:"button","aria-pressed":k,onClick:()=>r(v.name),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${k?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[i.jsx(Nh,{icon:v.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),i.jsx("span",{className:"shrink-0 font-mono",children:v.name}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:qi(u,v)}),i.jsx("span",{className:"w-3 shrink-0 text-center",children:k?"✓":""})]},v.name)})})]})}function fA({now:e,window:n,unknown:r=!1}){const l=ek(n),o=r?0:Math.min(1,e/l),u=r||o<=.8?"text-gray-400 dark:text-gray-500":o>.95?"text-red-500":"text-amber-500",d=5,f=2*Math.PI*d;return i.jsxs("span",{title:r?x.chat.contextUnknown:`${x.chat.contextUsage} ${Math.round(o*100)}%`,className:`flex shrink-0 items-center gap-1 font-mono ${u}`,children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block shrink-0",children:[i.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),i.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${f*o} ${f}`,transform:"rotate(-90 7 7)"})]}),r?"—":ft(e),"/",ft(l)]})}function ik({status:e,onSend:n,onStop:r,onCompact:l,modelRef:o,models:u,onChangeModel:d,defaultModel:f,thinkingLevel:m,onChangeThinkingLevel:h,sessionThinkingLevel:g,contextWindow:v,contextNow:k,contextStale:w=!1,vision:j,approvalMode:C,onChangeApprovalMode:N,modeSaving:M,autoFocus:O,agents:R,skills:$,initialSkills:H,onSkillsChange:_,onHandoff:V,initialText:G,onTextChange:W,initialHandoffTargetId:z,onHandoffTargetChange:q}){const{locale:A}=Ca(),[L,X]=b.useState(G??""),F=b.useRef(L);F.current=L;const[D,te]=b.useState([]),[ee,we]=b.useState(!1),[U,I]=b.useState(0),[B,T]=b.useState(null),re=b.useRef(null),[de,fe]=b.useState(),[he,Ce]=b.useState(null),[ne,me]=b.useState(H??[]),[be,De]=b.useState(0),[Fe,Ie]=b.useState(0),[Lt,Kt]=b.useState(null),_t=b.useRef(null),[Pn]=b.useState(()=>window.matchMedia("(max-width: 767px)").matches),je=e==="running",$e=e==="compacting",rt=!je&&!$e&&!ee&&(L.trim().length>0||D.length>0||he!==null||ne.length>0),pt=b.useCallback(oe=>{const ke=ne.includes(oe)?ne.filter(Oe=>Oe!==oe):[...ne,oe];me(ke),_?.(ke)},[ne,_]),$t=b.useRef(null),bt=b.useMemo(()=>{const oe=()=>{const ke=$t.current,Oe=ke?nA(F.current,ke):"";X(Oe),W?.(Oe),requestAnimationFrame(Ve)};return[{cmd:"/compact",desc:x.chat.compact,run:()=>{oe(),l()}},...M6($,A).map(ke=>({cmd:ke.cmd,desc:ke.desc,run:()=>{oe(),pt(ke.name)}}))]},[l,W,$,A,pt]),on=!je&&!$e?Yy(L,be):null;$t.current=on;const le=on&&on.start!==B?bt.filter(oe=>oe.cmd.startsWith(`/${on.query}`)):[],pe=le.length>0,Ee=le[Math.min(U,le.length-1)],ge=!je&&!$e&&!pe?Vy(L,be):null,ve=ge&&ge.start!==Lt?L6(R,ge.query):[],Xe=ve.length>0,lt=ve[Math.min(Fe,ve.length-1)];b.useEffect(()=>{if(!pe&&!Xe)return;const oe=()=>{const ke=re.current;if(!ke)return;let Oe=0;for(let Tt=ke.parentElement;Tt;Tt=Tt.parentElement)if(getComputedStyle(Tt).overflowY!=="visible"){Oe=Tt.getBoundingClientRect().top;break}const dt=ke.getBoundingClientRect().top-Oe-14;fe(Math.max(96,Math.min(320,Math.round(dt))))};return oe(),window.addEventListener("resize",oe),()=>window.removeEventListener("resize",oe)},[pe,Xe]);const Ve=()=>{const oe=_t.current;oe&&(oe.style.height="auto",oe.style.height=`${Math.min(oe.scrollHeight,176)}px`)};b.useEffect(()=>{Ve();const oe=_t.current;if(oe&&oe.value.length>0){const ke=oe.value.length;oe.setSelectionRange(ke,ke),oe.scrollTop=oe.scrollHeight,De(ke)}},[]);const et=b.useRef(!1);b.useEffect(()=>{if(!et.current&&(et.current=!0,$.length===0))return;const oe=ne.filter(ke=>$.some(Oe=>Oe.name===ke));oe.length!==ne.length&&(me(oe),_?.(oe))},[$,ne,_]);const ot=b.useRef(!1);b.useEffect(()=>{if(ot.current||!z||R.length===0)return;ot.current=!0;const oe=R.find(ke=>ke.agentId===z);oe&&Ce(oe)},[R,z]);const tt=oe=>{const ke=_t.current;if(!ge||!ke)return;let{start:Oe,end:dt}=ge;ke.value[dt]===" "?dt++:Oe>0&&ke.value[Oe-1]===" "&&Oe--;const Tt=ke.value.slice(0,Oe)+ke.value.slice(dt);ke.value=Tt,ke.setSelectionRange(Oe,Oe),ke.focus(),Ce(oe),q?.(oe.agentId),X(Tt),W?.(Tt),De(Oe),Ie(0),Ve()},en=async()=>{if(!rt)return;const oe=L.trim(),ke=he?{agent:he,rest:oe}:_6(oe,R),Oe=ke?ke.rest:oe,dt=ne.length>0&&Oe===""?x.chat.skillsAutoMessage(ne):Oe,Tt=Xb(ne,dt),oa=[];Tt&&oa.push({type:"text",text:Tt});for(const pa of D)oa.push({type:"image_url",imageUrl:pa});we(!0);try{(ke?await V(ke.agent,oa):await n(oa))&&(X(""),te([]),Ce(null),me([]),requestAnimationFrame(Ve))}finally{we(!1),_t.current?.focus()}},mn=oe=>{if(pe){if(oe.key==="ArrowDown"){oe.preventDefault(),I(ke=>(ke+1)%le.length);return}if(oe.key==="ArrowUp"){oe.preventDefault(),I(ke=>(ke-1+le.length)%le.length);return}if((oe.key==="Enter"&&!oe.shiftKey||oe.key==="Tab")&&!oe.nativeEvent.isComposing){oe.preventDefault(),Ee?.run();return}if(oe.key==="Escape"){T(on?.start??null);return}}if(Xe){if(oe.key==="ArrowDown"){oe.preventDefault(),Ie(ke=>(ke+1)%ve.length);return}if(oe.key==="ArrowUp"){oe.preventDefault(),Ie(ke=>(ke-1+ve.length)%ve.length);return}if((oe.key==="Enter"&&!oe.shiftKey||oe.key==="Tab")&&!oe.nativeEvent.isComposing){oe.preventDefault(),lt&&tt(lt);return}if(oe.key==="Escape"){Kt(ge?.start??null);return}}if(oe.key==="Backspace"&&he!==null&&oe.currentTarget.selectionStart===0&&oe.currentTarget.selectionEnd===0){oe.preventDefault(),Ce(null),q?.(null);return}oe.key==="Enter"&&!oe.shiftKey&&!oe.nativeEvent.isComposing&&(oe.preventDefault(),en())},Br=oe=>{for(const ke of oe){if(!ke.type.startsWith("image/"))continue;const Oe=new FileReader;Oe.onload=()=>{typeof Oe.result=="string"&&te(dt=>[...dt,Oe.result])},Oe.readAsDataURL(ke)}},Ma=oe=>{const ke=[];for(const Oe of oe.clipboardData.items)if(Oe.kind==="file"){const dt=Oe.getAsFile();dt&&ke.push(dt)}ke.length>0&&(oe.preventDefault(),Br(ke))},ar=oe=>{oe.target.files&&Br(oe.target.files),oe.target.value=""};return i.jsxs("div",{className:"relative",ref:re,children:[pe&&i.jsx("div",{style:{maxHeight:de},className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 w-80 max-w-[calc(100vw-2rem)] overflow-y-auto overscroll-contain rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:le.map((oe,ke)=>i.jsxs("button",{type:"button",ref:oe===Ee?Oe=>Oe?.scrollIntoView({block:"nearest"}):void 0,onMouseEnter:()=>I(ke),onClick:()=>oe.run(),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${oe===Ee?"bg-gray-100 dark:bg-gray-800":""}`,children:[i.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:oe.cmd}),i.jsx("span",{title:oe.desc,className:"min-w-0 flex-1 truncate text-xs text-gray-500 dark:text-gray-400",children:oe.desc})]},oe.cmd))}),Xe&&i.jsx("div",{style:{maxHeight:Math.min(256,de??256)},className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 w-72 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:ve.map((oe,ke)=>i.jsxs("button",{type:"button",onMouseEnter:()=>Ie(ke),onClick:()=>tt(oe),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${oe===lt?"bg-gray-100 dark:bg-gray-800":""}`,children:[i.jsxs("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:["@",oe.agentId]}),oe.name&&oe.name!==oe.agentId&&i.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:oe.name})]},oe.agentId))}),D.length>0&&i.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:D.map((oe,ke)=>i.jsxs("div",{className:"anim-pop relative",children:[i.jsx(hl,{src:oe,alt:x.chat.imageAlt,className:"h-16 w-16 rounded-md border border-gray-200 object-cover dark:border-gray-700"}),i.jsx("button",{type:"button","aria-label":x.chat.removeImage,onClick:()=>te(Oe=>Oe.filter((dt,Tt)=>Tt!==ke)),className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-gray-700 text-[10px] text-white transition-colors duration-150 hover:bg-gray-900",children:"×"})]},ke))}),!j&&D.length>0&&i.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.imagesAsPathHint}),i.jsxs("div",{className:"@container rounded-lg border border-gray-300 bg-white px-2.5 pb-2 pt-2 transition-[border-color,box-shadow] duration-200 focus-within:border-gray-500 focus-within:ring-2 focus-within:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:focus-within:border-gray-400",children:[(he!==null||ne.length>0)&&i.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-1",children:[he!==null&&i.jsxs("span",{className:"anim-pop flex max-w-48 items-center gap-0.5 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 font-mono text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",...he.name&&he.name!==he.agentId?{title:he.name}:{},children:[i.jsxs("span",{className:"truncate",children:["@",he.agentId]}),i.jsx("button",{type:"button","aria-label":x.chat.mentionRemove,onClick:()=>{Ce(null),q?.(null),_t.current?.focus()},className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]}),ne.map(oe=>{const ke=$.find(Oe=>Oe.name===oe);return i.jsxs("span",{className:"anim-pop flex max-w-48 items-center gap-1 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 font-mono text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",...ke?{title:qi(A,ke)}:{},children:[i.jsx(Nh,{icon:ke?.icon,size:13,className:"shrink-0 text-gray-500 dark:text-gray-400"}),i.jsx("span",{className:"truncate",children:oe}),i.jsx("button",{type:"button","aria-label":`${x.chat.skillRemove} ${oe}`,onClick:()=>pt(oe),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},oe)})]}),i.jsx("textarea",{ref:_t,rows:2,value:L,autoFocus:O,onChange:oe=>{const ke=oe.target.value,Oe=oe.target.selectionStart??ke.length;X(ke),W?.(ke),De(Oe),I(0),Ie(0),T(dt=>{if(dt===null)return null;const Tt=Yy(ke,Oe);return Tt&&Tt.start===dt?dt:null}),Kt(dt=>{if(dt===null)return null;const Tt=Vy(ke,Oe);return Tt&&Tt.start===dt?dt:null}),Ve()},onSelect:oe=>De(oe.currentTarget.selectionStart??0),onKeyDown:mn,onPaste:Ma,placeholder:Pn?x.chat.inputPlaceholderShort:x.chat.inputPlaceholder,className:"block max-h-44 min-h-[60px] w-full resize-none bg-transparent px-1 py-0.5 text-base leading-6 placeholder:text-gray-400 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500"}),i.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs",children:[i.jsxs("label",{className:"flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",title:j?x.chat.imageAlt:x.chat.imagesAsPathHint,children:[i.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ar}),i.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"block",children:[i.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"3"}),i.jsx("path",{d:"M3 15l5-5 4 4 3-3 6 6"})]})]}),i.jsx(iA,{value:C,onChange:N,disabled:M,direction:u&&d?"down":"up"}),i.jsx(dA,{skills:$,selected:ne,onToggle:pt,disabled:je||$e||ee,direction:u&&d?"down":"up"}),i.jsx("span",{className:"min-w-0 flex-1",children:i.jsxs("span",{title:`${x.chat.slashHint} · ${x.chat.mentionHint}`,className:"hidden truncate text-gray-300 @lg:block dark:text-gray-600",children:[x.chat.slashHint," · ",x.chat.mentionHint]})}),!d&&i.jsx(fA,{now:k,unknown:w,...v!==void 0?{window:v}:{}}),u&&d&&h&&i.jsx(uA,{value:m??null,onChange:h,disabled:ee}),!d&&(()=>{const oe=lk(x.chat.thinkingLevelNames,g);return oe&&i.jsxs("span",{title:`${x.chat.thinkingLevel}:${oe}`,className:"hidden h-8 shrink-0 items-center gap-1 px-1 text-xs text-gray-400 @md:flex dark:text-gray-500",children:[i.jsx(We,{d:sk,size:13,className:"shrink-0"}),oe]})})(),u&&d?i.jsx(cA,{models:u,value:o,...f!==void 0?{defaultModel:f}:{},onChange:d,disabled:ee}):i.jsxs("span",{title:o?.modelId??"",className:"flex h-8 min-w-0 max-w-44 shrink items-center gap-1.5 px-1 text-gray-400 dark:text-gray-500",children:[i.jsx(_i,{provider:o?.provider??"custom",className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:(()=>{const oe=u?.find(ke=>vt(ke,o));return oe?_m(oe):o?.modelId??"…"})()})]}),je?i.jsx("button",{type:"button",title:x.chat.stop,"aria-label":x.chat.stop,onClick:()=>{r()},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-red-50 text-red-600 transition-colors duration-150 hover:bg-red-100 dark:bg-red-950/60 dark:text-red-400 dark:hover:bg-red-950",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block",children:i.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})})}):i.jsx("button",{type:"button",title:x.chat.send,"aria-label":x.chat.send,disabled:!rt,onClick:()=>{en()},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-gray-900 text-white transition-colors duration-150 hover:bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-200 disabled:text-gray-400 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300 dark:disabled:bg-gray-800 dark:disabled:text-gray-600",children:i.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"block",children:i.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]})]})]})}function ok({className:e}){return i.jsx("img",{src:"/penguin-logo.svg",alt:"","aria-hidden":!0,draggable:!1,className:`select-none ${e??"h-9 w-9 rounded-lg"}`})}const mA=["always-ask","read-only","allow-all","deny-all"],is=(e,n)=>`penguin.chatDraft.${e}.${n}`,ck=(e,n)=>`penguin.chatDraft.session.${e}.${n}`;function hA(e){if(!e)return{};try{const n=JSON.parse(e);if(typeof n!="object"||n===null)return{};const r=n,l={};if(typeof r.text=="string"&&(l.text=r.text),typeof r.agentId=="string"&&(l.agentId=r.agentId),typeof r.workspace=="string"&&(l.workspace=r.workspace),typeof r.modelRef=="object"&&r.modelRef!==null){const o=r.modelRef;typeof o.provider=="string"&&typeof o.modelId=="string"&&(l.modelRef={provider:o.provider,modelId:o.modelId})}if(typeof r.handoffAgentId=="string"&&(l.handoffAgentId=r.handoffAgentId),Array.isArray(r.skills)){const o=r.skills.filter(u=>typeof u=="string");o.length>0&&(l.skills=o)}return typeof r.approvalMode=="string"&&mA.includes(r.approvalMode)&&(l.approvalMode=r.approvalMode),l}catch{return{}}}function au(e,n=localStorage){try{return hA(n.getItem(e))}catch{return{}}}function Ii(e,n,r=localStorage){try{r.setItem(e,JSON.stringify(n))}catch{}}function Bc(e,n=localStorage){try{n.removeItem(e)}catch{}}const pA=300;function Qy(e){try{return sessionStorage.getItem(`penguin.chatRouteApplied.${e}`)}catch{return null}}function Zy(e,n){try{sessionStorage.setItem(`penguin.chatRouteApplied.${e}`,n)}catch{}}const gA=[{id:"game",skills:["web-design"]},{id:"lol",skills:["web-design"]},{id:"rag",skills:["penguin-sdk","web-design"]}];function xA({projectId:e,models:n}){const r=ia(),l=Hn(),{agents:o,currentAgent:u,setCurrentAgentId:d}=sn(),{add:f}=Ui(),m=Nn().user?.userId??null,[h]=b.useState(()=>m?au(is(m,e)):{}),[g,v]=b.useState(h.agentId??u?.agentId??null),[k,w]=b.useState(h.workspace??""),[j,C]=b.useState(h.approvalMode??"allow-all"),[N,M]=b.useState(h.modelRef??null),[O,R]=b.useState(h.handoffAgentId??null),$=b.useRef(h.text??""),H=b.useRef(h.skills??[]),_=l.state,V=_?.agentId,G=b.useRef(null);b.useEffect(()=>{if(o.length===0)return;const je=$e=>!!$e&&o.some(rt=>rt.agentId===$e);if(V&&G.current!==l.key&&Qy("agentId")!==l.key&&(G.current=l.key,Zy("agentId",l.key),je(V))){v(V);return}je(g)||v((o.find($e=>$e.agentId==="default_agent")??o[0])?.agentId??null)},[o,g,l.key,V]);const W=_?.workspace,z=b.useRef(null);b.useEffect(()=>{W===void 0||z.current===l.key||Qy("workspace")===l.key||(z.current=l.key,Zy("workspace",l.key),w(W))},[l.key,W]),b.useEffect(()=>{if(!n||N&&n.models.some($e=>vt($e,N)))return;const je=n.models[0];M(n.defaultModel??(je?{provider:je.provider,modelId:je.modelId}:null))},[n,N]);const[q,A]=b.useState(null);b.useEffect(()=>{if(A(null),!g)return;let je=!1;return Q1(e,g).then($e=>{je||A($e.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{je=!0}},[e,g]);const L=b.useRef(null);L.current=q;const X=b.useCallback(je=>{if(!g||!je)return;const $e=L.current;A(je),Z1(e,g,{config:{model:{thinkingLevel:je}}}).catch(rt=>{A($e),On(rt instanceof He?rt.message:x.common.unknownError)})},[e,g]),[F,D]=b.useState([]),[te,ee]=b.useState(!1);b.useEffect(()=>{if(D($e=>$e.length>0?[]:$e),ee(!1),!g)return;let je=!1;return Hm(e,g).then($e=>{je||D($e.skills)}).catch(()=>{}).finally(()=>{je||ee(!0)}),()=>{je=!0}},[e,g]);const we=b.useRef(null),U=b.useCallback(()=>{we.current!==null&&(window.clearTimeout(we.current),we.current=null)},[]),I=b.useCallback(()=>{if(U(),!m)return;const je={text:$.current,workspace:k,approvalMode:j};g&&(je.agentId=g),N&&(je.modelRef=N),O&&(je.handoffAgentId=O),H.current.length>0&&(je.skills=H.current),Ii(is(m,e),je)},[U,m,e,g,k,j,N,O]),B=b.useRef(I);b.useEffect(()=>{B.current=I,I()},[I]);const T=b.useCallback(je=>{$.current=je,U(),we.current=window.setTimeout(()=>{we.current=null,B.current()},pA)},[U]),re=b.useCallback(je=>{H.current=je,B.current()},[]);b.useEffect(()=>()=>{we.current!==null&&(window.clearTimeout(we.current),B.current())},[]);const de=b.useCallback(()=>{U(),H.current=[],m&&(N?Ii(is(m,e),{modelRef:N}):Bc(is(m,e)))},[U,m,e,N]),fe=je=>{v(je.agentId),d(je.agentId)},he=b.useRef(!1),[Ce,ne]=b.useState(!1),me=b.useCallback(async(je,$e=!1)=>{if(!g||he.current)return!1;he.current=!0,ne(!0);let rt=null;try{const pt={approvalMode:j};N&&(pt.modelId=N.modelId,pt.provider=N.provider),k.trim()&&(pt.workspace=k.trim());const $t=await lm(e,g,pt);rt=$t.session.sessionId;const bt=await Mc(rt,{input:je});return f($t.session),$e||de(),r(`/chat/${bt.sessionId}`,{replace:!0}),!0}catch(pt){return rt&&Ec(rt).catch(()=>{}),On(er(pt,N?{modelId:N.modelId}:{})),!1}finally{he.current=!1,ne(!1)}},[e,g,j,N,k,f,de,r]),[be,De]=b.useState(null),Fe=b.useCallback(async je=>{if(be===null){De(je.id);try{const $e=je.skills.filter(rt=>F.some(pt=>pt.name===rt));await me([{type:"text",text:Xb($e,x.chat.exampleTasks[je.id].prompt)}],!0)}finally{De(null)}}},[be,F,me]),Ie=o.find(je=>je.agentId===g)??null,Lt=b.useCallback(async(je,$e)=>{if(!Ie||he.current)return!1;he.current=!0,ne(!0);const rt={type:"text",text:Qb({agentId:Ie.agentId,...Ie.name!==void 0?{agentName:Ie.name}:{}})};let pt=null;try{const $t=await lm(e,je.agentId,{approvalMode:j});pt=$t.session.sessionId;const bt=await Mc(pt,{input:[rt,...$e]});return f($t.session),de(),r(`/chat/${bt.sessionId}`),!0}catch($t){return pt&&Ec(pt).catch(()=>{}),On(er($t,n?.defaultModel?{modelId:n.defaultModel.modelId}:{})),!1}finally{he.current=!1,ne(!1)}},[e,Ie,j,f,de,r,n]),Kt=n?.models.find(je=>vt(je,N)),_t=Kt?.contextWindow,Pn=Kt?.vision!==!1;return i.jsxs("div",{className:"anim-fade flex min-h-0 flex-1 flex-col overflow-y-auto px-3 py-6 md:px-4",children:[i.jsx("div",{className:"flex-1"}),i.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[i.jsxs("div",{className:"mb-10 text-center",children:[i.jsx(ok,{className:"mx-auto mb-1 h-36 w-36 rounded-3xl"}),i.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:x.appName}),i.jsx("p",{className:"mt-2 text-base text-gray-400 dark:text-gray-500",children:x.chat.draftSubtitle})]}),i.jsx(ik,{status:"idle",onSend:me,onStop:async()=>{},onCompact:async()=>{},modelRef:N,models:n?.models??[],onChangeModel:M,thinkingLevel:q,onChangeThinkingLevel:X,...n?.defaultModel!==void 0?{defaultModel:n.defaultModel}:{},..._t!==void 0?{contextWindow:_t}:{},contextNow:0,vision:Pn,approvalMode:j,onChangeApprovalMode:C,modeSaving:!1,autoFocus:!0,agents:o,skills:F,...h.skills&&h.skills.length>0?{initialSkills:h.skills}:{},onSkillsChange:re,onHandoff:Lt,initialText:h.text??"",onTextChange:T,...h.handoffAgentId?{initialHandoffTargetId:h.handoffAgentId}:{},onHandoffTargetChange:R}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx(yA,{agents:o,selected:Ie,onSelect:fe}),i.jsx(vA,{projectId:e,workspace:k,onChange:w})]}),i.jsx("div",{className:"mt-6 flex flex-col items-stretch gap-2",children:gA.map(je=>{const $e=x.chat.exampleTasks[je.id];return i.jsxs("button",{type:"button",disabled:be!==null||Ce||!te||!g||!n,onClick:()=>{Fe(je)},className:"group flex min-w-0 items-center gap-3 rounded-xl border border-gray-200 bg-white px-4 py-3 text-left transition-colors duration-150 hover:border-gray-300 disabled:cursor-default disabled:opacity-60 dark:border-gray-800 dark:bg-gray-900 dark:hover:border-gray-700",children:[je.id==="lol"?i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-brand-500 dark:text-brand-400","aria-hidden":!0,children:[i.jsx("path",{d:"M9 18V6l11-2v12",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("circle",{cx:"6.5",cy:"18",r:"2.5",strokeWidth:"1.7"}),i.jsx("circle",{cx:"17.5",cy:"16",r:"2.5",strokeWidth:"1.7"})]}):je.id==="game"?i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-brand-500 dark:text-brand-400","aria-hidden":!0,children:[i.jsx("path",{d:"M6.7 6h10.6a4 4 0 0 1 3.97 3.56c.2 1.8.73 5.05.73 6.44a3 3 0 0 1-3 3c-1 0-1.5-.5-2-1l-1.4-1.4a2 2 0 0 0-1.42-.6H9.82a2 2 0 0 0-1.41.6L7 18c-.5.5-1 1-2 1a3 3 0 0 1-3-3c0-1.39.52-4.64.73-6.44A4 4 0 0 1 6.7 6z",strokeWidth:"1.7",strokeLinejoin:"round"}),i.jsx("path",{d:"M6.5 11h4M8.5 9v4M15 12h.01M18 10h.01",strokeWidth:"1.7",strokeLinecap:"round"})]}):i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-brand-500 dark:text-brand-400","aria-hidden":!0,children:[i.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z",strokeWidth:"1.7",strokeLinejoin:"round"}),i.jsx("path",{d:"M18.5 15.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9.9-2.1z",strokeWidth:"1.4",strokeLinejoin:"round"})]}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-gray-900 dark:text-gray-100",children:$e.label}),i.jsx("span",{className:"line-clamp-2 text-xs text-gray-500 dark:text-gray-400",children:$e.desc})]}),be===je.id?i.jsx("span",{className:"ml-1 shrink-0 text-xs text-gray-400",children:x.common.loading}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"ml-1 shrink-0 text-gray-300 transition-colors duration-150 group-hover:text-gray-500 dark:text-gray-600 dark:group-hover:text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M5 12h14M13 6l6 6-6 6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})]},je.id)})})]}),i.jsx("div",{className:"flex-1"})]})}const uk="flex max-w-64 items-center gap-1.5 rounded-full border border-gray-300 bg-white py-1 pl-1.5 pr-2 text-xs text-gray-600 transition-colors duration-150 hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100";function yA({agents:e,selected:n,onSelect:r}){const[l,o]=b.useState(!1);return i.jsx(Na,{open:l,setOpen:o,menuClass:"left-0 top-full mt-1 w-72 max-w-[calc(100vw-2rem)] origin-top-left",button:i.jsxs("button",{type:"button",title:x.chat.chooseAgent,"aria-label":x.chat.chooseAgent,onClick:()=>o(!l),className:uk,children:[n?i.jsx(zr,{id:n.agentId,name:jn(n),size:16,className:"shrink-0 rounded"}):null,i.jsx("span",{className:"min-w-0 truncate",children:n?jn(n):x.common.loading}),i.jsx(ln,{open:l,size:12,className:"shrink-0 text-gray-400"})]}),children:i.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.common.loading}),e.map(u=>{const d=u.agentId===n?.agentId;return i.jsxs("button",{type:"button","aria-pressed":d,onClick:()=>{r(u),o(!1)},className:"flex w-full items-center gap-2.5 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800",children:[i.jsx(zr,{id:u.agentId,name:jn(u),size:20,className:"shrink-0 rounded"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:`block truncate text-xs ${d?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:jn(u)}),u.description&&i.jsx("span",{className:"block truncate text-[11px] text-gray-400 dark:text-gray-500",children:u.description})]}),i.jsx("span",{className:"w-4 shrink-0 text-center text-xs text-gray-500 dark:text-gray-400",children:d?"✓":""})]},u.agentId)})]})})}function vA({projectId:e,workspace:n,onChange:r}){const[l,o]=b.useState(!1),[u,d]=b.useState({right:!1}),f=b.useRef(!1),[m,h]=b.useState(null),[g,v]=b.useState(!1),[k,w]=b.useState(null),[j,C]=b.useState("");b.useEffect(()=>{C(m?.path??"")},[m]);const N=b.useCallback(V=>{v(!0),w(null),Ix(e,V).then(h).catch(G=>w(G instanceof He?G.message:x.common.unknownError)).finally(()=>v(!1))},[e]),M=V=>{const G=!l;if(G){const W=V.currentTarget.getBoundingClientRect(),z=parseFloat(getComputedStyle(document.documentElement).fontSize),q=12,A=Math.min(20*z,window.innerWidth-2*z),L=window.innerWidth-q-W.left,X=W.right-q;L>=A?d({right:!1}):X>L?d({right:!0,...X<A?{maxWidth:X}:{}}):d({right:!1,maxWidth:L})}if(o(G),G&&!f.current){f.current=!0;const W=n.trim();N(W.startsWith("/")?W:"")}},O=async()=>{const V=j.trim();if(!V||V===m?.path){C(m?.path??"");return}try{h(await Ix(e,V))}catch{On(x.chat.workspaceDirInvalid),C(m?.path??"")}},R=n.trim(),$=R?R.split("/").filter(Boolean).pop()??"/":x.chat.workspaceAuto,H=m?.parent??null,_=(m?.entries??[]).filter(V=>!V.name.startsWith("."));return i.jsx(Na,{open:l,setOpen:o,menuClass:`top-full mt-1 w-80 max-w-[calc(100vw-2rem)] ${u.right?"right-0 origin-top-right":"left-0 origin-top-left"}`,...u.maxWidth!==void 0?{menuStyle:{maxWidth:u.maxWidth}}:{},button:i.jsxs("button",{type:"button",title:R?`${x.chat.workspace}:${R}`:x.chat.workspaceHint,"aria-label":x.chat.workspace,onClick:M,className:uk,children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"ml-0.5 shrink-0 text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",strokeWidth:"1.6",strokeLinejoin:"round"})}),i.jsx("span",{className:`min-w-0 truncate ${R?"font-mono":""}`,children:$}),i.jsx(ln,{open:l,size:12,className:"shrink-0 text-gray-400"})]}),children:i.jsxs("div",{className:"space-y-1.5 px-2.5 pb-2.5 pt-2",children:[i.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center gap-1.5 border-b border-gray-100 px-1.5 py-1 dark:border-gray-800",children:[i.jsx("input",{value:j,placeholder:"…","aria-label":x.chat.workspace,onChange:V=>C(V.target.value),onBlur:()=>{O()},onKeyDown:V=>{V.key==="Enter"&&!V.nativeEvent.isComposing?(V.preventDefault(),O()):V.key==="Escape"&&C(m?.path??"")},className:"min-w-0 flex-1 rounded border border-transparent bg-transparent px-1 py-0.5 font-mono text-xs text-gray-600 focus:border-gray-300 focus:outline-none dark:text-gray-300 dark:focus:border-gray-600"}),i.jsx("button",{type:"button",disabled:!m,onClick:()=>{m&&(r(m.path),o(!1))},className:"shrink-0 rounded border border-gray-300 px-1.5 py-0.5 text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 disabled:opacity-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:x.chat.workspaceUseThis})]}),i.jsxs("ul",{className:"max-h-40 overflow-y-auto py-1",children:[H!==null&&i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>N(H),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800",children:["↰ ",x.chat.workspaceUp]})}),_.map(V=>i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>N(V.path),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:[i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",strokeWidth:"1.6",strokeLinejoin:"round"})}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:V.name})]})},V.path)),m&&_.length===0&&i.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:x.chat.workspaceNoSubdirs}),g&&i.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:x.common.loading}),k&&i.jsxs("li",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 text-xs text-red-500",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate",title:k,children:k}),i.jsx("button",{type:"button",onClick:()=>N(""),className:"shrink-0 rounded border border-gray-300 px-1.5 py-0.5 text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:x.common.retry})]})]})]}),R&&i.jsx("button",{type:"button",onClick:()=>{r(""),o(!1)},className:"text-xs text-gray-500 underline decoration-gray-300 underline-offset-2 transition-colors duration-150 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200",children:x.chat.workspaceClear}),i.jsx("p",{className:"px-0.5 text-xs leading-5 text-gray-400 dark:text-gray-500",children:x.chat.workspaceHint})]})})}const Im={damping:1,response:.35},Jy={damping:.8,response:.3};function bA(e,n,r,l,o){const u=2*Math.PI/l.response,d=u*u,f=2*l.damping*u;let m=e,h=n,g=Math.min(o,64);for(;g>0;){const v=Math.min(g,8)/1e3,k=-d*(m-r)-f*h;h+=k*v,m+=h*v,g-=8}return[m,h]}function e1(e,n,r){return Math.abs(e-r)<.5&&Math.abs(n)<5}function kA(e,n){let r=e,l=0,o=e,u=Im,d,f=0,m=0;const h=()=>{f&&cancelAnimationFrame(f),f=0,m=0,d=void 0},g=v=>{const k=m?v-m:16;if(m=v,[r,l]=bA(r,l,o,u,k),e1(r,l,o)){r=o,l=0,f=0,m=0,n(r);const w=d;d=void 0,w?.();return}n(r),f=requestAnimationFrame(g)};return{get value(){return r},get velocity(){return l},animateTo(v,k,w){if(o=v,u=k,w?.velocity!==void 0&&(l=w.velocity),d=w?.onSettle,e1(r,l,o)){r=o,l=0,n(r);const j=d;d=void 0,j?.();return}f||(f=requestAnimationFrame(g))},stop(){return h(),[r,l]},set(v){h(),r=v,l=0,n(r)},dispose:h}}function wA(e,n=.998){return e/1e3*n/(1-n)}function SA(e,n,r=.55){return e*n*r/(n+r*Math.abs(e))}function jA(e,n){let r=n[0];for(const l of n)Math.abs(l-e)<Math.abs(r-e)&&(r=l);return r}const NA=.92,CA=.6;function TA(){const[e,n]=b.useState(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches);return b.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)"),l=o=>n(o.matches);return r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[]),e}function EA({open:e,snap:n,onSnapChange:r,onClose:l,title:o,children:u}){const[d,f]=b.useState(e),m=b.useRef(null),h=b.useRef(null),g=b.useRef(null),v=b.useRef(0),k=b.useRef(!1),w=b.useRef(!1),j=b.useRef(null),C=b.useRef([]),N=b.useRef({pointerY:0,sheetY:0}),M=b.useRef(e);M.current=e;const O=b.useRef(null),R=TA(),$=b.useCallback(q=>{const A=v.current||1;m.current&&(m.current.style.transform=`translate3d(0, ${q}px, 0)`),h.current&&(h.current.style.opacity=String(Math.min(1,Math.max(0,1-q/A))))},[]),H=b.useCallback(q=>{const A=v.current;return q==="full"?0:A*(1-CA/NA)},[]);b.useEffect(()=>{e&&f(!0)},[e]),b.useLayoutEffect(()=>{if(!d)return;const q=m.current;q&&(v.current=q.offsetHeight,g.current||(g.current=kA(v.current,$),g.current.set(v.current)))},[d,$]),b.useEffect(()=>{if(!d)return;const q=g.current;if(q)if(e){if(w.current=!1,k.current)return;const A=H(n);if(j.current!==null&&Math.abs(j.current-A)<1)return;if(j.current=A,R){q.set(A);return}q.animateTo(A,Im)}else{if(w.current=!0,j.current=v.current,R){f(!1);return}q.animateTo(v.current,Im,{onSettle:()=>f(!1)})}},[d,e,n,R,H]),b.useEffect(()=>{d||(g.current?.dispose(),g.current=null,j.current=null,k.current=!1,w.current=!1)},[d]),b.useEffect(()=>()=>g.current?.dispose(),[]),b.useEffect(()=>{if(!d)return;const q=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=q}},[d]),b.useEffect(()=>{if(!d||!e)return;const q=A=>{A.key==="Escape"&&l()};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[d,e,l]),b.useEffect(()=>{if(d)return O.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>O.current?.focus()},[d]),b.useEffect(()=>{if(!d)return;const q=()=>{const A=m.current;if(!A||(v.current=A.offsetHeight,k.current||w.current))return;const L=H(n);j.current=L,g.current?.set(L)};return window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[d,n,H]);const _=q=>{if(w.current)return;const A=g.current;if(!A)return;q.currentTarget.setPointerCapture(q.pointerId);const[L]=A.stop();k.current=!0,N.current={pointerY:q.clientY,sheetY:L},C.current=[{y:q.clientY,t:performance.now()}]},V=q=>{if(!k.current)return;const A=g.current;if(!A)return;const L=N.current.sheetY+(q.clientY-N.current.pointerY),X=v.current,F=L<0?-SA(-L,X):Math.min(L,X);A.set(F);const D=performance.now(),te=C.current;for(te.push({y:q.clientY,t:D});te.length>2&&D-te[0].t>100;)te.shift()},G=q=>{k.current=!1;const A=g.current;if(!A)return;const L=v.current,X=H("half"),F=M.current?A.value+wA(q):L,D=jA(F,[0,X,L]);if(j.current=D,D===L){if(w.current=!0,R){f(!1),l();return}A.animateTo(L,Jy,{velocity:q,onSettle:()=>{f(!1),l()}});return}A.animateTo(D,Jy,{velocity:q});const te=D===0?"full":"half";te!==n&&r?.(te)},W=()=>{if(!k.current)return;const q=C.current,A=q[q.length-1],L=q[0],X=A&&L?A.t-L.t:0;G(X>0?(A.y-L.y)/X*1e3:0)},z=()=>{k.current&&G(0)};return d?i.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":o,children:[i.jsx("div",{ref:h,className:`absolute inset-0 bg-black/45 ${R?"anim-fade":""}`,style:{opacity:0},onPointerDown:()=>l()}),i.jsxs("div",{ref:m,className:`absolute inset-x-0 bottom-0 flex h-[92dvh] flex-col overflow-hidden rounded-t-2xl border-t border-gray-200 bg-white shadow-2xl dark:border-gray-800 dark:bg-gray-900 ${R?"anim-fade":""}`,style:{transform:"translate3d(0, 100%, 0)"},children:[i.jsxs("div",{className:"shrink-0 cursor-grab touch-none select-none active:cursor-grabbing",onPointerDown:_,onPointerMove:V,onPointerUp:W,onPointerCancel:z,onLostPointerCapture:z,children:[i.jsx("div",{className:"mx-auto mt-2 h-1 w-9 rounded-full bg-gray-300 dark:bg-gray-600"}),i.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 pt-1.5",children:[i.jsx("span",{className:"text-base font-semibold",children:o??""}),i.jsx("button",{type:"button","aria-label":x.common.close,onClick:l,onPointerDown:q=>q.stopPropagation(),className:"rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]",children:u})]})]}):null}const MA=new Set(["txt","md","json","js","mjs","cjs","ts","tsx","jsx","py","sh","bash","yaml","yml","toml","css","html","htm","csv","log","xml","ini","conf","rs","go","java","c","h","cpp","hpp","sql","rb","php","gitignore","env"]),AA=new Set(["png","jpg","jpeg","gif","webp","svg"]),RA=new Set(["html","htm"]),t1=256*1024,n1=64*1024,LA={html:"html",htm:"html",css:"css",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",py:"python",rb:"ruby",php:"php",go:"go",rs:"rust",java:"java",c:"c",h:"c",cpp:"cpp",hpp:"cpp",sh:"shellscript",bash:"shellscript",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",xml:"xml",sql:"sql",log:"log"};function _A(e){return LA[e]??"text"}function a1(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function dc(e,n){return e===""?n:`${e}/${n}`}function r1(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}const l1=/^[a-z][a-z0-9+.-]*:/i;function s1(e,n){const r=n.startsWith("/")||e===""?[]:e.split("/");for(const l of n.split("/"))l===""||l==="."||(l===".."?r.pop():r.push(l));return r.join("/")}const Gf="<script>(function(){function mk(){var m={};return{getItem:function(k){return k in m?m[k]:null},setItem:function(k,v){m[k]=String(v)},removeItem:function(k){delete m[k]},clear:function(){m={}},key:function(i){return Object.keys(m)[i]||null},get length(){return Object.keys(m).length}}}['localStorage','sessionStorage'].forEach(function(n){try{window[n].length}catch(e){Object.defineProperty(window,n,{value:mk(),configurable:true})}})})();<\/script>";function IA(e){return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,n=>n+Gf):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,n=>n+Gf):Gf+e}function i1({session:e,openRequest:n,active:r,onPreviewOpen:l}){const[o,u]=b.useState(""),[d,f]=b.useState(null),[m,h]=b.useState(null),[g,v]=b.useState(null),[k,w]=b.useState(null),[j,C]=b.useState(!1),[N,M]=b.useState(0),[O,R]=b.useState(!1),[$,H]=b.useState("rendered");b.useEffect(()=>{let A=!1;return h(null),OS(e.sessionId,o).then(L=>{A||f(L)}).catch(L=>{A||h(L instanceof He?L.message:x.files.loadFailed)}),()=>{A=!0}},[e.sessionId,o,N]),b.useEffect(()=>{u(""),v(null),f(null),w(null)},[e.sessionId]);const _=b.useRef(r);b.useEffect(()=>{r&&!_.current&&M(A=>A+1),_.current=r},[r]);const V=b.useRef(l);V.current=l;const G=b.useCallback(async A=>{V.current?.();const L=A.includes("/")?A.slice(A.lastIndexOf("/")+1):A,X=a1(L);if(H("rendered"),AA.has(X)){v({path:A,name:L,kind:"image"});return}if(X==="pdf"){v({path:A,name:L,kind:"pdf"});return}const F=RA.has(X),D=X==="md";if(!F&&!MA.has(X)){v({path:A,name:L,kind:"unsupported"});return}try{const te=await fetch(sl(e.sessionId,A),{credentials:"same-origin"});if(!te.ok)throw new Error(String(te.status));const ee=await te.text(),we=ee.length>t1;D&&ee.length>n1&&H("source"),v({path:A,name:L,kind:F?"html":D?"md":"text",content:we?ee.slice(0,t1):ee,truncated:we})}catch{v({path:A,name:L,kind:"unsupported"})}},[e.sessionId]);b.useEffect(()=>{if(!n)return;const A=n.path,L=A.includes("/")?A.slice(0,A.lastIndexOf("/")):"";u(L),M(X=>X+1),G(A)},[n,G]);const W=A=>{G(dc(o,A))},z=A=>{const L=A.target.files;!L||L.length===0||(C(!0),w(null),h(null),(async()=>{try{for(const X of L){const F=await new Promise((D,te)=>{const ee=new FileReader;ee.onload=()=>{const we=ee.result;D(we.slice(we.indexOf(",")+1))},ee.onerror=()=>te(new Error("read failed")),ee.readAsDataURL(X)});await $S(e.sessionId,dc(o,X.name),F)}w(x.files.uploaded),M(X=>X+1)}catch(X){h(X instanceof He?X.message:x.common.unknownError)}finally{C(!1)}})(),A.target.value="")},q=o===""?[]:o.split("/");return g!==null?i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[i.jsxs("button",{type:"button",onClick:()=>{v(null),M(A=>A+1)},title:x.files.backToList,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-sm text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M15 18l-6-6 6-6"})}),x.files.backToList]}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm font-semibold",title:g.path,children:g.name}),(g.kind==="html"||g.kind==="md")&&i.jsx("div",{className:"flex shrink-0 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800",children:[["rendered",x.files.htmlRendered],["source",x.files.htmlSource]].map(([A,L])=>i.jsx("button",{type:"button",onClick:()=>H(A),className:`rounded px-2 py-0.5 text-xs transition-colors duration-150 ${$===A?"bg-white font-medium text-gray-900 shadow-sm dark:bg-gray-600 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:L},A))}),/\.html?$/i.test(g.name)&&i.jsx("a",{href:US(e.sessionId,g.path),target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center rounded-md border border-transparent bg-transparent px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:x.files.openInNewTab}),i.jsx("a",{href:sl(e.sessionId,g.path,!0),download:g.name,className:"inline-flex shrink-0 items-center rounded-md border border-transparent bg-transparent px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:x.files.download})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:g.kind==="image"?i.jsx("img",{src:sl(e.sessionId,g.path),alt:g.name,className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):g.kind==="pdf"?i.jsx("iframe",{src:sl(e.sessionId,g.path),title:g.name,className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 dark:border-gray-800"}):g.kind==="html"&&$==="rendered"?i.jsx("iframe",{srcDoc:IA(g.content??""),title:g.name,sandbox:"allow-scripts",className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 bg-white dark:border-gray-800"}):g.kind==="md"&&$==="rendered"?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"md-body text-base leading-relaxed text-gray-800 dark:text-gray-100",children:i.jsx(tu,{remarkPlugins:[nu],components:{img:({src:A,alt:L})=>i.jsx("img",{src:typeof A=="string"&&!l1.test(A)?sl(e.sessionId,s1(r1(g.path),A)):A,alt:L??"",loading:"lazy",className:"max-w-full"}),a:({href:A,children:L})=>{if(typeof A!="string"||A.startsWith("#"))return i.jsx("a",{href:A,children:L});if(l1.test(A))return i.jsx("a",{href:A,target:"_blank",rel:"noreferrer",children:L});const X=s1(r1(g.path),A);return i.jsx("a",{href:sl(e.sessionId,X),onClick:F=>{F.preventDefault(),G(X)},children:L})}},children:g.content??""})}),g.truncated&&i.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",x.files.previewTruncated]})]}):g.kind==="text"||g.kind==="html"||g.kind==="md"?i.jsxs(i.Fragment,{children:[i.jsx(Vb,{language:_A(a1(g.name)),code:g.content??"",highlight:(g.content?.length??0)<=n1}),g.truncated&&i.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",x.files.previewTruncated]})]}):i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:x.files.previewUnsupported})})]}):i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[i.jsx("button",{type:"button",onClick:()=>{u("")},className:"rounded px-1.5 py-0.5 text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:x.files.root}),q.map((A,L)=>i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),i.jsx("button",{type:"button",onClick:()=>u(q.slice(0,L+1).join("/")),className:"max-w-32 truncate rounded px-1 py-0.5 text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:A})]},L)),i.jsx("span",{className:"flex-1"}),i.jsx(Na,{open:O,setOpen:R,menuClass:"right-0 top-full mt-1 w-max max-w-72 origin-top-right",button:i.jsx(ye,{size:"sm",variant:O?"primary":"ghost",onClick:()=>R(A=>!A),children:x.files.details}),children:i.jsxs("div",{className:"px-3.5 py-2.5",children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.files.workspacePath}),i.jsx("p",{className:"mt-1 break-all font-mono text-xs leading-5",children:e.workspace})]})}),i.jsx(ye,{size:"sm",variant:"ghost",onClick:()=>M(A=>A+1),children:x.files.refresh}),i.jsxs("label",{className:"inline-flex cursor-pointer items-center rounded-md border border-transparent bg-transparent px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 focus-within:ring-2 focus-within:ring-gray-400/30 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:[i.jsx("input",{type:"file",multiple:!0,className:"sr-only",onChange:z,disabled:j}),j?x.common.saving:x.files.upload]})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[m?i.jsx("p",{className:"px-3 py-3 text-sm text-red-600 dark:text-red-400",children:m}):d===null?i.jsx(Dr,{rows:6}):d.entries.length===0?i.jsx("p",{className:"px-3 py-3 text-sm text-gray-400",children:x.files.empty}):i.jsx("ul",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:d.entries.map(A=>i.jsx("li",{children:i.jsxs("div",{className:"group flex items-center gap-2 px-3 py-1.5 transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsxs("button",{type:"button",onClick:()=>A.kind==="dir"?u(dc(o,A.name)):W(A.name),className:"flex min-w-0 flex-1 items-center gap-2 text-left",title:A.name,children:[i.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:A.kind==="dir"?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:i.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})})}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:A.name})]}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400 dark:text-gray-500",children:A.kind==="file"?hm(A.sizeBytes):""}),i.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:block dark:text-gray-500",children:A.mtime?$n(A.mtime):""}),A.kind==="file"&&i.jsx("a",{href:sl(e.sessionId,dc(o,A.name),!0),download:A.name,title:x.files.download,className:"shrink-0 rounded p-1 text-gray-300 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 group-hover:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})})]})},A.name))}),k&&i.jsx("p",{className:"px-3 py-2 text-xs text-emerald-600 dark:text-emerald-400",children:k})]})]})}function zA(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function DA({session:e,panel:n}){return n.isDocked?i.jsxs(i.Fragment,{children:[n.open&&i.jsx("div",{onMouseDown:n.startResize,onDoubleClick:n.resetWidth,title:x.files.resizeHandle,className:`w-1.5 shrink-0 cursor-col-resize transition-colors duration-150 hover:bg-brand-300/50 dark:hover:bg-brand-700/40 ${n.resizing?"bg-brand-400/60":"bg-transparent"}`}),i.jsx("div",{ref:n.panelRef,style:{width:n.open?n.width:0},inert:!n.open,className:`relative flex min-h-0 shrink-0 flex-col overflow-hidden border-l border-gray-200 dark:border-gray-800 ${n.resizing?"pointer-events-none":"transition-[width] duration-200"}`,children:i.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[i.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:x.files.title}),i.jsx("button",{type:"button",onClick:()=>n.setOpen(!1),title:x.common.close,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx(zA,{})})]}),i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(i1,{session:e,openRequest:n.openRequest,active:n.open})})]})})]}):i.jsx(EA,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:x.files.title,children:i.jsx("div",{className:"flex h-full min-h-0 flex-col",children:i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(i1,{session:e,openRequest:n.openRequest,active:n.open,onPreviewOpen:()=>n.setSheetSnap("full")})})})})}const ru=320,o1="(min-width: 1024px)",zm="penguin.filesPanelWidth";function Hc(e){return Math.max(ru,Math.min(720,Math.round(e*.5)))}function dk(e){return Math.min(Hc(e),Math.max(ru,Math.round(e*.34)))}function OA(){const e=Number(localStorage.getItem(zm));return!Number.isFinite(e)||e<=0?dk(window.innerWidth):Math.min(Hc(window.innerWidth),Math.max(ru,Math.round(e)))}function UA(e){const[n,r]=b.useState(!1),[l,o]=b.useState("half"),[u,d]=b.useState(null),f=b.useCallback(R=>{R&&o("half"),r(R)},[]),[m,h]=b.useState(OA),g=b.useRef(m),[v,k]=b.useState(!1),[w,j]=b.useState(()=>window.matchMedia(o1).matches),C=b.useRef(null);b.useEffect(()=>{d(null)},[e]),b.useEffect(()=>{const R=window.matchMedia(o1),$=H=>j(H.matches);return R.addEventListener("change",$),()=>R.removeEventListener("change",$)},[]);const N=b.useCallback(R=>{o("full"),d({path:R})},[]);b.useEffect(()=>{if(!v)return;const R=H=>{const _=C.current?.getBoundingClientRect(),V=_?_.right:window.innerWidth,G=Math.min(Hc(window.innerWidth),Math.max(ru,V-H.clientX));g.current=G,h(G)},$=()=>{k(!1),localStorage.setItem(zm,String(Math.round(g.current)))};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",R),window.addEventListener("mouseup",$),()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",$)}},[v]);const M=b.useCallback(R=>{R.preventDefault(),k(!0)},[]),O=b.useCallback(()=>{const R=dk(window.innerWidth);g.current=R,h(R),localStorage.removeItem(zm)},[]);return b.useEffect(()=>{const R=()=>{h($=>{const H=Math.min($,Hc(window.innerWidth));return H!==$&&(g.current=H),H})};return window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]),{open:n,setOpen:f,sheetSnap:l,setSheetSnap:o,browsePath:N,openRequest:u,isDocked:w,width:m,resizing:v,startResize:M,resetWidth:O,panelRef:C}}const $A=300;function BA(e){const n=Nn().user?.userId??null,r=n&&e?ck(n,e):null,l=b.useMemo(()=>r?au(r):{},[r]),o=b.useRef(l.text??""),u=b.useRef(l.handoffAgentId??null),d=b.useRef(l.skills??[]),f=b.useRef(null),m=b.useCallback(()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},[]),h=b.useCallback(()=>{if(m(),!r)return;const j=o.current,C=u.current,N=d.current;if(!j&&!C&&N.length===0){Bc(r);return}const M={text:j};C&&(M.handoffAgentId=C),N.length>0&&(M.skills=N),Ii(r,M)},[m,r]);b.useEffect(()=>(o.current=l.text??"",u.current=l.handoffAgentId??null,d.current=l.skills??[],()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null,h())}),[l,h]);const g=b.useCallback(j=>{o.current=j,m(),f.current=window.setTimeout(()=>{f.current=null,h()},$A)},[m,h]),v=b.useCallback(j=>{u.current=j,h()},[h]),k=b.useCallback(j=>{d.current=j,h()},[h]),w=b.useCallback(()=>{m(),d.current=[],r&&Bc(r)},[m,r]);return{initial:l,onTextChange:g,onHandoffTargetChange:v,onSkillsChange:k,discard:w}}function HA(e){const n=e.now??(()=>Date.now()),r=new Set,l=new Map;let o=Cc(r),u=!1,d="buffering",f=[],m=null,h=0,g=!1;const v=()=>{l.size!==0&&(l.clear(),e.onPendingChange())},k=(N,M)=>{if(nh(N)&&N.payload.type==="approval_decision"&&l.delete(us(N.origin,N.payload.tool_call_id))&&e.onPendingChange(),M&&!th(N.payload)&&b4(M,N)){Uv(o,N);return}Ic(o,N,n())},w=N=>{switch(N.type){case"approval_request":{const M=N.toolCall.payload.tool_call_id,O={toolCall:N.toolCall};if(N.origin&&(O.origin=N.origin),l.set(us(N.origin,M),O),!d4(o,N.origin,M)){const R={...N.toolCall};N.origin&&N.origin.length>0?R.origin=[...N.origin]:delete R.origin,Ic(o,R,n()),e.onModelChange()}e.onPendingChange();return}case"task_state":{m=N.state,e.onTaskState(N.state),N.state==="idle"&&(o4(o,n()),v(),e.onModelChange());return}case"resync_required":{j();return}case"hello":return}},j=async()=>{h+=1,d="buffering",f=[],v(),await C(h,Cc(r))},C=async(N,M)=>{try{const O=await e.loadMessages();if(u||N!==h)return;M&&(o=M);const R=o;i4(R,O,n());const $=v4(O,100),H=f;f=[];for(let _=0;_<H.length;_+=1){const V=H[_];if(V.kind==="omni"?k(V.msg,$):w(V.ev),u)return;if(N!==h){f.push(...H.slice(_+1));return}}d="live",m==="idle"&&c4(R),g=!1,e.onError(null),e.onLoading(!1),e.onModelChange()}catch(O){if(u||N!==h)return;g=!0,e.onLoading(!1),e.onError(O instanceof Error?O.message:String(O))}};return{get model(){return o},get pendingApprovals(){return l},load:()=>(h+=1,C(h)),retry:async()=>{u||!g||(e.onError(null),e.onLoading(!0),h+=1,await C(h,Cc(r)))},handleOmni:N=>{if(!u){if(d==="buffering"){f.push({kind:"omni",msg:N});return}k(N,null),e.onModelChange()}},handleServer:N=>{if(!u){if(N.type==="session_title"){e.onSessionTitle?.(N.sessionId,N.title);return}if(N.type==="session_created"){e.onSessionCreated?.(N.sessionId);return}if(d==="buffering"){N.type==="task_state"&&(m=N.state,e.onTaskState(N.state)),f.push({kind:"server",ev:N});return}w(N)}},markLocalDecision:N=>{u4(o,N)},resolveApproval:N=>{l.delete(N)&&e.onPendingChange()},dispose:()=>{u=!0}}}const PA=120,qA=new Map;function FA(e,n,r,l){const[o,u]=b.useState(0),[d,f]=b.useState(!0),[m,h]=b.useState(n),[g,v]=b.useState(null),[k,w]=b.useState(0),j=b.useRef(r);j.current=r;const C=b.useRef(l);C.current=l;const N=b.useRef(null),M=b.useRef(null);M.current===null&&(M.current=Cc());const O=b.useRef(null),R=b.useRef(null),$=b.useRef(0),H=b.useCallback(()=>{if(O.current!==null||R.current!==null)return;const W=()=>{$.current=Date.now(),u(q=>q+1)},z=$.current+PA-Date.now();if(z>0){R.current=window.setTimeout(()=>{R.current=null,W()},z);return}O.current=requestAnimationFrame(()=>{O.current=null,W()})},[]);b.useEffect(()=>{if(!e){N.current?.dispose(),N.current=null,h("idle"),f(!1),v(null),w(q=>q+1),u(q=>q+1);return}u(q=>q+1),f(!0),v(null),h(n),w(q=>q+1);const W=HA({loadMessages:async()=>(await AS(e)).messages,onTaskState:h,onLoading:f,onError:v,onModelChange:H,onPendingChange:()=>w(q=>q+1),onSessionTitle:(q,A)=>j.current?.(q,A),onSessionCreated:()=>C.current?.()});N.current=W;const z=R5(e,{onOmniMessage:W.handleOmni,onServerEvent:W.handleServer,onError:q=>{q&&rm().catch(()=>{})}});return W.load(),()=>{W.dispose(),z.close(),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[e]);const _=b.useCallback(W=>{N.current?.markLocalDecision(W)},[]),V=b.useCallback(W=>{N.current?.resolveApproval(W)},[]),G=b.useCallback(()=>{N.current?.retry()},[]);return{model:N.current?.model??M.current,version:o,loading:d,taskState:m,pendingApprovals:N.current?.pendingApprovals??qA,markLocalDecision:_,resolveApproval:V,error:g,retry:G}}const fc={tokens:"M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3zm0 0v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",cost:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",elapsed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",folder:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"};function Kf({icon:e,value:n,label:r}){return i.jsxs("span",{title:r,className:"flex shrink-0 items-center gap-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:e})}),n]})}const ja="new";function VA(){const e=ia(),n=yv(),{currency:r}=xl(),{currentProject:l,currentAgent:o,setCurrentAgentId:u,reloadAgents:d,agents:f}=sn(),m=l?.projectId??null,h=o?.agentId??null,{sessions:g,loading:v,reload:k,add:w,replace:j,setStatus:C,setTitle:N}=Ui(),[M,O]=b.useState(null),[R,$]=b.useState(!1),[H,_]=b.useState(!1),[V,G]=b.useState(!1),[W,z]=b.useState(!1),[q,A]=b.useState(null),L=n.sessionId??null,X=UA(L),F=L===ja,D=F?null:g.find(ge=>ge.sessionId===L)??null,te=D?{provider:D.provider,modelId:D.modelId}:null;Ta(D?D.title??x.chat.defaultSessionTitle:x.nav.chat);const ee=FA(D?.sessionId??null,D?.status??"idle",N,()=>{k()}),{initial:we,onTextChange:U,onHandoffTargetChange:I,onSkillsChange:B,discard:T}=BA(D?.sessionId??null),re=D?.sessionId??null,de=D?.agentId??null;b.useEffect(()=>{re&&de&&u(de)},[re,de,u]);const[fe,he]=b.useState([]);b.useEffect(()=>{if(he(ve=>ve.length>0?[]:ve),!m||!de)return;let ge=!1;return Hm(m,de).then(ve=>{ge||he(ve.skills)}).catch(()=>{}),()=>{ge=!0}},[m,de]);const[Ce,ne]=b.useState(null);b.useEffect(()=>{if(F||!L||v||g.some(ve=>ve.sessionId===L))return;let ge=!1;return MS(L).then(ve=>{ge||w(ve.session)},()=>{ge||ne(L)}),()=>{ge=!0}},[F,L,v,g,w]),b.useEffect(()=>{if(v||F||L&&g.some(ve=>ve.sessionId===L)||L&&Ce!==L)return;const ge=g[0];e(ge?`/chat/${ge.sessionId}`:`/chat/${ja}`,{replace:!0})},[v,F,L,Ce,g,e]),b.useEffect(()=>{D&&C(D.sessionId,ee.taskState)},[ee.taskState,D,C]);const me=b.useRef(ee.taskState);b.useEffect(()=>{const ge=me.current;me.current=ee.taskState,ge!=="idle"&&ee.taskState==="idle"&&(k(),d())},[ee.taskState,k,d]);const be=b.useRef(new Map);b.useEffect(()=>{O(null),$(!1),be.current=new Map},[L]);const De=b.useCallback(async ge=>{const ve=D?.sessionId??null,Xe=be.current,lt=ve===null?[]:ge.filter(et=>!Xe.has(et));if(ve!==null&<.length>0){const et=BS(ve,lt).then(ot=>new Set(ot.existing)).catch(()=>null);for(const ot of lt)Xe.set(ot,et.then(tt=>{if(tt===null)return Xe.delete(ot),!1;const en=tt.has(ot);return Xe.set(ot,en),en}))}const Ve=new Set;return await Promise.all(ge.map(async et=>{const ot=Xe.get(et);(ot===!0||ot instanceof Promise&&await ot)&&Ve.add(et)})),Ve},[D?.sessionId]);b.useEffect(()=>{if(!m||!D||ee.taskState!=="idle")return;let ge=!1;return J1(m,{groupBy:"session",agentId:D.agentId}).then(ve=>{if(ge)return;const Xe=ve.groups.find(lt=>lt.key===D.sessionId);O(Xe?.cost??null),$(Xe?.hasUncosted??!1)}).catch(()=>{}),()=>{ge=!0}},[m,D,ee.taskState]),b.useEffect(()=>{if(!m)return;let ge=!1;return A(null),(async()=>{try{const ve=await Fc(m);if(ge)return;A(ve);const{prefs:Xe}=await mS();if(ge||Xe.credentialGuideSeen)return;const lt=ve.models.find(et=>vt(et,ve.defaultModel));(!ve.defaultModel||!lt?.credential?.apiKeyMasked)&&_(!0),Y1({credentialGuideSeen:!0}).catch(()=>{})}catch{}})(),()=>{ge=!0}},[m]);const Fe=b.useCallback(async(ge,ve)=>{ve!==ge&&(await k(),e(`/chat/${ve}`,{replace:!0}))},[k,e]),Ie=b.useCallback(async ge=>{if(!D)return!1;try{const ve=await Mc(D.sessionId,{input:ge});return T(),await Fe(D.sessionId,ve.sessionId),!0}catch(ve){return On(er(ve,{modelId:D.modelId})),!1}},[D,T,Fe]),Lt=b.useCallback(async(ge,ve)=>{if(!m||!o||!D)return!1;const Xe={type:"text",text:Qb({agentId:o.agentId,...o.name!==void 0?{agentName:o.name}:{},sessionId:D.sessionId,workspace:D.workspace,...D.title!==void 0?{sessionTitle:D.title}:{}})};let lt=null;try{const Ve=await lm(m,ge.agentId,{approvalMode:D.approvalMode});lt=Ve.session.sessionId;const et=await Mc(lt,{input:[Xe,...ve]});return w(Ve.session),T(),e(`/chat/${et.sessionId}`),!0}catch(Ve){return lt&&Ec(lt).catch(()=>{}),On(er(Ve,q?.defaultModel?{modelId:q.defaultModel.modelId}:{})),!1}},[m,o,D,w,T,e,q]),Kt=b.useCallback(async()=>{D&&await LS(D.sessionId).catch(()=>{})},[D]),_t=b.useCallback(async(ge,ve,Xe)=>{if(!D)return;ee.markLocalDecision(ge);const lt=us(Xe,ge);try{await RS(D.sessionId,ge,{decision:ve}),ee.resolveApproval(lt)}catch(Ve){Ve instanceof He&&Ve.status===404&&ee.resolveApproval(lt)}},[D,ee]),Pn=b.useCallback(ge=>{!D||W||(z(!0),sm(D.sessionId,{approvalMode:ge}).then(ve=>j(ve.session)).catch(ve=>{On(er(ve))}).finally(()=>z(!1)))},[D,W,j]),je=b.useCallback(async()=>{if(D)try{const ge=await _S(D.sessionId);await Fe(D.sessionId,ge.sessionId)}catch(ge){On(er(ge,{modelId:D.modelId}))}},[D,Fe]),$e=b.useCallback(()=>{e(`/chat/${ja}`)},[e]),rt=q?.models.find(ge=>vt(ge,te))?.pricing,pt={pendingApprovals:ee.pendingApprovals,onApprove:_t,origin:[],taskRunning:ee.taskState!=="idle",taskCost:ge=>{if(!rt)return null;const ve=ge.tokensByBucket;return(ve.cacheRead*rt.cacheRead+ve.cacheWrite*rt.cacheWrite+ve.output*rt.output)/1e6},onOpenFile:ge=>{X.setOpen(!0),X.browsePath(ge)},workspace:D?.workspace??null,statFiles:De};if(!m||!h)return i.jsx("div",{className:"p-6",children:i.jsx(At,{className:"h-6 w-64"})});const $t=ee.model.stats.sessionTotal+ee.model.stats.subagentTotal,bt=q?.models.find(ge=>vt(ge,te)),on=bt?.contextWindow,le=bt?.vision!==!1,pe=D!==null&&!ee.loading&&!ee.error&&ee.model.items.length===0,Ee=D&&i.jsx(ik,{status:ee.taskState,onSend:Ie,onStop:Kt,onCompact:je,modelRef:te,...q!==null?{models:q.models}:{},sessionThinkingLevel:ee.model.thinkingLevel,...on!==void 0?{contextWindow:on}:{},contextNow:ee.model.stats.contextNow,contextStale:ee.model.stats.contextStale,vision:le,approvalMode:D.approvalMode,onChangeApprovalMode:Pn,modeSaving:W,autoFocus:!0,agents:f,skills:fe,...we.skills&&we.skills.length>0?{initialSkills:we.skills}:{},onSkillsChange:B,onHandoff:Lt,initialText:we.text??"",onTextChange:U,...we.handoffAgentId?{initialHandoffTargetId:we.handoffAgentId}:{},onHandoffTargetChange:I});return i.jsxs("div",{className:"flex h-full flex-col bg-white dark:bg-gray-950",children:[D&&i.jsxs("div",{className:"flex shrink-0 items-center gap-2.5 border-b border-gray-200 px-3 py-2 md:px-4 dark:border-gray-800",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[i.jsx("h1",{className:"flex min-w-0 text-[15px] font-semibold",children:i.jsx(Yc,{text:D.title??x.chat.defaultSessionTitle})}),ee.taskState==="running"&&i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500"}),x.chat.statusRunning]})]}),i.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[i.jsx(Kf,{icon:fc.tokens,value:ft($t),label:`${x.chat.statTokens}(Token)`}),M!=null&&i.jsx(Kf,{icon:fc.cost,value:`${la(M,r)}${R?" *":""}`,label:`${x.chat.statCost}(${r})${R?` · ${x.usage.uncostedNote}`:""}`}),i.jsx(Kf,{icon:fc.elapsed,value:Jt(ee.model.stats.sessionElapsedMs),label:x.chat.statElapsed})]}),i.jsxs("button",{type:"button","aria-expanded":X.open,onClick:()=>X.setOpen(!X.open),title:x.chat.openWorkspace,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors duration-150 ${X.open?"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200":"text-gray-500 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`,children:[i.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:i.jsx("path",{d:fc.folder})}),x.chat.openWorkspace]}),i.jsx(Na,{open:V,setOpen:G,menuClass:"right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] origin-top-right",button:i.jsx("button",{type:"button",title:x.chat.infoPanel,onClick:()=>G(!V),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("circle",{cx:"12",cy:"12",r:"9"}),i.jsx("path",{d:"M12 11v5m0-8h.01"})]})}),children:i.jsxs("div",{className:"space-y-3 px-3.5 py-2.5 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.model}),i.jsxs("p",{className:"truncate text-xs",children:[i.jsx("span",{className:"font-mono",children:D.modelId}),i.jsx("span",{className:"ml-1.5 text-gray-400 dark:text-gray-500",children:aa(D.provider)?.label??D.provider})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.workspace}),i.jsx("p",{className:"break-all font-mono text-xs leading-5",children:D.workspace})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.models.createdAt}),i.jsx("p",{className:"font-mono text-xs",children:$n(D.createdAt)})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.sessionStats}),i.jsxs("p",{className:"font-mono text-xs",children:[x.chat.statTokens," ",ft($t),M!=null&&` · ${x.chat.statCost} ${la(M,r)}`," ","· ",x.chat.statElapsed," ",Jt(ee.model.stats.sessionElapsedMs)]})]})]})})]}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:F?i.jsx(xA,{projectId:m,models:q},`draft:${m}`):i.jsx("div",{className:"anim-fade flex min-h-0 flex-1 flex-col",children:D?ee.error?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6",children:[i.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400",children:[x.chat.historyLoadFailed,":",ee.error]}),i.jsx(ye,{onClick:ee.retry,children:x.common.retry})]}):ee.loading?i.jsxs("div",{className:"space-y-3 p-6",children:[i.jsx(At,{className:"h-5 w-1/3"}),i.jsx(At,{className:"h-5 w-2/3"}),i.jsx(At,{className:"h-5 w-1/2"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"min-h-0 flex-1",children:pe?i.jsx("div",{className:"flex h-full items-center justify-center px-4",children:i.jsx("p",{className:"text-lg font-medium text-gray-400 dark:text-gray-500",children:x.chat.emptyGreeting})}):i.jsx(F6,{items:ee.model.items,version:ee.version,ctx:pt})}),i.jsx("div",{className:"shrink-0 border-t border-gray-200 bg-white px-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3 dark:border-gray-800 dark:bg-gray-950",children:i.jsx("div",{className:"mx-auto max-w-3xl",children:Ee})})]}):v?i.jsx("div",{className:"space-y-3 p-6",children:i.jsx(At,{className:"h-5 w-1/2"})}):i.jsx(Or,{title:x.chat.noSessions,action:i.jsx(ye,{onClick:$e,children:x.nav.newChat})})},D?.sessionId??"empty")}),D&&i.jsx(DA,{session:D,panel:X})]}),i.jsx(Dt,{open:H,title:x.project.noCredentialTitle,onClose:()=>_(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>_(!1),children:x.project.later}),i.jsx(ye,{variant:"primary",onClick:()=>{_(!1),e("/models")},children:x.project.goToModels})]}),children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.project.noCredentialBody})})]})}const fk=/^[a-z][a-z0-9_]{1,63}$/,c1=/^[a-z][a-z0-9_]{1,31}$/,GA=/^[a-z0-9_]+$/,KA=64;function WA({open:e,onClose:n,onCreated:r}){const{user:l}=Nn(),o=l&&!l.isAdmin?`${l.userId}-`:"",[u,d]=b.useState(""),[f,m]=b.useState(""),[h,g]=b.useState(null),[v,k]=b.useState(!1);b.useEffect(()=>{e&&(d(""),m(""),g(null))},[e]);const w=async()=>{const j=o+u.trim();if(!u.trim()){g(x.common.requiredField);return}if(!(o?GA.test(u.trim())&&j.length<=KA:fk.test(j))){g(o?x.project.idPrefixHint:x.project.idHint);return}k(!0),g(null);try{const N=await vS({projectId:j,...f.trim()?{name:f.trim()}:{}});r(N.project.projectId)}catch(N){g(N instanceof He?N.message:x.common.unknownError)}finally{k(!1)}};return i.jsx(Dt,{open:e,title:x.project.createTitle,onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:n,children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:v,onClick:()=>{w()},children:x.common.create})]}),children:i.jsxs("div",{className:"space-y-3",children:[o?i.jsxs("div",{children:[i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.project.id}),i.jsxs("div",{className:"flex items-stretch",children:[i.jsx("span",{className:"flex shrink-0 items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-100 px-2 font-mono text-xs text-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400",children:o}),i.jsx(Je,{size:"sm",className:"rounded-l-none",value:u,onChange:j=>d(j.target.value),autoFocus:!0})]}),i.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:x.project.idPrefixHint})]}):i.jsx(Je,{label:x.project.id,size:"sm",value:u,onChange:j=>d(j.target.value),hint:x.project.idHint,autoFocus:!0}),i.jsx(Je,{label:x.project.name,size:"sm",value:f,onChange:j=>m(j.target.value)}),h&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:h})]})})}function YA({open:e,onClose:n}){const{user:r}=Nn(),{currentProject:l,setCurrentProjectId:o,projects:u,reloadProjects:d}=sn(),[f,m]=b.useState(null),[h,g]=b.useState(""),[v,k]=b.useState(null),[w,j]=b.useState(!1),C=l?.projectId,N=l?.role==="owner";if(b.useEffect(()=>{!e||!C||(m(null),k(null),j(!1),kf(C).then($=>m($.members)).catch($=>k($ instanceof He?$.message:x.common.unknownError)))},[e,C]),!l||!C)return null;const M=async()=>{if(h.trim()){k(null);try{await kS(C,{userId:h.trim()}),g("");const $=await kf(C);m($.members)}catch($){k($ instanceof He?$.message:x.common.unknownError)}}},O=async $=>{k(null);try{await wS(C,$);const H=await kf(C);m(H.members)}catch(H){k(H instanceof He?H.message:x.common.unknownError)}},R=async()=>{k(null);try{await bS(C),n();const $=u.find(H=>H.projectId!==C);await d(),$&&o($.projectId)}catch($){k($ instanceof He?$.message:x.common.unknownError)}};return i.jsx(Dt,{open:e,title:x.project.settingsTitle,onClose:n,children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.project.switcher}),i.jsxs("p",{className:"text-sm",children:[um(l)," ",i.jsx("span",{className:"font-mono text-xs text-gray-400",children:C})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500",children:x.project.members}),f===null?i.jsx("p",{className:"text-xs text-gray-400",children:x.common.loading}):i.jsx("div",{className:"overflow-x-auto rounded-md border border-gray-200 dark:border-gray-800",children:i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50 text-left text-gray-500 dark:border-gray-800 dark:bg-gray-900/60 dark:text-gray-400",children:[i.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:x.project.memberUsername}),i.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:x.project.memberRole}),i.jsx("th",{className:"w-20 whitespace-nowrap px-2.5 py-1.5 text-right font-medium",children:x.project.memberActions})]})}),i.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[f.map($=>i.jsxs("tr",{children:[i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:$.userId}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:i.jsx(Rt,{tone:"gray",children:$.role})}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:N&&$.role!=="owner"&&$.userId!==r?.userId&&i.jsx(ye,{size:"sm",variant:"ghost",onClick:()=>{O($.userId)},children:x.project.removeMember})})]},$.userId)),N&&i.jsxs("tr",{children:[i.jsx("td",{className:"px-2.5 py-1.5",children:i.jsx(Je,{placeholder:x.project.memberUsername,size:"sm",value:h,onChange:$=>g($.target.value),onKeyDown:$=>{$.key==="Enter"&&M()}})}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:i.jsx(Rt,{tone:"gray",children:"member"})}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:i.jsx(ye,{size:"sm",disabled:!h.trim(),onClick:()=>{M()},children:x.project.addMember})})]})]})]})})]}),N&&i.jsx("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:C==="default_project"?i.jsx("p",{className:"text-xs text-gray-400",children:x.project.deleteDefaultForbidden}):u.length<=1?i.jsx("p",{className:"text-xs text-gray-400",children:x.project.deleteLastForbidden}):w?i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:x.project.deleteConfirm}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ye,{size:"sm",onClick:()=>j(!1),children:x.common.cancel}),i.jsx(ye,{size:"sm",variant:"danger",onClick:()=>{R()},children:x.common.confirm})]})]}):i.jsx(ye,{size:"sm",variant:"danger",onClick:()=>j(!0),children:x.project.deleteProject})}),v&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:v})]})})}const XA="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z",QA="M3 3l18 18M10.6 5.1A11 11 0 0 1 12 5c6.4 0 10 7 10 7a17.6 17.6 0 0 1-3.2 3.9M6.6 6.6C4 8.3 2 12 2 12s3.6 7 10 7a10 10 0 0 0 4.8-1.2M9.9 9.9a3 3 0 0 0 4.2 4.2";function Ir({label:e,hint:n,error:r,invalid:l,size:o="base",className:u,...d}){const[f,m]=b.useState(!1),h=f?x.auth.hidePassword:x.auth.showPassword;return i.jsxs("label",{className:"block",children:[e&&i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:e}),i.jsxs("div",{className:"relative",children:[i.jsx(Je,{...d,size:o,type:f?"text":"password",invalid:!!r||!!l,className:`${o==="sm"?"pr-8":"pr-10"} ${u??""}`}),i.jsx("button",{type:"button","aria-label":h,title:h,tabIndex:-1,onClick:()=>m(g=>!g),className:`absolute inset-y-0 right-0 flex items-center justify-center text-gray-400 transition-colors duration-150 hover:text-gray-600 dark:hover:text-gray-300 ${o==="sm"?"w-8":"w-10"}`,children:i.jsx("svg",{width:o==="sm"?14:16,height:o==="sm"?14:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:f?QA:XA})})})]}),r?i.jsx("span",{className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:r}):n?i.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:n}):null]})}function mk({open:e,onClose:n}){const{refresh:r}=Nn(),[l,o]=b.useState(""),[u,d]=b.useState(""),[f,m]=b.useState(""),[h,g]=b.useState(null),[v,k]=b.useState(!1);b.useEffect(()=>{e&&(o(""),d(""),m(""),g(null))},[e]);const w=async()=>{if(!l||!u||!f){g(x.common.requiredField);return}if(u!==f){g(x.account.passwordMismatch);return}k(!0),g(null);try{await fS({oldPassword:l,newPassword:u}),await r(),n()}catch(j){g(j instanceof He?j.message:x.common.unknownError)}finally{k(!1)}};return i.jsx(Dt,{open:e,title:x.account.changePassword,onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:n,disabled:v,children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:v,onClick:()=>{w()},children:x.common.save})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Ir,{label:x.account.oldPassword,size:"sm",value:l,onChange:j=>o(j.target.value),autoComplete:"current-password",hint:x.account.oldPasswordHint,autoFocus:!0}),i.jsx(Ir,{label:x.account.newPassword,size:"sm",value:u,onChange:j=>d(j.target.value),autoComplete:"new-password",hint:x.auth.passwordHint}),i.jsx(Ir,{label:x.account.confirmPassword,size:"sm",value:f,onChange:j=>m(j.target.value),autoComplete:"new-password"}),h&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:h})]})})}function ta({d:e,size:n=16}){return i.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:e})})}function ZA(){return i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}const zn={agents:"M12 3v3m-6 4a6 6 0 0 1 12 0v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5zm3 3h.01M15 13h.01",skills:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",models:"M7 7h10v10H7zM4 10h3m10 0h3M4 14h3m10 0h3M10 4v3m4-3v3m-4 10v3m4-3v3",usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",traces:"M4 6h16M4 12h10M4 18h13",benchmark:"M7 4h10v5a5 5 0 0 1-10 0V4zM7 5H4v1a3 3 0 0 0 3 3m10-4h3v1a3 3 0 0 1-3 3M12 14v4m-4 0h8"},hk="M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z",JA="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",u1="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",e8="m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",t8="M12 17v5M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z",mc="block w-full px-3.5 py-2 text-left text-sm transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800",pk="penguin.sidebarGroupMode";function n8(){return localStorage.getItem(pk)==="agent"?"agent":"workspace"}const a8=e=>`penguin.sidebarCollapsedGroups.${e}`,r8=e=>`penguin.sidebarPinnedGroups.${e}`;function hc(e){if(!e)return new Set;try{const n=JSON.parse(localStorage.getItem(e)??"[]");return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function d1(e,n){if(e)try{localStorage.setItem(e,JSON.stringify([...n]))}catch{}}const Wf=(e,n)=>`${n}\0${e}`;function l8({session:e}){return e.status==="running"?i.jsx("span",{title:x.chat.statusRunning,className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):e.status==="compacting"?i.jsx("span",{title:x.chat.statusCompacting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}):null}function f1({onNavigate:e,onCollapse:n}){const r=ia(),{user:l,logout:o}=Nn(),{mode:u,setMode:d,fontScale:f,setFontScale:m,accent:h,setAccent:g,currency:v,setCurrency:k}=xl(),{lang:w,setLang:j}=Ca(),{projects:C,currentProject:N,setCurrentProjectId:M,reloadProjects:O,agents:R,currentAgent:$,setCurrentAgentId:H}=sn(),{sessions:_,byAgent:V,hasMoreByAgent:G,loadMoreFor:W,loading:z,remove:q,replace:A}=Ui(),X=pv("/chat/:sessionId")?.params.sessionId??null,[F,D]=b.useState(!1),[te,ee]=b.useState(!1),[we,U]=b.useState(!1),[I,B]=b.useState(!1),[T,re]=b.useState(!1),de=N?.projectId??null,fe=de===null?null:a8(de),he=de===null?null:r8(de),[Ce,ne]=b.useState(n8),[me,be]=b.useState(()=>hc(fe)),[De,Fe]=b.useState(()=>hc(he));b.useEffect(()=>{be(hc(fe)),Fe(hc(he))},[fe,he]);const[Ie,Lt]=b.useState(new Set),[Kt,_t]=b.useState(new Set),[Pn,je]=b.useState(new Map),[$e,rt]=b.useState(null),[pt,$t]=b.useState(!1),[bt,on]=b.useState(null),[le,pe]=b.useState(null),[Ee,ge]=b.useState(""),[ve,Xe]=b.useState(!1),[lt,Ve]=b.useState(null),et=se=>{localStorage.setItem(pk,se),ne(se)},ot=b.useMemo(()=>O5(_),[_]),tt=b.useMemo(()=>Wx(R,se=>se.agentId,De),[R,De]),en=b.useMemo(()=>Wx(ot,se=>se.key,De),[ot,De]),mn=se=>Ce==="agent"?se.agentId:dm(se.workspace),Br=se=>{const Se=new Set(me);Se.has(se)?Se.delete(se):Se.add(se),be(Se),d1(fe,Se)},Ma=se=>{const Se=new Set(De);Se.has(se)?Se.delete(se):Se.add(se),Fe(Se),d1(he,Se)},ar=se=>Lt(Se=>{const ze=new Set(Se);return ze.has(se)?ze.delete(se):ze.add(se),ze}),oe=(se,Se)=>_t(ze=>{const ct=Wf(se,Se),Bt=new Set(ze);return Bt.has(ct)?Bt.delete(ct):Bt.add(ct),Bt}),ke=b.useRef(null);b.useEffect(()=>{if(!X)return;const se=_.find(Bt=>Bt.sessionId===X);if(!se||!se.source||se.archived)return;const Se=`${Ce}\0${X}`;if(ke.current===Se)return;ke.current=Se;const ze=Ce==="agent"?se.agentId:dm(se.workspace),ct=Wf(ze,se.source);_t(Bt=>Bt.has(ct)?Bt:new Set(Bt).add(ct))},[X,_,Ce]);const Oe=async se=>{!se.archived&&se.sessionId===X&&Lt(Se=>new Set(Se).add(mn(se)));try{const Se=await sm(se.sessionId,{archived:!se.archived});A(Se.session)}catch{}},dt=async()=>{if(!le)return;const se=Ee.trim();if(se){Xe(!0),Ve(null);try{const Se=await sm(le.sessionId,{title:se});A(Se.session),pe(null)}catch(Se){Ve(Se instanceof He?Se.message:x.common.unknownError)}finally{Xe(!1)}}},Tt=async()=>{if(!$e)return;$t(!0),on(null);const se=$e;try{if(await Ec(se.sessionId),q(se.sessionId),l&&Bc(ck(l.userId,se.sessionId)),rt(null),X===se.sessionId){const Se=(V.get(se.agentId)??[]).filter(ze=>ze.sessionId!==se.sessionId&&!ze.archived);r(Se[0]?`/chat/${Se[0].sessionId}`:"/chat")}}catch(Se){on(Se instanceof He?Se.message:x.common.unknownError)}finally{$t(!1)}},oa=se=>{r(se),e?.()},pa=(se,Se)=>{se&&H(se);const ze={...se?{agentId:se}:{},...Se!==void 0?{workspace:Se}:{}};r(`/chat/${ja}`,Object.keys(ze).length>0?{state:ze}:void 0),e?.()},rr=(R.find(se=>se.agentId==="default_agent")??R[0])?.agentId,su=$?.agentId??rr,Fi=se=>{H(se.agentId),oa(`/chat/${se.sessionId}`)},Vi=b.useMemo(()=>new Map(R.map(se=>[se.agentId,jn(se)])),[R]),bl=(se,Se)=>i.jsx("ul",{className:"space-y-0.5",children:se.map(ze=>i.jsx(s8,{s:ze,active:ze.sessionId===X,...Se?{agentHint:Vi.get(ze.agentId)??ze.agentId}:{},onOpen:Fi,onRename:ct=>{Ve(null),ge(ct.title??""),pe(ct)},onDelete:ct=>{on(null),rt(ct)},onToggleArchive:ct=>{Oe(ct)}},ze.sessionId))}),Hr="flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-[11px] font-medium text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 dark:text-gray-500 dark:hover:bg-gray-800/50",kl=(se,Se,ze,ct)=>{if(ze.length===0)return null;const Bt=Kt.has(Wf(se,Se));return i.jsxs("div",{className:"mt-1",children:[i.jsxs("button",{type:"button",onClick:()=>oe(se,Se),className:Hr,children:[i.jsx(ln,{open:Bt,size:12}),x.chat.sourceGroups[Se](ze.length)]}),Bt&&bl(ze,ct)]})},Gi=(se,Se)=>{je(ze=>{const ct=new Map(ze);return ct.set(se,(ze.get(se)??ul)+ul),ct}),Se.length>0&&W(Se)},gs=(se,Se,ze,ct)=>{const Bt=Ie.has(se),Aa=Pn.get(se)??ul,sr=Se.active.slice(0,Aa),Pr=Se.active.length>Aa||ct.length>0,ir=Se.active.length===0&&Se.subagent.length===0&&Se.schedule.length===0&&Se.archived.length===0;return i.jsxs(i.Fragment,{children:[ir?i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):bl(sr,ze),Pr&&i.jsxs("button",{type:"button","aria-label":x.chat.loadMore,onClick:()=>Gi(se,ct),className:`${Hr} mt-0.5`,children:[i.jsx("span",{className:"w-3","aria-hidden":!0}),x.chat.loadMore]}),kl(se,"subagent",Se.subagent,ze),kl(se,"schedule",Se.schedule,ze),Se.archived.length>0&&i.jsxs("div",{className:"mt-1",children:[i.jsxs("button",{type:"button",onClick:()=>ar(se),className:Hr,children:[i.jsx(ln,{open:Bt,size:12}),x.chat.archivedGroup(Se.archived.length)]}),Bt&&bl(Se.archived,ze)]})]})},ga=[{to:"/agents",label:x.nav.agents,icon:zn.agents},{to:"/skills",label:x.nav.skills,icon:zn.skills},{to:"/models",label:x.nav.models,icon:zn.models},{to:"/usage",label:x.nav.usage,icon:zn.usage},{to:"/traces",label:x.nav.traces,icon:zn.traces},{to:"/benchmark",label:x.nav.benchmark,icon:zn.benchmark}],Wt=[{value:"light",label:x.settings.themeLight},{value:"dark",label:x.settings.themeDark},{value:"system",label:x.settings.followSystem}],cn=[{value:"en",label:x.settings.langEn},{value:"zh",label:x.settings.langZh},{value:"system",label:x.settings.followSystem}],lr=[{value:"sm",label:x.settings.fontSmall},{value:"md",label:x.settings.fontMedium},{value:"lg",label:x.settings.fontLarge}],xs=[{value:"USD",label:x.models.currencyUsd},{value:"CNY",label:x.models.currencyCny}];return i.jsxs("div",{className:"flex h-full w-full flex-col",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-2 pt-2",children:[n&&i.jsx("button",{type:"button",title:x.nav.collapseSidebar,"aria-label":x.nav.collapseSidebar,onClick:n,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx(ta,{d:"M15 6l-6 6 6 6M4 4v16",size:18})}),i.jsxs(Na,{open:F,setOpen:D,className:"min-w-0 flex-1",menuClass:"left-0 right-0 top-full mt-1 origin-top",button:i.jsxs("button",{type:"button",onClick:()=>D(!F),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-base font-semibold transition-colors duration-150 hover:bg-gray-200/70 dark:hover:bg-gray-800",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:N?um(N):x.common.loading}),i.jsx("span",{className:"text-gray-400",children:i.jsx(ZA,{})})]}),children:[C.map(se=>i.jsxs("button",{type:"button",onClick:()=>{M(se.projectId),D(!1)},className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${se.projectId===N?.projectId?"font-semibold":""}`,children:[i.jsx("span",{className:"truncate",children:um(se)}),i.jsx(Rt,{tone:"gray",children:se.role})]},se.projectId)),i.jsxs("div",{className:"mt-1.5 border-t border-gray-100 pt-1.5 dark:border-gray-800",children:[i.jsxs("button",{type:"button",className:mc,onClick:()=>{D(!1),U(!0)},children:["+ ",x.project.create]}),N&&i.jsx("button",{type:"button",className:mc,onClick:()=>{D(!1),B(!0)},children:x.project.settings})]})]})]}),i.jsxs("nav",{className:"shrink-0 space-y-0.5 px-2 pt-2",children:[i.jsxs("button",{type:"button",onClick:()=>pa(rr),className:`flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors duration-150 ${X===ja?"bg-gray-200/70 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i.jsx(ta,{d:hk})}),x.chat.newSessionMenu]}),ga.map(se=>i.jsxs(Qm,{to:se.to,onClick:()=>e?.(),className:({isActive:Se})=>`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${Se?"bg-gray-200/70 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i.jsx(ta,{d:se.icon})}),se.label]},se.to))]}),i.jsxs("div",{className:"mt-3 min-h-0 flex-1 overflow-y-auto border-t border-gray-200 px-2 pb-2 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center justify-between px-1 pt-2",children:[i.jsx("span",{className:"px-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:x.chat.sessionList}),i.jsx("div",{className:"flex items-center gap-0.5",children:[{value:"workspace",icon:u1,label:x.chat.groupByWorkspace},{value:"agent",icon:zn.agents,label:x.chat.groupByAgent}].map(se=>i.jsx("button",{type:"button",title:se.label,"aria-label":se.label,"aria-pressed":Ce===se.value,onClick:()=>et(se.value),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150 ${Ce===se.value?"bg-gray-200/70 text-gray-700 dark:bg-gray-800 dark:text-gray-200":"text-gray-400 hover:bg-gray-200/50 hover:text-gray-700 dark:text-gray-500 dark:hover:bg-gray-800/70 dark:hover:text-gray-300"}`,children:i.jsx(ta,{d:se.icon,size:14})},se.value))})]}),Ce==="agent"?z&&R.length===0?i.jsx(Dr,{rows:5}):tt.map(se=>{const Se=Kx(V.get(se.agentId)??[]),ze=me.has(se.agentId),ct=De.has(se.agentId);return i.jsxs("div",{className:"pt-2.5",children:[i.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[i.jsxs("button",{type:"button",onClick:()=>Br(se.agentId),"aria-expanded":!ze,"aria-label":ze?x.nav.expandGroup:x.nav.collapseGroup,className:"flex min-w-0 flex-1 items-center gap-1 self-stretch rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[i.jsx(zr,{id:se.agentId,name:jn(se),size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:jn(se)}),i.jsx(ln,{open:!ze,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]}),i.jsx(m1,{pinned:ct,onToggle:()=>Ma(se.agentId)}),i.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:()=>pa(se.agentId),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx(ta,{d:"M12 5v14M5 12h14",size:18})}),i.jsx("button",{type:"button",title:x.agent.settings,onClick:()=>oa(`/agents/${se.agentId}`),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx(ta,{d:JA,size:16})})]}),ze?null:gs(se.agentId,Se,!1,G.get(se.agentId)===!0?[se.agentId]:[])]},se.agentId)}):z&&_.length===0?i.jsx(Dr,{rows:5}):en.length===0?i.jsx("p",{className:"px-2.5 pt-3 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):en.map(se=>{const Se=Kx(se.sessions),ze=me.has(se.key),ct=De.has(se.key);return i.jsxs("div",{className:"pt-2.5",children:[i.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[i.jsxs("button",{type:"button",onClick:()=>Br(se.key),"aria-expanded":!ze,"aria-label":ze?x.nav.expandGroup:x.nav.collapseGroup,...se.fullPath!==null?{title:se.fullPath}:{},className:"flex min-w-0 flex-1 items-center gap-1 self-stretch rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[i.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:i.jsx(ta,{d:ze?u1:e8,size:15})}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-gray-500 dark:text-gray-400",children:se.temp?x.chat.tempWorkspaces:se.label}),i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:Se.active.length+Se.subagent.length+Se.schedule.length}),i.jsx(ln,{open:!ze,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]}),i.jsx(m1,{pinned:ct,onToggle:()=>Ma(se.key)}),i.jsx("button",{type:"button",title:x.chat.newSessionInWorkspace,"aria-label":x.chat.newSessionInWorkspace,onClick:()=>pa(su,se.fullPath??""),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx(ta,{d:"M12 5v14M5 12h14",size:18})})]}),ze?null:gs(se.key,Se,!0,D5(se.sessions,G))]},se.key)})]}),i.jsx("div",{className:"shrink-0 border-t border-gray-200 p-2 dark:border-gray-800",children:i.jsxs(Na,{open:te,setOpen:ee,menuClass:"bottom-full left-0 right-0 mb-1 origin-bottom",button:i.jsxs("button",{type:"button",onClick:()=>ee(!te),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-150 hover:bg-gray-200/70 dark:hover:bg-gray-800",children:[i.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-gray-900 text-xs font-bold text-white dark:bg-gray-200 dark:text-gray-900",children:(l?.userId??"?").slice(0,1).toUpperCase()}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:l?.userId}),l?.isAdmin&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.auth.admin})]}),children:[i.jsxs("div",{className:"space-y-2.5 px-3 py-2",children:[i.jsx(hi,{label:x.settings.theme,children:i.jsx(dl,{options:Wt,value:u,onChange:d})}),i.jsx(hi,{label:x.settings.fontSize,children:i.jsx(dl,{options:lr,value:f,onChange:m})}),i.jsx(hi,{label:x.settings.accent,children:i.jsx(i8,{value:h,onChange:g})}),i.jsx(hi,{label:x.models.currency,children:i.jsx(dl,{options:xs,value:v,onChange:k,cols:2})}),i.jsx(hi,{label:x.settings.language,children:i.jsx(dl,{options:cn,value:w,onChange:j})})]}),i.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[i.jsx("button",{type:"button",className:mc,onClick:()=>{ee(!1),re(!0)},children:x.account.changePassword}),l?.isAdmin&&i.jsx("button",{type:"button",className:mc,onClick:()=>{ee(!1),oa("/admin/users")},children:x.admin.users}),i.jsx("button",{type:"button",className:"block w-full px-3.5 py-2 text-left text-sm text-red-600 transition-colors duration-150 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40",onClick:()=>{ee(!1),o().then(()=>r("/login"))},children:x.auth.logout})]})]})}),i.jsx(mk,{open:T,onClose:()=>re(!1)}),i.jsx(WA,{open:we,onClose:()=>U(!1),onCreated:se=>{U(!1),O().then(()=>M(se))}}),N&&i.jsx(YA,{open:I,onClose:()=>B(!1)}),i.jsxs(Dt,{open:le!==null,title:x.chat.renameSession,onClose:()=>ve?void 0:pe(null),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>pe(null),disabled:ve,children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:ve||!Ee.trim(),onClick:()=>{dt()},children:x.common.save})]}),children:[i.jsx(Je,{label:x.chat.renameSessionLabel,value:Ee,autoFocus:!0,maxLength:120,onChange:se=>ge(se.target.value),onKeyDown:se=>{se.key==="Enter"&&Ee.trim()&&!ve&&dt()}}),lt&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:lt})]}),i.jsxs(Dt,{open:$e!==null,title:x.chat.deleteSession,onClose:()=>pt?void 0:rt(null),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>rt(null),disabled:pt,children:x.common.cancel}),i.jsx(ye,{variant:"danger",disabled:pt,onClick:()=>{Tt()},children:x.common.delete})]}),children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:$e?x.chat.deleteSessionConfirm($e.title??x.chat.defaultSessionTitle):""}),bt&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:bt})]})]})}function m1({pinned:e,onToggle:n}){return i.jsx("button",{type:"button",title:e?x.nav.unpinGroup:x.nav.pinGroup,"aria-label":x.nav.pinGroup,"aria-pressed":e,onClick:n,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-all duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200 ${e?"text-gray-500 dark:text-gray-400":"text-gray-400 opacity-0 focus-visible:opacity-100 group-hover/header:opacity-100 dark:text-gray-500"}`,children:i.jsx(ta,{d:t8,size:15})})}function s8({s:e,active:n,agentHint:r,onOpen:l,onRename:o,onDelete:u,onToggleArchive:d}){const f="flex h-6 w-6 shrink-0 items-center justify-center rounded text-gray-400 opacity-0 transition-all duration-150 focus-visible:opacity-100 group-hover:opacity-100";return i.jsx("li",{children:i.jsxs("div",{className:`group flex items-center rounded-md pr-1 transition-colors duration-150 ${n?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[i.jsxs("button",{type:"button",onClick:()=>l(e),className:"flex min-w-0 flex-1 items-center gap-1.5 px-2.5 py-1.5 text-left",children:[r!==void 0&&i.jsxs("span",{title:r,className:"flex shrink-0 items-center",children:[i.jsx(zr,{id:e.agentId,name:r,size:14,className:"rounded"}),i.jsx("span",{className:"sr-only",children:r})]}),i.jsx(Yc,{text:e.title??x.chat.defaultSessionTitle,className:`min-w-0 flex-1 text-sm ${n?"font-medium text-gray-900 dark:text-gray-100":e.archived?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`}),e.source&&i.jsx(Rt,{tone:"gray",children:x.chat.sourceNames[e.source]??e.source}),i.jsx(l8,{session:e}),e.pendingApprovalCount>0&&i.jsx("span",{title:x.chat.pendingApprovals(e.pendingApprovalCount),children:i.jsx(Rt,{tone:"amber",children:e.pendingApprovalCount})})]}),i.jsxs("div",{className:"flex shrink-0 items-center",children:[i.jsx("button",{type:"button",title:x.chat.renameSession,"aria-label":x.chat.renameSession,onClick:()=>o(e),className:`${f} hover:bg-gray-300/60 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200`,children:i.jsx(ta,{d:"M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",size:14})}),i.jsx("button",{type:"button",title:e.archived?x.chat.unarchiveSession:x.chat.archiveSession,"aria-label":e.archived?x.chat.unarchiveSession:x.chat.archiveSession,onClick:()=>d(e),className:`${f} hover:bg-gray-300/60 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200`,children:i.jsx(ta,{d:e.archived?"M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M12 17v-5m-2.5 2L12 11l2.5 3":"M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M9.5 13.5 12 16l2.5-2.5",size:14})}),i.jsx("button",{type:"button",title:x.chat.deleteSession,"aria-label":x.chat.deleteSession,onClick:()=>u(e),className:`${f} hover:bg-gray-300/60 hover:text-red-600 dark:hover:bg-gray-700 dark:hover:text-red-400`,children:i.jsx(ta,{d:"M4 6h16M9 6V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V6M6 6v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6M10 10.5v6M14 10.5v6",size:14})})]})]})})}function hi({label:e,children:n}){return i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-[11px] font-medium text-gray-500 dark:text-gray-400",children:e}),n]})}function i8({value:e,onChange:n}){return i.jsx("div",{className:"flex items-center gap-1.5",children:oS.map(r=>i.jsx("button",{type:"button",title:x.settings.accentNames[r.value],"aria-label":x.settings.accentNames[r.value],"aria-pressed":e===r.value,onClick:()=>n(r.value),className:`h-5 w-5 rounded-full border transition-transform duration-150 hover:scale-110 ${e===r.value?"border-gray-500 ring-2 ring-gray-400/50 dark:border-gray-300":"border-transparent"}`,style:{backgroundColor:r.color}},r.value))})}const o8="M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5",Yf=e=>`flex h-8 w-8 items-center justify-center rounded-md transition-colors duration-150 ${e?"bg-gray-200/70 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-500 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`;function c8({onExpand:e}){const{user:n}=Nn(),r=ia(),{agents:l,setCurrentAgentId:o}=sn(),{sessions:u,loading:d}=Ui(),f=pv("/chat/:sessionId")?.params.sessionId??null,m=f!==null&&f!==ja,h=b.useMemo(()=>u.reduce((w,j)=>!j.archived&&(!w||Date.parse(j.createdAt)>Date.parse(w.createdAt))?j:w,null),[u]),g=()=>{h&&(o(h.agentId),r(`/chat/${h.sessionId}`))},v=()=>{const w=(l.find(j=>j.agentId==="default_agent")??l[0])?.agentId;w&&o(w),r(`/chat/${ja}`,w?{state:{agentId:w}}:void 0)},k=[{to:"/agents",label:x.nav.railAgents,icon:zn.agents},{to:"/skills",label:x.nav.skills,icon:zn.skills},{to:"/models",label:x.nav.models,icon:zn.models},{to:"/usage",label:x.nav.usage,icon:zn.usage},{to:"/traces",label:x.nav.traces,icon:zn.traces},{to:"/benchmark",label:x.nav.benchmark,icon:zn.benchmark}];return i.jsxs("div",{className:"flex h-full flex-col items-center gap-1 py-2.5",children:[i.jsx("button",{type:"button",title:x.nav.expandSidebar,"aria-label":x.nav.expandSidebar,onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx(We,{d:"M9 6l6 6-6 6M20 4v16",size:18})}),i.jsxs("nav",{className:"mt-1 flex flex-col items-center gap-1",children:[i.jsx("button",{type:"button",title:x.nav.lastConversation,"aria-label":x.nav.lastConversation,disabled:!h&&!d,onClick:g,className:h||d?Yf(m):"flex h-8 w-8 cursor-not-allowed items-center justify-center rounded-md text-gray-300 dark:text-gray-700",children:i.jsx(We,{d:o8,size:18})}),i.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:v,className:Yf(f===ja),children:i.jsx(We,{d:hk,size:18})}),k.map(w=>i.jsx(Qm,{to:w.to,title:w.label,"aria-label":w.label,className:({isActive:j})=>Yf(j),children:i.jsx(We,{d:w.icon,size:18})},w.to))]}),i.jsx("button",{type:"button",title:`${n?.userId??""} · ${x.nav.expandSidebar}`,"aria-label":n?.userId??x.auth.admin,onClick:e,className:"mt-auto flex h-8 w-8 items-center justify-center rounded-full bg-gray-900 text-xs font-bold text-white dark:bg-gray-200 dark:text-gray-900",children:(n?.userId??"?").slice(0,1).toUpperCase()})]})}function u8(){const{user:e}=Nn(),[n,r]=b.useState(!1),[l,o]=b.useState(!1),[u,d]=b.useState(()=>localStorage.getItem("penguin.sidebarCollapsed")==="1"),f=()=>d(m=>{const h=!m;return localStorage.setItem("penguin.sidebarCollapsed",h?"1":"0"),h});return i.jsxs("div",{className:"flex h-full",children:[i.jsx("aside",{className:`hidden shrink-0 border-r border-gray-200 bg-gray-50 md:block dark:border-gray-800 dark:bg-gray-900 ${u?"w-12":"w-64 lg:w-72"}`,children:u?i.jsx(c8,{onExpand:f}):i.jsx(f1,{onCollapse:f})}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-gray-200 bg-white px-2 md:hidden dark:border-gray-800 dark:bg-gray-950",children:[i.jsx("button",{type:"button","aria-label":x.chat.sessionList,onClick:()=>r(!0),className:"flex h-9 w-9 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}),i.jsx("span",{className:"text-sm font-semibold",children:x.appName})]}),e?.passwordIsInitial&&i.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-3 border-b border-amber-200 bg-amber-50 px-3 py-1.5 text-xs text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-300",children:[i.jsx("span",{children:x.account.initialPasswordBanner}),i.jsx("button",{type:"button",className:"shrink-0 font-medium underline underline-offset-2 hover:text-amber-950 dark:hover:text-amber-100",onClick:()=>o(!0),children:x.account.changeNow})]}),i.jsx("main",{className:"min-h-0 flex-1 overflow-hidden",children:i.jsx(Wj,{})})]}),i.jsx(mk,{open:l,onClose:()=>o(!1)}),i.jsx($5,{open:n,side:"left",title:x.appName,onClose:()=>r(!1),children:i.jsx("div",{className:"h-full bg-gray-50 dark:bg-gray-900",children:i.jsx(f1,{onNavigate:()=>r(!1)})})})]})}const Th=1440,Eh=900,Dm=3,d8=3,h1=Th/Dm,p1=Eh/d8,pc=28,gc=14;function f8(e){return()=>{e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function m8(e,n){return e.x1-gc<=n.x2&&e.x2+gc>=n.x1&&e.y1-gc<=n.y2&&e.y2+gc>=n.y1}function h8(e,n,r,l){return{x1:Math.min(e,r),y1:Math.min(n,l),x2:Math.max(e,r),y2:Math.max(n,l)}}const p8=[{cell:0,edge:"left"},{cell:1,edge:"top"},{cell:2,edge:"right"},{cell:3,edge:"left"},{cell:5,edge:"right"},{cell:6,edge:"bottom"},{cell:7,edge:"bottom"},{cell:8,edge:"right"}];function g8(){const e=f8(12696599),n=[];for(const{cell:r,edge:l}of p8){const o=r%Dm*h1+pc,u=Math.floor(r/Dm)*p1+pc,d=o+h1-2*pc,f=u+p1-2*pc,m=[],h=(R,$,H,_)=>{const V=H[0]>0?d-R:H[0]<0?R-o:H[1]>0?f-$:$-u;for(let G=Math.min(60+e()*150,V);G>=40;G/=2){const W=Math.round(R+H[0]*G),z=Math.round($+H[1]*G),q=h8(R,$,W,z);if(m.every((A,L)=>_.has(L)||!m8(q,A)))return m.push(q),[W,z]}return null},g=(R,$,H)=>(H-R)*(.35+e()*.3)>R-$?1:-1,v=(R,$,H,_,V,G,W)=>{let[z,q]=[R,$],A=H;const L=[`M${Math.round(z)},${Math.round(q)}`],X=[];for(let F=0;F<_;F+=1){const D=F===0?W:new Set([m.length-1]),te=h(z,q,A,D);if(!te)break;[z,q]=te,L.push(`L${z},${q}`),X.push([z,q]),A=A[0]!==0?[0,g(q,u,f)]:[g(z,o,d),0]}return X.length>=2&&n.push({d:L.join(" "),end:X[X.length-1],dur:V,delay:G}),X},k=.15+e()*.7,w=l==="left"?0:l==="right"?Th:Math.round(o+(d-o)*k),j=l==="top"?0:l==="bottom"?Eh:Math.round(u+(f-u)*k),C=l==="left"?[1,0]:l==="right"?[-1,0]:l==="top"?[0,1]:[0,-1],N=12+e()*8,M=e()*3.2,O=v(w,j,C,3+Math.floor(e()*3),N,M,new Set);if(r%2===0&&O.length>=3){const[R,$]=O[1],[H,_]=O[2],V=[-Math.sign(H-R),-Math.sign(_-$)];v(R,$,V,2,N,M+1.4,new Set([1,2]))}}return n}const x8=g8();function y8(){return i.jsx("svg",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 h-full w-full text-slate-500/25 dark:text-cyan-300/15",viewBox:`0 0 ${Th} ${Eh}`,preserveAspectRatio:"xMidYMid slice",fill:"none",children:x8.map((e,n)=>i.jsxs("g",{style:{"--trace-dur":`${e.dur.toFixed(1)}s`},children:[i.jsx("path",{d:e.d,pathLength:1,stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",className:"login-trace",style:{animationDelay:`${e.delay.toFixed(1)}s`}}),i.jsx("circle",{cx:e.end[0],cy:e.end[1],r:"3",fill:"currentColor",className:"login-via",style:{animationDelay:`${e.delay.toFixed(1)}s`}})]},n))})}function v8(){Ta(x.auth.login);const{login:e}=Nn(),{mode:n,setMode:r}=xl(),{lang:l,setLang:o}=Ca(),u=ia(),[d,f]=b.useState(""),[m,h]=b.useState(""),[g,v]=b.useState(null),[k,w]=b.useState(!1),j=async()=>{if(!d.trim()||!m){v(x.common.requiredField);return}w(!0),v(null);try{await e(d.trim(),m),u("/chat",{replace:!0})}catch(M){v(M instanceof He?M.message:x.common.unknownError)}finally{w(!1)}},C=[{value:"light",label:x.settings.themeLight},{value:"dark",label:x.settings.themeDark},{value:"system",label:x.settings.followSystem}],N=[{value:"en",label:x.settings.langEn},{value:"zh",label:x.settings.langZh},{value:"system",label:x.settings.followSystem}];return i.jsxs("div",{className:"relative flex min-h-full items-center justify-center overflow-hidden p-4",children:[i.jsx(y8,{}),i.jsxs("div",{className:"absolute right-4 top-4 flex flex-col items-end gap-1.5 sm:flex-row sm:items-center sm:gap-2",children:[i.jsx("div",{"aria-label":x.settings.language,children:i.jsx(dl,{options:N,value:l,onChange:o})}),i.jsx("div",{"aria-label":x.settings.theme,children:i.jsx(dl,{options:C,value:n,onChange:r})})]}),i.jsxs("div",{className:"anim-rise relative w-full max-w-sm",children:[i.jsx(ok,{className:"mx-auto mb-3 h-16 w-16 rounded-2xl"}),i.jsx("h1",{className:"mb-6 text-center text-3xl font-semibold tracking-tight",children:x.appName}),i.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("form",{className:"space-y-4",onSubmit:M=>{M.preventDefault(),j()},children:[i.jsx(Je,{label:x.auth.username,value:d,onChange:M=>f(M.target.value),autoComplete:"username",autoFocus:!0}),i.jsx(Ir,{label:x.auth.password,value:m,onChange:M=>h(M.target.value),autoComplete:"current-password"}),g&&i.jsx("p",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900 dark:bg-red-950/50 dark:text-red-300",children:g}),i.jsx(ye,{type:"submit",variant:"primary",className:"w-full justify-center py-2.5 text-sm font-semibold",disabled:k,children:x.auth.login})]}),i.jsx("p",{className:"mt-4 text-center text-xs text-gray-400 dark:text-gray-500",children:x.auth.defaultAdminNote})]})]})]})}const pi=100,Lr=30,Jn=2;function b8({data:e,label:n,className:r=""}){const l=Math.max(1,...e),o=e.length>1?(pi-2*Jn)/(e.length-1):0,u=e.map((h,g)=>[Jn+g*o,Lr-Jn-h/l*(Lr-2*Jn)]),d=`${Jn},${Lr-Jn} ${pi-Jn},${Lr-Jn}`,f=u.length>1?u.map(([h,g])=>`${h},${g}`).join(" "):d,m=u.length>1?`${f} ${pi-Jn},${Lr-Jn} ${Jn},${Lr-Jn}`:null;return i.jsxs("svg",{width:pi,height:Lr,viewBox:`0 0 ${pi} ${Lr}`,role:"img","aria-label":n,className:`text-emerald-600 dark:text-emerald-500 ${r}`,children:[i.jsx("title",{children:n}),m!==null&&i.jsx("polygon",{points:m,fill:"currentColor",fillOpacity:"0.12"}),i.jsx("polyline",{points:f,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const k8=new Set(["default_agent"]),ka={newChat:"M12 5v14M5 12h14",settings:"M10.3 4.3a2 2 0 0 1 3.4 0l.5.8a2 2 0 0 0 1.8 1l1-.1a2 2 0 0 1 1.7 3l-.5.8a2 2 0 0 0 0 2l.5.8a2 2 0 0 1-1.7 3l-1-.1a2 2 0 0 0-1.8 1l-.5.8a2 2 0 0 1-3.4 0l-.5-.8a2 2 0 0 0-1.8-1l-1 .1a2 2 0 0 1-1.7-3l.5-.8a2 2 0 0 0 0-2l-.5-.8a2 2 0 0 1 1.7-3l1 .1a2 2 0 0 0 1.8-1zM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",trash:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7m4 4v6m4-6v6",sessions:"M8 10h8M8 14h5M21 12a9 9 0 1 1-4-7.5",vaultKeys:"M15.5 7.5l3 3L22 7l-3-3M21 2l-9.6 9.6M13 15.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z",schedules:"M12 21a7 7 0 1 0 0-14 7 7 0 0 0 0 14zm0-10v3l2 1.5M5 3L2.5 5.5M19 3l2.5 2.5",skills:"M12 6.5C10.5 5 8 4.5 4 5v12c4-.5 6.5 0 8 1.5 1.5-1.5 4-2 8-1.5V5c-4-.5-6.5 0-8 1.5zm0 0V18",usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",traces:"M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z"};function w8(){const e=ia();Ta(x.nav.agents);const{locale:n}=Ca(),{currentProject:r,agents:l,agentsLoading:o,reloadAgents:u,setCurrentAgentId:d}=sn(),[f,m]=b.useState(!1),[h,g]=b.useState(""),[v,k]=b.useState(""),[w,j]=b.useState(""),[C,N]=b.useState(null),[M,O]=b.useState(!1),R=()=>{g(""),k(""),j(""),N(null),m(!0)},[$,H]=b.useState(null),[_,V]=b.useState(null),G=r?.projectId,W=async()=>{if(!G)return;const A=h.trim();if(!A){N(x.common.requiredField);return}if(!fk.test(A)){N(x.agent.idHint);return}O(!0),N(null);try{const L={agentId:A};v.trim()&&(L.name=v.trim()),w.trim()&&(L.description=w.trim());const X=await TS(G,L);m(!1),await u(),d(X.agent.agentId),e(`/agents/${X.agent.agentId}`)}catch(L){N(L instanceof He?L.message:x.common.unknownError)}finally{O(!1)}},z=A=>{d(A),e(`/chat/${ja}`,{state:{agentId:A}})},q=async()=>{if(!(!G||!$)){O(!0),V(null);try{await DS(G,$.agentId),H(null),await u()}catch(A){V(A instanceof He?A.message:x.common.unknownError)}finally{O(!1)}}};return i.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[i.jsxs("div",{className:"mx-auto max-w-5xl",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.agent.listTitle}),i.jsx(ye,{variant:"primary",onClick:R,children:x.agent.create})]}),o?i.jsx("div",{className:"space-y-3",children:Array.from({length:4},(A,L)=>i.jsxs(Rv,{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4",children:[i.jsxs("div",{className:"min-w-[14rem] flex-1",children:[i.jsx(At,{className:"h-[18px] w-40"}),i.jsx(At,{className:"mt-1.5 h-4 w-2/3"}),i.jsx(At,{className:"mt-1.5 h-4 w-48"})]}),i.jsx(At,{className:"hidden h-9 w-40 md:block"}),i.jsx(At,{className:"h-8 w-52"})]},L))}):l.length===0?i.jsx(Or,{title:x.common.none}):i.jsx("div",{className:"space-y-3",children:l.map(A=>{const L=k8.has(A.agentId);return i.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2 rounded-md border border-gray-200 bg-white px-5 py-4 dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"min-w-[14rem] flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(zr,{id:A.agentId,name:jn(A),size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-base font-bold",children:jn(A)}),i.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500",children:A.agentId}),i.jsxs(Rt,{tone:"gray",children:["v",A.version]}),A.activeSessionCount>0&&i.jsxs(Rt,{tone:"brand",children:[x.agent.activeSessions," ",A.activeSessionCount]})]}),i.jsx("p",{className:"mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400",children:A.description??""}),i.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2.5 text-xs text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.sessionCount(A.sessionCount),children:[i.jsx(We,{d:ka.sessions,size:12}),A.sessionCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.toolCount(A.toolCount),children:[i.jsx(We,{d:Gt.toolCalls,size:12}),A.toolCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.vaultKeyCount(A.vaultKeyCount),children:[i.jsx(We,{d:ka.vaultKeys,size:12}),A.vaultKeyCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.scheduleCount(A.scheduleCount),children:[i.jsx(We,{d:ka.schedules,size:12}),A.scheduleCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.skills.skillCount(A.skillCount),children:[i.jsx(We,{d:ka.skills,size:12}),A.skillCount]}),i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${x.agent.updatedAt} ${A.updatedAt?$n(A.updatedAt):"—"}`,children:[i.jsx(We,{d:Gt.elapsed,size:12}),A.updatedAt?K5(A.updatedAt,n):"—"]})]})]}),i.jsx(b8,{data:A.sessionActivity,label:x.agent.activity(A.sessionActivity.length||30),className:"hidden shrink-0 md:block"}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsxs(ye,{size:"sm",variant:"primary",onClick:()=>z(A.agentId),children:[i.jsx(We,{d:ka.newChat}),x.chat.newSessionMenu]}),i.jsxs(ye,{size:"sm",onClick:()=>{d(A.agentId),e(`/agents/${A.agentId}`)},children:[i.jsx(We,{d:ka.settings,className:"text-gray-600 dark:text-gray-300"}),x.common.settings]}),i.jsx(ye,{size:"icon",title:x.nav.usage,"aria-label":x.nav.usage,onClick:()=>e(`/usage?agentId=${encodeURIComponent(A.agentId)}`),children:i.jsx(We,{d:ka.usage,size:15,className:"text-gray-600 dark:text-gray-300"})}),i.jsx(ye,{size:"icon",title:x.nav.traces,"aria-label":x.nav.traces,onClick:()=>e(`/traces?agentId=${encodeURIComponent(A.agentId)}`),children:i.jsx(We,{d:ka.traces,size:15,className:"text-gray-600 dark:text-gray-300"})}),L?i.jsx("span",{role:"img",title:x.agent.builtinUndeletable,"aria-label":x.agent.builtinUndeletable,className:"inline-flex cursor-not-allowed items-center justify-center rounded-md border border-transparent p-1.5 text-gray-300 dark:text-gray-600",children:i.jsx(We,{d:ka.trash,size:15})}):i.jsx(ye,{size:"icon",variant:"danger",title:x.agent.deleteAgent,"aria-label":x.agent.deleteAgent,onClick:()=>H({agentId:A.agentId,name:jn(A)}),children:i.jsx(We,{d:ka.trash,size:15})})]})]},A.agentId)})})]}),i.jsx(Dt,{open:f,title:x.agent.createTitle,onClose:()=>m(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>m(!1),children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:M,onClick:()=>{W()},children:x.common.create})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Je,{label:x.agent.id,size:"sm",value:h,onChange:A=>g(A.target.value),hint:x.agent.idHint,autoFocus:!0}),i.jsx(Je,{label:x.agent.name,size:"sm",value:v,onChange:A=>k(A.target.value),hint:x.agent.nameHint}),i.jsx(cs,{label:x.agent.description,size:"sm",rows:3,value:w,onChange:A=>j(A.target.value)}),C&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:C})]})}),i.jsxs(Dt,{open:$!==null,title:x.agent.deleteAgent,onClose:()=>{H(null),V(null)},footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>{H(null),V(null)},children:x.common.cancel}),i.jsx(ye,{variant:"danger",disabled:M,onClick:()=>{q()},children:x.common.confirm})]}),children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:$?x.agent.deleteConfirm($.name):""}),_&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:_})]})]})}function S8({items:e,active:n,onChange:r}){return i.jsx("div",{role:"tablist",className:"flex max-w-full gap-1 overflow-x-auto overflow-y-hidden border-b border-gray-200 dark:border-gray-800",children:e.map(l=>i.jsx("button",{type:"button",role:"tab","aria-selected":l.key===n,onClick:()=>r(l.key),className:`-mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors duration-150 ${l.key===n?"border-gray-900 font-semibold text-gray-900 dark:border-gray-100 dark:text-gray-100":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-800 dark:text-gray-400 dark:hover:border-gray-700 dark:hover:text-gray-200"}`,children:l.label},l.key))})}const g1=4,x1=16;function j8({open:e,onClose:n,estimatedHeight:r,panelWidth:l}){const o=b.useRef(null),u=b.useRef(null),[d,f]=b.useState(null),m=b.useRef(n);return m.current=n,b.useLayoutEffect(()=>{if(!e||!o.current)return;const h=o.current.getBoundingClientRect(),g=window.innerHeight-h.bottom,v=h.top,k=Math.min(r,window.innerHeight*.7),w=g<k&&v>g,j=l,C=Math.max(x1,Math.min(h.left,window.innerWidth-j-x1));f({topPx:w?void 0:h.bottom+g1,bottomPx:w?window.innerHeight-h.top+g1:void 0,left:C,triggerWidth:h.width})},[e,r,l]),b.useEffect(()=>{if(!e)return;const h=w=>{const j=w.target;o.current?.contains(j)||u.current?.contains(j)||m.current()},g=w=>{w.key==="Escape"&&(w.stopPropagation(),m.current())},v=w=>{u.current?.contains(w.target)||m.current()},k=()=>m.current();return window.addEventListener("mousedown",h),window.addEventListener("keydown",g,!0),window.addEventListener("scroll",v,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",g,!0),window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",k)}},[e]),{triggerRef:o,panelRef:u,position:d}}const N8=288,C8={base:"text-base",sm:"text-xs"},T8={base:"text-xs",sm:"text-[11px]"};function gk({options:e,value:n,onChange:r,placeholder:l,mono:o,label:u,fullWidth:d,size:f="base","aria-label":m}){const[h,g]=b.useState(!1),{triggerRef:v,panelRef:k,position:w}=j8({open:h,onClose:()=>g(!1),estimatedHeight:e.length*48+16,panelWidth:N8}),j=n!=null?e.find(N=>N.value===n):void 0,C=i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:v,type:"button","aria-label":m,"aria-haspopup":"listbox","aria-expanded":h,onClick:()=>g(N=>!N),className:"flex items-center gap-2 rounded-md border border-gray-300 bg-white text-gray-900 transition-[border-color,box-shadow] duration-200 hover:border-gray-400 focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:border-gray-600 dark:focus:border-gray-400 dark:focus:ring-gray-500/30 "+Jm[f]+(d?" w-full justify-between":""),children:[i.jsx("span",{className:`min-w-0 truncate ${o?"font-mono":""}`,children:j?.triggerLabel??l??"—"}),i.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,className:"size-3 shrink-0 text-gray-400",children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),h&&w&&$i.createPortal(i.jsx("div",{ref:k,role:"listbox",style:{position:"fixed",top:w.topPx,bottom:w.bottomPx,left:w.left,minWidth:w.triggerWidth},className:"anim-pop z-[60] max-h-[70vh] w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:e.map(N=>i.jsxs("button",{type:"button",role:"option","aria-selected":N.value===n,onClick:()=>{r(N.value),g(!1)},className:`block w-full px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${N.value===n?"bg-gray-100 dark:bg-gray-800":""}`,children:[i.jsxs("span",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:`${C8[f]} ${N.value===n?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:N.label}),N.value===n&&i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),i.jsx("span",{className:`mt-0.5 block ${T8[f]} text-gray-500 dark:text-gray-400`,children:N.description})]},N.value))}),document.body)]});return u?i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:u}),C]}):C}const E8=/^[A-Za-z_][A-Za-z0-9_]*$/;function M8({agentId:e}){const{currentProject:n}=sn(),r=n?.projectId??null,l=n?.role==="owner",[o,u]=b.useState(null),[d,f]=b.useState(null),[m,h]=b.useState(null),[g,v]=b.useState(!1),[k,w]=b.useState(!1),[j,C]=b.useState(""),[N,M]=b.useState(""),[O,R]=b.useState(null),[$,H]=b.useState(null),_=b.useCallback(async()=>{if(!(!r||!e)){u(null),f(null);try{const A=await jS(r,e);u(A.entries)}catch(A){f(A instanceof He?A.message:x.common.unknownError)}}},[r,e]);b.useEffect(()=>{_()},[_]);const V=async A=>{if(!r||!e)return x.common.unknownError;v(!0),h(null);try{const L=await NS(r,e,A);return u(L.entries),h(x.common.saved),null}catch(L){return L instanceof He?L.message:x.common.unknownError}finally{v(!1)}},G=A=>(o??[]).filter(L=>L.key!==A).map(L=>({key:L.key})),W=()=>{C(""),M(""),R(null),w(!0)},z=async()=>{const A=j.trim();if(!A){R(x.common.requiredField);return}if(!E8.test(A)){R(x.vault.keyInvalid);return}if(!N){R(x.vault.valueRequired);return}R(null);const L=await V({entries:[...G(A),{key:A,value:N}]});if(L!==null){R(L);return}w(!1)},q=async()=>{if($===null)return;f(null);const A=await V({entries:G($)});A!==null&&f(A),H(null)};return r?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.vault.desc}),!l&&i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x.vault.readOnlyHint})]}),o===null?i.jsx(Dr,{rows:4}):o.length===0?i.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:x.vault.empty}):i.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:i.jsxs("table",{className:"w-full min-w-[420px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("th",{className:"px-3 py-2.5",children:x.vault.key}),i.jsx("th",{className:"px-3 py-2.5",children:x.vault.valueMasked}),i.jsx("th",{className:"px-3 py-2.5"})]})}),i.jsx("tbody",{children:o.map(A=>i.jsxs("tr",{className:"border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:A.key}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400",children:A.valueMasked}),i.jsx("td",{className:"px-3 py-2 text-right",children:l&&i.jsx(ye,{size:"sm",variant:"ghost",disabled:g,onClick:()=>H(A.key),children:x.vault.remove})})]},A.key))})]})}),l&&o!==null&&i.jsx(ye,{size:"sm",variant:"primary",disabled:g,onClick:W,children:x.vault.add}),i.jsx(Dt,{open:k,title:x.vault.addTitle,onClose:()=>w(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>w(!1),children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:g,onClick:()=>{z()},children:x.vault.add})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Je,{size:"sm",label:x.vault.key,hint:x.vault.keyHint,value:j,onChange:A=>C(A.target.value),className:"font-mono",placeholder:"OPENAI_API_KEY",autoComplete:"off"}),i.jsx(Ir,{size:"sm",label:x.vault.value,value:N,onChange:A=>M(A.target.value),className:"font-mono",autoComplete:"off",onKeyDown:A=>{A.key==="Enter"&&!g&&z()}}),O&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:O})]})}),i.jsx(Dt,{open:$!==null,title:x.vault.deleteTitle,onClose:()=>H(null),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>H(null),children:x.common.cancel}),i.jsx(ye,{variant:"danger",disabled:g,onClick:()=>{q()},children:x.common.confirm})]}),children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:$!==null?x.vault.deleteConfirm($):""})}),d&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d}),m&&i.jsx("p",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:m})]}):null}function A8(e){const n=[];return b.Children.forEach(e,r=>{if(!b.isValidElement(r)||r.type!=="option")return;const l=r.props;n.push({value:l.value!==void 0?String(l.value):"",label:l.children??"",...l.disabled?{disabled:!0}:{}})}),n}const R8="flex w-full items-center gap-2 rounded-md border border-gray-300 bg-white text-left text-gray-900 transition-[border-color,box-shadow] duration-200 hover:border-gray-400 focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:border-gray-600 dark:focus:border-gray-400 dark:focus:ring-gray-500/30",L8={base:"text-base",sm:"text-xs"};function zi({label:e,hint:n,size:r="base",className:l,children:o,value:u,onChange:d,disabled:f}){const m=A8(o),h=String(u??""),g=m.find(R=>R.value===h),v=b.useRef(null),[k,w]=b.useState(!1),[j,C]=b.useState(null),N=()=>{const R=v.current;if(!R)return;const $=R.getBoundingClientRect(),H=window.innerHeight-$.bottom,_=H<240&&$.top>H;C({left:$.left,top:_?$.top:$.bottom,width:$.width,up:_})};b.useLayoutEffect(()=>{k&&N()},[k]),b.useEffect(()=>{if(!k)return;const R=V=>{const G=V.target;v.current?.contains(G)||G.closest?.("[data-select-menu]")||w(!1)},$=V=>{V.key==="Escape"&&w(!1)},H=V=>{const G=V.target;G instanceof Element&&G.closest("[data-select-menu]")||w(!1)},_=()=>w(!1);return document.addEventListener("mousedown",R),window.addEventListener("keydown",$),window.addEventListener("scroll",H,!0),window.addEventListener("resize",_),()=>{document.removeEventListener("mousedown",R),window.removeEventListener("keydown",$),window.removeEventListener("scroll",H,!0),window.removeEventListener("resize",_)}},[k]);const M=R=>{w(!1),d?.({target:{value:R}}),v.current?.focus()},O=i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:v,type:"button",disabled:f,"aria-haspopup":"listbox","aria-expanded":k,onClick:()=>w(R=>!R),className:`${R8} ${Jm[r]} ${l??""}`,children:[i.jsx("span",{className:"min-w-0 flex-1 truncate",children:g?.label??m[0]?.label??""}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),k&&j&&$i.createPortal(i.jsx("ul",{"data-select-menu":!0,role:"listbox",className:"anim-pop fixed z-[60] max-h-60 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",style:{left:j.left,width:j.width,...j.up?{bottom:window.innerHeight-j.top+4}:{top:j.top+4}},children:m.map((R,$)=>i.jsx("li",{children:i.jsxs("button",{type:"button",role:"option","aria-selected":R.value===h,disabled:R.disabled,onClick:()=>M(R.value),className:`flex w-full items-center px-3 py-1.5 text-left ${L8[r]} transition-colors duration-150 disabled:opacity-50 ${R.value===h?"bg-gray-100 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800"}`,children:[i.jsx("span",{className:"min-w-0 flex-1 truncate",children:R.label}),R.value===h&&i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-500 dark:text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})},`${R.value}-${$}`))}),document.body)]});return!e&&!n?O:i.jsxs("label",{className:"block",children:[e&&i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:e}),O,n&&i.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:n})]})}const _8={active:"green",disabled:"gray",expired:"amber",done:"brand",missed:"amber",invalid:"red"};function y1(e){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=l=>l<10?`0${l}`:`${l}`;return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}const Xf=e=>JSON.stringify([e.provider,e.modelId]),I8=e=>{if(!e)return null;const[n,r]=JSON.parse(e);return{provider:n,modelId:r}},v1=e=>`${e.modelId} · ${aa(e.provider)?.label??e.provider}`,b1=e=>e.modelId&&e.provider?{provider:e.provider,modelId:e.modelId}:null,z8={editing:null,name:"",prompt:"",enabled:!0,startAt:"",endAt:"",period:"",target:"new",sessionId:"",workspace:"",model:null};function D8({agentId:e}){const{currentProject:n}=sn(),r=n?.projectId??null,l=n?.role==="owner",[o,u]=b.useState(null),[d,f]=b.useState(null),[m,h]=b.useState(null),[g,v]=b.useState(!1),[k,w]=b.useState(null),[j,C]=b.useState(null),[N,M]=b.useState(null),[O,R]=b.useState([]),$=b.useCallback(async()=>{if(!(!r||!e)){u(null),f(null);try{u(await HS(r,e))}catch(L){f(L instanceof He?L.message:x.common.unknownError)}}},[r,e]);b.useEffect(()=>{$()},[$]),b.useEffect(()=>{!r||!l||Fc(r).then(L=>R(L.models)).catch(()=>R([]))},[r,l]);const H=L=>w(X=>X===null?X:{...X,...L}),_=L=>{C(null),w(L)},V=async()=>{if(!r||k===null)return;C(null),h(null);const L=k.editing??k.name.trim();if(!L||!k.prompt.trim()||!k.startAt||k.target==="session"&&!k.sessionId.trim()){C(x.common.requiredField);return}const X={prompt:k.prompt,enabled:k.enabled,startAt:new Date(k.startAt).toISOString(),...k.period.trim()?{period:k.period.trim()}:{},...k.endAt?{endAt:new Date(k.endAt).toISOString()}:{},...k.target==="session"&&k.sessionId.trim()?{sessionId:k.sessionId.trim()}:{},...k.target==="new"&&k.workspace.trim()?{workspace:k.workspace.trim()}:{},...k.target==="new"&&k.model?{modelId:k.model.modelId,provider:k.model.provider}:{}};v(!0);try{k.editing!==null?await zx(r,e,k.editing,X):await PS(r,e,{name:L,...X}),w(null),h(x.common.saved),await $()}catch(F){C(F instanceof He?F.message:x.common.unknownError)}finally{v(!1)}},G=async L=>{if(!r)return;v(!0),f(null),h(null);const X=b1(L);try{await zx(r,e,L.name,{prompt:L.prompt,enabled:!L.enabled,startAt:L.startAt,...L.period!==void 0?{period:L.period}:{},...L.endAt!==void 0?{endAt:L.endAt}:{},...L.sessionId!==void 0?{sessionId:L.sessionId}:{},...L.workspace!==void 0?{workspace:L.workspace}:{},...X?{modelId:X.modelId,provider:X.provider}:{}}),h(x.common.saved),await $()}catch(F){f(F instanceof He?F.message:x.common.unknownError)}finally{v(!1)}},W=L=>{_({editing:L.name,name:L.name,prompt:L.prompt,enabled:L.enabled,startAt:y1(L.startAt),endAt:y1(L.endAt),period:L.period??"",target:L.sessionId?"session":"new",sessionId:L.sessionId??"",workspace:L.workspace??"",model:b1(L)})},z=async()=>{if(!(!r||N===null)){v(!0),f(null),h(null);try{await qS(r,e,N),k?.editing===N&&w(null),await $()}catch(L){f(L instanceof He?L.message:x.common.unknownError)}finally{v(!1),M(null)}}};if(!r)return null;const q=o?.schedules??[],A=o?.invalidFiles??[];return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.schedule.desc}),!l&&i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x.schedule.readOnlyHint})]}),o===null?i.jsx(Dr,{rows:4}):q.length===0?i.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:x.schedule.empty}):i.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:i.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colName}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colStatus}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colPeriod}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colTarget}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colFireTimes}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colQueued}),l&&i.jsx("th",{className:"px-3 py-2.5"})]})}),i.jsx("tbody",{children:q.map(L=>i.jsxs("tr",{className:"border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:L.name}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("span",{title:L.invalidReason,children:i.jsx(Rt,{tone:_8[L.status],children:x.schedule.statusNames[L.status]??L.status})})}),i.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:L.period!==void 0?i.jsx("span",{className:"font-mono",children:L.period}):x.schedule.once}),i.jsx("td",{className:"max-w-36 truncate px-3 py-2 text-xs text-gray-500 dark:text-gray-400",title:L.sessionId,children:L.sessionId!==void 0?i.jsx("span",{className:"font-mono",children:L.sessionId}):x.schedule.newSession}),i.jsxs("td",{className:"px-3 py-2 text-xs",children:[i.jsx("span",{className:"block text-gray-600 dark:text-gray-300",children:L.nextFireAt?$n(L.nextFireAt):"—"}),i.jsx("span",{className:"block text-gray-400 dark:text-gray-500",children:L.lastFiredAt?$n(L.lastFiredAt):"—"})]}),i.jsx("td",{className:"px-3 py-2",children:L.queued&&i.jsx(Rt,{tone:"brand",children:x.schedule.queued})}),l&&i.jsxs("td",{className:"whitespace-nowrap px-3 py-2 text-right",children:[i.jsx(ye,{size:"sm",variant:"ghost",disabled:g,onClick:()=>{G(L)},children:L.enabled?x.schedule.disable:x.schedule.enable}),i.jsx(ye,{size:"sm",variant:"ghost",disabled:g,onClick:()=>W(L),children:x.common.edit}),i.jsx(ye,{size:"sm",variant:"ghost",disabled:g,onClick:()=>M(L.name),children:x.common.delete})]})]},L.name))})]})}),A.length>0&&i.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400",children:[i.jsx("p",{className:"font-medium",children:x.schedule.invalidFiles}),i.jsx("ul",{className:"mt-0.5 space-y-0.5 font-mono",children:A.map(L=>i.jsxs("li",{children:[L.name,": ",L.error]},L.name))})]}),l&&o!==null&&i.jsx(ye,{size:"sm",variant:"primary",disabled:g,onClick:()=>_(z8),children:x.schedule.addTitle}),i.jsx(Dt,{open:k!==null,title:k?.editing!=null?x.schedule.editTitle(k.editing):x.schedule.addTitle,onClose:()=>w(null),widthClass:"sm:max-w-lg",footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>w(null),children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:g,onClick:()=>{V()},children:k?.editing!=null?x.common.save:x.common.create})]}),children:k!==null&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[i.jsx(Je,{size:"sm",label:x.schedule.name,hint:x.schedule.nameHint,value:k.name,disabled:k.editing!==null,onChange:L=>H({name:L.target.value}),className:"font-mono",placeholder:"daily_report",autoComplete:"off"}),i.jsx(Je,{size:"sm",label:x.schedule.period,value:k.period,onChange:L=>H({period:L.target.value}),className:"font-mono",placeholder:x.schedule.periodPlaceholder,autoComplete:"off"}),i.jsx(Je,{size:"sm",label:x.schedule.startAt,type:"datetime-local",value:k.startAt,onChange:L=>H({startAt:L.target.value}),className:"font-mono"}),i.jsx(Je,{size:"sm",label:x.schedule.endAt,type:"datetime-local",value:k.endAt,onChange:L=>H({endAt:L.target.value}),className:"font-mono"}),i.jsxs(zi,{size:"sm",label:x.schedule.target,value:k.target,onChange:L=>H({target:L.target.value}),children:[i.jsx("option",{value:"new",children:x.schedule.targetNew}),i.jsx("option",{value:"session",children:x.schedule.targetSession})]}),k.target==="session"?i.jsx(Je,{size:"sm",label:x.schedule.sessionId,value:k.sessionId,onChange:L=>H({sessionId:L.target.value}),className:"font-mono",autoComplete:"off"}):i.jsxs(i.Fragment,{children:[i.jsxs(zi,{size:"sm",label:x.schedule.model,value:k.model?Xf(k.model):"",onChange:L=>H({model:I8(L.target.value)}),children:[i.jsx("option",{value:"",children:x.schedule.modelDefault}),k.model&&!O.some(L=>L.modelId===k.model.modelId&&L.provider===k.model.provider)&&i.jsx("option",{value:Xf(k.model),children:v1(k.model)}),O.map(L=>i.jsx("option",{value:Xf({provider:L.provider,modelId:L.modelId}),children:v1({provider:L.provider,modelId:L.modelId})},`${L.provider}:${L.modelId}`))]}),i.jsx(Je,{size:"sm",label:x.schedule.workspace,value:k.workspace,onChange:L=>H({workspace:L.target.value}),className:"font-mono",autoComplete:"off"})]})]}),i.jsx(cs,{label:x.schedule.prompt,size:"sm",rows:4,value:k.prompt,onChange:L=>H({prompt:L.target.value})}),i.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[i.jsx("input",{type:"checkbox",checked:k.enabled,onChange:L=>H({enabled:L.target.checked})}),x.schedule.enabled]}),j&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:j})]})}),i.jsx(Dt,{open:N!==null,title:x.schedule.deleteTitle,onClose:()=>M(null),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>M(null),children:x.common.cancel}),i.jsx(ye,{variant:"danger",disabled:g,onClick:()=>{z()},children:x.common.confirm})]}),children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:N!==null?x.schedule.deleteConfirm(N):""})}),d&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d}),m&&i.jsx("p",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:m})]})}function O8(e){return e.filter(([n])=>n!=="").map(([n,r])=>({value:n,triggerLabel:n,label:n,description:r}))}function k1({label:e,value:n,onChange:r,options:l}){return i.jsxs("div",{className:"relative",children:[i.jsx(gk,{label:e,fullWidth:!0,size:"sm",placeholder:x.agent.defaultValue,value:n,onChange:r,options:l}),n!==""&&i.jsx("button",{type:"button",title:x.agent.resetToDefault,"aria-label":x.agent.resetToDefault,onClick:()=>r(""),className:"absolute right-0 top-0 text-xs text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-300",children:x.agent.resetToDefault})]})}function gi(e){const n=e.trim();if(!n)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function cl(e){return e===void 0?"":String(e)}function U8(){const e=[{key:"overview",label:x.agent.tabOverview},{key:"prompt",label:x.agent.tabPrompt},{key:"runtime",label:x.agent.tabRuntime},{key:"tools",label:x.agent.tabTools},{key:"vault",label:x.agent.tabVault},{key:"schedules",label:x.agent.tabSchedules}],n=ia(),l=yv().agentId??"";Ta(x.agent.settings);const{currentProject:o,reloadAgents:u}=sn(),d=o?.projectId??null,[f,m]=b.useState(null),[h,g]=b.useState("overview"),[v,k]=b.useState(null),[w,j]=b.useState(null),C=b.useCallback(()=>{!d||!l||(m(null),k(null),Q1(d,l).then(m).catch(O=>k(O instanceof He?O.message:x.common.unknownError)))},[d,l]);b.useEffect(()=>{C()},[C]);const N=b.useCallback(O=>{j(x.agent.importDone(O)),C(),u()},[C,u]),M=b.useCallback(async O=>{if(!(!d||!l)){k(null),j(null);try{const R=await Z1(d,l,O);m(R),j(x.common.saved),(O.config?.name!==void 0||O.config?.description!==void 0)&&u()}catch(R){k(R instanceof He?R.message:x.common.unknownError)}}},[d,l,u]);return d?v&&!f?i.jsx("p",{className:"p-6 text-sm text-red-600 dark:text-red-400",children:v}):f?i.jsx("div",{className:"no-scrollbar h-full overflow-y-auto p-4 md:p-6",children:i.jsxs("div",{className:"mx-auto max-w-3xl",children:[i.jsxs(ye,{variant:"ghost",size:"sm",onClick:()=>n("/agents"),className:"-ml-2 mb-3 text-gray-500 dark:text-gray-400",children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M15 18l-6-6 6-6"}),i.jsx("path",{d:"M9 12h12"})]}),x.agent.backToList]}),i.jsx("h1",{className:"mb-1 text-xl font-semibold",children:f.config.name??l}),i.jsx("p",{className:"mb-4 font-mono text-xs text-gray-400",children:l}),i.jsx(S8,{items:e,active:h,onChange:g}),i.jsxs("div",{className:"py-4",children:[h==="overview"&&i.jsx($8,{data:f,agentId:l,onSave:M,onImported:N}),h==="prompt"&&i.jsx(B8,{data:f,onSave:M}),h==="runtime"&&i.jsx(H8,{data:f,onSave:M}),h==="tools"&&i.jsx(P8,{data:f,onSave:M}),h==="vault"&&i.jsx(M8,{agentId:l}),h==="schedules"&&i.jsx(D8,{agentId:l})]}),v&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:v}),w&&i.jsx("p",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:w})]})}):i.jsxs("div",{className:"space-y-3 p-6",children:[i.jsx(At,{className:"h-6 w-64"}),i.jsx(At,{className:"h-32 w-full"})]}):null}const w1="inline-flex cursor-pointer items-center justify-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 hover:bg-gray-50 focus-within:ring-2 focus-within:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800";function $8({data:e,agentId:n,onSave:r,onImported:l}){const{currentProject:o}=sn(),u=o?.projectId??null,d=o?.role==="owner",[f,m]=b.useState(e.config.name??""),[h,g]=b.useState(e.config.description??""),[v,k]=b.useState(!1),[w,j]=b.useState(null),[C,N]=b.useState(null),M=()=>{const $={};f.trim()!==(e.config.name??"")&&($.name=f.trim()),h.trim()!==(e.config.description??"")&&($.description=h.trim()),Object.keys($).length!==0&&r({config:$})},O=async($,H)=>{if(u){k(!0),j(null);try{const _=await WS(u,n,{dataBase64:$,...H?{confirm:!0}:{}});N(null),l(_.version)}catch(_){_ instanceof He&&_.status===409&&_.code==="version_conflict"?N($):(N(null),j(_ instanceof He?_.message:x.common.unknownError))}finally{k(!1)}}},R=$=>{const H=$.target.files?.[0];if($.target.value="",!H)return;j(null);const _=new FileReader;_.onload=()=>{const V=_.result;O(V.slice(V.indexOf(",")+1),!1)},_.onerror=()=>j(x.common.unknownError),_.readAsDataURL(H)};return i.jsxs("div",{className:"space-y-4",children:[i.jsx(Je,{size:"sm",label:x.agent.name,value:f,onChange:$=>m($.target.value)}),i.jsx(cs,{label:x.agent.description,size:"sm",rows:3,value:h,onChange:$=>g($.target.value)}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.stateDir}),i.jsx("p",{className:"break-all font-mono text-xs text-gray-500 dark:text-gray-400",children:e.stateDir})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.activeSessions}),i.jsx("p",{className:"text-sm",children:e.activeSessionCount})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.stateVersion}),i.jsxs("p",{className:"font-mono text-sm",children:["v",e.config.version]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.transferTitle}),i.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:x.agent.transferDesc}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u&&i.jsx("a",{href:KS(u,n),download:!0,className:w1,children:x.agent.exportSnapshot}),d&&i.jsxs("label",{className:`${w1} ${v?"pointer-events-none opacity-60":""}`,children:[i.jsx("input",{type:"file",accept:".tar.gz,.tgz",className:"sr-only",disabled:v,onChange:R}),v?x.agent.importing:x.agent.importSnapshot]})]}),w&&i.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:w})]}),i.jsx(ye,{size:"sm",variant:"primary",onClick:M,children:x.common.save}),i.jsx(Dt,{open:C!==null,title:x.agent.importConflictTitle,onClose:()=>N(null),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>N(null),children:x.common.cancel}),i.jsx(ye,{variant:"danger",disabled:v,onClick:()=>{C!==null&&O(C,!0)},children:x.common.confirm})]}),children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.agent.importConflictBody})})]})}function B8({data:e,onSave:n}){const[r,l]=b.useState(e.agentsMd),[o,u]=b.useState(e.config.systemPrompt),d=b.useRef(null),f=()=>{const h={};r!==e.agentsMd&&(h.agentsMd=r),o!==e.config.systemPrompt&&(h.config={systemPrompt:o}),!(h.agentsMd===void 0&&h.config===void 0)&&n(h)},m=h=>{const g=d.current;if(g&&(g.focus(),document.execCommand?.("insertText",!1,h)))return;const v=g?g.selectionStart:o.length,k=g?g.selectionEnd:o.length;u(o.slice(0,v)+h+o.slice(k)),requestAnimationFrame(()=>{if(!g)return;g.focus();const w=v+h.length;g.setSelectionRange(w,w)})};return i.jsxs("div",{className:"space-y-4",children:[i.jsx(cs,{label:x.agent.agentsMd,mono:!0,size:"sm",rows:14,value:r,onChange:h=>l(h.target.value)}),i.jsx(cs,{ref:d,label:x.agent.systemPrompt,mono:!0,size:"sm",rows:12,value:o,onChange:h=>u(h.target.value)}),i.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:x.agent.placeholdersTitle}),i.jsx("ul",{className:"space-y-1",children:x.agent.placeholders.map(([h,g])=>i.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[i.jsx("button",{type:"button",onClick:()=>m(h),title:x.agent.insertPlaceholder,className:"shrink-0 rounded border border-gray-200 bg-white px-1.5 py-0.5 font-mono font-semibold text-gray-800 transition-colors duration-150 hover:border-gray-400 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-700",children:h}),i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:g})]},h))})]}),i.jsx(ye,{size:"sm",variant:"primary",onClick:f,children:x.common.save})]})}function H8({data:e,onSave:n}){const r=e.config,[l,o]=b.useState(cl(r.maxTurns)),[u,d]=b.useState(cl(r.model?.maxTokens)),[f,m]=b.useState(r.model?.thinkingLevel??""),[h,g]=b.useState(cl(r.model?.timeoutMs)),[v,k]=b.useState(cl(r.compaction?.maxContextLength)),[w,j]=b.useState(cl(r.compaction?.maxSessionTurns)),[C,N]=b.useState(r.compaction?.mode??""),[M,O]=b.useState(r.compaction?.prompt??""),[R,$]=b.useState(null),H=()=>{$(null);const G={},W=gi(l);if(W!==void 0&&W!==r.maxTurns){if(W<=0&&W!==-1){$(x.agent.maxTurnsInvalid);return}G.maxTurns=W}const z={},q=gi(u);q!==void 0&&q!==r.model?.maxTokens&&(z.maxTokens=q),f&&f!==(r.model?.thinkingLevel??"")&&(z.thinkingLevel=f);const A=gi(h);if(A!==void 0&&A!==r.model?.timeoutMs){if(A<=0&&A!==-1){$(x.agent.timeoutInvalid);return}z.timeoutMs=A}Object.keys(z).length>0&&(G.model=z);const L={},X=gi(v);X!==void 0&&X!==r.compaction?.maxContextLength&&(L.maxContextLength=X);const F=gi(w);F!==void 0&&F!==r.compaction?.maxSessionTurns&&(L.maxSessionTurns=F),C&&C!==(r.compaction?.mode??"")&&(L.mode=C),M!==(r.compaction?.prompt??"")&&(L.prompt=M),Object.keys(L).length>0&&(G.compaction=L),Object.keys(G).length!==0&&n({config:G})},_=lA(x.agent.thinkingLevelOptions,x.agent.thinkingLevelNoneKept,r.model?.thinkingLevel),V=O8(x.agent.compactionModeOptions);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("div",{className:"p-3",children:i.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[i.jsx(Je,{label:x.agent.maxTurns,size:"sm",value:l,onChange:G=>o(G.target.value),inputMode:"numeric",className:"font-mono"}),i.jsx(Je,{label:x.agent.maxTokens,size:"sm",value:u,onChange:G=>d(G.target.value),inputMode:"numeric",className:"font-mono"}),i.jsx(k1,{label:x.agent.thinkingLevel,value:f,onChange:m,options:_}),i.jsx(Je,{label:x.agent.timeoutMs,hint:x.agent.timeoutMsHint,size:"sm",value:h,onChange:G=>g(G.target.value),inputMode:"numeric",className:"font-mono"})]})}),i.jsx("div",{className:"border-t border-b border-gray-200 bg-gray-50/80 px-3 py-2 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:x.agent.compaction}),i.jsx("div",{className:"p-3",children:i.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[i.jsx(Je,{label:x.agent.maxContextLength,hint:x.agent.maxContextLengthHint,size:"sm",value:v,onChange:G=>k(G.target.value),inputMode:"numeric",className:"font-mono"}),i.jsx(Je,{label:x.agent.maxSessionTurns,hint:x.agent.maxSessionTurnsHint,size:"sm",value:w,onChange:G=>j(G.target.value),inputMode:"numeric",className:"font-mono"}),i.jsx(k1,{label:x.agent.compactionMode,value:C,onChange:N,options:V})]})}),i.jsx("div",{className:"border-t border-b border-gray-200 bg-gray-50/80 px-3 py-2 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:x.agent.compactionPrompt}),i.jsx("div",{className:"p-3",children:i.jsx(cs,{"aria-label":x.agent.compactionPrompt,mono:!0,size:"sm",rows:4,value:M,onChange:G=>O(G.target.value)})})]}),R&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:R}),i.jsx(ye,{size:"sm",variant:"primary",onClick:H,children:x.common.save})]})}function P8({data:e,onSave:n}){const r=[{value:"r",triggerLabel:"r",label:x.agent.permissionReadLabel,description:x.agent.permissionReadDescription},{value:"rw",triggerLabel:"rw",label:x.agent.permissionReadWriteLabel,description:x.agent.permissionReadWriteDescription}],[l,o]=b.useState(()=>e.config.toolsBuiltin.map(h=>({base:{...h},timeoutMs:cl(h.timeoutMs),maxOutputLength:cl(h.maxOutputLength)}))),[u,d]=b.useState(null),f=(h,g)=>{o(v=>v.map((k,w)=>w===h?{...k,...g}:k))},m=()=>{d(null);const h=[];for(const g of l){const v={...g.base};delete v.timeoutMs,delete v.maxOutputLength;const k=g.timeoutMs.trim();if(k){const j=Number(k);if(!Number.isInteger(j)||j<=0&&j!==-1){d(x.agent.toolFieldInvalid(g.base.name,"timeoutMs"));return}v.timeoutMs=j}const w=g.maxOutputLength.trim();if(w){const j=Number(w);if(!Number.isInteger(j)||j<=0&&j!==-1){d(x.agent.toolFieldInvalid(g.base.name,"maxOutputLength"));return}v.maxOutputLength=j}h.push(v)}n({config:{toolsBuiltin:h}})};return i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:i.jsxs("table",{className:"w-full min-w-[520px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("th",{className:"px-3 py-2",children:x.agent.toolName}),i.jsx("th",{className:"px-3 py-2",children:x.agent.toolPermission}),i.jsx("th",{className:"px-3 py-2",children:x.agent.toolTimeout}),i.jsx("th",{className:"px-3 py-2",children:x.agent.toolMaxOutput})]})}),i.jsx("tbody",{children:l.map((h,g)=>i.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800/60",children:[i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:h.base.name}),i.jsx("td",{className:"px-3 py-2",children:i.jsx(gk,{mono:!0,size:"sm","aria-label":x.agent.toolPermission,placeholder:x.agent.defaultValue,options:r,value:h.base.permission,onChange:v=>f(g,{base:{...h.base,permission:v}})})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx(Je,{size:"sm",value:h.timeoutMs,inputMode:"numeric",className:"font-mono",onChange:v=>f(g,{timeoutMs:v.target.value})})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx(Je,{size:"sm",value:h.maxOutputLength,inputMode:"numeric",className:"font-mono",onChange:v=>f(g,{maxOutputLength:v.target.value})})})]},h.base.name))})]})}),u&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:u}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.mcpServers}),i.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-gray-200 bg-gray-50 p-3 text-xs dark:border-gray-800 dark:bg-gray-900",children:JSON.stringify(e.config.mcpServers,null,2)})]}),i.jsx(ye,{size:"sm",variant:"primary",onClick:m,children:x.common.save})]})}const q8="M22 2 11 13M22 2 15 22 11 13 2 9 22 2",F8="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",V8="M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";function G8(e,n,r,l){return e.filter(o=>{const u=n.get(o)?.get(r);return u!==void 0&&u<l})}function K8(){Ta(x.nav.skills);const e=ia(),{locale:n}=Ca(),r=Nn().user?.userId??null,{currentProject:l,agents:o,setCurrentAgentId:u}=sn(),d=l?.projectId??null,[f,m]=b.useState(null),[h,g]=b.useState(null),[v,k]=b.useState(new Map),[w,j]=b.useState(new Set);b.useEffect(()=>{let H=!1;return g(null),FS().then(_=>{H||m(_.groups)}).catch(_=>{H||g(er(_))}),()=>{H=!0}},[]);const C=o.map(H=>H.agentId).join(",");b.useEffect(()=>{if(k(new Map),!d||C==="")return;let H=!1;const _=C.split(",");return Promise.all(_.map(async V=>{try{const G=await Hm(d,V);return[V,new Map(G.skills.map(W=>[W.name,W.version]))]}catch{return[V,new Map]}})).then(V=>{H||k(G=>{const W=new Map(V);for(const[z,q]of G)W.set(z,q);return W})}),()=>{H=!0}},[d,C]);const N=(H,_,V)=>k(G=>{const W=new Map(G),z=new Map(W.get(H)??[]);return V!==void 0?z.set(_,V):z.delete(_),W.set(H,z),W}),M=(H,_)=>k(V=>new Map(V).set(H,new Map(_.map(G=>[G.name,G.version])))),O=async(H,_,V,G)=>{if(!d)return;const W=v.get(H)?.get(_);N(H,_,V?G:void 0);const z=o.find(A=>A.agentId===H),q=z?jn(z):H;try{if(V){const A=await Dx(d,H,[_]);M(H,A.skills),os(x.skills.installedToast(_,q))}else await VS(d,H,_),os(x.skills.uninstalledToast(_,q))}catch(A){if(!V&&A instanceof He&&A.status===404)return;N(H,_,W),On(er(A))}},R=async(H,_)=>{if(!d||_.length===0)return;const G=(await Promise.allSettled(_.map(async W=>{const z=await Dx(d,W,[H]);M(W,z.skills)}))).find(W=>W.status==="rejected");G?On(er(G.reason)):os(x.skills.updatedToast(H,_.length))},$=H=>{if(r&&d){const _=is(r,d);Ii(_,{...au(_),agentId:"default_agent",text:x.skills.quickInvokeText(H),skills:[H],handoffAgentId:void 0})}u("default_agent"),e(`/chat/${ja}`,{state:{agentId:"default_agent"}})};return i.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:i.jsxs("div",{className:"mx-auto max-w-5xl",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.skills.pageTitle}),i.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:x.skills.pageDesc}),h?i.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h}),i.jsx(ye,{size:"sm",onClick:()=>window.location.reload(),children:x.common.retry})]}):f===null?i.jsx("div",{className:"mt-6 grid gap-2.5 sm:grid-cols-2",children:Array.from({length:4},(H,_)=>i.jsxs(Rv,{className:"p-4",children:[i.jsx(At,{className:"h-4 w-32"}),i.jsx(At,{className:"mt-2 h-4 w-3/4"}),i.jsx(At,{className:"mt-3 h-6 w-36"})]},_))}):i.jsx("div",{className:"mt-6 space-y-3",children:f.map(H=>{const _=!w.has(H.id);return i.jsxs("section",{className:"overflow-hidden rounded-md bg-white dark:bg-gray-900",children:[i.jsxs("button",{type:"button","aria-expanded":_,onClick:()=>j(V=>{const G=new Set(V);return G.has(H.id)?G.delete(H.id):G.add(H.id),G}),className:"flex w-full items-center gap-2.5 bg-gray-50 px-3 py-2.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[i.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:T6(n,H.title,H.titleZh)}),i.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.skills.skillCount(H.skills.length)}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(ln,{open:_,className:"text-gray-400"})]}),i.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${_?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:i.jsx("div",{className:"overflow-hidden",inert:!_,children:i.jsx("div",{className:`grid gap-2.5 p-2.5 transition-opacity duration-200 sm:grid-cols-2 ${_?"opacity-100":"opacity-0"}`,children:H.skills.map(V=>i.jsx(W8,{skill:V,installed:v,onQuickInvoke:$,onToggleInstall:O,onUpdateOutdated:R},V.name))})})})]},H.id)})})]})})}function W8({skill:e,installed:n,onQuickInvoke:r,onToggleInstall:l,onUpdateOutdated:o}){const{locale:u}=Ca(),{agents:d}=sn(),[f,m]=b.useState(!1);let h=0;for(const j of n.values())j.has(e.name)&&(h+=1);const g=G8(d.map(j=>j.agentId),n,e.name,e.version),v=qi(u,e),k=e.description,w=[`v${e.version}`,e.updated?W5(e.updated,u):null,x.skills.usedByAgents(h)].filter(j=>j!==null).join(" · ");return i.jsxs("div",{className:"flex h-full items-center gap-3 rounded-md p-4 transition-colors hover:bg-gray-100/70 dark:hover:bg-gray-800/60",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${X6(e.name)}`,children:i.jsx(Nh,{icon:e.icon,size:20})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate font-mono text-[13px] font-semibold",title:e.name,children:e.name}),i.jsx("p",{className:"mt-0.5 truncate text-xs leading-5 text-gray-500 dark:text-gray-400",title:k,children:v})]})]}),i.jsx("p",{className:"mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500",title:w,children:w})]}),i.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-1.5",children:[g.length>0&&i.jsx(ye,{size:"sm",variant:"secondary",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.updateOutdated(g.length)} ${e.name}`,title:x.skills.updateOutdated(g.length),onClick:()=>{o(e.name,g)},children:i.jsx(We,{d:V8,size:13})}),i.jsx(ye,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.quickInvoke} ${e.name}`,title:x.skills.quickInvoke,onClick:()=>r(e.name),children:i.jsx(We,{d:q8,size:15})}),i.jsx(ye,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.manageInstall} ${e.name}`,title:x.skills.manageInstall,onClick:()=>m(!0),children:i.jsx(We,{d:F8,size:15})})]}),f&&i.jsx(Dt,{open:!0,title:x.skills.manageInstallTitle(e.name),onClose:()=>m(!1),children:i.jsxs("div",{className:"space-y-0.5",children:[d.length===0&&i.jsx("p",{className:"py-1.5 text-xs text-gray-400",children:x.common.loading}),d.map(j=>i.jsx(Y8,{agentId:j.agentId,name:jn(j),installed:n.get(j.agentId)?.has(e.name)??!1,outdated:g.includes(j.agentId),onToggle:C=>{l(j.agentId,e.name,C,e.version)},onUpdate:()=>{o(e.name,[j.agentId])}},j.agentId))]})})]})}function Y8({agentId:e,name:n,installed:r,outdated:l,onToggle:o,onUpdate:u}){return i.jsxs("div",{className:"flex items-center gap-2 rounded-md px-1.5 py-1.5 transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/60",children:[i.jsx(zr,{id:e,name:n,size:22,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",title:e,children:n}),r&&l&&i.jsx(ye,{size:"sm",variant:"secondary",className:"shrink-0","aria-label":`${x.skills.updateAction} ${e}`,onClick:u,children:x.skills.updateAction}),r?i.jsxs(ye,{size:"sm",variant:"ghost",className:"group shrink-0","aria-label":`${x.skills.uninstall} ${e}`,onClick:()=>o(!1),children:[i.jsx("span",{className:"group-hover:hidden",children:x.skills.installed}),i.jsx("span",{className:"hidden text-red-600 group-hover:inline dark:text-red-400",children:x.skills.uninstall})]}):i.jsx(ye,{size:"sm",className:"shrink-0","aria-label":`${x.skills.install} ${e}`,onClick:()=>o(!0),children:x.skills.install})]})}function X8({checked:e,onChange:n,disabled:r,className:l,...o}){return i.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:r,onClick:()=>n(!e),className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 "+(e?"bg-[var(--accent-bg)]":"bg-gray-300 dark:bg-gray-600")+` ${l??""}`,...o,children:i.jsx("span",{"aria-hidden":!0,className:`inline-block size-4 transform rounded-full bg-white shadow transition-transform duration-200 ${e?"translate-x-[18px]":"translate-x-0.5"}`})})}function xk(e){return{vision:e.vision!==!1,contextWindow:e.context_window!==void 0?String(e.context_window):"",clientType:e.client_type??"",cacheRead:e.pricing?String(e.pricing.cache_read):"",cacheWrite:e.pricing?String(e.pricing.cache_write):"",output:e.pricing?String(e.pricing.output):"",baseUrl:e.base_url??""}}function Q8(e){return{provider:e.provider,modelId:e.model_id,original:null,...xk(e),maxTokens:"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}function Z8(e,n=J6()){const r=(f,m)=>`${f}\0${m}`,l=new Map(e.map((f,m)=>[r(f.provider,f.modelId),m])),o=[...e];let u=0,d=0;for(const f of n){const m=l.get(r(f.provider,f.model_id));if(m===void 0){o.push(Q8(f)),u+=1;continue}const h=o[m],g=xk(f);Object.keys(g).some(k=>h[k]!==g[k])&&(o[m]={...h,...g},d+=1)}return{rows:o,added:u,updated:d}}function J8(e){return e<1e3?"green":e<=3e3?"yellow":"red"}function eR(e){return e>=40?"green":e>=15?"yellow":"red"}const yk={USD:"$",CNY:"¥"};function S1(e){return Number.isFinite(e)?String(Math.round(e*1e6)/1e6):"0"}function Om(e){return Number.isFinite(e)?String(Math.round(e*1e4)/1e4):"0"}function Qf(e,n){const r=Number(e||"0"),l=n==="CNY"?r*Bm:r;return`${yk[n]}${Om(l)}`}function Zf(e,n){const r=e.trim();if(!r)return"";const l=Number(r);return Number.isFinite(l)?Om(n==="CNY"?l*Bm:l):r}function Jf(e,n){const r=e.trim();if(!r)return"";const l=Number(r);return Number.isFinite(l)?S1(n==="CNY"?l/Bm:l):r}const tR="M12 5v14M5 12h14",nR="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4",aR="M12 14l3.5-3.5M20.49 17A10 10 0 1 0 3.5 17",rR="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 7v5l3.5 2",lR="M13 2 3 14h9l-1 8 10-12h-9l1-8Z",j1={green:"text-green-600 dark:text-green-400",yellow:"text-amber-600 dark:text-amber-400",red:"text-red-600 dark:text-red-400"},N1=(e,n)=>`${e}\0${n}`,em=128e3;function C1(e){return e.replace(/[^\d]/g,"")}function sR(e){const n=e.replace(/[^\d.]/g,""),r=n.indexOf(".");return r===-1?n:n.slice(0,r+1)+n.slice(r+1).replace(/\./g,"")}function ea(e){return{provider:e.provider,modelId:e.modelId}}function iR(e){const{editing:n,ref:r,action:l,defaultModel:o,visionModel:u}=e,d=n===null,f=!d&&!vt(n,r)?n:null,m=h=>vt(h,f)?r:h;return{defaultModel:l==="setDefault"||d&&!o?r:m(o),visionModel:l==="setVisionModel"?r:m(u)}}function ki({text:e}){return i.jsx("span",{className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:e})}function oR(e){return e.original!==null&&Ch(e.original.provider,e.original.modelId)!==void 0}function cR(e){return!e.clearApiKey&&(!!e.apiKeyInput.trim()||!!e.credential?.apiKeyMasked)}function T1(e){const n={provider:e.provider,modelId:e.modelId,original:{provider:e.provider,modelId:e.modelId},vision:e.vision!==!1,contextWindow:e.contextWindow!==void 0?String(e.contextWindow):"",maxTokens:e.maxTokens!==void 0?String(e.maxTokens):"",clientType:e.clientType??"",cacheRead:e.pricing?String(e.pricing.cacheRead):"",cacheWrite:e.pricing?String(e.pricing.cacheWrite):"",output:e.pricing?String(e.pricing.output):"",baseUrl:e.credential?.baseUrl??"",originalBaseUrl:e.credential?.baseUrl??"",apiKeyInput:"",clearApiKey:!1};return e.displayName!==void 0&&(n.displayName=e.displayName),e.envKey!==void 0&&(n.envKey=e.envKey),e.credential&&(n.credential=e.credential),n}function uR(e){const n={provider:e.provider,modelId:e.modelId};e.original&&!vt(e.original,ea(e))&&(n.renamedFrom=e.original),e.displayName?.trim()&&(n.displayName=e.displayName.trim());const r=Number(e.contextWindow.trim());e.contextWindow.trim()&&Number.isFinite(r)&&(n.contextWindow=r),e.clientType.trim()&&(n.clientType=e.clientType.trim()),e.vision||(n.vision=!1);const l=Number(e.maxTokens.trim());e.maxTokens.trim()&&Number.isFinite(l)&&l>0&&(n.maxTokens=l);const o=Number(e.cacheRead.trim()),u=Number(e.cacheWrite.trim()),d=Number(e.output.trim());e.cacheRead.trim()&&e.cacheWrite.trim()&&e.output.trim()&&Number.isFinite(o)&&Number.isFinite(u)&&Number.isFinite(d)&&(n.pricing={cacheRead:o,cacheWrite:u,output:d}),e.apiKeyInput.trim()&&(n.apiKey=e.apiKeyInput.trim()),e.clearApiKey&&(n.clearApiKey=!0);const f=e.baseUrl.trim();return f!==e.originalBaseUrl&&(n.baseUrl=f||null),n}function dR(){Ta(x.models.title);const{currentProject:e}=sn(),n=e?.projectId??null,r=e?.role==="owner",l=Nn().user?.userId??null,[o,u]=b.useState(new Map),[d,f]=b.useState(null),[m,h]=b.useState(null),[g,v]=b.useState(null),[k,w]=b.useState(void 0),[j,C]=b.useState(void 0),[N,M]=b.useState(null),[O,R]=b.useState(null),[$,H]=b.useState(""),[_,V]=b.useState(new Set),[G,W]=b.useState(null),[z,q]=b.useState(!1),[A,L]=b.useState(""),[X,F]=b.useState(null),[D,te]=b.useState(null),[ee,we]=b.useState(!1),{currency:U}=xl(),I=b.useCallback(async()=>{if(n){v(null),te(null),u(new Map);try{const ne=await Fc(n);v(ne.models.map(T1)),w(ne.defaultModel),C(ne.visionModel)}catch(ne){te(ne instanceof He?ne.message:x.common.unknownError)}}},[n]);b.useEffect(()=>{I()},[I]);const B=async(ne,me,be,De)=>{if(!n)return!1;we(!0);const Fe=be&&ne.some(Ie=>vt(ea(Ie),be)&&Ie.vision)?be:void 0;try{const Ie={models:ne.map(uR)};me&&(Ie.defaultModel=me),Fe&&(Ie.visionModel=Fe);const Lt=await SS(n,Ie);if(v(Lt.models.map(T1)),w(Lt.defaultModel),C(Lt.visionModel),l&&Lt.defaultModel&&!vt(Lt.defaultModel,k)){const Kt=is(l,n),_t=au(Kt);_t.modelRef&&Ii(Kt,{..._t,modelRef:void 0})}return os(De??x.common.saved),!0}catch(Ie){return v(ne),me!==void 0&&w(me),Fe!==void 0&&C(Fe),On(Ie instanceof He?Ie.message:x.common.unknownError),!1}finally{we(!1)}},T=b.useMemo(()=>g?rk(g,$):[],[g,$]),re=async()=>{if(!g)return;const ne=Z8(g);if(ne.added===0&&ne.updated===0){os(x.models.syncUpToDate);return}await B(ne.rows,k,j,x.models.syncDone(ne.added,ne.updated))},de=async ne=>{if(!n||!g)return;const me=g.filter(be=>be.provider===ne);h(ne);try{for(const be of me){const De=N1(be.provider,be.modelId);u(Fe=>new Map(Fe).set(De,"pending"));try{const Fe=await X1(n,{provider:be.provider,modelId:be.modelId,speed:!0});u(Ie=>new Map(Ie).set(De,Fe))}catch(Fe){u(Ie=>new Map(Ie).set(De,{ok:!1,message:Fe instanceof He?Fe.message:x.common.unknownError}))}}}finally{h(null)}},fe=()=>{const ne=A.trim();if(!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(ne)){F(x.models.groupNameInvalid);return}if(Ur.some(me=>me.id===ne)||g?.some(me=>me.provider===ne)){F(x.models.groupNameExists);return}q(!1),L(""),R(ne)},he=N!==null?g?.find(ne=>vt(ea(ne),N)):void 0;if(!n)return null;const Ce=ne=>V(me=>{const be=new Set(me);return be.has(ne)?be.delete(ne):be.add(ne),be});return i.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[i.jsxs("div",{className:"mx-auto max-w-5xl",children:[i.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.models.title}),!r&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.models.readOnlyHint})]}),i.jsxs("div",{className:"flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0",children:[i.jsx("div",{className:"min-w-0 flex-1 sm:w-56 sm:flex-none",children:i.jsx(Je,{size:"sm",value:$,onChange:ne=>H(ne.target.value),placeholder:x.models.searchPlaceholder})}),r&&i.jsx(ye,{size:"sm",onClick:()=>{re()},disabled:ee||g===null,title:x.models.syncCatalogHint,children:x.models.syncCatalog})]})]}),g===null?i.jsx(Dr,{rows:4}):g.length===0?i.jsx(Or,{title:x.models.empty,action:r&&i.jsx(ye,{onClick:()=>R("custom"),children:x.models.addCustom})}):T.length===0?i.jsx(Or,{title:x.models.noSearchResults}):i.jsxs("div",{className:"space-y-3",children:[T.map(ne=>{const me=!_.has(ne.provider.id);return i.jsxs("section",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 pr-2 transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[i.jsxs("button",{type:"button","aria-expanded":me,onClick:()=>Ce(ne.provider.id),className:"flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left",children:[i.jsx(_i,{provider:ne.provider.id,className:"h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"}),i.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:ne.provider.label}),i.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.models.modelCount(ne.rows.length)})]}),r&&i.jsx("span",{className:"shrink-0",children:i.jsxs(ye,{size:"sm",variant:"ghost",disabled:ee,onClick:()=>R(ne.provider.id),children:[i.jsx(We,{d:tR,size:13}),x.models.addToGroup]})}),r&&ne.provider.id!=="custom"&&i.jsx("span",{className:"hidden shrink-0 sm:block",children:i.jsxs(ye,{size:"sm",variant:"ghost",disabled:ee,onClick:()=>W(ne.provider.id),children:[i.jsx(We,{d:nR,size:13}),x.models.groupApiKey]})}),r&&i.jsxs(ye,{size:"sm",variant:"ghost",className:"shrink-0",disabled:ee||m!==null,"aria-label":`${x.models.speedTest} ${ne.provider.label}`,title:m===ne.provider.id?x.models.speedPending:x.models.speedTest,onClick:()=>f(ne.provider.id),children:[i.jsx(We,{d:aR,size:13}),i.jsx("span",{className:"hidden sm:inline",children:m===ne.provider.id?x.models.speedPending:x.models.speedTest})]}),ne.provider.apiKeyUrl&&i.jsxs("a",{href:ne.provider.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"hidden shrink-0 whitespace-nowrap text-xs text-brand-600 underline-offset-2 hover:underline sm:inline dark:text-brand-300",children:[x.models.getApiKey," ↗"]}),i.jsx("button",{type:"button","aria-expanded":me,"aria-label":ne.provider.label,onClick:()=>Ce(ne.provider.id),className:"shrink-0 p-1.5",children:i.jsx(ln,{open:me,className:"text-gray-400"})})]}),i.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${me?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:i.jsx("div",{className:"overflow-hidden",inert:!me,children:i.jsx("div",{className:`grid gap-2 border-t border-gray-200 p-2.5 transition-opacity duration-200 sm:grid-cols-2 lg:grid-cols-3 dark:border-gray-800 ${me?"opacity-100":"opacity-0"}`,children:ne.rows.length===0?i.jsx("p",{className:"col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500",children:x.models.groupEmptyHint}):ne.rows.map(be=>i.jsx(fR,{row:be,currency:U,isDefault:vt(ea(be),k),isVisionModel:vt(ea(be),j),speed:o.get(N1(be.provider,be.modelId)),onOpen:()=>M(ea(be))},`${be.provider}:${be.modelId}`))})})})]},ne.provider.id)}),r&&$.trim()===""&&i.jsxs("button",{type:"button",onClick:()=>{L(""),F(null),q(!0)},className:"w-full rounded-md border border-dashed border-gray-300 px-3 py-2.5 text-sm text-gray-500 transition-colors hover:border-gray-400 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:text-gray-200",children:["+ ",x.models.addGroup]})]}),D&&i.jsx("p",{className:"mt-3 text-xs text-red-600 dark:text-red-400",children:D})]}),g&&G&&i.jsx(gR,{provider:Ur.find(ne=>ne.id===G)??nk(G),count:g.filter(ne=>ne.provider===G).length,onClose:()=>W(null),onSubmit:ne=>{const me=G;W(null);const be=g.filter(Fe=>Fe.provider===me);if(be.length===0)return;const De=g.map(Fe=>Fe.provider===me?{...Fe,apiKeyInput:ne,clearApiKey:!1}:Fe);B(De,k,j,x.models.groupKeyApplied(be.length))}}),d!==null&&i.jsxs(Dt,{open:!0,title:x.models.speedTestTitle,onClose:()=>f(null),children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.models.speedTestConfirm(g?.filter(ne=>ne.provider===d).length??0)}),i.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[i.jsx(ye,{onClick:()=>f(null),children:x.common.cancel}),i.jsx(ye,{variant:"primary",onClick:()=>{const ne=d;f(null),ne&&de(ne)},children:x.models.speedTestStart})]})]}),z&&i.jsxs(Dt,{open:!0,title:x.models.addGroupTitle,onClose:()=>q(!1),widthClass:"sm:max-w-sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>q(!1),children:x.common.cancel}),i.jsx(ye,{variant:"primary",onClick:fe,children:x.common.confirm})]}),children:[i.jsxs("label",{className:"block",children:[i.jsx(Je,{size:"sm",label:x.models.groupNameLabel,value:A,invalid:!!X,onChange:ne=>{L(ne.target.value),F(null)},onKeyDown:ne=>{ne.key==="Enter"&&fe()},placeholder:x.models.groupNameHint,className:"font-mono",autoFocus:!0}),X&&i.jsx(ki,{text:X})]}),i.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:x.models.addGroupDesc})]}),g&&(O!==null||he)&&i.jsx(pR,{projectId:n,row:O!==null?null:he??null,addProvider:O??"custom",existingRefs:g.map(ea),currency:U,canEdit:r,isDefault:he!==void 0&&vt(ea(he),k),isVisionModel:he!==void 0&&vt(ea(he),j),onClose:()=>{M(null),R(null)},onSubmit:(ne,me)=>{const be=O!==null;if(M(null),R(null),me==="remove"){const Ie=ne.original;B(g.filter(Lt=>!vt(ea(Lt),Ie)),vt(Ie,k)?void 0:k,vt(Ie,j)?void 0:j);return}const De=be?[...g,ne]:g.map(Ie=>vt(ea(Ie),N)?ne:Ie),Fe=iR({editing:be?null:N,ref:ea(ne),action:me,defaultModel:k,visionModel:j});B(De,Fe.defaultModel,Fe.visionModel)}})]})}function fR({row:e,currency:n,isDefault:r,isVisionModel:l,speed:o,onOpen:u}){const d=e.cacheRead||e.cacheWrite||e.output,f=[e.contextWindow?ft(Number(e.contextWindow)):null,d?`${Qf(e.cacheRead,n)} / ${Qf(e.cacheWrite,n)} / ${Qf(e.output,n)}`:null,e.credential?.apiKeyMasked&&!e.clearApiKey?e.credential.apiKeyMasked:cR(e)?x.models.keyConfigured:x.models.noKey].filter(h=>h!==null),m=o==="pending"?i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:x.models.speedPending}):o?o.ok?i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] font-medium",children:[o.ttftMs!==void 0&&i.jsxs("span",{className:`flex items-center gap-0.5 ${j1[J8(o.ttftMs)]}`,title:x.models.ttftTitle,children:[i.jsx(We,{d:rR,size:11}),Math.round(o.ttftMs),"ms"]}),o.tps!==void 0&&i.jsxs("span",{className:`flex items-center gap-0.5 ${j1[eR(o.tps)]}`,title:x.models.tpsTitle,children:[i.jsx(We,{d:lR,size:11}),o.tps," tok/s"]})]}):i.jsx("span",{className:"shrink-0 text-[11px] font-medium text-red-600 dark:text-red-400",title:o.message,children:x.models.speedFailed}):null;return i.jsxs("button",{type:"button",onClick:u,className:"flex w-full flex-col gap-0.5 rounded-md border border-gray-200 px-3 py-2.5 text-left transition-colors duration-150 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:hover:border-gray-700 dark:hover:bg-gray-800/40",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:"text-sm font-medium",children:e.displayName??e.modelId}),r&&i.jsx(Rt,{tone:"brand",children:x.models.default}),e.vision&&i.jsx(Rt,{tone:"green",children:x.models.visionBadge}),l&&i.jsx(Rt,{tone:"amber",children:x.models.visionModelBadge})]}),e.displayName!==void 0&&i.jsx("span",{className:"truncate font-mono text-[11px] text-gray-500 dark:text-gray-400",children:e.modelId}),i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-gray-400 dark:text-gray-500",children:f.join(" · ")}),m]})]})}const mR={save:()=>x.models.confirmSaveTitle,setDefault:()=>x.models.confirmDefaultTitle,setVisionModel:()=>x.models.confirmVisionModelTitle,remove:()=>x.models.confirmDeleteTitle},hR={save:e=>x.models.confirmSave(e),setDefault:e=>x.models.confirmDefault(e),setVisionModel:e=>x.models.confirmVisionModel(e),remove:e=>x.models.confirmDelete(e)};function pR({projectId:e,row:n,addProvider:r,existingRefs:l,currency:o,canEdit:u,isDefault:d,isVisionModel:f,onClose:m,onSubmit:h}){const[g,v]=b.useState(()=>{if(n)return{...n,cacheRead:Zf(n.cacheRead,o),cacheWrite:Zf(n.cacheWrite,o),output:Zf(n.output,o)};const F=aa(r),D=F!==void 0&&F.id!=="custom"&&F.gatewayBaseUrl===void 0;return{provider:r,modelId:"",original:null,vision:!0,contextWindow:"",maxTokens:"",clientType:D?"":"openai",cacheRead:"",cacheWrite:"",output:"",baseUrl:F?.gatewayBaseUrl??"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}),[k,w]=b.useState({}),[j,C]=b.useState(!1),[N,M]=b.useState(null),O=n===null,R=n!==null&&oR(n),$=F=>{v(D=>({...D,...F})),w(D=>{const te={...D};for(const ee of Object.keys(F))delete te[ee];return te})},H=async()=>{C(!0);try{const F=g.apiKeyInput.trim(),D=g.baseUrl.trim(),te={provider:g.provider,modelId:g.modelId.trim(),baseUrl:D||null};F?te.apiKey=F:g.clearApiKey&&(te.clearApiKey=!0),g.clientType.trim()&&(te.clientType=g.clientType.trim());const ee=await X1(e,te);ee.ok?os(x.models.testOk(ee.latencyMs??0)):On(x.models.testFailed(ee.message??""))}catch(F){On(x.models.testFailed(F instanceof He?F.message:x.common.unknownError))}finally{C(!1)}},_=()=>{const F=g.modelId.trim(),D={provider:g.provider,modelId:F},te=g.baseUrl.trim(),ee={};F?!vt(D,g.original)&&l.some(re=>vt(re,D))&&(ee.modelId=x.models.modelIdExists):ee.modelId=x.common.requiredField;const we=g.clientType.trim().toLowerCase().includes("openai")||g.provider==="custom"||aa(g.provider)===void 0;!R&&we&&!te&&(ee.baseUrl=x.models.baseUrlRequired);const U=[["cacheRead",g.cacheRead.trim()],["cacheWrite",g.cacheWrite.trim()],["output",g.output.trim()]],I=U.filter(([,re])=>re!=="").length;for(const[re,de]of U)de===""&&I>0?ee[re]=x.models.pricingAllOrNone:de!==""&&!Number.isFinite(Number(de))&&(ee[re]=x.models.pricingInvalid);const B=g.contextWindow.trim();B&&!Number.isFinite(Number(B))&&(ee.contextWindow=x.models.contextWindowInvalid);const T=g.maxTokens.trim();return T&&!(Number.isInteger(Number(T))&&Number(T)>0)&&(ee.maxTokens=x.models.maxTokensInvalid),Object.keys(ee).length>0?(w(ee),null):(w({}),{...g,modelId:F,contextWindow:!R&&!B?String(em):g.contextWindow,cacheRead:Jf(g.cacheRead,o),cacheWrite:Jf(g.cacheWrite,o),output:Jf(g.output,o)})},V=F=>{const D=_();D&&h(D,F)},G=aa(g.provider),W=Z6(g.modelId.trim(),g.clientType.trim()||void 0)?.envKey,z=G!==void 0&&G.id!=="custom"&&G.gatewayBaseUrl===void 0,q=O&&z&&!g.clientType.trim()&&g.modelId.trim()!==""&&W===void 0,A=i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"block",children:[i.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[i.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.modelId}),i.jsx("span",{className:"flex shrink-0 items-baseline gap-2.5",children:G?.modelsUrl&&i.jsxs("a",{href:G.modelsUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[x.models.getModelIds," ↗"]})})]}),i.jsx(Je,{size:"sm",value:g.modelId,disabled:!u,invalid:!!k.modelId,onChange:F=>$({modelId:F.target.value}),className:"font-mono",autoFocus:O,placeholder:x.models.modelIdHint}),k.modelId&&i.jsx(ki,{text:k.modelId}),q&&i.jsx("span",{className:"mt-1 block text-xs text-amber-600 dark:text-amber-400",children:x.models.autoRouteNone})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Je,{size:"sm",label:x.models.displayName,value:g.displayName??"",disabled:!u,onChange:F=>$({displayName:F.target.value}),placeholder:x.models.displayNameHint}),i.jsxs(zi,{size:"sm",label:x.models.providerGroup,value:g.provider,disabled:!u,onChange:F=>$({provider:F.target.value}),children:[Ur.map(F=>i.jsx("option",{value:F.id,children:F.label},F.id)),[...new Set(l.map(F=>F.provider).concat(g.provider))].filter(F=>!Ur.some(D=>D.id===F)).sort().map(F=>i.jsx("option",{value:F,children:F},F))]})]})]}),L=g.credential?.apiKeyMasked?x.models.apiKeyKeepHint:W?x.models.apiKeyEnvHint(W):x.models.apiKeyKeepHint,X=!g.credential?.apiKeyMasked&&W&&W===G?.envKey?x.models.providerEnvNotes[g.provider]:void 0;return i.jsxs(Dt,{open:!0,title:O?z?x.models.addTitleVendor:x.models.addTitle:x.models.editTitle,onClose:m,widthClass:"sm:max-w-lg",footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:m,children:x.common.cancel}),u&&i.jsx(ye,{variant:"primary",onClick:()=>{_()&&(O?V("save"):M("save"))},children:x.common.confirm})]}),children:[i.jsxs("div",{className:"space-y-3",children:[!O&&i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60",children:[i.jsx(_i,{provider:g.provider,className:"h-6 w-6 shrink-0 text-gray-700 dark:text-gray-300"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 text-sm font-medium",children:[g.displayName??g.modelId,d&&i.jsx(Rt,{tone:"brand",children:x.models.default}),g.vision&&i.jsx(Rt,{tone:"green",children:x.models.visionBadge}),f&&i.jsx(Rt,{tone:"amber",children:x.models.visionModelBadge})]}),g.displayName!==void 0&&i.jsx("span",{className:"truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:g.modelId})]}),n&&Ky(n.provider,n.modelId)&&i.jsxs("a",{href:Ky(n.provider,n.modelId),target:"_blank",rel:"noreferrer noopener",className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800",children:[x.models.homepage,i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0",children:i.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"})})]})]}),O&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:z?x.models.addAutoRouteHint:x.models.addProtocolHint}),A]}),u&&i.jsx("div",{className:"space-y-1.5",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(ye,{size:"sm",disabled:j||!g.modelId.trim(),onClick:()=>{H()},children:j?x.models.testing:x.models.testConnection}),!O&&!d&&i.jsx(ye,{size:"sm",onClick:()=>M("setDefault"),children:x.models.setDefault}),!O&&g.vision&&!f&&i.jsx(ye,{size:"sm",title:x.models.visionModelHint,onClick:()=>M("setVisionModel"),children:x.models.setVisionModel}),!O&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(ye,{size:"sm",variant:"danger",onClick:()=>M("remove"),children:x.models.remove})]})]})}),i.jsxs("div",{className:"block",children:[i.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[i.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.apiKey}),G?.apiKeyUrl&&i.jsxs("a",{href:G.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[x.models.getApiKey," ↗"]})]}),i.jsx(Ir,{size:"sm",value:g.apiKeyInput,disabled:!u,onChange:F=>$({apiKeyInput:F.target.value,clearApiKey:!1}),className:"font-mono",autoComplete:"off",autoFocus:!O,placeholder:L})]}),X&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:X}),g.credential?.apiKeyMasked&&!g.apiKeyInput&&i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"font-mono",children:g.credential.apiKeyMasked}),g.credential.createdAt&&i.jsxs("span",{className:"text-gray-400",children:[x.models.createdAt," ",$n(g.credential.createdAt)]}),u&&i.jsxs("label",{className:"flex items-center gap-1.5",children:[i.jsx("input",{type:"checkbox",checked:g.clearApiKey,onChange:F=>$({clearApiKey:F.target.checked})}),x.models.clearApiKey]})]}),i.jsx(Je,{size:"sm",label:x.models.baseUrl,value:g.baseUrl,disabled:!u,onChange:F=>$({baseUrl:F.target.value}),className:"font-mono",placeholder:R?x.models.baseUrlHint:"https://…",...k.baseUrl?{error:k.baseUrl}:{}}),i.jsxs("div",{className:"grid grid-cols-2 items-start gap-2",children:[i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.contextWindow}),i.jsxs("span",{className:"relative block",children:[i.jsx(Je,{size:"sm",value:g.contextWindow,inputMode:"numeric",disabled:!u,invalid:!!k.contextWindow,onChange:F=>$({contextWindow:C1(F.target.value)}),className:"pr-12 font-mono",title:R?x.models.contextWindowHint:x.models.contextWindowDefaultHint(em),placeholder:R?x.models.contextWindowHint:x.models.contextWindowDefaultHint(em)}),i.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:x.models.tokenUnit})]}),k.contextWindow&&i.jsx(ki,{text:k.contextWindow})]}),i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.maxTokens}),i.jsxs("span",{className:"relative block",children:[i.jsx(Je,{size:"sm",value:g.maxTokens,inputMode:"numeric",disabled:!u,invalid:!!k.maxTokens,onChange:F=>$({maxTokens:C1(F.target.value)}),className:"pr-12 font-mono",title:x.models.maxTokensTitle,placeholder:x.models.maxTokensHint}),i.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:x.models.tokenUnit})]}),k.maxTokens&&i.jsx(ki,{text:k.maxTokens})]})]}),i.jsx("div",{className:"grid grid-cols-3 items-start gap-2",children:[["cacheRead",x.models.priceCacheRead,g.cacheRead],["cacheWrite",x.models.priceCacheWrite,g.cacheWrite],["output",x.models.priceOutput,g.output]].map(([F,D,te])=>i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:D}),i.jsxs("span",{className:"relative block",children:[i.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-2 flex items-center text-xs text-gray-400",children:yk[o]}),i.jsx(Je,{size:"sm",value:te,inputMode:"decimal",disabled:!u,invalid:!!k[F],onChange:ee=>$({[F]:sR(ee.target.value)}),className:"pl-4 pr-11 text-right font-mono"}),i.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:x.models.priceUnitShort})]}),k[F]&&i.jsx(ki,{text:k[F]})]},F))}),!O&&A,!O&&!R&&g.clientType&&g.clientType!=="openai"&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.models.clientTypeLocked(g.clientType)}),!R&&i.jsxs("div",{children:[i.jsxs("label",{className:`inline-flex items-center gap-2 ${u?"cursor-pointer":"cursor-not-allowed"}`,children:[i.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.vision}),i.jsx(X8,{checked:g.vision,disabled:!u,onChange:F=>$({vision:F}),"aria-label":x.models.vision})]}),!g.vision&&i.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:x.models.visionOffProxyHint})]})]}),N&&i.jsx(Dt,{open:!0,title:mR[N](),onClose:()=>M(null),footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:()=>M(null),children:x.common.cancel}),i.jsx(ye,{variant:N==="remove"?"danger":"primary",onClick:()=>{const F=N;M(null),V(F)},children:x.common.confirm})]}),children:i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:hR[N](g.displayName??g.modelId)})})]})}function gR({provider:e,count:n,onClose:r,onSubmit:l}){const[o,u]=b.useState("");return i.jsx(Dt,{open:!0,title:x.models.groupApiKeyTitle(e.label),onClose:r,footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:r,children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:!o.trim(),onClick:()=>l(o.trim()),children:x.common.confirm})]}),children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(Je,{size:"sm",label:x.models.apiKey,type:"password",value:o,onChange:d=>u(d.target.value),className:"font-mono",autoComplete:"off",autoFocus:!0,placeholder:x.models.apiKeyEnvHint(e.envKey)}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.models.groupApiKeyHint(n)}),x.models.providerEnvNotes[e.id]&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.models.providerEnvNotes[e.id]}),e.apiKeyUrl&&i.jsxs("a",{href:e.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"inline-block text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[x.models.getApiKey," ↗"]})]})})}const wi=200,pl=46,Pc=8,Ci=10,xR=22;function Mh(e,n,r){const l=Math.max(0,r-pl-Pc),o=wi-Ci-xR,u=e>0?l/e:l;return{n:e,max:n,w:r,innerW:l,innerH:o,step:u,x:d=>pl+u*d+u/2,y:d=>Ci+o*(1-(n>0?d/n:0))}}function yR(e,n){return n.map((r,l)=>`${l===0?"M":"L"}${e.x(l)},${e.y(r)}`).join(" ")}function vR(e,n){const r=n.length;if(r===0)return"";const l=e.y(0),o=[];for(let u=0;u<r;u++)o.push(`${u===0?"M":"L"}${e.x(u)},${e.y(n[u])}`);return o.push(`L${e.x(r-1)},${l}`),o.push(`L${e.x(0)},${l}`),o.push("Z"),o.join(" ")}function bR(e){return e<=0?[]:e===1?[0]:e===2?[0,1]:[0,Math.floor((e-1)/2),e-1]}const kR=40;function wR(e,n){if(e<=0)return[];const r=n>0?Math.max(1,Math.ceil(kR/n)):e,l=[];for(let o=0;o<e;o+=r)l.push(o);return l}function SR(e,n){return n>0?e/n:1}const xc=12;function jR(e,n,r,l,o){let u=e+xc;u+r>o.right&&(u=e-xc-r);let d=n+xc;return d+l>o.bottom&&(d=n-xc-l),{left:Math.max(o.left,Math.min(u,o.right-r)),top:Math.max(0,Math.min(d,o.bottom-l))}}const tm=25,NR=8;function CR(e,n){const r=Math.max(0,e-pl-Pc),l=2*tm*n;return l<=r?{barW:tm,chartW:e,scroll:!1}:{barW:tm,chartW:pl+l+Pc,scroll:!0}}function TR(e,n,r){const l=e.length;if(l===0)return[];if(n<=l*r)return e.map(()=>n/l);const o=new Set;for(;;){const u=n-o.size*r,d=e.reduce((h,g,v)=>o.has(v)?h:h+g,0),f=h=>d>0?e[h]/d*u:u/(l-o.size),m=e.findIndex((h,g)=>!o.has(g)&&f(g)<r);if(m<0)return e.map((h,g)=>o.has(g)?r:f(g));o.add(m)}}const ER=["output","cacheWrite","cacheRead"];function MR(e,n){const r=ER.map(m=>({key:m,value:n[m]})).filter(m=>m.value>0);if(r.length===0)return[];const l=[];let o=0;for(const m of r){const h=e.y(o);o+=m.value;const g=e.y(o);l.push({y:g,h:h-g})}const u=e.y(0),d=TR(l.map(m=>m.h),u-e.y(o),NR);let f=u;return r.map((m,h)=>{const g=d[h],v={key:m.key,value:m.value,y:l[h].y,h:l[h].h,hitY:f-g,hitH:g};return f-=g,v})}const vk=Math.PI*2,qc=e=>Math.round(e*100)/100;function yc(e,n,r,l){const o=l-Math.PI/2;return[qc(e+r*Math.cos(o)),qc(n+r*Math.sin(o))]}function AR(e,n,r,l,o){if(o-l>=vk-1e-9){const[g,v]=yc(e,n,r,0),[k,w]=yc(e,n,r,Math.PI);return`M${g},${v} A${r},${r} 0 1 1 ${k},${w} A${r},${r} 0 1 1 ${g},${v} Z`}const[u,d]=yc(e,n,r,l),[f,m]=yc(e,n,r,o),h=o-l>Math.PI?1:0;return`M${qc(e)},${qc(n)} L${u},${d} A${r},${r} 0 ${h} 1 ${f},${m} Z`}function RR(e,n,r,l){const o=e.reduce((f,m)=>f+Math.max(0,m),0);if(o<=0)return[];const u=[];let d=0;return e.forEach((f,m)=>{if(f<=0)return;const h=f/o,g=d+h*vk;u.push({index:m,value:f,frac:h,start:d,end:g,path:AR(n,r,l,d,g)}),d=g}),u}function Ah(){const e=b.useRef(null),[n,r]=b.useState(0);return b.useLayoutEffect(()=>{const l=e.current;if(!l)return;const o=()=>r(Math.floor(l.getBoundingClientRect().width));o();const u=new ResizeObserver(o);return u.observe(l),()=>u.disconnect()},[]),[e,n]}function Rh({geom:e,fmtY:n,dates:r,hover:l,onHover:o,bubble:u,hitLayer:d,labels:f,hoverLine:m=!0,scrollToEnd:h=!1,children:g}){const{x:v,y:k,w,innerH:j,step:C,max:N}=e,M=[0,.25,.5,.75,1].map(z=>N*z),O=f??bR(r.length),R=b.useRef(null);b.useLayoutEffect(()=>{const z=R.current;!h||!z||(z.scrollLeft=z.scrollWidth-z.clientWidth)},[h,w,r.length]);const $=b.useRef(null),H=b.useRef(null),_=b.useRef(null),V=b.useRef(0),G=()=>{const z=H.current,q=$.current,A=R.current,L=_.current;if(!z||!q||!A||!L)return;const X=q.getBoundingClientRect(),F=jR(L.cx-X.left,L.cy-X.top,z.offsetWidth,z.offsetHeight,{left:A.scrollLeft,right:A.scrollLeft+A.clientWidth,bottom:wi});z.style.left=`${F.left}px`,z.style.top=`${F.top}px`,z.style.visibility="visible"},W=()=>{V.current||(V.current=requestAnimationFrame(()=>{V.current=0,G()}))};return b.useEffect(()=>()=>cancelAnimationFrame(V.current),[]),b.useLayoutEffect(G,[u,l]),i.jsxs("div",{ref:R,className:"relative overflow-x-auto",children:[i.jsxs("svg",{ref:$,viewBox:`0 0 ${w} ${wi}`,width:w,height:wi,className:"text-gray-600 dark:text-gray-400",role:"img",onMouseLeave:()=>{o(null),_.current=null},onMouseMove:z=>{_.current={cx:z.clientX,cy:z.clientY},W()},children:[M.map((z,q)=>i.jsxs("g",{children:[i.jsx("line",{x1:pl,x2:w-Pc,y1:k(z),y2:k(z),className:"stroke-gray-200 dark:stroke-gray-800",strokeWidth:1}),i.jsx("text",{x:pl-6,y:k(z)+3,textAnchor:"end",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:n(z)})]},q)),m&&l!==null&&r[l]&&i.jsx("line",{x1:v(l),x2:v(l),y1:Ci,y2:Ci+j,className:"stroke-gray-300 dark:stroke-gray-700",strokeWidth:1}),g,O.map(z=>{const q=r[z];return q?i.jsx("text",{x:v(z),y:wi-6,textAnchor:"middle",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:q.slice(5)},z):null}),d??r.map((z,q)=>i.jsx("rect",{x:pl+C*q,y:Ci,width:C,height:j,fill:"transparent",className:"cursor-crosshair",onMouseEnter:()=>o(q)},`hit-${q}`))]}),u&&l!==null&&r[l]&&i.jsx("div",{ref:H,className:"pointer-events-none absolute rounded border border-gray-200 bg-white px-2 py-1 text-xs whitespace-nowrap shadow-sm dark:border-gray-700 dark:bg-gray-900",style:{left:0,top:0,visibility:"hidden"},children:u(l)})]})}function LR({points:e,currency:n="USD"}){const[r,l]=b.useState(null),[o,u]=Ah(),d=e.map(g=>g.cost??0),f=Math.max(1e-9,...d),m=Mh(e.length,f,u),h=e.map(g=>g.date);return i.jsx("div",{ref:o,children:u>0&&i.jsx(Rh,{geom:m,fmtY:g=>la(g,n),dates:h,hover:r,onHover:l,bubble:g=>{const v=e[g];return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-gray-400",children:v.date}),i.jsx("p",{className:"font-mono",children:la(v.cost,n)})]})},children:i.jsxs("g",{children:[i.jsx("path",{d:vR(m,d),className:"fill-current",stroke:"none",opacity:r!==null?.06:.1}),i.jsx("path",{d:yR(m,d),fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),e.map((g,v)=>i.jsx("circle",{cx:m.x(v),cy:m.y(g.cost??0),r:r===v?4:2.5,className:"fill-current",opacity:r!==null&&r!==v?.25:1},g.date))]})})})}const Ti={cacheRead:"#7dd3fc",cacheWrite:"#0ea5e9",output:"#0369a1"},E1=[{fill:"fill-violet-500 dark:fill-violet-400",swatch:"bg-violet-500 dark:bg-violet-400"},{fill:"fill-sky-500 dark:fill-sky-400",swatch:"bg-sky-500 dark:bg-sky-400"},{fill:"fill-amber-500 dark:fill-amber-400",swatch:"bg-amber-500 dark:bg-amber-400"},{fill:"fill-rose-500 dark:fill-rose-400",swatch:"bg-rose-500 dark:bg-rose-400"},{fill:"fill-emerald-500 dark:fill-emerald-400",swatch:"bg-emerald-500 dark:bg-emerald-400"},{fill:"fill-cyan-500 dark:fill-cyan-400",swatch:"bg-cyan-500 dark:bg-cyan-400"},{fill:"fill-fuchsia-500 dark:fill-fuchsia-400",swatch:"bg-fuchsia-500 dark:bg-fuchsia-400"}];function M1(e){return E1[e%E1.length]}const A1=[{text:"text-violet-500",swatch:"bg-violet-500"},{text:"text-amber-500 dark:text-amber-600",swatch:"bg-amber-500 dark:bg-amber-600"},{text:"text-sky-500 dark:text-sky-600",swatch:"bg-sky-500 dark:bg-sky-600"},{text:"text-rose-500",swatch:"bg-rose-500"}];function bk(e){return A1[e%A1.length]}function lu({text:e}){return i.jsx("p",{className:"py-6 text-center text-xs text-gray-400",children:e??x.usage.empty})}function _R(e){return e==="cacheRead"?x.usage.colCacheRead:e==="cacheWrite"?x.usage.colCacheWrite:x.usage.colOutput}const kk="opacity-25",vc=160,IR=75;function zR({data:e}){const[n,r]=b.useState(null),l=e.reduce((m,h)=>m+h.requests,0);if(e.length===0||l<=0)return i.jsx(lu,{});const o=[...e].sort((m,h)=>h.requests-m.requests),u=RR(o.map(m=>m.requests),vc/2,vc/2,IR),d=m=>`${Math.round(m/l*100)}%`,f=m=>n!==null&&n!==m?kk:"";return i.jsxs("div",{className:"flex items-center gap-3",onMouseLeave:()=>r(null),children:[i.jsx("svg",{viewBox:`0 0 ${vc} ${vc}`,className:"h-40 w-40 shrink-0",role:"img","aria-label":x.usage.chartAgentCalls,children:u.map(m=>{const h=o[m.index];return i.jsx("path",{d:m.path,onMouseEnter:()=>r(m.index),className:`cursor-pointer ${M1(m.index).fill} transition-opacity duration-150 ${f(m.index)}`,children:i.jsx("title",{children:`${h.agentId} · ${h.requests} ${x.usage.requests} · ${d(h.requests)}`})},h.agentId)})}),i.jsx("ul",{className:"flex max-h-40 min-w-0 flex-1 flex-col gap-1 overflow-y-auto",children:o.map((m,h)=>i.jsxs("li",{onMouseEnter:()=>r(m.requests>0?h:null),title:`${m.agentId} · ${m.requests} ${x.usage.requests} · ${ft(m.total)}`,className:`flex cursor-pointer items-center gap-1.5 text-[10px] transition-opacity duration-150 ${f(h)}`,children:[i.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${M1(h).swatch}`}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-gray-500 dark:text-gray-400",children:m.agentId}),i.jsx("span",{className:"shrink-0 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:m.requests}),i.jsx("span",{className:"w-8 shrink-0 text-right font-mono tabular-nums text-gray-400 dark:text-gray-500",children:d(m.requests)})]},m.agentId))})]})}function DR({dimmed:e,onEnter:n,title:r,label:l,value:o,children:u}){return i.jsxs("div",{onMouseEnter:n,className:`flex cursor-pointer items-center gap-2 transition-opacity duration-150 ${e?kk:""}`,title:r,children:[i.jsx("span",{className:"w-24 shrink-0 truncate font-mono text-[10px] text-gray-500 dark:text-gray-400",children:l}),u,i.jsx("span",{className:"w-10 shrink-0 text-right font-mono text-[10px] tabular-nums text-gray-500 dark:text-gray-400",children:o})]})}function OR(e){return Ch(e.provider,e.modelId)?.displayName??e.modelId}function UR(e){const n=[`${e.completed}/${e.total}`];e.failed>0&&n.push(`failed ${e.failed}`),e.timeout>0&&n.push(`timeout ${e.timeout}`),e.malformed>0&&n.push(`malformed ${e.malformed}`),e.aborted>0&&n.push(`${x.usage.successAborted} ${e.aborted}`);const r=aa(e.provider)?.label??e.provider;return`${e.modelId} · ${r} · ${n.join(" · ")}`}function $R({data:e}){const[n,r]=b.useState(null);return e.length===0?i.jsx(lu,{}):i.jsx("div",{className:"flex flex-col gap-1.5",onMouseLeave:()=>r(null),children:e.map((l,o)=>{const u=SR(l.completed,l.total),d=Math.round(u*100);return i.jsx(DR,{dimmed:n!==null&&n!==o,onEnter:()=>r(o),title:UR(l),label:OR(l),value:`${d}%`,children:i.jsx("div",{className:"h-3 min-w-0 flex-1 overflow-hidden rounded-sm bg-gray-200 dark:bg-gray-800",children:i.jsx("div",{className:"h-full rounded-sm bg-sky-500 dark:bg-sky-400",style:{width:`${u*100}%`}})})},`${l.provider}:${l.modelId}`)})})}function BR({trend:e,legend:n}){const[r,l]=b.useState(null),[o,u]=Ah();if(e.length===0)return i.jsx(lu,{});const d=e.map(C=>C.cacheRead+C.cacheWrite+C.output),f=Math.max(1,...d),{barW:m,chartW:h,scroll:g}=CR(u,e.length),v=Mh(e.length,f,h),k=e.map(C=>C.date),w=e.map(C=>MR(v,C)),j=(C,N)=>r!==null&&!(r.i===C&&r.key===N)||n!=null&&n!==N;return i.jsx("div",{ref:o,children:u>0&&i.jsx(Rh,{geom:v,fmtY:C=>ft(Math.round(C)),dates:k,hover:r?.i??null,labels:wR(e.length,v.step),hoverLine:!1,scrollToEnd:g,onHover:C=>{C===null&&l(null)},bubble:C=>{const N=e[C],M=r?.key;if(!M)return null;const O=M==="cacheRead"?Lv(N.cacheRead,N.cacheWrite):null;return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-gray-400",children:N.date}),i.jsxs("p",{className:"font-mono",children:[_R(M)," ",ft(N[M])]}),O!==null&&i.jsxs("p",{className:"font-mono",children:[x.traces.hitRate," ",eh(O)]})]})},hitLayer:e.map((C,N)=>w[N].map(M=>i.jsx("rect",{x:v.x(N)-m/2,y:M.hitY,width:m,height:M.hitH,fill:"transparent",className:"cursor-pointer",onMouseEnter:()=>l({i:N,key:M.key}),onMouseLeave:()=>l(null)},`hit-${C.date}-${M.key}`))),children:e.map((C,N)=>w[N].map(M=>i.jsx("rect",{x:v.x(N)-m/2,y:M.y,width:m,height:M.h,fill:Ti[M.key],className:"transition-opacity duration-150",opacity:j(N,M.key)?.2:1},`${C.date}-${M.key}`)))})})}function HR({active:e,onHover:n}){const r=[["cacheRead",x.usage.colCacheRead],["cacheWrite",x.usage.colCacheWrite],["output",x.usage.colOutput]];return i.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:r.map(([l,o])=>i.jsxs("button",{type:"button",onMouseEnter:()=>n?.(l),onMouseLeave:()=>n?.(null),className:`flex items-center gap-1 text-[10px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${e!=null&&e!==l?"opacity-30":""}`,children:[i.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{backgroundColor:Ti[l]}}),o]},l))})}function PR(e){return e==="unexpected"?x.usage.errorsUnexpected:x.usage.errorsExpected}function qR(e){return e==="unexpected"?"unexpected":"expected"}function bc({label:e,value:n,alert:r,muted:l}){const o=r?"text-rose-600 dark:text-rose-400":l?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return i.jsxs("div",{className:"flex items-baseline gap-1.5",children:[i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e}),i.jsx("span",{className:`font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function kc({children:e,className:n=""}){return i.jsx("th",{className:`py-1.5 pr-2 font-medium ${n}`,children:e})}function FR({errors:e}){const{total:n,unexpected:r,topCode:l,recent:o}=e;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-6 gap-y-1.5",children:[i.jsx(bc,{label:x.usage.errorsTotal,value:String(n)}),i.jsx(bc,{label:x.usage.errorsUnexpected,value:String(r),alert:r>0,muted:r===0}),i.jsx(bc,{label:x.usage.errorsExpected,value:String(n-r),muted:!0}),l&&i.jsx(bc,{label:x.usage.errorsTopCode,value:`${l.source} · ${l.code} ×${l.count}`})]}),o.length===0?i.jsx(lu,{text:x.usage.errorsEmpty}):i.jsx("div",{className:"mt-2.5 max-h-72 overflow-y-auto border-t border-gray-200 dark:border-gray-800",children:i.jsxs("table",{className:"w-full table-fixed text-xs",children:[i.jsx("thead",{className:"sticky top-0 bg-white text-left text-gray-400 dark:bg-gray-900 dark:text-gray-500",children:i.jsxs("tr",{children:[i.jsx(kc,{className:"w-32",children:x.usage.errorsColTime}),i.jsx(kc,{className:"w-72",children:x.usage.errorsColCode}),i.jsx(kc,{className:"w-20",children:x.usage.errorsColKind}),i.jsx(kc,{children:x.usage.errorsColMessage})]})}),i.jsx("tbody",{children:o.map((u,d)=>{const f=qR(u.kind);return i.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[i.jsx("td",{className:"py-1.5 pr-2 font-mono tabular-nums text-gray-400",children:$n(u.ts)}),i.jsx("td",{className:"py-1.5 pr-2 font-mono text-gray-500 dark:text-gray-400",children:i.jsxs("span",{className:"block truncate",title:`${u.source} · ${u.code}`,children:[u.source," · ",u.code]})}),i.jsx("td",{className:"py-1.5 pr-2",children:i.jsx(Rt,{tone:f==="unexpected"?"red":"gray",children:PR(f)})}),i.jsx("td",{className:"py-1.5 text-gray-500 dark:text-gray-400",children:i.jsx("span",{className:"block truncate",title:u.message,children:u.message})})]},`${u.ts}-${d}`)})})]})})]})}function R1(e){const n=r=>r<10?`0${r}`:`${r}`;return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function nm({label:e,value:n,muted:r,sup:l}){const o=r?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return i.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[i.jsxs("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:[e,l&&i.jsx("sup",{className:"ml-px",children:"*"})]}),i.jsx("span",{className:`min-w-0 truncate font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function am({title:e,bucket:n,currency:r}){return i.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("p",{className:"mb-1.5 text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(nm,{label:x.usage.tokens,value:ft(n.total)}),i.jsx(nm,{label:x.usage.requests,value:String(n.requests),muted:!0}),i.jsx(nm,{label:x.usage.colCost,value:la(n.cost,r),sup:n.hasUncosted})]})]})}function xi({title:e,extra:n,children:r}){return i.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),n]}),r]})}function VR(){Ta(x.usage.title);const{currency:e}=xl(),{currentProject:n}=sn(),r=n?.projectId??null,[l]=Zm(),o=l.get("agentId"),[u,d]=b.useState(o??""),[f,m]=b.useState(null);b.useEffect(()=>{d(o??"")},[o]);const[h,g]=b.useState(()=>{const W=new Date;return W.setDate(W.getDate()-29),R1(W)}),[v,k]=b.useState(()=>R1(new Date)),[w,j]=b.useState(null),[C,N]=b.useState(null),[M,O]=b.useState(null),R=b.useCallback(async()=>{if(r){N(null);try{const W=await J1(r,{from:h,to:v,groupBy:"date",...u?{agentId:u}:{},...f?{provider:f.provider,modelId:f.modelId}:{}});j(W)}catch(W){N(W instanceof He?W.message:x.common.unknownError)}}},[r,h,v,u,f?.provider,f?.modelId]);if(b.useEffect(()=>{j(null),R()},[R]),!r)return null;const $=w?.models??[],H=f?$.findIndex(W=>W.provider===f.provider&&W.modelId===f.modelId):-1,_=H>=0?String(H):"",V=w?.summary,G=(V?.today.hasUncosted??!1)||(V?.last7d.hasUncosted??!1)||(V?.total.hasUncosted??!1);return i.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:i.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.usage.title}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("div",{className:"w-32",children:i.jsxs(zi,{size:"sm",value:u,onChange:W=>d(W.target.value),children:[i.jsx("option",{value:"",children:x.usage.filterAllAgents}),u&&!(w?.agentIds??[]).includes(u)&&i.jsx("option",{value:u,children:u}),(w?.agentIds??[]).map(W=>i.jsx("option",{value:W,children:W},W))]})}),i.jsx("div",{className:"w-32",children:i.jsxs(zi,{size:"sm",value:_,onChange:W=>{const z=W.target.value;m(z===""?null:$[Number(z)]??null)},children:[i.jsx("option",{value:"",children:x.usage.filterAllModels}),$.map((W,z)=>i.jsx("option",{value:String(z),children:Ch(W.provider,W.modelId)?.displayName??W.modelId},`${W.provider}:${W.modelId}`))]})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Je,{size:"sm",type:"date","aria-label":x.usage.from,value:h,onChange:W=>g(W.target.value)}),i.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:"–"}),i.jsx(Je,{size:"sm",type:"date","aria-label":x.usage.to,value:v,onChange:W=>k(W.target.value)})]})]})]}),w?i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsx(am,{title:x.usage.today,bucket:w.summary.today,currency:e}),i.jsx(am,{title:x.usage.last7d,bucket:w.summary.last7d,currency:e}),i.jsx(am,{title:x.usage.total,bucket:w.summary.total,currency:e})]}):i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsx(At,{className:"h-24"}),i.jsx(At,{className:"h-24"}),i.jsx(At,{className:"h-24"})]}),w?i.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[i.jsx(xi,{title:x.usage.chartAgentCalls,children:i.jsx(zR,{data:w.byAgent})}),i.jsx(xi,{title:x.usage.chartSuccessRate,children:i.jsx($R,{data:w.success})}),i.jsx(xi,{title:x.usage.chartTokenTrend,extra:i.jsx(HR,{active:M,onHover:O}),children:i.jsx(BR,{trend:w.trend,legend:M})}),i.jsx(xi,{title:x.usage.chartCostTrend,children:i.jsx(LR,{points:w.trend,currency:e})})]}):i.jsx(At,{className:"h-64"}),w&&i.jsx(xi,{title:x.usage.errors,children:i.jsx(FR,{errors:w.errors})}),G&&i.jsx("p",{className:"text-xs text-gray-400",children:x.usage.uncostedNote}),C&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:C})]})})}function GR({cacheRead:e,cacheWrite:n,output:r,max:l,size:o=44}){const u=e+n+r,d=Math.max(2,Math.round(o*.16)),f=o/2,m=(o-d)/2,h=2*Math.PI*m,g=Math.max(l,u,1),v=l>0?u/l:0,k=v>.95?"text-red-500":v>.8?"text-amber-500":"text-gray-300 dark:text-gray-700",w=[{key:"cacheRead",value:e,color:Ti.cacheRead,label:x.usage.colCacheRead},{key:"cacheWrite",value:n,color:Ti.cacheWrite,label:x.usage.colCacheWrite},{key:"output",value:r,color:Ti.output,label:x.usage.colOutput}],j=`${x.chat.contextUsage} ${ft(u)}/${ft(l)}`+w.map(N=>` · ${N.label} ${ft(N.value)}`).join("");let C=0;return i.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,className:`block shrink-0 ${k}`,role:"img","aria-label":j,children:[i.jsx("title",{children:j}),i.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:"currentColor",strokeOpacity:.35,strokeWidth:d}),w.map(N=>{if(N.value<=0)return null;const M=N.value/g*h,O=-(C/g)*h;return C+=N.value,i.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:N.color,strokeWidth:d,strokeDasharray:`${M} ${h}`,strokeDashoffset:O,transform:`rotate(-90 ${f} ${f})`},N.key)})]})}const fa={thinking:"bg-violet-500 dark:bg-violet-400",text:"bg-sky-500 dark:bg-sky-400",toolgen:"bg-amber-500 dark:bg-amber-400",approvalWait:"bg-rose-400 dark:bg-rose-300",exec:"bg-emerald-500 dark:bg-emerald-400"},Lh="sticky left-0 z-10 flex h-4 w-[5.5rem] shrink-0 items-center justify-end bg-white pr-2 dark:bg-gray-950",wk="truncate font-mono text-[11px]",L1=.25,Um=24,KR=1/Um,Ya=(e,n,r)=>Math.min(r,Math.max(n,e));function WR(e){return e==="thinking"?fa.thinking:e==="text"?fa.text:fa.toolgen}function YR(e){return e==="thinking"?x.traces.kindThinking:e==="text"?x.traces.kindModelReply:x.traces.kindToolGen}function XR(e){return e==="thinking"?"thinking":e==="text"?"text":"toolgen"}function yi(e){if(e===void 0)return null;const n=Date.parse(e);return Number.isFinite(n)?n:null}function QR(e,n){const r=new Map,l=u=>{let d=r.get(u);return d||(d={segs:[],spans:[]},r.set(u,d)),d};for(const u of e){const d=yi(u.startTs),f=yi(u.endTs);d===null||f===null||l(u.taskIndex).segs.push({kind:u.kind,...u.name!==void 0?{name:u.name}:{},ts:u.endTs,startMs:d,endMs:f})}for(const u of n){const d=yi(u.callTs);d!==null&&l(u.taskIndex).spans.push({name:u.name||u.toolCallId,toolCallId:u.toolCallId,callTs:u.callTs,...u.approvalTs!==void 0?{approvalTsRaw:u.approvalTs}:{},...u.outputTs!==void 0?{outputTsRaw:u.outputTs}:{},callMs:d,approvalMs:yi(u.approvalTs),outputMs:yi(u.outputTs),failed:u.stopReason!==void 0&&u.stopReason!=="completed",...u.stopReason!==void 0?{status:u.stopReason}:{},...u.decision!==void 0?{decision:u.decision}:{}})}const o=[];for(const[u,{segs:d,spans:f}]of[...r.entries()].sort((m,h)=>m[0]-h[0])){if(d.length===0&&f.length===0)continue;const m=[...d.map(j=>j.startMs),...f.map(j=>j.callMs)],h=[...d.map(j=>j.endMs),...f.map(j=>j.outputMs??j.approvalMs??j.callMs)],g=Math.min(...m),v=Math.max(...h,...m),k=Math.max(1,v-g);f.sort((j,C)=>j.callMs-C.callMs);const w=[...new Set(f.map(j=>j.name))];o.push({taskIndex:u,segs:d,spans:f,t0:g,total:k,toolNames:w})}return o}function Sk({children:e}){return i.jsx("div",{className:"relative h-4 min-w-0 flex-1 overflow-hidden bg-gray-100 dark:bg-gray-800/60",children:e})}function ZR({label:e,children:n}){return i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:`${Lh} text-gray-400 dark:text-gray-500`,title:e,children:i.jsx("span",{className:wk,children:e})}),i.jsx(Sk,{children:n})]})}function JR({total:e}){const n=[0,.25,.5,.75,1];return i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:Lh}),i.jsx("div",{className:"relative h-4 min-w-0 flex-1",children:n.map((r,l)=>i.jsx("span",{className:`absolute top-0 font-mono text-[11px] text-gray-400 dark:text-gray-500 ${l===0?"":l===n.length-1?"-translate-x-full":"-translate-x-1/2"}`,style:{left:`${r*100}%`},children:Jt(r*e)},l))})]})}function e7({segments:e,toolSpans:n,highlight:r,onHighlight:l,onJump:o,hideTaskLabel:u=!1}){const d=b.useMemo(()=>QR(e,n),[e,n]),{firstBarKeyByTs:f,barKeys:m}=b.useMemo(()=>{const B=new Map,T=new Set,re=(de,fe)=>{T.add(fe),B.has(de)||B.set(de,fe)};for(const de of d){de.segs.forEach((fe,he)=>re(fe.ts,`s-${de.taskIndex}-${he}`));for(const fe of de.spans)fe.approvalMs!==null&&fe.approvalMs>fe.callMs&&re(fe.approvalTsRaw??fe.callTs,`w-${fe.toolCallId}`),fe.approvalMs===null&&fe.outputMs===null?re(fe.callTs,`p-${fe.toolCallId}`):re(fe.outputTsRaw??fe.callTs,`e-${fe.toolCallId}`)}return{firstBarKeyByTs:B,barKeys:T}},[d]),[h,g]=b.useState(null),[v,k]=b.useState(1),[w,j]=b.useState({left:0,width:1}),C=b.useRef(null),N=b.useRef(null),M=b.useRef(w);M.current=w;const O=b.useRef(v);O.current=v;const R=b.useRef(null),$=b.useRef(null),H=b.useCallback(()=>{const B=C.current;if(!B)return;const T=B.scrollWidth||1;j({left:B.scrollLeft/T,width:Math.min(1,B.clientWidth/T)})},[]);if(b.useLayoutEffect(()=>{const B=C.current;if(B){if(R.current){const T=B.scrollWidth-B.clientWidth;B.scrollLeft=Ya(R.current(B),0,Math.max(0,T)),R.current=null}H()}},[v,d,H]),b.useLayoutEffect(()=>{const B=C.current;if(!B||typeof ResizeObserver>"u")return;const T=new ResizeObserver(()=>H());return T.observe(B),()=>T.disconnect()},[H]),b.useLayoutEffect(()=>()=>$.current?.(),[]),d.length===0)return i.jsx("p",{className:"text-xs text-gray-400",children:x.common.none});const _=r?.ts,V=r?.key,G=(B,T)=>l?.(T?{ts:T,key:B}:null),W=()=>l?.(null),z=V??(_!==void 0?f.get(_):void 0),q=z!==void 0&&m.has(z)?z:void 0,A=q!==void 0,L=B=>q===B,X=(B,T)=>h!==null&&!T||A&&!B?"opacity-15":"",F=(B,T,re,de)=>{const fe=Ya((B-re)/de*100,0,100),he=Ya((T-B)/de*100,0,100-fe);return fe>=100?{left:"100%",width:"0%",marginLeft:"-2px"}:{left:`${fe}%`,width:`${he}%`}},D=[{key:"thinking",className:fa.thinking,label:x.traces.kindThinking},{key:"text",className:fa.text,label:x.traces.kindModelReply},{key:"toolgen",className:fa.toolgen,label:x.traces.kindToolGen},{key:"approvalWait",className:fa.approvalWait,label:x.traces.legendApprovalWait},{key:"exec",className:fa.exec,label:x.traces.legendToolExec}],te=(B,T)=>{const re=Ya(T,KR,1),de=Ya(1/re,L1,Um),fe=Ya(B,0,1-re);R.current=he=>fe*he.scrollWidth,k(de)},ee=B=>{B.preventDefault();const T=N.current,re=C.current;if(!T||!re)return;const de=T.getBoundingClientRect().width||1,fe=B.clientX,he=re.scrollLeft,Ce=Math.max(0,re.scrollWidth-re.clientWidth),ne=be=>{const De=(be.clientX-fe)/de;re.scrollLeft=Ya(he+De*re.scrollWidth,0,Ce),H()},me=()=>{window.removeEventListener("pointermove",ne),window.removeEventListener("pointerup",me),window.removeEventListener("pointercancel",me),$.current=null};window.addEventListener("pointermove",ne),window.addEventListener("pointerup",me),window.addEventListener("pointercancel",me),$.current=me},we=B=>T=>{T.preventDefault(),T.stopPropagation();const re=N.current;if(!re)return;const de=re.getBoundingClientRect(),fe=Ce=>{const ne=Ya((Ce.clientX-de.left)/(de.width||1),0,1),me=M.current;if(B==="right")te(me.left,ne-me.left);else{const be=me.left+me.width;te(ne,be-ne)}},he=()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he),$.current=null};window.addEventListener("pointermove",fe),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he),$.current=he},U=()=>{R.current=()=>0,k(1)},I=B=>{const T=C.current,re=Ya(O.current*B,L1,Um);if(re!==O.current){if(T){const de=T.clientWidth/2,fe=(T.scrollLeft+de)/(T.scrollWidth||1);R.current=he=>fe*he.scrollWidth-de}k(re)}};return i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{ref:C,className:"no-scrollbar overflow-x-auto overflow-y-hidden",children:i.jsx("div",{className:"space-y-4",style:{width:`${v*100}%`},children:d.map(B=>i.jsxs("div",{className:"space-y-1",children:[!u&&i.jsxs("div",{className:"flex items-center gap-2 pl-[5.5rem]",children:[i.jsx("span",{className:"rounded bg-gray-100 px-1.5 py-0.5 text-[11px] font-medium text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:x.traces.task(B.taskIndex+1)}),i.jsx("span",{className:"font-mono text-[11px] text-gray-400",children:Jt(B.total)})]}),i.jsx(ZR,{label:x.traces.laneLLM,children:B.segs.map((T,re)=>{const de=XR(T.kind),fe=h===null||h===de,he=`s-${B.taskIndex}-${re}`,Ce=L(he);return i.jsx("span",{onMouseEnter:()=>G(he,T.ts),onMouseLeave:W,onClick:()=>o?.(T.ts),title:`${YR(T.kind)}${T.name?` ${T.name}`:""} · ${Jt(T.endMs-T.startMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${WR(T.kind)} ${X(Ce,fe)}`,style:F(T.startMs,T.endMs,B.t0,B.total)},re)})}),B.spans.map(T=>{const re=T.approvalMs??T.callMs,de=T.outputMs===null,fe=T.outputMs??B.t0+B.total,he=T.approvalTsRaw??T.callTs,Ce=T.outputTsRaw??T.callTs;return i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:`${Lh} text-gray-500 dark:text-gray-400`,title:T.name,children:i.jsx("span",{className:wk,children:T.name})}),i.jsxs(Sk,{children:[T.approvalMs!==null&&T.approvalMs>T.callMs&&i.jsx("span",{onMouseEnter:()=>G(`w-${T.toolCallId}`,he),onMouseLeave:W,onClick:()=>o?.(he),title:`${T.name} · ${x.traces.legendApprovalWait}${T.decision?` (${T.decision})`:""} · ${Jt(T.approvalMs-T.callMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${fa.approvalWait} ${X(L(`w-${T.toolCallId}`),h===null||h==="approvalWait")}`,style:F(T.callMs,T.approvalMs,B.t0,B.total)}),T.approvalMs===null&&de?(()=>{const ne=X(L(`p-${T.toolCallId}`),h===null||h==="approvalWait");return i.jsx("span",{onMouseEnter:()=>G(`p-${T.toolCallId}`,T.callTs),onMouseLeave:W,onClick:()=>o?.(T.callTs),title:`${T.name} · ${x.traces.legendApprovalWait} · ${x.traces.inProgress}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${fa.approvalWait} ${ne||"animate-pulse"}`,style:F(T.callMs,fe,B.t0,B.total)})})():(()=>{const ne=X(L(`e-${T.toolCallId}`),h===null||h==="exec"),me=de&&!ne;return i.jsx("span",{onMouseEnter:()=>G(`e-${T.toolCallId}`,Ce),onMouseLeave:W,onClick:()=>o?.(Ce),title:`${T.name} · ${x.traces.legendToolExec} · ${de?x.traces.inProgress:Jt(fe-re)}${T.failed?` · ${T.status}`:""}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${fa.exec} ${T.failed?"ring-1 ring-red-500":""} ${me?"animate-pulse opacity-70":ne}`,style:F(re,fe,B.t0,B.total)})})()]})]},T.toolCallId)}),i.jsx(JR,{total:B.total})]},B.taskIndex))})}),i.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-gray-100 pt-2.5 dark:border-gray-800",children:D.map(B=>i.jsxs("button",{type:"button",onMouseEnter:()=>g(B.key),onMouseLeave:()=>g(null),className:`flex items-center gap-1 px-1 font-mono text-[11px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${h!==null&&h!==B.key?"opacity-30":""}`,children:[i.jsx("span",{className:`inline-block h-2 w-3 rounded-sm ${B.className}`}),B.label]},B.key))}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:x.traces.zoom}),i.jsx("button",{type:"button","aria-label":x.traces.zoomOut,title:x.traces.zoomOut,onClick:()=>I(1/1.4),className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border border-gray-200 text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:i.jsx("span",{className:"text-[11px] leading-none",children:"−"})}),i.jsx("div",{ref:N,onDoubleClick:U,title:x.traces.zoomReset,className:"relative h-3 min-w-0 flex-1 rounded bg-gray-100 dark:bg-gray-800",children:i.jsxs("div",{role:"scrollbar","aria-label":x.traces.zoom,onPointerDown:ee,className:"absolute inset-y-0 flex cursor-grab items-center justify-between rounded bg-gray-400/70 active:cursor-grabbing dark:bg-gray-500/70",style:{left:`${w.left*100}%`,width:`${Math.max(w.width*100,3)}%`},children:[i.jsx("span",{onPointerDown:we("left"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-l bg-gray-500/80 dark:bg-gray-400/80"}),i.jsx("span",{onPointerDown:we("right"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-r bg-gray-500/80 dark:bg-gray-400/80"})]})}),i.jsx("button",{type:"button","aria-label":x.traces.zoomIn,title:x.traces.zoomIn,onClick:()=>I(1.4),className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border border-gray-200 text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:i.jsx("span",{className:"text-[11px] leading-none",children:"+"})}),i.jsxs("span",{className:"w-9 shrink-0 text-right font-mono text-[11px] tabular-nums text-gray-400",children:[v.toFixed(2),"×"]})]}),l&&i.jsx("p",{className:"text-[11px] text-gray-400 dark:text-gray-600",children:x.traces.linkHint})]})}function t7(e){return e==="session_meta"?"brand":e==="model_msg"?"gray":"amber"}const n7={text:"M8 10h8M8 14h5M21 12a9 9 0 1 1-4-7.5",thinking:"M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11v2h6v-2a6 6 0 0 0-3-11z",image_url:"M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",inline_data:"M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",tool_call:"M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",tool_call_output:"M4 6l4 4-4 4M12 18h8",token_usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",request_begin:"M5 12h14M13 6l6 6-6 6",request_end:"M19 12H5M11 6l-6 6 6 6",approval_decision:"M9 12l2 2 4-4M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z",compaction_begin:"M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4M9 12h6",compaction_end:"M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4M9 12h6",abort:"M6 6h12v12H6z",subagent:"M12 3v6m0 0l-5 4v8m5-12l5 4v8M4 21h16"},a7="M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";function r7({type:e}){return i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0 text-gray-400 dark:text-gray-500","aria-hidden":!0,children:i.jsx("path",{d:n7[e]??a7})})}function l7(e){const n=e.payload;switch(n.type){case void 0:return"";case"text":return`${String(n.role)}: ${String(n.text??"").slice(0,120)}`;case"thinking":return String(n.thinking??"").slice(0,120);case"image_url":return"[image]";case"inline_data":return`[image] ${String(n.mime_type??"")}`;case"tool_call":return`${String(n.name)} ${String(n.arguments??"").slice(0,100)}`;case"tool_call_output":{const r=String(n.output??"").slice(0,120);return Array.isArray(n.images)&&n.images.length>0?`[image] ${r}`:r}case"token_usage":{const r=n.request,l=n.session;return`request.total=${r?.total??0} session.total=${l?.total??0}`}case"request_end":return`status=${String(n.status)}`;case"approval_decision":return`${String(n.decision)} · ${String(n.tool_call_id)}`;case"compaction_begin":case"compaction_end":return`${String(n.mode)} (${String(n.reason)})${n.status?` · ${String(n.status)}`:""}`;case"abort":return n.reason!=null?String(n.reason):"";case"subagent":return String(n.session_id??"");default:return e.type==="session_meta"?`${String(n.session_id??"")} · ${String(n.model_id??"")}`:""}}function s7(e){const n=e.payload;return n.stop_reason??n.status}const wc="max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-gray-100 px-2.5 py-2 text-xs dark:bg-gray-800/70";function i7({p:e}){const n=e.request??{},r=e.session??{},l=(o,u)=>i.jsxs("tr",{children:[i.jsx("td",{className:"pr-3 text-gray-400",children:o}),i.jsx("td",{className:"pr-3 text-right font-mono",children:ft(u.cache_read??0)}),i.jsx("td",{className:"pr-3 text-right font-mono",children:ft(u.cache_write??0)}),i.jsx("td",{className:"pr-3 text-right font-mono",children:ft(u.output??0)}),i.jsx("td",{className:"text-right font-mono",children:ft(u.total??0)})]});return i.jsxs("table",{className:"text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-gray-400",children:[i.jsx("th",{}),i.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheRead"}),i.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheWrite"}),i.jsx("th",{className:"pr-3 text-right font-normal",children:"output"}),i.jsx("th",{className:"text-right font-normal",children:"total"})]})}),i.jsxs("tbody",{children:[l("request",n),l("session",r)]})]})}const _1="cursor-pointer text-xs font-medium text-gray-500 marker:text-gray-400 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200";function o7({p:e}){const n=[["session_id",String(e.session_id??"")],["source",String(e.source??"")],["model_id",String(e.model_id??"")],["context_window",String(e.model_context_window??"")],["thinking_level",String(e.thinking_level??"")],["agent_state",String(e.agent_state??"")],["workspace",String(e.workspace??"")]],r=String(e.system_prompt??""),l=Array.isArray(e.tools)?e.tools:[];return i.jsxs("div",{className:"space-y-2.5",children:[i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs",children:n.map(([o,u])=>i.jsxs(b.Fragment,{children:[i.jsx("dt",{className:"text-gray-400",children:o}),i.jsx("dd",{className:"min-w-0 break-all font-mono text-gray-700 dark:text-gray-300",children:u||"—"})]},o))}),r.trim()&&i.jsxs("details",{children:[i.jsx("summary",{className:_1,children:x.traces.systemPrompt}),i.jsx("div",{className:"md-body mt-1.5 max-h-96 overflow-auto rounded bg-gray-100 px-2.5 py-2 text-sm leading-relaxed text-gray-700 dark:bg-gray-800/70 dark:text-gray-300",children:i.jsx(tu,{remarkPlugins:[nu],children:r})})]}),l.length>0&&i.jsxs("details",{children:[i.jsx("summary",{className:_1,children:x.traces.toolDefs(l.length)}),i.jsx("ul",{className:"mt-1.5 space-y-1",children:l.map((o,u)=>i.jsxs("li",{className:"text-xs",children:[i.jsx("span",{className:"font-mono font-semibold text-gray-700 dark:text-gray-300",children:o.name??"—"}),o.description&&i.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:o.description})]},u))})]})]})}function c7({msg:e}){const n=e.payload;if(e.type==="session_meta")return i.jsx(o7,{p:n});switch(n.type){case"text":case"thinking":{const r=String(n.text??n.thinking??"");return r.trim()?i.jsx("div",{className:"md-body text-sm leading-relaxed text-gray-700 dark:text-gray-300",children:i.jsx(tu,{remarkPlugins:[nu],children:r})}):i.jsx("p",{className:"text-xs text-gray-400",children:"—"})}case"image_url":return i.jsx(hl,{src:String(n.image_url??""),alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"inline_data":return i.jsx(hl,{src:`data:${String(n.mime_type??"")};base64,${String(n.data??"")}`,alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"tool_call":return i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:String(n.name??"")}),i.jsx("pre",{className:wc,children:String(n.arguments??"")})]});case"tool_call_output":{const r=Array.isArray(n.images)?n.images:[];return r.length===0?i.jsx("pre",{className:wc,children:String(n.output??"")}):i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("pre",{className:wc,children:String(n.output??"")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((l,o)=>i.jsx(hl,{src:l,alt:"trace",className:"max-h-48 max-w-full rounded-md"},o))})]})}case"token_usage":return i.jsx(i7,{p:n});default:return i.jsx("pre",{className:wc,children:JSON.stringify(n,null,2)})}}function u7({msg:e,rowKey:n,matched:r,onHighlight:l}){const[o,u]=b.useState(!1),d=e.payload.type??e.type,f=s7(e);return i.jsxs("li",{"data-trace-row":n,children:[i.jsxs("button",{type:"button",onClick:()=>u(m=>!m),onMouseEnter:()=>l?.({ts:e.timestamp,rowKey:n}),onMouseLeave:()=>l?.(null),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 ${r?"bg-amber-50 dark:bg-amber-950/40":"hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,children:[i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:Y5(e.timestamp)}),i.jsx(r7,{type:d}),i.jsx(Rt,{tone:t7(e.type),children:d}),e.origin&&e.origin.length>0&&i.jsx(Rt,{tone:"brand",children:"origin"}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:l7(e)})]}),o&&i.jsxs("div",{className:"border-t border-gray-100 bg-gray-50/60 px-3 py-2 dark:border-gray-800 dark:bg-gray-900/40",children:[i.jsx(c7,{msg:e}),f&&i.jsx("div",{className:"mt-1.5 flex justify-end",children:i.jsx(Rt,{tone:fm(f),children:f})})]})]})}const I1=()=>({cacheRead:0,cacheWrite:0,output:0}),d7=2500,z1=(e,n)=>`${e}-${n}`;function Xa({label:e,value:n}){return i.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-0.5",children:[i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:e}),i.jsx("span",{className:"truncate font-mono text-sm font-semibold tabular-nums",children:n})]})}const jk=e=>e.cacheRead+e.cacheWrite,Nk=e=>Lv(e.cacheRead,e.cacheWrite),Ck="flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";function vi({icon:e,value:n,label:r}){return i.jsxs("span",{title:r,"aria-label":r,className:`${Ck} gap-1`,children:[i.jsx(We,{d:e,className:"text-gray-400"}),n]})}function f7({buckets:e}){const n=jk(e),r=`${x.traces.cacheHit} ${ft(e.cacheRead)} · ${x.traces.hitRate} ${eh(Nk(e))}`;return i.jsxs("span",{"aria-label":`${x.traces.taskInput} ${ft(n)} · ${r}`,className:Ck,children:[i.jsxs("span",{title:x.traces.taskInput,className:"flex items-center gap-1",children:[i.jsx(We,{d:Gt.input,className:"text-gray-400"}),ft(n)]}),i.jsxs("span",{title:r,className:"ml-1 flex items-center gap-0.5 text-gray-400",children:[i.jsx("span",{children:"("}),i.jsx(We,{d:Gt.cacheHit}),i.jsx("span",{children:ft(e.cacheRead)}),i.jsx("span",{children:")"})]})]})}function m7({projectId:e,agentId:n,sessionId:r,index:l,highlight:o,onHighlight:u}){const{currency:d}=xl(),[f,m]=b.useState(null),[h,g]=b.useState([]),[v,k]=b.useState(0),[w,j]=b.useState(0),[C,N]=b.useState(null),[M,O]=b.useState(null),[R,$]=b.useState(new Set),[H,_]=b.useState(null),V=b.useRef(null),G=b.useRef(null);b.useEffect(()=>()=>{G.current&&clearTimeout(G.current)},[]),b.useEffect(()=>{m(null),g([]),O(null),$(new Set),_(null);let I=!1;return Promise.all([zS(e,n,r,l),IS(e,n,r,l,0,1e3),Fc(e).catch(()=>null)]).then(([B,T,re])=>{I||(m(B),g(T.events),k(T.offset),j(T.total),N(re))}).catch(B=>{I||O(B instanceof He?B.message:x.common.unknownError)}),()=>{I=!0}},[e,n,r,l]);const W=b.useMemo(()=>{const I=h.find(T=>T.type==="session_meta"),B=I?I.payload:void 0;if(!(!B?.model_id||!B.provider))return C?.models.find(T=>T.modelId===B.model_id&&T.provider===B.provider)?.pricing},[h,C]),z=I=>W?(I.cacheRead*W.cacheRead+I.cacheWrite*W.cacheWrite+I.output*W.output)/1e6:null,q=b.useMemo(()=>{const I=h.find(B=>B.type==="session_meta");return ek(I?I.payload.model_context_window:void 0)},[h]),{tasks:A,global:L,statsByTask:X,globalLlmMs:F}=b.useMemo(()=>{const I={buckets:I1(),toolCalls:0},B=new Map;if(!f)return{tasks:[],global:I,statsByTask:B,globalLlmMs:0};const T=new Map;for(const me of f.tasks){const be=Date.parse(me.startTs),De=Date.parse(me.endTs);Number.isFinite(be)&&Number.isFinite(De)&&T.set(me.taskIndex,{min:be,max:De})}const re=new Map,de=me=>{let be=re.get(me);if(!be){const De=T.get(me);be={taskIndex:me,segments:[],spans:[],messages:[],toolCalls:0,durationMs:De?Math.max(0,De.max-De.min):0},re.set(me,be)}return be};for(const me of f.tasks)de(me.taskIndex);for(const me of f.modelSegments)de(me.taskIndex).segments.push(me);for(const me of f.toolSpans){const be=de(me.taskIndex);be.spans.push(me),be.toolCalls+=1}const fe=me=>{for(const be of f.tasks)if(me>=be.messageFrom&&me<=be.messageTo)return be.taskIndex;return null};for(let me=0;me<h.length;me++){const be=h[me];if(be.origin&&be.origin.length>0)continue;const De=fe(v+me);De!==null&&de(De).messages.push(be)}I.toolCalls=f.toolSpans.length;const he=new Map(f.tasks.map(me=>[me.taskIndex,me]));for(const me of f.tasks)I.buckets.cacheRead+=me.tokens.cacheRead,I.buckets.cacheWrite+=me.tokens.cacheWrite,I.buckets.output+=me.tokens.output;const Ce=f.tasks.reduce((me,be)=>me+be.llmMs,0);return{tasks:[...re.values()].sort((me,be)=>me.taskIndex-be.taskIndex),global:I,statsByTask:he,globalLlmMs:Ce}},[f,h,v]);if(M)return i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:M});if(!f)return i.jsx(At,{className:"h-40"});const D=f.elapsedMs,te=I=>$(B=>{const T=new Set(B);return T.has(I)?T.delete(I):T.add(I),T}),ee=I=>{for(const B of A){const T=B.messages.findIndex(re=>re.timestamp===I);if(T>=0)return z1(B.taskIndex,T)}return null},we=o?.rowKey??(o?.ts!==void 0?ee(o.ts):null),U=I=>{const B=ee(I);B!==null&&(_(B),requestAnimationFrame(()=>{V.current?.querySelector(`[data-trace-row="${B}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})}),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>_(null),d7))};return i.jsxs("div",{ref:V,className:"space-y-4",children:[i.jsxs("div",{className:"rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[i.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:x.traces.globalSummary}),i.jsxs("div",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-3",children:[i.jsxs("div",{children:[i.jsx(Xa,{label:x.traces.tasksLabel,value:String(f.tasks.length)}),i.jsx(Xa,{label:x.traces.toolCalls,value:String(L.toolCalls)}),i.jsx(Xa,{label:x.traces.compactions,value:String(f.compactionCount)})]}),i.jsxs("div",{children:[i.jsx(Xa,{label:x.chat.statInput,value:ft(jk(L.buckets))}),i.jsx(Xa,{label:x.traces.cacheHit,value:`${ft(L.buckets.cacheRead)} · ${eh(Nk(L.buckets))}`}),i.jsx(Xa,{label:x.chat.statOutput,value:ft(L.buckets.output)})]}),i.jsxs("div",{children:[i.jsx(Xa,{label:x.chat.statCost,value:la(z(L.buckets),d)}),i.jsx(Xa,{label:x.chat.statElapsed,value:Jt(Math.max(0,D))}),i.jsx(Xa,{label:x.chat.statTps,value:Rc(mm(L.buckets.output,F))})]})]})]}),A.map(I=>{const B=!R.has(I.taskIndex),T=X.get(I.taskIndex),re=T?.context,de=T?.tokens??I1();return i.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[i.jsxs("button",{type:"button",onClick:()=>te(I.taskIndex),"aria-expanded":B,className:"flex w-full items-center gap-2 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-800/60",children:[i.jsx(ln,{open:B,size:13,className:"text-gray-400"}),i.jsx("span",{className:"shrink-0 text-sm font-semibold",children:x.traces.task(I.taskIndex+1)}),T?.compaction===!0&&i.jsx("span",{className:"shrink-0 rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-medium text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:x.traces.compactionRound}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[i.jsx(vi,{icon:Gt.toolCalls,value:String(I.toolCalls),label:x.traces.toolCalls}),i.jsx(f7,{buckets:de}),i.jsx(vi,{icon:Gt.output,value:ft(de.output),label:x.traces.taskOutput}),i.jsx(vi,{icon:Gt.cost,value:la(z(de),d),label:`${x.chat.statCost}(${d})`}),i.jsx(vi,{icon:Gt.elapsed,value:Jt(I.durationMs),label:x.chat.statElapsed}),i.jsx(vi,{icon:Gt.tps,value:Rc(mm(de.output,T?.llmMs??0)),label:x.chat.statTps})]}),re&&i.jsx(GR,{cacheRead:re.cacheRead,cacheWrite:re.cacheWrite,output:re.output,max:q,size:22})]}),B&&i.jsxs("div",{className:"space-y-3 p-3",children:[(I.segments.length>0||I.spans.length>0)&&i.jsxs("div",{className:"rounded-md border border-gray-100 p-2 dark:border-gray-800/60",children:[i.jsx("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:x.traces.timeline}),i.jsx(e7,{segments:I.segments,toolSpans:I.spans,highlight:o,onHighlight:u,onJump:U,hideTaskLabel:!0})]}),i.jsxs("div",{children:[i.jsxs("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:[x.traces.messages,"(",I.messages.length,")"]}),I.messages.length===0?i.jsx("p",{className:"text-xs text-gray-400",children:x.common.none}):i.jsx("ul",{className:"divide-y divide-gray-100 rounded-md border border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:I.messages.map((fe,he)=>{const Ce=z1(I.taskIndex,he);return i.jsx(u7,{msg:fe,rowKey:Ce,matched:Ce===we||Ce===H,onHighlight:ne=>u(ne)},he)})})]})]})]},I.taskIndex)}),h.length<w&&i.jsx("p",{className:"text-xs text-gray-400",children:x.traces.truncatedNote(h.length,w)})]})}function h7(e){const n=new Map;for(const r of e.dates)for(const l of r.sessions){const o=n.get(l.sessionId)??[];for(const u of l.files)o.push({index:u.index,date:r.date,sizeBytes:u.sizeBytes});n.set(l.sessionId,o)}return[...n.entries()].sort((r,l)=>l[0].localeCompare(r[0])).map(([r,l])=>({sessionId:r,files:l.sort((o,u)=>u.index-o.index)}))}function p7({projectId:e,agentId:n,name:r,defaultOpen:l,focusSessionId:o,titleOf:u,selection:d,onSelect:f}){const[m,h]=b.useState(l),[g,v]=b.useState(null),[k,w]=b.useState(null);b.useEffect(()=>{!m||g||ES(e,n).then(C=>v(h7(C))).catch(C=>w(C instanceof He?C.message:x.common.unknownError))},[m,g,e,n]);const j=b.useRef(!1);return b.useEffect(()=>{if(j.current||!o||!g)return;j.current=!0;const C=g.find(N=>N.sessionId===o);C&&f({agentId:n,sessionId:C.sessionId,files:C.files})},[g,o,n,f]),i.jsxs("li",{className:"pt-2.5",children:[i.jsx("div",{className:"flex items-center px-1 pb-0.5",children:i.jsxs("button",{type:"button",onClick:()=>h(C=>!C),"aria-label":m?x.nav.collapseGroup:x.nav.expandGroup,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[i.jsx(zr,{id:n,name:r,size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),i.jsx(ln,{open:m,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]})}),m&&i.jsxs("div",{className:"anim-fade",children:[k&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:k}),!g&&!k&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:x.common.loading}),g&&g.length===0&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.traces.empty}),i.jsx("ul",{className:"space-y-0.5",children:g?.map(C=>{const N=d?.agentId===n&&d.sessionId===C.sessionId,M=u(n,C.sessionId);return i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>f({agentId:n,sessionId:C.sessionId,files:C.files}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${N?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[i.jsx(Yc,{text:M??C.sessionId,className:`min-w-0 flex-1 ${M?"text-sm":"font-mono text-xs"} ${N?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:C.files.length})]})},C.sessionId)})})]})]})}function g7(){Ta(x.traces.title);const{currentProject:e,agents:n,agentsLoading:r}=sn(),{byAgent:l}=Ui(),o=e?.projectId??null,[u]=Zm(),d=u.get("agentId"),f=u.get("sessionId"),[m,h]=b.useState(null),[g,v]=b.useState(null),[k,w]=b.useState(null);b.useEffect(()=>{h(null),v(null)},[o]),b.useEffect(()=>{w(null)},[m,g]);const j=(N,M)=>l.get(N)?.find(O=>O.sessionId===M)?.title;if(!o)return null;const C=m===null?null:m.files.find(N=>N.index===g)??m.files[0]??null;return i.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[i.jsxs("aside",{className:"max-h-52 shrink-0 overflow-y-auto border-b border-gray-200 bg-gray-50 px-1 py-2 md:max-h-none md:w-72 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:x.traces.title}),r?i.jsx(Dr,{rows:4}):i.jsx("ul",{children:n.map(N=>i.jsx(p7,{projectId:o,agentId:N.agentId,name:jn(N),defaultOpen:d===null||d===N.agentId,...f!==null&&d===N.agentId?{focusSessionId:f}:{},titleOf:j,selection:m,onSelect:M=>{h(M),v(M.files[0]?.index??null)}},N.agentId))})]}),i.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:m&&C?i.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("p",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:j(m.agentId,m.sessionId)??i.jsx("span",{className:"font-mono text-xs font-normal text-gray-500",children:m.sessionId})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[i.jsx("span",{className:"mr-1 text-xs text-gray-400",children:x.traces.filesTitle}),m.files.map(N=>i.jsxs("button",{type:"button",onClick:()=>v(N.index),title:`${N.date} · ${hm(N.sizeBytes)}`,className:`rounded-md border px-2 py-0.5 font-mono text-xs transition-colors duration-150 ${N.index===C.index?"border-gray-400 bg-gray-200/70 font-semibold text-gray-900 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100":"border-gray-200 text-gray-500 hover:bg-gray-100 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800/60"}`,children:["#",String(N.index).padStart(3,"0")]},N.index))]})]}),i.jsxs("p",{className:"truncate font-mono text-xs text-gray-400",children:[m.sessionId," · ",C.date," · ",hm(C.sizeBytes)]}),i.jsx(m7,{projectId:o,agentId:m.agentId,sessionId:m.sessionId,index:C.index,highlight:k,onHighlight:w})]}):i.jsx(Or,{title:x.traces.selectSession})})]})}function Tk(e,n){return e.map(r=>{const l=n==="score"?r.score:n==="cost"?r.cost:r.durationMs;return typeof l=="number"&&Number.isFinite(l)?l:null})}function x7(e){const n=[];let r=[];return e.forEach((l,o)=>{if(l===null){r.length>0&&n.push(r),r=[];return}r.push({index:o,value:l})}),r.length>0&&n.push(r),n}function y7(e){return Math.max(1e-9,...e.filter(n=>n!==null))}function v7(e){const n=new Map;e.forEach((l,o)=>{const u=l.modelId!==void 0&&l.modelId!=="",d=u?`${l.provider??""}\0${l.modelId}`:"";let f=n.get(d);f||(f={key:d,...u&&l.provider!==void 0?{provider:l.provider}:{},...u&&l.modelId!==void 0?{modelId:l.modelId}:{},indices:[]},n.set(d,f)),f.indices.push(o)});const r=[...n.values()];return[...r.filter(l=>l.key!==""),...r.filter(l=>l.key==="")]}function b7(e,n,r){const l=new Set(n.indices);return Tk(e,r).map((o,u)=>l.has(u)?o:null)}function k7({projectId:e,agentId:n,name:r,defaultOpen:l,selection:o,onSelect:u}){const[d,f]=b.useState(l),[m,h]=b.useState(null),[g,v]=b.useState(null);return b.useEffect(()=>{!d||m||GS(e,n).then(k=>h(k.benchmarks)).catch(k=>v(k instanceof He?k.message:x.common.unknownError))},[d,m,e,n]),i.jsxs("li",{className:"pt-2.5",children:[i.jsx("div",{className:"flex items-center px-1 pb-0.5",children:i.jsxs("button",{type:"button",onClick:()=>f(k=>!k),"aria-label":d?x.nav.collapseGroup:x.nav.expandGroup,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[i.jsx(zr,{id:n,name:r,size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),i.jsx(ln,{open:d,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]})}),d&&i.jsxs("div",{className:"anim-fade",children:[g&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:g}),!m&&!g&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:x.common.loading}),m&&m.length===0&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.benchmark.emptyAgent}),i.jsx("ul",{className:"space-y-0.5",children:m?.map(k=>{const w=o?.agentId===n&&o.benchmark.id===k.id;return i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>u({agentId:n,benchmark:k}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${w?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[i.jsx(Yc,{text:k.title,className:`min-w-0 flex-1 text-sm ${w?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:k.caseCount})]})},k.id)})})]})]})}function Sc(e){return e==="score"?x.benchmark.colScore:e==="cost"?x.benchmark.colCost:x.benchmark.colDuration}function D1(e,n){return e==="score"?Lc(n):e==="cost"?la(n):Jt(n)}function w7({evaluations:e,series:n,metric:r}){const[l,o]=b.useState(null),[u,d]=Ah(),f=Tk(e,r),m=Mh(e.length,y7(f),d),h=e.map(v=>$n(v.time)),g=m.y(0);return i.jsx("div",{ref:u,children:d>0&&i.jsx(Rh,{geom:m,fmtY:v=>D1(r,v),dates:h,hover:l,onHover:o,bubble:v=>{const k=e[v],w=f[v]??null;return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-gray-400",children:$n(k.time)}),i.jsxs("p",{className:"font-mono",children:[w===null?"—":D1(r,w),k.version!==void 0&&i.jsxs("span",{className:"ml-1.5 text-gray-400",children:["v",k.version]})]}),k.modelId&&i.jsx("p",{className:"font-mono text-gray-400",children:k.modelId})]})},children:n.map((v,k)=>{const w=x7(b7(e,v,r));return i.jsx("g",{className:v.modelId?bk(k).text:"text-gray-400 dark:text-gray-500",children:w.map((j,C)=>{const N=j.map((O,R)=>`${R===0?"M":"L"}${m.x(O.index)},${m.y(O.value)}`).join(" "),M=`${N} L${m.x(j[j.length-1].index)},${g} L${m.x(j[0].index)},${g} Z`;return i.jsxs("g",{children:[j.length>1&&i.jsx("path",{d:M,className:"fill-current",stroke:"none",opacity:l!==null?.06:.1}),j.length>1&&i.jsx("path",{d:N,fill:"none",stroke:"currentColor",strokeWidth:2,opacity:l!==null?.35:1}),j.map(O=>i.jsx("circle",{cx:m.x(O.index),cy:m.y(O.value),r:l===O.index?4:2.5,className:"fill-current",opacity:l!==null&&l!==O.index?.25:1},O.index))]},C)})},v.key===""?"unlabeled":v.key)})})})}function S7({evaluations:e}){const[n,r]=b.useState("score"),l=v7(e),o=l.map(f=>f.modelId).filter(f=>f!==void 0),u=new Set(o.filter((f,m)=>o.indexOf(f)!==m)),d=f=>{if(!f.modelId)return x.benchmark.legendUnlabeled;if(!u.has(f.modelId))return f.modelId;const m=f.provider?aa(f.provider)?.label??f.provider:"";return m?`${f.modelId} · ${m}`:f.modelId};return i.jsxs("div",{children:[i.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[i.jsx("p",{className:"text-xs font-semibold text-gray-500",children:x.benchmark.trendTitle(Sc(n))}),i.jsx("div",{className:"w-44 shrink-0",children:i.jsx(dl,{options:[{value:"score",label:Sc("score")},{value:"cost",label:Sc("cost")},{value:"duration",label:Sc("duration")}],value:n,onChange:r})})]}),l.length>=2&&i.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1",children:l.map((f,m)=>i.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400",title:f.provider?aa(f.provider)?.label??f.provider:void 0,children:[i.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${f.modelId?bk(m).swatch:"bg-gray-400 dark:bg-gray-500"}`}),i.jsx("span",{className:"font-mono",children:d(f)})]},f.key===""?"unlabeled":f.key))}),i.jsx(w7,{evaluations:e,series:l,metric:n})]})}const as="px-3 py-2";function j7({agentId:e,evaluation:n}){const[r,l]=b.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{onClick:()=>l(o=>!o),className:"cursor-pointer border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[i.jsx("td",{className:as,children:i.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[i.jsx(ln,{open:r,size:12,className:"text-gray-400"}),$n(n.time)]})}),i.jsx("td",{className:`${as} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.version!==void 0?`v${n.version}`:"—"}),i.jsx("td",{className:`${as} max-w-40 truncate font-mono text-xs text-gray-500 dark:text-gray-400`,title:n.provider,children:n.modelId??"—"}),i.jsx("td",{className:`${as} font-mono text-xs font-semibold tabular-nums`,children:Lc(n.score)}),i.jsx("td",{className:`${as} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:la(n.cost)}),i.jsx("td",{className:`${as} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:n.durationMs!==void 0?Jt(n.durationMs):"—"})]}),r&&i.jsx("tr",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800/60",children:i.jsxs("td",{colSpan:6,className:"bg-gray-50/80 px-3 py-2 dark:bg-gray-950/40",children:[(n.summaryTitle||n.summary)&&i.jsxs("div",{className:"mb-2",children:[n.summaryTitle?i.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:n.summaryTitle}):i.jsx("p",{className:"text-xs font-semibold text-gray-500",children:x.benchmark.summaryLabel}),n.summary&&i.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-xs text-gray-600 dark:text-gray-300",children:n.summary})]}),i.jsxs("table",{className:"w-full text-left",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-xs text-gray-500",children:[i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colCase}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colScore}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colCost}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colDuration}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colSession})]})}),i.jsx("tbody",{children:n.cases.map(o=>i.jsx(N7,{agentId:e,caseScore:o},o.case))})]})]})})]})}function O1({agentId:e,sessionId:n}){return n?i.jsx(Xm,{to:`/traces?agentId=${encodeURIComponent(e)}&sessionId=${encodeURIComponent(n)}`,className:"font-mono text-gray-600 underline decoration-gray-300 underline-offset-2 hover:text-gray-900 dark:text-gray-300 dark:decoration-gray-600 dark:hover:text-gray-100",title:n,children:n}):i.jsx("span",{className:"text-gray-400",children:"—"})}function N7({agentId:e,caseScore:n}){const[r,l]=b.useState(!1),o=n.runs??[],u=o.length>0;return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{onClick:u?()=>l(d=>!d):void 0,className:`text-xs ${u?"cursor-pointer transition-colors duration-150 hover:bg-gray-100/70 dark:hover:bg-gray-800/40":""}`,children:[i.jsx("td",{className:"px-2 py-1 font-mono",children:i.jsxs("span",{className:"flex items-center gap-1.5",children:[u&&i.jsx(ln,{open:r,size:12,className:"text-gray-400"}),n.case]})}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Lc(n.score)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:la(n.cost)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:n.durationMs!==void 0?Jt(n.durationMs):"—"}),i.jsx("td",{className:"px-2 py-1",children:i.jsx(O1,{agentId:e,...n.sessionId?{sessionId:n.sessionId}:{}})})]}),r&&o.map((d,f)=>i.jsxs("tr",{className:"text-xs text-gray-500 dark:text-gray-400",children:[i.jsxs("td",{className:"py-1 pl-7 pr-2 font-mono",children:[x.benchmark.colRun," #",f+1]}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Lc(d.score)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:la(d.cost)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:d.durationMs!==void 0?Jt(d.durationMs):"—"}),i.jsx("td",{className:"px-2 py-1",children:i.jsx(O1,{agentId:e,...d.sessionId?{sessionId:d.sessionId}:{}})})]},f))]})}function C7(){Ta(x.benchmark.title);const{currentProject:e,agents:n,agentsLoading:r}=sn(),l=e?.projectId??null,[o]=Zm(),u=o.get("agentId"),[d,f]=b.useState(null);if(b.useEffect(()=>{f(null)},[l]),!l)return null;const m=d?.benchmark??null,h=m?[...m.evaluations].sort((g,v)=>g.time.localeCompare(v.time)):[];return i.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[i.jsxs("aside",{className:"max-h-52 shrink-0 overflow-y-auto border-b border-gray-200 bg-gray-50 px-1 py-2 md:max-h-none md:w-72 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:x.benchmark.title}),r?i.jsx(Dr,{rows:4}):i.jsx("ul",{children:n.map(g=>i.jsx(k7,{projectId:l,agentId:g.agentId,name:jn(g),defaultOpen:u===null||u===g.agentId,selection:d,onSelect:f},g.agentId))})]}),i.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:d&&m?i.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[i.jsx("h1",{className:"min-w-0 truncate text-lg font-semibold",children:m.title}),i.jsx("span",{className:"text-xs text-gray-500",children:x.benchmark.caseCount(m.caseCount)})]}),m.description&&i.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:m.description})]}),h.length===0?i.jsx(Or,{title:x.benchmark.noEvaluations}):i.jsxs(i.Fragment,{children:[i.jsx(S7,{evaluations:h}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:x.benchmark.evaluations}),i.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:i.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colTime}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colVersion}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colModel}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colScore}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colCost}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colDuration})]})}),i.jsx("tbody",{children:[...h].reverse().map((g,v)=>i.jsx(j7,{agentId:d.agentId,evaluation:g},v))})]})})]})]})]},`${d.agentId}/${m.id}`):i.jsx(Or,{title:x.benchmark.selectBenchmark})})]})}function T7(){Ta(x.admin.users);const{user:e}=Nn(),[n,r]=b.useState(null),[l,o]=b.useState(null),[u,d]=b.useState(!1),[f,m]=b.useState(null),[h,g]=b.useState(null),v=b.useCallback(async()=>{try{r((await hS()).users),o(null)}catch(k){o(k instanceof He?k.message:x.common.unknownError)}},[]);return b.useEffect(()=>{e?.isAdmin&&v()},[e?.isAdmin,v]),e&&!e.isAdmin?i.jsx(Ai,{to:"/chat",replace:!0}):i.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[i.jsxs("div",{className:"mx-auto max-w-3xl",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.admin.users}),i.jsx(ye,{variant:"primary",onClick:()=>d(!0),children:x.admin.createUser})]}),n===null?i.jsx("p",{className:"text-sm text-gray-400",children:x.common.loading}):i.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50 text-left text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900/60 dark:text-gray-400",children:[i.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.admin.userId}),i.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.admin.role}),i.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.admin.createdAt}),i.jsx("th",{className:"whitespace-nowrap px-3 py-2 text-right font-medium",children:x.admin.actions})]})}),i.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:n.map(k=>i.jsxs("tr",{children:[i.jsxs("td",{className:"whitespace-nowrap px-3 py-2 font-medium",children:[k.userId,k.passwordIsInitial&&i.jsx("span",{className:"ml-2 align-middle",children:i.jsx(Rt,{tone:"gray",children:x.admin.initialPasswordFlag})})]}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:i.jsx(Rt,{tone:"gray",children:k.isAdmin?x.admin.roleAdmin:x.admin.roleUser})}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-gray-500 dark:text-gray-400",children:$n(k.createdAt)}),i.jsxs("td",{className:"whitespace-nowrap px-3 py-1.5 text-right",children:[i.jsx(ye,{size:"sm",variant:"ghost",onClick:()=>m(k),children:x.admin.resetPassword}),!k.isAdmin&&i.jsx(ye,{size:"sm",variant:"ghost",onClick:()=>g(k),children:x.admin.deleteUser})]})]},k.userId))})]})}),l&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]}),i.jsx(E7,{open:u,onClose:()=>d(!1),onDone:()=>{d(!1),v()}}),i.jsx(M7,{user:f,onClose:()=>m(null)}),i.jsx(A7,{user:h,onClose:()=>g(null),onDone:()=>{g(null),v()}})]})}function E7({open:e,onClose:n,onDone:r}){const[l,o]=b.useState(""),[u,d]=b.useState(""),[f,m]=b.useState(null),[h,g]=b.useState(!1);b.useEffect(()=>{e&&(o(""),d(""),m(null))},[e]);const v=async()=>{const k=l.trim();if(!k||!u){m(x.common.requiredField);return}if(!c1.test(k)){m(x.auth.usernameHint);return}g(!0),m(null);try{await pS({userId:k,password:u}),r()}catch(w){m(w instanceof He?w.message:x.common.unknownError)}finally{g(!1)}};return i.jsx(Dt,{open:e,title:x.admin.createUser,onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:n,disabled:h,children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:h,onClick:()=>{v()},children:x.common.create})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Je,{label:x.admin.userId,size:"sm",value:l,onChange:k=>o(k.target.value),hint:x.auth.usernameHint,autoFocus:!0}),i.jsx(Ir,{label:x.admin.initialPassword,size:"sm",value:u,onChange:k=>d(k.target.value),autoComplete:"new-password",hint:x.auth.passwordHint}),c1.test(l.trim())&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.admin.defaultProjectNote(`${l.trim()}-default_project`)}),f&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:f})]})})}function M7({user:e,onClose:n}){const[r,l]=b.useState(""),[o,u]=b.useState(null),[d,f]=b.useState(!1);b.useEffect(()=>{e&&(l(""),u(null))},[e]);const m=async()=>{if(e){if(!r){u(x.common.requiredField);return}f(!0),u(null);try{await gS(e.userId,{password:r}),n()}catch(h){u(h instanceof He?h.message:x.common.unknownError)}finally{f(!1)}}};return i.jsx(Dt,{open:e!==null,title:e?x.admin.resetPasswordTitle(e.userId):"",onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:n,disabled:d,children:x.common.cancel}),i.jsx(ye,{variant:"primary",disabled:d,onClick:()=>{m()},children:x.common.save})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Ir,{label:x.admin.initialPassword,size:"sm",value:r,onChange:h=>l(h.target.value),autoComplete:"new-password",hint:x.auth.passwordHint,autoFocus:!0}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.admin.resetPasswordNote}),o&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:o})]})})}function A7({user:e,onClose:n,onDone:r}){const[l,o]=b.useState(!1),[u,d]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(o(!1),d(null))},[e]);const h=async()=>{if(e){m(!0),d(null);try{await xS(e.userId),r()}catch(g){d(g instanceof He?g.message:x.common.unknownError)}finally{m(!1)}}};return i.jsx(Dt,{open:e!==null,title:e?x.admin.deleteUserTitle(e.userId):"",onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ye,{onClick:n,disabled:f,children:x.common.cancel}),l?i.jsx(ye,{variant:"danger",disabled:f,onClick:()=>{h()},children:x.common.confirm}):i.jsx(ye,{variant:"danger",onClick:()=>o(!0),children:x.common.delete})]}),children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:e?x.admin.deleteUserConfirm(e.userId):""}),u&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:u})]})})}function R7(){const{user:e}=Nn();return e===void 0?null:e===null?i.jsx(Ai,{to:"/login",replace:!0}):i.jsx(A5,{children:i.jsx(U5,{children:i.jsx(u8,{})})})}function L7(){const{user:e}=Nn();return e?i.jsx(Ai,{to:"/chat",replace:!0}):i.jsx(v8,{})}function _7(){return i.jsx(k5,{children:i.jsxs(Xj,{children:[i.jsx(wn,{path:"/login",element:i.jsx(L7,{})}),i.jsxs(wn,{element:i.jsx(R7,{}),children:[i.jsx(wn,{index:!0,element:i.jsx(Ai,{to:"/chat",replace:!0})}),i.jsx(wn,{path:"/chat/:sessionId?",element:i.jsx(VA,{})}),i.jsx(wn,{path:"/agents",element:i.jsx(w8,{})}),i.jsx(wn,{path:"/agents/:agentId",element:i.jsx(U8,{})}),i.jsx(wn,{path:"/skills",element:i.jsx(K8,{})}),i.jsx(wn,{path:"/models",element:i.jsx(dR,{})}),i.jsx(wn,{path:"/usage",element:i.jsx(VR,{})}),i.jsx(wn,{path:"/traces",element:i.jsx(g7,{})}),i.jsx(wn,{path:"/benchmark",element:i.jsx(C7,{})}),i.jsx(wn,{path:"/admin/users",element:i.jsx(T7,{})}),i.jsx(wn,{path:"*",element:i.jsx(Ai,{to:"/chat",replace:!0})})]})]})})}function I7(){return i.jsx(Jw,{children:i.jsx(iS,{children:i.jsx(YS,{children:i.jsxs(eS,{children:[i.jsx(_7,{}),i.jsx(N4,{})]})})})})}const Ek=document.getElementById("root");if(!Ek)throw new Error("#root mount point not found");Gw.createRoot(Ek).render(i.jsx(b.StrictMode,{children:i.jsx(I7,{})}));export{t6 as _,A4 as a,G4 as b,zy as c,P4 as f,V4 as h,sh as s,z4 as w};
|