@prismshadow/penguin-server 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/types.d.ts +107 -20
- package/dist/index.js +914 -267
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/web-dist/assets/index-BOvgZOwz.js +173 -0
- package/web-dist/assets/{index-7gbWDtby.js → index-BgHHHLga.js} +1 -1
- package/web-dist/assets/index-DGdg-i_E.css +1 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-Bnva9EYm.js +0 -102
- package/web-dist/assets/index-DMcMNwnl.css +0 -1
|
@@ -1,102 +0,0 @@
|
|
|
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"]'))s(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function Ob(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var am={exports:{}},zi={};var py;function VS(){if(py)return zi;py=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(s,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:s,key:d,ref:o!==void 0?o:null,props:c}}return zi.Fragment=n,zi.jsx=r,zi.jsxs=r,zi}var gy;function GS(){return gy||(gy=1,am.exports=VS()),am.exports}var l=GS(),rm={exports:{}},qe={};var xy;function WS(){if(xy)return qe;xy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=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"),y=Symbol.for("react.activity"),k=Symbol.iterator;function w(T){return T===null||typeof T!="object"?null:(T=k&&T[k]||T["@@iterator"],typeof T=="function"?T:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,M={};function A(T,U,j){this.props=T,this.context=U,this.refs=M,this.updater=j||N}A.prototype.isReactComponent={},A.prototype.setState=function(T,U){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,U,"setState")},A.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function R(){}R.prototype=A.prototype;function I(T,U,j){this.props=T,this.context=U,this.refs=M,this.updater=j||N}var P=I.prototype=new R;P.constructor=I,C(P,A.prototype),P.isPureReactComponent=!0;var D=Array.isArray;function L(){}var $={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function W(T,U,j){var K=j.ref;return{$$typeof:e,type:T,key:U,ref:K!==void 0?K:null,props:j}}function B(T,U){return W(T.type,U,T.props)}function V(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function q(T){var U={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(j){return U[j]})}var X=/\/+/g;function te(T,U){return typeof T=="object"&&T!==null&&T.key!=null?q(""+T.key):U.toString(36)}function O(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(L,L):(T.status="pending",T.then(function(U){T.status==="pending"&&(T.status="fulfilled",T.value=U)},function(U){T.status==="pending"&&(T.status="rejected",T.reason=U)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function z(T,U,j,K,se){var oe=typeof T;(oe==="undefined"||oe==="boolean")&&(T=null);var pe=!1;if(T===null)pe=!0;else switch(oe){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(T.$$typeof){case e:case n:pe=!0;break;case g:return pe=T._init,z(pe(T._payload),U,j,K,se)}}if(pe)return se=se(T),pe=K===""?"."+te(T,0):K,D(se)?(j="",pe!=null&&(j=pe.replace(X,"$&/")+"/"),z(se,U,j,"",function(he){return he})):se!=null&&(V(se)&&(se=B(se,j+(se.key==null||T&&T.key===se.key?"":(""+se.key).replace(X,"$&/")+"/")+pe)),U.push(se)),1;pe=0;var Se=K===""?".":K+":";if(D(T))for(var ie=0;ie<T.length;ie++)K=T[ie],oe=Se+te(K,ie),pe+=z(K,U,j,oe,se);else if(ie=w(T),typeof ie=="function")for(T=ie.call(T),ie=0;!(K=T.next()).done;)K=K.value,oe=Se+te(K,ie++),pe+=z(K,U,j,oe,se);else if(oe==="object"){if(typeof T.then=="function")return z(O(T),U,j,K,se);throw U=String(T),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return pe}function H(T,U,j){if(T==null)return T;var K=[],se=0;return z(T,K,"","",function(oe){return U.call(j,oe,se++)}),K}function Z(T){if(T._status===-1){var U=T._result;U=U(),U.then(function(j){(T._status===0||T._status===-1)&&(T._status=1,T._result=j)},function(j){(T._status===0||T._status===-1)&&(T._status=2,T._result=j)}),T._status===-1&&(T._status=0,T._result=U)}if(T._status===1)return T._result.default;throw T._result}var ce=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=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(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},E={map:H,forEach:function(T,U,j){H(T,function(){U.apply(this,arguments)},j)},count:function(T){var U=0;return H(T,function(){U++}),U},toArray:function(T){return H(T,function(U){return U})||[]},only:function(T){if(!V(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return qe.Activity=y,qe.Children=E,qe.Component=A,qe.Fragment=r,qe.Profiler=o,qe.PureComponent=I,qe.StrictMode=s,qe.Suspense=m,qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,qe.__COMPILER_RUNTIME={__proto__:null,c:function(T){return $.H.useMemoCache(T)}},qe.cache=function(T){return function(){return T.apply(null,arguments)}},qe.cacheSignal=function(){return null},qe.cloneElement=function(T,U,j){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var K=C({},T.props),se=T.key;if(U!=null)for(oe in U.key!==void 0&&(se=""+U.key),U)!Q.call(U,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&U.ref===void 0||(K[oe]=U[oe]);var oe=arguments.length-2;if(oe===1)K.children=j;else if(1<oe){for(var pe=Array(oe),Se=0;Se<oe;Se++)pe[Se]=arguments[Se+2];K.children=pe}return W(T.type,se,K)},qe.createContext=function(T){return T={$$typeof:d,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:c,_context:T},T},qe.createElement=function(T,U,j){var K,se={},oe=null;if(U!=null)for(K in U.key!==void 0&&(oe=""+U.key),U)Q.call(U,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(se[K]=U[K]);var pe=arguments.length-2;if(pe===1)se.children=j;else if(1<pe){for(var Se=Array(pe),ie=0;ie<pe;ie++)Se[ie]=arguments[ie+2];se.children=Se}if(T&&T.defaultProps)for(K in pe=T.defaultProps,pe)se[K]===void 0&&(se[K]=pe[K]);return W(T,oe,se)},qe.createRef=function(){return{current:null}},qe.forwardRef=function(T){return{$$typeof:f,render:T}},qe.isValidElement=V,qe.lazy=function(T){return{$$typeof:g,_payload:{_status:-1,_result:T},_init:Z}},qe.memo=function(T,U){return{$$typeof:h,type:T,compare:U===void 0?null:U}},qe.startTransition=function(T){var U=$.T,j={};$.T=j;try{var K=T(),se=$.S;se!==null&&se(j,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(L,ce)}catch(oe){ce(oe)}finally{U!==null&&j.types!==null&&(U.types=j.types),$.T=U}},qe.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},qe.use=function(T){return $.H.use(T)},qe.useActionState=function(T,U,j){return $.H.useActionState(T,U,j)},qe.useCallback=function(T,U){return $.H.useCallback(T,U)},qe.useContext=function(T){return $.H.useContext(T)},qe.useDebugValue=function(){},qe.useDeferredValue=function(T,U){return $.H.useDeferredValue(T,U)},qe.useEffect=function(T,U){return $.H.useEffect(T,U)},qe.useEffectEvent=function(T){return $.H.useEffectEvent(T)},qe.useId=function(){return $.H.useId()},qe.useImperativeHandle=function(T,U,j){return $.H.useImperativeHandle(T,U,j)},qe.useInsertionEffect=function(T,U){return $.H.useInsertionEffect(T,U)},qe.useLayoutEffect=function(T,U){return $.H.useLayoutEffect(T,U)},qe.useMemo=function(T,U){return $.H.useMemo(T,U)},qe.useOptimistic=function(T,U){return $.H.useOptimistic(T,U)},qe.useReducer=function(T,U,j){return $.H.useReducer(T,U,j)},qe.useRef=function(T){return $.H.useRef(T)},qe.useState=function(T){return $.H.useState(T)},qe.useSyncExternalStore=function(T,U,j){return $.H.useSyncExternalStore(T,U,j)},qe.useTransition=function(){return $.H.useTransition()},qe.version="19.2.7",qe}var yy;function Ah(){return yy||(yy=1,rm.exports=WS()),rm.exports}var v=Ah(),sm={exports:{}},Ui={},lm={exports:{}},im={};var by;function KS(){return by||(by=1,(function(e){function n(z,H){var Z=z.length;z.push(H);e:for(;0<Z;){var ce=Z-1>>>1,E=z[ce];if(0<o(E,H))z[ce]=H,z[Z]=E,Z=ce;else break e}}function r(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var H=z[0],Z=z.pop();if(Z!==H){z[0]=Z;e:for(var ce=0,E=z.length,T=E>>>1;ce<T;){var U=2*(ce+1)-1,j=z[U],K=U+1,se=z[K];if(0>o(j,Z))K<E&&0>o(se,j)?(z[ce]=se,z[K]=Z,ce=K):(z[ce]=j,z[U]=Z,ce=U);else if(K<E&&0>o(se,Z))z[ce]=se,z[K]=Z,ce=K;else break e}}return H}function o(z,H){var Z=z.sortIndex-H.sortIndex;return Z!==0?Z:z.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],g=1,y=null,k=3,w=!1,N=!1,C=!1,M=!1,A=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function P(z){for(var H=r(h);H!==null;){if(H.callback===null)s(h);else if(H.startTime<=z)s(h),H.sortIndex=H.expirationTime,n(m,H);else break;H=r(h)}}function D(z){if(C=!1,P(z),!N)if(r(m)!==null)N=!0,L||(L=!0,q());else{var H=r(h);H!==null&&O(D,H.startTime-z)}}var L=!1,$=-1,Q=5,W=-1;function B(){return M?!0:!(e.unstable_now()-W<Q)}function V(){if(M=!1,L){var z=e.unstable_now();W=z;var H=!0;try{e:{N=!1,C&&(C=!1,R($),$=-1),w=!0;var Z=k;try{t:{for(P(z),y=r(m);y!==null&&!(y.expirationTime>z&&B());){var ce=y.callback;if(typeof ce=="function"){y.callback=null,k=y.priorityLevel;var E=ce(y.expirationTime<=z);if(z=e.unstable_now(),typeof E=="function"){y.callback=E,P(z),H=!0;break t}y===r(m)&&s(m),P(z)}else s(m);y=r(m)}if(y!==null)H=!0;else{var T=r(h);T!==null&&O(D,T.startTime-z),H=!1}}break e}finally{y=null,k=Z,w=!1}H=void 0}}finally{H?q():L=!1}}}var q;if(typeof I=="function")q=function(){I(V)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,te=X.port2;X.port1.onmessage=V,q=function(){te.postMessage(null)}}else q=function(){A(V,0)};function O(z,H){$=A(function(){z(e.unstable_now())},H)}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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return k},e.unstable_next=function(z){switch(k){case 1:case 2:case 3:var H=3;break;default:H=k}var Z=k;k=H;try{return z()}finally{k=Z}},e.unstable_requestPaint=function(){M=!0},e.unstable_runWithPriority=function(z,H){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var Z=k;k=z;try{return H()}finally{k=Z}},e.unstable_scheduleCallback=function(z,H,Z){var ce=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?ce+Z:ce):Z=ce,z){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=Z+E,z={id:g++,callback:H,priorityLevel:z,startTime:Z,expirationTime:E,sortIndex:-1},Z>ce?(z.sortIndex=Z,n(h,z),r(m)===null&&z===r(h)&&(C?(R($),$=-1):C=!0,O(D,Z-ce))):(z.sortIndex=E,n(m,z),N||w||(N=!0,L||(L=!0,q()))),z},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(z){var H=k;return function(){var Z=k;k=H;try{return z.apply(this,arguments)}finally{k=Z}}}})(im)),im}var vy;function YS(){return vy||(vy=1,lm.exports=KS()),lm.exports}var om={exports:{}},Tn={};var ky;function QS(){if(ky)return Tn;ky=1;var e=Ah();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 s={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 c(m,h,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,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 Tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Tn.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 c(m,h,null,g)},Tn.flushSync=function(m){var h=d.T,g=s.p;try{if(d.T=null,s.p=2,m)return m()}finally{d.T=h,s.p=g,s.d.f()}},Tn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(m,h))},Tn.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},Tn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,y=f(g,h.crossOrigin),k=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?s.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:w}):g==="script"&&s.d.X(m,{crossOrigin:y,integrity:k,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Tn.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);s.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&&s.d.M(m)},Tn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,y=f(g,h.crossOrigin);s.d.L(m,g,{crossOrigin:y,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})}},Tn.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=f(h.as,h.crossOrigin);s.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 s.d.m(m)},Tn.requestFormReset=function(m){s.d.r(m)},Tn.unstable_batchedUpdates=function(m,h){return m(h)},Tn.useFormState=function(m,h,g){return d.H.useFormState(m,h,g)},Tn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Tn.version="19.2.7",Tn}var wy;function zb(){if(wy)return om.exports;wy=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(),om.exports=QS(),om.exports}var Sy;function XS(){if(Sy)return Ui;Sy=1;var e=YS(),n=Ah(),r=zb();function s(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}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 c(t){var a=t,i=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(i=a.return),t=a.return;while(t)}return a.tag===3?i: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(c(t)!==t)throw Error(s(188))}function h(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(s(188));return a!==t?null:t}for(var i=t,u=a;;){var p=i.return;if(p===null)break;var b=p.alternate;if(b===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===b.child){for(b=p.child;b;){if(b===i)return m(p),t;if(b===u)return m(p),a;b=b.sibling}throw Error(s(188))}if(i.return!==u.return)i=p,u=b;else{for(var S=!1,_=p.child;_;){if(_===i){S=!0,i=p,u=b;break}if(_===u){S=!0,u=p,i=b;break}_=_.sibling}if(!S){for(_=b.child;_;){if(_===i){S=!0,i=b,u=p;break}if(_===u){S=!0,u=b,i=p;break}_=_.sibling}if(!S)throw Error(s(189))}}if(i.alternate!==u)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?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 y=Object.assign,k=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),I=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function q(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var X=Symbol.for("react.client.reference");function te(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===X?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case A:return"Profiler";case M:return"StrictMode";case D:return"Suspense";case L:return"SuspenseList";case W:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case N:return"Portal";case I:return t.displayName||"Context";case R:return(t._context.displayName||"Context")+".Consumer";case P:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case $:return a=t.displayName||null,a!==null?a:te(t.type)||"Memo";case Q:a=t._payload,t=t._init;try{return te(t(a))}catch{}}return null}var O=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},ce=[],E=-1;function T(t){return{current:t}}function U(t){0>E||(t.current=ce[E],ce[E]=null,E--)}function j(t,a){E++,ce[E]=t.current,t.current=a}var K=T(null),se=T(null),oe=T(null),pe=T(null);function Se(t,a){switch(j(oe,a),j(se,t),j(K,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Ux(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Ux(a),t=$x(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}U(K),j(K,t)}function ie(){U(K),U(se),U(oe)}function he(t){t.memoizedState!==null&&j(pe,t);var a=K.current,i=$x(a,t.type);a!==i&&(j(se,t),j(K,i))}function be(t){se.current===t&&(U(K),U(se)),pe.current===t&&(U(pe),Ii._currentValue=Z)}var ze,st;function Ue(t){if(ze===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);ze=a&&a[1]||"",st=-1<i.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+ze+t+st}var wt=!1;function Yt(t,a){if(!t||wt)return"";wt=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(le){var ne=le}Reflect.construct(t,[],me)}else{try{me.call()}catch(le){ne=le}t.call(me.prototype)}}else{try{throw Error()}catch(le){ne=le}(me=t())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(le){if(le&&ne&&typeof le.stack=="string")return[le.stack,ne.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=u.DetermineComponentFrameRoot(),S=b[0],_=b[1];if(S&&_){var F=S.split(`
|
|
4
|
-
`),ee=_.split(`
|
|
5
|
-
`);for(p=u=0;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;for(;p<ee.length&&!ee[p].includes("DetermineComponentFrameRoot");)p++;if(u===F.length||p===ee.length)for(u=F.length-1,p=ee.length-1;1<=u&&0<=p&&F[u]!==ee[p];)p--;for(;1<=u&&0<=p;u--,p--)if(F[u]!==ee[p]){if(u!==1||p!==1)do if(u--,p--,0>p||F[u]!==ee[p]){var de=`
|
|
6
|
-
`+F[u].replace(" at new "," at ");return t.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",t.displayName)),de}while(1<=u&&0<=p);break}}}finally{wt=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Ue(i):""}function pn(t,a){switch(t.tag){case 26:case 27:case 5:return Ue(t.type);case 16:return Ue("Lazy");case 13:return t.child!==a&&a!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return Yt(t.type,!1);case 11:return Yt(t.type.render,!1);case 1:return Yt(t.type,!0);case 31:return Ue("Activity");default:return""}}function gn(t){try{var a="",i=null;do a+=pn(t,i),i=t,t=t.return;while(t);return a}catch(u){return`
|
|
7
|
-
Error generating stack: `+u.message+`
|
|
8
|
-
`+u.stack}}var je=Object.prototype.hasOwnProperty,Ee=e.unstable_scheduleCallback,lt=e.unstable_cancelCallback,We=e.unstable_shouldYield,ct=e.unstable_requestPaint,St=e.unstable_now,tn=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ae=e.unstable_NormalPriority,Be=e.unstable_LowPriority,$e=e.unstable_IdlePriority,Qt=e.log,mt=e.unstable_setDisableYieldValue,ht=null,Ke=null;function Ft(t){if(typeof Qt=="function"&&mt(t),Ke&&typeof Ke.setStrictMode=="function")try{Ke.setStrictMode(ht,t)}catch{}}var Ye=Math.clz32?Math.clz32:Rn,xn=Math.log,ut=Math.LN2;function Rn(t){return t>>>=0,t===0?32:31-(xn(t)/ut|0)|0}var un=256,_n=262144,In=4194304;function Bn(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 dn(t,a,i){var u=t.pendingLanes;if(u===0)return 0;var p=0,b=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var _=u&134217727;return _!==0?(u=_&~b,u!==0?p=Bn(u):(S&=_,S!==0?p=Bn(S):i||(i=_&~t,i!==0&&(p=Bn(i))))):(_=u&~b,_!==0?p=Bn(_):S!==0?p=Bn(S):i||(i=u&~t,i!==0&&(p=Bn(i)))),p===0?0:a!==0&&a!==p&&(a&b)===0&&(b=p&-p,i=a&-a,b>=i||b===32&&(i&4194048)!==0)?a:p}function ga(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function ve(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 Me(){var t=In;return In<<=1,(In&62914560)===0&&(In=4194304),t}function xt(t){for(var a=[],i=0;31>i;i++)a.push(t);return a}function yt(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function _t(t,a,i,u,p,b){var S=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var _=t.entanglements,F=t.expirationTimes,ee=t.hiddenUpdates;for(i=S&~i;0<i;){var de=31-Ye(i),me=1<<de;_[de]=0,F[de]=-1;var ne=ee[de];if(ne!==null)for(ee[de]=null,de=0;de<ne.length;de++){var le=ne[de];le!==null&&(le.lane&=-536870913)}i&=~me}u!==0&&It(t,u,0),b!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=b&~(S&~a))}function It(t,a,i){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-Ye(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|i&261930}function Xt(t,a){var i=t.entangledLanes|=a;for(t=t.entanglements;i;){var u=31-Ye(i),p=1<<u;p&a|t[u]&a&&(t[u]|=a),i&=~p}}function Da(t,a){var i=a&-a;return i=(i&42)!==0?1:Oa(i),(i&(t.suspendedLanes|a))!==0?0:i}function Oa(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 za(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Lr(){var t=H.p;return t!==0?t:(t=window.event,t===void 0?32:oy(t.type))}function Qs(t,a){var i=H.p;try{return H.p=t,a()}finally{H.p=i}}var Hn=Math.random().toString(36).slice(2),Lt="__reactFiber$"+Hn,Vt="__reactProps$"+Hn,ea="__reactContainer$"+Hn,ur="__reactEvents$"+Hn,Dr="__reactListeners$"+Hn,Xs="__reactHandles$"+Hn,Zs="__reactResources$"+Hn,Pn="__reactMarker$"+Hn;function Ln(t){delete t[Lt],delete t[Vt],delete t[ur],delete t[Dr],delete t[Xs]}function qn(t){var a=t[Lt];if(a)return a;for(var i=t.parentNode;i;){if(a=i[ea]||i[Lt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=Gx(t);t!==null;){if(i=t[Lt])return i;t=Gx(t)}return a}t=i,i=t.parentNode}return null}function xa(t){if(t=t[Lt]||t[ea]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function Dn(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(s(33))}function Cn(t){var a=t[Zs];return a||(a=t[Zs]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Dt(t){t[Pn]=!0}var Or=new Set,Js={};function Ua(t,a){ae(t,a),ae(t+"Capture",a)}function ae(t,a){for(Js[t]=a,t=0;t<a.length;t++)Or.add(a[t])}var we=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]*$"),Fe={},Qe={};function Ot(t){return je.call(Qe,t)?!0:je.call(Fe,t)?!1:we.test(t)?Qe[t]=!0:(Fe[t]=!0,!1)}function Mt(t,a,i){if(Ot(a))if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+i)}}function Zt(t,a,i){if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+i)}}function Gt(t,a,i,u){if(u===null)t.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttributeNS(a,i,""+u)}}function nn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function dr(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function re(t,a,i){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,b=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return p.call(this)},set:function(S){i=""+S,b.call(this,S)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return i},setValue:function(S){i=""+S},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function ye(t){if(!t._valueTracker){var a=dr(t)?"checked":"value";t._valueTracker=re(t,a,""+t[a])}}function Le(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=dr(t)?t.checked?"true":"false":t.value),t=u,t!==i?(a.setValue(t),!0):!1}function at(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 Bt=/[\n"\\]/g;function yn(t){return t.replace(Bt,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function zr(t,a,i,u,p,b,S,_){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=""+nn(a)):t.value!==""+nn(a)&&(t.value=""+nn(a)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),a!=null?Xu(t,S,nn(a)):i!=null?Xu(t,S,nn(i)):u!=null&&t.removeAttribute("value"),p==null&&b!=null&&(t.defaultChecked=!!b),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.name=""+nn(_):t.removeAttribute("name")}function el(t,a,i,u,p,b,S,_){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.type=b),a!=null||i!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){ye(t);return}i=i!=null?""+nn(i):"",a=a!=null?""+nn(a):i,_||a===t.value||(t.value=a),t.defaultValue=a}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=_?t.checked:!!u,t.defaultChecked=!!u,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S),ye(t)}function Xu(t,a,i){a==="number"&&at(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function tl(t,a,i,u){if(t=t.options,a){a={};for(var p=0;p<i.length;p++)a["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=a.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+nn(i),a=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}a!==null||t[p].disabled||(a=t[p])}a!==null&&(a.selected=!0)}}function Ip(t,a,i){if(a!=null&&(a=""+nn(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+nn(i):""}function Lp(t,a,i,u){if(a==null){if(u!=null){if(i!=null)throw Error(s(92));if(O(u)){if(1<u.length)throw Error(s(93));u=u[0]}i=u}i==null&&(i=""),a=i}i=nn(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),ye(t)}function nl(t,a){if(a){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=a;return}}t.textContent=a}var B2=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 Dp(t,a,i){var u=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,i):typeof i!="number"||i===0||B2.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function Op(t,a,i){if(a!=null&&typeof a!="object")throw Error(s(62));if(t=t.style,i!=null){for(var u in i)!i.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var p in a)u=a[p],a.hasOwnProperty(p)&&i[p]!==u&&Dp(t,p,u)}else for(var b in a)a.hasOwnProperty(b)&&Dp(t,b,a[b])}function Zu(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 H2=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"]]),P2=/^[\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 Eo(t){return P2.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function fr(){}var Ju=null;function ed(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var al=null,rl=null;function zp(t){var a=xa(t);if(a&&(t=a.stateNode)){var i=t[Vt]||null;e:switch(t=a.stateNode,a.type){case"input":if(zr(t,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+yn(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var p=u[Vt]||null;if(!p)throw Error(s(90));zr(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&Le(u)}break e;case"textarea":Ip(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&tl(t,!!i.multiple,a,!1)}}}var td=!1;function Up(t,a,i){if(td)return t(a,i);td=!0;try{var u=t(a);return u}finally{if(td=!1,(al!==null||rl!==null)&&(gc(),al&&(a=al,t=rl,rl=al=null,zp(a),t)))for(a=0;a<t.length;a++)zp(t[a])}}function Ql(t,a){var i=t.stateNode;if(i===null)return null;var u=i[Vt]||null;if(u===null)return null;i=u[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":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(s(231,a,typeof i));return i}var mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nd=!1;if(mr)try{var Xl={};Object.defineProperty(Xl,"passive",{get:function(){nd=!0}}),window.addEventListener("test",Xl,Xl),window.removeEventListener("test",Xl,Xl)}catch{nd=!1}var Ur=null,ad=null,Ao=null;function $p(){if(Ao)return Ao;var t,a=ad,i=a.length,u,p="value"in Ur?Ur.value:Ur.textContent,b=p.length;for(t=0;t<i&&a[t]===p[t];t++);var S=i-t;for(u=1;u<=S&&a[i-u]===p[b-u];u++);return Ao=p.slice(t,1<u?1-u:void 0)}function Ro(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 _o(){return!0}function Bp(){return!1}function Fn(t){function a(i,u,p,b,S){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=b,this.target=S,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(b):b[_]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?_o:Bp,this.isPropagationStopped=Bp,this}return y(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=_o)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=_o)},persist:function(){},isPersistent:_o}),a}var ys={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Io=Fn(ys),Zl=y({},ys,{view:0,detail:0}),q2=Fn(Zl),rd,sd,Jl,Lo=y({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:id,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!==Jl&&(Jl&&t.type==="mousemove"?(rd=t.screenX-Jl.screenX,sd=t.screenY-Jl.screenY):sd=rd=0,Jl=t),rd)},movementY:function(t){return"movementY"in t?t.movementY:sd}}),Hp=Fn(Lo),F2=y({},Lo,{dataTransfer:0}),V2=Fn(F2),G2=y({},Zl,{relatedTarget:0}),ld=Fn(G2),W2=y({},ys,{animationName:0,elapsedTime:0,pseudoElement:0}),K2=Fn(W2),Y2=y({},ys,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Q2=Fn(Y2),X2=y({},ys,{data:0}),Pp=Fn(X2),Z2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},J2={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"},ew={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tw(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=ew[t])?!!a[t]:!1}function id(){return tw}var nw=y({},Zl,{key:function(t){if(t.key){var a=Z2[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Ro(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?J2[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:id,charCode:function(t){return t.type==="keypress"?Ro(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ro(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),aw=Fn(nw),rw=y({},Lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qp=Fn(rw),sw=y({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:id}),lw=Fn(sw),iw=y({},ys,{propertyName:0,elapsedTime:0,pseudoElement:0}),ow=Fn(iw),cw=y({},Lo,{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}),uw=Fn(cw),dw=y({},ys,{newState:0,oldState:0}),fw=Fn(dw),mw=[9,13,27,32],od=mr&&"CompositionEvent"in window,ei=null;mr&&"documentMode"in document&&(ei=document.documentMode);var hw=mr&&"TextEvent"in window&&!ei,Fp=mr&&(!od||ei&&8<ei&&11>=ei),Vp=" ",Gp=!1;function Wp(t,a){switch(t){case"keyup":return mw.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kp(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var sl=!1;function pw(t,a){switch(t){case"compositionend":return Kp(a);case"keypress":return a.which!==32?null:(Gp=!0,Vp);case"textInput":return t=a.data,t===Vp&&Gp?null:t;default:return null}}function gw(t,a){if(sl)return t==="compositionend"||!od&&Wp(t,a)?(t=$p(),Ao=ad=Ur=null,sl=!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 Fp&&a.locale!=="ko"?null:a.data;default:return null}}var xw={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 Yp(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!xw[t.type]:a==="textarea"}function Qp(t,a,i,u){al?rl?rl.push(u):rl=[u]:al=u,a=Sc(a,"onChange"),0<a.length&&(i=new Io("onChange","change",null,i,u),t.push({event:i,listeners:a}))}var ti=null,ni=null;function yw(t){_x(t,0)}function Do(t){var a=Dn(t);if(Le(a))return t}function Xp(t,a){if(t==="change")return a}var Zp=!1;if(mr){var cd;if(mr){var ud="oninput"in document;if(!ud){var Jp=document.createElement("div");Jp.setAttribute("oninput","return;"),ud=typeof Jp.oninput=="function"}cd=ud}else cd=!1;Zp=cd&&(!document.documentMode||9<document.documentMode)}function eg(){ti&&(ti.detachEvent("onpropertychange",tg),ni=ti=null)}function tg(t){if(t.propertyName==="value"&&Do(ni)){var a=[];Qp(a,ni,t,ed(t)),Up(yw,a)}}function bw(t,a,i){t==="focusin"?(eg(),ti=a,ni=i,ti.attachEvent("onpropertychange",tg)):t==="focusout"&&eg()}function vw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Do(ni)}function kw(t,a){if(t==="click")return Do(a)}function ww(t,a){if(t==="input"||t==="change")return Do(a)}function Sw(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var ta=typeof Object.is=="function"?Object.is:Sw;function ai(t,a){if(ta(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var i=Object.keys(t),u=Object.keys(a);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!je.call(a,p)||!ta(t[p],a[p]))return!1}return!0}function ng(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ag(t,a){var i=ng(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=a&&u>=a)return{node:i,offset:a-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=ng(i)}}function rg(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?rg(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function sg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=at(t.document);a instanceof t.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)t=a.contentWindow;else break;a=at(t.document)}return a}function dd(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 jw=mr&&"documentMode"in document&&11>=document.documentMode,ll=null,fd=null,ri=null,md=!1;function lg(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;md||ll==null||ll!==at(u)||(u=ll,"selectionStart"in u&&dd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),ri&&ai(ri,u)||(ri=u,u=Sc(fd,"onSelect"),0<u.length&&(a=new Io("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=ll)))}function bs(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var il={animationend:bs("Animation","AnimationEnd"),animationiteration:bs("Animation","AnimationIteration"),animationstart:bs("Animation","AnimationStart"),transitionrun:bs("Transition","TransitionRun"),transitionstart:bs("Transition","TransitionStart"),transitioncancel:bs("Transition","TransitionCancel"),transitionend:bs("Transition","TransitionEnd")},hd={},ig={};mr&&(ig=document.createElement("div").style,"AnimationEvent"in window||(delete il.animationend.animation,delete il.animationiteration.animation,delete il.animationstart.animation),"TransitionEvent"in window||delete il.transitionend.transition);function vs(t){if(hd[t])return hd[t];if(!il[t])return t;var a=il[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in ig)return hd[t]=a[i];return t}var og=vs("animationend"),cg=vs("animationiteration"),ug=vs("animationstart"),Nw=vs("transitionrun"),Cw=vs("transitionstart"),Tw=vs("transitioncancel"),dg=vs("transitionend"),fg=new Map,pd="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(" ");pd.push("scrollEnd");function $a(t,a){fg.set(t,a),Ua(a,[t])}var Oo=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)},ya=[],ol=0,gd=0;function zo(){for(var t=ol,a=gd=ol=0;a<t;){var i=ya[a];ya[a++]=null;var u=ya[a];ya[a++]=null;var p=ya[a];ya[a++]=null;var b=ya[a];if(ya[a++]=null,u!==null&&p!==null){var S=u.pending;S===null?p.next=p:(p.next=S.next,S.next=p),u.pending=p}b!==0&&mg(i,p,b)}}function Uo(t,a,i,u){ya[ol++]=t,ya[ol++]=a,ya[ol++]=i,ya[ol++]=u,gd|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function xd(t,a,i,u){return Uo(t,a,i,u),$o(t)}function ks(t,a){return Uo(t,null,null,a),$o(t)}function mg(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var p=!1,b=t.return;b!==null;)b.childLanes|=i,u=b.alternate,u!==null&&(u.childLanes|=i),b.tag===22&&(t=b.stateNode,t===null||t._visibility&1||(p=!0)),t=b,b=b.return;return t.tag===3?(b=t.stateNode,p&&a!==null&&(p=31-Ye(i),t=b.hiddenUpdates,u=t[p],u===null?t[p]=[a]:u.push(a),a.lane=i|536870912),b):null}function $o(t){if(50<Ci)throw Ci=0,Tf=null,Error(s(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var cl={};function Mw(t,a,i,u){this.tag=t,this.key=i,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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function na(t,a,i,u){return new Mw(t,a,i,u)}function yd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function hr(t,a){var i=t.alternate;return i===null?(i=na(t.tag,a,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=a,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&65011712,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,a=t.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i.refCleanup=t.refCleanup,i}function hg(t,a){t.flags&=65011714;var i=t.alternate;return i===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=i.childLanes,t.lanes=i.lanes,t.child=i.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=i.memoizedProps,t.memoizedState=i.memoizedState,t.updateQueue=i.updateQueue,t.type=i.type,a=i.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function Bo(t,a,i,u,p,b){var S=0;if(u=t,typeof t=="function")yd(t)&&(S=1);else if(typeof t=="string")S=IS(t,i,K.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case W:return t=na(31,i,a,p),t.elementType=W,t.lanes=b,t;case C:return ws(i.children,p,b,a);case M:S=8,p|=24;break;case A:return t=na(12,i,a,p|2),t.elementType=A,t.lanes=b,t;case D:return t=na(13,i,a,p),t.elementType=D,t.lanes=b,t;case L:return t=na(19,i,a,p),t.elementType=L,t.lanes=b,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case I:S=10;break e;case R:S=9;break e;case P:S=11;break e;case $:S=14;break e;case Q:S=16,u=null;break e}S=29,i=Error(s(130,t===null?"null":typeof t,"")),u=null}return a=na(S,i,a,p),a.elementType=t,a.type=u,a.lanes=b,a}function ws(t,a,i,u){return t=na(7,t,u,a),t.lanes=i,t}function bd(t,a,i){return t=na(6,t,null,a),t.lanes=i,t}function pg(t){var a=na(18,null,null,0);return a.stateNode=t,a}function vd(t,a,i){return a=na(4,t.children!==null?t.children:[],t.key,a),a.lanes=i,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var gg=new WeakMap;function ba(t,a){if(typeof t=="object"&&t!==null){var i=gg.get(t);return i!==void 0?i:(a={value:t,source:a,stack:gn(a)},gg.set(t,a),a)}return{value:t,source:a,stack:gn(a)}}var ul=[],dl=0,Ho=null,si=0,va=[],ka=0,$r=null,Xa=1,Za="";function pr(t,a){ul[dl++]=si,ul[dl++]=Ho,Ho=t,si=a}function xg(t,a,i){va[ka++]=Xa,va[ka++]=Za,va[ka++]=$r,$r=t;var u=Xa;t=Za;var p=32-Ye(u)-1;u&=~(1<<p),i+=1;var b=32-Ye(a)+p;if(30<b){var S=p-p%5;b=(u&(1<<S)-1).toString(32),u>>=S,p-=S,Xa=1<<32-Ye(a)+p|i<<p|u,Za=b+t}else Xa=1<<b|i<<p|u,Za=t}function kd(t){t.return!==null&&(pr(t,1),xg(t,1,0))}function wd(t){for(;t===Ho;)Ho=ul[--dl],ul[dl]=null,si=ul[--dl],ul[dl]=null;for(;t===$r;)$r=va[--ka],va[ka]=null,Za=va[--ka],va[ka]=null,Xa=va[--ka],va[ka]=null}function yg(t,a){va[ka++]=Xa,va[ka++]=Za,va[ka++]=$r,Xa=a.id,Za=a.overflow,$r=t}var wn=null,zt=null,rt=!1,Br=null,wa=!1,Sd=Error(s(519));function Hr(t){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw li(ba(a,t)),Sd}function bg(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[Lt]=t,a[Vt]=u,i){case"dialog":Ze("cancel",a),Ze("close",a);break;case"iframe":case"object":case"embed":Ze("load",a);break;case"video":case"audio":for(i=0;i<Mi.length;i++)Ze(Mi[i],a);break;case"source":Ze("error",a);break;case"img":case"image":case"link":Ze("error",a),Ze("load",a);break;case"details":Ze("toggle",a);break;case"input":Ze("invalid",a),el(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ze("invalid",a);break;case"textarea":Ze("invalid",a),Lp(a,u.value,u.defaultValue,u.children)}i=u.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||u.suppressHydrationWarning===!0||Ox(a.textContent,i)?(u.popover!=null&&(Ze("beforetoggle",a),Ze("toggle",a)),u.onScroll!=null&&Ze("scroll",a),u.onScrollEnd!=null&&Ze("scrollend",a),u.onClick!=null&&(a.onclick=fr),a=!0):a=!1,a||Hr(t,!0)}function vg(t){for(wn=t.return;wn;)switch(wn.tag){case 5:case 31:case 13:wa=!1;return;case 27:case 3:wa=!0;return;default:wn=wn.return}}function fl(t){if(t!==wn)return!1;if(!rt)return vg(t),rt=!0,!1;var a=t.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||Pf(t.type,t.memoizedProps)),i=!i),i&&zt&&Hr(t),vg(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));zt=Vx(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));zt=Vx(t)}else a===27?(a=zt,ts(t.type)?(t=Wf,Wf=null,zt=t):zt=a):zt=wn?ja(t.stateNode.nextSibling):null;return!0}function Ss(){zt=wn=null,rt=!1}function jd(){var t=Br;return t!==null&&(Kn===null?Kn=t:Kn.push.apply(Kn,t),Br=null),t}function li(t){Br===null?Br=[t]:Br.push(t)}var Nd=T(null),js=null,gr=null;function Pr(t,a,i){j(Nd,a._currentValue),a._currentValue=i}function xr(t){t._currentValue=Nd.current,U(Nd)}function Cd(t,a,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),t===i)break;t=t.return}}function Td(t,a,i,u){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var b=p.dependencies;if(b!==null){var S=p.child;b=b.firstContext;e:for(;b!==null;){var _=b;b=p;for(var F=0;F<a.length;F++)if(_.context===a[F]){b.lanes|=i,_=b.alternate,_!==null&&(_.lanes|=i),Cd(b.return,i,t),u||(S=null);break e}b=_.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(s(341));S.lanes|=i,b=S.alternate,b!==null&&(b.lanes|=i),Cd(S,i,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 ml(t,a,i,u){t=null;for(var p=a,b=!1;p!==null;){if(!b){if((p.flags&524288)!==0)b=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(s(387));if(S=S.memoizedProps,S!==null){var _=p.type;ta(p.pendingProps.value,S.value)||(t!==null?t.push(_):t=[_])}}else if(p===pe.current){if(S=p.alternate,S===null)throw Error(s(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(Ii):t=[Ii])}p=p.return}t!==null&&Td(a,t,i,u),a.flags|=262144}function Po(t){for(t=t.firstContext;t!==null;){if(!ta(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ns(t){js=t,gr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Sn(t){return kg(js,t)}function qo(t,a){return js===null&&Ns(t),kg(t,a)}function kg(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},gr===null){if(t===null)throw Error(s(308));gr=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else gr=gr.next=a;return i}var Ew=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(i,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(i){return i()})}},Aw=e.unstable_scheduleCallback,Rw=e.unstable_NormalPriority,an={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Md(){return{controller:new Ew,data:new Map,refCount:0}}function ii(t){t.refCount--,t.refCount===0&&Aw(Rw,function(){t.controller.abort()})}var oi=null,Ed=0,hl=0,pl=null;function _w(t,a){if(oi===null){var i=oi=[];Ed=0,hl=If(),pl={status:"pending",value:void 0,then:function(u){i.push(u)}}}return Ed++,a.then(wg,wg),a}function wg(){if(--Ed===0&&oi!==null){pl!==null&&(pl.status="fulfilled");var t=oi;oi=null,hl=0,pl=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function Iw(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(p){i.push(p)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var p=0;p<i.length;p++)(0,i[p])(a)},function(p){for(u.status="rejected",u.reason=p,p=0;p<i.length;p++)(0,i[p])(void 0)}),u}var Sg=z.S;z.S=function(t,a){lx=St(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&_w(t,a),Sg!==null&&Sg(t,a)};var Cs=T(null);function Ad(){var t=Cs.current;return t!==null?t:Et.pooledCache}function Fo(t,a){a===null?j(Cs,Cs.current):j(Cs,a.pool)}function jg(){var t=Ad();return t===null?null:{parent:an._currentValue,pool:t}}var gl=Error(s(460)),Rd=Error(s(474)),Vo=Error(s(542)),Go={then:function(){}};function Ng(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Cg(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then(fr,fr),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Mg(t),t;default:if(typeof a.status=="string")a.then(fr,fr);else{if(t=Et,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=u}},function(u){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Mg(t),t}throw Ms=a,gl}}function Ts(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Ms=i,gl):i}}var Ms=null;function Tg(){if(Ms===null)throw Error(s(459));var t=Ms;return Ms=null,t}function Mg(t){if(t===gl||t===Vo)throw Error(s(483))}var xl=null,ci=0;function Wo(t){var a=ci;return ci+=1,xl===null&&(xl=[]),Cg(xl,t,a)}function ui(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function Ko(t,a){throw a.$$typeof===k?Error(s(525)):(t=Object.prototype.toString.call(a),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Eg(t){function a(Y,G){if(t){var J=Y.deletions;J===null?(Y.deletions=[G],Y.flags|=16):J.push(G)}}function i(Y,G){if(!t)return null;for(;G!==null;)a(Y,G),G=G.sibling;return null}function u(Y){for(var G=new Map;Y!==null;)Y.key!==null?G.set(Y.key,Y):G.set(Y.index,Y),Y=Y.sibling;return G}function p(Y,G){return Y=hr(Y,G),Y.index=0,Y.sibling=null,Y}function b(Y,G,J){return Y.index=J,t?(J=Y.alternate,J!==null?(J=J.index,J<G?(Y.flags|=67108866,G):J):(Y.flags|=67108866,G)):(Y.flags|=1048576,G)}function S(Y){return t&&Y.alternate===null&&(Y.flags|=67108866),Y}function _(Y,G,J,fe){return G===null||G.tag!==6?(G=bd(J,Y.mode,fe),G.return=Y,G):(G=p(G,J),G.return=Y,G)}function F(Y,G,J,fe){var Re=J.type;return Re===C?de(Y,G,J.props.children,fe,J.key):G!==null&&(G.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===Q&&Ts(Re)===G.type)?(G=p(G,J.props),ui(G,J),G.return=Y,G):(G=Bo(J.type,J.key,J.props,null,Y.mode,fe),ui(G,J),G.return=Y,G)}function ee(Y,G,J,fe){return G===null||G.tag!==4||G.stateNode.containerInfo!==J.containerInfo||G.stateNode.implementation!==J.implementation?(G=vd(J,Y.mode,fe),G.return=Y,G):(G=p(G,J.children||[]),G.return=Y,G)}function de(Y,G,J,fe,Re){return G===null||G.tag!==7?(G=ws(J,Y.mode,fe,Re),G.return=Y,G):(G=p(G,J),G.return=Y,G)}function me(Y,G,J){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=bd(""+G,Y.mode,J),G.return=Y,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return J=Bo(G.type,G.key,G.props,null,Y.mode,J),ui(J,G),J.return=Y,J;case N:return G=vd(G,Y.mode,J),G.return=Y,G;case Q:return G=Ts(G),me(Y,G,J)}if(O(G)||q(G))return G=ws(G,Y.mode,J,null),G.return=Y,G;if(typeof G.then=="function")return me(Y,Wo(G),J);if(G.$$typeof===I)return me(Y,qo(Y,G),J);Ko(Y,G)}return null}function ne(Y,G,J,fe){var Re=G!==null?G.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Re!==null?null:_(Y,G,""+J,fe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return J.key===Re?F(Y,G,J,fe):null;case N:return J.key===Re?ee(Y,G,J,fe):null;case Q:return J=Ts(J),ne(Y,G,J,fe)}if(O(J)||q(J))return Re!==null?null:de(Y,G,J,fe,null);if(typeof J.then=="function")return ne(Y,G,Wo(J),fe);if(J.$$typeof===I)return ne(Y,G,qo(Y,J),fe);Ko(Y,J)}return null}function le(Y,G,J,fe,Re){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Y=Y.get(J)||null,_(G,Y,""+fe,Re);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return Y=Y.get(fe.key===null?J:fe.key)||null,F(G,Y,fe,Re);case N:return Y=Y.get(fe.key===null?J:fe.key)||null,ee(G,Y,fe,Re);case Q:return fe=Ts(fe),le(Y,G,J,fe,Re)}if(O(fe)||q(fe))return Y=Y.get(J)||null,de(G,Y,fe,Re,null);if(typeof fe.then=="function")return le(Y,G,J,Wo(fe),Re);if(fe.$$typeof===I)return le(Y,G,J,qo(G,fe),Re);Ko(G,fe)}return null}function Ne(Y,G,J,fe){for(var Re=null,dt=null,Te=G,Ge=G=0,tt=null;Te!==null&&Ge<J.length;Ge++){Te.index>Ge?(tt=Te,Te=null):tt=Te.sibling;var ft=ne(Y,Te,J[Ge],fe);if(ft===null){Te===null&&(Te=tt);break}t&&Te&&ft.alternate===null&&a(Y,Te),G=b(ft,G,Ge),dt===null?Re=ft:dt.sibling=ft,dt=ft,Te=tt}if(Ge===J.length)return i(Y,Te),rt&&pr(Y,Ge),Re;if(Te===null){for(;Ge<J.length;Ge++)Te=me(Y,J[Ge],fe),Te!==null&&(G=b(Te,G,Ge),dt===null?Re=Te:dt.sibling=Te,dt=Te);return rt&&pr(Y,Ge),Re}for(Te=u(Te);Ge<J.length;Ge++)tt=le(Te,Y,Ge,J[Ge],fe),tt!==null&&(t&&tt.alternate!==null&&Te.delete(tt.key===null?Ge:tt.key),G=b(tt,G,Ge),dt===null?Re=tt:dt.sibling=tt,dt=tt);return t&&Te.forEach(function(ls){return a(Y,ls)}),rt&&pr(Y,Ge),Re}function Oe(Y,G,J,fe){if(J==null)throw Error(s(151));for(var Re=null,dt=null,Te=G,Ge=G=0,tt=null,ft=J.next();Te!==null&&!ft.done;Ge++,ft=J.next()){Te.index>Ge?(tt=Te,Te=null):tt=Te.sibling;var ls=ne(Y,Te,ft.value,fe);if(ls===null){Te===null&&(Te=tt);break}t&&Te&&ls.alternate===null&&a(Y,Te),G=b(ls,G,Ge),dt===null?Re=ls:dt.sibling=ls,dt=ls,Te=tt}if(ft.done)return i(Y,Te),rt&&pr(Y,Ge),Re;if(Te===null){for(;!ft.done;Ge++,ft=J.next())ft=me(Y,ft.value,fe),ft!==null&&(G=b(ft,G,Ge),dt===null?Re=ft:dt.sibling=ft,dt=ft);return rt&&pr(Y,Ge),Re}for(Te=u(Te);!ft.done;Ge++,ft=J.next())ft=le(Te,Y,Ge,ft.value,fe),ft!==null&&(t&&ft.alternate!==null&&Te.delete(ft.key===null?Ge:ft.key),G=b(ft,G,Ge),dt===null?Re=ft:dt.sibling=ft,dt=ft);return t&&Te.forEach(function(FS){return a(Y,FS)}),rt&&pr(Y,Ge),Re}function Ct(Y,G,J,fe){if(typeof J=="object"&&J!==null&&J.type===C&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case w:e:{for(var Re=J.key;G!==null;){if(G.key===Re){if(Re=J.type,Re===C){if(G.tag===7){i(Y,G.sibling),fe=p(G,J.props.children),fe.return=Y,Y=fe;break e}}else if(G.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===Q&&Ts(Re)===G.type){i(Y,G.sibling),fe=p(G,J.props),ui(fe,J),fe.return=Y,Y=fe;break e}i(Y,G);break}else a(Y,G);G=G.sibling}J.type===C?(fe=ws(J.props.children,Y.mode,fe,J.key),fe.return=Y,Y=fe):(fe=Bo(J.type,J.key,J.props,null,Y.mode,fe),ui(fe,J),fe.return=Y,Y=fe)}return S(Y);case N:e:{for(Re=J.key;G!==null;){if(G.key===Re)if(G.tag===4&&G.stateNode.containerInfo===J.containerInfo&&G.stateNode.implementation===J.implementation){i(Y,G.sibling),fe=p(G,J.children||[]),fe.return=Y,Y=fe;break e}else{i(Y,G);break}else a(Y,G);G=G.sibling}fe=vd(J,Y.mode,fe),fe.return=Y,Y=fe}return S(Y);case Q:return J=Ts(J),Ct(Y,G,J,fe)}if(O(J))return Ne(Y,G,J,fe);if(q(J)){if(Re=q(J),typeof Re!="function")throw Error(s(150));return J=Re.call(J),Oe(Y,G,J,fe)}if(typeof J.then=="function")return Ct(Y,G,Wo(J),fe);if(J.$$typeof===I)return Ct(Y,G,qo(Y,J),fe);Ko(Y,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,G!==null&&G.tag===6?(i(Y,G.sibling),fe=p(G,J),fe.return=Y,Y=fe):(i(Y,G),fe=bd(J,Y.mode,fe),fe.return=Y,Y=fe),S(Y)):i(Y,G)}return function(Y,G,J,fe){try{ci=0;var Re=Ct(Y,G,J,fe);return xl=null,Re}catch(Te){if(Te===gl||Te===Vo)throw Te;var dt=na(29,Te,null,Y.mode);return dt.lanes=fe,dt.return=Y,dt}}}var Es=Eg(!0),Ag=Eg(!1),qr=!1;function _d(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Id(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 Fr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Vr(t,a,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(pt&2)!==0){var p=u.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),u.pending=a,a=$o(t),mg(t,null,i),a}return Uo(t,u,a,i),$o(t)}function di(t,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,Xt(t,i)}}function Ld(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,b=null;if(i=i.firstBaseUpdate,i!==null){do{var S={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};b===null?p=b=S:b=b.next=S,i=i.next}while(i!==null);b===null?p=b=a:b=b.next=a}else p=b=a;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:b,shared:u.shared,callbacks:u.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=a:t.next=a,i.lastBaseUpdate=a}var Dd=!1;function fi(){if(Dd){var t=pl;if(t!==null)throw t}}function mi(t,a,i,u){Dd=!1;var p=t.updateQueue;qr=!1;var b=p.firstBaseUpdate,S=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var F=_,ee=F.next;F.next=null,S===null?b=ee:S.next=ee,S=F;var de=t.alternate;de!==null&&(de=de.updateQueue,_=de.lastBaseUpdate,_!==S&&(_===null?de.firstBaseUpdate=ee:_.next=ee,de.lastBaseUpdate=F))}if(b!==null){var me=p.baseState;S=0,de=ee=F=null,_=b;do{var ne=_.lane&-536870913,le=ne!==_.lane;if(le?(et&ne)===ne:(u&ne)===ne){ne!==0&&ne===hl&&(Dd=!0),de!==null&&(de=de.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ne=t,Oe=_;ne=a;var Ct=i;switch(Oe.tag){case 1:if(Ne=Oe.payload,typeof Ne=="function"){me=Ne.call(Ct,me,ne);break e}me=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Oe.payload,ne=typeof Ne=="function"?Ne.call(Ct,me,ne):Ne,ne==null)break e;me=y({},me,ne);break e;case 2:qr=!0}}ne=_.callback,ne!==null&&(t.flags|=64,le&&(t.flags|=8192),le=p.callbacks,le===null?p.callbacks=[ne]:le.push(ne))}else le={lane:ne,tag:_.tag,payload:_.payload,callback:_.callback,next:null},de===null?(ee=de=le,F=me):de=de.next=le,S|=ne;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;le=_,_=le.next,le.next=null,p.lastBaseUpdate=le,p.shared.pending=null}}while(!0);de===null&&(F=me),p.baseState=F,p.firstBaseUpdate=ee,p.lastBaseUpdate=de,b===null&&(p.shared.lanes=0),Qr|=S,t.lanes=S,t.memoizedState=me}}function Rg(t,a){if(typeof t!="function")throw Error(s(191,t));t.call(a)}function _g(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)Rg(i[t],a)}var yl=T(null),Yo=T(0);function Ig(t,a){t=Cr,j(Yo,t),j(yl,a),Cr=t|a.baseLanes}function Od(){j(Yo,Cr),j(yl,yl.current)}function zd(){Cr=Yo.current,U(yl),U(Yo)}var aa=T(null),Sa=null;function Gr(t){var a=t.alternate;j(Jt,Jt.current&1),j(aa,t),Sa===null&&(a===null||yl.current!==null||a.memoizedState!==null)&&(Sa=t)}function Ud(t){j(Jt,Jt.current),j(aa,t),Sa===null&&(Sa=t)}function Lg(t){t.tag===22?(j(Jt,Jt.current),j(aa,t),Sa===null&&(Sa=t)):Wr()}function Wr(){j(Jt,Jt.current),j(aa,aa.current)}function ra(t){U(aa),Sa===t&&(Sa=null),U(Jt)}var Jt=T(0);function Qo(t){for(var a=t;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Vf(i)||Gf(i)))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 yr=0,Ve=null,jt=null,rn=null,Xo=!1,bl=!1,As=!1,Zo=0,hi=0,vl=null,Lw=0;function Wt(){throw Error(s(321))}function $d(t,a){if(a===null)return!1;for(var i=0;i<a.length&&i<t.length;i++)if(!ta(t[i],a[i]))return!1;return!0}function Bd(t,a,i,u,p,b){return yr=b,Ve=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,z.H=t===null||t.memoizedState===null?x0:tf,As=!1,b=i(u,p),As=!1,bl&&(b=Og(a,i,u,p)),Dg(t),b}function Dg(t){z.H=xi;var a=jt!==null&&jt.next!==null;if(yr=0,rn=jt=Ve=null,Xo=!1,hi=0,vl=null,a)throw Error(s(300));t===null||sn||(t=t.dependencies,t!==null&&Po(t)&&(sn=!0))}function Og(t,a,i,u){Ve=t;var p=0;do{if(bl&&(vl=null),hi=0,bl=!1,25<=p)throw Error(s(301));if(p+=1,rn=jt=null,t.updateQueue!=null){var b=t.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}z.H=y0,b=a(i,u)}while(bl);return b}function Dw(){var t=z.H,a=t.useState()[0];return a=typeof a.then=="function"?pi(a):a,t=t.useState()[0],(jt!==null?jt.memoizedState:null)!==t&&(Ve.flags|=1024),a}function Hd(){var t=Zo!==0;return Zo=0,t}function Pd(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function qd(t){if(Xo){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}Xo=!1}yr=0,rn=jt=Ve=null,bl=!1,hi=Zo=0,vl=null}function On(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?Ve.memoizedState=rn=t:rn=rn.next=t,rn}function en(){if(jt===null){var t=Ve.alternate;t=t!==null?t.memoizedState:null}else t=jt.next;var a=rn===null?Ve.memoizedState:rn.next;if(a!==null)rn=a,jt=t;else{if(t===null)throw Ve.alternate===null?Error(s(467)):Error(s(310));jt=t,t={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},rn===null?Ve.memoizedState=rn=t:rn=rn.next=t}return rn}function Jo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pi(t){var a=hi;return hi+=1,vl===null&&(vl=[]),t=Cg(vl,t,a),a=Ve,(rn===null?a.memoizedState:rn.next)===null&&(a=a.alternate,z.H=a===null||a.memoizedState===null?x0:tf),t}function ec(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return pi(t);if(t.$$typeof===I)return Sn(t)}throw Error(s(438,String(t)))}function Fd(t){var a=null,i=Ve.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var u=Ve.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=Jo(),Ve.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(t),u=0;u<t;u++)i[u]=B;return a.index++,i}function br(t,a){return typeof a=="function"?a(t):a}function tc(t){var a=en();return Vd(a,jt,t)}function Vd(t,a,i){var u=t.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=i;var p=t.baseQueue,b=u.pending;if(b!==null){if(p!==null){var S=p.next;p.next=b.next,b.next=S}a.baseQueue=p=b,u.pending=null}if(b=t.baseState,p===null)t.memoizedState=b;else{a=p.next;var _=S=null,F=null,ee=a,de=!1;do{var me=ee.lane&-536870913;if(me!==ee.lane?(et&me)===me:(yr&me)===me){var ne=ee.revertLane;if(ne===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),me===hl&&(de=!0);else if((yr&ne)===ne){ee=ee.next,ne===hl&&(de=!0);continue}else me={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(_=F=me,S=b):F=F.next=me,Ve.lanes|=ne,Qr|=ne;me=ee.action,As&&i(b,me),b=ee.hasEagerState?ee.eagerState:i(b,me)}else ne={lane:me,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(_=F=ne,S=b):F=F.next=ne,Ve.lanes|=me,Qr|=me;ee=ee.next}while(ee!==null&&ee!==a);if(F===null?S=b:F.next=_,!ta(b,t.memoizedState)&&(sn=!0,de&&(i=pl,i!==null)))throw i;t.memoizedState=b,t.baseState=S,t.baseQueue=F,u.lastRenderedState=b}return p===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Gd(t){var a=en(),i=a.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,b=a.memoizedState;if(p!==null){i.pending=null;var S=p=p.next;do b=t(b,S.action),S=S.next;while(S!==p);ta(b,a.memoizedState)||(sn=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),i.lastRenderedState=b}return[b,u]}function zg(t,a,i){var u=Ve,p=en(),b=rt;if(b){if(i===void 0)throw Error(s(407));i=i()}else i=a();var S=!ta((jt||p).memoizedState,i);if(S&&(p.memoizedState=i,sn=!0),p=p.queue,Yd(Bg.bind(null,u,p,t),[t]),p.getSnapshot!==a||S||rn!==null&&rn.memoizedState.tag&1){if(u.flags|=2048,kl(9,{destroy:void 0},$g.bind(null,u,p,i,a),null),Et===null)throw Error(s(349));b||(yr&127)!==0||Ug(u,a,i)}return i}function Ug(t,a,i){t.flags|=16384,t={getSnapshot:a,value:i},a=Ve.updateQueue,a===null?(a=Jo(),Ve.updateQueue=a,a.stores=[t]):(i=a.stores,i===null?a.stores=[t]:i.push(t))}function $g(t,a,i,u){a.value=i,a.getSnapshot=u,Hg(a)&&Pg(t)}function Bg(t,a,i){return i(function(){Hg(a)&&Pg(t)})}function Hg(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!ta(t,i)}catch{return!0}}function Pg(t){var a=ks(t,2);a!==null&&Yn(a,t,2)}function Wd(t){var a=On();if(typeof t=="function"){var i=t;if(t=i(),As){Ft(!0);try{i()}finally{Ft(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:t},a}function qg(t,a,i,u){return t.baseState=i,Vd(t,jt,typeof u=="function"?u:br)}function Ow(t,a,i,u,p){if(rc(t))throw Error(s(485));if(t=a.action,t!==null){var b={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){b.listeners.push(S)}};z.T!==null?i(!0):b.isTransition=!1,u(b),i=a.pending,i===null?(b.next=a.pending=b,Fg(a,b)):(b.next=i.next,a.pending=i.next=b)}}function Fg(t,a){var i=a.action,u=a.payload,p=t.state;if(a.isTransition){var b=z.T,S={};z.T=S;try{var _=i(p,u),F=z.S;F!==null&&F(S,_),Vg(t,a,_)}catch(ee){Kd(t,a,ee)}finally{b!==null&&S.types!==null&&(b.types=S.types),z.T=b}}else try{b=i(p,u),Vg(t,a,b)}catch(ee){Kd(t,a,ee)}}function Vg(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){Gg(t,a,u)},function(u){return Kd(t,a,u)}):Gg(t,a,i)}function Gg(t,a,i){a.status="fulfilled",a.value=i,Wg(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,Fg(t,i)))}function Kd(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,Wg(a),a=a.next;while(a!==u)}t.action=null}function Wg(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function Kg(t,a){return a}function Yg(t,a){if(rt){var i=Et.formState;if(i!==null){e:{var u=Ve;if(rt){if(zt){t:{for(var p=zt,b=wa;p.nodeType!==8;){if(!b){p=null;break t}if(p=ja(p.nextSibling),p===null){p=null;break t}}b=p.data,p=b==="F!"||b==="F"?p:null}if(p){zt=ja(p.nextSibling),u=p.data==="F!";break e}}Hr(u)}u=!1}u&&(a=i[0])}}return i=On(),i.memoizedState=i.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kg,lastRenderedState:a},i.queue=u,i=h0.bind(null,Ve,u),u.dispatch=i,u=Wd(!1),b=ef.bind(null,Ve,!1,u.queue),u=On(),p={state:a,dispatch:null,action:t,pending:null},u.queue=p,i=Ow.bind(null,Ve,p,b,i),p.dispatch=i,u.memoizedState=t,[a,i,!1]}function Qg(t){var a=en();return Xg(a,jt,t)}function Xg(t,a,i){if(a=Vd(t,a,Kg)[0],t=tc(br)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=pi(a)}catch(S){throw S===gl?Vo:S}else u=a;a=en();var p=a.queue,b=p.dispatch;return i!==a.memoizedState&&(Ve.flags|=2048,kl(9,{destroy:void 0},zw.bind(null,p,i),null)),[u,b,t]}function zw(t,a){t.action=a}function Zg(t){var a=en(),i=jt;if(i!==null)return Xg(a,i,t);en(),a=a.memoizedState,i=en();var u=i.queue.dispatch;return i.memoizedState=t,[a,u,!1]}function kl(t,a,i,u){return t={tag:t,create:i,deps:u,inst:a,next:null},a=Ve.updateQueue,a===null&&(a=Jo(),Ve.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,a.lastEffect=t),t}function Jg(){return en().memoizedState}function nc(t,a,i,u){var p=On();Ve.flags|=t,p.memoizedState=kl(1|a,{destroy:void 0},i,u===void 0?null:u)}function ac(t,a,i,u){var p=en();u=u===void 0?null:u;var b=p.memoizedState.inst;jt!==null&&u!==null&&$d(u,jt.memoizedState.deps)?p.memoizedState=kl(a,b,i,u):(Ve.flags|=t,p.memoizedState=kl(1|a,b,i,u))}function e0(t,a){nc(8390656,8,t,a)}function Yd(t,a){ac(2048,8,t,a)}function Uw(t){Ve.flags|=4;var a=Ve.updateQueue;if(a===null)a=Jo(),Ve.updateQueue=a,a.events=[t];else{var i=a.events;i===null?a.events=[t]:i.push(t)}}function t0(t){var a=en().memoizedState;return Uw({ref:a,nextImpl:t}),function(){if((pt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function n0(t,a){return ac(4,2,t,a)}function a0(t,a){return ac(4,4,t,a)}function r0(t,a){if(typeof a=="function"){t=t();var i=a(t);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function s0(t,a,i){i=i!=null?i.concat([t]):null,ac(4,4,r0.bind(null,a,t),i)}function Qd(){}function l0(t,a){var i=en();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&$d(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function i0(t,a){var i=en();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&$d(a,u[1]))return u[0];if(u=t(),As){Ft(!0);try{t()}finally{Ft(!1)}}return i.memoizedState=[u,a],u}function Xd(t,a,i){return i===void 0||(yr&1073741824)!==0&&(et&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=ox(),Ve.lanes|=t,Qr|=t,i)}function o0(t,a,i,u){return ta(i,a)?i:yl.current!==null?(t=Xd(t,i,u),ta(t,a)||(sn=!0),t):(yr&42)===0||(yr&1073741824)!==0&&(et&261930)===0?(sn=!0,t.memoizedState=i):(t=ox(),Ve.lanes|=t,Qr|=t,a)}function c0(t,a,i,u,p){var b=H.p;H.p=b!==0&&8>b?b:8;var S=z.T,_={};z.T=_,ef(t,!1,a,i);try{var F=p(),ee=z.S;if(ee!==null&&ee(_,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var de=Iw(F,u);gi(t,a,de,ia(t))}else gi(t,a,u,ia(t))}catch(me){gi(t,a,{then:function(){},status:"rejected",reason:me},ia())}finally{H.p=b,S!==null&&_.types!==null&&(S.types=_.types),z.T=S}}function $w(){}function Zd(t,a,i,u){if(t.tag!==5)throw Error(s(476));var p=u0(t).queue;c0(t,p,a,Z,i===null?$w:function(){return d0(t),i(u)})}function u0(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:Z},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function d0(t){var a=u0(t);a.next===null&&(a=t.alternate.memoizedState),gi(t,a.next.queue,{},ia())}function Jd(){return Sn(Ii)}function f0(){return en().memoizedState}function m0(){return en().memoizedState}function Bw(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var i=ia();t=Fr(i);var u=Vr(a,t,i);u!==null&&(Yn(u,a,i),di(u,a,i)),a={cache:Md()},t.payload=a;return}a=a.return}}function Hw(t,a,i){var u=ia();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},rc(t)?p0(a,i):(i=xd(t,a,i,u),i!==null&&(Yn(i,t,u),g0(i,a,u)))}function h0(t,a,i){var u=ia();gi(t,a,i,u)}function gi(t,a,i,u){var p={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(rc(t))p0(a,p);else{var b=t.alternate;if(t.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var S=a.lastRenderedState,_=b(S,i);if(p.hasEagerState=!0,p.eagerState=_,ta(_,S))return Uo(t,a,p,0),Et===null&&zo(),!1}catch{}if(i=xd(t,a,p,u),i!==null)return Yn(i,t,u),g0(i,a,u),!0}return!1}function ef(t,a,i,u){if(u={lane:2,revertLane:If(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},rc(t)){if(a)throw Error(s(479))}else a=xd(t,i,u,2),a!==null&&Yn(a,t,2)}function rc(t){var a=t.alternate;return t===Ve||a!==null&&a===Ve}function p0(t,a){bl=Xo=!0;var i=t.pending;i===null?a.next=a:(a.next=i.next,i.next=a),t.pending=a}function g0(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,Xt(t,i)}}var xi={readContext:Sn,use:ec,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};xi.useEffectEvent=Wt;var x0={readContext:Sn,use:ec,useCallback:function(t,a){return On().memoizedState=[t,a===void 0?null:a],t},useContext:Sn,useEffect:e0,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,nc(4194308,4,r0.bind(null,a,t),i)},useLayoutEffect:function(t,a){return nc(4194308,4,t,a)},useInsertionEffect:function(t,a){nc(4,2,t,a)},useMemo:function(t,a){var i=On();a=a===void 0?null:a;var u=t();if(As){Ft(!0);try{t()}finally{Ft(!1)}}return i.memoizedState=[u,a],u},useReducer:function(t,a,i){var u=On();if(i!==void 0){var p=i(a);if(As){Ft(!0);try{i(a)}finally{Ft(!1)}}}else p=a;return u.memoizedState=u.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},u.queue=t,t=t.dispatch=Hw.bind(null,Ve,t),[u.memoizedState,t]},useRef:function(t){var a=On();return t={current:t},a.memoizedState=t},useState:function(t){t=Wd(t);var a=t.queue,i=h0.bind(null,Ve,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:Qd,useDeferredValue:function(t,a){var i=On();return Xd(i,t,a)},useTransition:function(){var t=Wd(!1);return t=c0.bind(null,Ve,t.queue,!0,!1),On().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=Ve,p=On();if(rt){if(i===void 0)throw Error(s(407));i=i()}else{if(i=a(),Et===null)throw Error(s(349));(et&127)!==0||Ug(u,a,i)}p.memoizedState=i;var b={value:i,getSnapshot:a};return p.queue=b,e0(Bg.bind(null,u,b,t),[t]),u.flags|=2048,kl(9,{destroy:void 0},$g.bind(null,u,b,i,a),null),i},useId:function(){var t=On(),a=Et.identifierPrefix;if(rt){var i=Za,u=Xa;i=(u&~(1<<32-Ye(u)-1)).toString(32)+i,a="_"+a+"R_"+i,i=Zo++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=Lw++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:Jd,useFormState:Yg,useActionState:Yg,useOptimistic:function(t){var a=On();a.memoizedState=a.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=ef.bind(null,Ve,!0,i),i.dispatch=a,[t,a]},useMemoCache:Fd,useCacheRefresh:function(){return On().memoizedState=Bw.bind(null,Ve)},useEffectEvent:function(t){var a=On(),i={impl:t};return a.memoizedState=i,function(){if((pt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},tf={readContext:Sn,use:ec,useCallback:l0,useContext:Sn,useEffect:Yd,useImperativeHandle:s0,useInsertionEffect:n0,useLayoutEffect:a0,useMemo:i0,useReducer:tc,useRef:Jg,useState:function(){return tc(br)},useDebugValue:Qd,useDeferredValue:function(t,a){var i=en();return o0(i,jt.memoizedState,t,a)},useTransition:function(){var t=tc(br)[0],a=en().memoizedState;return[typeof t=="boolean"?t:pi(t),a]},useSyncExternalStore:zg,useId:f0,useHostTransitionStatus:Jd,useFormState:Qg,useActionState:Qg,useOptimistic:function(t,a){var i=en();return qg(i,jt,t,a)},useMemoCache:Fd,useCacheRefresh:m0};tf.useEffectEvent=t0;var y0={readContext:Sn,use:ec,useCallback:l0,useContext:Sn,useEffect:Yd,useImperativeHandle:s0,useInsertionEffect:n0,useLayoutEffect:a0,useMemo:i0,useReducer:Gd,useRef:Jg,useState:function(){return Gd(br)},useDebugValue:Qd,useDeferredValue:function(t,a){var i=en();return jt===null?Xd(i,t,a):o0(i,jt.memoizedState,t,a)},useTransition:function(){var t=Gd(br)[0],a=en().memoizedState;return[typeof t=="boolean"?t:pi(t),a]},useSyncExternalStore:zg,useId:f0,useHostTransitionStatus:Jd,useFormState:Zg,useActionState:Zg,useOptimistic:function(t,a){var i=en();return jt!==null?qg(i,jt,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:Fd,useCacheRefresh:m0};y0.useEffectEvent=t0;function nf(t,a,i,u){a=t.memoizedState,i=i(u,a),i=i==null?a:y({},a,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var af={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=ia(),p=Fr(u);p.payload=a,i!=null&&(p.callback=i),a=Vr(t,p,u),a!==null&&(Yn(a,t,u),di(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=ia(),p=Fr(u);p.tag=1,p.payload=a,i!=null&&(p.callback=i),a=Vr(t,p,u),a!==null&&(Yn(a,t,u),di(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var i=ia(),u=Fr(i);u.tag=2,a!=null&&(u.callback=a),a=Vr(t,u,i),a!==null&&(Yn(a,t,i),di(a,t,i))}};function b0(t,a,i,u,p,b,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,b,S):a.prototype&&a.prototype.isPureReactComponent?!ai(i,u)||!ai(p,b):!0}function v0(t,a,i,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,u),a.state!==t&&af.enqueueReplaceState(a,a.state,null)}function Rs(t,a){var i=a;if("ref"in a){i={};for(var u in a)u!=="ref"&&(i[u]=a[u])}if(t=t.defaultProps){i===a&&(i=y({},i));for(var p in t)i[p]===void 0&&(i[p]=t[p])}return i}function k0(t){Oo(t)}function w0(t){console.error(t)}function S0(t){Oo(t)}function sc(t,a){try{var i=t.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function j0(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function rf(t,a,i){return i=Fr(i),i.tag=3,i.payload={element:null},i.callback=function(){sc(t,a)},i}function N0(t){return t=Fr(t),t.tag=3,t}function C0(t,a,i,u){var p=i.type.getDerivedStateFromError;if(typeof p=="function"){var b=u.value;t.payload=function(){return p(b)},t.callback=function(){j0(a,i,u)}}var S=i.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){j0(a,i,u),typeof p!="function"&&(Xr===null?Xr=new Set([this]):Xr.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function Pw(t,a,i,u,p){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&ml(a,i,p,!0),i=aa.current,i!==null){switch(i.tag){case 31:case 13:return Sa===null?xc():i.alternate===null&&Kt===0&&(Kt=3),i.flags&=-257,i.flags|=65536,i.lanes=p,u===Go?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),Af(t,u,p)),!1;case 22:return i.flags|=65536,u===Go?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([u]):i.add(u)),Af(t,u,p)),!1}throw Error(s(435,i.tag))}return Af(t,u,p),xc(),!1}if(rt)return a=aa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,u!==Sd&&(t=Error(s(422),{cause:u}),li(ba(t,i)))):(u!==Sd&&(a=Error(s(423),{cause:u}),li(ba(a,i))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,u=ba(u,i),p=rf(t.stateNode,u,p),Ld(t,p),Kt!==4&&(Kt=2)),!1;var b=Error(s(520),{cause:u});if(b=ba(b,i),Ni===null?Ni=[b]:Ni.push(b),Kt!==4&&(Kt=2),a===null)return!0;u=ba(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=p&-p,i.lanes|=t,t=rf(i.stateNode,u,t),Ld(i,t),!1;case 1:if(a=i.type,b=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Xr===null||!Xr.has(b))))return i.flags|=65536,p&=-p,i.lanes|=p,p=N0(p),C0(p,t,i,u),Ld(i,p),!1}i=i.return}while(i!==null);return!1}var sf=Error(s(461)),sn=!1;function jn(t,a,i,u){a.child=t===null?Ag(a,null,i,u):Es(a,t.child,i,u)}function T0(t,a,i,u,p){i=i.render;var b=a.ref;if("ref"in u){var S={};for(var _ in u)_!=="ref"&&(S[_]=u[_])}else S=u;return Ns(a),u=Bd(t,a,i,S,b,p),_=Hd(),t!==null&&!sn?(Pd(t,a,p),vr(t,a,p)):(rt&&_&&kd(a),a.flags|=1,jn(t,a,u,p),a.child)}function M0(t,a,i,u,p){if(t===null){var b=i.type;return typeof b=="function"&&!yd(b)&&b.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=b,E0(t,a,b,u,p)):(t=Bo(i.type,null,u,a,a.mode,p),t.ref=a.ref,t.return=a,a.child=t)}if(b=t.child,!hf(t,p)){var S=b.memoizedProps;if(i=i.compare,i=i!==null?i:ai,i(S,u)&&t.ref===a.ref)return vr(t,a,p)}return a.flags|=1,t=hr(b,u),t.ref=a.ref,t.return=a,a.child=t}function E0(t,a,i,u,p){if(t!==null){var b=t.memoizedProps;if(ai(b,u)&&t.ref===a.ref)if(sn=!1,a.pendingProps=u=b,hf(t,p))(t.flags&131072)!==0&&(sn=!0);else return a.lanes=t.lanes,vr(t,a,p)}return lf(t,a,i,u,p)}function A0(t,a,i,u){var p=u.children,b=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|i:i,t!==null){for(u=a.child=t.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~b}else u=0,a.child=null;return R0(t,a,b,i,u)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&Fo(a,b!==null?b.cachePool:null),b!==null?Ig(a,b):Od(),Lg(a);else return u=a.lanes=536870912,R0(t,a,b!==null?b.baseLanes|i:i,i,u)}else b!==null?(Fo(a,b.cachePool),Ig(a,b),Wr(),a.memoizedState=null):(t!==null&&Fo(a,null),Od(),Wr());return jn(t,a,p,i),a.child}function yi(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function R0(t,a,i,u,p){var b=Ad();return b=b===null?null:{parent:an._currentValue,pool:b},a.memoizedState={baseLanes:i,cachePool:b},t!==null&&Fo(a,null),Od(),Lg(a),t!==null&&ml(t,a,u,!0),a.childLanes=p,null}function lc(t,a){return a=oc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function _0(t,a,i){return Es(a,t.child,null,i),t=lc(a,a.pendingProps),t.flags|=2,ra(a),a.memoizedState=null,t}function qw(t,a,i){var u=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(rt){if(u.mode==="hidden")return t=lc(a,u),a.lanes=536870912,yi(null,t);if(Ud(a),(t=zt)?(t=Fx(t,wa),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:$r!==null?{id:Xa,overflow:Za}:null,retryLane:536870912,hydrationErrors:null},i=pg(t),i.return=a,a.child=i,wn=a,zt=null)):t=null,t===null)throw Hr(a);return a.lanes=536870912,null}return lc(a,u)}var b=t.memoizedState;if(b!==null){var S=b.dehydrated;if(Ud(a),p)if(a.flags&256)a.flags&=-257,a=_0(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(s(558));else if(sn||ml(t,a,i,!1),p=(i&t.childLanes)!==0,sn||p){if(u=Et,u!==null&&(S=Da(u,i),S!==0&&S!==b.retryLane))throw b.retryLane=S,ks(t,S),Yn(u,t,S),sf;xc(),a=_0(t,a,i)}else t=b.treeContext,zt=ja(S.nextSibling),wn=a,rt=!0,Br=null,wa=!1,t!==null&&yg(a,t),a=lc(a,u),a.flags|=4096;return a}return t=hr(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function ic(t,a){var i=a.ref;if(i===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(s(284));(t===null||t.ref!==i)&&(a.flags|=4194816)}}function lf(t,a,i,u,p){return Ns(a),i=Bd(t,a,i,u,void 0,p),u=Hd(),t!==null&&!sn?(Pd(t,a,p),vr(t,a,p)):(rt&&u&&kd(a),a.flags|=1,jn(t,a,i,p),a.child)}function I0(t,a,i,u,p,b){return Ns(a),a.updateQueue=null,i=Og(a,u,i,p),Dg(t),u=Hd(),t!==null&&!sn?(Pd(t,a,b),vr(t,a,b)):(rt&&u&&kd(a),a.flags|=1,jn(t,a,i,b),a.child)}function L0(t,a,i,u,p){if(Ns(a),a.stateNode===null){var b=cl,S=i.contextType;typeof S=="object"&&S!==null&&(b=Sn(S)),b=new i(u,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=af,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=u,b.state=a.memoizedState,b.refs={},_d(a),S=i.contextType,b.context=typeof S=="object"&&S!==null?Sn(S):cl,b.state=a.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(nf(a,i,S,u),b.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(S=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),S!==b.state&&af.enqueueReplaceState(b,b.state,null),mi(a,u,b,p),fi(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){b=a.stateNode;var _=a.memoizedProps,F=Rs(i,_);b.props=F;var ee=b.context,de=i.contextType;S=cl,typeof de=="object"&&de!==null&&(S=Sn(de));var me=i.getDerivedStateFromProps;de=typeof me=="function"||typeof b.getSnapshotBeforeUpdate=="function",_=a.pendingProps!==_,de||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(_||ee!==S)&&v0(a,b,u,S),qr=!1;var ne=a.memoizedState;b.state=ne,mi(a,u,b,p),fi(),ee=a.memoizedState,_||ne!==ee||qr?(typeof me=="function"&&(nf(a,i,me,u),ee=a.memoizedState),(F=qr||b0(a,i,F,u,ne,ee,S))?(de||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=ee),b.props=u,b.state=ee,b.context=S,u=F):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{b=a.stateNode,Id(t,a),S=a.memoizedProps,de=Rs(i,S),b.props=de,me=a.pendingProps,ne=b.context,ee=i.contextType,F=cl,typeof ee=="object"&&ee!==null&&(F=Sn(ee)),_=i.getDerivedStateFromProps,(ee=typeof _=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(S!==me||ne!==F)&&v0(a,b,u,F),qr=!1,ne=a.memoizedState,b.state=ne,mi(a,u,b,p),fi();var le=a.memoizedState;S!==me||ne!==le||qr||t!==null&&t.dependencies!==null&&Po(t.dependencies)?(typeof _=="function"&&(nf(a,i,_,u),le=a.memoizedState),(de=qr||b0(a,i,de,u,ne,le,F)||t!==null&&t.dependencies!==null&&Po(t.dependencies))?(ee||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(u,le,F),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(u,le,F)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||S===t.memoizedProps&&ne===t.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&ne===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=le),b.props=u,b.state=le,b.context=F,u=de):(typeof b.componentDidUpdate!="function"||S===t.memoizedProps&&ne===t.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&ne===t.memoizedState||(a.flags|=1024),u=!1)}return b=u,ic(t,a),u=(a.flags&128)!==0,b||u?(b=a.stateNode,i=u&&typeof i.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,t!==null&&u?(a.child=Es(a,t.child,null,p),a.child=Es(a,null,i,p)):jn(t,a,i,p),a.memoizedState=b.state,t=a.child):t=vr(t,a,p),t}function D0(t,a,i,u){return Ss(),a.flags|=256,jn(t,a,i,u),a.child}var of={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cf(t){return{baseLanes:t,cachePool:jg()}}function uf(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=la),t}function O0(t,a,i){var u=a.pendingProps,p=!1,b=(a.flags&128)!==0,S;if((S=b)||(S=t!==null&&t.memoizedState===null?!1:(Jt.current&2)!==0),S&&(p=!0,a.flags&=-129),S=(a.flags&32)!==0,a.flags&=-33,t===null){if(rt){if(p?Gr(a):Wr(),(t=zt)?(t=Fx(t,wa),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:$r!==null?{id:Xa,overflow:Za}:null,retryLane:536870912,hydrationErrors:null},i=pg(t),i.return=a,a.child=i,wn=a,zt=null)):t=null,t===null)throw Hr(a);return Gf(t)?a.lanes=32:a.lanes=536870912,null}var _=u.children;return u=u.fallback,p?(Wr(),p=a.mode,_=oc({mode:"hidden",children:_},p),u=ws(u,p,i,null),_.return=a,u.return=a,_.sibling=u,a.child=_,u=a.child,u.memoizedState=cf(i),u.childLanes=uf(t,S,i),a.memoizedState=of,yi(null,u)):(Gr(a),df(a,_))}var F=t.memoizedState;if(F!==null&&(_=F.dehydrated,_!==null)){if(b)a.flags&256?(Gr(a),a.flags&=-257,a=ff(t,a,i)):a.memoizedState!==null?(Wr(),a.child=t.child,a.flags|=128,a=null):(Wr(),_=u.fallback,p=a.mode,u=oc({mode:"visible",children:u.children},p),_=ws(_,p,i,null),_.flags|=2,u.return=a,_.return=a,u.sibling=_,a.child=u,Es(a,t.child,null,i),u=a.child,u.memoizedState=cf(i),u.childLanes=uf(t,S,i),a.memoizedState=of,a=yi(null,u));else if(Gr(a),Gf(_)){if(S=_.nextSibling&&_.nextSibling.dataset,S)var ee=S.dgst;S=ee,u=Error(s(419)),u.stack="",u.digest=S,li({value:u,source:null,stack:null}),a=ff(t,a,i)}else if(sn||ml(t,a,i,!1),S=(i&t.childLanes)!==0,sn||S){if(S=Et,S!==null&&(u=Da(S,i),u!==0&&u!==F.retryLane))throw F.retryLane=u,ks(t,u),Yn(S,t,u),sf;Vf(_)||xc(),a=ff(t,a,i)}else Vf(_)?(a.flags|=192,a.child=t.child,a=null):(t=F.treeContext,zt=ja(_.nextSibling),wn=a,rt=!0,Br=null,wa=!1,t!==null&&yg(a,t),a=df(a,u.children),a.flags|=4096);return a}return p?(Wr(),_=u.fallback,p=a.mode,F=t.child,ee=F.sibling,u=hr(F,{mode:"hidden",children:u.children}),u.subtreeFlags=F.subtreeFlags&65011712,ee!==null?_=hr(ee,_):(_=ws(_,p,i,null),_.flags|=2),_.return=a,u.return=a,u.sibling=_,a.child=u,yi(null,u),u=a.child,_=t.child.memoizedState,_===null?_=cf(i):(p=_.cachePool,p!==null?(F=an._currentValue,p=p.parent!==F?{parent:F,pool:F}:p):p=jg(),_={baseLanes:_.baseLanes|i,cachePool:p}),u.memoizedState=_,u.childLanes=uf(t,S,i),a.memoizedState=of,yi(t.child,u)):(Gr(a),i=t.child,t=i.sibling,i=hr(i,{mode:"visible",children:u.children}),i.return=a,i.sibling=null,t!==null&&(S=a.deletions,S===null?(a.deletions=[t],a.flags|=16):S.push(t)),a.child=i,a.memoizedState=null,i)}function df(t,a){return a=oc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function oc(t,a){return t=na(22,t,null,a),t.lanes=0,t}function ff(t,a,i){return Es(a,t.child,null,i),t=df(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function z0(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),Cd(t.return,a,i)}function mf(t,a,i,u,p,b){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p,treeForkCount:b}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=u,S.tail=i,S.tailMode=p,S.treeForkCount=b)}function U0(t,a,i){var u=a.pendingProps,p=u.revealOrder,b=u.tail;u=u.children;var S=Jt.current,_=(S&2)!==0;if(_?(S=S&1|2,a.flags|=128):S&=1,j(Jt,S),jn(t,a,u,i),u=rt?si:0,!_&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&z0(t,i,a);else if(t.tag===19)z0(t,i,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(i=a.child,p=null;i!==null;)t=i.alternate,t!==null&&Qo(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=a.child,a.child=null):(p=i.sibling,i.sibling=null),mf(a,!1,p,i,b,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,p=a.child,a.child=null;p!==null;){if(t=p.alternate,t!==null&&Qo(t)===null){a.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}mf(a,!0,i,null,b,u);break;case"together":mf(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function vr(t,a,i){if(t!==null&&(a.dependencies=t.dependencies),Qr|=a.lanes,(i&a.childLanes)===0)if(t!==null){if(ml(t,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(s(153));if(a.child!==null){for(t=a.child,i=hr(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=hr(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function hf(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Po(t)))}function Fw(t,a,i){switch(a.tag){case 3:Se(a,a.stateNode.containerInfo),Pr(a,an,t.memoizedState.cache),Ss();break;case 27:case 5:he(a);break;case 4:Se(a,a.stateNode.containerInfo);break;case 10:Pr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Ud(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Gr(a),a.flags|=128,null):(i&a.child.childLanes)!==0?O0(t,a,i):(Gr(a),t=vr(t,a,i),t!==null?t.sibling:null);Gr(a);break;case 19:var p=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(ml(t,a,i,!1),u=(i&a.childLanes)!==0),p){if(u)return U0(t,a,i);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),j(Jt,Jt.current),u)break;return null;case 22:return a.lanes=0,A0(t,a,i,a.pendingProps);case 24:Pr(a,an,t.memoizedState.cache)}return vr(t,a,i)}function $0(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)sn=!0;else{if(!hf(t,i)&&(a.flags&128)===0)return sn=!1,Fw(t,a,i);sn=(t.flags&131072)!==0}else sn=!1,rt&&(a.flags&1048576)!==0&&xg(a,si,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Ts(a.elementType),a.type=t,typeof t=="function")yd(t)?(u=Rs(t,u),a.tag=1,a=L0(null,a,t,u,i)):(a.tag=0,a=lf(null,a,t,u,i));else{if(t!=null){var p=t.$$typeof;if(p===P){a.tag=11,a=T0(null,a,t,u,i);break e}else if(p===$){a.tag=14,a=M0(null,a,t,u,i);break e}}throw a=te(t)||t,Error(s(306,a,""))}}return a;case 0:return lf(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,p=Rs(u,a.pendingProps),L0(t,a,u,p,i);case 3:e:{if(Se(a,a.stateNode.containerInfo),t===null)throw Error(s(387));u=a.pendingProps;var b=a.memoizedState;p=b.element,Id(t,a),mi(a,u,null,i);var S=a.memoizedState;if(u=S.cache,Pr(a,an,u),u!==b.cache&&Td(a,[an],i,!0),fi(),u=S.element,b.isDehydrated)if(b={element:u,isDehydrated:!1,cache:S.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=D0(t,a,u,i);break e}else if(u!==p){p=ba(Error(s(424)),a),li(p),a=D0(t,a,u,i);break e}else for(t=a.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,zt=ja(t.firstChild),wn=a,rt=!0,Br=null,wa=!0,i=Ag(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Ss(),u===p){a=vr(t,a,i);break e}jn(t,a,u,i)}a=a.child}return a;case 26:return ic(t,a),t===null?(i=Qx(a.type,null,a.pendingProps,null))?a.memoizedState=i:rt||(i=a.type,t=a.pendingProps,u=jc(oe.current).createElement(i),u[Lt]=a,u[Vt]=t,Nn(u,i,t),Dt(u),a.stateNode=u):a.memoizedState=Qx(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return he(a),t===null&&rt&&(u=a.stateNode=Wx(a.type,a.pendingProps,oe.current),wn=a,wa=!0,p=zt,ts(a.type)?(Wf=p,zt=ja(u.firstChild)):zt=p),jn(t,a,a.pendingProps.children,i),ic(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&rt&&((p=u=zt)&&(u=vS(u,a.type,a.pendingProps,wa),u!==null?(a.stateNode=u,wn=a,zt=ja(u.firstChild),wa=!1,p=!0):p=!1),p||Hr(a)),he(a),p=a.type,b=a.pendingProps,S=t!==null?t.memoizedProps:null,u=b.children,Pf(p,b)?u=null:S!==null&&Pf(p,S)&&(a.flags|=32),a.memoizedState!==null&&(p=Bd(t,a,Dw,null,null,i),Ii._currentValue=p),ic(t,a),jn(t,a,u,i),a.child;case 6:return t===null&&rt&&((t=i=zt)&&(i=kS(i,a.pendingProps,wa),i!==null?(a.stateNode=i,wn=a,zt=null,t=!0):t=!1),t||Hr(a)),null;case 13:return O0(t,a,i);case 4:return Se(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Es(a,null,u,i):jn(t,a,u,i),a.child;case 11:return T0(t,a,a.type,a.pendingProps,i);case 7:return jn(t,a,a.pendingProps,i),a.child;case 8:return jn(t,a,a.pendingProps.children,i),a.child;case 12:return jn(t,a,a.pendingProps.children,i),a.child;case 10:return u=a.pendingProps,Pr(a,a.type,u.value),jn(t,a,u.children,i),a.child;case 9:return p=a.type._context,u=a.pendingProps.children,Ns(a),p=Sn(p),u=u(p),a.flags|=1,jn(t,a,u,i),a.child;case 14:return M0(t,a,a.type,a.pendingProps,i);case 15:return E0(t,a,a.type,a.pendingProps,i);case 19:return U0(t,a,i);case 31:return qw(t,a,i);case 22:return A0(t,a,i,a.pendingProps);case 24:return Ns(a),u=Sn(an),t===null?(p=Ad(),p===null&&(p=Et,b=Md(),p.pooledCache=b,b.refCount++,b!==null&&(p.pooledCacheLanes|=i),p=b),a.memoizedState={parent:u,cache:p},_d(a),Pr(a,an,p)):((t.lanes&i)!==0&&(Id(t,a),mi(a,null,null,i),fi()),p=t.memoizedState,b=a.memoizedState,p.parent!==u?(p={parent:u,cache:u},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),Pr(a,an,u)):(u=b.cache,Pr(a,an,u),u!==p.cache&&Td(a,[an],i,!0))),jn(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function kr(t){t.flags|=4}function pf(t,a,i,u,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(fx())t.flags|=8192;else throw Ms=Go,Rd}else t.flags&=-16777217}function B0(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!ty(a))if(fx())t.flags|=8192;else throw Ms=Go,Rd}function cc(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Me():536870912,t.lanes|=a,Nl|=a)}function bi(t,a){if(!rt)switch(t.tailMode){case"hidden":a=t.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Ut(t){var a=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(a)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function Vw(t,a,i){var u=a.pendingProps;switch(wd(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(a),null;case 1:return Ut(a),null;case 3:return i=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),xr(an),ie(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(fl(a)?kr(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,jd())),Ut(a),null;case 26:var p=a.type,b=a.memoizedState;return t===null?(kr(a),b!==null?(Ut(a),B0(a,b)):(Ut(a),pf(a,p,null,u,i))):b?b!==t.memoizedState?(kr(a),Ut(a),B0(a,b)):(Ut(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&kr(a),Ut(a),pf(a,p,t,u,i)),null;case 27:if(be(a),i=oe.current,p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&kr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Ut(a),null}t=K.current,fl(a)?bg(a):(t=Wx(p,u,i),a.stateNode=t,kr(a))}return Ut(a),null;case 5:if(be(a),p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&kr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Ut(a),null}if(b=K.current,fl(a))bg(a);else{var S=jc(oe.current);switch(b){case 1:b=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:b=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":b=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":b=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":b=S.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof u.is=="string"?S.createElement("select",{is:u.is}):S.createElement("select"),u.multiple?b.multiple=!0:u.size&&(b.size=u.size);break;default:b=typeof u.is=="string"?S.createElement(p,{is:u.is}):S.createElement(p)}}b[Lt]=a,b[Vt]=u;e:for(S=a.child;S!==null;){if(S.tag===5||S.tag===6)b.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=b;e:switch(Nn(b,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&kr(a)}}return Ut(a),pf(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&kr(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(s(166));if(t=oe.current,fl(a)){if(t=a.stateNode,i=a.memoizedProps,u=null,p=wn,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}t[Lt]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||Ox(t.nodeValue,i)),t||Hr(a,!0)}else t=jc(t).createTextNode(u),t[Lt]=a,a.stateNode=t}return Ut(a),null;case 31:if(i=a.memoizedState,t===null||t.memoizedState!==null){if(u=fl(a),i!==null){if(t===null){if(!u)throw Error(s(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Lt]=a}else Ss(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),t=!1}else i=jd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return a.flags&256?(ra(a),a):(ra(a),null);if((a.flags&128)!==0)throw Error(s(558))}return Ut(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=fl(a),u!==null&&u.dehydrated!==null){if(t===null){if(!p)throw Error(s(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(s(317));p[Lt]=a}else Ss(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),p=!1}else p=jd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(ra(a),a):(ra(a),null)}return ra(a),(a.flags&128)!==0?(a.lanes=i,a):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=a.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),b=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),b!==p&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),cc(a,a.updateQueue),Ut(a),null);case 4:return ie(),t===null&&zf(a.stateNode.containerInfo),Ut(a),null;case 10:return xr(a.type),Ut(a),null;case 19:if(U(Jt),u=a.memoizedState,u===null)return Ut(a),null;if(p=(a.flags&128)!==0,b=u.rendering,b===null)if(p)bi(u,!1);else{if(Kt!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(b=Qo(t),b!==null){for(a.flags|=128,bi(u,!1),t=b.updateQueue,a.updateQueue=t,cc(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)hg(i,t),i=i.sibling;return j(Jt,Jt.current&1|2),rt&&pr(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&St()>hc&&(a.flags|=128,p=!0,bi(u,!1),a.lanes=4194304)}else{if(!p)if(t=Qo(b),t!==null){if(a.flags|=128,p=!0,t=t.updateQueue,a.updateQueue=t,cc(a,t),bi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!b.alternate&&!rt)return Ut(a),null}else 2*St()-u.renderingStartTime>hc&&i!==536870912&&(a.flags|=128,p=!0,bi(u,!1),a.lanes=4194304);u.isBackwards?(b.sibling=a.child,a.child=b):(t=u.last,t!==null?t.sibling=b:a.child=b,u.last=b)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=St(),t.sibling=null,i=Jt.current,j(Jt,p?i&1|2:i&1),rt&&pr(a,u.treeForkCount),t):(Ut(a),null);case 22:case 23:return ra(a),zd(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(i&536870912)!==0&&(a.flags&128)===0&&(Ut(a),a.subtreeFlags&6&&(a.flags|=8192)):Ut(a),i=a.updateQueue,i!==null&&cc(a,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==i&&(a.flags|=2048),t!==null&&U(Cs),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),xr(an),Ut(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function Gw(t,a){switch(wd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return xr(an),ie(),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(ra(a),a.alternate===null)throw Error(s(340));Ss()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(ra(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(s(340));Ss()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return U(Jt),null;case 4:return ie(),null;case 10:return xr(a.type),null;case 22:case 23:return ra(a),zd(),t!==null&&U(Cs),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return xr(an),null;case 25:return null;default:return null}}function H0(t,a){switch(wd(a),a.tag){case 3:xr(an),ie();break;case 26:case 27:case 5:be(a);break;case 4:ie();break;case 31:a.memoizedState!==null&&ra(a);break;case 13:ra(a);break;case 19:U(Jt);break;case 10:xr(a.type);break;case 22:case 23:ra(a),zd(),t!==null&&U(Cs);break;case 24:xr(an)}}function vi(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var p=u.next;i=p;do{if((i.tag&t)===t){u=void 0;var b=i.create,S=i.inst;u=b(),S.destroy=u}i=i.next}while(i!==p)}}catch(_){vt(a,a.return,_)}}function Kr(t,a,i){try{var u=a.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var b=p.next;u=b;do{if((u.tag&t)===t){var S=u.inst,_=S.destroy;if(_!==void 0){S.destroy=void 0,p=a;var F=i,ee=_;try{ee()}catch(de){vt(p,F,de)}}}u=u.next}while(u!==b)}}catch(de){vt(a,a.return,de)}}function P0(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{_g(a,i)}catch(u){vt(t,t.return,u)}}}function q0(t,a,i){i.props=Rs(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){vt(t,a,u)}}function ki(t,a){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof i=="function"?t.refCleanup=i(u):i.current=u}}catch(p){vt(t,a,p)}}function Ja(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(p){vt(t,a,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(p){vt(t,a,p)}else i.current=null}function F0(t){var a=t.type,i=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(p){vt(t,t.return,p)}}function gf(t,a,i){try{var u=t.stateNode;hS(u,t.type,i,a),u[Vt]=a}catch(p){vt(t,t.return,p)}}function V0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ts(t.type)||t.tag===4}function xf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||V0(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&&ts(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 yf(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(t),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=fr));else if(u!==4&&(u===27&&ts(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(yf(t,a,i),t=t.sibling;t!==null;)yf(t,a,i),t=t.sibling}function uc(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?i.insertBefore(t,a):i.appendChild(t);else if(u!==4&&(u===27&&ts(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(uc(t,a,i),t=t.sibling;t!==null;)uc(t,a,i),t=t.sibling}function G0(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);Nn(a,u,i),a[Lt]=t,a[Vt]=i}catch(b){vt(t,t.return,b)}}var wr=!1,ln=!1,bf=!1,W0=typeof WeakSet=="function"?WeakSet:Set,bn=null;function Ww(t,a){if(t=t.containerInfo,Bf=Rc,t=sg(t),dd(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,b=u.focusNode;u=u.focusOffset;try{i.nodeType,b.nodeType}catch{i=null;break e}var S=0,_=-1,F=-1,ee=0,de=0,me=t,ne=null;t:for(;;){for(var le;me!==i||p!==0&&me.nodeType!==3||(_=S+p),me!==b||u!==0&&me.nodeType!==3||(F=S+u),me.nodeType===3&&(S+=me.nodeValue.length),(le=me.firstChild)!==null;)ne=me,me=le;for(;;){if(me===t)break t;if(ne===i&&++ee===p&&(_=S),ne===b&&++de===u&&(F=S),(le=me.nextSibling)!==null)break;me=ne,ne=me.parentNode}me=le}i=_===-1||F===-1?null:{start:_,end:F}}else i=null}i=i||{start:0,end:0}}else i=null;for(Hf={focusedElem:t,selectionRange:i},Rc=!1,bn=a;bn!==null;)if(a=bn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,bn=t;else for(;bn!==null;){switch(a=bn,b=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(i=0;i<t.length;i++)p=t[i],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&b!==null){t=void 0,i=a,p=b.memoizedProps,b=b.memoizedState,u=i.stateNode;try{var Ne=Rs(i.type,p);t=u.getSnapshotBeforeUpdate(Ne,b),u.__reactInternalSnapshotBeforeUpdate=t}catch(Oe){vt(i,i.return,Oe)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,i=t.nodeType,i===9)Ff(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Ff(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(s(163))}if(t=a.sibling,t!==null){t.return=a.return,bn=t;break}bn=a.return}}function K0(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:jr(t,i),u&4&&vi(5,i);break;case 1:if(jr(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(S){vt(i,i.return,S)}else{var p=Rs(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(p,a,t.__reactInternalSnapshotBeforeUpdate)}catch(S){vt(i,i.return,S)}}u&64&&P0(i),u&512&&ki(i,i.return);break;case 3:if(jr(t,i),u&64&&(t=i.updateQueue,t!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{_g(t,a)}catch(S){vt(i,i.return,S)}}break;case 27:a===null&&u&4&&G0(i);case 26:case 5:jr(t,i),a===null&&u&4&&F0(i),u&512&&ki(i,i.return);break;case 12:jr(t,i);break;case 31:jr(t,i),u&4&&X0(t,i);break;case 13:jr(t,i),u&4&&Z0(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=nS.bind(null,i),wS(t,i))));break;case 22:if(u=i.memoizedState!==null||wr,!u){a=a!==null&&a.memoizedState!==null||ln,p=wr;var b=ln;wr=u,(ln=a)&&!b?Nr(t,i,(i.subtreeFlags&8772)!==0):jr(t,i),wr=p,ln=b}break;case 30:break;default:jr(t,i)}}function Y0(t){var a=t.alternate;a!==null&&(t.alternate=null,Y0(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&Ln(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 Ht=null,Vn=!1;function Sr(t,a,i){for(i=i.child;i!==null;)Q0(t,a,i),i=i.sibling}function Q0(t,a,i){if(Ke&&typeof Ke.onCommitFiberUnmount=="function")try{Ke.onCommitFiberUnmount(ht,i)}catch{}switch(i.tag){case 26:ln||Ja(i,a),Sr(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:ln||Ja(i,a);var u=Ht,p=Vn;ts(i.type)&&(Ht=i.stateNode,Vn=!1),Sr(t,a,i),Ai(i.stateNode),Ht=u,Vn=p;break;case 5:ln||Ja(i,a);case 6:if(u=Ht,p=Vn,Ht=null,Sr(t,a,i),Ht=u,Vn=p,Ht!==null)if(Vn)try{(Ht.nodeType===9?Ht.body:Ht.nodeName==="HTML"?Ht.ownerDocument.body:Ht).removeChild(i.stateNode)}catch(b){vt(i,a,b)}else try{Ht.removeChild(i.stateNode)}catch(b){vt(i,a,b)}break;case 18:Ht!==null&&(Vn?(t=Ht,Px(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),Il(t)):Px(Ht,i.stateNode));break;case 4:u=Ht,p=Vn,Ht=i.stateNode.containerInfo,Vn=!0,Sr(t,a,i),Ht=u,Vn=p;break;case 0:case 11:case 14:case 15:Kr(2,i,a),ln||Kr(4,i,a),Sr(t,a,i);break;case 1:ln||(Ja(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&q0(i,a,u)),Sr(t,a,i);break;case 21:Sr(t,a,i);break;case 22:ln=(u=ln)||i.memoizedState!==null,Sr(t,a,i),ln=u;break;default:Sr(t,a,i)}}function X0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Il(t)}catch(i){vt(a,a.return,i)}}}function Z0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Il(t)}catch(i){vt(a,a.return,i)}}function Kw(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new W0),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new W0),a;default:throw Error(s(435,t.tag))}}function dc(t,a){var i=Kw(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var p=aS.bind(null,t,u);u.then(p,p)}})}function Gn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u],b=t,S=a,_=S;e:for(;_!==null;){switch(_.tag){case 27:if(ts(_.type)){Ht=_.stateNode,Vn=!1;break e}break;case 5:Ht=_.stateNode,Vn=!1;break e;case 3:case 4:Ht=_.stateNode.containerInfo,Vn=!0;break e}_=_.return}if(Ht===null)throw Error(s(160));Q0(b,S,p),Ht=null,Vn=!1,b=p.alternate,b!==null&&(b.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)J0(a,t),a=a.sibling}var Ba=null;function J0(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Gn(a,t),Wn(t),u&4&&(Kr(3,t,t.return),vi(3,t),Kr(5,t,t.return));break;case 1:Gn(a,t),Wn(t),u&512&&(ln||i===null||Ja(i,i.return)),u&64&&wr&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(i=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=i===null?u:i.concat(u))));break;case 26:var p=Ba;if(Gn(a,t),Wn(t),u&512&&(ln||i===null||Ja(i,i.return)),u&4){var b=i!==null?i.memoizedState:null;if(u=t.memoizedState,i===null)if(u===null)if(t.stateNode===null){e:{u=t.type,i=t.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":b=p.getElementsByTagName("title")[0],(!b||b[Pn]||b[Lt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=p.createElement(u),p.head.insertBefore(b,p.querySelector("head > title"))),Nn(b,u,i),b[Lt]=t,Dt(b),u=b;break e;case"link":var S=Jx("link","href",p).get(u+(i.href||""));if(S){for(var _=0;_<S.length;_++)if(b=S[_],b.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&b.getAttribute("rel")===(i.rel==null?null:i.rel)&&b.getAttribute("title")===(i.title==null?null:i.title)&&b.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){S.splice(_,1);break t}}b=p.createElement(u),Nn(b,u,i),p.head.appendChild(b);break;case"meta":if(S=Jx("meta","content",p).get(u+(i.content||""))){for(_=0;_<S.length;_++)if(b=S[_],b.getAttribute("content")===(i.content==null?null:""+i.content)&&b.getAttribute("name")===(i.name==null?null:i.name)&&b.getAttribute("property")===(i.property==null?null:i.property)&&b.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&b.getAttribute("charset")===(i.charSet==null?null:i.charSet)){S.splice(_,1);break t}}b=p.createElement(u),Nn(b,u,i),p.head.appendChild(b);break;default:throw Error(s(468,u))}b[Lt]=t,Dt(b),u=b}t.stateNode=u}else ey(p,t.type,t.stateNode);else t.stateNode=Zx(p,u,t.memoizedProps);else b!==u?(b===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):b.count--,u===null?ey(p,t.type,t.stateNode):Zx(p,u,t.memoizedProps)):u===null&&t.stateNode!==null&&gf(t,t.memoizedProps,i.memoizedProps)}break;case 27:Gn(a,t),Wn(t),u&512&&(ln||i===null||Ja(i,i.return)),i!==null&&u&4&&gf(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Gn(a,t),Wn(t),u&512&&(ln||i===null||Ja(i,i.return)),t.flags&32){p=t.stateNode;try{nl(p,"")}catch(Ne){vt(t,t.return,Ne)}}u&4&&t.stateNode!=null&&(p=t.memoizedProps,gf(t,p,i!==null?i.memoizedProps:p)),u&1024&&(bf=!0);break;case 6:if(Gn(a,t),Wn(t),u&4){if(t.stateNode===null)throw Error(s(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(Ne){vt(t,t.return,Ne)}}break;case 3:if(Tc=null,p=Ba,Ba=Nc(a.containerInfo),Gn(a,t),Ba=p,Wn(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Il(a.containerInfo)}catch(Ne){vt(t,t.return,Ne)}bf&&(bf=!1,ex(t));break;case 4:u=Ba,Ba=Nc(t.stateNode.containerInfo),Gn(a,t),Wn(t),Ba=u;break;case 12:Gn(a,t),Wn(t);break;case 31:Gn(a,t),Wn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,dc(t,u)));break;case 13:Gn(a,t),Wn(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(mc=St()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,dc(t,u)));break;case 22:p=t.memoizedState!==null;var F=i!==null&&i.memoizedState!==null,ee=wr,de=ln;if(wr=ee||p,ln=de||F,Gn(a,t),ln=de,wr=ee,Wn(t),u&8192)e:for(a=t.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(i===null||F||wr||ln||_s(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){F=i=a;try{if(b=F.stateNode,p)S=b.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{_=F.stateNode;var me=F.memoizedProps.style,ne=me!=null&&me.hasOwnProperty("display")?me.display:null;_.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ne){vt(F,F.return,Ne)}}}else if(a.tag===6){if(i===null){F=a;try{F.stateNode.nodeValue=p?"":F.memoizedProps}catch(Ne){vt(F,F.return,Ne)}}}else if(a.tag===18){if(i===null){F=a;try{var le=F.stateNode;p?qx(le,!0):qx(F.stateNode,!1)}catch(Ne){vt(F,F.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;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(i=u.retryQueue,i!==null&&(u.retryQueue=null,dc(t,i))));break;case 19:Gn(a,t),Wn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,dc(t,u)));break;case 30:break;case 21:break;default:Gn(a,t),Wn(t)}}function Wn(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(V0(u)){i=u;break}u=u.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var p=i.stateNode,b=xf(t);uc(t,b,p);break;case 5:var S=i.stateNode;i.flags&32&&(nl(S,""),i.flags&=-33);var _=xf(t);uc(t,_,S);break;case 3:case 4:var F=i.stateNode.containerInfo,ee=xf(t);yf(t,ee,F);break;default:throw Error(s(161))}}catch(de){vt(t,t.return,de)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function ex(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;ex(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function jr(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)K0(t,a.alternate,a),a=a.sibling}function _s(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:Kr(4,a,a.return),_s(a);break;case 1:Ja(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&q0(a,a.return,i),_s(a);break;case 27:Ai(a.stateNode);case 26:case 5:Ja(a,a.return),_s(a);break;case 22:a.memoizedState===null&&_s(a);break;case 30:_s(a);break;default:_s(a)}t=t.sibling}}function Nr(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,p=t,b=a,S=b.flags;switch(b.tag){case 0:case 11:case 15:Nr(p,b,i),vi(4,b);break;case 1:if(Nr(p,b,i),u=b,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(ee){vt(u,u.return,ee)}if(u=b,p=u.updateQueue,p!==null){var _=u.stateNode;try{var F=p.shared.hiddenCallbacks;if(F!==null)for(p.shared.hiddenCallbacks=null,p=0;p<F.length;p++)Rg(F[p],_)}catch(ee){vt(u,u.return,ee)}}i&&S&64&&P0(b),ki(b,b.return);break;case 27:G0(b);case 26:case 5:Nr(p,b,i),i&&u===null&&S&4&&F0(b),ki(b,b.return);break;case 12:Nr(p,b,i);break;case 31:Nr(p,b,i),i&&S&4&&X0(p,b);break;case 13:Nr(p,b,i),i&&S&4&&Z0(p,b);break;case 22:b.memoizedState===null&&Nr(p,b,i),ki(b,b.return);break;case 30:break;default:Nr(p,b,i)}a=a.sibling}}function vf(t,a){var i=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==i&&(t!=null&&t.refCount++,i!=null&&ii(i))}function kf(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ii(t))}function Ha(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)tx(t,a,i,u),a=a.sibling}function tx(t,a,i,u){var p=a.flags;switch(a.tag){case 0:case 11:case 15:Ha(t,a,i,u),p&2048&&vi(9,a);break;case 1:Ha(t,a,i,u);break;case 3:Ha(t,a,i,u),p&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ii(t)));break;case 12:if(p&2048){Ha(t,a,i,u),t=a.stateNode;try{var b=a.memoizedProps,S=b.id,_=b.onPostCommit;typeof _=="function"&&_(S,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(F){vt(a,a.return,F)}}else Ha(t,a,i,u);break;case 31:Ha(t,a,i,u);break;case 13:Ha(t,a,i,u);break;case 23:break;case 22:b=a.stateNode,S=a.alternate,a.memoizedState!==null?b._visibility&2?Ha(t,a,i,u):wi(t,a):b._visibility&2?Ha(t,a,i,u):(b._visibility|=2,wl(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),p&2048&&vf(S,a);break;case 24:Ha(t,a,i,u),p&2048&&kf(a.alternate,a);break;default:Ha(t,a,i,u)}}function wl(t,a,i,u,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=t,S=a,_=i,F=u,ee=S.flags;switch(S.tag){case 0:case 11:case 15:wl(b,S,_,F,p),vi(8,S);break;case 23:break;case 22:var de=S.stateNode;S.memoizedState!==null?de._visibility&2?wl(b,S,_,F,p):wi(b,S):(de._visibility|=2,wl(b,S,_,F,p)),p&&ee&2048&&vf(S.alternate,S);break;case 24:wl(b,S,_,F,p),p&&ee&2048&&kf(S.alternate,S);break;default:wl(b,S,_,F,p)}a=a.sibling}}function wi(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,p=u.flags;switch(u.tag){case 22:wi(i,u),p&2048&&vf(u.alternate,u);break;case 24:wi(i,u),p&2048&&kf(u.alternate,u);break;default:wi(i,u)}a=a.sibling}}var Si=8192;function Sl(t,a,i){if(t.subtreeFlags&Si)for(t=t.child;t!==null;)nx(t,a,i),t=t.sibling}function nx(t,a,i){switch(t.tag){case 26:Sl(t,a,i),t.flags&Si&&t.memoizedState!==null&&LS(i,Ba,t.memoizedState,t.memoizedProps);break;case 5:Sl(t,a,i);break;case 3:case 4:var u=Ba;Ba=Nc(t.stateNode.containerInfo),Sl(t,a,i),Ba=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=Si,Si=16777216,Sl(t,a,i),Si=u):Sl(t,a,i));break;default:Sl(t,a,i)}}function ax(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 ji(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];bn=u,sx(u,t)}ax(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)rx(t),t=t.sibling}function rx(t){switch(t.tag){case 0:case 11:case 15:ji(t),t.flags&2048&&Kr(9,t,t.return);break;case 3:ji(t);break;case 12:ji(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,fc(t)):ji(t);break;default:ji(t)}}function fc(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];bn=u,sx(u,t)}ax(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:Kr(8,a,a.return),fc(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,fc(a));break;default:fc(a)}t=t.sibling}}function sx(t,a){for(;bn!==null;){var i=bn;switch(i.tag){case 0:case 11:case 15:Kr(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var u=i.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:ii(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,bn=u;else e:for(i=t;bn!==null;){u=bn;var p=u.sibling,b=u.return;if(Y0(u),u===i){bn=null;break e}if(p!==null){p.return=b,bn=p;break e}bn=b}}}var Yw={getCacheForType:function(t){var a=Sn(an),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return Sn(an).controller.signal}},Qw=typeof WeakMap=="function"?WeakMap:Map,pt=0,Et=null,Xe=null,et=0,bt=0,sa=null,Yr=!1,jl=!1,wf=!1,Cr=0,Kt=0,Qr=0,Is=0,Sf=0,la=0,Nl=0,Ni=null,Kn=null,jf=!1,mc=0,lx=0,hc=1/0,pc=null,Xr=null,fn=0,Zr=null,Cl=null,Tr=0,Nf=0,Cf=null,ix=null,Ci=0,Tf=null;function ia(){return(pt&2)!==0&&et!==0?et&-et:z.T!==null?If():Lr()}function ox(){if(la===0)if((et&536870912)===0||rt){var t=_n;_n<<=1,(_n&3932160)===0&&(_n=262144),la=t}else la=536870912;return t=aa.current,t!==null&&(t.flags|=32),la}function Yn(t,a,i){(t===Et&&(bt===2||bt===9)||t.cancelPendingCommit!==null)&&(Tl(t,0),Jr(t,et,la,!1)),yt(t,i),((pt&2)===0||t!==Et)&&(t===Et&&((pt&2)===0&&(Is|=i),Kt===4&&Jr(t,et,la,!1)),er(t))}function cx(t,a,i){if((pt&6)!==0)throw Error(s(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||ga(t,a),p=u?Jw(t,a):Ef(t,a,!0),b=u;do{if(p===0){jl&&!u&&Jr(t,a,0,!1);break}else{if(i=t.current.alternate,b&&!Xw(i)){p=Ef(t,a,!1),b=!1;continue}if(p===2){if(b=a,t.errorRecoveryDisabledLanes&b)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){a=S;e:{var _=t;p=Ni;var F=_.current.memoizedState.isDehydrated;if(F&&(Tl(_,S).flags|=256),S=Ef(_,S,!1),S!==2){if(wf&&!F){_.errorRecoveryDisabledLanes|=b,Is|=b,p=4;break e}b=Kn,Kn=p,b!==null&&(Kn===null?Kn=b:Kn.push.apply(Kn,b))}p=S}if(b=!1,p!==2)continue}}if(p===1){Tl(t,0),Jr(t,a,0,!0);break}e:{switch(u=t,b=p,b){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:Jr(u,a,la,!Yr);break e;case 2:Kn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(p=mc+300-St(),10<p)){if(Jr(u,a,la,!Yr),dn(u,0,!0)!==0)break e;Tr=a,u.timeoutHandle=Bx(ux.bind(null,u,i,Kn,pc,jf,a,la,Is,Nl,Yr,b,"Throttled",-0,0),p);break e}ux(u,i,Kn,pc,jf,a,la,Is,Nl,Yr,b,null,-0,0)}}break}while(!0);er(t)}function ux(t,a,i,u,p,b,S,_,F,ee,de,me,ne,le){if(t.timeoutHandle=-1,me=a.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fr},nx(a,b,me);var Ne=(b&62914560)===b?mc-St():(b&4194048)===b?lx-St():0;if(Ne=DS(me,Ne),Ne!==null){Tr=b,t.cancelPendingCommit=Ne(yx.bind(null,t,a,b,i,u,p,S,_,F,de,me,null,ne,le)),Jr(t,b,S,!ee);return}}yx(t,a,b,i,u,p,S,_,F)}function Xw(t){for(var a=t;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var u=0;u<i.length;u++){var p=i[u],b=p.getSnapshot;p=p.value;try{if(!ta(b(),p))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;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 Jr(t,a,i,u){a&=~Sf,a&=~Is,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var p=a;0<p;){var b=31-Ye(p),S=1<<b;u[b]=-1,p&=~S}i!==0&&It(t,i,a)}function gc(){return(pt&6)===0?(Ti(0),!1):!0}function Mf(){if(Xe!==null){if(bt===0)var t=Xe.return;else t=Xe,gr=js=null,qd(t),xl=null,ci=0,t=Xe;for(;t!==null;)H0(t.alternate,t),t=t.return;Xe=null}}function Tl(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,xS(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),Tr=0,Mf(),Et=t,Xe=i=hr(t.current,null),et=a,bt=0,sa=null,Yr=!1,jl=ga(t,a),wf=!1,Nl=la=Sf=Is=Qr=Kt=0,Kn=Ni=null,jf=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var p=31-Ye(u),b=1<<p;a|=t[p],u&=~b}return Cr=a,zo(),i}function dx(t,a){Ve=null,z.H=xi,a===gl||a===Vo?(a=Tg(),bt=3):a===Rd?(a=Tg(),bt=4):bt=a===sf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,sa=a,Xe===null&&(Kt=1,sc(t,ba(a,t.current)))}function fx(){var t=aa.current;return t===null?!0:(et&4194048)===et?Sa===null:(et&62914560)===et||(et&536870912)!==0?t===Sa:!1}function mx(){var t=z.H;return z.H=xi,t===null?xi:t}function hx(){var t=z.A;return z.A=Yw,t}function xc(){Kt=4,Yr||(et&4194048)!==et&&aa.current!==null||(jl=!0),(Qr&134217727)===0&&(Is&134217727)===0||Et===null||Jr(Et,et,la,!1)}function Ef(t,a,i){var u=pt;pt|=2;var p=mx(),b=hx();(Et!==t||et!==a)&&(pc=null,Tl(t,a)),a=!1;var S=Kt;e:do try{if(bt!==0&&Xe!==null){var _=Xe,F=sa;switch(bt){case 8:Mf(),S=6;break e;case 3:case 2:case 9:case 6:aa.current===null&&(a=!0);var ee=bt;if(bt=0,sa=null,Ml(t,_,F,ee),i&&jl){S=0;break e}break;default:ee=bt,bt=0,sa=null,Ml(t,_,F,ee)}}Zw(),S=Kt;break}catch(de){dx(t,de)}while(!0);return a&&t.shellSuspendCounter++,gr=js=null,pt=u,z.H=p,z.A=b,Xe===null&&(Et=null,et=0,zo()),S}function Zw(){for(;Xe!==null;)px(Xe)}function Jw(t,a){var i=pt;pt|=2;var u=mx(),p=hx();Et!==t||et!==a?(pc=null,hc=St()+500,Tl(t,a)):jl=ga(t,a);e:do try{if(bt!==0&&Xe!==null){a=Xe;var b=sa;t:switch(bt){case 1:bt=0,sa=null,Ml(t,a,b,1);break;case 2:case 9:if(Ng(b)){bt=0,sa=null,gx(a);break}a=function(){bt!==2&&bt!==9||Et!==t||(bt=7),er(t)},b.then(a,a);break e;case 3:bt=7;break e;case 4:bt=5;break e;case 7:Ng(b)?(bt=0,sa=null,gx(a)):(bt=0,sa=null,Ml(t,a,b,7));break;case 5:var S=null;switch(Xe.tag){case 26:S=Xe.memoizedState;case 5:case 27:var _=Xe;if(S?ty(S):_.stateNode.complete){bt=0,sa=null;var F=_.sibling;if(F!==null)Xe=F;else{var ee=_.return;ee!==null?(Xe=ee,yc(ee)):Xe=null}break t}}bt=0,sa=null,Ml(t,a,b,5);break;case 6:bt=0,sa=null,Ml(t,a,b,6);break;case 8:Mf(),Kt=6;break e;default:throw Error(s(462))}}eS();break}catch(de){dx(t,de)}while(!0);return gr=js=null,z.H=u,z.A=p,pt=i,Xe!==null?0:(Et=null,et=0,zo(),Kt)}function eS(){for(;Xe!==null&&!We();)px(Xe)}function px(t){var a=$0(t.alternate,t,Cr);t.memoizedProps=t.pendingProps,a===null?yc(t):Xe=a}function gx(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=I0(i,a,a.pendingProps,a.type,void 0,et);break;case 11:a=I0(i,a,a.pendingProps,a.type.render,a.ref,et);break;case 5:qd(a);default:H0(i,a),a=Xe=hg(a,Cr),a=$0(i,a,Cr)}t.memoizedProps=t.pendingProps,a===null?yc(t):Xe=a}function Ml(t,a,i,u){gr=js=null,qd(a),xl=null,ci=0;var p=a.return;try{if(Pw(t,p,a,i,et)){Kt=1,sc(t,ba(i,t.current)),Xe=null;return}}catch(b){if(p!==null)throw Xe=p,b;Kt=1,sc(t,ba(i,t.current)),Xe=null;return}a.flags&32768?(rt||u===1?t=!0:jl||(et&536870912)!==0?t=!1:(Yr=t=!0,(u===2||u===9||u===3||u===6)&&(u=aa.current,u!==null&&u.tag===13&&(u.flags|=16384))),xx(a,t)):yc(a)}function yc(t){var a=t;do{if((a.flags&32768)!==0){xx(a,Yr);return}t=a.return;var i=Vw(a.alternate,a,Cr);if(i!==null){Xe=i;return}if(a=a.sibling,a!==null){Xe=a;return}Xe=a=t}while(a!==null);Kt===0&&(Kt=5)}function xx(t,a){do{var i=Gw(t.alternate,t);if(i!==null){i.flags&=32767,Xe=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(t=t.sibling,t!==null)){Xe=t;return}Xe=t=i}while(t!==null);Kt=6,Xe=null}function yx(t,a,i,u,p,b,S,_,F){t.cancelPendingCommit=null;do bc();while(fn!==0);if((pt&6)!==0)throw Error(s(327));if(a!==null){if(a===t.current)throw Error(s(177));if(b=a.lanes|a.childLanes,b|=gd,_t(t,i,b,S,_,F),t===Et&&(Xe=Et=null,et=0),Cl=a,Zr=t,Tr=i,Nf=b,Cf=p,ix=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,rS(Ae,function(){return Sx(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=z.T,z.T=null,p=H.p,H.p=2,S=pt,pt|=4;try{Ww(t,a,i)}finally{pt=S,H.p=p,z.T=u}}fn=1,bx(),vx(),kx()}}function bx(){if(fn===1){fn=0;var t=Zr,a=Cl,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=z.T,z.T=null;var u=H.p;H.p=2;var p=pt;pt|=4;try{J0(a,t);var b=Hf,S=sg(t.containerInfo),_=b.focusedElem,F=b.selectionRange;if(S!==_&&_&&_.ownerDocument&&rg(_.ownerDocument.documentElement,_)){if(F!==null&&dd(_)){var ee=F.start,de=F.end;if(de===void 0&&(de=ee),"selectionStart"in _)_.selectionStart=ee,_.selectionEnd=Math.min(de,_.value.length);else{var me=_.ownerDocument||document,ne=me&&me.defaultView||window;if(ne.getSelection){var le=ne.getSelection(),Ne=_.textContent.length,Oe=Math.min(F.start,Ne),Ct=F.end===void 0?Oe:Math.min(F.end,Ne);!le.extend&&Oe>Ct&&(S=Ct,Ct=Oe,Oe=S);var Y=ag(_,Oe),G=ag(_,Ct);if(Y&&G&&(le.rangeCount!==1||le.anchorNode!==Y.node||le.anchorOffset!==Y.offset||le.focusNode!==G.node||le.focusOffset!==G.offset)){var J=me.createRange();J.setStart(Y.node,Y.offset),le.removeAllRanges(),Oe>Ct?(le.addRange(J),le.extend(G.node,G.offset)):(J.setEnd(G.node,G.offset),le.addRange(J))}}}}for(me=[],le=_;le=le.parentNode;)le.nodeType===1&&me.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<me.length;_++){var fe=me[_];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Rc=!!Bf,Hf=Bf=null}finally{pt=p,H.p=u,z.T=i}}t.current=a,fn=2}}function vx(){if(fn===2){fn=0;var t=Zr,a=Cl,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=z.T,z.T=null;var u=H.p;H.p=2;var p=pt;pt|=4;try{K0(t,a.alternate,a)}finally{pt=p,H.p=u,z.T=i}}fn=3}}function kx(){if(fn===4||fn===3){fn=0,ct();var t=Zr,a=Cl,i=Tr,u=ix;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?fn=5:(fn=0,Cl=Zr=null,wx(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(Xr=null),za(i),a=a.stateNode,Ke&&typeof Ke.onCommitFiberRoot=="function")try{Ke.onCommitFiberRoot(ht,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=z.T,p=H.p,H.p=2,z.T=null;try{for(var b=t.onRecoverableError,S=0;S<u.length;S++){var _=u[S];b(_.value,{componentStack:_.stack})}}finally{z.T=a,H.p=p}}(Tr&3)!==0&&bc(),er(t),p=t.pendingLanes,(i&261930)!==0&&(p&42)!==0?t===Tf?Ci++:(Ci=0,Tf=t):Ci=0,Ti(0)}}function wx(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,ii(a)))}function bc(){return bx(),vx(),kx(),Sx()}function Sx(){if(fn!==5)return!1;var t=Zr,a=Nf;Nf=0;var i=za(Tr),u=z.T,p=H.p;try{H.p=32>i?32:i,z.T=null,i=Cf,Cf=null;var b=Zr,S=Tr;if(fn=0,Cl=Zr=null,Tr=0,(pt&6)!==0)throw Error(s(331));var _=pt;if(pt|=4,rx(b.current),tx(b,b.current,S,i),pt=_,Ti(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot=="function")try{Ke.onPostCommitFiberRoot(ht,b)}catch{}return!0}finally{H.p=p,z.T=u,wx(t,a)}}function jx(t,a,i){a=ba(i,a),a=rf(t.stateNode,a,2),t=Vr(t,a,2),t!==null&&(yt(t,2),er(t))}function vt(t,a,i){if(t.tag===3)jx(t,t,i);else for(;a!==null;){if(a.tag===3){jx(a,t,i);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Xr===null||!Xr.has(u))){t=ba(i,t),i=N0(2),u=Vr(a,i,2),u!==null&&(C0(i,u,a,t),yt(u,2),er(u));break}}a=a.return}}function Af(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new Qw;var p=new Set;u.set(a,p)}else p=u.get(a),p===void 0&&(p=new Set,u.set(a,p));p.has(i)||(wf=!0,p.add(i),t=tS.bind(null,t,a,i),a.then(t,t))}function tS(t,a,i){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,Et===t&&(et&i)===i&&(Kt===4||Kt===3&&(et&62914560)===et&&300>St()-mc?(pt&2)===0&&Tl(t,0):Sf|=i,Nl===et&&(Nl=0)),er(t)}function Nx(t,a){a===0&&(a=Me()),t=ks(t,a),t!==null&&(yt(t,a),er(t))}function nS(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),Nx(t,i)}function aS(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(a),Nx(t,i)}function rS(t,a){return Ee(t,a)}var vc=null,El=null,Rf=!1,kc=!1,_f=!1,es=0;function er(t){t!==El&&t.next===null&&(El===null?vc=El=t:El=El.next=t),kc=!0,Rf||(Rf=!0,lS())}function Ti(t,a){if(!_f&&kc){_f=!0;do for(var i=!1,u=vc;u!==null;){if(t!==0){var p=u.pendingLanes;if(p===0)var b=0;else{var S=u.suspendedLanes,_=u.pingedLanes;b=(1<<31-Ye(42|t)+1)-1,b&=p&~(S&~_),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(i=!0,Ex(u,b))}else b=et,b=dn(u,u===Et?b:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(b&3)===0||ga(u,b)||(i=!0,Ex(u,b));u=u.next}while(i);_f=!1}}function sS(){Cx()}function Cx(){kc=Rf=!1;var t=0;es!==0&&gS()&&(t=es);for(var a=St(),i=null,u=vc;u!==null;){var p=u.next,b=Tx(u,a);b===0?(u.next=null,i===null?vc=p:i.next=p,p===null&&(El=i)):(i=u,(t!==0||(b&3)!==0)&&(kc=!0)),u=p}fn!==0&&fn!==5||Ti(t),es!==0&&(es=0)}function Tx(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,b=t.pendingLanes&-62914561;0<b;){var S=31-Ye(b),_=1<<S,F=p[S];F===-1?((_&i)===0||(_&u)!==0)&&(p[S]=ve(_,a)):F<=a&&(t.expiredLanes|=_),b&=~_}if(a=Et,i=et,i=dn(t,t===a?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===a&&(bt===2||bt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&<(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||ga(t,i)){if(a=i&-i,a===t.callbackPriority)return a;switch(u!==null&<(u),za(i)){case 2:case 8:i=ge;break;case 32:i=Ae;break;case 268435456:i=$e;break;default:i=Ae}return u=Mx.bind(null,t),i=Ee(i,u),t.callbackPriority=a,t.callbackNode=i,a}return u!==null&&u!==null&<(u),t.callbackPriority=2,t.callbackNode=null,2}function Mx(t,a){if(fn!==0&&fn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(bc()&&t.callbackNode!==i)return null;var u=et;return u=dn(t,t===Et?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(cx(t,u,a),Tx(t,St()),t.callbackNode!=null&&t.callbackNode===i?Mx.bind(null,t):null)}function Ex(t,a){if(bc())return null;cx(t,a,!0)}function lS(){yS(function(){(pt&6)!==0?Ee(ue,sS):Cx()})}function If(){if(es===0){var t=hl;t===0&&(t=un,un<<=1,(un&261888)===0&&(un=256)),es=t}return es}function Ax(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Eo(""+t)}function Rx(t,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,t.id&&i.setAttribute("form",t.id),a.parentNode.insertBefore(i,a),t=new FormData(t),i.parentNode.removeChild(i),t}function iS(t,a,i,u,p){if(a==="submit"&&i&&i.stateNode===p){var b=Ax((p[Vt]||null).action),S=u.submitter;S&&(a=(a=S[Vt]||null)?Ax(a.formAction):S.getAttribute("formAction"),a!==null&&(b=a,S=null));var _=new Io("action","action",null,u,p);t.push({event:_,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(es!==0){var F=S?Rx(p,S):new FormData(p);Zd(i,{pending:!0,data:F,method:p.method,action:b},null,F)}}else typeof b=="function"&&(_.preventDefault(),F=S?Rx(p,S):new FormData(p),Zd(i,{pending:!0,data:F,method:p.method,action:b},b,F))},currentTarget:p}]})}}for(var Lf=0;Lf<pd.length;Lf++){var Df=pd[Lf],oS=Df.toLowerCase(),cS=Df[0].toUpperCase()+Df.slice(1);$a(oS,"on"+cS)}$a(og,"onAnimationEnd"),$a(cg,"onAnimationIteration"),$a(ug,"onAnimationStart"),$a("dblclick","onDoubleClick"),$a("focusin","onFocus"),$a("focusout","onBlur"),$a(Nw,"onTransitionRun"),$a(Cw,"onTransitionStart"),$a(Tw,"onTransitionCancel"),$a(dg,"onTransitionEnd"),ae("onMouseEnter",["mouseout","mouseover"]),ae("onMouseLeave",["mouseout","mouseover"]),ae("onPointerEnter",["pointerout","pointerover"]),ae("onPointerLeave",["pointerout","pointerover"]),Ua("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ua("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ua("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ua("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ua("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ua("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mi="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(" "),uS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Mi));function _x(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var b=void 0;if(a)for(var S=u.length-1;0<=S;S--){var _=u[S],F=_.instance,ee=_.currentTarget;if(_=_.listener,F!==b&&p.isPropagationStopped())break e;b=_,p.currentTarget=ee;try{b(p)}catch(de){Oo(de)}p.currentTarget=null,b=F}else for(S=0;S<u.length;S++){if(_=u[S],F=_.instance,ee=_.currentTarget,_=_.listener,F!==b&&p.isPropagationStopped())break e;b=_,p.currentTarget=ee;try{b(p)}catch(de){Oo(de)}p.currentTarget=null,b=F}}}}function Ze(t,a){var i=a[ur];i===void 0&&(i=a[ur]=new Set);var u=t+"__bubble";i.has(u)||(Ix(a,t,2,!1),i.add(u))}function Of(t,a,i){var u=0;a&&(u|=4),Ix(i,t,u,a)}var wc="_reactListening"+Math.random().toString(36).slice(2);function zf(t){if(!t[wc]){t[wc]=!0,Or.forEach(function(i){i!=="selectionchange"&&(uS.has(i)||Of(i,!1,t),Of(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[wc]||(a[wc]=!0,Of("selectionchange",!1,a))}}function Ix(t,a,i,u){switch(oy(a)){case 2:var p=US;break;case 8:p=$S;break;default:p=Zf}i=p.bind(null,a,i,t),p=void 0,!nd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(a,i,{capture:!0,passive:p}):t.addEventListener(a,i,!0):p!==void 0?t.addEventListener(a,i,{passive:p}):t.addEventListener(a,i,!1)}function Uf(t,a,i,u,p){var b=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var S=u.tag;if(S===3||S===4){var _=u.stateNode.containerInfo;if(_===p)break;if(S===4)for(S=u.return;S!==null;){var F=S.tag;if((F===3||F===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;_!==null;){if(S=qn(_),S===null)return;if(F=S.tag,F===5||F===6||F===26||F===27){u=b=S;continue e}_=_.parentNode}}u=u.return}Up(function(){var ee=b,de=ed(i),me=[];e:{var ne=fg.get(t);if(ne!==void 0){var le=Io,Ne=t;switch(t){case"keypress":if(Ro(i)===0)break e;case"keydown":case"keyup":le=aw;break;case"focusin":Ne="focus",le=ld;break;case"focusout":Ne="blur",le=ld;break;case"beforeblur":case"afterblur":le=ld;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Hp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=V2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=lw;break;case og:case cg:case ug:le=K2;break;case dg:le=ow;break;case"scroll":case"scrollend":le=q2;break;case"wheel":le=uw;break;case"copy":case"cut":case"paste":le=Q2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=qp;break;case"toggle":case"beforetoggle":le=fw}var Oe=(a&4)!==0,Ct=!Oe&&(t==="scroll"||t==="scrollend"),Y=Oe?ne!==null?ne+"Capture":null:ne;Oe=[];for(var G=ee,J;G!==null;){var fe=G;if(J=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||J===null||Y===null||(fe=Ql(G,Y),fe!=null&&Oe.push(Ei(G,fe,J))),Ct)break;G=G.return}0<Oe.length&&(ne=new le(ne,Ne,null,i,de),me.push({event:ne,listeners:Oe}))}}if((a&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",le=t==="mouseout"||t==="pointerout",ne&&i!==Ju&&(Ne=i.relatedTarget||i.fromElement)&&(qn(Ne)||Ne[ea]))break e;if((le||ne)&&(ne=de.window===de?de:(ne=de.ownerDocument)?ne.defaultView||ne.parentWindow:window,le?(Ne=i.relatedTarget||i.toElement,le=ee,Ne=Ne?qn(Ne):null,Ne!==null&&(Ct=c(Ne),Oe=Ne.tag,Ne!==Ct||Oe!==5&&Oe!==27&&Oe!==6)&&(Ne=null)):(le=null,Ne=ee),le!==Ne)){if(Oe=Hp,fe="onMouseLeave",Y="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Oe=qp,fe="onPointerLeave",Y="onPointerEnter",G="pointer"),Ct=le==null?ne:Dn(le),J=Ne==null?ne:Dn(Ne),ne=new Oe(fe,G+"leave",le,i,de),ne.target=Ct,ne.relatedTarget=J,fe=null,qn(de)===ee&&(Oe=new Oe(Y,G+"enter",Ne,i,de),Oe.target=J,Oe.relatedTarget=Ct,fe=Oe),Ct=fe,le&&Ne)t:{for(Oe=dS,Y=le,G=Ne,J=0,fe=Y;fe;fe=Oe(fe))J++;fe=0;for(var Re=G;Re;Re=Oe(Re))fe++;for(;0<J-fe;)Y=Oe(Y),J--;for(;0<fe-J;)G=Oe(G),fe--;for(;J--;){if(Y===G||G!==null&&Y===G.alternate){Oe=Y;break t}Y=Oe(Y),G=Oe(G)}Oe=null}else Oe=null;le!==null&&Lx(me,ne,le,Oe,!1),Ne!==null&&Ct!==null&&Lx(me,Ct,Ne,Oe,!0)}}e:{if(ne=ee?Dn(ee):window,le=ne.nodeName&&ne.nodeName.toLowerCase(),le==="select"||le==="input"&&ne.type==="file")var dt=Xp;else if(Yp(ne))if(Zp)dt=ww;else{dt=vw;var Te=bw}else le=ne.nodeName,!le||le.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Zu(ee.elementType)&&(dt=Xp):dt=kw;if(dt&&(dt=dt(t,ee))){Qp(me,dt,i,de);break e}Te&&Te(t,ne,ee),t==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Xu(ne,"number",ne.value)}switch(Te=ee?Dn(ee):window,t){case"focusin":(Yp(Te)||Te.contentEditable==="true")&&(ll=Te,fd=ee,ri=null);break;case"focusout":ri=fd=ll=null;break;case"mousedown":md=!0;break;case"contextmenu":case"mouseup":case"dragend":md=!1,lg(me,i,de);break;case"selectionchange":if(jw)break;case"keydown":case"keyup":lg(me,i,de)}var Ge;if(od)e:{switch(t){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else sl?Wp(t,i)&&(tt="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(tt="onCompositionStart");tt&&(Fp&&i.locale!=="ko"&&(sl||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&sl&&(Ge=$p()):(Ur=de,ad="value"in Ur?Ur.value:Ur.textContent,sl=!0)),Te=Sc(ee,tt),0<Te.length&&(tt=new Pp(tt,t,null,i,de),me.push({event:tt,listeners:Te}),Ge?tt.data=Ge:(Ge=Kp(i),Ge!==null&&(tt.data=Ge)))),(Ge=hw?pw(t,i):gw(t,i))&&(tt=Sc(ee,"onBeforeInput"),0<tt.length&&(Te=new Pp("onBeforeInput","beforeinput",null,i,de),me.push({event:Te,listeners:tt}),Te.data=Ge)),iS(me,t,ee,i,de)}_x(me,a)})}function Ei(t,a,i){return{instance:t,listener:a,currentTarget:i}}function Sc(t,a){for(var i=a+"Capture",u=[];t!==null;){var p=t,b=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||b===null||(p=Ql(t,i),p!=null&&u.unshift(Ei(t,p,b)),p=Ql(t,a),p!=null&&u.push(Ei(t,p,b))),t.tag===3)return u;t=t.return}return[]}function dS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Lx(t,a,i,u,p){for(var b=a._reactName,S=[];i!==null&&i!==u;){var _=i,F=_.alternate,ee=_.stateNode;if(_=_.tag,F!==null&&F===u)break;_!==5&&_!==26&&_!==27||ee===null||(F=ee,p?(ee=Ql(i,b),ee!=null&&S.unshift(Ei(i,ee,F))):p||(ee=Ql(i,b),ee!=null&&S.push(Ei(i,ee,F)))),i=i.return}S.length!==0&&t.push({event:a,listeners:S})}var fS=/\r\n?/g,mS=/\u0000|\uFFFD/g;function Dx(t){return(typeof t=="string"?t:""+t).replace(fS,`
|
|
9
|
-
`).replace(mS,"")}function Ox(t,a){return a=Dx(a),Dx(t)===a}function Nt(t,a,i,u,p,b){switch(i){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||nl(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&nl(t,""+u);break;case"className":Zt(t,"class",u);break;case"tabIndex":Zt(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Zt(t,i,u);break;case"style":Op(t,u,b);break;case"data":if(a!=="object"){Zt(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||i!=="href")){t.removeAttribute(i);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Eo(""+u),t.setAttribute(i,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(i,"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 b=="function"&&(i==="formAction"?(a!=="input"&&Nt(t,a,"name",p.name,p,null),Nt(t,a,"formEncType",p.formEncType,p,null),Nt(t,a,"formMethod",p.formMethod,p,null),Nt(t,a,"formTarget",p.formTarget,p,null)):(Nt(t,a,"encType",p.encType,p,null),Nt(t,a,"method",p.method,p,null),Nt(t,a,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Eo(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=fr);break;case"onScroll":u!=null&&Ze("scroll",t);break;case"onScrollEnd":u!=null&&Ze("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(i=u.__html,i!=null){if(p.children!=null)throw Error(s(60));t.innerHTML=i}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}i=Eo(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""+u):t.removeAttribute(i);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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""):t.removeAttribute(i);break;case"capture":case"download":u===!0?t.setAttribute(i,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,u):t.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(i,u):t.removeAttribute(i);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(i):t.setAttribute(i,u);break;case"popover":Ze("beforetoggle",t),Ze("toggle",t),Mt(t,"popover",u);break;case"xlinkActuate":Gt(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Gt(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Gt(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Gt(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Gt(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Gt(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Gt(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Gt(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Gt(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Mt(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=H2.get(i)||i,Mt(t,i,u))}}function $f(t,a,i,u,p,b){switch(i){case"style":Op(t,u,b);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(i=u.__html,i!=null){if(p.children!=null)throw Error(s(60));t.innerHTML=i}}break;case"children":typeof u=="string"?nl(t,u):(typeof u=="number"||typeof u=="bigint")&&nl(t,""+u);break;case"onScroll":u!=null&&Ze("scroll",t);break;case"onScrollEnd":u!=null&&Ze("scrollend",t);break;case"onClick":u!=null&&(t.onclick=fr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Js.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(p=i.endsWith("Capture"),a=i.slice(2,p?i.length-7:void 0),b=t[Vt]||null,b=b!=null?b[i]:null,typeof b=="function"&&t.removeEventListener(a,b,p),typeof u=="function")){typeof b!="function"&&b!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,p);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):Mt(t,i,u)}}}function Nn(t,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",t),Ze("load",t);var u=!1,p=!1,b;for(b in i)if(i.hasOwnProperty(b)){var S=i[b];if(S!=null)switch(b){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Nt(t,a,b,S,i,null)}}p&&Nt(t,a,"srcSet",i.srcSet,i,null),u&&Nt(t,a,"src",i.src,i,null);return;case"input":Ze("invalid",t);var _=b=S=p=null,F=null,ee=null;for(u in i)if(i.hasOwnProperty(u)){var de=i[u];if(de!=null)switch(u){case"name":p=de;break;case"type":S=de;break;case"checked":F=de;break;case"defaultChecked":ee=de;break;case"value":b=de;break;case"defaultValue":_=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,a));break;default:Nt(t,a,u,de,i,null)}}el(t,b,_,F,ee,S,p,!1);return;case"select":Ze("invalid",t),u=S=b=null;for(p in i)if(i.hasOwnProperty(p)&&(_=i[p],_!=null))switch(p){case"value":b=_;break;case"defaultValue":S=_;break;case"multiple":u=_;default:Nt(t,a,p,_,i,null)}a=b,i=S,t.multiple=!!u,a!=null?tl(t,!!u,a,!1):i!=null&&tl(t,!!u,i,!0);return;case"textarea":Ze("invalid",t),b=p=u=null;for(S in i)if(i.hasOwnProperty(S)&&(_=i[S],_!=null))switch(S){case"value":u=_;break;case"defaultValue":p=_;break;case"children":b=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:Nt(t,a,S,_,i,null)}Lp(t,u,p,b);return;case"option":for(F in i)i.hasOwnProperty(F)&&(u=i[F],u!=null)&&(F==="selected"?t.selected=u&&typeof u!="function"&&typeof u!="symbol":Nt(t,a,F,u,i,null));return;case"dialog":Ze("beforetoggle",t),Ze("toggle",t),Ze("cancel",t),Ze("close",t);break;case"iframe":case"object":Ze("load",t);break;case"video":case"audio":for(u=0;u<Mi.length;u++)Ze(Mi[u],t);break;case"image":Ze("error",t),Ze("load",t);break;case"details":Ze("toggle",t);break;case"embed":case"source":case"link":Ze("error",t),Ze("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(ee in i)if(i.hasOwnProperty(ee)&&(u=i[ee],u!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Nt(t,a,ee,u,i,null)}return;default:if(Zu(a)){for(de in i)i.hasOwnProperty(de)&&(u=i[de],u!==void 0&&$f(t,a,de,u,i,void 0));return}}for(_ in i)i.hasOwnProperty(_)&&(u=i[_],u!=null&&Nt(t,a,_,u,i,null))}function hS(t,a,i,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,b=null,S=null,_=null,F=null,ee=null,de=null;for(le in i){var me=i[le];if(i.hasOwnProperty(le)&&me!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":F=me;default:u.hasOwnProperty(le)||Nt(t,a,le,null,u,me)}}for(var ne in u){var le=u[ne];if(me=i[ne],u.hasOwnProperty(ne)&&(le!=null||me!=null))switch(ne){case"type":b=le;break;case"name":p=le;break;case"checked":ee=le;break;case"defaultChecked":de=le;break;case"value":S=le;break;case"defaultValue":_=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,a));break;default:le!==me&&Nt(t,a,ne,le,u,me)}}zr(t,S,_,F,ee,de,b,p);return;case"select":le=S=_=ne=null;for(b in i)if(F=i[b],i.hasOwnProperty(b)&&F!=null)switch(b){case"value":break;case"multiple":le=F;default:u.hasOwnProperty(b)||Nt(t,a,b,null,u,F)}for(p in u)if(b=u[p],F=i[p],u.hasOwnProperty(p)&&(b!=null||F!=null))switch(p){case"value":ne=b;break;case"defaultValue":_=b;break;case"multiple":S=b;default:b!==F&&Nt(t,a,p,b,u,F)}a=_,i=S,u=le,ne!=null?tl(t,!!i,ne,!1):!!u!=!!i&&(a!=null?tl(t,!!i,a,!0):tl(t,!!i,i?[]:"",!1));return;case"textarea":le=ne=null;for(_ in i)if(p=i[_],i.hasOwnProperty(_)&&p!=null&&!u.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Nt(t,a,_,null,u,p)}for(S in u)if(p=u[S],b=i[S],u.hasOwnProperty(S)&&(p!=null||b!=null))switch(S){case"value":ne=p;break;case"defaultValue":le=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(s(91));break;default:p!==b&&Nt(t,a,S,p,u,b)}Ip(t,ne,le);return;case"option":for(var Ne in i)ne=i[Ne],i.hasOwnProperty(Ne)&&ne!=null&&!u.hasOwnProperty(Ne)&&(Ne==="selected"?t.selected=!1:Nt(t,a,Ne,null,u,ne));for(F in u)ne=u[F],le=i[F],u.hasOwnProperty(F)&&ne!==le&&(ne!=null||le!=null)&&(F==="selected"?t.selected=ne&&typeof ne!="function"&&typeof ne!="symbol":Nt(t,a,F,ne,u,le));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 Oe in i)ne=i[Oe],i.hasOwnProperty(Oe)&&ne!=null&&!u.hasOwnProperty(Oe)&&Nt(t,a,Oe,null,u,ne);for(ee in u)if(ne=u[ee],le=i[ee],u.hasOwnProperty(ee)&&ne!==le&&(ne!=null||le!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,a));break;default:Nt(t,a,ee,ne,u,le)}return;default:if(Zu(a)){for(var Ct in i)ne=i[Ct],i.hasOwnProperty(Ct)&&ne!==void 0&&!u.hasOwnProperty(Ct)&&$f(t,a,Ct,void 0,u,ne);for(de in u)ne=u[de],le=i[de],!u.hasOwnProperty(de)||ne===le||ne===void 0&&le===void 0||$f(t,a,de,ne,u,le);return}}for(var Y in i)ne=i[Y],i.hasOwnProperty(Y)&&ne!=null&&!u.hasOwnProperty(Y)&&Nt(t,a,Y,null,u,ne);for(me in u)ne=u[me],le=i[me],!u.hasOwnProperty(me)||ne===le||ne==null&&le==null||Nt(t,a,me,ne,u,le)}function zx(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var p=i[u],b=p.transferSize,S=p.initiatorType,_=p.duration;if(b&&_&&zx(S)){for(S=0,_=p.responseEnd,u+=1;u<i.length;u++){var F=i[u],ee=F.startTime;if(ee>_)break;var de=F.transferSize,me=F.initiatorType;de&&zx(me)&&(F=F.responseEnd,S+=de*(F<_?1:(_-ee)/(F-ee)))}if(--u,a+=8*(b+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 Bf=null,Hf=null;function jc(t){return t.nodeType===9?t:t.ownerDocument}function Ux(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 $x(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 Pf(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 qf=null;function gS(){var t=window.event;return t&&t.type==="popstate"?t===qf?!1:(qf=t,!0):(qf=null,!1)}var Bx=typeof setTimeout=="function"?setTimeout:void 0,xS=typeof clearTimeout=="function"?clearTimeout:void 0,Hx=typeof Promise=="function"?Promise:void 0,yS=typeof queueMicrotask=="function"?queueMicrotask:typeof Hx<"u"?function(t){return Hx.resolve(null).then(t).catch(bS)}:Bx;function bS(t){setTimeout(function(){throw t})}function ts(t){return t==="head"}function Px(t,a){var i=a,u=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(p),Il(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")Ai(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,Ai(i);for(var b=i.firstChild;b;){var S=b.nextSibling,_=b.nodeName;b[Pn]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&b.rel.toLowerCase()==="stylesheet"||i.removeChild(b),b=S}}else i==="body"&&Ai(t.ownerDocument.body);i=p}while(i);Il(a)}function qx(t,a){var i=t;t=0;do{var u=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),u&&u.nodeType===8)if(i=u.data,i==="/$"){if(t===0)break;t--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||t++;i=u}while(i)}function Ff(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Ff(i),Ln(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function vS(t,a,i,u){for(;t.nodeType===1;){var p=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Pn])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(b=t.getAttribute("rel"),b==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(b!==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(b=t.getAttribute("src"),(b!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&b&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var b=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===b)return t}else return t;if(t=ja(t.nextSibling),t===null)break}return null}function kS(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=ja(t.nextSibling),t===null))return null;return t}function Fx(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=ja(t.nextSibling),t===null))return null;return t}function Vf(t){return t.data==="$?"||t.data==="$~"}function Gf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function wS(t,a){var i=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||i.readyState!=="loading")a();else{var u=function(){a(),i.removeEventListener("DOMContentLoaded",u)};i.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function ja(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 Wf=null;function Vx(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return ja(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function Gx(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return t;a--}else i!=="/$"&&i!=="/&"||a++}t=t.previousSibling}return null}function Wx(t,a,i){switch(a=jc(i),t){case"html":if(t=a.documentElement,!t)throw Error(s(452));return t;case"head":if(t=a.head,!t)throw Error(s(453));return t;case"body":if(t=a.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function Ai(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Ln(t)}var Na=new Map,Kx=new Set;function Nc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Mr=H.d;H.d={f:SS,r:jS,D:NS,C:CS,L:TS,m:MS,X:AS,S:ES,M:RS};function SS(){var t=Mr.f(),a=gc();return t||a}function jS(t){var a=xa(t);a!==null&&a.tag===5&&a.type==="form"?d0(a):Mr.r(t)}var Al=typeof document>"u"?null:document;function Yx(t,a,i){var u=Al;if(u&&typeof a=="string"&&a){var p=yn(a);p='link[rel="'+t+'"][href="'+p+'"]',typeof i=="string"&&(p+='[crossorigin="'+i+'"]'),Kx.has(p)||(Kx.add(p),t={rel:t,crossOrigin:i,href:a},u.querySelector(p)===null&&(a=u.createElement("link"),Nn(a,"link",t),Dt(a),u.head.appendChild(a)))}}function NS(t){Mr.D(t),Yx("dns-prefetch",t,null)}function CS(t,a){Mr.C(t,a),Yx("preconnect",t,a)}function TS(t,a,i){Mr.L(t,a,i);var u=Al;if(u&&t&&a){var p='link[rel="preload"][as="'+yn(a)+'"]';a==="image"&&i&&i.imageSrcSet?(p+='[imagesrcset="'+yn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(p+='[imagesizes="'+yn(i.imageSizes)+'"]')):p+='[href="'+yn(t)+'"]';var b=p;switch(a){case"style":b=Rl(t);break;case"script":b=_l(t)}Na.has(b)||(t=y({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),Na.set(b,t),u.querySelector(p)!==null||a==="style"&&u.querySelector(Ri(b))||a==="script"&&u.querySelector(_i(b))||(a=u.createElement("link"),Nn(a,"link",t),Dt(a),u.head.appendChild(a)))}}function MS(t,a){Mr.m(t,a);var i=Al;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+yn(u)+'"][href="'+yn(t)+'"]',b=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=_l(t)}if(!Na.has(b)&&(t=y({rel:"modulepreload",href:t},a),Na.set(b,t),i.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(_i(b)))return}u=i.createElement("link"),Nn(u,"link",t),Dt(u),i.head.appendChild(u)}}}function ES(t,a,i){Mr.S(t,a,i);var u=Al;if(u&&t){var p=Cn(u).hoistableStyles,b=Rl(t);a=a||"default";var S=p.get(b);if(!S){var _={loading:0,preload:null};if(S=u.querySelector(Ri(b)))_.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":a},i),(i=Na.get(b))&&Kf(t,i);var F=S=u.createElement("link");Dt(F),Nn(F,"link",t),F._p=new Promise(function(ee,de){F.onload=ee,F.onerror=de}),F.addEventListener("load",function(){_.loading|=1}),F.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Cc(S,a,u)}S={type:"stylesheet",instance:S,count:1,state:_},p.set(b,S)}}}function AS(t,a){Mr.X(t,a);var i=Al;if(i&&t){var u=Cn(i).hoistableScripts,p=_l(t),b=u.get(p);b||(b=i.querySelector(_i(p)),b||(t=y({src:t,async:!0},a),(a=Na.get(p))&&Yf(t,a),b=i.createElement("script"),Dt(b),Nn(b,"link",t),i.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(p,b))}}function RS(t,a){Mr.M(t,a);var i=Al;if(i&&t){var u=Cn(i).hoistableScripts,p=_l(t),b=u.get(p);b||(b=i.querySelector(_i(p)),b||(t=y({src:t,async:!0,type:"module"},a),(a=Na.get(p))&&Yf(t,a),b=i.createElement("script"),Dt(b),Nn(b,"link",t),i.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(p,b))}}function Qx(t,a,i,u){var p=(p=oe.current)?Nc(p):null;if(!p)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=Rl(i.href),i=Cn(p).hoistableStyles,u=i.get(a),u||(u={type:"style",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=Rl(i.href);var b=Cn(p).hoistableStyles,S=b.get(t);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(t,S),(b=p.querySelector(Ri(t)))&&!b._p&&(S.instance=b,S.state.loading=5),Na.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Na.set(t,i),b||_S(p,t,i,S.state))),a&&u===null)throw Error(s(528,""));return S}if(a&&u!==null)throw Error(s(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=_l(i),i=Cn(p).hoistableScripts,u=i.get(a),u||(u={type:"script",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Rl(t){return'href="'+yn(t)+'"'}function Ri(t){return'link[rel="stylesheet"]['+t+"]"}function Xx(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function _S(t,a,i,u){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=t.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),Nn(a,"link",i),Dt(a),t.head.appendChild(a))}function _l(t){return'[src="'+yn(t)+'"]'}function _i(t){return"script[async]"+t}function Zx(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+yn(i.href)+'"]');if(u)return a.instance=u,Dt(u),u;var p=y({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Dt(u),Nn(u,"style",p),Cc(u,i.precedence,t),a.instance=u;case"stylesheet":p=Rl(i.href);var b=t.querySelector(Ri(p));if(b)return a.state.loading|=4,a.instance=b,Dt(b),b;u=Xx(i),(p=Na.get(p))&&Kf(u,p),b=(t.ownerDocument||t).createElement("link"),Dt(b);var S=b;return S._p=new Promise(function(_,F){S.onload=_,S.onerror=F}),Nn(b,"link",u),a.state.loading|=4,Cc(b,i.precedence,t),a.instance=b;case"script":return b=_l(i.src),(p=t.querySelector(_i(b)))?(a.instance=p,Dt(p),p):(u=i,(p=Na.get(b))&&(u=y({},i),Yf(u,p)),t=t.ownerDocument||t,p=t.createElement("script"),Dt(p),Nn(p,"link",u),t.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Cc(u,i.precedence,t));return a.instance}function Cc(t,a,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,b=p,S=0;S<u.length;S++){var _=u[S];if(_.dataset.precedence===a)b=_;else if(b!==p)break}b?b.parentNode.insertBefore(t,b.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function Kf(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function Yf(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Tc=null;function Jx(t,a,i){if(Tc===null){var u=new Map,p=Tc=new Map;p.set(i,u)}else p=Tc,u=p.get(i),u||(u=new Map,p.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),p=0;p<i.length;p++){var b=i[p];if(!(b[Pn]||b[Lt]||t==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var S=b.getAttribute(a)||"";S=t+S;var _=u.get(S);_?_.push(b):u.set(S,[b])}}return u}function ey(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function IS(t,a,i){if(i===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 ty(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function LS(t,a,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var p=Rl(u.href),b=a.querySelector(Ri(p));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Mc.bind(t),a.then(t,t)),i.state.loading|=4,i.instance=b,Dt(b);return}b=a.ownerDocument||a,u=Xx(u),(p=Na.get(p))&&Kf(u,p),b=b.createElement("link"),Dt(b);var S=b;S._p=new Promise(function(_,F){S.onload=_,S.onerror=F}),Nn(b,"link",u),i.instance=b}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=Mc.bind(t),a.addEventListener("load",i),a.addEventListener("error",i))}}var Qf=0;function DS(t,a){return t.stylesheets&&t.count===0&&Ac(t,t.stylesheets),0<t.count||0<t.imgCount?function(i){var u=setTimeout(function(){if(t.stylesheets&&Ac(t,t.stylesheets),t.unsuspend){var b=t.unsuspend;t.unsuspend=null,b()}},6e4+a);0<t.imgBytes&&Qf===0&&(Qf=62500*pS());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Ac(t,t.stylesheets),t.unsuspend)){var b=t.unsuspend;t.unsuspend=null,b()}},(t.imgBytes>Qf?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Mc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ac(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ec=null;function Ac(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ec=new Map,a.forEach(OS,t),Ec=null,Mc.call(t))}function OS(t,a){if(!(a.state.loading&4)){var i=Ec.get(t);if(i)var u=i.get(null);else{i=new Map,Ec.set(t,i);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<p.length;b++){var S=p[b];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(i.set(S.dataset.precedence,S),u=S)}u&&i.set(null,u)}p=a.instance,S=p.getAttribute("data-precedence"),b=i.get(S)||u,b===u&&i.set(null,p),i.set(S,p),this.count++,u=Mc.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),b?b.parentNode.insertBefore(p,b.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),a.state.loading|=4}}var Ii={$$typeof:I,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function zS(t,a,i,u,p,b,S,_,F){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=xt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xt(0),this.hiddenUpdates=xt(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=b,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function ny(t,a,i,u,p,b,S,_,F,ee,de,me){return t=new zS(t,a,i,S,F,ee,de,me,_),a=1,b===!0&&(a|=24),b=na(3,null,null,a),t.current=b,b.stateNode=t,a=Md(),a.refCount++,t.pooledCache=a,a.refCount++,b.memoizedState={element:u,isDehydrated:i,cache:a},_d(b),t}function ay(t){return t?(t=cl,t):cl}function ry(t,a,i,u,p,b){p=ay(p),u.context===null?u.context=p:u.pendingContext=p,u=Fr(a),u.payload={element:i},b=b===void 0?null:b,b!==null&&(u.callback=b),i=Vr(t,u,a),i!==null&&(Yn(i,t,a),di(i,t,a))}function sy(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function Xf(t,a){sy(t,a),(t=t.alternate)&&sy(t,a)}function ly(t){if(t.tag===13||t.tag===31){var a=ks(t,67108864);a!==null&&Yn(a,t,67108864),Xf(t,67108864)}}function iy(t){if(t.tag===13||t.tag===31){var a=ia();a=Oa(a);var i=ks(t,a);i!==null&&Yn(i,t,a),Xf(t,a)}}var Rc=!0;function US(t,a,i,u){var p=z.T;z.T=null;var b=H.p;try{H.p=2,Zf(t,a,i,u)}finally{H.p=b,z.T=p}}function $S(t,a,i,u){var p=z.T;z.T=null;var b=H.p;try{H.p=8,Zf(t,a,i,u)}finally{H.p=b,z.T=p}}function Zf(t,a,i,u){if(Rc){var p=Jf(u);if(p===null)Uf(t,a,u,_c,i),cy(t,u);else if(HS(p,t,a,i,u))u.stopPropagation();else if(cy(t,u),a&4&&-1<BS.indexOf(t)){for(;p!==null;){var b=xa(p);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var S=Bn(b.pendingLanes);if(S!==0){var _=b;for(_.pendingLanes|=2,_.entangledLanes|=2;S;){var F=1<<31-Ye(S);_.entanglements[1]|=F,S&=~F}er(b),(pt&6)===0&&(hc=St()+500,Ti(0))}}break;case 31:case 13:_=ks(b,2),_!==null&&Yn(_,b,2),gc(),Xf(b,2)}if(b=Jf(u),b===null&&Uf(t,a,u,_c,i),b===p)break;p=b}p!==null&&u.stopPropagation()}else Uf(t,a,u,null,i)}}function Jf(t){return t=ed(t),em(t)}var _c=null;function em(t){if(_c=null,t=qn(t),t!==null){var a=c(t);if(a===null)t=null;else{var i=a.tag;if(i===13){if(t=d(a),t!==null)return t;t=null}else if(i===31){if(t=f(a),t!==null)return t;t=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return _c=t,null}function oy(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(tn()){case ue:return 2;case ge:return 8;case Ae:case Be:return 32;case $e:return 268435456;default:return 32}default:return 32}}var tm=!1,ns=null,as=null,rs=null,Li=new Map,Di=new Map,ss=[],BS="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 cy(t,a){switch(t){case"focusin":case"focusout":ns=null;break;case"dragenter":case"dragleave":as=null;break;case"mouseover":case"mouseout":rs=null;break;case"pointerover":case"pointerout":Li.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Di.delete(a.pointerId)}}function Oi(t,a,i,u,p,b){return t===null||t.nativeEvent!==b?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:b,targetContainers:[p]},a!==null&&(a=xa(a),a!==null&&ly(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),t)}function HS(t,a,i,u,p){switch(a){case"focusin":return ns=Oi(ns,t,a,i,u,p),!0;case"dragenter":return as=Oi(as,t,a,i,u,p),!0;case"mouseover":return rs=Oi(rs,t,a,i,u,p),!0;case"pointerover":var b=p.pointerId;return Li.set(b,Oi(Li.get(b)||null,t,a,i,u,p)),!0;case"gotpointercapture":return b=p.pointerId,Di.set(b,Oi(Di.get(b)||null,t,a,i,u,p)),!0}return!1}function uy(t){var a=qn(t.target);if(a!==null){var i=c(a);if(i!==null){if(a=i.tag,a===13){if(a=d(i),a!==null){t.blockedOn=a,Qs(t.priority,function(){iy(i)});return}}else if(a===31){if(a=f(i),a!==null){t.blockedOn=a,Qs(t.priority,function(){iy(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ic(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var i=Jf(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);Ju=u,i.target.dispatchEvent(u),Ju=null}else return a=xa(i),a!==null&&ly(a),t.blockedOn=i,!1;a.shift()}return!0}function dy(t,a,i){Ic(t)&&i.delete(a)}function PS(){tm=!1,ns!==null&&Ic(ns)&&(ns=null),as!==null&&Ic(as)&&(as=null),rs!==null&&Ic(rs)&&(rs=null),Li.forEach(dy),Di.forEach(dy)}function Lc(t,a){t.blockedOn===a&&(t.blockedOn=null,tm||(tm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,PS)))}var Dc=null;function fy(t){Dc!==t&&(Dc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Dc===t&&(Dc=null);for(var a=0;a<t.length;a+=3){var i=t[a],u=t[a+1],p=t[a+2];if(typeof u!="function"){if(em(u||i)===null)continue;break}var b=xa(i);b!==null&&(t.splice(a,3),a-=3,Zd(b,{pending:!0,data:p,method:i.method,action:u},u,p))}}))}function Il(t){function a(F){return Lc(F,t)}ns!==null&&Lc(ns,t),as!==null&&Lc(as,t),rs!==null&&Lc(rs,t),Li.forEach(a),Di.forEach(a);for(var i=0;i<ss.length;i++){var u=ss[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<ss.length&&(i=ss[0],i.blockedOn===null);)uy(i),i.blockedOn===null&&ss.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var p=i[u],b=i[u+1],S=p[Vt]||null;if(typeof b=="function")S||fy(i);else if(S){var _=null;if(b&&b.hasAttribute("formAction")){if(p=b,S=b[Vt]||null)_=S.formAction;else if(em(p)!==null)continue}else _=S.action;typeof _=="function"?i[u+1]=_:(i.splice(u,3),u-=3),fy(i)}}}function my(){function t(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),u||setTimeout(i,20)}function i(){if(!u&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function nm(t){this._internalRoot=t}Oc.prototype.render=nm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(s(409));var i=a.current,u=ia();ry(i,u,t,a,null,null)},Oc.prototype.unmount=nm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;ry(t.current,2,null,t,null,null),gc(),a[ea]=null}};function Oc(t){this._internalRoot=t}Oc.prototype.unstable_scheduleHydration=function(t){if(t){var a=Lr();t={blockedOn:null,target:t,priority:a};for(var i=0;i<ss.length&&a!==0&&a<ss[i].priority;i++);ss.splice(i,0,t),i===0&&uy(t)}};var hy=n.version;if(hy!=="19.2.7")throw Error(s(527,hy,"19.2.7"));H.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=h(a),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var qS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zc.isDisabled&&zc.supportsFiber)try{ht=zc.inject(qS),Ke=zc}catch{}}return Ui.createRoot=function(t,a){if(!o(t))throw Error(s(299));var i=!1,u="",p=k0,b=w0,S=S0;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError)),a=ny(t,1,!1,null,null,i,u,null,p,b,S,my),t[ea]=a.current,zf(t),new nm(a)},Ui.hydrateRoot=function(t,a,i){if(!o(t))throw Error(s(299));var u=!1,p="",b=k0,S=w0,_=S0,F=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(b=i.onUncaughtError),i.onCaughtError!==void 0&&(S=i.onCaughtError),i.onRecoverableError!==void 0&&(_=i.onRecoverableError),i.formState!==void 0&&(F=i.formState)),a=ny(t,1,!0,a,i??null,u,p,F,b,S,_,my),a.context=ay(null),i=a.current,u=ia(),u=Oa(u),p=Fr(u),p.callback=null,Vr(i,p,u),i=u,a.current.lanes=i,yt(a,i),er(a),t[ea]=a.current,zf(t),new Oc(a)},Ui.version="19.2.7",Ui}var jy;function ZS(){if(jy)return sm.exports;jy=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(),sm.exports=XS(),sm.exports}var JS=ZS();const Ub={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:"橙"}},update:{lastUpdated:e=>`最近更新日期 ${e}`,newVersionBadge:"有新版本可用",newVersion:e=>`新版本 v${e} 可用`,checkNow:"检查更新",checking:"检查中…",upToDate:"已是最新版本",checkFailed:"检查更新失败,请稍后重试",checkDisabled:"更新检查已关闭(PENGUIN_UPDATE_CHECK=off)",releaseNotes:"更新说明",updateNow:"立即更新",updating:"更新中…",updated:"更新完成,重启服务后生效",restartHint:"在终端重新运行 penguin web(或 penguin server)即可完成重启",failed:"更新失败",unsupported:"当前安装方式不支持在线更新",confirmBody:"将下载最新版本并安装到服务器上的安装目录(数据目录不受影响)。安装完成后需要重启服务才会生效。"},common:{save:"保存",cancel:"取消",create:"创建",delete:"删除",edit:"编辑",settings:"设置",confirm:"确认",close:"关闭",loading:"加载中…",saved:"已保存",saving:"保存中…",noChangesToSave:"当前没有需要保存的修改",confirmSaveTitle:"保存修改",confirmSaveBody:"确定保存这些修改吗?修改将写入服务器上的配置文件。",none:"(无)",retry:"重试",unknownError:"请求失败,请稍后重试",requiredField:"此项必填",copied:"已复制",name:"名称",username:"用户名",role:"角色",actions:"操作",created:"创建时间",cost:"成本",time:"时间"},auth:{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:"用户管理",roleAdmin:"管理员",roleUser:"用户",createUser:"新增用户",initialPassword:"初始密码",initialPasswordFlag:"初始密码",defaultProjectNote:e=>`将自动创建默认 Project:${e}`,resetPassword:"重置密码",resetPasswordTitle:e=>`重置 ${e} 的密码`,resetPasswordNote:"重置后该用户的登录会话全部失效,需用新密码重新登录",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:"添加成员",removeMember:"移除",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 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",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}}","注入密钥保险柜的键名小节(无键时为空)"],["{{SKILL_METADATA}}","注入已安装 Skill 的元数据行(无 Skill 时为空)"],["{{PLATFORM}}","运行平台"],["{{OS_VERSION}}","操作系统版本"],["{{DATE}}","当前日期"],["{{PROJECT_DIR}}","PenguinHarness 应用数据根目录(存放全部 Agent 数据与 Project 级数据;不是本次任务的工作目录)"],["{{AGENT_ID}}","当前 Agent id"],["{{CWD}}","Workspace 绝对路径"],["{{PROVIDER}}","模型 provider 分组"],["{{MODEL_ID}}","上游模型 id"],["{{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`,toolPermission:"permission",permissionReadLabel:"Read-only",permissionReadDescription:"仅读取。审批模式为 read-only 时自动放行,无需确认。",permissionReadWriteLabel:"Read & write",permissionReadWriteDescription:"可修改。审批模式为 read-only 时需人工确认。",toolTimeout:"timeoutMs",toolMaxOutput:"maxOutputLength",toolCallDescription:"call_description",callDescriptionHint:"call_description:开启(缺省)时该工具的 schema 保留可选的 description 参数——模型为每次调用写一句说明,运行期间展示给用户;关闭则装配时从 schema 滤除该参数。仅参数中定义了 description 属性的工具可切换。",mcpServers:"MCP Server(只读)",defaultValue:"(缺省)",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。确认继续?",resetConfigTitle:"还原为默认配置",resetConfigDesc:"把 system_config.yaml 还原为当前内置默认值(与 Skill 更新同语义):自定义的系统提示词、工具列表、模型/压缩参数与 MCP Server 将被覆盖,仅保留名称、描述与版本号。",resetConfigAction:"还原为默认配置",resetConfigConfirmBody:"此操作会用当前默认值覆盖该 Agent 的现有配置:自定义系统提示词、工具列表、模型/压缩参数与 MCP Server 全部被替换,仅保留名称与描述。与 Skill 更新一样不可撤销,确认继续?",resetConfigDone:"配置已还原为当前默认值"},models:{title:"模型配置",addCustom:"添加自定义模型",addToGroup:"新增模型",editTitle:"模型配置",addTitle:"新增模型(OpenAI 协议)",addTitleVendor:"新增模型",addProtocolHint:"新增模型固定走 OpenAI Chat Completions 兼容协议(不按模型 id 自动路由),base URL 填其兼容端点",addAutoRouteHint:"该分组的新模型按上游 id 由 AgentHub 自动路由到厂商官方客户端:base URL 留空即官方端点,API key 留空按解析出的客户端读取环境变量",baseUrlOfficialNote:"注意:该模型走厂商官方协议——自定义 base URL 必须是兼容官方协议的端点,不会因此切换为 OpenAI 协议",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:"视觉",freeBadge:"免费",visionModelBadge:"视觉代理",setVisionModel:"设为视觉代理模型",visionModelHint:"供不支持图片的模型经 describe_image 代读图片",priceUnitShort:"/M tok",testConnection:"测试连通性",testing:"测试中…",testOk:e=>`连通正常(${e} ms)`,testFailed:e=>`连通失败:${e}`,priceCacheRead:"缓存读取价格",priceCacheWrite:"缓存写入价格",priceOutput:"输出价格",currency:"币种",currencyUsd:"美元 $",currencyCny:"人民币 ¥",apiKey:"API key",apiKeyKeepHint:"留空保留现有 key",apiKeyEnvHint: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 将默认使用它。`,default:"默认",setDefault:"设为默认模型",remove:"删除模型",readOnlyHint:"member 只读;模型与 credential 修改仅 owner 可执行",empty:"尚未配置任何模型",noKey:"未配置 key",showModelsWithoutKey:e=>`显示未配置 key 的模型(${e} 个)`,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}」?值不可恢复。`,overwriteTitle:"覆盖已有环境变量",overwriteConfirm:e=>`「${e}」已存在,保存将覆盖原值且不可恢复。`,empty:"尚未配置任何环境变量",readOnlyHint:"member 只读;Vault 修改仅 owner 可执行",keyHint:"字母、数字与下划线,不能以数字开头",keyInvalid:"键名不合法:仅字母、数字与下划线,且不能以数字开头",valueRequired:"值不能为空"},schedule:{desc:"定时任务(agent_state/schedule/*.toml):到点自动向目标 Session 发送 prompt;文件亦可手工编辑,Web 端修改后即时生效。",readOnlyHint:"member 只读;定时任务修改仅 owner 可执行",colStatus:"状态",colPeriod:"周期",colTarget:"目标",colFireTimes:"下次 / 最近触发",colQueued:"排队",statusNames:{active:"生效",disabled:"停用",expired:"已过期",done:"已完成",missed:"已错过",invalid:"无效"},queued:"排队中",once:"一次性",newSession:"新建会话",invalidFiles:"解析失败的文件(已跳过调度)",empty:"尚未配置定时任务",enable:"启用",disable:"停用",addTitle:"新建定时任务",editTitle:e=>`编辑定时任务「${e}」`,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:"更新",updateConfirmTitle:e=>`更新 ${e}`,updateConfirmWarning:e=>`更新 ${e} 会把库内当前副本重装到各 Agent,覆盖其已安装的文件——对已装技能的本地改动会丢失,如有需要请先导出备份。`,updatedToast:(e,n)=>`已将 ${e} 更新到最新版(${n} 个 Agent)`,uninstalledToast:(e,n)=>`已从 ${n} 卸载 ${e}`,uninstallConfirmTitle:e=>`卸载 ${e}`,uninstallConfirmBody:(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)"},statusRunning:"运行中",statusCompacting:"压缩中",pendingApprovals:e=>`${e} 个待审批`,jumpToLatest:"回到最新消息",inputPlaceholder:"输入消息,Enter 发送,Shift+Enter 换行,可粘贴图片",inputPlaceholderShort:"输入消息…",steerPlaceholder:"给运行中的 Agent 留言,随下一轮对话送达",steerPlaceholderShort:"给运行中的 Agent 留言…",steerSend:"发送给运行中的 Agent",steerQueuedIndicator:"插话已排队,将随下一轮送达",userSteering:"用户插话",steerModeLabel:"运行中发送方式",steerModeSteer:"插话",steerModeSteerHint:"立即插话:随下一轮对话送达运行中的 Agent",steerModeFollowUp:"排队",steerModeFollowUpHint:"排队跟进:本轮结束后自动作为新消息发送",followUpPlaceholder:"排队为下一条消息,本轮结束后自动发送",followUpPlaceholderShort:"排队为下一条消息…",followUpSend:"排队为下一条消息",followUpQueuedChip:e=>`${e} 条跟进消息已排队,本轮结束后自动发送`,send:"发送",stop:"停止",compact:"压缩上下文",approve:"允许",deny:"拒绝",decisionAllow:"已批准",decisionDeny:"已拒绝",decisionManual:"手动",decisionAuto:"自动",thinking:"思考",subagent:"子会话",subagentRunning:"运行中",aborted:e=>`[已中断]${e?`:${e}`:""}`,modelAuthDead:"模型 API 认证失败:请在模型配置页更新该模型的 API key,或新建会话。",modelAuthDeadOpenModels:"打开模型配置",modelAuthDeadRetry:"重试",modelAuthDeadCta:"新建会话",modelAuthDeadPlaceholder:"模型认证失败,请先更新 API key",reconnect:(e,n,r,s)=>{const o=e==="timeout"?"连接超时或网络中断":"响应不完整或无法解析",c=n==="gaveUp"?"已停止重试":n==="retried"?`已发起第 ${r} 次重试`:s!==void 0?`第 ${r} 次重试,${s} 秒后发起…`:`正在发起第 ${r} 次重试…`;return`[重试] ${o},${c}`},reconnectRetryNow:"立即重试",reconnectGiveUp:"放弃",imageAlt:"用户上传的图片",toolImageAlt:"工具输出的图片",imagesAsPathHint:"当前模型不支持直接查看图片:发送时图片将保存到会话临时目录,以文件路径转交(模型经 describe_image 查看)",infoPanel:"Session 信息",sessionStats:"统计",statTokens:"Token 累计",statElapsed:"用时",statInput:"输入 tokens",statCached:"已缓存",statOutput:"输出 tokens",statTps:"输出 TPS",statParenOpen:"(",statParenClose:")",noSessions:"还没有 Session",emptyStream:"发送一条消息开始对话",historyLoadFailed:"历史消息加载失败",statsLabel:"统计信息",removeImage:"移除图片",openWorkspace:"打开工作区",openAgents:"智能体面板",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}`:"回到原对话",switchModel:"切换模型开启新会话延续本对话",switchModelTitle:"切换模型",modelSwitchFrom:e=>e?`已切换模型(原为 ${e}),延续原会话`:"已切换模型,延续原会话",modelSwitchAutoMessage:"换用新模型继续这段对话",scheduledFrom:e=>`由定时任务「${e}」触发`,emptyGreeting:"开始一段新对话",compactionRunning:e=>`压缩进行中(${e})…`,compactionDone:e=>e==="discard"?"[压缩] 完成,旧上下文已丢弃":"[压缩] 完成,已切换到摘要后的新上下文",compactionFailed:e=>`[压缩] ${e==="aborted"?"已中断":"失败"},保留当前上下文`,unknownTool:"(未知工具)",workRunning:"运行中",workDone:"运行完毕",workGroupSteps:e=>`${e} 步`,approvalWaiting:"待审批",copyCode:"复制代码",copyReply:"复制回复",copyMessage:"复制消息",deleteSession:"删除对话",renameSession:"重命名对话",renameSessionLabel:"标题",deleteSessionConfirm:e=>`确定删除「${e}」?该对话的消息与 Trace 将被移除,且不可恢复。`,archiveSession:"归档",unarchiveSession:"取消归档",loadMore:"更多",folderGroups:{subagent:e=>`子智能体(${e})`,schedule:e=>`定时任务(${e})`,archived:e=>`已归档(${e})`},skillsBanner:e=>`使用技能:${e.join("、")}`,plusMenu:"更多输入方式",uploadImage:"上传图片",uploadImageDesc:"为本条消息附加图片",goalMode:"目标模式",goalModeDesc:"循环运行直至目标完成",goalBudgetLabel:"Token 预算",goalBudgetUnlimited:"预算不限",goalBudgetValue:e=>`预算 ${e}`,goalBudgetPlaceholder:"例如 500k",goalBudgetHint:"支持 k/m 后缀;留空表示预算不限",goalBudgetInvalid:"无效预算:应为正数,可带 k/m 后缀(500k、2m)",goalBudgetSave:"保存预算",goalRemove:"退出目标模式",goalRoundBanner:e=>`目标 · 第 ${e} 轮`,goalProgress:(e,n)=>`第 ${e} 轮 · tokens ${n}`,goalStatus:{active:"进行中",complete:"已完成",blocked:"受阻",budget_limited:"预算耗尽",aborted:"已中断"}},subagentPanel:{title:"智能体面板",topologyLabel:"调用关系",mainSessionNote:"主会话请在对话区查看",empty:"本次任务尚未派生子智能体",nodeRunning:"运行中",nodeDone:"已完成"},files:{title:"文件",upload:"上传",download:"下载",openInNewTab:"新页面打开",previewNotIsolatedHint:"当前访问地址无法提供独立预览源,页面将以沙箱模式打开:localStorage、Cookie 与第三方 embed 不可用。经 127.0.0.1 或 localhost 访问,或配置 PENGUIN_PREVIEW_ORIGIN 即可解除。",refresh:"刷新",root:"根目录",empty:"空目录",previewUnsupported:"该类型不支持预览,请下载查看",uploaded:"已上传",overwriteTitle:"覆盖同名文件",overwriteConfirm:e=>`当前目录已存在以下 ${e} 个同名文件,上传将覆盖:`,loadFailed:"加载失败",previewTruncated:"内容过大,预览已截断,请下载查看完整文件",details:"详情",workspacePath:"Workspace 路径",htmlRendered:"渲染视图",htmlSource:"源码",backToList:"返回列表",resizeHandle:"拖拽调整宽度,双击恢复默认"},usage:{title:"成本与统计",today:"今日",last7d:"近 7 天",total:"累计",tokens:"Token",requests:"Requests",from:"起始日期",to:"结束日期",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",uncostedNote:"* 只计入配置了价格的模型成本",filterAllAgents:"全部 Agent",filterAllModels:"全部模型",chartAgentCalls:"各 Agent 调用次数",chartSuccessRate:"各模型成功率",chartTokenTrend:"Token 逐日变化",chartCostTrend:"成本逐日变化",empty:"暂无用量记录",successAborted:"已中断(不计入)",errors:"异常",errorsTotal:"总数",errorsUnexpected:"未预期",errorsExpected:"预期内",errorsTopCode:"最常见",errorsColCode:"来源 · 错误码",errorsColKind:"类型",errorsColMessage:"消息",errorsEmpty:"暂无异常"},traces:{title:"轨迹观测",timeline:"执行时间线",laneLLM:"模型",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:"命中率",compactions:"压缩次数",compactionRound:"压缩",empty:"该 Agent 暂无 Trace",inProgress:"进行中",systemPrompt:"系统提示词",toolDefs:e=>`工具定义(${e})`,exportFile:"导出",importTrace:"导入 Trace",importing:"导入中…",fileTooLarge:"文件超过 14MB 上限。"},benchmark:{title:"评估中心",selectBenchmark:"在左侧选择一个 Benchmark",emptyAgent:"该 Agent 暂无 Benchmark",caseCount:e=>`${e} 题`,trendTitle:e=>`${e}随时间变化`,evaluations:"评估明细",noEvaluations:"暂无评估记录",summaryLabel:"评估说明",legendUnlabeled:"未标注模型",colVersion:"版本",colModel:"模型",colScore:"总分",colDuration:"耗时",colCase:"题目",colRun:"运行",colSession:"Session"},errors:{networkError:"网络错误,请检查连接",modelCredentialMissing:e=>`模型 ${e} 还没有可用的 API key,请先在「模型」页为它配置`,noDefaultModel:"该 Project 还没有默认模型,请先在「模型」页添加模型并设为默认",byCode:{invalid_credentials:"用户名或密码错误。",password_mismatch:"当前密码不正确。",invalid_password:"密码至少 8 位。",admin_required:"仅管理员可执行此操作。",not_found:"资源不存在,或你没有访问权限。",agent_not_found:"该 Agent 已不存在。",agent_exists:"该 Agent id 已被占用。",project_exists:"该 Project id 已被占用。",user_exists:"该用户名已被占用。",user_not_found:"该用户已不存在。",cannot_delete_admin:"内置 admin 不可删除。",member_not_found:"该用户不是本 Project 的成员。",schedule_exists:"已存在同名定时任务。",schedule_not_found:"该定时任务已不存在。",unknown_skill:"该技能不在技能库中。",file_not_found:"该文件已不存在。",file_too_large:"文件过大。",payload_too_large:"请求体过大。",dir_not_absolute:"目录必须是绝对路径。",not_a_dir:"该路径不是目录。",path_not_found:"该路径不存在。",workspace_missing:"该 Session 的 Workspace 已不存在。",task_in_progress:"该 Session 已有任务在运行。",version_conflict:"快照版本不高于当前版本。",invalid_title:"标题无效。",invalid_trace:"该文件不是有效的 Trace 文件。",trace_session_exists:"该 Agent 已存在同名 Session,无法导入重复的 Trace。"}}};let x=Ub;function ej(e){x=e}const tj={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"}},update:{lastUpdated:e=>`Last updated ${e}`,newVersionBadge:"New version available",newVersion:e=>`New version v${e} available`,checkNow:"Check for updates",checking:"Checking…",upToDate:"You're on the latest version",checkFailed:"Update check failed — try again later",checkDisabled:"Update checks are disabled (PENGUIN_UPDATE_CHECK=off)",releaseNotes:"Release notes",updateNow:"Update now",updating:"Updating…",updated:"Update complete — restart the service to apply",restartHint:"Restart by re-running penguin web (or penguin server) in a terminal",failed:"Update failed",unsupported:"This install cannot be updated from the web UI",confirmBody:"Downloads the latest release and installs it into the install directory on the server (the data directory is not touched). Restart the service afterwards for the update to take effect."},common:{save:"Save",cancel:"Cancel",create:"Create",delete:"Delete",edit:"Edit",settings:"Settings",confirm:"Confirm",close:"Close",loading:"Loading…",saved:"Saved",saving:"Saving…",noChangesToSave:"No changes to save",confirmSaveTitle:"Save changes",confirmSaveBody:"Save these changes? They will be written to the configuration files on the server.",none:"(none)",retry:"Retry",unknownError:"Request failed, please try again later",requiredField:"This field is required",copied:"Copied",name:"Name",username:"Username",role:"Role",actions:"Actions",created:"Created",cost:"Cost",time:"Time"},auth:{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",roleAdmin:"Admin",roleUser:"User",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",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",removeMember:"Remove",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.",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)"],["{{SKILL_METADATA}}","Injects the installed skills' metadata lines (empty when none)"],["{{PLATFORM}}","Runtime platform"],["{{OS_VERSION}}","Operating system version"],["{{DATE}}","Current date"],["{{PROJECT_DIR}}","PenguinHarness app data root — all agents' data and project-level data; not the task working directory"],["{{AGENT_ID}}","Current agent id"],["{{CWD}}","Absolute Workspace path"],["{{PROVIDER}}","Model provider group"],["{{MODEL_ID}}","Upstream model id"],["{{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`,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",toolCallDescription:"call_description",callDescriptionHint:"call_description: when on (the default), the tool's schema keeps the optional description argument — a model-written sentence about each call, shown to the user while it runs; when off, the argument is filtered out of the schema at assembly. Only tools whose parameters declare a description property can be toggled.",mcpServers:"MCP Servers (read-only)",defaultValue:"(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?",resetConfigTitle:"Restore default configuration",resetConfigDesc:"Restores system_config.yaml to the current built-in defaults (same semantics as a skill update): the custom system prompt, tool list, model/compaction settings and MCP servers are overwritten; only name, description and the State version are kept.",resetConfigAction:"Restore default configuration",resetConfigConfirmBody:"This overwrites the agent's existing configuration with the current defaults: the custom system prompt, tool list, model/compaction settings and MCP servers are all replaced, keeping only name and description. Like a skill update this cannot be undone. Continue?",resetConfigDone:"Configuration restored to the current defaults"},models:{title:"Models",addCustom:"Add custom model",addToGroup:"Add model",editTitle:"Model settings",addTitle:"Add model (OpenAI protocol)",addTitleVendor:"Add model",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",baseUrlOfficialNote:"Note: this model uses the vendor's official protocol — a custom base URL must serve an endpoint compatible with it; it never switches the model to the OpenAI protocol",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",freeBadge:"Free",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}`,priceCacheRead:"Cache read price",priceCacheWrite:"Cache write price",priceOutput:"Output price",currency:"Currency",currencyUsd:"USD $",currencyCny:"CNY ¥",apiKey:"API key",apiKeyKeepHint:"Leave empty to keep the current key",apiKeyEnvHint:e=>`Leave empty to use the ${e} env var`,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.`,default:"Default",setDefault:"Set as default model",remove:"Delete model",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})`,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.`,overwriteTitle:"Overwrite existing variable",overwriteConfirm:e=>`"${e}" already exists — saving will overwrite its value, which 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",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}"`,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",updateConfirmTitle:e=>`Update ${e}`,updateConfirmWarning:e=>`Updating ${e} reinstalls the library copy over each agent's installed files — any local edits to the installed skill are lost. Export a backup first if you need them.`,updatedToast:(e,n)=>`Updated ${e} to the latest version (${n} agent(s))`,uninstalledToast:(e,n)=>`Uninstalled ${e} from ${n}`,uninstallConfirmTitle:e=>`Uninstall ${e}`,uninstallConfirmBody:(e,n)=>`Uninstall ${e} from ${n}? Its installed files (local edits included) will be deleted.`},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)"},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…",steerPlaceholder:"Message the running agent — delivered with the next turn",steerPlaceholderShort:"Message the running agent…",steerSend:"Send to the running agent",steerQueuedIndicator:"Steering queued — delivered with the next turn",userSteering:"User steering",steerModeLabel:"Mid-run send mode",steerModeSteer:"Steer",steerModeSteerHint:"Steer now: delivered to the running agent with the next turn",steerModeFollowUp:"Queue",steerModeFollowUpHint:"Queue a follow-up: sent automatically as a new message when this run finishes",followUpPlaceholder:"Queue as the next message — sent automatically when this run finishes",followUpPlaceholderShort:"Queue as the next message…",followUpSend:"Queue as the next message",followUpQueuedChip:e=>`${e} follow-up ${e===1?"message":"messages"} queued — sent when this run finishes`,send:"Send",stop:"Stop",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}`:""}`,modelAuthDead:"Model API authentication failed: update this model's API key on the Models page, or start a new Session.",modelAuthDeadOpenModels:"Open Models page",modelAuthDeadRetry:"Retry",modelAuthDeadCta:"New Session",modelAuthDeadPlaceholder:"Model authentication failed — update the API key first",reconnect:(e,n,r,s)=>{const o=e==="timeout"?"Connection timed out":"Response incomplete or unparseable",c=n==="gaveUp"?"no further retries":n==="retried"?`retry #${r} sent`:s!==void 0?`retry #${r} in ${s}s…`:`starting retry #${r}…`;return`[Retry] ${o}; ${c}`},reconnectRetryNow:"Retry now",reconnectGiveUp:"Give up",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",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",statsLabel:"Stats",removeImage:"Remove image",openWorkspace:"Open workspace",openAgents:"Agents panel",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",switchModel:"Switch model — continue this conversation in a new session",switchModelTitle:"Switch model",modelSwitchFrom:e=>e?`Switched model (was ${e}) — continued from the earlier conversation`:"Switched model — continued from the earlier conversation",modelSwitchAutoMessage:"Continue this conversation on the new model",scheduledFrom:e=>`Triggered by scheduled task "${e}"`,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)",workRunning:"Running",workDone:"Done",workGroupSteps:e=>`${e} ${e===1?"step":"steps"}`,approvalWaiting:"awaiting approval",copyCode:"Copy code",copyReply:"Copy reply",copyMessage:"Copy message",deleteSession:"Delete chat",renameSession:"Rename chat",renameSessionLabel:"Title",deleteSessionConfirm:e=>`Delete "${e}"? Its messages and Trace will be removed permanently.`,archiveSession:"Archive",unarchiveSession:"Unarchive",loadMore:"More",folderGroups:{subagent:e=>`Subagents (${e})`,schedule:e=>`Scheduled (${e})`,archived:e=>`Archived (${e})`},skillsBanner:e=>`Using skill${e.length===1?"":"s"}: ${e.join(", ")}`,plusMenu:"More input options",uploadImage:"Upload image",uploadImageDesc:"Attach images to this message",goalMode:"Goal mode",goalModeDesc:"Loop until the goal completes",goalBudgetLabel:"Token budget",goalBudgetUnlimited:"Budget unlimited",goalBudgetValue:e=>`Budget ${e}`,goalBudgetPlaceholder:"e.g. 500k",goalBudgetHint:"Use a k/m suffix; leave blank for no budget limit",goalBudgetInvalid:"Invalid budget: use a positive number with an optional k/m suffix (500k, 2m)",goalBudgetSave:"Save budget",goalRemove:"Exit goal mode",goalRoundBanner:e=>`Goal · round ${e}`,goalProgress:(e,n)=>`round ${e} · tokens ${n}`,goalStatus:{active:"running",complete:"complete",blocked:"blocked",budget_limited:"budget exhausted",aborted:"interrupted"}},subagentPanel:{title:"Agents panel",topologyLabel:"Call graph",mainSessionNote:"The main conversation stays in the chat area",empty:"No subagents in the current task yet",nodeRunning:"running",nodeDone:"done"},files:{title:"Files",upload:"Upload",download:"Download",openInNewTab:"Open in new tab",previewNotIsolatedHint:"This address has no separate preview origin, so the page opens sandboxed: localStorage, cookies and third-party embeds will not work. Reach the app over 127.0.0.1 or localhost, or set PENGUIN_PREVIEW_ORIGIN.",refresh:"Refresh",root:"Workspace root",empty:"Empty directory",previewUnsupported:"Preview not supported for this type; download instead",uploaded:"Uploaded",overwriteTitle:"Overwrite existing files",overwriteConfirm:e=>`The current directory already has ${e} file(s) with these names — uploading will overwrite:`,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",requests:"Requests",from:"From",to:"To",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",uncostedNote:"* Only models with configured pricing count toward cost",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",errorsColCode:"Source · code",errorsColKind:"Type",errorsColMessage:"Message",errorsEmpty:"No errors"},traces:{title:"Traces",timeline:"Execution timeline",laneLLM:"Model",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",compactions:"compactions",compactionRound:"Compaction",empty:"No Traces for this agent",inProgress:"in progress",systemPrompt:"System prompt",toolDefs:e=>`Tool definitions (${e})`,exportFile:"Export",importTrace:"Import Trace",importing:"Importing…",fileTooLarge:"The file exceeds the 14MB limit."},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",colVersion:"Version",colModel:"Model",colScore:"Score",colDuration:"Duration",colCase:"Case",colRun:"Run",colSession:"Session"},errors:{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",byCode:{invalid_credentials:"Incorrect username or password.",password_mismatch:"The current password is incorrect.",invalid_password:"Password must be at least 8 characters.",admin_required:"Only an admin can perform this operation.",not_found:"This resource does not exist, or you do not have access.",agent_not_found:"This agent no longer exists.",agent_exists:"This agent id is already taken.",project_exists:"This Project id is already taken.",user_exists:"This username is already taken.",user_not_found:"This user no longer exists.",cannot_delete_admin:"The built-in admin cannot be deleted.",member_not_found:"This user is not a member of the Project.",schedule_exists:"A scheduled task with this name already exists.",schedule_not_found:"This scheduled task no longer exists.",unknown_skill:"This skill is not in the library.",file_not_found:"This file no longer exists.",file_too_large:"The file is too large.",payload_too_large:"The request is too large.",dir_not_absolute:"The directory must be an absolute path.",not_a_dir:"That path is not a directory.",path_not_found:"That path does not exist.",workspace_missing:"This Session's Workspace no longer exists.",task_in_progress:"This Session already has a task running.",version_conflict:"The snapshot's version is not newer than the current one.",invalid_title:"The title is invalid.",invalid_trace:"This file is not a valid Trace file.",trace_session_exists:"This agent already has a Session with that id; a duplicate Trace cannot be imported."}}},$b="penguin.lang",Bb=v.createContext(null);function nj(e){return e?.toLowerCase().startsWith("zh")?"zh":"en"}function aj(){return nj(navigator.language)}function rj(e){return e==="system"?aj():e}function sj(){const e=localStorage.getItem($b);return e==="zh"||e==="en"||e==="system"?e:"system"}function lj({children:e}){const[n,r]=v.useState(sj),[,s]=v.useState(0),o=rj(n);ej(o==="en"?tj:Ub),v.useEffect(()=>{if(n!=="system")return;const d=()=>s(f=>f+1);return window.addEventListener("languagechange",d),()=>window.removeEventListener("languagechange",d)},[n]);const c=v.useCallback(d=>{localStorage.setItem($b,d),r(d)},[]);return l.jsx(Bb.Provider,{value:{lang:n,locale:o,setLang:c},children:e})}function ij({children:e}){const{locale:n}=Qa();return l.jsx("div",{className:"contents",children:e},n)}function Qa(){const e=v.useContext(Bb);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}const Rh=7,Hb="penguin.theme",Pb="penguin.fontScale",qb="penguin.accent",Fb="penguin.currency",oj={sm:"16px",md:"18px",lg:"20px"},Vb=v.createContext(null);function cj(){const e=localStorage.getItem(Hb);return e==="light"||e==="dark"||e==="system"?e:"system"}function uj(){const e=localStorage.getItem(Pb);return e==="sm"||e==="md"||e==="lg"?e:"md"}function dj(){const e=localStorage.getItem(qb);return e==="neutral"||e==="blue"||e==="green"||e==="violet"||e==="rose"||e==="amber"?e:"neutral"}function fj(){return localStorage.getItem(Fb)==="CNY"?"CNY":"USD"}function mj(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function hj({children:e}){const[n,r]=v.useState(cj),[s,o]=v.useState(mj),[c,d]=v.useState(uj),[f,m]=v.useState(dj),[h,g]=v.useState(fj),y=n==="system"?s:n==="dark";v.useEffect(()=>{document.documentElement.classList.toggle("dark",y)},[y]),v.useEffect(()=>{document.documentElement.style.fontSize=oj[c]},[c]),v.useEffect(()=>{f==="neutral"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=f},[f]),v.useEffect(()=>{if(n!=="system")return;const M=window.matchMedia("(prefers-color-scheme: dark)"),A=R=>o(R.matches);return o(M.matches),M.addEventListener("change",A),()=>M.removeEventListener("change",A)},[n]);const k=v.useCallback(M=>{localStorage.setItem(Hb,M),r(M)},[]),w=v.useCallback(M=>{localStorage.setItem(Pb,M),d(M)},[]),N=v.useCallback(M=>{localStorage.setItem(qb,M),m(M)},[]),C=v.useCallback(M=>{localStorage.setItem(Fb,M),g(M)},[]);return l.jsx(Vb.Provider,{value:{mode:n,dark:y,setMode:k,fontScale:c,setFontScale:w,accent:f,setAccent:N,currency:h,setCurrency:C},children:e})}function Gs(){const e=v.useContext(Vb);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}const pj=[{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 Ka extends Error{status;code;constructor(n,r,s){super(s),this.name="ApiError",this.status=n,this.code=r}}let Gb=null;function Ny(e){Gb=e}function gj(e){return e.startsWith("/api/auth/")}async function Ce(e,n={}){let r=e;if(n.query){const c=new URLSearchParams;for(const[f,m]of Object.entries(n.query))m!==void 0&&c.set(f,String(m));const d=c.toString();d&&(r+=`?${d}`)}let s;try{s=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 Ka(0,"network_error",x.errors.networkError)}if(!s.ok){let c="http_error",d=x.common.unknownError;try{const f=await s.json();f.error?.code&&(c=f.error.code),f.error?.message&&(d=f.error.message)}catch{}throw s.status===401&&!gj(e)&&Gb?.(),new Ka(s.status,c,d)}if(s.status===204)return;const o=await s.text();if(o)return JSON.parse(o)}const xj=e=>Ce("/api/auth/login",{method:"POST",body:e}),yj=()=>Ce("/api/auth/logout",{method:"POST",body:{}}),ou=()=>Ce("/api/me"),bj=e=>Ce("/api/me/password",{method:"PUT",body:e}),vj=()=>Ce("/api/me/prefs"),Wb=e=>Ce("/api/me/prefs",{method:"PUT",body:e}),kj=()=>Ce("/api/admin/users"),wj=e=>Ce("/api/admin/users",{method:"POST",body:e}),Sj=(e,n)=>Ce(`/api/admin/users/${encodeURIComponent(e)}/password`,{method:"POST",body:n}),jj=e=>Ce(`/api/admin/users/${encodeURIComponent(e)}`,{method:"DELETE"}),Nj=()=>Ce("/api/projects"),Cj=e=>Ce("/api/projects",{method:"POST",body:e}),Tj=e=>Ce(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE"}),cm=e=>Ce(`/api/projects/${encodeURIComponent(e)}/members`),Mj=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:n}),Ej=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(n)}`,{method:"DELETE"}),_u=e=>Ce(`/api/projects/${encodeURIComponent(e)}/models`),Aj=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/models`,{method:"PUT",body:n}),Kb=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/models/test`,{method:"POST",body:n}),Rj=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`),_j=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`,{method:"PUT",body:r}),Ij=e=>Ce(`/api/projects/${encodeURIComponent(e)}/agents`),Lj=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents`,{method:"POST",body:n}),_h=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`),Yb=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`,{method:"PUT",body:r}),Dj=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config/reset`,{method:"POST"}),Oj=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces`),Cy=(e,n,r)=>{const s=r?`?limit=${r.limit}&offset=${r.offset}`+(r.category?`&category=${r.category}`:"")+(r.withCounts?"&counts=1":""):"";return Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions${s}`)},Ty=(e,n="")=>Ce(`/api/projects/${encodeURIComponent(e)}/dirs?path=${encodeURIComponent(n)}`),pu=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions`,{method:"POST",body:r}),My=e=>Ce(`/api/sessions/${encodeURIComponent(e)}`),Wm=(e,n)=>Ce(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),oo=e=>Ce(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),zj=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/messages`),$l=(e,n)=>Ce(`/api/sessions/${encodeURIComponent(e)}/tasks`,{method:"POST",body:n}),Uj=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/goal`),$j=(e,n,r)=>Ce(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(n)}`,{method:"POST",body:r}),Bj=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/abort`,{method:"POST",body:{}}),Hj=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/retry-now`,{method:"POST",body:{}}),Pj=(e,n)=>Ce(`/api/sessions/${encodeURIComponent(e)}/steer`,{method:"POST",body:n}),qj=e=>Ce(`/api/sessions/${encodeURIComponent(e)}/compact`,{method:"POST",body:{}}),Fj=(e,n,r,s,o,c)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}`,{query:{offset:o,limit:c}}),Vj=(e,n,r,s)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}/analysis`),Gj=(e,n,r,s)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}/download`,Wj=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/import`,{method:"POST",body:r}),Qb=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/usage`,{query:{from:n.from,to:n.to,groupBy:n.groupBy,agentId:n.agentId,provider:n.provider,modelId:n.modelId}}),Kj=(e,n)=>Ce(`/api/projects/${e}/agents/${n}`,{method:"DELETE"}),Yj=(e,n)=>Ce(`/api/sessions/${e}/files`,{query:{path:n}}),is=(e,n,r=!1)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(n)}${r?"&download=1":""}`,Ey=(e,n)=>`/api/sessions/${e}/files/preview-redirect?path=${encodeURIComponent(n)}`,Qj=(e,n,r)=>Ce(`/api/sessions/${e}/files/content`,{method:"PUT",body:{dataBase64:r},query:{path:n}}),Xj=(e,n)=>Ce(`/api/sessions/${e}/files/stat`,{method:"POST",body:{paths:n}}),Zj=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`),Jj=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`,{method:"POST",body:r}),Ay=(e,n,r,s)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"PUT",body:s}),e5=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"DELETE"}),t5=()=>Ce("/api/skills"),Ih=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`),Ry=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`,{method:"POST",body:{names:r}}),n5=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/${encodeURIComponent(r)}`,{method:"DELETE"}),a5=(e,n)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks`),r5=(e,n)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/export`,s5=(e,n,r)=>Ce(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/import`,{method:"POST",body:r}),l5=()=>Ce("/api/version"),Xb=(e=!1)=>Ce(`/api/version/update-check${e?"?force=1":""}`),i5=()=>Ce("/api/version/update",{method:"POST",body:{}}),Zb=v.createContext(null);function o5({children:e}){const[n,r]=v.useState(void 0),[s,o]=v.useState(!0);v.useEffect(()=>(Ny(()=>r(null)),()=>Ny(null)),[]),v.useEffect(()=>{let m=!1;return ou().then(h=>{m||(r(h.user),o(h.previewIsolated))}).catch(h=>{m||(h instanceof Ka&&h.status,r(null))}),()=>{m=!0}},[]);const c=v.useCallback(async(m,h)=>{const g=await xj({userId:m,password:h});r(g.user);try{const y=await ou();r(y.user),o(y.previewIsolated)}catch{}},[]),d=v.useCallback(async()=>{try{await yj()}finally{r(null)}},[]),f=v.useCallback(async()=>{const m=await ou();r(m.user),o(m.previewIsolated)},[]);return l.jsx(Zb.Provider,{value:{user:n,previewIsolated:s,login:c,logout:d,refresh:f},children:e})}function $n(){const e=v.useContext(Zb);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const Lh=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Jb=/^[\\/]{2}/;function c5(e,n){return n+e.replace(/\\/g,"/")}const _y="popstate";function Iy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function u5(e={}){function n(s,o){let c=o.state?.masked,{pathname:d,search:f,hash:m}=c||s.location;return Km("",{pathname:d,search:f,hash:m},o.state&&o.state.usr||null,o.state&&o.state.key||"default",c?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,o){return typeof o=="string"?o:co(o)}return f5(n,r,null,e)}function $t(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function ir(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function d5(){return Math.random().toString(36).substring(2,10)}function Ly(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 Km(e,n,r=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Vl(n):n,state:r,key:n&&n.key||s||d5(),mask:o}}function co({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 Vl(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(n.search=e.substring(s),e=e.substring(0,s)),e&&(n.pathname=e)}return n}function f5(e,n,r,s={}){let{window:o=document.defaultView,v5Compat:c=!1}=s,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 y(){f="POP";let M=g(),A=M==null?null:M-h;h=M,m&&m({action:f,location:C.location,delta:A})}function k(M,A){f="PUSH";let R=Iy(M)?M:Km(C.location,M,A);h=g()+1;let I=Ly(R,h),P=C.createHref(R.mask||R);try{d.pushState(I,"",P)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;o.location.assign(P)}c&&m&&m({action:f,location:C.location,delta:1})}function w(M,A){f="REPLACE";let R=Iy(M)?M:Km(C.location,M,A);h=g();let I=Ly(R,h),P=C.createHref(R.mask||R);d.replaceState(I,"",P),c&&m&&m({action:f,location:C.location,delta:0})}function N(M){return m5(o,M)}let C={get action(){return f},get location(){return e(o,d)},listen(M){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(_y,y),m=M,()=>{o.removeEventListener(_y,y),m=null}},createHref(M){return n(o,M)},createURL:N,encodeLocation(M){let A=N(M);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:k,replace:w,go(M){return d.go(M)}};return C}function m5(e,n,r=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),$t(s,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:co(n);return o=o.replace(/ $/,"%20"),!r&&Jb.test(o)&&(o=s+o),new URL(o,s)}function ev(e,n,r="/"){return h5(e,n,r,!1)}function h5(e,n,r,s,o){let c=hs((typeof n=="string"?Vl(n):n).pathname||"/",r);if(c==null)return null;let d=p5(e),f=null,m=sv(c);for(let h=0;f==null&&h<d.length;++h)f=T5(d[h],m,s);return f}function p5(e){let n=tv(e);return g5(n),n}function tv(e,n=[],r=[],s="",o=!1){let c=(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(s)&&m)return;$t(g.relativePath.startsWith(s),`Absolute route path "${g.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(s.length)}let y=Ga([s,g.relativePath]),k=r.concat(g);d.children&&d.children.length>0&&($t(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),tv(d.children,n,k,y,m)),!(d.path==null&&!d.index)&&n.push({path:y,score:N5(y,d.index),routesMeta:k.map((w,N)=>{let[C,M]=rv(w.relativePath,w.caseSensitive,N===k.length-1);return{...w,matcher:C,compiledParams:M}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let m of nv(d.path))c(d,f,!0,m)}),n}function nv(e){let n=e.split("/");if(n.length===0)return[];let[r,...s]=n,o=r.endsWith("?"),c=r.replace(/\?$/,"");if(s.length===0)return o?[c,""]:[c];let d=nv(s.join("/")),f=[];return f.push(...d.map(m=>m===""?c:[c,m].join("/"))),o&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function g5(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:C5(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}const x5=/^:[\w-]+$/,y5=/^:[\w-]+/,b5=3.5,v5=3,k5=2,w5=1,S5=10,j5=-2,Dy=e=>e==="*";function N5(e,n){let r=e.split("/"),s=r.length;return r.some(Dy)&&(s+=j5),n&&(s+=k5),r.filter(o=>!Dy(o)).reduce((o,c)=>o+(x5.test(c)?v5:y5.test(c)?b5:c===""?w5:S5),s)}function C5(e,n){return e.length===n.length&&e.slice(0,-1).every((r,s)=>r===n[s])?e[e.length-1]-n[n.length-1]:0}function T5(e,n,r=!1){let{routesMeta:s}=e,o={},c="/",d=[];for(let f=0;f<s.length;++f){let m=s[f],h=f===s.length-1,g=c==="/"?n:n.slice(c.length)||"/",y={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},k=m.matcher&&m.compiledParams?av(y,g,m.matcher,m.compiledParams):uo(y,g),w=m.route;if(!k&&h&&r&&!s[s.length-1].route.index&&(k=uo({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!k)return null;Object.assign(o,k.params),d.push({params:o,pathname:Ga([c,k.pathname]),pathnameBase:A5(Ga([c,k.pathnameBase])),route:w}),k.pathnameBase!=="/"&&(c=Ga([c,k.pathnameBase]))}return d}function uo(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=rv(e.path,e.caseSensitive,e.end);return av(e,n,r,s)}function av(e,n,r,s){let o=n.match(r);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let w=f[y]||"";d=c.slice(0,c.length-w.length).replace(/(.)\/+$/,"$1")}const k=f[y];return g&&!k?m[h]=void 0:m[h]=(k||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function rv(e,n=!1,r=!0){ir(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 s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,f,m,h)=>{if(s.push({paramName:d,isOptional:f!=null}),f){let g=h.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,"(?:/$1)?");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),s]}function sv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return ir(!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 hs(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}function M5(e,n="/"){let{pathname:r,search:s="",hash:o=""}=typeof e=="string"?Vl(e):e,c;return r?(r=lv(r),r.startsWith("/")?c=Oy(r.substring(1),"/"):c=Oy(r,n)):c=n,{pathname:c,search:R5(s),hash:_5(o)}}function Oy(e,n){let r=iv(n).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function um(e,n,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(s)}]. 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 E5(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Dh(e){let n=E5(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function Iu(e,n,r,s=!1){let o;typeof e=="string"?o=Vl(e):(o={...e},$t(!o.pathname||!o.pathname.includes("?"),um("?","pathname","search",o)),$t(!o.pathname||!o.pathname.includes("#"),um("#","pathname","hash",o)),$t(!o.search||!o.search.includes("#"),um("#","search","hash",o)));let c=e===""||o.pathname==="",d=c?"/":o.pathname,f;if(d==null)f=r;else{let y=n.length-1;if(!s&&d.startsWith("..")){let k=d.split("/");for(;k[0]==="..";)k.shift(),y-=1;o.pathname=k.join("/")}f=y>=0?n[y]:"/"}let m=M5(o,f),h=d&&d!=="/"&&d.endsWith("/"),g=(c||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}const lv=e=>e.replace(/[\\/]{2,}/g,"/"),Ga=e=>lv(e.join("/")),iv=e=>e.replace(/\/+$/,""),A5=e=>iv(e).replace(/^\/*/,"/"),R5=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_5=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var I5=class{status;statusText;data;error;internal;constructor(e,n,r,s=!1){this.status=e,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function L5(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function D5(e){return Ga(e.map(n=>n.route.path).filter(Boolean))||"/"}const ov=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cv(e,n){let r=e;if(typeof r!="string"||!Lh.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,o=!1;if(ov)try{let c=new URL(window.location.href),d=Jb.test(r)?new URL(c5(r,c.protocol)):new URL(r),f=hs(d.pathname,n);d.origin===c.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{ir(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:r}}const uv=["POST","PUT","PATCH","DELETE"];new Set(uv);const O5=["GET",...uv];new Set(O5);const z5=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function U5(e){try{return z5.includes(new URL(e).protocol)}catch{return!1}}const Gl=v.createContext(null);Gl.displayName="DataRouter";const Lu=v.createContext(null);Lu.displayName="DataRouterState";const dv=v.createContext(!1);function $5(){return v.useContext(dv)}const fv=v.createContext({isTransitioning:!1});fv.displayName="ViewTransition";const B5=v.createContext(new Map);B5.displayName="Fetchers";const H5=v.createContext(null);H5.displayName="Await";const Ia=v.createContext(null);Ia.displayName="Navigation";const bo=v.createContext(null);bo.displayName="Location";const La=v.createContext({outlet:null,matches:[],isDataRoute:!1});La.displayName="Route";const Oh=v.createContext(null);Oh.displayName="RouteError";const mv="REACT_ROUTER_ERROR",P5="REDIRECT",q5="ROUTE_ERROR_RESPONSE";function F5(e){if(e.startsWith(`${mv}:${P5}:{`))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 V5(e){if(e.startsWith(`${mv}:${q5}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new I5(n.status,n.statusText,n.data)}catch{}}function G5(e,{relative:n}={}){$t(Ws(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=v.useContext(Ia),{hash:o,pathname:c,search:d}=vo(e,{relative:n}),f=c;return r!=="/"&&(f=c==="/"?r:Ga([r,c])),s.createHref({pathname:f,search:d,hash:o})}function Ws(){return v.useContext(bo)!=null}function ha(){return $t(Ws(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(bo).location}function hv(e){$t(Ws(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:n}=ha();return v.useMemo(()=>uo(e,sv(n)),[n,e])}const pv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function pa(){let{isDataRoute:e}=v.useContext(La);return e?o4():W5()}function W5(){$t(Ws(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Gl),{basename:n,navigator:r}=v.useContext(Ia),{matches:s}=v.useContext(La),{pathname:o}=ha(),c=JSON.stringify(Dh(s)),d=v.useRef(!1);return v.useLayoutEffect(()=>{d.current=!0}),v.useCallback((f,m={})=>{if(ir(d.current,pv),!d.current)return;if(typeof f=="number"){r.go(f);return}let h=Iu(f,JSON.parse(c),o,m.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Ga([n,h.pathname])),(m.replace?r.replace:r.push)(h,m.state,m)},[n,r,c,o,e])}const K5=v.createContext(null);function Y5(e){let n=v.useContext(La).outlet;return v.useMemo(()=>n&&v.createElement(K5.Provider,{value:e},n),[n,e])}function gv(){let{matches:e}=v.useContext(La);return e[e.length-1]?.params??{}}function vo(e,{relative:n}={}){let{matches:r}=v.useContext(La),{pathname:s}=ha(),o=JSON.stringify(Dh(r));return v.useMemo(()=>Iu(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function Q5(e,n){return xv(e,n)}function xv(e,n,r){$t(Ws(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(Ia),{matches:o}=v.useContext(La),c=o[o.length-1],d=c?c.params:{};c&&c.pathname;let f=c?c.pathnameBase:"/";c&&c.route;let m=ha(),h;if(n){let N=typeof n=="string"?Vl(n):n;$t(f==="/"||N.pathname?.startsWith(f),`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 "${f}" but pathname "${N.pathname}" was given in the \`location\` prop.`),h=N}else h=m;let g=h.pathname||"/",y=g;if(f!=="/"){let N=f.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(N.length).join("/")}let k=r&&r.state.matches.length?r.state.matches.map(N=>Object.assign(N,{route:r.manifest[N.route.id]||N.route})):ev(e,{pathname:y}),w=n4(k&&k.map(N=>Object.assign({},N,{params:Object.assign({},d,N.params),pathname:Ga([f,s.encodeLocation?s.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?f:Ga([f,s.encodeLocation?s.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),o,r);return n&&w?v.createElement(bo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...h},navigationType:"POP"}},w):w}function X5(){let e=i4(),n=L5(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null;return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},n),r?v.createElement("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"}},r):null,null)}const Z5=v.createElement(X5,null);var J5=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=dv;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=V5(e.digest);r&&(e=r)}let n=e!==void 0?v.createElement(La.Provider,{value:this.props.routeContext},v.createElement(Oh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(e4,{error:e},n):n}};const dm=new WeakMap;function e4({children:e,error:n}){let{basename:r}=v.useContext(Ia);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=F5(n.digest);if(s){let o=dm.get(n);if(o)throw o;let c=cv(s.location,r),d=c.absoluteURL||c.to;if(U5(d))throw new Error("Invalid redirect location");if(ov&&!dm.get(n))if(c.isExternal||s.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:s.replace}));throw dm.set(n,f),f}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function t4({routeContext:e,match:n,children:r}){let s=v.useContext(Gl);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(La.Provider,{value:e},r)}function n4(e,n=[],r){let s=r?.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(n.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,c=s?.errors;if(c!=null){let g=o.findIndex(y=>y.route.id&&c?.[y.route.id]!==void 0);$t(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,g+1))}let d=!1,f=-1;if(r&&s){d=s.renderFallback;for(let g=0;g<o.length;g++){let y=o[g];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(f=g),y.route.id){let{loaderData:k,errors:w}=s,N=y.route.loader&&!k.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||N){r.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let m=r?.onError,h=s&&m?(g,y)=>{m(g,{location:s.location,params:s.matches?.[0]?.params??{},pattern:D5(s.matches),errorInfo:y})}:void 0;return o.reduceRight((g,y,k)=>{let w,N=!1,C=null,M=null;s&&(w=c&&y.route.id?c[y.route.id]:void 0,C=y.route.errorElement||Z5,d&&(f<0&&k===0?(c4("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,M=null):f===k&&(N=!0,M=y.route.hydrateFallbackElement||null)));let A=n.concat(o.slice(0,k+1)),R=()=>{let I;return w?I=C:N?I=M:y.route.Component?I=v.createElement(y.route.Component,null):y.route.element?I=y.route.element:I=g,v.createElement(t4,{match:y,routeContext:{outlet:g,matches:A,isDataRoute:s!=null},children:I})};return s&&(y.route.ErrorBoundary||y.route.errorElement||k===0)?v.createElement(J5,{location:s.location,revalidation:s.revalidation,component:C,error:w,children:R(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:h}):R()},null)}function zh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function a4(e){let n=v.useContext(Gl);return $t(n,zh(e)),n}function r4(e){let n=v.useContext(Lu);return $t(n,zh(e)),n}function s4(e){let n=v.useContext(La);return $t(n,zh(e)),n}function Uh(e){let n=s4(e),r=n.matches[n.matches.length-1];return $t(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function l4(){return Uh("useRouteId")}function i4(){let e=v.useContext(Oh),n=r4("useRouteError"),r=Uh("useRouteError");return e!==void 0?e:n.errors?.[r]}function o4(){let{router:e}=a4("useNavigate"),n=Uh("useNavigate"),r=v.useRef(!1);return v.useLayoutEffect(()=>{r.current=!0}),v.useCallback(async(s,o={})=>{ir(r.current,pv),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:n,...o}))},[e,n])}const zy={};function c4(e,n,r){zy[e]||(zy[e]=!0,ir(!1,r))}v.memo(u4);function u4({routes:e,manifest:n,future:r,state:s,isStatic:o,onError:c}){return xv(e,void 0,{manifest:n,state:s,isStatic:o,onError:c})}function fo({to:e,replace:n,state:r,relative:s}){$t(Ws(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=v.useContext(Ia);ir(!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:c}=v.useContext(La),{pathname:d}=ha(),f=pa(),m=Iu(e,Dh(c),d,s==="path"),h=JSON.stringify(m);return v.useEffect(()=>{f(JSON.parse(h),{replace:n,state:r,relative:s})},[f,h,s,n,r]),null}function d4(e){return Y5(e.context)}function Qn(e){$t(!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 f4({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:o,static:c=!1,useTransitions:d}){$t(!Ws(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=v.useMemo(()=>({basename:f,navigator:o,static:c,useTransitions:d,future:{}}),[f,o,c,d]);typeof r=="string"&&(r=Vl(r));let{pathname:h="/",search:g="",hash:y="",state:k=null,key:w="default",mask:N}=r,C=v.useMemo(()=>{let M=hs(h,f);return M==null?null:{location:{pathname:M,search:g,hash:y,state:k,key:w,mask:N},navigationType:s}},[f,h,g,y,k,w,s,N]);return ir(C!=null,`<Router basename="${f}"> is not able to match the URL "${h}${g}${y}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:v.createElement(Ia.Provider,{value:m},v.createElement(bo.Provider,{children:n,value:C}))}function m4({children:e,location:n}){return Q5(Ym(e),n)}function Ym(e,n=[]){let r=[];return v.Children.forEach(e,(s,o)=>{if(!v.isValidElement(s))return;let c=[...n,o];if(s.type===v.Fragment){r.push.apply(r,Ym(s.props.children,c));return}$t(s.type===Qn,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let d=s.props;$t(!d.index||!d.children,"An index route cannot have child routes.");let f={id:d.id||c.join("-"),caseSensitive:d.caseSensitive,element:d.element,Component:d.Component,index:d.index,path:d.path,middleware:d.middleware,loader:d.loader,action:d.action,hydrateFallbackElement:d.hydrateFallbackElement,HydrateFallback:d.HydrateFallback,errorElement:d.errorElement,ErrorBoundary:d.ErrorBoundary,shouldRevalidate:d.shouldRevalidate,handle:d.handle,lazy:d.lazy};d.children&&(f.children=Ym(d.children,c)),r.push(f)}),r}const cu="application/x-www-form-urlencoded";function Du(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function h4(e){return Du(e)&&e.tagName.toLowerCase()==="button"}function p4(e){return Du(e)&&e.tagName.toLowerCase()==="form"}function g4(e){return Du(e)&&e.tagName.toLowerCase()==="input"}function x4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function y4(e,n){return e.button===0&&(!n||n==="_self")&&!x4(e)}function Qm(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let s=e[r];return n.concat(Array.isArray(s)?s.map(o=>[r,o]):[[r,s]])},[]))}function b4(e,n){let r=Qm(e);return n&&n.forEach((s,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}let Uc=null;function v4(){if(Uc===null)try{new FormData(document.createElement("form"),0),Uc=!1}catch{Uc=!0}return Uc}const k4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function fm(e){return e!=null&&!k4.has(e)?(ir(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${cu}"`),null):e}function w4(e,n){let r,s,o,c,d;if(p4(e)){let f=e.getAttribute("action");s=f?hs(f,n):null,r=e.getAttribute("method")||"get",o=fm(e.getAttribute("enctype"))||cu,c=new FormData(e)}else if(h4(e)||g4(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(s=m?hs(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||"get",o=fm(e.getAttribute("formenctype"))||fm(f.getAttribute("enctype"))||cu,c=new FormData(f,e),!v4()){let{name:h,type:g,value:y}=e;if(g==="image"){let k=h?`${h}.`:"";c.append(`${k}x`,"0"),c.append(`${k}y`,"0")}else h&&c.append(h,y)}}else{if(Du(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r="get",s=null,o=cu,d=e}return c&&o==="text/plain"&&(d=c,c=void 0),{action:s,method:r.toLowerCase(),encType:o,formData:c,body:d}}function $h(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function yv(e,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${n}`:r.pathname=`${r.pathname}.${n}`,r}async function S4(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 j4(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 N4(e,n,r){return E4((await Promise.all(e.map(async s=>{let o=n.routes[s.route.id];if(o){let c=await S4(o,r);return c.links?c.links():[]}return[]}))).flat(1).filter(j4).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Uy(e,n,r,s,o,c){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 c==="assets"?n.filter((m,h)=>d(m,h)||f(m,h)):c==="data"?n.filter((m,h)=>{let g=s.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(d(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let y=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 y=="boolean")return y}return!0}):[]}function C4(e,n,{includeHydrateFallback:r}={}){return T4(e.map(s=>{let o=n.routes[s.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function T4(e){return[...new Set(e)]}function M4(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function E4(e,n){let r=new Set;return new Set(n),e.reduce((s,o)=>{let c=JSON.stringify(M4(o));return r.has(c)||(r.add(c),s.push({key:c,link:o})),s},[])}function A4(){let e=v.useContext(Gl);return $h(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function R4(){let e=v.useContext(Lu);return $h(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}const Bh=v.createContext(void 0);Bh.displayName="FrameworkContext";function Hh(){let e=v.useContext(Bh);return $h(e,"You must render this element inside a <HydratedRouter> element"),e}function _4(e,n){let r=v.useContext(Bh),[s,o]=v.useState(!1),[c,d]=v.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:y}=n,k=v.useRef(null);v.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let C=A=>{A.forEach(R=>{d(R.isIntersecting)})},M=new IntersectionObserver(C,{threshold:.5});return k.current&&M.observe(k.current),()=>{M.disconnect()}}},[e]),v.useEffect(()=>{if(s){let C=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(C)}}},[s]);let w=()=>{o(!0)},N=()=>{o(!1),d(!1)};return r?e!=="intent"?[c,k,{}]:[c,k,{onFocus:$i(f,w),onBlur:$i(m,N),onMouseEnter:$i(h,w),onMouseLeave:$i(g,N),onTouchStart:$i(y,w)}]:[!1,k,{}]}function $i(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function I4({page:e,...n}){let r=$5(),{nonce:s}=Hh(),{router:o}=A4(),c=v.useMemo(()=>ev(o.routes,e,o.basename),[o.routes,e,o.basename]);return c?(n.nonce==null&&s&&(n={...n,nonce:s}),r?v.createElement(D4,{page:e,matches:c,...n}):v.createElement(O4,{page:e,matches:c,...n})):null}function L4(e){let{manifest:n,routeModules:r}=Hh(),[s,o]=v.useState([]);return v.useEffect(()=>{let c=!1;return N4(e,n,r).then(d=>{c||o(d)}),()=>{c=!0}},[e,n,r]),s}function D4({page:e,matches:n,...r}){let s=ha(),o=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let c=yv(e,"rsc"),d=!1,f=[];for(let m of n)typeof m.route.shouldRevalidate=="function"?d=!0:f.push(m.route.id);return d&&f.length>0&&c.searchParams.set("_routes",f.join(",")),[c.pathname+c.search]},[e,s,n]);return v.createElement(v.Fragment,null,o.map(c=>v.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...r})))}function O4({page:e,matches:n,...r}){let s=ha(),{manifest:o,routeModules:c}=Hh(),{loaderData:d,matches:f}=R4(),m=v.useMemo(()=>Uy(e,n,f,o,s,"data"),[e,n,f,o,s]),h=v.useMemo(()=>Uy(e,n,f,o,s,"assets"),[e,n,f,o,s]),g=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,N=!1;if(n.forEach(M=>{let A=o.routes[M.route.id];!A||!A.hasLoader||(!m.some(R=>R.route.id===M.route.id)&&M.route.id in d&&c[M.route.id]?.shouldRevalidate||A.hasClientLoader?N=!0:w.add(M.route.id))}),w.size===0)return[];let C=yv(e,"data");return N&&w.size>0&&C.searchParams.set("_routes",n.filter(M=>w.has(M.route.id)).map(M=>M.route.id).join(",")),[C.pathname+C.search]},[d,s,o,m,n,e,c]),y=v.useMemo(()=>C4(h,o),[h,o]),k=L4(h);return v.createElement(v.Fragment,null,g.map(w=>v.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),y.map(w=>v.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),k.map(({key:w,link:N})=>v.createElement("link",{key:w,nonce:r.nonce,...N,crossOrigin:N.crossOrigin??r.crossOrigin})))}function z4(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}const U4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{U4&&(window.__reactRouterVersion="8.3.0")}catch{}function $4({basename:e,children:n,useTransitions:r,window:s}){let o=v.useRef(null);o.current==null&&(o.current=u5({window:s,v5Compat:!0}));let c=o.current,[d,f]=v.useState({action:c.action,location:c.location}),m=v.useCallback(h=>{r===!1?f(h):v.startTransition(()=>f(h))},[r]);return v.useLayoutEffect(()=>c.listen(m),[c,m]),v.createElement(f4,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:r})}const Ph=v.forwardRef(function({onClick:n,discover:r="render",prefetch:s="none",relative:o,reloadDocument:c,replace:d,mask:f,state:m,target:h,to:g,preventScrollReset:y,viewTransition:k,defaultShouldRevalidate:w,...N},C){let{basename:M,navigator:A,useTransitions:R}=v.useContext(Ia),I=typeof g=="string"&&Lh.test(g),P=cv(g,M);g=P.to;let D=G5(g,{relative:o}),L=ha(),$=null;if(f){let O=Iu(f,[],L.mask?L.mask.pathname:"/",!0);M!=="/"&&(O.pathname=O.pathname==="/"?M:Ga([M,O.pathname])),$=A.createHref(O)}let[Q,W,B]=_4(s,N),V=P4(g,{replace:d,mask:f,state:m,target:h,preventScrollReset:y,relative:o,viewTransition:k,defaultShouldRevalidate:w,useTransitions:R});function q(O){n&&n(O),O.defaultPrevented||V(O)}let X=!(P.isExternal||c),te=v.createElement("a",{...N,...B,href:(X?$:void 0)||P.absoluteURL||D,onClick:X?q:n,ref:z4(C,W),target:h,"data-discover":!I&&r==="render"?"true":void 0});return Q&&!I?v.createElement(v.Fragment,null,te,v.createElement(I4,{page:D})):te});Ph.displayName="Link";const qh=v.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:s="",end:o=!1,style:c,to:d,viewTransition:f,children:m,...h},g){let y=vo(d,{relative:h.relative}),k=ha(),w=v.useContext(Lu),{navigator:N,basename:C}=v.useContext(Ia),M=w!=null&&W4(y)&&f===!0,A=N.encodeLocation?N.encodeLocation(y).pathname:y.pathname,R=k.pathname,I=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(R=R.toLowerCase(),I=I?I.toLowerCase():null,A=A.toLowerCase()),I&&C&&(I=hs(I,C)||I);const P=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let D=R===A||!o&&R.startsWith(A)&&R.charAt(P)==="/",L=I!=null&&(I===A||!o&&I.startsWith(A)&&I.charAt(P)==="/"),$={isActive:D,isPending:L,isTransitioning:M},Q=D?n:void 0,W;typeof s=="function"?W=s($):W=[s,D?"active":null,L?"pending":null,M?"transitioning":null].filter(Boolean).join(" ");let B=typeof c=="function"?c($):c;return v.createElement(Ph,{...h,"aria-current":Q,className:W,ref:g,style:B,to:d,viewTransition:f},typeof m=="function"?m($):m)});qh.displayName="NavLink";const B4=v.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:s,replace:o,state:c,method:d="get",action:f,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:k,...w},N)=>{let{useTransitions:C}=v.useContext(Ia),M=V4(),A=G4(f,{relative:h}),R=d.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&Lh.test(f),P=D=>{if(m&&m(D),D.defaultPrevented)return;D.preventDefault();let L=D.nativeEvent.submitter,$=L?.getAttribute("formmethod")||d,Q=()=>M(L||D.currentTarget,{fetcherKey:n,method:$,navigate:r,replace:o,state:c,relative:h,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:k});C&&r!==!1?v.startTransition(()=>Q()):Q()};return v.createElement("form",{ref:N,method:R,action:A,onSubmit:s?m:P,...w,"data-discover":!I&&e==="render"?"true":void 0})});B4.displayName="Form";function H4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bv(e){let n=v.useContext(Gl);return $t(n,H4(e)),n}function P4(e,{target:n,replace:r,mask:s,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:h}={}){let g=pa(),y=ha(),k=vo(e,{relative:d});return v.useCallback(w=>{if(y4(w,n)){w.preventDefault();let N=r!==void 0?r:co(y)===co(k),C=()=>g(e,{replace:N,mask:s,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m});h?v.startTransition(()=>C()):C()}},[y,g,k,r,s,o,n,e,c,d,f,m,h])}function Fh(e){ir(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=v.useRef(Qm(e)),r=v.useRef(!1),s=ha(),o=v.useMemo(()=>b4(s.search,r.current?null:n.current),[s.search]),c=pa();return[o,v.useCallback((d,f)=>{const m=Qm(typeof d=="function"?d(new URLSearchParams(o)):d);r.current=!0,c("?"+m,f)},[c,o])]}let q4=0,F4=()=>`__${String(++q4)}__`;function V4(){let{router:e}=bv("useSubmit"),{basename:n}=v.useContext(Ia),r=l4(),s=e.fetch,o=e.navigate;return v.useCallback(async(c,d={})=>{let{action:f,method:m,encType:h,formData:g,body:y}=w4(c,n);d.navigate===!1?await s(d.fetcherKey||F4(),r,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||m,formEncType:d.encType||h,flushSync:d.flushSync}):await o(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||m,formEncType:d.encType||h,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[s,o,n,r])}function G4(e,{relative:n}={}){let{basename:r}=v.useContext(Ia),s=v.useContext(La);$t(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),c={...vo(e||".",{relative:n})},d=ha();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),m=f.getAll("index");if(m.some(h=>h==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let h=f.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:Ga([r,c.pathname])),co(c)}function W4(e,{relative:n}={}){let r=v.useContext(fv);$t(r!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=bv("useViewTransitionState"),o=vo(e,{relative:n});if(!r.isTransitioning)return!1;let c=hs(r.currentLocation.pathname,s)||r.currentLocation.pathname,d=hs(r.nextLocation.pathname,s)||r.nextLocation.pathname;return uo(o.pathname,d)!=null||uo(o.pathname,c)!=null}const $y="penguin.lastProjectId",By=e=>`penguin.lastAgentId.${e}`,vv=v.createContext(null);function Xm(e){return e.name??e.projectId}function Mn(e){return e.name??e.agentId}function K4({children:e}){const[n,r]=v.useState([]),[s,o]=v.useState(!0),[c,d]=v.useState(null),[f,m]=v.useState([]),[h,g]=v.useState(!0),[y,k]=v.useState(null),w=v.useCallback(async()=>{o(!0);try{const R=await Nj();r(R.projects),d(I=>{const P=I??localStorage.getItem($y);return(R.projects.find(L=>L.projectId===P)??R.projects[0])?.projectId??null})}finally{o(!1)}},[]);v.useEffect(()=>{w()},[w]);const N=v.useCallback(R=>{R!==c&&(localStorage.setItem($y,R),d(R),k(null),m([]),g(!0),Wb({lastProjectId:R}).catch(()=>{}))},[c]),C=v.useCallback(async()=>{if(c){g(!0);try{const R=await Ij(c);m(R.agents),k(I=>{const P=I??localStorage.getItem(By(c)),D=R.agents.find($=>$.agentId===P),L=R.agents.find($=>$.agentId==="default_agent")??R.agents[0]??null;return(D??L)?.agentId??null})}finally{g(!1)}}},[c]);v.useEffect(()=>{m([]),C()},[C]);const M=v.useCallback(R=>{c&&localStorage.setItem(By(c),R),k(R)},[c]),A=v.useMemo(()=>{const R=n.find(P=>P.projectId===c)??null,I=f.find(P=>P.agentId===y)??null;return{projects:n,projectsLoading:s,currentProject:R,setCurrentProjectId:N,reloadProjects:w,agents:f,agentsLoading:h,currentAgent:I,setCurrentAgentId:M,reloadAgents:C}},[n,s,c,N,w,f,h,y,M,C]);return l.jsx(vv.Provider,{value:A,children:e})}function hn(){const e=v.useContext(vv);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function kv(e,n){const r=new EventSource(e);r.onmessage=o=>{try{n.onOmniMessage(JSON.parse(o.data),o.lastEventId||null)}catch{}},r.addEventListener("server_event",o=>{try{n.onServerEvent(JSON.parse(o.data),o.lastEventId||null)}catch{}}),n.onOpen&&(r.onopen=n.onOpen);const{onError:s}=n;return s&&(r.onerror=()=>s(r.readyState===EventSource.CLOSED)),{close:()=>r.close()}}function Y4(e,n){return kv(`/api/sessions/${encodeURIComponent(e)}/stream`,n)}function Q4(e){return kv("/api/events",e)}const wv="\0temp-workspaces",X4=/[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;function Z4(e){const n=e.trim();return n===""||X4.test(n)}function gu(e){return Z4(e)?wv:e.trim()}function J4(e){const n=e.trim().split(/[/\\]+/).filter(Boolean);return n[n.length-1]??"/"}const Us=10;function Hy(e,n){return e.length>n?{items:e.slice(0,n),hasMore:!0}:{items:e,hasMore:!1}}function Fa(e){return e.archived?"archived":e.source==="subagent"||e.source==="schedule"?e.source:"active"}const Vh=["subagent","schedule","archived"];function Py(e){const n={active:[],subagent:[],schedule:[],archived:[]};for(const r of e)n[Fa(r)].push(r);return n}const eN=["active",...Vh];function tN(e){const n=new Map;for(const[r,s]of e)for(const[o,c]of Object.entries(s)){const d=gu(o);let f=n.get(d);f||(f={totals:{active:0,subagent:0,schedule:0,archived:0},agents:{active:[],subagent:[],schedule:[],archived:[]}},n.set(d,f));for(const m of eN){const h=c[m];h>0&&(f.totals[m]+=h,f.agents[m].includes(r)||f.agents[m].push(r))}}return n}function Sv(e){let n=null;for(const r of e){const s=Fa(r);s!=="active"&&s!=="schedule"||(!n||r.createdAt>n.createdAt||r.createdAt===n.createdAt&&r.sessionId>n.sessionId)&&(n=r)}return n}function nN(e){const n=new Map;for(const o of e){const c=gu(o.workspace);let d=n.get(c);if(!d){const f=c===wv;d={key:c,label:f?"":J4(o.workspace),fullPath:f?null:o.workspace.trim(),temp:f,sessions:[]},n.set(c,d)}d.sessions.push(o)}const r=(o,c)=>o<c?1:o>c?-1:0,s=[...n.values()];for(const o of s)o.sessions.sort((c,d)=>r(c.createdAt,d.createdAt));return s.sort((o,c)=>o.temp!==c.temp?o.temp?1:-1:r(o.sessions[0]?.createdAt??"",c.sessions[0]?.createdAt??"")),s}function qy(e,n,r){if(r.size===0)return[...e];const s=[],o=[];for(const c of e)(r.has(n(c))?s:o).push(c);return[...s,...o]}const jv=v.createContext(null),os=(e,n)=>`${e}\0${n}`;function aN({children:e}){const{currentProject:n,agents:r}=hn(),s=n?.projectId??null,o=r.map(z=>z.agentId).join(","),[c,d]=v.useState([]),[f,m]=v.useState(new Map),[h,g]=v.useState(new Map),[y,k]=v.useState(new Map),[w,N]=v.useState(!0),C=v.useRef(0),M=v.useRef([]);M.current=c;const A=v.useRef(f);A.current=f;const R=v.useRef(h);R.current=h;const I=v.useCallback(async()=>{const z=o===""?[]:o.split(",");if(!s||z.length===0)return;const H=++C.current;N(!0);try{const Z=await Promise.all(z.map(async K=>{const se=["active",...Vh.filter(oe=>A.current.has(os(K,oe)))];try{const oe=await Promise.all(se.map(async pe=>{const Se=await Cy(s,K,{offset:0,limit:Us+1,category:pe,...pe==="active"?{withCounts:!0}:{}});return{category:pe,counts:Se.counts,workspaceCounts:Se.workspaceCounts,...Hy(Se.sessions,Us)}}));return{agentId:K,pages:oe}}catch{return{agentId:K,pages:[]}}}));if(H!==C.current)return;const ce=[],E=new Set,T=new Map,U=new Map,j=new Map;for(const K of Z)for(const se of K.pages){T.set(os(K.agentId,se.category),{hasMore:se.hasMore,fetched:se.items.length}),se.counts&&U.set(K.agentId,se.counts),se.workspaceCounts&&j.set(K.agentId,se.workspaceCounts);for(const oe of se.items)E.has(oe.sessionId)||(E.add(oe.sessionId),ce.push(oe))}d(ce),m(T),g(U),k(j)}finally{H===C.current&&N(!1)}},[s,o]);v.useEffect(()=>{d([]),A.current=new Map,m(A.current),g(new Map),k(new Map),I()},[I]);const P=v.useCallback(async(z,H)=>{if(!s)return;const Z=[...new Set(z)].filter(U=>{const j=A.current.get(os(U,H));return j===void 0?(R.current.get(U)?.[H]??0)>0:j.hasMore});if(Z.length===0)return;const ce=C.current,E=await Promise.all(Z.map(async U=>{const j=A.current.get(os(U,H))?.fetched??0;try{const K=(await Cy(s,U,{offset:j,limit:Us+1,category:H})).sessions;return{agentId:U,...Hy(K,Us)}}catch{return null}}));if(ce!==C.current)return;const T=E.filter(U=>U!==null);d(U=>{const j=new Set(U.map(se=>se.sessionId)),K=T.flatMap(se=>se.items.filter(oe=>!j.has(oe.sessionId)));return K.length>0?[...U,...K]:U}),m(U=>{const j=new Map(U);for(const K of T){const se=os(K.agentId,H);j.set(se,{hasMore:K.hasMore,fetched:(U.get(se)?.fetched??0)+K.items.length})}return j})},[s]),D=v.useCallback((z,H)=>f.has(os(z,H)),[f]),L=v.useCallback((z,H)=>{const Z=f.get(os(z,H));return Z!==void 0?Z.hasMore:(h.get(z)?.[H]??0)>0},[f,h]),$=v.useCallback((z,H,Z)=>{const{agentId:ce,workspace:E}=z;g(T=>{const U=T.get(ce);if(!U)return T;const j=new Map(T);return j.set(ce,{...U,[H]:Math.max(0,U[H]+Z)}),j}),k(T=>{const U=T.get(ce);if(!U)return T;const j=U[E]??{active:0,subagent:0,schedule:0,archived:0},K=new Map(T);return K.set(ce,{...U,[E]:{...j,[H]:Math.max(0,j[H]+Z)}}),K})},[]),Q=v.useRef(I);Q.current=I;const W=v.useRef(s);W.current=s,v.useEffect(()=>{const z=Q4({onOmniMessage:()=>{},onServerEvent:H=>{H.type==="schedule_fired"&&H.projectId===W.current&&Q.current()}});return()=>z.close()},[]);const B=v.useCallback(z=>{C.current+=1,!M.current.some(Z=>Z.sessionId===z.sessionId)&&A.current.get(os(z.agentId,Fa(z)))?.hasMore===!1&&$(z,Fa(z),1),d(Z=>[z,...Z.filter(ce=>ce.sessionId!==z.sessionId)])},[$]),V=v.useCallback(z=>{C.current+=1;const H=M.current.find(Z=>Z.sessionId===z);H&&$(H,Fa(H),-1),d(Z=>Z.filter(ce=>ce.sessionId!==z))},[$]),q=v.useCallback(z=>{const H=M.current.find(Z=>Z.sessionId===z.sessionId);H&&Fa(H)!==Fa(z)&&($(z,Fa(H),-1),$(z,Fa(z),1)),d(Z=>Z.map(ce=>ce.sessionId===z.sessionId?z:ce))},[$]),X=v.useCallback((z,H)=>{d(Z=>{const ce=Z.find(E=>E.sessionId===z);return!ce||ce.status===H?Z:Z.map(E=>E.sessionId===z?{...E,status:H}:E)})},[]),te=v.useCallback((z,H)=>{d(Z=>Z.map(ce=>ce.sessionId===z?{...ce,title:H}:ce))},[]),O=v.useMemo(()=>{const z=new Map;for(const H of c){const Z=z.get(H.agentId);Z?Z.push(H):z.set(H.agentId,[H])}for(const H of z.values())H.sort((Z,ce)=>ce.createdAt.localeCompare(Z.createdAt)||ce.sessionId.localeCompare(Z.sessionId));return{sessions:c,byAgent:z,countsByAgent:h,workspaceCountsByAgent:y,isLoadedFor:D,hasMoreFor:L,loading:w,reload:I,loadMoreFor:P,add:B,remove:V,replace:q,setStatus:X,setTitle:te}},[c,h,y,D,L,w,I,P,B,V,q,X,te]);return l.jsx(jv.Provider,{value:O,children:e})}function Ks(){const e=v.useContext(jv);if(!e)throw new Error("useSessions must be used within a SessionsProvider");return e}function Gh({size:e=12,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nv({size:e=13,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function rN({size:e=13,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M12 4v11m0 0l-5-5m5 5l5-5M4 20h16",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function sN({size:e=13,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M12 15V4m0 0L7 9m5-5l5 5M4 20h16",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wh({onClose:e,className:n="",...r}){return l.jsx("button",{type:"button","aria-label":x.common.close,onClick:e,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 ${n}`,...r,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})}function lN({open:e,side:n="left",title:r,onClose:s,children:o,widthClass:c}){return v.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&s()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,s]),e?l.jsxs("div",{className:"fixed inset-0 z-50",children:[l.jsx("div",{className:"anim-fade absolute inset-0 bg-black/45",onMouseDown:s}),l.jsxs("div",{className:`absolute inset-y-0 flex w-[80vw] flex-col bg-white shadow-xl dark:bg-gray-900 ${c??"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:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[l.jsx("span",{className:"text-base font-semibold",children:r??""}),l.jsx(Wh,{onClose:s})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-[env(safe-area-inset-bottom)]",children:o})]})]}):null}function Pe({d:e,size:n=13,className:r=""}){return l.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:l.jsx("path",{d:e})})}function fs(e){const n=e.toFixed(1);return n.endsWith(".0")?n.slice(0,-2):n}function ot(e){const n=Math.abs(e);return n<1e3?`${e}`:n<1e6?`${fs(e/1e3)}k`:`${fs(e/1e6)}M`}function mn(e,n){if(e<1e3)return`${Math.round(e)}ms`;const r=e/1e3;return r<60?n?.compact&&r>=10?`${Math.round(r)}s`:`${fs(r)}s`:`${Math.floor(r/60)}m${Math.round(r%60)}s`}function Cv(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m${n%60}s`}function Zm(e,n){return n>0?e/(n/1e3):null}function xu(e){return e==null||!Number.isFinite(e)?"—":`${Math.abs(e)<1e3?fs(e):ot(e)} tok/s`}function Tv(e,n){const r=e+n;return r>0?e/r:null}function Kh(e){return e==null||!Number.isFinite(e)?"—":`${Math.round(e*100)}%`}function Ra(e,n="USD",r){if(e==null)return"—";const s=n==="CNY"?"¥":"$",o=n==="CNY"?e*7:e;if(o===0)return`${s}0`;const c=Math.abs(o);if(r?.compact&&c<1)return`${s}${Number(o.toPrecision(2))}`;const d=c>=100?0:c>=1?2:4;return`${s}${o.toFixed(d)}`}function yu(e){return Number.isInteger(e)?`${e}`:fs(e)}function Jm(e){return e<1024?`${e}B`:e<1024*1024?`${fs(e/1024)}KB`:e<1024*1024*1024?`${fs(e/(1024*1024))}MB`:`${fs(e/(1024*1024*1024))}GB`}function $s(e){return e<10?`0${e}`:`${e}`}function fa(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${n.getFullYear()}-${$s(n.getMonth()+1)}-${$s(n.getDate())} ${$s(n.getHours())}:${$s(n.getMinutes())}`}const iN=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Mv(e,n){const r=/^\d{4}-(\d{2})-(\d{2})(?:$|T)/.exec(e);if(!r)return e;const s=Number(r[1]),o=Number(r[2]);return s<1||s>12||o<1||o>31?e:n==="en"?`${iN[s-1]} ${o}`:`${s} 月 ${o} 日`}function Ev(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 bu(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function oN(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const s=Math.round((bu(new Date)-bu(r))/864e5);return s<0?fa(e):s===0?n==="en"?"today":"今天":s===1?n==="en"?"yesterday":"昨天":n==="en"?`${s} days ago`:`${s} 天前`}function cN(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const s=Math.round((bu(new Date)-bu(r))/864e5);return s<0?e:s===0?n==="en"?"updated today":"今天更新":s===1?n==="en"?"updated yesterday":"昨天更新":n==="en"?`updated ${s} days ago`:`${s} 天前更新`}function uN(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${$s(n.getHours())}:${$s(n.getMinutes())}:${$s(n.getSeconds())}`}function Ie(e,n){return e instanceof Ka?e.code==="model_credential_missing"?n?.modelId?x.errors.modelCredentialMissing(n.modelId):e.message:e.code==="no_default_model"?x.errors.noDefaultModel:x.errors.byCode[e.code]??e.message:x.common.unknownError}var Wl=zb();const $c=4,Bi=8;function _a({button:e,open:n,setOpen:r,children:s,menuClass:o,menuStyle:c,className:d,portal:f,onEscape:m}){const h=v.useRef(null),g=v.useRef(null),[y,k]=v.useState(null);v.useEffect(()=>{if(!n)return;const C=A=>{const R=A.target;h.current?.contains(R)||g.current?.contains(R)||r(!1)},M=A=>{A.key==="Escape"&&(m?m():r(!1))};return window.addEventListener("mousedown",C),window.addEventListener("keydown",M),()=>{window.removeEventListener("mousedown",C),window.removeEventListener("keydown",M)}},[n,r,m]);const w=v.useCallback(()=>{if(!n||!f||!h.current){k(null);return}const C=h.current.getBoundingClientRect(),M=g.current,A=M?.offsetWidth??0,R=M?.offsetHeight??0,I=f.align==="right"?C.right-A:C.left,P=Math.max(Bi,Math.min(I,window.innerWidth-A-Bi)),D=window.innerHeight-C.bottom-$c-Bi,L=C.top-$c-Bi,$=f.direction==="up",W=($?R<=L:R<=D)?$:L>D;k({left:P,maxHeight:Math.max(0,W?L:D),...W?{bottom:window.innerHeight-C.top+$c}:{top:C.bottom+$c}})},[n,f?.direction,f?.align,s]);v.useLayoutEffect(w,[w]),v.useEffect(()=>{if(!n||!f)return;const C=M=>{g.current?.contains(M.target)||w()};return window.addEventListener("scroll",C,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",w)}},[n,f,w]);const N=`anim-pop z-40 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900 ${f?"":"max-h-[70vh]"} ${o??"left-0 top-full mt-1 w-64 max-w-[calc(100vw-2rem)] origin-top-left"}`;return l.jsxs("div",{className:`relative ${d??""}`,ref:h,children:[e,n&&(f?Wl.createPortal(l.jsx("div",{ref:g,style:{position:"fixed",...y?{left:y.left,maxHeight:y.maxHeight,...y.top!==void 0?{top:y.top}:{},...y.bottom!==void 0?{bottom:y.bottom}:{}}:{left:0,top:0,visibility:"hidden"},maxWidth:`calc(100vw - ${Bi*2}px)`,...c},className:N,children:s}),document.body):l.jsx("div",{ref:g,...c!==void 0?{style:c}:{},className:`absolute ${N}`,children:s}))]})}function dN(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 fN(e){return dN(e)%360}function Av(e){const n=fN(e);return{bg:`hsl(${n} 55% 50% / 0.14)`,fg:`hsl(${n} 55% 28%)`,fgDark:`hsl(${n} 55% 73%)`}}const Fy=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function Vy(e){if(e){if(!Fy)return Array.from(e)[0];for(const n of Fy.segment(e))return n.segment}}function Rv(e,n){const r=Vy(e.trim())??Vy((n??"").trim());return r?r.toUpperCase():"?"}function Ya({id:e,name:n,size:r=18,className:s}){const o=Av(e);return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",className:s,style:{"--tile-fg":o.fg,"--tile-fg-dark":o.fgDark},"aria-hidden":!0,role:"img",children:[l.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:o.bg}),l.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:Rv(n??"",e)})]})}function Un({open:e,size:n=14,className:r=""}){return l.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:l.jsx("path",{d:"M9 5l7 7-7 7"})})}const mN={success:2500,info:4e3,error:6e3};let _r=[],hN=1;const eh=new Set;function th(){for(const e of eh)e(_r)}const pN=160;function _v(e){const n=_r.find(r=>r.id===e);!n||n.leaving||(_r=_r.map(r=>r.id===e?{...r,leaving:!0}:r),th(),setTimeout(()=>{_r=_r.filter(r=>r.id!==e),th()},pN))}function Yh(e,n){if(!n)return;const r=hN++;_r=[..._r,{id:r,kind:e,text:n}],th(),setTimeout(()=>_v(r),mN[e])}const ua=e=>Yh("success",e),gt=e=>Yh("error",e),gs=e=>Yh("info",e),gN={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",info:"border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200"};function xN(){const[e,n]=v.useState(_r);return v.useEffect(()=>(eh.add(n),()=>{eh.delete(n)}),[]),e.length===0?null:Wl.createPortal(l.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=>l.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"} ${gN[r.kind]}`,children:r.text},r.id))}),document.body)}function Ou({text:e,className:n=""}){const r=v.useRef(null),[s,o]=v.useState(!1);return v.useLayoutEffect(()=>{const c=r.current;if(!c)return;const d=()=>o(c.scrollWidth>c.clientWidth+1);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(c),()=>f.disconnect()},[e,n]),l.jsx("span",{ref:r,className:`truncate ${n}`,...s?{title:e}:{},children:e})}const yN={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",yellow:"bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-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 qt({tone:e="gray",children:n}){return l.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ${yN[e]}`,children:n})}function nh(e){switch(e){case"completed":return"green";case"aborted":return"amber";default:return"red"}}const Hi=[];function kn({open:e,title:n,onClose:r,children:s,footer:o,widthClass:c,headerless:d}){return v.useEffect(()=>{if(!e)return;const f=Symbol("modal");Hi.push(f);const m=h=>{h.key==="Escape"&&Hi[Hi.length-1]===f&&r()};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);const h=Hi.lastIndexOf(f);h!==-1&&Hi.splice(h,1)}},[e,r]),e?Wl.createPortal(l.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:f=>{f.target===f.currentTarget&&r()},children:l.jsxs("div",{...d?{role:"dialog","aria-label":n}:{},className:`anim-pop w-full ${c??"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:[!d&&l.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[l.jsx("h2",{className:"text-base font-semibold",children:n}),l.jsx(Wh,{onClose:r})]}),l.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-4 py-4",children:s}),o&&l.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 bN={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"},vN={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 ke({variant:e="secondary",size:n="md",className:r,...s}){return l.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 ${bN[e]} ${vN[n]} ${r??""}`,...s})}function kN({tone:e}){const n=e==="danger"?"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3zM12 9v4m0 4h.01":"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z";return l.jsx("span",{"aria-hidden":!0,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-full ${e==="danger"?"bg-red-100 text-red-600 dark:bg-red-950/60 dark:text-red-400":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300"}`,children:l.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:n})})})}function ma({open:e,title:n,onClose:r,onConfirm:s,confirmLabel:o,tone:c="danger",busy:d=!1,children:f}){return l.jsxs(kn,{open:e,title:n,onClose:r,headerless:!0,widthClass:"sm:max-w-sm",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(kN,{tone:c}),l.jsx("div",{className:"min-w-0 flex-1 pt-1.5",children:f})]}),l.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[l.jsx(ke,{size:"sm",onClick:r,disabled:d,children:x.common.cancel}),l.jsx(ke,{size:"sm",variant:c,disabled:d,onClick:s,children:o??x.common.confirm})]})]})}function zu(){const[e,n]=v.useState(null),r=l.jsx(ma,{open:e!==null,title:x.common.confirmSaveTitle,tone:"primary",confirmLabel:x.common.save,onClose:()=>n(null),onConfirm:()=>{e?.(),n(null)},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.common.confirmSaveBody})});return{requestSave:s=>n(()=>s),element:r}}const Qh="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",Iv="w-full px-3 py-1.5 text-left transition-colors duration-150";function no({children:e,required:n}){return l.jsxs("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:[e,n&&l.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]})}function Lv({children:e}){return l.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:e})}function Bs({id:e,children:n}){return l.jsx("span",{id:e,role:"alert",className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:n})}function ko({label:e,hint:n,error:r,errorId:s,required:o,children:c}){return!e&&!n&&!r?l.jsx(l.Fragment,{children:c}):l.jsxs("label",{className:"block",children:[e!=null&&e!==""&&l.jsx(no,{required:o,children:e}),c,r?l.jsx(Bs,{id:s,children:r}):n?l.jsx(Lv,{children:n}):null]})}const Dv=`w-full ${Qh} placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500`,Xh={base:"px-3 py-2 text-base",sm:"px-2 py-1 text-xs"},Uu="!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 nt({label:e,hint:n,error:r,invalid:s,required:o,size:c="base",className:d,...f}){const m=!!r||!!s,h=v.useId();return l.jsx(ko,{label:e,hint:n,error:r,errorId:h,required:o,children:l.jsx("input",{className:`${Dv} ${Xh[c]} ${m?Uu:""} ${d??""}`,"aria-invalid":m?!0:void 0,"aria-required":o||void 0,"aria-describedby":r?h:void 0,...f})})}const Pl=v.forwardRef(function({label:n,hint:r,error:s,invalid:o,required:c,mono:d,size:f="base",className:m,...h},g){const y=!!s||!!o,k=v.useId();return l.jsx(ko,{label:n,hint:r,error:s,errorId:k,required:c,children:l.jsx("textarea",{ref:g,className:`${Dv} px-3 py-2 ${f==="sm"?"text-xs leading-relaxed":"text-base"} ${d?"font-mono":""} ${y?Uu:""} ${m??""}`,"aria-invalid":y?!0:void 0,"aria-required":c||void 0,"aria-describedby":s?k:void 0,...h})})});function Hs({options:e,value:n,onChange:r,cols:s=3}){return l.jsx("div",{className:`grid ${s===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=>l.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 Pt({className:e}){return l.jsx("div",{className:`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${e??"h-4 w-full"}`})}function ar({rows:e=3}){return l.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:e},(n,r)=>l.jsx(Pt,{className:"h-8 w-full"},r))})}function Ov({className:e,children:n}){return l.jsx("div",{className:`rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900 ${e??"p-4"}`,children:n??l.jsxs(l.Fragment,{children:[l.jsx(Pt,{className:"h-3 w-20"}),l.jsx(Pt,{className:"mt-2.5 h-6 w-28"}),l.jsx(Pt,{className:"mt-2.5 h-3 w-24"})]})})}function or(e){v.useEffect(()=>{document.title=e?`${e} · ${x.appName}`:x.appName},[e])}var wN=["partial_text","partial_thinking","partial_tool_call","partial_tool_call_output"];function vu(e){return wN.includes(e.type??"")}function Zh(e){return e.type==="event_msg"}function SN(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jh(e,n){return`[${e}]
|
|
60
|
-
${n}
|
|
61
|
-
[/${e}]`}function wo(e,n,r=""){const s=SN(e);return[new RegExp(`\\[${s}\\]${n}\\[/${s}\\]`,r),new RegExp(`<${s}>${n}</${s}>`,r)]}function $u(e,n){return e[0].exec(n)??e[1].exec(n)}var sr={summary:"summary",userSteering:"user_steering",useSkills:"use_skills",handoffFrom:"handoff_from",scheduledTask:"scheduled_task",modelSwitchFrom:"model_switch_from"};wo(sr.summary,"([\\s\\S]*?)");function uu(e,n){if(e.length===0)return n;const r=Jh(sr.useSkills,`skills: ${e.join(", ")}`);return n?`${r}
|
|
62
|
-
|
|
63
|
-
${n}`:r}var jN=wo(sr.useSkills,"\\nskills: ([^\\n]+)\\n");function NN(e){const n=$u(jN,e);if(!n||n.index!==0)return null;const r=n[1].split(",").map(s=>s.trim()).filter(s=>s.length>0);return r.length===0?null:{skills:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}}function zv(e){const n=/^([\w-]+) \((.*)\)$/.exec(e);return n?{id:n[1],label:n[2]}:{id:e}}function ep(e,n){const r=new RegExp(`^(${n.join("|")}): (.+)$`),s=[];for(const o of e.split(`
|
|
64
|
-
`)){const c=r.exec(o);c&&s.push([c[1],c[2]])}return s}function CN(e){const n=e.agentName&&e.agentName!==e.agentId?` (${e.agentName})`:"",r=[`agent: ${e.agentId}${n}`];if(e.sessionId){const s=e.sessionTitle?` (${e.sessionTitle})`:"";r.push(`session: ${e.sessionId}${s}`)}return e.workspace&&r.push(`workspace: ${e.workspace}`),Jh(sr.handoffFrom,["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].join(`
|
|
65
|
-
`))}var TN=wo(sr.handoffFrom,"\\n([\\s\\S]*)\\n","");function MN(e){const n=e.trim(),r=$u(TN,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const s={agentId:""};for(const[o,c]of ep(r[1],["agent","session","workspace"])){if(o==="workspace"){s.workspace=c;continue}const{id:d,label:f}=zv(c);o==="agent"?(s.agentId=d,f!==void 0&&(s.agentName=f)):(s.sessionId=d,f!==void 0&&(s.sessionTitle=f))}return s.agentId?s:null}var EN=wo(sr.scheduledTask,"\\n([\\s\\S]*?)\\n");function AN(e){const n=$u(EN,e);if(!n||n.index!==0)return null;const r={name:"",firedAt:""};for(const[s,o]of ep(n[1],["schedule","fired_at"]))s==="schedule"?r.name=o:r.firedAt=o;return r.name?{origin:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}:null}function RN(e){const n=e.sessionTitle?` (${e.sessionTitle})`:"",r=[`session: ${e.sessionId}${n}`];return e.tracePath&&r.push(`trace: ${e.tracePath}`),e.workspace&&r.push(`workspace: ${e.workspace}`),e.prevModelId&&r.push(`previous_model: ${e.prevModelId}`),e.prevProvider&&r.push(`previous_provider: ${e.prevProvider}`),Jh(sr.modelSwitchFrom,["The user switched models: this conversation continues an earlier conversation, now on a different model. Its origin is listed below and the user's message, if any, follows. The earlier history is NOT in your context — when you need it, read the trace file at the path below (JSONL, one message envelope per line: user/assistant text, tool calls and results).",...r].join(`
|
|
66
|
-
`))}var _N=wo(sr.modelSwitchFrom,"\\n([\\s\\S]*)\\n");function IN(e){const n=e.trim(),r=$u(_N,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const s={sessionId:""},o=["session","trace","workspace","previous_model","previous_provider"];for(const[c,d]of ep(r[1],o))if(c==="session"){const{id:f,label:m}=zv(d);s.sessionId=f,m!==void 0&&(s.sessionTitle=m)}else c==="trace"?s.tracePath=d:c==="workspace"?s.workspace=d:c==="previous_model"?s.prevModelId=d:s.prevProvider=d;return s.sessionId?s:null}var LN=new RegExp(`^\\[${sr.userSteering}\\]\\n([\\s\\S]*?)\\n\\[/${sr.userSteering}\\]\\s*$`);function DN(e){const n=LN.exec(e);return n?n[1]:null}function ON(e){const n=/^\[goal\]\nround: (\d+)\n[\s\S]*?\n\[\/goal\](?:\n|$)/.exec(e);if(!n)return null;const r=Number(n[1]);return!Number.isInteger(r)||r<=0?null:{round:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}}function Uv(e,n){return n?(e.cacheRead*n.cacheRead+e.cacheWrite*n.cacheWrite+e.output*n.output)/1e6:null}function zN(){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 $v(e,n){e.taskCacheRead+=n.request.cache_read,e.taskCacheWrite+=n.request.cache_write,e.taskOutput+=n.request.output}function UN(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,$v(e,n),e.contextNow=n.request.total,e.contextStale=!1,e.taskMainOutput+=n.request.output,e.hasUsage=!0}function $N(e){e.pendingCompactionTokens!==0&&(e.taskTokens+=e.pendingCompactionTokens,e.taskCacheRead+=e.pendingCompactionCacheRead,e.taskCacheWrite+=e.pendingCompactionCacheWrite,e.taskOutput+=e.pendingCompactionOutput,e.hasUsage=!0,tp(e))}function tp(e){e.pendingCompactionTokens=0,e.pendingCompactionCacheRead=0,e.pendingCompactionCacheWrite=0,e.pendingCompactionOutput=0}function BN(e,n){n>0&&(e.taskLlmMs+=n)}function HN(e,n){e.taskTokens+=n.request.total,$v(e,n),e.subagentTotal+=n.request.total,e.hasUsage=!0}function PN(e){e.compactionActive=!0}function qN(e,n){e.compactionActive=!1,n==="completed"&&(e.contextStale=!0)}function FN(e){e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,tp(e),e.hasUsage=!1,e.compactionActive=!1}function VN(e,n){if(e.sessionElapsedMs+=n,tp(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:Zm(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 GN(e,n,r,s){const o=n&&r!=null?Math.max(0,s-r):0;return e.sessionElapsedMs+o}function WN(e,n){const r=e.tokensByBucket;return`[${n.stats}] ${n.input} ${ot(r.cacheRead+r.cacheWrite)}${n.parenOpen}${n.cached} ${ot(r.cacheRead)}${n.parenClose} · ${n.output} ${ot(r.output)} · ${xu(e.outputTps)}`}function Bv(e,n){return{items:[],nested:e,meta:null,stats:zN(),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,lastAuthFailureMs:null,taskOpen:!1,taskStartLocalMs:0,taskFirstTsMs:0,taskLastTsMs:0,taskLastReqEndMs:null,nextItemId:1}}function du(e=new Set){return Bv(!1,e)}function KN(e,n){return e===null?!1:n===null||e>n}function Zn(e){return e.nextItemId++}function ku(e,n,r=Date.now()){if(n.origin&&n.origin.length>0){iC(e,n,r);return}if(n.type==="model_msg"){if(e.stats.compactionActive){Va(e,n.timestamp),mm(e,n.timestamp);return}if(vu(n.payload)){Va(e,n.timestamp),aC(e,n.payload,Pa(n.timestamp));return}rC(e,n.payload,n.timestamp,r),mm(e,n.timestamp);return}if(Zh(n)){Va(e,n.timestamp),sC(e,n.payload,Pa(n.timestamp),r),mm(e,n.timestamp);return}if(n.type==="session_meta"&&e.nested){const s=n.payload,o={agentId:YN(s.agent_state),provider:s.provider,modelId:s.model_id};s.source!==void 0&&(o.source=s.source),e.meta=o}}function YN(e){const n=e.split(/[\\/]/).filter(r=>r.length>0);return n.length>=2?n[n.length-2]:null}function QN(e,n){const r=n.join("/");for(const s of e)if(s.startsWith(`${r} `)||s.startsWith(`${r}/`))return!0;return!1}function Pa(e){const n=Date.parse(e);return Number.isFinite(n)?n:void 0}function mm(e,n){const r=Date.parse(n);Number.isFinite(r)&&(e.lastTsMs=r)}function XN(e,n,r=Date.now()){for(const s of n)ku(e,s,r)}function ZN(e,n=Date.now()){np(e,"live",n)}function JN(e){np(e,"history")}function eC(e,n){e.localDecisions.add(n)}function ql(e,n){return`${e?.join("/")??""} ${n}`}function tC(e,n,r){let s=e;for(const o of n??[])if(s=s.subagents.get(o),!s)return null;return s.toolCards.get(r)??null}function Va(e,n){if(!e.taskOpen||e.stats.compactionActive)return;const r=Date.parse(n);!Number.isFinite(r)||r<=e.taskLastTsMs||(e.taskLastTsMs=r)}function Gy(e,n,r){np(e,"history");const s=lh(e);s&&(s.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,FN(e.stats)}function np(e,n,r){if(!e.taskOpen)return;e.taskOpen=!1,Hv(e);const s=e.taskLastReqEndMs??e.taskLastTsMs,o=Math.max(0,s-e.taskFirstTsMs);let c;e.taskLastReqEndMs!==null?c=o:n==="live"?c=Math.max((r??Date.now())-e.taskStartLocalMs,o):c=o;const d=VN(e.stats,c);if(e.nested)return;const f=nC(e);if(d===null&&f.text==="")return;const m={kind:"task_stats",id:Zn(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 nC(e){const n=[];let r;for(let s=e.items.length-1;s>=0;s--){const o=e.items[s];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(`
|
|
67
|
-
|
|
68
|
-
`),...r!==void 0?{atMs:r}:{}}}function aC(e,n,r){switch(n.type){case"partial_text":{if(n.event_type==="start"){e.pendingText=null;const o={kind:"assistant_text",id:Zn(e),text:n.text??"",streaming:!0,...r!==void 0?{atMs:r}:{}};e.openText=o,e.items.push(o);return}const s=e.openText;if(!s)return;n.text&&(s.text+=n.text),n.event_type==="stop"&&(s.streaming=!1,n.stop_reason!==void 0&&(s.stopReason=n.stop_reason),e.pendingText=s,e.openText=null);return}case"partial_thinking":{if(n.event_type==="start"){e.pendingThinking=null;const o={kind:"thinking",id:Zn(e),thinking:n.thinking??"",streaming:!0};r!==void 0&&(o.startedAtMs=r),e.openThinking=o,e.items.push(o);return}const s=e.openThinking;if(!s)return;n.thinking&&(s.thinking+=n.thinking),n.event_type==="stop"&&(s.streaming=!1,n.stop_reason!==void 0&&(s.stopReason=n.stop_reason),ah(s,r),e.pendingThinking=s,e.openThinking=null);return}case"partial_tool_call":{const s=e.toolCards.get(n.tool_call_id);if(s?.callComplete)return;if(n.event_type==="start"){if(s){s.name=n.name||s.name,s.argumentsText=n.arguments??"",s.callStreaming=!0,r!==void 0&&s.argStartedAtMs===void 0&&(s.argStartedAtMs=r);return}const o=sh(e,{toolCallId:n.tool_call_id,name:n.name,argumentsText:n.arguments??"",callStreaming:!0});r!==void 0&&(o.argStartedAtMs=r);return}if(!s)return;n.name&&!s.name&&(s.name=n.name),n.arguments&&(s.argumentsText+=n.arguments),n.event_type==="stop"&&(s.callStreaming=!1,n.stop_reason!==void 0&&(s.callStopReason=n.stop_reason),r!==void 0&&(s.callStartedAtMs=r));return}case"partial_tool_call_output":{const s=e.toolCards.get(n.tool_call_id);if(!s||s.outputComplete)return;if(n.event_type==="start"){s.outputStreaming=!0,n.output&&(s.output+=n.output),n.images&&n.images.length>0&&(s.images=n.images);return}if(!s.outputStreaming)return;n.output&&(s.output+=n.output),n.images&&n.images.length>0&&(s.images=n.images),n.event_type==="stop"&&(s.outputStreaming=!1,n.stop_reason!==void 0&&(s.outputStopReason=n.stop_reason),Pv(s,r));return}}}function rC(e,n,r,s){switch(n.type){case"text":{if(n.role==="user"){if(n.text.startsWith("[context_summary]")||n.text.startsWith("<context_summary>")){Va(e,r);return}const f=DN(n.text);if(f!==null){Va(e,r);const h=Pa(r);e.items.push({kind:"user_steering",id:Zn(e),text:f,...h!==void 0?{atMs:h}:{}});return}Gy(e,r,s);const m=Pa(r);e.items.push({kind:"user_text",id:Zn(e),text:n.text,...m!==void 0?{atMs:m}:{}});return}Va(e,r);const o=e.pendingText??e.openText;if(o){o.text=n.text,o.streaming=!1;const f=Pa(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 c=Pa(r),d={kind:"assistant_text",id:Zn(e),text:n.text,streaming:!1,...c!==void 0?{atMs:c}:{}};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.items.push(d);return}case"image_url":{Gy(e,r,s);const o=Pa(r);e.items.push({kind:"user_image",id:Zn(e),imageUrl:n.image_url,...o!==void 0?{atMs:o}:{}});return}case"thinking":{Va(e,r);const o=Pa(r),c=e.pendingThinking??e.openThinking;if(c){c.thinking=n.thinking,c.streaming=!1,n.stop_reason!==void 0&&(c.stopReason=n.stop_reason),ah(c,o),c===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}const d={kind:"thinking",id:Zn(e),thinking:n.thinking,streaming:!1};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.lastTsMs>0&&(d.startedAtMs=e.lastTsMs),ah(d,o),e.items.push(d);return}case"tool_call":{Va(e,r);const o=Pa(r),c=e.toolCards.get(n.tool_call_id),d=c?.callComplete?void 0:c;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),rh(e,d),Wy(d);return}c&&!c.outputComplete&&(c.outputComplete=!0,c.outputStreaming=!1,c.outputStopReason??="aborted");const f=sh(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),rh(e,f),e.lastTsMs>0&&(f.argStartedAtMs=e.lastTsMs),Wy(f);return}case"tool_call_output":{Va(e,r);let o=e.toolCards.get(n.tool_call_id);o||(o=sh(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),Pv(o,Pa(r));return}case"inline_data":case"inline_thinking":Va(e,r);return}}function Hv(e){for(const n of e.toolCards.values())n.callComplete&&!n.outputComplete&&(n.outputComplete=!0,n.outputStreaming=!1,n.outputStopReason??="aborted")}function Wy(e){!e.callStopReason||e.callStopReason==="completed"||e.outputComplete||(e.outputComplete=!0,e.outputStreaming=!1,e.outputStopReason??=e.callStopReason)}function ah(e,n){n===void 0||e.startedAtMs===void 0||(e.durationMs=Math.max(0,n-e.startedAtMs))}function Pv(e,n){if(n===void 0)return;const r=e.approvalAtMs??e.callStartedAtMs;if(r===void 0)return;const s=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0;e.durationMs=s+Math.max(0,n-r)}function rh(e,n){if(n.approvalWaitCounted)return;const{callStartedAtMs:r,approvalAtMs:s}=n;if(r===void 0||s===void 0)return;n.approvalWaitCounted=!0;const o=s-r;o>0&&(e.openApprovalWaitMs+=o)}function sh(e,n){const r={kind:"tool_call",id:Zn(e),toolCallId:n.toolCallId,name:n.name,argumentsText:n.argumentsText,callStreaming:n.callStreaming,callComplete:!1,output:"",outputStreaming:!1,outputComplete:!1},s=e.pendingDecisions.get(n.toolCallId);if(s!==void 0){r.decision=s,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 sC(e,n,r,s){switch(n.type){case"approval_decision":{const o=e.toolCards.get(n.tool_call_id);o?(o.decision=n.decision,o.decisionSource=e.localDecisions.has(n.tool_call_id)?"manual":"remote",r!==void 0&&o.approvalAtMs===void 0&&(o.approvalAtMs=r),rh(e,o)):(e.pendingDecisions.set(n.tool_call_id,n.decision),r!==void 0&&e.pendingDecisionTs.set(n.tool_call_id,r));return}case"abort":{Hv(e);const o=lh(e);o&&(o.gaveUp=!0),e.reconnectRun=0;const c={kind:"abort",id:Zn(e)};n.reason!=null&&(c.reason=n.reason),e.items.push(c);return}case"token_usage":UN(e.stats,n);return;case"compaction_begin":{PN(e.stats),e.items.push({kind:"compaction",id:Zn(e),reason:n.reason,mode:n.mode,running:!0});return}case"compaction_end":{qN(e.stats,n.status);const o=lC(e);if(o)o.running=!1,o.status=n.status;else{const c={kind:"compaction",id:Zn(e),reason:n.reason,mode:n.mode,running:!1,status:n.status};e.items.push(c)}return}case"request_begin":{const o=lh(e);o&&(o.retrying=!0),e.stats.compactionActive||(e.openRequestBeginMs=r??null,e.openApprovalWaitMs=0);return}case"request_end":{if(e.stats.compactionActive)return;if(n.status==="auth"&&(e.lastAuthFailureMs=r??Date.now()),n.status==="completed"&&(e.lastAuthFailureMs=null),e.openRequestBeginMs!==null&&r!==void 0&&BN(e.stats,r-e.openRequestBeginMs-e.openApprovalWaitMs),e.openRequestBeginMs=null,e.openApprovalWaitMs=0,r!==void 0&&(e.taskLastReqEndMs=r),$N(e.stats),n.status==="timeout"||n.status==="malformed"){e.reconnectRun+=1;const o={kind:"reconnect",id:Zn(e),status:n.status,attempt:e.reconnectRun,retrying:!1};typeof n.retry_in_ms=="number"&&n.retry_in_ms>0&&(o.plannedDelayMs=n.retry_in_ms,o.arrivedAtMs=s??Date.now()),e.items.push(o)}else e.reconnectRun=0;return}}}function lC(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 lh(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 iC(e,n,r){const s=n.origin[0];Zh(n)&&n.payload.type==="token_usage"&&HN(e.stats,n.payload),Va(e,n.timestamp);let o=e.subagents.get(s);o||(o=Bv(!0,e.localDecisions),o.firstSeenLocalMs=r,e.subagents.set(s,o),oC(e,s,o)),o.lastActivityLocalMs=r;const c=Pa(n.timestamp);c!==void 0&&(o.firstTsMs===void 0&&(o.firstTsMs=c),(o.lastActivityTsMs===void 0||c>o.lastActivityTsMs)&&(o.lastActivityTsMs=c));const d=n.origin.slice(1),f={...n};d.length>0?f.origin=d:delete f.origin,ku(o,f,r)}function oC(e,n,r){for(let s=e.items.length-1;s>=0;s--){const o=e.items[s];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:Zn(e),sessionId:n,model:r})}function cC(e,n=100){const r=new Set;for(let s=Math.max(0,e.length-n);s<e.length;s++)r.add(JSON.stringify(e[s]));return r}function uC(e,n){return e.has(JSON.stringify(n))}function qv(e,n){if(n.origin&&n.origin.length>0){const s=e.subagents.get(n.origin[0]);if(!s)return;const o=n.origin.slice(1),c={...n};o.length>0?c.origin=o:delete c.origin,qv(s,c);return}if(n.type!=="model_msg"||vu(n.payload))return;const r=n.payload;switch(r.type){case"text":{if(r.role!=="assistant")return;const s=e.pendingText??e.openText;s&&(hm(e,s),s===e.openText&&(e.openText=null),e.pendingText=null);return}case"thinking":{const s=e.pendingThinking??e.openThinking;s&&(hm(e,s),s===e.openThinking&&(e.openThinking=null),e.pendingThinking=null);return}case"tool_call":{const s=e.toolCards.get(r.tool_call_id);s&&!s.callComplete&&(hm(e,s),e.toolCards.delete(r.tool_call_id));return}case"tool_call_output":{const s=e.toolCards.get(r.tool_call_id);s&&!s.outputComplete&&(s.output="",s.outputStreaming=!1);return}default:return}}function hm(e,n){const r=e.items.indexOf(n);r>=0&&e.items.splice(r,1)}function lr({title:e,description:n,action:r}){return l.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:e}),n&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:n}),r&&l.jsx("div",{className:"mt-2",children:r})]})}const cn={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"},dC=/^\[attached image: (.+)\]$/,fC=/[/\\]scratchpad[/\\]([^/\\]+)[/\\]([A-Za-z0-9._-]+)$/;function mC(e){if(/^https?:\/\//i.test(e))return e;const n=fC.exec(e);return n?`/api/sessions/${encodeURIComponent(n[1])}/scratchpad/${encodeURIComponent(n[2])}`:null}function hC(e){if(!e.includes("[attached image: "))return{text:e,images:[]};const n=[],r=[];for(const s of e.split(`
|
|
69
|
-
`)){const o=dC.exec(s.trim()),c=o?mC(o[1]):null;c?r.push(c):n.push(s)}return{text:n.join(`
|
|
70
|
-
`).replace(/\n+$/,""),images:r}}function pC(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const gC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yC={};function Ky(e,n){return(yC.jsx?xC:gC).test(e)}const bC=/[ \t\n\f\r]/g;function vC(e){return typeof e=="object"?e.type==="text"?Yy(e.value):!1:Yy(e)}function Yy(e){return e.replace(bC,"")===""}class So{constructor(n,r,s){this.normal=r,this.property=n,s&&(this.space=s)}}So.prototype.normal={};So.prototype.property={};So.prototype.space=void 0;function Fv(e,n){const r={},s={};for(const o of e)Object.assign(r,o.property),Object.assign(s,o.normal);return new So(r,s,n)}function ih(e){return e.toLowerCase()}class Jn{constructor(n,r){this.attribute=r,this.property=n}}Jn.prototype.attribute="";Jn.prototype.booleanish=!1;Jn.prototype.boolean=!1;Jn.prototype.commaOrSpaceSeparated=!1;Jn.prototype.commaSeparated=!1;Jn.prototype.defined=!1;Jn.prototype.mustUseProperty=!1;Jn.prototype.number=!1;Jn.prototype.overloadedBoolean=!1;Jn.prototype.property="";Jn.prototype.spaceSeparated=!1;Jn.prototype.space=void 0;let kC=0;const He=Ys(),on=Ys(),oh=Ys(),xe=Ys(),At=Ys(),Ps=Ys(),oa=Ys();function Ys(){return 2**++kC}const ch=Object.freeze(Object.defineProperty({__proto__:null,boolean:He,booleanish:on,commaOrSpaceSeparated:oa,commaSeparated:Ps,number:xe,overloadedBoolean:oh,spaceSeparated:At},Symbol.toStringTag,{value:"Module"})),pm=Object.keys(ch);class ap extends Jn{constructor(n,r,s,o){let c=-1;if(super(n,r),Qy(this,"space",o),typeof s=="number")for(;++c<pm.length;){const d=pm[c];Qy(this,pm[c],(s&ch[d])===ch[d])}}}ap.prototype.defined=!0;function Qy(e,n,r){r&&(e[n]=r)}function Kl(e){const n={},r={};for(const[s,o]of Object.entries(e.properties)){const c=new ap(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),n[s]=c,r[ih(s)]=s,r[ih(c.attribute)]=s}return new So(n,r,e.space)}const Vv=Kl({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:At,ariaCurrent:null,ariaDescribedBy:At,ariaDetails:null,ariaDisabled:on,ariaDropEffect:At,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:At,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:At,ariaLevel:xe,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:At,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:At,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:on,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 Gv(e,n){return n in e?e[n]:n}function Wv(e,n){return Gv(e,n.toLowerCase())}const wC=Kl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ps,acceptCharset:At,accessKey:At,action:null,allow:null,allowFullScreen:He,allowPaymentRequest:He,allowUserMedia:He,alpha:He,alt:null,as:null,async:He,autoCapitalize:null,autoComplete:At,autoFocus:He,autoPlay:He,blocking:At,capture:null,charSet:null,checked:He,cite:null,className:At,closedBy:null,colorSpace:null,cols:xe,colSpan:xe,command:null,commandFor:null,content:null,contentEditable:on,controls:He,controlsList:At,coords:xe|Ps,crossOrigin:null,data:null,dateTime:null,decoding:null,default:He,defer:He,dir:null,dirName:null,disabled:He,download:oh,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:He,formTarget:null,headers:At,height:xe,hidden:oh,high:xe,href:null,hrefLang:null,htmlFor:At,httpEquiv:At,id:null,imageSizes:null,imageSrcSet:null,inert:He,inputMode:null,integrity:null,is:null,isMap:He,itemId:null,itemProp:At,itemRef:At,itemScope:He,itemType:At,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:He,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:He,muted:He,name:null,nonce:null,noModule:He,noValidate:He,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:He,optimum:xe,pattern:null,ping:At,placeholder:null,playsInline:He,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:He,referrerPolicy:null,rel:At,required:He,reversed:He,rows:xe,rowSpan:xe,sandbox:At,scope:null,scoped:He,seamless:He,selected:He,shadowRootClonable:He,shadowRootCustomElementRegistry:He,shadowRootDelegatesFocus:He,shadowRootMode:null,shadowRootSerializable:He,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:on,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:He,useMap:null,value:on,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:At,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:He,declare:He,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:He,noHref:He,noShade:He,noWrap:He,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:on,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:He,disablePictureInPicture:He,disableRemotePlayback:He,exportParts:Ps,part:At,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:Wv}),SC=Kl({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:oa,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:At,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:He,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:Ps,g2:Ps,glyphName:Ps,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:oa,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:At,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:oa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:oa,rev:oa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:oa,requiredFeatures:oa,requiredFonts:oa,requiredFormats:oa,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:oa,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:oa,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:oa,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:Gv}),Kv=Kl({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()}}),Yv=Kl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wv}),Qv=Kl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),jC={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"},NC=/[A-Z]/g,Xy=/-[a-z]/g,CC=/^data[-\w.:]+$/i;function TC(e,n){const r=ih(n);let s=n,o=Jn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&CC.test(n)){if(n.charAt(4)==="-"){const c=n.slice(5).replace(Xy,EC);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=n.slice(4);if(!Xy.test(c)){let d=c.replace(NC,MC);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=ap}return new o(s,n)}function MC(e){return"-"+e.toLowerCase()}function EC(e){return e.charAt(1).toUpperCase()}const AC=Fv([Vv,wC,Kv,Yv,Qv],"html"),rp=Fv([Vv,SC,Kv,Yv,Qv],"svg");function RC(e){return e.join(" ").trim()}var Ll={},gm,Zy;function _C(){if(Zy)return gm;Zy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
71
|
-
`,h="/",g="*",y="",k="comment",w="declaration";function N(M,A){if(typeof M!="string")throw new TypeError("First argument must be a string");if(!M)return[];A=A||{};var R=1,I=1;function P(te){var O=te.match(n);O&&(R+=O.length);var z=te.lastIndexOf(m);I=~z?te.length-z:I+te.length}function D(){var te={line:R,column:I};return function(O){return O.position=new L(te),W(),O}}function L(te){this.start=te,this.end={line:R,column:I},this.source=A.source}L.prototype.content=M;function $(te){var O=new Error(A.source+":"+R+":"+I+": "+te);if(O.reason=te,O.filename=A.source,O.line=R,O.column=I,O.source=M,!A.silent)throw O}function Q(te){var O=te.exec(M);if(O){var z=O[0];return P(z),M=M.slice(z.length),O}}function W(){Q(r)}function B(te){var O;for(te=te||[];O=V();)O!==!1&&te.push(O);return te}function V(){var te=D();if(!(h!=M.charAt(0)||g!=M.charAt(1))){for(var O=2;y!=M.charAt(O)&&(g!=M.charAt(O)||h!=M.charAt(O+1));)++O;if(O+=2,y===M.charAt(O-1))return $("End of comment missing");var z=M.slice(2,O-2);return I+=2,P(z),M=M.slice(O),I+=2,te({type:k,comment:z})}}function q(){var te=D(),O=Q(s);if(O){if(V(),!Q(o))return $("property missing ':'");var z=Q(c),H=te({type:w,property:C(O[0].replace(e,y)),value:z?C(z[0].replace(e,y)):y});return Q(d),H}}function X(){var te=[];B(te);for(var O;O=q();)O!==!1&&(te.push(O),B(te));return te}return W(),X()}function C(M){return M?M.replace(f,y):y}return gm=N,gm}var Jy;function IC(){if(Jy)return Ll;Jy=1;var e=Ll&&Ll.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.default=r;const n=e(_C());function r(s,o){let c=null;if(!s||typeof s!="string")return c;const d=(0,n.default)(s),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&&(c=c||{},c[h]=g)}),c}return Ll}var Pi={},e1;function LC(){if(e1)return Pi;e1=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=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={}),c(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,f):h=h.replace(s,f),h.replace(n,d))};return Pi.camelCase=m,Pi}var qi,t1;function DC(){if(t1)return qi;t1=1;var e=qi&&qi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(IC()),r=LC();function s(o,c){var d={};return!o||typeof o!="string"||(0,n.default)(o,function(f,m){f&&m&&(d[(0,r.camelCase)(f,c)]=m)}),d}return s.default=s,qi=s,qi}var OC=DC();const zC=Ob(OC),Xv=Zv("end"),sp=Zv("start");function Zv(e){return n;function n(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function UC(e){const n=sp(e),r=Xv(e);if(n&&r)return{start:n,end:r}}function ao(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?n1(e.position):"start"in e||"end"in e?n1(e):"line"in e||"column"in e?uh(e):""}function uh(e){return a1(e&&e.line)+":"+a1(e&&e.column)}function n1(e){return uh(e&&e.start)+"-"+uh(e&&e.end)}function a1(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(n,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let o="",c={},d=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof n=="string"?o=n:!c.cause&&n&&(d=!0,o=n.message,c.cause=n),!c.ruleId&&!c.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?c.ruleId=s:(c.source=s.slice(0,m),c.ruleId=s.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.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=ao(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const lp={}.hasOwnProperty,$C=new Map,BC=/[A-Z]/g,HC=new Set(["table","tbody","thead","tfoot","tr"]),PC=new Set(["td","th"]),Jv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function qC(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let s;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=XC(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");s=QC(r,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:s,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"?rp:AC,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},c=ek(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function ek(e,n,r){if(n.type==="element")return FC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return VC(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return WC(e,n,r);if(n.type==="mdxjsEsm")return GC(e,n);if(n.type==="root")return KC(e,n,r);if(n.type==="text")return YC(e,n)}function FC(e,n,r){const s=e.schema;let o=s;n.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=rp,e.schema=o),e.ancestors.push(n);const c=nk(e,n.tagName,!1),d=ZC(e,n);let f=op(e,n);return HC.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!vC(m):!0})),tk(e,d,c,n),ip(d,f),e.ancestors.pop(),e.schema=s,e.create(n,c,d,r)}function VC(e,n){if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}mo(e,n.position)}function GC(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);mo(e,n.position)}function WC(e,n,r){const s=e.schema;let o=s;n.name==="svg"&&s.space==="html"&&(o=rp,e.schema=o),e.ancestors.push(n);const c=n.name===null?e.Fragment:nk(e,n.name,!0),d=JC(e,n),f=op(e,n);return tk(e,d,c,n),ip(d,f),e.ancestors.pop(),e.schema=s,e.create(n,c,d,r)}function KC(e,n,r){const s={};return ip(s,op(e,n)),e.create(n,e.Fragment,s,r)}function YC(e,n){return n.value}function tk(e,n,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=s)}function ip(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function QC(e,n,r){return s;function s(o,c,d,f){const h=Array.isArray(d.children)?r:n;return f?h(c,d,f):h(c,d)}}function XC(e,n){return r;function r(s,o,c,d){const f=Array.isArray(c.children),m=sp(s);return n(o,c,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function ZC(e,n){const r={};let s,o;for(o in n.properties)if(o!=="children"&&lp.call(n.properties,o)){const c=e3(e,o,n.properties[o]);if(c){const[d,f]=c;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&PC.has(n.tagName)?s=f:r[d]=f}}if(s){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function JC(e,n){const r={};for(const s of n.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const d=c.expression;d.type;const f=d.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else mo(e,n.position);else{const o=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else mo(e,n.position);else c=s.value===null?!0:s.value;r[o]=c}return r}function op(e,n){const r=[];let s=-1;const o=e.passKeys?new Map:$C;for(;++s<n.children.length;){const c=n.children[s];let d;if(e.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const h=o.get(m)||0;d=m+"-"+h,o.set(m,h+1)}}const f=ek(e,c,d);f!==void 0&&r.push(f)}return r}function e3(e,n,r){const s=TC(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?pC(r):RC(r)),s.property==="style"){let o=typeof r=="object"?r:t3(e,String(r));return e.stylePropertyNameCase==="css"&&(o=n3(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?jC[s.property]||s.property:s.attribute,r]}}function t3(e,n){try{return zC(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,o=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Jv+"#cannot-parse-style-attribute",o}}function nk(e,n,r){let s;if(!r)s={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let c=-1,d;for(;++c<o.length;){const f=Ky(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}s=d}else s=Ky(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(s.type==="Literal"){const o=s.value;return lp.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);mo(e)}function mo(e,n){const r=new An("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=Jv+"#cannot-handle-mdx-estrees-without-createevaluater",r}function n3(e){const n={};let r;for(r in e)lp.call(e,r)&&(n[a3(r)]=e[r]);return n}function a3(e){let n=e.replace(BC,r3);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function r3(e){return"-"+e.toLowerCase()}const xm={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"]},s3={};function cp(e,n){const r=s3,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ak(e,s,o)}function ak(e,n,r){if(l3(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 r1(e.children,n,r)}return Array.isArray(e)?r1(e,n,r):""}function r1(e,n,r){const s=[];let o=-1;for(;++o<e.length;)s[o]=ak(e[o],n,r);return s.join("")}function l3(e){return!!(e&&typeof e=="object")}const s1=document.createElement("i");function up(e){const n="&"+e+";";s1.innerHTML=n;const r=s1.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function da(e,n,r,s){const o=e.length;let c=0,d;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,r=r>0?r:0,s.length<1e4)d=Array.from(s),d.unshift(n,r),e.splice(...d);else for(r&&e.splice(n,r);c<s.length;)d=s.slice(c,c+1e4),d.unshift(n,0),e.splice(...d),c+=1e4,n+=1e4}function Ea(e,n){return e.length>0?(da(e,e.length,0,n),e):n}const l1={}.hasOwnProperty;function rk(e){const n={};let r=-1;for(;++r<e.length;)i3(n,e[r]);return n}function i3(e,n){let r;for(r in n){const o=(l1.call(e,r)?e[r]:void 0)||(e[r]={}),c=n[r];let d;if(c)for(d in c){l1.call(o,d)||(o[d]=[]);const f=c[d];o3(o[d],Array.isArray(f)?f:f?[f]:[])}}}function o3(e,n){let r=-1;const s=[];for(;++r<n.length;)(n[r].add==="after"?e:s).push(n[r]);da(e,0,0,s)}function sk(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 Wa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=xs(/[A-Za-z]/),En=xs(/[\dA-Za-z]/),c3=xs(/[#-'*+\--9=?A-Z^-~]/);function wu(e){return e!==null&&(e<32||e===127)}const dh=xs(/\d/),u3=xs(/[\dA-Fa-f]/),d3=xs(/[!-/:-@[-`{-~]/);function De(e){return e!==null&&e<-2}function Rt(e){return e!==null&&(e<0||e===32)}function Je(e){return e===-2||e===-1||e===32}const Bu=xs(new RegExp("\\p{P}|\\p{S}","u")),Vs=xs(/\s/);function xs(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Yl(e){const n=[];let r=-1,s=0,o=0;for(;++r<e.length;){const c=e.charCodeAt(r);let d="";if(c===37&&En(e.charCodeAt(r+1))&&En(e.charCodeAt(r+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(d=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(r+1);c<56320&&f>56319&&f<57344?(d=String.fromCharCode(c,f),o=1):d="�"}else d=String.fromCharCode(c);d&&(n.push(e.slice(s,r),encodeURIComponent(d)),s=r+o+1,d=""),o&&(r+=o,o=0)}return n.join("")+e.slice(s)}function it(e,n,r,s){const o=s?s-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return Je(m)?(e.enter(r),f(m)):n(m)}function f(m){return Je(m)&&c++<o?(e.consume(m),f):(e.exit(r),n(m))}}const f3={tokenize:m3};function m3(e){const n=e.attempt(this.parser.constructs.contentInitial,s,o);let r;return n;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),it(e,n,"linePrefix")}function o(f){return e.enter("paragraph"),c(f)}function c(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 De(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),d)}}const h3={tokenize:p3},i1={tokenize:g3};function p3(e){const n=this,r=[];let s=0,o,c,d;return f;function f(I){if(s<r.length){const P=r[s];return n.containerState=P[1],e.attempt(P[0].continuation,m,h)(I)}return h(I)}function m(I){if(s++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&R();const P=n.events.length;let D=P,L;for(;D--;)if(n.events[D][0]==="exit"&&n.events[D][1].type==="chunkFlow"){L=n.events[D][1].end;break}A(s);let $=P;for(;$<n.events.length;)n.events[$][1].end={...L},$++;return da(n.events,D+1,0,n.events.slice(P)),n.events.length=$,h(I)}return f(I)}function h(I){if(s===r.length){if(!o)return k(I);if(o.currentConstruct&&o.currentConstruct.concrete)return N(I);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(i1,g,y)(I)}function g(I){return o&&R(),A(s),k(I)}function y(I){return n.parser.lazy[n.now().line]=s!==r.length,d=n.now().offset,N(I)}function k(I){return n.containerState={},e.attempt(i1,w,N)(I)}function w(I){return s++,r.push([n.currentConstruct,n.containerState]),k(I)}function N(I){if(I===null){o&&R(),A(0),e.consume(I);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),C(I)}function C(I){if(I===null){M(e.exit("chunkFlow"),!0),A(0),e.consume(I);return}return De(I)?(e.consume(I),M(e.exit("chunkFlow")),s=0,n.interrupt=void 0,f):(e.consume(I),C)}function M(I,P){const D=n.sliceStream(I);if(P&&D.push(null),I.previous=c,c&&(c.next=I),c=I,o.defineSkip(I.start),o.write(D),n.parser.lazy[I.start.line]){let L=o.events.length;for(;L--;)if(o.events[L][1].start.offset<d&&(!o.events[L][1].end||o.events[L][1].end.offset>d))return;const $=n.events.length;let Q=$,W,B;for(;Q--;)if(n.events[Q][0]==="exit"&&n.events[Q][1].type==="chunkFlow"){if(W){B=n.events[Q][1].end;break}W=!0}for(A(s),L=$;L<n.events.length;)n.events[L][1].end={...B},L++;da(n.events,Q+1,0,n.events.slice($)),n.events.length=L}}function A(I){let P=r.length;for(;P-- >I;){const D=r[P];n.containerState=D[1],D[0].exit.call(n,e)}r.length=I}function R(){o.write([null]),c=void 0,o=void 0,n.containerState._closeFlow=void 0}}function g3(e,n,r){return it(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fl(e){if(e===null||Rt(e)||Vs(e))return 1;if(Bu(e))return 2}function Hu(e,n,r){const s=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!s.includes(c)&&(n=c(n,r),s.push(c))}return n}const fh={name:"attention",resolveAll:x3,tokenize:y3};function x3(e,n){let r=-1,s,o,c,d,f,m,h,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&n.sliceSerialize(e[s][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[s][1].end},k={...e[r][1].start};o1(y,-m),o1(k,m),d={type:m>1?"strongSequence":"emphasisSequence",start:y,end:{...e[s][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:k},c={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[s][1].end={...d.start},e[r][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=Ea(h,[["enter",e[s][1],n],["exit",e[s][1],n]])),h=Ea(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",c,n]]),h=Ea(h,Hu(n.parser.constructs.insideSpan.null,e.slice(s+1,r),n)),h=Ea(h,[["exit",c,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,h=Ea(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):g=0,da(e,s-1,r-s+3,h),r=s+h.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function y3(e,n){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,o=Fl(s);let c;return d;function d(m){return c=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===c)return e.consume(m),f;const h=e.exit("attentionSequence"),g=Fl(m),y=!g||g===2&&o||r.includes(m),k=!o||o===2&&g||r.includes(s);return h._open=!!(c===42?y:y&&(o||!k)),h._close=!!(c===42?k:k&&(g||!y)),n(m)}}function o1(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const b3={name:"autolink",tokenize:v3};function v3(e,n,r){let s=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(w){return zn(w)?(e.consume(w),d):w===64?r(w):h(w)}function d(w){return w===43||w===45||w===46||En(w)?(s=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),s=0,m):(w===43||w===45||w===46||En(w))&&s++<32?(e.consume(w),f):(s=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||wu(w)?r(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),g):c3(w)?(e.consume(w),h):r(w)}function g(w){return En(w)?y(w):r(w)}function y(w){return w===46?(e.consume(w),s=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||En(w))&&s++<63){const N=w===45?k:y;return e.consume(w),N}return r(w)}}const jo={partial:!0,tokenize:k3};function k3(e,n,r){return s;function s(c){return Je(c)?it(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||De(c)?n(c):r(c)}}const lk={continuation:{tokenize:S3},exit:j3,name:"blockQuote",tokenize:w3};function w3(e,n,r){const s=this;return o;function o(d){if(d===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),c}return r(d)}function c(d){return Je(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function S3(e,n,r){const s=this;return o;function o(d){return Je(d)?it(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(lk,n,r)(d)}}function j3(e){e.exit("blockQuote")}const ik={name:"characterEscape",tokenize:N3};function N3(e,n,r){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return d3(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(c)}}const ok={name:"characterReference",tokenize:C3};function C3(e,n,r){const s=this;let o=0,c,d;return f;function f(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),m}function m(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),c=31,d=En,g(y))}function h(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,d=u3,g):(e.enter("characterReferenceValue"),c=7,d=dh,g(y))}function g(y){if(y===59&&o){const k=e.exit("characterReferenceValue");return d===En&&!up(s.sliceSerialize(k))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(y)&&o++<c?(e.consume(y),g):r(y)}}const c1={partial:!0,tokenize:M3},u1={concrete:!0,name:"codeFenced",tokenize:T3};function T3(e,n,r){const s=this,o={partial:!0,tokenize:D};let c=0,d=0,f;return m;function m(L){return h(L)}function h(L){const $=s.events[s.events.length-1];return c=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(L)}function g(L){return L===f?(d++,e.consume(L),g):d<3?r(L):(e.exit("codeFencedFenceSequence"),Je(L)?it(e,y,"whitespace")(L):y(L))}function y(L){return L===null||De(L)?(e.exit("codeFencedFence"),s.interrupt?n(L):e.check(c1,C,P)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),k(L))}function k(L){return L===null||De(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(L)):Je(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),it(e,w,"whitespace")(L)):L===96&&L===f?r(L):(e.consume(L),k)}function w(L){return L===null||De(L)?y(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),N(L))}function N(L){return L===null||De(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(L)):L===96&&L===f?r(L):(e.consume(L),N)}function C(L){return e.attempt(o,P,M)(L)}function M(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),A}function A(L){return c>0&&Je(L)?it(e,R,"linePrefix",c+1)(L):R(L)}function R(L){return L===null||De(L)?e.check(c1,C,P)(L):(e.enter("codeFlowValue"),I(L))}function I(L){return L===null||De(L)?(e.exit("codeFlowValue"),R(L)):(e.consume(L),I)}function P(L){return e.exit("codeFenced"),n(L)}function D(L,$,Q){let W=0;return B;function B(O){return L.enter("lineEnding"),L.consume(O),L.exit("lineEnding"),V}function V(O){return L.enter("codeFencedFence"),Je(O)?it(L,q,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):q(O)}function q(O){return O===f?(L.enter("codeFencedFenceSequence"),X(O)):Q(O)}function X(O){return O===f?(W++,L.consume(O),X):W>=d?(L.exit("codeFencedFenceSequence"),Je(O)?it(L,te,"whitespace")(O):te(O)):Q(O)}function te(O){return O===null||De(O)?(L.exit("codeFencedFence"),$(O)):Q(O)}}}function M3(e,n,r){const s=this;return o;function o(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return s.parser.lazy[s.now().line]?r(d):n(d)}}const ym={name:"codeIndented",tokenize:A3},E3={partial:!0,tokenize:R3};function A3(e,n,r){const s=this;return o;function o(h){return e.enter("codeIndented"),it(e,c,"linePrefix",5)(h)}function c(h){const g=s.events[s.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):De(h)?e.attempt(E3,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||De(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),n(h)}}function R3(e,n,r){const s=this;return o;function o(d){return s.parser.lazy[s.now().line]?r(d):De(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):it(e,c,"linePrefix",5)(d)}function c(d){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):De(d)?o(d):r(d)}}const _3={name:"codeText",previous:L3,resolve:I3,tokenize:D3};function I3(e){let n=e.length-4,r=3,s,o;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(s=r;++s<n;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(s=r-1,n++;++s<=n;)o===void 0?s!==n&&e[s][1].type!=="lineEnding"&&(o=s):(s===n||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),n-=s-o-2,s=o+2),o=void 0);return e}function L3(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function D3(e,n,r){let s=0,o,c;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),f(y)}function f(y){return y===96?(e.consume(y),s++,f):(e.exit("codeTextSequence"),m(y))}function m(y){return y===null?r(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),m):y===96?(c=e.enter("codeTextSequence"),o=0,g(y)):De(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(y))}function h(y){return y===null||y===32||y===96||De(y)?(e.exit("codeTextData"),m(y)):(e.consume(y),h)}function g(y){return y===96?(e.consume(y),o++,g):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),n(y)):(c.type="codeTextData",h(y))}}class O3{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 s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(n,s):n>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(n,r,s){const o=r||0;this.setCursor(Math.trunc(n));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return s&&Fi(this.left,s),c.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),Fi(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Fi(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);Fi(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Fi(this.left,r.reverse())}}}function Fi(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 ck(e){const n={};let r=-1,s,o,c,d,f,m,h;const g=new O3(e);for(;++r<g.length;){for(;r in n;)r=n[r];if(s=g.get(r),r&&s[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(n,z3(g,r)),r=n[r],h=!0);else if(s[1]._container){for(c=r,o=void 0;c--;)if(d=g.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(s[1].end={...g.get(o)[1].start},f=g.slice(o,r),f.unshift(s),g.splice(o,r-o+1,f))}}return da(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function z3(e,n){const r=e.get(n)[1],s=e.get(n)[2];let o=n-1;const c=[];let d=r._tokenizer;d||(d=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let g,y,k=-1,w=r,N=0,C=0;const M=[C];for(;w;){for(;e.get(++o)[1]!==w;);c.push(o),w._tokenizer||(g=s.sliceStream(w),w.next||g.push(null),y&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=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,M.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):M.pop(),k=M.length;k--;){const A=f.slice(M[k],M[k+1]),R=c.pop();m.push([R,R+A.length-1]),e.splice(R,2,A)}for(m.reverse(),k=-1;++k<m.length;)h[N+m[k][0]]=N+m[k][1],N+=m[k][1]-m[k][0]-1;return h}const U3={resolve:B3,tokenize:H3},$3={partial:!0,tokenize:P3};function B3(e){return ck(e),e}function H3(e,n){let r;return s;function s(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?c(f):De(f)?e.check($3,d,c)(f):(e.consume(f),o)}function c(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 P3(e,n,r){const s=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),it(e,c,"linePrefix")}function c(d){if(d===null||De(d))return r(d);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):e.interrupt(s.parser.constructs.flow,r,n)(d)}}function uk(e,n,r,s,o,c,d,f,m){const h=m||Number.POSITIVE_INFINITY;let g=0;return y;function y(A){return A===60?(e.enter(s),e.enter(o),e.enter(c),e.consume(A),e.exit(c),k):A===null||A===32||A===41||wu(A)?r(A):(e.enter(s),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(A))}function k(A){return A===62?(e.enter(c),e.consume(A),e.exit(c),e.exit(o),e.exit(s),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(A))}function w(A){return A===62?(e.exit("chunkString"),e.exit(f),k(A)):A===null||A===60||De(A)?r(A):(e.consume(A),A===92?N:w)}function N(A){return A===60||A===62||A===92?(e.consume(A),w):w(A)}function C(A){return!g&&(A===null||A===41||Rt(A))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(s),n(A)):g<h&&A===40?(e.consume(A),g++,C):A===41?(e.consume(A),g--,C):A===null||A===32||A===40||wu(A)?r(A):(e.consume(A),A===92?M:C)}function M(A){return A===40||A===41||A===92?(e.consume(A),C):C(A)}}function dk(e,n,r,s,o,c){const d=this;let f=0,m;return h;function h(w){return e.enter(s),e.enter(o),e.consume(w),e.exit(o),e.enter(c),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(c),e.enter(o),e.consume(w),e.exit(o),e.exit(s),n):De(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||De(w)||f++>999?(e.exit("chunkString"),g(w)):(e.consume(w),m||(m=!Je(w)),w===92?k:y)}function k(w){return w===91||w===92||w===93?(e.consume(w),f++,y):y(w)}}function fk(e,n,r,s,o,c){let d;return f;function f(k){return k===34||k===39||k===40?(e.enter(s),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(s),n):(e.enter(c),h(k))}function h(k){return k===d?(e.exit(c),m(d)):k===null?r(k):De(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),it(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===d||k===null||De(k)?(e.exit("chunkString"),h(k)):(e.consume(k),k===92?y:g)}function y(k){return k===d||k===92?(e.consume(k),g):g(k)}}function ro(e,n){let r;return s;function s(o){return De(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,s):Je(o)?it(e,s,r?"linePrefix":"lineSuffix")(o):n(o)}}const q3={name:"definition",tokenize:V3},F3={partial:!0,tokenize:G3};function V3(e,n,r){const s=this;let o;return c;function c(w){return e.enter("definition"),d(w)}function d(w){return dk.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return o=Wa(s.sliceSerialize(s.events[s.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 Rt(w)?ro(e,h)(w):h(w)}function h(w){return uk(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(F3,y,y)(w)}function y(w){return Je(w)?it(e,k,"whitespace")(w):k(w)}function k(w){return w===null||De(w)?(e.exit("definition"),s.parser.defined.push(o),n(w)):r(w)}}function G3(e,n,r){return s;function s(f){return Rt(f)?ro(e,o)(f):r(f)}function o(f){return fk(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return Je(f)?it(e,d,"whitespace")(f):d(f)}function d(f){return f===null||De(f)?n(f):r(f)}}const W3={name:"hardBreakEscape",tokenize:K3};function K3(e,n,r){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return De(c)?(e.exit("hardBreakEscape"),n(c)):r(c)}}const Y3={name:"headingAtx",resolve:Q3,tokenize:X3};function Q3(e,n){let r=e.length-2,s=3,o,c;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},c={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},da(e,s,r-s+1,[["enter",o,n],["enter",c,n],["exit",c,n],["exit",o,n]])),e}function X3(e,n,r){let s=0;return o;function o(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&s++<6?(e.consume(g),d):g===null||Rt(g)?(e.exit("atxHeadingSequence"),f(g)):r(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),m(g)):g===null||De(g)?(e.exit("atxHeading"),n(g)):Je(g)?it(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||Rt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const Z3=["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"],d1=["pre","script","style","textarea"],J3={concrete:!0,name:"htmlFlow",resolveTo:nT,tokenize:aT},eT={partial:!0,tokenize:sT},tT={partial:!0,tokenize:rT};function nT(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 aT(e,n,r){const s=this;let o,c,d,f,m;return h;function h(j){return g(j)}function g(j){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(j),y}function y(j){return j===33?(e.consume(j),k):j===47?(e.consume(j),c=!0,C):j===63?(e.consume(j),o=3,s.interrupt?n:E):zn(j)?(e.consume(j),d=String.fromCharCode(j),M):r(j)}function k(j){return j===45?(e.consume(j),o=2,w):j===91?(e.consume(j),o=5,f=0,N):zn(j)?(e.consume(j),o=4,s.interrupt?n:E):r(j)}function w(j){return j===45?(e.consume(j),s.interrupt?n:E):r(j)}function N(j){const K="CDATA[";return j===K.charCodeAt(f++)?(e.consume(j),f===K.length?s.interrupt?n:q:N):r(j)}function C(j){return zn(j)?(e.consume(j),d=String.fromCharCode(j),M):r(j)}function M(j){if(j===null||j===47||j===62||Rt(j)){const K=j===47,se=d.toLowerCase();return!K&&!c&&d1.includes(se)?(o=1,s.interrupt?n(j):q(j)):Z3.includes(d.toLowerCase())?(o=6,K?(e.consume(j),A):s.interrupt?n(j):q(j)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(j):c?R(j):I(j))}return j===45||En(j)?(e.consume(j),d+=String.fromCharCode(j),M):r(j)}function A(j){return j===62?(e.consume(j),s.interrupt?n:q):r(j)}function R(j){return Je(j)?(e.consume(j),R):B(j)}function I(j){return j===47?(e.consume(j),B):j===58||j===95||zn(j)?(e.consume(j),P):Je(j)?(e.consume(j),I):B(j)}function P(j){return j===45||j===46||j===58||j===95||En(j)?(e.consume(j),P):D(j)}function D(j){return j===61?(e.consume(j),L):Je(j)?(e.consume(j),D):I(j)}function L(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),m=j,$):Je(j)?(e.consume(j),L):Q(j)}function $(j){return j===m?(e.consume(j),m=null,W):j===null||De(j)?r(j):(e.consume(j),$)}function Q(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Rt(j)?D(j):(e.consume(j),Q)}function W(j){return j===47||j===62||Je(j)?I(j):r(j)}function B(j){return j===62?(e.consume(j),V):r(j)}function V(j){return j===null||De(j)?q(j):Je(j)?(e.consume(j),V):r(j)}function q(j){return j===45&&o===2?(e.consume(j),z):j===60&&o===1?(e.consume(j),H):j===62&&o===4?(e.consume(j),T):j===63&&o===3?(e.consume(j),E):j===93&&o===5?(e.consume(j),ce):De(j)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(eT,U,X)(j)):j===null||De(j)?(e.exit("htmlFlowData"),X(j)):(e.consume(j),q)}function X(j){return e.check(tT,te,U)(j)}function te(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),O}function O(j){return j===null||De(j)?X(j):(e.enter("htmlFlowData"),q(j))}function z(j){return j===45?(e.consume(j),E):q(j)}function H(j){return j===47?(e.consume(j),d="",Z):q(j)}function Z(j){if(j===62){const K=d.toLowerCase();return d1.includes(K)?(e.consume(j),T):q(j)}return zn(j)&&d.length<8?(e.consume(j),d+=String.fromCharCode(j),Z):q(j)}function ce(j){return j===93?(e.consume(j),E):q(j)}function E(j){return j===62?(e.consume(j),T):j===45&&o===2?(e.consume(j),E):q(j)}function T(j){return j===null||De(j)?(e.exit("htmlFlowData"),U(j)):(e.consume(j),T)}function U(j){return e.exit("htmlFlow"),n(j)}}function rT(e,n,r){const s=this;return o;function o(d){return De(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):r(d)}function c(d){return s.parser.lazy[s.now().line]?r(d):n(d)}}function sT(e,n,r){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(jo,n,r)}}const lT={name:"htmlText",tokenize:iT};function iT(e,n,r){const s=this;let o,c,d;return f;function f(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),m}function m(E){return E===33?(e.consume(E),h):E===47?(e.consume(E),D):E===63?(e.consume(E),I):zn(E)?(e.consume(E),Q):r(E)}function h(E){return E===45?(e.consume(E),g):E===91?(e.consume(E),c=0,N):zn(E)?(e.consume(E),R):r(E)}function g(E){return E===45?(e.consume(E),w):r(E)}function y(E){return E===null?r(E):E===45?(e.consume(E),k):De(E)?(d=y,H(E)):(e.consume(E),y)}function k(E){return E===45?(e.consume(E),w):y(E)}function w(E){return E===62?z(E):E===45?k(E):y(E)}function N(E){const T="CDATA[";return E===T.charCodeAt(c++)?(e.consume(E),c===T.length?C:N):r(E)}function C(E){return E===null?r(E):E===93?(e.consume(E),M):De(E)?(d=C,H(E)):(e.consume(E),C)}function M(E){return E===93?(e.consume(E),A):C(E)}function A(E){return E===62?z(E):E===93?(e.consume(E),A):C(E)}function R(E){return E===null||E===62?z(E):De(E)?(d=R,H(E)):(e.consume(E),R)}function I(E){return E===null?r(E):E===63?(e.consume(E),P):De(E)?(d=I,H(E)):(e.consume(E),I)}function P(E){return E===62?z(E):I(E)}function D(E){return zn(E)?(e.consume(E),L):r(E)}function L(E){return E===45||En(E)?(e.consume(E),L):$(E)}function $(E){return De(E)?(d=$,H(E)):Je(E)?(e.consume(E),$):z(E)}function Q(E){return E===45||En(E)?(e.consume(E),Q):E===47||E===62||Rt(E)?W(E):r(E)}function W(E){return E===47?(e.consume(E),z):E===58||E===95||zn(E)?(e.consume(E),B):De(E)?(d=W,H(E)):Je(E)?(e.consume(E),W):z(E)}function B(E){return E===45||E===46||E===58||E===95||En(E)?(e.consume(E),B):V(E)}function V(E){return E===61?(e.consume(E),q):De(E)?(d=V,H(E)):Je(E)?(e.consume(E),V):W(E)}function q(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(e.consume(E),o=E,X):De(E)?(d=q,H(E)):Je(E)?(e.consume(E),q):(e.consume(E),te)}function X(E){return E===o?(e.consume(E),o=void 0,O):E===null?r(E):De(E)?(d=X,H(E)):(e.consume(E),X)}function te(E){return E===null||E===34||E===39||E===60||E===61||E===96?r(E):E===47||E===62||Rt(E)?W(E):(e.consume(E),te)}function O(E){return E===47||E===62||Rt(E)?W(E):r(E)}function z(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),n):r(E)}function H(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),Z}function Z(E){return Je(E)?it(e,ce,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ce(E)}function ce(E){return e.enter("htmlTextData"),d(E)}}const dp={name:"labelEnd",resolveAll:dT,resolveTo:fT,tokenize:mT},oT={tokenize:hT},cT={tokenize:pT},uT={tokenize:gT};function dT(e){let n=-1;const r=[];for(;++n<e.length;){const s=e[n][1];if(r.push(e[n]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",n+=o}}return e.length!==r.length&&da(e,0,e.length,r),e}function fT(e,n){let r=e.length,s=0,o,c,d,f;for(;r--;)if(o=e[r][1],c){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&&(c=r,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(d=r);const m={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[c][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=Ea(f,e.slice(c+1,c+s+3)),f=Ea(f,[["enter",g,n]]),f=Ea(f,Hu(n.parser.constructs.insideSpan.null,e.slice(c+s+4,d-3),n)),f=Ea(f,[["exit",g,n],e[d-2],e[d-1],["exit",h,n]]),f=Ea(f,e.slice(d+1)),f=Ea(f,[["exit",m,n]]),da(e,c,e.length,f),e}function mT(e,n,r){const s=this;let o=s.events.length,c,d;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){c=s.events[o][1];break}return f;function f(k){return c?c._inactive?y(k):(d=s.parser.defined.includes(Wa(s.sliceSerialize({start:c.end,end:s.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(oT,g,d?g:y)(k):k===91?e.attempt(cT,g,d?h:y)(k):d?g(k):y(k)}function h(k){return e.attempt(uT,g,y)(k)}function g(k){return n(k)}function y(k){return c._balanced=!0,r(k)}}function hT(e,n,r){return s;function s(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return Rt(y)?ro(e,c)(y):c(y)}function c(y){return y===41?g(y):uk(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Rt(y)?ro(e,m)(y):g(y)}function f(y){return r(y)}function m(y){return y===34||y===39||y===40?fk(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function h(y){return Rt(y)?ro(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),n):r(y)}}function pT(e,n,r){const s=this;return o;function o(f){return dk.call(s,e,c,d,"reference","referenceMarker","referenceString")(f)}function c(f){return s.parser.defined.includes(Wa(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function d(f){return r(f)}}function gT(e,n,r){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),n):r(c)}}const xT={name:"labelStartImage",resolveAll:dp.resolveAll,tokenize:yT};function yT(e,n,r){const s=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(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 s.parser.constructs?r(f):n(f)}}const bT={name:"labelStartLink",resolveAll:dp.resolveAll,tokenize:vT};function vT(e,n,r){const s=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),c}function c(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(d):n(d)}}const bm={name:"lineEnding",tokenize:kT};function kT(e,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),it(e,n,"linePrefix")}}const fu={name:"thematicBreak",tokenize:wT};function wT(e,n,r){let s=0,o;return c;function c(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)):s>=3&&(h===null||De(h))?(e.exit("thematicBreak"),n(h)):r(h)}function m(h){return h===o?(e.consume(h),s++,m):(e.exit("thematicBreakSequence"),Je(h)?it(e,f,"whitespace")(h):f(h))}}const Xn={continuation:{tokenize:CT},exit:MT,name:"list",tokenize:NT},ST={partial:!0,tokenize:ET},jT={partial:!0,tokenize:TT};function NT(e,n,r){const s=this,o=s.events[s.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return f;function f(w){const N=s.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!s.containerState.marker||w===s.containerState.marker:dh(w)){if(s.containerState.type||(s.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(fu,r,h)(w):h(w);if(!s.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return dh(w)&&++d<10?(e.consume(w),m):(!s.interrupt||d<2)&&(s.containerState.marker?w===s.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"),s.containerState.marker=s.containerState.marker||w,e.check(jo,s.interrupt?r:g,e.attempt(ST,k,y))}function g(w){return s.containerState.initialBlankLine=!0,c++,k(w)}function y(w){return Je(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),k):r(w)}function k(w){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function CT(e,n,r){const s=this;return s.containerState._closeFlow=void 0,e.check(jo,o,c);function o(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,it(e,n,"listItemIndent",s.containerState.size+1)(f)}function c(f){return s.containerState.furtherBlankLines||!Je(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,d(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(jT,n,d)(f))}function d(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,it(e,e.attempt(Xn,n,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function TT(e,n,r){const s=this;return it(e,o,"listItemIndent",s.containerState.size+1);function o(c){const d=s.events[s.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===s.containerState.size?n(c):r(c)}}function MT(e){e.exit(this.containerState.type)}function ET(e,n,r){const s=this;return it(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=s.events[s.events.length-1];return!Je(c)&&d&&d[1].type==="listItemPrefixWhitespace"?n(c):r(c)}}const f1={name:"setextUnderline",resolveTo:AT,tokenize:RT};function AT(e,n){let r=e.length,s,o,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const d={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",d,n]),e.splice(c+1,0,["exit",e[s][1],n]),e[s][1].end={...e[c][1].end}):e[s][1]=d,e.push(["exit",d,n]),e}function RT(e,n,r){const s=this;let o;return c;function c(h){let g=s.events.length,y;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){y=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||y)?(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"),Je(h)?it(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||De(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const _T={tokenize:IT};function IT(e){const n=this,r=e.attempt(jo,s,e.attempt(this.parser.constructs.flowInitial,o,it(e,e.attempt(this.parser.constructs.flow,o,e.attempt(U3,o)),"linePrefix")));return r;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const LT={resolveAll:hk()},DT=mk("string"),OT=mk("text");function mk(e){return{resolveAll:hk(e==="text"?zT:void 0),tokenize:n};function n(r){const s=this,o=this.parser.constructs[e],c=r.attempt(o,d,f);return d;function d(g){return h(g)?c(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"),c(g)):(r.consume(g),m)}function h(g){if(g===null)return!0;const y=o[g];let k=-1;if(y)for(;++k<y.length;){const w=y[k];if(!w.previous||w.previous.call(s,s.previous))return!0}return!1}}}function hk(e){return n;function n(r,s){let o=-1,c;for(;++o<=r.length;)c===void 0?r[o]&&r[o][1].type==="data"&&(c=o,o++):(!r[o]||r[o][1].type!=="data")&&(o!==c+2&&(r[c][1].end=r[o-1][1].end,r.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(r,s):r}}function zT(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 s=e[r-1][1],o=n.sliceStream(s);let c=o.length,d=-1,f=0,m;for(;c--;){const h=o[c];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){c++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const h={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?d:s.start._bufferIndex+d,_index:s.start._index+c,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(r,0,["enter",h,n],["exit",h,n]),r+=2)}r++}return e}const UT={42:Xn,43:Xn,45:Xn,48:Xn,49:Xn,50:Xn,51:Xn,52:Xn,53:Xn,54:Xn,55:Xn,56:Xn,57:Xn,62:lk},$T={91:q3},BT={[-2]:ym,[-1]:ym,32:ym},HT={35:Y3,42:fu,45:[f1,fu],60:J3,61:f1,95:fu,96:u1,126:u1},PT={38:ok,92:ik},qT={[-5]:bm,[-4]:bm,[-3]:bm,33:xT,38:ok,42:fh,60:[b3,lT],91:bT,92:[W3,ik],93:dp,95:fh,96:_3},FT={null:[fh,LT]},VT={null:[42,95]},GT={null:[]},WT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VT,contentInitial:$T,disable:GT,document:UT,flow:HT,flowInitial:BT,insideSpan:FT,string:PT,text:qT},Symbol.toStringTag,{value:"Module"}));function KT(e,n,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const o={},c=[];let d=[],f=[];const m={attempt:$(D),check:$(L),consume:R,enter:I,exit:P,interrupt:$(L,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:N,parser:e,previous:null,sliceSerialize:k,sliceStream:w,write:y};let g=n.tokenize.call(h,m);return n.resolveAll&&c.push(n),h;function y(V){return d=Ea(d,V),M(),d[d.length-1]!==null?[]:(Q(n,0),h.events=Hu(c,h.events,h),h.events)}function k(V,q){return QT(w(V),q)}function w(V){return YT(d,V)}function N(){const{_bufferIndex:V,_index:q,line:X,column:te,offset:O}=s;return{_bufferIndex:V,_index:q,line:X,column:te,offset:O}}function C(V){o[V.line]=V.column,B()}function M(){let V;for(;s._index<d.length;){const q=d[s._index];if(typeof q=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<q.length;)A(q.charCodeAt(s._bufferIndex));else A(q)}}function A(V){g=g(V)}function R(V){De(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,B()):V!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===d[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=V}function I(V,q){const X=q||{};return X.type=V,X.start=N(),h.events.push(["enter",X,h]),f.push(X),X}function P(V){const q=f.pop();return q.end=N(),h.events.push(["exit",q,h]),q}function D(V,q){Q(V,q.from)}function L(V,q){q.restore()}function $(V,q){return X;function X(te,O,z){let H,Z,ce,E;return Array.isArray(te)?U(te):"tokenize"in te?U([te]):T(te);function T(oe){return pe;function pe(Se){const ie=Se!==null&&oe[Se],he=Se!==null&&oe.null,be=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(he)?he:he?[he]:[]];return U(be)(Se)}}function U(oe){return H=oe,Z=0,oe.length===0?z:j(oe[Z])}function j(oe){return pe;function pe(Se){return E=W(),ce=oe,oe.partial||(h.currentConstruct=oe),oe.name&&h.parser.constructs.disable.null.includes(oe.name)?se():oe.tokenize.call(q?Object.assign(Object.create(h),q):h,m,K,se)(Se)}}function K(oe){return V(ce,E),O}function se(oe){return E.restore(),++Z<H.length?j(H[Z]):z}}}function Q(V,q){V.resolveAll&&!c.includes(V)&&c.push(V),V.resolve&&da(h.events,q,h.events.length-q,V.resolve(h.events.slice(q),h)),V.resolveTo&&(h.events=V.resolveTo(h.events,h))}function W(){const V=N(),q=h.previous,X=h.currentConstruct,te=h.events.length,O=Array.from(f);return{from:te,restore:z};function z(){s=V,h.previous=q,h.currentConstruct=X,h.events.length=te,f=O,B()}}function B(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function YT(e,n){const r=n.start._index,s=n.start._bufferIndex,o=n.end._index,c=n.end._bufferIndex;let d;if(r===o)d=[e[r].slice(s,c)];else{if(d=e.slice(r,o),s>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(s):d.shift()}c>0&&d.push(e[o].slice(0,c))}return d}function QT(e,n){let r=-1;const s=[];let o;for(;++r<e.length;){const c=e[r];let d;if(typeof c=="string")d=c;else switch(c){case-5:{d="\r";break}case-4:{d=`
|
|
72
|
-
`;break}case-3:{d=`\r
|
|
73
|
-
`;break}case-2:{d=n?" ":" ";break}case-1:{if(!n&&o)continue;d=" ";break}default:d=String.fromCharCode(c)}o=c===-2,s.push(d)}return s.join("")}function XT(e){const s={constructs:rk([WT,...(e||{}).extensions||[]]),content:o(f3),defined:[],document:o(h3),flow:o(_T),lazy:{},string:o(DT),text:o(OT)};return s;function o(c){return d;function d(f){return KT(s,c,f)}}}function ZT(e){for(;!ck(e););return e}const m1=/[\0\t\n\r]/g;function JT(){let e=1,n="",r=!0,s;return o;function o(c,d,f){const m=[];let h,g,y,k,w;for(c=n+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c)),y=0,n="",r&&(c.charCodeAt(0)===65279&&y++,r=void 0);y<c.length;){if(m1.lastIndex=y,h=m1.exec(c),k=h&&h.index!==void 0?h.index:c.length,w=c.charCodeAt(k),!h){n=c.slice(y);break}if(w===10&&y===k&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),y<k&&(m.push(c.slice(y,k)),e+=k-y),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:s=!0,e=1}y=k+1}return f&&(s&&m.push(-5),n&&m.push(n),m.push(null)),m}}const eM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tM(e){return e.replace(eM,nM)}function nM(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),c=o===120||o===88;return sk(r.slice(c?2:1),c?16:10)}return up(r)||e}const pk={}.hasOwnProperty;function aM(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),rM(r)(ZT(XT(r).document().write(JT()(e,n,!0))))}function rM(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(je),autolinkProtocol:W,autolinkEmail:W,atxHeading:c(wt),blockQuote:c(he),characterEscape:W,characterReference:W,codeFenced:c(be),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(be,d),codeText:c(ze,d),codeTextData:W,data:W,codeFlowValue:W,definition:c(st),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c(Ue),hardBreakEscape:c(Yt),hardBreakTrailing:c(Yt),htmlFlow:c(pn,d),htmlFlowData:W,htmlText:c(pn,d),htmlTextData:W,image:c(gn),label:d,link:c(je),listItem:c(lt),listItemValue:k,listOrdered:c(Ee,y),listUnordered:c(Ee),paragraph:c(We),reference:j,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(wt),strong:c(ct),thematicBreak:c(tn)},exit:{atxHeading:m(),atxHeadingSequence:D,autolink:m(),autolinkEmail:ie,autolinkProtocol:Se,blockQuote:m(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:oe,characterReference:pe,codeFenced:m(M),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:N,codeFlowValue:B,codeIndented:m(A),codeText:m(O),codeTextData:B,data:B,definition:m(),definitionDestinationString:P,definitionLabelString:R,definitionTitleString:I,emphasis:m(),hardBreakEscape:m(q),hardBreakTrailing:m(q),htmlFlow:m(X),htmlFlowData:B,htmlText:m(te),htmlTextData:B,image:m(H),label:ce,labelText:Z,lineEnding:V,link:m(z),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:K,resourceDestinationString:E,resourceTitleString:T,resource:U,setextHeading:m(Q),setextHeadingLineSequence:$,setextHeadingText:L,strong:m(),thematicBreak:m()}};gk(n,(e||{}).mdastExtensions||[]);const r={};return s;function s(ue){let ge={type:"root",children:[]};const Ae={stack:[ge],tokenStack:[],config:n,enter:f,exit:h,buffer:d,resume:g,data:r},Be=[];let $e=-1;for(;++$e<ue.length;)if(ue[$e][1].type==="listOrdered"||ue[$e][1].type==="listUnordered")if(ue[$e][0]==="enter")Be.push($e);else{const Qt=Be.pop();$e=o(ue,Qt,$e)}for($e=-1;++$e<ue.length;){const Qt=n[ue[$e][0]];pk.call(Qt,ue[$e][1].type)&&Qt[ue[$e][1].type].call(Object.assign({sliceSerialize:ue[$e][2].sliceSerialize},Ae),ue[$e][1])}if(Ae.tokenStack.length>0){const Qt=Ae.tokenStack[Ae.tokenStack.length-1];(Qt[1]||h1).call(Ae,void 0,Qt[0])}for(ge.position={start:cs(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:cs(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<n.transforms.length;)ge=n.transforms[$e](ge)||ge;return ge}function o(ue,ge,Ae){let Be=ge-1,$e=-1,Qt=!1,mt,ht,Ke,Ft;for(;++Be<=Ae;){const Ye=ue[Be];switch(Ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ye[0]==="enter"?$e++:$e--,Ft=void 0;break}case"lineEndingBlank":{Ye[0]==="enter"&&(mt&&!Ft&&!$e&&!Ke&&(Ke=Be),Ft=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ft=void 0}if(!$e&&Ye[0]==="enter"&&Ye[1].type==="listItemPrefix"||$e===-1&&Ye[0]==="exit"&&(Ye[1].type==="listUnordered"||Ye[1].type==="listOrdered")){if(mt){let xn=Be;for(ht=void 0;xn--;){const ut=ue[xn];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;ht&&(ue[ht][1].type="lineEndingBlank",Qt=!0),ut[1].type="lineEnding",ht=xn}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}Ke&&(!ht||Ke<ht)&&(mt._spread=!0),mt.end=Object.assign({},ht?ue[ht][1].start:Ye[1].end),ue.splice(ht||Be,0,["exit",mt,Ye[2]]),Be++,Ae++}if(Ye[1].type==="listItemPrefix"){const xn={type:"listItem",_spread:!1,start:Object.assign({},Ye[1].start),end:void 0};mt=xn,ue.splice(Be,0,["enter",xn,Ye[2]]),Be++,Ae++,Ke=void 0,Ft=!0}}}return ue[ge][1]._spread=Qt,Ae}function c(ue,ge){return Ae;function Ae(Be){f.call(this,ue(Be),Be),ge&&ge.call(this,Be)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(ue,ge,Ae){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ge,Ae||void 0]),ue.position={start:cs(ge.start),end:void 0}}function m(ue){return ge;function ge(Ae){ue&&ue.call(this,Ae),h.call(this,Ae)}}function h(ue,ge){const Ae=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==ue.type&&(ge?ge.call(this,ue,Be[0]):(Be[1]||h1).call(this,ue,Be[0]));else throw new Error("Cannot close `"+ue.type+"` ("+ao({start:ue.start,end:ue.end})+"): it’s not open");Ae.position.end=cs(ue.end)}function g(){return cp(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function k(ue){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=ue}function N(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function M(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ue.replace(/(\r?\n|\r)$/g,"")}function R(ue){const ge=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ge,Ae.identifier=Wa(this.sliceSerialize(ue)).toLowerCase()}function I(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.title=ue}function P(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.url=ue}function D(ue){const ge=this.stack[this.stack.length-1];if(!ge.depth){const Ae=this.sliceSerialize(ue).length;ge.depth=Ae}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function $(ue){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function Q(){this.data.setextHeadingSlurpLineEnding=void 0}function W(ue){const Ae=this.stack[this.stack.length-1].children;let Be=Ae[Ae.length-1];(!Be||Be.type!=="text")&&(Be=St(),Be.position={start:cs(ue.start),end:void 0},Ae.push(Be)),this.stack.push(Be)}function B(ue){const ge=this.stack.pop();ge.value+=this.sliceSerialize(ue),ge.position.end=cs(ue.end)}function V(ue){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=ge.children[ge.children.length-1];Ae.position.end=cs(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(ge.type)&&(W.call(this,ue),B.call(this,ue))}function q(){this.data.atHardBreak=!0}function X(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ue}function te(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ue}function O(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ue}function z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ge,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function H(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ge,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Z(ue){const ge=this.sliceSerialize(ue),Ae=this.stack[this.stack.length-2];Ae.label=tM(ge),Ae.identifier=Wa(ge).toLowerCase()}function ce(){const ue=this.stack[this.stack.length-1],ge=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const Be=ue.children;Ae.children=Be}else Ae.alt=ge}function E(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.url=ue}function T(){const ue=this.resume(),ge=this.stack[this.stack.length-1];ge.title=ue}function U(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function K(ue){const ge=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ge,Ae.identifier=Wa(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function se(ue){this.data.characterReferenceType=ue.type}function oe(ue){const ge=this.sliceSerialize(ue),Ae=this.data.characterReferenceType;let Be;Ae?(Be=sk(ge,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=up(ge);const $e=this.stack[this.stack.length-1];$e.value+=Be}function pe(ue){const ge=this.stack.pop();ge.position.end=cs(ue.end)}function Se(ue){B.call(this,ue);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(ue)}function ie(ue){B.call(this,ue);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(ue)}function he(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function st(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ue(){return{type:"emphasis",children:[]}}function wt(){return{type:"heading",depth:0,children:[]}}function Yt(){return{type:"break"}}function pn(){return{type:"html",value:""}}function gn(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function Ee(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function lt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function We(){return{type:"paragraph",children:[]}}function ct(){return{type:"strong",children:[]}}function St(){return{type:"text",value:""}}function tn(){return{type:"thematicBreak"}}}function cs(e){return{line:e.line,column:e.column,offset:e.offset}}function gk(e,n){let r=-1;for(;++r<n.length;){const s=n[r];Array.isArray(s)?gk(e,s):sM(e,s)}}function sM(e,n){let r;for(r in n)if(pk.call(n,r))switch(r){case"canContainEols":{const s=n[r];s&&e[r].push(...s);break}case"transforms":{const s=n[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=n[r];s&&Object.assign(e[r],s);break}}}function h1(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+ao({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+ao({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+ao({start:n.start,end:n.end})+") is still open")}function lM(e){const n=this;n.parser=r;function r(s){return aM(s,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function iM(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 oM(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
74
|
-
`}]}function cM(e,n){const r=n.value?n.value+`
|
|
75
|
-
`:"",s={},o=n.lang?n.lang.split(/\s+/):[];o.length>0&&(s.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return n.meta&&(c.data={meta:n.meta}),e.patch(n,c),c=e.applyData(n,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(n,c),c}function uM(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function dM(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function fM(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(n.identifier).toUpperCase(),o=Yl(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let d,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),d=e.footnoteOrder.length):d=c+1,f+=1,e.footnoteCounts.set(s,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 mM(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 hM(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function xk(e,n){const r=n.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+s}];const o=e.all(n),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=s:o.push({type:"text",value:s}),o}function pM(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return xk(e,n);const o={src:Yl(s.url||""),alt:n.alt};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,c),e.applyData(n,c)}function gM(e,n){const r={src:Yl(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 s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,s),e.applyData(n,s)}function xM(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,s),e.applyData(n,s)}function yM(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return xk(e,n);const o={href:Yl(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,c),e.applyData(n,c)}function bM(e,n){const r={href:Yl(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function vM(e,n,r){const s=e.all(n),o=r?kM(r):yk(n),c={},d=[];if(typeof n.checked=="boolean"){const g=s[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},s.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const g=s[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
|
|
76
|
-
`}),g.type==="element"&&g.tagName==="p"&&!o?d.push(...g.children):d.push(g)}const m=s[s.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
|
|
77
|
-
`});const h={type:"element",tagName:"li",properties:c,children:d};return e.patch(n,h),e.applyData(n,h)}function kM(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let s=-1;for(;!n&&++s<r.length;)n=yk(r[s])}return n}function yk(e){const n=e.spread;return n??e.children.length>1}function wM(e,n){const r={},s=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++o<s.length;){const d=s[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 c={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(n,c),e.applyData(n,c)}function SM(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function jM(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function NM(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function CM(e,n){const r=e.all(n),s=r.shift(),o=[];if(s){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!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=sp(n.children[1]),m=Xv(n.children[n.children.length-1]);f&&m&&(d.position={start:f,end:m}),o.push(d)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,c),e.applyData(n,c)}function TM(e,n,r){const s=r?r.children:void 0,c=(s?s.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 y=n.children[m],k={},w=d?d[m]:void 0;w&&(k.align=w);let N={type:"element",tagName:c,properties:k,children:[]};y&&(N.children=e.all(y),e.patch(y,N),N=e.applyData(y,N)),h.push(N)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(n,g),e.applyData(n,g)}function MM(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const p1=9,g1=32;function EM(e){const n=String(e),r=/\r?\n|\r/g;let s=r.exec(n),o=0;const c=[];for(;s;)c.push(x1(n.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=r.exec(n);return c.push(x1(n.slice(o),o>0,!1)),c.join("")}function x1(e,n,r){let s=0,o=e.length;if(n){let c=e.codePointAt(s);for(;c===p1||c===g1;)s++,c=e.codePointAt(s)}if(r){let c=e.codePointAt(o-1);for(;c===p1||c===g1;)o--,c=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function AM(e,n){const r={type:"text",value:EM(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function RM(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const _M={blockquote:iM,break:oM,code:cM,delete:uM,emphasis:dM,footnoteReference:fM,heading:mM,html:hM,imageReference:pM,image:gM,inlineCode:xM,linkReference:yM,link:bM,listItem:vM,list:wM,paragraph:SM,root:jM,strong:NM,table:CM,tableCell:MM,tableRow:TM,text:AM,thematicBreak:RM,toml:Bc,yaml:Bc,definition:Bc,footnoteDefinition:Bc};function Bc(){}const bk=-1,Pu=0,so=1,Su=2,fp=3,mp=4,hp=5,pp=6,vk=7,kk=8,IM=typeof self=="object"?self:globalThis,y1=(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 IM[e](n)},LM=(e,n)=>{const r=(o,c)=>(e.set(c,o),o),s=o=>{if(e.has(o))return e.get(o);const[c,d]=n[o];switch(c){case Pu:case bk:return r(d,o);case so:{const f=r([],o);for(const m of d)f.push(s(m));return f}case Su:{const f=r({},o);for(const[m,h]of d)f[s(m)]=s(h);return f}case fp:return r(new Date(d),o);case mp:{const{source:f,flags:m}=d;return r(new RegExp(f,m),o)}case hp:{const f=r(new Map,o);for(const[m,h]of d)f.set(s(m),s(h));return f}case pp:{const f=r(new Set,o);for(const m of d)f.add(s(m));return f}case vk:{const{name:f,message:m}=d;return r(y1(f,m),o)}case kk: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(y1(c,d),o)};return s},b1=e=>LM(new Map,e)(0),Ds="",{toString:DM}={},{keys:OM}=Object,Vi=e=>{const n=typeof e;if(n!=="object"||!e)return[Pu,n];const r=DM.call(e).slice(8,-1);switch(r){case"Array":return[so,Ds];case"Object":return[Su,Ds];case"Date":return[fp,Ds];case"RegExp":return[mp,Ds];case"Map":return[hp,Ds];case"Set":return[pp,Ds];case"DataView":return[so,r]}return r.includes("Array")?[so,r]:r.includes("Error")?[vk,r]:[Su,r]},Hc=([e,n])=>e===Pu&&(n==="function"||n==="symbol"),zM=(e,n,r,s)=>{const o=(d,f)=>{const m=s.push(d)-1;return r.set(f,m),m},c=d=>{if(r.has(d))return r.get(d);let[f,m]=Vi(d);switch(f){case Pu:{let g=d;switch(m){case"bigint":f=kk,g=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return o([bk],d)}return o([f,g],d)}case so:{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=[],y=o([f,g],d);for(const k of d)g.push(c(k));return y}case Su:{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 c(d.toJSON());const g=[],y=o([f,g],d);for(const k of OM(d))(e||!Hc(Vi(d[k])))&&g.push([c(k),c(d[k])]);return y}case fp:return o([f,isNaN(d.getTime())?Ds:d.toISOString()],d);case mp:{const{source:g,flags:y}=d;return o([f,{source:g,flags:y}],d)}case hp:{const g=[],y=o([f,g],d);for(const[k,w]of d)(e||!(Hc(Vi(k))||Hc(Vi(w))))&&g.push([c(k),c(w)]);return y}case pp:{const g=[],y=o([f,g],d);for(const k of d)(e||!Hc(Vi(k)))&&g.push(c(k));return y}}const{message:h}=d;return o([f,{name:m,message:h}],d)};return c},v1=(e,{json:n,lossy:r}={})=>{const s=[];return zM(!(n||r),!!n,new Map,s)(e),s},ju=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?b1(v1(e,n)):structuredClone(e):(e,n)=>b1(v1(e,n));function UM(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 $M(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function BM(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||UM,s=e.options.footnoteBackLabel||$M,o=e.options.footnoteLabel||"Footnotes",c=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),y=String(h.identifier).toUpperCase(),k=Yl(y.toLowerCase());let w=0;const N=[],C=e.footnoteCounts.get(y);for(;C!==void 0&&++w<=C;){N.length>0&&N.push({type:"text",value:" "});let R=typeof r=="string"?r:r(m,w);typeof R=="string"&&(R={type:"text",value:R}),N.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+k+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,w),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const M=g[g.length-1];if(M&&M.type==="element"&&M.tagName==="p"){const R=M.children[M.children.length-1];R&&R.type==="text"?R.value+=" ":M.children.push({type:"text",value:" "}),M.children.push(...N)}else g.push(...N);const A={type:"element",tagName:"li",properties:{id:n+"fn-"+k},children:e.wrap(g,!0)};e.patch(h,A),f.push(A)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...ju(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
78
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
79
|
-
`}]}}const qu=(function(e){if(e==null)return FM;if(typeof e=="function")return Fu(e);if(typeof e=="object")return Array.isArray(e)?HM(e):PM(e);if(typeof e=="string")return qM(e);throw new Error("Expected function, string, or object as test")});function HM(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=qu(e[r]);return Fu(s);function s(...o){let c=-1;for(;++c<n.length;)if(n[c].apply(this,o))return!0;return!1}}function PM(e){const n=e;return Fu(r);function r(s){const o=s;let c;for(c in e)if(o[c]!==n[c])return!1;return!0}}function qM(e){return Fu(n);function n(r){return r&&r.type===e}}function Fu(e){return n;function n(r,s,o){return!!(VM(r)&&e.call(this,r,typeof s=="number"?s:void 0,o||void 0))}}function FM(){return!0}function VM(e){return e!==null&&typeof e=="object"&&"type"in e}const wk=[],GM=!0,mh=!1,WM="skip";function Sk(e,n,r,s){let o;typeof n=="function"&&typeof r!="function"?(s=r,r=n):o=n;const c=qu(o),d=s?-1:1;f(e,void 0,[])();function f(m,h,g){const y=m&&typeof m=="object"?m:{};if(typeof y.type=="string"){const w=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(k,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return k;function k(){let w=wk,N,C,M;if((!n||c(m,h,g[g.length-1]||void 0))&&(w=KM(r(m,g)),w[0]===mh))return w;if("children"in m&&m.children){const A=m;if(A.children&&w[0]!==WM)for(C=(s?A.children.length:-1)+d,M=g.concat(A);C>-1&&C<A.children.length;){const R=A.children[C];if(N=f(R,C,M)(),N[0]===mh)return N;C=typeof N[1]=="number"?N[1]:C+d}}return w}}}function KM(e){return Array.isArray(e)?e:typeof e=="number"?[GM,e]:e==null?wk:[e]}function gp(e,n,r,s){let o,c,d;typeof n=="function"&&typeof r!="function"?(c=void 0,d=n,o=r):(c=n,d=r,o=s),Sk(e,c,f,o);function f(m,h){const g=h[h.length-1],y=g?g.children.indexOf(m):void 0;return d(m,y,g)}}const hh={}.hasOwnProperty,YM={};function QM(e,n){const r=n||YM,s=new Map,o=new Map,c=new Map,d={..._M,...r.handlers},f={all:h,applyData:ZM,definitionById:s,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:r,patch:XM,wrap:eE};return gp(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?s:o,k=String(g.identifier).toUpperCase();y.has(k)||y.set(k,g)}}),f;function m(g,y){const k=g.type,w=f.handlers[k];if(hh.call(f.handlers,k)&&w)return w(f,g,y);if(f.options.passThrough&&f.options.passThrough.includes(k)){if("children"in g){const{children:C,...M}=g,A=ju(M);return A.children=f.all(g),A}return ju(g)}return(f.options.unknownHandler||JM)(f,g,y)}function h(g){const y=[];if("children"in g){const k=g.children;let w=-1;for(;++w<k.length;){const N=f.one(k[w],g);if(N){if(w&&k[w-1].type==="break"&&(!Array.isArray(N)&&N.type==="text"&&(N.value=k1(N.value)),!Array.isArray(N)&&N.type==="element")){const C=N.children[0];C&&C.type==="text"&&(C.value=k1(C.value))}Array.isArray(N)?y.push(...N):y.push(N)}}}return y}}function XM(e,n){e.position&&(n.position=UC(e))}function ZM(e,n){let r=n;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const d="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:d}}r.type==="element"&&c&&Object.assign(r.properties,ju(c)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function JM(e,n){const r=n.data||{},s="value"in n&&!(hh.call(r,"hProperties")||hh.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function eE(e,n){const r=[];let s=-1;for(n&&r.push({type:"text",value:`
|
|
80
|
-
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
81
|
-
`}),r.push(e[s]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
82
|
-
`}),r}function k1(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function w1(e,n){const r=QM(e,n),s=r.one(e,void 0),o=BM(r),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
|
|
83
|
-
`},o),c}function tE(e,n){return e&&"run"in e?async function(r,s){const o=w1(r,{file:s,...n});await e.run(o,s)}:function(r,s){return w1(r,{file:s,...e||n})}}function S1(e){if(e)throw e}var vm,j1;function nE(){if(j1)return vm;j1=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},c=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!y)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(s)return s(h,g).value}else return;return h[g]};return vm=function m(){var h,g,y,k,w,N,C=arguments[0],M=1,A=arguments.length,R=!1;for(typeof C=="boolean"&&(R=C,C=arguments[1]||{},M=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});M<A;++M)if(h=arguments[M],h!=null)for(g in h)y=f(C,g),k=f(h,g),C!==k&&(R&&k&&(c(k)||(w=o(k)))?(w?(w=!1,N=y&&o(y)?y:[]):N=y&&c(y)?y:{},d(C,{name:g,newValue:m(R,N,k)})):typeof k<"u"&&d(C,{name:g,newValue:k}));return C},vm}var aE=nE();const km=Ob(aE);function ph(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 rE(){const e=[],n={run:r,use:s};return n;function r(...o){let c=-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[++c];let y=-1;if(m){d(m);return}for(;++y<o.length;)(h[y]===null||h[y]===void 0)&&(h[y]=o[y]);o=h,g?sE(g,f)(...h):d(null,...h)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function sE(e,n){let r;return s;function s(...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(c,o):m instanceof Error?o(m):c(m))}function o(d,...f){r||(r=!0,n(d,...f))}function c(d){o(null,d)}}const nr={basename:lE,dirname:iE,extname:oE,join:cE,sep:"/"};function lE(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');No(e);let r=0,s=-1,o=e.length,c;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else s<0&&(c=!0,s=o+1);return s<0?"":e.slice(r,s)}if(n===e)return"";let d=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else d<0&&(c=!0,d=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(s=o):(f=-1,s=d));return r===s?s=d:s<0&&(s=e.length),e.slice(r,s)}function iE(e){if(No(e),e.length===0)return".";let n=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){n=r;break}}else s||(s=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function oE(e){No(e);let n=e.length,r=-1,s=0,o=-1,c=0,d;for(;n--;){const f=e.codePointAt(n);if(f===47){if(d){s=n+1;break}continue}r<0&&(d=!0,r=n+1),f===46?o<0?o=n:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||r<0||c===0||c===1&&o===r-1&&o===s+1?"":e.slice(o,r)}function cE(...e){let n=-1,r;for(;++n<e.length;)No(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":uE(r)}function uE(e){No(e);const n=e.codePointAt(0)===47;let r=dE(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function dE(e,n){let r="",s=0,o=-1,c=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||c===1))if(o!==d-1&&c===2){if(r.length<2||s!==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="",s=0):(r=r.slice(0,m),s=r.length-1-r.lastIndexOf("/")),o=d,c=0;continue}}else if(r.length>0){r="",s=0,o=d,c=0;continue}}n&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),s=d-o-1;o=d,c=0}else f===46&&c>-1?c++:c=-1}return r}function No(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const fE={cwd:mE};function mE(){return"/"}function gh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function hE(e){if(typeof e=="string")e=new URL(e);else if(!gh(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 pE(e)}function pE(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const s=n.codePointAt(r+2);if(s===70||s===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 wm=["history","path","basename","stem","extname","dirname"];class jk{constructor(n){let r;n?gh(n)?r={path:n}:typeof n=="string"||gE(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":fE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<wm.length;){const c=wm[s];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let o;for(o in r)wm.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?nr.basename(this.path):void 0}set basename(n){jm(n,"basename"),Sm(n,"basename"),this.path=nr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?nr.dirname(this.path):void 0}set dirname(n){N1(this.basename,"dirname"),this.path=nr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?nr.extname(this.path):void 0}set extname(n){if(Sm(n,"extname"),N1(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=nr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){gh(n)&&(n=hE(n)),jm(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?nr.basename(this.path,this.extname):void 0}set stem(n){jm(n,"stem"),Sm(n,"stem"),this.path=nr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,s){const o=this.message(n,r,s);throw o.fatal=!0,o}info(n,r,s){const o=this.message(n,r,s);return o.fatal=void 0,o}message(n,r,s){const o=new An(n,r,s);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 Sm(e,n){if(e&&e.includes(nr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+nr.sep+"`")}function jm(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function N1(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function gE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xE=(function(e){const s=this.constructor.prototype,o=s[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),yE={}.hasOwnProperty;class xp extends xE{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=rE()}copy(){const n=new xp;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];n.use(...s)}return n.data(km(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Tm("data",this.frozen),this.namespace[n]=r,this):yE.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Tm("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,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=r.call(n,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=Pc(n),s=this.parser||this.Parser;return Nm("parse",s),s(String(r),r)}process(n,r){const s=this;return this.freeze(),Nm("process",this.parser||this.Parser),Cm("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(c,d){const f=Pc(n),m=s.parse(f);s.run(m,f,function(g,y,k){if(g||!y||!k)return h(g);const w=y,N=s.stringify(w,k);kE(N)?k.value=N:k.result=N,h(g,k)});function h(g,y){g||!y?d(g):c?c(y):r(void 0,y)}}}processSync(n){let r=!1,s;return this.freeze(),Nm("processSync",this.parser||this.Parser),Cm("processSync",this.compiler||this.Compiler),this.process(n,o),T1("processSync","process",r),s;function o(c,d){r=!0,S1(c),s=d}}run(n,r,s){C1(n),this.freeze();const o=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?c(void 0,s):new Promise(c);function c(d,f){const m=Pc(r);o.run(n,m,h);function h(g,y,k){const w=y||n;g?f(g):d?d(w):s(void 0,w,k)}}}runSync(n,r){let s=!1,o;return this.run(n,r,c),T1("runSync","run",s),o;function c(d,f){S1(d),o=f,s=!0}}stringify(n,r){this.freeze();const s=Pc(r),o=this.compiler||this.Compiler;return Cm("stringify",o),C1(n),o(n,s)}use(n,...r){const s=this.attachers,o=this.namespace;if(Tm("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 c(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...y]=h;m(g,y)}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=km(!0,o.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const y=h[g];c(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,g){let y=-1,k=-1;for(;++y<s.length;)if(s[y][0]===h){k=y;break}if(k===-1)s.push([h,...g]);else if(g.length>0){let[w,...N]=g;const C=s[k][1];ph(C)&&ph(w)&&(w=km(!0,C,w)),s[k]=[h,w,...N]}}}}const bE=new xp().freeze();function Nm(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cm(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Tm(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 C1(e){if(!ph(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function T1(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Pc(e){return vE(e)?e:new jk(e)}function vE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function kE(e){return typeof e=="string"||wE(e)}function wE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const SE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",M1=[],E1={allowDangerousHtml:!0},jE=/^(https?|ircs?|mailto|xmpp)$/i,NE=[{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 Vu(e){const n=CE(e),r=TE(e);return ME(n.runSync(n.parse(r),r),e)}function CE(e){const n=e.rehypePlugins||M1,r=e.remarkPlugins||M1,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...E1}:E1;return bE().use(lM).use(r).use(tE,s).use(n)}function TE(e){const n=e.children||"",r=new jk;return typeof n=="string"&&(r.value=n),r}function ME(e,n){const r=n.allowedElements,s=n.allowElement,o=n.components,c=n.disallowedElements,d=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||EE;for(const g of NE)Object.hasOwn(n,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+SE+g.id,void 0);return gp(e,h),qC(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(g,y,k){if(g.type==="raw"&&k&&typeof y=="number")return d?k.children.splice(y,1):k.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let w;for(w in xm)if(Object.hasOwn(xm,w)&&Object.hasOwn(g.properties,w)){const N=g.properties[w],C=xm[w];(C===null||C.includes(g.tagName))&&(g.properties[w]=m(String(N||""),w,g))}}if(g.type==="element"){let w=r?!r.includes(g.tagName):c?c.includes(g.tagName):!1;if(!w&&s&&typeof y=="number"&&(w=!s(g,y,k)),w&&k&&typeof y=="number")return f&&g.children?k.children.splice(y,1,...g.children):k.children.splice(y,1),y}}}function EE(e){const n=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||r!==-1&&n>r||s!==-1&&n>s||jE.test(e.slice(0,n))?e:""}function A1(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let s=0,o=r.indexOf(n);for(;o!==-1;)s++,o=r.indexOf(n,o+n.length);return s}function AE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RE(e,n,r){const o=qu((r||{}).ignore||[]),c=_E(n);let d=-1;for(;++d<c.length;)Sk(e,"text",f);function f(h,g){let y=-1,k;for(;++y<g.length;){const w=g[y],N=k?k.children:void 0;if(o(w,N?N.indexOf(w):void 0,k))return;k=w}if(k)return m(h,g)}function m(h,g){const y=g[g.length-1],k=c[d][0],w=c[d][1];let N=0;const M=y.children.indexOf(h);let A=!1,R=[];k.lastIndex=0;let I=k.exec(h.value);for(;I;){const P=I.index,D={index:I.index,input:I.input,stack:[...g,h]};let L=w(...I,D);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?k.lastIndex=P+1:(N!==P&&R.push({type:"text",value:h.value.slice(N,P)}),Array.isArray(L)?R.push(...L):L&&R.push(L),N=P+I[0].length,A=!0),!k.global)break;I=k.exec(h.value)}return A?(N<h.value.length&&R.push({type:"text",value:h.value.slice(N)}),y.children.splice(M,1,...R)):R=[h],M+R.length}}function _E(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 s=-1;for(;++s<r.length;){const o=r[s];n.push([IE(o[0]),LE(o[1])])}return n}function IE(e){return typeof e=="string"?new RegExp(AE(e),"g"):e}function LE(e){return typeof e=="function"?e:function(){return e}}const Mm="phrasing",Em=["autolink","link","image","label"];function DE(){return{transforms:[PE],enter:{literalAutolink:zE,literalAutolinkEmail:Am,literalAutolinkHttp:Am,literalAutolinkWww:Am},exit:{literalAutolink:HE,literalAutolinkEmail:BE,literalAutolinkHttp:UE,literalAutolinkWww:$E}}}function OE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Mm,notInConstruct:Em},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Mm,notInConstruct:Em},{character:":",before:"[ps]",after:"\\/",inConstruct:Mm,notInConstruct:Em}]}}function zE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Am(e){this.config.enter.autolinkProtocol.call(this,e)}function UE(e){this.config.exit.autolinkProtocol.call(this,e)}function $E(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 BE(e){this.config.exit.autolinkEmail.call(this,e)}function HE(e){this.exit(e)}function PE(e){RE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),FE]],{ignore:["link","linkReference"]})}function qE(e,n,r,s,o){let c="";if(!Nk(o)||(/^w/i.test(n)&&(r=n+r,n="",c="http://"),!VE(r)))return!1;const d=GE(r+s);if(!d[0])return!1;const f={type:"link",title:null,url:c+n+d[0],children:[{type:"text",value:n+d[0]}]};return d[1]?[f,{type:"text",value:d[1]}]:f}function FE(e,n,r,s){return!Nk(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function VE(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 GE(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],s=r.indexOf(")");const o=A1(e,"(");let c=A1(e,")");for(;s!==-1&&o>c;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),c++;return[e,r]}function Nk(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Vs(r)||Bu(r))&&(!n||r!==47)}Ck.peek=tA;function WE(){this.buffer()}function KE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function YE(){this.buffer()}function QE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function XE(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Wa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function ZE(e){this.exit(e)}function JE(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Wa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function eA(e){this.exit(e)}function tA(){return"["}function Ck(e,n,r,s){const o=r.createTracker(s);let c=o.move("[^");const d=r.enter("footnoteReference"),f=r.enter("reference");return c+=o.move(r.safe(r.associationId(e),{after:"]",before:c})),f(),d(),c+=o.move("]"),c}function nA(){return{enter:{gfmFootnoteCallString:WE,gfmFootnoteCall:KE,gfmFootnoteDefinitionLabelString:YE,gfmFootnoteDefinition:QE},exit:{gfmFootnoteCallString:XE,gfmFootnoteCall:ZE,gfmFootnoteDefinitionLabelString:JE,gfmFootnoteDefinition:eA}}}function aA(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:Ck},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,o,c,d){const f=c.createTracker(d);let m=f.move("[^");const h=c.enter("footnoteDefinition"),g=c.enter("label");return m+=f.move(c.safe(c.associationId(s),{before:m,after:"]"})),g(),m+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
84
|
-
`:" ")+c.indentLines(c.containerFlow(s,f.current()),n?Tk:rA))),h(),m}}function rA(e,n,r){return n===0?e:Tk(e,n,r)}function Tk(e,n,r){return(r?"":" ")+e}const sA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Mk.peek=uA;function lA(){return{canContainEols:["delete"],enter:{strikethrough:oA},exit:{strikethrough:cA}}}function iA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:sA}],handlers:{delete:Mk}}}function oA(e){this.enter({type:"delete",children:[]},e)}function cA(e){this.exit(e)}function Mk(e,n,r,s){const o=r.createTracker(s),c=r.enter("strikethrough");let d=o.move("~~");return d+=r.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function uA(){return"~"}function dA(e){return e.length}function fA(e,n){const r=n||{},s=(r.align||[]).concat(),o=r.stringLength||dA,c=[],d=[],f=[],m=[];let h=0,g=-1;for(;++g<e.length;){const C=[],M=[];let A=-1;for(e[g].length>h&&(h=e[g].length);++A<e[g].length;){const R=mA(e[g][A]);if(r.alignDelimiters!==!1){const I=o(R);M[A]=I,(m[A]===void 0||I>m[A])&&(m[A]=I)}C.push(R)}d[g]=C,f[g]=M}let y=-1;if(typeof s=="object"&&"length"in s)for(;++y<h;)c[y]=R1(s[y]);else{const C=R1(s);for(;++y<h;)c[y]=C}y=-1;const k=[],w=[];for(;++y<h;){const C=c[y];let M="",A="";C===99?(M=":",A=":"):C===108?M=":":C===114&&(A=":");let R=r.alignDelimiters===!1?1:Math.max(1,m[y]-M.length-A.length);const I=M+"-".repeat(R)+A;r.alignDelimiters!==!1&&(R=M.length+R+A.length,R>m[y]&&(m[y]=R),w[y]=R),k[y]=I}d.splice(1,0,k),f.splice(1,0,w),g=-1;const N=[];for(;++g<d.length;){const C=d[g],M=f[g];y=-1;const A=[];for(;++y<h;){const R=C[y]||"";let I="",P="";if(r.alignDelimiters!==!1){const D=m[y]-(M[y]||0),L=c[y];L===114?I=" ".repeat(D):L===99?D%2?(I=" ".repeat(D/2+.5),P=" ".repeat(D/2-.5)):(I=" ".repeat(D/2),P=I):P=" ".repeat(D)}r.delimiterStart!==!1&&!y&&A.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&R==="")&&(r.delimiterStart!==!1||y)&&A.push(" "),r.alignDelimiters!==!1&&A.push(I),A.push(R),r.alignDelimiters!==!1&&A.push(P),r.padding!==!1&&A.push(" "),(r.delimiterEnd!==!1||y!==h-1)&&A.push("|")}N.push(r.delimiterEnd===!1?A.join("").replace(/ +$/,""):A.join(""))}return N.join(`
|
|
85
|
-
`)}function mA(e){return e==null?"":String(e)}function R1(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 hA(e,n,r,s){const o=r.enter("blockquote"),c=r.createTracker(s);c.move("> "),c.shift(2);const d=r.indentLines(r.containerFlow(e,c.current()),pA);return o(),d}function pA(e,n,r){return">"+(r?"":" ")+e}function gA(e,n){return _1(e,n.inConstruct,!0)&&!_1(e,n.notInConstruct,!1)}function _1(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let s=-1;for(;++s<n.length;)if(e.includes(n[s]))return!0;return!1}function I1(e,n,r,s){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
|
|
86
|
-
`&&gA(r.stack,r.unsafe[o]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
87
|
-
`}function xA(e,n){const r=String(e);let s=r.indexOf(n),o=s,c=0,d=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===o?++c>d&&(d=c):c=1,o=s+n.length,s=r.indexOf(n,o);return d}function yA(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 bA(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 vA(e,n,r,s){const o=bA(r),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(yA(e,r)){const y=r.enter("codeIndented"),k=r.indentLines(c,kA);return y(),k}const f=r.createTracker(s),m=o.repeat(Math.max(xA(c,o)+1,3)),h=r.enter("codeFenced");let g=f.move(m);if(e.lang){const y=r.enter(`codeFencedLang${d}`);g+=f.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${d}`);g+=f.move(" "),g+=f.move(r.safe(e.meta,{before:g,after:`
|
|
88
|
-
`,encode:["`"],...f.current()})),y()}return g+=f.move(`
|
|
89
|
-
`),c&&(g+=f.move(c+`
|
|
90
|
-
`)),g+=f.move(m),h(),g}function kA(e,n,r){return(r?"":" ")+e}function yp(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 wA(e,n,r,s){const o=yp(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("definition");let f=r.enter("label");const m=r.createTracker(s);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?" ":`
|
|
91
|
-
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${c}`),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 SA(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 ho(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Nu(e,n,r){const s=Fl(e),o=Fl(n);return s===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===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}}Ek.peek=jA;function Ek(e,n,r,s){const o=SA(r),c=r.enter("emphasis"),d=r.createTracker(s),f=d.move(o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=Nu(s.before.charCodeAt(s.before.length-1),h,o);g.inside&&(m=ho(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=Nu(s.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+ho(y));const w=d.move(o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function jA(e,n,r){return r.options.emphasis||"*"}function NA(e,n){let r=!1;return gp(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,mh}),!!((!e.depth||e.depth<3)&&cp(e)&&(n.options.setext||r))}function CA(e,n,r,s){const o=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(s);if(NA(e,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),k=r.containerPhrasing(e,{...c.current(),before:`
|
|
92
|
-
`,after:`
|
|
93
|
-
`});return y(),g(),k+`
|
|
94
|
-
`+(o===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(`
|
|
95
|
-
`))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),m=r.enter("phrasing");c.move(d+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
|
|
96
|
-
`,...c.current()});return/^[\t ]/.test(h)&&(h=ho(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,r.options.closeAtx&&(h+=" "+d),m(),f(),h}Ak.peek=TA;function Ak(e){return e.value||""}function TA(){return"<"}Rk.peek=MA;function Rk(e,n,r,s){const o=yp(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("image");let f=r.enter("label");const m=r.createTracker(s);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${c}`),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 MA(){return"!"}_k.peek=EA;function _k(e,n,r,s){const o=e.referenceType,c=r.enter("imageReference");let d=r.enter("label");const f=r.createTracker(s);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 y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function EA(){return"!"}Ik.peek=AA;function Ik(e,n,r){let s=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(s);)o+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++c<r.unsafe.length;){const d=r.unsafe[c],f=r.compilePattern(d);let m;if(d.atBreak)for(;m=f.exec(s);){let h=m.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(m.index+1)}}return o+s+o}function AA(){return"`"}function Lk(e,n){const r=cp(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))}Dk.peek=RA;function Dk(e,n,r,s){const o=yp(r),c=o==='"'?"Quote":"Apostrophe",d=r.createTracker(s);let f,m;if(Lk(e,r)){const g=r.stack;r.stack=[],f=r.enter("autolink");let y=d.move("<");return y+=d.move(r.containerPhrasing(e,{before:y,after:">",...d.current()})),y+=d.move(">"),f(),r.stack=g,y}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${c}`),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 RA(e,n,r){return Lk(e,r)?"<":"["}Ok.peek=_A;function Ok(e,n,r,s){const o=e.referenceType,c=r.enter("linkReference");let d=r.enter("label");const f=r.createTracker(s);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 y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function _A(){return"["}function bp(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 IA(e){const n=bp(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 LA(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 zk(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 DA(e,n,r,s){const o=r.enter("list"),c=r.bulletCurrent;let d=e.ordered?LA(r):bp(r);const f=e.ordered?d==="."?")":".":IA(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),zk(r)===d&&g){let y=-1;for(;++y<e.children.length;){const k=e.children[y];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,s);return r.bulletLastUsed=d,r.bulletCurrent=c,o(),h}function OA(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 zA(e,n,r,s){const o=OA(r);let c=r.bulletCurrent||bp(r);n&&n.type==="list"&&n.ordered&&(c=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+c);let d=c.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=r.createTracker(s);f.move(c+" ".repeat(d-c.length)),f.shift(d);const m=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,f.current()),g);return m(),h;function g(y,k,w){return k?(w?"":" ".repeat(d))+y:(w?c:c+" ".repeat(d-c.length))+y}}function UA(e,n,r,s){const o=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(e,s);return c(),o(),d}const $A=qu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function BA(e,n,r,s){return(e.children.some(function(d){return $A(d)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function HA(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}Uk.peek=PA;function Uk(e,n,r,s){const o=HA(r),c=r.enter("strong"),d=r.createTracker(s),f=d.move(o+o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=Nu(s.before.charCodeAt(s.before.length-1),h,o);g.inside&&(m=ho(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=Nu(s.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+ho(y));const w=d.move(o+o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function PA(e,n,r){return r.options.strong||"*"}function qA(e,n,r,s){return r.safe(e.value,s)}function FA(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 VA(e,n,r){const s=(zk(r)+(r.options.ruleSpaces?" ":"")).repeat(FA(r));return r.options.ruleSpaces?s.slice(0,-1):s}const $k={blockquote:hA,break:I1,code:vA,definition:wA,emphasis:Ek,hardBreak:I1,heading:CA,html:Ak,image:Rk,imageReference:_k,inlineCode:Ik,link:Dk,linkReference:Ok,list:DA,listItem:zA,paragraph:UA,root:BA,strong:Uk,text:qA,thematicBreak:VA};function GA(){return{enter:{table:WA,tableData:L1,tableHeader:L1,tableRow:YA},exit:{codeText:QA,table:KA,tableData:Rm,tableHeader:Rm,tableRow:Rm}}}function WA(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 KA(e){this.exit(e),this.data.inTable=void 0}function YA(e){this.enter({type:"tableRow",children:[]},e)}function Rm(e){this.exit(e)}function L1(e){this.enter({type:"tableCell",children:[]},e)}function QA(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,XA));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function XA(e,n){return n==="|"?n:e}function ZA(e){const n=e||{},r=n.tableCellPadding,s=n.tablePipeAlign,o=n.stringLength,c=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
97
|
-
`,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,N,C,M){return h(g(w,C,M),w.align)}function f(w,N,C,M){const A=y(w,C,M),R=h([A]);return R.slice(0,R.indexOf(`
|
|
98
|
-
`))}function m(w,N,C,M){const A=C.enter("tableCell"),R=C.enter("phrasing"),I=C.containerPhrasing(w,{...M,before:c,after:c});return R(),A(),I}function h(w,N){return fA(w,{align:N,alignDelimiters:s,padding:r,stringLength:o})}function g(w,N,C){const M=w.children;let A=-1;const R=[],I=N.enter("table");for(;++A<M.length;)R[A]=y(M[A],N,C);return I(),R}function y(w,N,C){const M=w.children;let A=-1;const R=[],I=N.enter("tableRow");for(;++A<M.length;)R[A]=m(M[A],w,N,C);return I(),R}function k(w,N,C){let M=$k.inlineCode(w,N,C);return C.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function JA(){return{exit:{taskListCheckValueChecked:D1,taskListCheckValueUnchecked:D1,paragraph:t6}}}function e6(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:n6}}}function D1(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function t6(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 s=r.children[0];if(s&&s.type==="text"){const o=n.children;let c=-1,d;for(;++c<o.length;){const f=o[c];if(f.type==="paragraph"){d=f;break}}d===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function n6(e,n,r,s){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);c&&f.move(d);let m=$k.listItem(e,n,r,{...s,...f.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(g){return g+d}}function a6(){return[DE(),nA(),lA(),GA(),JA()]}function r6(e){return{extensions:[OE(),aA(e),iA(),ZA(e),e6()]}}const s6={tokenize:d6,partial:!0},Bk={tokenize:f6,partial:!0},Hk={tokenize:m6,partial:!0},Pk={tokenize:h6,partial:!0},l6={tokenize:p6,partial:!0},qk={name:"wwwAutolink",tokenize:c6,previous:Vk},Fk={name:"protocolAutolink",tokenize:u6,previous:Gk},Ir={name:"emailAutolink",tokenize:o6,previous:Wk},cr={};function i6(){return{text:cr}}let Ls=48;for(;Ls<123;)cr[Ls]=Ir,Ls++,Ls===58?Ls=65:Ls===91&&(Ls=97);cr[43]=Ir;cr[45]=Ir;cr[46]=Ir;cr[95]=Ir;cr[72]=[Ir,Fk];cr[104]=[Ir,Fk];cr[87]=[Ir,qk];cr[119]=[Ir,qk];function o6(e,n,r){const s=this;let o,c;return d;function d(y){return!xh(y)||!Wk.call(s,s.previous)||vp(s.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return xh(y)?(e.consume(y),f):y===64?(e.consume(y),m):r(y)}function m(y){return y===46?e.check(l6,g,h)(y):y===45||y===95||En(y)?(c=!0,e.consume(y),m):g(y)}function h(y){return e.consume(y),o=!0,m}function g(y){return c&&o&&zn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(y)):r(y)}}function c6(e,n,r){const s=this;return o;function o(d){return d!==87&&d!==119||!Vk.call(s,s.previous)||vp(s.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(s6,e.attempt(Bk,e.attempt(Hk,c),r),r)(d))}function c(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(d)}}function u6(e,n,r){const s=this;let o="",c=!1;return d;function d(y){return(y===72||y===104)&&Gk.call(s,s.previous)&&!vp(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),f):r(y)}function f(y){if(zn(y)&&o.length<5)return o+=String.fromCodePoint(y),e.consume(y),f;if(y===58){const k=o.toLowerCase();if(k==="http"||k==="https")return e.consume(y),m}return r(y)}function m(y){return y===47?(e.consume(y),c?h:(c=!0,m)):r(y)}function h(y){return y===null||wu(y)||Rt(y)||Vs(y)||Bu(y)?r(y):e.attempt(Bk,e.attempt(Hk,g),r)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(y)}}function d6(e,n,r){let s=0;return o;function o(d){return(d===87||d===119)&&s<3?(s++,e.consume(d),o):d===46&&s===3?(e.consume(d),c):r(d)}function c(d){return d===null?r(d):n(d)}}function f6(e,n,r){let s,o,c;return d;function d(h){return h===46||h===95?e.check(Pk,m,f)(h):h===null||Rt(h)||Vs(h)||h!==45&&Bu(h)?m(h):(c=!0,e.consume(h),d)}function f(h){return h===95?s=!0:(o=s,s=void 0),e.consume(h),d}function m(h){return o||s||!c?r(h):n(h)}}function m6(e,n){let r=0,s=0;return o;function o(d){return d===40?(r++,e.consume(d),o):d===41&&s<r?c(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(Pk,n,c)(d):d===null||Rt(d)||Vs(d)?n(d):(e.consume(d),o)}function c(d){return d===41&&s++,e.consume(d),o}}function h6(e,n,r){return s;function s(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),s):f===38?(e.consume(f),c):f===93?(e.consume(f),o):f===60||f===null||Rt(f)||Vs(f)?n(f):r(f)}function o(f){return f===null||f===40||f===91||Rt(f)||Vs(f)?n(f):s(f)}function c(f){return zn(f)?d(f):r(f)}function d(f){return f===59?(e.consume(f),s):zn(f)?(e.consume(f),d):r(f)}}function p6(e,n,r){return s;function s(c){return e.consume(c),o}function o(c){return En(c)?r(c):n(c)}}function Vk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Rt(e)}function Gk(e){return!zn(e)}function Wk(e){return!(e===47||xh(e))}function xh(e){return e===43||e===45||e===46||e===95||En(e)}function vp(e){let n=e.length,r=!1;for(;n--;){const s=e[n][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const g6={tokenize:j6,partial:!0};function x6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:k6,continuation:{tokenize:w6},exit:S6}},text:{91:{name:"gfmFootnoteCall",tokenize:v6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:y6,resolveTo:b6}}}}function y6(e,n,r){const s=this;let o=s.events.length;const c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let d;for(;o--;){const m=s.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=Wa(s.sliceSerialize({start:d.end,end:s.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function b6(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 s={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 c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[r+1],e[r+2],["enter",s,n],e[r+3],e[r+4],["enter",o,n],["exit",o,n],["enter",c,n],["enter",d,n],["exit",d,n],["exit",c,n],e[e.length-2],e[e.length-1],["exit",s,n]];return e.splice(r,e.length-r+1,...f),e}function v6(e,n,r){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,d;return f;function f(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),m}function m(y){return y!==94?r(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(y){if(c>999||y===93&&!d||y===null||y===91||Rt(y))return r(y);if(y===93){e.exit("chunkString");const k=e.exit("gfmFootnoteCallString");return o.includes(Wa(s.sliceSerialize(k)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(y)}return Rt(y)||(d=!0),c++,e.consume(y),y===92?g:h}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,h):h(y)}}function k6(e,n,r){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,d=0,f;return m;function m(N){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(N){return N===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(N)}function g(N){if(d>999||N===93&&!f||N===null||N===91||Rt(N))return r(N);if(N===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=Wa(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),k}return Rt(N)||(f=!0),d++,e.consume(N),N===92?y:g}function y(N){return N===91||N===92||N===93?(e.consume(N),d++,g):g(N)}function k(N){return N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),o.includes(c)||o.push(c),it(e,w,"gfmFootnoteDefinitionWhitespace")):r(N)}function w(N){return n(N)}}function w6(e,n,r){return e.check(jo,n,e.attempt(g6,n,r))}function S6(e){e.exit("gfmFootnoteDefinition")}function j6(e,n,r){const s=this;return it(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const d=s.events[s.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?n(c):r(c)}}function N6(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:c,resolveAll:o};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},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)},y={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",y,f]],w=f.parser.constructs.insideSpan.null;w&&da(k,k.length,0,Hu(w,d.slice(h+1,m),f)),da(k,k.length,0,[["exit",y,f],["enter",d[m][1],f],["exit",d[m][1],f],["exit",g,f]]),da(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 c(d,f,m){const h=this.previous,g=this.events;let y=0;return k;function k(N){return h===126&&g[g.length-1][1].type!=="characterEscape"?m(N):(d.enter("strikethroughSequenceTemporary"),w(N))}function w(N){const C=Fl(h);if(N===126)return y>1?m(N):(d.consume(N),y++,w);if(y<2&&!r)return m(N);const M=d.exit("strikethroughSequenceTemporary"),A=Fl(N);return M._open=!A||A===2&&!!C,M._close=!C||C===2&&!!A,f(N)}}}class C6{constructor(){this.map=[]}add(n,r,s){T6(this,n,r,s)}consume(n){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];s.push(n.slice()),n.length=0;let o=s.pop();for(;o;){for(const c of o)n.push(c);o=s.pop()}this.map.length=0}}function T6(e,n,r,s){let o=0;if(!(r===0&&s.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=r,e.map[o][2].push(...s);return}o+=1}e.map.push([n,r,s])}}function M6(e,n){let r=!1;const s=[];for(;n<e.length;){const o=e[n];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&s.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const c=s.length-1;s[c]=s[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return s}function E6(){return{flow:{null:{name:"table",tokenize:A6,resolveAll:R6}}}}function A6(e,n,r){const s=this;let o=0,c=0,d;return f;function f(B){let V=s.events.length-1;for(;V>-1;){const te=s.events[V][1].type;if(te==="lineEnding"||te==="linePrefix")V--;else break}const q=V>-1?s.events[V][1].type:null,X=q==="tableHead"||q==="tableRow"?L:m;return X===L&&s.parser.lazy[s.now().line]?r(B):X(B)}function m(B){return e.enter("tableHead"),e.enter("tableRow"),h(B)}function h(B){return B===124||(d=!0,c+=1),g(B)}function g(B){return B===null?r(B):De(B)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),w):r(B):Je(B)?it(e,g,"whitespace")(B):(c+=1,d&&(d=!1,o+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),d=!0,g):(e.enter("data"),y(B)))}function y(B){return B===null||B===124||Rt(B)?(e.exit("data"),g(B)):(e.consume(B),B===92?k:y)}function k(B){return B===92||B===124?(e.consume(B),y):y(B)}function w(B){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(B):(e.enter("tableDelimiterRow"),d=!1,Je(B)?it(e,N,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):N(B))}function N(B){return B===45||B===58?M(B):B===124?(d=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),C):D(B)}function C(B){return Je(B)?it(e,M,"whitespace")(B):M(B)}function M(B){return B===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),A):B===45?(c+=1,A(B)):B===null||De(B)?P(B):D(B)}function A(B){return B===45?(e.enter("tableDelimiterFiller"),R(B)):D(B)}function R(B){return B===45?(e.consume(B),R):B===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(B))}function I(B){return Je(B)?it(e,P,"whitespace")(B):P(B)}function P(B){return B===124?N(B):B===null||De(B)?!d||o!==c?D(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(B)):D(B)}function D(B){return r(B)}function L(B){return e.enter("tableRow"),$(B)}function $(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),$):B===null||De(B)?(e.exit("tableRow"),n(B)):Je(B)?it(e,$,"whitespace")(B):(e.enter("data"),Q(B))}function Q(B){return B===null||B===124||Rt(B)?(e.exit("data"),$(B)):(e.consume(B),B===92?W:Q)}function W(B){return B===92||B===124?(e.consume(B),Q):Q(B)}}function R6(e,n){let r=-1,s=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,g,y;const k=new C6;for(;++r<e.length;){const w=e[r],N=w[1];w[0]==="enter"?N.type==="tableHead"?(f=!1,m!==0&&(O1(k,n,m,h,g),g=void 0,m=0),h={type:"table",start:Object.assign({},N.start),end:Object.assign({},N.end)},k.add(r,0,[["enter",h,n]])):N.type==="tableRow"||N.type==="tableDelimiterRow"?(s=!0,y=void 0,c=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},N.start),end:Object.assign({},N.end)},k.add(r,0,[["enter",g,n]])),o=N.type==="tableDelimiterRow"?2:g?3:1):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")?(s=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],y=qc(k,n,c,o,void 0,y),c=[0,0,0,0]),d[2]=r)):N.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(d[0]=d[1],y=qc(k,n,c,o,void 0,y)),c=d,d=[c[1],r,0,0])):N.type==="tableHead"?(f=!0,m=r):N.type==="tableRow"||N.type==="tableDelimiterRow"?(m=r,c[1]!==0?(d[0]=d[1],y=qc(k,n,c,o,r,y)):d[1]!==0&&(y=qc(k,n,d,o,r,y)),o=0):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&O1(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=M6(n.events,r))}return e}function qc(e,n,r,s,o,c){const d=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(c.end=Object.assign({},zl(n.events,r[0])),e.add(r[0],0,[["exit",c,n]]));const m=zl(n.events,r[1]);if(c={type:d,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",c,n]]),r[2]!==0){const h=zl(n.events,r[2]),g=zl(n.events,r[3]),y={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",y,n]]),s!==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 N=r[2]+1,C=r[3]-r[2]-1;e.add(N,C,[])}}e.add(r[3]+1,0,[["exit",y,n]])}return o!==void 0&&(c.end=Object.assign({},zl(n.events,o)),e.add(o,0,[["exit",c,n]]),c=void 0),c}function O1(e,n,r,s,o){const c=[],d=zl(n.events,r);o&&(o.end=Object.assign({},d),c.push(["exit",o,n])),s.end=Object.assign({},d),c.push(["exit",s,n]),e.add(r+1,0,c)}function zl(e,n){const r=e[n],s=r[0]==="enter"?"start":"end";return r[1][s]}const _6={name:"tasklistCheck",tokenize:L6};function I6(){return{text:{91:_6}}}function L6(e,n,r){const s=this;return o;function o(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return Rt(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 De(m)?n(m):Je(m)?e.check({tokenize:D6},n,r)(m):r(m)}}function D6(e,n,r){return it(e,s,"whitespace");function s(o){return o===null?r(o):n(o)}}function O6(e){return rk([i6(),x6(),N6(e),E6(),I6()])}const z6={};function Gu(e){const n=this,r=e||z6,s=n.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),d=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(O6(r)),c.push(a6()),d.push(r6(r))}const U6="modulepreload",$6=function(e){return"/"+e},z1={},B6=function(n,r,s){let o=Promise.resolve();if(r&&r.length>0){let m=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=d?.nonce||d?.getAttribute("nonce");o=m(r.map(h=>{if(h=$6(h),h in z1)return;z1[h]=!0;const g=h.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const k=document.createElement("link");if(k.rel=g?"stylesheet":U6,g||(k.as="script"),k.crossOrigin="",k.href=h,f&&k.setAttribute("nonce",f),document.head.appendChild(k),g)return new Promise((w,N)=>{k.addEventListener("load",w),k.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(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"&&c(f.reason);return n().catch(c)})},H6=1500;function P6({code:e}){const[n,r]=v.useState(!1),s=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),H6)};return l.jsx("button",{type:"button",title:n?x.common.copied:x.chat.copyCode,"aria-label":x.chat.copyCode,onClick:s,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:l.jsx(Pe,{d:n?cn.check:cn.copy})})}function Kk({language:e,code:n,highlight:r=!0}){const[s,o]=v.useState(null);return v.useEffect(()=>{if(!r){o(null);return}let c=!0;return B6(()=>import("./index-7gbWDtby.js"),[]).then(d=>d.codeToHtml(n,{lang:e||"text",themes:{light:"github-light",dark:"github-dark"}})).then(d=>{c&&o(d)}).catch(()=>{c&&o(null)}),()=>{c=!1}},[n,e,r]),l.jsxs("div",{className:"code-block my-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800",children:[l.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:[l.jsx("span",{className:"font-mono text-xs lowercase text-gray-500 dark:text-gray-400",children:e||"text"}),l.jsx(P6,{code:n})]}),l.jsx("div",{className:"overflow-x-auto bg-white text-[13px] leading-relaxed dark:bg-gray-950",children:s?l.jsx("div",{dangerouslySetInnerHTML:{__html:s}}):l.jsx("pre",{className:"m-0 px-3 py-2.5 font-mono text-gray-800 dark:text-gray-200",children:l.jsx("code",{children:n})})})]})}function q6(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(n=>typeof n=="string").join(""):""}function Yk({children:e,streaming:n}){if(v.isValidElement(e)){const r=e.props,s=/language-([\w+-]+)/.exec(r.className??"")?.[1]??"";return l.jsx(Kk,{language:s,code:q6(r.children).replace(/\n$/,""),highlight:!n})}return l.jsx("pre",{children:e})}function Qk({node:e,children:n,...r}){return l.jsx("a",{...r,target:"_blank",rel:"noreferrer",children:n})}const F6={pre:e=>l.jsx(Yk,{streaming:!0,children:e.children}),a:Qk},V6={pre:e=>l.jsx(Yk,{streaming:!1,children:e.children}),a:Qk},Xk=v.memo(function({text:n,streaming:r=!1}){return l.jsx(Vu,{remarkPlugins:[Gu],components:r?F6:V6,children:n})});function qs({src:e,alt:n,className:r}){const[s,o]=v.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"block cursor-zoom-in",onClick:()=>o(!0),children:l.jsx("img",{src:e,alt:n,className:r})}),s&&l.jsx(G6,{src:e,alt:n,onClose:()=>o(!1)})]})}function G6({src:e,alt:n,onClose:r}){return v.useEffect(()=>{const s=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r]),Wl.createPortal(l.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-10",onMouseDown:s=>{s.target===s.currentTarget&&r()},children:l.jsxs("div",{className:"anim-pop relative",children:[l.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:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}),l.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 W6=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"]),K6=/^[a-z][a-z0-9+.-]*:\/\//i;function Y6(e){const n=e.trim();if(n.length===0||n.length>200||/\s/.test(n)||K6.test(n)||n.startsWith("www."))return!1;const r=/\.([A-Za-z0-9]{1,8})$/.exec(n);if(!r)return!1;const s=r[1].toLowerCase();return/^\d+$/.test(s)?!1:W6.has(s)}const Q6=512;function X6(e,n){const r=e.trim();if(r.length===0||r.length>Q6||r.startsWith("~"))return null;const s=n!==null&&n.length>0?n:null,o=s?.includes("\\")??!1,c=o?"\\":"/",d=r.startsWith("/")||o&&(/^[A-Za-z]:/.test(r)||r.startsWith("\\"));let f=r;if(d){if(s===null||!r.startsWith(`${s}${c}`))return null;f=r.slice(s.length+c.length),c==="\\"&&(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 U1=3;function Z6(e){const n=[],r=new Set;for(const s of e.matchAll(/`([^`\n]+)`/g)){const o=s[1].trim();!Y6(o)||r.has(o)||(r.add(o),n.push(o))}return n}function J6({path:e}){const n=e.lastIndexOf("/"),r=n>=0?e.slice(0,n+1):"",s=n>=0?e.slice(n+1):e;return l.jsxs("span",{className:"flex min-w-0 items-baseline font-mono text-sm",children:[r&&l.jsx("span",{className:"min-w-0 shrink-[9999] truncate text-gray-400 dark:text-gray-500",children:r}),l.jsx("span",{className:"min-w-0 truncate font-semibold text-gray-800 dark:text-gray-100",children:s})]})}function e8({text:e,workspace:n,statFiles:r,onOpenFile:s}){const o=v.useMemo(()=>{const y=[],k=new Set;for(const w of Z6(e)){const N=X6(w,n);N===null||k.has(N)||(k.add(N),y.push(N))}return y},[e,n]),[c,d]=v.useState(null);v.useEffect(()=>{if(d(null),o.length===0)return;let y=!1;return r(o).then(k=>{y||d(o.filter(w=>k.has(w)))}).catch(()=>{}),()=>{y=!0}},[o,r]);const[f,m]=v.useState(!1);if(c===null||c.length===0)return null;const h=f?c:c.slice(0,U1),g=c.length-h.length;return l.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:[l.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:[l.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:l.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:x.chat.filesInMessage(c.length)})]}),l.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[h.map(y=>l.jsxs("button",{type:"button",title:y,onClick:()=>s(y),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:[l.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:l.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),l.jsx(J6,{path:y}),l.jsx("span",{className:"min-w-0 flex-1"}),l.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})]},y)),(g>0||f)&&c.length>U1&&l.jsxs("button",{type:"button",onClick:()=>m(y=>!y),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),l.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:l.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})]})}const t8={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"},$1={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 Co({state:e,size:n=13,label:r}){return e==="running"?l.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 ${$1.running}`}):l.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 ${$1[e]}`,children:[r&&l.jsx("title",{children:r}),l.jsx("path",{d:t8[e]})]})}function po({sinceMs:e,offsetMs:n=0}){const[r,s]=v.useState(()=>Date.now());return v.useEffect(()=>{const o=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(o)},[]),e===void 0?l.jsx("span",{className:"animate-pulse",children:"…"}):l.jsx(l.Fragment,{children:Cv(Math.max(0,n)+Math.max(0,r-e))})}function n8({item:e}){const[n,r]=v.useState(!1),s=e.stopReason!==void 0&&e.stopReason!=="completed",o=e.streaming?"running":s?"failed":"done",c=e.streaming?x.chat.workRunning:s?e.stopReason:x.chat.workDone;return l.jsxs("div",{children:[l.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:[l.jsx(Co,{state:o,label:c}),l.jsx("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:x.chat.thinking}),l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.streaming?l.jsx(po,{sinceMs:e.startedAtMs}):e.durationMs!==void 0?mn(e.durationMs):null}),s&&l.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Un,{open:n,className:"text-gray-400"})]}),n&&l.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:l.jsx(Xk,{text:e.thinking,streaming:e.streaming})})]})}function a8({onDecide:e}){const[n,r]=v.useState(!1),s=async o=>{r(!0);try{await e(o)}finally{r(!1)}};return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ke,{size:"sm",variant:"primary",disabled:n,onClick:()=>{s("allow")},children:x.chat.approve}),l.jsx(ke,{size:"sm",disabled:n,onClick:()=>{s("deny")},children:x.chat.deny})]})}function Zk(e){for(let n=e.length-1;n>=0;n--){const r=e[n].kind;if(r==="user_text"||r==="user_image")return n}return 0}function r8(e){let n=0;for(const r of e)(r.kind==="user_text"||r.kind==="user_image")&&(n+=1);return n}function Jk(e){try{const n=JSON.parse(e);if(n!==null&&typeof n=="object"){const r=n.agent_id;if(typeof r=="string"&&r.length>0)return r}}catch{}return null}function s8(e,n,r){return e2(e.items.slice(Zk(e.items)),n,{running:r})}function l8(e,n,r,s){const o=e.items,c=o.findIndex(m=>m.kind==="tool_call"&&m.subagentSessionId===s||m.kind==="subagent"&&m.sessionId===s);if(c===-1)return null;let d=0;for(let m=c;m>=0;m--){const h=o[m].kind;if(h==="user_text"||h==="user_image"){d=m;break}}let f=o.length;for(let m=c+1;m<o.length;m++){const h=o[m].kind;if(h==="user_text"||h==="user_image"){f=m;break}}return e2(o.slice(d,f),n,{running:f===o.length&&r})}function e2(e,n,r){const s=[{sessionId:n,agentId:null,running:r.running,depth:0,origin:[],parentId:null}],o=new Set([n]),c=(f,m,h,g,y,k)=>{if(o.has(f))return;o.add(f);const w=[...y,f],N=m.firstTsMs??m.firstSeenLocalMs,C=m.firstTsMs!==void 0&&m.lastActivityTsMs!==void 0?Math.max(0,m.lastActivityTsMs-m.firstTsMs):m.firstSeenLocalMs!==void 0&&m.lastActivityLocalMs!==void 0?Math.max(0,m.lastActivityLocalMs-m.firstSeenLocalMs):void 0;s.push({sessionId:f,agentId:m.meta?.agentId??k,running:h,depth:w.length,origin:w,parentId:g,...N!==void 0?{startedMs:N}:{},...C!==void 0?{elapsedMs:C}:{}}),d(m.items,f,w)},d=(f,m,h)=>{for(const g of f)g.kind==="tool_call"&&g.subagent&&g.subagentSessionId?c(g.subagentSessionId,g.subagent,!g.outputComplete,m,h,Jk(g.argumentsText)):g.kind==="subagent"&&c(g.sessionId,g.model,!1,m,h,null)};return d(e,n,[]),s}function i8(e){const n=e.items;for(let r=Zk(n);r<n.length;r++){const s=n[r];if(s.kind==="tool_call"&&s.subagent!==void 0||s.kind==="subagent")return!0}return!1}function o8(e,n){if(n.length===0)return null;let r=e;for(const s of n){const o=r.subagents.get(s);if(!o)return null;r=o}return r}const mu=168,Ji=34,_m=32,B1=10,Fc=6;function c8(e){const n=new Map;for(const g of e){if(g.parentId===null)continue;const y=n.get(g.parentId);y?y.push(g):n.set(g.parentId,[g])}const r=new Map;let s=0;const o=g=>{const y=n.get(g.sessionId)??[];let k;if(y.length===0)k=s++;else{const w=y.map(o);k=(w[0]+w[w.length-1])/2}return r.set(g.sessionId,k),k};for(const g of e)g.parentId===null&&o(g);const c=e.map(g=>({node:g,x:Fc+g.depth*(mu+_m),y:Fc+(r.get(g.sessionId)??0)*(Ji+B1)})),d=new Map(c.map(g=>[g.node.sessionId,g])),f=[];for(const g of c){if(g.node.parentId===null)continue;const y=d.get(g.node.parentId);if(!y)continue;const k=y.x+mu,w=y.y+Ji/2,N=g.x,C=g.y+Ji/2,M=k+_m/2;f.push({fromId:y.node.sessionId,toId:g.node.sessionId,path:w===C?`M ${k} ${w} H ${N}`:`M ${k} ${w} H ${M} V ${C} H ${N}`})}const m=e.reduce((g,y)=>Math.max(g,y.depth),0),h=Math.max(1,s);return{width:Fc*2+(m+1)*mu+m*_m,height:Fc*2+h*Ji+(h-1)*B1,nodes:c,edges:f}}function yh(e,n,r){const s=r.find(c=>c.sessionId===e.sessionId),o=e.agentId??s?.agentId??null;if(o!==null){const c=n.find(d=>d.agentId===o);return c?c.name?.length?c.name:c.agentId:o}return s?.title??null}function bh(e){return e.length>8?e.slice(-8):e}function t2({sessionId:e,model:n,running:r,ctx:s,agentId:o=null}){const{agents:c}=hn(),{sessions:d}=Ks(),f=yh({sessionId:e,agentId:n.meta?.agentId??o},c,d)??x.chat.subagent,m=QN(s.pendingApprovals.keys(),[...s.origin,e]),h=`${x.chat.subagent} ${f}${m?` · ${x.chat.approvalWaiting}`:""}`;return l.jsxs("button",{type:"button","aria-label":h,title:h,onClick:()=>s.onOpenSubagent?.(e,s.origin),className:"flex w-full items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[l.jsx(Ya,{id:n.meta?.agentId??o??e,name:f,size:16}),l.jsx("span",{className:"min-w-0 truncate text-xs font-medium text-gray-700 dark:text-gray-300",children:f}),e&&l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:bh(e)}),r&&l.jsx("span",{"aria-hidden":!0,className:"inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-gray-400 border-t-transparent"}),m&&l.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}),l.jsx("span",{className:"min-w-0 flex-1"})]})}const u8=new Set(["exec_command","input_command","run_subagent","input_subagent"]),kp=new Set(["read_file","edit_file","write_file"]);function n2(e){const n=e.split("/").filter(r=>r.length>0);return n.length<=2?e:`…/${n[n.length-2]}/${n[n.length-1]}`}function d8(e,n){if(e==="exec_command"){const r=Cu(n,"cmd");if(r!==null)return`$ ${r.replace(/\s+/g," ").trim()}`}if(kp.has(e)){const r=Cu(n,"file_path");if(r!==null)return n2(r.replace(/\s+/g," ").trim())}return n.replace(/\s+/g," ").trim()}function f8(e,n){if(u8.has(e)){const r=Cu(n,"description");if(r!==null){const s=r.replace(/\s+/g," ").trim();if(s)return s}return null}if(kp.has(e)){const r=Cu(n,"file_path");if(r!==null){const s=r.replace(/\s+/g," ").trim();if(s)return n2(s)}}return null}function m8(e,n){if(!kp.has(e))return null;let r;try{r=JSON.parse(n)}catch{return null}if(r===null||typeof r!="object")return null;const s=r,o=[],c=(d,f)=>{f!==void 0&&(typeof f=="string"&&f.includes(`
|
|
99
|
-
`)?o.push(`${d}:
|
|
100
|
-
${f}`):o.push(`${d}: ${typeof f=="string"?f:JSON.stringify(f)}`))};return c("file_path",s.file_path),e==="read_file"?(c("offset",s.offset),c("limit",s.limit)):e==="edit_file"?(c("old_string",s.old_string),c("new_string",s.new_string),s.replace_all===!0&&c("replace_all",!0)):e==="write_file"&&c("content",s.content),o.join(`
|
|
101
|
-
`)}function Cu(e,n){const r=`"${n}"`,s=e.indexOf(r);if(s===-1)return null;let o=s+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 c="",d=!1;for(;o<e.length;o+=1){const f=e[o];if(d){c+=f==="n"?`
|
|
102
|
-
`:f==="t"?" ":f,d=!1;continue}if(f==="\\"){d=!0;continue}if(f==='"')return c;c+=f}return c}function h8({item:e,ctx:n}){const[r,s]=v.useState(!1),o=v.useRef(!1),c=n.pendingApprovals.get(ql(n.origin,e.toolCallId)),d=d8(e.name,e.argumentsText),f=f8(e.name,e.argumentsText),m=e.callComplete&&!e.outputComplete&&!c,h=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0,g=e.callStopReason!==void 0&&e.callStopReason!=="completed"||e.outputStopReason!==void 0&&e.outputStopReason!=="completed",y=c?"waiting":m||e.callStreaming?"running":g?"failed":"done",k=e.decision?`${e.decision==="allow"?x.chat.decisionAllow:x.chat.decisionDeny} · ${e.decisionSource==="manual"?x.chat.decisionManual:x.chat.decisionAuto}`:null,w=e.decision==="deny"&&e.outputStopReason==="aborted",N=c?x.chat.approvalWaiting:y==="running"?x.chat.workRunning:y==="done"?k??x.chat.workDone:w?k??void 0:e.outputStopReason??e.callStopReason;return l.jsxs("div",{children:[l.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{o.current=!0,s(C=>!C)},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:[l.jsx(Co,{state:y,label:N}),l.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}),f&&l.jsx("span",{className:"min-w-0 shrink truncate text-xs text-gray-500 dark:text-gray-400",children:f}),l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.durationMs!==void 0?mn(e.durationMs):m?l.jsx(po,{sinceMs:e.approvalAtMs??e.callStartedAtMs,offsetMs:h}):c?h>0?mn(h):null:e.callStreaming?e.argStartedAtMs!==void 0?l.jsx(po,{sinceMs:e.argStartedAtMs}):l.jsx("span",{className:"animate-pulse",children:"…"}):null}),c&&l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-amber-600 sm:inline dark:text-amber-400",children:x.chat.approvalWaiting}),e.callStopReason&&e.callStopReason!=="completed"&&l.jsx(qt,{tone:nh(e.callStopReason),children:e.callStopReason}),e.outputStopReason&&e.outputStopReason!=="completed"&&!w&&l.jsx(qt,{tone:nh(e.outputStopReason),children:e.outputStopReason}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Un,{open:r,className:"text-gray-400"})]}),c&&l.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:[l.jsxs("div",{className:"mb-2 flex items-start gap-2 sm:items-center",children:[l.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}),l.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-xs text-gray-600 sm:truncate dark:text-gray-400",children:d})]}),(()=>{const C=m8(e.name,e.argumentsText);return C!==null?l.jsx("pre",{className:"mb-2 max-h-72 overflow-auto whitespace-pre-wrap break-all rounded-md bg-white/70 px-2 py-1.5 text-xs leading-5 text-gray-700 dark:bg-gray-950/40 dark:text-gray-300",children:C}):null})(),l.jsx(a8,{onDecide:C=>n.onApprove(e.toolCallId,C,n.origin)})]}),r&&l.jsxs("div",{className:"anim-fade",children:[e.argumentsText&&l.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)&&l.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&&l.jsx("span",{className:"animate-pulse",children:"▌"})]}),e.images&&e.images.length>0&&l.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((C,M)=>l.jsx(qs,{src:C,alt:x.chat.toolImageAlt,className:"max-h-40 max-w-full rounded-md border border-gray-200 dark:border-gray-700"},M))})]}),e.subagent&&l.jsx("div",{className:"px-3 pb-2 pt-2",children:l.jsx(t2,{sessionId:e.subagentSessionId??"",model:e.subagent,running:!e.outputComplete,agentId:Jk(e.argumentsText),ctx:n})})]})}function p8({item:e}){if(e.running)return l.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:[l.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 l.jsx("p",{className:"my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:n})}const wp=-1,go="M21 12A9 9 0 1 1 12 3M17 12A5 5 0 1 1 12 7M12 12L15 9V5L18 2V6H22L19 9H15";function Vc(e){const n=e.trim();if(n==="")return wp;const r=/^(\d+(?:\.\d+)?)([km])?$/i.exec(n);if(!r)return null;const s=r[2]?.toLowerCase()==="m"?1e6:r[2]?.toLowerCase()==="k"?1e3:1,o=Math.round(Number(r[1])*s);return o>0?o:null}function g8({round:e,objective:n}){return n!==void 0&&n!==""?l.jsxs("div",{className:"anim-msg my-4 flex flex-col items-end",children:[l.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:l.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:n})}),l.jsxs("p",{className:"mt-1 flex items-center gap-1.5 px-0.5 text-xs text-gray-400 dark:text-gray-500",children:[l.jsx(Pe,{d:go,size:12,className:"shrink-0"}),x.chat.goalRoundBanner(e)]})]}):l.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:[l.jsx(Pe,{d:go,className:"text-gray-400 dark:text-gray-500"}),x.chat.goalRoundBanner(e)]})}function x8({goal:e}){const n=e.budget>0&&e.budget!==wp?`${ot(e.used)}/${ot(e.budget)}`:ot(e.used),r=e.status!=="active";return l.jsxs("div",{className:"anim-fade mb-2 flex 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:[l.jsx(Pe,{d:go,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",title:e.objective,children:e.objective}),l.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:x.chat.goalProgress(e.rounds,n)}),l.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 ${r?e.status==="complete"?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400":"bg-gray-200 text-gray-600 dark:bg-gray-800 dark:text-gray-300"}`,children:x.chat.goalStatus[e.status]})]})}function y8(e){return e.agentName&&e.agentName!==e.agentId?`${e.agentName} (@${e.agentId})`:`@${e.agentId}`}const vh="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";function b8({origin:e}){const n=pa(),r=x.chat.handoffFrom(y8(e));if(!e.sessionId)return l.jsx("p",{className:vh,children:r});const s=e.sessionId;return l.jsxs("button",{type:"button",title:x.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${s}`),className:`${vh} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[r,l.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function v8({origin:e}){const n=pa(),r=e.sessionId;return l.jsxs("button",{type:"button",title:x.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${r}`),className:`${vh} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[x.chat.modelSwitchFrom(e.prevModelId),l.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function k8({origin:e}){return l.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&&l.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:fa(e.firedAt)})]})}const Sp="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 w8(e,n,r){return e==="zh"&&r?r:n}function To(e,n){return e==="zh"?n.shortDescriptionZh||n.shortDescription||n.description:n.shortDescription||n.description}function S8(e,n,r){const s=r.trim().toLowerCase();return s?e.filter(o=>o.name.toLowerCase().includes(s)||To(n,o).toLowerCase().includes(s)):e}function j8(e,n){return e.map(r=>({name:r.name,cmd:`/${r.name}`,desc:To(n,r)}))}function H1({names:e}){return l.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:[l.jsx(Pe,{d:Sp,className:"text-gray-400 dark:text-gray-500"}),x.chat.skillsBanner(e)]})}const a2=CN,N8=RN,C8=/^[\w-]*$/;function P1(e,n){const r=e.slice(0,n),s=r.lastIndexOf("@");if(s<0||s>0&&!/\s/.test(r[s-1]))return null;const o=r.slice(s+1);if(!C8.test(o))return null;const c=/^[\w-]*/.exec(e.slice(n))[0];return{start:s,end:n+c.length,query:o}}function T8(e,n){const r=n.toLowerCase();return e.filter(s=>s.agentId.toLowerCase().startsWith(r)||(s.name??"").toLowerCase().startsWith(r))}function M8(e,n){const r=/^@([\w-]+)([\s\S]*)$/.exec(e);if(!r)return null;const s=n.find(o=>o.agentId===r[1]);return s?{agent:s,rest:r[2].trimStart()}:null}function Gi({icon:e,value:n,compactValue:r,label:s,display:o="flex"}){return l.jsxs("span",{title:s,"aria-label":s,className:`${o} items-center gap-1`,children:[l.jsx(Pe,{d:e}),r!==void 0&&r!==n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:r}),l.jsx("span",{className:"hidden sm:inline",children:n})]}):n]})}function E8({stats:e,assistantText:n,cost:r,atMs:s}){const[o,c]=v.useState(!1),{currency:d}=Gs(),{locale:f}=Qa(),m=e?.tokensByBucket,h=m?m.cacheRead+m.cacheWrite:0,g=()=>{const y=n?.trim()||e===null?n??"":WN(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(y).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})};return l.jsxs("div",{className:"-mt-2 flex h-5 items-center justify-start gap-x-2 overflow-hidden whitespace-nowrap text-[11px] text-gray-400 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 sm:gap-x-3 sm:opacity-0 dark:text-gray-500",children:[l.jsxs("span",{className:"no-scrollbar flex min-w-0 items-center gap-x-2 overflow-x-auto sm:gap-x-3",children:[s!==void 0&&l.jsx("span",{children:Ev(s,f)}),e&&m&&l.jsxs(l.Fragment,{children:[l.jsx(Gi,{icon:cn.input,value:ot(h),label:x.chat.statInput}),l.jsx(Gi,{icon:cn.output,value:ot(m.output),label:x.chat.statOutput}),l.jsx(Gi,{icon:cn.tps,value:xu(e.outputTps),label:x.chat.statTps,display:"hidden sm:flex"}),r!=null&&l.jsx(Gi,{icon:cn.cost,value:Ra(r,d),compactValue:Ra(r,d,{compact:!0}),label:`${x.common.cost}(${d})`}),l.jsx(Gi,{icon:cn.elapsed,value:mn(e.elapsedDeltaMs),compactValue:mn(e.elapsedDeltaMs,{compact:!0}),label:x.chat.statElapsed})]})]}),l.jsx("button",{type:"button",title:o?x.common.copied:x.chat.copyReply,"aria-label":x.chat.copyReply,onClick:g,className:"flex h-5 w-5 shrink-0 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:l.jsx(Pe,{d:o?cn.check:cn.copy})})]})}const A8=1200,R8="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0";function Gc({atMs:e,text:n,align:r="left"}){const{locale:s}=Qa(),[o,c]=v.useState(!1),d=()=>{n!==void 0&&(navigator.clipboard.writeText(n),c(!0),setTimeout(()=>c(!1),A8))};return l.jsxs("div",{className:`flex h-5 items-center gap-2 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 sm:opacity-0 ${r==="right"?"justify-end":"justify-start"}`,children:[e!==void 0&&l.jsx("span",{className:"text-[11px] text-gray-400",children:Ev(e,s)}),n!==void 0&&l.jsx("button",{type:"button",title:o?x.common.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:l.jsx(Pe,{d:o?cn.check:cn.copy})})]})}const _8=2e3;function I8({item:e,ctx:n}){const r=e.gaveUp?"gaveUp":e.retrying?"retried":"waiting",s=r==="waiting"&&e.plannedDelayMs!==void 0&&e.plannedDelayMs>=_8&&e.arrivedAtMs!==void 0?e.arrivedAtMs+e.plannedDelayMs:null,[o,c]=v.useState(()=>Date.now()),[d,f]=v.useState(!1);v.useEffect(()=>{if(s===null||Date.now()>=s)return;const k=setInterval(()=>{c(Date.now()),Date.now()>=s&&clearInterval(k)},250);return()=>clearInterval(k)},[s]);const m=s!==null?s-o:0,h=s!==null&&m>0,g=h?Math.ceil(m/1e3):void 0,y=h&&n.origin.length===0&&(n.onRetryNow!==void 0||n.onGiveUp!==void 0);return l.jsxs("p",{className:"anim-msg my-1 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-xs text-amber-600 dark:text-amber-500",children:[l.jsx("span",{children:x.chat.reconnect(e.status,r,e.attempt,g)}),y&&l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[n.onRetryNow&&l.jsx("button",{type:"button",disabled:d,onClick:()=>{f(!0),n.onRetryNow()},className:"rounded border border-amber-300 px-1.5 py-0.5 text-[11px] font-medium text-amber-700 transition-colors duration-150 hover:bg-amber-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-amber-700 dark:text-amber-400 dark:hover:bg-amber-950/40",children:x.chat.reconnectRetryNow}),n.onGiveUp&&l.jsx("button",{type:"button",disabled:d,onClick:()=>{f(!0),n.onGiveUp()},className:"rounded border border-gray-300 px-1.5 py-0.5 text-[11px] text-gray-500 transition-colors duration-150 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-800",children:x.chat.reconnectGiveUp})]})]})}function r2({item:e,ctx:n}){switch(e.kind){case"user_text":{const r=MN(e.text);if(r)return l.jsx(b8,{origin:r});const s=IN(e.text);if(s)return l.jsx(v8,{origin:s});const o=ON(e.text),c=o?o.rest:e.text,d=AN(c),f=d?d.rest:c,m=NN(f),{text:h,images:g}=hC(m?m.rest:f);return o?l.jsxs(l.Fragment,{children:[m&&l.jsx(H1,{names:m.skills}),l.jsx(g8,{round:o.round,objective:h})]}):l.jsxs(l.Fragment,{children:[d&&l.jsx(k8,{origin:d.origin}),m&&l.jsx(H1,{names:m.skills}),h&&l.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[l.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:l.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:h})}),l.jsx(Gc,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:h,align:"right"})]}),g.map((y,k)=>l.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[l.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:l.jsx(qs,{src:y,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),l.jsx(Gc,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]},k))]})}case"user_steering":return l.jsxs("div",{className:"anim-msg group my-2 flex flex-col items-end",children:[l.jsxs("div",{className:"flex max-w-[88%] items-start gap-1.5 rounded-md border border-gray-200 bg-gray-100 px-3 py-1.5 md:max-w-[75%] dark:border-gray-700 dark:bg-gray-800",children:[l.jsx(Pe,{d:R8,className:"mt-1 shrink-0 text-gray-400 dark:text-gray-500"}),l.jsxs("p",{className:"wrap-anywhere whitespace-pre-wrap text-sm leading-relaxed text-gray-800 dark:text-gray-100",children:[l.jsx("span",{className:"mr-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400",children:x.chat.userSteering}),e.text]})]}),l.jsx(Gc,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:e.text,align:"right"})]});case"user_image":return l.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[l.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:l.jsx(qs,{src:e.imageUrl,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),l.jsx(Gc,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]});case"assistant_text":return l.jsxs("div",{className:"md-body anim-msg my-3 text-base leading-relaxed text-gray-800 dark:text-gray-100",children:[l.jsx(Xk,{text:e.text,streaming:e.streaming}),e.streaming&&l.jsx("span",{className:"animate-pulse text-gray-400",children:"▌"}),e.stopReason&&e.stopReason!=="completed"&&l.jsxs("span",{className:"ml-1 font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),!e.streaming&&n.onOpenFile&&n.statFiles&&l.jsx(e8,{text:e.text,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile})]});case"thinking":return l.jsx(n8,{item:e});case"tool_call":return l.jsx(h8,{item:e,ctx:n});case"subagent":return l.jsx("div",{className:"anim-msg my-2",children:l.jsx(t2,{sessionId:e.sessionId,model:e.model,running:!1,ctx:n})});case"abort":return l.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 l.jsx(I8,{item:e,ctx:n});case"compaction":return l.jsx(p8,{item:e});case"task_stats":return l.jsx(E8,{stats:e.stats,assistantText:e.assistantText,cost:e.stats?n.taskCost?.(e.stats)??null:null,...e.atMs!==void 0?{atMs:e.atMs}:{}})}}function L8(e){let n=0,r=0,s,o;const c=m=>{m!==void 0&&(s===void 0||m<s)&&(s=m)},d=(m,h)=>{if(h<=0)return;if(m===void 0){r+=h;return}c(m);const g=m+h;(o===void 0||g>o)&&(o=g)};for(const m of e){if(m.kind==="thinking"){c(m.startedAtMs),m.durationMs!==void 0&&d(m.startedAtMs,m.durationMs);continue}if(m.kind!=="tool_call"||(n+=1,c(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=s!==void 0&&o!==void 0?o-s:0;return{steps:n,durationMs:f+r,...s!==void 0?{startMs:s}:{}}}function D8(e){return e.kind==="thinking"||e.kind==="tool_call"}function O8(e,n){return e.kind==="thinking"?e.streaming:e.kind==="tool_call"?e.callStreaming||e.outputStreaming||e.callComplete&&!e.outputComplete?!0:n.pendingApprovals.has(ql(n.origin,e.toolCallId)):!1}function z8(e,n){return e.some(r=>r.kind==="tool_call"&&n.pendingApprovals.has(ql(n.origin,r.toolCallId)))}function U8({items:e,ctx:n,isLast:r}){const s=e.some(w=>O8(w,n)),o=r&&n.taskRunning||s,c=z8(e,n),[d,f]=v.useState(r),m=v.useRef(!1);v.useEffect(()=>{m.current||f(r)},[r]);const h=d||c,{steps:g,durationMs:y,startMs:k}=L8(e);return l.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:[l.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:[l.jsx(Co,{state:o?"running":"done",size:12}),l.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&&l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:inline",children:x.chat.workGroupSteps(g)}),s?k!==void 0&&l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:l.jsx(po,{sinceMs:k})}):y>0&&l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:mn(y)}),c&&!h&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hidden shrink-0 rounded bg-amber-100 px-1 text-[10px] font-medium text-amber-700 sm:inline dark:bg-amber-950/50 dark:text-amber-300",children:x.chat.approvalWaiting}),l.jsx("span",{role:"img",title:x.chat.approvalWaiting,"aria-label":x.chat.approvalWaiting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500 sm:hidden"})]}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Un,{open:h,className:"text-gray-400"})]}),h&&l.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=>l.jsx(r2,{item:w,ctx:n},w.id))})]})}function $8(){let e=!0,n=null,r=null;return{get stick(){return e},wheel(s){s<0&&(e=!1)},touchStart(s){r=s},touchMove(s){r!==null&&s>r&&(e=!1),r=s},touchEnd(){r=null},scrolled(s){const o=s.scrollHeight-s.scrollTop-s.clientHeight,c=n;if(n=s.scrollTop,c===null){e=o<80;return}if(s.scrollTop<c&&o>1){e=!1;return}o<80&&(e=!0)},resume(){e=!0,n=null}}}function B8({items:e,ctx:n}){const r=[];let s=[];const o=()=>{s.length>0&&(r.push({type:"group",items:s}),s=[])};for(const h of e)D8(h)?s.push(h):(o(),r.push({type:"single",item:h}));o();const c=(h,g)=>h.type==="group"?l.jsx(U8,{items:h.items,ctx:n,isLast:g===r.length-1},`wg-${h.items[0].id}`):l.jsx(r2,{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,y=f;f=[],d.push(l.jsx("div",{className:"group",children:y.map(k=>c(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(c(g,h));continue}f.push({seg:g,i:h}),g.type==="single"&&g.item.kind==="task_stats"&&m()}return m(),l.jsx(l.Fragment,{children:d})}function s2({items:e,version:n,ctx:r}){const s=v.useRef(null),o=v.useRef(null),c=o.current??=$8(),[d,f]=v.useState(!1),m=v.useRef(!1),h=v.useRef(null),g=()=>{h.current!==null&&(cancelAnimationFrame(h.current),h.current=null),m.current=!1};v.useEffect(()=>()=>g(),[]);const y=v.useRef(null),k=()=>{const C=s.current;f(!m.current&&!c.stick&&C!==null&&C.scrollHeight-C.scrollTop-C.clientHeight>1)},w=()=>{const C=s.current;if(!C)return;const M=y.current;y.current=C.scrollTop,m.current&&M!==null&&C.scrollTop<M-1&&g(),c.scrolled({scrollTop:C.scrollTop,scrollHeight:C.scrollHeight,clientHeight:C.clientHeight}),k()};v.useLayoutEffect(()=>{const C=s.current;C&&c.stick&&!m.current&&(C.scrollTop=C.scrollHeight),k()},[n,c]);const N=()=>{const C=s.current;if(!C)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){c.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 A=performance.now();const R=I=>{h.current=null;const P=s.current;if(!P||!m.current)return;const D=Math.min(.05,Math.max(.001,(I-A)/1e3));A=I;const L=P.scrollHeight-P.clientHeight-P.scrollTop;if(L<=1){m.current=!1,c.resume(),P.scrollTop=P.scrollHeight,k();return}const $=Math.max(L*Math.min(1,D*10),3200*D);P.scrollTop+=Math.min($,L),h.current=requestAnimationFrame(R)};h.current=requestAnimationFrame(R),k()};return l.jsxs("div",{className:"relative h-full min-h-0",children:[l.jsx("div",{ref:s,onScroll:w,onWheel:C=>{c.wheel(C.deltaY),C.deltaY<0&&g(),k()},onTouchStart:C=>{const M=C.touches[0];M&&c.touchStart(M.clientY)},onTouchMove:C=>{const M=C.touches[0];M&&c.touchMove(M.clientY),m.current&&g(),k()},onTouchEnd:()=>c.touchEnd(),className:"anim-fade h-full overflow-y-auto px-4 py-4 md:px-6",children:l.jsx("div",{className:"mx-auto max-w-3xl",children:e.length===0?l.jsx(lr,{title:x.chat.emptyStream}):l.jsx(B8,{items:e,ctx:r})})}),d&&l.jsx("button",{type:"button","aria-label":x.chat.jumpToLatest,title:x.chat.jumpToLatest,onClick:N,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:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M12 5v14M6 13l6 6 6-6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}const H8=128e3;function l2(e){const n=typeof e=="string"?Number(e):e;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:H8}const P8=/[\s"'/]on[a-z]+\s*=/i,q8=/href\s*=/i;function F8(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")||q8.test(n)||P8.test(n)?null:n}const Im=["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"],V8={firecrawl:3,"data-analysis":1,"web-design":2,"penguin-sdk":0};function G8(e){const n=V8[e];if(n!==void 0)return Im[n];let r=0;for(let s=0;s<e.length;s++)r=r*31+e.charCodeAt(s)>>>0;return Im[r%Im.length]}function jp({icon:e,size:n=20,className:r=""}){const s=F8(e);return s?l.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:s}}):l.jsx(Pe,{d:Sp,size:n,className:r})}const q1={viewBox:"-0.76 -0.47 28.6 28.6",path:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.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"}),l.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"}),l.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"}),l.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"})]})},W8={anthropic:{path:l.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:l.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:l.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:l.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:l.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:l.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:l.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:l.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":q1,"qwen-pay-as-you-go":q1,fireworks:{viewBox:"0 0 638 315",path:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M12 2.8 20.5 7.4v9.2L12 21.2 3.5 16.6V7.4L12 2.8Z"}),l.jsx("path",{d:"M3.5 7.4 12 12l8.5-4.6M12 12v9.2"})]})}};function Mo({provider:e,className:n}){const r=W8[e];if(!r){const s=Av(e);return l.jsxs("svg",{viewBox:"0 0 24 24",className:n,style:{"--tile-fg":s.fg,"--tile-fg-dark":s.fgDark},"aria-hidden":!0,children:[l.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:s.bg}),l.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:Rv(e)})]})}return l.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 Tt="https://openrouter.ai/api/v1",Rr="https://api.siliconflow.cn/v1",Ul="https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",eo="https://dashscope.aliyuncs.com/compatible-mode/v1",Os="https://api.fireworks.ai/inference/v1",ps=[{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:Tt},{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:Os},{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:Rr},{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:Ul},{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:eo},{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 vn(e,n,r){const s=o=>Math.round(o/7*1e6)/1e6;return _e(s(e),s(n),s(r))}function _e(e,n,r){return{unit:"usd_per_mtok",cache_read:e,cache_write:n,output:r}}var i2=[{modelId:"deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"deepseek",contextWindow:1e6,pricing:vn(.02,1,2),supportsVision:!1},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"deepseek",contextWindow:1e6,pricing:vn(.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:Tt},{modelId:"anthropic/claude-opus-5",displayName:"Claude Opus 5",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:Tt},{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:Tt},{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:Tt},{modelId:"anthropic/claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"openrouter",contextWindow:1e6,pricing:_e(2,2,10),supportsVision:!0,clientType:"openai",baseUrl:Tt},{modelId:"deepseek/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"openrouter",contextWindow:1e6,pricing:_e(.09,.09,.18),supportsVision:!1,clientType:"openai",baseUrl:Tt},{modelId:"deepseek/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"openrouter",contextWindow:1e6,pricing:_e(.435,.435,.87),supportsVision:!1,clientType:"openai",baseUrl:Tt},{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:Tt},{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:Tt},{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:Tt},{modelId:"inclusionai/ling-3.0-flash:free",displayName:"Ling 3.0 Flash (free)",provider:"openrouter",contextWindow:262144,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:Tt},{modelId:"minimax/minimax-m3",displayName:"MiniMax M3",provider:"openrouter",contextWindow:1048576,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:Tt},{modelId:"moonshotai/kimi-k3",displayName:"Kimi K3",provider:"openrouter",contextWindow:1e6,pricing:_e(3,3,15),supportsVision:!0,clientType:"openai",baseUrl:Tt},{modelId:"moonshotai/kimi-k2.6",displayName:"Kimi K2.6",provider:"openrouter",contextWindow:262144,pricing:_e(.144,.684,3.42),supportsVision:!0,clientType:"openai",baseUrl:Tt},{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:Tt},{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:Tt},{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:Tt},{modelId:"openai/gpt-5.5",displayName:"GPT-5.5",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,30),supportsVision:!0,clientType:"openai",baseUrl:Tt},{modelId:"openrouter/free",displayName:"Free Models Router",provider:"openrouter",contextWindow:128e3,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:Tt},{modelId:"poolside/laguna-m.1:free",displayName:"Laguna M.1 (free)",provider:"openrouter",contextWindow:262144,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:Tt},{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:Tt},{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:Tt},{modelId:"tencent/hy3",displayName:"Hy3",provider:"openrouter",contextWindow:262144,pricing:_e(.035,.14,.58),supportsVision:!1,clientType:"openai",baseUrl:Tt},{modelId:"x-ai/grok-4.5",displayName:"Grok 4.5",provider:"openrouter",contextWindow:5e5,pricing:_e(2,2,6),supportsVision:!0,clientType:"openai",baseUrl:Tt},{modelId:"xiaomi/mimo-v2.5",displayName:"MiMo-V2.5",provider:"openrouter",contextWindow:1048576,pricing:_e(.0028,.14,.28),supportsVision:!0,clientType:"openai",baseUrl:Tt},{modelId:"z-ai/glm-5.2",displayName:"GLM-5.2",provider:"openrouter",contextWindow:1e6,pricing:_e(.93,.93,3),supportsVision:!1,clientType:"openai",baseUrl:Tt},{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:Tt},{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:Os},{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:Os},{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:Os},{modelId:"accounts/fireworks/models/kimi-k3",displayName:"Kimi K3",provider:"fireworks",contextWindow:1e6,pricing:_e(.3,3,15),supportsVision:!0,clientType:"openai",baseUrl:Os},{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:Os},{modelId:"accounts/fireworks/models/minimax-m3",displayName:"MiniMax M3",provider:"fireworks",contextWindow:524288,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:Os},{modelId:"deepseek-ai/DeepSeek-V4-Flash",displayName:"DeepSeek V4 Flash",provider:"siliconflow",contextWindow:1e6,pricing:vn(.02,1,2),supportsVision:!1,clientType:"openai",baseUrl:Rr},{modelId:"deepseek-ai/DeepSeek-V4-Pro",displayName:"DeepSeek V4 Pro",provider:"siliconflow",contextWindow:1e6,pricing:vn(.1,12,24),supportsVision:!1,clientType:"openai",baseUrl:Rr},{modelId:"meituan-longcat/LongCat-2.0",displayName:"LongCat 2.0",provider:"siliconflow",contextWindow:1e6,pricing:vn(.1,5,20),supportsVision:!1,clientType:"openai",baseUrl:Rr},{modelId:"moonshotai/Kimi-K2.7-Code",displayName:"Kimi K2.7 Code",provider:"siliconflow",contextWindow:262144,pricing:vn(1.3,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:Rr},{modelId:"Pro/moonshotai/Kimi-K2.6",displayName:"Kimi K2.6",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:Rr},{modelId:"Pro/zai-org/GLM-5.1",displayName:"GLM-5.1",provider:"siliconflow",contextWindow:2e5,supportsVision:!1,clientType:"openai",baseUrl:Rr},{modelId:"Qwen/Qwen3.6-35B-A3B",displayName:"Qwen 3.6 35B A3B",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:Rr},{modelId:"zai-org/GLM-5.2",displayName:"GLM-5.2",provider:"siliconflow",contextWindow:1e6,pricing:vn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Rr},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"qwen-token-plan",contextWindow:1e6,pricing:vn(1,12,24),supportsVision:!1,clientType:"openai",baseUrl:Ul},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"qwen-token-plan",contextWindow:1048576,pricing:vn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Ul},{modelId:"qwen3.8-max-preview",displayName:"Qwen 3.8 Max Preview",provider:"qwen-token-plan",contextWindow:1e6,supportsVision:!0,clientType:"openai",baseUrl:Ul},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-token-plan",contextWindow:1e6,pricing:vn(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:Ul},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-token-plan",contextWindow:1e6,pricing:vn(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:Ul},{modelId:"kimi/kimi-k3",displayName:"Kimi K3",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:vn(2,20,100),supportsVision:!0,clientType:"openai",baseUrl:eo},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:vn(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:eo},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:vn(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:eo},{modelId:"ZHIPU/GLM-5.2",displayName:"GLM-5.2",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:vn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:eo},{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:vn(2,20,100),supportsVision:!0},{modelId:"kimi-k2.6",displayName:"Kimi K2.6",provider:"moonshot",contextWindow:262144,pricing:vn(1.1,6.5,27),supportsVision:!0},{modelId:"kimi-k2.5",displayName:"Kimi K2.5",provider:"moonshot",contextWindow:262144,pricing:vn(.7,4,21),supportsVision:!0}];function Np(e,n){return i2.find(r=>r.provider===e&&r.modelId===n)}function Aa(e){return ps.find(n=>n.id===e)}function K8(e,n){const r=(n||e).toLowerCase(),s=o=>({envKey:`${o}_API_KEY`,envBaseUrlKey:`${o}_BASE_URL`});if(r.includes("gemini-3")||r.includes("gemini-embedding"))return s("GEMINI");if(r.includes("claude")&&(r.includes("4-7")||r.includes("4-8")||r.includes("-5")||r.includes("4-6")))return s("ANTHROPIC");if(r.includes("gpt-5.4")||r.includes("gpt-5.5"))return s("OPENAI");if(r.includes("glm-5"))return s("ZAI");if(r.includes("kimi-k3")||r.includes("kimi-k2.5")||r.includes("kimi-k2.6"))return s("MOONSHOT");if(r.includes("deepseek-v4"))return s("DEEPSEEK");if(r.includes("openai"))return s("OPENAI")}function Y8(){return i2.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 F1(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 kt(e,n){return!!e&&!!n&&e.provider===n.provider&&e.modelId===n.modelId}function o2(e){return{id:e,label:e,envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}}function c2(e,n){const r=n.trim().toLowerCase();if(!r)return!0;const s=ps.find(o=>o.id===e.provider);return e.modelId.toLowerCase().includes(r)||(e.displayName??"").toLowerCase().includes(r)||e.provider.toLowerCase().includes(r)||(s?.label??"").toLowerCase().includes(r)}function u2(e,n){const r=n.trim()!=="",s=e.filter(f=>c2(f,n)),o=ps.map(f=>({provider:f,rows:s.filter(m=>m.provider===f.id)})),d=[...new Set(s.map(f=>f.provider).filter(f=>!ps.some(m=>m.id===f)))].sort().map(f=>({provider:o2(f),rows:s.filter(m=>m.provider===f)}));return[...o,...d].filter(f=>f.rows.length>0||!r&&f.provider.id==="custom")}function Q8(e){return u2(e,"").flatMap(n=>n.rows)}function kh(e){return!!e.credential?.apiKeyMasked}function d2(e){return e?[e.cacheRead,e.cacheWrite,e.output].every(n=>typeof n=="string"?n.trim()!==""&&Number(n)===0:n===0):!1}function V1(e,{showAll:n,query:r,selected:s,defaultModel:o}){const c=Q8(e);return(n||!c.some(kh)?c:c.filter(f=>kh(f)||kt(f,s)||kt(f,o))).filter(f=>c2(f,r))}const X8=/^[\w-]*$/;function G1(e,n){const r=e.slice(0,n),s=r.lastIndexOf("/");if(s<0||s>0&&!/\s/.test(r[s-1]))return null;const o=r.slice(s+1);if(!X8.test(o))return null;const c=/^[\w-]*/.exec(e.slice(n))[0];return{start:s,end:n+c.length,query:o}}function Z8(e,n){const r=e.slice(0,n.start),s=e.slice(n.end),o=r.endsWith(" ")&&s.startsWith(" ")?r+s.slice(1):r+s;return/^\s*$/.test(o)?"":o}const J8=["none","low","medium","high","xhigh"],eR=["low","medium","high","xhigh"];function tR(e,n){return n&&J8.includes(n)?e[n]??n:null}function nR(e,n,r){const s=e.filter(([o])=>o!=="").map(([o,c])=>({value:o,triggerLabel:o,label:o,description:c}));return r==="none"&&s.push({value:"none",triggerLabel:"none",label:"none",description:n}),s}const aR=["always-ask","read-only","allow-all","deny-all"],W1={"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 rR({value:e,onChange:n,disabled:r,direction:s="up"}){const[o,c]=v.useState(!1);return l.jsx(_a,{open:o,setOpen:c,menuClass:"w-max",portal:{direction:s,align:"left"},button:l.jsxs("button",{type:"button","aria-label":x.chat.approvalMode,title:`${x.chat.approvalMode}:${x.chat.approvalModeNames[e]??e}`,disabled:r,onClick:()=>c(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:[l.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:l.jsx("path",{d:W1[e]})}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:x.chat.approvalModeNames[e]??e}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:aR.map(d=>l.jsxs("button",{type:"button",onClick:()=>{n(d),c(!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:[l.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:l.jsx("path",{d:W1[d]})}),l.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-nowrap",children:x.chat.approvalModes[d]??d}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:d===e?"✓":""})]},d))})}function Cp(e){return e.displayName??e.modelId}const sR="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 f2({models:e,value:n,defaultModel:r,onPick:s}){const[o,c]=v.useState(""),[d,f]=v.useState(!1),m=V1(e,{showAll:d,query:o,selected:n,defaultModel:r}),h=d?0:V1(e,{showAll:!0,query:o,selected:n,defaultModel:r}).length-m.length;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:l.jsx("input",{autoFocus:!0,value:o,onChange:g=>c(g.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"})}),l.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[m.length===0&&l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.models.noSearchResults}),m.map(g=>l.jsxs("button",{type:"button",onClick:()=>s(g),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 ${kt(g,n)?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[l.jsx(Mo,{provider:g.provider,className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:Cp(g)}),d2(g.pricing)&&l.jsx("span",{className:"shrink-0",children:l.jsx(qt,{tone:"yellow",children:x.models.freeBadge})}),!kh(g)&&l.jsx("span",{role:"img",title:x.models.noKey,"aria-label":x.models.noKey,className:"shrink-0 text-gray-400 dark:text-gray-500",children:l.jsx(Pe,{d:sR,size:13})}),kt(g,r)&&l.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:x.models.default}),l.jsx("span",{className:"w-3 shrink-0 text-center text-xs",children:kt(g,n)?"✓":""})]},`${g.provider}:${g.modelId}`))]}),h>0&&l.jsx("div",{className:"border-t border-gray-100 dark:border-gray-800",children:l.jsx("button",{type:"button",onClick:()=>f(!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(h)})})]})}function lR({models:e,value:n,defaultModel:r,onChange:s,disabled:o}){const[c,d]=v.useState(!1),f=e.find(h=>kt(h,n)),m=f?Cp(f):n?.modelId??"…";return l.jsx(_a,{open:c,setOpen:d,menuClass:"w-max min-w-56 origin-top-right",portal:{direction:"down",align:"right"},button:l.jsxs("button",{type:"button",title:`${x.chat.chooseModel}:${m}`,"aria-label":x.chat.chooseModel,disabled:o||e.length===0,onClick:()=>d(!c),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:[l.jsx(Mo,{provider:f?.provider??n?.provider??"custom",className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:m}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:l.jsx(f2,{models:e,value:n,...r!==void 0?{defaultModel:r}:{},onPick:h=>{s({provider:h.provider,modelId:h.modelId}),d(!1)}})})}const iR="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z";function K1({value:e,onChange:n,disabled:r,direction:s="down"}){const[o,c]=v.useState(!1),d=e===null?"…":tR(x.chat.thinkingLevelNames,e)??"—";return l.jsxs(_a,{open:o,setOpen:c,menuClass:"w-max min-w-36",portal:{direction:s,align:"right"},button:l.jsxs("button",{type:"button",title:`${x.chat.thinkingLevel}:${d}`,"aria-label":x.chat.thinkingLevel,disabled:r||e===null,onClick:()=>c(!o),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:[l.jsx(Pe,{d:iR,size:14,className:"shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:d}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[l.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}),eR.map(f=>l.jsxs("button",{type:"button",onClick:()=>{n(f),c(!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 ${f===e?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.chat.thinkingLevelNames[f]??f}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:f===e?"✓":""})]},f))]})}const m2="penguin.steerMode";function oR(){return localStorage.getItem(m2)==="followup"?"followup":"steer"}const cR="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6";function uR({steerMode:e,onChangeSteerMode:n}){const r=(s,o,c)=>l.jsx("button",{type:"button",title:c,"aria-pressed":e===s,onClick:()=>n(s),className:`h-5 rounded px-1.5 text-xs transition-colors duration-150 ${e===s?"bg-gray-200 font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:o});return l.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-1 text-xs",children:[l.jsx(Pe,{d:cR,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-600 dark:text-gray-400",children:x.chat.steerModeLabel}),l.jsxs("div",{role:"group","aria-label":x.chat.steerModeLabel,className:"flex shrink-0 items-center gap-0.5",children:[r("steer",x.chat.steerModeSteer,x.chat.steerModeSteerHint),r("followup",x.chat.steerModeFollowUp,x.chat.steerModeFollowUpHint)]})]})}function dR({skills:e,selected:n,onToggle:r,disabled:s,direction:o="up"}){const{locale:c}=Qa(),[d,f]=v.useState(!1),[m,h]=v.useState(""),g=S8(e,c,m);return l.jsxs(_a,{open:d,setOpen:f,menuClass:"w-[26rem]",portal:{direction:o,align:"left"},button:l.jsxs("button",{type:"button","aria-label":x.chat.skillsSelect,title:x.chat.skillsSelect,disabled:s,onClick:()=>{const y=!d;f(y),y&&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:[l.jsx(Pe,{d:Sp,size:14,className:"shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:x.chat.skillsSelect}),n.length>0&&l.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}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[l.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:l.jsx("input",{autoFocus:!0,value:m,onChange:y=>h(y.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"})}),l.jsx("div",{className:"max-h-56 overflow-y-auto",children:e.length===0?l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.chat.skillsEmptyHint}):g.length===0?l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.chat.skillsNoMatch}):g.map(y=>{const k=n.includes(y.name);return l.jsxs("button",{type:"button","aria-pressed":k,onClick:()=>r(y.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:[l.jsx(jp,{icon:y.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"shrink-0 font-mono",children:y.name}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:To(c,y)}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:k?"✓":""})]},y.name)})})]})}const fR="M6 5h12a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3zM3 15l5-5 4 4 3-3 6 6";function mR({items:e,footer:n,direction:r="up"}){const[s,o]=v.useState(!1);return l.jsxs(_a,{open:s,setOpen:o,menuClass:"w-72",portal:{direction:r,align:"left"},button:l.jsx("button",{type:"button","aria-label":x.chat.plusMenu,title:x.chat.plusMenu,onClick:()=>o(!s),className:"flex h-8 w-8 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:l.jsx(Pe,{d:"M12 5v14M5 12h14",size:15,className:"shrink-0"})}),children:[e.map(c=>l.jsxs("button",{type:"button","aria-pressed":c.active,disabled:c.disabled,onClick:()=>{o(!1),c.onSelect()},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 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent dark:hover:bg-gray-800 dark:disabled:hover:bg-transparent ${c.active?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[l.jsx(Pe,{d:c.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"shrink-0",children:c.label}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:c.desc}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:c.active?"✓":""})]},c.key)),n&&l.jsx("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:n})]})}function hR({now:e,window:n,unknown:r=!1}){const s=l2(n),o=r?0:Math.min(1,e/s),c=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 l.jsxs("span",{title:r?x.chat.contextUnknown:`${x.chat.contextUsage} ${Math.round(o*100)}%`,className:`flex shrink-0 items-center gap-1 font-mono ${c}`,children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block shrink-0",children:[l.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),l.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)"})]}),l.jsxs("span",{className:"hidden @md:inline",children:[r?"—":ot(e),"/",ot(s)]})]})}function h2({status:e,onSend:n,onSteer:r,steeringDeliveredCount:s,onQueueFollowUp:o,queuedFollowUps:c=0,onStop:d,onCompact:f,modelRef:m,models:h,onChangeModel:g,onSwitchModel:y,defaultModel:k,thinkingLevel:w,onChangeThinkingLevel:N,turnThinkingLevel:C,onChangeTurnThinkingLevel:M,contextWindow:A,contextNow:R,contextStale:I=!1,vision:P,approvalMode:D,onChangeApprovalMode:L,modeSaving:$,autoFocus:Q,agents:W,skills:B,initialSkills:V,onSkillsChange:q,onHandoff:X,initialText:te,onTextChange:O,initialHandoffTargetId:z,onHandoffTargetChange:H,modelAuthDead:Z=!1,onOpenModels:ce,onRetryModelAuth:E,onNewSession:T}){const{locale:U}=Qa(),[j,K]=v.useState(te??""),se=v.useRef(j);se.current=j;const[oe,pe]=v.useState([]),[Se,ie]=v.useState(!1),[he,be]=v.useState(0),[ze,st]=v.useState(null),[Ue,wt]=v.useState(!1),Yt=v.useRef(null),pn=v.useRef(null),[gn,je]=v.useState(),[Ee,lt]=v.useState(null),[We,ct]=v.useState(V??[]),[St,tn]=v.useState(0),[ue,ge]=v.useState(0),[Ae,Be]=v.useState(null),$e=v.useRef(null),[Qt]=v.useState(()=>window.matchMedia("(max-width: 767px)").matches),mt=e==="running",ht=e==="compacting",[Ke,Ft]=v.useState(!1),[Ye,xn]=v.useState(""),[ut,Rn]=v.useState(!1),[un,_n]=v.useState(""),In=Ke?Vc(Ye):null,dn=Vc(un)===null,ga=In!==null&&In!==wp?x.chat.goalBudgetValue(ot(In)):x.chat.goalBudgetUnlimited,ve=!mt&&!ht&&!Se&&!Z&&(Ke?j.trim().length>0&&oe.length===0&&In!==null&&!(ut&&dn):j.trim().length>0||oe.length>0||Ee!==null||We.length>0),Me=v.useCallback(re=>{if(re){_n(Ye),Rn(!0);return}Vc(un)!==null&&(xn(un.trim()),Rn(!1))},[Ye,un]),xt=v.useCallback(()=>{Rn(!1),$e.current?.focus()},[]),yt=v.useCallback(()=>{Vc(un)!==null&&(xn(un.trim()),Rn(!1),$e.current?.focus())},[un]),_t=v.useCallback(re=>{Ft(re),Rn(!1),_n(""),re&&(xn(""),lt(null),H?.(null),pe([]))},[H]),It=mt&&!Se&&!Ke&&!Z&&r!==void 0&&Ee===null&&j.trim().length>0,[Xt,Da]=v.useState(oR),Oa=re=>{Da(re),localStorage.setItem(m2,re)},za=Xt==="followup"&&o!==void 0,Lr=mt&&!Se&&!Ke&&!Z&&za&&(j.trim().length>0||oe.length>0||Ee!==null||We.length>0),Qs=za?Lr:It,Hn=za?x.chat.followUpSend:x.chat.steerSend,Lt=mt&&j.trim().length===0&&oe.length===0&&Ee===null&&We.length===0,[Vt,ea]=v.useState(!1),ur=v.useRef(0);v.useEffect(()=>{Vt&&(!mt||(s??0)>ur.current)&&ea(!1)},[Vt,mt,s]);const Dr=v.useCallback(re=>{const ye=We.includes(re)?We.filter(Le=>Le!==re):[...We,re];ct(ye),q?.(ye)},[We,q]),Xs=v.useRef(null),Zs=v.useMemo(()=>{const re=()=>{const ye=Xs.current,Le=ye?Z8(se.current,ye):"";K(Le),O?.(Le)};return[{cmd:"/compact",desc:x.chat.compact,run:()=>{re(),f()}},{cmd:"/goal",desc:x.chat.goalModeDesc,run:()=>{re(),_t(!Ke)}},...y&&h&&h.length>0?[{cmd:"/model",desc:x.chat.switchModel,run:()=>{re(),wt(!0)}}]:[],...j8(B,U).map(ye=>({cmd:ye.cmd,desc:ye.desc,run:()=>{re(),Dr(ye.name)}}))]},[f,y,h,O,B,U,Dr,_t,Ke]),Pn=!mt&&!ht&&!Ue?G1(j,St):null;Xs.current=Pn;const Ln=Pn&&Pn.start!==ze?Zs.filter(re=>re.cmd.startsWith(`/${Pn.query}`)):[],qn=Ln.length>0,xa=Ln[Math.min(he,Ln.length-1)],Dn=!mt&&!ht&&!qn&&!Ue?P1(j,St):null,Cn=Dn&&Dn.start!==Ae?T8(W,Dn.query):[],Dt=Cn.length>0,Or=Cn[Math.min(ue,Cn.length-1)];v.useEffect(()=>{if(!Ue)return;const re=Le=>{Yt.current&&!Yt.current.contains(Le.target)&&wt(!1)},ye=Le=>{Le.key==="Escape"&&wt(!1)};return window.addEventListener("mousedown",re),window.addEventListener("keydown",ye),()=>{window.removeEventListener("mousedown",re),window.removeEventListener("keydown",ye)}},[Ue]);const Js=async re=>{if(wt(!1),!y||Se||mt||ht||kt(re,m))return;const Le=se.current.trim()||(We.length>0?x.chat.skillsAutoMessage(We):x.chat.modelSwitchAutoMessage),Bt=[{type:"text",text:uu(We,Le)}];for(const yn of oe)Bt.push({type:"image_url",imageUrl:yn});ie(!0);try{await y({provider:re.provider,modelId:re.modelId},Bt)&&(K(""),pe([]),ct([]))}finally{ie(!1),$e.current?.focus()}};v.useEffect(()=>{if(!qn&&!Dt&&!Ue)return;const re=()=>{const ye=pn.current;if(!ye)return;let Le=0;for(let Bt=ye.parentElement;Bt;Bt=Bt.parentElement)if(getComputedStyle(Bt).overflowY!=="visible"){Le=Bt.getBoundingClientRect().top;break}const at=ye.getBoundingClientRect().top-Le-14;je(Math.max(96,Math.min(320,Math.round(at))))};return re(),window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[qn,Dt,Ue]);const Ua=()=>{const re=$e.current;re&&(re.style.height="auto",re.style.height=`${Math.min(re.scrollHeight,176)}px`)};v.useLayoutEffect(Ua,[j]),v.useEffect(()=>{const re=$e.current;if(re&&re.value.length>0){const ye=re.value.length;re.setSelectionRange(ye,ye),re.scrollTop=re.scrollHeight,tn(ye)}},[]);const ae=v.useRef(!1);v.useEffect(()=>{if(!ae.current&&(ae.current=!0,B.length===0))return;const re=We.filter(ye=>B.some(Le=>Le.name===ye));re.length!==We.length&&(ct(re),q?.(re))},[B,We,q]);const we=v.useRef(!1);v.useEffect(()=>{if(we.current||!z||W.length===0)return;we.current=!0;const re=W.find(ye=>ye.agentId===z);re&<(re)},[W,z]);const Fe=re=>{const ye=$e.current;if(!Dn||!ye)return;let{start:Le,end:at}=Dn;ye.value[at]===" "?at++:Le>0&&ye.value[Le-1]===" "&&Le--;const Bt=ye.value.slice(0,Le)+ye.value.slice(at);ye.value=Bt,ye.setSelectionRange(Le,Le),ye.focus(),lt(re),H?.(re.agentId),Ft(!1),K(Bt),O?.(Bt),tn(Le),ge(0)},Qe=async(re=n)=>{const ye=j.trim();if(Ke){ie(!0);try{await n([{type:"text",text:uu(We,ye)}],{budget:In})&&(K(""),ct([]),_t(!1))}finally{ie(!1),$e.current?.focus()}return}const Le=Ee?{agent:Ee,rest:ye}:M8(ye,W),at=Le?Le.rest:ye,Bt=We.length>0&&at===""?x.chat.skillsAutoMessage(We):at,yn=uu(We,Bt),zr=[];yn&&zr.push({type:"text",text:yn});for(const el of oe)zr.push({type:"image_url",imageUrl:el});ie(!0);try{(Le?await X(Le.agent,zr):await re(zr,null))&&(K(""),pe([]),lt(null),ct([]))}finally{ie(!1),$e.current?.focus()}},Ot=async()=>{if(mt){if(za){if(!Lr)return;await Qe(o);return}if(!It)return;const re=j.trim();ie(!0);let ye="failed";try{ye=await r(re),ye==="queued"&&(ur.current=s??0,ea(!0),K(""))}finally{ie(!1),$e.current?.focus()}ye==="not_running"&&await Qe();return}ve&&await Qe()},Mt=re=>{if(qn){if(re.key==="ArrowDown"){re.preventDefault(),be(ye=>(ye+1)%Ln.length);return}if(re.key==="ArrowUp"){re.preventDefault(),be(ye=>(ye-1+Ln.length)%Ln.length);return}if((re.key==="Enter"&&!re.shiftKey||re.key==="Tab")&&!re.nativeEvent.isComposing){re.preventDefault(),xa?.run();return}if(re.key==="Escape"){st(Pn?.start??null);return}}if(Dt){if(re.key==="ArrowDown"){re.preventDefault(),ge(ye=>(ye+1)%Cn.length);return}if(re.key==="ArrowUp"){re.preventDefault(),ge(ye=>(ye-1+Cn.length)%Cn.length);return}if((re.key==="Enter"&&!re.shiftKey||re.key==="Tab")&&!re.nativeEvent.isComposing){re.preventDefault(),Or&&Fe(Or);return}if(re.key==="Escape"){Be(Dn?.start??null);return}}if(re.key==="Backspace"&&Ee!==null&&re.currentTarget.selectionStart===0&&re.currentTarget.selectionEnd===0){re.preventDefault(),lt(null),H?.(null);return}re.key==="Enter"&&!re.shiftKey&&!re.nativeEvent.isComposing&&(re.preventDefault(),Ot())},Zt=re=>{if(!Ke)for(const ye of re){if(!ye.type.startsWith("image/"))continue;const Le=new FileReader;Le.onload=()=>{typeof Le.result=="string"&&pe(at=>[...at,Le.result])},Le.readAsDataURL(ye)}},Gt=re=>{const ye=[];for(const Le of re.clipboardData.items)if(Le.kind==="file"){const at=Le.getAsFile();at&&ye.push(at)}ye.length>0&&(re.preventDefault(),Zt(ye))},nn=re=>{re.target.files&&Zt(re.target.files),re.target.value=""},dr=v.useRef(null);return l.jsxs("div",{className:"relative",ref:pn,children:[qn&&l.jsx("div",{style:{maxHeight:gn},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:Ln.map((re,ye)=>l.jsxs("button",{type:"button",ref:re===xa?Le=>Le?.scrollIntoView({block:"nearest"}):void 0,onMouseEnter:()=>be(ye),onClick:()=>re.run(),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${re===xa?"bg-gray-100 dark:bg-gray-800":""}`,children:[l.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:re.cmd}),l.jsx("span",{title:re.desc,className:"min-w-0 flex-1 truncate text-xs text-gray-500 dark:text-gray-400",children:re.desc})]},re.cmd))}),Ue&&h&&l.jsxs("div",{ref:Yt,style:{maxHeight:gn},className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 flex w-80 max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:[l.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.switchModelTitle}),l.jsx(f2,{models:h,value:m,...k!==void 0?{defaultModel:k}:{},onPick:re=>{Js(re)}})]}),Dt&&l.jsx("div",{style:{maxHeight:Math.min(256,gn??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:Cn.map((re,ye)=>l.jsxs("button",{type:"button",onMouseEnter:()=>ge(ye),onClick:()=>Fe(re),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${re===Or?"bg-gray-100 dark:bg-gray-800":""}`,children:[l.jsxs("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:["@",re.agentId]}),re.name&&re.name!==re.agentId&&l.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:re.name})]},re.agentId))}),oe.length>0&&l.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:oe.map((re,ye)=>l.jsxs("div",{className:"anim-pop relative",children:[l.jsx(qs,{src:re,alt:x.chat.imageAlt,className:"h-16 w-16 rounded-md border border-gray-200 object-cover dark:border-gray-700"}),l.jsx("button",{type:"button","aria-label":x.chat.removeImage,onClick:()=>pe(Le=>Le.filter((at,Bt)=>Bt!==ye)),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:"×"})]},ye))}),!P&&oe.length>0&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.imagesAsPathHint}),Vt&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.steerQueuedIndicator}),c>0&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.followUpQueuedChip(c)}),Z&&l.jsxs("div",{className:"anim-fade mb-1.5 flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-300",children:[l.jsx("span",{className:"min-w-0 flex-1 basis-56",children:x.chat.modelAuthDead}),l.jsxs("span",{className:"flex shrink-0 flex-wrap items-center gap-1.5",children:[ce&&l.jsx("button",{type:"button",onClick:ce,className:"shrink-0 rounded-md bg-gray-900 px-2.5 py-1 font-medium text-white transition-colors duration-150 hover:bg-gray-700 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300",children:x.chat.modelAuthDeadOpenModels}),E&&l.jsx("button",{type:"button",onClick:E,className:"shrink-0 rounded-md border border-gray-300 bg-white px-2.5 py-1 font-medium text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-700",children:x.chat.modelAuthDeadRetry}),T&&l.jsx("button",{type:"button",onClick:T,className:"shrink-0 rounded-md border border-gray-300 bg-white px-2.5 py-1 font-medium text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-700",children:x.chat.modelAuthDeadCta})]})]}),l.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${Z?" opacity-50 grayscale":""}`,children:[(Ee!==null||We.length>0||Ke)&&l.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-1",children:[Ke&&l.jsxs("span",{className:"anim-pop flex max-w-full items-center gap-1 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",children:[l.jsxs("span",{className:"flex shrink-0 items-center gap-1",title:x.chat.goalModeDesc,children:[l.jsx(Pe,{d:go,size:13,className:"text-gray-500 dark:text-gray-400"}),l.jsx("span",{children:x.chat.goalMode})]}),l.jsx("span",{"aria-hidden":!0,className:"mx-0.5 h-4 w-px shrink-0 bg-gray-300 dark:bg-gray-600"}),l.jsx(_a,{open:ut,setOpen:Me,onEscape:xt,className:"min-w-0",menuClass:"bottom-full left-1/2 -ml-32 mb-2 w-64 max-w-[calc(100vw-2rem)] origin-bottom",button:l.jsxs("button",{type:"button","aria-label":ga,"aria-expanded":ut,onClick:()=>Me(!ut),className:"flex h-5 min-w-0 items-center gap-1 rounded px-1.5 text-xs text-gray-600 transition-colors duration-150 hover:bg-white/80 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white",children:[l.jsx("span",{className:"truncate",children:ga}),l.jsx("svg",{width:"9",height:"9",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3"})})]}),children:l.jsxs("div",{className:"px-3 py-2",children:[l.jsx("label",{htmlFor:"goal-budget-input",className:"block text-xs font-medium text-gray-700 dark:text-gray-200",children:x.chat.goalBudgetLabel}),l.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[l.jsx("input",{id:"goal-budget-input",autoFocus:!0,value:un,onChange:re=>_n(re.target.value),onFocus:re=>re.currentTarget.select(),onKeyDown:re=>{re.key==="Enter"&&(re.preventDefault(),re.stopPropagation(),yt())},placeholder:x.chat.goalBudgetPlaceholder,"aria-invalid":dn,"aria-describedby":"goal-budget-hint",title:dn?x.chat.goalBudgetInvalid:x.chat.goalBudgetHint,className:`min-w-0 flex-1 rounded-md border bg-white px-2 py-1 font-mono text-sm leading-5 placeholder:text-gray-400 focus:outline-none focus:ring-2 dark:bg-gray-950 dark:placeholder:text-gray-500 ${dn?"border-red-400 text-red-600 focus:border-red-500 focus:ring-red-400/20 dark:border-red-500 dark:text-red-400":"border-gray-300 text-gray-800 focus:border-gray-500 focus:ring-gray-400/20 dark:border-gray-700 dark:text-gray-100 dark:focus:border-gray-500"}`}),l.jsx("button",{type:"button","aria-label":x.chat.goalBudgetSave,title:x.chat.goalBudgetSave,disabled:dn,onClick:yt,className:"flex h-7 w-7 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:opacity-35 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-white",children:l.jsx(Pe,{d:"M5 12l4 4L19 6",size:14})})]}),l.jsx("p",{id:"goal-budget-hint",className:`mt-1.5 text-[11px] leading-4 ${dn?"text-red-500 dark:text-red-400":"text-gray-400 dark:text-gray-500"}`,children:dn?x.chat.goalBudgetInvalid:x.chat.goalBudgetHint})]})}),l.jsx("button",{type:"button","aria-label":x.chat.goalRemove,onClick:()=>_t(!1),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]}),Ee!==null&&l.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",...Ee.name&&Ee.name!==Ee.agentId?{title:Ee.name}:{},children:[l.jsxs("span",{className:"truncate",children:["@",Ee.agentId]}),l.jsx("button",{type:"button","aria-label":x.chat.mentionRemove,onClick:()=>{lt(null),H?.(null),$e.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:"×"})]}),We.map(re=>{const ye=B.find(Le=>Le.name===re);return l.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",...ye?{title:To(U,ye)}:{},children:[l.jsx(jp,{icon:ye?.icon,size:13,className:"shrink-0 text-gray-500 dark:text-gray-400"}),l.jsx("span",{className:"truncate",children:re}),l.jsx("button",{type:"button","aria-label":`${x.chat.skillRemove} ${re}`,onClick:()=>Dr(re),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},re)})]}),l.jsx("textarea",{ref:$e,rows:2,value:j,autoFocus:Q,onChange:re=>{const ye=re.target.value,Le=re.target.selectionStart??ye.length;K(ye),O?.(ye),tn(Le),be(0),ge(0),st(at=>{if(at===null)return null;const Bt=G1(ye,Le);return Bt&&Bt.start===at?at:null}),Be(at=>{if(at===null)return null;const Bt=P1(ye,Le);return Bt&&Bt.start===at?at:null})},onSelect:re=>tn(re.currentTarget.selectionStart??0),onKeyDown:Mt,onPaste:Gt,disabled:Z,placeholder:Z?x.chat.modelAuthDeadPlaceholder:mt&&za?Qt?x.chat.followUpPlaceholderShort:x.chat.followUpPlaceholder:mt&&r?Qt?x.chat.steerPlaceholderShort:x.chat.steerPlaceholder:Qt?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"}),l.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 text-xs",children:[l.jsxs("div",{className:"no-scrollbar flex min-w-0 flex-1 items-center gap-2 overflow-x-auto",children:[l.jsx("input",{ref:dr,type:"file",accept:"image/*",multiple:!0,disabled:Ke,className:"hidden",onChange:nn}),l.jsx(mR,{items:[{key:"image",icon:fR,label:x.chat.uploadImage,desc:P?x.chat.uploadImageDesc:x.chat.imagesAsPathHint,active:oe.length>0,disabled:Ke,onSelect:()=>dr.current?.click()},{key:"goal",icon:go,label:x.chat.goalMode,desc:x.chat.goalModeDesc,active:Ke,disabled:mt||ht||Se,onSelect:()=>_t(!Ke)}],footer:l.jsx(uR,{steerMode:Xt,onChangeSteerMode:Oa}),direction:h&&g?"down":"up"}),l.jsx(rR,{value:D,onChange:L,disabled:$,direction:h&&g?"down":"up"}),l.jsx(dR,{skills:B,selected:We,onToggle:Dr,disabled:mt||ht||Se,direction:h&&g?"down":"up"}),l.jsxs("span",{title:`${x.chat.slashHint} · ${x.chat.mentionHint}`,className:"hidden min-w-0 truncate text-gray-300 @lg:block dark:text-gray-600",children:[x.chat.slashHint," · ",x.chat.mentionHint]})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!g&&l.jsx(hR,{now:R,unknown:I,...A!==void 0?{window:A}:{}}),h&&g&&N&&l.jsx(K1,{value:w??null,onChange:N,disabled:Se}),!g&&M&&l.jsx(K1,{value:C??"",onChange:M,disabled:Se,direction:"up"}),h&&g?l.jsx(lR,{models:h,value:m,...k!==void 0?{defaultModel:k}:{},onChange:g,disabled:Se}):l.jsxs("span",{title:m?.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:[l.jsx(Mo,{provider:m?.provider??"custom",className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:(()=>{const re=h?.find(ye=>kt(ye,m));return re?Cp(re):m?.modelId??"…"})()})]}),l.jsx("button",{type:"button",title:Lt?x.chat.stop:mt?Hn:x.chat.send,"aria-label":Lt?x.chat.stop:mt?Hn:x.chat.send,disabled:Lt?!1:mt?!Qs:!ve,onClick:()=>Lt?void d():void Ot(),className:Lt?"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":"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:Lt?l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block",children:l.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})}):l.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:l.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]})]})]})]})}function p2({className:e}){return l.jsx("img",{src:"/penguin-logo.svg",alt:"","aria-hidden":!0,draggable:!1,className:`select-none ${e??"h-9 w-9 rounded-lg"}`})}let Lm=null,Dm=null,hu=null,Hl=null;const wh=new Set;function g2(e){const[n,r]=v.useState(Lm),[s,o]=v.useState(hu);return v.useEffect(()=>{const c=()=>{r(Lm),o(hu)};return wh.add(c),()=>{wh.delete(c)}},[]),v.useEffect(()=>{if(!e)return;let c=!1;return Dm??=l5().then(d=>(Lm=d,d)),Dm.then(d=>{c||r(d)}).catch(()=>{Dm=null}),Hl??=Xb().then(d=>(hu=d,d)),Hl.then(d=>{c||o(d)}).catch(()=>{Hl=null}),()=>{c=!0}},[e]),{version:n,update:s}}async function pR(){const e=Xb(!0).then(n=>(hu=n,n));Hl=e;try{return await e}catch(n){throw Hl===e&&(Hl=null),n}finally{for(const n of wh)n()}}const gR=["always-ask","read-only","allow-all","deny-all"],Bl=(e,n)=>`penguin.chatDraft.${e}.${n}`,x2=(e,n)=>`penguin.chatDraft.session.${e}.${n}`;function xR(e){if(!e)return{};try{const n=JSON.parse(e);if(typeof n!="object"||n===null)return{};const r=n,s={};if(typeof r.text=="string"&&(s.text=r.text),typeof r.agentId=="string"&&(s.agentId=r.agentId),typeof r.workspace=="string"&&(s.workspace=r.workspace),typeof r.modelRef=="object"&&r.modelRef!==null){const o=r.modelRef;typeof o.provider=="string"&&typeof o.modelId=="string"&&(s.modelRef={provider:o.provider,modelId:o.modelId})}if(typeof r.handoffAgentId=="string"&&(s.handoffAgentId=r.handoffAgentId),Array.isArray(r.skills)){const o=r.skills.filter(c=>typeof c=="string");o.length>0&&(s.skills=o)}return typeof r.approvalMode=="string"&&gR.includes(r.approvalMode)&&(s.approvalMode=r.approvalMode),s}catch{return{}}}function Wu(e,n=localStorage){try{return xR(n.getItem(e))}catch{return{}}}function xo(e,n,r=localStorage){try{r.setItem(e,JSON.stringify(n))}catch{}}function Tu(e,n=localStorage){try{n.removeItem(e)}catch{}}const yR=300;function Y1(e){try{return sessionStorage.getItem(`penguin.chatRouteApplied.${e}`)}catch{return null}}function Q1(e,n){try{sessionStorage.setItem(`penguin.chatRouteApplied.${e}`,n)}catch{}}const bR=[{id:"game",skills:["web-design"]},{id:"lol",skills:["web-design"]},{id:"rag",skills:["penguin-sdk","web-design"]}];function vR({projectId:e,models:n}){const r=pa(),s=ha(),{agents:o,currentAgent:c,setCurrentAgentId:d}=hn(),{add:f}=Ks(),m=$n().user?.userId??null,[h]=v.useState(()=>m?Wu(Bl(m,e)):{}),[g,y]=v.useState(h.agentId??c?.agentId??null),[k,w]=v.useState(h.workspace??""),[N,C]=v.useState(h.approvalMode??"allow-all"),[M,A]=v.useState(h.modelRef??null),[R,I]=v.useState(h.handoffAgentId??null),P=v.useRef(h.text??""),D=v.useRef(h.skills??[]),L=s.state,$=L?.agentId,Q=v.useRef(null);v.useEffect(()=>{if(o.length===0)return;const je=Ee=>!!Ee&&o.some(lt=>lt.agentId===Ee);if($&&Q.current!==s.key&&Y1("agentId")!==s.key&&(Q.current=s.key,Q1("agentId",s.key),je($))){y($);return}je(g)||y((o.find(Ee=>Ee.agentId==="default_agent")??o[0])?.agentId??null)},[o,g,s.key,$]);const W=L?.workspace,B=v.useRef(null);v.useEffect(()=>{W===void 0||B.current===s.key||Y1("workspace")===s.key||(B.current=s.key,Q1("workspace",s.key),w(W))},[s.key,W]),v.useEffect(()=>{if(!n||M&&n.models.some(Ee=>kt(Ee,M)))return;const je=n.models[0];A(n.defaultModel??(je?{provider:je.provider,modelId:je.modelId}:null))},[n,M]);const[V,q]=v.useState(null);v.useEffect(()=>{if(q(null),!g)return;let je=!1;return _h(e,g).then(Ee=>{je||q(Ee.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{je=!0}},[e,g]);const X=v.useRef(null);X.current=V;const te=v.useCallback(je=>{if(!g||!je)return;const Ee=X.current;q(je),Yb(e,g,{config:{model:{thinkingLevel:je}}}).catch(lt=>{q(Ee),gt(Ie(lt))})},[e,g]),[O,z]=v.useState([]),[H,Z]=v.useState(!1);v.useEffect(()=>{if(z(Ee=>Ee.length>0?[]:Ee),Z(!1),!g)return;let je=!1;return Ih(e,g).then(Ee=>{je||z(Ee.skills)}).catch(()=>{}).finally(()=>{je||Z(!0)}),()=>{je=!0}},[e,g]);const ce=v.useRef(null),E=v.useCallback(()=>{ce.current!==null&&(window.clearTimeout(ce.current),ce.current=null)},[]),T=v.useCallback(()=>{if(E(),!m)return;const je={text:P.current,workspace:k,approvalMode:N};g&&(je.agentId=g),M&&(je.modelRef=M),R&&(je.handoffAgentId=R),D.current.length>0&&(je.skills=D.current),xo(Bl(m,e),je)},[E,m,e,g,k,N,M,R]),U=v.useRef(T);v.useEffect(()=>{U.current=T,T()},[T]);const j=v.useCallback(je=>{P.current=je,E(),ce.current=window.setTimeout(()=>{ce.current=null,U.current()},yR)},[E]),K=v.useCallback(je=>{D.current=je,U.current()},[]);v.useEffect(()=>()=>{ce.current!==null&&(window.clearTimeout(ce.current),U.current())},[]);const se=v.useCallback(()=>{E(),D.current=[],m&&(M?xo(Bl(m,e),{modelRef:M}):Tu(Bl(m,e)))},[E,m,e,M]),oe=je=>{y(je.agentId),d(je.agentId)},pe=v.useRef(!1),[Se,ie]=v.useState(!1),he=v.useCallback(async(je,Ee=!1,lt=null)=>{if(!g||pe.current)return!1;pe.current=!0,ie(!0);let We=null;try{const ct={approvalMode:N};M&&(ct.modelId=M.modelId,ct.provider=M.provider),k.trim()&&(ct.workspace=k.trim());const St=await pu(e,g,ct);We=St.session.sessionId;const tn=await $l(We,{input:je,...lt?{goal:lt}:{}});return f(St.session),Ee||se(),r(`/chat/${tn.sessionId}`,{replace:!0}),!0}catch(ct){return We&&oo(We).catch(()=>{}),gt(Ie(ct,M?{modelId:M.modelId}:{})),!1}finally{pe.current=!1,ie(!1)}},[e,g,N,M,k,f,se,r]),[be,ze]=v.useState(null),st=v.useCallback(async je=>{if(be===null){ze(je.id);try{const Ee=je.skills.filter(lt=>O.some(We=>We.name===lt));await he([{type:"text",text:uu(Ee,x.chat.exampleTasks[je.id].prompt)}],!0)}finally{ze(null)}}},[be,O,he]),Ue=o.find(je=>je.agentId===g)??null,wt=v.useCallback(async(je,Ee)=>{if(!Ue||pe.current)return!1;pe.current=!0,ie(!0);const lt={type:"text",text:a2({agentId:Ue.agentId,...Ue.name!==void 0?{agentName:Ue.name}:{}})};let We=null;try{const ct=await pu(e,je.agentId,{approvalMode:N});We=ct.session.sessionId;const St=await $l(We,{input:[lt,...Ee]});return f(ct.session),se(),r(`/chat/${St.sessionId}`),!0}catch(ct){return We&&oo(We).catch(()=>{}),gt(Ie(ct,n?.defaultModel?{modelId:n.defaultModel.modelId}:{})),!1}finally{pe.current=!1,ie(!1)}},[e,Ue,N,f,se,r,n]),Yt=n?.models.find(je=>kt(je,M)),pn=Yt?.contextWindow,gn=Yt?.vision!==!1;return l.jsxs("div",{className:"anim-fade flex min-h-0 flex-1 flex-col overflow-y-auto px-3 py-6 md:px-4",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[l.jsxs("div",{className:"mb-10 text-center",children:[l.jsx(p2,{className:"mx-auto mb-1 h-36 w-36 rounded-3xl"}),l.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:x.appName}),l.jsx("p",{className:"mt-2 text-base text-gray-400 dark:text-gray-500",children:x.chat.draftSubtitle}),l.jsx(kR,{})]}),l.jsx(h2,{status:"idle",onSend:(je,Ee)=>he(je,!1,Ee),onStop:async()=>{},onCompact:async()=>{},modelRef:M,models:n?.models??[],onChangeModel:A,thinkingLevel:V,onChangeThinkingLevel:te,...n?.defaultModel!==void 0?{defaultModel:n.defaultModel}:{},...pn!==void 0?{contextWindow:pn}:{},contextNow:0,vision:gn,approvalMode:N,onChangeApprovalMode:C,modeSaving:!1,autoFocus:!0,agents:o,skills:O,...h.skills&&h.skills.length>0?{initialSkills:h.skills}:{},onSkillsChange:K,onHandoff:wt,initialText:h.text??"",onTextChange:j,...h.handoffAgentId?{initialHandoffTargetId:h.handoffAgentId}:{},onHandoffTargetChange:I}),l.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[l.jsx(wR,{agents:o,selected:Ue,onSelect:oe}),l.jsx(SR,{projectId:e,workspace:k,onChange:w})]}),l.jsx("div",{className:"mt-6 flex flex-col items-stretch gap-2",children:bR.map(je=>{const Ee=x.chat.exampleTasks[je.id];return l.jsxs("button",{type:"button",disabled:be!==null||Se||!H||!g||!n,onClick:()=>{st(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"?l.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:[l.jsx("path",{d:"M9 18V6l11-2v12",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("circle",{cx:"6.5",cy:"18",r:"2.5",strokeWidth:"1.7"}),l.jsx("circle",{cx:"17.5",cy:"16",r:"2.5",strokeWidth:"1.7"})]}):je.id==="game"?l.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:[l.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"}),l.jsx("path",{d:"M6.5 11h4M8.5 9v4M15 12h.01M18 10h.01",strokeWidth:"1.7",strokeLinecap:"round"})]}):l.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:[l.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"}),l.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"})]}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-sm font-medium text-gray-900 dark:text-gray-100",children:Ee.label}),l.jsx("span",{className:"line-clamp-2 text-xs text-gray-500 dark:text-gray-400",children:Ee.desc})]}),be===je.id?l.jsx("span",{className:"ml-1 shrink-0 text-xs text-gray-400",children:x.common.loading}):l.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:l.jsx("path",{d:"M5 12h14M13 6l6 6-6 6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})]},je.id)})})]}),l.jsx("div",{className:"flex-1"})]})}const X1="ml-1.5 inline-block rounded-full bg-[var(--accent-bg)] px-1.5 align-super text-[10px] font-medium leading-4 text-[var(--accent-fg)] transition-opacity duration-150 hover:opacity-80";function kR(){const{locale:e}=Qa(),{version:n,update:r}=g2(!0);if(n===null)return null;const s=n.buildDate;return l.jsxs("p",{className:"mt-1.5 text-xs text-gray-400 dark:text-gray-500",children:[`v${n.version}${s!==null?` · ${x.update.lastUpdated(Mv(s,e))}`:""}`,r!==null&&r.updateAvailable&&r.latestVersion!==null&&(r.releaseUrl!==null?l.jsx("a",{href:r.releaseUrl,target:"_blank",rel:"noopener noreferrer",title:x.update.newVersion(r.latestVersion),"aria-label":x.update.newVersion(r.latestVersion),className:X1,children:x.update.newVersionBadge}):l.jsx("span",{className:X1,children:x.update.newVersionBadge}))]})}const y2="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 wR({agents:e,selected:n,onSelect:r}){const[s,o]=v.useState(!1);return l.jsx(_a,{open:s,setOpen:o,menuClass:"left-0 top-full mt-1 w-72 max-w-[calc(100vw-2rem)] origin-top-left",button:l.jsxs("button",{type:"button",title:x.chat.chooseAgent,"aria-label":x.chat.chooseAgent,onClick:()=>o(!s),className:y2,children:[n?l.jsx(Ya,{id:n.agentId,name:Mn(n),size:16,className:"shrink-0 rounded"}):null,l.jsx("span",{className:"min-w-0 truncate",children:n?Mn(n):x.common.loading}),l.jsx(Un,{open:s,size:12,className:"shrink-0 text-gray-400"})]}),children:l.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.common.loading}),e.map(c=>{const d=c.agentId===n?.agentId;return l.jsxs("button",{type:"button","aria-pressed":d,onClick:()=>{r(c),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:[l.jsx(Ya,{id:c.agentId,name:Mn(c),size:20,className:"shrink-0 rounded"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.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:Mn(c)}),c.description&&l.jsx("span",{className:"block truncate text-[11px] text-gray-400 dark:text-gray-500",children:c.description})]}),l.jsx("span",{className:"w-4 shrink-0 text-center text-xs text-gray-500 dark:text-gray-400",children:d?"✓":""})]},c.agentId)})]})})}function SR({projectId:e,workspace:n,onChange:r}){const[s,o]=v.useState(!1),[c,d]=v.useState({right:!1}),f=v.useRef(!1),[m,h]=v.useState(null),[g,y]=v.useState(!1),[k,w]=v.useState(null),[N,C]=v.useState("");v.useEffect(()=>{C(m?.path??"")},[m]);const M=v.useCallback($=>{y(!0),w(null),Ty(e,$).then(h).catch(Q=>w(Ie(Q))).finally(()=>y(!1))},[e]),A=$=>{const Q=!s;if(Q){const W=$.currentTarget.getBoundingClientRect(),B=parseFloat(getComputedStyle(document.documentElement).fontSize),V=12,q=Math.min(20*B,window.innerWidth-2*B),X=window.innerWidth-V-W.left,te=W.right-V;X>=q?d({right:!1}):te>X?d({right:!0,...te<q?{maxWidth:te}:{}}):d({right:!1,maxWidth:X})}if(o(Q),Q&&!f.current){f.current=!0;const W=n.trim();M(W.startsWith("/")?W:"")}},R=async()=>{const $=N.trim();if(!$||$===m?.path){C(m?.path??"");return}try{h(await Ty(e,$))}catch{gt(x.chat.workspaceDirInvalid),C(m?.path??"")}},I=n.trim(),P=I?I.split("/").filter(Boolean).pop()??"/":x.chat.workspaceAuto,D=m?.parent??null,L=(m?.entries??[]).filter($=>!$.name.startsWith("."));return l.jsx(_a,{open:s,setOpen:o,menuClass:`top-full mt-1 w-80 max-w-[calc(100vw-2rem)] ${c.right?"right-0 origin-top-right":"left-0 origin-top-left"}`,...c.maxWidth!==void 0?{menuStyle:{maxWidth:c.maxWidth}}:{},button:l.jsxs("button",{type:"button",title:I?`${x.chat.workspace}:${I}`:x.chat.workspaceHint,"aria-label":x.chat.workspace,onClick:A,className:y2,children:[l.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:l.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"})}),l.jsx("span",{className:`min-w-0 truncate ${I?"font-mono":""}`,children:P}),l.jsx(Un,{open:s,size:12,className:"shrink-0 text-gray-400"})]}),children:l.jsxs("div",{className:"space-y-1.5 px-2.5 pb-2.5 pt-2",children:[l.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800",children:[l.jsxs("div",{className:"flex items-center gap-1.5 border-b border-gray-100 px-1.5 py-1 dark:border-gray-800",children:[l.jsx("input",{value:N,placeholder:"…","aria-label":x.chat.workspace,onChange:$=>C($.target.value),onBlur:()=>{R()},onKeyDown:$=>{$.key==="Enter"&&!$.nativeEvent.isComposing?($.preventDefault(),R()):$.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"}),l.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})]}),l.jsxs("ul",{className:"max-h-40 overflow-y-auto py-1",children:[D!==null&&l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>M(D),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]})}),L.map($=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>M($.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:[l.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:l.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"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:$.name})]})},$.path)),m&&L.length===0&&l.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:x.chat.workspaceNoSubdirs}),g&&l.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:x.common.loading}),k&&l.jsxs("li",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 text-xs text-red-500",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",title:k,children:k}),l.jsx("button",{type:"button",onClick:()=>M(""),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})]})]})]}),I&&l.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}),l.jsx("p",{className:"px-0.5 text-xs leading-5 text-gray-400 dark:text-gray-500",children:x.chat.workspaceHint})]})})}const Sh={damping:1,response:.35},Z1={damping:.8,response:.3};function jR(e,n,r,s,o){const c=2*Math.PI/s.response,d=c*c,f=2*s.damping*c;let m=e,h=n,g=Math.min(o,64);for(;g>0;){const y=Math.min(g,8)/1e3,k=-d*(m-r)-f*h;h+=k*y,m+=h*y,g-=8}return[m,h]}function J1(e,n,r){return Math.abs(e-r)<.5&&Math.abs(n)<5}function NR(e,n){let r=e,s=0,o=e,c=Sh,d,f=0,m=0;const h=()=>{f&&cancelAnimationFrame(f),f=0,m=0,d=void 0},g=y=>{const k=m?y-m:16;if(m=y,[r,s]=jR(r,s,o,c,k),J1(r,s,o)){r=o,s=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 s},animateTo(y,k,w){if(o=y,c=k,w?.velocity!==void 0&&(s=w.velocity),d=w?.onSettle,J1(r,s,o)){r=o,s=0,n(r);const N=d;d=void 0,N?.();return}f||(f=requestAnimationFrame(g))},stop(){return h(),[r,s]},set(y){h(),r=y,s=0,n(r)},dispose:h}}function CR(e,n=.998){return e/1e3*n/(1-n)}function TR(e,n,r=.55){return e*n*r/(n+r*Math.abs(e))}function MR(e,n){let r=n[0];for(const s of n)Math.abs(s-e)<Math.abs(r-e)&&(r=s);return r}const ER=.92,AR=.6;function RR(){const[e,n]=v.useState(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches);return v.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)"),s=o=>n(o.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),e}function b2({open:e,snap:n,onSnapChange:r,onClose:s,title:o,children:c}){const[d,f]=v.useState(e),m=v.useRef(null),h=v.useRef(null),g=v.useRef(null),y=v.useRef(0),k=v.useRef(!1),w=v.useRef(!1),N=v.useRef(null),C=v.useRef([]),M=v.useRef({pointerY:0,sheetY:0}),A=v.useRef(e);A.current=e;const R=v.useRef(null),I=RR(),P=v.useCallback(V=>{const q=y.current||1;m.current&&(m.current.style.transform=`translate3d(0, ${V}px, 0)`),h.current&&(h.current.style.opacity=String(Math.min(1,Math.max(0,1-V/q))))},[]),D=v.useCallback(V=>{const q=y.current;return V==="full"?0:q*(1-AR/ER)},[]);v.useEffect(()=>{e&&f(!0)},[e]),v.useLayoutEffect(()=>{if(!d)return;const V=m.current;V&&(y.current=V.offsetHeight,g.current||(g.current=NR(y.current,P),g.current.set(y.current)))},[d,P]),v.useEffect(()=>{if(!d)return;const V=g.current;if(V)if(e){if(w.current=!1,k.current)return;const q=D(n);if(N.current!==null&&Math.abs(N.current-q)<1)return;if(N.current=q,I){V.set(q);return}V.animateTo(q,Sh)}else{if(w.current=!0,N.current=y.current,I){f(!1);return}V.animateTo(y.current,Sh,{onSettle:()=>f(!1)})}},[d,e,n,I,D]),v.useEffect(()=>{d||(g.current?.dispose(),g.current=null,N.current=null,k.current=!1,w.current=!1)},[d]),v.useEffect(()=>()=>g.current?.dispose(),[]),v.useEffect(()=>{if(!d)return;const V=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=V}},[d]),v.useEffect(()=>{if(!d||!e)return;const V=q=>{q.key==="Escape"&&s()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[d,e,s]),v.useEffect(()=>{if(d)return R.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>R.current?.focus()},[d]),v.useEffect(()=>{if(!d)return;const V=()=>{const q=m.current;if(!q||(y.current=q.offsetHeight,k.current||w.current))return;const X=D(n);N.current=X,g.current?.set(X)};return window.addEventListener("resize",V),()=>window.removeEventListener("resize",V)},[d,n,D]);const L=V=>{if(w.current)return;const q=g.current;if(!q)return;V.currentTarget.setPointerCapture(V.pointerId);const[X]=q.stop();k.current=!0,M.current={pointerY:V.clientY,sheetY:X},C.current=[{y:V.clientY,t:performance.now()}]},$=V=>{if(!k.current)return;const q=g.current;if(!q)return;const X=M.current.sheetY+(V.clientY-M.current.pointerY),te=y.current,O=X<0?-TR(-X,te):Math.min(X,te);q.set(O);const z=performance.now(),H=C.current;for(H.push({y:V.clientY,t:z});H.length>2&&z-H[0].t>100;)H.shift()},Q=V=>{k.current=!1;const q=g.current;if(!q)return;const X=y.current,te=D("half"),O=A.current?q.value+CR(V):X,z=MR(O,[0,te,X]);if(N.current=z,z===X){if(w.current=!0,I){f(!1),s();return}q.animateTo(X,Z1,{velocity:V,onSettle:()=>{f(!1),s()}});return}q.animateTo(z,Z1,{velocity:V});const H=z===0?"full":"half";H!==n&&r?.(H)},W=()=>{if(!k.current)return;const V=C.current,q=V[V.length-1],X=V[0],te=q&&X?q.t-X.t:0;Q(te>0?(q.y-X.y)/te*1e3:0)},B=()=>{k.current&&Q(0)};return d?l.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":o,children:[l.jsx("div",{ref:h,className:`absolute inset-0 bg-black/45 ${I?"anim-fade":""}`,style:{opacity:0},onPointerDown:()=>s()}),l.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 ${I?"anim-fade":""}`,style:{transform:"translate3d(0, 100%, 0)"},children:[l.jsxs("div",{className:"shrink-0 cursor-grab touch-none select-none active:cursor-grabbing",onPointerDown:L,onPointerMove:$,onPointerUp:W,onPointerCancel:B,onLostPointerCapture:B,children:[l.jsx("div",{className:"mx-auto mt-2 h-1 w-9 rounded-full bg-gray-300 dark:bg-gray-600"}),l.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 pt-1.5",children:[l.jsx("span",{className:"text-base font-semibold",children:o??""}),l.jsx(Wh,{onClose:s,onPointerDown:V=>V.stopPropagation()})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]",children:c})]})]}):null}const _R=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"]),IR=new Set(["png","jpg","jpeg","gif","webp","svg"]),LR=new Set(["html","htm"]),Wc=256*1024,eb=64*1024,DR={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 OR(e){return DR[e]??"text"}function tb(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function Kc(e,n){return e===""?n:`${e}/${n}`}function nb(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}const ab=/^[a-z][a-z0-9+.-]*:/i;function rb(e,n){const r=n.startsWith("/")||e===""?[]:e.split("/");for(const s of n.split("/"))s===""||s==="."||(s===".."?r.pop():r.push(s));return r.join("/")}const Om="<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 zR(e){return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,n=>n+Om):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,n=>n+Om):Om+e}let Yc=0;function sb({session:e,openRequest:n,active:r,onPreviewOpen:s}){const{previewIsolated:o}=$n(),[c,d]=v.useState(""),[f,m]=v.useState(null),[h,g]=v.useState(null),[y,k]=v.useState(null),[w,N]=v.useState(!1),[C,M]=v.useState(null),[A,R]=v.useState(0),[I,P]=v.useState(!1),[D,L]=v.useState("rendered"),[$,Q]=v.useState(null),W=v.useRef(o);W.current=o,v.useEffect(()=>{let E=!1;return g(null),Yj(e.sessionId,c).then(T=>{E||m(T)}).catch(T=>{E||g(T instanceof Ka?T.message:x.files.loadFailed)}),()=>{E=!0}},[e.sessionId,c,A]);const[B,V]=v.useState(e.sessionId);B!==e.sessionId&&(V(e.sessionId),d(""),k(null),m(null),Q(null),Yc++);const q=v.useRef(r);v.useEffect(()=>{r&&!q.current&&R(E=>E+1),q.current=r},[r]);const X=v.useRef(s);X.current=s;const te=v.useCallback(async E=>{X.current?.();const T=E.includes("/")?E.slice(E.lastIndexOf("/")+1):E,U=tb(T),j=++Yc,K=pe=>{j===Yc&&k(pe)};if(L("rendered"),Q(null),IR.has(U)){K({path:E,name:T,kind:"image",nonce:j});return}if(U==="pdf"){K({path:E,name:T,kind:"pdf",nonce:j});return}const se=LR.has(U),oe=U==="md";if(!se&&!_R.has(U)){K({path:E,name:T,kind:"unsupported",nonce:j});return}if(se&&W.current){K({path:E,name:T,kind:"html",nonce:j});return}try{const pe=await fetch(is(e.sessionId,E),{credentials:"same-origin"});if(!pe.ok)throw new Error(String(pe.status));const Se=await pe.text(),ie=Se.length>Wc;oe&&Se.length>eb&&j===Yc&&L("source"),K({path:E,name:T,kind:se?"html":oe?"md":"text",content:ie?Se.slice(0,Wc):Se,truncated:ie,nonce:j})}catch{K({path:E,name:T,kind:"unsupported",nonce:j})}},[e.sessionId]);v.useEffect(()=>{if(y?.kind!=="html"||y.content!==void 0||D!=="source"&&o)return;const E=y.path;let T=!1;return Q(null),(async()=>{try{const U=await fetch(is(e.sessionId,E),{credentials:"same-origin"});if(!U.ok)throw new Error(String(U.status));const j=await U.text();if(T)return;const K=j.length>Wc;k(se=>se!==null&&se.kind==="html"&&se.path===E&&se.content===void 0?{...se,content:K?j.slice(0,Wc):j,truncated:K}:se)}catch{T||Q(x.files.loadFailed)}})(),()=>{T=!0}},[y,D,o,e.sessionId]);const O=v.useRef(null);v.useEffect(()=>{if(!n||O.current===n)return;O.current=n;const E=n.path,T=E.includes("/")?E.slice(0,E.lastIndexOf("/")):"";d(T),R(U=>U+1),te(E)},[n,te]);const z=E=>{te(Kc(c,E))},H=E=>{N(!0),g(null),(async()=>{try{for(const T of E){const U=await new Promise((j,K)=>{const se=new FileReader;se.onload=()=>{const oe=se.result;j(oe.slice(oe.indexOf(",")+1))},se.onerror=()=>K(new Error("read failed")),se.readAsDataURL(T)});await Qj(e.sessionId,Kc(c,T.name),U)}ua(x.files.uploaded),R(T=>T+1)}catch(T){gt(Ie(T))}finally{N(!1)}})()},Z=E=>{const T=E.target.files?[...E.target.files]:[];if(E.target.value="",T.length===0)return;const U=new Set((f?.entries??[]).map(K=>K.name)),j=T.filter(K=>U.has(K.name)).map(K=>K.name);j.length>0?M({files:T,clashes:j}):H(T)},ce=c===""?[]:c.split("/");return y!==null?l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[l.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:[l.jsxs("button",{type:"button",onClick:()=>{k(null),R(E=>E+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:[l.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:l.jsx("path",{d:"M15 18l-6-6 6-6"})}),x.files.backToList]}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm font-semibold",title:y.path,children:y.name}),(y.kind==="html"||y.kind==="md")&&l.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(([E,T])=>l.jsx("button",{type:"button",onClick:()=>L(E),className:`rounded px-2 py-0.5 text-xs transition-colors duration-150 ${D===E?"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:T},E))}),/\.html?$/i.test(y.name)&&l.jsxs("a",{href:Ey(e.sessionId,y.path),target:"_blank",rel:"noopener noreferrer",title:o?void 0:x.files.previewNotIsolatedHint,className:"inline-flex shrink-0 items-center gap-1 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,!o&&l.jsx("span",{"aria-label":x.files.previewNotIsolatedHint,className:"text-amber-600 dark:text-amber-500",children:"⚠"})]}),l.jsx("a",{href:is(e.sessionId,y.path,!0),download:y.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})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:y.kind==="image"?l.jsx("img",{src:is(e.sessionId,y.path),alt:y.name,className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):y.kind==="pdf"?l.jsx("iframe",{src:is(e.sessionId,y.path),title:y.name,className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 dark:border-gray-800"}):y.kind==="html"&&D==="rendered"?o?l.jsx("iframe",{src:Ey(e.sessionId,y.path),title:y.name,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads",className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 bg-white dark:border-gray-800"},y.nonce):y.content===void 0?$!==null?l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:$}):l.jsx(ar,{rows:6}):l.jsx("iframe",{srcDoc:zR(y.content),title:y.name,sandbox:"allow-scripts",className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 bg-white dark:border-gray-800"}):y.kind==="md"&&D==="rendered"?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"md-body text-base leading-relaxed text-gray-800 dark:text-gray-100",children:l.jsx(Vu,{remarkPlugins:[Gu],components:{img:({src:E,alt:T})=>l.jsx("img",{src:typeof E=="string"&&!ab.test(E)?is(e.sessionId,rb(nb(y.path),E)):E,alt:T??"",loading:"lazy",className:"max-w-full"}),a:({href:E,children:T})=>{if(typeof E!="string"||E.startsWith("#"))return l.jsx("a",{href:E,children:T});if(ab.test(E))return l.jsx("a",{href:E,target:"_blank",rel:"noreferrer",children:T});const U=rb(nb(y.path),E);return l.jsx("a",{href:is(e.sessionId,U),onClick:j=>{j.preventDefault(),te(U)},children:T})}},children:y.content??""})}),y.truncated&&l.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",x.files.previewTruncated]})]}):y.kind==="text"||y.kind==="html"||y.kind==="md"?y.content===void 0?$!==null?l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:$}):l.jsx(ar,{rows:6}):l.jsxs(l.Fragment,{children:[l.jsx(Kk,{language:OR(tb(y.name)),code:y.content,highlight:y.content.length<=eb}),y.truncated&&l.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",x.files.previewTruncated]})]}):l.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:x.files.previewUnsupported})})]}):l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[l.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:[l.jsx("button",{type:"button",onClick:()=>{d("")},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}),ce.map((E,T)=>l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),l.jsx("button",{type:"button",onClick:()=>d(ce.slice(0,T+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:E})]},T)),l.jsx("span",{className:"flex-1"}),l.jsx(_a,{open:I,setOpen:P,menuClass:"right-0 top-full mt-1 w-max max-w-72 origin-top-right",button:l.jsx(ke,{size:"sm",variant:I?"primary":"ghost",onClick:()=>P(E=>!E),children:x.files.details}),children:l.jsxs("div",{className:"px-3.5 py-2.5",children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.files.workspacePath}),l.jsx("p",{className:"mt-1 break-all font-mono text-xs leading-5",children:e.workspace})]})}),l.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>R(E=>E+1),children:x.files.refresh}),l.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:[l.jsx("input",{type:"file",multiple:!0,className:"sr-only",onChange:Z,disabled:w}),w?x.common.saving:x.files.upload]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:h?l.jsx("p",{className:"px-3 py-3 text-sm text-red-600 dark:text-red-400",children:h}):f===null?l.jsx(ar,{rows:6}):f.entries.length===0?l.jsx("p",{className:"px-3 py-3 text-sm text-gray-400",children:x.files.empty}):l.jsx("ul",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:f.entries.map(E=>l.jsx("li",{children:l.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:[l.jsxs("button",{type:"button",onClick:()=>E.kind==="dir"?d(Kc(c,E.name)):z(E.name),className:"flex min-w-0 flex-1 items-center gap-2 text-left",title:E.name,children:[l.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:E.kind==="dir"?l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:l.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"})}):l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:l.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:E.name})]}),l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400 dark:text-gray-500",children:E.kind==="file"?Jm(E.sizeBytes):""}),l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:block dark:text-gray-500",children:E.mtime?fa(E.mtime):""}),E.kind==="file"&&l.jsx("a",{href:is(e.sessionId,Kc(c,E.name),!0),download:E.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:l.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:l.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})})]})},E.name))})}),l.jsx(ma,{open:C!==null,title:x.files.overwriteTitle,tone:"primary",confirmLabel:x.files.upload,onClose:()=>M(null),onConfirm:()=>{C&&H(C.files),M(null)},children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.files.overwriteConfirm(C?.clashes.length??0)}),l.jsx("ul",{className:"max-h-40 overflow-y-auto rounded-md border border-gray-200 px-3 py-1.5 dark:border-gray-800",children:(C?.clashes??[]).map(E=>l.jsx("li",{className:"truncate py-0.5 font-mono text-xs",title:E,children:E},E))})]})})]})}function UR(){return l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function $R({session:e,panel:n}){return n.isDocked?l.jsxs(l.Fragment,{children:[n.open&&l.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"}`}),l.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:l.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[l.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:x.files.title}),l.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:l.jsx(UR,{})})]}),l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(sb,{session:e,openRequest:n.openRequest,active:n.open})})]})})]}):l.jsx(b2,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:x.files.title,children:l.jsx("div",{className:"flex h-full min-h-0 flex-col",children:l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(sb,{session:e,openRequest:n.openRequest,active:n.open,onPreviewOpen:()=>n.setSheetSnap("full")})})})})}const Ku=320,lb="(min-width: 1024px)",jh="penguin.filesPanelWidth";function Mu(e){return Math.max(Ku,Math.min(720,Math.round(e*.5)))}function v2(e){return Math.min(Mu(e),Math.max(Ku,Math.round(e*.34)))}function BR(){const e=Number(localStorage.getItem(jh));return!Number.isFinite(e)||e<=0?v2(window.innerWidth):Math.min(Mu(window.innerWidth),Math.max(Ku,Math.round(e)))}function HR(e){const[n,r]=v.useState(!1),[s,o]=v.useState("half"),[c,d]=v.useState(null),f=v.useCallback(I=>{I&&o("half"),r(I)},[]),[m,h]=v.useState(BR),g=v.useRef(m),[y,k]=v.useState(!1),[w,N]=v.useState(()=>window.matchMedia(lb).matches),C=v.useRef(null);v.useEffect(()=>{d(null)},[e]),v.useEffect(()=>{const I=window.matchMedia(lb),P=D=>N(D.matches);return I.addEventListener("change",P),()=>I.removeEventListener("change",P)},[]);const M=v.useCallback(I=>{o("full"),d({path:I})},[]);v.useEffect(()=>{if(!y)return;const I=D=>{const L=C.current?.getBoundingClientRect(),$=L?L.right:window.innerWidth,Q=Math.min(Mu(window.innerWidth),Math.max(Ku,$-D.clientX));g.current=Q,h(Q)},P=()=>{k(!1),localStorage.setItem(jh,String(Math.round(g.current)))};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",I),window.addEventListener("mouseup",P),()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",P)}},[y]);const A=v.useCallback(I=>{I.preventDefault(),k(!0)},[]),R=v.useCallback(()=>{const I=v2(window.innerWidth);g.current=I,h(I),localStorage.removeItem(jh)},[]);return v.useEffect(()=>{const I=()=>{h(P=>{const D=Math.min(P,Mu(window.innerWidth));return D!==P&&(g.current=D),D})};return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]),{open:n,setOpen:f,sheetSnap:s,setSheetSnap:o,browsePath:M,openRequest:c,isDocked:w,width:m,resizing:y,startResize:A,resetWidth:R,panelRef:C}}function PR({nodes:e,selectedId:n,labelFor:r,onSelect:s}){const o=c8(e);return l.jsx("div",{role:"group","aria-label":x.subagentPanel.topologyLabel,className:"overflow-x-auto",children:l.jsxs("div",{className:"relative",style:{width:o.width,height:o.height},children:[l.jsx("svg",{width:o.width,height:o.height,className:"absolute inset-0 text-gray-300 dark:text-gray-700","aria-hidden":!0,children:o.edges.map(c=>l.jsx("path",{d:c.path,fill:"none",stroke:"currentColor",strokeWidth:"1.5"},`${c.fromId}>${c.toId}`))}),o.nodes.map(({node:c,x:d,y:f})=>{const m=r(c),h=c.sessionId===n,g=c.running?x.subagentPanel.nodeRunning:x.subagentPanel.nodeDone;return l.jsxs("button",{type:"button","aria-label":`${m} · ${g}`,"aria-pressed":h,title:`${m} · ${g}`,onClick:()=>s(c),style:{left:d,top:f,width:mu,height:Ji},className:`absolute flex items-center gap-1.5 rounded-md border bg-white px-2 text-left transition-colors duration-150 dark:bg-gray-900 ${h?"border-brand-500 ring-1 ring-brand-500":"border-gray-200 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-700 dark:hover:border-gray-600 dark:hover:bg-gray-800/60"}`,children:[l.jsx(Ya,{id:c.agentId??c.sessionId,name:m,size:18}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-gray-700 dark:text-gray-300",children:m}),c.running?c.startedMs!==void 0&&l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:l.jsx(po,{sinceMs:c.startedMs})}):c.elapsedMs!==void 0&&l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:mn(c.elapsedMs)}),l.jsx(Co,{state:c.running?"running":"done",size:10})]},c.sessionId)})]})})}function qR({session:e,model:n,version:r,taskRunning:s,ctx:o,focusRequest:c,taskScope:d}){const{agents:f}=hn(),{sessions:m}=Ks(),[h,g]=v.useState(null);v.useEffect(()=>{c&&g({sessionId:c.sessionId,origin:c.origin})},[c]);const y=v.useMemo(()=>(d?l8(n,e.sessionId,s,d.anchorSessionId):null)??s8(n,e.sessionId,s),[n,r,e.sessionId,s,d]),k=y.find(D=>D.depth>0)??null,w=h??(k?{sessionId:k.sessionId,origin:k.origin}:null),N=D=>{if(D.depth===0){const L=f.find($=>$.agentId===e.agentId);return L?L.name?.length?L.name:L.agentId:e.agentId}return yh(D,f,m)??bh(D.sessionId)},C=w!==null&&w.origin.length===0,M=w?y.find(D=>D.sessionId===w.sessionId)??null:null,A=w&&!C?o8(n,w.origin):null,R=M?N(M):w?yh({sessionId:w.sessionId,agentId:A?.meta?.agentId??null},f,m)??x.chat.subagent:"",I=M?.running??!1,P=w?{...o,origin:w.origin,taskRunning:I}:null;return l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"shrink-0 border-b border-gray-200 px-3 pb-2 pt-1.5 dark:border-gray-800",children:[l.jsx("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:x.subagentPanel.topologyLabel}),y.length>1?l.jsx("div",{className:"max-h-48 overflow-y-auto",children:l.jsx(PR,{nodes:y,selectedId:w?.sessionId??null,labelFor:N,onSelect:D=>g({sessionId:D.sessionId,origin:D.origin})})}):l.jsx("p",{className:"py-1 text-xs text-gray-400 dark:text-gray-500",children:x.subagentPanel.empty})]}),w===null?l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(lr,{title:x.subagentPanel.empty})}):C?l.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-4",children:l.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:x.subagentPanel.mainSessionNote})}):A===null?l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(lr,{title:x.subagentPanel.empty})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-gray-100 px-3 py-1.5 dark:border-gray-800/60",children:[l.jsx(Ya,{id:A.meta?.agentId??w.sessionId,name:R,size:16}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-gray-700 dark:text-gray-300",children:R}),l.jsx("span",{title:w.sessionId,className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:bh(w.sessionId)}),I&&l.jsx(Co,{state:"running",size:10,label:x.chat.subagentRunning})]}),l.jsx("div",{className:"min-h-0 flex-1",children:P&&l.jsx(s2,{items:A.items,version:r,ctx:P},w.sessionId)})]})]})}function FR(){return l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function VR({session:e,panel:n,model:r,version:s,taskRunning:o,ctx:c}){const d=l.jsx(qR,{session:e,model:r,version:s,taskRunning:o,ctx:c,focusRequest:n.focusRequest,taskScope:n.taskScope},e.sessionId);return n.isDocked?l.jsxs(l.Fragment,{children:[n.open&&l.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"}`}),l.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:l.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[l.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:x.subagentPanel.title}),l.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:l.jsx(FR,{})})]}),l.jsx("div",{className:"min-h-0 flex-1",children:d})]})})]}):l.jsx(b2,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:x.subagentPanel.title,children:l.jsx("div",{className:"flex h-full min-h-0 flex-col",children:l.jsx("div",{className:"min-h-0 flex-1",children:d})})})}const Yu=320,ib="(min-width: 1024px)",Nh="penguin.subagentsPanelWidth";function GR(){return{sessionId:null,taskCount:0,autoOpenedAt:null}}function WR(e,n){const r=n.sessionId!==e.sessionId,s=!r&&n.taskCount>e.taskCount,o=!r&&n.taskCount<e.taskCount;return(r||n.taskCount!==e.taskCount)&&(e.sessionId=n.sessionId,e.taskCount=n.taskCount,e.autoOpenedAt=o?n.taskCount:null),n.liveSpawn&&e.autoOpenedAt!==e.taskCount?(e.autoOpenedAt=e.taskCount,"autoOpen"):r||s?"close":null}function Eu(e){return Math.max(Yu,Math.min(720,Math.round(e*.5)))}function k2(e){return Math.min(Eu(e),Math.max(Yu,Math.round(e*.34)))}function KR(){const e=Number(localStorage.getItem(Nh));return!Number.isFinite(e)||e<=0?k2(window.innerWidth):Math.min(Eu(window.innerWidth),Math.max(Yu,Math.round(e)))}function YR(e){const[n,r]=v.useState(!1),[s,o]=v.useState("half"),[c,d]=v.useState(null),[f,m]=v.useState(null),h=v.useCallback(D=>{D&&(o("half"),m(null)),r(D)},[]),[g,y]=v.useState(KR),k=v.useRef(g),[w,N]=v.useState(!1),[C,M]=v.useState(()=>window.matchMedia(ib).matches),A=v.useRef(null);v.useEffect(()=>{d(null),m(null)},[e]),v.useEffect(()=>{const D=window.matchMedia(ib),L=$=>M($.matches);return D.addEventListener("change",L),()=>D.removeEventListener("change",L)},[]);const R=v.useCallback((D,L)=>{o("full"),m({anchorSessionId:L[0]??D}),d({sessionId:D,origin:L})},[]);v.useEffect(()=>{if(!w)return;const D=$=>{const Q=A.current?.getBoundingClientRect(),W=Q?Q.right:window.innerWidth,B=Math.min(Eu(window.innerWidth),Math.max(Yu,W-$.clientX));k.current=B,y(B)},L=()=>{N(!1),localStorage.setItem(Nh,String(Math.round(k.current)))};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",D),window.addEventListener("mouseup",L),()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",L)}},[w]);const I=v.useCallback(D=>{D.preventDefault(),N(!0)},[]),P=v.useCallback(()=>{const D=k2(window.innerWidth);k.current=D,y(D),localStorage.removeItem(Nh)},[]);return v.useEffect(()=>{const D=()=>{y(L=>{const $=Math.min(L,Eu(window.innerWidth));return $!==L&&(k.current=$),$})};return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),{open:n,setOpen:h,sheetSnap:s,setSheetSnap:o,focusSubagent:R,focusRequest:c,taskScope:f,isDocked:C,width:g,resizing:w,startResize:I,resetWidth:P,panelRef:A}}const QR=300;function XR(e){const n=$n().user?.userId??null,r=n&&e?x2(n,e):null,s=v.useMemo(()=>r?Wu(r):{},[r]),o=v.useRef(s.text??""),c=v.useRef(s.handoffAgentId??null),d=v.useRef(s.skills??[]),f=v.useRef(null),m=v.useCallback(()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},[]),h=v.useCallback(()=>{if(m(),!r)return;const N=o.current,C=c.current,M=d.current;if(!N&&!C&&M.length===0){Tu(r);return}const A={text:N};C&&(A.handoffAgentId=C),M.length>0&&(A.skills=M),xo(r,A)},[m,r]);v.useEffect(()=>(o.current=s.text??"",c.current=s.handoffAgentId??null,d.current=s.skills??[],()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null,h())}),[s,h]);const g=v.useCallback(N=>{o.current=N,m(),f.current=window.setTimeout(()=>{f.current=null,h()},QR)},[m,h]),y=v.useCallback(N=>{c.current=N,h()},[h]),k=v.useCallback(N=>{d.current=N,h()},[h]),w=v.useCallback(()=>{m(),d.current=[],r&&Tu(r)},[m,r]);return{initial:s,onTextChange:g,onHandoffTargetChange:y,onSkillsChange:k,discard:w}}function zm(e){const n=e.lastIndexOf("-");if(n<=0)return null;const r=Number.parseInt(e.slice(n+1),10);return!Number.isInteger(r)||r<0?null:{epoch:e.slice(0,n),seq:r}}function ZR(e){const n=e.now??(()=>Date.now()),r=new Set,s=new Map;let o=du(r),c=!1,d="buffering",f=[],m=null,h=null,g=0,y=!1;const k=()=>{s.size!==0&&(s.clear(),e.onPendingChange())},w=(R,I)=>{if(Zh(R)&&R.payload.type==="approval_decision"&&s.delete(ql(R.origin,R.payload.tool_call_id))&&e.onPendingChange(),I&&!vu(R.payload)&&uC(I,R)){qv(o,R);return}ku(o,R,n())},N=R=>{switch(R.type){case"approval_request":{const I=R.toolCall.payload.tool_call_id,P={toolCall:R.toolCall};if(R.origin&&(P.origin=R.origin),s.set(ql(R.origin,I),P),!tC(o,R.origin,I)){const D={...R.toolCall};R.origin&&R.origin.length>0?D.origin=[...R.origin]:delete D.origin,ku(o,D,n()),e.onModelChange()}e.onPendingChange();return}case"task_state":{m=R.state,e.onTaskState(R.state),e.onQueuedFollowUps?.(R.queued??0),R.state==="idle"&&(ZN(o,n()),k(),e.onModelChange());return}case"resync_required":{C();return}case"credentials_updated":{o.lastAuthFailureMs=null,e.onModelChange();return}case"hello":return}},C=async()=>{g+=1,d="buffering",f=[],k(),await A(g,du(r))},M=(R,I)=>{const P=zm(I.cursor);if(!P)return R;const D=h===null?null:zm(h);if(D!==null&&D.epoch!==P.epoch)return R;const L=[],$=[];for(const W of R){const B=W.id===null?null:zm(W.id);B!==null&&B.epoch===P.epoch&&B.seq<=P.seq?(W.kind!=="omni"||!vu(W.msg.payload))&&L.push(W):$.push(W)}const Q=I.fragments.map(W=>({kind:"omni",msg:W,id:null,seeded:!0}));return[...L,...Q,...$]},A=async(R,I)=>{try{const{messages:P,live:D}=await e.loadMessages();if(c||R!==g)return;I&&(o=I);const L=o;XN(L,P,n());const $=cC(P,100),Q=D!==void 0?M(f,D):f;f=[];for(let W=0;W<Q.length;W+=1){const B=Q[W];if(B.kind==="omni"?w(B.msg,$):N(B.ev),c)return;if(R!==g){f.push(...Q.slice(W+1).filter(V=>V.kind!=="omni"||!V.seeded));return}}d="live",m==="idle"&&JN(L),y=!1,e.onError(null),e.onLoading(!1),e.onModelChange()}catch(P){if(c||R!==g)return;y=!0,e.onLoading(!1),e.onError(P instanceof Error?P.message:String(P))}};return{get model(){return o},get pendingApprovals(){return s},load:()=>(g+=1,A(g)),retry:async()=>{c||!y||(e.onError(null),e.onLoading(!0),g+=1,await A(g,du(r)))},handleOmni:(R,I=null)=>{if(!c){if(I!==null&&(h=I),d==="buffering"){f.push({kind:"omni",msg:R,id:I});return}w(R,null),e.onModelChange()}},handleServer:(R,I=null)=>{if(!c){if(I!==null&&(h=I),R.type==="session_title"){e.onSessionTitle?.(R.sessionId,R.title);return}if(R.type==="session_created"){e.onSessionCreated?.(R.sessionId);return}if(R.type==="goal_started"||R.type==="goal_round"||R.type==="goal_finished"){e.onGoalEvent?.(R);return}if(d==="buffering"){R.type==="task_state"&&(m=R.state,e.onTaskState(R.state),e.onQueuedFollowUps?.(R.queued??0)),f.push({kind:"server",ev:R,id:I});return}N(R)}},markLocalDecision:R=>{eC(o,R)},resolveApproval:R=>{s.delete(R)&&e.onPendingChange()},dispose:()=>{c=!0}}}const JR=120,e_=new Map;function t_(e,n,r,s){const[o,c]=v.useState(0),[d,f]=v.useState(!0),[m,h]=v.useState(n),[g,y]=v.useState(0),[k,w]=v.useState(null),[N,C]=v.useState(0),[M,A]=v.useState(null),R=v.useCallback(O=>{A(z=>O.type==="goal_started"?{objective:O.objective,status:"active",budget:O.budget,used:0,rounds:0}:O.type==="goal_round"?{objective:z?.objective??"",status:"active",budget:O.budget,used:O.used,rounds:O.round}:{objective:z?.objective??"",status:O.outcome,budget:z?.budget??-1,used:O.used,rounds:O.rounds})},[]),I=v.useRef(r);I.current=r;const P=v.useRef(s);P.current=s;const D=v.useRef(null),L=v.useRef(null);L.current===null&&(L.current=du());const $=v.useRef(null),Q=v.useRef(null),W=v.useRef(0),B=v.useCallback(()=>{if($.current!==null||Q.current!==null)return;const O=()=>{W.current=Date.now(),c(H=>H+1)},z=W.current+JR-Date.now();if(z>0){Q.current=window.setTimeout(()=>{Q.current=null,O()},z);return}$.current=requestAnimationFrame(()=>{$.current=null,O()})},[]);v.useEffect(()=>{if(!e){D.current?.dispose(),D.current=null,h("idle"),y(0),f(!1),w(null),A(null),C(ce=>ce+1),c(ce=>ce+1);return}c(ce=>ce+1),f(!0),w(null),h(n),A(null),y(0),C(ce=>ce+1);let O=!1;const z=()=>{Uj(e).then(ce=>{O||!ce.goal||ce.goal.status!=="active"||A(E=>E??ce.goal)}).catch(()=>{})},H=ZR({loadMessages:()=>zj(e),onTaskState:h,onQueuedFollowUps:y,onLoading:f,onError:w,onModelChange:B,onPendingChange:()=>C(ce=>ce+1),onSessionTitle:(ce,E)=>I.current?.(ce,E),onSessionCreated:()=>P.current?.(),onGoalEvent:R});D.current=H;const Z=Y4(e,{onOmniMessage:H.handleOmni,onServerEvent:H.handleServer,onOpen:z,onError:ce=>{ce&&ou().catch(()=>{})}});return H.load(),()=>{O=!0,H.dispose(),Z.close(),$.current!==null&&(cancelAnimationFrame($.current),$.current=null),Q.current!==null&&(window.clearTimeout(Q.current),Q.current=null)}},[e]);const V=v.useCallback(O=>{D.current?.markLocalDecision(O)},[]),q=v.useCallback(O=>{D.current?.resolveApproval(O)},[]),X=v.useCallback(()=>{D.current?.retry()},[]),te=v.useCallback(()=>{const O=D.current?.model;O&&O.lastAuthFailureMs!==null&&(O.lastAuthFailureMs=null,c(z=>z+1))},[]);return{model:D.current?.model??L.current,version:o,loading:d,taskState:m,queuedFollowUps:g,lastAuthFailureMs:(D.current?.model??L.current).lastAuthFailureMs,dismissModelAuthDead:te,pendingApprovals:D.current?.pendingApprovals??e_,markLocalDecision:V,resolveApproval:q,error:k,retry:X,goal:M}}const Qc={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 Um({icon:e,value:n,label:r}){return l.jsxs("span",{title:r,className:"flex shrink-0 items-center gap-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:[l.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:l.jsx("path",{d:e})}),n]})}function n_({stats:e,taskOpen:n,taskStartLocalMs:r}){const[s,o]=v.useState(()=>Date.now());return v.useEffect(()=>{if(!n)return;o(Date.now());const c=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(c)},[n]),n?l.jsx(l.Fragment,{children:Cv(GN(e,n,r,s))}):l.jsx(l.Fragment,{children:mn(e.sessionElapsedMs)})}function a_(e,n,r,s,o){const c=e.stats,d=e.taskOpen?Uv({cacheRead:c.taskCacheRead,cacheWrite:c.taskCacheWrite,output:c.taskOutput},s):null,f=d!=null&&(d>0||n!=null)?(n??0)+d:n;return{tokensText:ot(c.sessionTotal+c.subagentTotal),costText:f!=null?Ra(f,o):null,costUncosted:r,elapsedNode:l.jsx(n_,{stats:c,taskOpen:e.taskOpen,taskStartLocalMs:e.taskStartLocalMs})}}const rr="new";function r_(){const e=pa(),n=gv(),{currency:r}=Gs(),{currentProject:s,currentAgent:o,setCurrentAgentId:c,reloadAgents:d,agents:f}=hn(),m=s?.projectId??null,h=o?.agentId??null,{sessions:g,loading:y,reload:k,add:w,replace:N,setStatus:C,setTitle:M}=Ks(),[A,R]=v.useState(null),[I,P]=v.useState(!1),[D,L]=v.useState(!1),[$,Q]=v.useState(!1),[W,B]=v.useState(!1),[V,q]=v.useState(null),[X,te]=v.useState(""),O=n.sessionId??null,z=HR(O),H=YR(O),Z={...z,setOpen:ve=>{ve&&H.setOpen(!1),z.setOpen(ve)}},ce={...H,setOpen:ve=>{ve&&z.setOpen(!1),H.setOpen(ve)}},E=O===rr,T=E?null:g.find(ve=>ve.sessionId===O)??null,U=T?{provider:T.provider,modelId:T.modelId}:null;or(T?T.title??x.chat.defaultSessionTitle:x.nav.chat);const j=t_(T?.sessionId??null,T?.status??"idle",M,()=>{k()}),{initial:K,onTextChange:se,onHandoffTargetChange:oe,onSkillsChange:pe,discard:Se}=XR(T?.sessionId??null),ie=T?.sessionId??null,he=T?.agentId??null;v.useEffect(()=>{ie&&he&&c(he)},[ie,he,c]);const be=v.useRef(GR()),ze=r8(j.model.items),st=j.taskState!=="idle"&&i8(j.model);v.useEffect(()=>{const ve=WR(be.current,{sessionId:ie,taskCount:ze,liveSpawn:st});ve==="close"?H.setOpen(!1):ve==="autoOpen"&&H.isDocked&&!H.open&&!z.open&&H.setOpen(!0)},[ie,ze,st]);const[Ue,wt]=v.useState([]);v.useEffect(()=>{if(wt(Me=>Me.length>0?[]:Me),!m||!he)return;let ve=!1;return Ih(m,he).then(Me=>{ve||wt(Me.skills)}).catch(()=>{}),()=>{ve=!0}},[m,he]);const[Yt,pn]=v.useState("");v.useEffect(()=>{if(pn(""),!m||!he)return;let ve=!1;return _h(m,he).then(Me=>{ve||pn(Me.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{ve=!0}},[m,he]);const[gn,je]=v.useState(null);v.useEffect(()=>{if(E||!O||y||g.some(Me=>Me.sessionId===O))return;let ve=!1;return My(O).then(Me=>{ve||w(Me.session)},()=>{ve||je(O)}),()=>{ve=!0}},[E,O,y,g,w]),v.useEffect(()=>{if(y||E||O&&g.some(Me=>Me.sessionId===O)||O&&gn!==O)return;const ve=Sv(g);e(ve?`/chat/${ve.sessionId}`:`/chat/${rr}`,{replace:!0})},[y,E,O,gn,g,e]),v.useEffect(()=>{T&&C(T.sessionId,j.taskState)},[j.taskState,T,C]);const Ee=v.useRef(j.taskState);v.useEffect(()=>{const ve=Ee.current;Ee.current=j.taskState,ve!=="idle"&&j.taskState==="idle"&&(k(),d())},[j.taskState,k,d]);const lt=v.useRef(new Map);v.useEffect(()=>{R(null),P(!1),te(""),lt.current=new Map},[O]);const We=v.useCallback(async ve=>{const Me=T?.sessionId??null,xt=lt.current,yt=Me===null?[]:ve.filter(It=>!xt.has(It));if(Me!==null&&yt.length>0){const It=Xj(Me,yt).then(Xt=>new Set(Xt.existing)).catch(()=>null);for(const Xt of yt)xt.set(Xt,It.then(Da=>{if(Da===null)return xt.delete(Xt),!1;const Oa=Da.has(Xt);return xt.set(Xt,Oa),Oa}))}const _t=new Set;return await Promise.all(ve.map(async It=>{const Xt=xt.get(It);(Xt===!0||Xt instanceof Promise&&await Xt)&&_t.add(It)})),_t},[T?.sessionId]);v.useEffect(()=>{if(!m||!T||j.taskState!=="idle")return;let ve=!1;return Qb(m,{groupBy:"session",agentId:T.agentId}).then(Me=>{if(ve)return;const xt=Me.groups.find(yt=>yt.key===T.sessionId);R(xt?.cost??null),P(xt?.hasUncosted??!1)}).catch(()=>{}),()=>{ve=!0}},[m,T,j.taskState]),v.useEffect(()=>{if(!m)return;let ve=!1;return q(null),(async()=>{try{const Me=await _u(m);if(ve)return;q(Me);const{prefs:xt}=await vj();if(ve||xt.credentialGuideSeen)return;const yt=Me.models.find(It=>kt(It,Me.defaultModel));(!Me.defaultModel||!yt?.credential?.apiKeyMasked)&&L(!0),Wb({credentialGuideSeen:!0}).catch(()=>{})}catch{}})(),()=>{ve=!0}},[m]);const ct=v.useCallback(async(ve,Me)=>{Me!==ve&&(await k(),e(`/chat/${Me}`,{replace:!0}))},[k,e]),St=v.useCallback(async(ve,Me)=>{if(!T)return!1;try{const xt=await $l(T.sessionId,{input:ve,...Me?{goal:Me}:{},...X?{thinkingLevel:X}:{}});return Se(),await ct(T.sessionId,xt.sessionId),!0}catch(xt){return gt(Ie(xt,{modelId:T.modelId})),!1}},[T,X,Se,ct]),tn=v.useCallback(async(ve,Me)=>{if(!m||!T)return!1;const xt=await My(T.sessionId).then(It=>It.session.tracePath).catch(()=>{}),yt={type:"text",text:N8({sessionId:T.sessionId,...T.title!==void 0?{sessionTitle:T.title}:{},...xt!==void 0?{tracePath:xt}:{},workspace:T.workspace,prevProvider:T.provider,prevModelId:T.modelId})};let _t=null;try{const It=await pu(m,T.agentId,{provider:ve.provider,modelId:ve.modelId,workspace:T.workspace,approvalMode:T.approvalMode});_t=It.session.sessionId;const Xt=await $l(_t,{input:[yt,...Me]});return w(It.session),Se(),e(`/chat/${Xt.sessionId}`),!0}catch(It){return _t&&oo(_t).catch(()=>{}),gt(Ie(It,{modelId:ve.modelId})),!1}},[m,T,w,Se,e]),ue=v.useCallback(async(ve,Me)=>{if(!m||!o||!T)return!1;const xt={type:"text",text:a2({agentId:o.agentId,...o.name!==void 0?{agentName:o.name}:{},sessionId:T.sessionId,workspace:T.workspace,...T.title!==void 0?{sessionTitle:T.title}:{}})};let yt=null;try{const _t=await pu(m,ve.agentId,{approvalMode:T.approvalMode});yt=_t.session.sessionId;const It=await $l(yt,{input:[xt,...Me]});return w(_t.session),Se(),e(`/chat/${It.sessionId}`),!0}catch(_t){return yt&&oo(yt).catch(()=>{}),gt(Ie(_t,V?.defaultModel?{modelId:V.defaultModel.modelId}:{})),!1}},[m,o,T,w,Se,e,V]),ge=v.useCallback(async()=>{T&&await Bj(T.sessionId).catch(()=>{})},[T]),Ae=v.useCallback(async ve=>{if(!T)return!1;try{const Me=await $l(T.sessionId,{input:ve,queueIfBusy:!0});return Se(),await ct(T.sessionId,Me.sessionId),!0}catch(Me){return gt(Ie(Me,{modelId:T.modelId})),!1}},[T,Se,ct]),Be=v.useCallback(async ve=>{if(!T)return"failed";try{return await Pj(T.sessionId,{text:ve}),"queued"}catch(Me){return Me instanceof Ka&&Me.status===409?"not_running":(gt(Ie(Me,{modelId:T.modelId})),"failed")}},[T]),$e=v.useCallback(async(ve,Me,xt)=>{if(!T)return;j.markLocalDecision(ve);const yt=ql(xt,ve);try{await $j(T.sessionId,ve,{decision:Me}),j.resolveApproval(yt)}catch(_t){_t instanceof Ka&&_t.status===404&&j.resolveApproval(yt)}},[T,j]),Qt=v.useCallback(ve=>{!T||W||(B(!0),Wm(T.sessionId,{approvalMode:ve}).then(Me=>N(Me.session)).catch(Me=>{gt(Ie(Me))}).finally(()=>B(!1)))},[T,W,N]),mt=v.useCallback(async()=>{if(T)try{const ve=await qj(T.sessionId);await ct(T.sessionId,ve.sessionId)}catch(ve){gt(Ie(ve,{modelId:T.modelId}))}},[T,ct]),ht=v.useCallback(()=>{e(`/chat/${rr}`)},[e]),Ke=v.useCallback(()=>{e("/models")},[e]),Ft=V?.models.find(ve=>kt(ve,U))?.pricing,Ye={pendingApprovals:j.pendingApprovals,onApprove:$e,origin:[],taskRunning:j.taskState!=="idle",taskCost:ve=>Uv(ve.tokensByBucket,Ft),onRetryNow:()=>{T&&Hj(T.sessionId).catch(()=>{})},onGiveUp:()=>{ge()},onOpenFile:ve=>{Z.setOpen(!0),Z.browsePath(ve)},onOpenSubagent:(ve,Me)=>{ce.setOpen(!0),ce.focusSubagent(ve,[...Me,ve])},workspace:T?.workspace??null,statFiles:We},xn=[...j.pendingApprovals.keys()].some(ve=>!ve.startsWith(" "));if(!m||!h)return l.jsx("div",{className:"p-6",children:l.jsx(Pt,{className:"h-6 w-64"})});const ut=a_(j.model,A,I,Ft,r),Rn=V?.models.find(ve=>kt(ve,U)),un=Rn?.contextWindow,_n=Rn?.vision!==!1,In=T!==null&&!j.loading&&!j.error&&j.model.items.length===0,Bn=V?.updatedAt!==void 0?Date.parse(V.updatedAt):NaN,dn=KN(j.lastAuthFailureMs,Number.isFinite(Bn)?Bn:null),ga=T&&l.jsx(h2,{status:j.taskState,modelAuthDead:dn,onOpenModels:Ke,onRetryModelAuth:j.dismissModelAuthDead,onNewSession:ht,onSend:St,onSteer:Be,steeringDeliveredCount:j.model.items.filter(ve=>ve.kind==="user_steering").length,onQueueFollowUp:Ae,queuedFollowUps:j.queuedFollowUps,onStop:ge,onCompact:mt,modelRef:U,...V!==null?{models:V.models}:{},...V?.defaultModel!==void 0?{defaultModel:V.defaultModel}:{},onSwitchModel:tn,turnThinkingLevel:X||Yt,onChangeTurnThinkingLevel:te,...un!==void 0?{contextWindow:un}:{},contextNow:j.model.stats.contextNow,contextStale:j.model.stats.contextStale,vision:_n,approvalMode:T.approvalMode,onChangeApprovalMode:Qt,modeSaving:W,autoFocus:!0,agents:f,skills:Ue,...K.skills&&K.skills.length>0?{initialSkills:K.skills}:{},onSkillsChange:pe,onHandoff:ue,initialText:K.text??"",onTextChange:se,...K.handoffAgentId?{initialHandoffTargetId:K.handoffAgentId}:{},onHandoffTargetChange:oe});return l.jsxs("div",{className:"flex h-full flex-col bg-white dark:bg-gray-950",children:[T&&l.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:[l.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[l.jsx("h1",{className:"flex min-w-0 text-[15px] font-semibold",children:l.jsx(Ou,{text:T.title??x.chat.defaultSessionTitle})}),j.taskState==="running"&&l.jsxs("span",{title:x.chat.statusRunning,className:"flex shrink-0 items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400",children:[l.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500"}),l.jsx("span",{className:"hidden sm:inline",children:x.chat.statusRunning})]})]}),l.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[l.jsx(Um,{icon:Qc.tokens,value:ut.tokensText,label:`${x.chat.statTokens}(Token)`}),ut.costText!=null&&l.jsx(Um,{icon:Qc.cost,value:`${ut.costText}${ut.costUncosted?" *":""}`,label:`${x.common.cost}(${r})${ut.costUncosted?` · ${x.usage.uncostedNote}`:""}`}),l.jsx(Um,{icon:Qc.elapsed,value:ut.elapsedNode,label:x.chat.statElapsed})]}),l.jsxs("button",{type:"button","aria-expanded":ce.open,onClick:()=>ce.setOpen(!ce.open),title:x.chat.openAgents,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors duration-150 ${ce.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:[l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:[l.jsx("circle",{cx:"5",cy:"12",r:"2.5"}),l.jsx("circle",{cx:"19",cy:"5.5",r:"2.5"}),l.jsx("circle",{cx:"19",cy:"18.5",r:"2.5"}),l.jsx("path",{d:"M7.4 11 16.7 6.6M7.4 13l9.3 4.4"})]}),x.chat.openAgents,xn&&l.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-amber-500"})]}),l.jsxs("button",{type:"button","aria-expanded":Z.open,onClick:()=>Z.setOpen(!Z.open),title:x.chat.openWorkspace,"aria-label":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 ${Z.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:[l.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:l.jsx("path",{d:Qc.folder})}),l.jsx("span",{className:"hidden sm:inline",children:x.chat.openWorkspace})]}),l.jsx(_a,{open:$,setOpen:Q,menuClass:"right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] origin-top-right",button:l.jsx("button",{type:"button",title:x.chat.infoPanel,onClick:()=>Q(!$),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:l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("path",{d:"M12 11v5m0-8h.01"})]})}),children:l.jsxs("div",{className:"space-y-3 px-3.5 py-2.5 text-sm",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.model}),l.jsxs("p",{className:"truncate text-xs",children:[l.jsx("span",{className:"font-mono",children:T.modelId}),l.jsx("span",{className:"ml-1.5 text-gray-400 dark:text-gray-500",children:Aa(T.provider)?.label??T.provider})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.workspace}),l.jsx("p",{className:"break-all font-mono text-xs leading-5",children:T.workspace})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.common.created}),l.jsx("p",{className:"font-mono text-xs",children:fa(T.createdAt)})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.sessionStats}),l.jsxs("p",{className:"font-mono text-xs",children:[x.chat.statTokens," ",ut.tokensText,ut.costText!=null&&` · ${x.common.cost} ${ut.costText}`," ·"," ",x.chat.statElapsed," ",ut.elapsedNode]})]})]})})]}),l.jsxs("div",{className:"flex min-h-0 flex-1",children:[l.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:E?l.jsx(vR,{projectId:m,models:V},`draft:${m}`):l.jsx("div",{className:"anim-fade flex min-h-0 flex-1 flex-col",children:T?j.error?l.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6",children:[l.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400",children:[x.chat.historyLoadFailed,":",j.error]}),l.jsx(ke,{onClick:j.retry,children:x.common.retry})]}):j.loading?l.jsxs("div",{className:"space-y-3 p-6",children:[l.jsx(Pt,{className:"h-5 w-1/3"}),l.jsx(Pt,{className:"h-5 w-2/3"}),l.jsx(Pt,{className:"h-5 w-1/2"})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"min-h-0 flex-1",children:In?l.jsx("div",{className:"flex h-full items-center justify-center px-4",children:l.jsx("p",{className:"text-lg font-medium text-gray-400 dark:text-gray-500",children:x.chat.emptyGreeting})}):l.jsx(s2,{items:j.model.items,version:j.version,ctx:Ye})}),l.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:l.jsxs("div",{className:"mx-auto max-w-3xl",children:[j.goal&&l.jsx(x8,{goal:j.goal}),ga]})})]}):y?l.jsx("div",{className:"space-y-3 p-6",children:l.jsx(Pt,{className:"h-5 w-1/2"})}):l.jsx(lr,{title:x.chat.noSessions,action:l.jsx(ke,{onClick:ht,children:x.nav.newChat})})},T?.sessionId??"empty")}),T&&l.jsx(VR,{session:T,panel:ce,model:j.model,version:j.version,taskRunning:j.taskState!=="idle",ctx:Ye}),T&&l.jsx($R,{session:T,panel:Z})]}),l.jsx(kn,{open:D,title:x.project.noCredentialTitle,onClose:()=>L(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:()=>L(!1),children:x.project.later}),l.jsx(ke,{variant:"primary",onClick:()=>{L(!1),e("/models")},children:x.project.goToModels})]}),children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.project.noCredentialBody})})]})}const w2=/^[a-z][a-z0-9_]{1,63}$/,ob=/^[a-z][a-z0-9_]{1,31}$/,s_=/^[a-z0-9_]+$/,l_=64;function i_({open:e,onClose:n,onCreated:r}){const{user:s}=$n(),o=s&&!s.isAdmin?`${s.userId}-`:"",[c,d]=v.useState(""),[f,m]=v.useState(""),[h,g]=v.useState(void 0),[y,k]=v.useState(!1);v.useEffect(()=>{e&&(d(""),m(""),g(void 0))},[e]);const w=async()=>{const N=o+c.trim();if(!c.trim()){g(x.common.requiredField);return}if(!(o?s_.test(c.trim())&&N.length<=l_:w2.test(N))){g(o?x.project.idPrefixHint:x.project.idHint);return}k(!0),g(void 0);try{const M=await Cj({projectId:N,...f.trim()?{name:f.trim()}:{}});r(M.project.projectId)}catch(M){g(Ie(M))}finally{k(!1)}};return l.jsx(kn,{open:e,title:x.project.createTitle,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:n,children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:y,onClick:()=>{w()},children:x.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[o?l.jsxs("div",{children:[l.jsx(no,{required:!0,children:x.project.id}),l.jsxs("div",{className:"flex items-stretch",children:[l.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}),l.jsx(nt,{size:"sm",className:"rounded-l-none",value:c,invalid:!!h,onChange:N=>{d(N.target.value),g(void 0)},autoFocus:!0})]}),h?l.jsx(Bs,{children:h}):l.jsx(Lv,{children:x.project.idPrefixHint})]}):l.jsx(nt,{label:x.project.id,required:!0,size:"sm",value:c,error:h,onChange:N=>{d(N.target.value),g(void 0)},hint:x.project.idHint,autoFocus:!0}),l.jsx(nt,{label:x.project.name,size:"sm",value:f,onChange:N=>m(N.target.value)})]})})}function o_({open:e,onClose:n}){const{user:r}=$n(),{currentProject:s,setCurrentProjectId:o,projects:c,reloadProjects:d}=hn(),[f,m]=v.useState(null),[h,g]=v.useState(""),[y,k]=v.useState(null),[w,N]=v.useState(!1),C=s?.projectId,M=s?.role==="owner";if(v.useEffect(()=>{!e||!C||(m(null),k(null),N(!1),cm(C).then(P=>m(P.members)).catch(P=>k(Ie(P))))},[e,C]),!s||!C)return null;const A=async()=>{if(h.trim())try{await Mj(C,{userId:h.trim()}),g("");const P=await cm(C);m(P.members)}catch(P){gt(Ie(P))}},R=async P=>{try{await Ej(C,P);const D=await cm(C);m(D.members)}catch(D){gt(Ie(D))}},I=async()=>{try{await Tj(C),n();const P=c.find(D=>D.projectId!==C);await d(),P&&o(P.projectId)}catch(P){gt(Ie(P))}};return l.jsxs(kn,{open:e,title:x.project.settingsTitle,onClose:n,children:[l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.project.switcher}),l.jsxs("p",{className:"text-sm",children:[Xm(s)," ",l.jsx("span",{className:"font-mono text-xs text-gray-400",children:C})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500",children:x.project.members}),y?l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:y}):f===null?l.jsx("p",{className:"text-xs text-gray-400",children:x.common.loading}):l.jsx("div",{className:"overflow-x-auto rounded-md border border-gray-200 dark:border-gray-800",children:l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{children:l.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:[l.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:x.common.username}),l.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:x.common.role}),l.jsx("th",{className:"w-20 whitespace-nowrap px-2.5 py-1.5 text-right font-medium",children:x.common.actions})]})}),l.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[f.map(P=>l.jsxs("tr",{children:[l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:P.userId}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:l.jsx(qt,{tone:"gray",children:P.role})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:M&&P.role!=="owner"&&P.userId!==r?.userId&&l.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>{R(P.userId)},children:x.project.removeMember})})]},P.userId)),M&&l.jsxs("tr",{children:[l.jsx("td",{className:"px-2.5 py-1.5",children:l.jsx(nt,{placeholder:x.common.username,size:"sm",value:h,onChange:P=>g(P.target.value),onKeyDown:P=>{P.key==="Enter"&&A()}})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:l.jsx(qt,{tone:"gray",children:"member"})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:l.jsx(ke,{size:"sm",disabled:!h.trim(),onClick:()=>{A()},children:x.project.addMember})})]})]})]})})]}),M&&l.jsx("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:C==="default_project"?l.jsx("p",{className:"text-xs text-gray-400",children:x.project.deleteDefaultForbidden}):c.length<=1?l.jsx("p",{className:"text-xs text-gray-400",children:x.project.deleteLastForbidden}):l.jsx(ke,{size:"sm",variant:"danger",onClick:()=>N(!0),children:x.project.deleteProject})})]}),l.jsx(ma,{open:w,title:x.project.deleteProject,onClose:()=>N(!1),onConfirm:()=>{I()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.project.deleteConfirm})})]})}const c_="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",u_="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 ms({label:e,hint:n,error:r,invalid:s,required:o,size:c="base",className:d,...f}){const[m,h]=v.useState(!1),g=m?x.auth.hidePassword:x.auth.showPassword,y=v.useId();return l.jsx(ko,{label:e,hint:n,error:r,errorId:y,required:o,children:l.jsxs("div",{className:"relative",children:[l.jsx(nt,{...f,required:o,size:c,type:m?"text":"password",invalid:!!r||!!s,"aria-describedby":r?y:void 0,className:`${c==="sm"?"pr-8":"pr-10"} ${d??""}`}),l.jsx("button",{type:"button","aria-label":g,title:g,tabIndex:-1,onClick:()=>h(k=>!k),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 ${c==="sm"?"w-8":"w-10"}`,children:l.jsx("svg",{width:c==="sm"?14:16,height:c==="sm"?14:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:m?u_:c_})})})]})})}function S2({open:e,onClose:n}){const{refresh:r}=$n(),[s,o]=v.useState(""),[c,d]=v.useState(""),[f,m]=v.useState(""),[h,g]=v.useState({}),[y,k]=v.useState(!1),w=()=>g(C=>C.old||C.new||C.confirm?{}:C);v.useEffect(()=>{e&&(o(""),d(""),m(""),g({}))},[e]);const N=async()=>{const C={};if(s||(C.old=x.common.requiredField),c||(C.new=x.common.requiredField),f||(C.confirm=x.common.requiredField),!C.confirm&&c!==f&&(C.confirm=x.account.passwordMismatch),C.old||C.new||C.confirm){g(C);return}k(!0),g({});try{await bj({oldPassword:s,newPassword:c}),await r(),n()}catch(M){M instanceof Ka&&M.code==="invalid_password"?g({new:Ie(M)}):g({old:Ie(M)})}finally{k(!1)}};return l.jsx(kn,{open:e,title:x.account.changePassword,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:n,disabled:y,children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:y,onClick:()=>{N()},children:x.common.save})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(ms,{label:x.account.oldPassword,required:!0,size:"sm",value:s,onChange:C=>{o(C.target.value),w()},error:h.old,autoComplete:"current-password",hint:x.account.oldPasswordHint,autoFocus:!0}),l.jsx(ms,{label:x.account.newPassword,required:!0,size:"sm",value:c,onChange:C=>{d(C.target.value),w()},error:h.new,autoComplete:"new-password",hint:x.auth.passwordHint}),l.jsx(ms,{label:x.account.confirmPassword,required:!0,size:"sm",value:f,onChange:C=>{m(C.target.value),w()},error:h.confirm,autoComplete:"new-password"})]})})}function d_({open:e,onClose:n,latestVersion:r}){const[s,o]=v.useState("confirm"),[c,d]=v.useState(null);v.useEffect(()=>{e&&(o("confirm"),d(null))},[e]);const f=async()=>{o("running");try{d(await i5())}catch(h){d({status:"failed",output:Ie(h),needsRestart:!1})}o("done")},m=c===null?null:c.status==="updated"?{text:x.update.updated,className:"text-green-600 dark:text-green-400"}:c.status==="unsupported"?{text:x.update.unsupported,className:"text-amber-600 dark:text-amber-400"}:{text:x.update.failed,className:"text-red-600 dark:text-red-400"};return l.jsx(kn,{open:e,title:x.update.updateNow,onClose:s==="running"?()=>{}:n,footer:s==="done"?l.jsx(ke,{onClick:n,children:x.common.close}):l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:n,disabled:s==="running",children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:s==="running",onClick:()=>{f()},children:s==="running"?x.update.updating:x.update.updateNow})]}),children:s==="done"&&c!==null&&m!==null?l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:`text-sm font-medium ${m.className}`,children:m.text}),c.status==="updated"&&l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:x.update.restartHint}),c.output!==""&&l.jsx("pre",{className:"max-h-56 overflow-auto rounded-md bg-gray-100 p-3 text-xs leading-relaxed whitespace-pre-wrap text-gray-700 dark:bg-gray-800 dark:text-gray-300",children:c.output})]}):l.jsxs("div",{className:"space-y-2",children:[r!==null&&l.jsx("p",{className:"text-sm font-medium",children:x.update.newVersion(r)}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:x.update.confirmBody}),s==="running"&&l.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:x.update.updating})]})})}function Ma({d:e,size:n=16}){return l.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:l.jsx("path",{d:e})})}const ca={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"},j2="M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z",f_="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",cb="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",m_="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",h_="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",us="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",p_="ml-1.5 inline-block rounded-full bg-[var(--accent-bg)] px-1.5 align-super text-[10px] font-medium leading-4 text-[var(--accent-fg)] transition-opacity duration-150 hover:opacity-80",N2="penguin.sidebarGroupMode";function g_(){return localStorage.getItem(N2)==="agent"?"agent":"workspace"}const x_=e=>`penguin.sidebarCollapsedGroups.${e}`,y_=e=>`penguin.sidebarPinnedGroups.${e}`;function Xc(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 ub(e,n){if(e)try{localStorage.setItem(e,JSON.stringify([...n]))}catch{}}const Zc=(e,n)=>`${n}\0${e}`;function b_({session:e}){return e.status==="running"?l.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"?l.jsx("span",{title:x.chat.statusCompacting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}):null}function db({onNavigate:e,onCollapse:n}){const r=pa(),{user:s,logout:o}=$n(),{mode:c,setMode:d,fontScale:f,setFontScale:m,accent:h,setAccent:g,currency:y,setCurrency:k}=Gs(),{lang:w,locale:N,setLang:C}=Qa(),{projects:M,currentProject:A,setCurrentProjectId:R,reloadProjects:I,agents:P,currentAgent:D,setCurrentAgentId:L}=hn(),{sessions:$,byAgent:Q,countsByAgent:W,workspaceCountsByAgent:B,isLoadedFor:V,hasMoreFor:q,loadMoreFor:X,loading:te,remove:O,replace:z}=Ks(),Z=hv("/chat/:sessionId")?.params.sessionId??null,[ce,E]=v.useState(!1),[T,U]=v.useState(!1),[j,K]=v.useState(!1),[se,oe]=v.useState(!1),[pe,Se]=v.useState(!1),[ie,he]=v.useState(!1),{version:be,update:ze}=g2(T),st=ze?.updateAvailable===!0,Ue=be?.buildDate??null,[wt,Yt]=v.useState(!1),pn=async()=>{if(!wt){Yt(!0);try{const ae=await pR();ae.disabled===!0?gs(x.update.checkDisabled):ae.error!==void 0?gt(x.update.checkFailed):ae.updateAvailable||ua(x.update.upToDate)}catch(ae){gt(Ie(ae))}finally{Yt(!1)}}},gn=A?.projectId??null,je=gn===null?null:x_(gn),Ee=gn===null?null:y_(gn),[lt,We]=v.useState(g_),[ct,St]=v.useState(()=>Xc(je)),[tn,ue]=v.useState(()=>Xc(Ee));v.useEffect(()=>{St(Xc(je)),ue(Xc(Ee))},[je,Ee]);const[ge,Ae]=v.useState(new Set),[Be,$e]=v.useState(new Set),[Qt,mt]=v.useState(new Map),[ht,Ke]=v.useState(null),[Ft,Ye]=v.useState(!1),[xn,ut]=v.useState(null),[Rn,un]=v.useState(""),[_n,In]=v.useState(!1),[Bn,dn]=v.useState(null),ga=ae=>{localStorage.setItem(N2,ae),We(ae)},ve=v.useMemo(()=>nN($),[$]),Me=v.useMemo(()=>tN(B),[B]),xt=v.useMemo(()=>qy(P,ae=>ae.agentId,tn),[P,tn]),yt=v.useMemo(()=>qy(ve,ae=>ae.key,tn),[ve,tn]),_t=ae=>lt==="agent"?ae.agentId:gu(ae.workspace),It=ae=>{const we=new Set(ct);we.has(ae)?we.delete(ae):we.add(ae),St(we),ub(je,we)},Xt=ae=>{const we=new Set(tn);we.has(ae)?we.delete(ae):we.add(ae),ue(we),ub(Ee,we)},Da=(ae,we)=>`${we}\0${ae}`,Oa=(ae,we,Fe)=>{const Qe=Da(ae,we);$e(Ot=>new Set(Ot).add(Qe)),X(Fe,we).finally(()=>{$e(Ot=>{const Mt=new Set(Ot);return Mt.delete(Qe),Mt})})},za=(ae,we,Fe)=>{const Qe=Zc(ae,we),Ot=!ge.has(Qe);if(Ae(Mt=>{const Zt=new Set(Mt);return Ot?Zt.add(Qe):Zt.delete(Qe),Zt}),Ot){const Mt=Fe.filter(Zt=>!V(Zt,we));Mt.length>0&&X(Mt,we)}},Lr=v.useRef(null);v.useEffect(()=>{if(!Z)return;const ae=$.find(Mt=>Mt.sessionId===Z);if(!ae)return;const we=Fa(ae);if(we==="active"||we==="archived")return;const Fe=`${lt}\0${Z}`;if(Lr.current===Fe)return;Lr.current=Fe;const Qe=lt==="agent"?ae.agentId:gu(ae.workspace),Ot=Zc(Qe,we);Ae(Mt=>Mt.has(Ot)?Mt:new Set(Mt).add(Ot)),V(ae.agentId,we)||X([ae.agentId],we)},[Z,$,lt,V,X]);const Qs=async ae=>{!ae.archived&&ae.sessionId===Z&&Ae(we=>new Set(we).add(Zc(_t(ae),"archived")));try{const we=await Wm(ae.sessionId,{archived:!ae.archived});z(we.session)}catch{}},Hn=async()=>{if(!xn)return;const ae=Rn.trim();if(ae){In(!0),dn(null);try{const we=await Wm(xn.sessionId,{title:ae});z(we.session),ut(null)}catch(we){dn(Ie(we))}finally{In(!1)}}},Lt=async()=>{if(!ht)return;Ye(!0);const ae=ht;try{if(await oo(ae.sessionId),O(ae.sessionId),s&&Tu(x2(s.userId,ae.sessionId)),Ke(null),Z===ae.sessionId){const we=(Q.get(ae.agentId)??[]).filter(Fe=>{const Qe=Fa(Fe);return Fe.sessionId!==ae.sessionId&&(Qe==="active"||Qe==="schedule")});r(we[0]?`/chat/${we[0].sessionId}`:"/chat")}}catch(we){gt(Ie(we))}finally{Ye(!1)}},Vt=ae=>{r(ae),e?.()},ea=(ae,we)=>{ae&&L(ae);const Fe={...ae?{agentId:ae}:{},...we!==void 0?{workspace:we}:{}};r(`/chat/${rr}`,Object.keys(Fe).length>0?{state:Fe}:void 0),e?.()},ur=(P.find(ae=>ae.agentId==="default_agent")??P[0])?.agentId,Dr=D?.agentId??ur,Xs=ae=>{L(ae.agentId),Vt(`/chat/${ae.sessionId}`)},Zs=v.useMemo(()=>new Map(P.map(ae=>[ae.agentId,Mn(ae)])),[P]),Pn=(ae,we)=>l.jsx("ul",{className:"space-y-0.5",children:ae.map(Fe=>l.jsx(v_,{s:Fe,active:Fe.sessionId===Z,...we?{agentHint:Zs.get(Fe.agentId)??Fe.agentId}:{},onOpen:Xs,onRename:Qe=>{dn(null),un(Qe.title??""),ut(Qe)},onDelete:Qe=>Ke(Qe),onToggleArchive:Qe=>{Qs(Qe)}},Fe.sessionId))}),Ln="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",qn=(ae,we,Fe,Qe,Ot,Mt)=>{const Zt=Fe[we],Gt=Math.max(Mt?.[we]??0,Zt.length);if(Gt===0)return null;const nn=ge.has(Zc(ae,we)),dr=Zt.length<Gt&&Ot.some(ye=>q(ye,we)),re=Be.has(Da(ae,we));return l.jsxs("div",{className:"mt-1",children:[l.jsxs("button",{type:"button",onClick:()=>za(ae,we,Ot),className:Ln,children:[l.jsx(Un,{open:nn,size:12}),x.chat.folderGroups[we](Gt)]}),nn&&Pn(Zt,Qe),nn&&dr&&l.jsxs("button",{type:"button","aria-label":x.chat.loadMore,disabled:re,onClick:()=>Oa(ae,we,Ot),className:`${Ln} disabled:opacity-60`,children:[l.jsx("span",{className:"w-3","aria-hidden":!0}),re?x.common.loading:x.chat.loadMore]})]},we)},xa=(ae,we)=>{mt(Fe=>{const Qe=new Map(Fe);return Qe.set(ae,(Fe.get(ae)??Us)+Us),Qe}),we.length>0&&Oa(ae,"active",we)},Dn=(ae,we,Fe,Qe,Ot)=>{const Mt=Qt.get(ae)??Us,Zt=we.active.slice(0,Mt),Gt=Ot("active"),nn=Math.max(Qe?.active??0,we.active.length),dr=we.active.length>Mt||we.active.length<nn&&Gt.some(at=>q(at,"active")),re=Vh.map(at=>qn(ae,at,we,Fe,Ot(at),Qe)),ye=we.active.length===0&&re.every(at=>at===null),Le=Be.has(Da(ae,"active"));return l.jsxs(l.Fragment,{children:[ye?l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):Pn(Zt,Fe),dr&&l.jsxs("button",{type:"button","aria-label":x.chat.loadMore,disabled:Le,onClick:()=>xa(ae,Gt),className:`${Ln} mt-0.5 disabled:opacity-60`,children:[l.jsx("span",{className:"w-3","aria-hidden":!0}),Le?x.common.loading:x.chat.loadMore]}),re]})},Cn=[{to:"/agents",label:x.nav.agents,icon:ca.agents},{to:"/skills",label:x.nav.skills,icon:ca.skills},{to:"/models",label:x.nav.models,icon:ca.models},{to:"/usage",label:x.nav.usage,icon:ca.usage},{to:"/traces",label:x.nav.traces,icon:ca.traces},{to:"/benchmark",label:x.nav.benchmark,icon:ca.benchmark}],Dt=[{value:"light",label:x.settings.themeLight},{value:"dark",label:x.settings.themeDark},{value:"system",label:x.settings.followSystem}],Or=[{value:"en",label:x.settings.langEn},{value:"zh",label:x.settings.langZh},{value:"system",label:x.settings.followSystem}],Js=[{value:"sm",label:x.settings.fontSmall},{value:"md",label:x.settings.fontMedium},{value:"lg",label:x.settings.fontLarge}],Ua=[{value:"USD",label:x.models.currencyUsd},{value:"CNY",label:x.models.currencyCny}];return l.jsxs("div",{className:"flex h-full w-full flex-col",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-2 pt-2",children:[n&&l.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:l.jsx(Ma,{d:"M15 6l-6 6 6 6M4 4v16",size:18})}),l.jsxs(_a,{open:ce,setOpen:E,className:"min-w-0 flex-1",menuClass:"left-0 right-0 top-full mt-1 origin-top",button:l.jsxs("button",{type:"button",onClick:()=>E(!ce),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:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:A?Xm(A):x.common.loading}),l.jsx("span",{className:"text-gray-400",children:l.jsx(Gh,{})})]}),children:[M.map(ae=>l.jsxs("button",{type:"button",onClick:()=>{R(ae.projectId),E(!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 ${ae.projectId===A?.projectId?"font-semibold":""}`,children:[l.jsx("span",{className:"truncate",children:Xm(ae)}),l.jsx(qt,{tone:"gray",children:ae.role})]},ae.projectId)),l.jsxs("div",{className:"mt-1.5 border-t border-gray-100 pt-1.5 dark:border-gray-800",children:[l.jsxs("button",{type:"button",className:us,onClick:()=>{E(!1),K(!0)},children:["+ ",x.project.create]}),A&&l.jsx("button",{type:"button",className:us,onClick:()=>{E(!1),oe(!0)},children:x.project.settings})]})]})]}),l.jsxs("nav",{className:"shrink-0 space-y-0.5 px-2 pt-2",children:[l.jsxs("button",{type:"button",onClick:()=>ea(ur),className:`flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors duration-150 ${Z===rr?"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:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:l.jsx(Ma,{d:j2})}),x.chat.newSessionMenu]}),Cn.map(ae=>l.jsxs(qh,{to:ae.to,onClick:()=>e?.(),className:({isActive:we})=>`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${we?"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:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:l.jsx(Ma,{d:ae.icon})}),ae.label]},ae.to))]}),l.jsxs("div",{className:"relative mt-3 min-h-0 flex-1 overflow-y-auto border-t border-gray-200 px-2 pb-2 dark:border-gray-800",children:[l.jsxs("div",{className:"flex items-center justify-between px-1 pt-2",children:[l.jsx("span",{className:"px-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:x.chat.sessionList}),l.jsx("div",{className:"flex items-center gap-0.5",children:[{value:"workspace",icon:cb,label:x.chat.groupByWorkspace},{value:"agent",icon:ca.agents,label:x.chat.groupByAgent}].map(ae=>l.jsx("button",{type:"button",title:ae.label,"aria-label":ae.label,"aria-pressed":lt===ae.value,onClick:()=>ga(ae.value),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150 ${lt===ae.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:l.jsx(Ma,{d:ae.icon,size:14})},ae.value))})]}),lt==="agent"?te&&P.length===0?l.jsx(ar,{rows:5}):xt.map(ae=>{const we=Py(Q.get(ae.agentId)??[]),Fe=ct.has(ae.agentId),Qe=tn.has(ae.agentId);return l.jsxs("div",{className:"pt-2.5",children:[l.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>It(ae.agentId),"aria-expanded":!Fe,"aria-label":Fe?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:[l.jsx(Ya,{id:ae.agentId,name:Mn(ae),size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:Mn(ae)}),l.jsx(Un,{open:!Fe,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),l.jsx(fb,{pinned:Qe,onToggle:()=>Xt(ae.agentId)}),l.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:()=>ea(ae.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:l.jsx(Ma,{d:"M12 5v14M5 12h14",size:18})}),l.jsx("button",{type:"button",title:x.agent.settings,onClick:()=>Vt(`/agents/${ae.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:l.jsx(Ma,{d:f_,size:16})})]}),Fe?null:Dn(ae.agentId,we,!1,W.get(ae.agentId),()=>[ae.agentId])]},ae.agentId)}):te&&$.length===0?l.jsx(ar,{rows:5}):yt.length===0?l.jsx("p",{className:"px-2.5 pt-3 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):yt.map(ae=>{const we=Py(ae.sessions),Fe=ct.has(ae.key),Qe=tn.has(ae.key),Ot=Me.get(ae.key),Mt=[...new Set(ae.sessions.map(Gt=>Gt.agentId))],Zt=Gt=>[...new Set([...Ot?.agents[Gt]??[],...Mt])];return l.jsxs("div",{className:"pt-2.5",children:[l.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>It(ae.key),"aria-expanded":!Fe,"aria-label":Fe?x.nav.expandGroup:x.nav.collapseGroup,...ae.fullPath!==null?{title:ae.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:[l.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:l.jsx(Ma,{d:Fe?cb:m_,size:15})}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-gray-500 dark:text-gray-400",children:ae.temp?x.chat.tempWorkspaces:ae.label}),l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:Math.max(Ot?.totals.active??0,we.active.length)}),l.jsx(Un,{open:!Fe,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),l.jsx(fb,{pinned:Qe,onToggle:()=>Xt(ae.key)}),l.jsx("button",{type:"button",title:x.chat.newSessionInWorkspace,"aria-label":x.chat.newSessionInWorkspace,onClick:()=>ea(Dr,ae.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:l.jsx(Ma,{d:"M12 5v14M5 12h14",size:18})})]}),Fe?null:Dn(ae.key,we,!0,Ot?.totals,Zt)]},ae.key)})]}),l.jsx("div",{className:"shrink-0 border-t border-gray-200 p-2 dark:border-gray-800",children:l.jsxs(_a,{open:T,setOpen:U,menuClass:"bottom-full left-0 right-0 mb-1 origin-bottom",button:l.jsxs("button",{type:"button",onClick:()=>U(!T),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:[l.jsxs("span",{className:"relative 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:[(s?.userId??"?").slice(0,1).toUpperCase(),st&&l.jsx("span",{"aria-hidden":!0,className:"absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full border-2 border-gray-50 bg-[var(--accent-bg)] dark:border-gray-900"})]}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s?.userId}),s?.isAdmin&&l.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.auth.admin})]}),children:[l.jsxs("div",{className:"space-y-2.5 px-3 py-2",children:[l.jsx(Wi,{label:x.settings.theme,children:l.jsx(Hs,{options:Dt,value:c,onChange:d})}),l.jsx(Wi,{label:x.settings.fontSize,children:l.jsx(Hs,{options:Js,value:f,onChange:m})}),l.jsx(Wi,{label:x.settings.accent,children:l.jsx(k_,{value:h,onChange:g})}),l.jsx(Wi,{label:x.models.currency,children:l.jsx(Hs,{options:Ua,value:y,onChange:k,cols:2})}),l.jsx(Wi,{label:x.settings.language,children:l.jsx(Hs,{options:Or,value:w,onChange:C})})]}),ze!==null&&ze.updateAvailable&&ze.latestVersion!==null&&l.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[ze.releaseUrl!==null?l.jsxs("a",{href:ze.releaseUrl,target:"_blank",rel:"noopener noreferrer",title:x.update.releaseNotes,className:`${us} flex items-center gap-2 font-medium`,children:[l.jsx("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full bg-[var(--accent-bg)]"}),x.update.newVersion(ze.latestVersion)]}):l.jsxs("span",{className:`${us} flex items-center gap-2 font-medium`,children:[l.jsx("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full bg-[var(--accent-bg)]"}),x.update.newVersion(ze.latestVersion)]}),s?.isAdmin&&l.jsx("button",{type:"button",className:us,onClick:()=>{U(!1),he(!0)},children:x.update.updateNow})]}),l.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[l.jsx("button",{type:"button",className:us,onClick:()=>{U(!1),Se(!0)},children:x.account.changePassword}),l.jsxs("button",{type:"button",disabled:wt,onClick:()=>{pn()},...Ue!==null?{title:x.update.lastUpdated(Mv(Ue,N))}:{},className:`${us} flex items-center justify-between gap-2 disabled:cursor-default disabled:opacity-60`,children:[l.jsx("span",{children:wt?x.update.checking:x.update.checkNow}),be!==null&&l.jsxs("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:[`v${be.version}`,ze!==null&&ze.updateAvailable&&ze.latestVersion!==null&&l.jsx("span",{className:p_,title:x.update.newVersion(ze.latestVersion),children:x.update.newVersionBadge})]})]}),s?.isAdmin&&l.jsx("button",{type:"button",className:us,onClick:()=>{U(!1),Vt("/admin/users")},children:x.admin.users}),l.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:()=>{U(!1),o().then(()=>r("/login"))},children:x.auth.logout})]})]})}),l.jsx(S2,{open:pe,onClose:()=>Se(!1)}),l.jsx(d_,{open:ie,onClose:()=>he(!1),latestVersion:ze?.latestVersion??null}),l.jsx(i_,{open:j,onClose:()=>K(!1),onCreated:ae=>{K(!1),I().then(()=>R(ae))}}),A&&l.jsx(o_,{open:se,onClose:()=>oe(!1)}),l.jsx(kn,{open:xn!==null,title:x.chat.renameSession,onClose:()=>_n?void 0:ut(null),footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:()=>ut(null),disabled:_n,children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:_n||!Rn.trim(),onClick:()=>{Hn()},children:x.common.save})]}),children:l.jsx(nt,{label:x.chat.renameSessionLabel,value:Rn,error:Bn??void 0,autoFocus:!0,maxLength:120,onChange:ae=>{un(ae.target.value),Bn&&dn(null)},onKeyDown:ae=>{ae.key==="Enter"&&Rn.trim()&&!_n&&Hn()}})}),l.jsx(ma,{open:ht!==null,title:x.chat.deleteSession,confirmLabel:x.common.delete,busy:Ft,onClose:()=>Ft?void 0:Ke(null),onConfirm:()=>{Lt()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:ht?x.chat.deleteSessionConfirm(ht.title??x.chat.defaultSessionTitle):""})})]})}function fb({pinned:e,onToggle:n}){return l.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:l.jsx(Ma,{d:h_,size:15})})}function v_({s:e,active:n,agentHint:r,onOpen:s,onRename:o,onDelete:c,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 l.jsx("li",{children:l.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:[l.jsxs("button",{type:"button",onClick:()=>s(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&&l.jsxs("span",{title:r,className:"flex shrink-0 items-center",children:[l.jsx(Ya,{id:e.agentId,name:r,size:14,className:"rounded"}),l.jsx("span",{className:"sr-only",children:r})]}),l.jsx(Ou,{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"}`}),l.jsx(b_,{session:e}),e.pendingApprovalCount>0&&l.jsx("span",{title:x.chat.pendingApprovals(e.pendingApprovalCount),children:l.jsx(qt,{tone:"amber",children:e.pendingApprovalCount})})]}),l.jsxs("div",{className:"flex shrink-0 items-center",children:[l.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:l.jsx(Ma,{d:"M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",size:14})}),l.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:l.jsx(Ma,{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})}),l.jsx("button",{type:"button",title:x.chat.deleteSession,"aria-label":x.chat.deleteSession,onClick:()=>c(e),className:`${f} hover:bg-gray-300/60 hover:text-red-600 dark:hover:bg-gray-700 dark:hover:text-red-400`,children:l.jsx(Ma,{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 Wi({label:e,children:n}){return l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-[11px] font-medium text-gray-500 dark:text-gray-400",children:e}),n]})}function k_({value:e,onChange:n}){return l.jsx("div",{className:"flex items-center gap-1.5",children:pj.map(r=>l.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 w_="M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5",$m=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 S_({onExpand:e}){const{user:n}=$n(),r=pa(),{agents:s,setCurrentAgentId:o}=hn(),{sessions:c,loading:d}=Ks(),f=hv("/chat/:sessionId")?.params.sessionId??null,m=f!==null&&f!==rr,h=v.useMemo(()=>Sv(c),[c]),g=()=>{h&&(o(h.agentId),r(`/chat/${h.sessionId}`))},y=()=>{const w=(s.find(N=>N.agentId==="default_agent")??s[0])?.agentId;w&&o(w),r(`/chat/${rr}`,w?{state:{agentId:w}}:void 0)},k=[{to:"/agents",label:x.nav.railAgents,icon:ca.agents},{to:"/skills",label:x.nav.skills,icon:ca.skills},{to:"/models",label:x.nav.models,icon:ca.models},{to:"/usage",label:x.nav.usage,icon:ca.usage},{to:"/traces",label:x.nav.traces,icon:ca.traces},{to:"/benchmark",label:x.nav.benchmark,icon:ca.benchmark}];return l.jsxs("div",{className:"flex h-full flex-col items-center gap-1 py-2.5",children:[l.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:l.jsx(Pe,{d:"M9 6l6 6-6 6M20 4v16",size:18})}),l.jsxs("nav",{className:"mt-1 flex flex-col items-center gap-1",children:[l.jsx("button",{type:"button",title:x.nav.lastConversation,"aria-label":x.nav.lastConversation,disabled:!h&&!d,onClick:g,className:h||d?$m(m):"flex h-8 w-8 cursor-not-allowed items-center justify-center rounded-md text-gray-300 dark:text-gray-700",children:l.jsx(Pe,{d:w_,size:18})}),l.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:y,className:$m(f===rr),children:l.jsx(Pe,{d:j2,size:18})}),k.map(w=>l.jsx(qh,{to:w.to,title:w.label,"aria-label":w.label,className:({isActive:N})=>$m(N),children:l.jsx(Pe,{d:w.icon,size:18})},w.to))]}),l.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 j_(){const{user:e}=$n(),[n,r]=v.useState(!1),[s,o]=v.useState(!1),[c,d]=v.useState(()=>localStorage.getItem("penguin.sidebarCollapsed")==="1"),f=()=>d(m=>{const h=!m;return localStorage.setItem("penguin.sidebarCollapsed",h?"1":"0"),h});return l.jsxs("div",{className:"flex h-full",children:[l.jsx("aside",{className:`hidden shrink-0 border-r border-gray-200 bg-gray-50 md:block dark:border-gray-800 dark:bg-gray-900 ${c?"w-12":"w-64 lg:w-72"}`,children:c?l.jsx(S_,{onExpand:f}):l.jsx(db,{onCollapse:f})}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[l.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:[l.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:l.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}),l.jsx("span",{className:"text-sm font-semibold",children:x.appName})]}),e?.passwordIsInitial&&l.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:[l.jsx("span",{children:x.account.initialPasswordBanner}),l.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})]}),l.jsx("main",{className:"min-h-0 flex-1 overflow-hidden",children:l.jsx(d4,{})})]}),l.jsx(S2,{open:s,onClose:()=>o(!1)}),l.jsx(lN,{open:n,side:"left",title:x.appName,onClose:()=>r(!1),children:l.jsx("div",{className:"h-full bg-gray-50 dark:bg-gray-900",children:l.jsx(db,{onNavigate:()=>r(!1)})})})]})}const Tp=1440,Mp=900,Ch=3,N_=3,mb=Tp/Ch,hb=Mp/N_,Jc=28,eu=14;function C_(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 T_(e,n){return e.x1-eu<=n.x2&&e.x2+eu>=n.x1&&e.y1-eu<=n.y2&&e.y2+eu>=n.y1}function M_(e,n,r,s){return{x1:Math.min(e,r),y1:Math.min(n,s),x2:Math.max(e,r),y2:Math.max(n,s)}}const E_=[{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 A_(){const e=C_(12696599),n=[];for(const{cell:r,edge:s}of E_){const o=r%Ch*mb+Jc,c=Math.floor(r/Ch)*hb+Jc,d=o+mb-2*Jc,f=c+hb-2*Jc,m=[],h=(I,P,D,L)=>{const $=D[0]>0?d-I:D[0]<0?I-o:D[1]>0?f-P:P-c;for(let Q=Math.min(60+e()*150,$);Q>=40;Q/=2){const W=Math.round(I+D[0]*Q),B=Math.round(P+D[1]*Q),V=M_(I,P,W,B);if(m.every((q,X)=>L.has(X)||!T_(V,q)))return m.push(V),[W,B]}return null},g=(I,P,D)=>(D-I)*(.35+e()*.3)>I-P?1:-1,y=(I,P,D,L,$,Q,W)=>{let[B,V]=[I,P],q=D;const X=[`M${Math.round(B)},${Math.round(V)}`],te=[];for(let O=0;O<L;O+=1){const z=O===0?W:new Set([m.length-1]),H=h(B,V,q,z);if(!H)break;[B,V]=H,X.push(`L${B},${V}`),te.push([B,V]),q=q[0]!==0?[0,g(V,c,f)]:[g(B,o,d),0]}return te.length>=2&&n.push({d:X.join(" "),end:te[te.length-1],dur:$,delay:Q}),te},k=.15+e()*.7,w=s==="left"?0:s==="right"?Tp:Math.round(o+(d-o)*k),N=s==="top"?0:s==="bottom"?Mp:Math.round(c+(f-c)*k),C=s==="left"?[1,0]:s==="right"?[-1,0]:s==="top"?[0,1]:[0,-1],M=12+e()*8,A=e()*3.2,R=y(w,N,C,3+Math.floor(e()*3),M,A,new Set);if(r%2===0&&R.length>=3){const[I,P]=R[1],[D,L]=R[2],$=[-Math.sign(D-I),-Math.sign(L-P)];y(I,P,$,2,M,A+1.4,new Set([1,2]))}}return n}const R_=A_();function __(){return l.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 ${Tp} ${Mp}`,preserveAspectRatio:"xMidYMid slice",fill:"none",children:R_.map((e,n)=>l.jsxs("g",{style:{"--trace-dur":`${e.dur.toFixed(1)}s`},children:[l.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`}}),l.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 I_(){or(x.auth.login);const{login:e}=$n(),{mode:n,setMode:r}=Gs(),{lang:s,setLang:o}=Qa(),c=pa(),[d,f]=v.useState(""),[m,h]=v.useState(""),[g,y]=v.useState({}),[k,w]=v.useState(!1),N=()=>y(R=>R.userId||R.password||R.form?{}:R),C=async()=>{const R={};if(d.trim()||(R.userId=x.common.requiredField),m||(R.password=x.common.requiredField),R.userId||R.password){y(R);return}w(!0),y({});try{await e(d.trim(),m),c("/chat",{replace:!0})}catch(I){y({form:Ie(I)})}finally{w(!1)}},M=[{value:"light",label:x.settings.themeLight},{value:"dark",label:x.settings.themeDark},{value:"system",label:x.settings.followSystem}],A=[{value:"en",label:x.settings.langEn},{value:"zh",label:x.settings.langZh},{value:"system",label:x.settings.followSystem}];return l.jsxs("div",{className:"relative flex min-h-full items-center justify-center overflow-hidden p-4",children:[l.jsx(__,{}),l.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:[l.jsx("div",{"aria-label":x.settings.language,children:l.jsx(Hs,{options:A,value:s,onChange:o})}),l.jsx("div",{"aria-label":x.settings.theme,children:l.jsx(Hs,{options:M,value:n,onChange:r})})]}),l.jsxs("div",{className:"anim-rise relative w-full max-w-sm",children:[l.jsx(p2,{className:"mx-auto mb-3 h-16 w-16 rounded-2xl"}),l.jsx("h1",{className:"mb-6 text-center text-3xl font-semibold tracking-tight",children:x.appName}),l.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("form",{className:"space-y-4",onSubmit:R=>{R.preventDefault(),C()},children:[l.jsx(nt,{label:x.common.username,required:!0,value:d,onChange:R=>{f(R.target.value),N()},error:g.userId,autoComplete:"username",autoFocus:!0}),l.jsx(ms,{label:x.auth.password,required:!0,value:m,onChange:R=>{h(R.target.value),N()},error:g.password,autoComplete:"current-password"}),g.form&&l.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.form}),l.jsx(ke,{type:"submit",variant:"primary",className:"w-full justify-center py-2.5 text-sm font-semibold",disabled:k,children:x.auth.login})]}),l.jsx("p",{className:"mt-4 text-center text-xs text-gray-400 dark:text-gray-500",children:x.auth.defaultAdminNote})]})]})]})}const Ki=100,ds=30,Ca=2;function L_({data:e,label:n,className:r=""}){const s=Math.max(1,...e),o=e.length>1?(Ki-2*Ca)/(e.length-1):0,c=e.map((h,g)=>[Ca+g*o,ds-Ca-h/s*(ds-2*Ca)]),d=`${Ca},${ds-Ca} ${Ki-Ca},${ds-Ca}`,f=c.length>1?c.map(([h,g])=>`${h},${g}`).join(" "):d,m=c.length>1?`${f} ${Ki-Ca},${ds-Ca} ${Ca},${ds-Ca}`:null;return l.jsxs("svg",{width:Ki,height:ds,viewBox:`0 0 ${Ki} ${ds}`,role:"img","aria-label":n,className:`text-emerald-600 dark:text-emerald-500 ${r}`,children:[l.jsx("title",{children:n}),m!==null&&l.jsx("polygon",{points:m,fill:"currentColor",fillOpacity:"0.12"}),l.jsx("polyline",{points:f,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const D_=new Set(["default_agent"]),tr={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 O_(){const e=pa();or(x.nav.agents);const{locale:n}=Qa(),{currentProject:r,agents:s,agentsLoading:o,reloadAgents:c,setCurrentAgentId:d}=hn(),[f,m]=v.useState(!1),[h,g]=v.useState(""),[y,k]=v.useState(""),[w,N]=v.useState(""),[C,M]=v.useState(void 0),[A,R]=v.useState(!1),I=()=>{g(""),k(""),N(""),M(void 0),m(!0)},[P,D]=v.useState(null),[L,$]=v.useState(null),Q=r?.projectId,W=async()=>{if(!Q)return;const q=h.trim();if(!q){M(x.common.requiredField);return}if(!w2.test(q)){M(x.agent.idHint);return}R(!0),M(void 0);try{const X={agentId:q};y.trim()&&(X.name=y.trim()),w.trim()&&(X.description=w.trim());const te=await Lj(Q,X);m(!1),await c(),d(te.agent.agentId),e(`/agents/${te.agent.agentId}`)}catch(X){M(Ie(X))}finally{R(!1)}},B=q=>{d(q),e(`/chat/${rr}`,{state:{agentId:q}})},V=async()=>{if(!(!Q||!P)){R(!0),$(null);try{await Kj(Q,P.agentId),D(null),await c()}catch(q){$(Ie(q))}finally{R(!1)}}};return l.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[l.jsxs("div",{className:"mx-auto max-w-5xl",children:[l.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[l.jsx("h1",{className:"text-xl font-semibold",children:x.agent.listTitle}),l.jsx(ke,{variant:"primary",onClick:I,children:x.agent.create})]}),o?l.jsx("div",{className:"space-y-3",children:Array.from({length:4},(q,X)=>l.jsxs(Ov,{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4",children:[l.jsxs("div",{className:"min-w-[14rem] flex-1",children:[l.jsx(Pt,{className:"h-[18px] w-40"}),l.jsx(Pt,{className:"mt-1.5 h-4 w-2/3"}),l.jsx(Pt,{className:"mt-1.5 h-4 w-48"})]}),l.jsx(Pt,{className:"hidden h-9 w-40 md:block"}),l.jsx(Pt,{className:"h-8 w-52"})]},X))}):s.length===0?l.jsx(lr,{title:x.common.none}):l.jsx("div",{className:"space-y-3",children:s.map(q=>{const X=D_.has(q.agentId);return l.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:[l.jsxs("div",{className:"min-w-[14rem] flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ya,{id:q.agentId,name:Mn(q),size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-base font-bold",children:Mn(q)}),l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500",children:q.agentId}),l.jsxs(qt,{tone:"gray",children:["v",q.version]}),q.activeSessionCount>0&&l.jsxs(qt,{tone:"brand",children:[x.agent.activeSessions," ",q.activeSessionCount]})]}),l.jsx("p",{className:"mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400",children:q.description??""}),l.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2.5 text-xs text-gray-500 dark:text-gray-400",children:[l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.sessionCount(q.sessionCount),children:[l.jsx(Pe,{d:tr.sessions,size:12}),q.sessionCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.toolCount(q.toolCount),children:[l.jsx(Pe,{d:cn.toolCalls,size:12}),q.toolCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.vaultKeyCount(q.vaultKeyCount),children:[l.jsx(Pe,{d:tr.vaultKeys,size:12}),q.vaultKeyCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.scheduleCount(q.scheduleCount),children:[l.jsx(Pe,{d:tr.schedules,size:12}),q.scheduleCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.skills.skillCount(q.skillCount),children:[l.jsx(Pe,{d:tr.skills,size:12}),q.skillCount]}),l.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${x.agent.updatedAt} ${q.updatedAt?fa(q.updatedAt):"—"}`,children:[l.jsx(Pe,{d:cn.elapsed,size:12}),q.updatedAt?oN(q.updatedAt,n):"—"]})]})]}),l.jsx(L_,{data:q.sessionActivity,label:x.agent.activity(q.sessionActivity.length||30),className:"hidden shrink-0 md:block"}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[l.jsxs(ke,{size:"sm",variant:"primary",onClick:()=>B(q.agentId),children:[l.jsx(Pe,{d:tr.newChat}),x.chat.newSessionMenu]}),l.jsxs(ke,{size:"sm",onClick:()=>{d(q.agentId),e(`/agents/${q.agentId}`)},children:[l.jsx(Pe,{d:tr.settings,className:"text-gray-600 dark:text-gray-300"}),x.common.settings]}),l.jsx(ke,{size:"icon",title:x.nav.usage,"aria-label":x.nav.usage,onClick:()=>e(`/usage?agentId=${encodeURIComponent(q.agentId)}`),children:l.jsx(Pe,{d:tr.usage,size:15,className:"text-gray-600 dark:text-gray-300"})}),l.jsx(ke,{size:"icon",title:x.nav.traces,"aria-label":x.nav.traces,onClick:()=>e(`/traces?agentId=${encodeURIComponent(q.agentId)}`),children:l.jsx(Pe,{d:tr.traces,size:15,className:"text-gray-600 dark:text-gray-300"})}),X?l.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:l.jsx(Pe,{d:tr.trash,size:15})}):l.jsx(ke,{size:"icon",variant:"danger",title:x.agent.deleteAgent,"aria-label":x.agent.deleteAgent,onClick:()=>D({agentId:q.agentId,name:Mn(q)}),children:l.jsx(Pe,{d:tr.trash,size:15})})]})]},q.agentId)})})]}),l.jsx(kn,{open:f,title:x.agent.createTitle,onClose:()=>m(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:()=>m(!1),children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:A,onClick:()=>{W()},children:x.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(nt,{label:x.agent.id,required:!0,size:"sm",value:h,onChange:q=>{g(q.target.value),M(void 0)},error:C,hint:x.agent.idHint,autoFocus:!0}),l.jsx(nt,{label:x.common.name,size:"sm",value:y,onChange:q=>k(q.target.value),hint:x.agent.nameHint}),l.jsx(Pl,{label:x.agent.description,size:"sm",rows:3,value:w,onChange:q=>N(q.target.value)})]})}),l.jsxs(ma,{open:P!==null,title:x.agent.deleteAgent,busy:A,onClose:()=>{D(null),$(null)},onConfirm:()=>{V()},children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:P?x.agent.deleteConfirm(P.name):""}),L&&l.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:L})]})]})}function z_({items:e,active:n,onChange:r}){return l.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(s=>l.jsx("button",{type:"button",role:"tab","aria-selected":s.key===n,onClick:()=>r(s.key),className:`-mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors duration-150 ${s.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:s.label},s.key))})}const pb=4,gb=16;function C2({open:e,onClose:n,estimatedHeight:r,panelWidth:s}){const o=v.useRef(null),c=v.useRef(null),[d,f]=v.useState(null),m=v.useRef(n);return m.current=n,v.useLayoutEffect(()=>{if(!e||!o.current)return;const h=o.current.getBoundingClientRect(),g=window.innerHeight-h.bottom,y=h.top,k=Math.min(r,window.innerHeight*.7),w=g<k&&y>g,N=s??h.width,C=Math.max(gb,Math.min(h.left,window.innerWidth-N-gb));f({topPx:w?void 0:h.bottom+pb,bottomPx:w?window.innerHeight-h.top+pb:void 0,left:C,triggerWidth:h.width})},[e,r,s]),v.useEffect(()=>{if(!e)return;const h=w=>{const N=w.target;o.current?.contains(N)||c.current?.contains(N)||m.current()},g=w=>{w.key==="Escape"&&(w.stopPropagation(),m.current())},y=w=>{c.current?.contains(w.target)||m.current()},k=()=>m.current();return window.addEventListener("mousedown",h),window.addEventListener("keydown",g,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",g,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",k)}},[e]),{triggerRef:o,panelRef:c,position:d}}const U_=288,$_={base:"text-base",sm:"text-xs"},B_={base:"text-xs",sm:"text-[11px]"};function Th({options:e,value:n,onChange:r,placeholder:s,mono:o,label:c,error:d,required:f,fullWidth:m,size:h="base","aria-label":g}){const[y,k]=v.useState(!1),{triggerRef:w,panelRef:N,position:C}=C2({open:y,onClose:()=>k(!1),estimatedHeight:e.length*48+16,panelWidth:U_}),M=n!=null?e.find(I=>I.value===n):void 0,A=v.useId(),R=l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:w,type:"button","aria-label":g,"aria-haspopup":"listbox","aria-expanded":y,"aria-required":f||void 0,"aria-invalid":d?!0:void 0,"aria-describedby":d?A:void 0,onClick:()=>k(I=>!I),className:`flex items-center gap-2 ${Qh} ${Xh[h]} ${d?Uu:""}`+(m?" w-full justify-between":""),children:[l.jsx("span",{className:`min-w-0 truncate ${o?"font-mono":""}`,children:M?.triggerLabel??s??"—"}),l.jsx(Gh,{className:"text-gray-400"})]}),y&&C&&Wl.createPortal(l.jsx("div",{ref:N,role:"listbox",style:{position:"fixed",top:C.topPx,bottom:C.bottomPx,left:C.left,minWidth:C.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(I=>l.jsxs("button",{type:"button",role:"option","aria-selected":I.value===n,onClick:()=>{r(I.value),k(!1)},className:`block ${Iv} hover:bg-gray-100 dark:hover:bg-gray-800 ${I.value===n?"bg-gray-100 dark:bg-gray-800":""}`,children:[l.jsxs("span",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:`${$_[h]} ${I.value===n?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:I.label}),I.value===n&&l.jsx(Nv,{className:"text-gray-500 dark:text-gray-400"})]}),l.jsx("span",{className:`mt-0.5 block ${B_[h]} text-gray-500 dark:text-gray-400`,children:I.description})]},I.value))}),document.body)]});return l.jsx(ko,{label:c,error:d,errorId:A,required:f,children:R})}function T2({checked:e,onChange:n,disabled:r,className:s,...o}){return l.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")+` ${s??""}`,...o,children:l.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"}`})})}const H_=/^[A-Za-z_][A-Za-z0-9_]*$/;function P_({agentId:e}){const{currentProject:n}=hn(),r=n?.projectId??null,s=n?.role==="owner",[o,c]=v.useState(null),[d,f]=v.useState(null),[m,h]=v.useState(!1),[g,y]=v.useState(!1),[k,w]=v.useState(""),[N,C]=v.useState(""),[M,A]=v.useState({}),R=()=>A(X=>X.key||X.value?{}:X),[I,P]=v.useState(null),[D,L]=v.useState(null),$=v.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{const X=await Rj(r,e);c(X.entries)}catch(X){f(Ie(X))}}},[r,e]);v.useEffect(()=>{$()},[$]);const Q=async X=>{if(!r||!e)return x.common.unknownError;h(!0);try{const te=await _j(r,e,X);return c(te.entries),ua(x.common.saved),null}catch(te){return Ie(te)}finally{h(!1)}},W=X=>(o??[]).filter(te=>te.key!==X).map(te=>({key:te.key})),B=()=>{w(""),C(""),A({}),y(!0)},V=async()=>{const X=k.trim(),te={};if(X?H_.test(X)||(te.key=x.vault.keyInvalid):te.key=x.common.requiredField,N||(te.value=x.vault.valueRequired),te.key||te.value){A(te);return}if(A({}),D!==X&&(o??[]).some(z=>z.key===X)){L(X);return}L(null);const O=await Q({entries:[...W(X),{key:X,value:N}]});if(O!==null){A({key:O});return}y(!1)},q=async()=>{if(I===null)return;const X=await Q({entries:W(I)});X!==null&>(X),P(null)};return r?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.vault.desc}),!s&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x.vault.readOnlyHint})]}),o===null?l.jsx(ar,{rows:4}):o.length===0?l.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:x.vault.empty}):l.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:l.jsxs("table",{className:"w-full min-w-[420px] text-left text-sm",children:[l.jsx("thead",{children:l.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:[l.jsx("th",{className:"px-3 py-2.5",children:x.vault.key}),l.jsx("th",{className:"px-3 py-2.5",children:x.vault.valueMasked}),l.jsx("th",{className:"px-3 py-2.5"})]})}),l.jsx("tbody",{children:o.map(X=>l.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:[l.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:X.key}),l.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400",children:X.valueMasked}),l.jsx("td",{className:"px-3 py-2 text-right",children:s&&l.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>P(X.key),children:x.vault.remove})})]},X.key))})]})}),s&&o!==null&&l.jsx(ke,{size:"sm",variant:"primary",disabled:m,onClick:B,children:x.vault.add}),l.jsx(kn,{open:g,title:x.vault.addTitle,onClose:()=>y(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:()=>y(!1),children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:m,onClick:()=>{V()},children:x.vault.add})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(nt,{size:"sm",label:x.vault.key,required:!0,hint:x.vault.keyHint,error:M.key,value:k,onChange:X=>{w(X.target.value),R()},className:"font-mono",placeholder:"OPENAI_API_KEY",autoComplete:"off"}),l.jsx(ms,{size:"sm",label:x.vault.value,required:!0,error:M.value,value:N,onChange:X=>{C(X.target.value),R()},className:"font-mono",autoComplete:"off",onKeyDown:X=>{X.key==="Enter"&&!m&&V()}})]})}),l.jsx(ma,{open:D!==null,title:x.vault.overwriteTitle,tone:"primary",confirmLabel:x.common.save,busy:m,onClose:()=>L(null),onConfirm:()=>{V()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:D!==null?x.vault.overwriteConfirm(D):""})}),l.jsx(ma,{open:I!==null,title:x.vault.deleteTitle,busy:m,onClose:()=>P(null),onConfirm:()=>{q()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:I!==null?x.vault.deleteConfirm(I):""})}),d&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]}):null}function q_(e){const n=[];return v.Children.forEach(e,r=>{if(!v.isValidElement(r)||r.type!=="option")return;const s=r.props;n.push({value:s.value!==void 0?String(s.value):"",label:s.children??"",...s.disabled?{disabled:!0}:{}})}),n}const F_=`flex w-full items-center gap-2 text-left ${Qh} disabled:cursor-not-allowed disabled:opacity-60`,V_={base:"text-base",sm:"text-xs"};function yo({label:e,hint:n,error:r,required:s,size:o="base",className:c,children:d,value:f,onChange:m,disabled:h}){const g=q_(d),y=String(f??""),k=g.find(D=>D.value===y),w=v.useId(),[N,C]=v.useState(!1),{triggerRef:M,panelRef:A,position:R}=C2({open:N,onClose:()=>C(!1),estimatedHeight:g.length*36+8}),I=D=>{C(!1),m?.({target:{value:D}}),M.current?.focus()},P=l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:M,type:"button",disabled:h,"aria-haspopup":"listbox","aria-expanded":N,"aria-required":s||void 0,"aria-invalid":r?!0:void 0,"aria-describedby":r?w:void 0,onClick:()=>C(D=>!D),className:`${F_} ${Xh[o]} ${r?Uu:""} ${c??""}`,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:k?.label??g[0]?.label??""}),l.jsx(Gh,{className:"text-gray-400"})]}),N&&R&&Wl.createPortal(l.jsx("div",{ref:A,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:R.left,width:R.triggerWidth,top:R.topPx,bottom:R.bottomPx},children:g.map((D,L)=>l.jsxs("button",{type:"button",role:"option","aria-selected":D.value===y,disabled:D.disabled,onClick:()=>I(D.value),className:`flex items-center ${Iv} ${V_[o]} disabled:opacity-50 ${D.value===y?"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:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:D.label}),D.value===y&&l.jsx(Nv,{className:"text-gray-500 dark:text-gray-400"})]},`${D.value}-${L}`))}),document.body)]});return l.jsx(ko,{label:e,hint:n,error:r,errorId:w,required:s,children:P})}const G_={active:"green",disabled:"gray",expired:"amber",done:"brand",missed:"amber",invalid:"red"};function xb(e){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=s=>s<10?`0${s}`:`${s}`;return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}const Bm=e=>JSON.stringify([e.provider,e.modelId]),W_=e=>{if(!e)return null;const[n,r]=JSON.parse(e);return{provider:n,modelId:r}},yb=e=>`${e.modelId} · ${Aa(e.provider)?.label??e.provider}`,bb=e=>e.modelId&&e.provider?{provider:e.provider,modelId:e.modelId}:null,K_={editing:null,name:"",prompt:"",enabled:!0,startAt:"",endAt:"",period:"",target:"new",sessionId:"",workspace:"",model:null};function Y_({agentId:e}){const{currentProject:n}=hn(),r=n?.projectId??null,s=n?.role==="owner",[o,c]=v.useState(null),[d,f]=v.useState(null),[m,h]=v.useState(!1),[g,y]=v.useState(null),[k,w]=v.useState(null),[N,C]=v.useState({}),[M,A]=v.useState(null),[R,I]=v.useState(null),[P,D]=v.useState([]),L=v.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{c(await Zj(r,e))}catch(O){f(Ie(O))}}},[r,e]);v.useEffect(()=>{L()},[L]),v.useEffect(()=>{!r||!s||_u(r).then(O=>D(O.models)).catch(()=>D([]))},[r,s]);const $=O=>{C(z=>z.name||z.prompt||z.startAt||z.sessionId?{}:z),A(z=>z&&null),y(z=>z===null?z:{...z,...O})},Q=O=>{C({}),A(null),y(O),w(O)},W=async()=>{if(!r||g===null)return;A(null);const O=g.editing??g.name.trim(),z={};if(O||(z.name=x.common.requiredField),g.prompt.trim()||(z.prompt=x.common.requiredField),g.startAt||(z.startAt=x.common.requiredField),g.target==="session"&&!g.sessionId.trim()&&(z.sessionId=x.common.requiredField),z.name||z.prompt||z.startAt||z.sessionId){C(z);return}if(C({}),g.editing!==null&&JSON.stringify(g)===JSON.stringify(k)){gs(x.common.noChangesToSave);return}const H={prompt:g.prompt,enabled:g.enabled,startAt:new Date(g.startAt).toISOString(),...g.period.trim()?{period:g.period.trim()}:{},...g.endAt?{endAt:new Date(g.endAt).toISOString()}:{},...g.target==="session"&&g.sessionId.trim()?{sessionId:g.sessionId.trim()}:{},...g.target==="new"&&g.workspace.trim()?{workspace:g.workspace.trim()}:{},...g.target==="new"&&g.model?{modelId:g.model.modelId,provider:g.model.provider}:{}};h(!0);try{g.editing!==null?await Ay(r,e,g.editing,H):await Jj(r,e,{name:O,...H}),y(null),ua(x.common.saved),await L()}catch(Z){A(Ie(Z))}finally{h(!1)}},B=async O=>{if(!r)return;h(!0);const z=bb(O);try{await Ay(r,e,O.name,{prompt:O.prompt,enabled:!O.enabled,startAt:O.startAt,...O.period!==void 0?{period:O.period}:{},...O.endAt!==void 0?{endAt:O.endAt}:{},...O.sessionId!==void 0?{sessionId:O.sessionId}:{},...O.workspace!==void 0?{workspace:O.workspace}:{},...z?{modelId:z.modelId,provider:z.provider}:{}}),ua(x.common.saved),await L()}catch(H){gt(Ie(H))}finally{h(!1)}},V=O=>{Q({editing:O.name,name:O.name,prompt:O.prompt,enabled:O.enabled,startAt:xb(O.startAt),endAt:xb(O.endAt),period:O.period??"",target:O.sessionId?"session":"new",sessionId:O.sessionId??"",workspace:O.workspace??"",model:bb(O)})},q=async()=>{if(!(!r||R===null)){h(!0);try{await e5(r,e,R),g?.editing===R&&y(null),await L()}catch(O){gt(Ie(O))}finally{h(!1),I(null)}}};if(!r)return null;const X=o?.schedules??[],te=o?.invalidFiles??[];return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.schedule.desc}),!s&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x.schedule.readOnlyHint})]}),o===null?l.jsx(ar,{rows:4}):X.length===0?l.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:x.schedule.empty}):l.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:l.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[l.jsx("thead",{children:l.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:[l.jsx("th",{className:"px-3 py-2.5",children:x.common.name}),l.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colStatus}),l.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colPeriod}),l.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colTarget}),l.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colFireTimes}),l.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colQueued}),s&&l.jsx("th",{className:"px-3 py-2.5"})]})}),l.jsx("tbody",{children:X.map(O=>l.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:[l.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:O.name}),l.jsx("td",{className:"px-3 py-2",children:l.jsx("span",{title:O.invalidReason,children:l.jsx(qt,{tone:G_[O.status],children:x.schedule.statusNames[O.status]??O.status})})}),l.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:O.period!==void 0?l.jsx("span",{className:"font-mono",children:O.period}):x.schedule.once}),l.jsx("td",{className:"max-w-36 truncate px-3 py-2 text-xs text-gray-500 dark:text-gray-400",title:O.sessionId,children:O.sessionId!==void 0?l.jsx("span",{className:"font-mono",children:O.sessionId}):x.schedule.newSession}),l.jsxs("td",{className:"px-3 py-2 text-xs",children:[l.jsx("span",{className:"block text-gray-600 dark:text-gray-300",children:O.nextFireAt?fa(O.nextFireAt):"—"}),l.jsx("span",{className:"block text-gray-400 dark:text-gray-500",children:O.lastFiredAt?fa(O.lastFiredAt):"—"})]}),l.jsx("td",{className:"px-3 py-2",children:O.queued&&l.jsx(qt,{tone:"brand",children:x.schedule.queued})}),s&&l.jsxs("td",{className:"whitespace-nowrap px-3 py-2 text-right",children:[l.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>{B(O)},children:O.enabled?x.schedule.disable:x.schedule.enable}),l.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>V(O),children:x.common.edit}),l.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>I(O.name),children:x.common.delete})]})]},O.name))})]})}),te.length>0&&l.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400",children:[l.jsx("p",{className:"font-medium",children:x.schedule.invalidFiles}),l.jsx("ul",{className:"mt-0.5 space-y-0.5 font-mono",children:te.map(O=>l.jsxs("li",{children:[O.name,": ",O.error]},O.name))})]}),s&&o!==null&&l.jsx(ke,{size:"sm",variant:"primary",disabled:m,onClick:()=>Q(K_),children:x.schedule.addTitle}),l.jsx(kn,{open:g!==null,title:g?.editing!=null?x.schedule.editTitle(g.editing):x.schedule.addTitle,onClose:()=>y(null),widthClass:"sm:max-w-lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:()=>y(null),children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:m,onClick:()=>{W()},children:g?.editing!=null?x.common.save:x.common.create})]}),children:g!==null&&l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[l.jsx(nt,{size:"sm",label:x.common.name,required:!0,hint:x.schedule.nameHint,error:N.name,value:g.name,disabled:g.editing!==null,onChange:O=>$({name:O.target.value}),className:"font-mono",placeholder:"daily_report",autoComplete:"off"}),l.jsx(nt,{size:"sm",label:x.schedule.period,value:g.period,onChange:O=>$({period:O.target.value}),className:"font-mono",placeholder:x.schedule.periodPlaceholder,autoComplete:"off"}),l.jsx(nt,{size:"sm",label:x.schedule.startAt,required:!0,type:"datetime-local",error:N.startAt,value:g.startAt,onChange:O=>$({startAt:O.target.value}),className:"font-mono"}),l.jsx(nt,{size:"sm",label:x.schedule.endAt,type:"datetime-local",value:g.endAt,onChange:O=>$({endAt:O.target.value}),className:"font-mono"}),l.jsxs(yo,{size:"sm",label:x.schedule.target,value:g.target,onChange:O=>$({target:O.target.value}),children:[l.jsx("option",{value:"new",children:x.schedule.targetNew}),l.jsx("option",{value:"session",children:x.schedule.targetSession})]}),g.target==="session"?l.jsx(nt,{size:"sm",label:x.schedule.sessionId,required:!0,error:N.sessionId,value:g.sessionId,onChange:O=>$({sessionId:O.target.value}),className:"font-mono",autoComplete:"off"}):l.jsxs(l.Fragment,{children:[l.jsxs(yo,{size:"sm",label:x.schedule.model,value:g.model?Bm(g.model):"",onChange:O=>$({model:W_(O.target.value)}),children:[l.jsx("option",{value:"",children:x.schedule.modelDefault}),g.model&&!P.some(O=>O.modelId===g.model.modelId&&O.provider===g.model.provider)&&l.jsx("option",{value:Bm(g.model),children:yb(g.model)}),P.map(O=>l.jsx("option",{value:Bm({provider:O.provider,modelId:O.modelId}),children:yb({provider:O.provider,modelId:O.modelId})},`${O.provider}:${O.modelId}`))]}),l.jsx(nt,{size:"sm",label:x.schedule.workspace,value:g.workspace,onChange:O=>$({workspace:O.target.value}),className:"font-mono",autoComplete:"off"})]})]}),l.jsx(Pl,{label:x.schedule.prompt,required:!0,size:"sm",rows:4,error:N.prompt,value:g.prompt,onChange:O=>$({prompt:O.target.value})}),l.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[l.jsx("input",{type:"checkbox",checked:g.enabled,onChange:O=>$({enabled:O.target.checked})}),x.schedule.enabled]}),M&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:M})]})}),l.jsx(ma,{open:R!==null,title:x.schedule.deleteTitle,busy:m,onClose:()=>I(null),onConfirm:()=>{q()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:R!==null?x.schedule.deleteConfirm(R):""})}),d&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]})}function Q_(e){return e.filter(([n])=>n!=="").map(([n,r])=>({value:n,triggerLabel:n,label:n,description:r}))}function Yi(e){const n=e.trim();if(!n)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function zs(e){return e===void 0?"":String(e)}function X_(){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=pa(),s=gv().agentId??"";or(x.agent.settings);const{currentProject:o,reloadAgents:c}=hn(),d=o?.projectId??null,[f,m]=v.useState(null),[h,g]=v.useState("overview"),[y,k]=v.useState(null),w=v.useCallback(()=>{!d||!s||(m(null),k(null),_h(d,s).then(m).catch(A=>k(Ie(A))))},[d,s]);v.useEffect(()=>{w()},[w]);const N=v.useCallback(A=>{ua(x.agent.importDone(A)),w(),c()},[w,c]),C=v.useCallback(()=>{ua(x.agent.resetConfigDone),w(),c()},[w,c]),M=v.useCallback(async A=>{if(!(!d||!s))try{const R=await Yb(d,s,A);m(R),ua(x.common.saved),(A.config?.name!==void 0||A.config?.description!==void 0)&&c()}catch(R){gt(Ie(R))}},[d,s,c]);return d?y&&!f?l.jsx("p",{className:"p-6 text-sm text-red-600 dark:text-red-400",children:y}):f?l.jsx("div",{className:"no-scrollbar h-full overflow-y-auto p-4 md:p-6",children:l.jsxs("div",{className:"mx-auto max-w-3xl",children:[l.jsxs(ke,{variant:"ghost",size:"sm",onClick:()=>n("/agents"),className:"-ml-2 mb-3 text-gray-500 dark:text-gray-400",children:[l.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:[l.jsx("path",{d:"M15 18l-6-6 6-6"}),l.jsx("path",{d:"M9 12h12"})]}),x.agent.backToList]}),l.jsx("h1",{className:"mb-1 text-xl font-semibold",children:f.config.name??s}),l.jsx("p",{className:"mb-4 font-mono text-xs text-gray-400",children:s}),l.jsx(z_,{items:e,active:h,onChange:g}),l.jsxs("div",{className:"py-4",children:[h==="overview"&&l.jsx(Z_,{data:f,agentId:s,onSave:M,onImported:N,onConfigReset:C}),h==="prompt"&&l.jsx(J_,{data:f,onSave:M}),h==="runtime"&&l.jsx(eI,{data:f,onSave:M}),h==="tools"&&l.jsx(tI,{data:f,onSave:M}),h==="vault"&&l.jsx(P_,{agentId:s}),h==="schedules"&&l.jsx(Y_,{agentId:s})]})]})}):l.jsxs("div",{className:"space-y-3 p-6",children:[l.jsx(Pt,{className:"h-6 w-64"}),l.jsx(Pt,{className:"h-32 w-full"})]}):null}const vb="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 Z_({data:e,agentId:n,onSave:r,onImported:s,onConfigReset:o}){const{currentProject:c}=hn(),d=c?.projectId??null,f=c?.role==="owner",[m,h]=v.useState(e.config.name??""),[g,y]=v.useState(e.config.description??""),[k,w]=v.useState(!1),[N,C]=v.useState(null),[M,A]=v.useState(null),[R,I]=v.useState(!1),[P,D]=v.useState(!1),{requestSave:L,element:$}=zu(),Q=async()=>{if(d){D(!0);try{await Dj(d,n),I(!1),o()}catch(q){gt(Ie(q))}finally{D(!1)}}},W=()=>{const q={};if(m.trim()!==(e.config.name??"")&&(q.name=m.trim()),g.trim()!==(e.config.description??"")&&(q.description=g.trim()),Object.keys(q).length===0){gs(x.common.noChangesToSave);return}L(()=>{r({config:q})})},B=async(q,X)=>{if(d){w(!0),C(null);try{const te=await s5(d,n,{dataBase64:q,...X?{confirm:!0}:{}});A(null),s(te.version)}catch(te){te instanceof Ka&&te.status===409&&te.code==="version_conflict"?A(q):(A(null),C(Ie(te)))}finally{w(!1)}}},V=q=>{const X=q.target.files?.[0];if(q.target.value="",!X)return;C(null);const te=new FileReader;te.onload=()=>{const O=te.result;B(O.slice(O.indexOf(",")+1),!1)},te.onerror=()=>C(x.common.unknownError),te.readAsDataURL(X)};return l.jsxs("div",{className:"space-y-4",children:[l.jsx(nt,{size:"sm",label:x.common.name,value:m,onChange:q=>h(q.target.value)}),l.jsx(Pl,{label:x.agent.description,size:"sm",rows:3,value:g,onChange:q=>y(q.target.value)}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.stateDir}),l.jsx("p",{className:"break-all font-mono text-xs text-gray-500 dark:text-gray-400",children:e.stateDir})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.activeSessions}),l.jsx("p",{className:"text-sm",children:e.activeSessionCount})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.stateVersion}),l.jsxs("p",{className:"font-mono text-sm",children:["v",e.config.version]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.transferTitle}),l.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:x.agent.transferDesc}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d&&l.jsx("a",{href:r5(d,n),download:!0,className:vb,children:x.agent.exportSnapshot}),f&&l.jsxs("label",{className:`${vb} ${k?"pointer-events-none opacity-60":""}`,children:[l.jsx("input",{type:"file",accept:".tar.gz,.tgz",className:"sr-only",disabled:k,onChange:V}),k?x.agent.importing:x.agent.importSnapshot]})]}),N&&l.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:N})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.resetConfigTitle}),l.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:x.agent.resetConfigDesc}),l.jsx(ke,{size:"sm",disabled:P,onClick:()=>I(!0),children:x.agent.resetConfigAction})]}),l.jsx(ke,{size:"sm",variant:"primary",onClick:W,children:x.common.save}),$,l.jsx(ma,{open:M!==null,title:x.agent.importConflictTitle,busy:k,onClose:()=>A(null),onConfirm:()=>{M!==null&&B(M,!0)},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.agent.importConflictBody})}),l.jsx(ma,{open:R,title:x.agent.resetConfigTitle,busy:P,onClose:()=>I(!1),onConfirm:()=>{Q()},confirmLabel:x.agent.resetConfigAction,children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.agent.resetConfigConfirmBody})})]})}function J_({data:e,onSave:n}){const[r,s]=v.useState(e.agentsMd),[o,c]=v.useState(e.config.systemPrompt),d=v.useRef(null),{requestSave:f,element:m}=zu(),h=()=>{const y={};if(r!==e.agentsMd&&(y.agentsMd=r),o!==e.config.systemPrompt&&(y.config={systemPrompt:o}),y.agentsMd===void 0&&y.config===void 0){gs(x.common.noChangesToSave);return}f(()=>{n(y)})},g=y=>{const k=d.current;if(k&&(k.focus(),document.execCommand?.("insertText",!1,y)))return;const w=k?k.selectionStart:o.length,N=k?k.selectionEnd:o.length;c(o.slice(0,w)+y+o.slice(N)),requestAnimationFrame(()=>{if(!k)return;k.focus();const C=w+y.length;k.setSelectionRange(C,C)})};return l.jsxs("div",{className:"space-y-4",children:[l.jsx(Pl,{label:x.agent.agentsMd,mono:!0,size:"sm",rows:14,value:r,onChange:y=>s(y.target.value)}),l.jsx(Pl,{ref:d,label:x.agent.systemPrompt,mono:!0,size:"sm",rows:12,value:o,onChange:y=>c(y.target.value)}),l.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:x.agent.placeholdersTitle}),l.jsx("ul",{className:"space-y-1",children:x.agent.placeholders.map(([y,k])=>l.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[l.jsx("button",{type:"button",onClick:()=>g(y),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:y}),l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:k})]},y))})]}),l.jsx(ke,{size:"sm",variant:"primary",onClick:h,children:x.common.save}),m]})}function eI({data:e,onSave:n}){const r=e.config,[s,o]=v.useState(zs(r.maxTurns)),[c,d]=v.useState(zs(r.model?.maxTokens)),[f,m]=v.useState(r.model?.thinkingLevel??""),[h,g]=v.useState(zs(r.model?.timeoutMs)),[y,k]=v.useState(zs(r.compaction?.maxContextLength)),[w,N]=v.useState(zs(r.compaction?.maxSessionTurns)),[C,M]=v.useState(r.compaction?.mode??""),[A,R]=v.useState(r.compaction?.prompt??""),[I,P]=v.useState({}),D=()=>P(V=>V.maxTurns||V.timeoutMs?{}:V),{requestSave:L,element:$}=zu(),Q=()=>{P({});const V={},q=Yi(s);if(q!==void 0&&q!==r.maxTurns){if(q<=0&&q!==-1){P({maxTurns:x.agent.maxTurnsInvalid});return}V.maxTurns=q}const X={},te=Yi(c);te!==void 0&&te!==r.model?.maxTokens&&(X.maxTokens=te),f&&f!==(r.model?.thinkingLevel??"")&&(X.thinkingLevel=f);const O=Yi(h);if(O!==void 0&&O!==r.model?.timeoutMs){if(O<=0&&O!==-1){P({timeoutMs:x.agent.timeoutInvalid});return}X.timeoutMs=O}Object.keys(X).length>0&&(V.model=X);const z={},H=Yi(y);H!==void 0&&H!==r.compaction?.maxContextLength&&(z.maxContextLength=H);const Z=Yi(w);if(Z!==void 0&&Z!==r.compaction?.maxSessionTurns&&(z.maxSessionTurns=Z),C&&C!==(r.compaction?.mode??"")&&(z.mode=C),A!==(r.compaction?.prompt??"")&&(z.prompt=A),Object.keys(z).length>0&&(V.compaction=z),Object.keys(V).length===0){gs(x.common.noChangesToSave);return}L(()=>{n({config:V})})},W=nR(x.agent.thinkingLevelOptions,x.agent.thinkingLevelNoneKept,r.model?.thinkingLevel),B=Q_(x.agent.compactionModeOptions);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[l.jsx(nt,{label:x.agent.maxTurns,size:"sm",value:s,error:I.maxTurns,onChange:V=>{o(V.target.value),D()},inputMode:"numeric",className:"font-mono"}),l.jsx(nt,{label:x.agent.maxTokens,size:"sm",value:c,onChange:V=>d(V.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(Th,{label:x.agent.thinkingLevel,fullWidth:!0,size:"sm",placeholder:x.agent.defaultValue,value:f,onChange:m,options:W}),l.jsx(nt,{label:x.agent.timeoutMs,hint:x.agent.timeoutMsHint,size:"sm",value:h,error:I.timeoutMs,onChange:V=>{g(V.target.value),D()},inputMode:"numeric",className:"font-mono"})]})}),l.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}),l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[l.jsx(nt,{label:x.agent.maxContextLength,hint:x.agent.maxContextLengthHint,size:"sm",value:y,onChange:V=>k(V.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(nt,{label:x.agent.maxSessionTurns,hint:x.agent.maxSessionTurnsHint,size:"sm",value:w,onChange:V=>N(V.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(Th,{label:x.agent.compactionMode,fullWidth:!0,size:"sm",placeholder:x.agent.defaultValue,value:C,onChange:M,options:B})]})}),l.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}),l.jsx("div",{className:"p-3",children:l.jsx(Pl,{"aria-label":x.agent.compactionPrompt,mono:!0,size:"sm",rows:4,value:A,onChange:V=>R(V.target.value)})})]}),l.jsx(ke,{size:"sm",variant:"primary",onClick:Q,children:x.common.save}),$]})}function tI({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}],[s,o]=v.useState(()=>e.config.toolsBuiltin.map(k=>({base:{...k},timeoutMs:zs(k.timeoutMs),maxOutputLength:zs(k.maxOutputLength)}))),[c,d]=v.useState({}),{requestSave:f,element:m}=zu(),h=(k,w)=>{o(N=>N.map((C,M)=>M===k?{...C,...w}:C)),d(N=>{const C=`${k}-timeoutMs`,M=`${k}-maxOutputLength`;if(!N[C]&&!N[M])return N;const A={...N};return delete A[C],delete A[M],A})},g=()=>{const k={},w=[];for(const[M,A]of s.entries()){const R={...A.base};delete R.timeoutMs,delete R.maxOutputLength;const I=A.timeoutMs.trim();if(I){const L=Number(I);!Number.isInteger(L)||L<=0&&L!==-1?k[`${M}-timeoutMs`]=x.agent.toolFieldInvalid(A.base.name,"timeoutMs"):R.timeoutMs=L}const P=A.maxOutputLength.trim();if(P){const L=Number(P);!Number.isInteger(L)||L<=0&&L!==-1?k[`${M}-maxOutputLength`]=x.agent.toolFieldInvalid(A.base.name,"maxOutputLength"):R.maxOutputLength=L}const D=e.config.toolsBuiltin[M];R.call_description===!0&&D?.call_description===void 0&&delete R.call_description,w.push(R)}if(Object.keys(k).length>0){d(k);return}d({});const N=e.config.toolsBuiltin;if(!(w.length!==N.length||w.some((M,A)=>{const R=N[A];return M.permission!==R.permission||M.timeoutMs!==R.timeoutMs||M.maxOutputLength!==R.maxOutputLength||M.call_description!==R.call_description}))){gs(x.common.noChangesToSave);return}f(()=>{n({config:{toolsBuiltin:w}})})},y=k=>{const w=k.parameters?.properties;return w!=null&&w.description!==void 0};return l.jsxs("div",{className:"space-y-4",children:[l.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:l.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[l.jsx("thead",{children:l.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:[l.jsx("th",{className:"px-3 py-2",children:x.common.name}),l.jsx("th",{className:"px-3 py-2",children:x.agent.toolPermission}),l.jsx("th",{className:"px-3 py-2",children:x.agent.toolTimeout}),l.jsx("th",{className:"px-3 py-2",children:x.agent.toolMaxOutput}),l.jsx("th",{className:"px-3 py-2",children:x.agent.toolCallDescription})]})}),l.jsx("tbody",{children:s.map((k,w)=>l.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800/60",children:[l.jsx("td",{className:"px-3 py-2 align-top font-mono text-xs",children:k.base.name}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(Th,{mono:!0,size:"sm","aria-label":x.agent.toolPermission,placeholder:x.agent.defaultValue,options:r,value:k.base.permission,onChange:N=>h(w,{base:{...k.base,permission:N}})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(nt,{size:"sm",value:k.timeoutMs,error:c[`${w}-timeoutMs`],inputMode:"numeric",className:"font-mono",onChange:N=>h(w,{timeoutMs:N.target.value})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(nt,{size:"sm",value:k.maxOutputLength,error:c[`${w}-maxOutputLength`],inputMode:"numeric",className:"font-mono",onChange:N=>h(w,{maxOutputLength:N.target.value})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:y(k.base)?l.jsx(T2,{checked:k.base.call_description!==!1,onChange:N=>h(w,{base:{...k.base,call_description:N}}),"aria-label":`${k.base.name} ${x.agent.toolCallDescription}`}):l.jsx("span",{className:"text-xs text-gray-300 dark:text-gray-600",children:"—"})})]},k.base.name))})]})}),l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.agent.callDescriptionHint}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.mcpServers}),l.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)})]}),l.jsx(ke,{size:"sm",variant:"primary",onClick:g,children:x.common.save}),m]})}const nI="M22 2 11 13M22 2 15 22 11 13 2 9 22 2",aI="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",rI="M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";function sI(e,n,r,s){return e.filter(o=>{const c=n.get(o)?.get(r);return c!==void 0&&c<s})}function lI(){or(x.nav.skills);const e=pa(),{locale:n}=Qa(),r=$n().user?.userId??null,{currentProject:s,agents:o,setCurrentAgentId:c}=hn(),d=s?.projectId??null,[f,m]=v.useState(null),[h,g]=v.useState(null),[y,k]=v.useState(new Map),[w,N]=v.useState(new Set);v.useEffect(()=>{let D=!1;return g(null),t5().then(L=>{D||m(L.groups)}).catch(L=>{D||g(Ie(L))}),()=>{D=!0}},[]);const C=o.map(D=>D.agentId).join(",");v.useEffect(()=>{if(k(new Map),!d||C==="")return;let D=!1;const L=C.split(",");return Promise.all(L.map(async $=>{try{const Q=await Ih(d,$);return[$,new Map(Q.skills.map(W=>[W.name,W.version]))]}catch{return[$,new Map]}})).then($=>{D||k(Q=>{const W=new Map($);for(const[B,V]of Q)W.set(B,V);return W})}),()=>{D=!0}},[d,C]);const M=(D,L,$)=>k(Q=>{const W=new Map(Q),B=new Map(W.get(D)??[]);return $!==void 0?B.set(L,$):B.delete(L),W.set(D,B),W}),A=(D,L)=>k($=>new Map($).set(D,new Map(L.map(Q=>[Q.name,Q.version])))),R=async(D,L,$,Q)=>{if(!d)return;const W=y.get(D)?.get(L);M(D,L,$?Q:void 0);const B=o.find(q=>q.agentId===D),V=B?Mn(B):D;try{if($){const q=await Ry(d,D,[L]);A(D,q.skills),ua(x.skills.installedToast(L,V))}else await n5(d,D,L),ua(x.skills.uninstalledToast(L,V))}catch(q){if(!$&&q instanceof Ka&&q.status===404)return;M(D,L,W),gt(Ie(q))}},I=async(D,L)=>{if(!d||L.length===0)return;const Q=(await Promise.allSettled(L.map(async W=>{const B=await Ry(d,W,[D]);A(W,B.skills)}))).find(W=>W.status==="rejected");Q?gt(Ie(Q.reason)):ua(x.skills.updatedToast(D,L.length))},P=D=>{if(r&&d){const L=Bl(r,d);xo(L,{...Wu(L),agentId:"default_agent",text:x.skills.quickInvokeText(D),skills:[D],handoffAgentId:void 0})}c("default_agent"),e(`/chat/${rr}`,{state:{agentId:"default_agent"}})};return l.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:l.jsxs("div",{className:"mx-auto max-w-5xl",children:[l.jsx("h1",{className:"text-xl font-semibold",children:x.skills.pageTitle}),l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:x.skills.pageDesc}),h?l.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h}),l.jsx(ke,{size:"sm",onClick:()=>window.location.reload(),children:x.common.retry})]}):f===null?l.jsx("div",{className:"mt-6 grid gap-2.5 sm:grid-cols-2",children:Array.from({length:4},(D,L)=>l.jsxs(Ov,{className:"p-4",children:[l.jsx(Pt,{className:"h-4 w-32"}),l.jsx(Pt,{className:"mt-2 h-4 w-3/4"}),l.jsx(Pt,{className:"mt-3 h-6 w-36"})]},L))}):l.jsx("div",{className:"mt-6 space-y-3",children:f.map(D=>{const L=!w.has(D.id);return l.jsxs("section",{className:"overflow-hidden rounded-md bg-white dark:bg-gray-900",children:[l.jsxs("button",{type:"button","aria-expanded":L,onClick:()=>N($=>{const Q=new Set($);return Q.has(D.id)?Q.delete(D.id):Q.add(D.id),Q}),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:[l.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:w8(n,D.title,D.titleZh)}),l.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.skills.skillCount(D.skills.length)}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Un,{open:L,className:"text-gray-400"})]}),l.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${L?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:l.jsx("div",{className:"overflow-hidden",inert:!L,children:l.jsx("div",{className:`grid gap-2.5 p-2.5 transition-opacity duration-200 sm:grid-cols-2 ${L?"opacity-100":"opacity-0"}`,children:D.skills.map($=>l.jsx(iI,{skill:$,installed:y,onQuickInvoke:P,onToggleInstall:R,onUpdateOutdated:I},$.name))})})})]},D.id)})})]})})}function iI({skill:e,installed:n,onQuickInvoke:r,onToggleInstall:s,onUpdateOutdated:o}){const{locale:c}=Qa(),{agents:d}=hn(),[f,m]=v.useState(!1),[h,g]=v.useState(null),[y,k]=v.useState(!1),[w,N]=v.useState(null),C=async()=>{h&&(k(!0),await o(e.name,h),k(!1),g(null))},M=w!==null?d.find($=>$.agentId===w):void 0,A=M?Mn(M):void 0;let R=0;for(const $ of n.values())$.has(e.name)&&(R+=1);const I=sI(d.map($=>$.agentId),n,e.name,e.version),P=To(c,e),D=e.description,L=[`v${e.version}`,e.updated?cN(e.updated,c):null,x.skills.usedByAgents(R)].filter($=>$!==null).join(" · ");return l.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:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${G8(e.name)}`,children:l.jsx(jp,{icon:e.icon,size:20})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate font-mono text-[13px] font-semibold",title:e.name,children:e.name}),l.jsx("p",{className:"mt-0.5 truncate text-xs leading-5 text-gray-500 dark:text-gray-400",title:D,children:P})]})]}),l.jsx("p",{className:"mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500",title:L,children:L})]}),l.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-1.5",children:[I.length>0&&l.jsx(ke,{size:"sm",variant:"secondary",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.updateOutdated(I.length)} ${e.name}`,title:x.skills.updateOutdated(I.length),onClick:()=>g(I),children:l.jsx(Pe,{d:rI,size:13})}),l.jsx(ke,{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:l.jsx(Pe,{d:nI,size:15})}),l.jsx(ke,{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:l.jsx(Pe,{d:aI,size:15})})]}),f&&l.jsx(kn,{open:!0,title:x.skills.manageInstallTitle(e.name),onClose:()=>m(!1),children:l.jsxs("div",{className:"space-y-0.5",children:[d.length===0&&l.jsx("p",{className:"py-1.5 text-xs text-gray-400",children:x.common.loading}),d.map($=>l.jsx(oI,{agentId:$.agentId,name:Mn($),installed:n.get($.agentId)?.has(e.name)??!1,outdated:I.includes($.agentId),onToggle:Q=>{Q?s($.agentId,e.name,!0,e.version):N($.agentId)},onUpdate:()=>g([$.agentId])},$.agentId))]})}),h&&l.jsx(ma,{open:!0,title:x.skills.updateConfirmTitle(e.name),tone:"primary",confirmLabel:x.skills.updateAction,busy:y,onClose:()=>g(null),onConfirm:()=>{C()},children:l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.skills.updateConfirmWarning(e.name)}),l.jsx("ul",{className:"divide-y divide-gray-100 overflow-hidden rounded-md border border-gray-200 dark:divide-gray-800 dark:border-gray-800",children:h.map($=>{const Q=n.get($)?.get(e.name),W=d.find(B=>B.agentId===$);return l.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-1.5 text-xs",children:[l.jsx("span",{className:"min-w-0 truncate",children:W?Mn(W):$}),l.jsxs("span",{className:"shrink-0 font-mono text-gray-500 dark:text-gray-400",children:["v",Q??"?"," → v",e.version]})]},$)})})]})}),w!==null&&l.jsx(ma,{open:!0,title:x.skills.uninstallConfirmTitle(e.name),confirmLabel:x.skills.uninstall,onClose:()=>N(null),onConfirm:()=>{const $=w;N(null),s($,e.name,!1,e.version)},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.skills.uninstallConfirmBody(e.name,A??w)})})]})}function oI({agentId:e,name:n,installed:r,outdated:s,onToggle:o,onUpdate:c}){return l.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:[l.jsx(Ya,{id:e,name:n,size:22,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",title:e,children:n}),r&&s&&l.jsx(ke,{size:"sm",variant:"secondary",className:"shrink-0","aria-label":`${x.skills.updateAction} ${e}`,onClick:c,children:x.skills.updateAction}),r?l.jsxs(ke,{size:"sm",variant:"ghost",className:"group shrink-0","aria-label":`${x.skills.uninstall} ${e}`,onClick:()=>o(!1),children:[l.jsx("span",{className:"group-hover:hidden",children:x.skills.installed}),l.jsx("span",{className:"hidden text-red-600 group-hover:inline dark:text-red-400",children:x.skills.uninstall})]}):l.jsx(ke,{size:"sm",className:"shrink-0","aria-label":`${x.skills.install} ${e}`,onClick:()=>o(!0),children:x.skills.install})]})}function M2(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 cI(e){return{provider:e.provider,modelId:e.model_id,original:null,...M2(e),maxTokens:"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}function uI(e,n=Y8()){const r=(f,m)=>`${f}\0${m}`,s=new Map(e.map((f,m)=>[r(f.provider,f.modelId),m])),o=[...e];let c=0,d=0;for(const f of n){const m=s.get(r(f.provider,f.model_id));if(m===void 0){o.push(cI(f)),c+=1;continue}const h=o[m],g=M2(f);Object.keys(g).some(k=>h[k]!==g[k])&&(o[m]={...h,...g},d+=1)}return{rows:o,added:c,updated:d}}function dI(e){return e<1e3?"green":e<=3e3?"yellow":"red"}function fI(e){return e>=40?"green":e>=15?"yellow":"red"}const E2={USD:"$",CNY:"¥"};function kb(e){return Number.isFinite(e)?String(Math.round(e*1e6)/1e6):"0"}function Mh(e){return Number.isFinite(e)?String(Math.round(e*1e4)/1e4):"0"}function Hm(e,n){const r=Number(e||"0"),s=n==="CNY"?r*Rh:r;return`${E2[n]}${Mh(s)}`}function Dl(e,n){const r=e.trim();if(!r)return"";const s=Number(r);return Number.isFinite(s)?Mh(n==="CNY"?s*Rh:s):r}function Pm(e,n){const r=e.trim();if(!r)return"";const s=Number(r);return Number.isFinite(s)?kb(n==="CNY"?s/Rh:s):r}const mI="M12 5v14M5 12h14",hI="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",pI="M12 14l3.5-3.5M20.49 17A10 10 0 1 0 3.5 17",gI="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 7v5l3.5 2",xI="M13 2 3 14h9l-1 8 10-12h-9l1-8Z",wb={green:"text-green-600 dark:text-green-400",yellow:"text-amber-600 dark:text-amber-400",red:"text-red-600 dark:text-red-400"},Sb=(e,n)=>`${e}\0${n}`,qm=128e3;function jb(e){return e.replace(/[^\d]/g,"")}function yI(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 Ta(e){return{provider:e.provider,modelId:e.modelId}}function bI(e){const{editing:n,ref:r,action:s,defaultModel:o,visionModel:c}=e,d=n===null,f=!d&&!kt(n,r)?n:null,m=h=>kt(h,f)?r:h;return{defaultModel:s==="setDefault"||d&&!o?r:m(o),visionModel:s==="setVisionModel"?r:m(c)}}function vI(e){return e.original!==null&&Np(e.original.provider,e.original.modelId)!==void 0}function kI(e){return!e.clearApiKey&&(!!e.apiKeyInput.trim()||!!e.credential?.apiKeyMasked)}function Nb(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 wI(e){const n={provider:e.provider,modelId:e.modelId};e.original&&!kt(e.original,Ta(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 s=Number(e.maxTokens.trim());e.maxTokens.trim()&&Number.isFinite(s)&&s>0&&(n.maxTokens=s);const o=Number(e.cacheRead.trim()),c=Number(e.cacheWrite.trim()),d=Number(e.output.trim());e.cacheRead.trim()&&e.cacheWrite.trim()&&e.output.trim()&&Number.isFinite(o)&&Number.isFinite(c)&&Number.isFinite(d)&&(n.pricing={cacheRead:o,cacheWrite:c,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 SI(){or(x.models.title);const{currentProject:e}=hn(),n=e?.projectId??null,r=e?.role==="owner",s=$n().user?.userId??null,[o,c]=v.useState(new Map),[d,f]=v.useState(null),[m,h]=v.useState(null),[g,y]=v.useState(null),[k,w]=v.useState(void 0),[N,C]=v.useState(void 0),[M,A]=v.useState(null),[R,I]=v.useState(null),[P,D]=v.useState(""),[L,$]=v.useState(new Set),[Q,W]=v.useState(null),[B,V]=v.useState(!1),[q,X]=v.useState(""),[te,O]=v.useState(null),[z,H]=v.useState(null),[Z,ce]=v.useState(!1),{currency:E}=Gs(),T=v.useCallback(async()=>{if(n){y(null),H(null),c(new Map);try{const ie=await _u(n);y(ie.models.map(Nb)),w(ie.defaultModel),C(ie.visionModel)}catch(ie){H(Ie(ie))}}},[n]);v.useEffect(()=>{T()},[T]);const U=async(ie,he,be,ze)=>{if(!n)return!1;ce(!0);const st=be&&ie.some(Ue=>kt(Ta(Ue),be)&&Ue.vision)?be:void 0;try{const Ue={models:ie.map(wI)};he&&(Ue.defaultModel=he),st&&(Ue.visionModel=st);const wt=await Aj(n,Ue);if(y(wt.models.map(Nb)),w(wt.defaultModel),C(wt.visionModel),s&&wt.defaultModel&&!kt(wt.defaultModel,k)){const Yt=Bl(s,n),pn=Wu(Yt);pn.modelRef&&xo(Yt,{...pn,modelRef:void 0})}return ua(ze??x.common.saved),!0}catch(Ue){return y(ie),he!==void 0&&w(he),st!==void 0&&C(st),gt(Ie(Ue)),!1}finally{ce(!1)}},j=v.useMemo(()=>g?u2(g,P):[],[g,P]),K=async()=>{if(!g)return;const ie=uI(g);if(ie.added===0&&ie.updated===0){gs(x.models.syncUpToDate);return}await U(ie.rows,k,N,x.models.syncDone(ie.added,ie.updated))},se=async ie=>{if(!n||!g)return;const he=g.filter(be=>be.provider===ie);h(ie);try{for(const be of he){const ze=Sb(be.provider,be.modelId);c(st=>new Map(st).set(ze,"pending"));try{const st=await Kb(n,{provider:be.provider,modelId:be.modelId,speed:!0});c(Ue=>new Map(Ue).set(ze,st))}catch(st){c(Ue=>new Map(Ue).set(ze,{ok:!1,message:Ie(st)}))}}}finally{h(null)}},oe=()=>{const ie=q.trim();if(!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(ie)){O(x.models.groupNameInvalid);return}if(ps.some(he=>he.id===ie)||g?.some(he=>he.provider===ie)){O(x.models.groupNameExists);return}V(!1),X(""),I(ie)},pe=M!==null?g?.find(ie=>kt(Ta(ie),M)):void 0;if(!n)return null;const Se=ie=>$(he=>{const be=new Set(he);return be.has(ie)?be.delete(ie):be.add(ie),be});return l.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[l.jsxs("div",{className:"mx-auto max-w-5xl",children:[l.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold",children:x.models.title}),!r&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.models.readOnlyHint})]}),l.jsxs("div",{className:"flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0",children:[l.jsx("div",{className:"min-w-0 flex-1 sm:w-56 sm:flex-none",children:l.jsx(nt,{size:"sm",value:P,onChange:ie=>D(ie.target.value),placeholder:x.models.searchPlaceholder})}),r&&l.jsx(ke,{size:"sm",onClick:()=>{K()},disabled:Z||g===null,title:x.models.syncCatalogHint,children:x.models.syncCatalog})]})]}),g===null?l.jsx(ar,{rows:4}):g.length===0?l.jsx(lr,{title:x.models.empty,action:r&&l.jsx(ke,{onClick:()=>I("custom"),children:x.models.addCustom})}):j.length===0?l.jsx(lr,{title:x.models.noSearchResults}):l.jsxs("div",{className:"space-y-3",children:[j.map(ie=>{const he=!L.has(ie.provider.id);return l.jsxs("section",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[l.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:[l.jsxs("button",{type:"button","aria-expanded":he,onClick:()=>Se(ie.provider.id),className:"flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left",children:[l.jsx(Mo,{provider:ie.provider.id,className:"h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"}),l.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:ie.provider.label}),l.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.models.modelCount(ie.rows.length)})]}),r&&l.jsx("span",{className:"shrink-0",children:l.jsxs(ke,{size:"sm",variant:"ghost",disabled:Z,onClick:()=>I(ie.provider.id),children:[l.jsx(Pe,{d:mI,size:13}),x.models.addToGroup]})}),r&&ie.provider.id!=="custom"&&l.jsx("span",{className:"hidden shrink-0 sm:block",children:l.jsxs(ke,{size:"sm",variant:"ghost",disabled:Z,onClick:()=>W(ie.provider.id),children:[l.jsx(Pe,{d:hI,size:13}),x.models.groupApiKey]})}),r&&l.jsxs(ke,{size:"sm",variant:"ghost",className:"shrink-0",disabled:Z||m!==null,"aria-label":`${x.models.speedTest} ${ie.provider.label}`,title:m===ie.provider.id?x.models.speedPending:x.models.speedTest,onClick:()=>f(ie.provider.id),children:[l.jsx(Pe,{d:pI,size:13}),l.jsx("span",{className:"hidden sm:inline",children:m===ie.provider.id?x.models.speedPending:x.models.speedTest})]}),ie.provider.apiKeyUrl&&l.jsxs("a",{href:ie.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," ↗"]}),l.jsx("button",{type:"button","aria-expanded":he,"aria-label":ie.provider.label,onClick:()=>Se(ie.provider.id),className:"shrink-0 p-1.5",children:l.jsx(Un,{open:he,className:"text-gray-400"})})]}),l.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${he?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:l.jsx("div",{className:"overflow-hidden",inert:!he,children:l.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 ${he?"opacity-100":"opacity-0"}`,children:ie.rows.length===0?l.jsx("p",{className:"col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500",children:x.models.groupEmptyHint}):ie.rows.map(be=>l.jsx(jI,{row:be,currency:E,isDefault:kt(Ta(be),k),isVisionModel:kt(Ta(be),N),speed:o.get(Sb(be.provider,be.modelId)),onOpen:()=>A(Ta(be))},`${be.provider}:${be.modelId}`))})})})]},ie.provider.id)}),r&&P.trim()===""&&l.jsxs("button",{type:"button",onClick:()=>{X(""),O(null),V(!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]})]}),z&&l.jsx("p",{className:"mt-3 text-xs text-red-600 dark:text-red-400",children:z})]}),g&&Q&&l.jsx(MI,{provider:ps.find(ie=>ie.id===Q)??o2(Q),count:g.filter(ie=>ie.provider===Q).length,onClose:()=>W(null),onSubmit:ie=>{const he=Q;W(null);const be=g.filter(st=>st.provider===he);if(be.length===0)return;const ze=g.map(st=>st.provider===he?{...st,apiKeyInput:ie,clearApiKey:!1}:st);U(ze,k,N,x.models.groupKeyApplied(be.length))}}),d!==null&&l.jsxs(kn,{open:!0,title:x.models.speedTestTitle,onClose:()=>f(null),children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.models.speedTestConfirm(g?.filter(ie=>ie.provider===d).length??0)}),l.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[l.jsx(ke,{onClick:()=>f(null),children:x.common.cancel}),l.jsx(ke,{variant:"primary",onClick:()=>{const ie=d;f(null),ie&&se(ie)},children:x.models.speedTestStart})]})]}),B&&l.jsxs(kn,{open:!0,title:x.models.addGroupTitle,onClose:()=>V(!1),widthClass:"sm:max-w-sm",footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:()=>V(!1),children:x.common.cancel}),l.jsx(ke,{variant:"primary",onClick:oe,children:x.common.confirm})]}),children:[l.jsxs("label",{className:"block",children:[l.jsx(nt,{size:"sm",label:x.models.groupNameLabel,required:!0,value:q,invalid:!!te,onChange:ie=>{X(ie.target.value),O(null)},onKeyDown:ie=>{ie.key==="Enter"&&oe()},placeholder:x.models.groupNameHint,className:"font-mono",autoFocus:!0}),te&&l.jsx(Bs,{children:te})]}),l.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:x.models.addGroupDesc})]}),g&&(R!==null||pe)&&l.jsx(TI,{projectId:n,row:R!==null?null:pe??null,addProvider:R??"custom",existingRefs:g.map(Ta),currency:E,canEdit:r,isDefault:pe!==void 0&&kt(Ta(pe),k),isVisionModel:pe!==void 0&&kt(Ta(pe),N),onClose:()=>{A(null),I(null)},onSubmit:(ie,he)=>{const be=R!==null;if(A(null),I(null),he==="remove"){const Ue=ie.original;U(g.filter(wt=>!kt(Ta(wt),Ue)),kt(Ue,k)?void 0:k,kt(Ue,N)?void 0:N);return}const ze=be?[...g,ie]:g.map(Ue=>kt(Ta(Ue),M)?ie:Ue),st=bI({editing:be?null:M,ref:Ta(ie),action:he,defaultModel:k,visionModel:N});U(ze,st.defaultModel,st.visionModel)}})]})}function jI({row:e,currency:n,isDefault:r,isVisionModel:s,speed:o,onOpen:c}){const d=e.cacheRead||e.cacheWrite||e.output,f=[e.contextWindow?ot(Number(e.contextWindow)):null,d?`${Hm(e.cacheRead,n)} / ${Hm(e.cacheWrite,n)} / ${Hm(e.output,n)}`:null,e.credential?.apiKeyMasked&&!e.clearApiKey?e.credential.apiKeyMasked:kI(e)?x.models.keyConfigured:x.models.noKey].filter(h=>h!==null),m=o==="pending"?l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:x.models.speedPending}):o?o.ok?l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] font-medium",children:[o.ttftMs!==void 0&&l.jsxs("span",{className:`flex items-center gap-0.5 ${wb[dI(o.ttftMs)]}`,title:x.models.ttftTitle,children:[l.jsx(Pe,{d:gI,size:11}),Math.round(o.ttftMs),"ms"]}),o.tps!==void 0&&l.jsxs("span",{className:`flex items-center gap-0.5 ${wb[fI(o.tps)]}`,title:x.models.tpsTitle,children:[l.jsx(Pe,{d:xI,size:11}),o.tps," tok/s"]})]}):l.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 l.jsxs("button",{type:"button",onClick:c,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:[l.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("span",{className:"text-sm font-medium",children:e.displayName??e.modelId}),r&&l.jsx(qt,{tone:"brand",children:x.models.default}),d2(e)&&l.jsx(qt,{tone:"yellow",children:x.models.freeBadge}),e.vision&&l.jsx(qt,{tone:"green",children:x.models.visionBadge}),s&&l.jsx(qt,{tone:"amber",children:x.models.visionModelBadge})]}),e.displayName!==void 0&&l.jsx("span",{className:"truncate font-mono text-[11px] text-gray-500 dark:text-gray-400",children:e.modelId}),l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-gray-400 dark:text-gray-500",children:f.join(" · ")}),m]})]})}const NI={save:()=>x.models.confirmSaveTitle,setDefault:()=>x.models.confirmDefaultTitle,setVisionModel:()=>x.models.confirmVisionModelTitle,remove:()=>x.models.confirmDeleteTitle},CI={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 TI({projectId:e,row:n,addProvider:r,existingRefs:s,currency:o,canEdit:c,isDefault:d,isVisionModel:f,onClose:m,onSubmit:h}){const[g,y]=v.useState(()=>{if(n)return{...n,cacheRead:Dl(n.cacheRead,o),cacheWrite:Dl(n.cacheWrite,o),output:Dl(n.output,o)};const H=Aa(r),Z=H!==void 0&&H.id!=="custom"&&H.gatewayBaseUrl===void 0;return{provider:r,modelId:"",original:null,vision:!0,contextWindow:"",maxTokens:"",clientType:Z?"":"openai",cacheRead:"",cacheWrite:"",output:"",baseUrl:H?.gatewayBaseUrl??"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}),[k,w]=v.useState({}),[N,C]=v.useState(!1),[M,A]=v.useState(null),R=n===null,I=n!==null&&vI(n),P=H=>{y(Z=>({...Z,...H})),w(Z=>{const ce={...Z};for(const E of Object.keys(H))delete ce[E];return ce})},D=async()=>{C(!0);try{const H=g.apiKeyInput.trim(),Z=g.baseUrl.trim(),ce={provider:g.provider,modelId:g.modelId.trim(),baseUrl:Z||null};H?ce.apiKey=H:g.clearApiKey&&(ce.clearApiKey=!0),g.clientType.trim()&&(ce.clientType=g.clientType.trim());const E=await Kb(e,ce);E.ok?ua(x.models.testOk(E.latencyMs??0)):gt(x.models.testFailed(E.message??""))}catch(H){gt(x.models.testFailed(Ie(H)))}finally{C(!1)}},L=g.clientType.trim().toLowerCase().includes("openai")||g.provider==="custom"||Aa(g.provider)===void 0,$=!I&&L,Q=()=>{const H=g.modelId.trim(),Z={provider:g.provider,modelId:H},ce=g.baseUrl.trim(),E={};H?!kt(Z,g.original)&&s.some(se=>kt(se,Z))&&(E.modelId=x.models.modelIdExists):E.modelId=x.common.requiredField,$&&!ce&&(E.baseUrl=x.models.baseUrlRequired);const T=[["cacheRead",g.cacheRead.trim()],["cacheWrite",g.cacheWrite.trim()],["output",g.output.trim()]],U=T.filter(([,se])=>se!=="").length;for(const[se,oe]of T)oe===""&&U>0?E[se]=x.models.pricingAllOrNone:oe!==""&&!Number.isFinite(Number(oe))&&(E[se]=x.models.pricingInvalid);const j=g.contextWindow.trim();j&&!Number.isFinite(Number(j))&&(E.contextWindow=x.models.contextWindowInvalid);const K=g.maxTokens.trim();return K&&!(Number.isInteger(Number(K))&&Number(K)>0)&&(E.maxTokens=x.models.maxTokensInvalid),Object.keys(E).length>0?(w(E),null):(w({}),{...g,modelId:H,contextWindow:!I&&!j?String(qm):g.contextWindow,cacheRead:Pm(g.cacheRead,o),cacheWrite:Pm(g.cacheWrite,o),output:Pm(g.output,o)})},W=H=>{const Z=Q();Z&&h(Z,H)},B=Aa(g.provider),V=K8(g.modelId.trim(),g.clientType.trim()||void 0)?.envKey,q=B!==void 0&&B.id!=="custom"&&B.gatewayBaseUrl===void 0,X=R&&q&&!g.clientType.trim()&&g.modelId.trim()!==""&&V===void 0,te=l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"block",children:[l.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[l.jsxs("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:[x.models.modelId,l.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]}),l.jsx("span",{className:"flex shrink-0 items-baseline gap-2.5",children:B?.modelsUrl&&l.jsxs("a",{href:B.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," ↗"]})})]}),l.jsx(nt,{size:"sm",required:!0,value:g.modelId,disabled:!c,invalid:!!k.modelId,onChange:H=>P({modelId:H.target.value}),className:"font-mono",autoFocus:R,placeholder:x.models.modelIdHint}),k.modelId&&l.jsx(Bs,{children:k.modelId}),X&&l.jsx("span",{className:"mt-1 block text-xs text-amber-600 dark:text-amber-400",children:x.models.autoRouteNone})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx(nt,{size:"sm",label:x.models.displayName,value:g.displayName??"",disabled:!c,onChange:H=>P({displayName:H.target.value}),placeholder:x.models.displayNameHint}),l.jsxs(yo,{size:"sm",label:x.models.providerGroup,value:g.provider,disabled:!c,onChange:H=>P({provider:H.target.value}),children:[ps.map(H=>l.jsx("option",{value:H.id,children:H.label},H.id)),[...new Set(s.map(H=>H.provider).concat(g.provider))].filter(H=>!ps.some(Z=>Z.id===H)).sort().map(H=>l.jsx("option",{value:H,children:H},H))]})]})]}),O=g.credential?.apiKeyMasked?x.models.apiKeyKeepHint:V?x.models.apiKeyEnvHint(V):x.models.apiKeyKeepHint,z=!g.credential?.apiKeyMasked&&V&&V===B?.envKey?x.models.providerEnvNotes[g.provider]:void 0;return l.jsxs(kn,{open:!0,title:R?q?x.models.addTitleVendor:x.models.addTitle:x.models.editTitle,onClose:m,widthClass:"sm:max-w-lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:m,children:x.common.cancel}),c&&l.jsx(ke,{variant:"primary",onClick:()=>{if(!Q())return;if(R||n===null){W("save");return}const H={...n,cacheRead:Dl(n.cacheRead,o),cacheWrite:Dl(n.cacheWrite,o),output:Dl(n.output,o)};if(JSON.stringify(g)===JSON.stringify(H)){gs(x.common.noChangesToSave);return}A("save")},children:x.common.confirm})]}),children:[l.jsxs("div",{className:"space-y-3",children:[!R&&l.jsxs("div",{className:"flex items-center gap-2.5 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60",children:[l.jsx(Mo,{provider:g.provider,className:"h-6 w-6 shrink-0 text-gray-700 dark:text-gray-300"}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 text-sm font-medium",children:[g.displayName??g.modelId,d&&l.jsx(qt,{tone:"brand",children:x.models.default}),g.vision&&l.jsx(qt,{tone:"green",children:x.models.visionBadge}),f&&l.jsx(qt,{tone:"amber",children:x.models.visionModelBadge})]}),g.displayName!==void 0&&l.jsx("span",{className:"truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:g.modelId})]}),n&&F1(n.provider,n.modelId)&&l.jsxs("a",{href:F1(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,l.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:l.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"})})]})]}),R&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:q?x.models.addAutoRouteHint:x.models.addProtocolHint}),te]}),c&&l.jsx("div",{className:"space-y-1.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(ke,{size:"sm",disabled:N||!g.modelId.trim(),onClick:()=>{D()},children:N?x.models.testing:x.models.testConnection}),!R&&!d&&l.jsx(ke,{size:"sm",onClick:()=>A("setDefault"),children:x.models.setDefault}),!R&&g.vision&&!f&&l.jsx(ke,{size:"sm",title:x.models.visionModelHint,onClick:()=>A("setVisionModel"),children:x.models.setVisionModel}),!R&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(ke,{size:"sm",variant:"danger",onClick:()=>A("remove"),children:x.models.remove})]})]})}),l.jsxs("div",{className:"block",children:[l.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.apiKey}),B?.apiKeyUrl&&l.jsxs("a",{href:B.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," ↗"]})]}),l.jsx(ms,{size:"sm",value:g.apiKeyInput,disabled:!c,onChange:H=>P({apiKeyInput:H.target.value,clearApiKey:!1}),className:"font-mono",autoComplete:"off",autoFocus:!R,placeholder:O})]}),z&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:z}),g.credential?.apiKeyMasked&&!g.apiKeyInput&&l.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[l.jsx("span",{className:"font-mono",children:g.credential.apiKeyMasked}),g.credential.createdAt&&l.jsxs("span",{className:"text-gray-400",children:[x.common.created," ",fa(g.credential.createdAt)]}),c&&l.jsxs("label",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"checkbox",checked:g.clearApiKey,onChange:H=>P({clearApiKey:H.target.checked})}),x.models.clearApiKey]})]}),l.jsx(nt,{size:"sm",label:x.models.baseUrl,required:$,value:g.baseUrl,disabled:!c,onChange:H=>P({baseUrl:H.target.value}),className:"font-mono",placeholder:I?x.models.baseUrlHint:"https://…",...k.baseUrl?{error:k.baseUrl}:{},...L?{}:{hint:x.models.baseUrlOfficialNote}}),l.jsxs("div",{className:"grid grid-cols-2 items-start gap-2",children:[l.jsxs("label",{className:"block",children:[l.jsx(no,{children:x.models.contextWindow}),l.jsxs("span",{className:"relative block",children:[l.jsx(nt,{size:"sm",value:g.contextWindow,inputMode:"numeric",disabled:!c,invalid:!!k.contextWindow,onChange:H=>P({contextWindow:jb(H.target.value)}),className:"pr-12 font-mono",title:I?x.models.contextWindowHint:x.models.contextWindowDefaultHint(qm),placeholder:I?x.models.contextWindowHint:x.models.contextWindowDefaultHint(qm)}),l.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&&l.jsx(Bs,{children:k.contextWindow})]}),l.jsxs("label",{className:"block",children:[l.jsx(no,{children:x.models.maxTokens}),l.jsxs("span",{className:"relative block",children:[l.jsx(nt,{size:"sm",value:g.maxTokens,inputMode:"numeric",disabled:!c,invalid:!!k.maxTokens,onChange:H=>P({maxTokens:jb(H.target.value)}),className:"pr-12 font-mono",title:x.models.maxTokensTitle,placeholder:x.models.maxTokensHint}),l.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&&l.jsx(Bs,{children:k.maxTokens})]})]}),l.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(([H,Z,ce])=>l.jsxs("label",{className:"block",children:[l.jsx(no,{children:Z}),l.jsxs("span",{className:"relative block",children:[l.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-2 flex items-center text-xs text-gray-400",children:E2[o]}),l.jsx(nt,{size:"sm",value:ce,inputMode:"decimal",disabled:!c,invalid:!!k[H],onChange:E=>P({[H]:yI(E.target.value)}),className:"pl-4 pr-11 text-right font-mono"}),l.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[H]&&l.jsx(Bs,{children:k[H]})]},H))}),!R&&te,!R&&!I&&g.clientType&&g.clientType!=="openai"&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.models.clientTypeLocked(g.clientType)}),!I&&l.jsxs("div",{children:[l.jsxs("label",{className:`inline-flex items-center gap-2 ${c?"cursor-pointer":"cursor-not-allowed"}`,children:[l.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.vision}),l.jsx(T2,{checked:g.vision,disabled:!c,onChange:H=>P({vision:H}),"aria-label":x.models.vision})]}),!g.vision&&l.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:x.models.visionOffProxyHint})]})]}),M&&l.jsx(ma,{open:!0,title:NI[M](),tone:M==="remove"?"danger":"primary",onClose:()=>A(null),onConfirm:()=>{const H=M;A(null),W(H)},children:l.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:CI[M](g.displayName??g.modelId)})})]})}function MI({provider:e,count:n,onClose:r,onSubmit:s}){const[o,c]=v.useState("");return l.jsx(kn,{open:!0,title:x.models.groupApiKeyTitle(e.label),onClose:r,footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:r,children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:!o.trim(),onClick:()=>s(o.trim()),children:x.common.confirm})]}),children:l.jsxs("div",{className:"space-y-2",children:[l.jsx(nt,{size:"sm",label:x.models.apiKey,required:!0,type:"password",value:o,onChange:d=>c(d.target.value),className:"font-mono",autoComplete:"off",autoFocus:!0,placeholder:x.models.apiKeyEnvHint(e.envKey)}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.models.groupApiKeyHint(n)}),x.models.providerEnvNotes[e.id]&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.models.providerEnvNotes[e.id]}),e.apiKeyUrl&&l.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 to=200,Fs=46,Au=8,lo=10,EI=22;function Ep(e,n,r){const s=Math.max(0,r-Fs-Au),o=to-lo-EI,c=e>0?s/e:s;return{n:e,max:n,w:r,innerW:s,innerH:o,step:c,x:d=>Fs+c*d+c/2,y:d=>lo+o*(1-(n>0?d/n:0))}}function AI(e,n){return n.map((r,s)=>`${s===0?"M":"L"}${e.x(s)},${e.y(r)}`).join(" ")}function RI(e,n){const r=n.length;if(r===0)return"";const s=e.y(0),o=[];for(let c=0;c<r;c++)o.push(`${c===0?"M":"L"}${e.x(c)},${e.y(n[c])}`);return o.push(`L${e.x(r-1)},${s}`),o.push(`L${e.x(0)},${s}`),o.push("Z"),o.join(" ")}function _I(e){return e<=0?[]:e===1?[0]:e===2?[0,1]:[0,Math.floor((e-1)/2),e-1]}const II=40;function LI(e,n){if(e<=0)return[];const r=n>0?Math.max(1,Math.ceil(II/n)):e,s=[];for(let o=0;o<e;o+=r)s.push(o);return s}function DI(e,n){return n>0?e/n:1}const tu=12;function OI(e,n,r,s,o){let c=e+tu;c+r>o.right&&(c=e-tu-r);let d=n+tu;return d+s>o.bottom&&(d=n-tu-s),{left:Math.max(o.left,Math.min(c,o.right-r)),top:Math.max(0,Math.min(d,o.bottom-s))}}const Fm=25,zI=8;function UI(e,n){const r=Math.max(0,e-Fs-Au),s=2*Fm*n;return s<=r?{barW:Fm,chartW:e,scroll:!1}:{barW:Fm,chartW:Fs+s+Au,scroll:!0}}function $I(e,n,r){const s=e.length;if(s===0)return[];if(n<=s*r)return e.map(()=>n/s);const o=new Set;for(;;){const c=n-o.size*r,d=e.reduce((h,g,y)=>o.has(y)?h:h+g,0),f=h=>d>0?e[h]/d*c:c/(s-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 BI=["output","cacheWrite","cacheRead"];function HI(e,n){const r=BI.map(m=>({key:m,value:n[m]})).filter(m=>m.value>0);if(r.length===0)return[];const s=[];let o=0;for(const m of r){const h=e.y(o);o+=m.value;const g=e.y(o);s.push({y:g,h:h-g})}const c=e.y(0),d=$I(s.map(m=>m.h),c-e.y(o),zI);let f=c;return r.map((m,h)=>{const g=d[h],y={key:m.key,value:m.value,y:s[h].y,h:s[h].h,hitY:f-g,hitH:g};return f-=g,y})}const A2=Math.PI*2,Ru=e=>Math.round(e*100)/100;function nu(e,n,r,s){const o=s-Math.PI/2;return[Ru(e+r*Math.cos(o)),Ru(n+r*Math.sin(o))]}function PI(e,n,r,s,o){if(o-s>=A2-1e-9){const[g,y]=nu(e,n,r,0),[k,w]=nu(e,n,r,Math.PI);return`M${g},${y} A${r},${r} 0 1 1 ${k},${w} A${r},${r} 0 1 1 ${g},${y} Z`}const[c,d]=nu(e,n,r,s),[f,m]=nu(e,n,r,o),h=o-s>Math.PI?1:0;return`M${Ru(e)},${Ru(n)} L${c},${d} A${r},${r} 0 ${h} 1 ${f},${m} Z`}function qI(e,n,r,s){const o=e.reduce((f,m)=>f+Math.max(0,m),0);if(o<=0)return[];const c=[];let d=0;return e.forEach((f,m)=>{if(f<=0)return;const h=f/o,g=d+h*A2;c.push({index:m,value:f,frac:h,start:d,end:g,path:PI(n,r,s,d,g)}),d=g}),c}function Ap(){const e=v.useRef(null),[n,r]=v.useState(0);return v.useLayoutEffect(()=>{const s=e.current;if(!s)return;const o=()=>r(Math.floor(s.getBoundingClientRect().width));o();const c=new ResizeObserver(o);return c.observe(s),()=>c.disconnect()},[]),[e,n]}function Rp({geom:e,fmtY:n,dates:r,hover:s,onHover:o,bubble:c,hitLayer:d,labels:f,hoverLine:m=!0,scrollToEnd:h=!1,children:g}){const{x:y,y:k,w,innerH:N,step:C,max:M}=e,A=[0,.25,.5,.75,1].map(B=>M*B),R=f??_I(r.length),I=v.useRef(null);v.useLayoutEffect(()=>{const B=I.current;!h||!B||(B.scrollLeft=B.scrollWidth-B.clientWidth)},[h,w,r.length]);const P=v.useRef(null),D=v.useRef(null),L=v.useRef(null),$=v.useRef(0),Q=()=>{const B=D.current,V=P.current,q=I.current,X=L.current;if(!B||!V||!q||!X)return;const te=V.getBoundingClientRect(),O=OI(X.cx-te.left,X.cy-te.top,B.offsetWidth,B.offsetHeight,{left:q.scrollLeft,right:q.scrollLeft+q.clientWidth,bottom:to});B.style.left=`${O.left}px`,B.style.top=`${O.top}px`,B.style.visibility="visible"},W=()=>{$.current||($.current=requestAnimationFrame(()=>{$.current=0,Q()}))};return v.useEffect(()=>()=>cancelAnimationFrame($.current),[]),v.useLayoutEffect(Q,[c,s]),l.jsxs("div",{ref:I,className:"relative overflow-x-auto",children:[l.jsxs("svg",{ref:P,viewBox:`0 0 ${w} ${to}`,width:w,height:to,className:"text-gray-600 dark:text-gray-400",role:"img",onMouseLeave:()=>{o(null),L.current=null},onMouseMove:B=>{L.current={cx:B.clientX,cy:B.clientY},W()},children:[A.map((B,V)=>l.jsxs("g",{children:[l.jsx("line",{x1:Fs,x2:w-Au,y1:k(B),y2:k(B),className:"stroke-gray-200 dark:stroke-gray-800",strokeWidth:1}),l.jsx("text",{x:Fs-6,y:k(B)+3,textAnchor:"end",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:n(B)})]},V)),m&&s!==null&&r[s]&&l.jsx("line",{x1:y(s),x2:y(s),y1:lo,y2:lo+N,className:"stroke-gray-300 dark:stroke-gray-700",strokeWidth:1}),g,R.map(B=>{const V=r[B];return V?l.jsx("text",{x:y(B),y:to-6,textAnchor:"middle",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:V.slice(5)},B):null}),d??r.map((B,V)=>l.jsx("rect",{x:Fs+C*V,y:lo,width:C,height:N,fill:"transparent",className:"cursor-crosshair",onMouseEnter:()=>o(V)},`hit-${V}`))]}),c&&s!==null&&r[s]&&l.jsx("div",{ref:D,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:c(s)})]})}function FI({points:e,currency:n="USD"}){const[r,s]=v.useState(null),[o,c]=Ap(),d=e.map(g=>g.cost??0),f=Math.max(1e-9,...d),m=Ep(e.length,f,c),h=e.map(g=>g.date);return l.jsx("div",{ref:o,children:c>0&&l.jsx(Rp,{geom:m,fmtY:g=>Ra(g,n),dates:h,hover:r,onHover:s,bubble:g=>{const y=e[g];return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:y.date}),l.jsx("p",{className:"font-mono",children:Ra(y.cost,n)})]})},children:l.jsxs("g",{children:[l.jsx("path",{d:RI(m,d),className:"fill-current",stroke:"none",opacity:r!==null?.06:.1}),l.jsx("path",{d:AI(m,d),fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),e.map((g,y)=>l.jsx("circle",{cx:m.x(y),cy:m.y(g.cost??0),r:r===y?4:2.5,className:"fill-current",opacity:r!==null&&r!==y?.25:1},g.date))]})})})}const io={cacheRead:"#7dd3fc",cacheWrite:"#0ea5e9",output:"#0369a1"},Cb=[{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 Tb(e){return Cb[e%Cb.length]}const Mb=[{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 R2(e){return Mb[e%Mb.length]}function Qu({text:e}){return l.jsx("p",{className:"py-6 text-center text-xs text-gray-400",children:e??x.usage.empty})}function VI(e){return e==="cacheRead"?x.usage.colCacheRead:e==="cacheWrite"?x.usage.colCacheWrite:x.usage.colOutput}const _2="opacity-25",au=160,GI=75;function WI({data:e}){const[n,r]=v.useState(null),s=e.reduce((m,h)=>m+h.requests,0);if(e.length===0||s<=0)return l.jsx(Qu,{});const o=[...e].sort((m,h)=>h.requests-m.requests),c=qI(o.map(m=>m.requests),au/2,au/2,GI),d=m=>`${Math.round(m/s*100)}%`,f=m=>n!==null&&n!==m?_2:"";return l.jsxs("div",{className:"flex items-center gap-3",onMouseLeave:()=>r(null),children:[l.jsx("svg",{viewBox:`0 0 ${au} ${au}`,className:"h-40 w-40 shrink-0",role:"img","aria-label":x.usage.chartAgentCalls,children:c.map(m=>{const h=o[m.index];return l.jsx("path",{d:m.path,onMouseEnter:()=>r(m.index),className:`cursor-pointer ${Tb(m.index).fill} transition-opacity duration-150 ${f(m.index)}`,children:l.jsx("title",{children:`${h.agentId} · ${h.requests} ${x.usage.requests} · ${d(h.requests)}`})},h.agentId)})}),l.jsx("ul",{className:"flex max-h-40 min-w-0 flex-1 flex-col gap-1 overflow-y-auto",children:o.map((m,h)=>l.jsxs("li",{onMouseEnter:()=>r(m.requests>0?h:null),title:`${m.agentId} · ${m.requests} ${x.usage.requests} · ${ot(m.total)}`,className:`flex cursor-pointer items-center gap-1.5 text-[10px] transition-opacity duration-150 ${f(h)}`,children:[l.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${Tb(h).swatch}`}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-gray-500 dark:text-gray-400",children:m.agentId}),l.jsx("span",{className:"shrink-0 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:m.requests}),l.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 KI({dimmed:e,onEnter:n,title:r,label:s,value:o,children:c}){return l.jsxs("div",{onMouseEnter:n,className:`flex cursor-pointer items-center gap-2 transition-opacity duration-150 ${e?_2:""}`,title:r,children:[l.jsx("span",{className:"w-24 shrink-0 truncate font-mono text-[10px] text-gray-500 dark:text-gray-400",children:s}),c,l.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 YI(e){return Np(e.provider,e.modelId)?.displayName??e.modelId}function QI(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 XI({data:e}){const[n,r]=v.useState(null);return e.length===0?l.jsx(Qu,{}):l.jsx("div",{className:"flex flex-col gap-1.5",onMouseLeave:()=>r(null),children:e.map((s,o)=>{const c=DI(s.completed,s.total),d=Math.round(c*100);return l.jsx(KI,{dimmed:n!==null&&n!==o,onEnter:()=>r(o),title:QI(s),label:YI(s),value:`${d}%`,children:l.jsx("div",{className:"h-3 min-w-0 flex-1 overflow-hidden rounded-sm bg-gray-200 dark:bg-gray-800",children:l.jsx("div",{className:"h-full rounded-sm bg-sky-500 dark:bg-sky-400",style:{width:`${c*100}%`}})})},`${s.provider}:${s.modelId}`)})})}function ZI({trend:e,legend:n}){const[r,s]=v.useState(null),[o,c]=Ap();if(e.length===0)return l.jsx(Qu,{});const d=e.map(C=>C.cacheRead+C.cacheWrite+C.output),f=Math.max(1,...d),{barW:m,chartW:h,scroll:g}=UI(c,e.length),y=Ep(e.length,f,h),k=e.map(C=>C.date),w=e.map(C=>HI(y,C)),N=(C,M)=>r!==null&&!(r.i===C&&r.key===M)||n!=null&&n!==M;return l.jsx("div",{ref:o,children:c>0&&l.jsx(Rp,{geom:y,fmtY:C=>ot(Math.round(C)),dates:k,hover:r?.i??null,labels:LI(e.length,y.step),hoverLine:!1,scrollToEnd:g,onHover:C=>{C===null&&s(null)},bubble:C=>{const M=e[C],A=r?.key;if(!A)return null;const R=A==="cacheRead"?Tv(M.cacheRead,M.cacheWrite):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:M.date}),l.jsxs("p",{className:"font-mono",children:[VI(A)," ",ot(M[A])]}),R!==null&&l.jsxs("p",{className:"font-mono",children:[x.traces.hitRate," ",Kh(R)]})]})},hitLayer:e.map((C,M)=>w[M].map(A=>l.jsx("rect",{x:y.x(M)-m/2,y:A.hitY,width:m,height:A.hitH,fill:"transparent",className:"cursor-pointer",onMouseEnter:()=>s({i:M,key:A.key}),onMouseLeave:()=>s(null)},`hit-${C.date}-${A.key}`))),children:e.map((C,M)=>w[M].map(A=>l.jsx("rect",{x:y.x(M)-m/2,y:A.y,width:m,height:A.h,fill:io[A.key],className:"transition-opacity duration-150",opacity:N(M,A.key)?.2:1},`${C.date}-${A.key}`)))})})}function JI({active:e,onHover:n}){const r=[["cacheRead",x.usage.colCacheRead],["cacheWrite",x.usage.colCacheWrite],["output",x.usage.colOutput]];return l.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:r.map(([s,o])=>l.jsxs("button",{type:"button",onMouseEnter:()=>n?.(s),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!==s?"opacity-30":""}`,children:[l.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{backgroundColor:io[s]}}),o]},s))})}function eL(e){return e==="unexpected"?x.usage.errorsUnexpected:x.usage.errorsExpected}function tL(e){return e==="unexpected"?"unexpected":"expected"}function ru({label:e,value:n,alert:r,muted:s}){const o=r?"text-rose-600 dark:text-rose-400":s?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return l.jsxs("div",{className:"flex items-baseline gap-1.5",children:[l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e}),l.jsx("span",{className:`font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function su({children:e,className:n=""}){return l.jsx("th",{className:`py-1.5 pr-2 font-medium ${n}`,children:e})}function nL({errors:e}){const{total:n,unexpected:r,topCode:s,recent:o}=e,[c,d]=v.useState(new Set),f=m=>d(h=>{const g=new Set(h);return g.has(m)?g.delete(m):g.add(m),g});return l.jsxs("div",{children:[l.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-6 gap-y-1.5",children:[l.jsx(ru,{label:x.usage.errorsTotal,value:String(n)}),l.jsx(ru,{label:x.usage.errorsUnexpected,value:String(r),alert:r>0,muted:r===0}),l.jsx(ru,{label:x.usage.errorsExpected,value:String(n-r),muted:!0}),s&&l.jsx(ru,{label:x.usage.errorsTopCode,value:`${s.source} · ${s.code} ×${s.count}`})]}),o.length===0?l.jsx(Qu,{text:x.usage.errorsEmpty}):l.jsx("div",{className:"mt-2.5 max-h-72 overflow-y-auto border-t border-gray-200 dark:border-gray-800",children:l.jsxs("table",{className:"w-full table-fixed text-xs",children:[l.jsx("thead",{className:"sticky top-0 bg-white text-left text-gray-400 dark:bg-gray-900 dark:text-gray-500",children:l.jsxs("tr",{children:[l.jsx(su,{className:"w-32",children:x.common.time}),l.jsx(su,{className:"w-72",children:x.usage.errorsColCode}),l.jsx(su,{className:"w-20",children:x.usage.errorsColKind}),l.jsx(su,{children:x.usage.errorsColMessage})]})}),l.jsx("tbody",{children:o.map((m,h)=>{const g=tL(m.kind);return l.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[l.jsx("td",{className:"py-1.5 pr-2 align-top font-mono tabular-nums text-gray-400",children:fa(m.ts)}),l.jsx("td",{className:"py-1.5 pr-2 align-top font-mono text-gray-500 dark:text-gray-400",children:l.jsxs("span",{className:"block break-words",children:[m.source," · ",m.code]})}),l.jsx("td",{className:"py-1.5 pr-2 align-top",children:l.jsx(qt,{tone:g==="unexpected"?"red":"gray",children:eL(g)})}),l.jsx("td",{className:"py-1.5 align-top text-gray-500 dark:text-gray-400",children:l.jsx("button",{type:"button",title:m.message,onClick:()=>f(h),className:`block w-full cursor-pointer text-left transition-colors hover:text-gray-700 dark:hover:text-gray-300 ${c.has(h)?"whitespace-pre-wrap break-words":"truncate"}`,children:m.message})})]},`${m.ts}-${h}`)})})]})})]})}function Eb(e){const n=r=>r<10?`0${r}`:`${r}`;return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function Vm({label:e,value:n,muted:r,sup:s}){const o=r?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return l.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[l.jsxs("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:[e,s&&l.jsx("sup",{className:"ml-px",children:"*"})]}),l.jsx("span",{className:`min-w-0 truncate font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function Gm({title:e,bucket:n,currency:r}){return l.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("p",{className:"mb-1.5 text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(Vm,{label:x.usage.tokens,value:ot(n.total)}),l.jsx(Vm,{label:x.usage.requests,value:String(n.requests),muted:!0}),l.jsx(Vm,{label:x.common.cost,value:Ra(n.cost,r),sup:n.hasUncosted})]})]})}function Qi({title:e,extra:n,children:r}){return l.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),n]}),r]})}function aL(){or(x.usage.title);const{currency:e}=Gs(),{currentProject:n}=hn(),r=n?.projectId??null,[s]=Fh(),o=s.get("agentId"),[c,d]=v.useState(o??""),[f,m]=v.useState(null);v.useEffect(()=>{d(o??"")},[o]);const[h,g]=v.useState(()=>{const W=new Date;return W.setDate(W.getDate()-29),Eb(W)}),[y,k]=v.useState(()=>Eb(new Date)),[w,N]=v.useState(null),[C,M]=v.useState(null),[A,R]=v.useState(null),I=v.useCallback(async()=>{if(r){M(null);try{const W=await Qb(r,{from:h,to:y,groupBy:"date",...c?{agentId:c}:{},...f?{provider:f.provider,modelId:f.modelId}:{}});N(W)}catch(W){M(Ie(W))}}},[r,h,y,c,f?.provider,f?.modelId]);if(v.useEffect(()=>{N(null),I()},[I]),!r)return null;const P=w?.models??[],D=f?P.findIndex(W=>W.provider===f.provider&&W.modelId===f.modelId):-1,L=D>=0?String(D):"",$=w?.summary,Q=($?.today.hasUncosted??!1)||($?.last7d.hasUncosted??!1)||($?.total.hasUncosted??!1);return l.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:l.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsx("h1",{className:"text-xl font-semibold",children:x.usage.title}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"w-32",children:l.jsxs(yo,{size:"sm",value:c,onChange:W=>d(W.target.value),children:[l.jsx("option",{value:"",children:x.usage.filterAllAgents}),c&&!(w?.agentIds??[]).includes(c)&&l.jsx("option",{value:c,children:c}),(w?.agentIds??[]).map(W=>l.jsx("option",{value:W,children:W},W))]})}),l.jsx("div",{className:"w-32",children:l.jsxs(yo,{size:"sm",value:L,onChange:W=>{const B=W.target.value;m(B===""?null:P[Number(B)]??null)},children:[l.jsx("option",{value:"",children:x.usage.filterAllModels}),P.map((W,B)=>l.jsx("option",{value:String(B),children:Np(W.provider,W.modelId)?.displayName??W.modelId},`${W.provider}:${W.modelId}`))]})}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(nt,{size:"sm",type:"date","aria-label":x.usage.from,value:h,onChange:W=>g(W.target.value)}),l.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:"–"}),l.jsx(nt,{size:"sm",type:"date","aria-label":x.usage.to,value:y,onChange:W=>k(W.target.value)})]})]})]}),w?l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[l.jsx(Gm,{title:x.usage.today,bucket:w.summary.today,currency:e}),l.jsx(Gm,{title:x.usage.last7d,bucket:w.summary.last7d,currency:e}),l.jsx(Gm,{title:x.usage.total,bucket:w.summary.total,currency:e})]}):l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[l.jsx(Pt,{className:"h-24"}),l.jsx(Pt,{className:"h-24"}),l.jsx(Pt,{className:"h-24"})]}),w?l.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[l.jsx(Qi,{title:x.usage.chartAgentCalls,children:l.jsx(WI,{data:w.byAgent})}),l.jsx(Qi,{title:x.usage.chartSuccessRate,children:l.jsx(XI,{data:w.success})}),l.jsx(Qi,{title:x.usage.chartTokenTrend,extra:l.jsx(JI,{active:A,onHover:R}),children:l.jsx(ZI,{trend:w.trend,legend:A})}),l.jsx(Qi,{title:x.usage.chartCostTrend,children:l.jsx(FI,{points:w.trend,currency:e})})]}):l.jsx(Pt,{className:"h-64"}),w&&l.jsx(Qi,{title:x.usage.errors,children:l.jsx(nL,{errors:w.errors})}),Q&&l.jsx("p",{className:"text-xs text-gray-400",children:x.usage.uncostedNote}),C&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:C})]})})}function rL({cacheRead:e,cacheWrite:n,output:r,max:s,size:o=44}){const c=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(s,c,1),y=s>0?c/s:0,k=y>.95?"text-red-500":y>.8?"text-amber-500":"text-gray-300 dark:text-gray-700",w=[{key:"cacheRead",value:e,color:io.cacheRead,label:x.usage.colCacheRead},{key:"cacheWrite",value:n,color:io.cacheWrite,label:x.usage.colCacheWrite},{key:"output",value:r,color:io.output,label:x.usage.colOutput}],N=`${x.chat.contextUsage} ${ot(c)}/${ot(s)}`+w.map(M=>` · ${M.label} ${ot(M.value)}`).join("");let C=0;return l.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,className:`block shrink-0 ${k}`,role:"img","aria-label":N,children:[l.jsx("title",{children:N}),l.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:"currentColor",strokeOpacity:.35,strokeWidth:d}),w.map(M=>{if(M.value<=0)return null;const A=M.value/g*h,R=-(C/g)*h;return C+=M.value,l.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:M.color,strokeWidth:d,strokeDasharray:`${A} ${h}`,strokeDashoffset:R,transform:`rotate(-90 ${f} ${f})`},M.key)})]})}const qa={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"},_p="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",I2="truncate font-mono text-[11px]",Ab=.25,Eh=24,sL=1/Eh,Er=(e,n,r)=>Math.min(r,Math.max(n,e));function lL(e){return e==="thinking"?qa.thinking:e==="text"?qa.text:qa.toolgen}function iL(e){return e==="thinking"?x.traces.kindThinking:e==="text"?x.traces.kindModelReply:x.traces.kindToolGen}function oL(e){return e==="thinking"?"thinking":e==="text"?"text":"toolgen"}function Xi(e){if(e===void 0)return null;const n=Date.parse(e);return Number.isFinite(n)?n:null}function cL(e,n){const r=new Map,s=c=>{let d=r.get(c);return d||(d={segs:[],spans:[]},r.set(c,d)),d};for(const c of e){const d=Xi(c.startTs),f=Xi(c.endTs);d===null||f===null||s(c.taskIndex).segs.push({kind:c.kind,...c.name!==void 0?{name:c.name}:{},ts:c.endTs,startMs:d,endMs:f})}for(const c of n){const d=Xi(c.callTs);d!==null&&s(c.taskIndex).spans.push({name:c.name||c.toolCallId,toolCallId:c.toolCallId,callTs:c.callTs,...c.approvalTs!==void 0?{approvalTsRaw:c.approvalTs}:{},...c.outputTs!==void 0?{outputTsRaw:c.outputTs}:{},callMs:d,approvalMs:Xi(c.approvalTs),outputMs:Xi(c.outputTs),failed:c.stopReason!==void 0&&c.stopReason!=="completed",...c.stopReason!==void 0?{status:c.stopReason}:{},...c.decision!==void 0?{decision:c.decision}:{}})}const o=[];for(const[c,{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(N=>N.startMs),...f.map(N=>N.callMs)],h=[...d.map(N=>N.endMs),...f.map(N=>N.outputMs??N.approvalMs??N.callMs)],g=Math.min(...m),y=Math.max(...h,...m),k=Math.max(1,y-g);f.sort((N,C)=>N.callMs-C.callMs);const w=[...new Set(f.map(N=>N.name))];o.push({taskIndex:c,segs:d,spans:f,t0:g,total:k,toolNames:w})}return o}function L2({children:e}){return l.jsx("div",{className:"relative h-4 min-w-0 flex-1 overflow-hidden bg-gray-100 dark:bg-gray-800/60",children:e})}function uL({label:e,children:n}){return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:`${_p} text-gray-400 dark:text-gray-500`,title:e,children:l.jsx("span",{className:I2,children:e})}),l.jsx(L2,{children:n})]})}function dL({total:e}){const n=[0,.25,.5,.75,1];return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:_p}),l.jsx("div",{className:"relative h-4 min-w-0 flex-1",children:n.map((r,s)=>l.jsx("span",{className:`absolute top-0 font-mono text-[11px] text-gray-400 dark:text-gray-500 ${s===0?"":s===n.length-1?"-translate-x-full":"-translate-x-1/2"}`,style:{left:`${r*100}%`},children:mn(r*e)},s))})]})}function fL({segments:e,toolSpans:n,highlight:r,onHighlight:s,onJump:o,hideTaskLabel:c=!1}){const d=v.useMemo(()=>cL(e,n),[e,n]),{firstBarKeyByTs:f,barKeys:m}=v.useMemo(()=>{const U=new Map,j=new Set,K=(se,oe)=>{j.add(oe),U.has(se)||U.set(se,oe)};for(const se of d){se.segs.forEach((oe,pe)=>K(oe.ts,`s-${se.taskIndex}-${pe}`));for(const oe of se.spans)oe.approvalMs!==null&&oe.approvalMs>oe.callMs&&K(oe.approvalTsRaw??oe.callTs,`w-${oe.toolCallId}`),oe.approvalMs===null&&oe.outputMs===null?K(oe.callTs,`p-${oe.toolCallId}`):K(oe.outputTsRaw??oe.callTs,`e-${oe.toolCallId}`)}return{firstBarKeyByTs:U,barKeys:j}},[d]),[h,g]=v.useState(null),[y,k]=v.useState(1),[w,N]=v.useState({left:0,width:1}),C=v.useRef(null),M=v.useRef(null),A=v.useRef(w);A.current=w;const R=v.useRef(y);R.current=y;const I=v.useRef(null),P=v.useRef(null),D=v.useCallback(()=>{const U=C.current;if(!U)return;const j=U.scrollWidth||1;N({left:U.scrollLeft/j,width:Math.min(1,U.clientWidth/j)})},[]);if(v.useLayoutEffect(()=>{const U=C.current;if(U){if(I.current){const j=U.scrollWidth-U.clientWidth;U.scrollLeft=Er(I.current(U),0,Math.max(0,j)),I.current=null}D()}},[y,d,D]),v.useLayoutEffect(()=>{const U=C.current;if(!U||typeof ResizeObserver>"u")return;const j=new ResizeObserver(()=>D());return j.observe(U),()=>j.disconnect()},[D]),v.useLayoutEffect(()=>()=>P.current?.(),[]),d.length===0)return l.jsx("p",{className:"text-xs text-gray-400",children:x.common.none});const L=r?.ts,$=r?.key,Q=(U,j)=>s?.(j?{ts:j,key:U}:null),W=()=>s?.(null),B=$??(L!==void 0?f.get(L):void 0),V=B!==void 0&&m.has(B)?B:void 0,q=V!==void 0,X=U=>V===U,te=(U,j)=>h!==null&&!j||q&&!U?"opacity-15":"",O=(U,j,K,se)=>{const oe=Er((U-K)/se*100,0,100),pe=Er((j-U)/se*100,0,100-oe);return oe>=100?{left:"100%",width:"0%",marginLeft:"-2px"}:{left:`${oe}%`,width:`${pe}%`}},z=[{key:"thinking",className:qa.thinking,label:x.traces.kindThinking},{key:"text",className:qa.text,label:x.traces.kindModelReply},{key:"toolgen",className:qa.toolgen,label:x.traces.kindToolGen},{key:"approvalWait",className:qa.approvalWait,label:x.traces.legendApprovalWait},{key:"exec",className:qa.exec,label:x.traces.legendToolExec}],H=(U,j)=>{const K=Er(j,sL,1),se=Er(1/K,Ab,Eh),oe=Er(U,0,1-K);I.current=pe=>oe*pe.scrollWidth,k(se)},Z=U=>{U.preventDefault();const j=M.current,K=C.current;if(!j||!K)return;const se=j.getBoundingClientRect().width||1,oe=U.clientX,pe=K.scrollLeft,Se=Math.max(0,K.scrollWidth-K.clientWidth),ie=be=>{const ze=(be.clientX-oe)/se;K.scrollLeft=Er(pe+ze*K.scrollWidth,0,Se),D()},he=()=>{window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he),P.current=null};window.addEventListener("pointermove",ie),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he),P.current=he},ce=U=>j=>{j.preventDefault(),j.stopPropagation();const K=M.current;if(!K)return;const se=K.getBoundingClientRect(),oe=Se=>{const ie=Er((Se.clientX-se.left)/(se.width||1),0,1),he=A.current;if(U==="right")H(he.left,ie-he.left);else{const be=he.left+he.width;H(ie,be-ie)}},pe=()=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",pe),window.removeEventListener("pointercancel",pe),P.current=null};window.addEventListener("pointermove",oe),window.addEventListener("pointerup",pe),window.addEventListener("pointercancel",pe),P.current=pe},E=()=>{I.current=()=>0,k(1)},T=U=>{const j=C.current,K=Er(R.current*U,Ab,Eh);if(K!==R.current){if(j){const se=j.clientWidth/2,oe=(j.scrollLeft+se)/(j.scrollWidth||1);I.current=pe=>oe*pe.scrollWidth-se}k(K)}};return l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{ref:C,className:"no-scrollbar overflow-x-auto overflow-y-hidden",children:l.jsx("div",{className:"space-y-4",style:{width:`${y*100}%`},children:d.map(U=>l.jsxs("div",{className:"space-y-1",children:[!c&&l.jsxs("div",{className:"flex items-center gap-2 pl-[5.5rem]",children:[l.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(U.taskIndex+1)}),l.jsx("span",{className:"font-mono text-[11px] text-gray-400",children:mn(U.total)})]}),l.jsx(uL,{label:x.traces.laneLLM,children:U.segs.map((j,K)=>{const se=oL(j.kind),oe=h===null||h===se,pe=`s-${U.taskIndex}-${K}`,Se=X(pe);return l.jsx("span",{onMouseEnter:()=>Q(pe,j.ts),onMouseLeave:W,onClick:()=>o?.(j.ts),title:`${iL(j.kind)}${j.name?` ${j.name}`:""} · ${mn(j.endMs-j.startMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${lL(j.kind)} ${te(Se,oe)}`,style:O(j.startMs,j.endMs,U.t0,U.total)},K)})}),U.spans.map(j=>{const K=j.approvalMs??j.callMs,se=j.outputMs===null,oe=j.outputMs??U.t0+U.total,pe=j.approvalTsRaw??j.callTs,Se=j.outputTsRaw??j.callTs;return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:`${_p} text-gray-500 dark:text-gray-400`,title:j.name,children:l.jsx("span",{className:I2,children:j.name})}),l.jsxs(L2,{children:[j.approvalMs!==null&&j.approvalMs>j.callMs&&l.jsx("span",{onMouseEnter:()=>Q(`w-${j.toolCallId}`,pe),onMouseLeave:W,onClick:()=>o?.(pe),title:`${j.name} · ${x.traces.legendApprovalWait}${j.decision?` (${j.decision})`:""} · ${mn(j.approvalMs-j.callMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${qa.approvalWait} ${te(X(`w-${j.toolCallId}`),h===null||h==="approvalWait")}`,style:O(j.callMs,j.approvalMs,U.t0,U.total)}),j.approvalMs===null&&se?(()=>{const ie=te(X(`p-${j.toolCallId}`),h===null||h==="approvalWait");return l.jsx("span",{onMouseEnter:()=>Q(`p-${j.toolCallId}`,j.callTs),onMouseLeave:W,onClick:()=>o?.(j.callTs),title:`${j.name} · ${x.traces.legendApprovalWait} · ${x.traces.inProgress}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${qa.approvalWait} ${ie||"animate-pulse"}`,style:O(j.callMs,oe,U.t0,U.total)})})():(()=>{const ie=te(X(`e-${j.toolCallId}`),h===null||h==="exec"),he=se&&!ie;return l.jsx("span",{onMouseEnter:()=>Q(`e-${j.toolCallId}`,Se),onMouseLeave:W,onClick:()=>o?.(Se),title:`${j.name} · ${x.traces.legendToolExec} · ${se?x.traces.inProgress:mn(oe-K)}${j.failed?` · ${j.status}`:""}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${qa.exec} ${j.failed?"ring-1 ring-red-500":""} ${he?"animate-pulse opacity-70":ie}`,style:O(K,oe,U.t0,U.total)})})()]})]},j.toolCallId)}),l.jsx(dL,{total:U.total})]},U.taskIndex))})}),l.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:z.map(U=>l.jsxs("button",{type:"button",onMouseEnter:()=>g(U.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!==U.key?"opacity-30":""}`,children:[l.jsx("span",{className:`inline-block h-2 w-3 rounded-sm ${U.className}`}),U.label]},U.key))}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:x.traces.zoom}),l.jsx("button",{type:"button","aria-label":x.traces.zoomOut,title:x.traces.zoomOut,onClick:()=>T(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:l.jsx("span",{className:"text-[11px] leading-none",children:"−"})}),l.jsx("div",{ref:M,onDoubleClick:E,title:x.traces.zoomReset,className:"relative h-3 min-w-0 flex-1 rounded bg-gray-100 dark:bg-gray-800",children:l.jsxs("div",{role:"scrollbar","aria-label":x.traces.zoom,onPointerDown:Z,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:[l.jsx("span",{onPointerDown:ce("left"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-l bg-gray-500/80 dark:bg-gray-400/80"}),l.jsx("span",{onPointerDown:ce("right"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-r bg-gray-500/80 dark:bg-gray-400/80"})]})}),l.jsx("button",{type:"button","aria-label":x.traces.zoomIn,title:x.traces.zoomIn,onClick:()=>T(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:l.jsx("span",{className:"text-[11px] leading-none",children:"+"})}),l.jsxs("span",{className:"w-9 shrink-0 text-right font-mono text-[11px] tabular-nums text-gray-400",children:[y.toFixed(2),"×"]})]}),s&&l.jsx("p",{className:"text-[11px] text-gray-400 dark:text-gray-600",children:x.traces.linkHint})]})}function mL(e){return e==="session_meta"?"brand":e==="model_msg"?"gray":"amber"}const hL={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"},pL="M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";function gL({type:e}){return l.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:l.jsx("path",{d:hL[e]??pL})})}function xL(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,s=n.session;return`request.total=${r?.total??0} session.total=${s?.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"goal_finished":return`${String(n.outcome)} · rounds=${String(n.rounds)} · tokens=${String(n.tokens_used)}`;case"subagent":return String(n.session_id??"");default:return e.type==="session_meta"?`${String(n.session_id??"")} · ${String(n.model_id??"")}`:""}}function yL(e){const n=e.payload;return n.stop_reason??n.status}const lu="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 bL({p:e}){const n=e.request??{},r=e.session??{},s=(o,c)=>l.jsxs("tr",{children:[l.jsx("td",{className:"pr-3 text-gray-400",children:o}),l.jsx("td",{className:"pr-3 text-right font-mono",children:ot(c.cache_read??0)}),l.jsx("td",{className:"pr-3 text-right font-mono",children:ot(c.cache_write??0)}),l.jsx("td",{className:"pr-3 text-right font-mono",children:ot(c.output??0)}),l.jsx("td",{className:"text-right font-mono",children:ot(c.total??0)})]});return l.jsxs("table",{className:"text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-gray-400",children:[l.jsx("th",{}),l.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheRead"}),l.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheWrite"}),l.jsx("th",{className:"pr-3 text-right font-normal",children:"output"}),l.jsx("th",{className:"text-right font-normal",children:"total"})]})}),l.jsxs("tbody",{children:[s("request",n),s("session",r)]})]})}const Rb="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 vL({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??"")],...typeof e.thinking_level=="string"&&e.thinking_level?[["thinking_level",e.thinking_level]]:[],["agent_state",String(e.agent_state??"")],["workspace",String(e.workspace??"")]],r=String(e.system_prompt??""),s=Array.isArray(e.tools)?e.tools:[];return l.jsxs("div",{className:"space-y-2.5",children:[l.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs",children:n.map(([o,c])=>l.jsxs(v.Fragment,{children:[l.jsx("dt",{className:"text-gray-400",children:o}),l.jsx("dd",{className:"min-w-0 break-all font-mono text-gray-700 dark:text-gray-300",children:c||"—"})]},o))}),r.trim()&&l.jsxs("details",{children:[l.jsx("summary",{className:Rb,children:x.traces.systemPrompt}),l.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:l.jsx(Vu,{remarkPlugins:[Gu],children:r})})]}),s.length>0&&l.jsxs("details",{children:[l.jsx("summary",{className:Rb,children:x.traces.toolDefs(s.length)}),l.jsx("ul",{className:"mt-1.5 space-y-1",children:s.map((o,c)=>l.jsxs("li",{className:"text-xs",children:[l.jsx("span",{className:"font-mono font-semibold text-gray-700 dark:text-gray-300",children:o.name??"—"}),o.description&&l.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:o.description})]},c))})]})]})}function kL({msg:e}){const n=e.payload;if(e.type==="session_meta")return l.jsx(vL,{p:n});switch(n.type){case"text":case"thinking":{const r=String(n.text??n.thinking??"");return r.trim()?l.jsx("div",{className:"md-body text-sm leading-relaxed text-gray-700 dark:text-gray-300",children:l.jsx(Vu,{remarkPlugins:[Gu],children:r})}):l.jsx("p",{className:"text-xs text-gray-400",children:"—"})}case"image_url":return l.jsx(qs,{src:String(n.image_url??""),alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"inline_data":return l.jsx(qs,{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 l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:String(n.name??"")}),l.jsx("pre",{className:lu,children:String(n.arguments??"")})]});case"tool_call_output":{const r=Array.isArray(n.images)?n.images:[];return r.length===0?l.jsx("pre",{className:lu,children:String(n.output??"")}):l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("pre",{className:lu,children:String(n.output??"")}),l.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((s,o)=>l.jsx(qs,{src:s,alt:"trace",className:"max-h-48 max-w-full rounded-md"},o))})]})}case"token_usage":return l.jsx(bL,{p:n});default:return l.jsx("pre",{className:lu,children:JSON.stringify(n,null,2)})}}function wL({msg:e,rowKey:n,matched:r,onHighlight:s}){const[o,c]=v.useState(!1),d=e.payload.type??e.type,f=yL(e);return l.jsxs("li",{"data-trace-row":n,children:[l.jsxs("button",{type:"button",onClick:()=>c(m=>!m),onMouseEnter:()=>s?.({ts:e.timestamp,rowKey:n}),onMouseLeave:()=>s?.(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:[l.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:uN(e.timestamp)}),l.jsx(gL,{type:d}),l.jsx(qt,{tone:mL(e.type),children:d}),e.origin&&e.origin.length>0&&l.jsx(qt,{tone:"brand",children:"origin"}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:xL(e)})]}),o&&l.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:[l.jsx(kL,{msg:e}),f&&l.jsx("div",{className:"mt-1.5 flex justify-end",children:l.jsx(qt,{tone:nh(f),children:f})})]})]})}const _b=()=>({cacheRead:0,cacheWrite:0,output:0}),SL=2500,Ib=(e,n)=>`${e}-${n}`;function Ar({label:e,value:n}){return l.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-0.5",children:[l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:e}),l.jsx("span",{className:"truncate font-mono text-sm font-semibold tabular-nums",children:n})]})}const D2=e=>e.cacheRead+e.cacheWrite,O2=e=>Tv(e.cacheRead,e.cacheWrite),z2="flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";function Zi({icon:e,value:n,label:r}){return l.jsxs("span",{title:r,"aria-label":r,className:`${z2} gap-1`,children:[l.jsx(Pe,{d:e,className:"text-gray-400"}),n]})}function jL({buckets:e}){const n=D2(e),r=`${x.traces.cacheHit} ${ot(e.cacheRead)} · ${x.traces.hitRate} ${Kh(O2(e))}`;return l.jsxs("span",{"aria-label":`${x.traces.taskInput} ${ot(n)} · ${r}`,className:z2,children:[l.jsxs("span",{title:x.traces.taskInput,className:"flex items-center gap-1",children:[l.jsx(Pe,{d:cn.input,className:"text-gray-400"}),ot(n)]}),l.jsxs("span",{title:r,className:"ml-1 flex items-center gap-0.5 text-gray-400",children:[l.jsx("span",{children:"("}),l.jsx(Pe,{d:cn.cacheHit}),l.jsx("span",{children:ot(e.cacheRead)}),l.jsx("span",{children:")"})]})]})}function NL({projectId:e,agentId:n,sessionId:r,index:s,highlight:o,onHighlight:c}){const{currency:d}=Gs(),[f,m]=v.useState(null),[h,g]=v.useState([]),[y,k]=v.useState(0),[w,N]=v.useState(0),[C,M]=v.useState(null),[A,R]=v.useState(null),[I,P]=v.useState(new Set),[D,L]=v.useState(null),$=v.useRef(null),Q=v.useRef(null);v.useEffect(()=>()=>{Q.current&&clearTimeout(Q.current)},[]),v.useEffect(()=>{m(null),g([]),R(null),P(new Set),L(null);let T=!1;return Promise.all([Vj(e,n,r,s),Fj(e,n,r,s,0,1e3),_u(e).catch(()=>null)]).then(([U,j,K])=>{T||(m(U),g(j.events),k(j.offset),N(j.total),M(K))}).catch(U=>{T||R(Ie(U))}),()=>{T=!0}},[e,n,r,s]);const W=v.useMemo(()=>{const T=h.find(j=>j.type==="session_meta"),U=T?T.payload:void 0;if(!(!U?.model_id||!U.provider))return C?.models.find(j=>j.modelId===U.model_id&&j.provider===U.provider)?.pricing},[h,C]),B=T=>W?(T.cacheRead*W.cacheRead+T.cacheWrite*W.cacheWrite+T.output*W.output)/1e6:null,V=v.useMemo(()=>{const T=h.find(U=>U.type==="session_meta");return l2(T?T.payload.model_context_window:void 0)},[h]),{tasks:q,global:X,statsByTask:te,globalLlmMs:O}=v.useMemo(()=>{const T={buckets:_b(),toolCalls:0},U=new Map;if(!f)return{tasks:[],global:T,statsByTask:U,globalLlmMs:0};const j=new Map;for(const he of f.tasks){const be=Date.parse(he.startTs),ze=Date.parse(he.endTs);Number.isFinite(be)&&Number.isFinite(ze)&&j.set(he.taskIndex,{min:be,max:ze})}const K=new Map,se=he=>{let be=K.get(he);if(!be){const ze=j.get(he);be={taskIndex:he,segments:[],spans:[],messages:[],toolCalls:0,durationMs:ze?Math.max(0,ze.max-ze.min):0},K.set(he,be)}return be};for(const he of f.tasks)se(he.taskIndex);for(const he of f.modelSegments)se(he.taskIndex).segments.push(he);for(const he of f.toolSpans){const be=se(he.taskIndex);be.spans.push(he),be.toolCalls+=1}const oe=he=>{for(const be of f.tasks)if(he>=be.messageFrom&&he<=be.messageTo)return be.taskIndex;return null};for(let he=0;he<h.length;he++){const be=h[he];if(be.origin&&be.origin.length>0)continue;const ze=oe(y+he);ze!==null&&se(ze).messages.push(be)}T.toolCalls=f.toolSpans.length;const pe=new Map(f.tasks.map(he=>[he.taskIndex,he]));for(const he of f.tasks)T.buckets.cacheRead+=he.tokens.cacheRead,T.buckets.cacheWrite+=he.tokens.cacheWrite,T.buckets.output+=he.tokens.output;const Se=f.tasks.reduce((he,be)=>he+be.llmMs,0);return{tasks:[...K.values()].sort((he,be)=>he.taskIndex-be.taskIndex),global:T,statsByTask:pe,globalLlmMs:Se}},[f,h,y]);if(A)return l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:A});if(!f)return l.jsx(Pt,{className:"h-40"});const z=f.elapsedMs,H=T=>P(U=>{const j=new Set(U);return j.has(T)?j.delete(T):j.add(T),j}),Z=T=>{for(const U of q){const j=U.messages.findIndex(K=>K.timestamp===T);if(j>=0)return Ib(U.taskIndex,j)}return null},ce=o?.rowKey??(o?.ts!==void 0?Z(o.ts):null),E=T=>{const U=Z(T);U!==null&&(L(U),requestAnimationFrame(()=>{$.current?.querySelector(`[data-trace-row="${U}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})}),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>L(null),SL))};return l.jsxs("div",{ref:$,className:"space-y-4",children:[l.jsxs("div",{className:"rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[l.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:x.traces.globalSummary}),l.jsxs("div",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-3",children:[l.jsxs("div",{children:[l.jsx(Ar,{label:x.traces.tasksLabel,value:String(f.tasks.length)}),l.jsx(Ar,{label:x.traces.toolCalls,value:String(X.toolCalls)}),l.jsx(Ar,{label:x.traces.compactions,value:String(f.compactionCount)})]}),l.jsxs("div",{children:[l.jsx(Ar,{label:x.chat.statInput,value:ot(D2(X.buckets))}),l.jsx(Ar,{label:x.traces.cacheHit,value:`${ot(X.buckets.cacheRead)} · ${Kh(O2(X.buckets))}`}),l.jsx(Ar,{label:x.chat.statOutput,value:ot(X.buckets.output)})]}),l.jsxs("div",{children:[l.jsx(Ar,{label:x.common.cost,value:Ra(B(X.buckets),d)}),l.jsx(Ar,{label:x.chat.statElapsed,value:mn(Math.max(0,z))}),l.jsx(Ar,{label:x.chat.statTps,value:xu(Zm(X.buckets.output,O))})]})]})]}),q.map(T=>{const U=!I.has(T.taskIndex),j=te.get(T.taskIndex),K=j?.context,se=j?.tokens??_b();return l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[l.jsxs("button",{type:"button",onClick:()=>H(T.taskIndex),"aria-expanded":U,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:[l.jsx(Un,{open:U,size:13,className:"text-gray-400"}),l.jsx("span",{className:"shrink-0 text-sm font-semibold",children:x.traces.task(T.taskIndex+1)}),j?.compaction===!0&&l.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}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[l.jsx(Zi,{icon:cn.toolCalls,value:String(T.toolCalls),label:x.traces.toolCalls}),l.jsx(jL,{buckets:se}),l.jsx(Zi,{icon:cn.output,value:ot(se.output),label:x.traces.taskOutput}),l.jsx(Zi,{icon:cn.cost,value:Ra(B(se),d),label:`${x.common.cost}(${d})`}),l.jsx(Zi,{icon:cn.elapsed,value:mn(T.durationMs),label:x.chat.statElapsed}),l.jsx(Zi,{icon:cn.tps,value:xu(Zm(se.output,j?.llmMs??0)),label:x.chat.statTps})]}),K&&l.jsx(rL,{cacheRead:K.cacheRead,cacheWrite:K.cacheWrite,output:K.output,max:V,size:22})]}),U&&l.jsxs("div",{className:"space-y-3 p-3",children:[(T.segments.length>0||T.spans.length>0)&&l.jsxs("div",{className:"rounded-md border border-gray-100 p-2 dark:border-gray-800/60",children:[l.jsx("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:x.traces.timeline}),l.jsx(fL,{segments:T.segments,toolSpans:T.spans,highlight:o,onHighlight:c,onJump:E,hideTaskLabel:!0})]}),l.jsxs("div",{children:[l.jsxs("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:[x.traces.messages,"(",T.messages.length,")"]}),T.messages.length===0?l.jsx("p",{className:"text-xs text-gray-400",children:x.common.none}):l.jsx("ul",{className:"divide-y divide-gray-100 rounded-md border border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:T.messages.map((oe,pe)=>{const Se=Ib(T.taskIndex,pe);return l.jsx(wL,{msg:oe,rowKey:Se,matched:Se===ce||Se===D,onHighlight:ie=>c(ie)},pe)})})]})]})]},T.taskIndex)}),h.length<w&&l.jsx("p",{className:"text-xs text-gray-400",children:x.traces.truncatedNote(h.length,w)})]})}const CL=14*1024*1024;function TL(e){const n=new Map;for(const r of e.dates)for(const s of r.sessions){const o=n.get(s.sessionId)??[];for(const c of s.files)o.push({index:c.index,date:r.date,sizeBytes:c.sizeBytes});n.set(s.sessionId,o)}return[...n.entries()].sort((r,s)=>s[0].localeCompare(r[0])).map(([r,s])=>({sessionId:r,files:s.sort((o,c)=>c.index-o.index)}))}function ML({projectId:e,agentId:n,name:r,defaultOpen:s,focusSessionId:o,canImport:c,titleOf:d,selection:f,onSelect:m}){const[h,g]=v.useState(s),[y,k]=v.useState(null),[w,N]=v.useState(null),[C,M]=v.useState(!1),A=v.useRef(null);v.useEffect(()=>{!h||y||Oj(e,n).then(D=>k(TL(D))).catch(D=>N(Ie(D)))},[h,y,e,n]);const R=v.useRef(!1);v.useEffect(()=>{if(R.current||!o||!y)return;R.current=!0;const D=y.find(L=>L.sessionId===o);D&&m({agentId:n,sessionId:D.sessionId,files:D.files})},[y,o,n,m]),v.useEffect(()=>{const D=A.current;if(D===null||!y)return;A.current=null;const L=y.find($=>$.sessionId===D);L&&m({agentId:n,sessionId:L.sessionId,files:L.files})},[y,n,m]);const I=async D=>{M(!0);try{const L=await Wj(e,n,{dataBase64:D});A.current=L.sessionId,k(null),g(!0)}catch(L){gt(Ie(L))}finally{M(!1)}},P=D=>{const L=D.target.files?.[0];if(D.target.value="",!L)return;if(L.size>CL){gt(x.traces.fileTooLarge);return}const $=new FileReader;$.onload=()=>{const Q=$.result;I(Q.slice(Q.indexOf(",")+1))},$.onerror=()=>gt(x.common.unknownError),$.readAsDataURL(L)};return l.jsxs("li",{className:"pt-2.5",children:[l.jsxs("div",{className:"flex items-center px-1 pb-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>g(D=>!D),"aria-label":h?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:[l.jsx(Ya,{id:n,name:r,size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),l.jsx(Un,{open:h,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),c&&l.jsxs("label",{title:C?x.traces.importing:x.traces.importTrace,className:`shrink-0 cursor-pointer rounded p-1 text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 hover:text-gray-600 dark:hover:bg-gray-800/50 dark:hover:text-gray-300 ${C?"pointer-events-none opacity-60":""}`,children:[l.jsx("input",{type:"file",accept:".jsonl",className:"sr-only",disabled:C,onChange:P}),l.jsx(sN,{size:13}),l.jsx("span",{className:"sr-only",children:C?x.traces.importing:x.traces.importTrace})]})]}),h&&l.jsxs("div",{className:"anim-fade",children:[w&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:w}),!y&&!w&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:x.common.loading}),y&&y.length===0&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.traces.empty}),l.jsx("ul",{className:"space-y-0.5",children:y?.map(D=>{const L=f?.agentId===n&&f.sessionId===D.sessionId,$=d(n,D.sessionId);return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>m({agentId:n,sessionId:D.sessionId,files:D.files}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${L?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[l.jsx(Ou,{text:$??D.sessionId,className:`min-w-0 flex-1 ${$?"text-sm":"font-mono text-xs"} ${L?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),l.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:D.files.length})]})},D.sessionId)})})]})]})}function EL(){or(x.traces.title);const{currentProject:e,agents:n,agentsLoading:r}=hn(),{byAgent:s}=Ks(),o=e?.projectId??null,[c]=Fh(),d=c.get("agentId"),f=c.get("sessionId"),[m,h]=v.useState(null),[g,y]=v.useState(null),[k,w]=v.useState(null);v.useEffect(()=>{h(null),y(null)},[o]),v.useEffect(()=>{w(null)},[m,g]);const N=(M,A)=>s.get(M)?.find(R=>R.sessionId===A)?.title;if(!o)return null;const C=m===null?null:m.files.find(M=>M.index===g)??m.files[0]??null;return l.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[l.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:[l.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:x.traces.title}),r?l.jsx(ar,{rows:4}):l.jsx("ul",{children:n.map(M=>l.jsx(ML,{projectId:o,agentId:M.agentId,name:Mn(M),defaultOpen:d===null||d===M.agentId,...f!==null&&d===M.agentId?{focusSessionId:f}:{},canImport:e?.role==="owner",titleOf:N,selection:m,onSelect:A=>{h(A),y(A.files[0]?.index??null)}},M.agentId))})]}),l.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:m&&C?l.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("p",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N(m.agentId,m.sessionId)??l.jsx("span",{className:"font-mono text-xs font-normal text-gray-500",children:m.sessionId})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[l.jsx("span",{className:"mr-1 text-xs text-gray-400",children:x.traces.filesTitle}),m.files.map(M=>l.jsxs("button",{type:"button",onClick:()=>y(M.index),title:`${M.date} · ${Jm(M.sizeBytes)}`,className:`rounded-md border px-2 py-0.5 font-mono text-xs transition-colors duration-150 ${M.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(M.index).padStart(3,"0")]},M.index))]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("p",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-400",children:[m.sessionId," · ",C.date," · ",Jm(C.sizeBytes)]}),l.jsxs("a",{href:Gj(o,m.agentId,m.sessionId,C.index),download:!0,className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-gray-200 px-2 py-0.5 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800/60",children:[l.jsx(rN,{size:12}),x.traces.exportFile]})]}),l.jsx(NL,{projectId:o,agentId:m.agentId,sessionId:m.sessionId,index:C.index,highlight:k,onHighlight:w})]}):l.jsx(lr,{title:x.traces.selectSession})})]})}function U2(e,n){return e.map(r=>{const s=n==="score"?r.score:n==="cost"?r.cost:r.durationMs;return typeof s=="number"&&Number.isFinite(s)?s:null})}function AL(e){const n=[];let r=[];return e.forEach((s,o)=>{if(s===null){r.length>0&&n.push(r),r=[];return}r.push({index:o,value:s})}),r.length>0&&n.push(r),n}function RL(e){return Math.max(1e-9,...e.filter(n=>n!==null))}function _L(e){const n=new Map;e.forEach((s,o)=>{const c=s.modelId!==void 0&&s.modelId!=="",d=c?`${s.provider??""}\0${s.modelId}`:"";let f=n.get(d);f||(f={key:d,...c&&s.provider!==void 0?{provider:s.provider}:{},...c&&s.modelId!==void 0?{modelId:s.modelId}:{},indices:[]},n.set(d,f)),f.indices.push(o)});const r=[...n.values()];return[...r.filter(s=>s.key!==""),...r.filter(s=>s.key==="")]}function IL(e,n,r){const s=new Set(n.indices);return U2(e,r).map((o,c)=>s.has(c)?o:null)}function LL({projectId:e,agentId:n,name:r,defaultOpen:s,selection:o,onSelect:c}){const[d,f]=v.useState(s),[m,h]=v.useState(null),[g,y]=v.useState(null);return v.useEffect(()=>{!d||m||a5(e,n).then(k=>h(k.benchmarks)).catch(k=>y(Ie(k)))},[d,m,e,n]),l.jsxs("li",{className:"pt-2.5",children:[l.jsx("div",{className:"flex items-center px-1 pb-0.5",children:l.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:[l.jsx(Ya,{id:n,name:r,size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),l.jsx(Un,{open:d,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]})}),d&&l.jsxs("div",{className:"anim-fade",children:[g&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:g}),!m&&!g&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:x.common.loading}),m&&m.length===0&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.benchmark.emptyAgent}),l.jsx("ul",{className:"space-y-0.5",children:m?.map(k=>{const w=o?.agentId===n&&o.benchmark.id===k.id;return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>c({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:[l.jsx(Ou,{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"}`}),l.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:k.caseCount})]})},k.id)})})]})]})}function iu(e){return e==="score"?x.benchmark.colScore:e==="cost"?x.common.cost:x.benchmark.colDuration}function Lb(e,n){return e==="score"?yu(n):e==="cost"?Ra(n):mn(n)}function DL({evaluations:e,series:n,metric:r}){const[s,o]=v.useState(null),[c,d]=Ap(),f=U2(e,r),m=Ep(e.length,RL(f),d),h=e.map(y=>fa(y.time)),g=m.y(0);return l.jsx("div",{ref:c,children:d>0&&l.jsx(Rp,{geom:m,fmtY:y=>Lb(r,y),dates:h,hover:s,onHover:o,bubble:y=>{const k=e[y],w=f[y]??null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:fa(k.time)}),l.jsxs("p",{className:"font-mono",children:[w===null?"—":Lb(r,w),k.version!==void 0&&l.jsxs("span",{className:"ml-1.5 text-gray-400",children:["v",k.version]})]}),k.modelId&&l.jsx("p",{className:"font-mono text-gray-400",children:k.modelId})]})},children:n.map((y,k)=>{const w=AL(IL(e,y,r));return l.jsx("g",{className:y.modelId?R2(k).text:"text-gray-400 dark:text-gray-500",children:w.map((N,C)=>{const M=N.map((R,I)=>`${I===0?"M":"L"}${m.x(R.index)},${m.y(R.value)}`).join(" "),A=`${M} L${m.x(N[N.length-1].index)},${g} L${m.x(N[0].index)},${g} Z`;return l.jsxs("g",{children:[N.length>1&&l.jsx("path",{d:A,className:"fill-current",stroke:"none",opacity:s!==null?.06:.1}),N.length>1&&l.jsx("path",{d:M,fill:"none",stroke:"currentColor",strokeWidth:2,opacity:s!==null?.35:1}),N.map(R=>l.jsx("circle",{cx:m.x(R.index),cy:m.y(R.value),r:s===R.index?4:2.5,className:"fill-current",opacity:s!==null&&s!==R.index?.25:1},R.index))]},C)})},y.key===""?"unlabeled":y.key)})})})}function OL({evaluations:e}){const[n,r]=v.useState("score"),s=_L(e),o=s.map(f=>f.modelId).filter(f=>f!==void 0),c=new Set(o.filter((f,m)=>o.indexOf(f)!==m)),d=f=>{if(!f.modelId)return x.benchmark.legendUnlabeled;if(!c.has(f.modelId))return f.modelId;const m=f.provider?Aa(f.provider)?.label??f.provider:"";return m?`${f.modelId} · ${m}`:f.modelId};return l.jsxs("div",{children:[l.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[l.jsx("p",{className:"text-xs font-semibold text-gray-500",children:x.benchmark.trendTitle(iu(n))}),l.jsx("div",{className:"w-44 shrink-0",children:l.jsx(Hs,{options:[{value:"score",label:iu("score")},{value:"cost",label:iu("cost")},{value:"duration",label:iu("duration")}],value:n,onChange:r})})]}),s.length>=2&&l.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1",children:s.map((f,m)=>l.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:[l.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${f.modelId?R2(m).swatch:"bg-gray-400 dark:bg-gray-500"}`}),l.jsx("span",{className:"font-mono",children:d(f)})]},f.key===""?"unlabeled":f.key))}),l.jsx(DL,{evaluations:e,series:s,metric:n})]})}const Ol="px-3 py-2";function zL({agentId:e,evaluation:n}){const[r,s]=v.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("tr",{onClick:()=>s(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:[l.jsx("td",{className:Ol,children:l.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx(Un,{open:r,size:12,className:"text-gray-400"}),fa(n.time)]})}),l.jsx("td",{className:`${Ol} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.version!==void 0?`v${n.version}`:"—"}),l.jsx("td",{className:`${Ol} max-w-40 truncate font-mono text-xs text-gray-500 dark:text-gray-400`,title:n.provider,children:n.modelId??"—"}),l.jsx("td",{className:`${Ol} font-mono text-xs font-semibold tabular-nums`,children:yu(n.score)}),l.jsx("td",{className:`${Ol} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:Ra(n.cost)}),l.jsx("td",{className:`${Ol} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:n.durationMs!==void 0?mn(n.durationMs):"—"})]}),r&&l.jsx("tr",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800/60",children:l.jsxs("td",{colSpan:6,className:"bg-gray-50/80 px-3 py-2 dark:bg-gray-950/40",children:[(n.summaryTitle||n.summary)&&l.jsxs("div",{className:"mb-2",children:[n.summaryTitle?l.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:n.summaryTitle}):l.jsx("p",{className:"text-xs font-semibold text-gray-500",children:x.benchmark.summaryLabel}),n.summary&&l.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-xs text-gray-600 dark:text-gray-300",children:n.summary})]}),l.jsxs("table",{className:"w-full text-left",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-xs text-gray-500",children:[l.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colCase}),l.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colScore}),l.jsx("th",{className:"px-2 py-1 font-medium",children:x.common.cost}),l.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colDuration}),l.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colSession})]})}),l.jsx("tbody",{children:n.cases.map(o=>l.jsx(UL,{agentId:e,caseScore:o},o.case))})]})]})})]})}function Db({agentId:e,sessionId:n}){return n?l.jsx(Ph,{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}):l.jsx("span",{className:"text-gray-400",children:"—"})}function UL({agentId:e,caseScore:n}){const[r,s]=v.useState(!1),o=n.runs??[],c=o.length>0;return l.jsxs(l.Fragment,{children:[l.jsxs("tr",{onClick:c?()=>s(d=>!d):void 0,className:`text-xs ${c?"cursor-pointer transition-colors duration-150 hover:bg-gray-100/70 dark:hover:bg-gray-800/40":""}`,children:[l.jsx("td",{className:"px-2 py-1 font-mono",children:l.jsxs("span",{className:"flex items-center gap-1.5",children:[c&&l.jsx(Un,{open:r,size:12,className:"text-gray-400"}),n.case]})}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:yu(n.score)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:Ra(n.cost)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:n.durationMs!==void 0?mn(n.durationMs):"—"}),l.jsx("td",{className:"px-2 py-1",children:l.jsx(Db,{agentId:e,...n.sessionId?{sessionId:n.sessionId}:{}})})]}),r&&o.map((d,f)=>l.jsxs("tr",{className:"text-xs text-gray-500 dark:text-gray-400",children:[l.jsxs("td",{className:"py-1 pl-7 pr-2 font-mono",children:[x.benchmark.colRun," #",f+1]}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:yu(d.score)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Ra(d.cost)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:d.durationMs!==void 0?mn(d.durationMs):"—"}),l.jsx("td",{className:"px-2 py-1",children:l.jsx(Db,{agentId:e,...d.sessionId?{sessionId:d.sessionId}:{}})})]},f))]})}function $L(){or(x.benchmark.title);const{currentProject:e,agents:n,agentsLoading:r}=hn(),s=e?.projectId??null,[o]=Fh(),c=o.get("agentId"),[d,f]=v.useState(null);if(v.useEffect(()=>{f(null)},[s]),!s)return null;const m=d?.benchmark??null,h=m?[...m.evaluations].sort((g,y)=>g.time.localeCompare(y.time)):[];return l.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[l.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:[l.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:x.benchmark.title}),r?l.jsx(ar,{rows:4}):l.jsx("ul",{children:n.map(g=>l.jsx(LL,{projectId:s,agentId:g.agentId,name:Mn(g),defaultOpen:c===null||c===g.agentId,selection:d,onSelect:f},g.agentId))})]}),l.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:d&&m?l.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[l.jsx("h1",{className:"min-w-0 truncate text-lg font-semibold",children:m.title}),l.jsx("span",{className:"text-xs text-gray-500",children:x.benchmark.caseCount(m.caseCount)})]}),m.description&&l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:m.description})]}),h.length===0?l.jsx(lr,{title:x.benchmark.noEvaluations}):l.jsxs(l.Fragment,{children:[l.jsx(OL,{evaluations:h}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:x.benchmark.evaluations}),l.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:l.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[l.jsx("thead",{children:l.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:[l.jsx("th",{className:"px-3 py-2.5",children:x.common.time}),l.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colVersion}),l.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colModel}),l.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colScore}),l.jsx("th",{className:"px-3 py-2.5",children:x.common.cost}),l.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colDuration})]})}),l.jsx("tbody",{children:[...h].reverse().map((g,y)=>l.jsx(zL,{agentId:d.agentId,evaluation:g},y))})]})})]})]})]},`${d.agentId}/${m.id}`):l.jsx(lr,{title:x.benchmark.selectBenchmark})})]})}function BL(){or(x.admin.users);const{user:e}=$n(),[n,r]=v.useState(null),[s,o]=v.useState(null),[c,d]=v.useState(!1),[f,m]=v.useState(null),[h,g]=v.useState(null),y=v.useCallback(async()=>{try{r((await kj()).users),o(null)}catch(k){o(Ie(k))}},[]);return v.useEffect(()=>{e?.isAdmin&&y()},[e?.isAdmin,y]),e&&!e.isAdmin?l.jsx(fo,{to:"/chat",replace:!0}):l.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[l.jsxs("div",{className:"mx-auto max-w-3xl",children:[l.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-semibold",children:x.admin.users}),l.jsx(ke,{variant:"primary",onClick:()=>d(!0),children:x.admin.createUser})]}),n===null?l.jsx("p",{className:"text-sm text-gray-400",children:x.common.loading}):l.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.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:[l.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.common.username}),l.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.common.role}),l.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.common.created}),l.jsx("th",{className:"whitespace-nowrap px-3 py-2 text-right font-medium",children:x.common.actions})]})}),l.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:n.map(k=>l.jsxs("tr",{children:[l.jsxs("td",{className:"whitespace-nowrap px-3 py-2 font-medium",children:[k.userId,k.passwordIsInitial&&l.jsx("span",{className:"ml-2 align-middle",children:l.jsx(qt,{tone:"gray",children:x.admin.initialPasswordFlag})})]}),l.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:l.jsx(qt,{tone:"gray",children:k.isAdmin?x.admin.roleAdmin:x.admin.roleUser})}),l.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-gray-500 dark:text-gray-400",children:fa(k.createdAt)}),l.jsxs("td",{className:"whitespace-nowrap px-3 py-1.5 text-right",children:[l.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>m(k),children:x.admin.resetPassword}),!k.isAdmin&&l.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>g(k),children:x.common.delete})]})]},k.userId))})]})}),s&&l.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:s})]}),l.jsx(HL,{open:c,onClose:()=>d(!1),onDone:()=>{d(!1),y()}}),l.jsx(PL,{user:f,onClose:()=>m(null)}),l.jsx(qL,{user:h,onClose:()=>g(null),onDone:()=>{g(null),y()}})]})}function HL({open:e,onClose:n,onDone:r}){const[s,o]=v.useState(""),[c,d]=v.useState(""),[f,m]=v.useState({}),[h,g]=v.useState(!1),y=()=>m(w=>w.userId||w.password?{}:w);v.useEffect(()=>{e&&(o(""),d(""),m({}))},[e]);const k=async()=>{const w=s.trim(),N={};if(w?ob.test(w)||(N.userId=x.auth.usernameHint):N.userId=x.common.requiredField,c||(N.password=x.common.requiredField),N.userId||N.password){m(N);return}g(!0),m({});try{await wj({userId:w,password:c}),r()}catch(C){C instanceof Ka&&C.code==="invalid_password"?m({password:Ie(C)}):m({userId:Ie(C)})}finally{g(!1)}};return l.jsx(kn,{open:e,title:x.admin.createUser,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:n,disabled:h,children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:h,onClick:()=>{k()},children:x.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(nt,{label:x.common.username,required:!0,size:"sm",value:s,onChange:w=>{o(w.target.value),y()},error:f.userId,hint:x.auth.usernameHint,autoFocus:!0}),l.jsx(ms,{label:x.admin.initialPassword,required:!0,size:"sm",value:c,onChange:w=>{d(w.target.value),y()},error:f.password,autoComplete:"new-password",hint:x.auth.passwordHint}),ob.test(s.trim())&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.admin.defaultProjectNote(`${s.trim()}-default_project`)})]})})}function PL({user:e,onClose:n}){const[r,s]=v.useState(""),[o,c]=v.useState(void 0),[d,f]=v.useState(!1);v.useEffect(()=>{e&&(s(""),c(void 0))},[e]);const m=async()=>{if(e){if(!r){c(x.common.requiredField);return}f(!0),c(void 0);try{await Sj(e.userId,{password:r}),n()}catch(h){c(Ie(h))}finally{f(!1)}}};return l.jsx(kn,{open:e!==null,title:e?x.admin.resetPasswordTitle(e.userId):"",onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:n,disabled:d,children:x.common.cancel}),l.jsx(ke,{variant:"primary",disabled:d,onClick:()=>{m()},children:x.common.save})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(ms,{label:x.admin.initialPassword,required:!0,size:"sm",value:r,onChange:h=>{s(h.target.value),c(void 0)},error:o,autoComplete:"new-password",hint:x.auth.passwordHint,autoFocus:!0}),l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.admin.resetPasswordNote})]})})}function qL({user:e,onClose:n,onDone:r}){const[s,o]=v.useState(!1),[c,d]=v.useState(null),[f,m]=v.useState(!1);v.useEffect(()=>{e&&(o(!1),d(null))},[e]);const h=async()=>{if(e){m(!0),d(null);try{await jj(e.userId),r()}catch(g){d(Ie(g))}finally{m(!1)}}};return l.jsx(kn,{open:e!==null,title:e?x.admin.deleteUserTitle(e.userId):"",onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ke,{onClick:n,disabled:f,children:x.common.cancel}),s?l.jsx(ke,{variant:"danger",disabled:f,onClick:()=>{h()},children:x.common.confirm}):l.jsx(ke,{variant:"danger",onClick:()=>o(!0),children:x.common.delete})]}),children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:e?x.admin.deleteUserConfirm(e.userId):""}),c&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:c})]})})}function FL(){const{user:e}=$n();return e===void 0?null:e===null?l.jsx(fo,{to:"/login",replace:!0}):l.jsx(K4,{children:l.jsx(aN,{children:l.jsx(j_,{})})})}function VL(){const{user:e}=$n();return e?l.jsx(fo,{to:"/chat",replace:!0}):l.jsx(I_,{})}function GL(){return l.jsx($4,{children:l.jsxs(m4,{children:[l.jsx(Qn,{path:"/login",element:l.jsx(VL,{})}),l.jsxs(Qn,{element:l.jsx(FL,{}),children:[l.jsx(Qn,{index:!0,element:l.jsx(fo,{to:"/chat",replace:!0})}),l.jsx(Qn,{path:"/chat/:sessionId?",element:l.jsx(r_,{})}),l.jsx(Qn,{path:"/agents",element:l.jsx(O_,{})}),l.jsx(Qn,{path:"/agents/:agentId",element:l.jsx(X_,{})}),l.jsx(Qn,{path:"/skills",element:l.jsx(lI,{})}),l.jsx(Qn,{path:"/models",element:l.jsx(SI,{})}),l.jsx(Qn,{path:"/usage",element:l.jsx(aL,{})}),l.jsx(Qn,{path:"/traces",element:l.jsx(EL,{})}),l.jsx(Qn,{path:"/benchmark",element:l.jsx($L,{})}),l.jsx(Qn,{path:"/admin/users",element:l.jsx(BL,{})}),l.jsx(Qn,{path:"*",element:l.jsx(fo,{to:"/chat",replace:!0})})]})]})})}function WL(){return l.jsx(lj,{children:l.jsx(hj,{children:l.jsx(o5,{children:l.jsxs(ij,{children:[l.jsx(GL,{}),l.jsx(xN,{})]})})})})}const $2=document.getElementById("root");if(!$2)throw new Error("#root mount point not found");JS.createRoot($2).render(l.jsx(v.StrictMode,{children:l.jsx(WL,{})}));export{B6 as _,pC as a,RC as b,A1 as c,TC as f,AC as h,rp as s,vC as w};
|