@prismshadow/penguin-server 0.1.2 → 0.1.5

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.
@@ -0,0 +1,171 @@
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 Zb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fm={exports:{}},Gi={};var Sy;function ij(){if(Sy)return Gi;Sy=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 Gi.Fragment=n,Gi.jsx=r,Gi.jsxs=r,Gi}var jy;function oj(){return jy||(jy=1,fm.exports=ij()),fm.exports}var l=oj(),mm={exports:{}},qe={};var Ny;function cj(){if(Ny)return qe;Ny=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"),p=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function w(M){return M===null||typeof M!="object"?null:(M=k&&M[k]||M["@@iterator"],typeof M=="function"?M:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,T={};function A(M,$,N){this.props=M,this.context=$,this.refs=T,this.updater=N||j}A.prototype.isReactComponent={},A.prototype.setState=function(M,$){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,$,"setState")},A.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function R(){}R.prototype=A.prototype;function L(M,$,N){this.props=M,this.context=$,this.refs=T,this.updater=N||j}var H=L.prototype=new R;H.constructor=L,C(H,A.prototype),H.isPureReactComponent=!0;var O=Array.isArray;function I(){}var z={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function X(M,$,N){var Y=N.ref;return{$$typeof:e,type:M,key:$,ref:Y!==void 0?Y:null,props:N}}function D(M,$){return X(M.type,$,M.props)}function q(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function P(M){var $={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(N){return $[N]})}var K=/\/+/g;function ee(M,$){return typeof M=="object"&&M!==null&&M.key!=null?P(""+M.key):$.toString(36)}function B(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(I,I):(M.status="pending",M.then(function($){M.status==="pending"&&(M.status="fulfilled",M.value=$)},function($){M.status==="pending"&&(M.status="rejected",M.reason=$)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function U(M,$,N,Y,le){var oe=typeof M;(oe==="undefined"||oe==="boolean")&&(M=null);var pe=!1;if(M===null)pe=!0;else switch(oe){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(M.$$typeof){case e:case n:pe=!0;break;case p:return pe=M._init,U(pe(M._payload),$,N,Y,le)}}if(pe)return le=le(M),pe=Y===""?"."+ee(M,0):Y,O(le)?(N="",pe!=null&&(N=pe.replace(K,"$&/")+"/"),U(le,$,N,"",function(he){return he})):le!=null&&(q(le)&&(le=D(le,N+(le.key==null||M&&M.key===le.key?"":(""+le.key).replace(K,"$&/")+"/")+pe)),$.push(le)),1;pe=0;var Ce=Y===""?".":Y+":";if(O(M))for(var re=0;re<M.length;re++)Y=M[re],oe=Ce+ee(Y,re),pe+=U(Y,$,N,oe,le);else if(re=w(M),typeof re=="function")for(M=re.call(M),re=0;!(Y=M.next()).done;)Y=Y.value,oe=Ce+ee(Y,re++),pe+=U(Y,$,N,oe,le);else if(oe==="object"){if(typeof M.then=="function")return U(B(M),$,N,Y,le);throw $=String(M),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return pe}function F(M,$,N){if(M==null)return M;var Y=[],le=0;return U(M,Y,"","",function(oe){return $.call(N,oe,le++)}),Y}function Z(M){if(M._status===-1){var $=M._result;$=$(),$.then(function(N){(M._status===0||M._status===-1)&&(M._status=1,M._result=N)},function(N){(M._status===0||M._status===-1)&&(M._status=2,M._result=N)}),M._status===-1&&(M._status=0,M._result=$)}if(M._status===1)return M._result.default;throw M._result}var ue=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},E={map:F,forEach:function(M,$,N){F(M,function(){$.apply(this,arguments)},N)},count:function(M){var $=0;return F(M,function(){$++}),$},toArray:function(M){return F(M,function($){return $})||[]},only:function(M){if(!q(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return qe.Activity=y,qe.Children=E,qe.Component=A,qe.Fragment=r,qe.Profiler=o,qe.PureComponent=L,qe.StrictMode=s,qe.Suspense=m,qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,qe.__COMPILER_RUNTIME={__proto__:null,c:function(M){return z.H.useMemoCache(M)}},qe.cache=function(M){return function(){return M.apply(null,arguments)}},qe.cacheSignal=function(){return null},qe.cloneElement=function(M,$,N){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var Y=C({},M.props),le=M.key;if($!=null)for(oe in $.key!==void 0&&(le=""+$.key),$)!W.call($,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&$.ref===void 0||(Y[oe]=$[oe]);var oe=arguments.length-2;if(oe===1)Y.children=N;else if(1<oe){for(var pe=Array(oe),Ce=0;Ce<oe;Ce++)pe[Ce]=arguments[Ce+2];Y.children=pe}return X(M.type,le,Y)},qe.createContext=function(M){return M={$$typeof:d,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:c,_context:M},M},qe.createElement=function(M,$,N){var Y,le={},oe=null;if($!=null)for(Y in $.key!==void 0&&(oe=""+$.key),$)W.call($,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(le[Y]=$[Y]);var pe=arguments.length-2;if(pe===1)le.children=N;else if(1<pe){for(var Ce=Array(pe),re=0;re<pe;re++)Ce[re]=arguments[re+2];le.children=Ce}if(M&&M.defaultProps)for(Y in pe=M.defaultProps,pe)le[Y]===void 0&&(le[Y]=pe[Y]);return X(M,oe,le)},qe.createRef=function(){return{current:null}},qe.forwardRef=function(M){return{$$typeof:f,render:M}},qe.isValidElement=q,qe.lazy=function(M){return{$$typeof:p,_payload:{_status:-1,_result:M},_init:Z}},qe.memo=function(M,$){return{$$typeof:h,type:M,compare:$===void 0?null:$}},qe.startTransition=function(M){var $=z.T,N={};z.T=N;try{var Y=M(),le=z.S;le!==null&&le(N,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(I,ue)}catch(oe){ue(oe)}finally{$!==null&&N.types!==null&&($.types=N.types),z.T=$}},qe.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},qe.use=function(M){return z.H.use(M)},qe.useActionState=function(M,$,N){return z.H.useActionState(M,$,N)},qe.useCallback=function(M,$){return z.H.useCallback(M,$)},qe.useContext=function(M){return z.H.useContext(M)},qe.useDebugValue=function(){},qe.useDeferredValue=function(M,$){return z.H.useDeferredValue(M,$)},qe.useEffect=function(M,$){return z.H.useEffect(M,$)},qe.useEffectEvent=function(M){return z.H.useEffectEvent(M)},qe.useId=function(){return z.H.useId()},qe.useImperativeHandle=function(M,$,N){return z.H.useImperativeHandle(M,$,N)},qe.useInsertionEffect=function(M,$){return z.H.useInsertionEffect(M,$)},qe.useLayoutEffect=function(M,$){return z.H.useLayoutEffect(M,$)},qe.useMemo=function(M,$){return z.H.useMemo(M,$)},qe.useOptimistic=function(M,$){return z.H.useOptimistic(M,$)},qe.useReducer=function(M,$,N){return z.H.useReducer(M,$,N)},qe.useRef=function(M){return z.H.useRef(M)},qe.useState=function(M){return z.H.useState(M)},qe.useSyncExternalStore=function(M,$,N){return z.H.useSyncExternalStore(M,$,N)},qe.useTransition=function(){return z.H.useTransition()},qe.version="19.2.7",qe}var Cy;function Bh(){return Cy||(Cy=1,mm.exports=cj()),mm.exports}var v=Bh(),hm={exports:{}},Wi={},pm={exports:{}},gm={};var Ty;function uj(){return Ty||(Ty=1,(function(e){function n(U,F){var Z=U.length;U.push(F);e:for(;0<Z;){var ue=Z-1>>>1,E=U[ue];if(0<o(E,F))U[ue]=F,U[Z]=E,Z=ue;else break e}}function r(U){return U.length===0?null:U[0]}function s(U){if(U.length===0)return null;var F=U[0],Z=U.pop();if(Z!==F){U[0]=Z;e:for(var ue=0,E=U.length,M=E>>>1;ue<M;){var $=2*(ue+1)-1,N=U[$],Y=$+1,le=U[Y];if(0>o(N,Z))Y<E&&0>o(le,N)?(U[ue]=le,U[Y]=Z,ue=Y):(U[ue]=N,U[$]=Z,ue=$);else if(Y<E&&0>o(le,Z))U[ue]=le,U[Y]=Z,ue=Y;else break e}}return F}function o(U,F){var Z=U.sortIndex-F.sortIndex;return Z!==0?Z:U.id-F.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=[],p=1,y=null,k=3,w=!1,j=!1,C=!1,T=!1,A=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function H(U){for(var F=r(h);F!==null;){if(F.callback===null)s(h);else if(F.startTime<=U)s(h),F.sortIndex=F.expirationTime,n(m,F);else break;F=r(h)}}function O(U){if(C=!1,H(U),!j)if(r(m)!==null)j=!0,I||(I=!0,P());else{var F=r(h);F!==null&&B(O,F.startTime-U)}}var I=!1,z=-1,W=5,X=-1;function D(){return T?!0:!(e.unstable_now()-X<W)}function q(){if(T=!1,I){var U=e.unstable_now();X=U;var F=!0;try{e:{j=!1,C&&(C=!1,R(z),z=-1),w=!0;var Z=k;try{t:{for(H(U),y=r(m);y!==null&&!(y.expirationTime>U&&D());){var ue=y.callback;if(typeof ue=="function"){y.callback=null,k=y.priorityLevel;var E=ue(y.expirationTime<=U);if(U=e.unstable_now(),typeof E=="function"){y.callback=E,H(U),F=!0;break t}y===r(m)&&s(m),H(U)}else s(m);y=r(m)}if(y!==null)F=!0;else{var M=r(h);M!==null&&B(O,M.startTime-U),F=!1}}break e}finally{y=null,k=Z,w=!1}F=void 0}}finally{F?P():I=!1}}}var P;if(typeof L=="function")P=function(){L(q)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ee=K.port2;K.port1.onmessage=q,P=function(){ee.postMessage(null)}}else P=function(){A(q,0)};function B(U,F){z=A(function(){U(e.unstable_now())},F)}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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return k},e.unstable_next=function(U){switch(k){case 1:case 2:case 3:var F=3;break;default:F=k}var Z=k;k=F;try{return U()}finally{k=Z}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(U,F){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var Z=k;k=U;try{return F()}finally{k=Z}},e.unstable_scheduleCallback=function(U,F,Z){var ue=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?ue+Z:ue):Z=ue,U){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,U={id:p++,callback:F,priorityLevel:U,startTime:Z,expirationTime:E,sortIndex:-1},Z>ue?(U.sortIndex=Z,n(h,U),r(m)===null&&U===r(h)&&(C?(R(z),z=-1):C=!0,B(O,Z-ue))):(U.sortIndex=E,n(m,U),j||w||(j=!0,I||(I=!0,P()))),U},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(U){var F=k;return function(){var Z=k;k=F;try{return U.apply(this,arguments)}finally{k=Z}}}})(gm)),gm}var My;function dj(){return My||(My=1,pm.exports=uj()),pm.exports}var xm={exports:{}},Mn={};var Ey;function fj(){if(Ey)return Mn;Ey=1;var e=Bh();function n(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}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,p){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:p}}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 Mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Mn.createPortal=function(m,h){var p=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,p)},Mn.flushSync=function(m){var h=d.T,p=s.p;try{if(d.T=null,s.p=2,m)return m()}finally{d.T=h,s.p=p,s.d.f()}},Mn.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))},Mn.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},Mn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,y=f(p,h.crossOrigin),k=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?s.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:w}):p==="script"&&s.d.X(m,{crossOrigin:y,integrity:k,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Mn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);s.d.M(m,{crossOrigin:p,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)},Mn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,y=f(p,h.crossOrigin);s.d.L(m,p,{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})}},Mn.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);s.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(m)},Mn.requestFormReset=function(m){s.d.r(m)},Mn.unstable_batchedUpdates=function(m,h){return m(h)},Mn.useFormState=function(m,h,p){return d.H.useFormState(m,h,p)},Mn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Mn.version="19.2.7",Mn}var Ay;function Jb(){if(Ay)return xm.exports;Ay=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(),xm.exports=fj(),xm.exports}var Ry;function mj(){if(Ry)return Wi;Ry=1;var e=dj(),n=Bh(),r=Jb();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 g=i.return;if(g===null)break;var b=g.alternate;if(b===null){if(u=g.return,u!==null){i=u;continue}break}if(g.child===b.child){for(b=g.child;b;){if(b===i)return m(g),t;if(b===u)return m(g),a;b=b.sibling}throw Error(s(188))}if(i.return!==u.return)i=g,u=b;else{for(var S=!1,_=g.child;_;){if(_===i){S=!0,i=g,u=b;break}if(_===u){S=!0,u=g,i=b;break}_=_.sibling}if(!S){for(_=b.child;_;){if(_===i){S=!0,i=b,u=g;break}if(_===u){S=!0,u=b,i=g;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 p(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=p(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"),j=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),L=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function P(t){return t===null||typeof t!="object"?null:(t=q&&t[q]||t["@@iterator"],typeof t=="function"?t:null)}var K=Symbol.for("react.client.reference");function ee(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===K?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case A:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case I:return"SuspenseList";case X:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case j:return"Portal";case L:return t.displayName||"Context";case R:return(t._context.displayName||"Context")+".Consumer";case H:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case z:return a=t.displayName||null,a!==null?a:ee(t.type)||"Memo";case W:a=t._payload,t=t._init;try{return ee(t(a))}catch{}}return null}var B=Array.isArray,U=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},ue=[],E=-1;function M(t){return{current:t}}function $(t){0>E||(t.current=ue[E],ue[E]=null,E--)}function N(t,a){E++,ue[E]=t.current,t.current=a}var Y=M(null),le=M(null),oe=M(null),pe=M(null);function Ce(t,a){switch(N(oe,a),N(le,t),N(Y,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Gx(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Gx(a),t=Wx(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}$(Y),N(Y,t)}function re(){$(Y),$(le),$(oe)}function he(t){t.memoizedState!==null&&N(pe,t);var a=Y.current,i=Wx(a,t.type);a!==i&&(N(le,t),N(Y,i))}function xe(t){le.current===t&&($(Y),$(le)),pe.current===t&&($(pe),Pi._currentValue=Z)}var We,Ke;function $e(t){if(We===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);We=a&&a[1]||"",Ke=-1<i.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+We+t+Ke}var Bt=!1;function Ht(t,a){if(!t||Bt)return"";Bt=!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(ie){var ne=ie}Reflect.construct(t,[],me)}else{try{me.call()}catch(ie){ne=ie}t.call(me.prototype)}}else{try{throw Error()}catch(ie){ne=ie}(me=t())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(ie){if(ie&&ne&&typeof ie.stack=="string")return[ie.stack,ne.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=u.DetermineComponentFrameRoot(),S=b[0],_=b[1];if(S&&_){var V=S.split(`
4
+ `),te=_.split(`
5
+ `);for(g=u=0;u<V.length&&!V[u].includes("DetermineComponentFrameRoot");)u++;for(;g<te.length&&!te[g].includes("DetermineComponentFrameRoot");)g++;if(u===V.length||g===te.length)for(u=V.length-1,g=te.length-1;1<=u&&0<=g&&V[u]!==te[g];)g--;for(;1<=u&&0<=g;u--,g--)if(V[u]!==te[g]){if(u!==1||g!==1)do if(u--,g--,0>g||V[u]!==te[g]){var de=`
6
+ `+V[u].replace(" at new "," at ");return t.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",t.displayName)),de}while(1<=u&&0<=g);break}}}finally{Bt=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?$e(i):""}function jn(t,a){switch(t.tag){case 26:case 27:case 5:return $e(t.type);case 16:return $e("Lazy");case 13:return t.child!==a&&a!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("SuspenseList");case 0:case 15:return Ht(t.type,!1);case 11:return Ht(t.type.render,!1);case 1:return Ht(t.type,!0);case 31:return $e("Activity");default:return""}}function Te(t){try{var a="",i=null;do a+=jn(t,i),i=t,t=t.return;while(t);return a}catch(u){return`
7
+ Error generating stack: `+u.message+`
8
+ `+u.stack}}var ze=Object.prototype.hasOwnProperty,ct=e.unstable_scheduleCallback,At=e.unstable_cancelCallback,bt=e.unstable_shouldYield,$n=e.unstable_requestPaint,ut=e.unstable_now,za=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,Le=e.unstable_LowPriority,Be=e.unstable_IdlePriority,Gt=e.log,pt=e.unstable_setDisableYieldValue,Pt=null,mt=null;function Ft(t){if(typeof Gt=="function"&&pt(t),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(Pt,t)}catch{}}var He=Math.clz32?Math.clz32:Wt,mn=Math.log,at=Math.LN2;function Wt(t){return t>>>=0,t===0?32:31-(mn(t)/at|0)|0}var _n=256,Rt=262144,In=4194304;function Nn(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 Bn(t,a,i){var u=t.pendingLanes;if(u===0)return 0;var g=0,b=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var _=u&134217727;return _!==0?(u=_&~b,u!==0?g=Nn(u):(S&=_,S!==0?g=Nn(S):i||(i=_&~t,i!==0&&(g=Nn(i))))):(_=u&~b,_!==0?g=Nn(_):S!==0?g=Nn(S):i||(i=u&~t,i!==0&&(g=Nn(i)))),g===0?0:a!==0&&a!==g&&(a&b)===0&&(b=g&-g,i=a&-a,b>=i||b===32&&(i&4194048)!==0)?a:g}function yn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function Ua(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 be(){var t=In;return In<<=1,(In&62914560)===0&&(In=4194304),t}function Ee(t){for(var a=[],i=0;31>i;i++)a.push(t);return a}function Ye(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Kt(t,a,i,u,g,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,V=t.expirationTimes,te=t.hiddenUpdates;for(i=S&~i;0<i;){var de=31-He(i),me=1<<de;_[de]=0,V[de]=-1;var ne=te[de];if(ne!==null)for(te[de]=null,de=0;de<ne.length;de++){var ie=ne[de];ie!==null&&(ie.lane&=-536870913)}i&=~me}u!==0&&gt(t,u,0),b!==0&&g===0&&t.tag!==0&&(t.suspendedLanes|=b&~(S&~a))}function gt(t,a,i){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-He(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|i&261930}function _t(t,a){var i=t.entangledLanes|=a;for(t=t.entanglements;i;){var u=31-He(i),g=1<<u;g&a|t[u]&a&&(t[u]|=a),i&=~g}}function Yt(t,a){var i=a&-a;return i=(i&42)!==0?1:Xn(i),(i&(t.suspendedLanes|a))!==0?0:i}function Xn(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 pa(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function nl(){var t=F.p;return t!==0?t:(t=window.event,t===void 0?32:gy(t.type))}function Hr(t,a){var i=F.p;try{return F.p=t,a()}finally{F.p=i}}var Cn=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Cn,hn="__reactProps$"+Cn,ga="__reactContainer$"+Cn,Xa="__reactEvents$"+Cn,gr="__reactListeners$"+Cn,al="__reactHandles$"+Cn,js="__reactResources$"+Cn,xr="__reactMarker$"+Cn;function yr(t){delete t[Qt],delete t[hn],delete t[Xa],delete t[gr],delete t[al]}function bn(t){var a=t[Qt];if(a)return a;for(var i=t.parentNode;i;){if(a=i[ga]||i[Qt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=ey(t);t!==null;){if(i=t[Qt])return i;t=ey(t)}return a}t=i,i=t.parentNode}return null}function xa(t){if(t=t[Qt]||t[ga]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function Za(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(s(33))}function ya(t){var a=t[js];return a||(a=t[js]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Lt(t){t[xr]=!0}var Ns=new Set,rl={};function Ln(t,a){Tn(t,a),Tn(t+"Capture",a)}function Tn(t,a){for(rl[t]=a,t=0;t<a.length;t++)Ns.add(a[t])}var ae=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]*$"),ke={},Pe={};function rt(t){return ze.call(Pe,t)?!0:ze.call(ke,t)?!1:ae.test(t)?Pe[t]=!0:(ke[t]=!0,!1)}function jt(t,a,i){if(rt(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 Nt(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 Ot(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 It(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Zn(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Pr(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 g=u.get,b=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return g.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 ba(t){if(!t._valueTracker){var a=Zn(t)?"checked":"value";t._valueTracker=Pr(t,a,""+t[a])}}function Ja(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=Zn(t)?t.checked?"true":"false":t.value),t=u,t!==i?(a.setValue(t),!0):!1}function er(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 tr=/[\n"\\]/g;function On(t){return t.replace(tr,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Jl(t,a,i,u,g,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=""+It(a)):t.value!==""+It(a)&&(t.value=""+It(a)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),a!=null?ei(t,S,It(a)):i!=null?ei(t,S,It(i)):u!=null&&t.removeAttribute("value"),g==null&&b!=null&&(t.defaultChecked=!!b),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.name=""+It(_):t.removeAttribute("name")}function Fo(t,a,i,u,g,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)){ba(t);return}i=i!=null?""+It(i):"",a=a!=null?""+It(a):i,_||a===t.value||(t.value=a),t.defaultValue=a}u=u??g,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),ba(t)}function ei(t,a,i){a==="number"&&er(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function Fr(t,a,i,u){if(t=t.options,a){a={};for(var g=0;g<i.length;g++)a["$"+i[g]]=!0;for(i=0;i<t.length;i++)g=a.hasOwnProperty("$"+t[i].value),t[i].selected!==g&&(t[i].selected=g),g&&u&&(t[i].defaultSelected=!0)}else{for(i=""+It(i),a=null,g=0;g<t.length;g++){if(t[g].value===i){t[g].selected=!0,u&&(t[g].defaultSelected=!0);return}a!==null||t[g].disabled||(a=t[g])}a!==null&&(a.selected=!0)}}function ti(t,a,i){if(a!=null&&(a=""+It(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+It(i):""}function ni(t,a,i,u){if(a==null){if(u!=null){if(i!=null)throw Error(s(92));if(B(u)){if(1<u.length)throw Error(s(93));u=u[0]}i=u}i==null&&(i=""),a=i}i=It(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),ba(t)}function se(t,a){if(a){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=a;return}}t.textContent=a}var we=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 De(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||we.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function Dt(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 g in a)u=a[g],a.hasOwnProperty(g)&&i[g]!==u&&De(t,g,u)}else for(var b in a)a.hasOwnProperty(b)&&De(t,b,a[b])}function Ct(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 nr=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"]]),ai=/^[\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 ri(t){return ai.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function $a(){}var od=null;function cd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var sl=null,ll=null;function Vp(t){var a=xa(t);if(a&&(t=a.stateNode)){var i=t[hn]||null;e:switch(t=a.stateNode,a.type){case"input":if(Jl(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="'+On(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var g=u[hn]||null;if(!g)throw Error(s(90));Jl(u,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&Ja(u)}break e;case"textarea":ti(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Fr(t,!!i.multiple,a,!1)}}}var ud=!1;function Gp(t,a,i){if(ud)return t(a,i);ud=!0;try{var u=t(a);return u}finally{if(ud=!1,(sl!==null||ll!==null)&&(Ac(),sl&&(a=sl,t=ll,ll=sl=null,Vp(a),t)))for(a=0;a<t.length;a++)Vp(t[a])}}function si(t,a){var i=t.stateNode;if(i===null)return null;var u=i[hn]||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 br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dd=!1;if(br)try{var li={};Object.defineProperty(li,"passive",{get:function(){dd=!0}}),window.addEventListener("test",li,li),window.removeEventListener("test",li,li)}catch{dd=!1}var qr=null,fd=null,qo=null;function Wp(){if(qo)return qo;var t,a=fd,i=a.length,u,g="value"in qr?qr.value:qr.textContent,b=g.length;for(t=0;t<i&&a[t]===g[t];t++);var S=i-t;for(u=1;u<=S&&a[i-u]===g[b-u];u++);return qo=g.slice(t,1<u?1-u:void 0)}function Vo(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 Go(){return!0}function Kp(){return!1}function Hn(t){function a(i,u,g,b,S){this._reactName=i,this._targetInst=g,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)?Go:Kp,this.isPropagationStopped=Kp,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=Go)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Go)},persist:function(){},isPersistent:Go}),a}var Cs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wo=Hn(Cs),ii=y({},Cs,{view:0,detail:0}),sw=Hn(ii),md,hd,oi,Ko=y({},ii,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gd,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!==oi&&(oi&&t.type==="mousemove"?(md=t.screenX-oi.screenX,hd=t.screenY-oi.screenY):hd=md=0,oi=t),md)},movementY:function(t){return"movementY"in t?t.movementY:hd}}),Yp=Hn(Ko),lw=y({},Ko,{dataTransfer:0}),iw=Hn(lw),ow=y({},ii,{relatedTarget:0}),pd=Hn(ow),cw=y({},Cs,{animationName:0,elapsedTime:0,pseudoElement:0}),uw=Hn(cw),dw=y({},Cs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),fw=Hn(dw),mw=y({},Cs,{data:0}),Qp=Hn(mw),hw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pw={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"},gw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xw(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=gw[t])?!!a[t]:!1}function gd(){return xw}var yw=y({},ii,{key:function(t){if(t.key){var a=hw[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Vo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?pw[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gd,charCode:function(t){return t.type==="keypress"?Vo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Vo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),bw=Hn(yw),vw=y({},Ko,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xp=Hn(vw),kw=y({},ii,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gd}),ww=Hn(kw),Sw=y({},Cs,{propertyName:0,elapsedTime:0,pseudoElement:0}),jw=Hn(Sw),Nw=y({},Ko,{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}),Cw=Hn(Nw),Tw=y({},Cs,{newState:0,oldState:0}),Mw=Hn(Tw),Ew=[9,13,27,32],xd=br&&"CompositionEvent"in window,ci=null;br&&"documentMode"in document&&(ci=document.documentMode);var Aw=br&&"TextEvent"in window&&!ci,Zp=br&&(!xd||ci&&8<ci&&11>=ci),Jp=" ",eg=!1;function tg(t,a){switch(t){case"keyup":return Ew.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ng(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var il=!1;function Rw(t,a){switch(t){case"compositionend":return ng(a);case"keypress":return a.which!==32?null:(eg=!0,Jp);case"textInput":return t=a.data,t===Jp&&eg?null:t;default:return null}}function _w(t,a){if(il)return t==="compositionend"||!xd&&tg(t,a)?(t=Wp(),qo=fd=qr=null,il=!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 Zp&&a.locale!=="ko"?null:a.data;default:return null}}var Iw={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 ag(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!Iw[t.type]:a==="textarea"}function rg(t,a,i,u){sl?ll?ll.push(u):ll=[u]:sl=u,a=zc(a,"onChange"),0<a.length&&(i=new Wo("onChange","change",null,i,u),t.push({event:i,listeners:a}))}var ui=null,di=null;function Lw(t){Bx(t,0)}function Yo(t){var a=Za(t);if(Ja(a))return t}function sg(t,a){if(t==="change")return a}var lg=!1;if(br){var yd;if(br){var bd="oninput"in document;if(!bd){var ig=document.createElement("div");ig.setAttribute("oninput","return;"),bd=typeof ig.oninput=="function"}yd=bd}else yd=!1;lg=yd&&(!document.documentMode||9<document.documentMode)}function og(){ui&&(ui.detachEvent("onpropertychange",cg),di=ui=null)}function cg(t){if(t.propertyName==="value"&&Yo(di)){var a=[];rg(a,di,t,cd(t)),Gp(Lw,a)}}function Ow(t,a,i){t==="focusin"?(og(),ui=a,di=i,ui.attachEvent("onpropertychange",cg)):t==="focusout"&&og()}function Dw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Yo(di)}function zw(t,a){if(t==="click")return Yo(a)}function Uw(t,a){if(t==="input"||t==="change")return Yo(a)}function $w(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var Jn=typeof Object.is=="function"?Object.is:$w;function fi(t,a){if(Jn(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 g=i[u];if(!ze.call(a,g)||!Jn(t[g],a[g]))return!1}return!0}function ug(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function dg(t,a){var i=ug(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=ug(i)}}function fg(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?fg(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function mg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=er(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=er(t.document)}return a}function vd(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 Bw=br&&"documentMode"in document&&11>=document.documentMode,ol=null,kd=null,mi=null,wd=!1;function hg(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;wd||ol==null||ol!==er(u)||(u=ol,"selectionStart"in u&&vd(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}),mi&&fi(mi,u)||(mi=u,u=zc(kd,"onSelect"),0<u.length&&(a=new Wo("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=ol)))}function Ts(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var cl={animationend:Ts("Animation","AnimationEnd"),animationiteration:Ts("Animation","AnimationIteration"),animationstart:Ts("Animation","AnimationStart"),transitionrun:Ts("Transition","TransitionRun"),transitionstart:Ts("Transition","TransitionStart"),transitioncancel:Ts("Transition","TransitionCancel"),transitionend:Ts("Transition","TransitionEnd")},Sd={},pg={};br&&(pg=document.createElement("div").style,"AnimationEvent"in window||(delete cl.animationend.animation,delete cl.animationiteration.animation,delete cl.animationstart.animation),"TransitionEvent"in window||delete cl.transitionend.transition);function Ms(t){if(Sd[t])return Sd[t];if(!cl[t])return t;var a=cl[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in pg)return Sd[t]=a[i];return t}var gg=Ms("animationend"),xg=Ms("animationiteration"),yg=Ms("animationstart"),Hw=Ms("transitionrun"),Pw=Ms("transitionstart"),Fw=Ms("transitioncancel"),bg=Ms("transitionend"),vg=new Map,jd="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(" ");jd.push("scrollEnd");function Ba(t,a){vg.set(t,a),Ln(a,[t])}var Qo=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)},va=[],ul=0,Nd=0;function Xo(){for(var t=ul,a=Nd=ul=0;a<t;){var i=va[a];va[a++]=null;var u=va[a];va[a++]=null;var g=va[a];va[a++]=null;var b=va[a];if(va[a++]=null,u!==null&&g!==null){var S=u.pending;S===null?g.next=g:(g.next=S.next,S.next=g),u.pending=g}b!==0&&kg(i,g,b)}}function Zo(t,a,i,u){va[ul++]=t,va[ul++]=a,va[ul++]=i,va[ul++]=u,Nd|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Cd(t,a,i,u){return Zo(t,a,i,u),Jo(t)}function Es(t,a){return Zo(t,null,null,a),Jo(t)}function kg(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var g=!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||(g=!0)),t=b,b=b.return;return t.tag===3?(b=t.stateNode,g&&a!==null&&(g=31-He(i),t=b.hiddenUpdates,u=t[g],u===null?t[g]=[a]:u.push(a),a.lane=i|536870912),b):null}function Jo(t){if(50<Oi)throw Oi=0,Df=null,Error(s(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var dl={};function qw(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 ea(t,a,i,u){return new qw(t,a,i,u)}function Td(t){return t=t.prototype,!(!t||!t.isReactComponent)}function vr(t,a){var i=t.alternate;return i===null?(i=ea(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 wg(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 ec(t,a,i,u,g,b){var S=0;if(u=t,typeof t=="function")Td(t)&&(S=1);else if(typeof t=="string")S=YS(t,i,Y.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case X:return t=ea(31,i,a,g),t.elementType=X,t.lanes=b,t;case C:return As(i.children,g,b,a);case T:S=8,g|=24;break;case A:return t=ea(12,i,a,g|2),t.elementType=A,t.lanes=b,t;case O:return t=ea(13,i,a,g),t.elementType=O,t.lanes=b,t;case I:return t=ea(19,i,a,g),t.elementType=I,t.lanes=b,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case L:S=10;break e;case R:S=9;break e;case H:S=11;break e;case z:S=14;break e;case W:S=16,u=null;break e}S=29,i=Error(s(130,t===null?"null":typeof t,"")),u=null}return a=ea(S,i,a,g),a.elementType=t,a.type=u,a.lanes=b,a}function As(t,a,i,u){return t=ea(7,t,u,a),t.lanes=i,t}function Md(t,a,i){return t=ea(6,t,null,a),t.lanes=i,t}function Sg(t){var a=ea(18,null,null,0);return a.stateNode=t,a}function Ed(t,a,i){return a=ea(4,t.children!==null?t.children:[],t.key,a),a.lanes=i,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var jg=new WeakMap;function ka(t,a){if(typeof t=="object"&&t!==null){var i=jg.get(t);return i!==void 0?i:(a={value:t,source:a,stack:Te(a)},jg.set(t,a),a)}return{value:t,source:a,stack:Te(a)}}var fl=[],ml=0,tc=null,hi=0,wa=[],Sa=0,Vr=null,ar=1,rr="";function kr(t,a){fl[ml++]=hi,fl[ml++]=tc,tc=t,hi=a}function Ng(t,a,i){wa[Sa++]=ar,wa[Sa++]=rr,wa[Sa++]=Vr,Vr=t;var u=ar;t=rr;var g=32-He(u)-1;u&=~(1<<g),i+=1;var b=32-He(a)+g;if(30<b){var S=g-g%5;b=(u&(1<<S)-1).toString(32),u>>=S,g-=S,ar=1<<32-He(a)+g|i<<g|u,rr=b+t}else ar=1<<b|i<<g|u,rr=t}function Ad(t){t.return!==null&&(kr(t,1),Ng(t,1,0))}function Rd(t){for(;t===tc;)tc=fl[--ml],fl[ml]=null,hi=fl[--ml],fl[ml]=null;for(;t===Vr;)Vr=wa[--Sa],wa[Sa]=null,rr=wa[--Sa],wa[Sa]=null,ar=wa[--Sa],wa[Sa]=null}function Cg(t,a){wa[Sa++]=ar,wa[Sa++]=rr,wa[Sa++]=Vr,ar=a.id,rr=a.overflow,Vr=t}var vn=null,zt=null,nt=!1,Gr=null,ja=!1,_d=Error(s(519));function Wr(t){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pi(ka(a,t)),_d}function Tg(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[Qt]=t,a[hn]=u,i){case"dialog":Xe("cancel",a),Xe("close",a);break;case"iframe":case"object":case"embed":Xe("load",a);break;case"video":case"audio":for(i=0;i<zi.length;i++)Xe(zi[i],a);break;case"source":Xe("error",a);break;case"img":case"image":case"link":Xe("error",a),Xe("load",a);break;case"details":Xe("toggle",a);break;case"input":Xe("invalid",a),Fo(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Xe("invalid",a);break;case"textarea":Xe("invalid",a),ni(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||qx(a.textContent,i)?(u.popover!=null&&(Xe("beforetoggle",a),Xe("toggle",a)),u.onScroll!=null&&Xe("scroll",a),u.onScrollEnd!=null&&Xe("scrollend",a),u.onClick!=null&&(a.onclick=$a),a=!0):a=!1,a||Wr(t,!0)}function Mg(t){for(vn=t.return;vn;)switch(vn.tag){case 5:case 31:case 13:ja=!1;return;case 27:case 3:ja=!0;return;default:vn=vn.return}}function hl(t){if(t!==vn)return!1;if(!nt)return Mg(t),nt=!0,!1;var a=t.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||Xf(t.type,t.memoizedProps)),i=!i),i&&zt&&Wr(t),Mg(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));zt=Jx(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));zt=Jx(t)}else a===27?(a=zt,is(t.type)?(t=nm,nm=null,zt=t):zt=a):zt=vn?Ca(t.stateNode.nextSibling):null;return!0}function Rs(){zt=vn=null,nt=!1}function Id(){var t=Gr;return t!==null&&(Vn===null?Vn=t:Vn.push.apply(Vn,t),Gr=null),t}function pi(t){Gr===null?Gr=[t]:Gr.push(t)}var Ld=M(null),_s=null,wr=null;function Kr(t,a,i){N(Ld,a._currentValue),a._currentValue=i}function Sr(t){t._currentValue=Ld.current,$(Ld)}function Od(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 Dd(t,a,i,u){var g=t.child;for(g!==null&&(g.return=t);g!==null;){var b=g.dependencies;if(b!==null){var S=g.child;b=b.firstContext;e:for(;b!==null;){var _=b;b=g;for(var V=0;V<a.length;V++)if(_.context===a[V]){b.lanes|=i,_=b.alternate,_!==null&&(_.lanes|=i),Od(b.return,i,t),u||(S=null);break e}b=_.next}}else if(g.tag===18){if(S=g.return,S===null)throw Error(s(341));S.lanes|=i,b=S.alternate,b!==null&&(b.lanes|=i),Od(S,i,t),S=null}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===t){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}}function pl(t,a,i,u){t=null;for(var g=a,b=!1;g!==null;){if(!b){if((g.flags&524288)!==0)b=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var S=g.alternate;if(S===null)throw Error(s(387));if(S=S.memoizedProps,S!==null){var _=g.type;Jn(g.pendingProps.value,S.value)||(t!==null?t.push(_):t=[_])}}else if(g===pe.current){if(S=g.alternate,S===null)throw Error(s(387));S.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(t!==null?t.push(Pi):t=[Pi])}g=g.return}t!==null&&Dd(a,t,i,u),a.flags|=262144}function nc(t){for(t=t.firstContext;t!==null;){if(!Jn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Is(t){_s=t,wr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function kn(t){return Eg(_s,t)}function ac(t,a){return _s===null&&Is(t),Eg(t,a)}function Eg(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},wr===null){if(t===null)throw Error(s(308));wr=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else wr=wr.next=a;return i}var Vw=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()})}},Gw=e.unstable_scheduleCallback,Ww=e.unstable_NormalPriority,nn={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zd(){return{controller:new Vw,data:new Map,refCount:0}}function gi(t){t.refCount--,t.refCount===0&&Gw(Ww,function(){t.controller.abort()})}var xi=null,Ud=0,gl=0,xl=null;function Kw(t,a){if(xi===null){var i=xi=[];Ud=0,gl=Pf(),xl={status:"pending",value:void 0,then:function(u){i.push(u)}}}return Ud++,a.then(Ag,Ag),a}function Ag(){if(--Ud===0&&xi!==null){xl!==null&&(xl.status="fulfilled");var t=xi;xi=null,gl=0,xl=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function Yw(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(g){i.push(g)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var g=0;g<i.length;g++)(0,i[g])(a)},function(g){for(u.status="rejected",u.reason=g,g=0;g<i.length;g++)(0,i[g])(void 0)}),u}var Rg=U.S;U.S=function(t,a){hx=ut(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Kw(t,a),Rg!==null&&Rg(t,a)};var Ls=M(null);function $d(){var t=Ls.current;return t!==null?t:Tt.pooledCache}function rc(t,a){a===null?N(Ls,Ls.current):N(Ls,a.pool)}function _g(){var t=$d();return t===null?null:{parent:nn._currentValue,pool:t}}var yl=Error(s(460)),Bd=Error(s(474)),sc=Error(s(542)),lc={then:function(){}};function Ig(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Lg(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then($a,$a),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Dg(t),t;default:if(typeof a.status=="string")a.then($a,$a);else{if(t=Tt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var g=a;g.status="fulfilled",g.value=u}},function(u){if(a.status==="pending"){var g=a;g.status="rejected",g.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Dg(t),t}throw Ds=a,yl}}function Os(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Ds=i,yl):i}}var Ds=null;function Og(){if(Ds===null)throw Error(s(459));var t=Ds;return Ds=null,t}function Dg(t){if(t===yl||t===sc)throw Error(s(483))}var bl=null,yi=0;function ic(t){var a=yi;return yi+=1,bl===null&&(bl=[]),Lg(bl,t,a)}function bi(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function oc(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 zg(t){function a(Q,G){if(t){var J=Q.deletions;J===null?(Q.deletions=[G],Q.flags|=16):J.push(G)}}function i(Q,G){if(!t)return null;for(;G!==null;)a(Q,G),G=G.sibling;return null}function u(Q){for(var G=new Map;Q!==null;)Q.key!==null?G.set(Q.key,Q):G.set(Q.index,Q),Q=Q.sibling;return G}function g(Q,G){return Q=vr(Q,G),Q.index=0,Q.sibling=null,Q}function b(Q,G,J){return Q.index=J,t?(J=Q.alternate,J!==null?(J=J.index,J<G?(Q.flags|=67108866,G):J):(Q.flags|=67108866,G)):(Q.flags|=1048576,G)}function S(Q){return t&&Q.alternate===null&&(Q.flags|=67108866),Q}function _(Q,G,J,fe){return G===null||G.tag!==6?(G=Md(J,Q.mode,fe),G.return=Q,G):(G=g(G,J),G.return=Q,G)}function V(Q,G,J,fe){var Re=J.type;return Re===C?de(Q,G,J.props.children,fe,J.key):G!==null&&(G.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===W&&Os(Re)===G.type)?(G=g(G,J.props),bi(G,J),G.return=Q,G):(G=ec(J.type,J.key,J.props,null,Q.mode,fe),bi(G,J),G.return=Q,G)}function te(Q,G,J,fe){return G===null||G.tag!==4||G.stateNode.containerInfo!==J.containerInfo||G.stateNode.implementation!==J.implementation?(G=Ed(J,Q.mode,fe),G.return=Q,G):(G=g(G,J.children||[]),G.return=Q,G)}function de(Q,G,J,fe,Re){return G===null||G.tag!==7?(G=As(J,Q.mode,fe,Re),G.return=Q,G):(G=g(G,J),G.return=Q,G)}function me(Q,G,J){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Md(""+G,Q.mode,J),G.return=Q,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return J=ec(G.type,G.key,G.props,null,Q.mode,J),bi(J,G),J.return=Q,J;case j:return G=Ed(G,Q.mode,J),G.return=Q,G;case W:return G=Os(G),me(Q,G,J)}if(B(G)||P(G))return G=As(G,Q.mode,J,null),G.return=Q,G;if(typeof G.then=="function")return me(Q,ic(G),J);if(G.$$typeof===L)return me(Q,ac(Q,G),J);oc(Q,G)}return null}function ne(Q,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:_(Q,G,""+J,fe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return J.key===Re?V(Q,G,J,fe):null;case j:return J.key===Re?te(Q,G,J,fe):null;case W:return J=Os(J),ne(Q,G,J,fe)}if(B(J)||P(J))return Re!==null?null:de(Q,G,J,fe,null);if(typeof J.then=="function")return ne(Q,G,ic(J),fe);if(J.$$typeof===L)return ne(Q,G,ac(Q,J),fe);oc(Q,J)}return null}function ie(Q,G,J,fe,Re){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Q=Q.get(J)||null,_(G,Q,""+fe,Re);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return Q=Q.get(fe.key===null?J:fe.key)||null,V(G,Q,fe,Re);case j:return Q=Q.get(fe.key===null?J:fe.key)||null,te(G,Q,fe,Re);case W:return fe=Os(fe),ie(Q,G,J,fe,Re)}if(B(fe)||P(fe))return Q=Q.get(J)||null,de(G,Q,fe,Re,null);if(typeof fe.then=="function")return ie(Q,G,J,ic(fe),Re);if(fe.$$typeof===L)return ie(Q,G,J,ac(G,fe),Re);oc(G,fe)}return null}function je(Q,G,J,fe){for(var Re=null,it=null,Me=G,Ge=G=0,tt=null;Me!==null&&Ge<J.length;Ge++){Me.index>Ge?(tt=Me,Me=null):tt=Me.sibling;var ot=ne(Q,Me,J[Ge],fe);if(ot===null){Me===null&&(Me=tt);break}t&&Me&&ot.alternate===null&&a(Q,Me),G=b(ot,G,Ge),it===null?Re=ot:it.sibling=ot,it=ot,Me=tt}if(Ge===J.length)return i(Q,Me),nt&&kr(Q,Ge),Re;if(Me===null){for(;Ge<J.length;Ge++)Me=me(Q,J[Ge],fe),Me!==null&&(G=b(Me,G,Ge),it===null?Re=Me:it.sibling=Me,it=Me);return nt&&kr(Q,Ge),Re}for(Me=u(Me);Ge<J.length;Ge++)tt=ie(Me,Q,Ge,J[Ge],fe),tt!==null&&(t&&tt.alternate!==null&&Me.delete(tt.key===null?Ge:tt.key),G=b(tt,G,Ge),it===null?Re=tt:it.sibling=tt,it=tt);return t&&Me.forEach(function(fs){return a(Q,fs)}),nt&&kr(Q,Ge),Re}function Oe(Q,G,J,fe){if(J==null)throw Error(s(151));for(var Re=null,it=null,Me=G,Ge=G=0,tt=null,ot=J.next();Me!==null&&!ot.done;Ge++,ot=J.next()){Me.index>Ge?(tt=Me,Me=null):tt=Me.sibling;var fs=ne(Q,Me,ot.value,fe);if(fs===null){Me===null&&(Me=tt);break}t&&Me&&fs.alternate===null&&a(Q,Me),G=b(fs,G,Ge),it===null?Re=fs:it.sibling=fs,it=fs,Me=tt}if(ot.done)return i(Q,Me),nt&&kr(Q,Ge),Re;if(Me===null){for(;!ot.done;Ge++,ot=J.next())ot=me(Q,ot.value,fe),ot!==null&&(G=b(ot,G,Ge),it===null?Re=ot:it.sibling=ot,it=ot);return nt&&kr(Q,Ge),Re}for(Me=u(Me);!ot.done;Ge++,ot=J.next())ot=ie(Me,Q,Ge,ot.value,fe),ot!==null&&(t&&ot.alternate!==null&&Me.delete(ot.key===null?Ge:ot.key),G=b(ot,G,Ge),it===null?Re=ot:it.sibling=ot,it=ot);return t&&Me.forEach(function(lj){return a(Q,lj)}),nt&&kr(Q,Ge),Re}function wt(Q,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(Q,G.sibling),fe=g(G,J.props.children),fe.return=Q,Q=fe;break e}}else if(G.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===W&&Os(Re)===G.type){i(Q,G.sibling),fe=g(G,J.props),bi(fe,J),fe.return=Q,Q=fe;break e}i(Q,G);break}else a(Q,G);G=G.sibling}J.type===C?(fe=As(J.props.children,Q.mode,fe,J.key),fe.return=Q,Q=fe):(fe=ec(J.type,J.key,J.props,null,Q.mode,fe),bi(fe,J),fe.return=Q,Q=fe)}return S(Q);case j: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(Q,G.sibling),fe=g(G,J.children||[]),fe.return=Q,Q=fe;break e}else{i(Q,G);break}else a(Q,G);G=G.sibling}fe=Ed(J,Q.mode,fe),fe.return=Q,Q=fe}return S(Q);case W:return J=Os(J),wt(Q,G,J,fe)}if(B(J))return je(Q,G,J,fe);if(P(J)){if(Re=P(J),typeof Re!="function")throw Error(s(150));return J=Re.call(J),Oe(Q,G,J,fe)}if(typeof J.then=="function")return wt(Q,G,ic(J),fe);if(J.$$typeof===L)return wt(Q,G,ac(Q,J),fe);oc(Q,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,G!==null&&G.tag===6?(i(Q,G.sibling),fe=g(G,J),fe.return=Q,Q=fe):(i(Q,G),fe=Md(J,Q.mode,fe),fe.return=Q,Q=fe),S(Q)):i(Q,G)}return function(Q,G,J,fe){try{yi=0;var Re=wt(Q,G,J,fe);return bl=null,Re}catch(Me){if(Me===yl||Me===sc)throw Me;var it=ea(29,Me,null,Q.mode);return it.lanes=fe,it.return=Q,it}}}var zs=zg(!0),Ug=zg(!1),Yr=!1;function Hd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pd(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 Qr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Xr(t,a,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(dt&2)!==0){var g=u.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),u.pending=a,a=Jo(t),kg(t,null,i),a}return Zo(t,u,a,i),Jo(t)}function vi(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,_t(t,i)}}function Fd(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var g=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?g=b=S:b=b.next=S,i=i.next}while(i!==null);b===null?g=b=a:b=b.next=a}else g=b=a;i={baseState:u.baseState,firstBaseUpdate:g,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 qd=!1;function ki(){if(qd){var t=xl;if(t!==null)throw t}}function wi(t,a,i,u){qd=!1;var g=t.updateQueue;Yr=!1;var b=g.firstBaseUpdate,S=g.lastBaseUpdate,_=g.shared.pending;if(_!==null){g.shared.pending=null;var V=_,te=V.next;V.next=null,S===null?b=te:S.next=te,S=V;var de=t.alternate;de!==null&&(de=de.updateQueue,_=de.lastBaseUpdate,_!==S&&(_===null?de.firstBaseUpdate=te:_.next=te,de.lastBaseUpdate=V))}if(b!==null){var me=g.baseState;S=0,de=te=V=null,_=b;do{var ne=_.lane&-536870913,ie=ne!==_.lane;if(ie?(et&ne)===ne:(u&ne)===ne){ne!==0&&ne===gl&&(qd=!0),de!==null&&(de=de.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var je=t,Oe=_;ne=a;var wt=i;switch(Oe.tag){case 1:if(je=Oe.payload,typeof je=="function"){me=je.call(wt,me,ne);break e}me=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Oe.payload,ne=typeof je=="function"?je.call(wt,me,ne):je,ne==null)break e;me=y({},me,ne);break e;case 2:Yr=!0}}ne=_.callback,ne!==null&&(t.flags|=64,ie&&(t.flags|=8192),ie=g.callbacks,ie===null?g.callbacks=[ne]:ie.push(ne))}else ie={lane:ne,tag:_.tag,payload:_.payload,callback:_.callback,next:null},de===null?(te=de=ie,V=me):de=de.next=ie,S|=ne;if(_=_.next,_===null){if(_=g.shared.pending,_===null)break;ie=_,_=ie.next,ie.next=null,g.lastBaseUpdate=ie,g.shared.pending=null}}while(!0);de===null&&(V=me),g.baseState=V,g.firstBaseUpdate=te,g.lastBaseUpdate=de,b===null&&(g.shared.lanes=0),ns|=S,t.lanes=S,t.memoizedState=me}}function $g(t,a){if(typeof t!="function")throw Error(s(191,t));t.call(a)}function Bg(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)$g(i[t],a)}var vl=M(null),cc=M(0);function Hg(t,a){t=_r,N(cc,t),N(vl,a),_r=t|a.baseLanes}function Vd(){N(cc,_r),N(vl,vl.current)}function Gd(){_r=cc.current,$(vl),$(cc)}var ta=M(null),Na=null;function Zr(t){var a=t.alternate;N(en,en.current&1),N(ta,t),Na===null&&(a===null||vl.current!==null||a.memoizedState!==null)&&(Na=t)}function Wd(t){N(en,en.current),N(ta,t),Na===null&&(Na=t)}function Pg(t){t.tag===22?(N(en,en.current),N(ta,t),Na===null&&(Na=t)):Jr()}function Jr(){N(en,en.current),N(ta,ta.current)}function na(t){$(ta),Na===t&&(Na=null),$(en)}var en=M(0);function uc(t){for(var a=t;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||em(i)||tm(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 jr=0,Ve=null,vt=null,an=null,dc=!1,kl=!1,Us=!1,fc=0,Si=0,wl=null,Qw=0;function Xt(){throw Error(s(321))}function Kd(t,a){if(a===null)return!1;for(var i=0;i<a.length&&i<t.length;i++)if(!Jn(t[i],a[i]))return!1;return!0}function Yd(t,a,i,u,g,b){return jr=b,Ve=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,U.H=t===null||t.memoizedState===null?N0:df,Us=!1,b=i(u,g),Us=!1,kl&&(b=qg(a,i,u,g)),Fg(t),b}function Fg(t){U.H=Ci;var a=vt!==null&&vt.next!==null;if(jr=0,an=vt=Ve=null,dc=!1,Si=0,wl=null,a)throw Error(s(300));t===null||rn||(t=t.dependencies,t!==null&&nc(t)&&(rn=!0))}function qg(t,a,i,u){Ve=t;var g=0;do{if(kl&&(wl=null),Si=0,kl=!1,25<=g)throw Error(s(301));if(g+=1,an=vt=null,t.updateQueue!=null){var b=t.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}U.H=C0,b=a(i,u)}while(kl);return b}function Xw(){var t=U.H,a=t.useState()[0];return a=typeof a.then=="function"?ji(a):a,t=t.useState()[0],(vt!==null?vt.memoizedState:null)!==t&&(Ve.flags|=1024),a}function Qd(){var t=fc!==0;return fc=0,t}function Xd(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function Zd(t){if(dc){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}dc=!1}jr=0,an=vt=Ve=null,kl=!1,Si=fc=0,wl=null}function Dn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return an===null?Ve.memoizedState=an=t:an=an.next=t,an}function tn(){if(vt===null){var t=Ve.alternate;t=t!==null?t.memoizedState:null}else t=vt.next;var a=an===null?Ve.memoizedState:an.next;if(a!==null)an=a,vt=t;else{if(t===null)throw Ve.alternate===null?Error(s(467)):Error(s(310));vt=t,t={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},an===null?Ve.memoizedState=an=t:an=an.next=t}return an}function mc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ji(t){var a=Si;return Si+=1,wl===null&&(wl=[]),t=Lg(wl,t,a),a=Ve,(an===null?a.memoizedState:an.next)===null&&(a=a.alternate,U.H=a===null||a.memoizedState===null?N0:df),t}function hc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ji(t);if(t.$$typeof===L)return kn(t)}throw Error(s(438,String(t)))}function Jd(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(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=mc(),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]=D;return a.index++,i}function Nr(t,a){return typeof a=="function"?a(t):a}function pc(t){var a=tn();return ef(a,vt,t)}function ef(t,a,i){var u=t.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=i;var g=t.baseQueue,b=u.pending;if(b!==null){if(g!==null){var S=g.next;g.next=b.next,b.next=S}a.baseQueue=g=b,u.pending=null}if(b=t.baseState,g===null)t.memoizedState=b;else{a=g.next;var _=S=null,V=null,te=a,de=!1;do{var me=te.lane&-536870913;if(me!==te.lane?(et&me)===me:(jr&me)===me){var ne=te.revertLane;if(ne===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),me===gl&&(de=!0);else if((jr&ne)===ne){te=te.next,ne===gl&&(de=!0);continue}else me={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},V===null?(_=V=me,S=b):V=V.next=me,Ve.lanes|=ne,ns|=ne;me=te.action,Us&&i(b,me),b=te.hasEagerState?te.eagerState:i(b,me)}else ne={lane:me,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},V===null?(_=V=ne,S=b):V=V.next=ne,Ve.lanes|=me,ns|=me;te=te.next}while(te!==null&&te!==a);if(V===null?S=b:V.next=_,!Jn(b,t.memoizedState)&&(rn=!0,de&&(i=xl,i!==null)))throw i;t.memoizedState=b,t.baseState=S,t.baseQueue=V,u.lastRenderedState=b}return g===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function tf(t){var a=tn(),i=a.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=t;var u=i.dispatch,g=i.pending,b=a.memoizedState;if(g!==null){i.pending=null;var S=g=g.next;do b=t(b,S.action),S=S.next;while(S!==g);Jn(b,a.memoizedState)||(rn=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),i.lastRenderedState=b}return[b,u]}function Vg(t,a,i){var u=Ve,g=tn(),b=nt;if(b){if(i===void 0)throw Error(s(407));i=i()}else i=a();var S=!Jn((vt||g).memoizedState,i);if(S&&(g.memoizedState=i,rn=!0),g=g.queue,rf(Kg.bind(null,u,g,t),[t]),g.getSnapshot!==a||S||an!==null&&an.memoizedState.tag&1){if(u.flags|=2048,Sl(9,{destroy:void 0},Wg.bind(null,u,g,i,a),null),Tt===null)throw Error(s(349));b||(jr&127)!==0||Gg(u,a,i)}return i}function Gg(t,a,i){t.flags|=16384,t={getSnapshot:a,value:i},a=Ve.updateQueue,a===null?(a=mc(),Ve.updateQueue=a,a.stores=[t]):(i=a.stores,i===null?a.stores=[t]:i.push(t))}function Wg(t,a,i,u){a.value=i,a.getSnapshot=u,Yg(a)&&Qg(t)}function Kg(t,a,i){return i(function(){Yg(a)&&Qg(t)})}function Yg(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!Jn(t,i)}catch{return!0}}function Qg(t){var a=Es(t,2);a!==null&&Gn(a,t,2)}function nf(t){var a=Dn();if(typeof t=="function"){var i=t;if(t=i(),Us){Ft(!0);try{i()}finally{Ft(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:t},a}function Xg(t,a,i,u){return t.baseState=i,ef(t,vt,typeof u=="function"?u:Nr)}function Zw(t,a,i,u,g){if(yc(t))throw Error(s(485));if(t=a.action,t!==null){var b={payload:g,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){b.listeners.push(S)}};U.T!==null?i(!0):b.isTransition=!1,u(b),i=a.pending,i===null?(b.next=a.pending=b,Zg(a,b)):(b.next=i.next,a.pending=i.next=b)}}function Zg(t,a){var i=a.action,u=a.payload,g=t.state;if(a.isTransition){var b=U.T,S={};U.T=S;try{var _=i(g,u),V=U.S;V!==null&&V(S,_),Jg(t,a,_)}catch(te){af(t,a,te)}finally{b!==null&&S.types!==null&&(b.types=S.types),U.T=b}}else try{b=i(g,u),Jg(t,a,b)}catch(te){af(t,a,te)}}function Jg(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){e0(t,a,u)},function(u){return af(t,a,u)}):e0(t,a,i)}function e0(t,a,i){a.status="fulfilled",a.value=i,t0(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,Zg(t,i)))}function af(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,t0(a),a=a.next;while(a!==u)}t.action=null}function t0(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function n0(t,a){return a}function a0(t,a){if(nt){var i=Tt.formState;if(i!==null){e:{var u=Ve;if(nt){if(zt){t:{for(var g=zt,b=ja;g.nodeType!==8;){if(!b){g=null;break t}if(g=Ca(g.nextSibling),g===null){g=null;break t}}b=g.data,g=b==="F!"||b==="F"?g:null}if(g){zt=Ca(g.nextSibling),u=g.data==="F!";break e}}Wr(u)}u=!1}u&&(a=i[0])}}return i=Dn(),i.memoizedState=i.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n0,lastRenderedState:a},i.queue=u,i=w0.bind(null,Ve,u),u.dispatch=i,u=nf(!1),b=uf.bind(null,Ve,!1,u.queue),u=Dn(),g={state:a,dispatch:null,action:t,pending:null},u.queue=g,i=Zw.bind(null,Ve,g,b,i),g.dispatch=i,u.memoizedState=t,[a,i,!1]}function r0(t){var a=tn();return s0(a,vt,t)}function s0(t,a,i){if(a=ef(t,a,n0)[0],t=pc(Nr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=ji(a)}catch(S){throw S===yl?sc:S}else u=a;a=tn();var g=a.queue,b=g.dispatch;return i!==a.memoizedState&&(Ve.flags|=2048,Sl(9,{destroy:void 0},Jw.bind(null,g,i),null)),[u,b,t]}function Jw(t,a){t.action=a}function l0(t){var a=tn(),i=vt;if(i!==null)return s0(a,i,t);tn(),a=a.memoizedState,i=tn();var u=i.queue.dispatch;return i.memoizedState=t,[a,u,!1]}function Sl(t,a,i,u){return t={tag:t,create:i,deps:u,inst:a,next:null},a=Ve.updateQueue,a===null&&(a=mc(),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 i0(){return tn().memoizedState}function gc(t,a,i,u){var g=Dn();Ve.flags|=t,g.memoizedState=Sl(1|a,{destroy:void 0},i,u===void 0?null:u)}function xc(t,a,i,u){var g=tn();u=u===void 0?null:u;var b=g.memoizedState.inst;vt!==null&&u!==null&&Kd(u,vt.memoizedState.deps)?g.memoizedState=Sl(a,b,i,u):(Ve.flags|=t,g.memoizedState=Sl(1|a,b,i,u))}function o0(t,a){gc(8390656,8,t,a)}function rf(t,a){xc(2048,8,t,a)}function eS(t){Ve.flags|=4;var a=Ve.updateQueue;if(a===null)a=mc(),Ve.updateQueue=a,a.events=[t];else{var i=a.events;i===null?a.events=[t]:i.push(t)}}function c0(t){var a=tn().memoizedState;return eS({ref:a,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function u0(t,a){return xc(4,2,t,a)}function d0(t,a){return xc(4,4,t,a)}function f0(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 m0(t,a,i){i=i!=null?i.concat([t]):null,xc(4,4,f0.bind(null,a,t),i)}function sf(){}function h0(t,a){var i=tn();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&Kd(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function p0(t,a){var i=tn();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&Kd(a,u[1]))return u[0];if(u=t(),Us){Ft(!0);try{t()}finally{Ft(!1)}}return i.memoizedState=[u,a],u}function lf(t,a,i){return i===void 0||(jr&1073741824)!==0&&(et&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=gx(),Ve.lanes|=t,ns|=t,i)}function g0(t,a,i,u){return Jn(i,a)?i:vl.current!==null?(t=lf(t,i,u),Jn(t,a)||(rn=!0),t):(jr&42)===0||(jr&1073741824)!==0&&(et&261930)===0?(rn=!0,t.memoizedState=i):(t=gx(),Ve.lanes|=t,ns|=t,a)}function x0(t,a,i,u,g){var b=F.p;F.p=b!==0&&8>b?b:8;var S=U.T,_={};U.T=_,uf(t,!1,a,i);try{var V=g(),te=U.S;if(te!==null&&te(_,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var de=Yw(V,u);Ni(t,a,de,sa(t))}else Ni(t,a,u,sa(t))}catch(me){Ni(t,a,{then:function(){},status:"rejected",reason:me},sa())}finally{F.p=b,S!==null&&_.types!==null&&(S.types=_.types),U.T=S}}function tS(){}function of(t,a,i,u){if(t.tag!==5)throw Error(s(476));var g=y0(t).queue;x0(t,g,a,Z,i===null?tS:function(){return b0(t),i(u)})}function y0(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:Nr,lastRenderedState:Z},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function b0(t){var a=y0(t);a.next===null&&(a=t.alternate.memoizedState),Ni(t,a.next.queue,{},sa())}function cf(){return kn(Pi)}function v0(){return tn().memoizedState}function k0(){return tn().memoizedState}function nS(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var i=sa();t=Qr(i);var u=Xr(a,t,i);u!==null&&(Gn(u,a,i),vi(u,a,i)),a={cache:zd()},t.payload=a;return}a=a.return}}function aS(t,a,i){var u=sa();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},yc(t)?S0(a,i):(i=Cd(t,a,i,u),i!==null&&(Gn(i,t,u),j0(i,a,u)))}function w0(t,a,i){var u=sa();Ni(t,a,i,u)}function Ni(t,a,i,u){var g={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(yc(t))S0(a,g);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(g.hasEagerState=!0,g.eagerState=_,Jn(_,S))return Zo(t,a,g,0),Tt===null&&Xo(),!1}catch{}if(i=Cd(t,a,g,u),i!==null)return Gn(i,t,u),j0(i,a,u),!0}return!1}function uf(t,a,i,u){if(u={lane:2,revertLane:Pf(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},yc(t)){if(a)throw Error(s(479))}else a=Cd(t,i,u,2),a!==null&&Gn(a,t,2)}function yc(t){var a=t.alternate;return t===Ve||a!==null&&a===Ve}function S0(t,a){kl=dc=!0;var i=t.pending;i===null?a.next=a:(a.next=i.next,i.next=a),t.pending=a}function j0(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,_t(t,i)}}var Ci={readContext:kn,use:hc,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Ci.useEffectEvent=Xt;var N0={readContext:kn,use:hc,useCallback:function(t,a){return Dn().memoizedState=[t,a===void 0?null:a],t},useContext:kn,useEffect:o0,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,gc(4194308,4,f0.bind(null,a,t),i)},useLayoutEffect:function(t,a){return gc(4194308,4,t,a)},useInsertionEffect:function(t,a){gc(4,2,t,a)},useMemo:function(t,a){var i=Dn();a=a===void 0?null:a;var u=t();if(Us){Ft(!0);try{t()}finally{Ft(!1)}}return i.memoizedState=[u,a],u},useReducer:function(t,a,i){var u=Dn();if(i!==void 0){var g=i(a);if(Us){Ft(!0);try{i(a)}finally{Ft(!1)}}}else g=a;return u.memoizedState=u.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},u.queue=t,t=t.dispatch=aS.bind(null,Ve,t),[u.memoizedState,t]},useRef:function(t){var a=Dn();return t={current:t},a.memoizedState=t},useState:function(t){t=nf(t);var a=t.queue,i=w0.bind(null,Ve,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:sf,useDeferredValue:function(t,a){var i=Dn();return lf(i,t,a)},useTransition:function(){var t=nf(!1);return t=x0.bind(null,Ve,t.queue,!0,!1),Dn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=Ve,g=Dn();if(nt){if(i===void 0)throw Error(s(407));i=i()}else{if(i=a(),Tt===null)throw Error(s(349));(et&127)!==0||Gg(u,a,i)}g.memoizedState=i;var b={value:i,getSnapshot:a};return g.queue=b,o0(Kg.bind(null,u,b,t),[t]),u.flags|=2048,Sl(9,{destroy:void 0},Wg.bind(null,u,b,i,a),null),i},useId:function(){var t=Dn(),a=Tt.identifierPrefix;if(nt){var i=rr,u=ar;i=(u&~(1<<32-He(u)-1)).toString(32)+i,a="_"+a+"R_"+i,i=fc++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=Qw++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:cf,useFormState:a0,useActionState:a0,useOptimistic:function(t){var a=Dn();a.memoizedState=a.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=uf.bind(null,Ve,!0,i),i.dispatch=a,[t,a]},useMemoCache:Jd,useCacheRefresh:function(){return Dn().memoizedState=nS.bind(null,Ve)},useEffectEvent:function(t){var a=Dn(),i={impl:t};return a.memoizedState=i,function(){if((dt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},df={readContext:kn,use:hc,useCallback:h0,useContext:kn,useEffect:rf,useImperativeHandle:m0,useInsertionEffect:u0,useLayoutEffect:d0,useMemo:p0,useReducer:pc,useRef:i0,useState:function(){return pc(Nr)},useDebugValue:sf,useDeferredValue:function(t,a){var i=tn();return g0(i,vt.memoizedState,t,a)},useTransition:function(){var t=pc(Nr)[0],a=tn().memoizedState;return[typeof t=="boolean"?t:ji(t),a]},useSyncExternalStore:Vg,useId:v0,useHostTransitionStatus:cf,useFormState:r0,useActionState:r0,useOptimistic:function(t,a){var i=tn();return Xg(i,vt,t,a)},useMemoCache:Jd,useCacheRefresh:k0};df.useEffectEvent=c0;var C0={readContext:kn,use:hc,useCallback:h0,useContext:kn,useEffect:rf,useImperativeHandle:m0,useInsertionEffect:u0,useLayoutEffect:d0,useMemo:p0,useReducer:tf,useRef:i0,useState:function(){return tf(Nr)},useDebugValue:sf,useDeferredValue:function(t,a){var i=tn();return vt===null?lf(i,t,a):g0(i,vt.memoizedState,t,a)},useTransition:function(){var t=tf(Nr)[0],a=tn().memoizedState;return[typeof t=="boolean"?t:ji(t),a]},useSyncExternalStore:Vg,useId:v0,useHostTransitionStatus:cf,useFormState:l0,useActionState:l0,useOptimistic:function(t,a){var i=tn();return vt!==null?Xg(i,vt,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:Jd,useCacheRefresh:k0};C0.useEffectEvent=c0;function ff(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 mf={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=sa(),g=Qr(u);g.payload=a,i!=null&&(g.callback=i),a=Xr(t,g,u),a!==null&&(Gn(a,t,u),vi(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=sa(),g=Qr(u);g.tag=1,g.payload=a,i!=null&&(g.callback=i),a=Xr(t,g,u),a!==null&&(Gn(a,t,u),vi(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var i=sa(),u=Qr(i);u.tag=2,a!=null&&(u.callback=a),a=Xr(t,u,i),a!==null&&(Gn(a,t,i),vi(a,t,i))}};function T0(t,a,i,u,g,b,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,b,S):a.prototype&&a.prototype.isPureReactComponent?!fi(i,u)||!fi(g,b):!0}function M0(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&&mf.enqueueReplaceState(a,a.state,null)}function $s(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 g in t)i[g]===void 0&&(i[g]=t[g])}return i}function E0(t){Qo(t)}function A0(t){console.error(t)}function R0(t){Qo(t)}function bc(t,a){try{var i=t.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function _0(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function hf(t,a,i){return i=Qr(i),i.tag=3,i.payload={element:null},i.callback=function(){bc(t,a)},i}function I0(t){return t=Qr(t),t.tag=3,t}function L0(t,a,i,u){var g=i.type.getDerivedStateFromError;if(typeof g=="function"){var b=u.value;t.payload=function(){return g(b)},t.callback=function(){_0(a,i,u)}}var S=i.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){_0(a,i,u),typeof g!="function"&&(as===null?as=new Set([this]):as.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function rS(t,a,i,u,g){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&pl(a,i,g,!0),i=ta.current,i!==null){switch(i.tag){case 31:case 13:return Na===null?Rc():i.alternate===null&&Zt===0&&(Zt=3),i.flags&=-257,i.flags|=65536,i.lanes=g,u===lc?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),$f(t,u,g)),!1;case 22:return i.flags|=65536,u===lc?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)),$f(t,u,g)),!1}throw Error(s(435,i.tag))}return $f(t,u,g),Rc(),!1}if(nt)return a=ta.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,u!==_d&&(t=Error(s(422),{cause:u}),pi(ka(t,i)))):(u!==_d&&(a=Error(s(423),{cause:u}),pi(ka(a,i))),t=t.current.alternate,t.flags|=65536,g&=-g,t.lanes|=g,u=ka(u,i),g=hf(t.stateNode,u,g),Fd(t,g),Zt!==4&&(Zt=2)),!1;var b=Error(s(520),{cause:u});if(b=ka(b,i),Li===null?Li=[b]:Li.push(b),Zt!==4&&(Zt=2),a===null)return!0;u=ka(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=g&-g,i.lanes|=t,t=hf(i.stateNode,u,t),Fd(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"&&(as===null||!as.has(b))))return i.flags|=65536,g&=-g,i.lanes|=g,g=I0(g),L0(g,t,i,u),Fd(i,g),!1}i=i.return}while(i!==null);return!1}var pf=Error(s(461)),rn=!1;function wn(t,a,i,u){a.child=t===null?Ug(a,null,i,u):zs(a,t.child,i,u)}function O0(t,a,i,u,g){i=i.render;var b=a.ref;if("ref"in u){var S={};for(var _ in u)_!=="ref"&&(S[_]=u[_])}else S=u;return Is(a),u=Yd(t,a,i,S,b,g),_=Qd(),t!==null&&!rn?(Xd(t,a,g),Cr(t,a,g)):(nt&&_&&Ad(a),a.flags|=1,wn(t,a,u,g),a.child)}function D0(t,a,i,u,g){if(t===null){var b=i.type;return typeof b=="function"&&!Td(b)&&b.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=b,z0(t,a,b,u,g)):(t=ec(i.type,null,u,a,a.mode,g),t.ref=a.ref,t.return=a,a.child=t)}if(b=t.child,!Sf(t,g)){var S=b.memoizedProps;if(i=i.compare,i=i!==null?i:fi,i(S,u)&&t.ref===a.ref)return Cr(t,a,g)}return a.flags|=1,t=vr(b,u),t.ref=a.ref,t.return=a,a.child=t}function z0(t,a,i,u,g){if(t!==null){var b=t.memoizedProps;if(fi(b,u)&&t.ref===a.ref)if(rn=!1,a.pendingProps=u=b,Sf(t,g))(t.flags&131072)!==0&&(rn=!0);else return a.lanes=t.lanes,Cr(t,a,g)}return gf(t,a,i,u,g)}function U0(t,a,i,u){var g=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,g=0;u!==null;)g=g|u.lanes|u.childLanes,u=u.sibling;u=g&~b}else u=0,a.child=null;return $0(t,a,b,i,u)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&rc(a,b!==null?b.cachePool:null),b!==null?Hg(a,b):Vd(),Pg(a);else return u=a.lanes=536870912,$0(t,a,b!==null?b.baseLanes|i:i,i,u)}else b!==null?(rc(a,b.cachePool),Hg(a,b),Jr(),a.memoizedState=null):(t!==null&&rc(a,null),Vd(),Jr());return wn(t,a,g,i),a.child}function Ti(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function $0(t,a,i,u,g){var b=$d();return b=b===null?null:{parent:nn._currentValue,pool:b},a.memoizedState={baseLanes:i,cachePool:b},t!==null&&rc(a,null),Vd(),Pg(a),t!==null&&pl(t,a,u,!0),a.childLanes=g,null}function vc(t,a){return a=wc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function B0(t,a,i){return zs(a,t.child,null,i),t=vc(a,a.pendingProps),t.flags|=2,na(a),a.memoizedState=null,t}function sS(t,a,i){var u=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(nt){if(u.mode==="hidden")return t=vc(a,u),a.lanes=536870912,Ti(null,t);if(Wd(a),(t=zt)?(t=Zx(t,ja),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Vr!==null?{id:ar,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},i=Sg(t),i.return=a,a.child=i,vn=a,zt=null)):t=null,t===null)throw Wr(a);return a.lanes=536870912,null}return vc(a,u)}var b=t.memoizedState;if(b!==null){var S=b.dehydrated;if(Wd(a),g)if(a.flags&256)a.flags&=-257,a=B0(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(s(558));else if(rn||pl(t,a,i,!1),g=(i&t.childLanes)!==0,rn||g){if(u=Tt,u!==null&&(S=Yt(u,i),S!==0&&S!==b.retryLane))throw b.retryLane=S,Es(t,S),Gn(u,t,S),pf;Rc(),a=B0(t,a,i)}else t=b.treeContext,zt=Ca(S.nextSibling),vn=a,nt=!0,Gr=null,ja=!1,t!==null&&Cg(a,t),a=vc(a,u),a.flags|=4096;return a}return t=vr(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function kc(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 gf(t,a,i,u,g){return Is(a),i=Yd(t,a,i,u,void 0,g),u=Qd(),t!==null&&!rn?(Xd(t,a,g),Cr(t,a,g)):(nt&&u&&Ad(a),a.flags|=1,wn(t,a,i,g),a.child)}function H0(t,a,i,u,g,b){return Is(a),a.updateQueue=null,i=qg(a,u,i,g),Fg(t),u=Qd(),t!==null&&!rn?(Xd(t,a,b),Cr(t,a,b)):(nt&&u&&Ad(a),a.flags|=1,wn(t,a,i,b),a.child)}function P0(t,a,i,u,g){if(Is(a),a.stateNode===null){var b=dl,S=i.contextType;typeof S=="object"&&S!==null&&(b=kn(S)),b=new i(u,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=mf,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=u,b.state=a.memoizedState,b.refs={},Hd(a),S=i.contextType,b.context=typeof S=="object"&&S!==null?kn(S):dl,b.state=a.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(ff(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&&mf.enqueueReplaceState(b,b.state,null),wi(a,u,b,g),ki(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){b=a.stateNode;var _=a.memoizedProps,V=$s(i,_);b.props=V;var te=b.context,de=i.contextType;S=dl,typeof de=="object"&&de!==null&&(S=kn(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"||(_||te!==S)&&M0(a,b,u,S),Yr=!1;var ne=a.memoizedState;b.state=ne,wi(a,u,b,g),ki(),te=a.memoizedState,_||ne!==te||Yr?(typeof me=="function"&&(ff(a,i,me,u),te=a.memoizedState),(V=Yr||T0(a,i,V,u,ne,te,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=te),b.props=u,b.state=te,b.context=S,u=V):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{b=a.stateNode,Pd(t,a),S=a.memoizedProps,de=$s(i,S),b.props=de,me=a.pendingProps,ne=b.context,te=i.contextType,V=dl,typeof te=="object"&&te!==null&&(V=kn(te)),_=i.getDerivedStateFromProps,(te=typeof _=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(S!==me||ne!==V)&&M0(a,b,u,V),Yr=!1,ne=a.memoizedState,b.state=ne,wi(a,u,b,g),ki();var ie=a.memoizedState;S!==me||ne!==ie||Yr||t!==null&&t.dependencies!==null&&nc(t.dependencies)?(typeof _=="function"&&(ff(a,i,_,u),ie=a.memoizedState),(de=Yr||T0(a,i,de,u,ne,ie,V)||t!==null&&t.dependencies!==null&&nc(t.dependencies))?(te||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(u,ie,V),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(u,ie,V)),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=ie),b.props=u,b.state=ie,b.context=V,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,kc(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=zs(a,t.child,null,g),a.child=zs(a,null,i,g)):wn(t,a,i,g),a.memoizedState=b.state,t=a.child):t=Cr(t,a,g),t}function F0(t,a,i,u){return Rs(),a.flags|=256,wn(t,a,i,u),a.child}var xf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yf(t){return{baseLanes:t,cachePool:_g()}}function bf(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=ra),t}function q0(t,a,i){var u=a.pendingProps,g=!1,b=(a.flags&128)!==0,S;if((S=b)||(S=t!==null&&t.memoizedState===null?!1:(en.current&2)!==0),S&&(g=!0,a.flags&=-129),S=(a.flags&32)!==0,a.flags&=-33,t===null){if(nt){if(g?Zr(a):Jr(),(t=zt)?(t=Zx(t,ja),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Vr!==null?{id:ar,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},i=Sg(t),i.return=a,a.child=i,vn=a,zt=null)):t=null,t===null)throw Wr(a);return tm(t)?a.lanes=32:a.lanes=536870912,null}var _=u.children;return u=u.fallback,g?(Jr(),g=a.mode,_=wc({mode:"hidden",children:_},g),u=As(u,g,i,null),_.return=a,u.return=a,_.sibling=u,a.child=_,u=a.child,u.memoizedState=yf(i),u.childLanes=bf(t,S,i),a.memoizedState=xf,Ti(null,u)):(Zr(a),vf(a,_))}var V=t.memoizedState;if(V!==null&&(_=V.dehydrated,_!==null)){if(b)a.flags&256?(Zr(a),a.flags&=-257,a=kf(t,a,i)):a.memoizedState!==null?(Jr(),a.child=t.child,a.flags|=128,a=null):(Jr(),_=u.fallback,g=a.mode,u=wc({mode:"visible",children:u.children},g),_=As(_,g,i,null),_.flags|=2,u.return=a,_.return=a,u.sibling=_,a.child=u,zs(a,t.child,null,i),u=a.child,u.memoizedState=yf(i),u.childLanes=bf(t,S,i),a.memoizedState=xf,a=Ti(null,u));else if(Zr(a),tm(_)){if(S=_.nextSibling&&_.nextSibling.dataset,S)var te=S.dgst;S=te,u=Error(s(419)),u.stack="",u.digest=S,pi({value:u,source:null,stack:null}),a=kf(t,a,i)}else if(rn||pl(t,a,i,!1),S=(i&t.childLanes)!==0,rn||S){if(S=Tt,S!==null&&(u=Yt(S,i),u!==0&&u!==V.retryLane))throw V.retryLane=u,Es(t,u),Gn(S,t,u),pf;em(_)||Rc(),a=kf(t,a,i)}else em(_)?(a.flags|=192,a.child=t.child,a=null):(t=V.treeContext,zt=Ca(_.nextSibling),vn=a,nt=!0,Gr=null,ja=!1,t!==null&&Cg(a,t),a=vf(a,u.children),a.flags|=4096);return a}return g?(Jr(),_=u.fallback,g=a.mode,V=t.child,te=V.sibling,u=vr(V,{mode:"hidden",children:u.children}),u.subtreeFlags=V.subtreeFlags&65011712,te!==null?_=vr(te,_):(_=As(_,g,i,null),_.flags|=2),_.return=a,u.return=a,u.sibling=_,a.child=u,Ti(null,u),u=a.child,_=t.child.memoizedState,_===null?_=yf(i):(g=_.cachePool,g!==null?(V=nn._currentValue,g=g.parent!==V?{parent:V,pool:V}:g):g=_g(),_={baseLanes:_.baseLanes|i,cachePool:g}),u.memoizedState=_,u.childLanes=bf(t,S,i),a.memoizedState=xf,Ti(t.child,u)):(Zr(a),i=t.child,t=i.sibling,i=vr(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 vf(t,a){return a=wc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function wc(t,a){return t=ea(22,t,null,a),t.lanes=0,t}function kf(t,a,i){return zs(a,t.child,null,i),t=vf(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function V0(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),Od(t.return,a,i)}function wf(t,a,i,u,g,b){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:g,treeForkCount:b}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=u,S.tail=i,S.tailMode=g,S.treeForkCount=b)}function G0(t,a,i){var u=a.pendingProps,g=u.revealOrder,b=u.tail;u=u.children;var S=en.current,_=(S&2)!==0;if(_?(S=S&1|2,a.flags|=128):S&=1,N(en,S),wn(t,a,u,i),u=nt?hi:0,!_&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&V0(t,i,a);else if(t.tag===19)V0(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(g){case"forwards":for(i=a.child,g=null;i!==null;)t=i.alternate,t!==null&&uc(t)===null&&(g=i),i=i.sibling;i=g,i===null?(g=a.child,a.child=null):(g=i.sibling,i.sibling=null),wf(a,!1,g,i,b,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,g=a.child,a.child=null;g!==null;){if(t=g.alternate,t!==null&&uc(t)===null){a.child=g;break}t=g.sibling,g.sibling=i,i=g,g=t}wf(a,!0,i,null,b,u);break;case"together":wf(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function Cr(t,a,i){if(t!==null&&(a.dependencies=t.dependencies),ns|=a.lanes,(i&a.childLanes)===0)if(t!==null){if(pl(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=vr(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=vr(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function Sf(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&nc(t)))}function lS(t,a,i){switch(a.tag){case 3:Ce(a,a.stateNode.containerInfo),Kr(a,nn,t.memoizedState.cache),Rs();break;case 27:case 5:he(a);break;case 4:Ce(a,a.stateNode.containerInfo);break;case 10:Kr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Wd(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Zr(a),a.flags|=128,null):(i&a.child.childLanes)!==0?q0(t,a,i):(Zr(a),t=Cr(t,a,i),t!==null?t.sibling:null);Zr(a);break;case 19:var g=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(pl(t,a,i,!1),u=(i&a.childLanes)!==0),g){if(u)return G0(t,a,i);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),N(en,en.current),u)break;return null;case 22:return a.lanes=0,U0(t,a,i,a.pendingProps);case 24:Kr(a,nn,t.memoizedState.cache)}return Cr(t,a,i)}function W0(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)rn=!0;else{if(!Sf(t,i)&&(a.flags&128)===0)return rn=!1,lS(t,a,i);rn=(t.flags&131072)!==0}else rn=!1,nt&&(a.flags&1048576)!==0&&Ng(a,hi,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Os(a.elementType),a.type=t,typeof t=="function")Td(t)?(u=$s(t,u),a.tag=1,a=P0(null,a,t,u,i)):(a.tag=0,a=gf(null,a,t,u,i));else{if(t!=null){var g=t.$$typeof;if(g===H){a.tag=11,a=O0(null,a,t,u,i);break e}else if(g===z){a.tag=14,a=D0(null,a,t,u,i);break e}}throw a=ee(t)||t,Error(s(306,a,""))}}return a;case 0:return gf(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,g=$s(u,a.pendingProps),P0(t,a,u,g,i);case 3:e:{if(Ce(a,a.stateNode.containerInfo),t===null)throw Error(s(387));u=a.pendingProps;var b=a.memoizedState;g=b.element,Pd(t,a),wi(a,u,null,i);var S=a.memoizedState;if(u=S.cache,Kr(a,nn,u),u!==b.cache&&Dd(a,[nn],i,!0),ki(),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=F0(t,a,u,i);break e}else if(u!==g){g=ka(Error(s(424)),a),pi(g),a=F0(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=Ca(t.firstChild),vn=a,nt=!0,Gr=null,ja=!0,i=Ug(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Rs(),u===g){a=Cr(t,a,i);break e}wn(t,a,u,i)}a=a.child}return a;case 26:return kc(t,a),t===null?(i=ry(a.type,null,a.pendingProps,null))?a.memoizedState=i:nt||(i=a.type,t=a.pendingProps,u=Uc(oe.current).createElement(i),u[Qt]=a,u[hn]=t,Sn(u,i,t),Lt(u),a.stateNode=u):a.memoizedState=ry(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return he(a),t===null&&nt&&(u=a.stateNode=ty(a.type,a.pendingProps,oe.current),vn=a,ja=!0,g=zt,is(a.type)?(nm=g,zt=Ca(u.firstChild)):zt=g),wn(t,a,a.pendingProps.children,i),kc(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&nt&&((g=u=zt)&&(u=DS(u,a.type,a.pendingProps,ja),u!==null?(a.stateNode=u,vn=a,zt=Ca(u.firstChild),ja=!1,g=!0):g=!1),g||Wr(a)),he(a),g=a.type,b=a.pendingProps,S=t!==null?t.memoizedProps:null,u=b.children,Xf(g,b)?u=null:S!==null&&Xf(g,S)&&(a.flags|=32),a.memoizedState!==null&&(g=Yd(t,a,Xw,null,null,i),Pi._currentValue=g),kc(t,a),wn(t,a,u,i),a.child;case 6:return t===null&&nt&&((t=i=zt)&&(i=zS(i,a.pendingProps,ja),i!==null?(a.stateNode=i,vn=a,zt=null,t=!0):t=!1),t||Wr(a)),null;case 13:return q0(t,a,i);case 4:return Ce(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=zs(a,null,u,i):wn(t,a,u,i),a.child;case 11:return O0(t,a,a.type,a.pendingProps,i);case 7:return wn(t,a,a.pendingProps,i),a.child;case 8:return wn(t,a,a.pendingProps.children,i),a.child;case 12:return wn(t,a,a.pendingProps.children,i),a.child;case 10:return u=a.pendingProps,Kr(a,a.type,u.value),wn(t,a,u.children,i),a.child;case 9:return g=a.type._context,u=a.pendingProps.children,Is(a),g=kn(g),u=u(g),a.flags|=1,wn(t,a,u,i),a.child;case 14:return D0(t,a,a.type,a.pendingProps,i);case 15:return z0(t,a,a.type,a.pendingProps,i);case 19:return G0(t,a,i);case 31:return sS(t,a,i);case 22:return U0(t,a,i,a.pendingProps);case 24:return Is(a),u=kn(nn),t===null?(g=$d(),g===null&&(g=Tt,b=zd(),g.pooledCache=b,b.refCount++,b!==null&&(g.pooledCacheLanes|=i),g=b),a.memoizedState={parent:u,cache:g},Hd(a),Kr(a,nn,g)):((t.lanes&i)!==0&&(Pd(t,a),wi(a,null,null,i),ki()),g=t.memoizedState,b=a.memoizedState,g.parent!==u?(g={parent:u,cache:u},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),Kr(a,nn,u)):(u=b.cache,Kr(a,nn,u),u!==g.cache&&Dd(a,[nn],i,!0))),wn(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Tr(t){t.flags|=4}function jf(t,a,i,u,g){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(g&335544128)===g)if(t.stateNode.complete)t.flags|=8192;else if(vx())t.flags|=8192;else throw Ds=lc,Bd}else t.flags&=-16777217}function K0(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!cy(a))if(vx())t.flags|=8192;else throw Ds=lc,Bd}function Sc(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?be():536870912,t.lanes|=a,Tl|=a)}function Mi(t,a){if(!nt)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 g=t.child;g!==null;)i|=g.lanes|g.childLanes,u|=g.subtreeFlags&65011712,u|=g.flags&65011712,g.return=t,g=g.sibling;else for(g=t.child;g!==null;)i|=g.lanes|g.childLanes,u|=g.subtreeFlags,u|=g.flags,g.return=t,g=g.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function iS(t,a,i){var u=a.pendingProps;switch(Rd(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),Sr(nn),re(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(hl(a)?Tr(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Id())),Ut(a),null;case 26:var g=a.type,b=a.memoizedState;return t===null?(Tr(a),b!==null?(Ut(a),K0(a,b)):(Ut(a),jf(a,g,null,u,i))):b?b!==t.memoizedState?(Tr(a),Ut(a),K0(a,b)):(Ut(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&Tr(a),Ut(a),jf(a,g,t,u,i)),null;case 27:if(xe(a),i=oe.current,g=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&Tr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Ut(a),null}t=Y.current,hl(a)?Tg(a):(t=ty(g,u,i),a.stateNode=t,Tr(a))}return Ut(a),null;case 5:if(xe(a),g=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&Tr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Ut(a),null}if(b=Y.current,hl(a))Tg(a);else{var S=Uc(oe.current);switch(b){case 1:b=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:b=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":b=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":b=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);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(g,{is:u.is}):S.createElement(g)}}b[Qt]=a,b[hn]=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(Sn(b,g,u),g){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Tr(a)}}return Ut(a),jf(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&Tr(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(s(166));if(t=oe.current,hl(a)){if(t=a.stateNode,i=a.memoizedProps,u=null,g=vn,g!==null)switch(g.tag){case 27:case 5:u=g.memoizedProps}t[Qt]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||qx(t.nodeValue,i)),t||Wr(a,!0)}else t=Uc(t).createTextNode(u),t[Qt]=a,a.stateNode=t}return Ut(a),null;case 31:if(i=a.memoizedState,t===null||t.memoizedState!==null){if(u=hl(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[Qt]=a}else Rs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),t=!1}else i=Id(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return a.flags&256?(na(a),a):(na(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(g=hl(a),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(s(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(s(317));g[Qt]=a}else Rs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),g=!1}else g=Id(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(na(a),a):(na(a),null)}return na(a),(a.flags&128)!==0?(a.lanes=i,a):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=a.child,g=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(g=u.alternate.memoizedState.cachePool.pool),b=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),b!==g&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),Sc(a,a.updateQueue),Ut(a),null);case 4:return re(),t===null&&Gf(a.stateNode.containerInfo),Ut(a),null;case 10:return Sr(a.type),Ut(a),null;case 19:if($(en),u=a.memoizedState,u===null)return Ut(a),null;if(g=(a.flags&128)!==0,b=u.rendering,b===null)if(g)Mi(u,!1);else{if(Zt!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(b=uc(t),b!==null){for(a.flags|=128,Mi(u,!1),t=b.updateQueue,a.updateQueue=t,Sc(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)wg(i,t),i=i.sibling;return N(en,en.current&1|2),nt&&kr(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&ut()>Mc&&(a.flags|=128,g=!0,Mi(u,!1),a.lanes=4194304)}else{if(!g)if(t=uc(b),t!==null){if(a.flags|=128,g=!0,t=t.updateQueue,a.updateQueue=t,Sc(a,t),Mi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!b.alternate&&!nt)return Ut(a),null}else 2*ut()-u.renderingStartTime>Mc&&i!==536870912&&(a.flags|=128,g=!0,Mi(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=ut(),t.sibling=null,i=en.current,N(en,g?i&1|2:i&1),nt&&kr(a,u.treeForkCount),t):(Ut(a),null);case 22:case 23:return na(a),Gd(),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&&Sc(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&&$(Ls),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),Sr(nn),Ut(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function oS(t,a){switch(Rd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return Sr(nn),re(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return xe(a),null;case 31:if(a.memoizedState!==null){if(na(a),a.alternate===null)throw Error(s(340));Rs()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(na(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(s(340));Rs()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return $(en),null;case 4:return re(),null;case 10:return Sr(a.type),null;case 22:case 23:return na(a),Gd(),t!==null&&$(Ls),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return Sr(nn),null;case 25:return null;default:return null}}function Y0(t,a){switch(Rd(a),a.tag){case 3:Sr(nn),re();break;case 26:case 27:case 5:xe(a);break;case 4:re();break;case 31:a.memoizedState!==null&&na(a);break;case 13:na(a);break;case 19:$(en);break;case 10:Sr(a.type);break;case 22:case 23:na(a),Gd(),t!==null&&$(Ls);break;case 24:Sr(nn)}}function Ei(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var g=u.next;i=g;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!==g)}}catch(_){yt(a,a.return,_)}}function es(t,a,i){try{var u=a.updateQueue,g=u!==null?u.lastEffect:null;if(g!==null){var b=g.next;u=b;do{if((u.tag&t)===t){var S=u.inst,_=S.destroy;if(_!==void 0){S.destroy=void 0,g=a;var V=i,te=_;try{te()}catch(de){yt(g,V,de)}}}u=u.next}while(u!==b)}}catch(de){yt(a,a.return,de)}}function Q0(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{Bg(a,i)}catch(u){yt(t,t.return,u)}}}function X0(t,a,i){i.props=$s(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){yt(t,a,u)}}function Ai(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(g){yt(t,a,g)}}function sr(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(g){yt(t,a,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(g){yt(t,a,g)}else i.current=null}function Z0(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(g){yt(t,t.return,g)}}function Nf(t,a,i){try{var u=t.stateNode;AS(u,t.type,i,a),u[hn]=a}catch(g){yt(t,t.return,g)}}function J0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&is(t.type)||t.tag===4}function Cf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||J0(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&&is(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 Tf(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=$a));else if(u!==4&&(u===27&&is(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(Tf(t,a,i),t=t.sibling;t!==null;)Tf(t,a,i),t=t.sibling}function jc(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&&is(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(jc(t,a,i),t=t.sibling;t!==null;)jc(t,a,i),t=t.sibling}function ex(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);Sn(a,u,i),a[Qt]=t,a[hn]=i}catch(b){yt(t,t.return,b)}}var Mr=!1,sn=!1,Mf=!1,tx=typeof WeakSet=="function"?WeakSet:Set,pn=null;function cS(t,a){if(t=t.containerInfo,Yf=Vc,t=mg(t),vd(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 g=u.anchorOffset,b=u.focusNode;u=u.focusOffset;try{i.nodeType,b.nodeType}catch{i=null;break e}var S=0,_=-1,V=-1,te=0,de=0,me=t,ne=null;t:for(;;){for(var ie;me!==i||g!==0&&me.nodeType!==3||(_=S+g),me!==b||u!==0&&me.nodeType!==3||(V=S+u),me.nodeType===3&&(S+=me.nodeValue.length),(ie=me.firstChild)!==null;)ne=me,me=ie;for(;;){if(me===t)break t;if(ne===i&&++te===g&&(_=S),ne===b&&++de===u&&(V=S),(ie=me.nextSibling)!==null)break;me=ne,ne=me.parentNode}me=ie}i=_===-1||V===-1?null:{start:_,end:V}}else i=null}i=i||{start:0,end:0}}else i=null;for(Qf={focusedElem:t,selectionRange:i},Vc=!1,pn=a;pn!==null;)if(a=pn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,pn=t;else for(;pn!==null;){switch(a=pn,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++)g=t[i],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&b!==null){t=void 0,i=a,g=b.memoizedProps,b=b.memoizedState,u=i.stateNode;try{var je=$s(i.type,g);t=u.getSnapshotBeforeUpdate(je,b),u.__reactInternalSnapshotBeforeUpdate=t}catch(Oe){yt(i,i.return,Oe)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,i=t.nodeType,i===9)Jf(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Jf(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,pn=t;break}pn=a.return}}function nx(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:Ar(t,i),u&4&&Ei(5,i);break;case 1:if(Ar(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(S){yt(i,i.return,S)}else{var g=$s(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(g,a,t.__reactInternalSnapshotBeforeUpdate)}catch(S){yt(i,i.return,S)}}u&64&&Q0(i),u&512&&Ai(i,i.return);break;case 3:if(Ar(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{Bg(t,a)}catch(S){yt(i,i.return,S)}}break;case 27:a===null&&u&4&&ex(i);case 26:case 5:Ar(t,i),a===null&&u&4&&Z0(i),u&512&&Ai(i,i.return);break;case 12:Ar(t,i);break;case 31:Ar(t,i),u&4&&sx(t,i);break;case 13:Ar(t,i),u&4&&lx(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=yS.bind(null,i),US(t,i))));break;case 22:if(u=i.memoizedState!==null||Mr,!u){a=a!==null&&a.memoizedState!==null||sn,g=Mr;var b=sn;Mr=u,(sn=a)&&!b?Rr(t,i,(i.subtreeFlags&8772)!==0):Ar(t,i),Mr=g,sn=b}break;case 30:break;default:Ar(t,i)}}function ax(t){var a=t.alternate;a!==null&&(t.alternate=null,ax(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&yr(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 qt=null,Pn=!1;function Er(t,a,i){for(i=i.child;i!==null;)rx(t,a,i),i=i.sibling}function rx(t,a,i){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(Pt,i)}catch{}switch(i.tag){case 26:sn||sr(i,a),Er(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:sn||sr(i,a);var u=qt,g=Pn;is(i.type)&&(qt=i.stateNode,Pn=!1),Er(t,a,i),$i(i.stateNode),qt=u,Pn=g;break;case 5:sn||sr(i,a);case 6:if(u=qt,g=Pn,qt=null,Er(t,a,i),qt=u,Pn=g,qt!==null)if(Pn)try{(qt.nodeType===9?qt.body:qt.nodeName==="HTML"?qt.ownerDocument.body:qt).removeChild(i.stateNode)}catch(b){yt(i,a,b)}else try{qt.removeChild(i.stateNode)}catch(b){yt(i,a,b)}break;case 18:qt!==null&&(Pn?(t=qt,Qx(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),Ol(t)):Qx(qt,i.stateNode));break;case 4:u=qt,g=Pn,qt=i.stateNode.containerInfo,Pn=!0,Er(t,a,i),qt=u,Pn=g;break;case 0:case 11:case 14:case 15:es(2,i,a),sn||es(4,i,a),Er(t,a,i);break;case 1:sn||(sr(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&X0(i,a,u)),Er(t,a,i);break;case 21:Er(t,a,i);break;case 22:sn=(u=sn)||i.memoizedState!==null,Er(t,a,i),sn=u;break;default:Er(t,a,i)}}function sx(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ol(t)}catch(i){yt(a,a.return,i)}}}function lx(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ol(t)}catch(i){yt(a,a.return,i)}}function uS(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new tx),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new tx),a;default:throw Error(s(435,t.tag))}}function Nc(t,a){var i=uS(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var g=bS.bind(null,t,u);u.then(g,g)}})}function Fn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var g=i[u],b=t,S=a,_=S;e:for(;_!==null;){switch(_.tag){case 27:if(is(_.type)){qt=_.stateNode,Pn=!1;break e}break;case 5:qt=_.stateNode,Pn=!1;break e;case 3:case 4:qt=_.stateNode.containerInfo,Pn=!0;break e}_=_.return}if(qt===null)throw Error(s(160));rx(b,S,g),qt=null,Pn=!1,b=g.alternate,b!==null&&(b.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)ix(a,t),a=a.sibling}var Ha=null;function ix(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Fn(a,t),qn(t),u&4&&(es(3,t,t.return),Ei(3,t),es(5,t,t.return));break;case 1:Fn(a,t),qn(t),u&512&&(sn||i===null||sr(i,i.return)),u&64&&Mr&&(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 g=Ha;if(Fn(a,t),qn(t),u&512&&(sn||i===null||sr(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,g=g.ownerDocument||g;t:switch(u){case"title":b=g.getElementsByTagName("title")[0],(!b||b[xr]||b[Qt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=g.createElement(u),g.head.insertBefore(b,g.querySelector("head > title"))),Sn(b,u,i),b[Qt]=t,Lt(b),u=b;break e;case"link":var S=iy("link","href",g).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=g.createElement(u),Sn(b,u,i),g.head.appendChild(b);break;case"meta":if(S=iy("meta","content",g).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=g.createElement(u),Sn(b,u,i),g.head.appendChild(b);break;default:throw Error(s(468,u))}b[Qt]=t,Lt(b),u=b}t.stateNode=u}else oy(g,t.type,t.stateNode);else t.stateNode=ly(g,u,t.memoizedProps);else b!==u?(b===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):b.count--,u===null?oy(g,t.type,t.stateNode):ly(g,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Nf(t,t.memoizedProps,i.memoizedProps)}break;case 27:Fn(a,t),qn(t),u&512&&(sn||i===null||sr(i,i.return)),i!==null&&u&4&&Nf(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Fn(a,t),qn(t),u&512&&(sn||i===null||sr(i,i.return)),t.flags&32){g=t.stateNode;try{se(g,"")}catch(je){yt(t,t.return,je)}}u&4&&t.stateNode!=null&&(g=t.memoizedProps,Nf(t,g,i!==null?i.memoizedProps:g)),u&1024&&(Mf=!0);break;case 6:if(Fn(a,t),qn(t),u&4){if(t.stateNode===null)throw Error(s(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(je){yt(t,t.return,je)}}break;case 3:if(Hc=null,g=Ha,Ha=$c(a.containerInfo),Fn(a,t),Ha=g,qn(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Ol(a.containerInfo)}catch(je){yt(t,t.return,je)}Mf&&(Mf=!1,ox(t));break;case 4:u=Ha,Ha=$c(t.stateNode.containerInfo),Fn(a,t),qn(t),Ha=u;break;case 12:Fn(a,t),qn(t);break;case 31:Fn(a,t),qn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Nc(t,u)));break;case 13:Fn(a,t),qn(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Tc=ut()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Nc(t,u)));break;case 22:g=t.memoizedState!==null;var V=i!==null&&i.memoizedState!==null,te=Mr,de=sn;if(Mr=te||g,sn=de||V,Fn(a,t),sn=de,Mr=te,qn(t),u&8192)e:for(a=t.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(i===null||V||Mr||sn||Bs(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){V=i=a;try{if(b=V.stateNode,g)S=b.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{_=V.stateNode;var me=V.memoizedProps.style,ne=me!=null&&me.hasOwnProperty("display")?me.display:null;_.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(je){yt(V,V.return,je)}}}else if(a.tag===6){if(i===null){V=a;try{V.stateNode.nodeValue=g?"":V.memoizedProps}catch(je){yt(V,V.return,je)}}}else if(a.tag===18){if(i===null){V=a;try{var ie=V.stateNode;g?Xx(ie,!0):Xx(V.stateNode,!1)}catch(je){yt(V,V.return,je)}}}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,Nc(t,i))));break;case 19:Fn(a,t),qn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Nc(t,u)));break;case 30:break;case 21:break;default:Fn(a,t),qn(t)}}function qn(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(J0(u)){i=u;break}u=u.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var g=i.stateNode,b=Cf(t);jc(t,b,g);break;case 5:var S=i.stateNode;i.flags&32&&(se(S,""),i.flags&=-33);var _=Cf(t);jc(t,_,S);break;case 3:case 4:var V=i.stateNode.containerInfo,te=Cf(t);Tf(t,te,V);break;default:throw Error(s(161))}}catch(de){yt(t,t.return,de)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function ox(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;ox(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Ar(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)nx(t,a.alternate,a),a=a.sibling}function Bs(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:es(4,a,a.return),Bs(a);break;case 1:sr(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&X0(a,a.return,i),Bs(a);break;case 27:$i(a.stateNode);case 26:case 5:sr(a,a.return),Bs(a);break;case 22:a.memoizedState===null&&Bs(a);break;case 30:Bs(a);break;default:Bs(a)}t=t.sibling}}function Rr(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,g=t,b=a,S=b.flags;switch(b.tag){case 0:case 11:case 15:Rr(g,b,i),Ei(4,b);break;case 1:if(Rr(g,b,i),u=b,g=u.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(te){yt(u,u.return,te)}if(u=b,g=u.updateQueue,g!==null){var _=u.stateNode;try{var V=g.shared.hiddenCallbacks;if(V!==null)for(g.shared.hiddenCallbacks=null,g=0;g<V.length;g++)$g(V[g],_)}catch(te){yt(u,u.return,te)}}i&&S&64&&Q0(b),Ai(b,b.return);break;case 27:ex(b);case 26:case 5:Rr(g,b,i),i&&u===null&&S&4&&Z0(b),Ai(b,b.return);break;case 12:Rr(g,b,i);break;case 31:Rr(g,b,i),i&&S&4&&sx(g,b);break;case 13:Rr(g,b,i),i&&S&4&&lx(g,b);break;case 22:b.memoizedState===null&&Rr(g,b,i),Ai(b,b.return);break;case 30:break;default:Rr(g,b,i)}a=a.sibling}}function Ef(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&&gi(i))}function Af(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&gi(t))}function Pa(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)cx(t,a,i,u),a=a.sibling}function cx(t,a,i,u){var g=a.flags;switch(a.tag){case 0:case 11:case 15:Pa(t,a,i,u),g&2048&&Ei(9,a);break;case 1:Pa(t,a,i,u);break;case 3:Pa(t,a,i,u),g&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&gi(t)));break;case 12:if(g&2048){Pa(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(V){yt(a,a.return,V)}}else Pa(t,a,i,u);break;case 31:Pa(t,a,i,u);break;case 13:Pa(t,a,i,u);break;case 23:break;case 22:b=a.stateNode,S=a.alternate,a.memoizedState!==null?b._visibility&2?Pa(t,a,i,u):Ri(t,a):b._visibility&2?Pa(t,a,i,u):(b._visibility|=2,jl(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),g&2048&&Ef(S,a);break;case 24:Pa(t,a,i,u),g&2048&&Af(a.alternate,a);break;default:Pa(t,a,i,u)}}function jl(t,a,i,u,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=t,S=a,_=i,V=u,te=S.flags;switch(S.tag){case 0:case 11:case 15:jl(b,S,_,V,g),Ei(8,S);break;case 23:break;case 22:var de=S.stateNode;S.memoizedState!==null?de._visibility&2?jl(b,S,_,V,g):Ri(b,S):(de._visibility|=2,jl(b,S,_,V,g)),g&&te&2048&&Ef(S.alternate,S);break;case 24:jl(b,S,_,V,g),g&&te&2048&&Af(S.alternate,S);break;default:jl(b,S,_,V,g)}a=a.sibling}}function Ri(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,g=u.flags;switch(u.tag){case 22:Ri(i,u),g&2048&&Ef(u.alternate,u);break;case 24:Ri(i,u),g&2048&&Af(u.alternate,u);break;default:Ri(i,u)}a=a.sibling}}var _i=8192;function Nl(t,a,i){if(t.subtreeFlags&_i)for(t=t.child;t!==null;)ux(t,a,i),t=t.sibling}function ux(t,a,i){switch(t.tag){case 26:Nl(t,a,i),t.flags&_i&&t.memoizedState!==null&&QS(i,Ha,t.memoizedState,t.memoizedProps);break;case 5:Nl(t,a,i);break;case 3:case 4:var u=Ha;Ha=$c(t.stateNode.containerInfo),Nl(t,a,i),Ha=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=_i,_i=16777216,Nl(t,a,i),_i=u):Nl(t,a,i));break;default:Nl(t,a,i)}}function dx(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 Ii(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];pn=u,mx(u,t)}dx(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)fx(t),t=t.sibling}function fx(t){switch(t.tag){case 0:case 11:case 15:Ii(t),t.flags&2048&&es(9,t,t.return);break;case 3:Ii(t);break;case 12:Ii(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Cc(t)):Ii(t);break;default:Ii(t)}}function Cc(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];pn=u,mx(u,t)}dx(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:es(8,a,a.return),Cc(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,Cc(a));break;default:Cc(a)}t=t.sibling}}function mx(t,a){for(;pn!==null;){var i=pn;switch(i.tag){case 0:case 11:case 15:es(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:gi(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,pn=u;else e:for(i=t;pn!==null;){u=pn;var g=u.sibling,b=u.return;if(ax(u),u===i){pn=null;break e}if(g!==null){g.return=b,pn=g;break e}pn=b}}}var dS={getCacheForType:function(t){var a=kn(nn),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return kn(nn).controller.signal}},fS=typeof WeakMap=="function"?WeakMap:Map,dt=0,Tt=null,Qe=null,et=0,xt=0,aa=null,ts=!1,Cl=!1,Rf=!1,_r=0,Zt=0,ns=0,Hs=0,_f=0,ra=0,Tl=0,Li=null,Vn=null,If=!1,Tc=0,hx=0,Mc=1/0,Ec=null,as=null,cn=0,rs=null,Ml=null,Ir=0,Lf=0,Of=null,px=null,Oi=0,Df=null;function sa(){return(dt&2)!==0&&et!==0?et&-et:U.T!==null?Pf():nl()}function gx(){if(ra===0)if((et&536870912)===0||nt){var t=Rt;Rt<<=1,(Rt&3932160)===0&&(Rt=262144),ra=t}else ra=536870912;return t=ta.current,t!==null&&(t.flags|=32),ra}function Gn(t,a,i){(t===Tt&&(xt===2||xt===9)||t.cancelPendingCommit!==null)&&(El(t,0),ss(t,et,ra,!1)),Ye(t,i),((dt&2)===0||t!==Tt)&&(t===Tt&&((dt&2)===0&&(Hs|=i),Zt===4&&ss(t,et,ra,!1)),lr(t))}function xx(t,a,i){if((dt&6)!==0)throw Error(s(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||yn(t,a),g=u?pS(t,a):Uf(t,a,!0),b=u;do{if(g===0){Cl&&!u&&ss(t,a,0,!1);break}else{if(i=t.current.alternate,b&&!mS(i)){g=Uf(t,a,!1),b=!1;continue}if(g===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;g=Li;var V=_.current.memoizedState.isDehydrated;if(V&&(El(_,S).flags|=256),S=Uf(_,S,!1),S!==2){if(Rf&&!V){_.errorRecoveryDisabledLanes|=b,Hs|=b,g=4;break e}b=Vn,Vn=g,b!==null&&(Vn===null?Vn=b:Vn.push.apply(Vn,b))}g=S}if(b=!1,g!==2)continue}}if(g===1){El(t,0),ss(t,a,0,!0);break}e:{switch(u=t,b=g,b){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:ss(u,a,ra,!ts);break e;case 2:Vn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(g=Tc+300-ut(),10<g)){if(ss(u,a,ra,!ts),Bn(u,0,!0)!==0)break e;Ir=a,u.timeoutHandle=Kx(yx.bind(null,u,i,Vn,Ec,If,a,ra,Hs,Tl,ts,b,"Throttled",-0,0),g);break e}yx(u,i,Vn,Ec,If,a,ra,Hs,Tl,ts,b,null,-0,0)}}break}while(!0);lr(t)}function yx(t,a,i,u,g,b,S,_,V,te,de,me,ne,ie){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:$a},ux(a,b,me);var je=(b&62914560)===b?Tc-ut():(b&4194048)===b?hx-ut():0;if(je=XS(me,je),je!==null){Ir=b,t.cancelPendingCommit=je(Cx.bind(null,t,a,b,i,u,g,S,_,V,de,me,null,ne,ie)),ss(t,b,S,!te);return}}Cx(t,a,b,i,u,g,S,_,V)}function mS(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 g=i[u],b=g.getSnapshot;g=g.value;try{if(!Jn(b(),g))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 ss(t,a,i,u){a&=~_f,a&=~Hs,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var g=a;0<g;){var b=31-He(g),S=1<<b;u[b]=-1,g&=~S}i!==0&&gt(t,i,a)}function Ac(){return(dt&6)===0?(Di(0),!1):!0}function zf(){if(Qe!==null){if(xt===0)var t=Qe.return;else t=Qe,wr=_s=null,Zd(t),bl=null,yi=0,t=Qe;for(;t!==null;)Y0(t.alternate,t),t=t.return;Qe=null}}function El(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,IS(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),Ir=0,zf(),Tt=t,Qe=i=vr(t.current,null),et=a,xt=0,aa=null,ts=!1,Cl=yn(t,a),Rf=!1,Tl=ra=_f=Hs=ns=Zt=0,Vn=Li=null,If=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var g=31-He(u),b=1<<g;a|=t[g],u&=~b}return _r=a,Xo(),i}function bx(t,a){Ve=null,U.H=Ci,a===yl||a===sc?(a=Og(),xt=3):a===Bd?(a=Og(),xt=4):xt=a===pf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,aa=a,Qe===null&&(Zt=1,bc(t,ka(a,t.current)))}function vx(){var t=ta.current;return t===null?!0:(et&4194048)===et?Na===null:(et&62914560)===et||(et&536870912)!==0?t===Na:!1}function kx(){var t=U.H;return U.H=Ci,t===null?Ci:t}function wx(){var t=U.A;return U.A=dS,t}function Rc(){Zt=4,ts||(et&4194048)!==et&&ta.current!==null||(Cl=!0),(ns&134217727)===0&&(Hs&134217727)===0||Tt===null||ss(Tt,et,ra,!1)}function Uf(t,a,i){var u=dt;dt|=2;var g=kx(),b=wx();(Tt!==t||et!==a)&&(Ec=null,El(t,a)),a=!1;var S=Zt;e:do try{if(xt!==0&&Qe!==null){var _=Qe,V=aa;switch(xt){case 8:zf(),S=6;break e;case 3:case 2:case 9:case 6:ta.current===null&&(a=!0);var te=xt;if(xt=0,aa=null,Al(t,_,V,te),i&&Cl){S=0;break e}break;default:te=xt,xt=0,aa=null,Al(t,_,V,te)}}hS(),S=Zt;break}catch(de){bx(t,de)}while(!0);return a&&t.shellSuspendCounter++,wr=_s=null,dt=u,U.H=g,U.A=b,Qe===null&&(Tt=null,et=0,Xo()),S}function hS(){for(;Qe!==null;)Sx(Qe)}function pS(t,a){var i=dt;dt|=2;var u=kx(),g=wx();Tt!==t||et!==a?(Ec=null,Mc=ut()+500,El(t,a)):Cl=yn(t,a);e:do try{if(xt!==0&&Qe!==null){a=Qe;var b=aa;t:switch(xt){case 1:xt=0,aa=null,Al(t,a,b,1);break;case 2:case 9:if(Ig(b)){xt=0,aa=null,jx(a);break}a=function(){xt!==2&&xt!==9||Tt!==t||(xt=7),lr(t)},b.then(a,a);break e;case 3:xt=7;break e;case 4:xt=5;break e;case 7:Ig(b)?(xt=0,aa=null,jx(a)):(xt=0,aa=null,Al(t,a,b,7));break;case 5:var S=null;switch(Qe.tag){case 26:S=Qe.memoizedState;case 5:case 27:var _=Qe;if(S?cy(S):_.stateNode.complete){xt=0,aa=null;var V=_.sibling;if(V!==null)Qe=V;else{var te=_.return;te!==null?(Qe=te,_c(te)):Qe=null}break t}}xt=0,aa=null,Al(t,a,b,5);break;case 6:xt=0,aa=null,Al(t,a,b,6);break;case 8:zf(),Zt=6;break e;default:throw Error(s(462))}}gS();break}catch(de){bx(t,de)}while(!0);return wr=_s=null,U.H=u,U.A=g,dt=i,Qe!==null?0:(Tt=null,et=0,Xo(),Zt)}function gS(){for(;Qe!==null&&!bt();)Sx(Qe)}function Sx(t){var a=W0(t.alternate,t,_r);t.memoizedProps=t.pendingProps,a===null?_c(t):Qe=a}function jx(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=H0(i,a,a.pendingProps,a.type,void 0,et);break;case 11:a=H0(i,a,a.pendingProps,a.type.render,a.ref,et);break;case 5:Zd(a);default:Y0(i,a),a=Qe=wg(a,_r),a=W0(i,a,_r)}t.memoizedProps=t.pendingProps,a===null?_c(t):Qe=a}function Al(t,a,i,u){wr=_s=null,Zd(a),bl=null,yi=0;var g=a.return;try{if(rS(t,g,a,i,et)){Zt=1,bc(t,ka(i,t.current)),Qe=null;return}}catch(b){if(g!==null)throw Qe=g,b;Zt=1,bc(t,ka(i,t.current)),Qe=null;return}a.flags&32768?(nt||u===1?t=!0:Cl||(et&536870912)!==0?t=!1:(ts=t=!0,(u===2||u===9||u===3||u===6)&&(u=ta.current,u!==null&&u.tag===13&&(u.flags|=16384))),Nx(a,t)):_c(a)}function _c(t){var a=t;do{if((a.flags&32768)!==0){Nx(a,ts);return}t=a.return;var i=iS(a.alternate,a,_r);if(i!==null){Qe=i;return}if(a=a.sibling,a!==null){Qe=a;return}Qe=a=t}while(a!==null);Zt===0&&(Zt=5)}function Nx(t,a){do{var i=oS(t.alternate,t);if(i!==null){i.flags&=32767,Qe=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(t=t.sibling,t!==null)){Qe=t;return}Qe=t=i}while(t!==null);Zt=6,Qe=null}function Cx(t,a,i,u,g,b,S,_,V){t.cancelPendingCommit=null;do Ic();while(cn!==0);if((dt&6)!==0)throw Error(s(327));if(a!==null){if(a===t.current)throw Error(s(177));if(b=a.lanes|a.childLanes,b|=Nd,Kt(t,i,b,S,_,V),t===Tt&&(Qe=Tt=null,et=0),Ml=a,rs=t,Ir=i,Lf=b,Of=g,px=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,vS(Se,function(){return Rx(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=U.T,U.T=null,g=F.p,F.p=2,S=dt,dt|=4;try{cS(t,a,i)}finally{dt=S,F.p=g,U.T=u}}cn=1,Tx(),Mx(),Ex()}}function Tx(){if(cn===1){cn=0;var t=rs,a=Ml,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=U.T,U.T=null;var u=F.p;F.p=2;var g=dt;dt|=4;try{ix(a,t);var b=Qf,S=mg(t.containerInfo),_=b.focusedElem,V=b.selectionRange;if(S!==_&&_&&_.ownerDocument&&fg(_.ownerDocument.documentElement,_)){if(V!==null&&vd(_)){var te=V.start,de=V.end;if(de===void 0&&(de=te),"selectionStart"in _)_.selectionStart=te,_.selectionEnd=Math.min(de,_.value.length);else{var me=_.ownerDocument||document,ne=me&&me.defaultView||window;if(ne.getSelection){var ie=ne.getSelection(),je=_.textContent.length,Oe=Math.min(V.start,je),wt=V.end===void 0?Oe:Math.min(V.end,je);!ie.extend&&Oe>wt&&(S=wt,wt=Oe,Oe=S);var Q=dg(_,Oe),G=dg(_,wt);if(Q&&G&&(ie.rangeCount!==1||ie.anchorNode!==Q.node||ie.anchorOffset!==Q.offset||ie.focusNode!==G.node||ie.focusOffset!==G.offset)){var J=me.createRange();J.setStart(Q.node,Q.offset),ie.removeAllRanges(),Oe>wt?(ie.addRange(J),ie.extend(G.node,G.offset)):(J.setEnd(G.node,G.offset),ie.addRange(J))}}}}for(me=[],ie=_;ie=ie.parentNode;)ie.nodeType===1&&me.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<me.length;_++){var fe=me[_];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Vc=!!Yf,Qf=Yf=null}finally{dt=g,F.p=u,U.T=i}}t.current=a,cn=2}}function Mx(){if(cn===2){cn=0;var t=rs,a=Ml,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=U.T,U.T=null;var u=F.p;F.p=2;var g=dt;dt|=4;try{nx(t,a.alternate,a)}finally{dt=g,F.p=u,U.T=i}}cn=3}}function Ex(){if(cn===4||cn===3){cn=0,$n();var t=rs,a=Ml,i=Ir,u=px;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?cn=5:(cn=0,Ml=rs=null,Ax(t,t.pendingLanes));var g=t.pendingLanes;if(g===0&&(as=null),pa(i),a=a.stateNode,mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(Pt,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=U.T,g=F.p,F.p=2,U.T=null;try{for(var b=t.onRecoverableError,S=0;S<u.length;S++){var _=u[S];b(_.value,{componentStack:_.stack})}}finally{U.T=a,F.p=g}}(Ir&3)!==0&&Ic(),lr(t),g=t.pendingLanes,(i&261930)!==0&&(g&42)!==0?t===Df?Oi++:(Oi=0,Df=t):Oi=0,Di(0)}}function Ax(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,gi(a)))}function Ic(){return Tx(),Mx(),Ex(),Rx()}function Rx(){if(cn!==5)return!1;var t=rs,a=Lf;Lf=0;var i=pa(Ir),u=U.T,g=F.p;try{F.p=32>i?32:i,U.T=null,i=Of,Of=null;var b=rs,S=Ir;if(cn=0,Ml=rs=null,Ir=0,(dt&6)!==0)throw Error(s(331));var _=dt;if(dt|=4,fx(b.current),cx(b,b.current,S,i),dt=_,Di(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(Pt,b)}catch{}return!0}finally{F.p=g,U.T=u,Ax(t,a)}}function _x(t,a,i){a=ka(i,a),a=hf(t.stateNode,a,2),t=Xr(t,a,2),t!==null&&(Ye(t,2),lr(t))}function yt(t,a,i){if(t.tag===3)_x(t,t,i);else for(;a!==null;){if(a.tag===3){_x(a,t,i);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(as===null||!as.has(u))){t=ka(i,t),i=I0(2),u=Xr(a,i,2),u!==null&&(L0(i,u,a,t),Ye(u,2),lr(u));break}}a=a.return}}function $f(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new fS;var g=new Set;u.set(a,g)}else g=u.get(a),g===void 0&&(g=new Set,u.set(a,g));g.has(i)||(Rf=!0,g.add(i),t=xS.bind(null,t,a,i),a.then(t,t))}function xS(t,a,i){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,Tt===t&&(et&i)===i&&(Zt===4||Zt===3&&(et&62914560)===et&&300>ut()-Tc?(dt&2)===0&&El(t,0):_f|=i,Tl===et&&(Tl=0)),lr(t)}function Ix(t,a){a===0&&(a=be()),t=Es(t,a),t!==null&&(Ye(t,a),lr(t))}function yS(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),Ix(t,i)}function bS(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,g=t.memoizedState;g!==null&&(i=g.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),Ix(t,i)}function vS(t,a){return ct(t,a)}var Lc=null,Rl=null,Bf=!1,Oc=!1,Hf=!1,ls=0;function lr(t){t!==Rl&&t.next===null&&(Rl===null?Lc=Rl=t:Rl=Rl.next=t),Oc=!0,Bf||(Bf=!0,wS())}function Di(t,a){if(!Hf&&Oc){Hf=!0;do for(var i=!1,u=Lc;u!==null;){if(t!==0){var g=u.pendingLanes;if(g===0)var b=0;else{var S=u.suspendedLanes,_=u.pingedLanes;b=(1<<31-He(42|t)+1)-1,b&=g&~(S&~_),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(i=!0,zx(u,b))}else b=et,b=Bn(u,u===Tt?b:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(b&3)===0||yn(u,b)||(i=!0,zx(u,b));u=u.next}while(i);Hf=!1}}function kS(){Lx()}function Lx(){Oc=Bf=!1;var t=0;ls!==0&&_S()&&(t=ls);for(var a=ut(),i=null,u=Lc;u!==null;){var g=u.next,b=Ox(u,a);b===0?(u.next=null,i===null?Lc=g:i.next=g,g===null&&(Rl=i)):(i=u,(t!==0||(b&3)!==0)&&(Oc=!0)),u=g}cn!==0&&cn!==5||Di(t),ls!==0&&(ls=0)}function Ox(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,g=t.expirationTimes,b=t.pendingLanes&-62914561;0<b;){var S=31-He(b),_=1<<S,V=g[S];V===-1?((_&i)===0||(_&u)!==0)&&(g[S]=Ua(_,a)):V<=a&&(t.expiredLanes|=_),b&=~_}if(a=Tt,i=et,i=Bn(t,t===a?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===a&&(xt===2||xt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&At(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||yn(t,i)){if(a=i&-i,a===t.callbackPriority)return a;switch(u!==null&&At(u),pa(i)){case 2:case 8:i=ye;break;case 32:i=Se;break;case 268435456:i=Be;break;default:i=Se}return u=Dx.bind(null,t),i=ct(i,u),t.callbackPriority=a,t.callbackNode=i,a}return u!==null&&u!==null&&At(u),t.callbackPriority=2,t.callbackNode=null,2}function Dx(t,a){if(cn!==0&&cn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(Ic()&&t.callbackNode!==i)return null;var u=et;return u=Bn(t,t===Tt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(xx(t,u,a),Ox(t,ut()),t.callbackNode!=null&&t.callbackNode===i?Dx.bind(null,t):null)}function zx(t,a){if(Ic())return null;xx(t,a,!0)}function wS(){LS(function(){(dt&6)!==0?ct(ce,kS):Lx()})}function Pf(){if(ls===0){var t=gl;t===0&&(t=_n,_n<<=1,(_n&261888)===0&&(_n=256)),ls=t}return ls}function Ux(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ri(""+t)}function $x(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 SS(t,a,i,u,g){if(a==="submit"&&i&&i.stateNode===g){var b=Ux((g[hn]||null).action),S=u.submitter;S&&(a=(a=S[hn]||null)?Ux(a.formAction):S.getAttribute("formAction"),a!==null&&(b=a,S=null));var _=new Wo("action","action",null,u,g);t.push({event:_,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ls!==0){var V=S?$x(g,S):new FormData(g);of(i,{pending:!0,data:V,method:g.method,action:b},null,V)}}else typeof b=="function"&&(_.preventDefault(),V=S?$x(g,S):new FormData(g),of(i,{pending:!0,data:V,method:g.method,action:b},b,V))},currentTarget:g}]})}}for(var Ff=0;Ff<jd.length;Ff++){var qf=jd[Ff],jS=qf.toLowerCase(),NS=qf[0].toUpperCase()+qf.slice(1);Ba(jS,"on"+NS)}Ba(gg,"onAnimationEnd"),Ba(xg,"onAnimationIteration"),Ba(yg,"onAnimationStart"),Ba("dblclick","onDoubleClick"),Ba("focusin","onFocus"),Ba("focusout","onBlur"),Ba(Hw,"onTransitionRun"),Ba(Pw,"onTransitionStart"),Ba(Fw,"onTransitionCancel"),Ba(bg,"onTransitionEnd"),Tn("onMouseEnter",["mouseout","mouseover"]),Tn("onMouseLeave",["mouseout","mouseover"]),Tn("onPointerEnter",["pointerout","pointerover"]),Tn("onPointerLeave",["pointerout","pointerover"]),Ln("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ln("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ln("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ln("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zi="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(" "),CS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zi));function Bx(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],g=u.event;u=u.listeners;e:{var b=void 0;if(a)for(var S=u.length-1;0<=S;S--){var _=u[S],V=_.instance,te=_.currentTarget;if(_=_.listener,V!==b&&g.isPropagationStopped())break e;b=_,g.currentTarget=te;try{b(g)}catch(de){Qo(de)}g.currentTarget=null,b=V}else for(S=0;S<u.length;S++){if(_=u[S],V=_.instance,te=_.currentTarget,_=_.listener,V!==b&&g.isPropagationStopped())break e;b=_,g.currentTarget=te;try{b(g)}catch(de){Qo(de)}g.currentTarget=null,b=V}}}}function Xe(t,a){var i=a[Xa];i===void 0&&(i=a[Xa]=new Set);var u=t+"__bubble";i.has(u)||(Hx(a,t,2,!1),i.add(u))}function Vf(t,a,i){var u=0;a&&(u|=4),Hx(i,t,u,a)}var Dc="_reactListening"+Math.random().toString(36).slice(2);function Gf(t){if(!t[Dc]){t[Dc]=!0,Ns.forEach(function(i){i!=="selectionchange"&&(CS.has(i)||Vf(i,!1,t),Vf(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Dc]||(a[Dc]=!0,Vf("selectionchange",!1,a))}}function Hx(t,a,i,u){switch(gy(a)){case 2:var g=ej;break;case 8:g=tj;break;default:g=im}i=g.bind(null,a,i,t),g=void 0,!dd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),u?g!==void 0?t.addEventListener(a,i,{capture:!0,passive:g}):t.addEventListener(a,i,!0):g!==void 0?t.addEventListener(a,i,{passive:g}):t.addEventListener(a,i,!1)}function Wf(t,a,i,u,g){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(_===g)break;if(S===4)for(S=u.return;S!==null;){var V=S.tag;if((V===3||V===4)&&S.stateNode.containerInfo===g)return;S=S.return}for(;_!==null;){if(S=bn(_),S===null)return;if(V=S.tag,V===5||V===6||V===26||V===27){u=b=S;continue e}_=_.parentNode}}u=u.return}Gp(function(){var te=b,de=cd(i),me=[];e:{var ne=vg.get(t);if(ne!==void 0){var ie=Wo,je=t;switch(t){case"keypress":if(Vo(i)===0)break e;case"keydown":case"keyup":ie=bw;break;case"focusin":je="focus",ie=pd;break;case"focusout":je="blur",ie=pd;break;case"beforeblur":case"afterblur":ie=pd;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":ie=Yp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=iw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=ww;break;case gg:case xg:case yg:ie=uw;break;case bg:ie=jw;break;case"scroll":case"scrollend":ie=sw;break;case"wheel":ie=Cw;break;case"copy":case"cut":case"paste":ie=fw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Xp;break;case"toggle":case"beforetoggle":ie=Mw}var Oe=(a&4)!==0,wt=!Oe&&(t==="scroll"||t==="scrollend"),Q=Oe?ne!==null?ne+"Capture":null:ne;Oe=[];for(var G=te,J;G!==null;){var fe=G;if(J=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||J===null||Q===null||(fe=si(G,Q),fe!=null&&Oe.push(Ui(G,fe,J))),wt)break;G=G.return}0<Oe.length&&(ne=new ie(ne,je,null,i,de),me.push({event:ne,listeners:Oe}))}}if((a&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",ie=t==="mouseout"||t==="pointerout",ne&&i!==od&&(je=i.relatedTarget||i.fromElement)&&(bn(je)||je[ga]))break e;if((ie||ne)&&(ne=de.window===de?de:(ne=de.ownerDocument)?ne.defaultView||ne.parentWindow:window,ie?(je=i.relatedTarget||i.toElement,ie=te,je=je?bn(je):null,je!==null&&(wt=c(je),Oe=je.tag,je!==wt||Oe!==5&&Oe!==27&&Oe!==6)&&(je=null)):(ie=null,je=te),ie!==je)){if(Oe=Yp,fe="onMouseLeave",Q="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Oe=Xp,fe="onPointerLeave",Q="onPointerEnter",G="pointer"),wt=ie==null?ne:Za(ie),J=je==null?ne:Za(je),ne=new Oe(fe,G+"leave",ie,i,de),ne.target=wt,ne.relatedTarget=J,fe=null,bn(de)===te&&(Oe=new Oe(Q,G+"enter",je,i,de),Oe.target=J,Oe.relatedTarget=wt,fe=Oe),wt=fe,ie&&je)t:{for(Oe=TS,Q=ie,G=je,J=0,fe=Q;fe;fe=Oe(fe))J++;fe=0;for(var Re=G;Re;Re=Oe(Re))fe++;for(;0<J-fe;)Q=Oe(Q),J--;for(;0<fe-J;)G=Oe(G),fe--;for(;J--;){if(Q===G||G!==null&&Q===G.alternate){Oe=Q;break t}Q=Oe(Q),G=Oe(G)}Oe=null}else Oe=null;ie!==null&&Px(me,ne,ie,Oe,!1),je!==null&&wt!==null&&Px(me,wt,je,Oe,!0)}}e:{if(ne=te?Za(te):window,ie=ne.nodeName&&ne.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ne.type==="file")var it=sg;else if(ag(ne))if(lg)it=Uw;else{it=Dw;var Me=Ow}else ie=ne.nodeName,!ie||ie.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Ct(te.elementType)&&(it=sg):it=zw;if(it&&(it=it(t,te))){rg(me,it,i,de);break e}Me&&Me(t,ne,te),t==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&ei(ne,"number",ne.value)}switch(Me=te?Za(te):window,t){case"focusin":(ag(Me)||Me.contentEditable==="true")&&(ol=Me,kd=te,mi=null);break;case"focusout":mi=kd=ol=null;break;case"mousedown":wd=!0;break;case"contextmenu":case"mouseup":case"dragend":wd=!1,hg(me,i,de);break;case"selectionchange":if(Bw)break;case"keydown":case"keyup":hg(me,i,de)}var Ge;if(xd)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 il?tg(t,i)&&(tt="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(tt="onCompositionStart");tt&&(Zp&&i.locale!=="ko"&&(il||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&il&&(Ge=Wp()):(qr=de,fd="value"in qr?qr.value:qr.textContent,il=!0)),Me=zc(te,tt),0<Me.length&&(tt=new Qp(tt,t,null,i,de),me.push({event:tt,listeners:Me}),Ge?tt.data=Ge:(Ge=ng(i),Ge!==null&&(tt.data=Ge)))),(Ge=Aw?Rw(t,i):_w(t,i))&&(tt=zc(te,"onBeforeInput"),0<tt.length&&(Me=new Qp("onBeforeInput","beforeinput",null,i,de),me.push({event:Me,listeners:tt}),Me.data=Ge)),SS(me,t,te,i,de)}Bx(me,a)})}function Ui(t,a,i){return{instance:t,listener:a,currentTarget:i}}function zc(t,a){for(var i=a+"Capture",u=[];t!==null;){var g=t,b=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||b===null||(g=si(t,i),g!=null&&u.unshift(Ui(t,g,b)),g=si(t,a),g!=null&&u.push(Ui(t,g,b))),t.tag===3)return u;t=t.return}return[]}function TS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Px(t,a,i,u,g){for(var b=a._reactName,S=[];i!==null&&i!==u;){var _=i,V=_.alternate,te=_.stateNode;if(_=_.tag,V!==null&&V===u)break;_!==5&&_!==26&&_!==27||te===null||(V=te,g?(te=si(i,b),te!=null&&S.unshift(Ui(i,te,V))):g||(te=si(i,b),te!=null&&S.push(Ui(i,te,V)))),i=i.return}S.length!==0&&t.push({event:a,listeners:S})}var MS=/\r\n?/g,ES=/\u0000|\uFFFD/g;function Fx(t){return(typeof t=="string"?t:""+t).replace(MS,`
9
+ `).replace(ES,"")}function qx(t,a){return a=Fx(a),Fx(t)===a}function kt(t,a,i,u,g,b){switch(i){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||se(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&se(t,""+u);break;case"className":Nt(t,"class",u);break;case"tabIndex":Nt(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Nt(t,i,u);break;case"style":Dt(t,u,b);break;case"data":if(a!=="object"){Nt(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=ri(""+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"&&kt(t,a,"name",g.name,g,null),kt(t,a,"formEncType",g.formEncType,g,null),kt(t,a,"formMethod",g.formMethod,g,null),kt(t,a,"formTarget",g.formTarget,g,null)):(kt(t,a,"encType",g.encType,g,null),kt(t,a,"method",g.method,g,null),kt(t,a,"target",g.target,g,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=ri(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=$a);break;case"onScroll":u!=null&&Xe("scroll",t);break;case"onScrollEnd":u!=null&&Xe("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(g.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=ri(""+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":Xe("beforetoggle",t),Xe("toggle",t),jt(t,"popover",u);break;case"xlinkActuate":Ot(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Ot(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Ot(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Ot(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Ot(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Ot(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Ot(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Ot(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Ot(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":jt(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=nr.get(i)||i,jt(t,i,u))}}function Kf(t,a,i,u,g,b){switch(i){case"style":Dt(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(g.children!=null)throw Error(s(60));t.innerHTML=i}}break;case"children":typeof u=="string"?se(t,u):(typeof u=="number"||typeof u=="bigint")&&se(t,""+u);break;case"onScroll":u!=null&&Xe("scroll",t);break;case"onScrollEnd":u!=null&&Xe("scrollend",t);break;case"onClick":u!=null&&(t.onclick=$a);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rl.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(g=i.endsWith("Capture"),a=i.slice(2,g?i.length-7:void 0),b=t[hn]||null,b=b!=null?b[i]:null,typeof b=="function"&&t.removeEventListener(a,b,g),typeof u=="function")){typeof b!="function"&&b!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,g);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):jt(t,i,u)}}}function Sn(t,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xe("error",t),Xe("load",t);var u=!1,g=!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":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:kt(t,a,b,S,i,null)}}g&&kt(t,a,"srcSet",i.srcSet,i,null),u&&kt(t,a,"src",i.src,i,null);return;case"input":Xe("invalid",t);var _=b=S=g=null,V=null,te=null;for(u in i)if(i.hasOwnProperty(u)){var de=i[u];if(de!=null)switch(u){case"name":g=de;break;case"type":S=de;break;case"checked":V=de;break;case"defaultChecked":te=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:kt(t,a,u,de,i,null)}}Fo(t,b,_,V,te,S,g,!1);return;case"select":Xe("invalid",t),u=S=b=null;for(g in i)if(i.hasOwnProperty(g)&&(_=i[g],_!=null))switch(g){case"value":b=_;break;case"defaultValue":S=_;break;case"multiple":u=_;default:kt(t,a,g,_,i,null)}a=b,i=S,t.multiple=!!u,a!=null?Fr(t,!!u,a,!1):i!=null&&Fr(t,!!u,i,!0);return;case"textarea":Xe("invalid",t),b=g=u=null;for(S in i)if(i.hasOwnProperty(S)&&(_=i[S],_!=null))switch(S){case"value":u=_;break;case"defaultValue":g=_;break;case"children":b=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:kt(t,a,S,_,i,null)}ni(t,u,g,b);return;case"option":for(V in i)i.hasOwnProperty(V)&&(u=i[V],u!=null)&&(V==="selected"?t.selected=u&&typeof u!="function"&&typeof u!="symbol":kt(t,a,V,u,i,null));return;case"dialog":Xe("beforetoggle",t),Xe("toggle",t),Xe("cancel",t),Xe("close",t);break;case"iframe":case"object":Xe("load",t);break;case"video":case"audio":for(u=0;u<zi.length;u++)Xe(zi[u],t);break;case"image":Xe("error",t),Xe("load",t);break;case"details":Xe("toggle",t);break;case"embed":case"source":case"link":Xe("error",t),Xe("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(te in i)if(i.hasOwnProperty(te)&&(u=i[te],u!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:kt(t,a,te,u,i,null)}return;default:if(Ct(a)){for(de in i)i.hasOwnProperty(de)&&(u=i[de],u!==void 0&&Kf(t,a,de,u,i,void 0));return}}for(_ in i)i.hasOwnProperty(_)&&(u=i[_],u!=null&&kt(t,a,_,u,i,null))}function AS(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 g=null,b=null,S=null,_=null,V=null,te=null,de=null;for(ie in i){var me=i[ie];if(i.hasOwnProperty(ie)&&me!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":V=me;default:u.hasOwnProperty(ie)||kt(t,a,ie,null,u,me)}}for(var ne in u){var ie=u[ne];if(me=i[ne],u.hasOwnProperty(ne)&&(ie!=null||me!=null))switch(ne){case"type":b=ie;break;case"name":g=ie;break;case"checked":te=ie;break;case"defaultChecked":de=ie;break;case"value":S=ie;break;case"defaultValue":_=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,a));break;default:ie!==me&&kt(t,a,ne,ie,u,me)}}Jl(t,S,_,V,te,de,b,g);return;case"select":ie=S=_=ne=null;for(b in i)if(V=i[b],i.hasOwnProperty(b)&&V!=null)switch(b){case"value":break;case"multiple":ie=V;default:u.hasOwnProperty(b)||kt(t,a,b,null,u,V)}for(g in u)if(b=u[g],V=i[g],u.hasOwnProperty(g)&&(b!=null||V!=null))switch(g){case"value":ne=b;break;case"defaultValue":_=b;break;case"multiple":S=b;default:b!==V&&kt(t,a,g,b,u,V)}a=_,i=S,u=ie,ne!=null?Fr(t,!!i,ne,!1):!!u!=!!i&&(a!=null?Fr(t,!!i,a,!0):Fr(t,!!i,i?[]:"",!1));return;case"textarea":ie=ne=null;for(_ in i)if(g=i[_],i.hasOwnProperty(_)&&g!=null&&!u.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:kt(t,a,_,null,u,g)}for(S in u)if(g=u[S],b=i[S],u.hasOwnProperty(S)&&(g!=null||b!=null))switch(S){case"value":ne=g;break;case"defaultValue":ie=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(s(91));break;default:g!==b&&kt(t,a,S,g,u,b)}ti(t,ne,ie);return;case"option":for(var je in i)ne=i[je],i.hasOwnProperty(je)&&ne!=null&&!u.hasOwnProperty(je)&&(je==="selected"?t.selected=!1:kt(t,a,je,null,u,ne));for(V in u)ne=u[V],ie=i[V],u.hasOwnProperty(V)&&ne!==ie&&(ne!=null||ie!=null)&&(V==="selected"?t.selected=ne&&typeof ne!="function"&&typeof ne!="symbol":kt(t,a,V,ne,u,ie));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)&&kt(t,a,Oe,null,u,ne);for(te in u)if(ne=u[te],ie=i[te],u.hasOwnProperty(te)&&ne!==ie&&(ne!=null||ie!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,a));break;default:kt(t,a,te,ne,u,ie)}return;default:if(Ct(a)){for(var wt in i)ne=i[wt],i.hasOwnProperty(wt)&&ne!==void 0&&!u.hasOwnProperty(wt)&&Kf(t,a,wt,void 0,u,ne);for(de in u)ne=u[de],ie=i[de],!u.hasOwnProperty(de)||ne===ie||ne===void 0&&ie===void 0||Kf(t,a,de,ne,u,ie);return}}for(var Q in i)ne=i[Q],i.hasOwnProperty(Q)&&ne!=null&&!u.hasOwnProperty(Q)&&kt(t,a,Q,null,u,ne);for(me in u)ne=u[me],ie=i[me],!u.hasOwnProperty(me)||ne===ie||ne==null&&ie==null||kt(t,a,me,ne,u,ie)}function Vx(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function RS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var g=i[u],b=g.transferSize,S=g.initiatorType,_=g.duration;if(b&&_&&Vx(S)){for(S=0,_=g.responseEnd,u+=1;u<i.length;u++){var V=i[u],te=V.startTime;if(te>_)break;var de=V.transferSize,me=V.initiatorType;de&&Vx(me)&&(V=V.responseEnd,S+=de*(V<_?1:(_-te)/(V-te)))}if(--u,a+=8*(b+S)/(g.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 Yf=null,Qf=null;function Uc(t){return t.nodeType===9?t:t.ownerDocument}function Gx(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 Wx(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 Xf(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 Zf=null;function _S(){var t=window.event;return t&&t.type==="popstate"?t===Zf?!1:(Zf=t,!0):(Zf=null,!1)}var Kx=typeof setTimeout=="function"?setTimeout:void 0,IS=typeof clearTimeout=="function"?clearTimeout:void 0,Yx=typeof Promise=="function"?Promise:void 0,LS=typeof queueMicrotask=="function"?queueMicrotask:typeof Yx<"u"?function(t){return Yx.resolve(null).then(t).catch(OS)}:Kx;function OS(t){setTimeout(function(){throw t})}function is(t){return t==="head"}function Qx(t,a){var i=a,u=0;do{var g=i.nextSibling;if(t.removeChild(i),g&&g.nodeType===8)if(i=g.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(g),Ol(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")$i(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,$i(i);for(var b=i.firstChild;b;){var S=b.nextSibling,_=b.nodeName;b[xr]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&b.rel.toLowerCase()==="stylesheet"||i.removeChild(b),b=S}}else i==="body"&&$i(t.ownerDocument.body);i=g}while(i);Ol(a)}function Xx(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 Jf(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":Jf(i),yr(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function DS(t,a,i,u){for(;t.nodeType===1;){var g=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[xr])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!==g.rel||t.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||t.getAttribute("title")!==(g.title==null?null:g.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(b=t.getAttribute("src"),(b!==(g.src==null?null:g.src)||t.getAttribute("type")!==(g.type==null?null:g.type)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&b&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var b=g.name==null?null:""+g.name;if(g.type==="hidden"&&t.getAttribute("name")===b)return t}else return t;if(t=Ca(t.nextSibling),t===null)break}return null}function zS(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Ca(t.nextSibling),t===null))return null;return t}function Zx(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Ca(t.nextSibling),t===null))return null;return t}function em(t){return t.data==="$?"||t.data==="$~"}function tm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function US(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 Ca(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 nm=null;function Jx(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return Ca(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function ey(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 ty(t,a,i){switch(a=Uc(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 $i(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);yr(t)}var Ta=new Map,ny=new Set;function $c(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Lr=F.d;F.d={f:$S,r:BS,D:HS,C:PS,L:FS,m:qS,X:GS,S:VS,M:WS};function $S(){var t=Lr.f(),a=Ac();return t||a}function BS(t){var a=xa(t);a!==null&&a.tag===5&&a.type==="form"?b0(a):Lr.r(t)}var _l=typeof document>"u"?null:document;function ay(t,a,i){var u=_l;if(u&&typeof a=="string"&&a){var g=On(a);g='link[rel="'+t+'"][href="'+g+'"]',typeof i=="string"&&(g+='[crossorigin="'+i+'"]'),ny.has(g)||(ny.add(g),t={rel:t,crossOrigin:i,href:a},u.querySelector(g)===null&&(a=u.createElement("link"),Sn(a,"link",t),Lt(a),u.head.appendChild(a)))}}function HS(t){Lr.D(t),ay("dns-prefetch",t,null)}function PS(t,a){Lr.C(t,a),ay("preconnect",t,a)}function FS(t,a,i){Lr.L(t,a,i);var u=_l;if(u&&t&&a){var g='link[rel="preload"][as="'+On(a)+'"]';a==="image"&&i&&i.imageSrcSet?(g+='[imagesrcset="'+On(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(g+='[imagesizes="'+On(i.imageSizes)+'"]')):g+='[href="'+On(t)+'"]';var b=g;switch(a){case"style":b=Il(t);break;case"script":b=Ll(t)}Ta.has(b)||(t=y({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),Ta.set(b,t),u.querySelector(g)!==null||a==="style"&&u.querySelector(Bi(b))||a==="script"&&u.querySelector(Hi(b))||(a=u.createElement("link"),Sn(a,"link",t),Lt(a),u.head.appendChild(a)))}}function qS(t,a){Lr.m(t,a);var i=_l;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+On(u)+'"][href="'+On(t)+'"]',b=g;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Ll(t)}if(!Ta.has(b)&&(t=y({rel:"modulepreload",href:t},a),Ta.set(b,t),i.querySelector(g)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Hi(b)))return}u=i.createElement("link"),Sn(u,"link",t),Lt(u),i.head.appendChild(u)}}}function VS(t,a,i){Lr.S(t,a,i);var u=_l;if(u&&t){var g=ya(u).hoistableStyles,b=Il(t);a=a||"default";var S=g.get(b);if(!S){var _={loading:0,preload:null};if(S=u.querySelector(Bi(b)))_.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":a},i),(i=Ta.get(b))&&am(t,i);var V=S=u.createElement("link");Lt(V),Sn(V,"link",t),V._p=new Promise(function(te,de){V.onload=te,V.onerror=de}),V.addEventListener("load",function(){_.loading|=1}),V.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Bc(S,a,u)}S={type:"stylesheet",instance:S,count:1,state:_},g.set(b,S)}}}function GS(t,a){Lr.X(t,a);var i=_l;if(i&&t){var u=ya(i).hoistableScripts,g=Ll(t),b=u.get(g);b||(b=i.querySelector(Hi(g)),b||(t=y({src:t,async:!0},a),(a=Ta.get(g))&&rm(t,a),b=i.createElement("script"),Lt(b),Sn(b,"link",t),i.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(g,b))}}function WS(t,a){Lr.M(t,a);var i=_l;if(i&&t){var u=ya(i).hoistableScripts,g=Ll(t),b=u.get(g);b||(b=i.querySelector(Hi(g)),b||(t=y({src:t,async:!0,type:"module"},a),(a=Ta.get(g))&&rm(t,a),b=i.createElement("script"),Lt(b),Sn(b,"link",t),i.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(g,b))}}function ry(t,a,i,u){var g=(g=oe.current)?$c(g):null;if(!g)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=Il(i.href),i=ya(g).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=Il(i.href);var b=ya(g).hoistableStyles,S=b.get(t);if(S||(g=g.ownerDocument||g,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(t,S),(b=g.querySelector(Bi(t)))&&!b._p&&(S.instance=b,S.state.loading=5),Ta.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},Ta.set(t,i),b||KS(g,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=Ll(i),i=ya(g).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 Il(t){return'href="'+On(t)+'"'}function Bi(t){return'link[rel="stylesheet"]['+t+"]"}function sy(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function KS(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}),Sn(a,"link",i),Lt(a),t.head.appendChild(a))}function Ll(t){return'[src="'+On(t)+'"]'}function Hi(t){return"script[async]"+t}function ly(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+On(i.href)+'"]');if(u)return a.instance=u,Lt(u),u;var g=y({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Lt(u),Sn(u,"style",g),Bc(u,i.precedence,t),a.instance=u;case"stylesheet":g=Il(i.href);var b=t.querySelector(Bi(g));if(b)return a.state.loading|=4,a.instance=b,Lt(b),b;u=sy(i),(g=Ta.get(g))&&am(u,g),b=(t.ownerDocument||t).createElement("link"),Lt(b);var S=b;return S._p=new Promise(function(_,V){S.onload=_,S.onerror=V}),Sn(b,"link",u),a.state.loading|=4,Bc(b,i.precedence,t),a.instance=b;case"script":return b=Ll(i.src),(g=t.querySelector(Hi(b)))?(a.instance=g,Lt(g),g):(u=i,(g=Ta.get(b))&&(u=y({},i),rm(u,g)),t=t.ownerDocument||t,g=t.createElement("script"),Lt(g),Sn(g,"link",u),t.head.appendChild(g),a.instance=g);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,Bc(u,i.precedence,t));return a.instance}function Bc(t,a,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=u.length?u[u.length-1]:null,b=g,S=0;S<u.length;S++){var _=u[S];if(_.dataset.precedence===a)b=_;else if(b!==g)break}b?b.parentNode.insertBefore(t,b.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function am(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function rm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Hc=null;function iy(t,a,i){if(Hc===null){var u=new Map,g=Hc=new Map;g.set(i,u)}else g=Hc,u=g.get(i),u||(u=new Map,g.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),g=0;g<i.length;g++){var b=i[g];if(!(b[xr]||b[Qt]||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 oy(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function YS(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 cy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function QS(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 g=Il(u.href),b=a.querySelector(Bi(g));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Pc.bind(t),a.then(t,t)),i.state.loading|=4,i.instance=b,Lt(b);return}b=a.ownerDocument||a,u=sy(u),(g=Ta.get(g))&&am(u,g),b=b.createElement("link"),Lt(b);var S=b;S._p=new Promise(function(_,V){S.onload=_,S.onerror=V}),Sn(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=Pc.bind(t),a.addEventListener("load",i),a.addEventListener("error",i))}}var sm=0;function XS(t,a){return t.stylesheets&&t.count===0&&qc(t,t.stylesheets),0<t.count||0<t.imgCount?function(i){var u=setTimeout(function(){if(t.stylesheets&&qc(t,t.stylesheets),t.unsuspend){var b=t.unsuspend;t.unsuspend=null,b()}},6e4+a);0<t.imgBytes&&sm===0&&(sm=62500*RS());var g=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&qc(t,t.stylesheets),t.unsuspend)){var b=t.unsuspend;t.unsuspend=null,b()}},(t.imgBytes>sm?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(g)}}:null}function Pc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Fc=null;function qc(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Fc=new Map,a.forEach(ZS,t),Fc=null,Pc.call(t))}function ZS(t,a){if(!(a.state.loading&4)){var i=Fc.get(t);if(i)var u=i.get(null);else{i=new Map,Fc.set(t,i);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<g.length;b++){var S=g[b];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(i.set(S.dataset.precedence,S),u=S)}u&&i.set(null,u)}g=a.instance,S=g.getAttribute("data-precedence"),b=i.get(S)||u,b===u&&i.set(null,g),i.set(S,g),this.count++,u=Pc.bind(this),g.addEventListener("load",u),g.addEventListener("error",u),b?b.parentNode.insertBefore(g,b.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(g,t.firstChild)),a.state.loading|=4}}var Pi={$$typeof:L,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function JS(t,a,i,u,g,b,S,_,V){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=Ee(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ee(0),this.hiddenUpdates=Ee(null),this.identifierPrefix=u,this.onUncaughtError=g,this.onCaughtError=b,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function uy(t,a,i,u,g,b,S,_,V,te,de,me){return t=new JS(t,a,i,S,V,te,de,me,_),a=1,b===!0&&(a|=24),b=ea(3,null,null,a),t.current=b,b.stateNode=t,a=zd(),a.refCount++,t.pooledCache=a,a.refCount++,b.memoizedState={element:u,isDehydrated:i,cache:a},Hd(b),t}function dy(t){return t?(t=dl,t):dl}function fy(t,a,i,u,g,b){g=dy(g),u.context===null?u.context=g:u.pendingContext=g,u=Qr(a),u.payload={element:i},b=b===void 0?null:b,b!==null&&(u.callback=b),i=Xr(t,u,a),i!==null&&(Gn(i,t,a),vi(i,t,a))}function my(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function lm(t,a){my(t,a),(t=t.alternate)&&my(t,a)}function hy(t){if(t.tag===13||t.tag===31){var a=Es(t,67108864);a!==null&&Gn(a,t,67108864),lm(t,67108864)}}function py(t){if(t.tag===13||t.tag===31){var a=sa();a=Xn(a);var i=Es(t,a);i!==null&&Gn(i,t,a),lm(t,a)}}var Vc=!0;function ej(t,a,i,u){var g=U.T;U.T=null;var b=F.p;try{F.p=2,im(t,a,i,u)}finally{F.p=b,U.T=g}}function tj(t,a,i,u){var g=U.T;U.T=null;var b=F.p;try{F.p=8,im(t,a,i,u)}finally{F.p=b,U.T=g}}function im(t,a,i,u){if(Vc){var g=om(u);if(g===null)Wf(t,a,u,Gc,i),xy(t,u);else if(aj(g,t,a,i,u))u.stopPropagation();else if(xy(t,u),a&4&&-1<nj.indexOf(t)){for(;g!==null;){var b=xa(g);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var S=Nn(b.pendingLanes);if(S!==0){var _=b;for(_.pendingLanes|=2,_.entangledLanes|=2;S;){var V=1<<31-He(S);_.entanglements[1]|=V,S&=~V}lr(b),(dt&6)===0&&(Mc=ut()+500,Di(0))}}break;case 31:case 13:_=Es(b,2),_!==null&&Gn(_,b,2),Ac(),lm(b,2)}if(b=om(u),b===null&&Wf(t,a,u,Gc,i),b===g)break;g=b}g!==null&&u.stopPropagation()}else Wf(t,a,u,null,i)}}function om(t){return t=cd(t),cm(t)}var Gc=null;function cm(t){if(Gc=null,t=bn(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 Gc=t,null}function gy(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(za()){case ce:return 2;case ye:return 8;case Se:case Le:return 32;case Be:return 268435456;default:return 32}default:return 32}}var um=!1,os=null,cs=null,us=null,Fi=new Map,qi=new Map,ds=[],nj="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 xy(t,a){switch(t){case"focusin":case"focusout":os=null;break;case"dragenter":case"dragleave":cs=null;break;case"mouseover":case"mouseout":us=null;break;case"pointerover":case"pointerout":Fi.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":qi.delete(a.pointerId)}}function Vi(t,a,i,u,g,b){return t===null||t.nativeEvent!==b?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:b,targetContainers:[g]},a!==null&&(a=xa(a),a!==null&&hy(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),t)}function aj(t,a,i,u,g){switch(a){case"focusin":return os=Vi(os,t,a,i,u,g),!0;case"dragenter":return cs=Vi(cs,t,a,i,u,g),!0;case"mouseover":return us=Vi(us,t,a,i,u,g),!0;case"pointerover":var b=g.pointerId;return Fi.set(b,Vi(Fi.get(b)||null,t,a,i,u,g)),!0;case"gotpointercapture":return b=g.pointerId,qi.set(b,Vi(qi.get(b)||null,t,a,i,u,g)),!0}return!1}function yy(t){var a=bn(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,Hr(t.priority,function(){py(i)});return}}else if(a===31){if(a=f(i),a!==null){t.blockedOn=a,Hr(t.priority,function(){py(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 Wc(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var i=om(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);od=u,i.target.dispatchEvent(u),od=null}else return a=xa(i),a!==null&&hy(a),t.blockedOn=i,!1;a.shift()}return!0}function by(t,a,i){Wc(t)&&i.delete(a)}function rj(){um=!1,os!==null&&Wc(os)&&(os=null),cs!==null&&Wc(cs)&&(cs=null),us!==null&&Wc(us)&&(us=null),Fi.forEach(by),qi.forEach(by)}function Kc(t,a){t.blockedOn===a&&(t.blockedOn=null,um||(um=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rj)))}var Yc=null;function vy(t){Yc!==t&&(Yc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Yc===t&&(Yc=null);for(var a=0;a<t.length;a+=3){var i=t[a],u=t[a+1],g=t[a+2];if(typeof u!="function"){if(cm(u||i)===null)continue;break}var b=xa(i);b!==null&&(t.splice(a,3),a-=3,of(b,{pending:!0,data:g,method:i.method,action:u},u,g))}}))}function Ol(t){function a(V){return Kc(V,t)}os!==null&&Kc(os,t),cs!==null&&Kc(cs,t),us!==null&&Kc(us,t),Fi.forEach(a),qi.forEach(a);for(var i=0;i<ds.length;i++){var u=ds[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<ds.length&&(i=ds[0],i.blockedOn===null);)yy(i),i.blockedOn===null&&ds.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var g=i[u],b=i[u+1],S=g[hn]||null;if(typeof b=="function")S||vy(i);else if(S){var _=null;if(b&&b.hasAttribute("formAction")){if(g=b,S=b[hn]||null)_=S.formAction;else if(cm(g)!==null)continue}else _=S.action;typeof _=="function"?i[u+1]=_:(i.splice(u,3),u-=3),vy(i)}}}function ky(){function t(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(S){return g=S})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=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,g=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),g!==null&&(g(),g=null)}}}function dm(t){this._internalRoot=t}Qc.prototype.render=dm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(s(409));var i=a.current,u=sa();fy(i,u,t,a,null,null)},Qc.prototype.unmount=dm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;fy(t.current,2,null,t,null,null),Ac(),a[ga]=null}};function Qc(t){this._internalRoot=t}Qc.prototype.unstable_scheduleHydration=function(t){if(t){var a=nl();t={blockedOn:null,target:t,priority:a};for(var i=0;i<ds.length&&a!==0&&a<ds[i].priority;i++);ds.splice(i,0,t),i===0&&yy(t)}};var wy=n.version;if(wy!=="19.2.7")throw Error(s(527,wy,"19.2.7"));F.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?p(t):null,t=t===null?null:t.stateNode,t};var sj={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xc.isDisabled&&Xc.supportsFiber)try{Pt=Xc.inject(sj),mt=Xc}catch{}}return Wi.createRoot=function(t,a){if(!o(t))throw Error(s(299));var i=!1,u="",g=E0,b=A0,S=R0;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError)),a=uy(t,1,!1,null,null,i,u,null,g,b,S,ky),t[ga]=a.current,Gf(t),new dm(a)},Wi.hydrateRoot=function(t,a,i){if(!o(t))throw Error(s(299));var u=!1,g="",b=E0,S=A0,_=R0,V=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(g=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&&(V=i.formState)),a=uy(t,1,!0,a,i??null,u,g,V,b,S,_,ky),a.context=dy(null),i=a.current,u=sa(),u=Xn(u),g=Qr(u),g.callback=null,Xr(i,g,u),i=u,a.current.lanes=i,Ye(a,i),lr(a),t[ga]=a.current,Gf(t),new Qc(a)},Wi.version="19.2.7",Wi}var _y;function hj(){if(_y)return hm.exports;_y=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(),hm.exports=mj(),hm.exports}var pj=hj();const ev={appName:"PenguinHarness",nav:{chat:"对话",newChat:"新对话",agents:"智能体",skills:"技能库",models:"模型库",usage:"成本中心",traces:"轨迹观测",benchmark:"评估中心",lastConversation:"最近一次对话",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:"将下载最新版本并安装到服务器上的安装目录(数据目录不受影响)。安装完成后需要重启服务才会生效。",adminOnly:"只有管理员可以在这里执行更新。"},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)",displayName:"显示名",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",exampleFolders:{webapps:"搭建网页应用",agents:"搭建和优化智能体"},exampleTasks:{game:{label:"2D 企鹅雪橇越野小游戏",desc:"可爱南极企鹅滑雪橇跳石头,难度由易到难的 2D 纯前端小游戏",prompt:"做一个可爱的南极企鹅滑雪橇越野 2D 小游戏:按空格键起跳,跃过冰面上迎面而来的石头;开局要足够简单、上手无压力,滑行速度与障碍密度随时间平滑、循序渐进地上升,避免突然变难,实时计分,撞上石头即结束并可一键重新开始。2D 横版画面、可爱卡通风,纯前端实现(单个 HTML 文件即可),界面遵循 web-design 技能。完成后在浏览器里自测一次,确认开局能轻松玩过几秒,并告诉我怎么打开和怎么玩。"},gamecenter:{label:"多智能体搭建小游戏中心",desc:"并行产出 10 个玩法互不重复的纯前端小游戏,配一个统一风格的索引首页",prompt:`用多智能体并行搭建一个网页小游戏中心:10 个玩法互不重复的纯前端小游戏,外加一个索引首页。
10
+
11
+ ## 分工方式
12
+ - 先规划这 10 个游戏(例如贪吃蛇、2048、俄罗斯方块、打砖块、扫雷、记忆翻牌、推箱子、太空射击、跳跃平台、节奏点击),确认玩法确实互不重复,并定好统一的目录结构、配色与交互规范。
13
+ - 再把 10 个游戏分派给多个子智能体并行实现,每个子智能体只负责自己的那一个游戏,严格按既定规范产出,互不改动他人的文件。
14
+
15
+ ## 每个游戏
16
+ - 独立的 \`games/<slug>/index.html\`,纯前端单文件、file:// 直接打开即可运行,不依赖后端与任何 CDN 资源。
17
+ - 具备开始 / 重新开始、实时计分或计时、失败或通关结算,并同时支持键盘与触摸操作,页面内写明玩法说明。
18
+ - 提供返回索引首页的入口。
19
+
20
+ ## 索引首页
21
+ - 根目录 \`index.html\`:卡片网格列出全部 10 个游戏(名称 + 一句话玩法 + 操作方式),点击进入对应游戏。
22
+ - 与所有游戏共用一套设计语言,遵循 web-design 技能。
23
+
24
+ ## 收尾
25
+ - 统一验收:10 个游戏玩法确实不重复、风格一致,索引页的链接全部可达。
26
+ - 在浏览器里逐个自测,确认都能开始、能结束、能重开,然后告诉我怎么打开。`},lol:{label:"英雄联盟音乐播放器",desc:"用 SoundCloud Widget API 播放历届 Worlds 主题曲,单文件即开即用",prompt:`用 SoundCloud Widget API(见 https://developers.soundcloud.com/docs/api/html5-widget)做一个英雄联盟 Worlds 主题曲播放器,单文件 index.html,file:// 打开即用。
27
+
28
+ ## 技术约束
29
+ - 使用 SC.Widget JS API(widget.load / widget.toggle / widget.setVolume / widget.seekTo),引入 https://w.soundcloud.com/player/api.js
30
+ - iframe 必须可见(180px 高),visual=true color=f0b90b single_active=true
31
+ - 仅包含以下 8 首已确认可播曲目(oEmbed 验证通过),不要添加未经 oEmbed 验证的曲目:
32
+ - Warriors (S4) — soundcloud.com/leagueoflegends/warriors
33
+ - Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
34
+ - Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
35
+ - Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
36
+ - Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
37
+ - GODS (S13) — soundcloud.com/leagueoflegends/gods
38
+ - Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
39
+ - Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
40
+
41
+ ## 布局
42
+ - 左侧 260px 粘性侧边栏:曲目列表(S4/S5/… 标签 + emoji + 曲名 + 年份),点击高亮金色边框,SC.Widget.load() 切歌 + auto_play
43
+ - 右侧主区域:Hero 标题 + 桌面时钟(80px 等宽金色 HH:MM:SS,每秒刷新,冒号闪烁)+ 心情标签
44
+ - 播放器卡片:SoundCloud iframe + 自定义控制栏(⏮ ▶/⏸ ⏭ + 曲目信息 + 音量滑块,点击喇叭图标静音切换)
45
+ - 心情波动区:15 根金色动画柱,切歌时重新随机生成
46
+ - 键盘快捷键:空格播放暂停、← → 切歌、↑ ↓ 调音量
47
+
48
+ ## 设计
49
+ Penguin 视觉风格(见 web-design 技能),默认深色。手机端侧边栏变为顶部横向滚动。
50
+
51
+ 完成后在浏览器打开 index.html 自测一次。`},rag:{label:"构建 Claude Code 文档 RAG 智能体",desc:"收集 claude-code-docs 仓库,生成可对话、带来源引用的 RAG 知识应用",prompt:"收集 https://github.com/ericbuess/claude-code-docs 的文档,构建一个 RAG 知识应用:克隆仓库并整理语料,建立检索索引;应用化身 Claude Code 配置专家,检索增强回答 Claude Code 相关问题并标注可点击的来源引用——引用要能展示命中的原文片段,并链接到真实文档;按 web-design 技能提供美观的 Web 聊天界面。完成后运行应用,用一个中文问题和一个英文问题各自测一次,确认两者都检索到了正确的英文文档、流式回答正常,并告诉我访问方式。"},agentBenchmarkBuild:{label:"构建通用决策智能体和评测基准",desc:"创建一个通用决策 Agent,并用足球、售后和投资任务检验它",prompt:`请依次使用 \`agent-creation\` 和 \`benchmark-design\`,创建决策 Agent,并产出 Frozen Benchmark 与 Formal Baseline。
52
+
53
+ Agent:
54
+ - id:\`finite_choice_agent\`
55
+ - 能力:面对有限选项,在公开信息不足或冲突时仍能给出稳定、可解释的选择
56
+ - installed_skills:\`[]\`
57
+
58
+ Benchmark:
59
+ - id:\`contextual-choice-adaptation\`
60
+ - capability:从公开规则、历史案例和当前事实中形成并迁移稳定的有限选择决策过程
61
+ - runs:\`1\`
62
+ - desired_baseline_score:\`<75\`
63
+ - pilot_iteration_limit:\`5\`
64
+
65
+ 场景:
66
+ 1. 根据历史比赛与当前信息进行足球投注决策。
67
+ 2. 根据售后政策与工单事实选择处置动作。
68
+ 3. 根据投资策略、历史市场与当前指标选择投资动作。`},agentOptimization:{label:"优化通用决策智能体的准确率",desc:"根据已有评测结果改进 Agent,并验证新版本是否真正提升",prompt:"请使用 `agent-optimization`,根据 Frozen Benchmark 优化决策 Agent。\n\n- test_agent_id:`finite_choice_agent`\n- benchmark_id:`contextual-choice-adaptation`\n- capability_direction:提高信息不完整、规则冲突和有限选项决策中的稳定性\n- desired_score:`>=95`\n- candidate_round_limit:`5`"}},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"?"连接超时或网络中断":e==="malformed"?"响应不完整或无法解析":"模型服务返回错误",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:"输入 / 使用命令",switchAgent:"交给其他 Agent,发送时开启新会话",switchAgentTitle:"选择 Agent",agentSearchPlaceholder:"搜索 Agent:id / 名称",agentsNoMatch:"没有匹配的 Agent",handoffTargetTitle:e=>`发送后交接给 ${e}`,handoffRemove:"移除交接目标",skillsSelect:"技能",skillRemove:"移除技能",skillsSearchPlaceholder:"搜索技能",skillsNoMatch:"没有匹配的技能",skillsEmptyHint:"暂无已装技能,去技能库添加",skillsAutoMessage:e=>`使用 ${e.join("、")} 技能`,handoffFrom:e=>`由 ${e} 的对话交接而来`,handoffBack:e=>e?`回到原对话:${e}`:"回到原对话",switchModel:"切换模型,发送时开启新会话延续本对话",switchModelTitle:"切换模型",modelSwitchTargetTitle:e=>`发送后换用 ${e} 延续本对话`,modelSwitchRemove:"移除切换模型",modelSwitchBusyHint:"本轮结束后才能切换模型:新会话要从当前会话的记录接续",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("、")}`,attachedFilesBanner:e=>`附加文件:${e.join("、")}`,plusMenu:"更多输入方式",uploadImage:"上传图片",uploadImageDesc:"为本条消息附加图片",uploadFile:"上传文件",uploadFileDesc:"文件存入会话临时目录,模型按路径读取",removeFile:"移除文件",attachmentTooLarge:e=>`${e} 超过 10MB 上限,未添加。`,goalMode:"目标模式",goalModeDesc:"循环运行直至目标完成",goalBudgetLabel:"Token 预算",goalBudgetUnlimited:"预算不限",goalBudgetValue:e=>`预算 ${e}`,goalBudgetPlaceholder:"例如 500k",goalBudgetHint:"支持 k/m 后缀;留空表示预算不限",goalBudgetInvalid:"无效预算:应为正数,可带 k/m 后缀(500k、2m)",goalBudgetSave:"保存预算",goalRemove:"退出目标模式",goalRoundBanner:e=>`目标 · 第 ${e} 轮`,goalRoundImages: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:"暂无异常",errorsNewer:"较新",errorsOlder:"更早",errorsPageOf:(e,n,r)=>`第 ${e} / ${n} 页 · 共 ${r} 条`},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}随时间变化`,cases:"题目",viewCase:"查看题目",publicMaterials:"公开材料",statementUnavailable:"题面暂时无法读取",evaluations:"评估明细",noEvaluations:"暂无评估记录",summaryLabel:"评估说明",legendUnlabeled:"未标注模型",colVersion:"版本",colModel:"模型 ID",colThinkingLevel:"推理强度",colScore:"Score",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:"文件过大。",too_many_files:"一条消息附加的文件过多。",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=ev;function gj(e){x=e}const xj={appName:"PenguinHarness",nav:{chat:"Chat",newChat:"New chat",agents:"Agents",skills:"Skills",models:"Models",usage:"Cost Center",traces:"Trajectories",benchmark:"Evaluation Center",lastConversation:"Last conversation",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.",adminOnly:"Only an administrator can run the update from here."},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)",displayName:"Display name",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",exampleFolders:{webapps:"Build web apps",agents:"Build and optimize agents"},exampleTasks:{game:{label:"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."},gamecenter:{label:"A mini-game center built by multiple agents",desc:"Ten pure-frontend games with no repeated mechanics, built in parallel behind one index page",prompt:`Build a web mini-game center with multiple agents working in parallel: 10 pure-frontend games with no two sharing the same mechanic, plus an index page.
69
+
70
+ ## How to split the work
71
+ - First plan the 10 games (say snake, 2048, tetris, breakout, minesweeper, memory match, sokoban, space shooter, platform jumper, rhythm tap), confirm no two mechanics repeat, and fix a shared directory layout, palette and interaction spec.
72
+ - Then hand the 10 games to several subagents to implement in parallel — each subagent owns exactly one game, follows the agreed spec, and never edits another's files.
73
+
74
+ ## Each game
75
+ - Its own \`games/<slug>/index.html\`: pure frontend, a single file that runs straight from file://, with no backend and no CDN assets.
76
+ - Start / restart, live score or timer, a lose-or-clear summary, both keyboard and touch controls, and the rules written on the page.
77
+ - A way back to the index page.
78
+
79
+ ## Index page
80
+ - \`index.html\` at the root: a card grid listing all 10 games (name + one-line mechanic + controls), each card opening its game.
81
+ - One design language shared with every game, following the web-design skill.
82
+
83
+ ## Wrap-up
84
+ - Review as a whole: the 10 mechanics really are distinct, the styling is consistent, and every index link resolves.
85
+ - Self-test each game in a browser — it starts, it ends, it restarts — then tell me how to open it.`},lol:{label:"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://.
86
+
87
+ ## Technical constraints
88
+ - Use the SC.Widget JS API (widget.load / widget.toggle / widget.setVolume / widget.seekTo), loading https://w.soundcloud.com/player/api.js
89
+ - The iframe must stay visible (180px tall), with visual=true color=f0b90b single_active=true
90
+ - Include ONLY these 8 tracks confirmed playable (oEmbed-verified); do not add tracks that are not oEmbed-verified:
91
+ - Warriors (S4) — soundcloud.com/leagueoflegends/warriors
92
+ - Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
93
+ - Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
94
+ - Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
95
+ - Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
96
+ - GODS (S13) — soundcloud.com/leagueoflegends/gods
97
+ - Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
98
+ - Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
99
+
100
+ ## Layout
101
+ - 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
102
+ - Right main area: hero title + a desktop clock (80px monospace gold HH:MM:SS, refreshed every second, blinking colons) + a mood tag
103
+ - Player card: the SoundCloud iframe + a custom control bar (⏮ ▶/⏸ ⏭ + track info + a volume slider; clicking the speaker icon toggles mute)
104
+ - Mood-wave section: 15 gold animated bars, re-randomized on every track switch
105
+ - Keyboard shortcuts: Space play/pause, ← → previous/next, ↑ ↓ volume
106
+
107
+ ## Design
108
+ Penguin visual style (see the web-design skill), dark by default. On phones the sidebar becomes a horizontally scrolling top bar.
109
+
110
+ When done, open index.html in a browser and self-test once.`},rag:{label:"Build a Claude Code docs RAG agent",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. When done, run the app and self-test one Chinese question and one English question, confirming both retrieve the right English documents and stream their answers, then tell me how to access it."},agentBenchmarkBuild:{label:"Build a general-purpose decision agent and its benchmark",desc:"Create a general decision Agent and test it on football, after-sales, and investment tasks",prompt:`Use \`agent-creation\` followed by \`benchmark-design\` to create a decision Agent and produce a frozen Benchmark with a Formal Baseline.
111
+
112
+ Agent:
113
+ - id: \`finite_choice_agent\`
114
+ - capability: make stable, explainable finite choices when public information is incomplete or conflicting
115
+ - installed_skills: \`[]\`
116
+
117
+ Benchmark:
118
+ - id: \`contextual-choice-adaptation\`
119
+ - capability: form and transfer a stable finite-choice decision process from public rules, historical examples, and current facts
120
+ - runs: \`1\`
121
+ - desired_baseline_score: \`<75\`
122
+ - pilot_iteration_limit: \`5\`
123
+
124
+ Scenarios:
125
+ 1. Make football betting decisions from historical matches and current information.
126
+ 2. Choose after-sales actions from policy and ticket facts.
127
+ 3. Choose investment actions from a strategy, historical markets, and current indicators.`},agentOptimization:{label:"Improve the general-purpose decision agent's accuracy",desc:"Improve an Agent from existing evaluation results and verify that the new version is better",prompt:"Use `agent-optimization` to optimize a decision Agent against its frozen Benchmark.\n\n- test_agent_id: `finite_choice_agent`\n- benchmark_id: `contextual-choice-adaptation`\n- capability_direction: improve stability under incomplete information, conflicting rules, and finite choices\n- desired_score: `>=95`\n- candidate_round_limit: `5`"}},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":e==="malformed"?"Response incomplete or unparseable":"The model provider returned an error",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",switchAgent:"Hand off to another agent — opens a new session on send",switchAgentTitle:"Choose agent",agentSearchPlaceholder:"Search agents: id / name",agentsNoMatch:"No matching agents",handoffTargetTitle:e=>`Sending hands this conversation to ${e}`,handoffRemove:"Remove handoff 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 — on send, continues this conversation in a new session",switchModelTitle:"Switch model",modelSwitchTargetTitle:e=>`Sending continues this conversation on ${e}`,modelSwitchRemove:"Remove model switch",modelSwitchBusyHint:"The model switch waits for this turn to finish: the new session continues from this session's record",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(", ")}`,attachedFilesBanner:e=>`Attached file${e.length===1?"":"s"}: ${e.join(", ")}`,plusMenu:"More input options",uploadImage:"Upload image",uploadImageDesc:"Attach images to this message",uploadFile:"Upload file",uploadFileDesc:"Saved to the session scratchpad; the model reads them by path",removeFile:"Remove file",attachmentTooLarge:e=>`${e} exceeds the 10MB limit and was not attached.`,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}`,goalRoundImages:e=>e===1?"1 attached image":`${e} attached images`,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",errorsNewer:"Newer",errorsOlder:"Older",errorsPageOf:(e,n,r)=>`Page ${e} / ${n} · ${r} total`},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`,cases:"Cases",viewCase:"View task",publicMaterials:"Public materials",statementUnavailable:"The public Statement is unavailable",evaluations:"Evaluations",noEvaluations:"No evaluations yet",summaryLabel:"Summary",legendUnlabeled:"unlabeled model",colVersion:"Version",colModel:"Model ID",colThinkingLevel:"Thinking level",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.",too_many_files:"Too many files attached to one message.",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."}}},tv="penguin.lang",nv=v.createContext(null);function yj(e){return e?.toLowerCase().startsWith("zh")?"zh":"en"}function bj(){return yj(navigator.language)}function vj(e){return e==="system"?bj():e}function kj(){const e=localStorage.getItem(tv);return e==="zh"||e==="en"||e==="system"?e:"system"}function wj({children:e}){const[n,r]=v.useState(kj),[,s]=v.useState(0),o=vj(n);gj(o==="en"?xj:ev),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(tv,d),r(d)},[]);return l.jsx(nv.Provider,{value:{lang:n,locale:o,setLang:c},children:e})}function Sj({children:e}){const{locale:n}=Qa();return l.jsx("div",{className:"contents",children:e},n)}function Qa(){const e=v.useContext(nv);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}const Hh=7,av="penguin.theme",rv="penguin.fontScale",sv="penguin.accent",lv="penguin.currency",jj={sm:"16px",md:"18px",lg:"20px"},iv=v.createContext(null);function Nj(){const e=localStorage.getItem(av);return e==="light"||e==="dark"||e==="system"?e:"system"}function Cj(){const e=localStorage.getItem(rv);return e==="sm"||e==="md"||e==="lg"?e:"md"}function Tj(){const e=localStorage.getItem(sv);return e==="neutral"||e==="blue"||e==="green"||e==="violet"||e==="rose"||e==="amber"?e:"neutral"}function Mj(){return localStorage.getItem(lv)==="CNY"?"CNY":"USD"}function Ej(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function Aj({children:e}){const[n,r]=v.useState(Nj),[s,o]=v.useState(Ej),[c,d]=v.useState(Cj),[f,m]=v.useState(Tj),[h,p]=v.useState(Mj),y=n==="system"?s:n==="dark";v.useEffect(()=>{document.documentElement.classList.toggle("dark",y)},[y]),v.useEffect(()=>{document.documentElement.style.fontSize=jj[c]},[c]),v.useEffect(()=>{f==="neutral"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=f},[f]),v.useEffect(()=>{if(n!=="system")return;const T=window.matchMedia("(prefers-color-scheme: dark)"),A=R=>o(R.matches);return o(T.matches),T.addEventListener("change",A),()=>T.removeEventListener("change",A)},[n]);const k=v.useCallback(T=>{localStorage.setItem(av,T),r(T)},[]),w=v.useCallback(T=>{localStorage.setItem(rv,T),d(T)},[]),j=v.useCallback(T=>{localStorage.setItem(sv,T),m(T)},[]),C=v.useCallback(T=>{localStorage.setItem(lv,T),p(T)},[]);return l.jsx(iv.Provider,{value:{mode:n,dark:y,setMode:k,fontScale:c,setFontScale:w,accent:f,setAccent:j,currency:h,setCurrency:C},children:e})}function ks(){const e=v.useContext(iv);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}const Rj=[{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 ov=null;function Iy(e){ov=e}function _j(e){return e.startsWith("/api/auth/")}async function Ne(e,n={}){return(await cv(e,n)).data}async function cv(e,n={}){let r=e;if(n.query){const f=new URLSearchParams;for(const[h,p]of Object.entries(n.query))p!==void 0&&f.set(h,String(p));const m=f.toString();m&&(r+=`?${m}`)}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 f="http_error",m=x.common.unknownError;try{const h=await s.json();h.error?.code&&(f=h.error.code),h.error?.message&&(m=h.error.message)}catch{}throw s.status===401&&!_j(e)&&ov?.(),new Ka(s.status,f,m)}const o=Date.parse(s.headers.get("date")??""),c=Number.isFinite(o)?o:null;if(s.status===204)return{data:void 0,serverNowMs:c};const d=await s.text();return d?{data:JSON.parse(d),serverNowMs:c}:{data:void 0,serverNowMs:c}}const Ij=e=>Ne("/api/auth/login",{method:"POST",body:e}),Lj=()=>Ne("/api/auth/logout",{method:"POST",body:{}}),wu=()=>Ne("/api/me"),Oj=e=>Ne("/api/me/password",{method:"PUT",body:e}),Dj=()=>Ne("/api/me/prefs"),uv=e=>Ne("/api/me/prefs",{method:"PUT",body:e}),zj=()=>Ne("/api/admin/users"),Uj=e=>Ne("/api/admin/users",{method:"POST",body:e}),$j=(e,n)=>Ne(`/api/admin/users/${encodeURIComponent(e)}/password`,{method:"POST",body:n}),Bj=e=>Ne(`/api/admin/users/${encodeURIComponent(e)}`,{method:"DELETE"}),Hj=()=>Ne("/api/projects"),Pj=e=>Ne("/api/projects",{method:"POST",body:e}),Fj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),qj=e=>Ne(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE"}),ym=e=>Ne(`/api/projects/${encodeURIComponent(e)}/members`),Vj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:n}),Gj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(n)}`,{method:"DELETE"}),Vu=e=>Ne(`/api/projects/${encodeURIComponent(e)}/models`),Wj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/models`,{method:"PUT",body:n}),dv=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/models/test`,{method:"POST",body:n}),Kj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`),Yj=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`,{method:"PUT",body:r}),Qj=e=>Ne(`/api/projects/${encodeURIComponent(e)}/agents`),Xj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents`,{method:"POST",body:n}),Ph=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`),fv=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`,{method:"PUT",body:r}),Zj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config/reset`,{method:"POST"}),Jj=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces`),Ly=(e,n,r)=>{const s=r?`?limit=${r.limit}&offset=${r.offset}`+(r.category?`&category=${r.category}`:"")+(r.withCounts?"&counts=1":""):"";return Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions${s}`)},Oy=(e,n="")=>Ne(`/api/projects/${encodeURIComponent(e)}/dirs?path=${encodeURIComponent(n)}`),nh=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions`,{method:"POST",body:r}),Dy=e=>Ne(`/api/sessions/${encodeURIComponent(e)}`),ah=(e,n)=>Ne(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),Mu=e=>Ne(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),e5=e=>cv(`/api/sessions/${encodeURIComponent(e)}/messages`).then(({data:n,serverNowMs:r})=>({...n,serverNowMs:r})),co=(e,n)=>Ne(`/api/sessions/${encodeURIComponent(e)}/tasks`,{method:"POST",body:n}),t5=e=>Ne(`/api/sessions/${encodeURIComponent(e)}/goal`),n5=(e,n,r)=>Ne(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(n)}`,{method:"POST",body:r}),a5=e=>Ne(`/api/sessions/${encodeURIComponent(e)}/abort`,{method:"POST",body:{}}),r5=e=>Ne(`/api/sessions/${encodeURIComponent(e)}/retry-now`,{method:"POST",body:{}}),s5=(e,n)=>Ne(`/api/sessions/${encodeURIComponent(e)}/steer`,{method:"POST",body:n}),l5=e=>Ne(`/api/sessions/${encodeURIComponent(e)}/compact`,{method:"POST",body:{}}),i5=(e,n,r,s,o,c)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}`,{query:{offset:o,limit:c}}),o5=(e,n,r,s)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}/analysis`),c5=(e,n,r,s)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}/download`,u5=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/import`,{method:"POST",body:r}),d5=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/usage/errors`,{query:{offset:String(n.offset),limit:String(n.limit),from:n.from,to:n.to,agentId:n.agentId}}),mv=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/usage`,{query:{from:n.from,to:n.to,groupBy:n.groupBy,agentId:n.agentId,provider:n.provider,modelId:n.modelId}}),f5=(e,n)=>Ne(`/api/projects/${e}/agents/${n}`,{method:"DELETE"}),m5=(e,n)=>Ne(`/api/sessions/${e}/files`,{query:{path:n}}),ms=(e,n,r=!1)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(n)}${r?"&download=1":""}`,zy=(e,n)=>`/api/sessions/${e}/files/preview-redirect?path=${encodeURIComponent(n)}`,h5=(e,n,r)=>Ne(`/api/sessions/${e}/files/content`,{method:"PUT",body:{dataBase64:r},query:{path:n}}),p5=(e,n)=>Ne(`/api/sessions/${e}/files/stat`,{method:"POST",body:{paths:n}}),g5=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`),x5=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`,{method:"POST",body:r}),Uy=(e,n,r,s)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"PUT",body:s}),y5=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"DELETE"}),b5=()=>Ne("/api/skills"),Fh=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`),$y=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`,{method:"POST",body:{names:r}}),v5=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/${encodeURIComponent(r)}`,{method:"DELETE"}),k5=(e,n)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks`),w5=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks/${encodeURIComponent(r)}/cases`),S5=(e,n,r,s,o)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks/${encodeURIComponent(r)}/cases/${encodeURIComponent(s)}/files`,{query:{path:o}}),j5=(e,n,r,s,o,c)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks/${encodeURIComponent(r)}/cases/${encodeURIComponent(s)}/files/content?path=${encodeURIComponent(o)}`+(c?.download?"&download=1":"")+(c?.preview&&!c.download?"&preview=1":""),N5=(e,n)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/export`,C5=(e,n,r)=>Ne(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/import`,{method:"POST",body:r}),T5=()=>Ne("/api/version"),hv=(e=!1)=>Ne(`/api/version/update-check${e?"?force=1":""}`),M5=()=>Ne("/api/version/update",{method:"POST",body:{}}),pv=v.createContext(null);function E5({children:e}){const[n,r]=v.useState(void 0),[s,o]=v.useState(!0);v.useEffect(()=>(Iy(()=>r(null)),()=>Iy(null)),[]),v.useEffect(()=>{let m=!1;return wu().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 p=await Ij({userId:m,password:h});r(p.user);try{const y=await wu();r(y.user),o(y.previewIsolated)}catch{}},[]),d=v.useCallback(async()=>{try{await Lj()}finally{r(null)}},[]),f=v.useCallback(async()=>{const m=await wu();r(m.user),o(m.previewIsolated)},[]);return l.jsx(pv.Provider,{value:{user:n,previewIsolated:s,login:c,logout:d,refresh:f},children:e})}function Un(){const e=v.useContext(pv);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const qh=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,gv=/^[\\/]{2}/;function A5(e,n){return n+e.replace(/\\/g,"/")}const By="popstate";function Hy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function R5(e={}){function n(s,o){let c=o.state?.masked,{pathname:d,search:f,hash:m}=c||s.location;return rh("",{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:ko(o)}return I5(n,r,null,e)}function $t(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function mr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function _5(){return Math.random().toString(36).substring(2,10)}function Py(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 rh(e,n,r=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Kl(n):n,state:r,key:n&&n.key||s||_5(),mask:o}}function ko({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 Kl(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 I5(e,n,r,s={}){let{window:o=document.defaultView,v5Compat:c=!1}=s,d=o.history,f="POP",m=null,h=p();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function p(){return(d.state||{idx:null}).idx}function y(){f="POP";let T=p(),A=T==null?null:T-h;h=T,m&&m({action:f,location:C.location,delta:A})}function k(T,A){f="PUSH";let R=Hy(T)?T:rh(C.location,T,A);h=p()+1;let L=Py(R,h),H=C.createHref(R.mask||R);try{d.pushState(L,"",H)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;o.location.assign(H)}c&&m&&m({action:f,location:C.location,delta:1})}function w(T,A){f="REPLACE";let R=Hy(T)?T:rh(C.location,T,A);h=p();let L=Py(R,h),H=C.createHref(R.mask||R);d.replaceState(L,"",H),c&&m&&m({action:f,location:C.location,delta:0})}function j(T){return L5(o,T)}let C={get action(){return f},get location(){return e(o,d)},listen(T){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(By,y),m=T,()=>{o.removeEventListener(By,y),m=null}},createHref(T){return n(o,T)},createURL:j,encodeLocation(T){let A=j(T);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:k,replace:w,go(T){return d.go(T)}};return C}function L5(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:ko(n);return o=o.replace(/ $/,"%20"),!r&&gv.test(o)&&(o=s+o),new URL(o,s)}function xv(e,n,r="/"){return O5(e,n,r,!1)}function O5(e,n,r,s,o){let c=bs((typeof n=="string"?Kl(n):n).pathname||"/",r);if(c==null)return null;let d=D5(e),f=null,m=wv(c);for(let h=0;f==null&&h<d.length;++h)f=K5(d[h],m,s);return f}function D5(e){let n=yv(e);return z5(n),n}function yv(e,n=[],r=[],s="",o=!1){let c=(d,f,m=o,h)=>{let p={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(s)&&m)return;$t(p.relativePath.startsWith(s),`Absolute route path "${p.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(s.length)}let y=Ga([s,p.relativePath]),k=r.concat(p);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}".`),yv(d.children,n,k,y,m)),!(d.path==null&&!d.index)&&n.push({path:y,score:G5(y,d.index),routesMeta:k.map((w,j)=>{let[C,T]=kv(w.relativePath,w.caseSensitive,j===k.length-1);return{...w,matcher:C,compiledParams:T}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let m of bv(d.path))c(d,f,!0,m)}),n}function bv(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=bv(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 z5(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:W5(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}const U5=/^:[\w-]+$/,$5=/^:[\w-]+/,B5=3.5,H5=3,P5=2,F5=1,q5=10,V5=-2,Fy=e=>e==="*";function G5(e,n){let r=e.split("/"),s=r.length;return r.some(Fy)&&(s+=V5),n&&(s+=P5),r.filter(o=>!Fy(o)).reduce((o,c)=>o+(U5.test(c)?H5:$5.test(c)?B5:c===""?F5:q5),s)}function W5(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 K5(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,p=c==="/"?n:n.slice(c.length)||"/",y={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},k=m.matcher&&m.compiledParams?vv(y,p,m.matcher,m.compiledParams):wo(y,p),w=m.route;if(!k&&h&&r&&!s[s.length-1].route.index&&(k=wo({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!k)return null;Object.assign(o,k.params),d.push({params:o,pathname:Ga([c,k.pathname]),pathnameBase:X5(Ga([c,k.pathnameBase])),route:w}),k.pathnameBase!=="/"&&(c=Ga([c,k.pathnameBase]))}return d}function wo(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=kv(e.path,e.caseSensitive,e.end);return vv(e,n,r,s)}function vv(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:p},y)=>{if(h==="*"){let w=f[y]||"";d=c.slice(0,c.length-w.length).replace(/(.)\/+$/,"$1")}const k=f[y];return p&&!k?m[h]=void 0:m[h]=(k||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function kv(e,n=!1,r=!0){mr(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 p=h.charAt(m+c.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 wv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return mr(!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 bs(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 Y5(e,n="/"){let{pathname:r,search:s="",hash:o=""}=typeof e=="string"?Kl(e):e,c;return r?(r=Sv(r),r.startsWith("/")?c=qy(r.substring(1),"/"):c=qy(r,n)):c=n,{pathname:c,search:Z5(s),hash:J5(o)}}function qy(e,n){let r=jv(n).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function bm(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 Q5(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Vh(e){let n=Q5(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function Gu(e,n,r,s=!1){let o;typeof e=="string"?o=Kl(e):(o={...e},$t(!o.pathname||!o.pathname.includes("?"),bm("?","pathname","search",o)),$t(!o.pathname||!o.pathname.includes("#"),bm("#","pathname","hash",o)),$t(!o.search||!o.search.includes("#"),bm("#","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=Y5(o,f),h=d&&d!=="/"&&d.endsWith("/"),p=(c||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}const Sv=e=>e.replace(/[\\/]{2,}/g,"/"),Ga=e=>Sv(e.join("/")),jv=e=>e.replace(/\/+$/,""),X5=e=>jv(e).replace(/^\/*/,"/"),Z5=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,J5=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var eN=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 tN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function nN(e){return Ga(e.map(n=>n.route.path).filter(Boolean))||"/"}const Nv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Cv(e,n){let r=e;if(typeof r!="string"||!qh.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,o=!1;if(Nv)try{let c=new URL(window.location.href),d=gv.test(r)?new URL(A5(r,c.protocol)):new URL(r),f=bs(d.pathname,n);d.origin===c.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{mr(!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 Tv=["POST","PUT","PATCH","DELETE"];new Set(Tv);const aN=["GET",...Tv];new Set(aN);const rN=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function sN(e){try{return rN.includes(new URL(e).protocol)}catch{return!1}}const Yl=v.createContext(null);Yl.displayName="DataRouter";const Wu=v.createContext(null);Wu.displayName="DataRouterState";const Mv=v.createContext(!1);function lN(){return v.useContext(Mv)}const Ev=v.createContext({isTransitioning:!1});Ev.displayName="ViewTransition";const iN=v.createContext(new Map);iN.displayName="Fetchers";const oN=v.createContext(null);oN.displayName="Await";const Oa=v.createContext(null);Oa.displayName="Navigation";const _o=v.createContext(null);_o.displayName="Location";const Da=v.createContext({outlet:null,matches:[],isDataRoute:!1});Da.displayName="Route";const Gh=v.createContext(null);Gh.displayName="RouteError";const Av="REACT_ROUTER_ERROR",cN="REDIRECT",uN="ROUTE_ERROR_RESPONSE";function dN(e){if(e.startsWith(`${Av}:${cN}:{`))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 fN(e){if(e.startsWith(`${Av}:${uN}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new eN(n.status,n.statusText,n.data)}catch{}}function mN(e,{relative:n}={}){$t(Js(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=v.useContext(Oa),{hash:o,pathname:c,search:d}=Io(e,{relative:n}),f=c;return r!=="/"&&(f=c==="/"?r:Ga([r,c])),s.createHref({pathname:f,search:d,hash:o})}function Js(){return v.useContext(_o)!=null}function ma(){return $t(Js(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(_o).location}function Rv(e){$t(Js(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:n}=ma();return v.useMemo(()=>wo(e,wv(n)),[n,e])}const _v="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ha(){let{isDataRoute:e}=v.useContext(Da);return e?EN():hN()}function hN(){$t(Js(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Yl),{basename:n,navigator:r}=v.useContext(Oa),{matches:s}=v.useContext(Da),{pathname:o}=ma(),c=JSON.stringify(Vh(s)),d=v.useRef(!1);return v.useLayoutEffect(()=>{d.current=!0}),v.useCallback((f,m={})=>{if(mr(d.current,_v),!d.current)return;if(typeof f=="number"){r.go(f);return}let h=Gu(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 pN=v.createContext(null);function gN(e){let n=v.useContext(Da).outlet;return v.useMemo(()=>n&&v.createElement(pN.Provider,{value:e},n),[n,e])}function Iv(){let{matches:e}=v.useContext(Da);return e[e.length-1]?.params??{}}function Io(e,{relative:n}={}){let{matches:r}=v.useContext(Da),{pathname:s}=ma(),o=JSON.stringify(Vh(r));return v.useMemo(()=>Gu(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function xN(e,n){return Lv(e,n)}function Lv(e,n,r){$t(Js(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(Oa),{matches:o}=v.useContext(Da),c=o[o.length-1],d=c?c.params:{};c&&c.pathname;let f=c?c.pathnameBase:"/";c&&c.route;let m=ma(),h;if(n){let j=typeof n=="string"?Kl(n):n;$t(f==="/"||j.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 "${j.pathname}" was given in the \`location\` prop.`),h=j}else h=m;let p=h.pathname||"/",y=p;if(f!=="/"){let j=f.replace(/^\//,"").split("/");y="/"+p.replace(/^\//,"").split("/").slice(j.length).join("/")}let k=r&&r.state.matches.length?r.state.matches.map(j=>Object.assign(j,{route:r.manifest[j.route.id]||j.route})):xv(e,{pathname:y}),w=SN(k&&k.map(j=>Object.assign({},j,{params:Object.assign({},d,j.params),pathname:Ga([f,s.encodeLocation?s.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?f:Ga([f,s.encodeLocation?s.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,r);return n&&w?v.createElement(_o.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...h},navigationType:"POP"}},w):w}function yN(){let e=MN(),n=tN(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 bN=v.createElement(yN,null);var vN=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=Mv;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=fN(e.digest);r&&(e=r)}let n=e!==void 0?v.createElement(Da.Provider,{value:this.props.routeContext},v.createElement(Gh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(kN,{error:e},n):n}};const vm=new WeakMap;function kN({children:e,error:n}){let{basename:r}=v.useContext(Oa);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=dN(n.digest);if(s){let o=vm.get(n);if(o)throw o;let c=Cv(s.location,r),d=c.absoluteURL||c.to;if(sN(d))throw new Error("Invalid redirect location");if(Nv&&!vm.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 vm.set(n,f),f}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function wN({routeContext:e,match:n,children:r}){let s=v.useContext(Yl);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Da.Provider,{value:e},r)}function SN(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 p=o.findIndex(y=>y.route.id&&c?.[y.route.id]!==void 0);$t(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let d=!1,f=-1;if(r&&s){d=s.renderFallback;for(let p=0;p<o.length;p++){let y=o[p];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(f=p),y.route.id){let{loaderData:k,errors:w}=s,j=y.route.loader&&!k.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||j){r.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let m=r?.onError,h=s&&m?(p,y)=>{m(p,{location:s.location,params:s.matches?.[0]?.params??{},pattern:nN(s.matches),errorInfo:y})}:void 0;return o.reduceRight((p,y,k)=>{let w,j=!1,C=null,T=null;s&&(w=c&&y.route.id?c[y.route.id]:void 0,C=y.route.errorElement||bN,d&&(f<0&&k===0?(AN("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,T=null):f===k&&(j=!0,T=y.route.hydrateFallbackElement||null)));let A=n.concat(o.slice(0,k+1)),R=()=>{let L;return w?L=C:j?L=T:y.route.Component?L=v.createElement(y.route.Component,null):y.route.element?L=y.route.element:L=p,v.createElement(wN,{match:y,routeContext:{outlet:p,matches:A,isDataRoute:s!=null},children:L})};return s&&(y.route.ErrorBoundary||y.route.errorElement||k===0)?v.createElement(vN,{location:s.location,revalidation:s.revalidation,component:C,error:w,children:R(),routeContext:{outlet:null,matches:A,isDataRoute:!0},onError:h}):R()},null)}function Wh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function jN(e){let n=v.useContext(Yl);return $t(n,Wh(e)),n}function NN(e){let n=v.useContext(Wu);return $t(n,Wh(e)),n}function CN(e){let n=v.useContext(Da);return $t(n,Wh(e)),n}function Kh(e){let n=CN(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 TN(){return Kh("useRouteId")}function MN(){let e=v.useContext(Gh),n=NN("useRouteError"),r=Kh("useRouteError");return e!==void 0?e:n.errors?.[r]}function EN(){let{router:e}=jN("useNavigate"),n=Kh("useNavigate"),r=v.useRef(!1);return v.useLayoutEffect(()=>{r.current=!0}),v.useCallback(async(s,o={})=>{mr(r.current,_v),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:n,...o}))},[e,n])}const Vy={};function AN(e,n,r){Vy[e]||(Vy[e]=!0,mr(!1,r))}v.memo(RN);function RN({routes:e,manifest:n,future:r,state:s,isStatic:o,onError:c}){return Lv(e,void 0,{manifest:n,state:s,isStatic:o,onError:c})}function So({to:e,replace:n,state:r,relative:s}){$t(Js(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=v.useContext(Oa);mr(!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(Da),{pathname:d}=ma(),f=ha(),m=Gu(e,Vh(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 _N(e){return gN(e.context)}function Wn(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 IN({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:o,static:c=!1,useTransitions:d}){$t(!Js(),"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=Kl(r));let{pathname:h="/",search:p="",hash:y="",state:k=null,key:w="default",mask:j}=r,C=v.useMemo(()=>{let T=bs(h,f);return T==null?null:{location:{pathname:T,search:p,hash:y,state:k,key:w,mask:j},navigationType:s}},[f,h,p,y,k,w,s,j]);return mr(C!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${y}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:v.createElement(Oa.Provider,{value:m},v.createElement(_o.Provider,{children:n,value:C}))}function LN({children:e,location:n}){return xN(sh(e),n)}function sh(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,sh(s.props.children,c));return}$t(s.type===Wn,`[${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=sh(d.children,c)),r.push(f)}),r}const Su="application/x-www-form-urlencoded";function Ku(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ON(e){return Ku(e)&&e.tagName.toLowerCase()==="button"}function DN(e){return Ku(e)&&e.tagName.toLowerCase()==="form"}function zN(e){return Ku(e)&&e.tagName.toLowerCase()==="input"}function UN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $N(e,n){return e.button===0&&(!n||n==="_self")&&!UN(e)}function lh(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 BN(e,n){let r=lh(e);return n&&n.forEach((s,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}let Zc=null;function HN(){if(Zc===null)try{new FormData(document.createElement("form"),0),Zc=!1}catch{Zc=!0}return Zc}const PN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function km(e){return e!=null&&!PN.has(e)?(mr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Su}"`),null):e}function FN(e,n){let r,s,o,c,d;if(DN(e)){let f=e.getAttribute("action");s=f?bs(f,n):null,r=e.getAttribute("method")||"get",o=km(e.getAttribute("enctype"))||Su,c=new FormData(e)}else if(ON(e)||zN(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?bs(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||"get",o=km(e.getAttribute("formenctype"))||km(f.getAttribute("enctype"))||Su,c=new FormData(f,e),!HN()){let{name:h,type:p,value:y}=e;if(p==="image"){let k=h?`${h}.`:"";c.append(`${k}x`,"0"),c.append(`${k}y`,"0")}else h&&c.append(h,y)}}else{if(Ku(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r="get",s=null,o=Su,d=e}return c&&o==="text/plain"&&(d=c,c=void 0),{action:s,method:r.toLowerCase(),encType:o,formData:c,body:d}}function Yh(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Ov(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 qN(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 VN(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 GN(e,n,r){return QN((await Promise.all(e.map(async s=>{let o=n.routes[s.route.id];if(o){let c=await qN(o,r);return c.links?c.links():[]}return[]}))).flat(1).filter(VN).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Gy(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 p=s.routes[m.route.id];if(!p||!p.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 WN(e,n,{includeHydrateFallback:r}={}){return KN(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 KN(e){return[...new Set(e)]}function YN(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function QN(e,n){let r=new Set;return new Set(n),e.reduce((s,o)=>{let c=JSON.stringify(YN(o));return r.has(c)||(r.add(c),s.push({key:c,link:o})),s},[])}function XN(){let e=v.useContext(Yl);return Yh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ZN(){let e=v.useContext(Wu);return Yh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}const Qh=v.createContext(void 0);Qh.displayName="FrameworkContext";function Xh(){let e=v.useContext(Qh);return Yh(e,"You must render this element inside a <HydratedRouter> element"),e}function JN(e,n){let r=v.useContext(Qh),[s,o]=v.useState(!1),[c,d]=v.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,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)})},T=new IntersectionObserver(C,{threshold:.5});return k.current&&T.observe(k.current),()=>{T.disconnect()}}},[e]),v.useEffect(()=>{if(s){let C=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(C)}}},[s]);let w=()=>{o(!0)},j=()=>{o(!1),d(!1)};return r?e!=="intent"?[c,k,{}]:[c,k,{onFocus:Ki(f,w),onBlur:Ki(m,j),onMouseEnter:Ki(h,w),onMouseLeave:Ki(p,j),onTouchStart:Ki(y,w)}]:[!1,k,{}]}function Ki(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function e4({page:e,...n}){let r=lN(),{nonce:s}=Xh(),{router:o}=XN(),c=v.useMemo(()=>xv(o.routes,e,o.basename),[o.routes,e,o.basename]);return c?(n.nonce==null&&s&&(n={...n,nonce:s}),r?v.createElement(n4,{page:e,matches:c,...n}):v.createElement(a4,{page:e,matches:c,...n})):null}function t4(e){let{manifest:n,routeModules:r}=Xh(),[s,o]=v.useState([]);return v.useEffect(()=>{let c=!1;return GN(e,n,r).then(d=>{c||o(d)}),()=>{c=!0}},[e,n,r]),s}function n4({page:e,matches:n,...r}){let s=ma(),o=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let c=Ov(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 a4({page:e,matches:n,...r}){let s=ma(),{manifest:o,routeModules:c}=Xh(),{loaderData:d,matches:f}=ZN(),m=v.useMemo(()=>Gy(e,n,f,o,s,"data"),[e,n,f,o,s]),h=v.useMemo(()=>Gy(e,n,f,o,s,"assets"),[e,n,f,o,s]),p=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,j=!1;if(n.forEach(T=>{let A=o.routes[T.route.id];!A||!A.hasLoader||(!m.some(R=>R.route.id===T.route.id)&&T.route.id in d&&c[T.route.id]?.shouldRevalidate||A.hasClientLoader?j=!0:w.add(T.route.id))}),w.size===0)return[];let C=Ov(e,"data");return j&&w.size>0&&C.searchParams.set("_routes",n.filter(T=>w.has(T.route.id)).map(T=>T.route.id).join(",")),[C.pathname+C.search]},[d,s,o,m,n,e,c]),y=v.useMemo(()=>WN(h,o),[h,o]),k=t4(h);return v.createElement(v.Fragment,null,p.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:j})=>v.createElement("link",{key:w,nonce:r.nonce,...j,crossOrigin:j.crossOrigin??r.crossOrigin})))}function r4(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}const s4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{s4&&(window.__reactRouterVersion="8.3.0")}catch{}function l4({basename:e,children:n,useTransitions:r,window:s}){let o=v.useRef(null);o.current==null&&(o.current=R5({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(IN,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:r})}const Zh=v.forwardRef(function({onClick:n,discover:r="render",prefetch:s="none",relative:o,reloadDocument:c,replace:d,mask:f,state:m,target:h,to:p,preventScrollReset:y,viewTransition:k,defaultShouldRevalidate:w,...j},C){let{basename:T,navigator:A,useTransitions:R}=v.useContext(Oa),L=typeof p=="string"&&qh.test(p),H=Cv(p,T);p=H.to;let O=mN(p,{relative:o}),I=ma(),z=null;if(f){let B=Gu(f,[],I.mask?I.mask.pathname:"/",!0);T!=="/"&&(B.pathname=B.pathname==="/"?T:Ga([T,B.pathname])),z=A.createHref(B)}let[W,X,D]=JN(s,j),q=c4(p,{replace:d,mask:f,state:m,target:h,preventScrollReset:y,relative:o,viewTransition:k,defaultShouldRevalidate:w,useTransitions:R});function P(B){n&&n(B),B.defaultPrevented||q(B)}let K=!(H.isExternal||c),ee=v.createElement("a",{...j,...D,href:(K?z:void 0)||H.absoluteURL||O,onClick:K?P:n,ref:r4(C,X),target:h,"data-discover":!L&&r==="render"?"true":void 0});return W&&!L?v.createElement(v.Fragment,null,ee,v.createElement(e4,{page:O})):ee});Zh.displayName="Link";const Jh=v.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:s="",end:o=!1,style:c,to:d,viewTransition:f,children:m,...h},p){let y=Io(d,{relative:h.relative}),k=ma(),w=v.useContext(Wu),{navigator:j,basename:C}=v.useContext(Oa),T=w!=null&&h4(y)&&f===!0,A=j.encodeLocation?j.encodeLocation(y).pathname:y.pathname,R=k.pathname,L=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(R=R.toLowerCase(),L=L?L.toLowerCase():null,A=A.toLowerCase()),L&&C&&(L=bs(L,C)||L);const H=A!=="/"&&A.endsWith("/")?A.length-1:A.length;let O=R===A||!o&&R.startsWith(A)&&R.charAt(H)==="/",I=L!=null&&(L===A||!o&&L.startsWith(A)&&L.charAt(H)==="/"),z={isActive:O,isPending:I,isTransitioning:T},W=O?n:void 0,X;typeof s=="function"?X=s(z):X=[s,O?"active":null,I?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let D=typeof c=="function"?c(z):c;return v.createElement(Zh,{...h,"aria-current":W,className:X,ref:p,style:D,to:d,viewTransition:f},typeof m=="function"?m(z):m)});Jh.displayName="NavLink";const i4=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:p,viewTransition:y,defaultShouldRevalidate:k,...w},j)=>{let{useTransitions:C}=v.useContext(Oa),T=f4(),A=m4(f,{relative:h}),R=d.toLowerCase()==="get"?"get":"post",L=typeof f=="string"&&qh.test(f),H=O=>{if(m&&m(O),O.defaultPrevented)return;O.preventDefault();let I=O.nativeEvent.submitter,z=I?.getAttribute("formmethod")||d,W=()=>T(I||O.currentTarget,{fetcherKey:n,method:z,navigate:r,replace:o,state:c,relative:h,preventScrollReset:p,viewTransition:y,defaultShouldRevalidate:k});C&&r!==!1?v.startTransition(()=>W()):W()};return v.createElement("form",{ref:j,method:R,action:A,onSubmit:s?m:H,...w,"data-discover":!L&&e==="render"?"true":void 0})});i4.displayName="Form";function o4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Dv(e){let n=v.useContext(Yl);return $t(n,o4(e)),n}function c4(e,{target:n,replace:r,mask:s,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:h}={}){let p=ha(),y=ma(),k=Io(e,{relative:d});return v.useCallback(w=>{if($N(w,n)){w.preventDefault();let j=r!==void 0?r:ko(y)===ko(k),C=()=>p(e,{replace:j,mask:s,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m});h?v.startTransition(()=>C()):C()}},[y,p,k,r,s,o,n,e,c,d,f,m,h])}function ep(e){mr(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(lh(e)),r=v.useRef(!1),s=ma(),o=v.useMemo(()=>BN(s.search,r.current?null:n.current),[s.search]),c=ha();return[o,v.useCallback((d,f)=>{const m=lh(typeof d=="function"?d(new URLSearchParams(o)):d);r.current=!0,c("?"+m,f)},[c,o])]}let u4=0,d4=()=>`__${String(++u4)}__`;function f4(){let{router:e}=Dv("useSubmit"),{basename:n}=v.useContext(Oa),r=TN(),s=e.fetch,o=e.navigate;return v.useCallback(async(c,d={})=>{let{action:f,method:m,encType:h,formData:p,body:y}=FN(c,n);d.navigate===!1?await s(d.fetcherKey||d4(),r,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:p,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:p,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 m4(e,{relative:n}={}){let{basename:r}=v.useContext(Oa),s=v.useContext(Da);$t(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),c={...Io(e||".",{relative:n})},d=ma();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(p=>p).forEach(p=>f.append("index",p));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])),ko(c)}function h4(e,{relative:n}={}){let r=v.useContext(Ev);$t(r!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Dv("useViewTransitionState"),o=Io(e,{relative:n});if(!r.isTransitioning)return!1;let c=bs(r.currentLocation.pathname,s)||r.currentLocation.pathname,d=bs(r.nextLocation.pathname,s)||r.nextLocation.pathname;return wo(o.pathname,d)!=null||wo(o.pathname,c)!=null}const Wy="penguin.lastProjectId",Ky=e=>`penguin.lastAgentId.${e}`,zv=v.createContext(null);function ih(e){return e.name??e.projectId}function un(e){return e.name??e.agentId}function p4({children:e}){const[n,r]=v.useState([]),[s,o]=v.useState(!0),[c,d]=v.useState(null),[f,m]=v.useState([]),[h,p]=v.useState(!0),[y,k]=v.useState(null),w=v.useCallback(async()=>{o(!0);try{const R=await Hj();r(R.projects),d(L=>{const H=L??localStorage.getItem(Wy);return(R.projects.find(I=>I.projectId===H)??R.projects[0])?.projectId??null})}finally{o(!1)}},[]);v.useEffect(()=>{w()},[w]);const j=v.useCallback(R=>{R!==c&&(localStorage.setItem(Wy,R),d(R),k(null),m([]),p(!0),uv({lastProjectId:R}).catch(()=>{}))},[c]),C=v.useCallback(async()=>{if(c){p(!0);try{const R=await Qj(c);m(R.agents),k(L=>{const H=L??localStorage.getItem(Ky(c)),O=R.agents.find(z=>z.agentId===H),I=R.agents.find(z=>z.agentId==="default_agent")??R.agents[0]??null;return(O??I)?.agentId??null})}finally{p(!1)}}},[c]);v.useEffect(()=>{m([]),C()},[C]);const T=v.useCallback(R=>{c&&localStorage.setItem(Ky(c),R),k(R)},[c]),A=v.useMemo(()=>{const R=n.find(H=>H.projectId===c)??null,L=f.find(H=>H.agentId===y)??null;return{projects:n,projectsLoading:s,currentProject:R,setCurrentProjectId:j,reloadProjects:w,agents:f,agentsLoading:h,currentAgent:L,setCurrentAgentId:T,reloadAgents:C}},[n,s,c,j,w,f,h,y,T,C]);return l.jsx(zv.Provider,{value:A,children:e})}function fn(){const e=v.useContext(zv);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function Uv(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 g4(e,n){return Uv(`/api/sessions/${encodeURIComponent(e)}/stream`,n)}function x4(e){return Uv("/api/events",e)}const $v="\0temp-workspaces",y4=/[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;function b4(e){const n=e.trim();return n===""||y4.test(n)}function Eu(e){return b4(e)?$v:e.trim()}function v4(e){const n=e.trim().split(/[/\\]+/).filter(Boolean);return n[n.length-1]??"/"}const Ws=10;function Yy(e,n){return e.length>n?{items:e.slice(0,n),hasMore:!0}:{items:e,hasMore:!1}}function Va(e){return e.archived?"archived":e.source==="subagent"||e.source==="schedule"?e.source:"active"}const tp=["subagent","schedule","archived"];function Qy(e){const n={active:[],subagent:[],schedule:[],archived:[]};for(const r of e)n[Va(r)].push(r);return n}const k4=["active",...tp];function w4(e){const n=new Map;for(const[r,s]of e)for(const[o,c]of Object.entries(s)){const d=Eu(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 k4){const h=c[m];h>0&&(f.totals[m]+=h,f.agents[m].includes(r)||f.agents[m].push(r))}}return n}function Bv(e){let n=null;for(const r of e){const s=Va(r);s!=="active"&&s!=="schedule"||(!n||r.createdAt>n.createdAt||r.createdAt===n.createdAt&&r.sessionId>n.sessionId)&&(n=r)}return n}function S4(e){const n=new Map;for(const o of e){const c=Eu(o.workspace);let d=n.get(c);if(!d){const f=c===$v;d={key:c,label:f?"":v4(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 Xy(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 Hv=v.createContext(null),hs=(e,n)=>`${e}\0${n}`;function j4({children:e}){const{currentProject:n,agents:r}=fn(),s=n?.projectId??null,o=r.map(U=>U.agentId).join(","),[c,d]=v.useState([]),[f,m]=v.useState(new Map),[h,p]=v.useState(new Map),[y,k]=v.useState(new Map),[w,j]=v.useState(!0),C=v.useRef(0),T=v.useRef([]);T.current=c;const A=v.useRef(f);A.current=f;const R=v.useRef(h);R.current=h;const L=v.useCallback(async()=>{const U=o===""?[]:o.split(",");if(!s||U.length===0)return;const F=++C.current;j(!0);try{const Z=await Promise.all(U.map(async Y=>{const le=["active",...tp.filter(oe=>A.current.has(hs(Y,oe)))];try{const oe=await Promise.all(le.map(async pe=>{const Ce=await Ly(s,Y,{offset:0,limit:Ws+1,category:pe,...pe==="active"?{withCounts:!0}:{}});return{category:pe,counts:Ce.counts,workspaceCounts:Ce.workspaceCounts,...Yy(Ce.sessions,Ws)}}));return{agentId:Y,pages:oe}}catch{return{agentId:Y,pages:[]}}}));if(F!==C.current)return;const ue=[],E=new Set,M=new Map,$=new Map,N=new Map;for(const Y of Z)for(const le of Y.pages){M.set(hs(Y.agentId,le.category),{hasMore:le.hasMore,fetched:le.items.length}),le.counts&&$.set(Y.agentId,le.counts),le.workspaceCounts&&N.set(Y.agentId,le.workspaceCounts);for(const oe of le.items)E.has(oe.sessionId)||(E.add(oe.sessionId),ue.push(oe))}d(ue),m(M),p($),k(N)}finally{F===C.current&&j(!1)}},[s,o]);v.useEffect(()=>{d([]),A.current=new Map,m(A.current),p(new Map),k(new Map),L()},[L]);const H=v.useCallback(async(U,F)=>{if(!s)return;const Z=[...new Set(U)].filter($=>{const N=A.current.get(hs($,F));return N===void 0?(R.current.get($)?.[F]??0)>0:N.hasMore});if(Z.length===0)return;const ue=C.current,E=await Promise.all(Z.map(async $=>{const N=A.current.get(hs($,F))?.fetched??0;try{const Y=(await Ly(s,$,{offset:N,limit:Ws+1,category:F})).sessions;return{agentId:$,...Yy(Y,Ws)}}catch{return null}}));if(ue!==C.current)return;const M=E.filter($=>$!==null);d($=>{const N=new Set($.map(le=>le.sessionId)),Y=M.flatMap(le=>le.items.filter(oe=>!N.has(oe.sessionId)));return Y.length>0?[...$,...Y]:$}),m($=>{const N=new Map($);for(const Y of M){const le=hs(Y.agentId,F);N.set(le,{hasMore:Y.hasMore,fetched:($.get(le)?.fetched??0)+Y.items.length})}return N})},[s]),O=v.useCallback((U,F)=>f.has(hs(U,F)),[f]),I=v.useCallback((U,F)=>{const Z=f.get(hs(U,F));return Z!==void 0?Z.hasMore:(h.get(U)?.[F]??0)>0},[f,h]),z=v.useCallback((U,F,Z)=>{const{agentId:ue,workspace:E}=U;p(M=>{const $=M.get(ue);if(!$)return M;const N=new Map(M);return N.set(ue,{...$,[F]:Math.max(0,$[F]+Z)}),N}),k(M=>{const $=M.get(ue);if(!$)return M;const N=$[E]??{active:0,subagent:0,schedule:0,archived:0},Y=new Map(M);return Y.set(ue,{...$,[E]:{...N,[F]:Math.max(0,N[F]+Z)}}),Y})},[]),W=v.useRef(L);W.current=L;const X=v.useRef(s);X.current=s,v.useEffect(()=>{const U=x4({onOmniMessage:()=>{},onServerEvent:F=>{F.type==="schedule_fired"&&F.projectId===X.current&&W.current()}});return()=>U.close()},[]);const D=v.useCallback(U=>{C.current+=1,!T.current.some(Z=>Z.sessionId===U.sessionId)&&A.current.get(hs(U.agentId,Va(U)))?.hasMore===!1&&z(U,Va(U),1),d(Z=>[U,...Z.filter(ue=>ue.sessionId!==U.sessionId)])},[z]),q=v.useCallback(U=>{C.current+=1;const F=T.current.find(Z=>Z.sessionId===U);F&&z(F,Va(F),-1),d(Z=>Z.filter(ue=>ue.sessionId!==U))},[z]),P=v.useCallback(U=>{const F=T.current.find(Z=>Z.sessionId===U.sessionId);F&&Va(F)!==Va(U)&&(z(U,Va(F),-1),z(U,Va(U),1)),d(Z=>Z.map(ue=>ue.sessionId===U.sessionId?U:ue))},[z]),K=v.useCallback((U,F)=>{d(Z=>{const ue=Z.find(E=>E.sessionId===U);return!ue||ue.status===F?Z:Z.map(E=>E.sessionId===U?{...E,status:F}:E)})},[]),ee=v.useCallback((U,F)=>{d(Z=>Z.map(ue=>ue.sessionId===U?{...ue,title:F}:ue))},[]),B=v.useMemo(()=>{const U=new Map;for(const F of c){const Z=U.get(F.agentId);Z?Z.push(F):U.set(F.agentId,[F])}for(const F of U.values())F.sort((Z,ue)=>ue.createdAt.localeCompare(Z.createdAt)||ue.sessionId.localeCompare(Z.sessionId));return{sessions:c,byAgent:U,countsByAgent:h,workspaceCountsByAgent:y,isLoadedFor:O,hasMoreFor:I,loading:w,reload:L,loadMoreFor:H,add:D,remove:q,replace:P,setStatus:K,setTitle:ee}},[c,h,y,O,I,w,L,H,D,q,P,K,ee]);return l.jsx(Hv.Provider,{value:B,children:e})}function el(){const e=v.useContext(Hv);if(!e)throw new Error("useSessions must be used within a SessionsProvider");return e}function np({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 Pv({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 N4({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 C4({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 ap({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 T4({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(ap,{onClose:s})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-[env(safe-area-inset-bottom)]",children:o})]})]}):null}function Ue({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 Ys(e){const n=e.toFixed(1);return n.endsWith(".0")?n.slice(0,-2):n}function lt(e){const n=Math.abs(e);return n<1e3?`${e}`:n<1e6?`${Ys(e/1e3)}k`:`${Ys(e/1e6)}M`}function xn(e,n){if(e<1e3)return`${Math.round(e)}ms`;const r=e/1e3;if(r<60&&!(n?.compact&&r>=10))return`${Ys(r)}s`;const s=Math.round(r);return s<60?`${s}s`:`${Math.floor(s/60)}m${s%60}s`}function Fv(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m${n%60}s`}function oh(e,n){return n>0?e/(n/1e3):null}function Au(e){return e==null||!Number.isFinite(e)?"—":`${Math.abs(e)<1e3?Ys(e):lt(e)} tok/s`}function qv(e,n){const r=e+n;return r>0?e/r:null}function rp(e){return e==null||!Number.isFinite(e)?"—":`${Math.round(e*100)}%`}function Ya(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 jo(e){return Number.isInteger(e)?`${e}`:e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function Zy(e){return Number(e.toFixed(1))<1024}function No(e){if(e<1024)return`${e}B`;const n=e/1024;if(Zy(n))return`${Ys(n)}KB`;const r=n/1024;return Zy(r)?`${Ys(r)}MB`:`${Ys(r/1024)}GB`}function Ks(e){return e<10?`0${e}`:`${e}`}function ua(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${n.getFullYear()}-${Ks(n.getMonth()+1)}-${Ks(n.getDate())} ${Ks(n.getHours())}:${Ks(n.getMinutes())}`}const M4=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Vv(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"?`${M4[s-1]} ${o}`:`${s} 月 ${o} 日`}function Gv(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 Ru(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function E4(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const s=Math.round((Ru(new Date)-Ru(r))/864e5);return s<0?ua(e):s===0?n==="en"?"today":"今天":s===1?n==="en"?"yesterday":"昨天":n==="en"?`${s} days ago`:`${s} 天前`}function A4(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const s=Math.round((Ru(new Date)-Ru(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 R4(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${Ks(n.getHours())}:${Ks(n.getMinutes())}:${Ks(n.getSeconds())}`}function Ae(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 Ql=Jb();const Jc=4,Yi=8;function La({button:e,open:n,setOpen:r,children:s,menuClass:o,menuStyle:c,className:d,portal:f,onEscape:m}){const h=v.useRef(null),p=v.useRef(null),[y,k]=v.useState(null);v.useEffect(()=>{if(!n)return;const C=A=>{const R=A.target;h.current?.contains(R)||p.current?.contains(R)||r(!1)},T=A=>{A.key==="Escape"&&(m?m():r(!1))};return window.addEventListener("mousedown",C),window.addEventListener("keydown",T),()=>{window.removeEventListener("mousedown",C),window.removeEventListener("keydown",T)}},[n,r,m]);const w=v.useCallback(()=>{if(!n||!f||!h.current){k(null);return}const C=h.current.getBoundingClientRect(),T=p.current,A=T?.offsetWidth??0,R=T?.offsetHeight??0,L=f.align==="right"?C.right-A:C.left,H=Math.max(Yi,Math.min(L,window.innerWidth-A-Yi)),O=window.innerHeight-C.bottom-Jc-Yi,I=C.top-Jc-Yi,z=f.direction==="up",X=(z?R<=I:R<=O)?z:I>O;k({left:H,maxHeight:Math.max(0,X?I:O),...X?{bottom:window.innerHeight-C.top+Jc}:{top:C.bottom+Jc}})},[n,f?.direction,f?.align,s]);v.useLayoutEffect(w,[w]),v.useEffect(()=>{if(!n||!f)return;const C=T=>{p.current?.contains(T.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 j=`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?Ql.createPortal(l.jsx("div",{ref:p,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 - ${Yi*2}px)`,...c},className:j,children:s}),document.body):l.jsx("div",{ref:p,...c!==void 0?{style:c}:{},className:`absolute ${j}`,children:s}))]})}function _4(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 I4(e){return _4(e)%360}function Wv(e){const n=I4(e);return{bg:`hsl(${n} 55% 50% / 0.14)`,fg:`hsl(${n} 55% 28%)`,fgDark:`hsl(${n} 55% 73%)`}}const Jy=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function e1(e){if(e){if(!Jy)return Array.from(e)[0];for(const n of Jy.segment(e))return n.segment}}function Kv(e,n){const r=e1(e.trim())??e1((n??"").trim());return r?r.toUpperCase():"?"}function da({id:e,name:n,size:r=18,className:s}){const o=Wv(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:Kv(n??"",e)})]})}function An({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 L4={success:2500,info:4e3,error:6e3};let Ur=[],O4=1;const ch=new Set;function uh(){for(const e of ch)e(Ur)}const D4=160;function Yv(e){const n=Ur.find(r=>r.id===e);!n||n.leaving||(Ur=Ur.map(r=>r.id===e?{...r,leaving:!0}:r),uh(),setTimeout(()=>{Ur=Ur.filter(r=>r.id!==e),uh()},D4))}function sp(e,n){if(!n)return;const r=O4++;Ur=[...Ur,{id:r,kind:e,text:n}],uh(),setTimeout(()=>Yv(r),L4[e])}const oa=e=>sp("success",e),ft=e=>sp("error",e),ws=e=>sp("info",e),z4={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 U4(){const[e,n]=v.useState(Ur);return v.useEffect(()=>(ch.add(n),()=>{ch.delete(n)}),[]),e.length===0?null:Ql.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:()=>Yv(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"} ${z4[r.kind]}`,children:r.text},r.id))}),document.body)}function Yu({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 $4={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 Jt({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 ${$4[e]}`,children:n})}function B4(e){switch(e){case"completed":return"green";case"aborted":return"amber";default:return"red"}}const Qi=[];function dn({open:e,title:n,onClose:r,children:s,footer:o,widthClass:c,headerless:d}){return v.useEffect(()=>{if(!e)return;const f=Symbol("modal");Qi.push(f);const m=h=>{h.key==="Escape"&&Qi[Qi.length-1]===f&&r()};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);const h=Qi.lastIndexOf(f);h!==-1&&Qi.splice(h,1)}},[e,r]),e?Ql.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(ap,{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 H4={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"},P4={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 ve({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 ${H4[e]} ${P4[n]} ${r??""}`,...s})}function F4({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 fa({open:e,title:n,onClose:r,onConfirm:s,confirmLabel:o,tone:c="danger",busy:d=!1,children:f}){return l.jsxs(dn,{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(F4,{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(ve,{size:"sm",onClick:r,disabled:d,children:x.common.cancel}),l.jsx(ve,{size:"sm",variant:c,disabled:d,onClick:s,children:o??x.common.confirm})]})]})}function Qu(){const[e,n]=v.useState(null),r=l.jsx(fa,{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 lp="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",Qv="w-full px-3 py-1.5 text-left transition-colors duration-150";function Pl({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 Xv({children:e}){return l.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:e})}function xs({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 Lo({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(Pl,{required:o,children:e}),c,r?l.jsx(xs,{id:s,children:r}):n?l.jsx(Xv,{children:n}):null]})}const Zv=`w-full ${lp} placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500`,ip={base:"px-3 py-2 text-base",sm:"px-2 py-1 text-xs"},Xu="!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 op(e,n){return e!==void 0&&e!=="off"?{autoComplete:e}:{autoComplete:n?"new-password":"off","data-1p-ignore":"","data-lpignore":"true","data-bwignore":"","data-form-type":"other"}}const Zu=op(void 0,!1);function Ze({label:e,hint:n,error:r,invalid:s,required:o,size:c="base",className:d,autoComplete:f,...m}){const h=!!r||!!s,p=v.useId();return l.jsx(Lo,{label:e,hint:n,error:r,errorId:p,required:o,children:l.jsx("input",{className:`${Zv} ${ip[c]} ${h?Xu:""} ${d??""}`,"aria-invalid":h?!0:void 0,"aria-required":o||void 0,"aria-describedby":r?p:void 0,...op(f,m.type==="password"),...m})})}const ql=v.forwardRef(function({label:n,hint:r,error:s,invalid:o,required:c,mono:d,size:f="base",className:m,autoComplete:h,...p},y){const k=!!s||!!o,w=v.useId();return l.jsx(Lo,{label:n,hint:r,error:s,errorId:w,required:c,children:l.jsx("textarea",{ref:y,className:`${Zv} px-3 py-2 ${f==="sm"?"text-xs leading-relaxed":"text-base"} ${d?"font-mono":""} ${k?Xu:""} ${m??""}`,"aria-invalid":k?!0:void 0,"aria-required":c||void 0,"aria-describedby":s?w:void 0,...op(h,!1),...p})})});function Bl({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 Vt({className:e}){return l.jsx("div",{className:`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${e??"h-4 w-full"}`})}function Ia({rows:e=3}){return l.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:e},(n,r)=>l.jsx(Vt,{className:"h-8 w-full"},r))})}function Jv({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(Vt,{className:"h-3 w-20"}),l.jsx(Vt,{className:"mt-2.5 h-6 w-28"}),l.jsx(Vt,{className:"mt-2.5 h-3 w-24"})]})})}function hr(e){v.useEffect(()=>{document.title=e?`${e} · ${x.appName}`:x.appName},[e])}var q4=["partial_text","partial_thinking","partial_tool_call","partial_tool_call_output"];function _u(e){return q4.includes(e.type??"")}function cp(e){return e.type==="event_msg"}function V4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function up(e,n){return`[${e}]
128
+ ${n}
129
+ [/${e}]`}function Oo(e,n,r=""){const s=V4(e);return[new RegExp(`\\[${s}\\]${n}\\[/${s}\\]`,r),new RegExp(`<${s}>${n}</${s}>`,r)]}function Ju(e,n){return e[0].exec(n)??e[1].exec(n)}var dr={summary:"summary",userSteering:"user_steering",useSkills:"use_skills",handoffFrom:"handoff_from",scheduledTask:"scheduled_task",modelSwitchFrom:"model_switch_from"},G4="[attached image: ",W4="[attached file: ",K4=/^\[attached image: (.+)\]$/,Y4=/^\[attached file: (.+)\]$/;function Q4(e){return K4.exec(e)?.[1]??null}function X4(e){return Y4.exec(e)?.[1]??null}Oo(dr.summary,"([\\s\\S]*?)");function dh(e,n){if(e.length===0)return n;const r=up(dr.useSkills,`skills: ${e.join(", ")}`);return n?`${r}
130
+
131
+ ${n}`:r}var Z4=Oo(dr.useSkills,"\\nskills: ([^\\n]+)\\n");function J4(e){const n=Ju(Z4,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 ek(e){const n=/^([\w-]+) \((.*)\)$/.exec(e);return n?{id:n[1],label:n[2]}:{id:e}}function dp(e,n){const r=new RegExp(`^(${n.join("|")}): (.+)$`),s=[];for(const o of e.split(`
132
+ `)){const c=r.exec(o);c&&s.push([c[1],c[2]])}return s}function eC(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}`),up(dr.handoffFrom,["The user handed this conversation to you from another one; 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(`
133
+ `))}var tC=Oo(dr.handoffFrom,"\\n([\\s\\S]*)\\n","");function nC(e){const n=e.trim(),r=Ju(tC,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const s={agentId:""};for(const[o,c]of dp(r[1],["agent","session","workspace"])){if(o==="workspace"){s.workspace=c;continue}const{id:d,label:f}=ek(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 aC=Oo(dr.scheduledTask,"\\n([\\s\\S]*?)\\n");function rC(e){const n=Ju(aC,e);if(!n||n.index!==0)return null;const r={name:"",firedAt:""};for(const[s,o]of dp(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 sC(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}`),up(dr.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(`
134
+ `))}var lC=Oo(dr.modelSwitchFrom,"\\n([\\s\\S]*)\\n");function iC(e){const n=e.trim(),r=Ju(lC,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 dp(r[1],o))if(c==="session"){const{id:f,label:m}=ek(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 oC=new RegExp(`^\\[${dr.userSteering}\\]\\n([\\s\\S]*?)\\n\\[/${dr.userSteering}\\]\\s*$`);function cC(e){const n=oC.exec(e);return n?n[1]:null}function uC(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 tk(e,n){return n?(e.cacheRead*n.cacheRead+e.cacheWrite*n.cacheWrite+e.output*n.output)/1e6:null}function dC(){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 nk(e,n){e.taskCacheRead+=n.request.cache_read,e.taskCacheWrite+=n.request.cache_write,e.taskOutput+=n.request.output}function fC(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,nk(e,n),e.contextNow=n.request.total,e.contextStale=!1,e.taskMainOutput+=n.request.output,e.hasUsage=!0}function mC(e){e.pendingCompactionTokens!==0&&(e.taskTokens+=e.pendingCompactionTokens,e.taskCacheRead+=e.pendingCompactionCacheRead,e.taskCacheWrite+=e.pendingCompactionCacheWrite,e.taskOutput+=e.pendingCompactionOutput,e.hasUsage=!0,fp(e))}function fp(e){e.pendingCompactionTokens=0,e.pendingCompactionCacheRead=0,e.pendingCompactionCacheWrite=0,e.pendingCompactionOutput=0}function hC(e,n){n>0&&(e.taskLlmMs+=n)}function pC(e,n){e.taskTokens+=n.request.total,nk(e,n),e.subagentTotal+=n.request.total,e.hasUsage=!0}function gC(e){e.compactionActive=!0}function xC(e,n){e.compactionActive=!1,n==="completed"&&(e.contextStale=!0)}function yC(e){e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,fp(e),e.hasUsage=!1,e.compactionActive=!1}function bC(e,n){if(e.sessionElapsedMs+=n,fp(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:oh(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 vC(e,n,r,s){const o=n&&r!=null?Math.max(0,s-r):0;return e.sessionElapsedMs+o}function kC(e,n){const r=e.tokensByBucket;return`[${n.stats}] ${n.input} ${lt(r.cacheRead+r.cacheWrite)}${n.parenOpen}${n.cached} ${lt(r.cacheRead)}${n.parenClose} · ${n.output} ${lt(r.output)} · ${Au(e.outputTps)}`}function wC(e){return e==="failed"||e==="timeout"||e==="malformed"}function ak(e,n){return{items:[],nested:e,meta:null,stats:dC(),openText:null,openThinking:null,pendingText:null,pendingThinking:null,openSteering: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 ju(e=new Set){return ak(!1,e)}function SC(e,n){return e===null?!1:n===null||e>n}function Yn(e){return e.nextItemId++}function Iu(e,n,r=Date.now()){if(n.origin&&n.origin.length>0){zC(e,n,r);return}if(jC(n)||(e.openSteering=null),n.type==="model_msg"){if(e.stats.compactionActive){Aa(e,n.timestamp),wm(e,n.timestamp);return}if(_u(n.payload)){Aa(e,n.timestamp),IC(e,n.payload,Fa(n.timestamp));return}LC(e,n.payload,n.timestamp,r),wm(e,n.timestamp);return}if(cp(n)){Aa(e,n.timestamp),OC(e,n.payload,Fa(n.timestamp),r),wm(e,n.timestamp);return}if(n.type==="session_meta"&&e.nested){const s=n.payload,o={agentId:NC(s.agent_state),provider:s.provider,modelId:s.model_id};s.source!==void 0&&(o.source=s.source),e.meta=o}}function jC(e){return e.type==="model_msg"&&e.payload.type==="image_url"}function NC(e){const n=e.split(/[\\/]/).filter(r=>r.length>0);return n.length>=2?n[n.length-2]:null}function CC(e,n){const r=n.join("/");for(const s of e)if(s.startsWith(`${r} `)||s.startsWith(`${r}/`))return!0;return!1}function Fa(e){const n=Date.parse(e);return Number.isFinite(n)?n:void 0}function wm(e,n){const r=Date.parse(n);Number.isFinite(r)&&(e.lastTsMs=r)}function TC(e,n,r=Date.now(),s=null){for(const o of n)Iu(e,o,r);if(e.taskOpen){const o=e.taskLastTsMs-e.taskFirstTsMs,c=s===null?0:s-e.taskFirstTsMs;e.taskStartLocalMs=r-Math.max(0,o,c)}}function MC(e){mp(e)}function EC(e){mp(e)}function AC(e,n){e.localDecisions.add(n)}function Vl(e,n){return`${e?.join("/")??""} ${n}`}function RC(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 Aa(e,n){if(!e.taskOpen||e.stats.compactionActive)return;const r=Date.parse(n);!Number.isFinite(r)||r<=e.taskLastTsMs||(e.taskLastTsMs=r)}function t1(e,n,r){mp(e);const s=ph(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,yC(e.stats)}function mp(e){if(!e.taskOpen)return;e.taskOpen=!1,rk(e);const n=e.taskLastReqEndMs??e.taskLastTsMs,r=Math.max(0,n-e.taskFirstTsMs),s=bC(e.stats,r);if(e.nested)return;const o=_C(e);if(s===null&&o.text==="")return;const c={kind:"task_stats",id:Yn(e),stats:s,assistantText:o.text,...o.atMs!==void 0?{atMs:o.atMs}:{}};let d=e.items.length;for(;d>0&&e.items[d-1].kind==="compaction";)d--;e.items.splice(d,0,c)}function _C(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(`
135
+
136
+ `),...r!==void 0?{atMs:r}:{}}}function IC(e,n,r){switch(n.type){case"partial_text":{if(n.event_type==="start"){e.pendingText=null;const o={kind:"assistant_text",id:Yn(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:Yn(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),fh(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=hh(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),sk(s,r));return}}}function LC(e,n,r,s){switch(n.type){case"text":{if(n.role==="user"){if(n.text.startsWith("[context_summary]")||n.text.startsWith("<context_summary>")){Aa(e,r);return}const f=cC(n.text);if(f!==null){Aa(e,r);const h=Fa(r),p={kind:"user_steering",id:Yn(e),text:f,...h!==void 0?{atMs:h}:{}};e.items.push(p),e.openSteering=p;return}t1(e,r,s);const m=Fa(r);e.items.push({kind:"user_text",id:Yn(e),text:n.text,...m!==void 0?{atMs:m}:{}});return}Aa(e,r);const o=e.pendingText??e.openText;if(o){if(!n.text.trim()){ho(e,o),o===e.openText&&(e.openText=null),e.pendingText=null;return}o.text=n.text,o.streaming=!1;const f=Fa(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}if(!n.text.trim())return;const c=Fa(r),d={kind:"assistant_text",id:Yn(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":{if(e.openSteering){Aa(e,r),e.openSteering.images=[...e.openSteering.images??[],n.image_url];return}t1(e,r,s);const o=Fa(r);e.items.push({kind:"user_image",id:Yn(e),imageUrl:n.image_url,...o!==void 0?{atMs:o}:{}});return}case"thinking":{Aa(e,r);const o=Fa(r),c=e.pendingThinking??e.openThinking;if(c){if(!n.thinking.trim()){ho(e,c),c===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}c.thinking=n.thinking,c.streaming=!1,n.stop_reason!==void 0&&(c.stopReason=n.stop_reason),fh(c,o),c===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}if(!n.thinking.trim())return;const d={kind:"thinking",id:Yn(e),thinking:n.thinking,streaming:!1};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.lastTsMs>0&&(d.startedAtMs=e.lastTsMs),fh(d,o),e.items.push(d);return}case"tool_call":{Aa(e,r);const o=Fa(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),mh(e,d),n1(d);return}c&&!c.outputComplete&&(c.outputComplete=!0,c.outputStreaming=!1,c.outputStopReason??="aborted");const f=hh(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),mh(e,f),e.lastTsMs>0&&(f.argStartedAtMs=e.lastTsMs),n1(f);return}case"tool_call_output":{Aa(e,r);let o=e.toolCards.get(n.tool_call_id);o||(o=hh(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),sk(o,Fa(r));return}case"inline_data":case"inline_thinking":Aa(e,r);return}}function rk(e){for(const n of e.toolCards.values())n.callComplete&&!n.outputComplete&&(n.outputComplete=!0,n.outputStreaming=!1,n.outputStopReason??="aborted")}function n1(e){!e.callStopReason||e.callStopReason==="completed"||e.outputComplete||(e.outputComplete=!0,e.outputStreaming=!1,e.outputStopReason??=e.callStopReason)}function fh(e,n){n===void 0||e.startedAtMs===void 0||(e.durationMs=Math.max(0,n-e.startedAtMs))}function sk(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 mh(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 hh(e,n){const r={kind:"tool_call",id:Yn(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 OC(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),mh(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":{rk(e);const o=ph(e);o&&(o.gaveUp=!0),e.reconnectRun=0;const c={kind:"abort",id:Yn(e)};n.reason!=null&&(c.reason=n.reason),e.items.push(c);return}case"token_usage":fC(e.stats,n);return;case"compaction_begin":{gC(e.stats),e.items.push({kind:"compaction",id:Yn(e),reason:n.reason,mode:n.mode,running:!0});return}case"compaction_end":{xC(e.stats,n.status);const o=DC(e);if(o)o.running=!1,o.status=n.status;else{const c={kind:"compaction",id:Yn(e),reason:n.reason,mode:n.mode,running:!1,status:n.status};e.items.push(c)}return}case"request_begin":{const o=ph(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&&hC(e.stats,r-e.openRequestBeginMs-e.openApprovalWaitMs),e.openRequestBeginMs=null,e.openApprovalWaitMs=0,r!==void 0&&(e.taskLastReqEndMs=r),mC(e.stats),wC(n.status)){e.reconnectRun+=1;const o={kind:"reconnect",id:Yn(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 DC(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 ph(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 zC(e,n,r){const s=n.origin[0];cp(n)&&n.payload.type==="token_usage"&&pC(e.stats,n.payload),Aa(e,n.timestamp);let o=e.subagents.get(s);o||(o=ak(!0,e.localDecisions),o.firstSeenLocalMs=r,e.subagents.set(s,o),UC(e,s,o)),o.lastActivityLocalMs=r;const c=Fa(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,Iu(o,f,r)}function UC(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:Yn(e),sessionId:n,model:r})}function $C(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 BC(e,n){return e.has(JSON.stringify(n))}function lk(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,lk(s,c);return}if(n.type!=="model_msg"||_u(n.payload))return;const r=n.payload;switch(r.type){case"text":{if(r.role!=="assistant")return;const s=e.pendingText??e.openText;s&&(ho(e,s),s===e.openText&&(e.openText=null),e.pendingText=null);return}case"thinking":{const s=e.pendingThinking??e.openThinking;s&&(ho(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&&(ho(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 ho(e,n){const r=e.items.indexOf(n);r>=0&&e.items.splice(r,1)}function fr({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 on={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"},ik=/[/\\]scratchpad[/\\]([^/\\]+)[/\\]([^/\\]+)$/;function HC(e){if(/^https?:\/\//i.test(e))return e;const n=ik.exec(e);return n?`/api/sessions/${encodeURIComponent(n[1])}/scratchpad/${encodeURIComponent(n[2])}`:null}function a1(e){if(!e.includes(G4)&&!e.includes(W4))return{text:e,images:[],files:[]};const n=[],r=[],s=[];for(const o of e.split(`
137
+ `)){const c=o.trim(),d=Q4(c),f=d!==null?HC(d):null;if(f){r.push(f);continue}const m=X4(c);if(m!==null&&ik.test(m)){s.push(m);continue}n.push(o)}return{text:n.join(`
138
+ `).replace(/\n+$/,""),images:r,files:s}}function PC(e){const n=e.split(/[/\\]/);return n[n.length-1]||e}function FC(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const qC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GC={};function r1(e,n){return(GC.jsx?VC:qC).test(e)}const WC=/[ \t\n\f\r]/g;function KC(e){return typeof e=="object"?e.type==="text"?s1(e.value):!1:s1(e)}function s1(e){return e.replace(WC,"")===""}class Do{constructor(n,r,s){this.normal=r,this.property=n,s&&(this.space=s)}}Do.prototype.normal={};Do.prototype.property={};Do.prototype.space=void 0;function ok(e,n){const r={},s={};for(const o of e)Object.assign(r,o.property),Object.assign(s,o.normal);return new Do(r,s,n)}function gh(e){return e.toLowerCase()}class Qn{constructor(n,r){this.attribute=r,this.property=n}}Qn.prototype.attribute="";Qn.prototype.booleanish=!1;Qn.prototype.boolean=!1;Qn.prototype.commaOrSpaceSeparated=!1;Qn.prototype.commaSeparated=!1;Qn.prototype.defined=!1;Qn.prototype.mustUseProperty=!1;Qn.prototype.number=!1;Qn.prototype.overloadedBoolean=!1;Qn.prototype.property="";Qn.prototype.spaceSeparated=!1;Qn.prototype.space=void 0;let YC=0;const Fe=tl(),ln=tl(),xh=tl(),ge=tl(),Mt=tl(),Qs=tl(),la=tl();function tl(){return 2**++YC}const yh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fe,booleanish:ln,commaOrSpaceSeparated:la,commaSeparated:Qs,number:ge,overloadedBoolean:xh,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),Sm=Object.keys(yh);class hp extends Qn{constructor(n,r,s,o){let c=-1;if(super(n,r),l1(this,"space",o),typeof s=="number")for(;++c<Sm.length;){const d=Sm[c];l1(this,Sm[c],(s&yh[d])===yh[d])}}}hp.prototype.defined=!0;function l1(e,n,r){r&&(e[n]=r)}function Xl(e){const n={},r={};for(const[s,o]of Object.entries(e.properties)){const c=new hp(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),n[s]=c,r[gh(s)]=s,r[gh(c.attribute)]=s}return new Do(n,r,e.space)}const ck=Xl({properties:{ariaActiveDescendant:null,ariaAtomic:ln,ariaAutoComplete:null,ariaBusy:ln,ariaChecked:ln,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:Mt,ariaCurrent:null,ariaDescribedBy:Mt,ariaDetails:null,ariaDisabled:ln,ariaDropEffect:Mt,ariaErrorMessage:null,ariaExpanded:ln,ariaFlowTo:Mt,ariaGrabbed:ln,ariaHasPopup:null,ariaHidden:ln,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Mt,ariaLevel:ge,ariaLive:null,ariaModal:ln,ariaMultiLine:ln,ariaMultiSelectable:ln,ariaOrientation:null,ariaOwns:Mt,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:ln,ariaReadOnly:ln,ariaRelevant:null,ariaRequired:ln,ariaRoleDescription:Mt,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:ln,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function uk(e,n){return n in e?e[n]:n}function dk(e,n){return uk(e,n.toLowerCase())}const QC=Xl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qs,acceptCharset:Mt,accessKey:Mt,action:null,allow:null,allowFullScreen:Fe,allowPaymentRequest:Fe,allowUserMedia:Fe,alpha:Fe,alt:null,as:null,async:Fe,autoCapitalize:null,autoComplete:Mt,autoFocus:Fe,autoPlay:Fe,blocking:Mt,capture:null,charSet:null,checked:Fe,cite:null,className:Mt,closedBy:null,colorSpace:null,cols:ge,colSpan:ge,command:null,commandFor:null,content:null,contentEditable:ln,controls:Fe,controlsList:Mt,coords:ge|Qs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Fe,defer:Fe,dir:null,dirName:null,disabled:Fe,download:xh,draggable:ln,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Fe,formTarget:null,headers:Mt,height:ge,hidden:xh,high:ge,href:null,hrefLang:null,htmlFor:Mt,httpEquiv:Mt,id:null,imageSizes:null,imageSrcSet:null,inert:Fe,inputMode:null,integrity:null,is:null,isMap:Fe,itemId:null,itemProp:Mt,itemRef:Mt,itemScope:Fe,itemType:Mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Fe,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:Fe,muted:Fe,name:null,nonce:null,noModule:Fe,noValidate:Fe,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:Fe,optimum:ge,pattern:null,ping:Mt,placeholder:null,playsInline:Fe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Fe,referrerPolicy:null,rel:Mt,required:Fe,reversed:Fe,rows:ge,rowSpan:ge,sandbox:Mt,scope:null,scoped:Fe,seamless:Fe,selected:Fe,shadowRootClonable:Fe,shadowRootCustomElementRegistry:Fe,shadowRootDelegatesFocus:Fe,shadowRootMode:null,shadowRootSerializable:Fe,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:ln,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:Fe,useMap:null,value:ln,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Mt,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Fe,declare:Fe,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:Fe,noHref:Fe,noShade:Fe,noWrap:Fe,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:ln,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Fe,disablePictureInPicture:Fe,disableRemotePlayback:Fe,exportParts:Qs,part:Mt,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:dk}),XC=Xl({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:la,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:Mt,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:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:Fe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,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:Qs,g2:Qs,glyphName:Qs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:la,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,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:ge,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:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:la,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:la,rev:la,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:la,requiredFeatures:la,requiredFonts:la,requiredFormats:la,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:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:la,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:la,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:la,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:uk}),fk=Xl({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()}}),mk=Xl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dk}),hk=Xl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),ZC={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"},JC=/[A-Z]/g,i1=/-[a-z]/g,e3=/^data[-\w.:]+$/i;function t3(e,n){const r=gh(n);let s=n,o=Qn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&e3.test(n)){if(n.charAt(4)==="-"){const c=n.slice(5).replace(i1,a3);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=n.slice(4);if(!i1.test(c)){let d=c.replace(JC,n3);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=hp}return new o(s,n)}function n3(e){return"-"+e.toLowerCase()}function a3(e){return e.charAt(1).toUpperCase()}const r3=ok([ck,QC,fk,mk,hk],"html"),pp=ok([ck,XC,fk,mk,hk],"svg");function s3(e){return e.join(" ").trim()}var Dl={},jm,o1;function l3(){if(o1)return jm;o1=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=`
139
+ `,h="/",p="*",y="",k="comment",w="declaration";function j(T,A){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];A=A||{};var R=1,L=1;function H(ee){var B=ee.match(n);B&&(R+=B.length);var U=ee.lastIndexOf(m);L=~U?ee.length-U:L+ee.length}function O(){var ee={line:R,column:L};return function(B){return B.position=new I(ee),X(),B}}function I(ee){this.start=ee,this.end={line:R,column:L},this.source=A.source}I.prototype.content=T;function z(ee){var B=new Error(A.source+":"+R+":"+L+": "+ee);if(B.reason=ee,B.filename=A.source,B.line=R,B.column=L,B.source=T,!A.silent)throw B}function W(ee){var B=ee.exec(T);if(B){var U=B[0];return H(U),T=T.slice(U.length),B}}function X(){W(r)}function D(ee){var B;for(ee=ee||[];B=q();)B!==!1&&ee.push(B);return ee}function q(){var ee=O();if(!(h!=T.charAt(0)||p!=T.charAt(1))){for(var B=2;y!=T.charAt(B)&&(p!=T.charAt(B)||h!=T.charAt(B+1));)++B;if(B+=2,y===T.charAt(B-1))return z("End of comment missing");var U=T.slice(2,B-2);return L+=2,H(U),T=T.slice(B),L+=2,ee({type:k,comment:U})}}function P(){var ee=O(),B=W(s);if(B){if(q(),!W(o))return z("property missing ':'");var U=W(c),F=ee({type:w,property:C(B[0].replace(e,y)),value:U?C(U[0].replace(e,y)):y});return W(d),F}}function K(){var ee=[];D(ee);for(var B;B=P();)B!==!1&&(ee.push(B),D(ee));return ee}return X(),K()}function C(T){return T?T.replace(f,y):y}return jm=j,jm}var c1;function i3(){if(c1)return Dl;c1=1;var e=Dl&&Dl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Dl,"__esModule",{value:!0}),Dl.default=r;const n=e(l3());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:p}=m;f?o(h,p,m):p&&(c=c||{},c[h]=p)}),c}return Dl}var Xi={},u1;function o3(){if(u1)return Xi;u1=1,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.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,p){return p.toUpperCase()},f=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),c(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(o,f):h=h.replace(s,f),h.replace(n,d))};return Xi.camelCase=m,Xi}var Zi,d1;function c3(){if(d1)return Zi;d1=1;var e=Zi&&Zi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(i3()),r=o3();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,Zi=s,Zi}var u3=c3();const d3=Zb(u3),pk=gk("end"),gp=gk("start");function gk(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 f3(e){const n=gp(e),r=pk(e);if(n&&r)return{start:n,end:r}}function po(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?f1(e.position):"start"in e||"end"in e?f1(e):"line"in e||"column"in e?bh(e):""}function bh(e){return m1(e&&e.line)+":"+m1(e&&e.column)}function f1(e){return bh(e&&e.start)+"-"+bh(e&&e.end)}function m1(e){return e&&typeof e=="number"?e:1}class Rn 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=po(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}}Rn.prototype.file="";Rn.prototype.name="";Rn.prototype.reason="";Rn.prototype.message="";Rn.prototype.stack="";Rn.prototype.column=void 0;Rn.prototype.line=void 0;Rn.prototype.ancestors=void 0;Rn.prototype.cause=void 0;Rn.prototype.fatal=void 0;Rn.prototype.place=void 0;Rn.prototype.ruleId=void 0;Rn.prototype.source=void 0;const xp={}.hasOwnProperty,m3=new Map,h3=/[A-Z]/g,p3=new Set(["table","tbody","thead","tfoot","tr"]),g3=new Set(["td","th"]),xk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function x3(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=N3(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=j3(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"?pp:r3,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},c=yk(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function yk(e,n,r){if(n.type==="element")return y3(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return b3(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return k3(e,n,r);if(n.type==="mdxjsEsm")return v3(e,n);if(n.type==="root")return w3(e,n,r);if(n.type==="text")return S3(e,n)}function y3(e,n,r){const s=e.schema;let o=s;n.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=pp,e.schema=o),e.ancestors.push(n);const c=vk(e,n.tagName,!1),d=C3(e,n);let f=bp(e,n);return p3.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!KC(m):!0})),bk(e,d,c,n),yp(d,f),e.ancestors.pop(),e.schema=s,e.create(n,c,d,r)}function b3(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)}Co(e,n.position)}function v3(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Co(e,n.position)}function k3(e,n,r){const s=e.schema;let o=s;n.name==="svg"&&s.space==="html"&&(o=pp,e.schema=o),e.ancestors.push(n);const c=n.name===null?e.Fragment:vk(e,n.name,!0),d=T3(e,n),f=bp(e,n);return bk(e,d,c,n),yp(d,f),e.ancestors.pop(),e.schema=s,e.create(n,c,d,r)}function w3(e,n,r){const s={};return yp(s,bp(e,n)),e.create(n,e.Fragment,s,r)}function S3(e,n){return n.value}function bk(e,n,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=s)}function yp(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function j3(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 N3(e,n){return r;function r(s,o,c,d){const f=Array.isArray(c.children),m=gp(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 C3(e,n){const r={};let s,o;for(o in n.properties)if(o!=="children"&&xp.call(n.properties,o)){const c=M3(e,o,n.properties[o]);if(c){const[d,f]=c;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&g3.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 T3(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 Co(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 Co(e,n.position);else c=s.value===null?!0:s.value;r[o]=c}return r}function bp(e,n){const r=[];let s=-1;const o=e.passKeys?new Map:m3;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=yk(e,c,d);f!==void 0&&r.push(f)}return r}function M3(e,n,r){const s=t3(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?FC(r):s3(r)),s.property==="style"){let o=typeof r=="object"?r:E3(e,String(r));return e.stylePropertyNameCase==="css"&&(o=A3(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?ZC[s.property]||s.property:s.attribute,r]}}function E3(e,n){try{return d3(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,o=new Rn("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=xk+"#cannot-parse-style-attribute",o}}function vk(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=r1(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=r1(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(s.type==="Literal"){const o=s.value;return xp.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);Co(e)}function Co(e,n){const r=new Rn("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=xk+"#cannot-handle-mdx-estrees-without-createevaluater",r}function A3(e){const n={};let r;for(r in e)xp.call(e,r)&&(n[R3(r)]=e[r]);return n}function R3(e){let n=e.replace(h3,_3);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function _3(e){return"-"+e.toLowerCase()}const Nm={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"]},I3={};function vp(e,n){const r=I3,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return kk(e,s,o)}function kk(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 h1(e.children,n,r)}return Array.isArray(e)?h1(e,n,r):""}function h1(e,n,r){const s=[];let o=-1;for(;++o<e.length;)s[o]=kk(e[o],n,r);return s.join("")}function L3(e){return!!(e&&typeof e=="object")}const p1=document.createElement("i");function kp(e){const n="&"+e+";";p1.innerHTML=n;const r=p1.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function ca(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 _a(e,n){return e.length>0?(ca(e,e.length,0,n),e):n}const g1={}.hasOwnProperty;function wk(e){const n={};let r=-1;for(;++r<e.length;)O3(n,e[r]);return n}function O3(e,n){let r;for(r in n){const o=(g1.call(e,r)?e[r]:void 0)||(e[r]={}),c=n[r];let d;if(c)for(d in c){g1.call(o,d)||(o[d]=[]);const f=c[d];D3(o[d],Array.isArray(f)?f:f?[f]:[])}}}function D3(e,n){let r=-1;const s=[];for(;++r<n.length;)(n[r].add==="after"?e:s).push(n[r]);ca(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=Ss(/[A-Za-z]/),En=Ss(/[\dA-Za-z]/),z3=Ss(/[#-'*+\--9=?A-Z^-~]/);function Lu(e){return e!==null&&(e<32||e===127)}const vh=Ss(/\d/),U3=Ss(/[\dA-Fa-f]/),$3=Ss(/[!-/:-@[-`{-~]/);function Ie(e){return e!==null&&e<-2}function Et(e){return e!==null&&(e<0||e===32)}function Je(e){return e===-2||e===-1||e===32}const ed=Ss(new RegExp("\\p{P}|\\p{S}","u")),Zs=Ss(/\s/);function Ss(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Zl(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 st(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 B3={tokenize:H3};function H3(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"),st(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 Ie(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),d)}}const P3={tokenize:F3},x1={tokenize:q3};function F3(e){const n=this,r=[];let s=0,o,c,d;return f;function f(L){if(s<r.length){const H=r[s];return n.containerState=H[1],e.attempt(H[0].continuation,m,h)(L)}return h(L)}function m(L){if(s++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&R();const H=n.events.length;let O=H,I;for(;O--;)if(n.events[O][0]==="exit"&&n.events[O][1].type==="chunkFlow"){I=n.events[O][1].end;break}A(s);let z=H;for(;z<n.events.length;)n.events[z][1].end={...I},z++;return ca(n.events,O+1,0,n.events.slice(H)),n.events.length=z,h(L)}return f(L)}function h(L){if(s===r.length){if(!o)return k(L);if(o.currentConstruct&&o.currentConstruct.concrete)return j(L);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(x1,p,y)(L)}function p(L){return o&&R(),A(s),k(L)}function y(L){return n.parser.lazy[n.now().line]=s!==r.length,d=n.now().offset,j(L)}function k(L){return n.containerState={},e.attempt(x1,w,j)(L)}function w(L){return s++,r.push([n.currentConstruct,n.containerState]),k(L)}function j(L){if(L===null){o&&R(),A(0),e.consume(L);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),C(L)}function C(L){if(L===null){T(e.exit("chunkFlow"),!0),A(0),e.consume(L);return}return Ie(L)?(e.consume(L),T(e.exit("chunkFlow")),s=0,n.interrupt=void 0,f):(e.consume(L),C)}function T(L,H){const O=n.sliceStream(L);if(H&&O.push(null),L.previous=c,c&&(c.next=L),c=L,o.defineSkip(L.start),o.write(O),n.parser.lazy[L.start.line]){let I=o.events.length;for(;I--;)if(o.events[I][1].start.offset<d&&(!o.events[I][1].end||o.events[I][1].end.offset>d))return;const z=n.events.length;let W=z,X,D;for(;W--;)if(n.events[W][0]==="exit"&&n.events[W][1].type==="chunkFlow"){if(X){D=n.events[W][1].end;break}X=!0}for(A(s),I=z;I<n.events.length;)n.events[I][1].end={...D},I++;ca(n.events,W+1,0,n.events.slice(z)),n.events.length=I}}function A(L){let H=r.length;for(;H-- >L;){const O=r[H];n.containerState=O[1],O[0].exit.call(n,e)}r.length=L}function R(){o.write([null]),c=void 0,o=void 0,n.containerState._closeFlow=void 0}}function q3(e,n,r){return st(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Gl(e){if(e===null||Et(e)||Zs(e))return 1;if(ed(e))return 2}function td(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 kh={name:"attention",resolveAll:V3,tokenize:G3};function V3(e,n){let r=-1,s,o,c,d,f,m,h,p;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};y1(y,-m),y1(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=_a(h,[["enter",e[s][1],n],["exit",e[s][1],n]])),h=_a(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",c,n]]),h=_a(h,td(n.parser.constructs.insideSpan.null,e.slice(s+1,r),n)),h=_a(h,[["exit",c,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[r][1].end.offset-e[r][1].start.offset?(p=2,h=_a(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):p=0,ca(e,s-1,r-s+3,h),r=s+h.length-p-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function G3(e,n){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,o=Gl(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"),p=Gl(m),y=!p||p===2&&o||r.includes(m),k=!o||o===2&&p||r.includes(s);return h._open=!!(c===42?y:y&&(o||!k)),h._close=!!(c===42?k:k&&(p||!y)),n(m)}}function y1(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const W3={name:"autolink",tokenize:K3};function K3(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||Lu(w)?r(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),p):z3(w)?(e.consume(w),h):r(w)}function p(w){return En(w)?y(w):r(w)}function y(w){return w===46?(e.consume(w),s=0,p):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 j=w===45?k:y;return e.consume(w),j}return r(w)}}const zo={partial:!0,tokenize:Y3};function Y3(e,n,r){return s;function s(c){return Je(c)?st(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||Ie(c)?n(c):r(c)}}const jk={continuation:{tokenize:X3},exit:Z3,name:"blockQuote",tokenize:Q3};function Q3(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 X3(e,n,r){const s=this;return o;function o(d){return Je(d)?st(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(jk,n,r)(d)}}function Z3(e){e.exit("blockQuote")}const Nk={name:"characterEscape",tokenize:J3};function J3(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 $3(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(c)}}const Ck={name:"characterReference",tokenize:eT};function eT(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,p(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,p):(e.enter("characterReferenceValue"),c=7,d=vh,p(y))}function p(y){if(y===59&&o){const k=e.exit("characterReferenceValue");return d===En&&!kp(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),p):r(y)}}const b1={partial:!0,tokenize:nT},v1={concrete:!0,name:"codeFenced",tokenize:tT};function tT(e,n,r){const s=this,o={partial:!0,tokenize:O};let c=0,d=0,f;return m;function m(I){return h(I)}function h(I){const z=s.events[s.events.length-1];return c=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,f=I,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(I)}function p(I){return I===f?(d++,e.consume(I),p):d<3?r(I):(e.exit("codeFencedFenceSequence"),Je(I)?st(e,y,"whitespace")(I):y(I))}function y(I){return I===null||Ie(I)?(e.exit("codeFencedFence"),s.interrupt?n(I):e.check(b1,C,H)(I)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),k(I))}function k(I){return I===null||Ie(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(I)):Je(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),st(e,w,"whitespace")(I)):I===96&&I===f?r(I):(e.consume(I),k)}function w(I){return I===null||Ie(I)?y(I):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(I))}function j(I){return I===null||Ie(I)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(I)):I===96&&I===f?r(I):(e.consume(I),j)}function C(I){return e.attempt(o,H,T)(I)}function T(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),A}function A(I){return c>0&&Je(I)?st(e,R,"linePrefix",c+1)(I):R(I)}function R(I){return I===null||Ie(I)?e.check(b1,C,H)(I):(e.enter("codeFlowValue"),L(I))}function L(I){return I===null||Ie(I)?(e.exit("codeFlowValue"),R(I)):(e.consume(I),L)}function H(I){return e.exit("codeFenced"),n(I)}function O(I,z,W){let X=0;return D;function D(B){return I.enter("lineEnding"),I.consume(B),I.exit("lineEnding"),q}function q(B){return I.enter("codeFencedFence"),Je(B)?st(I,P,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):P(B)}function P(B){return B===f?(I.enter("codeFencedFenceSequence"),K(B)):W(B)}function K(B){return B===f?(X++,I.consume(B),K):X>=d?(I.exit("codeFencedFenceSequence"),Je(B)?st(I,ee,"whitespace")(B):ee(B)):W(B)}function ee(B){return B===null||Ie(B)?(I.exit("codeFencedFence"),z(B)):W(B)}}}function nT(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 Cm={name:"codeIndented",tokenize:rT},aT={partial:!0,tokenize:sT};function rT(e,n,r){const s=this;return o;function o(h){return e.enter("codeIndented"),st(e,c,"linePrefix",5)(h)}function c(h){const p=s.events[s.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?d(h):r(h)}function d(h){return h===null?m(h):Ie(h)?e.attempt(aT,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Ie(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),n(h)}}function sT(e,n,r){const s=this;return o;function o(d){return s.parser.lazy[s.now().line]?r(d):Ie(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):st(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):Ie(d)?o(d):r(d)}}const lT={name:"codeText",previous:oT,resolve:iT,tokenize:cT};function iT(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 oT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function cT(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,p(y)):Ie(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||Ie(y)?(e.exit("codeTextData"),m(y)):(e.consume(y),h)}function p(y){return y===96?(e.consume(y),o++,p):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),n(y)):(c.type="codeTextData",h(y))}}class uT{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&&Ji(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),Ji(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Ji(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);Ji(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Ji(this.left,r.reverse())}}}function Ji(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 Tk(e){const n={};let r=-1,s,o,c,d,f,m,h;const p=new uT(e);for(;++r<p.length;){for(;r in n;)r=n[r];if(s=p.get(r),r&&s[1].type==="chunkFlow"&&p.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,dT(p,r)),r=n[r],h=!0);else if(s[1]._container){for(c=r,o=void 0;c--;)if(d=p.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(p.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={...p.get(o)[1].start},f=p.slice(o,r),f.unshift(s),p.splice(o,r-o+1,f))}}return ca(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function dT(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 p,y,k=-1,w=r,j=0,C=0;const T=[C];for(;w;){for(;e.get(++o)[1]!==w;);c.push(o),w._tokenizer||(p=s.sliceStream(w),w.next||p.push(null),y&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(p),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,T.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):T.pop(),k=T.length;k--;){const A=f.slice(T[k],T[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[j+m[k][0]]=j+m[k][1],j+=m[k][1]-m[k][0]-1;return h}const fT={resolve:hT,tokenize:pT},mT={partial:!0,tokenize:gT};function hT(e){return Tk(e),e}function pT(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):Ie(f)?e.check(mT,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 gT(e,n,r){const s=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),st(e,c,"linePrefix")}function c(d){if(d===null||Ie(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 Mk(e,n,r,s,o,c,d,f,m){const h=m||Number.POSITIVE_INFINITY;let p=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||Lu(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||Ie(A)?r(A):(e.consume(A),A===92?j:w)}function j(A){return A===60||A===62||A===92?(e.consume(A),w):w(A)}function C(A){return!p&&(A===null||A===41||Et(A))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(s),n(A)):p<h&&A===40?(e.consume(A),p++,C):A===41?(e.consume(A),p--,C):A===null||A===32||A===40||Lu(A)?r(A):(e.consume(A),A===92?T:C)}function T(A){return A===40||A===41||A===92?(e.consume(A),C):C(A)}}function Ek(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),p}function p(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):Ie(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Ie(w)||f++>999?(e.exit("chunkString"),p(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 Ak(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):Ie(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),st(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===d||k===null||Ie(k)?(e.exit("chunkString"),h(k)):(e.consume(k),k===92?y:p)}function y(k){return k===d||k===92?(e.consume(k),p):p(k)}}function go(e,n){let r;return s;function s(o){return Ie(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,s):Je(o)?st(e,s,r?"linePrefix":"lineSuffix")(o):n(o)}}const xT={name:"definition",tokenize:bT},yT={partial:!0,tokenize:vT};function bT(e,n,r){const s=this;let o;return c;function c(w){return e.enter("definition"),d(w)}function d(w){return Ek.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 Et(w)?go(e,h)(w):h(w)}function h(w){return Mk(e,p,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(yT,y,y)(w)}function y(w){return Je(w)?st(e,k,"whitespace")(w):k(w)}function k(w){return w===null||Ie(w)?(e.exit("definition"),s.parser.defined.push(o),n(w)):r(w)}}function vT(e,n,r){return s;function s(f){return Et(f)?go(e,o)(f):r(f)}function o(f){return Ak(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return Je(f)?st(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Ie(f)?n(f):r(f)}}const kT={name:"hardBreakEscape",tokenize:wT};function wT(e,n,r){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return Ie(c)?(e.exit("hardBreakEscape"),n(c)):r(c)}}const ST={name:"headingAtx",resolve:jT,tokenize:NT};function jT(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"},ca(e,s,r-s+1,[["enter",o,n],["enter",c,n],["exit",c,n],["exit",o,n]])),e}function NT(e,n,r){let s=0;return o;function o(p){return e.enter("atxHeading"),c(p)}function c(p){return e.enter("atxHeadingSequence"),d(p)}function d(p){return p===35&&s++<6?(e.consume(p),d):p===null||Et(p)?(e.exit("atxHeadingSequence"),f(p)):r(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Ie(p)?(e.exit("atxHeading"),n(p)):Je(p)?st(e,f,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),f(p))}function h(p){return p===null||p===35||Et(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const CT=["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"],k1=["pre","script","style","textarea"],TT={concrete:!0,name:"htmlFlow",resolveTo:AT,tokenize:RT},MT={partial:!0,tokenize:IT},ET={partial:!0,tokenize:_T};function AT(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 RT(e,n,r){const s=this;let o,c,d,f,m;return h;function h(N){return p(N)}function p(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),y}function y(N){return N===33?(e.consume(N),k):N===47?(e.consume(N),c=!0,C):N===63?(e.consume(N),o=3,s.interrupt?n:E):zn(N)?(e.consume(N),d=String.fromCharCode(N),T):r(N)}function k(N){return N===45?(e.consume(N),o=2,w):N===91?(e.consume(N),o=5,f=0,j):zn(N)?(e.consume(N),o=4,s.interrupt?n:E):r(N)}function w(N){return N===45?(e.consume(N),s.interrupt?n:E):r(N)}function j(N){const Y="CDATA[";return N===Y.charCodeAt(f++)?(e.consume(N),f===Y.length?s.interrupt?n:P:j):r(N)}function C(N){return zn(N)?(e.consume(N),d=String.fromCharCode(N),T):r(N)}function T(N){if(N===null||N===47||N===62||Et(N)){const Y=N===47,le=d.toLowerCase();return!Y&&!c&&k1.includes(le)?(o=1,s.interrupt?n(N):P(N)):CT.includes(d.toLowerCase())?(o=6,Y?(e.consume(N),A):s.interrupt?n(N):P(N)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(N):c?R(N):L(N))}return N===45||En(N)?(e.consume(N),d+=String.fromCharCode(N),T):r(N)}function A(N){return N===62?(e.consume(N),s.interrupt?n:P):r(N)}function R(N){return Je(N)?(e.consume(N),R):D(N)}function L(N){return N===47?(e.consume(N),D):N===58||N===95||zn(N)?(e.consume(N),H):Je(N)?(e.consume(N),L):D(N)}function H(N){return N===45||N===46||N===58||N===95||En(N)?(e.consume(N),H):O(N)}function O(N){return N===61?(e.consume(N),I):Je(N)?(e.consume(N),O):L(N)}function I(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),m=N,z):Je(N)?(e.consume(N),I):W(N)}function z(N){return N===m?(e.consume(N),m=null,X):N===null||Ie(N)?r(N):(e.consume(N),z)}function W(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Et(N)?O(N):(e.consume(N),W)}function X(N){return N===47||N===62||Je(N)?L(N):r(N)}function D(N){return N===62?(e.consume(N),q):r(N)}function q(N){return N===null||Ie(N)?P(N):Je(N)?(e.consume(N),q):r(N)}function P(N){return N===45&&o===2?(e.consume(N),U):N===60&&o===1?(e.consume(N),F):N===62&&o===4?(e.consume(N),M):N===63&&o===3?(e.consume(N),E):N===93&&o===5?(e.consume(N),ue):Ie(N)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(MT,$,K)(N)):N===null||Ie(N)?(e.exit("htmlFlowData"),K(N)):(e.consume(N),P)}function K(N){return e.check(ET,ee,$)(N)}function ee(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),B}function B(N){return N===null||Ie(N)?K(N):(e.enter("htmlFlowData"),P(N))}function U(N){return N===45?(e.consume(N),E):P(N)}function F(N){return N===47?(e.consume(N),d="",Z):P(N)}function Z(N){if(N===62){const Y=d.toLowerCase();return k1.includes(Y)?(e.consume(N),M):P(N)}return zn(N)&&d.length<8?(e.consume(N),d+=String.fromCharCode(N),Z):P(N)}function ue(N){return N===93?(e.consume(N),E):P(N)}function E(N){return N===62?(e.consume(N),M):N===45&&o===2?(e.consume(N),E):P(N)}function M(N){return N===null||Ie(N)?(e.exit("htmlFlowData"),$(N)):(e.consume(N),M)}function $(N){return e.exit("htmlFlow"),n(N)}}function _T(e,n,r){const s=this;return o;function o(d){return Ie(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 IT(e,n,r){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(zo,n,r)}}const LT={name:"htmlText",tokenize:OT};function OT(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),O):E===63?(e.consume(E),L):zn(E)?(e.consume(E),W):r(E)}function h(E){return E===45?(e.consume(E),p):E===91?(e.consume(E),c=0,j):zn(E)?(e.consume(E),R):r(E)}function p(E){return E===45?(e.consume(E),w):r(E)}function y(E){return E===null?r(E):E===45?(e.consume(E),k):Ie(E)?(d=y,F(E)):(e.consume(E),y)}function k(E){return E===45?(e.consume(E),w):y(E)}function w(E){return E===62?U(E):E===45?k(E):y(E)}function j(E){const M="CDATA[";return E===M.charCodeAt(c++)?(e.consume(E),c===M.length?C:j):r(E)}function C(E){return E===null?r(E):E===93?(e.consume(E),T):Ie(E)?(d=C,F(E)):(e.consume(E),C)}function T(E){return E===93?(e.consume(E),A):C(E)}function A(E){return E===62?U(E):E===93?(e.consume(E),A):C(E)}function R(E){return E===null||E===62?U(E):Ie(E)?(d=R,F(E)):(e.consume(E),R)}function L(E){return E===null?r(E):E===63?(e.consume(E),H):Ie(E)?(d=L,F(E)):(e.consume(E),L)}function H(E){return E===62?U(E):L(E)}function O(E){return zn(E)?(e.consume(E),I):r(E)}function I(E){return E===45||En(E)?(e.consume(E),I):z(E)}function z(E){return Ie(E)?(d=z,F(E)):Je(E)?(e.consume(E),z):U(E)}function W(E){return E===45||En(E)?(e.consume(E),W):E===47||E===62||Et(E)?X(E):r(E)}function X(E){return E===47?(e.consume(E),U):E===58||E===95||zn(E)?(e.consume(E),D):Ie(E)?(d=X,F(E)):Je(E)?(e.consume(E),X):U(E)}function D(E){return E===45||E===46||E===58||E===95||En(E)?(e.consume(E),D):q(E)}function q(E){return E===61?(e.consume(E),P):Ie(E)?(d=q,F(E)):Je(E)?(e.consume(E),q):X(E)}function P(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(e.consume(E),o=E,K):Ie(E)?(d=P,F(E)):Je(E)?(e.consume(E),P):(e.consume(E),ee)}function K(E){return E===o?(e.consume(E),o=void 0,B):E===null?r(E):Ie(E)?(d=K,F(E)):(e.consume(E),K)}function ee(E){return E===null||E===34||E===39||E===60||E===61||E===96?r(E):E===47||E===62||Et(E)?X(E):(e.consume(E),ee)}function B(E){return E===47||E===62||Et(E)?X(E):r(E)}function U(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),n):r(E)}function F(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),Z}function Z(E){return Je(E)?st(e,ue,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ue(E)}function ue(E){return e.enter("htmlTextData"),d(E)}}const wp={name:"labelEnd",resolveAll:$T,resolveTo:BT,tokenize:HT},DT={tokenize:PT},zT={tokenize:FT},UT={tokenize:qT};function $T(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&&ca(e,0,e.length,r),e}function BT(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}},p={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=_a(f,e.slice(c+1,c+s+3)),f=_a(f,[["enter",p,n]]),f=_a(f,td(n.parser.constructs.insideSpan.null,e.slice(c+s+4,d-3),n)),f=_a(f,[["exit",p,n],e[d-2],e[d-1],["exit",h,n]]),f=_a(f,e.slice(d+1)),f=_a(f,[["exit",m,n]]),ca(e,c,e.length,f),e}function HT(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(DT,p,d?p:y)(k):k===91?e.attempt(zT,p,d?h:y)(k):d?p(k):y(k)}function h(k){return e.attempt(UT,p,y)(k)}function p(k){return n(k)}function y(k){return c._balanced=!0,r(k)}}function PT(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 Et(y)?go(e,c)(y):c(y)}function c(y){return y===41?p(y):Mk(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Et(y)?go(e,m)(y):p(y)}function f(y){return r(y)}function m(y){return y===34||y===39||y===40?Ak(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):p(y)}function h(y){return Et(y)?go(e,p)(y):p(y)}function p(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),n):r(y)}}function FT(e,n,r){const s=this;return o;function o(f){return Ek.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 qT(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 VT={name:"labelStartImage",resolveAll:wp.resolveAll,tokenize:GT};function GT(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 WT={name:"labelStartLink",resolveAll:wp.resolveAll,tokenize:KT};function KT(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 Tm={name:"lineEnding",tokenize:YT};function YT(e,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),st(e,n,"linePrefix")}}const Nu={name:"thematicBreak",tokenize:QT};function QT(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||Ie(h))?(e.exit("thematicBreak"),n(h)):r(h)}function m(h){return h===o?(e.consume(h),s++,m):(e.exit("thematicBreakSequence"),Je(h)?st(e,f,"whitespace")(h):f(h))}}const Kn={continuation:{tokenize:eM},exit:nM,name:"list",tokenize:JT},XT={partial:!0,tokenize:aM},ZT={partial:!0,tokenize:tM};function JT(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 j=s.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!s.containerState.marker||w===s.containerState.marker:vh(w)){if(s.containerState.type||(s.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Nu,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 vh(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(zo,s.interrupt?r:p,e.attempt(XT,k,y))}function p(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 eM(e,n,r){const s=this;return s.containerState._closeFlow=void 0,e.check(zo,o,c);function o(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,st(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(ZT,n,d)(f))}function d(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,st(e,e.attempt(Kn,n,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function tM(e,n,r){const s=this;return st(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 nM(e){e.exit(this.containerState.type)}function aM(e,n,r){const s=this;return st(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 w1={name:"setextUnderline",resolveTo:rM,tokenize:sM};function rM(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 sM(e,n,r){const s=this;let o;return c;function c(h){let p=s.events.length,y;for(;p--;)if(s.events[p][1].type!=="lineEnding"&&s.events[p][1].type!=="linePrefix"&&s.events[p][1].type!=="content"){y=s.events[p][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)?st(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Ie(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const lM={tokenize:iM};function iM(e){const n=this,r=e.attempt(zo,s,e.attempt(this.parser.constructs.flowInitial,o,st(e,e.attempt(this.parser.constructs.flow,o,e.attempt(fT,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 oM={resolveAll:_k()},cM=Rk("string"),uM=Rk("text");function Rk(e){return{resolveAll:_k(e==="text"?dM: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(p){return h(p)?c(p):f(p)}function f(p){if(p===null){r.consume(p);return}return r.enter("data"),r.consume(p),m}function m(p){return h(p)?(r.exit("data"),c(p)):(r.consume(p),m)}function h(p){if(p===null)return!0;const y=o[p];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 _k(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 dM(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 fM={42:Kn,43:Kn,45:Kn,48:Kn,49:Kn,50:Kn,51:Kn,52:Kn,53:Kn,54:Kn,55:Kn,56:Kn,57:Kn,62:jk},mM={91:xT},hM={[-2]:Cm,[-1]:Cm,32:Cm},pM={35:ST,42:Nu,45:[w1,Nu],60:TT,61:w1,95:Nu,96:v1,126:v1},gM={38:Ck,92:Nk},xM={[-5]:Tm,[-4]:Tm,[-3]:Tm,33:VT,38:Ck,42:kh,60:[W3,LT],91:WT,92:[kT,Nk],93:wp,95:kh,96:lT},yM={null:[kh,oM]},bM={null:[42,95]},vM={null:[]},kM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:bM,contentInitial:mM,disable:vM,document:fM,flow:pM,flowInitial:hM,insideSpan:yM,string:gM,text:xM},Symbol.toStringTag,{value:"Module"}));function wM(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:z(O),check:z(I),consume:R,enter:L,exit:H,interrupt:z(I,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:j,parser:e,previous:null,sliceSerialize:k,sliceStream:w,write:y};let p=n.tokenize.call(h,m);return n.resolveAll&&c.push(n),h;function y(q){return d=_a(d,q),T(),d[d.length-1]!==null?[]:(W(n,0),h.events=td(c,h.events,h),h.events)}function k(q,P){return jM(w(q),P)}function w(q){return SM(d,q)}function j(){const{_bufferIndex:q,_index:P,line:K,column:ee,offset:B}=s;return{_bufferIndex:q,_index:P,line:K,column:ee,offset:B}}function C(q){o[q.line]=q.column,D()}function T(){let q;for(;s._index<d.length;){const P=d[s._index];if(typeof P=="string")for(q=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===q&&s._bufferIndex<P.length;)A(P.charCodeAt(s._bufferIndex));else A(P)}}function A(q){p=p(q)}function R(q){Ie(q)?(s.line++,s.column=1,s.offset+=q===-3?2:1,D()):q!==-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=q}function L(q,P){const K=P||{};return K.type=q,K.start=j(),h.events.push(["enter",K,h]),f.push(K),K}function H(q){const P=f.pop();return P.end=j(),h.events.push(["exit",P,h]),P}function O(q,P){W(q,P.from)}function I(q,P){P.restore()}function z(q,P){return K;function K(ee,B,U){let F,Z,ue,E;return Array.isArray(ee)?$(ee):"tokenize"in ee?$([ee]):M(ee);function M(oe){return pe;function pe(Ce){const re=Ce!==null&&oe[Ce],he=Ce!==null&&oe.null,xe=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(he)?he:he?[he]:[]];return $(xe)(Ce)}}function $(oe){return F=oe,Z=0,oe.length===0?U:N(oe[Z])}function N(oe){return pe;function pe(Ce){return E=X(),ue=oe,oe.partial||(h.currentConstruct=oe),oe.name&&h.parser.constructs.disable.null.includes(oe.name)?le():oe.tokenize.call(P?Object.assign(Object.create(h),P):h,m,Y,le)(Ce)}}function Y(oe){return q(ue,E),B}function le(oe){return E.restore(),++Z<F.length?N(F[Z]):U}}}function W(q,P){q.resolveAll&&!c.includes(q)&&c.push(q),q.resolve&&ca(h.events,P,h.events.length-P,q.resolve(h.events.slice(P),h)),q.resolveTo&&(h.events=q.resolveTo(h.events,h))}function X(){const q=j(),P=h.previous,K=h.currentConstruct,ee=h.events.length,B=Array.from(f);return{from:ee,restore:U};function U(){s=q,h.previous=P,h.currentConstruct=K,h.events.length=ee,f=B,D()}}function D(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function SM(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 jM(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=`
140
+ `;break}case-3:{d=`\r
141
+ `;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 NM(e){const s={constructs:wk([kM,...(e||{}).extensions||[]]),content:o(B3),defined:[],document:o(P3),flow:o(lM),lazy:{},string:o(cM),text:o(uM)};return s;function o(c){return d;function d(f){return wM(s,c,f)}}}function CM(e){for(;!Tk(e););return e}const S1=/[\0\t\n\r]/g;function TM(){let e=1,n="",r=!0,s;return o;function o(c,d,f){const m=[];let h,p,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(S1.lastIndex=y,h=S1.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(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)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 MM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function EM(e){return e.replace(MM,AM)}function AM(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 kp(r)||e}const Ik={}.hasOwnProperty;function RM(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),_M(r)(CM(NM(r).document().write(TM()(e,n,!0))))}function _M(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(ze),autolinkProtocol:X,autolinkEmail:X,atxHeading:c(Bt),blockQuote:c(he),characterEscape:X,characterReference:X,codeFenced:c(xe),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(xe,d),codeText:c(We,d),codeTextData:X,data:X,codeFlowValue:X,definition:c(Ke),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c($e),hardBreakEscape:c(Ht),hardBreakTrailing:c(Ht),htmlFlow:c(jn,d),htmlFlowData:X,htmlText:c(jn,d),htmlTextData:X,image:c(Te),label:d,link:c(ze),listItem:c(At),listItemValue:k,listOrdered:c(ct,y),listUnordered:c(ct),paragraph:c(bt),reference:N,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(Bt),strong:c($n),thematicBreak:c(za)},exit:{atxHeading:m(),atxHeadingSequence:O,autolink:m(),autolinkEmail:re,autolinkProtocol:Ce,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:oe,characterReference:pe,codeFenced:m(T),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:j,codeFlowValue:D,codeIndented:m(A),codeText:m(B),codeTextData:D,data:D,definition:m(),definitionDestinationString:H,definitionLabelString:R,definitionTitleString:L,emphasis:m(),hardBreakEscape:m(P),hardBreakTrailing:m(P),htmlFlow:m(K),htmlFlowData:D,htmlText:m(ee),htmlTextData:D,image:m(F),label:ue,labelText:Z,lineEnding:q,link:m(U),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Y,resourceDestinationString:E,resourceTitleString:M,resource:$,setextHeading:m(W),setextHeadingLineSequence:z,setextHeadingText:I,strong:m(),thematicBreak:m()}};Lk(n,(e||{}).mdastExtensions||[]);const r={};return s;function s(ce){let ye={type:"root",children:[]};const Se={stack:[ye],tokenStack:[],config:n,enter:f,exit:h,buffer:d,resume:p,data:r},Le=[];let Be=-1;for(;++Be<ce.length;)if(ce[Be][1].type==="listOrdered"||ce[Be][1].type==="listUnordered")if(ce[Be][0]==="enter")Le.push(Be);else{const Gt=Le.pop();Be=o(ce,Gt,Be)}for(Be=-1;++Be<ce.length;){const Gt=n[ce[Be][0]];Ik.call(Gt,ce[Be][1].type)&&Gt[ce[Be][1].type].call(Object.assign({sliceSerialize:ce[Be][2].sliceSerialize},Se),ce[Be][1])}if(Se.tokenStack.length>0){const Gt=Se.tokenStack[Se.tokenStack.length-1];(Gt[1]||j1).call(Se,void 0,Gt[0])}for(ye.position={start:ps(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ps(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},Be=-1;++Be<n.transforms.length;)ye=n.transforms[Be](ye)||ye;return ye}function o(ce,ye,Se){let Le=ye-1,Be=-1,Gt=!1,pt,Pt,mt,Ft;for(;++Le<=Se;){const He=ce[Le];switch(He[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{He[0]==="enter"?Be++:Be--,Ft=void 0;break}case"lineEndingBlank":{He[0]==="enter"&&(pt&&!Ft&&!Be&&!mt&&(mt=Le),Ft=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ft=void 0}if(!Be&&He[0]==="enter"&&He[1].type==="listItemPrefix"||Be===-1&&He[0]==="exit"&&(He[1].type==="listUnordered"||He[1].type==="listOrdered")){if(pt){let mn=Le;for(Pt=void 0;mn--;){const at=ce[mn];if(at[1].type==="lineEnding"||at[1].type==="lineEndingBlank"){if(at[0]==="exit")continue;Pt&&(ce[Pt][1].type="lineEndingBlank",Gt=!0),at[1].type="lineEnding",Pt=mn}else if(!(at[1].type==="linePrefix"||at[1].type==="blockQuotePrefix"||at[1].type==="blockQuotePrefixWhitespace"||at[1].type==="blockQuoteMarker"||at[1].type==="listItemIndent"))break}mt&&(!Pt||mt<Pt)&&(pt._spread=!0),pt.end=Object.assign({},Pt?ce[Pt][1].start:He[1].end),ce.splice(Pt||Le,0,["exit",pt,He[2]]),Le++,Se++}if(He[1].type==="listItemPrefix"){const mn={type:"listItem",_spread:!1,start:Object.assign({},He[1].start),end:void 0};pt=mn,ce.splice(Le,0,["enter",mn,He[2]]),Le++,Se++,mt=void 0,Ft=!0}}}return ce[ye][1]._spread=Gt,Se}function c(ce,ye){return Se;function Se(Le){f.call(this,ce(Le),Le),ye&&ye.call(this,Le)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(ce,ye,Se){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([ye,Se||void 0]),ce.position={start:ps(ye.start),end:void 0}}function m(ce){return ye;function ye(Se){ce&&ce.call(this,Se),h.call(this,Se)}}function h(ce,ye){const Se=this.stack.pop(),Le=this.tokenStack.pop();if(Le)Le[0].type!==ce.type&&(ye?ye.call(this,ce,Le[0]):(Le[1]||j1).call(this,ce,Le[0]));else throw new Error("Cannot close `"+ce.type+"` ("+po({start:ce.start,end:ce.end})+"): it’s not open");Se.position.end=ps(ce.end)}function p(){return vp(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function k(ce){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ce}function j(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ce}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce.replace(/(\r?\n|\r)$/g,"")}function R(ce){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ye,Se.identifier=Wa(this.sliceSerialize(ce)).toLowerCase()}function L(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ce}function H(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ce}function O(ce){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Se=this.sliceSerialize(ce).length;ye.depth=Se}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function z(ce){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function X(ce){const Se=this.stack[this.stack.length-1].children;let Le=Se[Se.length-1];(!Le||Le.type!=="text")&&(Le=ut(),Le.position={start:ps(ce.start),end:void 0},Se.push(Le)),this.stack.push(Le)}function D(ce){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ce),ye.position.end=ps(ce.end)}function q(ce){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=ye.children[ye.children.length-1];Se.position.end=ps(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(ye.type)&&(X.call(this,ce),D.call(this,ce))}function P(){this.data.atHardBreak=!0}function K(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce}function ee(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce}function B(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce}function U(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ye,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function F(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ye,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function Z(ce){const ye=this.sliceSerialize(ce),Se=this.stack[this.stack.length-2];Se.label=EM(ye),Se.identifier=Wa(ye).toLowerCase()}function ue(){const ce=this.stack[this.stack.length-1],ye=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Le=ce.children;Se.children=Le}else Se.alt=ye}function E(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ce}function M(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ce}function $(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function Y(ce){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ye,Se.identifier=Wa(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function le(ce){this.data.characterReferenceType=ce.type}function oe(ce){const ye=this.sliceSerialize(ce),Se=this.data.characterReferenceType;let Le;Se?(Le=Sk(ye,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=kp(ye);const Be=this.stack[this.stack.length-1];Be.value+=Le}function pe(ce){const ye=this.stack.pop();ye.position.end=ps(ce.end)}function Ce(ce){D.call(this,ce);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ce)}function re(ce){D.call(this,ce);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ce)}function he(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function We(){return{type:"inlineCode",value:""}}function Ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $e(){return{type:"emphasis",children:[]}}function Bt(){return{type:"heading",depth:0,children:[]}}function Ht(){return{type:"break"}}function jn(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function ct(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function At(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function bt(){return{type:"paragraph",children:[]}}function $n(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function za(){return{type:"thematicBreak"}}}function ps(e){return{line:e.line,column:e.column,offset:e.offset}}function Lk(e,n){let r=-1;for(;++r<n.length;){const s=n[r];Array.isArray(s)?Lk(e,s):IM(e,s)}}function IM(e,n){let r;for(r in n)if(Ik.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 j1(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+po({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+po({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+po({start:n.start,end:n.end})+") is still open")}function LM(e){const n=this;n.parser=r;function r(s){return RM(s,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function OM(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 DM(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
142
+ `}]}function zM(e,n){const r=n.value?n.value+`
143
+ `:"",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 $M(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function BM(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(n.identifier).toUpperCase(),o=Zl(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 HM(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 PM(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function Ok(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 FM(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return Ok(e,n);const o={src:Zl(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 qM(e,n){const r={src:Zl(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 VM(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 GM(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return Ok(e,n);const o={href:Zl(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 WM(e,n){const r={href:Zl(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 KM(e,n,r){const s=e.all(n),o=r?YM(r):Dk(n),c={},d=[];if(typeof n.checked=="boolean"){const p=s[0];let y;p&&p.type==="element"&&p.tagName==="p"?y=p:(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 p=s[f];(o||f!==0||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
144
+ `}),p.type==="element"&&p.tagName==="p"&&!o?d.push(...p.children):d.push(p)}const m=s[s.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
145
+ `});const h={type:"element",tagName:"li",properties:c,children:d};return e.patch(n,h),e.applyData(n,h)}function YM(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=Dk(r[s])}return n}function Dk(e){const n=e.spread;return n??e.children.length>1}function QM(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 XM(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ZM(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function JM(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function eE(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=gp(n.children[1]),m=pk(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 tE(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 j={type:"element",tagName:c,properties:k,children:[]};y&&(j.children=e.all(y),e.patch(y,j),j=e.applyData(y,j)),h.push(j)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(n,p),e.applyData(n,p)}function nE(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const N1=9,C1=32;function aE(e){const n=String(e),r=/\r?\n|\r/g;let s=r.exec(n),o=0;const c=[];for(;s;)c.push(T1(n.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=r.exec(n);return c.push(T1(n.slice(o),o>0,!1)),c.join("")}function T1(e,n,r){let s=0,o=e.length;if(n){let c=e.codePointAt(s);for(;c===N1||c===C1;)s++,c=e.codePointAt(s)}if(r){let c=e.codePointAt(o-1);for(;c===N1||c===C1;)o--,c=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function rE(e,n){const r={type:"text",value:aE(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function sE(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const lE={blockquote:OM,break:DM,code:zM,delete:UM,emphasis:$M,footnoteReference:BM,heading:HM,html:PM,imageReference:FM,image:qM,inlineCode:VM,linkReference:GM,link:WM,listItem:KM,list:QM,paragraph:XM,root:ZM,strong:JM,table:eE,tableCell:nE,tableRow:tE,text:rE,thematicBreak:sE,toml:eu,yaml:eu,definition:eu,footnoteDefinition:eu};function eu(){}const zk=-1,nd=0,xo=1,Ou=2,Sp=3,jp=4,Np=5,Cp=6,Uk=7,$k=8,iE=typeof self=="object"?self:globalThis,M1=(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 iE[e](n)},oE=(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 nd:case zk:return r(d,o);case xo:{const f=r([],o);for(const m of d)f.push(s(m));return f}case Ou:{const f=r({},o);for(const[m,h]of d)f[s(m)]=s(h);return f}case Sp:return r(new Date(d),o);case jp:{const{source:f,flags:m}=d;return r(new RegExp(f,m),o)}case Np:{const f=r(new Map,o);for(const[m,h]of d)f.set(s(m),s(h));return f}case Cp:{const f=r(new Set,o);for(const m of d)f.add(s(m));return f}case Uk:{const{name:f,message:m}=d;return r(M1(f,m),o)}case $k: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(M1(c,d),o)};return s},E1=e=>oE(new Map,e)(0),qs="",{toString:cE}={},{keys:uE}=Object,eo=e=>{const n=typeof e;if(n!=="object"||!e)return[nd,n];const r=cE.call(e).slice(8,-1);switch(r){case"Array":return[xo,qs];case"Object":return[Ou,qs];case"Date":return[Sp,qs];case"RegExp":return[jp,qs];case"Map":return[Np,qs];case"Set":return[Cp,qs];case"DataView":return[xo,r]}return r.includes("Array")?[xo,r]:r.includes("Error")?[Uk,r]:[Ou,r]},tu=([e,n])=>e===nd&&(n==="function"||n==="symbol"),dE=(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]=eo(d);switch(f){case nd:{let p=d;switch(m){case"bigint":f=$k,p=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return o([zk],d)}return o([f,p],d)}case xo:{if(m){let k=d;return m==="DataView"?k=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(k=new Uint8Array(d)),o([m,[...k]],d)}const p=[],y=o([f,p],d);for(const k of d)p.push(c(k));return y}case Ou:{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 p=[],y=o([f,p],d);for(const k of uE(d))(e||!tu(eo(d[k])))&&p.push([c(k),c(d[k])]);return y}case Sp:return o([f,isNaN(d.getTime())?qs:d.toISOString()],d);case jp:{const{source:p,flags:y}=d;return o([f,{source:p,flags:y}],d)}case Np:{const p=[],y=o([f,p],d);for(const[k,w]of d)(e||!(tu(eo(k))||tu(eo(w))))&&p.push([c(k),c(w)]);return y}case Cp:{const p=[],y=o([f,p],d);for(const k of d)(e||!tu(eo(k)))&&p.push(c(k));return y}}const{message:h}=d;return o([f,{name:m,message:h}],d)};return c},A1=(e,{json:n,lossy:r}={})=>{const s=[];return dE(!(n||r),!!n,new Map,s)(e),s},Du=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?E1(A1(e,n)):structuredClone(e):(e,n)=>E1(A1(e,n));function fE(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 mE(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function hE(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||fE,s=e.options.footnoteBackLabel||mE,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 p=e.all(h),y=String(h.identifier).toUpperCase(),k=Zl(y.toLowerCase());let w=0;const j=[],C=e.footnoteCounts.get(y);for(;C!==void 0&&++w<=C;){j.length>0&&j.push({type:"text",value:" "});let R=typeof r=="string"?r:r(m,w);typeof R=="string"&&(R={type:"text",value:R}),j.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 T=p[p.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const R=T.children[T.children.length-1];R&&R.type==="text"?R.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...j)}else p.push(...j);const A={type:"element",tagName:"li",properties:{id:n+"fn-"+k},children:e.wrap(p,!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:{...Du(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
146
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
147
+ `}]}}const ad=(function(e){if(e==null)return yE;if(typeof e=="function")return rd(e);if(typeof e=="object")return Array.isArray(e)?pE(e):gE(e);if(typeof e=="string")return xE(e);throw new Error("Expected function, string, or object as test")});function pE(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=ad(e[r]);return rd(s);function s(...o){let c=-1;for(;++c<n.length;)if(n[c].apply(this,o))return!0;return!1}}function gE(e){const n=e;return rd(r);function r(s){const o=s;let c;for(c in e)if(o[c]!==n[c])return!1;return!0}}function xE(e){return rd(n);function n(r){return r&&r.type===e}}function rd(e){return n;function n(r,s,o){return!!(bE(r)&&e.call(this,r,typeof s=="number"?s:void 0,o||void 0))}}function yE(){return!0}function bE(e){return e!==null&&typeof e=="object"&&"type"in e}const Bk=[],vE=!0,wh=!1,kE="skip";function Hk(e,n,r,s){let o;typeof n=="function"&&typeof r!="function"?(s=r,r=n):o=n;const c=ad(o),d=s?-1:1;f(e,void 0,[])();function f(m,h,p){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=Bk,j,C,T;if((!n||c(m,h,p[p.length-1]||void 0))&&(w=wE(r(m,p)),w[0]===wh))return w;if("children"in m&&m.children){const A=m;if(A.children&&w[0]!==kE)for(C=(s?A.children.length:-1)+d,T=p.concat(A);C>-1&&C<A.children.length;){const R=A.children[C];if(j=f(R,C,T)(),j[0]===wh)return j;C=typeof j[1]=="number"?j[1]:C+d}}return w}}}function wE(e){return Array.isArray(e)?e:typeof e=="number"?[vE,e]:e==null?Bk:[e]}function Tp(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),Hk(e,c,f,o);function f(m,h){const p=h[h.length-1],y=p?p.children.indexOf(m):void 0;return d(m,y,p)}}const Sh={}.hasOwnProperty,SE={};function jE(e,n){const r=n||SE,s=new Map,o=new Map,c=new Map,d={...lE,...r.handlers},f={all:h,applyData:CE,definitionById:s,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:r,patch:NE,wrap:ME};return Tp(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const y=p.type==="definition"?s:o,k=String(p.identifier).toUpperCase();y.has(k)||y.set(k,p)}}),f;function m(p,y){const k=p.type,w=f.handlers[k];if(Sh.call(f.handlers,k)&&w)return w(f,p,y);if(f.options.passThrough&&f.options.passThrough.includes(k)){if("children"in p){const{children:C,...T}=p,A=Du(T);return A.children=f.all(p),A}return Du(p)}return(f.options.unknownHandler||TE)(f,p,y)}function h(p){const y=[];if("children"in p){const k=p.children;let w=-1;for(;++w<k.length;){const j=f.one(k[w],p);if(j){if(w&&k[w-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=R1(j.value)),!Array.isArray(j)&&j.type==="element")){const C=j.children[0];C&&C.type==="text"&&(C.value=R1(C.value))}Array.isArray(j)?y.push(...j):y.push(j)}}}return y}}function NE(e,n){e.position&&(n.position=f3(e))}function CE(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,Du(c)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function TE(e,n){const r=n.data||{},s="value"in n&&!(Sh.call(r,"hProperties")||Sh.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 ME(e,n){const r=[];let s=-1;for(n&&r.push({type:"text",value:`
148
+ `});++s<e.length;)s&&r.push({type:"text",value:`
149
+ `}),r.push(e[s]);return n&&e.length>0&&r.push({type:"text",value:`
150
+ `}),r}function R1(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function _1(e,n){const r=jE(e,n),s=r.one(e,void 0),o=hE(r),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
151
+ `},o),c}function EE(e,n){return e&&"run"in e?async function(r,s){const o=_1(r,{file:s,...n});await e.run(o,s)}:function(r,s){return _1(r,{file:s,...e||n})}}function I1(e){if(e)throw e}var Mm,L1;function AE(){if(L1)return Mm;L1=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 p=e.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!y)return!1;var k;for(k in h);return typeof k>"u"||e.call(h,k)},d=function(h,p){r&&p.name==="__proto__"?r(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(s)return s(h,p).value}else return;return h[p]};return Mm=function m(){var h,p,y,k,w,j,C=arguments[0],T=1,A=arguments.length,R=!1;for(typeof C=="boolean"&&(R=C,C=arguments[1]||{},T=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});T<A;++T)if(h=arguments[T],h!=null)for(p in h)y=f(C,p),k=f(h,p),C!==k&&(R&&k&&(c(k)||(w=o(k)))?(w?(w=!1,j=y&&o(y)?y:[]):j=y&&c(y)?y:{},d(C,{name:p,newValue:m(R,j,k)})):typeof k<"u"&&d(C,{name:p,newValue:k}));return C},Mm}var RE=AE();const Em=Zb(RE);function jh(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 _E(){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 p=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,p?IE(p,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 IE(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 p=h;if(f&&r)throw p;return o(p)}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 or={basename:LE,dirname:OE,extname:DE,join:zE,sep:"/"};function LE(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Uo(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 OE(e){if(Uo(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 DE(e){Uo(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 zE(...e){let n=-1,r;for(;++n<e.length;)Uo(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":UE(r)}function UE(e){Uo(e);const n=e.codePointAt(0)===47;let r=$E(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function $E(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 Uo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const BE={cwd:HE};function HE(){return"/"}function Nh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function PE(e){if(typeof e=="string")e=new URL(e);else if(!Nh(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 FE(e)}function FE(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 Am=["history","path","basename","stem","extname","dirname"];class Pk{constructor(n){let r;n?Nh(n)?r={path:n}:typeof n=="string"||qE(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":BE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Am.length;){const c=Am[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)Am.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?or.basename(this.path):void 0}set basename(n){_m(n,"basename"),Rm(n,"basename"),this.path=or.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?or.dirname(this.path):void 0}set dirname(n){O1(this.basename,"dirname"),this.path=or.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?or.extname(this.path):void 0}set extname(n){if(Rm(n,"extname"),O1(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=or.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Nh(n)&&(n=PE(n)),_m(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?or.basename(this.path,this.extname):void 0}set stem(n){_m(n,"stem"),Rm(n,"stem"),this.path=or.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 Rn(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 Rm(e,n){if(e&&e.includes(or.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+or.sep+"`")}function _m(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function O1(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function qE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VE=(function(e){const s=this.constructor.prototype,o=s[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),GE={}.hasOwnProperty;class Mp extends VE{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=_E()}copy(){const n=new Mp;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];n.use(...s)}return n.data(Em(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Om("data",this.frozen),this.namespace[n]=r,this):GE.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Om("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=nu(n),s=this.parser||this.Parser;return Im("parse",s),s(String(r),r)}process(n,r){const s=this;return this.freeze(),Im("process",this.parser||this.Parser),Lm("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(c,d){const f=nu(n),m=s.parse(f);s.run(m,f,function(p,y,k){if(p||!y||!k)return h(p);const w=y,j=s.stringify(w,k);YE(j)?k.value=j:k.result=j,h(p,k)});function h(p,y){p||!y?d(p):c?c(y):r(void 0,y)}}}processSync(n){let r=!1,s;return this.freeze(),Im("processSync",this.parser||this.Parser),Lm("processSync",this.compiler||this.Compiler),this.process(n,o),z1("processSync","process",r),s;function o(c,d){r=!0,I1(c),s=d}}run(n,r,s){D1(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=nu(r);o.run(n,m,h);function h(p,y,k){const w=y||n;p?f(p):d?d(w):s(void 0,w,k)}}}runSync(n,r){let s=!1,o;return this.run(n,r,c),z1("runSync","run",s),o;function c(d,f){I1(d),o=f,s=!0}}stringify(n,r){this.freeze();const s=nu(r),o=this.compiler||this.Compiler;return Lm("stringify",o),D1(n),o(n,s)}use(n,...r){const s=this.attachers,o=this.namespace;if(Om("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[p,...y]=h;m(p,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=Em(!0,o.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const y=h[p];c(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let y=-1,k=-1;for(;++y<s.length;)if(s[y][0]===h){k=y;break}if(k===-1)s.push([h,...p]);else if(p.length>0){let[w,...j]=p;const C=s[k][1];jh(C)&&jh(w)&&(w=Em(!0,C,w)),s[k]=[h,w,...j]}}}}const WE=new Mp().freeze();function Im(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Lm(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Om(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 D1(e){if(!jh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function z1(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function nu(e){return KE(e)?e:new Pk(e)}function KE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function YE(e){return typeof e=="string"||QE(e)}function QE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const XE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",U1=[],$1={allowDangerousHtml:!0},ZE=/^(https?|ircs?|mailto|xmpp)$/i,JE=[{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 $o(e){const n=eA(e),r=tA(e);return nA(n.runSync(n.parse(r),r),e)}function eA(e){const n=e.rehypePlugins||U1,r=e.remarkPlugins||U1,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$1}:$1;return WE().use(LM).use(r).use(EE,s).use(n)}function tA(e){const n=e.children||"",r=new Pk;return typeof n=="string"&&(r.value=n),r}function nA(e,n){const r=n.allowedElements,s=n.allowElement,o=n.components,c=n.disallowedElements,d=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||aA;for(const p of JE)Object.hasOwn(n,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+XE+p.id,void 0);return Tp(e,h),x3(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,y,k){if(p.type==="raw"&&k&&typeof y=="number")return d?k.children.splice(y,1):k.children[y]={type:"text",value:p.value},y;if(p.type==="element"){let w;for(w in Nm)if(Object.hasOwn(Nm,w)&&Object.hasOwn(p.properties,w)){const j=p.properties[w],C=Nm[w];(C===null||C.includes(p.tagName))&&(p.properties[w]=m(String(j||""),w,p))}}if(p.type==="element"){let w=r?!r.includes(p.tagName):c?c.includes(p.tagName):!1;if(!w&&s&&typeof y=="number"&&(w=!s(p,y,k)),w&&k&&typeof y=="number")return f&&p.children?k.children.splice(y,1,...p.children):k.children.splice(y,1),y}}}function aA(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||ZE.test(e.slice(0,n))?e:""}function B1(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 rA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function sA(e,n,r){const o=ad((r||{}).ignore||[]),c=lA(n);let d=-1;for(;++d<c.length;)Hk(e,"text",f);function f(h,p){let y=-1,k;for(;++y<p.length;){const w=p[y],j=k?k.children:void 0;if(o(w,j?j.indexOf(w):void 0,k))return;k=w}if(k)return m(h,p)}function m(h,p){const y=p[p.length-1],k=c[d][0],w=c[d][1];let j=0;const T=y.children.indexOf(h);let A=!1,R=[];k.lastIndex=0;let L=k.exec(h.value);for(;L;){const H=L.index,O={index:L.index,input:L.input,stack:[...p,h]};let I=w(...L,O);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?k.lastIndex=H+1:(j!==H&&R.push({type:"text",value:h.value.slice(j,H)}),Array.isArray(I)?R.push(...I):I&&R.push(I),j=H+L[0].length,A=!0),!k.global)break;L=k.exec(h.value)}return A?(j<h.value.length&&R.push({type:"text",value:h.value.slice(j)}),y.children.splice(T,1,...R)):R=[h],T+R.length}}function lA(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([iA(o[0]),oA(o[1])])}return n}function iA(e){return typeof e=="string"?new RegExp(rA(e),"g"):e}function oA(e){return typeof e=="function"?e:function(){return e}}const Dm="phrasing",zm=["autolink","link","image","label"];function cA(){return{transforms:[gA],enter:{literalAutolink:dA,literalAutolinkEmail:Um,literalAutolinkHttp:Um,literalAutolinkWww:Um},exit:{literalAutolink:pA,literalAutolinkEmail:hA,literalAutolinkHttp:fA,literalAutolinkWww:mA}}}function uA(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dm,notInConstruct:zm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dm,notInConstruct:zm},{character:":",before:"[ps]",after:"\\/",inConstruct:Dm,notInConstruct:zm}]}}function dA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Um(e){this.config.enter.autolinkProtocol.call(this,e)}function fA(e){this.config.exit.autolinkProtocol.call(this,e)}function mA(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 hA(e){this.config.exit.autolinkEmail.call(this,e)}function pA(e){this.exit(e)}function gA(e){sA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xA],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),yA]],{ignore:["link","linkReference"]})}function xA(e,n,r,s,o){let c="";if(!Fk(o)||(/^w/i.test(n)&&(r=n+r,n="",c="http://"),!bA(r)))return!1;const d=vA(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 yA(e,n,r,s){return!Fk(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function bA(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 vA(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=B1(e,"(");let c=B1(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 Fk(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Zs(r)||ed(r))&&(!n||r!==47)}qk.peek=EA;function kA(){this.buffer()}function wA(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function SA(){this.buffer()}function jA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function NA(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 CA(e){this.exit(e)}function TA(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 MA(e){this.exit(e)}function EA(){return"["}function qk(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 AA(){return{enter:{gfmFootnoteCallString:kA,gfmFootnoteCall:wA,gfmFootnoteDefinitionLabelString:SA,gfmFootnoteDefinition:jA},exit:{gfmFootnoteCallString:NA,gfmFootnoteCall:CA,gfmFootnoteDefinitionLabelString:TA,gfmFootnoteDefinition:MA}}}function RA(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:qk},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"),p=c.enter("label");return m+=f.move(c.safe(c.associationId(s),{before:m,after:"]"})),p(),m+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),m+=f.move((n?`
152
+ `:" ")+c.indentLines(c.containerFlow(s,f.current()),n?Vk:_A))),h(),m}}function _A(e,n,r){return n===0?e:Vk(e,n,r)}function Vk(e,n,r){return(r?"":" ")+e}const IA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Gk.peek=UA;function LA(){return{canContainEols:["delete"],enter:{strikethrough:DA},exit:{strikethrough:zA}}}function OA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:IA}],handlers:{delete:Gk}}}function DA(e){this.enter({type:"delete",children:[]},e)}function zA(e){this.exit(e)}function Gk(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 $A(e){return e.length}function BA(e,n){const r=n||{},s=(r.align||[]).concat(),o=r.stringLength||$A,c=[],d=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const C=[],T=[];let A=-1;for(e[p].length>h&&(h=e[p].length);++A<e[p].length;){const R=HA(e[p][A]);if(r.alignDelimiters!==!1){const L=o(R);T[A]=L,(m[A]===void 0||L>m[A])&&(m[A]=L)}C.push(R)}d[p]=C,f[p]=T}let y=-1;if(typeof s=="object"&&"length"in s)for(;++y<h;)c[y]=H1(s[y]);else{const C=H1(s);for(;++y<h;)c[y]=C}y=-1;const k=[],w=[];for(;++y<h;){const C=c[y];let T="",A="";C===99?(T=":",A=":"):C===108?T=":":C===114&&(A=":");let R=r.alignDelimiters===!1?1:Math.max(1,m[y]-T.length-A.length);const L=T+"-".repeat(R)+A;r.alignDelimiters!==!1&&(R=T.length+R+A.length,R>m[y]&&(m[y]=R),w[y]=R),k[y]=L}d.splice(1,0,k),f.splice(1,0,w),p=-1;const j=[];for(;++p<d.length;){const C=d[p],T=f[p];y=-1;const A=[];for(;++y<h;){const R=C[y]||"";let L="",H="";if(r.alignDelimiters!==!1){const O=m[y]-(T[y]||0),I=c[y];I===114?L=" ".repeat(O):I===99?O%2?(L=" ".repeat(O/2+.5),H=" ".repeat(O/2-.5)):(L=" ".repeat(O/2),H=L):H=" ".repeat(O)}r.delimiterStart!==!1&&!y&&A.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&R==="")&&(r.delimiterStart!==!1||y)&&A.push(" "),r.alignDelimiters!==!1&&A.push(L),A.push(R),r.alignDelimiters!==!1&&A.push(H),r.padding!==!1&&A.push(" "),(r.delimiterEnd!==!1||y!==h-1)&&A.push("|")}j.push(r.delimiterEnd===!1?A.join("").replace(/ +$/,""):A.join(""))}return j.join(`
153
+ `)}function HA(e){return e==null?"":String(e)}function H1(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 PA(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()),FA);return o(),d}function FA(e,n,r){return">"+(r?"":" ")+e}function qA(e,n){return P1(e,n.inConstruct,!0)&&!P1(e,n.notInConstruct,!1)}function P1(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 F1(e,n,r,s){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
154
+ `&&qA(r.stack,r.unsafe[o]))return/[ \t]/.test(s.before)?"":" ";return`\\
155
+ `}function VA(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 GA(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 WA(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 KA(e,n,r,s){const o=WA(r),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(GA(e,r)){const y=r.enter("codeIndented"),k=r.indentLines(c,YA);return y(),k}const f=r.createTracker(s),m=o.repeat(Math.max(VA(c,o)+1,3)),h=r.enter("codeFenced");let p=f.move(m);if(e.lang){const y=r.enter(`codeFencedLang${d}`);p+=f.move(r.safe(e.lang,{before:p,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${d}`);p+=f.move(" "),p+=f.move(r.safe(e.meta,{before:p,after:`
156
+ `,encode:["`"],...f.current()})),y()}return p+=f.move(`
157
+ `),c&&(p+=f.move(c+`
158
+ `)),p+=f.move(m),h(),p}function YA(e,n,r){return(r?"":" ")+e}function Ep(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 QA(e,n,r,s){const o=Ep(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?" ":`
159
+ `,...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 XA(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 To(e){return"&#x"+e.toString(16).toUpperCase()+";"}function zu(e,n,r){const s=Gl(e),o=Gl(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}}Wk.peek=ZA;function Wk(e,n,r,s){const o=XA(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),p=zu(s.before.charCodeAt(s.before.length-1),h,o);p.inside&&(m=To(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=zu(s.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+To(y));const w=d.move(o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:p.outside},f+m+w}function ZA(e,n,r){return r.options.emphasis||"*"}function JA(e,n){let r=!1;return Tp(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,wh}),!!((!e.depth||e.depth<3)&&vp(e)&&(n.options.setext||r))}function e6(e,n,r,s){const o=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(s);if(JA(e,r)){const p=r.enter("headingSetext"),y=r.enter("phrasing"),k=r.containerPhrasing(e,{...c.current(),before:`
160
+ `,after:`
161
+ `});return y(),p(),k+`
162
+ `+(o===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(`
163
+ `))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),m=r.enter("phrasing");c.move(d+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
164
+ `,...c.current()});return/^[\t ]/.test(h)&&(h=To(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,r.options.closeAtx&&(h+=" "+d),m(),f(),h}Kk.peek=t6;function Kk(e){return e.value||""}function t6(){return"<"}Yk.peek=n6;function Yk(e,n,r,s){const o=Ep(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 n6(){return"!"}Qk.peek=a6;function Qk(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 p=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=p,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function a6(){return"!"}Xk.peek=r6;function Xk(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 r6(){return"`"}function Zk(e,n){const r=vp(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))}Jk.peek=s6;function Jk(e,n,r,s){const o=Ep(r),c=o==='"'?"Quote":"Apostrophe",d=r.createTracker(s);let f,m;if(Zk(e,r)){const p=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=p,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 s6(e,n,r){return Zk(e,r)?"<":"["}e2.peek=l6;function e2(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 p=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=p,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function l6(){return"["}function Ap(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 i6(e){const n=Ap(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 o6(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 t2(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 c6(e,n,r,s){const o=r.enter("list"),c=r.bulletCurrent;let d=e.ordered?o6(r):Ap(r);const f=e.ordered?d==="."?")":".":i6(r);let m=n&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&p&&(!p.children||!p.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),t2(r)===d&&p){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 u6(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 d6(e,n,r,s){const o=u6(r);let c=r.bulletCurrent||Ap(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()),p);return m(),h;function p(y,k,w){return k?(w?"":" ".repeat(d))+y:(w?c:c+" ".repeat(d-c.length))+y}}function f6(e,n,r,s){const o=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(e,s);return c(),o(),d}const m6=ad(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function h6(e,n,r,s){return(e.children.some(function(d){return m6(d)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function p6(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}n2.peek=g6;function n2(e,n,r,s){const o=p6(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),p=zu(s.before.charCodeAt(s.before.length-1),h,o);p.inside&&(m=To(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=zu(s.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+To(y));const w=d.move(o+o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:p.outside},f+m+w}function g6(e,n,r){return r.options.strong||"*"}function x6(e,n,r,s){return r.safe(e.value,s)}function y6(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 b6(e,n,r){const s=(t2(r)+(r.options.ruleSpaces?" ":"")).repeat(y6(r));return r.options.ruleSpaces?s.slice(0,-1):s}const a2={blockquote:PA,break:F1,code:KA,definition:QA,emphasis:Wk,hardBreak:F1,heading:e6,html:Kk,image:Yk,imageReference:Qk,inlineCode:Xk,link:Jk,linkReference:e2,list:c6,listItem:d6,paragraph:f6,root:h6,strong:n2,text:x6,thematicBreak:b6};function v6(){return{enter:{table:k6,tableData:q1,tableHeader:q1,tableRow:S6},exit:{codeText:j6,table:w6,tableData:$m,tableHeader:$m,tableRow:$m}}}function k6(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 w6(e){this.exit(e),this.data.inTable=void 0}function S6(e){this.enter({type:"tableRow",children:[]},e)}function $m(e){this.exit(e)}function q1(e){this.enter({type:"tableCell",children:[]},e)}function j6(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,N6));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function N6(e,n){return n==="|"?n:e}function C6(e){const n=e||{},r=n.tableCellPadding,s=n.tablePipeAlign,o=n.stringLength,c=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
165
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:k,table:d,tableCell:m,tableRow:f}};function d(w,j,C,T){return h(p(w,C,T),w.align)}function f(w,j,C,T){const A=y(w,C,T),R=h([A]);return R.slice(0,R.indexOf(`
166
+ `))}function m(w,j,C,T){const A=C.enter("tableCell"),R=C.enter("phrasing"),L=C.containerPhrasing(w,{...T,before:c,after:c});return R(),A(),L}function h(w,j){return BA(w,{align:j,alignDelimiters:s,padding:r,stringLength:o})}function p(w,j,C){const T=w.children;let A=-1;const R=[],L=j.enter("table");for(;++A<T.length;)R[A]=y(T[A],j,C);return L(),R}function y(w,j,C){const T=w.children;let A=-1;const R=[],L=j.enter("tableRow");for(;++A<T.length;)R[A]=m(T[A],w,j,C);return L(),R}function k(w,j,C){let T=a2.inlineCode(w,j,C);return C.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function T6(){return{exit:{taskListCheckValueChecked:V1,taskListCheckValueUnchecked:V1,paragraph:E6}}}function M6(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:A6}}}function V1(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function E6(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 A6(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=a2.listItem(e,n,r,{...s,...f.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(p){return p+d}}function R6(){return[cA(),AA(),LA(),v6(),T6()]}function _6(e){return{extensions:[uA(),RA(e),OA(),C6(e),M6()]}}const I6={tokenize:$6,partial:!0},r2={tokenize:B6,partial:!0},s2={tokenize:H6,partial:!0},l2={tokenize:P6,partial:!0},L6={tokenize:F6,partial:!0},i2={name:"wwwAutolink",tokenize:z6,previous:c2},o2={name:"protocolAutolink",tokenize:U6,previous:u2},Br={name:"emailAutolink",tokenize:D6,previous:d2},pr={};function O6(){return{text:pr}}let Ps=48;for(;Ps<123;)pr[Ps]=Br,Ps++,Ps===58?Ps=65:Ps===91&&(Ps=97);pr[43]=Br;pr[45]=Br;pr[46]=Br;pr[95]=Br;pr[72]=[Br,o2];pr[104]=[Br,o2];pr[87]=[Br,i2];pr[119]=[Br,i2];function D6(e,n,r){const s=this;let o,c;return d;function d(y){return!Ch(y)||!d2.call(s,s.previous)||Rp(s.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return Ch(y)?(e.consume(y),f):y===64?(e.consume(y),m):r(y)}function m(y){return y===46?e.check(L6,p,h)(y):y===45||y===95||En(y)?(c=!0,e.consume(y),m):p(y)}function h(y){return e.consume(y),o=!0,m}function p(y){return c&&o&&zn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(y)):r(y)}}function z6(e,n,r){const s=this;return o;function o(d){return d!==87&&d!==119||!c2.call(s,s.previous)||Rp(s.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(I6,e.attempt(r2,e.attempt(s2,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)&&u2.call(s,s.previous)&&!Rp(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||Lu(y)||Et(y)||Zs(y)||ed(y)?r(y):e.attempt(r2,e.attempt(s2,p),r)(y)}function p(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(y)}}function $6(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 B6(e,n,r){let s,o,c;return d;function d(h){return h===46||h===95?e.check(l2,m,f)(h):h===null||Et(h)||Zs(h)||h!==45&&ed(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 H6(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(l2,n,c)(d):d===null||Et(d)||Zs(d)?n(d):(e.consume(d),o)}function c(d){return d===41&&s++,e.consume(d),o}}function P6(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||Et(f)||Zs(f)?n(f):r(f)}function o(f){return f===null||f===40||f===91||Et(f)||Zs(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 F6(e,n,r){return s;function s(c){return e.consume(c),o}function o(c){return En(c)?r(c):n(c)}}function c2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Et(e)}function u2(e){return!zn(e)}function d2(e){return!(e===47||Ch(e))}function Ch(e){return e===43||e===45||e===46||e===95||En(e)}function Rp(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 q6={tokenize:Z6,partial:!0};function V6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Y6,continuation:{tokenize:Q6},exit:X6}},text:{91:{name:"gfmFootnoteCall",tokenize:K6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:G6,resolveTo:W6}}}}function G6(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 W6(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 K6(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||Et(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 Et(y)||(d=!0),c++,e.consume(y),y===92?p:h}function p(y){return y===91||y===92||y===93?(e.consume(y),c++,h):h(y)}}function Y6(e,n,r){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,d=0,f;return m;function m(j){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(j){return j===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):r(j)}function p(j){if(d>999||j===93&&!f||j===null||j===91||Et(j))return r(j);if(j===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=Wa(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),k}return Et(j)||(f=!0),d++,e.consume(j),j===92?y:p}function y(j){return j===91||j===92||j===93?(e.consume(j),d++,p):p(j)}function k(j){return j===58?(e.enter("definitionMarker"),e.consume(j),e.exit("definitionMarker"),o.includes(c)||o.push(c),st(e,w,"gfmFootnoteDefinitionWhitespace")):r(j)}function w(j){return n(j)}}function Q6(e,n,r){return e.check(zo,n,e.attempt(q6,n,r))}function X6(e){e.exit("gfmFootnoteDefinition")}function Z6(e,n,r){const s=this;return st(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 J6(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 p={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",p,f],["enter",d[h][1],f],["exit",d[h][1],f],["enter",y,f]],w=f.parser.constructs.insideSpan.null;w&&ca(k,k.length,0,td(w,d.slice(h+1,m),f)),ca(k,k.length,0,[["exit",y,f],["enter",d[m][1],f],["exit",d[m][1],f],["exit",p,f]]),ca(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,p=this.events;let y=0;return k;function k(j){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(j):(d.enter("strikethroughSequenceTemporary"),w(j))}function w(j){const C=Gl(h);if(j===126)return y>1?m(j):(d.consume(j),y++,w);if(y<2&&!r)return m(j);const T=d.exit("strikethroughSequenceTemporary"),A=Gl(j);return T._open=!A||A===2&&!!C,T._close=!C||C===2&&!!A,f(j)}}}class eR{constructor(){this.map=[]}add(n,r,s){tR(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 tR(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 nR(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 aR(){return{flow:{null:{name:"table",tokenize:rR,resolveAll:sR}}}}function rR(e,n,r){const s=this;let o=0,c=0,d;return f;function f(D){let q=s.events.length-1;for(;q>-1;){const ee=s.events[q][1].type;if(ee==="lineEnding"||ee==="linePrefix")q--;else break}const P=q>-1?s.events[q][1].type:null,K=P==="tableHead"||P==="tableRow"?I:m;return K===I&&s.parser.lazy[s.now().line]?r(D):K(D)}function m(D){return e.enter("tableHead"),e.enter("tableRow"),h(D)}function h(D){return D===124||(d=!0,c+=1),p(D)}function p(D){return D===null?r(D):Ie(D)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w):r(D):Je(D)?st(e,p,"whitespace")(D):(c+=1,d&&(d=!1,o+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),d=!0,p):(e.enter("data"),y(D)))}function y(D){return D===null||D===124||Et(D)?(e.exit("data"),p(D)):(e.consume(D),D===92?k:y)}function k(D){return D===92||D===124?(e.consume(D),y):y(D)}function w(D){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(D):(e.enter("tableDelimiterRow"),d=!1,Je(D)?st(e,j,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):j(D))}function j(D){return D===45||D===58?T(D):D===124?(d=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),C):O(D)}function C(D){return Je(D)?st(e,T,"whitespace")(D):T(D)}function T(D){return D===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),A):D===45?(c+=1,A(D)):D===null||Ie(D)?H(D):O(D)}function A(D){return D===45?(e.enter("tableDelimiterFiller"),R(D)):O(D)}function R(D){return D===45?(e.consume(D),R):D===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),L):(e.exit("tableDelimiterFiller"),L(D))}function L(D){return Je(D)?st(e,H,"whitespace")(D):H(D)}function H(D){return D===124?j(D):D===null||Ie(D)?!d||o!==c?O(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(D)):O(D)}function O(D){return r(D)}function I(D){return e.enter("tableRow"),z(D)}function z(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),z):D===null||Ie(D)?(e.exit("tableRow"),n(D)):Je(D)?st(e,z,"whitespace")(D):(e.enter("data"),W(D))}function W(D){return D===null||D===124||Et(D)?(e.exit("data"),z(D)):(e.consume(D),D===92?X:W)}function X(D){return D===92||D===124?(e.consume(D),W):W(D)}}function sR(e,n){let r=-1,s=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,p,y;const k=new eR;for(;++r<e.length;){const w=e[r],j=w[1];w[0]==="enter"?j.type==="tableHead"?(f=!1,m!==0&&(G1(k,n,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},k.add(r,0,[["enter",h,n]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(s=!0,y=void 0,c=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},k.add(r,0,[["enter",p,n]])),o=j.type==="tableDelimiterRow"?2:p?3:1):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(s=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],y=au(k,n,c,o,void 0,y),c=[0,0,0,0]),d[2]=r)):j.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(d[0]=d[1],y=au(k,n,c,o,void 0,y)),c=d,d=[c[1],r,0,0])):j.type==="tableHead"?(f=!0,m=r):j.type==="tableRow"||j.type==="tableDelimiterRow"?(m=r,c[1]!==0?(d[0]=d[1],y=au(k,n,c,o,r,y)):d[1]!==0&&(y=au(k,n,d,o,r,y)),o=0):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&G1(k,n,m,h,p),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=nR(n.events,r))}return e}function au(e,n,r,s,o,c){const d=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(c.end=Object.assign({},Ul(n.events,r[0])),e.add(r[0],0,[["exit",c,n]]));const m=Ul(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=Ul(n.events,r[2]),p=Ul(n.events,r[3]),y={type:f,start:Object.assign({},h),end:Object.assign({},p)};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 j=r[2]+1,C=r[3]-r[2]-1;e.add(j,C,[])}}e.add(r[3]+1,0,[["exit",y,n]])}return o!==void 0&&(c.end=Object.assign({},Ul(n.events,o)),e.add(o,0,[["exit",c,n]]),c=void 0),c}function G1(e,n,r,s,o){const c=[],d=Ul(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 Ul(e,n){const r=e[n],s=r[0]==="enter"?"start":"end";return r[1][s]}const lR={name:"tasklistCheck",tokenize:oR};function iR(){return{text:{91:lR}}}function oR(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 Et(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 Ie(m)?n(m):Je(m)?e.check({tokenize:cR},n,r)(m):r(m)}}function cR(e,n,r){return st(e,s,"whitespace");function s(o){return o===null?r(o):n(o)}}function uR(e){return wk([O6(),V6(),J6(e),aR(),iR()])}const dR={};function Bo(e){const n=this,r=e||dR,s=n.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),d=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(uR(r)),c.push(R6()),d.push(_6(r))}const fR="modulepreload",mR=function(e){return"/"+e},W1={},hR=function(n,r,s){let o=Promise.resolve();if(r&&r.length>0){let m=function(h){return Promise.all(h.map(p=>Promise.resolve(p).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=mR(h),h in W1)return;W1[h]=!0;const p=h.endsWith(".css"),y=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const k=document.createElement("link");if(k.rel=p?"stylesheet":fR,p||(k.as="script"),k.crossOrigin="",k.href=h,f&&k.setAttribute("nonce",f),document.head.appendChild(k),p)return new Promise((w,j)=>{k.addEventListener("load",w),k.addEventListener("error",()=>j(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)})},pR=1500;function gR({code:e}){const[n,r]=v.useState(!1),s=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),pR)};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(Ue,{d:n?on.check:on.copy})})}function _p({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 hR(()=>import("./index-DibOt1-H.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(gR,{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 xR(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(n=>typeof n=="string").join(""):""}function f2({children:e,streaming:n}){if(v.isValidElement(e)){const r=e.props,s=/language-([\w+-]+)/.exec(r.className??"")?.[1]??"";return l.jsx(_p,{language:s,code:xR(r.children).replace(/\n$/,""),highlight:!n})}return l.jsx("pre",{children:e})}function m2({node:e,children:n,...r}){return l.jsx("a",{...r,target:"_blank",rel:"noreferrer",children:n})}const yR={pre:e=>l.jsx(f2,{streaming:!0,children:e.children}),a:m2},bR={pre:e=>l.jsx(f2,{streaming:!1,children:e.children}),a:m2},h2=v.memo(function({text:n,streaming:r=!1}){return l.jsx($o,{remarkPlugins:[Bo],components:r?yR:bR,children:n})});function $r({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(vR,{src:e,alt:n,onClose:()=>o(!1)})]})}function vR({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]),Ql.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 kR=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"]),wR=/^[a-z][a-z0-9+.-]*:\/\//i;function SR(e){const n=e.trim();if(n.length===0||n.length>200||/\s/.test(n)||wR.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:kR.has(s)}const jR=512;function NR(e,n){const r=e.trim();if(r.length===0||r.length>jR||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 K1=3;function CR(e){const n=[],r=new Set;for(const s of e.matchAll(/`([^`\n]+)`/g)){const o=s[1].trim();!SR(o)||r.has(o)||(r.add(o),n.push(o))}return n}function TR({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 MR({text:e,workspace:n,statFiles:r,onOpenFile:s}){const o=v.useMemo(()=>{const y=[],k=new Set;for(const w of CR(e)){const j=NR(w,n);j===null||k.has(j)||(k.add(j),y.push(j))}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,K1),p=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(TR,{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)),(p>0||f)&&c.length>K1&&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(p),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 ER={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"},Y1={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 Ho({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 ${Y1.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 ${Y1[e]}`,children:[r&&l.jsx("title",{children:r}),l.jsx("path",{d:ER[e]})]})}function Mo({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:Fv(Math.max(0,n)+Math.max(0,r-e))})}function AR({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(Ho,{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(Mo,{sinceMs:e.startedAtMs}):e.durationMs!==void 0?xn(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(An,{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(h2,{text:e.thinking,streaming:e.streaming})})]})}function RR({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(ve,{size:"sm",variant:"primary",disabled:n,onClick:()=>{s("allow")},children:x.chat.approve}),l.jsx(ve,{size:"sm",disabled:n,onClick:()=>{s("deny")},children:x.chat.deny})]})}function p2(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 _R(e){let n=0;for(const r of e)(r.kind==="user_text"||r.kind==="user_image")&&(n+=1);return n}function g2(e,n){try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"){const s=r[n];if(typeof s=="string"&&s.length>0)return s}}catch{}return null}function x2(e){return g2(e,"agent_id")}function IR(e){return g2(e,"description")}function LR(e,n,r){return y2(e.items.slice(p2(e.items)),n,{running:r})}function OR(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 y2(o.slice(d,f),n,{running:f===o.length&&r})}function y2(e,n,r){const s=[{sessionId:n,agentId:null,description:null,running:r.running,depth:0,origin:[],parentId:null}],o=new Set([n]),c=(f,m,h,p,y,k,w)=>{if(o.has(f))return;o.add(f);const j=[...y,f],C=m.firstTsMs??m.firstSeenLocalMs,T=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,description:w,running:h,depth:j.length,origin:j,parentId:p,...C!==void 0?{startedMs:C}:{},...T!==void 0?{elapsedMs:T}:{}}),d(m.items,f,j)},d=(f,m,h)=>{for(const p of f)p.kind==="tool_call"&&p.subagent&&p.subagentSessionId?c(p.subagentSessionId,p.subagent,!p.outputComplete,m,h,x2(p.argumentsText),IR(p.argumentsText)):p.kind==="subagent"&&c(p.sessionId,p.model,!1,m,h,null,null)};return d(e,n,[]),s}function DR(e){const n=e.items;for(let r=p2(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 zR(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 Cu=200,uo=46,Bm=32,Q1=10,ru=6;function UR(e){const n=new Map;for(const p of e){if(p.parentId===null)continue;const y=n.get(p.parentId);y?y.push(p):n.set(p.parentId,[p])}const r=new Map;let s=0;const o=p=>{const y=n.get(p.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(p.sessionId,k),k};for(const p of e)p.parentId===null&&o(p);const c=e.map(p=>({node:p,x:ru+p.depth*(Cu+Bm),y:ru+(r.get(p.sessionId)??0)*(uo+Q1)})),d=new Map(c.map(p=>[p.node.sessionId,p])),f=[];for(const p of c){if(p.node.parentId===null)continue;const y=d.get(p.node.parentId);if(!y)continue;const k=y.x+Cu,w=y.y+uo/2,j=p.x,C=p.y+uo/2,T=k+Bm/2;f.push({fromId:y.node.sessionId,toId:p.node.sessionId,path:w===C?`M ${k} ${w} H ${j}`:`M ${k} ${w} H ${T} V ${C} H ${j}`})}const m=e.reduce((p,y)=>Math.max(p,y.depth),0),h=Math.max(1,s);return{width:ru*2+(m+1)*Cu+m*Bm,height:ru*2+h*uo+(h-1)*Q1,nodes:c,edges:f}}function Th(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 Mh(e){return e.length>8?e.slice(-8):e}function b2({sessionId:e,model:n,running:r,ctx:s,agentId:o=null}){const{agents:c}=fn(),{sessions:d}=el(),f=Th({sessionId:e,agentId:n.meta?.agentId??o},c,d)??x.chat.subagent,m=CC(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(da,{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:Mh(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 $R=new Set(["exec_command","input_command","run_subagent","input_subagent"]),Ip=new Set(["read_file","edit_file","write_file"]);function BR(e){return e==="aborted"?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"}function v2(e){const n=e.split("/").filter(r=>r.length>0);return n.length<=2?e:`…/${n[n.length-2]}/${n[n.length-1]}`}function HR(e,n){if(e==="exec_command"){const r=Uu(n,"cmd");if(r!==null)return`$ ${r.replace(/\s+/g," ").trim()}`}if(Ip.has(e)){const r=Uu(n,"file_path");if(r!==null)return v2(r.replace(/\s+/g," ").trim())}return n.replace(/\s+/g," ").trim()}function PR(e,n){if($R.has(e)){const r=Uu(n,"description");if(r!==null){const s=r.replace(/\s+/g," ").trim();if(s)return s}return null}if(Ip.has(e)){const r=Uu(n,"file_path");if(r!==null){const s=r.replace(/\s+/g," ").trim();if(s)return v2(s)}}return null}function FR(e,n){if(!Ip.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(`
167
+ `)?o.push(`${d}:
168
+ ${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(`
169
+ `)}function Uu(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"?`
170
+ `:f==="t"?" ":f,d=!1;continue}if(f==="\\"){d=!0;continue}if(f==='"')return c;c+=f}return c}function qR({item:e,ctx:n}){const[r,s]=v.useState(!1),o=v.useRef(!1),c=n.pendingApprovals.get(Vl(n.origin,e.toolCallId)),d=HR(e.name,e.argumentsText),f=PR(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,p=e.callStopReason!==void 0&&e.callStopReason!=="completed"||e.outputStopReason!==void 0&&e.outputStopReason!=="completed",y=c?"waiting":m||e.callStreaming?"running":p?"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",j=c?x.chat.approvalWaiting:y==="running"?x.chat.workRunning:y==="done"?k??x.chat.workDone:w?k??void 0:e.outputStopReason??e.callStopReason,C=[...new Set([e.callStopReason,w?void 0:e.outputStopReason].filter(T=>T!==void 0&&T!=="completed"))];return l.jsxs("div",{children:[l.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{o.current=!0,s(T=>!T)},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(Ho,{state:y,label:j}),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?xn(e.durationMs):m?l.jsx(Mo,{sinceMs:e.approvalAtMs??e.callStartedAtMs,offsetMs:h}):c?h>0?xn(h):null:e.callStreaming?e.argStartedAtMs!==void 0?l.jsx(Mo,{sinceMs:e.argStartedAtMs}):l.jsx("span",{className:"animate-pulse",children:"…"}):null}),C.map(T=>l.jsxs("span",{className:`shrink-0 font-mono text-xs ${BR(T)}`,children:["[",T,"]"]},T)),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(An,{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 T=FR(e.name,e.argumentsText);return T!==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:T}):null})(),l.jsx(RR,{onDecide:T=>n.onApprove(e.toolCallId,T,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((T,A)=>l.jsx($r,{src:T,alt:x.chat.toolImageAlt,className:"max-h-40 max-w-full rounded-md border border-gray-200 dark:border-gray-700"},A))})]}),e.subagent&&l.jsx("div",{className:"px-3 pb-2 pt-2",children:l.jsx(b2,{sessionId:e.subagentSessionId??"",model:e.subagent,running:!e.outputComplete,agentId:x2(e.argumentsText),ctx:n})})]})}function VR({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 Lp=-1,Eo="M21 12A9 9 0 1 1 12 3M17 12A5 5 0 1 1 12 7M12 12L15 9V5L18 2V6H22L19 9H15";function su(e){const n=e.trim();if(n==="")return Lp;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}const GR="M3 5h18v14H3zM3 16l5-5 4 4 3-3 6 6M15.5 8.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0";function WR({images:e,showFull:n,onExpand:r}){return e.length===0?null:n?l.jsx("div",{className:"mt-1.5 flex max-w-[88%] flex-wrap justify-end gap-1.5 md:max-w-[75%]",children:e.map((s,o)=>l.jsx($r,{src:s,alt:x.chat.imageAlt,className:"max-h-40 max-w-full rounded-md"},o))}):l.jsxs("button",{type:"button",onClick:r,className:"mt-1.5 flex items-center gap-1.5 rounded-md border border-gray-200 bg-gray-50 px-2 py-1 text-xs text-gray-500 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800",children:[l.jsx(Ue,{d:GR,size:12,className:"shrink-0"}),x.chat.goalRoundImages(e.length)]})}function KR({round:e,objective:n,images:r=[]}){const[s,o]=v.useState(!1),c=r.length>0&&(e===1||s);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.jsx(WR,{images:r,showFull:c,onExpand:()=>o(!0)}),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(Ue,{d:Eo,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(Ue,{d:Eo,className:"text-gray-400 dark:text-gray-500"}),x.chat.goalRoundBanner(e)]})}function YR({goal:e}){const n=e.budget>0&&e.budget!==Lp?`${lt(e.used)}/${lt(e.budget)}`:lt(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(Ue,{d:Eo,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 QR(e){return e.agentName&&e.agentName!==e.agentId?`${e.agentName} (${e.agentId})`:e.agentId}const Eh="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 XR({origin:e}){const n=ha(),r=x.chat.handoffFrom(QR(e));if(!e.sessionId)return l.jsx("p",{className:Eh,children:r});const s=e.sessionId;return l.jsxs("button",{type:"button",title:x.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${s}`),className:`${Eh} 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 ZR({origin:e}){const n=ha(),r=e.sessionId;return l.jsxs("button",{type:"button",title:x.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${r}`),className:`${Eh} 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 JR({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:ua(e.firedAt)})]})}const Op="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 e8(e,n,r){return e==="zh"&&r?r:n}function Po(e,n){return e==="zh"?n.shortDescriptionZh||n.shortDescription||n.description:n.shortDescription||n.description}function t8(e,n,r){const s=r.trim().toLowerCase();return s?e.filter(o=>o.name.toLowerCase().includes(s)||Po(n,o).toLowerCase().includes(s)):e}function n8(e,n){return e.map(r=>({name:r.name,cmd:`/${r.name}`,desc:Po(n,r)}))}function X1({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(Ue,{d:Op,className:"text-gray-400 dark:text-gray-500"}),x.chat.skillsBanner(e)]})}const Ah="M21.4 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.2-9.19a4 4 0 0 1 5.65 5.66l-9.19 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48";function a8({files:e}){const n=x.chat.attachedFilesBanner(e.map(PC));return l.jsxs("p",{title:n,className:"anim-msg my-2 flex w-fit max-w-full 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(Ue,{d:Ah,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 truncate",children:n})]})}const r8=eC,s8=sC;function l8(e,n){const r=n.trim().toLowerCase();return r?e.filter(s=>s.agentId.toLowerCase().includes(r)||(s.name??"").toLowerCase().includes(r)):e}function i8({handoffTarget:e,pendingModel:n,canSwitchModel:r,sessionBusy:s}){return e?"handoff":!n||!r?"post":s?"blocked":"model"}function to({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(Ue,{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 o8({stats:e,assistantText:n,cost:r,atMs:s}){const[o,c]=v.useState(!1),{currency:d}=ks(),{locale:f}=Qa(),m=e?.tokensByBucket,h=m?m.cacheRead+m.cacheWrite:0,p=()=>{const y=n?.trim()||e===null?n??"":kC(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:Gv(s,f)}),e&&m&&l.jsxs(l.Fragment,{children:[l.jsx(to,{icon:on.input,value:lt(h),label:x.chat.statInput}),l.jsx(to,{icon:on.output,value:lt(m.output),label:x.chat.statOutput}),l.jsx(to,{icon:on.tps,value:Au(e.outputTps),label:x.chat.statTps,display:"hidden sm:flex"}),r!=null&&l.jsx(to,{icon:on.cost,value:Ya(r,d),compactValue:Ya(r,d,{compact:!0}),label:`${x.common.cost}(${d})`}),l.jsx(to,{icon:on.elapsed,value:xn(e.elapsedDeltaMs),compactValue:xn(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:p,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(Ue,{d:o?on.check:on.copy})})]})}const c8=1200,u8="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 lu({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),c8))};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:Gv(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(Ue,{d:o?on.check:on.copy})})]})}const d8=2e3;function f8({item:e,ctx:n}){const r=e.gaveUp?"gaveUp":e.retrying?"retried":"waiting",s=r==="waiting"&&e.plannedDelayMs!==void 0&&e.plannedDelayMs>=d8&&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,p=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,p)}),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 k2({item:e,ctx:n}){switch(e.kind){case"user_text":{const r=nC(e.text);if(r)return l.jsx(XR,{origin:r});const s=iC(e.text);if(s)return l.jsx(ZR,{origin:s});const o=uC(e.text),c=o?o.rest:e.text,d=rC(c),f=d?d.rest:c,m=J4(f),{text:h,images:p,files:y}=a1(m?m.rest:f);return o?l.jsxs(l.Fragment,{children:[m&&l.jsx(X1,{names:m.skills}),l.jsx(KR,{round:o.round,objective:h,images:p})]}):l.jsxs(l.Fragment,{children:[d&&l.jsx(JR,{origin:d.origin}),m&&l.jsx(X1,{names:m.skills}),y.length>0&&l.jsx(a8,{files:y}),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(lu,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:h,align:"right"})]}),p.map((k,w)=>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($r,{src:k,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),l.jsx(lu,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]},w))]})}case"user_steering":{const{text:r,images:s}=a1(e.text),o=[...s,...e.images??[]];return l.jsxs("div",{className:"anim-msg group my-2 flex flex-col items-end",children:[l.jsxs("div",{className:"flex max-w-[88%] flex-col 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.jsxs("div",{className:"flex items-start gap-1.5",children:[l.jsx(Ue,{d:u8,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}),r]})]}),o.length>0&&l.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:o.map((c,d)=>l.jsx($r,{src:c,alt:x.chat.imageAlt,className:"max-h-28 max-w-full rounded-md"},d))})]}),l.jsx(lu,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:r,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($r,{src:e.imageUrl,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),l.jsx(lu,{...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(h2,{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(MR,{text:e.text,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile})]});case"thinking":return l.jsx(AR,{item:e});case"tool_call":return l.jsx(qR,{item:e,ctx:n});case"subagent":return l.jsx("div",{className:"anim-msg my-2",children:l.jsx(b2,{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(f8,{item:e,ctx:n});case"compaction":return l.jsx(VR,{item:e});case"task_stats":return l.jsx(o8,{stats:e.stats,assistantText:e.assistantText,cost:e.stats?n.taskCost?.(e.stats)??null:null,...e.atMs!==void 0?{atMs:e.atMs}:{}})}}function m8(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 p=m+h;(o===void 0||p>o)&&(o=p)};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 h8(e){return e.kind==="thinking"||e.kind==="tool_call"}function p8(e,n){return e.kind==="thinking"?e.streaming:e.kind==="tool_call"?e.callStreaming||e.outputStreaming||e.callComplete&&!e.outputComplete?!0:n.pendingApprovals.has(Vl(n.origin,e.toolCallId)):!1}function g8(e,n){return e.some(r=>r.kind==="tool_call"&&n.pendingApprovals.has(Vl(n.origin,r.toolCallId)))}function x8({items:e,ctx:n,isLast:r}){const s=e.some(w=>p8(w,n)),o=r&&n.taskRunning||s,c=g8(e,n),[d,f]=v.useState(r),m=v.useRef(!1);v.useEffect(()=>{m.current||f(r)},[r]);const h=d||c,{steps:p,durationMs:y,startMs:k}=m8(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(Ho,{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}),p>0&&l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:inline",children:x.chat.workGroupSteps(p)}),s?k!==void 0&&l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:l.jsx(Mo,{sinceMs:k})}):y>0&&l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:xn(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(An,{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(k2,{item:w,ctx:n},w.id))})]})}function y8(){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)h8(h)?s.push(h):(o(),r.push({type:"single",item:h}));o();const c=(h,p)=>h.type==="group"?l.jsx(x8,{items:h.items,ctx:n,isLast:p===r.length-1},`wg-${h.items[0].id}`):l.jsx(k2,{item:h.item,ctx:n},h.item.id),d=[];let f=[];const m=()=>{if(f.length===0)return;const h=f[0].seg,p=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-${p}`))};for(let h=0;h<r.length;h++){const p=r[h];if(p.type==="single"&&(p.item.kind==="user_text"||p.item.kind==="user_image")){m(),d.push(c(p,h));continue}f.push({seg:p,i:h}),p.type==="single"&&p.item.kind==="task_stats"&&m()}return m(),l.jsx(l.Fragment,{children:d})}function w2({items:e,version:n,ctx:r}){const s=v.useRef(null),o=v.useRef(null),c=o.current??=y8(),[d,f]=v.useState(!1),m=v.useRef(!1),h=v.useRef(null),p=()=>{h.current!==null&&(cancelAnimationFrame(h.current),h.current=null),m.current=!1};v.useEffect(()=>()=>p(),[]);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 T=y.current;y.current=C.scrollTop,m.current&&T!==null&&C.scrollTop<T-1&&p(),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 j=()=>{const C=s.current;if(!C)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){c.resume(),C.scrollTop=C.scrollHeight,k();return}p(),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=L=>{h.current=null;const H=s.current;if(!H||!m.current)return;const O=Math.min(.05,Math.max(.001,(L-A)/1e3));A=L;const I=H.scrollHeight-H.clientHeight-H.scrollTop;if(I<=1){m.current=!1,c.resume(),H.scrollTop=H.scrollHeight,k();return}const z=Math.max(I*Math.min(1,O*10),3200*O);H.scrollTop+=Math.min(z,I),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&&p(),k()},onTouchStart:C=>{const T=C.touches[0];T&&c.touchStart(T.clientY)},onTouchMove:C=>{const T=C.touches[0];T&&c.touchMove(T.clientY),m.current&&p(),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(fr,{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:j,className:"anim-pop absolute bottom-3 left-1/2 z-10 -translate-x-1/2 rounded-full border border-gray-300 bg-white p-1.5 text-gray-500 shadow-sm transition-colors duration-150 hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-100",children: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 v8=128e3;function S2(e){const n=typeof e=="string"?Number(e):e;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:v8}const k8=/[\s"'/]on[a-z]+\s*=/i,w8=/href\s*=/i;function S8(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")||w8.test(n)||k8.test(n)?null:n}const Hm=["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"],j8={firecrawl:3,"data-analysis":1,"web-design":2,"penguin-sdk":0};function N8(e){const n=j8[e];if(n!==void 0)return Hm[n];let r=0;for(let s=0;s<e.length;s++)r=r*31+e.charCodeAt(s)>>>0;return Hm[r%Hm.length]}function Dp({icon:e,size:n=20,className:r=""}){const s=S8(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(Ue,{d:Op,size:n,className:r})}const Z1={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"})]})},C8={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":Z1,"qwen-pay-as-you-go":Z1,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 Wl({provider:e,className:n}){const r=C8[e];if(!r){const s=Wv(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:Kv(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 St="https://openrouter.ai/api/v1",zr="https://api.siliconflow.cn/v1",$l="https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",fo="https://dashscope.aliyuncs.com/compatible-mode/v1",Vs="https://api.fireworks.ai/inference/v1",vs=[{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:St},{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:Vs},{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:zr},{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:$l},{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:fo},{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 gn(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 j2=[{modelId:"deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"deepseek",contextWindow:1e6,pricing:gn(.02,1,2),supportsVision:!1},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"deepseek",contextWindow:1e6,pricing:gn(.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:St},{modelId:"anthropic/claude-opus-5",displayName:"Claude Opus 5",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:St},{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:St},{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:St},{modelId:"anthropic/claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"openrouter",contextWindow:1e6,pricing:_e(2,2,10),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"deepseek/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"openrouter",contextWindow:1e6,pricing:_e(.09,.09,.18),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"deepseek/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"openrouter",contextWindow:1e6,pricing:_e(.435,.435,.87),supportsVision:!1,clientType:"openai",baseUrl:St},{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:St},{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:St},{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:St},{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:St},{modelId:"minimax/minimax-m3",displayName:"MiniMax M3",provider:"openrouter",contextWindow:1048576,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"moonshotai/kimi-k3",displayName:"Kimi K3",provider:"openrouter",contextWindow:1e6,pricing:_e(3,3,15),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"moonshotai/kimi-k2.6",displayName:"Kimi K2.6",provider:"openrouter",contextWindow:262144,pricing:_e(.144,.684,3.42),supportsVision:!0,clientType:"openai",baseUrl:St},{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:St},{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:St},{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:St},{modelId:"openai/gpt-5.5",displayName:"GPT-5.5",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,30),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"openrouter/free",displayName:"Free Models Router",provider:"openrouter",contextWindow:128e3,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:St},{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:St},{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:St},{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:St},{modelId:"tencent/hy3",displayName:"Hy3",provider:"openrouter",contextWindow:262144,pricing:_e(.035,.14,.58),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"x-ai/grok-4.5",displayName:"Grok 4.5",provider:"openrouter",contextWindow:5e5,pricing:_e(2,2,6),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"xiaomi/mimo-v2.5",displayName:"MiMo-V2.5",provider:"openrouter",contextWindow:1048576,pricing:_e(.0028,.14,.28),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"z-ai/glm-5.2",displayName:"GLM-5.2",provider:"openrouter",contextWindow:1e6,pricing:_e(.93,.93,3),supportsVision:!1,clientType:"openai",baseUrl:St},{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:St},{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:Vs},{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:Vs},{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:Vs},{modelId:"accounts/fireworks/models/kimi-k3",displayName:"Kimi K3",provider:"fireworks",contextWindow:1e6,pricing:_e(.3,3,15),supportsVision:!0,clientType:"openai",baseUrl:Vs},{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:Vs},{modelId:"accounts/fireworks/models/minimax-m3",displayName:"MiniMax M3",provider:"fireworks",contextWindow:524288,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:Vs},{modelId:"deepseek-ai/DeepSeek-V4-Flash",displayName:"DeepSeek V4 Flash",provider:"siliconflow",contextWindow:1e6,pricing:gn(.02,1,2),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"deepseek-ai/DeepSeek-V4-Pro",displayName:"DeepSeek V4 Pro",provider:"siliconflow",contextWindow:1e6,pricing:gn(.1,12,24),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"meituan-longcat/LongCat-2.0",displayName:"LongCat 2.0",provider:"siliconflow",contextWindow:1e6,pricing:gn(.1,5,20),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"moonshotai/Kimi-K2.7-Code",displayName:"Kimi K2.7 Code",provider:"siliconflow",contextWindow:262144,pricing:gn(1.3,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:zr},{modelId:"Pro/moonshotai/Kimi-K2.6",displayName:"Kimi K2.6",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:zr},{modelId:"Pro/zai-org/GLM-5.1",displayName:"GLM-5.1",provider:"siliconflow",contextWindow:2e5,supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"Qwen/Qwen3.6-35B-A3B",displayName:"Qwen 3.6 35B A3B",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:zr},{modelId:"zai-org/GLM-5.2",displayName:"GLM-5.2",provider:"siliconflow",contextWindow:1e6,pricing:gn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"qwen-token-plan",contextWindow:1e6,pricing:gn(1,12,24),supportsVision:!1,clientType:"openai",baseUrl:$l},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"qwen-token-plan",contextWindow:1048576,pricing:gn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:$l},{modelId:"qwen3.8-max-preview",displayName:"Qwen 3.8 Max Preview",provider:"qwen-token-plan",contextWindow:1e6,supportsVision:!0,clientType:"openai",baseUrl:$l},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-token-plan",contextWindow:1e6,pricing:gn(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:$l},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-token-plan",contextWindow:1e6,pricing:gn(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:$l},{modelId:"kimi/kimi-k3",displayName:"Kimi K3",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:gn(2,20,100),supportsVision:!0,clientType:"openai",baseUrl:fo},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:gn(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:fo},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:gn(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:fo},{modelId:"ZHIPU/GLM-5.2",displayName:"GLM-5.2",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:gn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:fo},{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:gn(2,20,100),supportsVision:!0},{modelId:"kimi-k2.6",displayName:"Kimi K2.6",provider:"moonshot",contextWindow:262144,pricing:gn(1.1,6.5,27),supportsVision:!0},{modelId:"kimi-k2.5",displayName:"Kimi K2.5",provider:"moonshot",contextWindow:262144,pricing:gn(.7,4,21),supportsVision:!0}];function zp(e,n){return j2.find(r=>r.provider===e&&r.modelId===n)}function cr(e){return vs.find(n=>n.id===e)}function T8(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 M8(){return j2.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 J1(e,n){if(e==="openrouter")return`https://openrouter.ai/${n}`;if(e==="qwen-token-plan")return n==="qwen3.8-max-preview"?cr(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]}`:cr(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]}`:cr(e)?.modelsUrl}if(e!=="custom")return cr(e)?.modelsUrl}function ht(e,n){return!!e&&!!n&&e.provider===n.provider&&e.modelId===n.modelId}function N2(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=vs.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 T2(e,n){const r=n.trim()!=="",s=e.filter(f=>C2(f,n)),o=vs.map(f=>({provider:f,rows:s.filter(m=>m.provider===f.id)})),d=[...new Set(s.map(f=>f.provider).filter(f=>!vs.some(m=>m.id===f)))].sort().map(f=>({provider:N2(f),rows:s.filter(m=>m.provider===f)}));return[...o,...d].filter(f=>f.rows.length>0||!r&&f.provider.id==="custom")}function E8(e){return T2(e,"").flatMap(n=>n.rows)}function Rh(e){return!!e.credential?.apiKeyMasked}function M2(e){return e?[e.cacheRead,e.cacheWrite,e.output].every(n=>typeof n=="string"?n.trim()!==""&&Number(n)===0:n===0):!1}function eb(e,{showAll:n,query:r,selected:s,defaultModel:o}){const c=E8(e);return(n||!c.some(Rh)?c:c.filter(f=>Rh(f)||ht(f,s)||ht(f,o))).filter(f=>C2(f,r))}const A8=/^[\w-]*$/;function tb(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(!A8.test(o))return null;const c=/^[\w-]*/.exec(e.slice(n))[0];return{start:s,end:n+c.length,query:o}}function R8(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 _8=["none","low","medium","high","xhigh"],I8=["low","medium","high","xhigh"];function L8(e,n){return n&&_8.includes(n)?e[n]??n:null}function O8(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}function D8(e){if(e.sending)return"disabled";const n=!e.goalOn&&!e.modelAuthDead;return n&&e.canSteerChannel&&!e.hasHandoffTarget&&!e.hasPendingModel&&(e.hasText||e.hasImages)&&!e.followUpMode?"steer":n&&e.canQueueChannel&&e.stagedRoute!=="blocked"&&e.hasContent?"queue":"stop"}const z8=["always-ask","read-only","allow-all","deny-all"],nb={"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 U8({value:e,onChange:n,disabled:r,direction:s="up"}){const[o,c]=v.useState(!1);return l.jsx(La,{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:nb[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:z8.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:nb[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 yo(e){return e.displayName??e.modelId}const $8="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 E2({items:e,itemKey:n,isCurrent:r,query:s,onQueryChange:o,searchPlaceholder:c,emptyText:d,onPick:f,renderRow:m,footer:h}){const[p,y]=v.useState(-1),k=p>=0&&p<e.length?n(e[p]):null,w=j=>{if(e.length!==0){if(j.key==="ArrowDown"){j.preventDefault(),y(C=>(C+1)%e.length);return}if(j.key==="ArrowUp"){j.preventDefault(),y(C=>C<=0?e.length-1:C-1);return}(j.key==="Enter"&&!j.shiftKey||j.key==="Tab")&&!j.nativeEvent.isComposing&&(j.preventDefault(),f(e[p>=0?p:0]))}};return l.jsxs("div",{className:"contents",onKeyDown:w,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:s,onChange:j=>{o(j.target.value),y(-1)},placeholder:c,"aria-label":c,...Zu,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:[e.length===0&&l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:d}),e.map(j=>{const C=n(j),T=r?.(j)??!1;return l.jsxs("button",{type:"button",ref:C===k?A=>A?.scrollIntoView({block:"nearest"}):void 0,onClick:()=>f(j),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 ${T?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}${C===k?" bg-gray-100 dark:bg-gray-800":""}`,children:[m(j),l.jsx("span",{className:"w-3 shrink-0 text-center text-xs",children:T?"✓":""})]},C)})]}),h]})}function A2({models:e,value:n,defaultModel:r,onPick:s}){const[o,c]=v.useState(""),[d,f]=v.useState(!1),m=eb(e,{showAll:d,query:o,selected:n,defaultModel:r}),h=d?0:eb(e,{showAll:!0,query:o,selected:n,defaultModel:r}).length-m.length;return l.jsx(E2,{items:m,itemKey:p=>`${p.provider}:${p.modelId}`,isCurrent:p=>ht(p,n),query:o,onQueryChange:c,searchPlaceholder:x.models.searchPlaceholder,emptyText:x.models.noSearchResults,onPick:s,renderRow:p=>l.jsxs(l.Fragment,{children:[l.jsx(Wl,{provider:p.provider,className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:yo(p)}),M2(p.pricing)&&l.jsx("span",{className:"shrink-0",children:l.jsx(Jt,{tone:"yellow",children:x.models.freeBadge})}),!Rh(p)&&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(Ue,{d:$8,size:13})}),ht(p,r)&&l.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:x.models.default})]}),...h>0?{footer: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 B8({models:e,value:n,defaultModel:r,onChange:s,disabled:o}){const[c,d]=v.useState(!1),f=e.find(h=>ht(h,n)),m=f?yo(f):n?.modelId??"…";return l.jsx(La,{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(Wl,{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(A2,{models:e,value:n,...r!==void 0?{defaultModel:r}:{},onPick:h=>{s({provider:h.provider,modelId:h.modelId}),d(!1)}})})}function H8({agents:e,currentAgentId:n,onPick:r}){const[s,o]=v.useState("");return l.jsx(E2,{items:l8(e,s),itemKey:c=>c.agentId,isCurrent:c=>c.agentId===n,query:s,onQueryChange:o,searchPlaceholder:x.chat.agentSearchPlaceholder,emptyText:x.chat.agentsNoMatch,onPick:r,renderRow:c=>l.jsxs(l.Fragment,{children:[l.jsx(da,{id:c.agentId,name:un(c),size:16,className:"shrink-0 rounded"}),l.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:c.agentId}),c.name&&c.name!==c.agentId&&l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:c.name})]})})}function ab({panelRef:e,maxHeight:n,title:r,children:s}){return l.jsxs("div",{ref:e,style:{maxHeight:n},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:r}),s]})}const P8="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z";function rb({value:e,onChange:n,disabled:r,direction:s="down"}){const[o,c]=v.useState(!1),d=e===null?"…":L8(x.chat.thinkingLevelNames,e)??"—";return l.jsxs(La,{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(Ue,{d:P8,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}),I8.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 R2="penguin.steerMode";function F8(){return localStorage.getItem(R2)==="followup"?"followup":"steer"}const q8="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6";function V8({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(Ue,{d:q8,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 G8({skills:e,selected:n,onToggle:r,disabled:s,direction:o="up"}){const{locale:c}=Qa(),[d,f]=v.useState(!1),[m,h]=v.useState(""),p=t8(e,c,m);return l.jsxs(La,{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(Ue,{d:Op,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,...Zu,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}):p.length===0?l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.chat.skillsNoMatch}):p.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(Dp,{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:Po(c,y)}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:k?"✓":""})]},y.name)})})]})}const W8="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 K8({items:e,footer:n,direction:r="up"}){const[s,o]=v.useState(!1);return l.jsxs(La,{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(Ue,{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(Ue,{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 Y8({now:e,window:n,unknown:r=!1}){const s=S2(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?"—":lt(e),"/",lt(s)]})]})}const Q8=10*1024*1024;function X8(e){return new Promise(n=>{const r=new FileReader;r.onload=()=>n(typeof r.result=="string"?r.result:null),r.onerror=()=>n(null),r.readAsDataURL(e)})}function Z8(e,n,r){for(const s of n)e.push({type:"image_url",imageUrl:s});for(const s of r)e.push({type:"file",fileName:s.name,dataUrl:s.dataUrl})}function _2({status:e,onSend:n,onSteer:r,steeringDeliveredCount:s,onQueueFollowUp:o,queuedFollowUps:c=0,onStop:d,onCompact:f,modelRef:m,models:h,onChangeModel:p,onSwitchModel:y,defaultModel:k,thinkingLevel:w,onChangeThinkingLevel:j,turnThinkingLevel:C,onChangeTurnThinkingLevel:T,contextWindow:A,contextNow:R,contextStale:L=!1,vision:H,approvalMode:O,onChangeApprovalMode:I,modeSaving:z,autoFocus:W,agents:X,currentAgentId:D,skills:q,initialSkills:P,onSkillsChange:K,onHandoff:ee,initialText:B,onTextChange:U,initialHandoffTargetId:F,onHandoffTargetChange:Z,initialPendingModelRef:ue,onPendingModelChange:E,modelAuthDead:M=!1,onOpenModels:$,onRetryModelAuth:N,onNewSession:Y}){const{locale:le}=Qa(),[oe,pe]=v.useState(B??""),Ce=v.useRef(oe);Ce.current=oe;const[re,he]=v.useState([]),[xe,We]=v.useState([]),[Ke,$e]=v.useState(!1),[Bt,Ht]=v.useState(0),[jn,Te]=v.useState(null),[ze,ct]=v.useState(!1),At=v.useRef(null),[bt,$n]=v.useState(!1),ut=v.useRef(null),za=v.useRef(null),[ce,ye]=v.useState(),[Se,Le]=v.useState(null),[Be,Gt]=v.useState(null),[pt,Pt]=v.useState(P??[]),[mt,Ft]=v.useState(0),He=v.useRef(null),[mn]=v.useState(()=>window.matchMedia("(max-width: 767px)").matches),at=e==="running",Wt=e==="compacting",_n=oe.trim().length>0||re.length>0||xe.length>0||Se!==null||Be!==null||pt.length>0,[Rt,In]=v.useState(!1),[Nn,Bn]=v.useState(""),[yn,Ua]=v.useState(!1),[be,Ee]=v.useState(""),Ye=Rt?su(Nn):null,gt=su(be)===null,_t=Ye!==null&&Ye!==Lp?x.chat.goalBudgetValue(lt(Ye)):x.chat.goalBudgetUnlimited,Yt=i8({handoffTarget:Se!==null,pendingModel:Be!==null,canSwitchModel:y!==void 0,sessionBusy:at||Wt}),Xn=!at&&!Wt&&!Ke&&!M&&(Rt?oe.trim().length>0&&xe.length===0&&Ye!==null&&!(yn&&gt):_n),pa=v.useCallback(se=>{if(se){Ee(Nn),Ua(!0);return}su(be)!==null&&(Bn(be.trim()),Ua(!1))},[Nn,be]),nl=v.useCallback(()=>{Ua(!1),He.current?.focus()},[]),Hr=v.useCallback(()=>{su(be)!==null&&(Bn(be.trim()),Ua(!1),He.current?.focus())},[be]),Cn=v.useCallback(se=>{In(se),Ua(!1),Ee(""),se&&(Bn(""),Le(null),Z?.(null),Gt(null),E?.(null),We([]))},[Z,E]),[Qt,hn]=v.useState(F8),ga=se=>{hn(se),localStorage.setItem(R2,se)},Xa=Qt==="followup"&&o!==void 0,gr=D8({sending:Ke,goalOn:Rt,modelAuthDead:M,canSteerChannel:r!==void 0,canQueueChannel:o!==void 0,followUpMode:Xa,stagedRoute:Yt,hasHandoffTarget:Se!==null,hasPendingModel:Be!==null,hasText:oe.trim().length>0,hasImages:re.length>0,hasContent:_n}),al=at&&gr==="steer",js=at&&gr==="queue",xr=al||js,yr=gr==="queue"?x.chat.followUpSend:x.chat.steerSend,bn=at&&gr==="stop",[xa,Za]=v.useState(!1),ya=v.useRef(0);v.useEffect(()=>{xa&&(!at||(s??0)>ya.current)&&Za(!1)},[xa,at,s]);const Lt=v.useCallback(se=>{const we=pt.includes(se)?pt.filter(De=>De!==se):[...pt,se];Pt(we),K?.(we)},[pt,K]),Ns=v.useRef(null),rl=v.useMemo(()=>{const se=()=>{const we=Ns.current,De=we?R8(Ce.current,we):"";pe(De),U?.(De)};return[{cmd:"/compact",desc:x.chat.compact,run:()=>{se(),f()}},{cmd:"/goal",desc:x.chat.goalModeDesc,run:()=>{se(),Cn(!Rt)}},...y&&h&&h.length>0?[{cmd:"/model",desc:x.chat.switchModel,run:()=>{se(),ct(!0)}}]:[],...ee&&X.length>0?[{cmd:"/agent",desc:x.chat.switchAgent,run:()=>{se(),$n(!0)}}]:[],...n8(q,le).map(we=>({cmd:we.cmd,desc:we.desc,run:()=>{se(),Lt(we.name)}}))]},[f,y,h,X,U,q,le,Lt,Cn,Rt]),Ln=!at&&!Wt&&!ze&&!bt?tb(oe,mt):null;Ns.current=Ln;const Tn=Ln&&Ln.start!==jn?rl.filter(se=>se.cmd.startsWith(`/${Ln.query}`)):[],ae=Tn.length>0,ke=Tn[Math.min(Bt,Tn.length-1)];v.useEffect(()=>{if(!ze&&!bt)return;const se=()=>{ct(!1),$n(!1),He.current?.focus()},we=Dt=>{const Ct=ze?At.current:ut.current;Ct&&!Ct.contains(Dt.target)&&se()},De=Dt=>{Dt.key==="Escape"&&!Dt.isComposing&&se()};return window.addEventListener("mousedown",we),window.addEventListener("keydown",De),()=>{window.removeEventListener("mousedown",we),window.removeEventListener("keydown",De)}},[ze,bt]);const Pe=se=>{Gt(se),E?.(se?{provider:se.provider,modelId:se.modelId}:null)},rt=se=>{if(ct(!1),He.current?.focus(),ht(se,m)){Pe(null);return}Pe(se),Le(null),Z?.(null),In(!1)},jt=se=>{$n(!1),Le(se),Z?.(se.agentId),Pe(null),In(!1),He.current?.focus()},Nt=()=>{Se!==null&&(Le(null),Z?.(null)),Pe(null)};v.useEffect(()=>{if(!ae&&!ze&&!bt)return;const se=()=>{const we=za.current;if(!we)return;let De=0;for(let Ct=we.parentElement;Ct;Ct=Ct.parentElement)if(getComputedStyle(Ct).overflowY!=="visible"){De=Ct.getBoundingClientRect().top;break}const Dt=we.getBoundingClientRect().top-De-14;ye(Math.max(96,Math.min(320,Math.round(Dt))))};return se(),window.addEventListener("resize",se),()=>window.removeEventListener("resize",se)},[ae,ze,bt]);const Ot=()=>{const se=He.current;se&&(se.style.height="auto",se.style.height=`${Math.min(se.scrollHeight,176)}px`)};v.useLayoutEffect(Ot,[oe]),v.useEffect(()=>{const se=He.current;if(se&&se.value.length>0){const we=se.value.length;se.setSelectionRange(we,we),se.scrollTop=se.scrollHeight,Ft(we)}},[]);const It=v.useRef(!1);v.useEffect(()=>{if(!It.current&&(It.current=!0,q.length===0))return;const se=pt.filter(we=>q.some(De=>De.name===we));se.length!==pt.length&&(Pt(se),K?.(se))},[q,pt,K]);const Zn=Se!==null||Be!==null||Rt,Pr=v.useRef(!1);v.useEffect(()=>{if(Pr.current||!F||X.length===0||(Pr.current=!0,Zn))return;const se=X.find(we=>we.agentId===F);se&&Le(se)},[X,F,Zn]);const ba=v.useRef(!1);v.useEffect(()=>{if(ba.current||!ue||!h||h.length===0||(ba.current=!0,Zn||!y))return;const se=h.find(we=>ht(we,ue));se&&!ht(se,m)&&Gt(se)},[h,ue,m,y,Zn]);const Ja=async(se=n)=>{const we=oe.trim();if(Rt){$e(!0);try{const ai=[{type:"text",text:dh(pt,we)}];for(const $a of re)ai.push({type:"image_url",imageUrl:$a});await n(ai,{budget:Ye})&&(pe(""),he([]),Pt([]),Cn(!1))}finally{$e(!1),He.current?.focus()}return}if(Yt==="blocked")return;const De=Yt==="model"?Be:null,Dt=we!==""?we:pt.length>0?x.chat.skillsAutoMessage(pt):De?x.chat.modelSwitchAutoMessage:we,Ct=dh(pt,Dt),nr=[];Ct&&nr.push({type:"text",text:Ct}),Z8(nr,re,xe),$e(!0);try{(Se?await ee(Se,nr):De?await y({provider:De.provider,modelId:De.modelId},nr):await se(nr,null))&&(pe(""),he([]),We([]),Le(null),Gt(null),Pt([]))}finally{$e(!1),He.current?.focus()}},er=async()=>{if(at){if(js){await Ja(o);return}if(!al)return;const se=oe.trim(),we=re;$e(!0);let De="failed";try{De=await r(se,we),De==="queued"&&(ya.current=s??0,Za(!0),pe(""),he([]))}finally{$e(!1),He.current?.focus()}De==="not_running"&&await Ja();return}Xn&&await Ja()},tr=se=>{if(ae){if(se.key==="ArrowDown"){se.preventDefault(),Ht(we=>(we+1)%Tn.length);return}if(se.key==="ArrowUp"){se.preventDefault(),Ht(we=>(we-1+Tn.length)%Tn.length);return}if((se.key==="Enter"&&!se.shiftKey||se.key==="Tab")&&!se.nativeEvent.isComposing){se.preventDefault(),ke?.run();return}if(se.key==="Escape"){Te(Ln?.start??null);return}}if(se.key==="Backspace"&&(Se!==null||Be!==null)&&se.currentTarget.selectionStart===0&&se.currentTarget.selectionEnd===0){se.preventDefault(),Nt();return}se.key==="Enter"&&!se.shiftKey&&!se.nativeEvent.isComposing&&(se.preventDefault(),er())},On=se=>{for(const we of se){if(!we.type.startsWith("image/"))continue;const De=new FileReader;De.onload=()=>{typeof De.result=="string"&&he(Dt=>[...Dt,De.result])},De.readAsDataURL(we)}},Jl=se=>{const we=[];for(const De of se.clipboardData.items)if(De.kind==="file"){const Dt=De.getAsFile();Dt&&we.push(Dt)}we.length>0&&(se.preventDefault(),On(we))},Fo=se=>{se.target.files&&On(se.target.files),se.target.value=""},ei=se=>{if(Rt)return;const we=[];for(const De of se){if(De.size>Q8){ft(x.chat.attachmentTooLarge(De.name));continue}we.push(De)}we.length!==0&&Promise.all(we.map(X8)).then(De=>{const Dt=we.flatMap((Ct,nr)=>De[nr]?[{name:Ct.name,size:Ct.size,dataUrl:De[nr]}]:[]);Dt.length>0&&We(Ct=>[...Ct,...Dt])})},Fr=se=>{se.target.files&&ei(se.target.files),se.target.value=""},ti=v.useRef(null),ni=v.useRef(null);return l.jsxs("div",{className:"relative",ref:za,children:[ae&&l.jsx("div",{style:{maxHeight:ce},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:Tn.map((se,we)=>l.jsxs("button",{type:"button",ref:se===ke?De=>De?.scrollIntoView({block:"nearest"}):void 0,onMouseEnter:()=>Ht(we),onClick:()=>se.run(),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${se===ke?"bg-gray-100 dark:bg-gray-800":""}`,children:[l.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:se.cmd}),l.jsx("span",{title:se.desc,className:"min-w-0 flex-1 truncate text-xs text-gray-500 dark:text-gray-400",children:se.desc})]},se.cmd))}),ze&&h&&l.jsx(ab,{panelRef:At,maxHeight:ce,title:x.chat.switchModelTitle,children:l.jsx(A2,{models:h,value:m,...k!==void 0?{defaultModel:k}:{},onPick:rt})}),bt&&l.jsx(ab,{panelRef:ut,maxHeight:ce,title:x.chat.switchAgentTitle,children:l.jsx(H8,{agents:X,...D!==void 0?{currentAgentId:D}:{},onPick:jt})}),re.length>0&&l.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:re.map((se,we)=>l.jsxs("div",{className:"anim-pop relative",children:[l.jsx($r,{src:se,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:()=>he(De=>De.filter((Dt,Ct)=>Ct!==we)),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:"×"})]},we))}),xe.length>0&&l.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:xe.map((se,we)=>l.jsxs("span",{title:se.name,className:"anim-pop flex max-w-56 items-center gap-1.5 rounded-md border border-gray-200 bg-gray-50 py-1 pl-2 pr-1 text-xs text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200",children:[l.jsx(Ue,{d:Ah,size:13,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 truncate",children:se.name}),l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:No(se.size)}),l.jsx("button",{type:"button","aria-label":`${x.chat.removeFile} ${se.name}`,onClick:()=>We(De=>De.filter((Dt,Ct)=>Ct!==we)),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))}),!H&&re.length>0&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.imagesAsPathHint}),Yt==="blocked"&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.modelSwitchBusyHint}),xa&&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)}),M&&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:[$&&l.jsx("button",{type:"button",onClick:$,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}),N&&l.jsx("button",{type:"button",onClick:N,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}),Y&&l.jsx("button",{type:"button",onClick:Y,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${M?" opacity-50 grayscale":""}`,children:[(Se!==null||Be!==null||pt.length>0||Rt)&&l.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-1",children:[Rt&&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(Ue,{d:Eo,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(La,{open:yn,setOpen:pa,onEscape:nl,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":_t,"aria-expanded":yn,onClick:()=>pa(!yn),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:_t}),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:be,onChange:se=>Ee(se.target.value),onFocus:se=>se.currentTarget.select(),onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),se.stopPropagation(),Hr())},placeholder:x.chat.goalBudgetPlaceholder,"aria-invalid":gt,"aria-describedby":"goal-budget-hint",...Zu,title:gt?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 ${gt?"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:gt,onClick:Hr,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(Ue,{d:"M5 12l4 4L19 6",size:14})})]}),l.jsx("p",{id:"goal-budget-hint",className:`mt-1.5 text-[11px] leading-4 ${gt?"text-red-500 dark:text-red-400":"text-gray-400 dark:text-gray-500"}`,children:gt?x.chat.goalBudgetInvalid:x.chat.goalBudgetHint})]})}),l.jsx("button",{type:"button","aria-label":x.chat.goalRemove,onClick:()=>Cn(!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:"×"})]}),Se!==null&&l.jsxs("span",{title:x.chat.handoffTargetTitle(un(Se)),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",children:[l.jsx(da,{id:Se.agentId,name:un(Se),size:13,className:"shrink-0 rounded-sm"}),l.jsx("span",{className:"truncate",children:Se.agentId}),l.jsx("button",{type:"button","aria-label":x.chat.handoffRemove,onClick:()=>{Le(null),Z?.(null),He.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:"×"})]}),Be!==null&&l.jsxs("span",{title:x.chat.modelSwitchTargetTitle(yo(Be)),className:"anim-pop flex max-w-48 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.jsx(Wl,{provider:Be.provider,className:"h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"truncate",children:yo(Be)}),l.jsx("button",{type:"button","aria-label":x.chat.modelSwitchRemove,onClick:()=>{Pe(null),He.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:"×"})]}),pt.map(se=>{const we=q.find(De=>De.name===se);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",...we?{title:Po(le,we)}:{},children:[l.jsx(Dp,{icon:we?.icon,size:13,className:"shrink-0 text-gray-500 dark:text-gray-400"}),l.jsx("span",{className:"truncate",children:se}),l.jsx("button",{type:"button","aria-label":`${x.chat.skillRemove} ${se}`,onClick:()=>Lt(se),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},se)})]}),l.jsx("textarea",{ref:He,rows:2,value:oe,autoFocus:W,onChange:se=>{const we=se.target.value,De=se.target.selectionStart??we.length;pe(we),U?.(we),Ft(De),Ht(0),Te(Dt=>{if(Dt===null)return null;const Ct=tb(we,De);return Ct&&Ct.start===Dt?Dt:null})},onSelect:se=>Ft(se.currentTarget.selectionStart??0),onKeyDown:tr,onPaste:Jl,disabled:M,placeholder:M?x.chat.modelAuthDeadPlaceholder:at&&Xa?mn?x.chat.followUpPlaceholderShort:x.chat.followUpPlaceholder:at&&r?mn?x.chat.steerPlaceholderShort:x.chat.steerPlaceholder:mn?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:ti,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Fo}),l.jsx("input",{ref:ni,type:"file",multiple:!0,disabled:Rt,className:"hidden",onChange:Fr}),l.jsx(K8,{items:[{key:"image",icon:W8,label:x.chat.uploadImage,desc:H&&!Rt?x.chat.uploadImageDesc:x.chat.imagesAsPathHint,active:re.length>0,onSelect:()=>ti.current?.click()},{key:"file",icon:Ah,label:x.chat.uploadFile,desc:x.chat.uploadFileDesc,active:xe.length>0,disabled:Rt,onSelect:()=>ni.current?.click()},{key:"goal",icon:Eo,label:x.chat.goalMode,desc:x.chat.goalModeDesc,active:Rt,disabled:at||Wt||Ke,onSelect:()=>Cn(!Rt)}],footer:l.jsx(V8,{steerMode:Qt,onChangeSteerMode:ga}),direction:h&&p?"down":"up"}),l.jsx(U8,{value:O,onChange:I,disabled:z,direction:h&&p?"down":"up"}),l.jsx(G8,{skills:q,selected:pt,onToggle:Lt,disabled:at||Wt||Ke,direction:h&&p?"down":"up"}),l.jsx("span",{title:x.chat.slashHint,className:"hidden min-w-0 truncate text-gray-300 @lg:block dark:text-gray-600",children:x.chat.slashHint})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!p&&l.jsx(Y8,{now:R,unknown:L,...A!==void 0?{window:A}:{}}),h&&p&&j&&l.jsx(rb,{value:w??null,onChange:j,disabled:Ke}),!p&&T&&l.jsx(rb,{value:C??"",onChange:T,disabled:Ke,direction:"up"}),h&&p?l.jsx(B8,{models:h,value:m,...k!==void 0?{defaultModel:k}:{},onChange:p,disabled:Ke}):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(Wl,{provider:m?.provider??"custom",className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:(()=>{const se=h?.find(we=>ht(we,m));return se?yo(se):m?.modelId??"…"})()})]}),l.jsx("button",{type:"button",title:bn?x.chat.stop:at?yr:x.chat.send,"aria-label":bn?x.chat.stop:at?yr:x.chat.send,disabled:bn?!1:at?!xr:!Xn,onClick:()=>bn?void d():void er(),className:bn?"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:bn?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 I2({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 Pm=null,Fm=null,Tu=null,Fl=null;const _h=new Set;function L2(e){const[n,r]=v.useState(Pm),[s,o]=v.useState(Tu);return v.useEffect(()=>{const c=()=>{r(Pm),o(Tu)};return _h.add(c),()=>{_h.delete(c)}},[]),v.useEffect(()=>{if(!e)return;let c=!1;return Fm??=T5().then(d=>(Pm=d,d)),Fm.then(d=>{c||r(d)}).catch(()=>{Fm=null}),Fl??=hv().then(d=>(Tu=d,d)),Fl.then(d=>{c||o(d)}).catch(()=>{Fl=null}),()=>{c=!0}},[e]),{version:n,update:s}}async function sb(){const e=hv(!0).then(n=>(Tu=n,n));Fl=e;try{return await e}catch(n){throw Fl===e&&(Fl=null),n}finally{for(const n of _h)n()}}const Ih=[{id:"webapps",tasks:[{id:"game",skills:["web-design"]},{id:"gamecenter",skills:["web-design"]},{id:"lol",skills:["web-design"]}]},{id:"agents",tasks:[{id:"rag",skills:["penguin-sdk","web-design"]},{id:"agentBenchmarkBuild",skills:[]},{id:"agentOptimization",skills:[]}]}];Ih.flatMap(e=>[...e.tasks]);const J8=["always-ask","read-only","allow-all","deny-all"],Hl=(e,n)=>`penguin.chatDraft.${e}.${n}`,O2=(e,n)=>`penguin.chatDraft.session.${e}.${n}`;function lb(e){if(typeof e!="object"||e===null)return;const n=e;if(!(typeof n.provider!="string"||typeof n.modelId!="string"))return{provider:n.provider,modelId:n.modelId}}function e_(e){if(!e)return{};try{const n=JSON.parse(e);if(typeof n!="object"||n===null)return{};const r=n,s={};typeof r.text=="string"&&(s.text=r.text),typeof r.agentId=="string"&&(s.agentId=r.agentId),typeof r.workspace=="string"&&(s.workspace=r.workspace);const o=lb(r.modelRef);o&&(s.modelRef=o),typeof r.handoffAgentId=="string"&&(s.handoffAgentId=r.handoffAgentId);const c=lb(r.switchModelRef);if(c&&(s.switchModelRef=c),Array.isArray(r.skills)){const d=r.skills.filter(f=>typeof f=="string");d.length>0&&(s.skills=d)}return typeof r.approvalMode=="string"&&J8.includes(r.approvalMode)&&(s.approvalMode=r.approvalMode),s}catch{return{}}}function sd(e,n=localStorage){try{return e_(n.getItem(e))}catch{return{}}}function Ao(e,n,r=localStorage){try{r.setItem(e,JSON.stringify(n))}catch{}}function $u(e,n=localStorage){try{n.removeItem(e)}catch{}}const t_=300;function ib(e){try{return sessionStorage.getItem(`penguin.chatRouteApplied.${e}`)}catch{return null}}function ob(e,n){try{sessionStorage.setItem(`penguin.chatRouteApplied.${e}`,n)}catch{}}const n_={webapps:"M3 6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6zM3 9h18M6 6.5h.01M9 6.5h.01",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"};function a_({projectId:e,models:n}){const r=ha(),s=ma(),{agents:o,currentAgent:c,setCurrentAgentId:d}=fn(),{add:f}=el(),m=Un().user?.userId??null,[h]=v.useState(()=>m?sd(Hl(m,e)):{}),[p,y]=v.useState(h.agentId??c?.agentId??null),[k,w]=v.useState(h.workspace??""),[j,C]=v.useState(h.approvalMode??"allow-all"),[T,A]=v.useState(h.modelRef??null),R=v.useRef(h.text??""),L=v.useRef(h.skills??[]),H=s.state,O=H?.agentId,I=v.useRef(null);v.useEffect(()=>{if(o.length===0)return;const Te=ze=>!!ze&&o.some(ct=>ct.agentId===ze);if(O&&I.current!==s.key&&ib("agentId")!==s.key&&(I.current=s.key,ob("agentId",s.key),Te(O))){y(O);return}Te(p)||y((o.find(ze=>ze.agentId==="default_agent")??o[0])?.agentId??null)},[o,p,s.key,O]);const z=H?.workspace,W=v.useRef(null);v.useEffect(()=>{z===void 0||W.current===s.key||ib("workspace")===s.key||(W.current=s.key,ob("workspace",s.key),w(z))},[s.key,z]),v.useEffect(()=>{if(!n||T&&n.models.some(ze=>ht(ze,T)))return;const Te=n.models[0];A(n.defaultModel??(Te?{provider:Te.provider,modelId:Te.modelId}:null))},[n,T]);const[X,D]=v.useState(null);v.useEffect(()=>{if(D(null),!p)return;let Te=!1;return Ph(e,p).then(ze=>{Te||D(ze.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{Te=!0}},[e,p]);const q=v.useRef(null);q.current=X;const P=v.useCallback(Te=>{if(!p||!Te)return;const ze=q.current;D(Te),fv(e,p,{config:{model:{thinkingLevel:Te}}}).catch(ct=>{D(ze),ft(Ae(ct))})},[e,p]),[K,ee]=v.useState([]),[B,U]=v.useState(!1);v.useEffect(()=>{if(ee(ze=>ze.length>0?[]:ze),U(!1),!p)return;let Te=!1;return Fh(e,p).then(ze=>{Te||ee(ze.skills)}).catch(()=>{}).finally(()=>{Te||U(!0)}),()=>{Te=!0}},[e,p]);const F=v.useRef(null),Z=v.useCallback(()=>{F.current!==null&&(window.clearTimeout(F.current),F.current=null)},[]),ue=v.useCallback(()=>{if(Z(),!m)return;const Te={text:R.current,workspace:k,approvalMode:j};p&&(Te.agentId=p),T&&(Te.modelRef=T),L.current.length>0&&(Te.skills=L.current),Ao(Hl(m,e),Te)},[Z,m,e,p,k,j,T]),E=v.useRef(ue);v.useEffect(()=>{E.current=ue,ue()},[ue]);const M=v.useCallback(Te=>{R.current=Te,Z(),F.current=window.setTimeout(()=>{F.current=null,E.current()},t_)},[Z]),$=v.useCallback(Te=>{L.current=Te,E.current()},[]);v.useEffect(()=>()=>{F.current!==null&&(window.clearTimeout(F.current),E.current())},[]);const N=v.useCallback(()=>{Z(),L.current=[],m&&(T?Ao(Hl(m,e),{modelRef:T}):$u(Hl(m,e)))},[Z,m,e,T]),Y=Te=>{y(Te.agentId),d(Te.agentId)},le=v.useRef(!1),[oe,pe]=v.useState(!1),Ce=v.useCallback(async(Te,ze=!1,ct=null)=>{if(!p||le.current)return!1;le.current=!0,pe(!0);let At=null;try{const bt={approvalMode:j};T&&(bt.modelId=T.modelId,bt.provider=T.provider),k.trim()&&(bt.workspace=k.trim());const $n=await nh(e,p,bt);At=$n.session.sessionId;const ut=await co(At,{input:Te,...ct?{goal:ct}:{}});return f($n.session),ze||N(),r(`/chat/${ut.sessionId}`,{replace:!0}),!0}catch(bt){return At&&Mu(At).catch(()=>{}),ft(Ae(bt,T?{modelId:T.modelId}:{})),!1}finally{le.current=!1,pe(!1)}},[e,p,j,T,k,f,N,r]),[re,he]=v.useState(null),xe=v.useCallback(async Te=>{if(re===null){he(Te.id);try{const ze=Te.skills.filter(ct=>K.some(At=>At.name===ct));await Ce([{type:"text",text:dh(ze,x.chat.exampleTasks[Te.id].prompt)}],!0)}finally{he(null)}}},[re,K,Ce]),[We,Ke]=v.useState(Ih[0].id),$e=o.find(Te=>Te.agentId===p)??null,Bt=n?.models.find(Te=>ht(Te,T)),Ht=Bt?.contextWindow,jn=Bt?.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(I2,{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(r_,{})]}),l.jsx(_2,{status:"idle",onSend:(Te,ze)=>Ce(Te,!1,ze),onStop:async()=>{},onCompact:async()=>{},modelRef:T,models:n?.models??[],onChangeModel:A,thinkingLevel:X,onChangeThinkingLevel:P,...n?.defaultModel!==void 0?{defaultModel:n.defaultModel}:{},...Ht!==void 0?{contextWindow:Ht}:{},contextNow:0,vision:jn,approvalMode:j,onChangeApprovalMode:C,modeSaving:!1,autoFocus:!0,agents:o,...p?{currentAgentId:p}:{},skills:K,...h.skills&&h.skills.length>0?{initialSkills:h.skills}:{},onSkillsChange:$,initialText:h.text??"",onTextChange:M}),l.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[l.jsx(s_,{agents:o,selected:$e,onSelect:Y}),l.jsx(l_,{projectId:e,workspace:k,onChange:w})]}),l.jsx("div",{className:"mt-6 space-y-1",children:Ih.map(Te=>{const ze=Te.id===We;return l.jsxs("div",{children:[l.jsxs("button",{type:"button","aria-expanded":ze,onClick:()=>Ke(Te.id),className:`flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left transition-colors duration-150 ${ze?"bg-gray-100 dark:bg-gray-800/70":"hover:bg-gray-100 dark:hover:bg-gray-800/70"}`,children:[l.jsx("span",{className:"shrink-0 text-brand-500 dark:text-brand-400",children:l.jsx("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("path",{d:n_[Te.id]})})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-gray-700 dark:text-gray-300",children:x.chat.exampleFolders[Te.id]}),l.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:Te.tasks.length}),l.jsx(An,{open:ze,size:14,className:"text-gray-400"})]}),ze&&l.jsx("ul",{className:"mt-0.5 space-y-0.5 pl-4",children:Te.tasks.map(ct=>{const At=x.chat.exampleTasks[ct.id];return l.jsx("li",{children:l.jsxs("button",{type:"button",title:At.desc,disabled:re!==null||oe||!B||!p||!n,onClick:()=>{xe(ct)},className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 disabled:cursor-default disabled:opacity-60 disabled:hover:bg-transparent dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:At.label}),re===ct.id&&l.jsx("span",{className:"shrink-0 text-xs text-gray-400",children:x.common.loading})]})},ct.id)})})]},Te.id)})})]}),l.jsx("div",{className:"flex-1"})]})}const cb="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 r_(){const{locale:e}=Qa(),{version:n,update:r}=L2(!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(Vv(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:cb,children:x.update.newVersionBadge}):l.jsx("span",{className:cb,children:x.update.newVersionBadge}))]})}const D2="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 s_({agents:e,selected:n,onSelect:r}){const[s,o]=v.useState(!1);return l.jsx(La,{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:D2,children:[n?l.jsx(da,{id:n.agentId,name:un(n),size:16,className:"shrink-0 rounded"}):null,l.jsx("span",{className:"min-w-0 truncate",children:n?un(n):x.common.loading}),l.jsx(An,{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(da,{id:c.agentId,name:un(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:un(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 l_({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),[p,y]=v.useState(!1),[k,w]=v.useState(null),[j,C]=v.useState("");v.useEffect(()=>{C(m?.path??"")},[m]);const T=v.useCallback(z=>{y(!0),w(null),Oy(e,z).then(h).catch(W=>w(Ae(W))).finally(()=>y(!1))},[e]),A=z=>{const W=!s;if(W){const X=z.currentTarget.getBoundingClientRect(),D=parseFloat(getComputedStyle(document.documentElement).fontSize),q=12,P=Math.min(20*D,window.innerWidth-2*D),K=window.innerWidth-q-X.left,ee=X.right-q;K>=P?d({right:!1}):ee>K?d({right:!0,...ee<P?{maxWidth:ee}:{}}):d({right:!1,maxWidth:K})}if(o(W),W&&!f.current){f.current=!0;const X=n.trim();T(X.startsWith("/")?X:"")}},R=async()=>{const z=j.trim();if(!z||z===m?.path){C(m?.path??"");return}try{h(await Oy(e,z))}catch{ft(x.chat.workspaceDirInvalid),C(m?.path??"")}},L=n.trim(),H=L?L.split("/").filter(Boolean).pop()??"/":x.chat.workspaceAuto,O=m?.parent??null,I=(m?.entries??[]).filter(z=>!z.name.startsWith("."));return l.jsx(La,{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:L?`${x.chat.workspace}:${L}`:x.chat.workspaceHint,"aria-label":x.chat.workspace,onClick:A,className:D2,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 ${L?"font-mono":""}`,children:H}),l.jsx(An,{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:j,placeholder:"…","aria-label":x.chat.workspace,...Zu,onChange:z=>C(z.target.value),onBlur:()=>{R()},onKeyDown:z=>{z.key==="Enter"&&!z.nativeEvent.isComposing?(z.preventDefault(),R()):z.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:[O!==null&&l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>T(O),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]})}),I.map(z=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>T(z.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:z.name})]})},z.path)),m&&I.length===0&&l.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:x.chat.workspaceNoSubdirs}),p&&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:()=>T(""),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})]})]})]}),L&&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 Lh={damping:1,response:.35},ub={damping:.8,response:.3};function i_(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,p=Math.min(o,64);for(;p>0;){const y=Math.min(p,8)/1e3,k=-d*(m-r)-f*h;h+=k*y,m+=h*y,p-=8}return[m,h]}function db(e,n,r){return Math.abs(e-r)<.5&&Math.abs(n)<5}function o_(e,n){let r=e,s=0,o=e,c=Lh,d,f=0,m=0;const h=()=>{f&&cancelAnimationFrame(f),f=0,m=0,d=void 0},p=y=>{const k=m?y-m:16;if(m=y,[r,s]=i_(r,s,o,c,k),db(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(p)};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,db(r,s,o)){r=o,s=0,n(r);const j=d;d=void 0,j?.();return}f||(f=requestAnimationFrame(p))},stop(){return h(),[r,s]},set(y){h(),r=y,s=0,n(r)},dispose:h}}function c_(e,n=.998){return e/1e3*n/(1-n)}function u_(e,n,r=.55){return e*n*r/(n+r*Math.abs(e))}function d_(e,n){let r=n[0];for(const s of n)Math.abs(s-e)<Math.abs(r-e)&&(r=s);return r}const f_=.92,m_=.6;function h_(){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 z2({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),p=v.useRef(null),y=v.useRef(0),k=v.useRef(!1),w=v.useRef(!1),j=v.useRef(null),C=v.useRef([]),T=v.useRef({pointerY:0,sheetY:0}),A=v.useRef(e);A.current=e;const R=v.useRef(null),L=h_(),H=v.useCallback(q=>{const P=y.current||1;m.current&&(m.current.style.transform=`translate3d(0, ${q}px, 0)`),h.current&&(h.current.style.opacity=String(Math.min(1,Math.max(0,1-q/P))))},[]),O=v.useCallback(q=>{const P=y.current;return q==="full"?0:P*(1-m_/f_)},[]);v.useEffect(()=>{e&&f(!0)},[e]),v.useLayoutEffect(()=>{if(!d)return;const q=m.current;q&&(y.current=q.offsetHeight,p.current||(p.current=o_(y.current,H),p.current.set(y.current)))},[d,H]),v.useEffect(()=>{if(!d)return;const q=p.current;if(q)if(e){if(w.current=!1,k.current)return;const P=O(n);if(j.current!==null&&Math.abs(j.current-P)<1)return;if(j.current=P,L){q.set(P);return}q.animateTo(P,Lh)}else{if(w.current=!0,j.current=y.current,L){f(!1);return}q.animateTo(y.current,Lh,{onSettle:()=>f(!1)})}},[d,e,n,L,O]),v.useEffect(()=>{d||(p.current?.dispose(),p.current=null,j.current=null,k.current=!1,w.current=!1)},[d]),v.useEffect(()=>()=>p.current?.dispose(),[]),v.useEffect(()=>{if(!d)return;const q=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=q}},[d]),v.useEffect(()=>{if(!d||!e)return;const q=P=>{P.key==="Escape"&&s()};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[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 q=()=>{const P=m.current;if(!P||(y.current=P.offsetHeight,k.current||w.current))return;const K=O(n);j.current=K,p.current?.set(K)};return window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[d,n,O]);const I=q=>{if(w.current)return;const P=p.current;if(!P)return;q.currentTarget.setPointerCapture(q.pointerId);const[K]=P.stop();k.current=!0,T.current={pointerY:q.clientY,sheetY:K},C.current=[{y:q.clientY,t:performance.now()}]},z=q=>{if(!k.current)return;const P=p.current;if(!P)return;const K=T.current.sheetY+(q.clientY-T.current.pointerY),ee=y.current,B=K<0?-u_(-K,ee):Math.min(K,ee);P.set(B);const U=performance.now(),F=C.current;for(F.push({y:q.clientY,t:U});F.length>2&&U-F[0].t>100;)F.shift()},W=q=>{k.current=!1;const P=p.current;if(!P)return;const K=y.current,ee=O("half"),B=A.current?P.value+c_(q):K,U=d_(B,[0,ee,K]);if(j.current=U,U===K){if(w.current=!0,L){f(!1),s();return}P.animateTo(K,ub,{velocity:q,onSettle:()=>{f(!1),s()}});return}P.animateTo(U,ub,{velocity:q});const F=U===0?"full":"half";F!==n&&r?.(F)},X=()=>{if(!k.current)return;const q=C.current,P=q[q.length-1],K=q[0],ee=P&&K?P.t-K.t:0;W(ee>0?(P.y-K.y)/ee*1e3:0)},D=()=>{k.current&&W(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 ${L?"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 ${L?"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:I,onPointerMove:z,onPointerUp:X,onPointerCancel:D,onLostPointerCapture:D,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(ap,{onClose:s,onPointerDown:q=>q.stopPropagation()})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]",children:c})]})]}):null}function Up(e){return l.jsx("span",{className:"relative",children:l.jsx("input",{type:"file",className:"sr-only",...e})})}const p_=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"]),g_=new Set(["png","jpg","jpeg","gif","webp","svg"]),x_=new Set(["html","htm"]),iu=256*1024,fb=64*1024,y_={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 b_(e){return y_[e]??"text"}function mb(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function ou(e,n){return e===""?n:`${e}/${n}`}function hb(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}const pb=/^[a-z][a-z0-9+.-]*:/i;function gb(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 qm="<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 v_(e){return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,n=>n+qm):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,n=>n+qm):qm+e}let cu=0;function xb({session:e,openRequest:n,active:r,onPreviewOpen:s}){const{previewIsolated:o}=Un(),[c,d]=v.useState(""),[f,m]=v.useState(null),[h,p]=v.useState(null),[y,k]=v.useState(null),[w,j]=v.useState(!1),[C,T]=v.useState(null),[A,R]=v.useState(0),[L,H]=v.useState(!1),[O,I]=v.useState("rendered"),[z,W]=v.useState(null),X=v.useRef(o);X.current=o,v.useEffect(()=>{let E=!1;return p(null),m5(e.sessionId,c).then(M=>{E||m(M)}).catch(M=>{E||p(M instanceof Ka?M.message:x.files.loadFailed)}),()=>{E=!0}},[e.sessionId,c,A]);const[D,q]=v.useState(e.sessionId);D!==e.sessionId&&(q(e.sessionId),d(""),k(null),m(null),W(null),cu++);const P=v.useRef(r);v.useEffect(()=>{r&&!P.current&&R(E=>E+1),P.current=r},[r]);const K=v.useRef(s);K.current=s;const ee=v.useCallback(async E=>{K.current?.();const M=E.includes("/")?E.slice(E.lastIndexOf("/")+1):E,$=mb(M),N=++cu,Y=pe=>{N===cu&&k(pe)};if(I("rendered"),W(null),g_.has($)){Y({path:E,name:M,kind:"image",nonce:N});return}if($==="pdf"){Y({path:E,name:M,kind:"pdf",nonce:N});return}const le=x_.has($),oe=$==="md";if(!le&&!p_.has($)){Y({path:E,name:M,kind:"unsupported",nonce:N});return}if(le&&X.current){Y({path:E,name:M,kind:"html",nonce:N});return}try{const pe=await fetch(ms(e.sessionId,E),{credentials:"same-origin"});if(!pe.ok)throw new Error(String(pe.status));const Ce=await pe.text(),re=Ce.length>iu;oe&&Ce.length>fb&&N===cu&&I("source"),Y({path:E,name:M,kind:le?"html":oe?"md":"text",content:re?Ce.slice(0,iu):Ce,truncated:re,nonce:N})}catch{Y({path:E,name:M,kind:"unsupported",nonce:N})}},[e.sessionId]);v.useEffect(()=>{if(y?.kind!=="html"||y.content!==void 0||O!=="source"&&o)return;const E=y.path;let M=!1;return W(null),(async()=>{try{const $=await fetch(ms(e.sessionId,E),{credentials:"same-origin"});if(!$.ok)throw new Error(String($.status));const N=await $.text();if(M)return;const Y=N.length>iu;k(le=>le!==null&&le.kind==="html"&&le.path===E&&le.content===void 0?{...le,content:Y?N.slice(0,iu):N,truncated:Y}:le)}catch{M||W(x.files.loadFailed)}})(),()=>{M=!0}},[y,O,o,e.sessionId]);const B=v.useRef(null);v.useEffect(()=>{if(!n||B.current===n)return;B.current=n;const E=n.path,M=E.includes("/")?E.slice(0,E.lastIndexOf("/")):"";d(M),R($=>$+1),ee(E)},[n,ee]);const U=E=>{ee(ou(c,E))},F=E=>{j(!0),p(null),(async()=>{try{for(const M of E){const $=await new Promise((N,Y)=>{const le=new FileReader;le.onload=()=>{const oe=le.result;N(oe.slice(oe.indexOf(",")+1))},le.onerror=()=>Y(new Error("read failed")),le.readAsDataURL(M)});await h5(e.sessionId,ou(c,M.name),$)}oa(x.files.uploaded),R(M=>M+1)}catch(M){ft(Ae(M))}finally{j(!1)}})()},Z=E=>{const M=E.target.files?[...E.target.files]:[];if(E.target.value="",M.length===0)return;const $=new Set((f?.entries??[]).map(Y=>Y.name)),N=M.filter(Y=>$.has(Y.name)).map(Y=>Y.name);N.length>0?T({files:M,clashes:N}):F(M)},ue=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,M])=>l.jsx("button",{type:"button",onClick:()=>I(E),className:`rounded px-2 py-0.5 text-xs transition-colors duration-150 ${O===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:M},E))}),/\.html?$/i.test(y.name)&&l.jsxs("a",{href:zy(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:ms(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:ms(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:ms(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"&&O==="rendered"?o?l.jsx("iframe",{src:zy(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?z!==null?l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:z}):l.jsx(Ia,{rows:6}):l.jsx("iframe",{srcDoc:v_(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"&&O==="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($o,{remarkPlugins:[Bo],components:{img:({src:E,alt:M})=>l.jsx("img",{src:typeof E=="string"&&!pb.test(E)?ms(e.sessionId,gb(hb(y.path),E)):E,alt:M??"",loading:"lazy",className:"max-w-full"}),a:({href:E,children:M})=>{if(typeof E!="string"||E.startsWith("#"))return l.jsx("a",{href:E,children:M});if(pb.test(E))return l.jsx("a",{href:E,target:"_blank",rel:"noreferrer",children:M});const $=gb(hb(y.path),E);return l.jsx("a",{href:ms(e.sessionId,$),onClick:N=>{N.preventDefault(),ee($)},children:M})}},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?z!==null?l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:z}):l.jsx(Ia,{rows:6}):l.jsxs(l.Fragment,{children:[l.jsx(_p,{language:b_(mb(y.name)),code:y.content,highlight:y.content.length<=fb}),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}),ue.map((E,M)=>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(ue.slice(0,M+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})]},M)),l.jsx("span",{className:"flex-1"}),l.jsx(La,{open:L,setOpen:H,menuClass:"right-0 top-full mt-1 w-max max-w-72 origin-top-right",button:l.jsx(ve,{size:"sm",variant:L?"primary":"ghost",onClick:()=>H(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(ve,{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(Up,{multiple:!0,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(Ia,{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(ou(c,E.name)):U(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"?No(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?ua(E.mtime):""}),E.kind==="file"&&l.jsx("a",{href:ms(e.sessionId,ou(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(fa,{open:C!==null,title:x.files.overwriteTitle,tone:"primary",confirmLabel:x.files.upload,onClose:()=>T(null),onConfirm:()=>{C&&F(C.files),T(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 k_(){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 w_({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 ${n.open?"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(k_,{})})]}),l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(xb,{session:e,openRequest:n.openRequest,active:n.open})})]})})]}):l.jsx(z2,{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(xb,{session:e,openRequest:n.openRequest,active:n.open,onPreviewOpen:()=>n.setSheetSnap("full")})})})})}const ld=320,Bu="penguin.panelWidth",S_=["penguin.filesPanelWidth","penguin.subagentsPanelWidth"];function Hu(e){return Math.max(ld,Math.min(720,Math.round(e*.5)))}function U2(e){return Math.min(Hu(e),Math.max(ld,Math.round(e*.4)))}function j_(){try{const e=Number(localStorage.getItem(Bu));if(Number.isFinite(e)&&e>0)return e;let n=null;for(const r of S_){const s=Number(localStorage.getItem(r));Number.isFinite(s)&&s>0&&(n=Math.max(n??0,s)),localStorage.removeItem(r)}return n!==null&&localStorage.setItem(Bu,String(Math.round(n))),n}catch{return null}}function N_(){const e=j_();return e===null?U2(window.innerWidth):Math.min(Hu(window.innerWidth),Math.max(ld,Math.round(e)))}let Pu=null;const Oh=new Set;function uu(){return Pu??=N_(),Pu}function Vm(e){if(e!==Pu){Pu=e;for(const n of Oh)n()}}function C_(e){return Oh.add(e),()=>Oh.delete(e)}function $2(){const e=v.useSyncExternalStore(C_,uu,uu),[n,r]=v.useState(!1),s=v.useRef(null);v.useEffect(()=>{if(!n)return;const d=m=>{const h=s.current?.getBoundingClientRect(),p=h?h.right:window.innerWidth;Vm(Math.min(Hu(window.innerWidth),Math.max(ld,p-m.clientX)))},f=()=>{r(!1);try{localStorage.setItem(Bu,String(Math.round(uu())))}catch{}};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",d),window.addEventListener("mouseup",f),()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",f)}},[n]);const o=v.useCallback(d=>{d.preventDefault(),r(!0)},[]),c=v.useCallback(()=>{Vm(U2(window.innerWidth));try{localStorage.removeItem(Bu)}catch{}},[]);return v.useEffect(()=>{const d=()=>Vm(Math.min(uu(),Hu(window.innerWidth)));return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),{width:e,resizing:n,startResize:o,resetWidth:c,panelRef:s}}const yb="(min-width: 1024px)";function T_(e){const[n,r]=v.useState(!1),[s,o]=v.useState("half"),[c,d]=v.useState(null),f=v.useCallback(k=>{k&&o("half"),r(k)},[]),m=$2(),[h,p]=v.useState(()=>window.matchMedia(yb).matches);v.useEffect(()=>{d(null)},[e]),v.useEffect(()=>{const k=window.matchMedia(yb),w=j=>p(j.matches);return k.addEventListener("change",w),()=>k.removeEventListener("change",w)},[]);const y=v.useCallback(k=>{o("full"),d({path:k})},[]);return{open:n,setOpen:f,sheetSnap:s,setSheetSnap:o,browsePath:y,openRequest:c,isDocked:h,...m}}function M_({nodes:e,selectedId:n,labelFor:r,onSelect:s}){const o=UR(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,p=c.running?x.subagentPanel.nodeRunning:x.subagentPanel.nodeDone,y=c.description!==null?`${m} · ${p}
171
+ ${c.description}`:`${m} · ${p}`;return l.jsxs("button",{type:"button","aria-label":`${m} · ${p}`,"aria-pressed":h,title:y,onClick:()=>s(c),style:{left:d,top:f,width:Cu,height:uo},className:`absolute flex flex-col justify-center gap-0.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.jsxs("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[l.jsx(da,{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(Mo,{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:xn(c.elapsedMs)}),l.jsx(Ho,{state:c.running?"running":"done",size:10})]}),c.description!==null&&l.jsx("span",{className:"w-full truncate pl-[24px] text-[10px] leading-tight text-gray-400 dark:text-gray-500",children:c.description})]},c.sessionId)})]})})}function E_({session:e,model:n,version:r,taskRunning:s,ctx:o,focusRequest:c,taskScope:d}){const{agents:f}=fn(),{sessions:m}=el(),[h,p]=v.useState(null);v.useEffect(()=>{c&&p({sessionId:c.sessionId,origin:c.origin})},[c]);const y=v.useMemo(()=>(d?OR(n,e.sessionId,s,d.anchorSessionId):null)??LR(n,e.sessionId,s),[n,r,e.sessionId,s,d]),k=y.find(O=>O.depth>0)??null,w=h??(k?{sessionId:k.sessionId,origin:k.origin}:null),j=O=>{if(O.depth===0){const I=f.find(z=>z.agentId===e.agentId);return I?I.name?.length?I.name:I.agentId:e.agentId}return Th(O,f,m)??Mh(O.sessionId)},C=w!==null&&w.origin.length===0,T=w?y.find(O=>O.sessionId===w.sessionId)??null:null,A=w&&!C?zR(n,w.origin):null,R=T?j(T):w?Th({sessionId:w.sessionId,agentId:A?.meta?.agentId??null},f,m)??x.chat.subagent:"",L=T?.running??!1,H=w?{...o,origin:w.origin,taskRunning:L}: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(M_,{nodes:y,selectedId:w?.sessionId??null,labelFor:j,onSelect:O=>p({sessionId:O.sessionId,origin:O.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(fr,{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(fr,{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(da,{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:Mh(w.sessionId)}),L&&l.jsx(Ho,{state:"running",size:10,label:x.chat.subagentRunning})]}),l.jsx("div",{className:"min-h-0 flex-1",children:H&&l.jsx(w2,{items:A.items,version:r,ctx:H},w.sessionId)})]})]})}function A_(){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,model:r,version:s,taskRunning:o,ctx:c}){const d=l.jsx(E_,{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 ${n.open?"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(A_,{})})]}),l.jsx("div",{className:"min-h-0 flex-1",children:d})]})})]}):l.jsx(z2,{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 bb="(min-width: 1024px)";function __(){return{sessionId:null,taskCount:0,autoOpenedAt:null}}function I_(e,n){const r=n.sessionId!==e.sessionId,s=!r&&n.taskCount<e.taskCount;return(r||n.taskCount!==e.taskCount)&&(e.sessionId=n.sessionId,e.taskCount=n.taskCount,e.autoOpenedAt=s?n.taskCount:null),n.liveSpawn&&e.autoOpenedAt!==e.taskCount?(e.autoOpenedAt=e.taskCount,"autoOpen"):null}function L_(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(j=>{j&&(o("half"),m(null)),r(j)},[]),p=$2(),[y,k]=v.useState(()=>window.matchMedia(bb).matches);v.useEffect(()=>{d(null),m(null)},[e]),v.useEffect(()=>{const j=window.matchMedia(bb),C=T=>k(T.matches);return j.addEventListener("change",C),()=>j.removeEventListener("change",C)},[]);const w=v.useCallback((j,C)=>{o("full"),m({anchorSessionId:C[0]??j}),d({sessionId:j,origin:C})},[]);return{open:n,setOpen:h,sheetSnap:s,setSheetSnap:o,focusSubagent:w,focusRequest:c,taskScope:f,isDocked:y,...p}}const O_=300;function D_(e){const n=Un().user?.userId??null,r=n&&e?O2(n,e):null,s=v.useMemo(()=>r?sd(r):{},[r]),o=v.useRef(s.text??""),c=v.useRef(s.handoffAgentId??null),d=v.useRef(s.switchModelRef??null),f=v.useRef(s.skills??[]),m=v.useRef(null),h=v.useCallback(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),p=v.useCallback(()=>{if(h(),!r)return;const T=o.current,A=c.current,R=d.current,L=f.current;if(!T&&!A&&!R&&L.length===0){$u(r);return}const H={text:T};A&&(H.handoffAgentId=A),R&&(H.switchModelRef=R),L.length>0&&(H.skills=L),Ao(r,H)},[h,r]);v.useEffect(()=>(o.current=s.text??"",c.current=s.handoffAgentId??null,d.current=s.switchModelRef??null,f.current=s.skills??[],()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null,p())}),[s,p]);const y=v.useCallback(T=>{o.current=T,h(),m.current=window.setTimeout(()=>{m.current=null,p()},O_)},[h,p]),k=v.useCallback(T=>{c.current=T,p()},[p]),w=v.useCallback(T=>{d.current=T,p()},[p]),j=v.useCallback(T=>{f.current=T,p()},[p]),C=v.useCallback(()=>{h(),f.current=[],c.current=null,d.current=null,r&&$u(r)},[h,r]);return{initial:s,onTextChange:y,onHandoffTargetChange:k,onPendingModelChange:w,onSkillsChange:j,discard:C}}function Gm(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 z_(e){const n=e.now??(()=>Date.now()),r=new Set,s=new Map;let o=ju(r),c=!1,d="buffering",f=[],m=null,h=null,p=0,y=!1;const k=()=>{s.size!==0&&(s.clear(),e.onPendingChange())},w=(R,L)=>{if(cp(R)&&R.payload.type==="approval_decision"&&s.delete(Vl(R.origin,R.payload.tool_call_id))&&e.onPendingChange(),L&&!_u(R.payload)&&BC(L,R)){lk(o,R);return}Iu(o,R,n())},j=R=>{switch(R.type){case"approval_request":{const L=R.toolCall.payload.tool_call_id,H={toolCall:R.toolCall};if(R.origin&&(H.origin=R.origin),s.set(Vl(R.origin,L),H),!RC(o,R.origin,L)){const O={...R.toolCall};R.origin&&R.origin.length>0?O.origin=[...R.origin]:delete O.origin,Iu(o,O,n()),e.onModelChange()}e.onPendingChange();return}case"task_state":{m=R.state,e.onTaskState(R.state),e.onQueuedFollowUps?.(R.queued??0),R.state==="idle"&&(MC(o),k(),e.onModelChange());return}case"resync_required":{C();return}case"credentials_updated":{o.lastAuthFailureMs=null,e.onModelChange();return}case"hello":return}},C=async()=>{p+=1,d="buffering",f=[],k(),await A(p,ju(r))},T=(R,L)=>{const H=Gm(L.cursor);if(!H)return R;const O=h===null?null:Gm(h);if(O!==null&&O.epoch!==H.epoch)return R;const I=[],z=[];for(const X of R){const D=X.id===null?null:Gm(X.id);D!==null&&D.epoch===H.epoch&&D.seq<=H.seq?(X.kind!=="omni"||!_u(X.msg.payload))&&I.push(X):z.push(X)}const W=L.fragments.map(X=>({kind:"omni",msg:X,id:null,seeded:!0}));return[...I,...W,...z]},A=async(R,L)=>{try{const{messages:H,live:O,serverNowMs:I}=await e.loadMessages();if(c||R!==p)return;L&&(o=L);const z=o;TC(z,H,n(),I??null);const W=$C(H,100),X=O!==void 0?T(f,O):f;f=[];for(let D=0;D<X.length;D+=1){const q=X[D];if(q.kind==="omni"?w(q.msg,W):j(q.ev),c)return;if(R!==p){f.push(...X.slice(D+1).filter(P=>P.kind!=="omni"||!P.seeded));return}}d="live",m==="idle"&&EC(z),y=!1,e.onError(null),e.onLoading(!1),e.onModelChange()}catch(H){if(c||R!==p)return;y=!0,e.onLoading(!1),e.onError(H instanceof Error?H.message:String(H))}};return{get model(){return o},get pendingApprovals(){return s},load:()=>(p+=1,A(p)),retry:async()=>{c||!y||(e.onError(null),e.onLoading(!0),p+=1,await A(p,ju(r)))},handleOmni:(R,L=null)=>{if(!c){if(L!==null&&(h=L),d==="buffering"){f.push({kind:"omni",msg:R,id:L});return}w(R,null),e.onModelChange()}},handleServer:(R,L=null)=>{if(!c){if(L!==null&&(h=L),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:L});return}j(R)}},markLocalDecision:R=>{AC(o,R)},resolveApproval:R=>{s.delete(R)&&e.onPendingChange()},dispose:()=>{c=!0}}}const U_=120,$_=new Map;function B_(e,n,r,s){const[o,c]=v.useState(0),[d,f]=v.useState(!0),[m,h]=v.useState(n),[p,y]=v.useState(0),[k,w]=v.useState(null),[j,C]=v.useState(0),[T,A]=v.useState(null),R=v.useCallback(B=>{A(U=>B.type==="goal_started"?{objective:B.objective,status:"active",budget:B.budget,used:0,rounds:0}:B.type==="goal_round"?{objective:U?.objective??"",status:"active",budget:B.budget,used:B.used,rounds:B.round}:{objective:U?.objective??"",status:B.outcome,budget:U?.budget??-1,used:B.used,rounds:B.rounds})},[]),L=v.useRef(r);L.current=r;const H=v.useRef(s);H.current=s;const O=v.useRef(null),I=v.useRef(null);I.current===null&&(I.current=ju());const z=v.useRef(null),W=v.useRef(null),X=v.useRef(0),D=v.useCallback(()=>{if(z.current!==null||W.current!==null)return;const B=()=>{X.current=Date.now(),c(F=>F+1)},U=X.current+U_-Date.now();if(U>0){W.current=window.setTimeout(()=>{W.current=null,B()},U);return}z.current=requestAnimationFrame(()=>{z.current=null,B()})},[]);v.useEffect(()=>{if(!e){O.current?.dispose(),O.current=null,h("idle"),y(0),f(!1),w(null),A(null),C(ue=>ue+1),c(ue=>ue+1);return}c(ue=>ue+1),f(!0),w(null),h(n),A(null),y(0),C(ue=>ue+1);let B=!1;const U=()=>{t5(e).then(ue=>{B||!ue.goal||ue.goal.status!=="active"||A(E=>E??ue.goal)}).catch(()=>{})},F=z_({loadMessages:()=>e5(e),onTaskState:h,onQueuedFollowUps:y,onLoading:f,onError:w,onModelChange:D,onPendingChange:()=>C(ue=>ue+1),onSessionTitle:(ue,E)=>L.current?.(ue,E),onSessionCreated:()=>H.current?.(),onGoalEvent:R});O.current=F;const Z=g4(e,{onOmniMessage:F.handleOmni,onServerEvent:F.handleServer,onOpen:U,onError:ue=>{ue&&wu().catch(()=>{})}});return F.load(),()=>{B=!0,F.dispose(),Z.close(),z.current!==null&&(cancelAnimationFrame(z.current),z.current=null),W.current!==null&&(window.clearTimeout(W.current),W.current=null)}},[e]);const q=v.useCallback(B=>{O.current?.markLocalDecision(B)},[]),P=v.useCallback(B=>{O.current?.resolveApproval(B)},[]),K=v.useCallback(()=>{O.current?.retry()},[]),ee=v.useCallback(()=>{const B=O.current?.model;B&&B.lastAuthFailureMs!==null&&(B.lastAuthFailureMs=null,c(U=>U+1))},[]);return{model:O.current?.model??I.current,version:o,loading:d,taskState:m,queuedFollowUps:p,lastAuthFailureMs:(O.current?.model??I.current).lastAuthFailureMs,dismissModelAuthDead:ee,pendingApprovals:O.current?.pendingApprovals??$_,markLocalDecision:q,resolveApproval:P,error:k,retry:K,goal:T}}const du={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 Wm({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 H_({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:Fv(vC(e,n,r,s))}):l.jsx(l.Fragment,{children:xn(e.sessionElapsedMs)})}function P_(e,n,r,s,o){const c=e.stats,d=e.taskOpen?tk({cacheRead:c.taskCacheRead,cacheWrite:c.taskCacheWrite,output:c.taskOutput},s):null,f=d!=null&&(d>0||n!=null)?(n??0)+d:n;return{tokensText:lt(c.sessionTotal+c.subagentTotal),costText:f!=null?Ya(f,o):null,costUncosted:r,elapsedNode:l.jsx(H_,{stats:c,taskOpen:e.taskOpen,taskStartLocalMs:e.taskStartLocalMs})}}const ur="new";function F_(){const e=ha(),n=Iv(),{currency:r}=ks(),{currentProject:s,currentAgent:o,setCurrentAgentId:c,reloadAgents:d,agents:f}=fn(),m=s?.projectId??null,h=o?.agentId??null,{sessions:p,loading:y,reload:k,add:w,replace:j,setStatus:C,setTitle:T}=el(),[A,R]=v.useState(null),[L,H]=v.useState(!1),[O,I]=v.useState(!1),[z,W]=v.useState(!1),[X,D]=v.useState(!1),[q,P]=v.useState(null),[K,ee]=v.useState(""),B=n.sessionId??null,U=T_(B),F=L_(B),Z={...U,setOpen:be=>{be&&F.setOpen(!1),U.setOpen(be)}},ue={...F,setOpen:be=>{be&&U.setOpen(!1),F.setOpen(be)}},E=B===ur,M=E?null:p.find(be=>be.sessionId===B)??null,$=M?{provider:M.provider,modelId:M.modelId}:null;hr(M?M.title??x.chat.defaultSessionTitle:x.nav.chat);const N=B_(M?.sessionId??null,M?.status??"idle",T,()=>{k()}),{initial:Y,onTextChange:le,onHandoffTargetChange:oe,onPendingModelChange:pe,onSkillsChange:Ce,discard:re}=D_(M?.sessionId??null),he=M?.sessionId??null,xe=M?.agentId??null;v.useEffect(()=>{he&&xe&&c(xe)},[he,xe,c]),v.useEffect(()=>{E&&(U.setOpen(!1),F.setOpen(!1))},[E]);const We=v.useRef(__()),Ke=_R(N.model.items),$e=N.taskState!=="idle"&&DR(N.model);v.useEffect(()=>{I_(We.current,{sessionId:he,taskCount:Ke,liveSpawn:$e})==="autoOpen"&&F.isDocked&&!F.open&&!U.open&&F.setOpen(!0)},[he,Ke,$e]);const[Bt,Ht]=v.useState([]);v.useEffect(()=>{if(Ht(Ee=>Ee.length>0?[]:Ee),!m||!xe)return;let be=!1;return Fh(m,xe).then(Ee=>{be||Ht(Ee.skills)}).catch(()=>{}),()=>{be=!0}},[m,xe]);const[jn,Te]=v.useState("");v.useEffect(()=>{if(Te(""),!m||!xe)return;let be=!1;return Ph(m,xe).then(Ee=>{be||Te(Ee.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{be=!0}},[m,xe]);const[ze,ct]=v.useState(null);v.useEffect(()=>{if(E||!B||y||p.some(Ee=>Ee.sessionId===B))return;let be=!1;return Dy(B).then(Ee=>{be||w(Ee.session)},()=>{be||ct(B)}),()=>{be=!0}},[E,B,y,p,w]),v.useEffect(()=>{if(y||E||B&&p.some(Ee=>Ee.sessionId===B)||B&&ze!==B)return;const be=Bv(p);e(be?`/chat/${be.sessionId}`:`/chat/${ur}`,{replace:!0})},[y,E,B,ze,p,e]),v.useEffect(()=>{M&&C(M.sessionId,N.taskState)},[N.taskState,M,C]);const At=v.useRef(N.taskState);v.useEffect(()=>{const be=At.current;At.current=N.taskState,be!=="idle"&&N.taskState==="idle"&&(k(),d())},[N.taskState,k,d]);const bt=v.useRef(new Map);v.useEffect(()=>{R(null),H(!1),ee(""),bt.current=new Map},[B]);const $n=v.useCallback(async be=>{const Ee=M?.sessionId??null,Ye=bt.current,Kt=Ee===null?[]:be.filter(_t=>!Ye.has(_t));if(Ee!==null&&Kt.length>0){const _t=p5(Ee,Kt).then(Yt=>new Set(Yt.existing)).catch(()=>null);for(const Yt of Kt)Ye.set(Yt,_t.then(Xn=>{if(Xn===null)return Ye.delete(Yt),!1;const pa=Xn.has(Yt);return Ye.set(Yt,pa),pa}))}const gt=new Set;return await Promise.all(be.map(async _t=>{const Yt=Ye.get(_t);(Yt===!0||Yt instanceof Promise&&await Yt)&&gt.add(_t)})),gt},[M?.sessionId]);v.useEffect(()=>{if(!m||!M||N.taskState!=="idle")return;let be=!1;return mv(m,{groupBy:"session",agentId:M.agentId}).then(Ee=>{if(be)return;const Ye=Ee.groups.find(Kt=>Kt.key===M.sessionId);R(Ye?.cost??null),H(Ye?.hasUncosted??!1)}).catch(()=>{}),()=>{be=!0}},[m,M,N.taskState]),v.useEffect(()=>{if(!m)return;let be=!1;return P(null),(async()=>{try{const Ee=await Vu(m);if(be)return;P(Ee);const{prefs:Ye}=await Dj();if(be||Ye.credentialGuideSeen)return;const Kt=Ee.models.find(_t=>ht(_t,Ee.defaultModel));(!Ee.defaultModel||!Kt?.credential?.apiKeyMasked)&&I(!0),uv({credentialGuideSeen:!0}).catch(()=>{})}catch{}})(),()=>{be=!0}},[m]);const ut=v.useCallback(async(be,Ee)=>{Ee!==be&&(await k(),e(`/chat/${Ee}`,{replace:!0}))},[k,e]),za=v.useCallback(async(be,Ee)=>{if(!M)return!1;try{const Ye=await co(M.sessionId,{input:be,...Ee?{goal:Ee}:{},...K?{thinkingLevel:K}:{}});return re(),await ut(M.sessionId,Ye.sessionId),!0}catch(Ye){return ft(Ae(Ye,{modelId:M.modelId})),!1}},[M,K,re,ut]),ce=v.useCallback(async(be,Ee)=>{if(!m||!M)return!1;const Ye=await Dy(M.sessionId).then(_t=>_t.session.tracePath).catch(()=>{}),Kt={type:"text",text:s8({sessionId:M.sessionId,...M.title!==void 0?{sessionTitle:M.title}:{},...Ye!==void 0?{tracePath:Ye}:{},workspace:M.workspace,prevProvider:M.provider,prevModelId:M.modelId})};let gt=null;try{const _t=await nh(m,M.agentId,{provider:be.provider,modelId:be.modelId,workspace:M.workspace,approvalMode:M.approvalMode});gt=_t.session.sessionId;const Yt=await co(gt,{input:[Kt,...Ee]});return w(_t.session),re(),e(`/chat/${Yt.sessionId}`),!0}catch(_t){return gt&&Mu(gt).catch(()=>{}),ft(Ae(_t,{modelId:be.modelId})),!1}},[m,M,w,re,e]),ye=v.useCallback(async(be,Ee)=>{if(!m||!o||!M)return!1;const Ye={type:"text",text:r8({agentId:o.agentId,...o.name!==void 0?{agentName:o.name}:{},sessionId:M.sessionId,workspace:M.workspace,...M.title!==void 0?{sessionTitle:M.title}:{}})};let Kt=null;try{const gt=await nh(m,be.agentId,{approvalMode:M.approvalMode});Kt=gt.session.sessionId;const _t=await co(Kt,{input:[Ye,...Ee]});return w(gt.session),re(),e(`/chat/${_t.sessionId}`),!0}catch(gt){return Kt&&Mu(Kt).catch(()=>{}),ft(Ae(gt,q?.defaultModel?{modelId:q.defaultModel.modelId}:{})),!1}},[m,o,M,w,re,e,q]),Se=v.useCallback(async()=>{M&&await a5(M.sessionId).catch(()=>{})},[M]),Le=v.useCallback(async be=>{if(!M)return!1;try{const Ee=await co(M.sessionId,{input:be,queueIfBusy:!0});return re(),await ut(M.sessionId,Ee.sessionId),!0}catch(Ee){return ft(Ae(Ee,{modelId:M.modelId})),!1}},[M,re,ut]),Be=v.useCallback(async(be,Ee=[])=>{if(!M)return"failed";try{return await s5(M.sessionId,{text:be,...Ee.length>0?{images:Ee}:{}}),"queued"}catch(Ye){return Ye instanceof Ka&&Ye.status===409?"not_running":(ft(Ae(Ye,{modelId:M.modelId})),"failed")}},[M]),Gt=v.useCallback(async(be,Ee,Ye)=>{if(!M)return;N.markLocalDecision(be);const Kt=Vl(Ye,be);try{await n5(M.sessionId,be,{decision:Ee}),N.resolveApproval(Kt)}catch(gt){gt instanceof Ka&&gt.status===404&&N.resolveApproval(Kt)}},[M,N]),pt=v.useCallback(be=>{!M||X||(D(!0),ah(M.sessionId,{approvalMode:be}).then(Ee=>j(Ee.session)).catch(Ee=>{ft(Ae(Ee))}).finally(()=>D(!1)))},[M,X,j]),Pt=v.useCallback(async()=>{if(M)try{const be=await l5(M.sessionId);await ut(M.sessionId,be.sessionId)}catch(be){ft(Ae(be,{modelId:M.modelId}))}},[M,ut]),mt=v.useCallback(()=>{e(`/chat/${ur}`)},[e]),Ft=v.useCallback(()=>{e("/models")},[e]),He=q?.models.find(be=>ht(be,$))?.pricing,mn={pendingApprovals:N.pendingApprovals,onApprove:Gt,origin:[],taskRunning:N.taskState!=="idle",taskCost:be=>tk(be.tokensByBucket,He),onRetryNow:()=>{M&&r5(M.sessionId).catch(()=>{})},onGiveUp:()=>{Se()},onOpenFile:be=>{Z.setOpen(!0),Z.browsePath(be)},onOpenSubagent:(be,Ee)=>{ue.setOpen(!0),ue.focusSubagent(be,[...Ee,be])},workspace:M?.workspace??null,statFiles:$n},at=[...N.pendingApprovals.keys()].some(be=>!be.startsWith(" "));if(!m||!h)return l.jsx("div",{className:"p-6",children:l.jsx(Vt,{className:"h-6 w-64"})});const Wt=P_(N.model,A,L,He,r),_n=q?.models.find(be=>ht(be,$)),Rt=_n?.contextWindow,In=_n?.vision!==!1,Nn=M!==null&&!N.loading&&!N.error&&N.model.items.length===0,Bn=q?.updatedAt!==void 0?Date.parse(q.updatedAt):NaN,yn=SC(N.lastAuthFailureMs,Number.isFinite(Bn)?Bn:null),Ua=M&&l.jsx(_2,{status:N.taskState,modelAuthDead:yn,onOpenModels:Ft,onRetryModelAuth:N.dismissModelAuthDead,onNewSession:mt,onSend:za,onSteer:Be,steeringDeliveredCount:N.model.items.filter(be=>be.kind==="user_steering").length,onQueueFollowUp:Le,queuedFollowUps:N.queuedFollowUps,onStop:Se,onCompact:Pt,modelRef:$,...q!==null?{models:q.models}:{},...q?.defaultModel!==void 0?{defaultModel:q.defaultModel}:{},onSwitchModel:ce,turnThinkingLevel:K||jn,onChangeTurnThinkingLevel:ee,...Rt!==void 0?{contextWindow:Rt}:{},contextNow:N.model.stats.contextNow,contextStale:N.model.stats.contextStale,vision:In,approvalMode:M.approvalMode,onChangeApprovalMode:pt,modeSaving:X,autoFocus:!0,agents:f,currentAgentId:M.agentId,skills:Bt,...Y.skills&&Y.skills.length>0?{initialSkills:Y.skills}:{},onSkillsChange:Ce,onHandoff:ye,initialText:Y.text??"",onTextChange:le,...Y.handoffAgentId?{initialHandoffTargetId:Y.handoffAgentId}:{},onHandoffTargetChange:oe,...Y.switchModelRef?{initialPendingModelRef:Y.switchModelRef}:{},onPendingModelChange:pe});return l.jsxs("div",{className:"flex h-full flex-col bg-white dark:bg-gray-950",children:[M&&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(Yu,{text:M.title??x.chat.defaultSessionTitle})}),N.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(Wm,{icon:du.tokens,value:Wt.tokensText,label:`${x.chat.statTokens}(Token)`}),Wt.costText!=null&&l.jsx(Wm,{icon:du.cost,value:`${Wt.costText}${Wt.costUncosted?" *":""}`,label:`${x.common.cost}(${r})${Wt.costUncosted?` · ${x.usage.uncostedNote}`:""}`}),l.jsx(Wm,{icon:du.elapsed,value:Wt.elapsedNode,label:x.chat.statElapsed})]}),l.jsxs("button",{type:"button","aria-expanded":ue.open,onClick:()=>ue.setOpen(!ue.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 ${ue.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,at&&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:du.folder})}),l.jsx("span",{className:"hidden sm:inline",children:x.chat.openWorkspace})]}),l.jsx(La,{open:z,setOpen:W,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:()=>W(!z),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:M.modelId}),l.jsx("span",{className:"ml-1.5 text-gray-400 dark:text-gray-500",children:cr(M.provider)?.label??M.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:M.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:ua(M.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," ",Wt.tokensText,Wt.costText!=null&&` · ${x.common.cost} ${Wt.costText}`," ·"," ",x.chat.statElapsed," ",Wt.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(a_,{projectId:m,models:q},`draft:${m}`):l.jsx("div",{className:"anim-fade flex min-h-0 flex-1 flex-col",children:M?N.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,":",N.error]}),l.jsx(ve,{onClick:N.retry,children:x.common.retry})]}):N.loading?l.jsxs("div",{className:"space-y-3 p-6",children:[l.jsx(Vt,{className:"h-5 w-1/3"}),l.jsx(Vt,{className:"h-5 w-2/3"}),l.jsx(Vt,{className:"h-5 w-1/2"})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"min-h-0 flex-1",children:Nn?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(w2,{items:N.model.items,version:N.version,ctx:mn})}),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:[N.goal&&l.jsx(YR,{goal:N.goal}),Ua]})})]}):y?l.jsx("div",{className:"space-y-3 p-6",children:l.jsx(Vt,{className:"h-5 w-1/2"})}):l.jsx(fr,{title:x.chat.noSessions,action:l.jsx(ve,{onClick:mt,children:x.nav.newChat})})},M?.sessionId??"empty")}),M&&l.jsx(R_,{session:M,panel:ue,model:N.model,version:N.version,taskRunning:N.taskState!=="idle",ctx:mn}),M&&l.jsx(w_,{session:M,panel:Z})]}),l.jsx(dn,{open:O,title:x.project.noCredentialTitle,onClose:()=>I(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:()=>I(!1),children:x.project.later}),l.jsx(ve,{variant:"primary",onClick:()=>{I(!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 B2=/^[a-z][a-z0-9_]{1,63}$/,vb=/^[a-z][a-z0-9_]{1,31}$/,q_=/^[a-z0-9_]+$/,V_=64;function G_({open:e,onClose:n,onCreated:r}){const{user:s}=Un(),o=s&&!s.isAdmin?`${s.userId}-`:"",[c,d]=v.useState(""),[f,m]=v.useState(""),[h,p]=v.useState(void 0),[y,k]=v.useState(!1);v.useEffect(()=>{e&&(d(""),m(""),p(void 0))},[e]);const w=async()=>{const j=o+c.trim();if(!c.trim()){p(x.common.requiredField);return}if(!(o?q_.test(c.trim())&&j.length<=V_:B2.test(j))){p(o?x.project.idPrefixHint:x.project.idHint);return}k(!0),p(void 0);try{const T=await Pj({projectId:j,...f.trim()?{name:f.trim()}:{}});r(T.project.projectId)}catch(T){p(Ae(T))}finally{k(!1)}};return l.jsx(dn,{open:e,title:x.project.createTitle,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:n,children:x.common.cancel}),l.jsx(ve,{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(Pl,{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(Ze,{size:"sm",className:"rounded-l-none",value:c,invalid:!!h,onChange:j=>{d(j.target.value),p(void 0)},autoFocus:!0})]}),h?l.jsx(xs,{children:h}):l.jsx(Xv,{children:x.project.idPrefixHint})]}):l.jsx(Ze,{label:x.project.id,required:!0,size:"sm",value:c,error:h,onChange:j=>{d(j.target.value),p(void 0)},hint:x.project.idHint,autoFocus:!0}),l.jsx(Ze,{label:x.project.name,size:"sm",value:f,onChange:j=>m(j.target.value)})]})})}function W_({open:e,onClose:n}){const{user:r}=Un(),{currentProject:s,setCurrentProjectId:o,projects:c,reloadProjects:d}=fn(),[f,m]=v.useState(null),[h,p]=v.useState(""),[y,k]=v.useState(null),[w,j]=v.useState(!1),[C,T]=v.useState(""),[A,R]=v.useState(!1),[L,H]=v.useState(void 0),O=s?.projectId,I=s?.role==="owner",z=s?ih(s):"";if(v.useEffect(()=>{!e||!O||(m(null),k(null),j(!1),T(z),H(void 0),ym(O).then(P=>m(P.members)).catch(P=>k(Ae(P))))},[e,O]),!s||!O)return null;const W=async()=>{const P=C.trim();if(!(!P||P===z||A)){R(!0),H(void 0);try{await Fj(O,{name:P}),await d()}catch(K){H(Ae(K))}finally{R(!1)}}},X=async()=>{if(h.trim())try{await Vj(O,{userId:h.trim()}),p("");const P=await ym(O);m(P.members)}catch(P){ft(Ae(P))}},D=async P=>{try{await Gj(O,P);const K=await ym(O);m(K.members)}catch(K){ft(Ae(K))}},q=async()=>{try{await qj(O),n();const P=c.find(K=>K.projectId!==O);await d(),P&&o(P.projectId)}catch(P){ft(Ae(P))}};return l.jsxs(dn,{open:e,title:x.project.settingsTitle,onClose:n,children:[l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[I?l.jsxs(l.Fragment,{children:[l.jsx(Pl,{children:x.project.displayName}),l.jsxs("div",{className:"flex items-stretch gap-2",children:[l.jsx(Ze,{size:"sm",className:"min-w-0 flex-1",value:C,invalid:!!L,maxLength:100,onChange:P=>{T(P.target.value),L&&H(void 0)},onKeyDown:P=>{P.key==="Enter"&&W()}}),l.jsx(ve,{size:"sm",disabled:A||!C.trim()||C.trim()===z,onClick:()=>{W()},children:x.common.save})]}),L!==void 0&&l.jsx(xs,{children:L})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.project.switcher}),l.jsx("p",{className:"text-sm",children:z})]}),l.jsx("p",{className:"mt-1 font-mono text-xs text-gray-400",children:O})]}),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(Jt,{tone:"gray",children:P.role})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:I&&P.role!=="owner"&&P.userId!==r?.userId&&l.jsx(ve,{size:"sm",variant:"ghost",onClick:()=>{D(P.userId)},children:x.project.removeMember})})]},P.userId)),I&&l.jsxs("tr",{children:[l.jsx("td",{className:"px-2.5 py-1.5",children:l.jsx(Ze,{placeholder:x.common.username,size:"sm",value:h,onChange:P=>p(P.target.value),onKeyDown:P=>{P.key==="Enter"&&X()}})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:l.jsx(Jt,{tone:"gray",children:"member"})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:l.jsx(ve,{size:"sm",disabled:!h.trim(),onClick:()=>{X()},children:x.project.addMember})})]})]})]})})]}),I&&l.jsx("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:O==="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(ve,{size:"sm",variant:"danger",onClick:()=>j(!0),children:x.project.deleteProject})})]}),l.jsx(fa,{open:w,title:x.project.deleteProject,onClose:()=>j(!1),onConfirm:()=>{q()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.project.deleteConfirm})})]})}const K_="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",Y_="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 ys({label:e,hint:n,error:r,invalid:s,required:o,size:c="base",className:d,...f}){const[m,h]=v.useState(!1),p=m?x.auth.hidePassword:x.auth.showPassword,y=v.useId();return l.jsx(Lo,{label:e,hint:n,error:r,errorId:y,required:o,children:l.jsxs("div",{className:"relative",children:[l.jsx(Ze,{...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":p,title:p,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?Y_:K_})})})]})})}function H2({open:e,onClose:n}){const{refresh:r}=Un(),[s,o]=v.useState(""),[c,d]=v.useState(""),[f,m]=v.useState(""),[h,p]=v.useState({}),[y,k]=v.useState(!1),w=()=>p(C=>C.old||C.new||C.confirm?{}:C);v.useEffect(()=>{e&&(o(""),d(""),m(""),p({}))},[e]);const j=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){p(C);return}k(!0),p({});try{await Oj({oldPassword:s,newPassword:c}),await r(),n()}catch(T){T instanceof Ka&&T.code==="invalid_password"?p({new:Ae(T)}):p({old:Ae(T)})}finally{k(!1)}};return l.jsx(dn,{open:e,title:x.account.changePassword,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:n,disabled:y,children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:y,onClick:()=>{j()},children:x.common.save})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(ys,{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(ys,{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(ys,{label:x.account.confirmPassword,required:!0,size:"sm",value:f,onChange:C=>{m(C.target.value),w()},error:h.confirm,autoComplete:"new-password"})]})})}function Q_({open:e,onClose:n,latestVersion:r,releaseUrl:s=null,canUpdate:o,onRunFinished:c}){const[d,f]=v.useState("confirm"),[m,h]=v.useState(null);v.useEffect(()=>{e&&(f("confirm"),h(null))},[e]);const p=()=>{d==="done"&&c?.(),n()},y=async()=>{f("running");try{h(await M5())}catch(w){h({status:"failed",output:Ae(w),needsRestart:!1})}f("done")},k=m===null?null:m.status==="updated"?{text:x.update.updated,className:"text-green-600 dark:text-green-400"}:m.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(dn,{open:e,title:o?x.update.updateNow:r!==null?x.update.newVersion(r):x.update.releaseNotes,onClose:d==="running"?()=>{}:p,footer:d==="done"||!o?l.jsx(ve,{onClick:p,children:x.common.close}):l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:p,disabled:d==="running",children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:d==="running",onClick:()=>{y()},children:d==="running"?x.update.updating:x.update.updateNow})]}),children:d==="done"&&m!==null&&k!==null?l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:`text-sm font-medium ${k.className}`,children:k.text}),m.status==="updated"&&l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:x.update.restartHint}),m.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:m.output})]}):l.jsxs("div",{className:"space-y-2",children:[r!==null&&l.jsx("p",{className:"text-sm font-medium",children:x.update.newVersion(r)}),s!==null&&l.jsx("p",{children:l.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:x.update.releaseNotes})}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:o?x.update.confirmBody:x.update.adminOnly}),d==="running"&&l.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:x.update.updating})]})})}function Ra({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 ia={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"},P2="M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z",X_="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",kb="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",Z_="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",J_="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",no="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",F2="penguin.sidebarGroupMode";function eI(){return localStorage.getItem(F2)==="agent"?"agent":"workspace"}const tI=e=>`penguin.sidebarCollapsedGroups.${e}`,nI=e=>`penguin.sidebarPinnedGroups.${e}`;function fu(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 wb(e,n){if(e)try{localStorage.setItem(e,JSON.stringify([...n]))}catch{}}const mu=(e,n)=>`${n}\0${e}`;function aI({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 Sb({onNavigate:e,onCollapse:n}){const r=ha(),{user:s,logout:o}=Un(),{mode:c,setMode:d,fontScale:f,setFontScale:m,accent:h,setAccent:p,currency:y,setCurrency:k}=ks(),{lang:w,locale:j,setLang:C}=Qa(),{projects:T,currentProject:A,setCurrentProjectId:R,reloadProjects:L,agents:H,currentAgent:O,setCurrentAgentId:I}=fn(),{sessions:z,byAgent:W,countsByAgent:X,workspaceCountsByAgent:D,isLoadedFor:q,hasMoreFor:P,loadMoreFor:K,loading:ee,remove:B,replace:U}=el(),Z=Rv("/chat/:sessionId")?.params.sessionId??null,[ue,E]=v.useState(!1),[M,$]=v.useState(!1),[N,Y]=v.useState(!1),[le,oe]=v.useState(!1),[pe,Ce]=v.useState(!1),[re,he]=v.useState(!1),{version:xe,update:We}=L2(M),Ke=We?.updateAvailable===!0,$e=Ke?We?.latestVersion??null:null,Bt=xe?.buildDate??null,[Ht,jn]=v.useState(!1),Te=async()=>{if(!Ht){jn(!0);try{const ae=await sb();ae.disabled===!0?ws(x.update.checkDisabled):ae.error!==void 0?ft(x.update.checkFailed):ae.updateAvailable||oa(x.update.upToDate)}catch(ae){ft(Ae(ae))}finally{jn(!1)}}},ze=A?.projectId??null,ct=ze===null?null:tI(ze),At=ze===null?null:nI(ze),[bt,$n]=v.useState(eI),[ut,za]=v.useState(()=>fu(ct)),[ce,ye]=v.useState(()=>fu(At));v.useEffect(()=>{za(fu(ct)),ye(fu(At))},[ct,At]);const[Se,Le]=v.useState(new Set),[Be,Gt]=v.useState(new Set),[pt,Pt]=v.useState(new Map),[mt,Ft]=v.useState(null),[He,mn]=v.useState(!1),[at,Wt]=v.useState(null),[_n,Rt]=v.useState(""),[In,Nn]=v.useState(!1),[Bn,yn]=v.useState(null),Ua=ae=>{localStorage.setItem(F2,ae),$n(ae)},be=v.useMemo(()=>S4(z),[z]),Ee=v.useMemo(()=>w4(D),[D]),Ye=v.useMemo(()=>Xy(H,ae=>ae.agentId,ce),[H,ce]),Kt=v.useMemo(()=>Xy(be,ae=>ae.key,ce),[be,ce]),gt=ae=>bt==="agent"?ae.agentId:Eu(ae.workspace),_t=ae=>{const ke=new Set(ut);ke.has(ae)?ke.delete(ae):ke.add(ae),za(ke),wb(ct,ke)},Yt=ae=>{const ke=new Set(ce);ke.has(ae)?ke.delete(ae):ke.add(ae),ye(ke),wb(At,ke)},Xn=(ae,ke)=>`${ke}\0${ae}`,pa=(ae,ke,Pe)=>{const rt=Xn(ae,ke);Gt(jt=>new Set(jt).add(rt)),K(Pe,ke).finally(()=>{Gt(jt=>{const Nt=new Set(jt);return Nt.delete(rt),Nt})})},nl=(ae,ke,Pe)=>{const rt=mu(ae,ke),jt=!Se.has(rt);if(Le(Nt=>{const Ot=new Set(Nt);return jt?Ot.add(rt):Ot.delete(rt),Ot}),jt){const Nt=Pe.filter(Ot=>!q(Ot,ke));Nt.length>0&&K(Nt,ke)}},Hr=v.useRef(null);v.useEffect(()=>{if(!Z)return;const ae=z.find(Nt=>Nt.sessionId===Z);if(!ae)return;const ke=Va(ae);if(ke==="active"||ke==="archived")return;const Pe=`${bt}\0${Z}`;if(Hr.current===Pe)return;Hr.current=Pe;const rt=bt==="agent"?ae.agentId:Eu(ae.workspace),jt=mu(rt,ke);Le(Nt=>Nt.has(jt)?Nt:new Set(Nt).add(jt)),q(ae.agentId,ke)||K([ae.agentId],ke)},[Z,z,bt,q,K]);const Cn=async ae=>{!ae.archived&&ae.sessionId===Z&&Le(ke=>new Set(ke).add(mu(gt(ae),"archived")));try{const ke=await ah(ae.sessionId,{archived:!ae.archived});U(ke.session)}catch{}},Qt=async()=>{if(!at)return;const ae=_n.trim();if(ae){Nn(!0),yn(null);try{const ke=await ah(at.sessionId,{title:ae});U(ke.session),Wt(null)}catch(ke){yn(Ae(ke))}finally{Nn(!1)}}},hn=async()=>{if(!mt)return;mn(!0);const ae=mt;try{if(await Mu(ae.sessionId),B(ae.sessionId),s&&$u(O2(s.userId,ae.sessionId)),Ft(null),Z===ae.sessionId){const ke=(W.get(ae.agentId)??[]).filter(Pe=>{const rt=Va(Pe);return Pe.sessionId!==ae.sessionId&&(rt==="active"||rt==="schedule")});r(ke[0]?`/chat/${ke[0].sessionId}`:"/chat")}}catch(ke){ft(Ae(ke))}finally{mn(!1)}},ga=ae=>{r(ae),e?.()},Xa=(ae,ke)=>{ae&&I(ae);const Pe={...ae?{agentId:ae}:{},...ke!==void 0?{workspace:ke}:{}};r(`/chat/${ur}`,Object.keys(Pe).length>0?{state:Pe}:void 0),e?.()},gr=(H.find(ae=>ae.agentId==="default_agent")??H[0])?.agentId,al=O?.agentId??gr,js=ae=>{I(ae.agentId),ga(`/chat/${ae.sessionId}`)},xr=v.useMemo(()=>new Map(H.map(ae=>[ae.agentId,un(ae)])),[H]),yr=(ae,ke)=>l.jsx("ul",{className:"space-y-0.5",children:ae.map(Pe=>l.jsx(rI,{s:Pe,active:Pe.sessionId===Z,...ke?{agentHint:xr.get(Pe.agentId)??Pe.agentId}:{},onOpen:js,onRename:rt=>{yn(null),Rt(rt.title??""),Wt(rt)},onDelete:rt=>Ft(rt),onToggleArchive:rt=>{Cn(rt)}},Pe.sessionId))}),bn="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",xa=(ae,ke,Pe,rt,jt,Nt)=>{const Ot=Pe[ke],It=Math.max(Nt?.[ke]??0,Ot.length);if(It===0)return null;const Zn=Se.has(mu(ae,ke)),Pr=Ot.length<It&&jt.some(Ja=>P(Ja,ke)),ba=Be.has(Xn(ae,ke));return l.jsxs("div",{className:"mt-1",children:[l.jsxs("button",{type:"button",onClick:()=>nl(ae,ke,jt),className:bn,children:[l.jsx(An,{open:Zn,size:12}),x.chat.folderGroups[ke](It)]}),Zn&&yr(Ot,rt),Zn&&Pr&&l.jsxs("button",{type:"button","aria-label":x.chat.loadMore,disabled:ba,onClick:()=>pa(ae,ke,jt),className:`${bn} disabled:opacity-60`,children:[l.jsx("span",{className:"w-3","aria-hidden":!0}),ba?x.common.loading:x.chat.loadMore]})]},ke)},Za=(ae,ke)=>{Pt(Pe=>{const rt=new Map(Pe);return rt.set(ae,(Pe.get(ae)??Ws)+Ws),rt}),ke.length>0&&pa(ae,"active",ke)},ya=(ae,ke,Pe,rt,jt)=>{const Nt=pt.get(ae)??Ws,Ot=ke.active.slice(0,Nt),It=jt("active"),Zn=Math.max(rt?.active??0,ke.active.length),Pr=ke.active.length>Nt||ke.active.length<Zn&&It.some(tr=>P(tr,"active")),ba=tp.map(tr=>xa(ae,tr,ke,Pe,jt(tr),rt)),Ja=ke.active.length===0&&ba.every(tr=>tr===null),er=Be.has(Xn(ae,"active"));return l.jsxs(l.Fragment,{children:[Ja?l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):yr(Ot,Pe),Pr&&l.jsxs("button",{type:"button","aria-label":x.chat.loadMore,disabled:er,onClick:()=>Za(ae,It),className:`${bn} mt-0.5 disabled:opacity-60`,children:[l.jsx("span",{className:"w-3","aria-hidden":!0}),er?x.common.loading:x.chat.loadMore]}),ba]})},Lt=[{to:"/agents",label:x.nav.agents,icon:ia.agents},{to:"/skills",label:x.nav.skills,icon:ia.skills},{to:"/models",label:x.nav.models,icon:ia.models},{to:"/usage",label:x.nav.usage,icon:ia.usage},{to:"/traces",label:x.nav.traces,icon:ia.traces},{to:"/benchmark",label:x.nav.benchmark,icon:ia.benchmark}],Ns=[{value:"light",label:x.settings.themeLight},{value:"dark",label:x.settings.themeDark},{value:"system",label:x.settings.followSystem}],rl=[{value:"en",label:x.settings.langEn},{value:"zh",label:x.settings.langZh},{value:"system",label:x.settings.followSystem}],Ln=[{value:"sm",label:x.settings.fontSmall},{value:"md",label:x.settings.fontMedium},{value:"lg",label:x.settings.fontLarge}],Tn=[{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(Ra,{d:"M15 6l-6 6 6 6M4 4v16",size:18})}),l.jsxs(La,{open:ue,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(!ue),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?ih(A):x.common.loading}),l.jsx("span",{className:"text-gray-400",children:l.jsx(np,{})})]}),children:[T.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:ih(ae)}),l.jsx(Jt,{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:no,onClick:()=>{E(!1),Y(!0)},children:["+ ",x.project.create]}),A&&l.jsx("button",{type:"button",className:no,onClick:()=>{E(!1),oe(!0)},children:x.project.settings})]})]})]}),l.jsx("div",{className:"shrink-0 px-2 pb-2 pt-2",children:l.jsxs("button",{type:"button",onClick:()=>Xa(gr),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===ur?"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(Ra,{d:P2})}),x.chat.newSessionMenu]})}),l.jsxs("div",{className:"relative min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:[l.jsx("nav",{className:"space-y-0.5",children:Lt.map(ae=>l.jsxs(Jh,{to:ae.to,onClick:()=>e?.(),className:({isActive:ke})=>`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${ke?"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(Ra,{d:ae.icon})}),ae.label]},ae.to))}),l.jsxs("div",{className:"-mx-2 mt-3 flex items-center justify-between border-t border-gray-200 px-3 pt-2 dark:border-gray-800",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:kb,label:x.chat.groupByWorkspace},{value:"agent",icon:ia.agents,label:x.chat.groupByAgent}].map(ae=>l.jsx("button",{type:"button",title:ae.label,"aria-label":ae.label,"aria-pressed":bt===ae.value,onClick:()=>Ua(ae.value),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150 ${bt===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(Ra,{d:ae.icon,size:14})},ae.value))})]}),bt==="agent"?ee&&H.length===0?l.jsx(Ia,{rows:5}):Ye.map(ae=>{const ke=Qy(W.get(ae.agentId)??[]),Pe=ut.has(ae.agentId),rt=ce.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:()=>_t(ae.agentId),"aria-expanded":!Pe,"aria-label":Pe?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(da,{id:ae.agentId,name:un(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:un(ae)}),l.jsx(An,{open:!Pe,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),l.jsx(jb,{pinned:rt,onToggle:()=>Yt(ae.agentId)}),l.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:()=>Xa(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(Ra,{d:"M12 5v14M5 12h14",size:18})}),l.jsx("button",{type:"button",title:x.agent.settings,onClick:()=>ga(`/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(Ra,{d:X_,size:16})})]}),Pe?null:ya(ae.agentId,ke,!1,X.get(ae.agentId),()=>[ae.agentId])]},ae.agentId)}):ee&&z.length===0?l.jsx(Ia,{rows:5}):Kt.length===0?l.jsx("p",{className:"px-2.5 pt-3 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):Kt.map(ae=>{const ke=Qy(ae.sessions),Pe=ut.has(ae.key),rt=ce.has(ae.key),jt=Ee.get(ae.key),Nt=[...new Set(ae.sessions.map(It=>It.agentId))],Ot=It=>[...new Set([...jt?.agents[It]??[],...Nt])];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:()=>_t(ae.key),"aria-expanded":!Pe,"aria-label":Pe?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(Ra,{d:Pe?kb:Z_,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(jt?.totals.active??0,ke.active.length)}),l.jsx(An,{open:!Pe,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),l.jsx(jb,{pinned:rt,onToggle:()=>Yt(ae.key)}),l.jsx("button",{type:"button",title:x.chat.newSessionInWorkspace,"aria-label":x.chat.newSessionInWorkspace,onClick:()=>Xa(al,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(Ra,{d:"M12 5v14M5 12h14",size:18})})]}),Pe?null:ya(ae.key,ke,!0,jt?.totals,Ot)]},ae.key)})]}),l.jsx("div",{className:"shrink-0 border-t border-gray-200 p-2 dark:border-gray-800",children:l.jsxs(La,{open:M,setOpen:$,menuClass:"bottom-full left-0 right-0 mb-1 origin-bottom",button:l.jsxs("button",{type:"button",onClick:()=>$(!M),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(),Ke&&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(ao,{label:x.settings.theme,children:l.jsx(Bl,{options:Ns,value:c,onChange:d})}),l.jsx(ao,{label:x.settings.fontSize,children:l.jsx(Bl,{options:Ln,value:f,onChange:m})}),l.jsx(ao,{label:x.settings.accent,children:l.jsx(sI,{value:h,onChange:p})}),l.jsx(ao,{label:x.models.currency,children:l.jsx(Bl,{options:Tn,value:y,onChange:k,cols:2})}),l.jsx(ao,{label:x.settings.language,children:l.jsx(Bl,{options:rl,value:w,onChange:C})})]}),l.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[l.jsx("button",{type:"button",className:no,onClick:()=>{$(!1),Ce(!0)},children:x.account.changePassword}),l.jsxs("button",{type:"button",disabled:Ht,onClick:()=>{$e!==null?($(!1),he(!0)):Te()},...Bt!==null?{title:x.update.lastUpdated(Vv(Bt,j))}:{},className:`${no} flex items-center justify-between gap-2 disabled:cursor-default disabled:opacity-60`,children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[$e!==null&&l.jsx("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent-bg)]"}),l.jsx("span",{className:"min-w-0 truncate",children:Ht?x.update.checking:$e!==null?x.update.newVersion($e):x.update.checkNow})]}),xe!==null&&l.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:`v${xe.version}`})]}),s?.isAdmin&&l.jsx("button",{type:"button",className:no,onClick:()=>{$(!1),ga("/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:()=>{$(!1),o().then(()=>r("/login"))},children:x.auth.logout})]})]})}),l.jsx(H2,{open:pe,onClose:()=>Ce(!1)}),l.jsx(Q_,{open:re,onClose:()=>he(!1),latestVersion:$e,releaseUrl:We?.releaseUrl??null,canUpdate:s?.isAdmin===!0,onRunFinished:()=>{sb().catch(()=>{})}}),l.jsx(G_,{open:N,onClose:()=>Y(!1),onCreated:ae=>{Y(!1),L().then(()=>R(ae))}}),A&&l.jsx(W_,{open:le,onClose:()=>oe(!1)}),l.jsx(dn,{open:at!==null,title:x.chat.renameSession,onClose:()=>In?void 0:Wt(null),footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:()=>Wt(null),disabled:In,children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:In||!_n.trim(),onClick:()=>{Qt()},children:x.common.save})]}),children:l.jsx(Ze,{label:x.chat.renameSessionLabel,value:_n,error:Bn??void 0,autoFocus:!0,maxLength:120,onChange:ae=>{Rt(ae.target.value),Bn&&yn(null)},onKeyDown:ae=>{ae.key==="Enter"&&_n.trim()&&!In&&Qt()}})}),l.jsx(fa,{open:mt!==null,title:x.chat.deleteSession,confirmLabel:x.common.delete,busy:He,onClose:()=>He?void 0:Ft(null),onConfirm:()=>{hn()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:mt?x.chat.deleteSessionConfirm(mt.title??x.chat.defaultSessionTitle):""})})]})}function jb({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(Ra,{d:J_,size:15})})}function rI({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(da,{id:e.agentId,name:r,size:14,className:"rounded"}),l.jsx("span",{className:"sr-only",children:r})]}),l.jsx(Yu,{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(aI,{session:e}),e.pendingApprovalCount>0&&l.jsx("span",{title:x.chat.pendingApprovals(e.pendingApprovalCount),children:l.jsx(Jt,{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(Ra,{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(Ra,{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(Ra,{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 ao({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 sI({value:e,onChange:n}){return l.jsx("div",{className:"flex items-center gap-1.5",children:Rj.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 lI="M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5",Km=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 iI({onExpand:e}){const{user:n}=Un(),r=ha(),{agents:s,setCurrentAgentId:o}=fn(),{sessions:c,loading:d}=el(),f=Rv("/chat/:sessionId")?.params.sessionId??null,m=f!==null&&f!==ur,h=v.useMemo(()=>Bv(c),[c]),p=()=>{h&&(o(h.agentId),r(`/chat/${h.sessionId}`))},y=()=>{const w=(s.find(j=>j.agentId==="default_agent")??s[0])?.agentId;w&&o(w),r(`/chat/${ur}`,w?{state:{agentId:w}}:void 0)},k=[{to:"/agents",label:x.nav.agents,icon:ia.agents},{to:"/skills",label:x.nav.skills,icon:ia.skills},{to:"/models",label:x.nav.models,icon:ia.models},{to:"/usage",label:x.nav.usage,icon:ia.usage},{to:"/traces",label:x.nav.traces,icon:ia.traces},{to:"/benchmark",label:x.nav.benchmark,icon:ia.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 shrink-0 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(Ue,{d:"M9 6l6 6-6 6M20 4v16",size:18})}),l.jsxs("nav",{className:"no-scrollbar mt-1 flex min-h-0 flex-1 flex-col items-center gap-1 overflow-y-auto",children:[l.jsx("button",{type:"button",title:x.nav.lastConversation,"aria-label":x.nav.lastConversation,disabled:!h&&!d,onClick:p,className:h||d?Km(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(Ue,{d:lI,size:18})}),l.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:y,className:Km(f===ur),children:l.jsx(Ue,{d:P2,size:18})}),k.map(w=>l.jsx(Jh,{to:w.to,title:w.label,"aria-label":w.label,className:({isActive:j})=>Km(j),children:l.jsx(Ue,{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 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:(n?.userId??"?").slice(0,1).toUpperCase()})]})}function oI(){const{user:e}=Un(),[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(iI,{onExpand:f}):l.jsx(Sb,{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(_N,{})})]}),l.jsx(H2,{open:s,onClose:()=>o(!1)}),l.jsx(T4,{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(Sb,{onNavigate:()=>r(!1)})})})]})}const $p=1440,Bp=900,Dh=3,cI=3,Nb=$p/Dh,Cb=Bp/cI,hu=28,pu=14;function uI(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 dI(e,n){return e.x1-pu<=n.x2&&e.x2+pu>=n.x1&&e.y1-pu<=n.y2&&e.y2+pu>=n.y1}function fI(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 mI=[{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 hI(){const e=uI(12696599),n=[];for(const{cell:r,edge:s}of mI){const o=r%Dh*Nb+hu,c=Math.floor(r/Dh)*Cb+hu,d=o+Nb-2*hu,f=c+Cb-2*hu,m=[],h=(L,H,O,I)=>{const z=O[0]>0?d-L:O[0]<0?L-o:O[1]>0?f-H:H-c;for(let W=Math.min(60+e()*150,z);W>=40;W/=2){const X=Math.round(L+O[0]*W),D=Math.round(H+O[1]*W),q=fI(L,H,X,D);if(m.every((P,K)=>I.has(K)||!dI(q,P)))return m.push(q),[X,D]}return null},p=(L,H,O)=>(O-L)*(.35+e()*.3)>L-H?1:-1,y=(L,H,O,I,z,W,X)=>{let[D,q]=[L,H],P=O;const K=[`M${Math.round(D)},${Math.round(q)}`],ee=[];for(let B=0;B<I;B+=1){const U=B===0?X:new Set([m.length-1]),F=h(D,q,P,U);if(!F)break;[D,q]=F,K.push(`L${D},${q}`),ee.push([D,q]),P=P[0]!==0?[0,p(q,c,f)]:[p(D,o,d),0]}return ee.length>=2&&n.push({d:K.join(" "),end:ee[ee.length-1],dur:z,delay:W}),ee},k=.15+e()*.7,w=s==="left"?0:s==="right"?$p:Math.round(o+(d-o)*k),j=s==="top"?0:s==="bottom"?Bp:Math.round(c+(f-c)*k),C=s==="left"?[1,0]:s==="right"?[-1,0]:s==="top"?[0,1]:[0,-1],T=12+e()*8,A=e()*3.2,R=y(w,j,C,3+Math.floor(e()*3),T,A,new Set);if(r%2===0&&R.length>=3){const[L,H]=R[1],[O,I]=R[2],z=[-Math.sign(O-L),-Math.sign(I-H)];y(L,H,z,2,T,A+1.4,new Set([1,2]))}}return n}const pI=hI();function gI(){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 ${$p} ${Bp}`,preserveAspectRatio:"xMidYMid slice",fill:"none",children:pI.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 xI(){hr(x.auth.login);const{login:e}=Un(),{mode:n,setMode:r}=ks(),{lang:s,setLang:o}=Qa(),c=ha(),[d,f]=v.useState(""),[m,h]=v.useState(""),[p,y]=v.useState({}),[k,w]=v.useState(!1),j=()=>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(L){y({form:Ae(L)})}finally{w(!1)}},T=[{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(gI,{}),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(Bl,{options:A,value:s,onChange:o})}),l.jsx("div",{"aria-label":x.settings.theme,children:l.jsx(Bl,{options:T,value:n,onChange:r})})]}),l.jsxs("div",{className:"anim-rise relative w-full max-w-sm",children:[l.jsx(I2,{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(Ze,{label:x.common.username,required:!0,value:d,onChange:R=>{f(R.target.value),j()},error:p.userId,autoComplete:"username",autoFocus:!0}),l.jsx(ys,{label:x.auth.password,required:!0,value:m,onChange:R=>{h(R.target.value),j()},error:p.password,autoComplete:"current-password"}),p.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:p.form}),l.jsx(ve,{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 ro=100,gs=30,Ma=2;function yI({data:e,label:n,className:r=""}){const s=Math.max(1,...e),o=e.length>1?(ro-2*Ma)/(e.length-1):0,c=e.map((h,p)=>[Ma+p*o,gs-Ma-h/s*(gs-2*Ma)]),d=`${Ma},${gs-Ma} ${ro-Ma},${gs-Ma}`,f=c.length>1?c.map(([h,p])=>`${h},${p}`).join(" "):d,m=c.length>1?`${f} ${ro-Ma},${gs-Ma} ${Ma},${gs-Ma}`:null;return l.jsxs("svg",{width:ro,height:gs,viewBox:`0 0 ${ro} ${gs}`,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 bI=new Set(["default_agent"]),ir={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 vI(){const e=ha();hr(x.nav.agents);const{locale:n}=Qa(),{currentProject:r,agents:s,agentsLoading:o,reloadAgents:c,setCurrentAgentId:d}=fn(),[f,m]=v.useState(!1),[h,p]=v.useState(""),[y,k]=v.useState(""),[w,j]=v.useState(""),[C,T]=v.useState(void 0),[A,R]=v.useState(!1),L=()=>{p(""),k(""),j(""),T(void 0),m(!0)},[H,O]=v.useState(null),[I,z]=v.useState(null),W=r?.projectId,X=async()=>{if(!W)return;const P=h.trim();if(!P){T(x.common.requiredField);return}if(!B2.test(P)){T(x.agent.idHint);return}R(!0),T(void 0);try{const K={agentId:P};y.trim()&&(K.name=y.trim()),w.trim()&&(K.description=w.trim());const ee=await Xj(W,K);m(!1),await c(),d(ee.agent.agentId),e(`/agents/${ee.agent.agentId}`)}catch(K){T(Ae(K))}finally{R(!1)}},D=P=>{d(P),e(`/chat/${ur}`,{state:{agentId:P}})},q=async()=>{if(!(!W||!H)){R(!0),z(null);try{await f5(W,H.agentId),O(null),await c()}catch(P){z(Ae(P))}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(ve,{variant:"primary",onClick:L,children:x.agent.create})]}),o?l.jsx("div",{className:"space-y-3",children:Array.from({length:4},(P,K)=>l.jsxs(Jv,{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(Vt,{className:"h-[18px] w-40"}),l.jsx(Vt,{className:"mt-1.5 h-4 w-2/3"}),l.jsx(Vt,{className:"mt-1.5 h-4 w-48"})]}),l.jsx(Vt,{className:"hidden h-9 w-40 md:block"}),l.jsx(Vt,{className:"h-8 w-52"})]},K))}):s.length===0?l.jsx(fr,{title:x.common.none}):l.jsx("div",{className:"space-y-3",children:s.map(P=>{const K=bI.has(P.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(da,{id:P.agentId,name:un(P),size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-base font-bold",children:un(P)}),l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500",children:P.agentId}),l.jsxs(Jt,{tone:"gray",children:["v",P.version]}),P.activeSessionCount>0&&l.jsxs(Jt,{tone:"brand",children:[x.agent.activeSessions," ",P.activeSessionCount]})]}),l.jsx("p",{className:"mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400",children:P.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(P.sessionCount),children:[l.jsx(Ue,{d:ir.sessions,size:12}),P.sessionCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.toolCount(P.toolCount),children:[l.jsx(Ue,{d:on.toolCalls,size:12}),P.toolCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.vaultKeyCount(P.vaultKeyCount),children:[l.jsx(Ue,{d:ir.vaultKeys,size:12}),P.vaultKeyCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.scheduleCount(P.scheduleCount),children:[l.jsx(Ue,{d:ir.schedules,size:12}),P.scheduleCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.skills.skillCount(P.skillCount),children:[l.jsx(Ue,{d:ir.skills,size:12}),P.skillCount]}),l.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${x.agent.updatedAt} ${P.updatedAt?ua(P.updatedAt):"—"}`,children:[l.jsx(Ue,{d:on.elapsed,size:12}),P.updatedAt?E4(P.updatedAt,n):"—"]})]})]}),l.jsx(yI,{data:P.sessionActivity,label:x.agent.activity(P.sessionActivity.length||30),className:"hidden shrink-0 md:block"}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[l.jsxs(ve,{size:"sm",variant:"primary",onClick:()=>D(P.agentId),children:[l.jsx(Ue,{d:ir.newChat}),x.chat.newSessionMenu]}),l.jsxs(ve,{size:"sm",onClick:()=>{d(P.agentId),e(`/agents/${P.agentId}`)},children:[l.jsx(Ue,{d:ir.settings,className:"text-gray-600 dark:text-gray-300"}),x.common.settings]}),l.jsx(ve,{size:"icon",title:x.nav.usage,"aria-label":x.nav.usage,onClick:()=>e(`/usage?agentId=${encodeURIComponent(P.agentId)}`),children:l.jsx(Ue,{d:ir.usage,size:15,className:"text-gray-600 dark:text-gray-300"})}),l.jsx(ve,{size:"icon",title:x.nav.traces,"aria-label":x.nav.traces,onClick:()=>e(`/traces?agentId=${encodeURIComponent(P.agentId)}`),children:l.jsx(Ue,{d:ir.traces,size:15,className:"text-gray-600 dark:text-gray-300"})}),K?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(Ue,{d:ir.trash,size:15})}):l.jsx(ve,{size:"icon",variant:"danger",title:x.agent.deleteAgent,"aria-label":x.agent.deleteAgent,onClick:()=>O({agentId:P.agentId,name:un(P)}),children:l.jsx(Ue,{d:ir.trash,size:15})})]})]},P.agentId)})})]}),l.jsx(dn,{open:f,title:x.agent.createTitle,onClose:()=>m(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:()=>m(!1),children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:A,onClick:()=>{X()},children:x.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(Ze,{label:x.agent.id,required:!0,size:"sm",value:h,onChange:P=>{p(P.target.value),T(void 0)},error:C,hint:x.agent.idHint,autoFocus:!0}),l.jsx(Ze,{label:x.common.name,size:"sm",value:y,onChange:P=>k(P.target.value),hint:x.agent.nameHint}),l.jsx(ql,{label:x.agent.description,size:"sm",rows:3,value:w,onChange:P=>j(P.target.value)})]})}),l.jsxs(fa,{open:H!==null,title:x.agent.deleteAgent,busy:A,onClose:()=>{O(null),z(null)},onConfirm:()=>{q()},children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:H?x.agent.deleteConfirm(H.name):""}),I&&l.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:I})]})]})}function kI({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 Tb=4,Mb=16;function q2({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(),p=window.innerHeight-h.bottom,y=h.top,k=Math.min(r,window.innerHeight*.7),w=p<k&&y>p,j=s??h.width,C=Math.max(Mb,Math.min(h.left,window.innerWidth-j-Mb));f({topPx:w?void 0:h.bottom+Tb,bottomPx:w?window.innerHeight-h.top+Tb:void 0,left:C,triggerWidth:h.width})},[e,r,s]),v.useEffect(()=>{if(!e)return;const h=w=>{const j=w.target;o.current?.contains(j)||c.current?.contains(j)||m.current()},p=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",p,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",p,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",k)}},[e]),{triggerRef:o,panelRef:c,position:d}}const wI=288,SI={base:"text-base",sm:"text-xs"},jI={base:"text-xs",sm:"text-[11px]"};function zh({options:e,value:n,onChange:r,placeholder:s,mono:o,label:c,error:d,required:f,fullWidth:m,size:h="base","aria-label":p}){const[y,k]=v.useState(!1),{triggerRef:w,panelRef:j,position:C}=q2({open:y,onClose:()=>k(!1),estimatedHeight:e.length*48+16,panelWidth:wI}),T=n!=null?e.find(L=>L.value===n):void 0,A=v.useId(),R=l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:w,type:"button","aria-label":p,"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(L=>!L),className:`flex items-center gap-2 ${lp} ${ip[h]} ${d?Xu:""}`+(m?" w-full justify-between":""),children:[l.jsx("span",{className:`min-w-0 truncate ${o?"font-mono":""}`,children:T?.triggerLabel??s??"—"}),l.jsx(np,{className:"text-gray-400"})]}),y&&C&&Ql.createPortal(l.jsx("div",{ref:j,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(L=>l.jsxs("button",{type:"button",role:"option","aria-selected":L.value===n,onClick:()=>{r(L.value),k(!1)},className:`block ${Qv} hover:bg-gray-100 dark:hover:bg-gray-800 ${L.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:`${SI[h]} ${L.value===n?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:L.label}),L.value===n&&l.jsx(Pv,{className:"text-gray-500 dark:text-gray-400"})]}),l.jsx("span",{className:`mt-0.5 block ${jI[h]} text-gray-500 dark:text-gray-400`,children:L.description})]},L.value))}),document.body)]});return l.jsx(Lo,{label:c,error:d,errorId:A,required:f,children:R})}function V2({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 NI=/^[A-Za-z_][A-Za-z0-9_]*$/;function CI({agentId:e}){const{currentProject:n}=fn(),r=n?.projectId??null,s=n?.role==="owner",[o,c]=v.useState(null),[d,f]=v.useState(null),[m,h]=v.useState(!1),[p,y]=v.useState(!1),[k,w]=v.useState(""),[j,C]=v.useState(""),[T,A]=v.useState({}),R=()=>A(K=>K.key||K.value?{}:K),[L,H]=v.useState(null),[O,I]=v.useState(null),z=v.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{const K=await Kj(r,e);c(K.entries)}catch(K){f(Ae(K))}}},[r,e]);v.useEffect(()=>{z()},[z]);const W=async K=>{if(!r||!e)return x.common.unknownError;h(!0);try{const ee=await Yj(r,e,K);return c(ee.entries),oa(x.common.saved),null}catch(ee){return Ae(ee)}finally{h(!1)}},X=K=>(o??[]).filter(ee=>ee.key!==K).map(ee=>({key:ee.key})),D=()=>{w(""),C(""),A({}),y(!0)},q=async()=>{const K=k.trim(),ee={};if(K?NI.test(K)||(ee.key=x.vault.keyInvalid):ee.key=x.common.requiredField,j||(ee.value=x.vault.valueRequired),ee.key||ee.value){A(ee);return}if(A({}),O!==K&&(o??[]).some(U=>U.key===K)){I(K);return}I(null);const B=await W({entries:[...X(K),{key:K,value:j}]});if(B!==null){A({key:B});return}y(!1)},P=async()=>{if(L===null)return;const K=await W({entries:X(L)});K!==null&&ft(K),H(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(Ia,{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(K=>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:K.key}),l.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400",children:K.valueMasked}),l.jsx("td",{className:"px-3 py-2 text-right",children:s&&l.jsx(ve,{size:"sm",variant:"ghost",disabled:m,onClick:()=>H(K.key),children:x.vault.remove})})]},K.key))})]})}),s&&o!==null&&l.jsx(ve,{size:"sm",variant:"primary",disabled:m,onClick:D,children:x.vault.add}),l.jsx(dn,{open:p,title:x.vault.addTitle,onClose:()=>y(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:()=>y(!1),children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:m,onClick:()=>{q()},children:x.vault.add})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(Ze,{size:"sm",label:x.vault.key,required:!0,hint:x.vault.keyHint,error:T.key,value:k,onChange:K=>{w(K.target.value),R()},className:"font-mono",placeholder:"OPENAI_API_KEY",autoComplete:"off"}),l.jsx(ys,{size:"sm",label:x.vault.value,required:!0,error:T.value,value:j,onChange:K=>{C(K.target.value),R()},className:"font-mono",autoComplete:"off",onKeyDown:K=>{K.key==="Enter"&&!m&&q()}})]})}),l.jsx(fa,{open:O!==null,title:x.vault.overwriteTitle,tone:"primary",confirmLabel:x.common.save,busy:m,onClose:()=>I(null),onConfirm:()=>{q()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:O!==null?x.vault.overwriteConfirm(O):""})}),l.jsx(fa,{open:L!==null,title:x.vault.deleteTitle,busy:m,onClose:()=>H(null),onConfirm:()=>{P()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:L!==null?x.vault.deleteConfirm(L):""})}),d&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]}):null}function TI(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 MI=`flex w-full items-center gap-2 text-left ${lp} disabled:cursor-not-allowed disabled:opacity-60`,EI={base:"text-base",sm:"text-xs"};function Ro({label:e,hint:n,error:r,required:s,size:o="base",className:c,children:d,value:f,onChange:m,disabled:h}){const p=TI(d),y=String(f??""),k=p.find(O=>O.value===y),w=v.useId(),[j,C]=v.useState(!1),{triggerRef:T,panelRef:A,position:R}=q2({open:j,onClose:()=>C(!1),estimatedHeight:p.length*36+8}),L=O=>{C(!1),m?.({target:{value:O}}),T.current?.focus()},H=l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:T,type:"button",disabled:h,"aria-haspopup":"listbox","aria-expanded":j,"aria-required":s||void 0,"aria-invalid":r?!0:void 0,"aria-describedby":r?w:void 0,onClick:()=>C(O=>!O),className:`${MI} ${ip[o]} ${r?Xu:""} ${c??""}`,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:k?.label??p[0]?.label??""}),l.jsx(np,{className:"text-gray-400"})]}),j&&R&&Ql.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:p.map((O,I)=>l.jsxs("button",{type:"button",role:"option","aria-selected":O.value===y,disabled:O.disabled,onClick:()=>L(O.value),className:`flex items-center ${Qv} ${EI[o]} disabled:opacity-50 ${O.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:O.label}),O.value===y&&l.jsx(Pv,{className:"text-gray-500 dark:text-gray-400"})]},`${O.value}-${I}`))}),document.body)]});return l.jsx(Lo,{label:e,hint:n,error:r,errorId:w,required:s,children:H})}const AI={active:"green",disabled:"gray",expired:"amber",done:"brand",missed:"amber",invalid:"red"};function Eb(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 Ym=e=>JSON.stringify([e.provider,e.modelId]),RI=e=>{if(!e)return null;const[n,r]=JSON.parse(e);return{provider:n,modelId:r}},Ab=e=>`${e.modelId} · ${cr(e.provider)?.label??e.provider}`,Rb=e=>e.modelId&&e.provider?{provider:e.provider,modelId:e.modelId}:null,_I={editing:null,name:"",prompt:"",enabled:!0,startAt:"",endAt:"",period:"",target:"new",sessionId:"",workspace:"",model:null};function II({agentId:e}){const{currentProject:n}=fn(),r=n?.projectId??null,s=n?.role==="owner",[o,c]=v.useState(null),[d,f]=v.useState(null),[m,h]=v.useState(!1),[p,y]=v.useState(null),[k,w]=v.useState(null),[j,C]=v.useState({}),[T,A]=v.useState(null),[R,L]=v.useState(null),[H,O]=v.useState([]),I=v.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{c(await g5(r,e))}catch(B){f(Ae(B))}}},[r,e]);v.useEffect(()=>{I()},[I]),v.useEffect(()=>{!r||!s||Vu(r).then(B=>O(B.models)).catch(()=>O([]))},[r,s]);const z=B=>{C(U=>U.name||U.prompt||U.startAt||U.sessionId?{}:U),A(U=>U&&null),y(U=>U===null?U:{...U,...B})},W=B=>{C({}),A(null),y(B),w(B)},X=async()=>{if(!r||p===null)return;A(null);const B=p.editing??p.name.trim(),U={};if(B||(U.name=x.common.requiredField),p.prompt.trim()||(U.prompt=x.common.requiredField),p.startAt||(U.startAt=x.common.requiredField),p.target==="session"&&!p.sessionId.trim()&&(U.sessionId=x.common.requiredField),U.name||U.prompt||U.startAt||U.sessionId){C(U);return}if(C({}),p.editing!==null&&JSON.stringify(p)===JSON.stringify(k)){ws(x.common.noChangesToSave);return}const F={prompt:p.prompt,enabled:p.enabled,startAt:new Date(p.startAt).toISOString(),...p.period.trim()?{period:p.period.trim()}:{},...p.endAt?{endAt:new Date(p.endAt).toISOString()}:{},...p.target==="session"&&p.sessionId.trim()?{sessionId:p.sessionId.trim()}:{},...p.target==="new"&&p.workspace.trim()?{workspace:p.workspace.trim()}:{},...p.target==="new"&&p.model?{modelId:p.model.modelId,provider:p.model.provider}:{}};h(!0);try{p.editing!==null?await Uy(r,e,p.editing,F):await x5(r,e,{name:B,...F}),y(null),oa(x.common.saved),await I()}catch(Z){A(Ae(Z))}finally{h(!1)}},D=async B=>{if(!r)return;h(!0);const U=Rb(B);try{await Uy(r,e,B.name,{prompt:B.prompt,enabled:!B.enabled,startAt:B.startAt,...B.period!==void 0?{period:B.period}:{},...B.endAt!==void 0?{endAt:B.endAt}:{},...B.sessionId!==void 0?{sessionId:B.sessionId}:{},...B.workspace!==void 0?{workspace:B.workspace}:{},...U?{modelId:U.modelId,provider:U.provider}:{}}),oa(x.common.saved),await I()}catch(F){ft(Ae(F))}finally{h(!1)}},q=B=>{W({editing:B.name,name:B.name,prompt:B.prompt,enabled:B.enabled,startAt:Eb(B.startAt),endAt:Eb(B.endAt),period:B.period??"",target:B.sessionId?"session":"new",sessionId:B.sessionId??"",workspace:B.workspace??"",model:Rb(B)})},P=async()=>{if(!(!r||R===null)){h(!0);try{await y5(r,e,R),p?.editing===R&&y(null),await I()}catch(B){ft(Ae(B))}finally{h(!1),L(null)}}};if(!r)return null;const K=o?.schedules??[],ee=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(Ia,{rows:4}):K.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:K.map(B=>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:B.name}),l.jsx("td",{className:"px-3 py-2",children:l.jsx("span",{title:B.invalidReason,children:l.jsx(Jt,{tone:AI[B.status],children:x.schedule.statusNames[B.status]??B.status})})}),l.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:B.period!==void 0?l.jsx("span",{className:"font-mono",children:B.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:B.sessionId,children:B.sessionId!==void 0?l.jsx("span",{className:"font-mono",children:B.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:B.nextFireAt?ua(B.nextFireAt):"—"}),l.jsx("span",{className:"block text-gray-400 dark:text-gray-500",children:B.lastFiredAt?ua(B.lastFiredAt):"—"})]}),l.jsx("td",{className:"px-3 py-2",children:B.queued&&l.jsx(Jt,{tone:"brand",children:x.schedule.queued})}),s&&l.jsxs("td",{className:"whitespace-nowrap px-3 py-2 text-right",children:[l.jsx(ve,{size:"sm",variant:"ghost",disabled:m,onClick:()=>{D(B)},children:B.enabled?x.schedule.disable:x.schedule.enable}),l.jsx(ve,{size:"sm",variant:"ghost",disabled:m,onClick:()=>q(B),children:x.common.edit}),l.jsx(ve,{size:"sm",variant:"ghost",disabled:m,onClick:()=>L(B.name),children:x.common.delete})]})]},B.name))})]})}),ee.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:ee.map(B=>l.jsxs("li",{children:[B.name,": ",B.error]},B.name))})]}),s&&o!==null&&l.jsx(ve,{size:"sm",variant:"primary",disabled:m,onClick:()=>W(_I),children:x.schedule.addTitle}),l.jsx(dn,{open:p!==null,title:p?.editing!=null?x.schedule.editTitle(p.editing):x.schedule.addTitle,onClose:()=>y(null),widthClass:"sm:max-w-lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:()=>y(null),children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:m,onClick:()=>{X()},children:p?.editing!=null?x.common.save:x.common.create})]}),children:p!==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(Ze,{size:"sm",label:x.common.name,required:!0,hint:x.schedule.nameHint,error:j.name,value:p.name,disabled:p.editing!==null,onChange:B=>z({name:B.target.value}),className:"font-mono",placeholder:"daily_report",autoComplete:"off"}),l.jsx(Ze,{size:"sm",label:x.schedule.period,value:p.period,onChange:B=>z({period:B.target.value}),className:"font-mono",placeholder:x.schedule.periodPlaceholder,autoComplete:"off"}),l.jsx(Ze,{size:"sm",label:x.schedule.startAt,required:!0,type:"datetime-local",error:j.startAt,value:p.startAt,onChange:B=>z({startAt:B.target.value}),className:"font-mono"}),l.jsx(Ze,{size:"sm",label:x.schedule.endAt,type:"datetime-local",value:p.endAt,onChange:B=>z({endAt:B.target.value}),className:"font-mono"}),l.jsxs(Ro,{size:"sm",label:x.schedule.target,value:p.target,onChange:B=>z({target:B.target.value}),children:[l.jsx("option",{value:"new",children:x.schedule.targetNew}),l.jsx("option",{value:"session",children:x.schedule.targetSession})]}),p.target==="session"?l.jsx(Ze,{size:"sm",label:x.schedule.sessionId,required:!0,error:j.sessionId,value:p.sessionId,onChange:B=>z({sessionId:B.target.value}),className:"font-mono",autoComplete:"off"}):l.jsxs(l.Fragment,{children:[l.jsxs(Ro,{size:"sm",label:x.schedule.model,value:p.model?Ym(p.model):"",onChange:B=>z({model:RI(B.target.value)}),children:[l.jsx("option",{value:"",children:x.schedule.modelDefault}),p.model&&!H.some(B=>B.modelId===p.model.modelId&&B.provider===p.model.provider)&&l.jsx("option",{value:Ym(p.model),children:Ab(p.model)}),H.map(B=>l.jsx("option",{value:Ym({provider:B.provider,modelId:B.modelId}),children:Ab({provider:B.provider,modelId:B.modelId})},`${B.provider}:${B.modelId}`))]}),l.jsx(Ze,{size:"sm",label:x.schedule.workspace,value:p.workspace,onChange:B=>z({workspace:B.target.value}),className:"font-mono",autoComplete:"off"})]})]}),l.jsx(ql,{label:x.schedule.prompt,required:!0,size:"sm",rows:4,error:j.prompt,value:p.prompt,onChange:B=>z({prompt:B.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:p.enabled,onChange:B=>z({enabled:B.target.checked})}),x.schedule.enabled]}),T&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:T})]})}),l.jsx(fa,{open:R!==null,title:x.schedule.deleteTitle,busy:m,onClose:()=>L(null),onConfirm:()=>{P()},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 LI(e){return e.filter(([n])=>n!=="").map(([n,r])=>({value:n,triggerLabel:n,label:n,description:r}))}function so(e){const n=e.trim();if(!n)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Gs(e){return e===void 0?"":String(e)}function OI(){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=ha(),s=Iv().agentId??"";hr(x.agent.settings);const{currentProject:o,reloadAgents:c}=fn(),d=o?.projectId??null,[f,m]=v.useState(null),[h,p]=v.useState("overview"),[y,k]=v.useState(null),w=v.useCallback(()=>{!d||!s||(m(null),k(null),Ph(d,s).then(m).catch(A=>k(Ae(A))))},[d,s]);v.useEffect(()=>{w()},[w]);const j=v.useCallback(A=>{oa(x.agent.importDone(A)),w(),c()},[w,c]),C=v.useCallback(()=>{oa(x.agent.resetConfigDone),w(),c()},[w,c]),T=v.useCallback(async A=>{if(!(!d||!s))try{const R=await fv(d,s,A);m(R),oa(x.common.saved),(A.config?.name!==void 0||A.config?.description!==void 0)&&c()}catch(R){ft(Ae(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 relative h-full overflow-y-auto p-4 md:p-6",children:l.jsxs("div",{className:"mx-auto max-w-3xl",children:[l.jsxs(ve,{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(kI,{items:e,active:h,onChange:p}),l.jsxs("div",{className:"py-4",children:[h==="overview"&&l.jsx(DI,{data:f,agentId:s,onSave:T,onImported:j,onConfigReset:C}),h==="prompt"&&l.jsx(zI,{data:f,onSave:T}),h==="runtime"&&l.jsx(UI,{data:f,onSave:T}),h==="tools"&&l.jsx($I,{data:f,onSave:T}),h==="vault"&&l.jsx(CI,{agentId:s}),h==="schedules"&&l.jsx(II,{agentId:s})]})]})}):l.jsxs("div",{className:"space-y-3 p-6",children:[l.jsx(Vt,{className:"h-6 w-64"}),l.jsx(Vt,{className:"h-32 w-full"})]}):null}const _b="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 DI({data:e,agentId:n,onSave:r,onImported:s,onConfigReset:o}){const{currentProject:c}=fn(),d=c?.projectId??null,f=c?.role==="owner",[m,h]=v.useState(e.config.name??""),[p,y]=v.useState(e.config.description??""),[k,w]=v.useState(!1),[j,C]=v.useState(null),[T,A]=v.useState(null),[R,L]=v.useState(!1),[H,O]=v.useState(!1),{requestSave:I,element:z}=Qu(),W=async()=>{if(d){O(!0);try{await Zj(d,n),L(!1),o()}catch(P){ft(Ae(P))}finally{O(!1)}}},X=()=>{const P={};if(m.trim()!==(e.config.name??"")&&(P.name=m.trim()),p.trim()!==(e.config.description??"")&&(P.description=p.trim()),Object.keys(P).length===0){ws(x.common.noChangesToSave);return}I(()=>{r({config:P})})},D=async(P,K)=>{if(d){w(!0),C(null);try{const ee=await C5(d,n,{dataBase64:P,...K?{confirm:!0}:{}});A(null),s(ee.version)}catch(ee){ee instanceof Ka&&ee.status===409&&ee.code==="version_conflict"?A(P):(A(null),C(Ae(ee)))}finally{w(!1)}}},q=P=>{const K=P.target.files?.[0];if(P.target.value="",!K)return;C(null);const ee=new FileReader;ee.onload=()=>{const B=ee.result;D(B.slice(B.indexOf(",")+1),!1)},ee.onerror=()=>C(x.common.unknownError),ee.readAsDataURL(K)};return l.jsxs("div",{className:"space-y-4",children:[l.jsx(Ze,{size:"sm",label:x.common.name,value:m,onChange:P=>h(P.target.value)}),l.jsx(ql,{label:x.agent.description,size:"sm",rows:3,value:p,onChange:P=>y(P.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:N5(d,n),download:!0,className:_b,children:x.agent.exportSnapshot}),f&&l.jsxs("label",{className:`${_b} ${k?"pointer-events-none opacity-60":""}`,children:[l.jsx(Up,{accept:".tar.gz,.tgz",disabled:k,onChange:q}),k?x.agent.importing:x.agent.importSnapshot]})]}),j&&l.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:j})]}),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(ve,{size:"sm",disabled:H,onClick:()=>L(!0),children:x.agent.resetConfigAction})]}),l.jsx(ve,{size:"sm",variant:"primary",onClick:X,children:x.common.save}),z,l.jsx(fa,{open:T!==null,title:x.agent.importConflictTitle,busy:k,onClose:()=>A(null),onConfirm:()=>{T!==null&&D(T,!0)},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.agent.importConflictBody})}),l.jsx(fa,{open:R,title:x.agent.resetConfigTitle,busy:H,onClose:()=>L(!1),onConfirm:()=>{W()},confirmLabel:x.agent.resetConfigAction,children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.agent.resetConfigConfirmBody})})]})}function zI({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}=Qu(),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){ws(x.common.noChangesToSave);return}f(()=>{n(y)})},p=y=>{const k=d.current;if(k&&(k.focus(),document.execCommand?.("insertText",!1,y)))return;const w=k?k.selectionStart:o.length,j=k?k.selectionEnd:o.length;c(o.slice(0,w)+y+o.slice(j)),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(ql,{label:x.agent.agentsMd,mono:!0,size:"sm",rows:14,value:r,onChange:y=>s(y.target.value)}),l.jsx(ql,{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:()=>p(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(ve,{size:"sm",variant:"primary",onClick:h,children:x.common.save}),m]})}function UI({data:e,onSave:n}){const r=e.config,[s,o]=v.useState(Gs(r.maxTurns)),[c,d]=v.useState(Gs(r.model?.maxTokens)),[f,m]=v.useState(r.model?.thinkingLevel??""),[h,p]=v.useState(Gs(r.model?.timeoutMs)),[y,k]=v.useState(Gs(r.compaction?.maxContextLength)),[w,j]=v.useState(Gs(r.compaction?.maxSessionTurns)),[C,T]=v.useState(r.compaction?.mode??""),[A,R]=v.useState(r.compaction?.prompt??""),[L,H]=v.useState({}),O=()=>H(q=>q.maxTurns||q.timeoutMs?{}:q),{requestSave:I,element:z}=Qu(),W=()=>{H({});const q={},P=so(s);if(P!==void 0&&P!==r.maxTurns){if(P<=0&&P!==-1){H({maxTurns:x.agent.maxTurnsInvalid});return}q.maxTurns=P}const K={},ee=so(c);ee!==void 0&&ee!==r.model?.maxTokens&&(K.maxTokens=ee),f&&f!==(r.model?.thinkingLevel??"")&&(K.thinkingLevel=f);const B=so(h);if(B!==void 0&&B!==r.model?.timeoutMs){if(B<=0&&B!==-1){H({timeoutMs:x.agent.timeoutInvalid});return}K.timeoutMs=B}Object.keys(K).length>0&&(q.model=K);const U={},F=so(y);F!==void 0&&F!==r.compaction?.maxContextLength&&(U.maxContextLength=F);const Z=so(w);if(Z!==void 0&&Z!==r.compaction?.maxSessionTurns&&(U.maxSessionTurns=Z),C&&C!==(r.compaction?.mode??"")&&(U.mode=C),A!==(r.compaction?.prompt??"")&&(U.prompt=A),Object.keys(U).length>0&&(q.compaction=U),Object.keys(q).length===0){ws(x.common.noChangesToSave);return}I(()=>{n({config:q})})},X=O8(x.agent.thinkingLevelOptions,x.agent.thinkingLevelNoneKept,r.model?.thinkingLevel),D=LI(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(Ze,{label:x.agent.maxTurns,size:"sm",value:s,error:L.maxTurns,onChange:q=>{o(q.target.value),O()},inputMode:"numeric",className:"font-mono"}),l.jsx(Ze,{label:x.agent.maxTokens,size:"sm",value:c,onChange:q=>d(q.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(zh,{label:x.agent.thinkingLevel,fullWidth:!0,size:"sm",placeholder:x.agent.defaultValue,value:f,onChange:m,options:X}),l.jsx(Ze,{label:x.agent.timeoutMs,hint:x.agent.timeoutMsHint,size:"sm",value:h,error:L.timeoutMs,onChange:q=>{p(q.target.value),O()},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(Ze,{label:x.agent.maxContextLength,hint:x.agent.maxContextLengthHint,size:"sm",value:y,onChange:q=>k(q.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(Ze,{label:x.agent.maxSessionTurns,hint:x.agent.maxSessionTurnsHint,size:"sm",value:w,onChange:q=>j(q.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(zh,{label:x.agent.compactionMode,fullWidth:!0,size:"sm",placeholder:x.agent.defaultValue,value:C,onChange:T,options:D})]})}),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(ql,{"aria-label":x.agent.compactionPrompt,mono:!0,size:"sm",rows:4,value:A,onChange:q=>R(q.target.value)})})]}),l.jsx(ve,{size:"sm",variant:"primary",onClick:W,children:x.common.save}),z]})}function $I({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:Gs(k.timeoutMs),maxOutputLength:Gs(k.maxOutputLength)}))),[c,d]=v.useState({}),{requestSave:f,element:m}=Qu(),h=(k,w)=>{o(j=>j.map((C,T)=>T===k?{...C,...w}:C)),d(j=>{const C=`${k}-timeoutMs`,T=`${k}-maxOutputLength`;if(!j[C]&&!j[T])return j;const A={...j};return delete A[C],delete A[T],A})},p=()=>{const k={},w=[];for(const[T,A]of s.entries()){const R={...A.base};delete R.timeoutMs,delete R.maxOutputLength;const L=A.timeoutMs.trim();if(L){const I=Number(L);!Number.isInteger(I)||I<=0&&I!==-1?k[`${T}-timeoutMs`]=x.agent.toolFieldInvalid(A.base.name,"timeoutMs"):R.timeoutMs=I}const H=A.maxOutputLength.trim();if(H){const I=Number(H);!Number.isInteger(I)||I<=0&&I!==-1?k[`${T}-maxOutputLength`]=x.agent.toolFieldInvalid(A.base.name,"maxOutputLength"):R.maxOutputLength=I}const O=e.config.toolsBuiltin[T];R.call_description===!0&&O?.call_description===void 0&&delete R.call_description,w.push(R)}if(Object.keys(k).length>0){d(k);return}d({});const j=e.config.toolsBuiltin;if(!(w.length!==j.length||w.some((T,A)=>{const R=j[A];return T.permission!==R.permission||T.timeoutMs!==R.timeoutMs||T.maxOutputLength!==R.maxOutputLength||T.call_description!==R.call_description}))){ws(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(zh,{mono:!0,size:"sm","aria-label":x.agent.toolPermission,placeholder:x.agent.defaultValue,options:r,value:k.base.permission,onChange:j=>h(w,{base:{...k.base,permission:j}})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(Ze,{size:"sm",value:k.timeoutMs,error:c[`${w}-timeoutMs`],inputMode:"numeric",className:"font-mono",onChange:j=>h(w,{timeoutMs:j.target.value})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(Ze,{size:"sm",value:k.maxOutputLength,error:c[`${w}-maxOutputLength`],inputMode:"numeric",className:"font-mono",onChange:j=>h(w,{maxOutputLength:j.target.value})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:y(k.base)?l.jsx(V2,{checked:k.base.call_description!==!1,onChange:j=>h(w,{base:{...k.base,call_description:j}}),"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(ve,{size:"sm",variant:"primary",onClick:p,children:x.common.save}),m]})}const BI="M22 2 11 13M22 2 15 22 11 13 2 9 22 2",HI="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",PI="M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";function FI(e,n,r,s){return e.filter(o=>{const c=n.get(o)?.get(r);return c!==void 0&&c<s})}function qI(){hr(x.nav.skills);const e=ha(),{locale:n}=Qa(),r=Un().user?.userId??null,{currentProject:s,agents:o,setCurrentAgentId:c}=fn(),d=s?.projectId??null,[f,m]=v.useState(null),[h,p]=v.useState(null),[y,k]=v.useState(new Map),[w,j]=v.useState(new Set);v.useEffect(()=>{let O=!1;return p(null),b5().then(I=>{O||m(I.groups)}).catch(I=>{O||p(Ae(I))}),()=>{O=!0}},[]);const C=o.map(O=>O.agentId).join(",");v.useEffect(()=>{if(k(new Map),!d||C==="")return;let O=!1;const I=C.split(",");return Promise.all(I.map(async z=>{try{const W=await Fh(d,z);return[z,new Map(W.skills.map(X=>[X.name,X.version]))]}catch{return[z,new Map]}})).then(z=>{O||k(W=>{const X=new Map(z);for(const[D,q]of W)X.set(D,q);return X})}),()=>{O=!0}},[d,C]);const T=(O,I,z)=>k(W=>{const X=new Map(W),D=new Map(X.get(O)??[]);return z!==void 0?D.set(I,z):D.delete(I),X.set(O,D),X}),A=(O,I)=>k(z=>new Map(z).set(O,new Map(I.map(W=>[W.name,W.version])))),R=async(O,I,z,W)=>{if(!d)return;const X=y.get(O)?.get(I);T(O,I,z?W:void 0);const D=o.find(P=>P.agentId===O),q=D?un(D):O;try{if(z){const P=await $y(d,O,[I]);A(O,P.skills),oa(x.skills.installedToast(I,q))}else await v5(d,O,I),oa(x.skills.uninstalledToast(I,q))}catch(P){if(!z&&P instanceof Ka&&P.status===404)return;T(O,I,X),ft(Ae(P))}},L=async(O,I)=>{if(!d||I.length===0)return;const W=(await Promise.allSettled(I.map(async X=>{const D=await $y(d,X,[O]);A(X,D.skills)}))).find(X=>X.status==="rejected");W?ft(Ae(W.reason)):oa(x.skills.updatedToast(O,I.length))},H=O=>{if(r&&d){const I=Hl(r,d);Ao(I,{...sd(I),agentId:"default_agent",text:x.skills.quickInvokeText(O),skills:[O],handoffAgentId:void 0})}c("default_agent"),e(`/chat/${ur}`,{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(ve,{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},(O,I)=>l.jsxs(Jv,{className:"p-4",children:[l.jsx(Vt,{className:"h-4 w-32"}),l.jsx(Vt,{className:"mt-2 h-4 w-3/4"}),l.jsx(Vt,{className:"mt-3 h-6 w-36"})]},I))}):l.jsx("div",{className:"mt-6 space-y-3",children:f.map(O=>{const I=!w.has(O.id);return l.jsxs("section",{className:"overflow-hidden rounded-md bg-white dark:bg-gray-900",children:[l.jsxs("button",{type:"button","aria-expanded":I,onClick:()=>j(z=>{const W=new Set(z);return W.has(O.id)?W.delete(O.id):W.add(O.id),W}),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:e8(n,O.title,O.titleZh)}),l.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.skills.skillCount(O.skills.length)}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(An,{open:I,className:"text-gray-400"})]}),l.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${I?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:l.jsx("div",{className:"overflow-hidden",inert:!I,children:l.jsx("div",{className:`grid gap-2.5 p-2.5 transition-opacity duration-200 sm:grid-cols-2 ${I?"opacity-100":"opacity-0"}`,children:O.skills.map(z=>l.jsx(VI,{skill:z,installed:y,onQuickInvoke:H,onToggleInstall:R,onUpdateOutdated:L},z.name))})})})]},O.id)})})]})})}function VI({skill:e,installed:n,onQuickInvoke:r,onToggleInstall:s,onUpdateOutdated:o}){const{locale:c}=Qa(),{agents:d}=fn(),[f,m]=v.useState(!1),[h,p]=v.useState(null),[y,k]=v.useState(!1),[w,j]=v.useState(null),C=async()=>{h&&(k(!0),await o(e.name,h),k(!1),p(null))},T=w!==null?d.find(z=>z.agentId===w):void 0,A=T?un(T):void 0;let R=0;for(const z of n.values())z.has(e.name)&&(R+=1);const L=FI(d.map(z=>z.agentId),n,e.name,e.version),H=Po(c,e),O=e.description,I=[`v${e.version}`,e.updated?A4(e.updated,c):null,x.skills.usedByAgents(R)].filter(z=>z!==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 ${N8(e.name)}`,children:l.jsx(Dp,{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:O,children:H})]})]}),l.jsx("p",{className:"mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500",title:I,children:I})]}),l.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-1.5",children:[L.length>0&&l.jsx(ve,{size:"sm",variant:"secondary",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.updateOutdated(L.length)} ${e.name}`,title:x.skills.updateOutdated(L.length),onClick:()=>p(L),children:l.jsx(Ue,{d:PI,size:13})}),l.jsx(ve,{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(Ue,{d:BI,size:15})}),l.jsx(ve,{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(Ue,{d:HI,size:15})})]}),f&&l.jsx(dn,{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(z=>l.jsx(GI,{agentId:z.agentId,name:un(z),installed:n.get(z.agentId)?.has(e.name)??!1,outdated:L.includes(z.agentId),onToggle:W=>{W?s(z.agentId,e.name,!0,e.version):j(z.agentId)},onUpdate:()=>p([z.agentId])},z.agentId))]})}),h&&l.jsx(fa,{open:!0,title:x.skills.updateConfirmTitle(e.name),tone:"primary",confirmLabel:x.skills.updateAction,busy:y,onClose:()=>p(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(z=>{const W=n.get(z)?.get(e.name),X=d.find(D=>D.agentId===z);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:X?un(X):z}),l.jsxs("span",{className:"shrink-0 font-mono text-gray-500 dark:text-gray-400",children:["v",W??"?"," → v",e.version]})]},z)})})]})}),w!==null&&l.jsx(fa,{open:!0,title:x.skills.uninstallConfirmTitle(e.name),confirmLabel:x.skills.uninstall,onClose:()=>j(null),onConfirm:()=>{const z=w;j(null),s(z,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 GI({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(da,{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(ve,{size:"sm",variant:"secondary",className:"shrink-0","aria-label":`${x.skills.updateAction} ${e}`,onClick:c,children:x.skills.updateAction}),r?l.jsxs(ve,{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(ve,{size:"sm",className:"shrink-0","aria-label":`${x.skills.install} ${e}`,onClick:()=>o(!0),children:x.skills.install})]})}function G2(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 WI(e){return{provider:e.provider,modelId:e.model_id,original:null,...G2(e),maxTokens:"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}function KI(e,n=M8()){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(WI(f)),c+=1;continue}const h=o[m],p=G2(f);Object.keys(p).some(k=>h[k]!==p[k])&&(o[m]={...h,...p},d+=1)}return{rows:o,added:c,updated:d}}function YI(e){return e<1e3?"green":e<=3e3?"yellow":"red"}function QI(e){return e>=40?"green":e>=15?"yellow":"red"}const W2={USD:"$",CNY:"¥"};function Ib(e){return Number.isFinite(e)?String(Math.round(e*1e6)/1e6):"0"}function Uh(e){return Number.isFinite(e)?String(Math.round(e*1e4)/1e4):"0"}function Qm(e,n){const r=Number(e||"0"),s=n==="CNY"?r*Hh:r;return`${W2[n]}${Uh(s)}`}function zl(e,n){const r=e.trim();if(!r)return"";const s=Number(r);return Number.isFinite(s)?Uh(n==="CNY"?s*Hh:s):r}function Xm(e,n){const r=e.trim();if(!r)return"";const s=Number(r);return Number.isFinite(s)?Ib(n==="CNY"?s/Hh:s):r}const XI="M12 5v14M5 12h14",ZI="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",JI="M12 14l3.5-3.5M20.49 17A10 10 0 1 0 3.5 17",eL="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 7v5l3.5 2",tL="M13 2 3 14h9l-1 8 10-12h-9l1-8Z",Lb={green:"text-green-600 dark:text-green-400",yellow:"text-amber-600 dark:text-amber-400",red:"text-red-600 dark:text-red-400"},Ob=(e,n)=>`${e}\0${n}`,Zm=128e3;function Db(e){return e.replace(/[^\d]/g,"")}function nL(e){const n=e.replace(/[^\d.]/g,""),r=n.indexOf(".");return r===-1?n:n.slice(0,r+1)+n.slice(r+1).replace(/\./g,"")}function Ea(e){return{provider:e.provider,modelId:e.modelId}}function aL(e){const{editing:n,ref:r,action:s,defaultModel:o,visionModel:c}=e,d=n===null,f=!d&&!ht(n,r)?n:null,m=h=>ht(h,f)?r:h;return{defaultModel:s==="setDefault"||d&&!o?r:m(o),visionModel:s==="setVisionModel"?r:m(c)}}function rL(e){return e.original!==null&&zp(e.original.provider,e.original.modelId)!==void 0}function sL(e){return!e.clearApiKey&&(!!e.apiKeyInput.trim()||!!e.credential?.apiKeyMasked)}function zb(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 lL(e){const n={provider:e.provider,modelId:e.modelId};e.original&&!ht(e.original,Ea(e))&&(n.renamedFrom=e.original),e.displayName?.trim()&&(n.displayName=e.displayName.trim());const r=Number(e.contextWindow.trim());e.contextWindow.trim()&&Number.isFinite(r)&&(n.contextWindow=r),e.clientType.trim()&&(n.clientType=e.clientType.trim()),e.vision||(n.vision=!1);const 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 iL(){hr(x.models.title);const{currentProject:e}=fn(),n=e?.projectId??null,r=e?.role==="owner",s=Un().user?.userId??null,[o,c]=v.useState(new Map),[d,f]=v.useState(null),[m,h]=v.useState(null),[p,y]=v.useState(null),[k,w]=v.useState(void 0),[j,C]=v.useState(void 0),[T,A]=v.useState(null),[R,L]=v.useState(null),[H,O]=v.useState(""),[I,z]=v.useState(new Set),[W,X]=v.useState(null),[D,q]=v.useState(!1),[P,K]=v.useState(""),[ee,B]=v.useState(null),[U,F]=v.useState(null),[Z,ue]=v.useState(!1),{currency:E}=ks(),M=v.useCallback(async()=>{if(n){y(null),F(null),c(new Map);try{const re=await Vu(n);y(re.models.map(zb)),w(re.defaultModel),C(re.visionModel)}catch(re){F(Ae(re))}}},[n]);v.useEffect(()=>{M()},[M]);const $=async(re,he,xe,We)=>{if(!n)return!1;ue(!0);const Ke=xe&&re.some($e=>ht(Ea($e),xe)&&$e.vision)?xe:void 0;try{const $e={models:re.map(lL)};he&&($e.defaultModel=he),Ke&&($e.visionModel=Ke);const Bt=await Wj(n,$e);if(y(Bt.models.map(zb)),w(Bt.defaultModel),C(Bt.visionModel),s&&Bt.defaultModel&&!ht(Bt.defaultModel,k)){const Ht=Hl(s,n),jn=sd(Ht);jn.modelRef&&Ao(Ht,{...jn,modelRef:void 0})}return oa(We??x.common.saved),!0}catch($e){return y(re),he!==void 0&&w(he),Ke!==void 0&&C(Ke),ft(Ae($e)),!1}finally{ue(!1)}},N=v.useMemo(()=>p?T2(p,H):[],[p,H]),Y=async()=>{if(!p)return;const re=KI(p);if(re.added===0&&re.updated===0){ws(x.models.syncUpToDate);return}await $(re.rows,k,j,x.models.syncDone(re.added,re.updated))},le=async re=>{if(!n||!p)return;const he=p.filter(xe=>xe.provider===re);h(re);try{for(const xe of he){const We=Ob(xe.provider,xe.modelId);c(Ke=>new Map(Ke).set(We,"pending"));try{const Ke=await dv(n,{provider:xe.provider,modelId:xe.modelId,speed:!0});c($e=>new Map($e).set(We,Ke))}catch(Ke){c($e=>new Map($e).set(We,{ok:!1,message:Ae(Ke)}))}}}finally{h(null)}},oe=()=>{const re=P.trim();if(!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(re)){B(x.models.groupNameInvalid);return}if(vs.some(he=>he.id===re)||p?.some(he=>he.provider===re)){B(x.models.groupNameExists);return}q(!1),K(""),L(re)},pe=T!==null?p?.find(re=>ht(Ea(re),T)):void 0;if(!n)return null;const Ce=re=>z(he=>{const xe=new Set(he);return xe.has(re)?xe.delete(re):xe.add(re),xe});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(Ze,{size:"sm",value:H,onChange:re=>O(re.target.value),placeholder:x.models.searchPlaceholder})}),r&&l.jsx(ve,{size:"sm",onClick:()=>{Y()},disabled:Z||p===null,title:x.models.syncCatalogHint,children:x.models.syncCatalog})]})]}),p===null?l.jsx(Ia,{rows:4}):p.length===0?l.jsx(fr,{title:x.models.empty,action:r&&l.jsx(ve,{onClick:()=>L("custom"),children:x.models.addCustom})}):N.length===0?l.jsx(fr,{title:x.models.noSearchResults}):l.jsxs("div",{className:"space-y-3",children:[N.map(re=>{const he=!I.has(re.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:()=>Ce(re.provider.id),className:"flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left",children:[l.jsx(Wl,{provider:re.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:re.provider.label}),l.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.models.modelCount(re.rows.length)})]}),r&&l.jsx("span",{className:"shrink-0",children:l.jsxs(ve,{size:"sm",variant:"ghost",disabled:Z,onClick:()=>L(re.provider.id),children:[l.jsx(Ue,{d:XI,size:13}),x.models.addToGroup]})}),r&&re.provider.id!=="custom"&&l.jsx("span",{className:"hidden shrink-0 sm:block",children:l.jsxs(ve,{size:"sm",variant:"ghost",disabled:Z,onClick:()=>X(re.provider.id),children:[l.jsx(Ue,{d:ZI,size:13}),x.models.groupApiKey]})}),r&&l.jsxs(ve,{size:"sm",variant:"ghost",className:"shrink-0",disabled:Z||m!==null,"aria-label":`${x.models.speedTest} ${re.provider.label}`,title:m===re.provider.id?x.models.speedPending:x.models.speedTest,onClick:()=>f(re.provider.id),children:[l.jsx(Ue,{d:JI,size:13}),l.jsx("span",{className:"hidden sm:inline",children:m===re.provider.id?x.models.speedPending:x.models.speedTest})]}),re.provider.apiKeyUrl&&l.jsxs("a",{href:re.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":re.provider.label,onClick:()=>Ce(re.provider.id),className:"shrink-0 p-1.5",children:l.jsx(An,{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:re.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}):re.rows.map(xe=>l.jsx(oL,{row:xe,currency:E,isDefault:ht(Ea(xe),k),isVisionModel:ht(Ea(xe),j),speed:o.get(Ob(xe.provider,xe.modelId)),onOpen:()=>A(Ea(xe))},`${xe.provider}:${xe.modelId}`))})})})]},re.provider.id)}),r&&H.trim()===""&&l.jsxs("button",{type:"button",onClick:()=>{K(""),B(null),q(!0)},className:"w-full rounded-md border border-dashed border-gray-300 px-3 py-2.5 text-sm text-gray-500 transition-colors hover:border-gray-400 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:text-gray-200",children:["+ ",x.models.addGroup]})]}),U&&l.jsx("p",{className:"mt-3 text-xs text-red-600 dark:text-red-400",children:U})]}),p&&W&&l.jsx(fL,{provider:vs.find(re=>re.id===W)??N2(W),count:p.filter(re=>re.provider===W).length,onClose:()=>X(null),onSubmit:re=>{const he=W;X(null);const xe=p.filter(Ke=>Ke.provider===he);if(xe.length===0)return;const We=p.map(Ke=>Ke.provider===he?{...Ke,apiKeyInput:re,clearApiKey:!1}:Ke);$(We,k,j,x.models.groupKeyApplied(xe.length))}}),d!==null&&l.jsxs(dn,{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(p?.filter(re=>re.provider===d).length??0)}),l.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[l.jsx(ve,{onClick:()=>f(null),children:x.common.cancel}),l.jsx(ve,{variant:"primary",onClick:()=>{const re=d;f(null),re&&le(re)},children:x.models.speedTestStart})]})]}),D&&l.jsxs(dn,{open:!0,title:x.models.addGroupTitle,onClose:()=>q(!1),widthClass:"sm:max-w-sm",footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:()=>q(!1),children:x.common.cancel}),l.jsx(ve,{variant:"primary",onClick:oe,children:x.common.confirm})]}),children:[l.jsxs("label",{className:"block",children:[l.jsx(Ze,{size:"sm",label:x.models.groupNameLabel,required:!0,value:P,invalid:!!ee,onChange:re=>{K(re.target.value),B(null)},onKeyDown:re=>{re.key==="Enter"&&oe()},placeholder:x.models.groupNameHint,className:"font-mono",autoFocus:!0}),ee&&l.jsx(xs,{children:ee})]}),l.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:x.models.addGroupDesc})]}),p&&(R!==null||pe)&&l.jsx(dL,{projectId:n,row:R!==null?null:pe??null,addProvider:R??"custom",existingRefs:p.map(Ea),currency:E,canEdit:r,isDefault:pe!==void 0&&ht(Ea(pe),k),isVisionModel:pe!==void 0&&ht(Ea(pe),j),onClose:()=>{A(null),L(null)},onSubmit:(re,he)=>{const xe=R!==null;if(A(null),L(null),he==="remove"){const $e=re.original;$(p.filter(Bt=>!ht(Ea(Bt),$e)),ht($e,k)?void 0:k,ht($e,j)?void 0:j);return}const We=xe?[...p,re]:p.map($e=>ht(Ea($e),T)?re:$e),Ke=aL({editing:xe?null:T,ref:Ea(re),action:he,defaultModel:k,visionModel:j});$(We,Ke.defaultModel,Ke.visionModel)}})]})}function oL({row:e,currency:n,isDefault:r,isVisionModel:s,speed:o,onOpen:c}){const d=e.cacheRead||e.cacheWrite||e.output,f=[e.contextWindow?lt(Number(e.contextWindow)):null,d?`${Qm(e.cacheRead,n)} / ${Qm(e.cacheWrite,n)} / ${Qm(e.output,n)}`:null,e.credential?.apiKeyMasked&&!e.clearApiKey?e.credential.apiKeyMasked:sL(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 ${Lb[YI(o.ttftMs)]}`,title:x.models.ttftTitle,children:[l.jsx(Ue,{d:eL,size:11}),Math.round(o.ttftMs),"ms"]}),o.tps!==void 0&&l.jsxs("span",{className:`flex items-center gap-0.5 ${Lb[QI(o.tps)]}`,title:x.models.tpsTitle,children:[l.jsx(Ue,{d:tL,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(Jt,{tone:"brand",children:x.models.default}),M2(e)&&l.jsx(Jt,{tone:"yellow",children:x.models.freeBadge}),e.vision&&l.jsx(Jt,{tone:"green",children:x.models.visionBadge}),s&&l.jsx(Jt,{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 cL={save:()=>x.models.confirmSaveTitle,setDefault:()=>x.models.confirmDefaultTitle,setVisionModel:()=>x.models.confirmVisionModelTitle,remove:()=>x.models.confirmDeleteTitle},uL={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 dL({projectId:e,row:n,addProvider:r,existingRefs:s,currency:o,canEdit:c,isDefault:d,isVisionModel:f,onClose:m,onSubmit:h}){const[p,y]=v.useState(()=>{if(n)return{...n,cacheRead:zl(n.cacheRead,o),cacheWrite:zl(n.cacheWrite,o),output:zl(n.output,o)};const F=cr(r),Z=F!==void 0&&F.id!=="custom"&&F.gatewayBaseUrl===void 0;return{provider:r,modelId:"",original:null,vision:!0,contextWindow:"",maxTokens:"",clientType:Z?"":"openai",cacheRead:"",cacheWrite:"",output:"",baseUrl:F?.gatewayBaseUrl??"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}),[k,w]=v.useState({}),[j,C]=v.useState(!1),[T,A]=v.useState(null),R=n===null,L=n!==null&&rL(n),H=F=>{y(Z=>({...Z,...F})),w(Z=>{const ue={...Z};for(const E of Object.keys(F))delete ue[E];return ue})},O=async()=>{C(!0);try{const F=p.apiKeyInput.trim(),Z=p.baseUrl.trim(),ue={provider:p.provider,modelId:p.modelId.trim(),baseUrl:Z||null};F?ue.apiKey=F:p.clearApiKey&&(ue.clearApiKey=!0),p.clientType.trim()&&(ue.clientType=p.clientType.trim());const E=await dv(e,ue);E.ok?oa(x.models.testOk(E.latencyMs??0)):ft(x.models.testFailed(E.message??""))}catch(F){ft(x.models.testFailed(Ae(F)))}finally{C(!1)}},I=p.clientType.trim().toLowerCase().includes("openai")||p.provider==="custom"||cr(p.provider)===void 0,z=!L&&I,W=()=>{const F=p.modelId.trim(),Z={provider:p.provider,modelId:F},ue=p.baseUrl.trim(),E={};F?!ht(Z,p.original)&&s.some(le=>ht(le,Z))&&(E.modelId=x.models.modelIdExists):E.modelId=x.common.requiredField,z&&!ue&&(E.baseUrl=x.models.baseUrlRequired);const M=[["cacheRead",p.cacheRead.trim()],["cacheWrite",p.cacheWrite.trim()],["output",p.output.trim()]],$=M.filter(([,le])=>le!=="").length;for(const[le,oe]of M)oe===""&&$>0?E[le]=x.models.pricingAllOrNone:oe!==""&&!Number.isFinite(Number(oe))&&(E[le]=x.models.pricingInvalid);const N=p.contextWindow.trim();N&&!Number.isFinite(Number(N))&&(E.contextWindow=x.models.contextWindowInvalid);const Y=p.maxTokens.trim();return Y&&!(Number.isInteger(Number(Y))&&Number(Y)>0)&&(E.maxTokens=x.models.maxTokensInvalid),Object.keys(E).length>0?(w(E),null):(w({}),{...p,modelId:F,contextWindow:!L&&!N?String(Zm):p.contextWindow,cacheRead:Xm(p.cacheRead,o),cacheWrite:Xm(p.cacheWrite,o),output:Xm(p.output,o)})},X=F=>{const Z=W();Z&&h(Z,F)},D=cr(p.provider),q=T8(p.modelId.trim(),p.clientType.trim()||void 0)?.envKey,P=D!==void 0&&D.id!=="custom"&&D.gatewayBaseUrl===void 0,K=R&&P&&!p.clientType.trim()&&p.modelId.trim()!==""&&q===void 0,ee=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:D?.modelsUrl&&l.jsxs("a",{href:D.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(Ze,{size:"sm",required:!0,value:p.modelId,disabled:!c,invalid:!!k.modelId,onChange:F=>H({modelId:F.target.value}),className:"font-mono",autoFocus:R,placeholder:x.models.modelIdHint}),k.modelId&&l.jsx(xs,{children:k.modelId}),K&&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(Ze,{size:"sm",label:x.models.displayName,value:p.displayName??"",disabled:!c,onChange:F=>H({displayName:F.target.value}),placeholder:x.models.displayNameHint}),l.jsxs(Ro,{size:"sm",label:x.models.providerGroup,value:p.provider,disabled:!c,onChange:F=>H({provider:F.target.value}),children:[vs.map(F=>l.jsx("option",{value:F.id,children:F.label},F.id)),[...new Set(s.map(F=>F.provider).concat(p.provider))].filter(F=>!vs.some(Z=>Z.id===F)).sort().map(F=>l.jsx("option",{value:F,children:F},F))]})]})]}),B=p.credential?.apiKeyMasked?x.models.apiKeyKeepHint:q?x.models.apiKeyEnvHint(q):x.models.apiKeyKeepHint,U=!p.credential?.apiKeyMasked&&q&&q===D?.envKey?x.models.providerEnvNotes[p.provider]:void 0;return l.jsxs(dn,{open:!0,title:R?P?x.models.addTitleVendor:x.models.addTitle:x.models.editTitle,onClose:m,widthClass:"sm:max-w-lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:m,children:x.common.cancel}),c&&l.jsx(ve,{variant:"primary",onClick:()=>{if(!W())return;if(R||n===null){X("save");return}const F={...n,cacheRead:zl(n.cacheRead,o),cacheWrite:zl(n.cacheWrite,o),output:zl(n.output,o)};if(JSON.stringify(p)===JSON.stringify(F)){ws(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(Wl,{provider:p.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:[p.displayName??p.modelId,d&&l.jsx(Jt,{tone:"brand",children:x.models.default}),p.vision&&l.jsx(Jt,{tone:"green",children:x.models.visionBadge}),f&&l.jsx(Jt,{tone:"amber",children:x.models.visionModelBadge})]}),p.displayName!==void 0&&l.jsx("span",{className:"truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:p.modelId})]}),n&&J1(n.provider,n.modelId)&&l.jsxs("a",{href:J1(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:P?x.models.addAutoRouteHint:x.models.addProtocolHint}),ee]}),c&&l.jsx("div",{className:"space-y-1.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(ve,{size:"sm",disabled:j||!p.modelId.trim(),onClick:()=>{O()},children:j?x.models.testing:x.models.testConnection}),!R&&!d&&l.jsx(ve,{size:"sm",onClick:()=>A("setDefault"),children:x.models.setDefault}),!R&&p.vision&&!f&&l.jsx(ve,{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(ve,{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}),D?.apiKeyUrl&&l.jsxs("a",{href:D.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(ys,{size:"sm",value:p.apiKeyInput,disabled:!c,onChange:F=>H({apiKeyInput:F.target.value,clearApiKey:!1}),className:"font-mono",autoComplete:"off",autoFocus:!R,placeholder:B})]}),U&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:U}),p.credential?.apiKeyMasked&&!p.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:p.credential.apiKeyMasked}),p.credential.createdAt&&l.jsxs("span",{className:"text-gray-400",children:[x.common.created," ",ua(p.credential.createdAt)]}),c&&l.jsxs("label",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"checkbox",checked:p.clearApiKey,onChange:F=>H({clearApiKey:F.target.checked})}),x.models.clearApiKey]})]}),l.jsx(Ze,{size:"sm",label:x.models.baseUrl,required:z,value:p.baseUrl,disabled:!c,onChange:F=>H({baseUrl:F.target.value}),className:"font-mono",placeholder:L?x.models.baseUrlHint:"https://…",...k.baseUrl?{error:k.baseUrl}:{},...I?{}:{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(Pl,{children:x.models.contextWindow}),l.jsxs("span",{className:"relative block",children:[l.jsx(Ze,{size:"sm",value:p.contextWindow,inputMode:"numeric",disabled:!c,invalid:!!k.contextWindow,onChange:F=>H({contextWindow:Db(F.target.value)}),className:"pr-12 font-mono",title:L?x.models.contextWindowHint:x.models.contextWindowDefaultHint(Zm),placeholder:L?x.models.contextWindowHint:x.models.contextWindowDefaultHint(Zm)}),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(xs,{children:k.contextWindow})]}),l.jsxs("label",{className:"block",children:[l.jsx(Pl,{children:x.models.maxTokens}),l.jsxs("span",{className:"relative block",children:[l.jsx(Ze,{size:"sm",value:p.maxTokens,inputMode:"numeric",disabled:!c,invalid:!!k.maxTokens,onChange:F=>H({maxTokens:Db(F.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(xs,{children:k.maxTokens})]})]}),l.jsx("div",{className:"grid grid-cols-3 items-start gap-2",children:[["cacheRead",x.models.priceCacheRead,p.cacheRead],["cacheWrite",x.models.priceCacheWrite,p.cacheWrite],["output",x.models.priceOutput,p.output]].map(([F,Z,ue])=>l.jsxs("label",{className:"block",children:[l.jsx(Pl,{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:W2[o]}),l.jsx(Ze,{size:"sm",value:ue,inputMode:"decimal",disabled:!c,invalid:!!k[F],onChange:E=>H({[F]:nL(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[F]&&l.jsx(xs,{children:k[F]})]},F))}),!R&&ee,!R&&!L&&p.clientType&&p.clientType!=="openai"&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.models.clientTypeLocked(p.clientType)}),!L&&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(V2,{checked:p.vision,disabled:!c,onChange:F=>H({vision:F}),"aria-label":x.models.vision})]}),!p.vision&&l.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:x.models.visionOffProxyHint})]})]}),T&&l.jsx(fa,{open:!0,title:cL[T](),tone:T==="remove"?"danger":"primary",onClose:()=>A(null),onConfirm:()=>{const F=T;A(null),X(F)},children:l.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:uL[T](p.displayName??p.modelId)})})]})}function fL({provider:e,count:n,onClose:r,onSubmit:s}){const[o,c]=v.useState("");return l.jsx(dn,{open:!0,title:x.models.groupApiKeyTitle(e.label),onClose:r,footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:r,children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:!o.trim(),onClick:()=>s(o.trim()),children:x.common.confirm})]}),children:l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ze,{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 mo=200,Xs=46,Fu=8,bo=10,mL=22;function Hp(e,n,r){const s=Math.max(0,r-Xs-Fu),o=mo-bo-mL,c=e>0?s/e:s;return{n:e,max:n,w:r,innerW:s,innerH:o,step:c,x:d=>Xs+c*d+c/2,y:d=>bo+o*(1-(n>0?d/n:0))}}function hL(e,n){return n.map((r,s)=>`${s===0?"M":"L"}${e.x(s)},${e.y(r)}`).join(" ")}function pL(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 gL(e){return e<=0?[]:e===1?[0]:e===2?[0,1]:[0,Math.floor((e-1)/2),e-1]}const xL=40;function yL(e,n){if(e<=0)return[];const r=n>0?Math.max(1,Math.ceil(xL/n)):e,s=[];for(let o=0;o<e;o+=r)s.push(o);return s}function bL(e,n){return n>0?e/n:1}const gu=12;function vL(e,n,r,s,o){let c=e+gu;c+r>o.right&&(c=e-gu-r);let d=n+gu;return d+s>o.bottom&&(d=n-gu-s),{left:Math.max(o.left,Math.min(c,o.right-r)),top:Math.max(0,Math.min(d,o.bottom-s))}}const Jm=25,kL=8;function wL(e,n){const r=Math.max(0,e-Xs-Fu),s=2*Jm*n;return s<=r?{barW:Jm,chartW:e,scroll:!1}:{barW:Jm,chartW:Xs+s+Fu,scroll:!0}}function SL(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,p,y)=>o.has(y)?h:h+p,0),f=h=>d>0?e[h]/d*c:c/(s-o.size),m=e.findIndex((h,p)=>!o.has(p)&&f(p)<r);if(m<0)return e.map((h,p)=>o.has(p)?r:f(p));o.add(m)}}const jL=["output","cacheWrite","cacheRead"];function NL(e,n){const r=jL.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 p=e.y(o);s.push({y:p,h:h-p})}const c=e.y(0),d=SL(s.map(m=>m.h),c-e.y(o),kL);let f=c;return r.map((m,h)=>{const p=d[h],y={key:m.key,value:m.value,y:s[h].y,h:s[h].h,hitY:f-p,hitH:p};return f-=p,y})}const K2=Math.PI*2,qu=e=>Math.round(e*100)/100;function xu(e,n,r,s){const o=s-Math.PI/2;return[qu(e+r*Math.cos(o)),qu(n+r*Math.sin(o))]}function CL(e,n,r,s,o){if(o-s>=K2-1e-9){const[p,y]=xu(e,n,r,0),[k,w]=xu(e,n,r,Math.PI);return`M${p},${y} A${r},${r} 0 1 1 ${k},${w} A${r},${r} 0 1 1 ${p},${y} Z`}const[c,d]=xu(e,n,r,s),[f,m]=xu(e,n,r,o),h=o-s>Math.PI?1:0;return`M${qu(e)},${qu(n)} L${c},${d} A${r},${r} 0 ${h} 1 ${f},${m} Z`}function TL(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,p=d+h*K2;c.push({index:m,value:f,frac:h,start:d,end:p,path:CL(n,r,s,d,p)}),d=p}),c}function Pp(){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 Fp({geom:e,fmtY:n,dates:r,hover:s,onHover:o,bubble:c,hitLayer:d,labels:f,hoverLine:m=!0,scrollToEnd:h=!1,children:p}){const{x:y,y:k,w,innerH:j,step:C,max:T}=e,A=[0,.25,.5,.75,1].map(D=>T*D),R=f??gL(r.length),L=v.useRef(null);v.useLayoutEffect(()=>{const D=L.current;!h||!D||(D.scrollLeft=D.scrollWidth-D.clientWidth)},[h,w,r.length]);const H=v.useRef(null),O=v.useRef(null),I=v.useRef(null),z=v.useRef(0),W=()=>{const D=O.current,q=H.current,P=L.current,K=I.current;if(!D||!q||!P||!K)return;const ee=q.getBoundingClientRect(),B=vL(K.cx-ee.left,K.cy-ee.top,D.offsetWidth,D.offsetHeight,{left:P.scrollLeft,right:P.scrollLeft+P.clientWidth,bottom:mo});D.style.left=`${B.left}px`,D.style.top=`${B.top}px`,D.style.visibility="visible"},X=()=>{z.current||(z.current=requestAnimationFrame(()=>{z.current=0,W()}))};return v.useEffect(()=>()=>cancelAnimationFrame(z.current),[]),v.useLayoutEffect(W,[c,s]),l.jsxs("div",{ref:L,className:"relative overflow-x-auto",children:[l.jsxs("svg",{ref:H,viewBox:`0 0 ${w} ${mo}`,width:w,height:mo,className:"text-gray-600 dark:text-gray-400",role:"img",onMouseLeave:()=>{o(null),I.current=null},onMouseMove:D=>{I.current={cx:D.clientX,cy:D.clientY},X()},children:[A.map((D,q)=>l.jsxs("g",{children:[l.jsx("line",{x1:Xs,x2:w-Fu,y1:k(D),y2:k(D),className:"stroke-gray-200 dark:stroke-gray-800",strokeWidth:1}),l.jsx("text",{x:Xs-6,y:k(D)+3,textAnchor:"end",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:n(D)})]},q)),m&&s!==null&&r[s]&&l.jsx("line",{x1:y(s),x2:y(s),y1:bo,y2:bo+j,className:"stroke-gray-300 dark:stroke-gray-700",strokeWidth:1}),p,R.map(D=>{const q=r[D];return q?l.jsx("text",{x:y(D),y:mo-6,textAnchor:"middle",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:q.slice(5)},D):null}),d??r.map((D,q)=>l.jsx("rect",{x:Xs+C*q,y:bo,width:C,height:j,fill:"transparent",className:"cursor-crosshair",onMouseEnter:()=>o(q)},`hit-${q}`))]}),c&&s!==null&&r[s]&&l.jsx("div",{ref:O,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 ML({points:e,currency:n="USD"}){const[r,s]=v.useState(null),[o,c]=Pp(),d=e.map(p=>p.cost??0),f=Math.max(1e-9,...d),m=Hp(e.length,f,c),h=e.map(p=>p.date);return l.jsx("div",{ref:o,children:c>0&&l.jsx(Fp,{geom:m,fmtY:p=>Ya(p,n),dates:h,hover:r,onHover:s,bubble:p=>{const y=e[p];return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:y.date}),l.jsx("p",{className:"font-mono",children:Ya(y.cost,n)})]})},children:l.jsxs("g",{children:[l.jsx("path",{d:pL(m,d),className:"fill-current",stroke:"none",opacity:r!==null?.06:.1}),l.jsx("path",{d:hL(m,d),fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),e.map((p,y)=>l.jsx("circle",{cx:m.x(y),cy:m.y(p.cost??0),r:r===y?4:2.5,className:"fill-current",opacity:r!==null&&r!==y?.25:1},p.date))]})})})}const vo={cacheRead:"#7dd3fc",cacheWrite:"#0ea5e9",output:"#0369a1"},Ub=[{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 $b(e){return Ub[e%Ub.length]}const Bb=[{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 Y2(e){return Bb[e%Bb.length]}function id({text:e}){return l.jsx("p",{className:"py-6 text-center text-xs text-gray-400",children:e??x.usage.empty})}function EL(e){return e==="cacheRead"?x.usage.colCacheRead:e==="cacheWrite"?x.usage.colCacheWrite:x.usage.colOutput}const Q2="opacity-25",yu=160,AL=75;function RL({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(id,{});const o=[...e].sort((m,h)=>h.requests-m.requests),c=TL(o.map(m=>m.requests),yu/2,yu/2,AL),d=m=>`${Math.round(m/s*100)}%`,f=m=>n!==null&&n!==m?Q2:"";return l.jsxs("div",{className:"flex items-center gap-3",onMouseLeave:()=>r(null),children:[l.jsx("svg",{viewBox:`0 0 ${yu} ${yu}`,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 ${$b(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} · ${lt(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 ${$b(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 _L({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?Q2:""}`,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 IL(e){return zp(e.provider,e.modelId)?.displayName??e.modelId}function LL(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=cr(e.provider)?.label??e.provider;return`${e.modelId} · ${r} · ${n.join(" · ")}`}function OL({data:e}){const[n,r]=v.useState(null);return e.length===0?l.jsx(id,{}):l.jsx("div",{className:"flex flex-col gap-1.5",onMouseLeave:()=>r(null),children:e.map((s,o)=>{const c=bL(s.completed,s.total),d=Math.round(c*100);return l.jsx(_L,{dimmed:n!==null&&n!==o,onEnter:()=>r(o),title:LL(s),label:IL(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 DL({trend:e,legend:n}){const[r,s]=v.useState(null),[o,c]=Pp();if(e.length===0)return l.jsx(id,{});const d=e.map(C=>C.cacheRead+C.cacheWrite+C.output),f=Math.max(1,...d),{barW:m,chartW:h,scroll:p}=wL(c,e.length),y=Hp(e.length,f,h),k=e.map(C=>C.date),w=e.map(C=>NL(y,C)),j=(C,T)=>r!==null&&!(r.i===C&&r.key===T)||n!=null&&n!==T;return l.jsx("div",{ref:o,children:c>0&&l.jsx(Fp,{geom:y,fmtY:C=>lt(Math.round(C)),dates:k,hover:r?.i??null,labels:yL(e.length,y.step),hoverLine:!1,scrollToEnd:p,onHover:C=>{C===null&&s(null)},bubble:C=>{const T=e[C],A=r?.key;if(!A)return null;const R=A==="cacheRead"?qv(T.cacheRead,T.cacheWrite):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:T.date}),l.jsxs("p",{className:"font-mono",children:[EL(A)," ",lt(T[A])]}),R!==null&&l.jsxs("p",{className:"font-mono",children:[x.traces.hitRate," ",rp(R)]})]})},hitLayer:e.map((C,T)=>w[T].map(A=>l.jsx("rect",{x:y.x(T)-m/2,y:A.hitY,width:m,height:A.hitH,fill:"transparent",className:"cursor-pointer",onMouseEnter:()=>s({i:T,key:A.key}),onMouseLeave:()=>s(null)},`hit-${C.date}-${A.key}`))),children:e.map((C,T)=>w[T].map(A=>l.jsx("rect",{x:y.x(T)-m/2,y:A.y,width:m,height:A.h,fill:vo[A.key],className:"transition-opacity duration-150",opacity:j(T,A.key)?.2:1},`${C.date}-${A.key}`)))})})}function zL({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:vo[s]}}),o]},s))})}function UL(e){return e==="unexpected"?x.usage.errorsUnexpected:x.usage.errorsExpected}function $L(e){return e==="unexpected"?"unexpected":"expected"}const BL={environment:"env"};function Hb(e,n){return`[${BL[e]??e}] ${n}`}function bu({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 vu({children:e,className:n=""}){return l.jsx("th",{className:`py-1.5 pr-2 font-medium ${n}`,children:e})}function HL({errors:e,projectId:n,filters:r}){const{total:s,unexpected:o,topCode:c,recent:d}=e,f=Math.max(1,d.length),[m,h]=v.useState(0),[p,y]=v.useState(d),[k,w]=v.useState(s),[j,C]=v.useState(null),[T,A]=v.useState(!1);v.useEffect(()=>h(0),[d]),v.useEffect(()=>{if(m===0){y(d),w(s),C(null);return}let I=!1;return A(!0),C(null),d5(n,{offset:m*f,limit:f,...r}).then(z=>{I||(y(z.items),w(z.total))}).catch(z=>{I||C(Ae(z))}).finally(()=>{I||A(!1)}),()=>{I=!0}},[m,f,n,r,d,s]);const R=Math.max(1,Math.ceil(k/f)),[L,H]=v.useState(new Set);v.useEffect(()=>H(new Set),[p]);const O=I=>H(z=>{const W=new Set(z);return W.has(I)?W.delete(I):W.add(I),W});return l.jsxs("div",{children:[l.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-6 gap-y-1.5",children:[l.jsx(bu,{label:x.usage.errorsTotal,value:String(s)}),l.jsx(bu,{label:x.usage.errorsUnexpected,value:String(o),alert:o>0,muted:o===0}),l.jsx(bu,{label:x.usage.errorsExpected,value:String(s-o),muted:!0}),c&&l.jsx(bu,{label:x.usage.errorsTopCode,value:`${Hb(c.source,c.code)} ×${c.count}`})]}),p.length===0?l.jsx(id,{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(vu,{className:"w-32",children:x.common.time}),l.jsx(vu,{className:"w-72",children:x.usage.errorsColCode}),l.jsx(vu,{className:"w-20",children:x.usage.errorsColKind}),l.jsx(vu,{children:x.usage.errorsColMessage})]})}),l.jsx("tbody",{children:p.map((I,z)=>{const W=$L(I.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:ua(I.ts)}),l.jsx("td",{className:"py-1.5 pr-2 align-top font-mono text-gray-500 dark:text-gray-400",children:l.jsx("span",{className:"block break-words",children:Hb(I.source,I.code)})}),l.jsx("td",{className:"py-1.5 pr-2 align-top",children:l.jsx(Jt,{tone:W==="unexpected"?"red":"gray",children:UL(W)})}),l.jsx("td",{className:"py-1.5 align-top text-gray-500 dark:text-gray-400",children:l.jsx("button",{type:"button",title:I.message,onClick:()=>O(z),className:`block w-full cursor-pointer text-left transition-colors hover:text-gray-700 dark:hover:text-gray-300 ${L.has(z)?"whitespace-pre-wrap break-words":"truncate"}`,children:I.message})})]},`${I.ts}-${z}`)})})]})}),(R>1||m>0)&&l.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2 text-xs text-gray-500 dark:text-gray-400",children:[j!==null&&l.jsx("span",{className:"mr-auto text-rose-500",children:j}),l.jsx("span",{className:"tabular-nums",children:x.usage.errorsPageOf(m+1,R,k)}),l.jsx(Pb,{label:x.usage.errorsNewer,disabled:m===0||T,onClick:()=>h(I=>Math.max(0,I-1))}),l.jsx(Pb,{label:x.usage.errorsOlder,disabled:m+1>=R||T,onClick:()=>h(I=>I+1)})]})]})}function Pb({label:e,disabled:n,onClick:r}){return l.jsx("button",{type:"button",disabled:n,onClick:r,className:"rounded-md border border-gray-200 px-2 py-0.5 transition-colors duration-150 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent dark:border-gray-800 dark:hover:bg-gray-800/60 dark:disabled:hover:bg-transparent",children:e})}function Fb(e){const n=r=>r<10?`0${r}`:`${r}`;return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function eh({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 th({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(eh,{label:x.usage.tokens,value:lt(n.total)}),l.jsx(eh,{label:x.usage.requests,value:String(n.requests),muted:!0}),l.jsx(eh,{label:x.common.cost,value:Ya(n.cost,r),sup:n.hasUncosted})]})]})}function lo({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 PL(){hr(x.usage.title);const{currency:e}=ks(),{currentProject:n}=fn(),r=n?.projectId??null,[s]=ep(),o=s.get("agentId"),[c,d]=v.useState(o??""),[f,m]=v.useState(null);v.useEffect(()=>{d(o??"")},[o]);const[h,p]=v.useState(()=>{const D=new Date;return D.setDate(D.getDate()-29),Fb(D)}),[y,k]=v.useState(()=>Fb(new Date)),[w,j]=v.useState(null),[C,T]=v.useState(null),[A,R]=v.useState(null),L=v.useCallback(async()=>{if(r){T(null);try{const D=await mv(r,{from:h,to:y,groupBy:"date",...c?{agentId:c}:{},...f?{provider:f.provider,modelId:f.modelId}:{}});j(D)}catch(D){T(Ae(D))}}},[r,h,y,c,f?.provider,f?.modelId]);v.useEffect(()=>{j(null),L()},[L]);const H=v.useMemo(()=>({from:h,to:y,...c?{agentId:c}:{}}),[h,y,c]);if(!r)return null;const O=w?.models??[],I=f?O.findIndex(D=>D.provider===f.provider&&D.modelId===f.modelId):-1,z=I>=0?String(I):"",W=w?.summary,X=(W?.today.hasUncosted??!1)||(W?.last7d.hasUncosted??!1)||(W?.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(Ro,{size:"sm",value:c,onChange:D=>d(D.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(D=>l.jsx("option",{value:D,children:D},D))]})}),l.jsx("div",{className:"w-32",children:l.jsxs(Ro,{size:"sm",value:z,onChange:D=>{const q=D.target.value;m(q===""?null:O[Number(q)]??null)},children:[l.jsx("option",{value:"",children:x.usage.filterAllModels}),O.map((D,q)=>l.jsx("option",{value:String(q),children:zp(D.provider,D.modelId)?.displayName??D.modelId},`${D.provider}:${D.modelId}`))]})}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Ze,{size:"sm",type:"date","aria-label":x.usage.from,value:h,onChange:D=>p(D.target.value)}),l.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:"–"}),l.jsx(Ze,{size:"sm",type:"date","aria-label":x.usage.to,value:y,onChange:D=>k(D.target.value)})]})]})]}),w?l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[l.jsx(th,{title:x.usage.today,bucket:w.summary.today,currency:e}),l.jsx(th,{title:x.usage.last7d,bucket:w.summary.last7d,currency:e}),l.jsx(th,{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(Vt,{className:"h-24"}),l.jsx(Vt,{className:"h-24"}),l.jsx(Vt,{className:"h-24"})]}),w?l.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[l.jsx(lo,{title:x.usage.chartAgentCalls,children:l.jsx(RL,{data:w.byAgent})}),l.jsx(lo,{title:x.usage.chartSuccessRate,children:l.jsx(OL,{data:w.success})}),l.jsx(lo,{title:x.usage.chartTokenTrend,extra:l.jsx(zL,{active:A,onHover:R}),children:l.jsx(DL,{trend:w.trend,legend:A})}),l.jsx(lo,{title:x.usage.chartCostTrend,children:l.jsx(ML,{points:w.trend,currency:e})})]}):l.jsx(Vt,{className:"h-64"}),w&&l.jsx(lo,{title:x.usage.errors,children:l.jsx(HL,{errors:w.errors,projectId:r,filters:H})}),X&&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 FL({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,p=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:vo.cacheRead,label:x.usage.colCacheRead},{key:"cacheWrite",value:n,color:vo.cacheWrite,label:x.usage.colCacheWrite},{key:"output",value:r,color:vo.output,label:x.usage.colOutput}],j=`${x.chat.contextUsage} ${lt(c)}/${lt(s)}`+w.map(T=>` · ${T.label} ${lt(T.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":j,children:[l.jsx("title",{children:j}),l.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:"currentColor",strokeOpacity:.35,strokeWidth:d}),w.map(T=>{if(T.value<=0)return null;const A=T.value/p*h,R=-(C/p)*h;return C+=T.value,l.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:T.color,strokeWidth:d,strokeDasharray:`${A} ${h}`,strokeDashoffset:R,transform:`rotate(-90 ${f} ${f})`},T.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"},qp="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",X2="truncate font-mono text-[11px]",qb=.25,$h=24,qL=1/$h,Or=(e,n,r)=>Math.min(r,Math.max(n,e));function VL(e){return e==="thinking"?qa.thinking:e==="text"?qa.text:qa.toolgen}function GL(e){return e==="thinking"?x.traces.kindThinking:e==="text"?x.traces.kindModelReply:x.traces.kindToolGen}function WL(e){return e==="thinking"?"thinking":e==="text"?"text":"toolgen"}function io(e){if(e===void 0)return null;const n=Date.parse(e);return Number.isFinite(n)?n:null}function KL(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=io(c.startTs),f=io(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=io(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:io(c.approvalTs),outputMs:io(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(j=>j.startMs),...f.map(j=>j.callMs)],h=[...d.map(j=>j.endMs),...f.map(j=>j.outputMs??j.approvalMs??j.callMs)],p=Math.min(...m),y=Math.max(...h,...m),k=Math.max(1,y-p);f.sort((j,C)=>j.callMs-C.callMs);const w=[...new Set(f.map(j=>j.name))];o.push({taskIndex:c,segs:d,spans:f,t0:p,total:k,toolNames:w})}return o}function Z2({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 YL({label:e,children:n}){return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:`${qp} text-gray-400 dark:text-gray-500`,title:e,children:l.jsx("span",{className:X2,children:e})}),l.jsx(Z2,{children:n})]})}function QL({total:e}){const n=[0,.25,.5,.75,1];return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:qp}),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:xn(r*e)},s))})]})}function XL({segments:e,toolSpans:n,highlight:r,onHighlight:s,onJump:o,hideTaskLabel:c=!1}){const d=v.useMemo(()=>KL(e,n),[e,n]),{firstBarKeyByTs:f,barKeys:m}=v.useMemo(()=>{const $=new Map,N=new Set,Y=(le,oe)=>{N.add(oe),$.has(le)||$.set(le,oe)};for(const le of d){le.segs.forEach((oe,pe)=>Y(oe.ts,`s-${le.taskIndex}-${pe}`));for(const oe of le.spans)oe.approvalMs!==null&&oe.approvalMs>oe.callMs&&Y(oe.approvalTsRaw??oe.callTs,`w-${oe.toolCallId}`),oe.approvalMs===null&&oe.outputMs===null?Y(oe.callTs,`p-${oe.toolCallId}`):Y(oe.outputTsRaw??oe.callTs,`e-${oe.toolCallId}`)}return{firstBarKeyByTs:$,barKeys:N}},[d]),[h,p]=v.useState(null),[y,k]=v.useState(1),[w,j]=v.useState({left:0,width:1}),C=v.useRef(null),T=v.useRef(null),A=v.useRef(w);A.current=w;const R=v.useRef(y);R.current=y;const L=v.useRef(null),H=v.useRef(null),O=v.useCallback(()=>{const $=C.current;if(!$)return;const N=$.scrollWidth||1;j({left:$.scrollLeft/N,width:Math.min(1,$.clientWidth/N)})},[]);if(v.useLayoutEffect(()=>{const $=C.current;if($){if(L.current){const N=$.scrollWidth-$.clientWidth;$.scrollLeft=Or(L.current($),0,Math.max(0,N)),L.current=null}O()}},[y,d,O]),v.useLayoutEffect(()=>{const $=C.current;if(!$||typeof ResizeObserver>"u")return;const N=new ResizeObserver(()=>O());return N.observe($),()=>N.disconnect()},[O]),v.useLayoutEffect(()=>()=>H.current?.(),[]),d.length===0)return l.jsx("p",{className:"text-xs text-gray-400",children:x.common.none});const I=r?.ts,z=r?.key,W=($,N)=>s?.(N?{ts:N,key:$}:null),X=()=>s?.(null),D=z??(I!==void 0?f.get(I):void 0),q=D!==void 0&&m.has(D)?D:void 0,P=q!==void 0,K=$=>q===$,ee=($,N)=>h!==null&&!N||P&&!$?"opacity-15":"",B=($,N,Y,le)=>{const oe=Or(($-Y)/le*100,0,100),pe=Or((N-$)/le*100,0,100-oe);return oe>=100?{left:"100%",width:"0%",marginLeft:"-2px"}:{left:`${oe}%`,width:`${pe}%`}},U=[{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}],F=($,N)=>{const Y=Or(N,qL,1),le=Or(1/Y,qb,$h),oe=Or($,0,1-Y);L.current=pe=>oe*pe.scrollWidth,k(le)},Z=$=>{$.preventDefault();const N=T.current,Y=C.current;if(!N||!Y)return;const le=N.getBoundingClientRect().width||1,oe=$.clientX,pe=Y.scrollLeft,Ce=Math.max(0,Y.scrollWidth-Y.clientWidth),re=xe=>{const We=(xe.clientX-oe)/le;Y.scrollLeft=Or(pe+We*Y.scrollWidth,0,Ce),O()},he=()=>{window.removeEventListener("pointermove",re),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he),H.current=null};window.addEventListener("pointermove",re),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he),H.current=he},ue=$=>N=>{N.preventDefault(),N.stopPropagation();const Y=T.current;if(!Y)return;const le=Y.getBoundingClientRect(),oe=Ce=>{const re=Or((Ce.clientX-le.left)/(le.width||1),0,1),he=A.current;if($==="right")F(he.left,re-he.left);else{const xe=he.left+he.width;F(re,xe-re)}},pe=()=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",pe),window.removeEventListener("pointercancel",pe),H.current=null};window.addEventListener("pointermove",oe),window.addEventListener("pointerup",pe),window.addEventListener("pointercancel",pe),H.current=pe},E=()=>{L.current=()=>0,k(1)},M=$=>{const N=C.current,Y=Or(R.current*$,qb,$h);if(Y!==R.current){if(N){const le=N.clientWidth/2,oe=(N.scrollLeft+le)/(N.scrollWidth||1);L.current=pe=>oe*pe.scrollWidth-le}k(Y)}};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($=>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($.taskIndex+1)}),l.jsx("span",{className:"font-mono text-[11px] text-gray-400",children:xn($.total)})]}),l.jsx(YL,{label:x.traces.laneLLM,children:$.segs.map((N,Y)=>{const le=WL(N.kind),oe=h===null||h===le,pe=`s-${$.taskIndex}-${Y}`,Ce=K(pe);return l.jsx("span",{onMouseEnter:()=>W(pe,N.ts),onMouseLeave:X,onClick:()=>o?.(N.ts),title:`${GL(N.kind)}${N.name?` ${N.name}`:""} · ${xn(N.endMs-N.startMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${VL(N.kind)} ${ee(Ce,oe)}`,style:B(N.startMs,N.endMs,$.t0,$.total)},Y)})}),$.spans.map(N=>{const Y=N.approvalMs??N.callMs,le=N.outputMs===null,oe=N.outputMs??$.t0+$.total,pe=N.approvalTsRaw??N.callTs,Ce=N.outputTsRaw??N.callTs;return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:`${qp} text-gray-500 dark:text-gray-400`,title:N.name,children:l.jsx("span",{className:X2,children:N.name})}),l.jsxs(Z2,{children:[N.approvalMs!==null&&N.approvalMs>N.callMs&&l.jsx("span",{onMouseEnter:()=>W(`w-${N.toolCallId}`,pe),onMouseLeave:X,onClick:()=>o?.(pe),title:`${N.name} · ${x.traces.legendApprovalWait}${N.decision?` (${N.decision})`:""} · ${xn(N.approvalMs-N.callMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${qa.approvalWait} ${ee(K(`w-${N.toolCallId}`),h===null||h==="approvalWait")}`,style:B(N.callMs,N.approvalMs,$.t0,$.total)}),N.approvalMs===null&&le?(()=>{const re=ee(K(`p-${N.toolCallId}`),h===null||h==="approvalWait");return l.jsx("span",{onMouseEnter:()=>W(`p-${N.toolCallId}`,N.callTs),onMouseLeave:X,onClick:()=>o?.(N.callTs),title:`${N.name} · ${x.traces.legendApprovalWait} · ${x.traces.inProgress}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${qa.approvalWait} ${re||"animate-pulse"}`,style:B(N.callMs,oe,$.t0,$.total)})})():(()=>{const re=ee(K(`e-${N.toolCallId}`),h===null||h==="exec"),he=le&&!re;return l.jsx("span",{onMouseEnter:()=>W(`e-${N.toolCallId}`,Ce),onMouseLeave:X,onClick:()=>o?.(Ce),title:`${N.name} · ${x.traces.legendToolExec} · ${le?x.traces.inProgress:xn(oe-Y)}${N.failed?` · ${N.status}`:""}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${qa.exec} ${N.failed?"ring-1 ring-red-500":""} ${he?"animate-pulse opacity-70":re}`,style:B(Y,oe,$.t0,$.total)})})()]})]},N.toolCallId)}),l.jsx(QL,{total:$.total})]},$.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:U.map($=>l.jsxs("button",{type:"button",onMouseEnter:()=>p($.key),onMouseLeave:()=>p(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!==$.key?"opacity-30":""}`,children:[l.jsx("span",{className:`inline-block h-2 w-3 rounded-sm ${$.className}`}),$.label]},$.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:()=>M(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:T,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:ue("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:ue("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:()=>M(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 ZL(e){return e==="session_meta"?"brand":e==="model_msg"?"gray":"amber"}const JL={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"},e7="M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";function t7({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:JL[e]??e7})})}function n7(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 a7(e){const n=e.payload;return n.stop_reason??n.status}const ku="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 r7({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:lt(c.cache_read??0)}),l.jsx("td",{className:"pr-3 text-right font-mono",children:lt(c.cache_write??0)}),l.jsx("td",{className:"pr-3 text-right font-mono",children:lt(c.output??0)}),l.jsx("td",{className:"text-right font-mono",children:lt(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 Vb="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 s7({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:Vb,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($o,{remarkPlugins:[Bo],children:r})})]}),s.length>0&&l.jsxs("details",{children:[l.jsx("summary",{className:Vb,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 l7({msg:e}){const n=e.payload;if(e.type==="session_meta")return l.jsx(s7,{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($o,{remarkPlugins:[Bo],children:r})}):l.jsx("p",{className:"text-xs text-gray-400",children:"—"})}case"image_url":return l.jsx($r,{src:String(n.image_url??""),alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"inline_data":return l.jsx($r,{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:ku,children:String(n.arguments??"")})]});case"tool_call_output":{const r=Array.isArray(n.images)?n.images:[];return r.length===0?l.jsx("pre",{className:ku,children:String(n.output??"")}):l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("pre",{className:ku,children:String(n.output??"")}),l.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((s,o)=>l.jsx($r,{src:s,alt:"trace",className:"max-h-48 max-w-full rounded-md"},o))})]})}case"token_usage":return l.jsx(r7,{p:n});default:return l.jsx("pre",{className:ku,children:JSON.stringify(n,null,2)})}}function i7({msg:e,rowKey:n,matched:r,onHighlight:s}){const[o,c]=v.useState(!1),d=e.payload.type??e.type,f=a7(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:R4(e.timestamp)}),l.jsx(t7,{type:d}),l.jsx(Jt,{tone:ZL(e.type),children:d}),e.origin&&e.origin.length>0&&l.jsx(Jt,{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:n7(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(l7,{msg:e}),f&&l.jsx("div",{className:"mt-1.5 flex justify-end",children:l.jsx(Jt,{tone:B4(f),children:f})})]})]})}const Gb=()=>({cacheRead:0,cacheWrite:0,output:0}),o7=2500,Wb=(e,n)=>`${e}-${n}`;function Dr({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 J2=e=>e.cacheRead+e.cacheWrite,ew=e=>qv(e.cacheRead,e.cacheWrite),tw="flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";function oo({icon:e,value:n,label:r}){return l.jsxs("span",{title:r,"aria-label":r,className:`${tw} gap-1`,children:[l.jsx(Ue,{d:e,className:"text-gray-400"}),n]})}function c7({buckets:e}){const n=J2(e),r=`${x.traces.cacheHit} ${lt(e.cacheRead)} · ${x.traces.hitRate} ${rp(ew(e))}`;return l.jsxs("span",{"aria-label":`${x.traces.taskInput} ${lt(n)} · ${r}`,className:tw,children:[l.jsxs("span",{title:x.traces.taskInput,className:"flex items-center gap-1",children:[l.jsx(Ue,{d:on.input,className:"text-gray-400"}),lt(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(Ue,{d:on.cacheHit}),l.jsx("span",{children:lt(e.cacheRead)}),l.jsx("span",{children:")"})]})]})}function u7({projectId:e,agentId:n,sessionId:r,index:s,highlight:o,onHighlight:c}){const{currency:d}=ks(),[f,m]=v.useState(null),[h,p]=v.useState([]),[y,k]=v.useState(0),[w,j]=v.useState(0),[C,T]=v.useState(null),[A,R]=v.useState(null),[L,H]=v.useState(new Set),[O,I]=v.useState(null),z=v.useRef(null),W=v.useRef(null);v.useEffect(()=>()=>{W.current&&clearTimeout(W.current)},[]),v.useEffect(()=>{m(null),p([]),R(null),H(new Set),I(null);let M=!1;return Promise.all([o5(e,n,r,s),i5(e,n,r,s,0,1e3),Vu(e).catch(()=>null)]).then(([$,N,Y])=>{M||(m($),p(N.events),k(N.offset),j(N.total),T(Y))}).catch($=>{M||R(Ae($))}),()=>{M=!0}},[e,n,r,s]);const X=v.useMemo(()=>{const M=h.find(N=>N.type==="session_meta"),$=M?M.payload:void 0;if(!(!$?.model_id||!$.provider))return C?.models.find(N=>N.modelId===$.model_id&&N.provider===$.provider)?.pricing},[h,C]),D=M=>X?(M.cacheRead*X.cacheRead+M.cacheWrite*X.cacheWrite+M.output*X.output)/1e6:null,q=v.useMemo(()=>{const M=h.find($=>$.type==="session_meta");return S2(M?M.payload.model_context_window:void 0)},[h]),{tasks:P,global:K,statsByTask:ee,globalLlmMs:B}=v.useMemo(()=>{const M={buckets:Gb(),toolCalls:0},$=new Map;if(!f)return{tasks:[],global:M,statsByTask:$,globalLlmMs:0};const N=new Map;for(const he of f.tasks){const xe=Date.parse(he.startTs),We=Date.parse(he.endTs);Number.isFinite(xe)&&Number.isFinite(We)&&N.set(he.taskIndex,{min:xe,max:We})}const Y=new Map,le=he=>{let xe=Y.get(he);if(!xe){const We=N.get(he);xe={taskIndex:he,segments:[],spans:[],messages:[],toolCalls:0,durationMs:We?Math.max(0,We.max-We.min):0},Y.set(he,xe)}return xe};for(const he of f.tasks)le(he.taskIndex);for(const he of f.modelSegments)le(he.taskIndex).segments.push(he);for(const he of f.toolSpans){const xe=le(he.taskIndex);xe.spans.push(he),xe.toolCalls+=1}const oe=he=>{for(const xe of f.tasks)if(he>=xe.messageFrom&&he<=xe.messageTo)return xe.taskIndex;return null};for(let he=0;he<h.length;he++){const xe=h[he];if(xe.origin&&xe.origin.length>0)continue;const We=oe(y+he);We!==null&&le(We).messages.push(xe)}M.toolCalls=f.toolSpans.length;const pe=new Map(f.tasks.map(he=>[he.taskIndex,he]));for(const he of f.tasks)M.buckets.cacheRead+=he.tokens.cacheRead,M.buckets.cacheWrite+=he.tokens.cacheWrite,M.buckets.output+=he.tokens.output;const Ce=f.tasks.reduce((he,xe)=>he+xe.llmMs,0);return{tasks:[...Y.values()].sort((he,xe)=>he.taskIndex-xe.taskIndex),global:M,statsByTask:pe,globalLlmMs:Ce}},[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(Vt,{className:"h-40"});const U=f.elapsedMs,F=M=>H($=>{const N=new Set($);return N.has(M)?N.delete(M):N.add(M),N}),Z=M=>{for(const $ of P){const N=$.messages.findIndex(Y=>Y.timestamp===M);if(N>=0)return Wb($.taskIndex,N)}return null},ue=o?.rowKey??(o?.ts!==void 0?Z(o.ts):null),E=M=>{const $=Z(M);$!==null&&(I($),requestAnimationFrame(()=>{z.current?.querySelector(`[data-trace-row="${$}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})}),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>I(null),o7))};return l.jsxs("div",{ref:z,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(Dr,{label:x.traces.tasksLabel,value:String(f.tasks.length)}),l.jsx(Dr,{label:x.traces.toolCalls,value:String(K.toolCalls)}),l.jsx(Dr,{label:x.traces.compactions,value:String(f.compactionCount)})]}),l.jsxs("div",{children:[l.jsx(Dr,{label:x.chat.statInput,value:lt(J2(K.buckets))}),l.jsx(Dr,{label:x.traces.cacheHit,value:`${lt(K.buckets.cacheRead)} · ${rp(ew(K.buckets))}`}),l.jsx(Dr,{label:x.chat.statOutput,value:lt(K.buckets.output)})]}),l.jsxs("div",{children:[l.jsx(Dr,{label:x.common.cost,value:Ya(D(K.buckets),d)}),l.jsx(Dr,{label:x.chat.statElapsed,value:xn(Math.max(0,U))}),l.jsx(Dr,{label:x.chat.statTps,value:Au(oh(K.buckets.output,B))})]})]})]}),P.map(M=>{const $=!L.has(M.taskIndex),N=ee.get(M.taskIndex),Y=N?.context,le=N?.tokens??Gb();return l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[l.jsxs("button",{type:"button",onClick:()=>F(M.taskIndex),"aria-expanded":$,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(An,{open:$,size:13,className:"text-gray-400"}),l.jsx("span",{className:"shrink-0 text-sm font-semibold",children:x.traces.task(M.taskIndex+1)}),N?.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(oo,{icon:on.toolCalls,value:String(M.toolCalls),label:x.traces.toolCalls}),l.jsx(c7,{buckets:le}),l.jsx(oo,{icon:on.output,value:lt(le.output),label:x.traces.taskOutput}),l.jsx(oo,{icon:on.cost,value:Ya(D(le),d),label:`${x.common.cost}(${d})`}),l.jsx(oo,{icon:on.elapsed,value:xn(M.durationMs),label:x.chat.statElapsed}),l.jsx(oo,{icon:on.tps,value:Au(oh(le.output,N?.llmMs??0)),label:x.chat.statTps})]}),Y&&l.jsx(FL,{cacheRead:Y.cacheRead,cacheWrite:Y.cacheWrite,output:Y.output,max:q,size:22})]}),$&&l.jsxs("div",{className:"space-y-3 p-3",children:[(M.segments.length>0||M.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(XL,{segments:M.segments,toolSpans:M.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,"(",M.messages.length,")"]}),M.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:M.messages.map((oe,pe)=>{const Ce=Wb(M.taskIndex,pe);return l.jsx(i7,{msg:oe,rowKey:Ce,matched:Ce===ue||Ce===O,onHighlight:re=>c(re)},pe)})})]})]})]},M.taskIndex)}),h.length<w&&l.jsx("p",{className:"text-xs text-gray-400",children:x.traces.truncatedNote(h.length,w)})]})}const d7=14*1024*1024;function f7(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 m7({projectId:e,agentId:n,name:r,defaultOpen:s,focusSessionId:o,canImport:c,titleOf:d,selection:f,onSelect:m}){const[h,p]=v.useState(s),[y,k]=v.useState(null),[w,j]=v.useState(null),[C,T]=v.useState(!1),A=v.useRef(null);v.useEffect(()=>{!h||y||Jj(e,n).then(O=>k(f7(O))).catch(O=>j(Ae(O)))},[h,y,e,n]);const R=v.useRef(!1);v.useEffect(()=>{if(R.current||!o||!y)return;R.current=!0;const O=y.find(I=>I.sessionId===o);O&&m({agentId:n,sessionId:O.sessionId,files:O.files})},[y,o,n,m]),v.useEffect(()=>{const O=A.current;if(O===null||!y)return;A.current=null;const I=y.find(z=>z.sessionId===O);I&&m({agentId:n,sessionId:I.sessionId,files:I.files})},[y,n,m]);const L=async O=>{T(!0);try{const I=await u5(e,n,{dataBase64:O});A.current=I.sessionId,k(null),p(!0)}catch(I){ft(Ae(I))}finally{T(!1)}},H=O=>{const I=O.target.files?.[0];if(O.target.value="",!I)return;if(I.size>d7){ft(x.traces.fileTooLarge);return}const z=new FileReader;z.onload=()=>{const W=z.result;L(W.slice(W.indexOf(",")+1))},z.onerror=()=>ft(x.common.unknownError),z.readAsDataURL(I)};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:()=>p(O=>!O),"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(da,{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(An,{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(Up,{accept:".jsonl",disabled:C,onChange:H}),l.jsx(C4,{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(O=>{const I=f?.agentId===n&&f.sessionId===O.sessionId,z=d(n,O.sessionId);return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>m({agentId:n,sessionId:O.sessionId,files:O.files}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${I?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[l.jsx(Yu,{text:z??O.sessionId,className:`min-w-0 flex-1 ${z?"text-sm":"font-mono text-xs"} ${I?"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:O.files.length})]})},O.sessionId)})})]})]})}function h7(){hr(x.traces.title);const{currentProject:e,agents:n,agentsLoading:r}=fn(),{byAgent:s}=el(),o=e?.projectId??null,[c]=ep(),d=c.get("agentId"),f=c.get("sessionId"),[m,h]=v.useState(null),[p,y]=v.useState(null),[k,w]=v.useState(null);v.useEffect(()=>{h(null),y(null)},[o]),v.useEffect(()=>{w(null)},[m,p]);const j=(T,A)=>s.get(T)?.find(R=>R.sessionId===A)?.title;if(!o)return null;const C=m===null?null:m.files.find(T=>T.index===p)??m.files[0]??null;return l.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[l.jsxs("aside",{className:"relative 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(Ia,{rows:4}):l.jsx("ul",{children:n.map(T=>l.jsx(m7,{projectId:o,agentId:T.agentId,name:un(T),defaultOpen:d===null||d===T.agentId,...f!==null&&d===T.agentId?{focusSessionId:f}:{},canImport:e?.role==="owner",titleOf:j,selection:m,onSelect:A=>{h(A),y(A.files[0]?.index??null)}},T.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:j(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(T=>l.jsxs("button",{type:"button",onClick:()=>y(T.index),title:`${T.date} · ${No(T.sizeBytes)}`,className:`rounded-md border px-2 py-0.5 font-mono text-xs transition-colors duration-150 ${T.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(T.index).padStart(3,"0")]},T.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," · ",No(C.sizeBytes)]}),l.jsxs("a",{href:c5(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(N4,{size:12}),x.traces.exportFile]})]}),l.jsx(u7,{projectId:o,agentId:m.agentId,sessionId:m.sessionId,index:C.index,highlight:k,onHighlight:w})]}):l.jsx(fr,{title:x.traces.selectSession})})]})}function nw(e){return e.map(n=>typeof n.score=="number"&&Number.isFinite(n.score)?n.score:null)}function p7(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 g7(e){return Math.max(1e-9,...e.filter(n=>n!==null))}function x7(e){const n=new Map;e.forEach((s,o)=>{const c=s.modelId!==void 0&&s.modelId!=="",d=c?`${s.modelId}\0${s.thinkingLevel??""}`:"";let f=n.get(d);f||(f={key:d,...c&&s.modelId!==void 0?{modelId:s.modelId}:{},...c&&s.thinkingLevel!==void 0?{thinkingLevel:s.thinkingLevel}:{},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 y7(e,n){const r=new Set(n.indices);return nw(e).map((s,o)=>r.has(o)?s:null)}const b7=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","sql","svg"]),v7=new Set(["png","jpg","jpeg","gif","webp"]),Kb=/^[a-z][a-z0-9+.-]*:/i,k7=64*1024;function aw(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function Yb(e,n){return e===""?n:`${e}/${n}`}function Qb(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}function Xb(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("/")}function w7(e){const n=aw(e);return{json:"json",md:"markdown",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",sh:"shellscript",bash:"shellscript",yaml:"yaml",yml:"yaml",toml:"toml",css:"css",html:"html",htm:"html",xml:"xml",sql:"sql",svg:"xml"}[n]??"text"}function S7({projectId:e,agentId:n,benchmarkId:r,caseSummary:s}){const[o,c]=v.useState(""),[d,f]=v.useState(null),[m,h]=v.useState(null),[p,y]=v.useState(null),k=v.useRef(!1),w=v.useRef(0),j=v.useCallback((H,O)=>j5(e,n,r,s.id,H,O),[e,n,r,s.id]),C=v.useCallback(async H=>{const O=++w.current,I=H.includes("/")?H.slice(H.lastIndexOf("/")+1):H,z=aw(I);if(v7.has(z)){y({path:H,name:I,kind:"image"});return}if(z==="pdf"){y({path:H,name:I,kind:"pdf"});return}const W=z==="md";if(!b7.has(z)){y({path:H,name:I,kind:"unsupported"});return}y({path:H,name:I,kind:W?"md":"text",loading:!0});try{const X=await fetch(j(H,{preview:!0}),{credentials:"same-origin"});if(!X.ok)throw new Error(String(X.status));const D=await X.text();if(O!==w.current)return;y({path:H,name:I,kind:W?"md":"text",content:D,truncated:X.headers.get("x-content-truncated")==="1"})}catch(X){if(O!==w.current)return;y({path:H,name:I,kind:W?"md":"text",error:Ae(X)})}},[j]);v.useEffect(()=>{f(null),h(null);let H=!1;return S5(e,n,r,s.id,o).then(O=>{if(!H&&(f(O),o===""&&!k.current)){k.current=!0;const I=O.entries.find(z=>z.kind==="file"&&z.name.toLowerCase()==="readme.md");I&&C(I.name)}}).catch(O=>{H||h(Ae(O))}),()=>{H=!0}},[e,n,r,s.id,o,C]);const T=o===""?[]:o.split("/"),A=p?j(p.path,{download:!0}):null,R=H=>{if(H.kind==="dir"){c(Yb(o,H.name));return}C(Yb(o,H.name))},L={img:({src:H,alt:O})=>l.jsx("img",{src:typeof H=="string"&&!Kb.test(H)?j(Xb(Qb(p?.path??""),H)):H,alt:O??"",loading:"lazy",className:"max-w-full"}),a:({href:H,children:O})=>{if(typeof H!="string"||H.startsWith("#"))return l.jsx("a",{href:H,children:O});if(Kb.test(H))return l.jsx("a",{href:H,target:"_blank",rel:"noreferrer",children:O});const I=Xb(Qb(p?.path??""),H);return l.jsx("a",{href:j(I),onClick:z=>{z.preventDefault(),C(I)},children:O})}};return l.jsxs("div",{className:"grid min-h-[58vh] overflow-hidden rounded-md border border-gray-200 md:grid-cols-[240px_minmax(0,1fr)] dark:border-gray-800",children:[l.jsxs("aside",{className:"border-b border-gray-200 bg-gray-50/60 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-950/30",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-gray-200 px-2 py-2 dark:border-gray-800",children:[l.jsx("button",{type:"button",onClick:()=>c(""),className:"rounded px-1.5 py-0.5 text-xs text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:x.benchmark.publicMaterials}),T.map((H,O)=>l.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[l.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),l.jsx("button",{type:"button",onClick:()=>c(T.slice(0,O+1).join("/")),className:"max-w-24 truncate rounded px-1 py-0.5 text-xs text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:H})]},`${H}-${O}`))]}),l.jsxs("div",{className:"max-h-44 overflow-y-auto md:max-h-[53vh]",children:[m&&l.jsx("p",{className:"px-3 py-2 text-xs text-red-500",children:m}),!d&&!m&&l.jsx(Ia,{rows:4}),d?.entries.length===0&&l.jsx("p",{className:"px-3 py-2 text-xs text-gray-400",children:x.files.empty}),d?.entries.map(H=>l.jsxs("button",{type:"button",onClick:()=>R(H),className:"flex w-full items-center gap-2 border-b border-gray-100 px-3 py-2 text-left hover:bg-gray-100 dark:border-gray-800/70 dark:hover:bg-gray-800/60",children:[l.jsx("span",{className:"text-sm text-gray-400",children:H.kind==="dir"?"▸":"·"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:H.name}),H.kind==="file"&&l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:No(H.sizeBytes)})]},`${H.kind}/${H.name}`))]})]}),l.jsxs("section",{className:"min-w-0",children:[l.jsxs("div",{className:"flex min-h-11 flex-wrap items-center gap-2 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[l.jsx("div",{className:"min-w-0 flex-1",children:l.jsx("p",{className:"truncate font-mono text-xs text-gray-500",children:p?.path??s.id})}),A&&p&&l.jsx("a",{href:A,download:p.name,className:"rounded-md px-2.5 py-1 text-xs font-medium text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:x.files.download})]}),l.jsx("div",{className:"max-h-[52vh] min-h-[52vh] overflow-auto p-3",children:p?p.loading?l.jsx(Ia,{rows:8}):p.error?l.jsx("p",{className:"text-sm text-red-500",children:p.error}):p.kind==="image"?l.jsx("img",{src:j(p.path),alt:p.name,loading:"lazy",className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):p.kind==="pdf"?l.jsx("iframe",{src:j(p.path),title:p.name,className:"h-[50vh] w-full rounded-md border border-gray-200 dark:border-gray-800"}):p.kind==="md"?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"md-body text-sm text-gray-800 dark:text-gray-100",children:l.jsx($o,{remarkPlugins:[Bo],components:L,children:p.content??""})}),p.truncated&&l.jsx("p",{className:"mt-2 text-xs text-gray-400",children:x.files.previewTruncated})]}):p.kind==="text"?l.jsxs(l.Fragment,{children:[l.jsx(_p,{language:w7(p.name),code:p.content??"",highlight:(p.content?.length??0)<=k7}),p.truncated&&l.jsx("p",{className:"mt-2 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.jsx("p",{className:"text-sm text-gray-400",children:x.benchmark.statementUnavailable})})]})]})}function j7({projectId:e,agentId:n,name:r,defaultOpen:s,selection:o,onSelect:c}){const[d,f]=v.useState(s),[m,h]=v.useState(null),[p,y]=v.useState(null);return v.useEffect(()=>{!d||m||k5(e,n).then(k=>h(k.benchmarks)).catch(k=>y(Ae(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(da,{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(An,{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:[p&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:p}),!m&&!p&&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(Yu,{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 N7({evaluations:e,series:n}){const[r,s]=v.useState(null),[o,c]=Pp(),d=nw(e),f=Hp(e.length,Math.max(g7(d),100),c),m=e.map(h=>ua(h.time));return l.jsx("div",{ref:o,children:c>0&&l.jsx(Fp,{geom:f,fmtY:jo,dates:m,hover:r,onHover:s,bubble:h=>{const p=e[h],y=d[h]??null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:ua(p.time)}),l.jsxs("p",{className:"font-mono",children:[y===null?"—":jo(y),p.version!==void 0&&l.jsxs("span",{className:"ml-1.5 text-gray-400",children:["v",p.version]})]}),l.jsxs("p",{className:"font-mono text-gray-400",children:[p.modelId," · ",p.thinkingLevel]})]})},children:n.map((h,p)=>{const y=p7(y7(e,h));return l.jsx("g",{className:h.modelId?Y2(p).text:"text-gray-400 dark:text-gray-500",children:y.map((k,w)=>{const j=k.map((C,T)=>`${T===0?"M":"L"}${f.x(C.index)},${f.y(C.value)}`).join(" ");return l.jsxs("g",{children:[k.length>1&&l.jsx("path",{d:j,fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),k.map(C=>l.jsx("circle",{cx:f.x(C.index),cy:f.y(C.value),r:r===C.index?4:2.5,className:"fill-current",opacity:r!==null&&r!==C.index?.25:1},C.index))]},w)})},h.key===""?"unlabeled":h.key)})})})}function C7({evaluations:e}){const n=x7(e),r=s=>s.modelId?s.thinkingLevel?`${s.modelId} · ${s.thinkingLevel}`:s.modelId:x.benchmark.legendUnlabeled;return l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:x.benchmark.trendTitle(x.benchmark.colScore)}),n.length>=2&&l.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1",children:n.map((s,o)=>l.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400",children:[l.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${s.modelId?Y2(o).swatch:"bg-gray-400 dark:bg-gray-500"}`}),l.jsx("span",{className:"font-mono",children:r(s)})]},s.key===""?"unlabeled":s.key))}),l.jsx(N7,{evaluations:e,series:n})]})}const Fs="px-3 py-2";function T7({agentId:e,evaluation:n,caseTitles:r,onOpenCase:s,currency:o}){const[c,d]=v.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("tr",{onClick:()=>d(f=>!f),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:Fs,children:l.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx(An,{open:c,size:12,className:"text-gray-400"}),ua(n.time)]})}),l.jsx("td",{className:`${Fs} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.version!==void 0?`v${n.version}`:"—"}),l.jsx("td",{className:`${Fs} 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:`${Fs} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.thinkingLevel}),l.jsx("td",{className:`${Fs} font-mono text-xs font-semibold tabular-nums`,children:jo(n.score)}),l.jsx("td",{className:`${Fs} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:Ya(n.cost,o)}),l.jsx("td",{className:`${Fs} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:n.durationMs!==void 0?xn(n.durationMs):"—"})]}),c&&l.jsx("tr",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800/60",children:l.jsxs("td",{colSpan:7,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(f=>l.jsx(E7,{agentId:e,caseScore:f,title:r.get(f.case),onOpenCase:r.has(f.case)?s:void 0,currency:o},f.case))})]})]})})]})}function M7({agentId:e,sessionId:n}){return n?l.jsx(Zh,{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 E7({agentId:e,caseScore:n,title:r,onOpenCase:s,currency:o}){const[c,d]=v.useState(!1),f=n.runs;return l.jsxs(l.Fragment,{children:[l.jsxs("tr",{onClick:()=>d(m=>!m),className:"cursor-pointer text-xs transition-colors duration-150 hover:bg-gray-100/70 dark:hover:bg-gray-800/40",children:[l.jsx("td",{className:"px-2 py-1",children:l.jsxs("span",{className:"flex items-start gap-1.5",children:[l.jsx(An,{open:c,size:12,className:"text-gray-400"}),l.jsxs("span",{className:"min-w-0",children:[s?l.jsx("button",{type:"button",className:"block text-left font-medium text-gray-800 hover:underline dark:text-gray-200",onClick:m=>{m.stopPropagation(),s(n.case)},children:r??n.case}):l.jsx("span",{className:"block font-medium text-gray-800 dark:text-gray-200",children:r??n.case}),r&&r!==n.case&&l.jsx("span",{className:"block font-mono text-[11px] text-gray-400",children:n.case})]})]})}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:jo(n.score)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:Ya(n.cost,o)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:n.durationMs!==void 0?xn(n.durationMs):"—"}),l.jsx("td",{className:"px-2 py-1",children:l.jsx("span",{className:"text-gray-400",children:"—"})})]}),c&&f.map((m,h)=>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," #",h+1]}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:jo(m.score)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Ya(m.cost,o)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:m.durationMs!==void 0?xn(m.durationMs):"—"}),l.jsx("td",{className:"px-2 py-1",children:l.jsx(M7,{agentId:e,...m.sessionId?{sessionId:m.sessionId}:{}})})]},h))]})}function A7({cases:e,error:n,onOpenCase:r}){return l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:x.benchmark.cases}),l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[n&&l.jsx("p",{className:"px-3 py-2 text-xs text-red-500",children:n}),!e&&!n&&l.jsx("p",{className:"px-3 py-2 text-xs text-gray-400",children:x.common.loading}),e?.map(s=>l.jsxs("button",{type:"button",onClick:()=>r(s.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-2 text-left transition-colors last:border-b-0 hover:bg-gray-50 dark:border-gray-800/70 dark:hover:bg-gray-800/50",children:[l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block text-sm font-medium text-gray-800 dark:text-gray-200",children:s.title}),l.jsx("span",{className:"block truncate font-mono text-[11px] text-gray-400",children:s.id})]}),l.jsx("span",{className:"shrink-0 rounded-md px-2.5 py-1 text-xs font-medium text-gray-600 dark:text-gray-300",children:x.benchmark.viewCase})]},s.id))]})]})}function R7(){hr(x.benchmark.title);const{currentProject:e,agents:n,agentsLoading:r}=fn(),{currency:s}=ks(),o=e?.projectId??null,[c]=ep(),d=c.get("agentId"),[f,m]=v.useState(null),[h,p]=v.useState(null),[y,k]=v.useState(null),[w,j]=v.useState(null);if(v.useEffect(()=>{m(null)},[o]),v.useEffect(()=>{if(p(null),k(null),j(null),!o||!f)return;let L=!1;return w5(o,f.agentId,f.benchmark.id).then(H=>{L||p(H.cases)}).catch(H=>{L||k(Ae(H))}),()=>{L=!0}},[o,f]),!o)return null;const C=f?.benchmark??null,T=C?[...C.evaluations]:[],A=new Map(h?.map(L=>[L.id,L.title])??[]),R=h?.find(L=>L.id===w)??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.benchmark.title}),r?l.jsx(Ia,{rows:4}):l.jsx("ul",{children:n.map(L=>l.jsx(j7,{projectId:o,agentId:L.agentId,name:un(L),defaultOpen:d===null||d===L.agentId,selection:f,onSelect:m},L.agentId))})]}),l.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:f&&C?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:C.title}),l.jsx("span",{className:"text-xs text-gray-500",children:x.benchmark.caseCount(C.caseCount)})]}),C.description&&l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:C.description})]}),l.jsx(A7,{cases:h,error:y,onOpenCase:j}),T.length===0?l.jsx(fr,{title:x.benchmark.noEvaluations}):l.jsxs(l.Fragment,{children:[l.jsx(C7,{evaluations:T}),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-[720px] 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.colThinkingLevel}),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:[...T].reverse().map((L,H)=>l.jsx(T7,{agentId:f.agentId,evaluation:L,caseTitles:A,onOpenCase:j,currency:s},H))})]})})]})]}),R&&l.jsx(dn,{open:!0,title:R.title,widthClass:"sm:max-w-6xl",onClose:()=>j(null),children:l.jsx(S7,{projectId:o,agentId:f.agentId,benchmarkId:C.id,caseSummary:R})})]},`${f.agentId}/${C.id}`):l.jsx(fr,{title:x.benchmark.selectBenchmark})})]})}function _7(){hr(x.admin.users);const{user:e}=Un(),[n,r]=v.useState(null),[s,o]=v.useState(null),[c,d]=v.useState(!1),[f,m]=v.useState(null),[h,p]=v.useState(null),y=v.useCallback(async()=>{try{r((await zj()).users),o(null)}catch(k){o(Ae(k))}},[]);return v.useEffect(()=>{e?.isAdmin&&y()},[e?.isAdmin,y]),e&&!e.isAdmin?l.jsx(So,{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(ve,{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(Jt,{tone:"gray",children:x.admin.initialPasswordFlag})})]}),l.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:l.jsx(Jt,{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:ua(k.createdAt)}),l.jsxs("td",{className:"whitespace-nowrap px-3 py-1.5 text-right",children:[l.jsx(ve,{size:"sm",variant:"ghost",onClick:()=>m(k),children:x.admin.resetPassword}),!k.isAdmin&&l.jsx(ve,{size:"sm",variant:"ghost",onClick:()=>p(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(I7,{open:c,onClose:()=>d(!1),onDone:()=>{d(!1),y()}}),l.jsx(L7,{user:f,onClose:()=>m(null)}),l.jsx(O7,{user:h,onClose:()=>p(null),onDone:()=>{p(null),y()}})]})}function I7({open:e,onClose:n,onDone:r}){const[s,o]=v.useState(""),[c,d]=v.useState(""),[f,m]=v.useState({}),[h,p]=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(),j={};if(w?vb.test(w)||(j.userId=x.auth.usernameHint):j.userId=x.common.requiredField,c||(j.password=x.common.requiredField),j.userId||j.password){m(j);return}p(!0),m({});try{await Uj({userId:w,password:c}),r()}catch(C){C instanceof Ka&&C.code==="invalid_password"?m({password:Ae(C)}):m({userId:Ae(C)})}finally{p(!1)}};return l.jsx(dn,{open:e,title:x.admin.createUser,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:n,disabled:h,children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:h,onClick:()=>{k()},children:x.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(Ze,{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(ys,{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}),vb.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 L7({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 $j(e.userId,{password:r}),n()}catch(h){c(Ae(h))}finally{f(!1)}}};return l.jsx(dn,{open:e!==null,title:e?x.admin.resetPasswordTitle(e.userId):"",onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:n,disabled:d,children:x.common.cancel}),l.jsx(ve,{variant:"primary",disabled:d,onClick:()=>{m()},children:x.common.save})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(ys,{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 O7({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 Bj(e.userId),r()}catch(p){d(Ae(p))}finally{m(!1)}}};return l.jsx(dn,{open:e!==null,title:e?x.admin.deleteUserTitle(e.userId):"",onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(ve,{onClick:n,disabled:f,children:x.common.cancel}),s?l.jsx(ve,{variant:"danger",disabled:f,onClick:()=>{h()},children:x.common.confirm}):l.jsx(ve,{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 D7(){const{user:e}=Un();return e===void 0?null:e===null?l.jsx(So,{to:"/login",replace:!0}):l.jsx(p4,{children:l.jsx(j4,{children:l.jsx(oI,{})})})}function z7(){const{user:e}=Un();return e?l.jsx(So,{to:"/chat",replace:!0}):l.jsx(xI,{})}function U7(){return l.jsx(l4,{children:l.jsxs(LN,{children:[l.jsx(Wn,{path:"/login",element:l.jsx(z7,{})}),l.jsxs(Wn,{element:l.jsx(D7,{}),children:[l.jsx(Wn,{index:!0,element:l.jsx(So,{to:"/chat",replace:!0})}),l.jsx(Wn,{path:"/chat/:sessionId?",element:l.jsx(F_,{})}),l.jsx(Wn,{path:"/agents",element:l.jsx(vI,{})}),l.jsx(Wn,{path:"/agents/:agentId",element:l.jsx(OI,{})}),l.jsx(Wn,{path:"/skills",element:l.jsx(qI,{})}),l.jsx(Wn,{path:"/models",element:l.jsx(iL,{})}),l.jsx(Wn,{path:"/usage",element:l.jsx(PL,{})}),l.jsx(Wn,{path:"/traces",element:l.jsx(h7,{})}),l.jsx(Wn,{path:"/benchmark",element:l.jsx(R7,{})}),l.jsx(Wn,{path:"/admin/users",element:l.jsx(_7,{})}),l.jsx(Wn,{path:"*",element:l.jsx(So,{to:"/chat",replace:!0})})]})]})})}function $7(){return l.jsx(wj,{children:l.jsx(Aj,{children:l.jsx(E5,{children:l.jsxs(Sj,{children:[l.jsx(U7,{}),l.jsx(U4,{})]})})})})}const rw=document.getElementById("root");if(!rw)throw new Error("#root mount point not found");pj.createRoot(rw).render(l.jsx(v.StrictMode,{children:l.jsx($7,{})}));export{hR as _,FC as a,s3 as b,B1 as c,t3 as f,r3 as h,pp as s,KC as w};