@prismshadow/penguin-server 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/types.d.ts +233 -6
- package/dist/{chunk-V6KH4FRG.js → chunk-OMBFPEGQ.js} +1 -1
- package/dist/chunk-OMBFPEGQ.js.map +1 -0
- package/dist/chunk-UUJCF46V.js +50 -0
- package/dist/chunk-UUJCF46V.js.map +1 -0
- package/dist/index.js +1081 -207
- package/dist/index.js.map +1 -1
- package/dist/initial-password.d.ts +17 -0
- package/dist/initial-password.js +15 -0
- package/dist/initial-password.js.map +1 -0
- package/dist/lock.js +1 -1
- package/package.json +8 -3
- package/web-dist/assets/{index-DTZ3P5wj.js → index-B3puu-Hr.js} +1 -1
- package/web-dist/assets/index-CaDuyrN0.css +1 -0
- package/web-dist/assets/index-rgHg3m6g.js +181 -0
- package/web-dist/index.html +2 -2
- package/dist/chunk-V6KH4FRG.js.map +0 -1
- package/web-dist/assets/index-BvejhGl5.css +0 -1
- package/web-dist/assets/index-yzk1uoHO.js +0 -172
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(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"&&l(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 l(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function _v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Im={exports:{}},Ji={};var Py;function N5(){if(Py)return Ji;Py=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,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:l,key:d,ref:o!==void 0?o:null,props:c}}return Ji.Fragment=n,Ji.jsx=r,Ji.jsxs=r,Ji}var Fy;function C5(){return Fy||(Fy=1,Im.exports=N5()),Im.exports}var s=C5(),_m={exports:{}},Ye={};var qy;function T5(){if(qy)return Ye;qy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function w(_){return _===null||typeof _!="object"?null:(_=k&&_[k]||_["@@iterator"],typeof _=="function"?_:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,E={};function M(_,R,C){this.props=_,this.context=R,this.refs=E,this.updater=C||S}M.prototype.isReactComponent={},M.prototype.setState=function(_,R){if(typeof _!="object"&&typeof _!="function"&&_!=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,_,R,"setState")},M.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function L(){}L.prototype=M.prototype;function O(_,R,C){this.props=_,this.context=R,this.refs=E,this.updater=C||S}var P=O.prototype=new L;P.constructor=O,T(P,M.prototype),P.isPureReactComponent=!0;var H=Array.isArray;function I(){}var F={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function Z(_,R,C){var Q=C.ref;return{$$typeof:e,type:_,key:R,ref:Q!==void 0?Q:null,props:C}}function z(_,R){return Z(_.type,R,_.props)}function B(_){return typeof _=="object"&&_!==null&&_.$$typeof===e}function A(_){var R={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(C){return R[C]})}var $=/\/+/g;function q(_,R){return typeof _=="object"&&_!==null&&_.key!=null?A(""+_.key):R.toString(36)}function U(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(I,I):(_.status="pending",_.then(function(R){_.status==="pending"&&(_.status="fulfilled",_.value=R)},function(R){_.status==="pending"&&(_.status="rejected",_.reason=R)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function V(_,R,C,Q,ee){var ae=typeof _;(ae==="undefined"||ae==="boolean")&&(_=null);var he=!1;if(_===null)he=!0;else switch(ae){case"bigint":case"string":case"number":he=!0;break;case"object":switch(_.$$typeof){case e:case n:he=!0;break;case g:return he=_._init,V(he(_._payload),R,C,Q,ee)}}if(he)return ee=ee(_),he=Q===""?"."+q(_,0):Q,H(ee)?(C="",he!=null&&(C=he.replace($,"$&/")+"/"),V(ee,R,C,"",function(ye){return ye})):ee!=null&&(B(ee)&&(ee=z(ee,C+(ee.key==null||_&&_.key===ee.key?"":(""+ee.key).replace($,"$&/")+"/")+he)),R.push(ee)),1;he=0;var xe=Q===""?".":Q+":";if(H(_))for(var ie=0;ie<_.length;ie++)Q=_[ie],ae=xe+q(Q,ie),he+=V(Q,R,C,ae,ee);else if(ie=w(_),typeof ie=="function")for(_=ie.call(_),ie=0;!(Q=_.next()).done;)Q=Q.value,ae=xe+q(Q,ie++),he+=V(Q,R,C,ae,ee);else if(ae==="object"){if(typeof _.then=="function")return V(U(_),R,C,Q,ee);throw R=String(_),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return he}function W(_,R,C){if(_==null)return _;var Q=[],ee=0;return V(_,Q,"","",function(ae){return R.call(C,ae,ee++)}),Q}function ce(_){if(_._status===-1){var R=_._result;R=R(),R.then(function(C){(_._status===0||_._status===-1)&&(_._status=1,_._result=C)},function(C){(_._status===0||_._status===-1)&&(_._status=2,_._result=C)}),_._status===-1&&(_._status=0,_._result=R)}if(_._status===1)return _._result.default;throw _._result}var te=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(R))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},N={map:W,forEach:function(_,R,C){W(_,function(){R.apply(this,arguments)},C)},count:function(_){var R=0;return W(_,function(){R++}),R},toArray:function(_){return W(_,function(R){return R})||[]},only:function(_){if(!B(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Ye.Activity=y,Ye.Children=N,Ye.Component=M,Ye.Fragment=r,Ye.Profiler=o,Ye.PureComponent=O,Ye.StrictMode=l,Ye.Suspense=m,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(_){return F.H.useMemoCache(_)}},Ye.cache=function(_){return function(){return _.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(_,R,C){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var Q=T({},_.props),ee=_.key;if(R!=null)for(ae in R.key!==void 0&&(ee=""+R.key),R)!K.call(R,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&R.ref===void 0||(Q[ae]=R[ae]);var ae=arguments.length-2;if(ae===1)Q.children=C;else if(1<ae){for(var he=Array(ae),xe=0;xe<ae;xe++)he[xe]=arguments[xe+2];Q.children=he}return Z(_.type,ee,Q)},Ye.createContext=function(_){return _={$$typeof:d,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:c,_context:_},_},Ye.createElement=function(_,R,C){var Q,ee={},ae=null;if(R!=null)for(Q in R.key!==void 0&&(ae=""+R.key),R)K.call(R,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(ee[Q]=R[Q]);var he=arguments.length-2;if(he===1)ee.children=C;else if(1<he){for(var xe=Array(he),ie=0;ie<he;ie++)xe[ie]=arguments[ie+2];ee.children=xe}if(_&&_.defaultProps)for(Q in he=_.defaultProps,he)ee[Q]===void 0&&(ee[Q]=he[Q]);return Z(_,ae,ee)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(_){return{$$typeof:f,render:_}},Ye.isValidElement=B,Ye.lazy=function(_){return{$$typeof:g,_payload:{_status:-1,_result:_},_init:ce}},Ye.memo=function(_,R){return{$$typeof:h,type:_,compare:R===void 0?null:R}},Ye.startTransition=function(_){var R=F.T,C={};F.T=C;try{var Q=_(),ee=F.S;ee!==null&&ee(C,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(I,te)}catch(ae){te(ae)}finally{R!==null&&C.types!==null&&(R.types=C.types),F.T=R}},Ye.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Ye.use=function(_){return F.H.use(_)},Ye.useActionState=function(_,R,C){return F.H.useActionState(_,R,C)},Ye.useCallback=function(_,R){return F.H.useCallback(_,R)},Ye.useContext=function(_){return F.H.useContext(_)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(_,R){return F.H.useDeferredValue(_,R)},Ye.useEffect=function(_,R){return F.H.useEffect(_,R)},Ye.useEffectEvent=function(_){return F.H.useEffectEvent(_)},Ye.useId=function(){return F.H.useId()},Ye.useImperativeHandle=function(_,R,C){return F.H.useImperativeHandle(_,R,C)},Ye.useInsertionEffect=function(_,R){return F.H.useInsertionEffect(_,R)},Ye.useLayoutEffect=function(_,R){return F.H.useLayoutEffect(_,R)},Ye.useMemo=function(_,R){return F.H.useMemo(_,R)},Ye.useOptimistic=function(_,R){return F.H.useOptimistic(_,R)},Ye.useReducer=function(_,R,C){return F.H.useReducer(_,R,C)},Ye.useRef=function(_){return F.H.useRef(_)},Ye.useState=function(_){return F.H.useState(_)},Ye.useSyncExternalStore=function(_,R,C){return F.H.useSyncExternalStore(_,R,C)},Ye.useTransition=function(){return F.H.useTransition()},Ye.version="19.2.7",Ye}var Vy;function fp(){return Vy||(Vy=1,_m.exports=T5()),_m.exports}var b=fp(),Lm={exports:{}},eo={},Om={exports:{}},Dm={};var Gy;function M5(){return Gy||(Gy=1,(function(e){function n(V,W){var ce=V.length;V.push(W);e:for(;0<ce;){var te=ce-1>>>1,N=V[te];if(0<o(N,W))V[te]=W,V[ce]=N,ce=te;else break e}}function r(V){return V.length===0?null:V[0]}function l(V){if(V.length===0)return null;var W=V[0],ce=V.pop();if(ce!==W){V[0]=ce;e:for(var te=0,N=V.length,_=N>>>1;te<_;){var R=2*(te+1)-1,C=V[R],Q=R+1,ee=V[Q];if(0>o(C,ce))Q<N&&0>o(ee,C)?(V[te]=ee,V[Q]=ce,te=Q):(V[te]=C,V[R]=ce,te=R);else if(Q<N&&0>o(ee,ce))V[te]=ee,V[Q]=ce,te=Q;else break e}}return W}function o(V,W){var ce=V.sortIndex-W.sortIndex;return ce!==0?ce:V.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],g=1,y=null,k=3,w=!1,S=!1,T=!1,E=!1,M=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function P(V){for(var W=r(h);W!==null;){if(W.callback===null)l(h);else if(W.startTime<=V)l(h),W.sortIndex=W.expirationTime,n(m,W);else break;W=r(h)}}function H(V){if(T=!1,P(V),!S)if(r(m)!==null)S=!0,I||(I=!0,A());else{var W=r(h);W!==null&&U(H,W.startTime-V)}}var I=!1,F=-1,K=5,Z=-1;function z(){return E?!0:!(e.unstable_now()-Z<K)}function B(){if(E=!1,I){var V=e.unstable_now();Z=V;var W=!0;try{e:{S=!1,T&&(T=!1,L(F),F=-1),w=!0;var ce=k;try{t:{for(P(V),y=r(m);y!==null&&!(y.expirationTime>V&&z());){var te=y.callback;if(typeof te=="function"){y.callback=null,k=y.priorityLevel;var N=te(y.expirationTime<=V);if(V=e.unstable_now(),typeof N=="function"){y.callback=N,P(V),W=!0;break t}y===r(m)&&l(m),P(V)}else l(m);y=r(m)}if(y!==null)W=!0;else{var _=r(h);_!==null&&U(H,_.startTime-V),W=!1}}break e}finally{y=null,k=ce,w=!1}W=void 0}}finally{W?A():I=!1}}}var A;if(typeof O=="function")A=function(){O(B)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,q=$.port2;$.port1.onmessage=B,A=function(){q.postMessage(null)}}else A=function(){M(B,0)};function U(V,W){F=M(function(){V(e.unstable_now())},W)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return k},e.unstable_next=function(V){switch(k){case 1:case 2:case 3:var W=3;break;default:W=k}var ce=k;k=W;try{return V()}finally{k=ce}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(V,W){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ce=k;k=V;try{return W()}finally{k=ce}},e.unstable_scheduleCallback=function(V,W,ce){var te=e.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?te+ce:te):ce=te,V){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=ce+N,V={id:g++,callback:W,priorityLevel:V,startTime:ce,expirationTime:N,sortIndex:-1},ce>te?(V.sortIndex=ce,n(h,V),r(m)===null&&V===r(h)&&(T?(L(F),F=-1):T=!0,U(H,ce-te))):(V.sortIndex=N,n(m,V),S||w||(S=!0,I||(I=!0,A()))),V},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(V){var W=k;return function(){var ce=k;k=W;try{return V.apply(this,arguments)}finally{k=ce}}}})(Dm)),Dm}var Wy;function E5(){return Wy||(Wy=1,Om.exports=M5()),Om.exports}var zm={exports:{}},zn={};var Ky;function A5(){if(Ky)return zn;Ky=1;var e=fp();function n(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,h,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:h,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return zn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,zn.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(n(299));return c(m,h,null,g)},zn.flushSync=function(m){var h=d.T,g=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=h,l.p=g,l.d.f()}},zn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,l.d.C(m,h))},zn.prefetchDNS=function(m){typeof m=="string"&&l.d.D(m)},zn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,y=f(g,h.crossOrigin),k=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?l.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:w}):g==="script"&&l.d.X(m,{crossOrigin:y,integrity:k,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},zn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);l.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&l.d.M(m)},zn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,y=f(g,h.crossOrigin);l.d.L(m,g,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},zn.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=f(h.as,h.crossOrigin);l.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else l.d.m(m)},zn.requestFormReset=function(m){l.d.r(m)},zn.unstable_batchedUpdates=function(m,h){return m(h)},zn.useFormState=function(m,h,g){return d.H.useFormState(m,h,g)},zn.useFormStatus=function(){return d.H.useHostTransitionStatus()},zn.version="19.2.7",zn}var Yy;function Lv(){if(Yy)return zm.exports;Yy=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(),zm.exports=A5(),zm.exports}var Qy;function R5(){if(Qy)return eo;Qy=1;var e=E5(),n=fp(),r=Lv();function l(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(l(188))}function h(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(l(188));return a!==t?null:t}for(var i=t,u=a;;){var x=i.return;if(x===null)break;var v=x.alternate;if(v===null){if(u=x.return,u!==null){i=u;continue}break}if(x.child===v.child){for(v=x.child;v;){if(v===i)return m(x),t;if(v===u)return m(x),a;v=v.sibling}throw Error(l(188))}if(i.return!==u.return)i=x,u=v;else{for(var j=!1,D=x.child;D;){if(D===i){j=!0,i=x,u=v;break}if(D===u){j=!0,u=x,i=v;break}D=D.sibling}if(!j){for(D=v.child;D;){if(D===i){j=!0,i=v,u=x;break}if(D===u){j=!0,u=v,i=x;break}D=D.sibling}if(!j)throw Error(l(189))}}if(i.alternate!==u)throw Error(l(190))}if(i.tag!==3)throw Error(l(188));return i.stateNode.current===i?t:a}function g(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=g(t),a!==null)return a;t=t.sibling}return null}var y=Object.assign,k=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),O=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function A(t){return t===null||typeof t!="object"?null:(t=B&&t[B]||t["@@iterator"],typeof t=="function"?t:null)}var $=Symbol.for("react.client.reference");function q(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===$?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case M:return"Profiler";case E:return"StrictMode";case H:return"Suspense";case I:return"SuspenseList";case Z:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case O:return t.displayName||"Context";case L:return(t._context.displayName||"Context")+".Consumer";case P:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case F:return a=t.displayName||null,a!==null?a:q(t.type)||"Memo";case K:a=t._payload,t=t._init;try{return q(t(a))}catch{}}return null}var U=Array.isArray,V=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},te=[],N=-1;function _(t){return{current:t}}function R(t){0>N||(t.current=te[N],te[N]=null,N--)}function C(t,a){N++,te[N]=t.current,t.current=a}var Q=_(null),ee=_(null),ae=_(null),he=_(null);function xe(t,a){switch(C(ae,a),C(ee,t),C(Q,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?dy(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=dy(a),t=fy(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}R(Q),C(Q,t)}function ie(){R(Q),R(ee),R(ae)}function ye(t){t.memoizedState!==null&&C(he,t);var a=Q.current,i=fy(a,t.type);a!==i&&(C(ee,t),C(Q,i))}function ve(t){ee.current===t&&(R(Q),R(ee)),he.current===t&&(R(he),Yi._currentValue=ce)}var Ke,He;function Ge(t){if(Ke===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);Ke=a&&a[1]||"",He=-1<i.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Ke+t+He}var Qe=!1;function ut(t,a){if(!t||Qe)return"";Qe=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(de){var oe=de}Reflect.construct(t,[],ge)}else{try{ge.call()}catch(de){oe=de}t.call(ge.prototype)}}else{try{throw Error()}catch(de){oe=de}(ge=t())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(de){if(de&&oe&&typeof de.stack=="string")return[de.stack,oe.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),j=v[0],D=v[1];if(j&&D){var G=j.split(`
|
|
4
|
-
`),se=D.split(`
|
|
5
|
-
`);for(x=u=0;u<G.length&&!G[u].includes("DetermineComponentFrameRoot");)u++;for(;x<se.length&&!se[x].includes("DetermineComponentFrameRoot");)x++;if(u===G.length||x===se.length)for(u=G.length-1,x=se.length-1;1<=u&&0<=x&&G[u]!==se[x];)x--;for(;1<=u&&0<=x;u--,x--)if(G[u]!==se[x]){if(u!==1||x!==1)do if(u--,x--,0>x||G[u]!==se[x]){var fe=`
|
|
6
|
-
`+G[u].replace(" at new "," at ");return t.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",t.displayName)),fe}while(1<=u&&0<=x);break}}}finally{Qe=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Ge(i):""}function Yt(t,a){switch(t.tag){case 26:case 27:case 5:return Ge(t.type);case 16:return Ge("Lazy");case 13:return t.child!==a&&a!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return ut(t.type,!1);case 11:return ut(t.type.render,!1);case 1:return ut(t.type,!0);case 31:return Ge("Activity");default:return""}}function en(t){try{var a="",i=null;do a+=Yt(t,i),i=t,t=t.return;while(t);return a}catch(u){return`
|
|
7
|
-
Error generating stack: `+u.message+`
|
|
8
|
-
`+u.stack}}var tn=Object.prototype.hasOwnProperty,wn=e.unstable_scheduleCallback,Pt=e.unstable_cancelCallback,xn=e.unstable_shouldYield,yn=e.unstable_requestPaint,st=e.unstable_now,Wt=e.unstable_getCurrentPriorityLevel,X=e.unstable_ImmediatePriority,me=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Ae=e.unstable_LowPriority,Oe=e.unstable_IdlePriority,re=e.log,ke=e.unstable_setDisableYieldValue,Me=null,Te=null;function $e(t){if(typeof re=="function"&&ke(t),Te&&typeof Te.setStrictMode=="function")try{Te.setStrictMode(Me,t)}catch{}}var Ve=Math.clz32?Math.clz32:cn,Xe=Math.log,et=Math.LN2;function cn(t){return t>>>=0,t===0?32:31-(Xe(t)/et|0)|0}var bn=256,Nt=262144,Sn=4194304;function vn(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 Ct(t,a,i){var u=t.pendingLanes;if(u===0)return 0;var x=0,v=t.suspendedLanes,j=t.pingedLanes;t=t.warmLanes;var D=u&134217727;return D!==0?(u=D&~v,u!==0?x=vn(u):(j&=D,j!==0?x=vn(j):i||(i=D&~t,i!==0&&(x=vn(i))))):(D=u&~v,D!==0?x=vn(D):j!==0?x=vn(j):i||(i=u&~t,i!==0&&(x=vn(i)))),x===0?0:a!==0&&a!==x&&(a&v)===0&&(v=x&-x,i=a&-a,v>=i||v===32&&(i&4194048)!==0)?a:x}function It(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function jn(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 Vn(){var t=Sn;return Sn<<=1,(Sn&62914560)===0&&(Sn=4194304),t}function la(t){for(var a=[],i=0;31>i;i++)a.push(t);return a}function On(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Nn(t,a,i,u,x,v){var j=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 D=t.entanglements,G=t.expirationTimes,se=t.hiddenUpdates;for(i=j&~i;0<i;){var fe=31-Ve(i),ge=1<<fe;D[fe]=0,G[fe]=-1;var oe=se[fe];if(oe!==null)for(se[fe]=null,fe=0;fe<oe.length;fe++){var de=oe[fe];de!==null&&(de.lane&=-536870913)}i&=~ge}u!==0&&tr(t,u,0),v!==0&&x===0&&t.tag!==0&&(t.suspendedLanes|=v&~(j&~a))}function tr(t,a,i){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-Ve(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|i&261930}function ia(t,a){var i=t.entangledLanes|=a;for(t=t.entanglements;i;){var u=31-Ve(i),x=1<<u;x&a|t[u]&a&&(t[u]|=a),i&=~x}}function Ce(t,a){var i=a&-a;return i=(i&42)!==0?1:Ie(i),(i&(t.suspendedLanes|a))!==0?0:i}function Ie(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 lt(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function xt(){var t=W.p;return t!==0?t:(t=window.event,t===void 0?32:Oy(t.type))}function zt(t,a){var i=W.p;try{return W.p=t,a()}finally{W.p=i}}var dt=Math.random().toString(36).slice(2),bt="__reactFiber$"+dt,Qt="__reactProps$"+dt,Xt="__reactContainer$"+dt,oa="__reactEvents$"+dt,yr="__reactListeners$"+dt,ml="__reactHandles$"+dt,Es="__reactResources$"+dt,Gn="__reactMarker$"+dt;function nr(t){delete t[bt],delete t[Qt],delete t[oa],delete t[yr],delete t[ml]}function Na(t){var a=t[bt];if(a)return a;for(var i=t.parentNode;i;){if(a=i[Xt]||i[bt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=by(t);t!==null;){if(i=t[bt])return i;t=by(t)}return a}t=i,i=t.parentNode}return null}function ar(t){if(t=t[bt]||t[Xt]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function rr(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(l(33))}function Bn(t){var a=t[Es];return a||(a=t[Es]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Ut(t){t[Gn]=!0}var As=new Set,Rs={};function Hn(t,a){Ca(t,a),Ca(t+"Capture",a)}function Ca(t,a){for(Rs[t]=a,t=0;t<a.length;t++)As.add(a[t])}var ci=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]*$"),sr={},Ta={};function qr(t){return tn.call(Ta,t)?!0:tn.call(sr,t)?!1:ci.test(t)?Ta[t]=!0:(sr[t]=!0,!1)}function lr(t,a,i){if(qr(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 ue(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 Se(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 qe(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ft(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ft(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 x=u.get,v=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return x.call(this)},set:function(j){i=""+j,v.call(this,j)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return i},setValue:function(j){i=""+j},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function _t(t){if(!t._valueTracker){var a=ft(t)?"checked":"value";t._valueTracker=Ft(t,a,""+t[a])}}function nn(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=ft(t)?t.checked?"true":"false":t.value),t=u,t!==i?(a.setValue(t),!0):!1}function Cn(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 Vr=/[\n"\\]/g;function un(t){return t.replace(Vr,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function br(t,a,i,u,x,v,j,D){t.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.type=j:t.removeAttribute("type"),a!=null?j==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+qe(a)):t.value!==""+qe(a)&&(t.value=""+qe(a)):j!=="submit"&&j!=="reset"||t.removeAttribute("value"),a!=null?Is(t,j,qe(a)):i!=null?Is(t,j,qe(i)):u!=null&&t.removeAttribute("value"),x==null&&v!=null&&(t.defaultChecked=!!v),x!=null&&(t.checked=x&&typeof x!="function"&&typeof x!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?t.name=""+qe(D):t.removeAttribute("name")}function hl(t,a,i,u,x,v,j,D){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),a!=null||i!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){_t(t);return}i=i!=null?""+qe(i):"",a=a!=null?""+qe(a):i,D||a===t.value||(t.value=a),t.defaultValue=a}u=u??x,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=D?t.checked:!!u,t.defaultChecked=!!u,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(t.name=j),_t(t)}function Is(t,a,i){a==="number"&&Cn(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function Dn(t,a,i,u){if(t=t.options,a){a={};for(var x=0;x<i.length;x++)a["$"+i[x]]=!0;for(i=0;i<t.length;i++)x=a.hasOwnProperty("$"+t[i].value),t[i].selected!==x&&(t[i].selected=x),x&&u&&(t[i].defaultSelected=!0)}else{for(i=""+qe(i),a=null,x=0;x<t.length;x++){if(t[x].value===i){t[x].selected=!0,u&&(t[x].defaultSelected=!0);return}a!==null||t[x].disabled||(a=t[x])}a!==null&&(a.selected=!0)}}function tc(t,a,i){if(a!=null&&(a=""+qe(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+qe(i):""}function nc(t,a,i,u){if(a==null){if(u!=null){if(i!=null)throw Error(l(92));if(U(u)){if(1<u.length)throw Error(l(93));u=u[0]}i=u}i==null&&(i=""),a=i}i=qe(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),_t(t)}function Gr(t,a){if(a){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=a;return}}t.textContent=a}var Ed=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 ui(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||Ed.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function di(t,a,i){if(a!=null&&typeof a!="object")throw Error(l(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 x in a)u=a[x],a.hasOwnProperty(x)&&i[x]!==u&&ui(t,x,u)}else for(var v in a)a.hasOwnProperty(v)&&ui(t,v,a[v])}function le(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 je=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"]]),Fe=/^[\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 pt(t){return Fe.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function it(){}var Ma=null;function _s(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ls=null,Wr=null;function ug(t){var a=ar(t);if(a&&(t=a.stateNode)){var i=t[Qt]||null;e:switch(t=a.stateNode,a.type){case"input":if(br(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="'+un(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var x=u[Qt]||null;if(!x)throw Error(l(90));br(u,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&nn(u)}break e;case"textarea":tc(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Dn(t,!!i.multiple,a,!1)}}}var Ad=!1;function dg(t,a,i){if(Ad)return t(a,i);Ad=!0;try{var u=t(a);return u}finally{if(Ad=!1,(Ls!==null||Wr!==null)&&(Fc(),Ls&&(a=Ls,t=Wr,Wr=Ls=null,ug(a),t)))for(a=0;a<t.length;a++)ug(t[a])}}function fi(t,a){var i=t.stateNode;if(i===null)return null;var u=i[Qt]||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(l(231,a,typeof i));return i}var vr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rd=!1;if(vr)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){Rd=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{Rd=!1}var Kr=null,Id=null,ac=null;function fg(){if(ac)return ac;var t,a=Id,i=a.length,u,x="value"in Kr?Kr.value:Kr.textContent,v=x.length;for(t=0;t<i&&a[t]===x[t];t++);var j=i-t;for(u=1;u<=j&&a[i-u]===x[v-u];u++);return ac=x.slice(t,1<u?1-u:void 0)}function rc(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 sc(){return!0}function mg(){return!1}function Wn(t){function a(i,u,x,v,j){this._reactName=i,this._targetInst=x,this.type=u,this.nativeEvent=v,this.target=j,this.currentTarget=null;for(var D in t)t.hasOwnProperty(D)&&(i=t[D],this[D]=i?i(v):v[D]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?sc:mg,this.isPropagationStopped=mg,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=sc)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=sc)},persist:function(){},isPersistent:sc}),a}var Os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lc=Wn(Os),hi=y({},Os,{view:0,detail:0}),SS=Wn(hi),_d,Ld,pi,ic=y({},hi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dd,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!==pi&&(pi&&t.type==="mousemove"?(_d=t.screenX-pi.screenX,Ld=t.screenY-pi.screenY):Ld=_d=0,pi=t),_d)},movementY:function(t){return"movementY"in t?t.movementY:Ld}}),hg=Wn(ic),jS=y({},ic,{dataTransfer:0}),NS=Wn(jS),CS=y({},hi,{relatedTarget:0}),Od=Wn(CS),TS=y({},Os,{animationName:0,elapsedTime:0,pseudoElement:0}),MS=Wn(TS),ES=y({},Os,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),AS=Wn(ES),RS=y({},Os,{data:0}),pg=Wn(RS),IS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_S={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"},LS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function OS(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=LS[t])?!!a[t]:!1}function Dd(){return OS}var DS=y({},hi,{key:function(t){if(t.key){var a=IS[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=rc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?_S[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dd,charCode:function(t){return t.type==="keypress"?rc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?rc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),zS=Wn(DS),US=y({},ic,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gg=Wn(US),$S=y({},hi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dd}),BS=Wn($S),HS=y({},Os,{propertyName:0,elapsedTime:0,pseudoElement:0}),PS=Wn(HS),FS=y({},ic,{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}),qS=Wn(FS),VS=y({},Os,{newState:0,oldState:0}),GS=Wn(VS),WS=[9,13,27,32],zd=vr&&"CompositionEvent"in window,gi=null;vr&&"documentMode"in document&&(gi=document.documentMode);var KS=vr&&"TextEvent"in window&&!gi,xg=vr&&(!zd||gi&&8<gi&&11>=gi),yg=" ",bg=!1;function vg(t,a){switch(t){case"keyup":return WS.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var pl=!1;function YS(t,a){switch(t){case"compositionend":return kg(a);case"keypress":return a.which!==32?null:(bg=!0,yg);case"textInput":return t=a.data,t===yg&&bg?null:t;default:return null}}function QS(t,a){if(pl)return t==="compositionend"||!zd&&vg(t,a)?(t=fg(),ac=Id=Kr=null,pl=!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 xg&&a.locale!=="ko"?null:a.data;default:return null}}var XS={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 wg(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!XS[t.type]:a==="textarea"}function Sg(t,a,i,u){Ls?Wr?Wr.push(u):Wr=[u]:Ls=u,a=Qc(a,"onChange"),0<a.length&&(i=new lc("onChange","change",null,i,u),t.push({event:i,listeners:a}))}var xi=null,yi=null;function ZS(t){sy(t,0)}function oc(t){var a=rr(t);if(nn(a))return t}function jg(t,a){if(t==="change")return a}var Ng=!1;if(vr){var Ud;if(vr){var $d="oninput"in document;if(!$d){var Cg=document.createElement("div");Cg.setAttribute("oninput","return;"),$d=typeof Cg.oninput=="function"}Ud=$d}else Ud=!1;Ng=Ud&&(!document.documentMode||9<document.documentMode)}function Tg(){xi&&(xi.detachEvent("onpropertychange",Mg),yi=xi=null)}function Mg(t){if(t.propertyName==="value"&&oc(yi)){var a=[];Sg(a,yi,t,_s(t)),dg(ZS,a)}}function JS(t,a,i){t==="focusin"?(Tg(),xi=a,yi=i,xi.attachEvent("onpropertychange",Mg)):t==="focusout"&&Tg()}function ej(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return oc(yi)}function tj(t,a){if(t==="click")return oc(a)}function nj(t,a){if(t==="input"||t==="change")return oc(a)}function aj(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var ca=typeof Object.is=="function"?Object.is:aj;function bi(t,a){if(ca(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 x=i[u];if(!tn.call(a,x)||!ca(t[x],a[x]))return!1}return!0}function Eg(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ag(t,a){var i=Eg(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=Eg(i)}}function Rg(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?Rg(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function Ig(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Cn(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=Cn(t.document)}return a}function Bd(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 rj=vr&&"documentMode"in document&&11>=document.documentMode,gl=null,Hd=null,vi=null,Pd=!1;function _g(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Pd||gl==null||gl!==Cn(u)||(u=gl,"selectionStart"in u&&Bd(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}),vi&&bi(vi,u)||(vi=u,u=Qc(Hd,"onSelect"),0<u.length&&(a=new lc("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=gl)))}function Ds(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var xl={animationend:Ds("Animation","AnimationEnd"),animationiteration:Ds("Animation","AnimationIteration"),animationstart:Ds("Animation","AnimationStart"),transitionrun:Ds("Transition","TransitionRun"),transitionstart:Ds("Transition","TransitionStart"),transitioncancel:Ds("Transition","TransitionCancel"),transitionend:Ds("Transition","TransitionEnd")},Fd={},Lg={};vr&&(Lg=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function zs(t){if(Fd[t])return Fd[t];if(!xl[t])return t;var a=xl[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in Lg)return Fd[t]=a[i];return t}var Og=zs("animationend"),Dg=zs("animationiteration"),zg=zs("animationstart"),sj=zs("transitionrun"),lj=zs("transitionstart"),ij=zs("transitioncancel"),Ug=zs("transitionend"),$g=new Map,qd="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(" ");qd.push("scrollEnd");function Va(t,a){$g.set(t,a),Hn(a,[t])}var cc=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)},Ea=[],yl=0,Vd=0;function uc(){for(var t=yl,a=Vd=yl=0;a<t;){var i=Ea[a];Ea[a++]=null;var u=Ea[a];Ea[a++]=null;var x=Ea[a];Ea[a++]=null;var v=Ea[a];if(Ea[a++]=null,u!==null&&x!==null){var j=u.pending;j===null?x.next=x:(x.next=j.next,j.next=x),u.pending=x}v!==0&&Bg(i,x,v)}}function dc(t,a,i,u){Ea[yl++]=t,Ea[yl++]=a,Ea[yl++]=i,Ea[yl++]=u,Vd|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Gd(t,a,i,u){return dc(t,a,i,u),fc(t)}function Us(t,a){return dc(t,null,null,a),fc(t)}function Bg(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var x=!1,v=t.return;v!==null;)v.childLanes|=i,u=v.alternate,u!==null&&(u.childLanes|=i),v.tag===22&&(t=v.stateNode,t===null||t._visibility&1||(x=!0)),t=v,v=v.return;return t.tag===3?(v=t.stateNode,x&&a!==null&&(x=31-Ve(i),t=v.hiddenUpdates,u=t[x],u===null?t[x]=[a]:u.push(a),a.lane=i|536870912),v):null}function fc(t){if(50<Pi)throw Pi=0,nm=null,Error(l(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var bl={};function oj(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 ua(t,a,i,u){return new oj(t,a,i,u)}function Wd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function kr(t,a){var i=t.alternate;return i===null?(i=ua(t.tag,a,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=a,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&65011712,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,a=t.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i.refCleanup=t.refCleanup,i}function Hg(t,a){t.flags&=65011714;var i=t.alternate;return i===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=i.childLanes,t.lanes=i.lanes,t.child=i.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=i.memoizedProps,t.memoizedState=i.memoizedState,t.updateQueue=i.updateQueue,t.type=i.type,a=i.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function mc(t,a,i,u,x,v){var j=0;if(u=t,typeof t=="function")Wd(t)&&(j=1);else if(typeof t=="string")j=m5(t,i,Q.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Z:return t=ua(31,i,a,x),t.elementType=Z,t.lanes=v,t;case T:return $s(i.children,x,v,a);case E:j=8,x|=24;break;case M:return t=ua(12,i,a,x|2),t.elementType=M,t.lanes=v,t;case H:return t=ua(13,i,a,x),t.elementType=H,t.lanes=v,t;case I:return t=ua(19,i,a,x),t.elementType=I,t.lanes=v,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case O:j=10;break e;case L:j=9;break e;case P:j=11;break e;case F:j=14;break e;case K:j=16,u=null;break e}j=29,i=Error(l(130,t===null?"null":typeof t,"")),u=null}return a=ua(j,i,a,x),a.elementType=t,a.type=u,a.lanes=v,a}function $s(t,a,i,u){return t=ua(7,t,u,a),t.lanes=i,t}function Kd(t,a,i){return t=ua(6,t,null,a),t.lanes=i,t}function Pg(t){var a=ua(18,null,null,0);return a.stateNode=t,a}function Yd(t,a,i){return a=ua(4,t.children!==null?t.children:[],t.key,a),a.lanes=i,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Fg=new WeakMap;function Aa(t,a){if(typeof t=="object"&&t!==null){var i=Fg.get(t);return i!==void 0?i:(a={value:t,source:a,stack:en(a)},Fg.set(t,a),a)}return{value:t,source:a,stack:en(a)}}var vl=[],kl=0,hc=null,ki=0,Ra=[],Ia=0,Yr=null,ir=1,or="";function wr(t,a){vl[kl++]=ki,vl[kl++]=hc,hc=t,ki=a}function qg(t,a,i){Ra[Ia++]=ir,Ra[Ia++]=or,Ra[Ia++]=Yr,Yr=t;var u=ir;t=or;var x=32-Ve(u)-1;u&=~(1<<x),i+=1;var v=32-Ve(a)+x;if(30<v){var j=x-x%5;v=(u&(1<<j)-1).toString(32),u>>=j,x-=j,ir=1<<32-Ve(a)+x|i<<x|u,or=v+t}else ir=1<<v|i<<x|u,or=t}function Qd(t){t.return!==null&&(wr(t,1),qg(t,1,0))}function Xd(t){for(;t===hc;)hc=vl[--kl],vl[kl]=null,ki=vl[--kl],vl[kl]=null;for(;t===Yr;)Yr=Ra[--Ia],Ra[Ia]=null,or=Ra[--Ia],Ra[Ia]=null,ir=Ra[--Ia],Ra[Ia]=null}function Vg(t,a){Ra[Ia++]=ir,Ra[Ia++]=or,Ra[Ia++]=Yr,ir=a.id,or=a.overflow,Yr=t}var En=null,$t=null,mt=!1,Qr=null,_a=!1,Zd=Error(l(519));function Xr(t){var a=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wi(Aa(a,t)),Zd}function Gg(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[bt]=t,a[Qt]=u,i){case"dialog":at("cancel",a),at("close",a);break;case"iframe":case"object":case"embed":at("load",a);break;case"video":case"audio":for(i=0;i<qi.length;i++)at(qi[i],a);break;case"source":at("error",a);break;case"img":case"image":case"link":at("error",a),at("load",a);break;case"details":at("toggle",a);break;case"input":at("invalid",a),hl(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":at("invalid",a);break;case"textarea":at("invalid",a),nc(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||cy(a.textContent,i)?(u.popover!=null&&(at("beforetoggle",a),at("toggle",a)),u.onScroll!=null&&at("scroll",a),u.onScrollEnd!=null&&at("scrollend",a),u.onClick!=null&&(a.onclick=it),a=!0):a=!1,a||Xr(t,!0)}function Wg(t){for(En=t.return;En;)switch(En.tag){case 5:case 31:case 13:_a=!1;return;case 27:case 3:_a=!0;return;default:En=En.return}}function wl(t){if(t!==En)return!1;if(!mt)return Wg(t),mt=!0,!1;var a=t.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||xm(t.type,t.memoizedProps)),i=!i),i&&$t&&Xr(t),Wg(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));$t=yy(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));$t=yy(t)}else a===27?(a=$t,ds(t.type)?(t=wm,wm=null,$t=t):$t=a):$t=En?Oa(t.stateNode.nextSibling):null;return!0}function Bs(){$t=En=null,mt=!1}function Jd(){var t=Qr;return t!==null&&(Xn===null?Xn=t:Xn.push.apply(Xn,t),Qr=null),t}function wi(t){Qr===null?Qr=[t]:Qr.push(t)}var ef=_(null),Hs=null,Sr=null;function Zr(t,a,i){C(ef,a._currentValue),a._currentValue=i}function jr(t){t._currentValue=ef.current,R(ef)}function tf(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 nf(t,a,i,u){var x=t.child;for(x!==null&&(x.return=t);x!==null;){var v=x.dependencies;if(v!==null){var j=x.child;v=v.firstContext;e:for(;v!==null;){var D=v;v=x;for(var G=0;G<a.length;G++)if(D.context===a[G]){v.lanes|=i,D=v.alternate,D!==null&&(D.lanes|=i),tf(v.return,i,t),u||(j=null);break e}v=D.next}}else if(x.tag===18){if(j=x.return,j===null)throw Error(l(341));j.lanes|=i,v=j.alternate,v!==null&&(v.lanes|=i),tf(j,i,t),j=null}else j=x.child;if(j!==null)j.return=x;else for(j=x;j!==null;){if(j===t){j=null;break}if(x=j.sibling,x!==null){x.return=j.return,j=x;break}j=j.return}x=j}}function Sl(t,a,i,u){t=null;for(var x=a,v=!1;x!==null;){if(!v){if((x.flags&524288)!==0)v=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var j=x.alternate;if(j===null)throw Error(l(387));if(j=j.memoizedProps,j!==null){var D=x.type;ca(x.pendingProps.value,j.value)||(t!==null?t.push(D):t=[D])}}else if(x===he.current){if(j=x.alternate,j===null)throw Error(l(387));j.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(t!==null?t.push(Yi):t=[Yi])}x=x.return}t!==null&&nf(a,t,i,u),a.flags|=262144}function pc(t){for(t=t.firstContext;t!==null;){if(!ca(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ps(t){Hs=t,Sr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function An(t){return Kg(Hs,t)}function gc(t,a){return Hs===null&&Ps(t),Kg(t,a)}function Kg(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},Sr===null){if(t===null)throw Error(l(308));Sr=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else Sr=Sr.next=a;return i}var cj=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()})}},uj=e.unstable_scheduleCallback,dj=e.unstable_NormalPriority,dn={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function af(){return{controller:new cj,data:new Map,refCount:0}}function Si(t){t.refCount--,t.refCount===0&&uj(dj,function(){t.controller.abort()})}var ji=null,rf=0,jl=0,Nl=null;function fj(t,a){if(ji===null){var i=ji=[];rf=0,jl=om(),Nl={status:"pending",value:void 0,then:function(u){i.push(u)}}}return rf++,a.then(Yg,Yg),a}function Yg(){if(--rf===0&&ji!==null){Nl!==null&&(Nl.status="fulfilled");var t=ji;ji=null,jl=0,Nl=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function mj(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(x){i.push(x)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var x=0;x<i.length;x++)(0,i[x])(a)},function(x){for(u.status="rejected",u.reason=x,x=0;x<i.length;x++)(0,i[x])(void 0)}),u}var Qg=V.S;V.S=function(t,a){_x=st(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&fj(t,a),Qg!==null&&Qg(t,a)};var Fs=_(null);function sf(){var t=Fs.current;return t!==null?t:Lt.pooledCache}function xc(t,a){a===null?C(Fs,Fs.current):C(Fs,a.pool)}function Xg(){var t=sf();return t===null?null:{parent:dn._currentValue,pool:t}}var Cl=Error(l(460)),lf=Error(l(474)),yc=Error(l(542)),bc={then:function(){}};function Zg(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Jg(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then(it,it),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,t0(t),t;default:if(typeof a.status=="string")a.then(it,it);else{if(t=Lt,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=u}},function(u){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,t0(t),t}throw Vs=a,Cl}}function qs(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Vs=i,Cl):i}}var Vs=null;function e0(){if(Vs===null)throw Error(l(459));var t=Vs;return Vs=null,t}function t0(t){if(t===Cl||t===yc)throw Error(l(483))}var Tl=null,Ni=0;function vc(t){var a=Ni;return Ni+=1,Tl===null&&(Tl=[]),Jg(Tl,t,a)}function Ci(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function kc(t,a){throw a.$$typeof===k?Error(l(525)):(t=Object.prototype.toString.call(a),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function n0(t){function a(J,Y){if(t){var ne=J.deletions;ne===null?(J.deletions=[Y],J.flags|=16):ne.push(Y)}}function i(J,Y){if(!t)return null;for(;Y!==null;)a(J,Y),Y=Y.sibling;return null}function u(J){for(var Y=new Map;J!==null;)J.key!==null?Y.set(J.key,J):Y.set(J.index,J),J=J.sibling;return Y}function x(J,Y){return J=kr(J,Y),J.index=0,J.sibling=null,J}function v(J,Y,ne){return J.index=ne,t?(ne=J.alternate,ne!==null?(ne=ne.index,ne<Y?(J.flags|=67108866,Y):ne):(J.flags|=67108866,Y)):(J.flags|=1048576,Y)}function j(J){return t&&J.alternate===null&&(J.flags|=67108866),J}function D(J,Y,ne,pe){return Y===null||Y.tag!==6?(Y=Kd(ne,J.mode,pe),Y.return=J,Y):(Y=x(Y,ne),Y.return=J,Y)}function G(J,Y,ne,pe){var ze=ne.type;return ze===T?fe(J,Y,ne.props.children,pe,ne.key):Y!==null&&(Y.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===K&&qs(ze)===Y.type)?(Y=x(Y,ne.props),Ci(Y,ne),Y.return=J,Y):(Y=mc(ne.type,ne.key,ne.props,null,J.mode,pe),Ci(Y,ne),Y.return=J,Y)}function se(J,Y,ne,pe){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ne.containerInfo||Y.stateNode.implementation!==ne.implementation?(Y=Yd(ne,J.mode,pe),Y.return=J,Y):(Y=x(Y,ne.children||[]),Y.return=J,Y)}function fe(J,Y,ne,pe,ze){return Y===null||Y.tag!==7?(Y=$s(ne,J.mode,pe,ze),Y.return=J,Y):(Y=x(Y,ne),Y.return=J,Y)}function ge(J,Y,ne){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=Kd(""+Y,J.mode,ne),Y.return=J,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case w:return ne=mc(Y.type,Y.key,Y.props,null,J.mode,ne),Ci(ne,Y),ne.return=J,ne;case S:return Y=Yd(Y,J.mode,ne),Y.return=J,Y;case K:return Y=qs(Y),ge(J,Y,ne)}if(U(Y)||A(Y))return Y=$s(Y,J.mode,ne,null),Y.return=J,Y;if(typeof Y.then=="function")return ge(J,vc(Y),ne);if(Y.$$typeof===O)return ge(J,gc(J,Y),ne);kc(J,Y)}return null}function oe(J,Y,ne,pe){var ze=Y!==null?Y.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ze!==null?null:D(J,Y,""+ne,pe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:return ne.key===ze?G(J,Y,ne,pe):null;case S:return ne.key===ze?se(J,Y,ne,pe):null;case K:return ne=qs(ne),oe(J,Y,ne,pe)}if(U(ne)||A(ne))return ze!==null?null:fe(J,Y,ne,pe,null);if(typeof ne.then=="function")return oe(J,Y,vc(ne),pe);if(ne.$$typeof===O)return oe(J,Y,gc(J,ne),pe);kc(J,ne)}return null}function de(J,Y,ne,pe,ze){if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return J=J.get(ne)||null,D(Y,J,""+pe,ze);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case w:return J=J.get(pe.key===null?ne:pe.key)||null,G(Y,J,pe,ze);case S:return J=J.get(pe.key===null?ne:pe.key)||null,se(Y,J,pe,ze);case K:return pe=qs(pe),de(J,Y,ne,pe,ze)}if(U(pe)||A(pe))return J=J.get(ne)||null,fe(Y,J,pe,ze,null);if(typeof pe.then=="function")return de(J,Y,ne,vc(pe),ze);if(pe.$$typeof===O)return de(J,Y,ne,gc(Y,pe),ze);kc(Y,pe)}return null}function Re(J,Y,ne,pe){for(var ze=null,vt=null,Le=Y,Je=Y=0,ct=null;Le!==null&&Je<ne.length;Je++){Le.index>Je?(ct=Le,Le=null):ct=Le.sibling;var kt=oe(J,Le,ne[Je],pe);if(kt===null){Le===null&&(Le=ct);break}t&&Le&&kt.alternate===null&&a(J,Le),Y=v(kt,Y,Je),vt===null?ze=kt:vt.sibling=kt,vt=kt,Le=ct}if(Je===ne.length)return i(J,Le),mt&&wr(J,Je),ze;if(Le===null){for(;Je<ne.length;Je++)Le=ge(J,ne[Je],pe),Le!==null&&(Y=v(Le,Y,Je),vt===null?ze=Le:vt.sibling=Le,vt=Le);return mt&&wr(J,Je),ze}for(Le=u(Le);Je<ne.length;Je++)ct=de(Le,J,Je,ne[Je],pe),ct!==null&&(t&&ct.alternate!==null&&Le.delete(ct.key===null?Je:ct.key),Y=v(ct,Y,Je),vt===null?ze=ct:vt.sibling=ct,vt=ct);return t&&Le.forEach(function(gs){return a(J,gs)}),mt&&wr(J,Je),ze}function Be(J,Y,ne,pe){if(ne==null)throw Error(l(151));for(var ze=null,vt=null,Le=Y,Je=Y=0,ct=null,kt=ne.next();Le!==null&&!kt.done;Je++,kt=ne.next()){Le.index>Je?(ct=Le,Le=null):ct=Le.sibling;var gs=oe(J,Le,kt.value,pe);if(gs===null){Le===null&&(Le=ct);break}t&&Le&&gs.alternate===null&&a(J,Le),Y=v(gs,Y,Je),vt===null?ze=gs:vt.sibling=gs,vt=gs,Le=ct}if(kt.done)return i(J,Le),mt&&wr(J,Je),ze;if(Le===null){for(;!kt.done;Je++,kt=ne.next())kt=ge(J,kt.value,pe),kt!==null&&(Y=v(kt,Y,Je),vt===null?ze=kt:vt.sibling=kt,vt=kt);return mt&&wr(J,Je),ze}for(Le=u(Le);!kt.done;Je++,kt=ne.next())kt=de(Le,J,Je,kt.value,pe),kt!==null&&(t&&kt.alternate!==null&&Le.delete(kt.key===null?Je:kt.key),Y=v(kt,Y,Je),vt===null?ze=kt:vt.sibling=kt,vt=kt);return t&&Le.forEach(function(j5){return a(J,j5)}),mt&&wr(J,Je),ze}function Rt(J,Y,ne,pe){if(typeof ne=="object"&&ne!==null&&ne.type===T&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:e:{for(var ze=ne.key;Y!==null;){if(Y.key===ze){if(ze=ne.type,ze===T){if(Y.tag===7){i(J,Y.sibling),pe=x(Y,ne.props.children),pe.return=J,J=pe;break e}}else if(Y.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===K&&qs(ze)===Y.type){i(J,Y.sibling),pe=x(Y,ne.props),Ci(pe,ne),pe.return=J,J=pe;break e}i(J,Y);break}else a(J,Y);Y=Y.sibling}ne.type===T?(pe=$s(ne.props.children,J.mode,pe,ne.key),pe.return=J,J=pe):(pe=mc(ne.type,ne.key,ne.props,null,J.mode,pe),Ci(pe,ne),pe.return=J,J=pe)}return j(J);case S:e:{for(ze=ne.key;Y!==null;){if(Y.key===ze)if(Y.tag===4&&Y.stateNode.containerInfo===ne.containerInfo&&Y.stateNode.implementation===ne.implementation){i(J,Y.sibling),pe=x(Y,ne.children||[]),pe.return=J,J=pe;break e}else{i(J,Y);break}else a(J,Y);Y=Y.sibling}pe=Yd(ne,J.mode,pe),pe.return=J,J=pe}return j(J);case K:return ne=qs(ne),Rt(J,Y,ne,pe)}if(U(ne))return Re(J,Y,ne,pe);if(A(ne)){if(ze=A(ne),typeof ze!="function")throw Error(l(150));return ne=ze.call(ne),Be(J,Y,ne,pe)}if(typeof ne.then=="function")return Rt(J,Y,vc(ne),pe);if(ne.$$typeof===O)return Rt(J,Y,gc(J,ne),pe);kc(J,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Y!==null&&Y.tag===6?(i(J,Y.sibling),pe=x(Y,ne),pe.return=J,J=pe):(i(J,Y),pe=Kd(ne,J.mode,pe),pe.return=J,J=pe),j(J)):i(J,Y)}return function(J,Y,ne,pe){try{Ni=0;var ze=Rt(J,Y,ne,pe);return Tl=null,ze}catch(Le){if(Le===Cl||Le===yc)throw Le;var vt=ua(29,Le,null,J.mode);return vt.lanes=pe,vt.return=J,vt}}}var Gs=n0(!0),a0=n0(!1),Jr=!1;function of(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cf(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 es(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ts(t,a,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(St&2)!==0){var x=u.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),u.pending=a,a=fc(t),Bg(t,null,i),a}return dc(t,u,a,i),fc(t)}function Ti(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,ia(t,i)}}function uf(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var x=null,v=null;if(i=i.firstBaseUpdate,i!==null){do{var j={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};v===null?x=v=j:v=v.next=j,i=i.next}while(i!==null);v===null?x=v=a:v=v.next=a}else x=v=a;i={baseState:u.baseState,firstBaseUpdate:x,lastBaseUpdate:v,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 df=!1;function Mi(){if(df){var t=Nl;if(t!==null)throw t}}function Ei(t,a,i,u){df=!1;var x=t.updateQueue;Jr=!1;var v=x.firstBaseUpdate,j=x.lastBaseUpdate,D=x.shared.pending;if(D!==null){x.shared.pending=null;var G=D,se=G.next;G.next=null,j===null?v=se:j.next=se,j=G;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,D=fe.lastBaseUpdate,D!==j&&(D===null?fe.firstBaseUpdate=se:D.next=se,fe.lastBaseUpdate=G))}if(v!==null){var ge=x.baseState;j=0,fe=se=G=null,D=v;do{var oe=D.lane&-536870913,de=oe!==D.lane;if(de?(ot&oe)===oe:(u&oe)===oe){oe!==0&&oe===jl&&(df=!0),fe!==null&&(fe=fe.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var Re=t,Be=D;oe=a;var Rt=i;switch(Be.tag){case 1:if(Re=Be.payload,typeof Re=="function"){ge=Re.call(Rt,ge,oe);break e}ge=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Be.payload,oe=typeof Re=="function"?Re.call(Rt,ge,oe):Re,oe==null)break e;ge=y({},ge,oe);break e;case 2:Jr=!0}}oe=D.callback,oe!==null&&(t.flags|=64,de&&(t.flags|=8192),de=x.callbacks,de===null?x.callbacks=[oe]:de.push(oe))}else de={lane:oe,tag:D.tag,payload:D.payload,callback:D.callback,next:null},fe===null?(se=fe=de,G=ge):fe=fe.next=de,j|=oe;if(D=D.next,D===null){if(D=x.shared.pending,D===null)break;de=D,D=de.next,de.next=null,x.lastBaseUpdate=de,x.shared.pending=null}}while(!0);fe===null&&(G=ge),x.baseState=G,x.firstBaseUpdate=se,x.lastBaseUpdate=fe,v===null&&(x.shared.lanes=0),ls|=j,t.lanes=j,t.memoizedState=ge}}function r0(t,a){if(typeof t!="function")throw Error(l(191,t));t.call(a)}function s0(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)r0(i[t],a)}var Ml=_(null),wc=_(0);function l0(t,a){t=_r,C(wc,t),C(Ml,a),_r=t|a.baseLanes}function ff(){C(wc,_r),C(Ml,Ml.current)}function mf(){_r=wc.current,R(Ml),R(wc)}var da=_(null),La=null;function ns(t){var a=t.alternate;C(an,an.current&1),C(da,t),La===null&&(a===null||Ml.current!==null||a.memoizedState!==null)&&(La=t)}function hf(t){C(an,an.current),C(da,t),La===null&&(La=t)}function i0(t){t.tag===22?(C(an,an.current),C(da,t),La===null&&(La=t)):as()}function as(){C(an,an.current),C(da,da.current)}function fa(t){R(da),La===t&&(La=null),R(an)}var an=_(0);function Sc(t){for(var a=t;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||vm(i)||km(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 Nr=0,Ze=null,Et=null,fn=null,jc=!1,El=!1,Ws=!1,Nc=0,Ai=0,Al=null,hj=0;function Zt(){throw Error(l(321))}function pf(t,a){if(a===null)return!1;for(var i=0;i<a.length&&i<t.length;i++)if(!ca(t[i],a[i]))return!1;return!0}function gf(t,a,i,u,x,v){return Nr=v,Ze=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,V.H=t===null||t.memoizedState===null?q0:Rf,Ws=!1,v=i(u,x),Ws=!1,El&&(v=c0(a,i,u,x)),o0(t),v}function o0(t){V.H=_i;var a=Et!==null&&Et.next!==null;if(Nr=0,fn=Et=Ze=null,jc=!1,Ai=0,Al=null,a)throw Error(l(300));t===null||mn||(t=t.dependencies,t!==null&&pc(t)&&(mn=!0))}function c0(t,a,i,u){Ze=t;var x=0;do{if(El&&(Al=null),Ai=0,El=!1,25<=x)throw Error(l(301));if(x+=1,fn=Et=null,t.updateQueue!=null){var v=t.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}V.H=V0,v=a(i,u)}while(El);return v}function pj(){var t=V.H,a=t.useState()[0];return a=typeof a.then=="function"?Ri(a):a,t=t.useState()[0],(Et!==null?Et.memoizedState:null)!==t&&(Ze.flags|=1024),a}function xf(){var t=Nc!==0;return Nc=0,t}function yf(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function bf(t){if(jc){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}jc=!1}Nr=0,fn=Et=Ze=null,El=!1,Ai=Nc=0,Al=null}function Pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?Ze.memoizedState=fn=t:fn=fn.next=t,fn}function rn(){if(Et===null){var t=Ze.alternate;t=t!==null?t.memoizedState:null}else t=Et.next;var a=fn===null?Ze.memoizedState:fn.next;if(a!==null)fn=a,Et=t;else{if(t===null)throw Ze.alternate===null?Error(l(467)):Error(l(310));Et=t,t={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},fn===null?Ze.memoizedState=fn=t:fn=fn.next=t}return fn}function Cc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ri(t){var a=Ai;return Ai+=1,Al===null&&(Al=[]),t=Jg(Al,t,a),a=Ze,(fn===null?a.memoizedState:fn.next)===null&&(a=a.alternate,V.H=a===null||a.memoizedState===null?q0:Rf),t}function Tc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ri(t);if(t.$$typeof===O)return An(t)}throw Error(l(438,String(t)))}function vf(t){var a=null,i=Ze.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var u=Ze.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=Cc(),Ze.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]=z;return a.index++,i}function Cr(t,a){return typeof a=="function"?a(t):a}function Mc(t){var a=rn();return kf(a,Et,t)}function kf(t,a,i){var u=t.queue;if(u===null)throw Error(l(311));u.lastRenderedReducer=i;var x=t.baseQueue,v=u.pending;if(v!==null){if(x!==null){var j=x.next;x.next=v.next,v.next=j}a.baseQueue=x=v,u.pending=null}if(v=t.baseState,x===null)t.memoizedState=v;else{a=x.next;var D=j=null,G=null,se=a,fe=!1;do{var ge=se.lane&-536870913;if(ge!==se.lane?(ot&ge)===ge:(Nr&ge)===ge){var oe=se.revertLane;if(oe===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),ge===jl&&(fe=!0);else if((Nr&oe)===oe){se=se.next,oe===jl&&(fe=!0);continue}else ge={lane:0,revertLane:se.revertLane,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},G===null?(D=G=ge,j=v):G=G.next=ge,Ze.lanes|=oe,ls|=oe;ge=se.action,Ws&&i(v,ge),v=se.hasEagerState?se.eagerState:i(v,ge)}else oe={lane:ge,revertLane:se.revertLane,gesture:se.gesture,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},G===null?(D=G=oe,j=v):G=G.next=oe,Ze.lanes|=ge,ls|=ge;se=se.next}while(se!==null&&se!==a);if(G===null?j=v:G.next=D,!ca(v,t.memoizedState)&&(mn=!0,fe&&(i=Nl,i!==null)))throw i;t.memoizedState=v,t.baseState=j,t.baseQueue=G,u.lastRenderedState=v}return x===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function wf(t){var a=rn(),i=a.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=t;var u=i.dispatch,x=i.pending,v=a.memoizedState;if(x!==null){i.pending=null;var j=x=x.next;do v=t(v,j.action),j=j.next;while(j!==x);ca(v,a.memoizedState)||(mn=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),i.lastRenderedState=v}return[v,u]}function u0(t,a,i){var u=Ze,x=rn(),v=mt;if(v){if(i===void 0)throw Error(l(407));i=i()}else i=a();var j=!ca((Et||x).memoizedState,i);if(j&&(x.memoizedState=i,mn=!0),x=x.queue,Nf(m0.bind(null,u,x,t),[t]),x.getSnapshot!==a||j||fn!==null&&fn.memoizedState.tag&1){if(u.flags|=2048,Rl(9,{destroy:void 0},f0.bind(null,u,x,i,a),null),Lt===null)throw Error(l(349));v||(Nr&127)!==0||d0(u,a,i)}return i}function d0(t,a,i){t.flags|=16384,t={getSnapshot:a,value:i},a=Ze.updateQueue,a===null?(a=Cc(),Ze.updateQueue=a,a.stores=[t]):(i=a.stores,i===null?a.stores=[t]:i.push(t))}function f0(t,a,i,u){a.value=i,a.getSnapshot=u,h0(a)&&p0(t)}function m0(t,a,i){return i(function(){h0(a)&&p0(t)})}function h0(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!ca(t,i)}catch{return!0}}function p0(t){var a=Us(t,2);a!==null&&Zn(a,t,2)}function Sf(t){var a=Pn();if(typeof t=="function"){var i=t;if(t=i(),Ws){$e(!0);try{i()}finally{$e(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cr,lastRenderedState:t},a}function g0(t,a,i,u){return t.baseState=i,kf(t,Et,typeof u=="function"?u:Cr)}function gj(t,a,i,u,x){if(Rc(t))throw Error(l(485));if(t=a.action,t!==null){var v={payload:x,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){v.listeners.push(j)}};V.T!==null?i(!0):v.isTransition=!1,u(v),i=a.pending,i===null?(v.next=a.pending=v,x0(a,v)):(v.next=i.next,a.pending=i.next=v)}}function x0(t,a){var i=a.action,u=a.payload,x=t.state;if(a.isTransition){var v=V.T,j={};V.T=j;try{var D=i(x,u),G=V.S;G!==null&&G(j,D),y0(t,a,D)}catch(se){jf(t,a,se)}finally{v!==null&&j.types!==null&&(v.types=j.types),V.T=v}}else try{v=i(x,u),y0(t,a,v)}catch(se){jf(t,a,se)}}function y0(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){b0(t,a,u)},function(u){return jf(t,a,u)}):b0(t,a,i)}function b0(t,a,i){a.status="fulfilled",a.value=i,v0(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,x0(t,i)))}function jf(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,v0(a),a=a.next;while(a!==u)}t.action=null}function v0(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function k0(t,a){return a}function w0(t,a){if(mt){var i=Lt.formState;if(i!==null){e:{var u=Ze;if(mt){if($t){t:{for(var x=$t,v=_a;x.nodeType!==8;){if(!v){x=null;break t}if(x=Oa(x.nextSibling),x===null){x=null;break t}}v=x.data,x=v==="F!"||v==="F"?x:null}if(x){$t=Oa(x.nextSibling),u=x.data==="F!";break e}}Xr(u)}u=!1}u&&(a=i[0])}}return i=Pn(),i.memoizedState=i.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:k0,lastRenderedState:a},i.queue=u,i=H0.bind(null,Ze,u),u.dispatch=i,u=Sf(!1),v=Af.bind(null,Ze,!1,u.queue),u=Pn(),x={state:a,dispatch:null,action:t,pending:null},u.queue=x,i=gj.bind(null,Ze,x,v,i),x.dispatch=i,u.memoizedState=t,[a,i,!1]}function S0(t){var a=rn();return j0(a,Et,t)}function j0(t,a,i){if(a=kf(t,a,k0)[0],t=Mc(Cr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Ri(a)}catch(j){throw j===Cl?yc:j}else u=a;a=rn();var x=a.queue,v=x.dispatch;return i!==a.memoizedState&&(Ze.flags|=2048,Rl(9,{destroy:void 0},xj.bind(null,x,i),null)),[u,v,t]}function xj(t,a){t.action=a}function N0(t){var a=rn(),i=Et;if(i!==null)return j0(a,i,t);rn(),a=a.memoizedState,i=rn();var u=i.queue.dispatch;return i.memoizedState=t,[a,u,!1]}function Rl(t,a,i,u){return t={tag:t,create:i,deps:u,inst:a,next:null},a=Ze.updateQueue,a===null&&(a=Cc(),Ze.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 C0(){return rn().memoizedState}function Ec(t,a,i,u){var x=Pn();Ze.flags|=t,x.memoizedState=Rl(1|a,{destroy:void 0},i,u===void 0?null:u)}function Ac(t,a,i,u){var x=rn();u=u===void 0?null:u;var v=x.memoizedState.inst;Et!==null&&u!==null&&pf(u,Et.memoizedState.deps)?x.memoizedState=Rl(a,v,i,u):(Ze.flags|=t,x.memoizedState=Rl(1|a,v,i,u))}function T0(t,a){Ec(8390656,8,t,a)}function Nf(t,a){Ac(2048,8,t,a)}function yj(t){Ze.flags|=4;var a=Ze.updateQueue;if(a===null)a=Cc(),Ze.updateQueue=a,a.events=[t];else{var i=a.events;i===null?a.events=[t]:i.push(t)}}function M0(t){var a=rn().memoizedState;return yj({ref:a,nextImpl:t}),function(){if((St&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}function E0(t,a){return Ac(4,2,t,a)}function A0(t,a){return Ac(4,4,t,a)}function R0(t,a){if(typeof a=="function"){t=t();var i=a(t);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function I0(t,a,i){i=i!=null?i.concat([t]):null,Ac(4,4,R0.bind(null,a,t),i)}function Cf(){}function _0(t,a){var i=rn();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&pf(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function L0(t,a){var i=rn();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&pf(a,u[1]))return u[0];if(u=t(),Ws){$e(!0);try{t()}finally{$e(!1)}}return i.memoizedState=[u,a],u}function Tf(t,a,i){return i===void 0||(Nr&1073741824)!==0&&(ot&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=Ox(),Ze.lanes|=t,ls|=t,i)}function O0(t,a,i,u){return ca(i,a)?i:Ml.current!==null?(t=Tf(t,i,u),ca(t,a)||(mn=!0),t):(Nr&42)===0||(Nr&1073741824)!==0&&(ot&261930)===0?(mn=!0,t.memoizedState=i):(t=Ox(),Ze.lanes|=t,ls|=t,a)}function D0(t,a,i,u,x){var v=W.p;W.p=v!==0&&8>v?v:8;var j=V.T,D={};V.T=D,Af(t,!1,a,i);try{var G=x(),se=V.S;if(se!==null&&se(D,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var fe=mj(G,u);Ii(t,a,fe,pa(t))}else Ii(t,a,u,pa(t))}catch(ge){Ii(t,a,{then:function(){},status:"rejected",reason:ge},pa())}finally{W.p=v,j!==null&&D.types!==null&&(j.types=D.types),V.T=j}}function bj(){}function Mf(t,a,i,u){if(t.tag!==5)throw Error(l(476));var x=z0(t).queue;D0(t,x,a,ce,i===null?bj:function(){return U0(t),i(u)})}function z0(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cr,lastRenderedState:ce},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cr,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function U0(t){var a=z0(t);a.next===null&&(a=t.alternate.memoizedState),Ii(t,a.next.queue,{},pa())}function Ef(){return An(Yi)}function $0(){return rn().memoizedState}function B0(){return rn().memoizedState}function vj(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var i=pa();t=es(i);var u=ts(a,t,i);u!==null&&(Zn(u,a,i),Ti(u,a,i)),a={cache:af()},t.payload=a;return}a=a.return}}function kj(t,a,i){var u=pa();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Rc(t)?P0(a,i):(i=Gd(t,a,i,u),i!==null&&(Zn(i,t,u),F0(i,a,u)))}function H0(t,a,i){var u=pa();Ii(t,a,i,u)}function Ii(t,a,i,u){var x={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Rc(t))P0(a,x);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var j=a.lastRenderedState,D=v(j,i);if(x.hasEagerState=!0,x.eagerState=D,ca(D,j))return dc(t,a,x,0),Lt===null&&uc(),!1}catch{}if(i=Gd(t,a,x,u),i!==null)return Zn(i,t,u),F0(i,a,u),!0}return!1}function Af(t,a,i,u){if(u={lane:2,revertLane:om(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Rc(t)){if(a)throw Error(l(479))}else a=Gd(t,i,u,2),a!==null&&Zn(a,t,2)}function Rc(t){var a=t.alternate;return t===Ze||a!==null&&a===Ze}function P0(t,a){El=jc=!0;var i=t.pending;i===null?a.next=a:(a.next=i.next,i.next=a),t.pending=a}function F0(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ia(t,i)}}var _i={readContext:An,use:Tc,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};_i.useEffectEvent=Zt;var q0={readContext:An,use:Tc,useCallback:function(t,a){return Pn().memoizedState=[t,a===void 0?null:a],t},useContext:An,useEffect:T0,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,Ec(4194308,4,R0.bind(null,a,t),i)},useLayoutEffect:function(t,a){return Ec(4194308,4,t,a)},useInsertionEffect:function(t,a){Ec(4,2,t,a)},useMemo:function(t,a){var i=Pn();a=a===void 0?null:a;var u=t();if(Ws){$e(!0);try{t()}finally{$e(!1)}}return i.memoizedState=[u,a],u},useReducer:function(t,a,i){var u=Pn();if(i!==void 0){var x=i(a);if(Ws){$e(!0);try{i(a)}finally{$e(!1)}}}else x=a;return u.memoizedState=u.baseState=x,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:x},u.queue=t,t=t.dispatch=kj.bind(null,Ze,t),[u.memoizedState,t]},useRef:function(t){var a=Pn();return t={current:t},a.memoizedState=t},useState:function(t){t=Sf(t);var a=t.queue,i=H0.bind(null,Ze,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:Cf,useDeferredValue:function(t,a){var i=Pn();return Tf(i,t,a)},useTransition:function(){var t=Sf(!1);return t=D0.bind(null,Ze,t.queue,!0,!1),Pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=Ze,x=Pn();if(mt){if(i===void 0)throw Error(l(407));i=i()}else{if(i=a(),Lt===null)throw Error(l(349));(ot&127)!==0||d0(u,a,i)}x.memoizedState=i;var v={value:i,getSnapshot:a};return x.queue=v,T0(m0.bind(null,u,v,t),[t]),u.flags|=2048,Rl(9,{destroy:void 0},f0.bind(null,u,v,i,a),null),i},useId:function(){var t=Pn(),a=Lt.identifierPrefix;if(mt){var i=or,u=ir;i=(u&~(1<<32-Ve(u)-1)).toString(32)+i,a="_"+a+"R_"+i,i=Nc++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=hj++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:Ef,useFormState:w0,useActionState:w0,useOptimistic:function(t){var a=Pn();a.memoizedState=a.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=Af.bind(null,Ze,!0,i),i.dispatch=a,[t,a]},useMemoCache:vf,useCacheRefresh:function(){return Pn().memoizedState=vj.bind(null,Ze)},useEffectEvent:function(t){var a=Pn(),i={impl:t};return a.memoizedState=i,function(){if((St&2)!==0)throw Error(l(440));return i.impl.apply(void 0,arguments)}}},Rf={readContext:An,use:Tc,useCallback:_0,useContext:An,useEffect:Nf,useImperativeHandle:I0,useInsertionEffect:E0,useLayoutEffect:A0,useMemo:L0,useReducer:Mc,useRef:C0,useState:function(){return Mc(Cr)},useDebugValue:Cf,useDeferredValue:function(t,a){var i=rn();return O0(i,Et.memoizedState,t,a)},useTransition:function(){var t=Mc(Cr)[0],a=rn().memoizedState;return[typeof t=="boolean"?t:Ri(t),a]},useSyncExternalStore:u0,useId:$0,useHostTransitionStatus:Ef,useFormState:S0,useActionState:S0,useOptimistic:function(t,a){var i=rn();return g0(i,Et,t,a)},useMemoCache:vf,useCacheRefresh:B0};Rf.useEffectEvent=M0;var V0={readContext:An,use:Tc,useCallback:_0,useContext:An,useEffect:Nf,useImperativeHandle:I0,useInsertionEffect:E0,useLayoutEffect:A0,useMemo:L0,useReducer:wf,useRef:C0,useState:function(){return wf(Cr)},useDebugValue:Cf,useDeferredValue:function(t,a){var i=rn();return Et===null?Tf(i,t,a):O0(i,Et.memoizedState,t,a)},useTransition:function(){var t=wf(Cr)[0],a=rn().memoizedState;return[typeof t=="boolean"?t:Ri(t),a]},useSyncExternalStore:u0,useId:$0,useHostTransitionStatus:Ef,useFormState:N0,useActionState:N0,useOptimistic:function(t,a){var i=rn();return Et!==null?g0(i,Et,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:vf,useCacheRefresh:B0};V0.useEffectEvent=M0;function If(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 _f={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=pa(),x=es(u);x.payload=a,i!=null&&(x.callback=i),a=ts(t,x,u),a!==null&&(Zn(a,t,u),Ti(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=pa(),x=es(u);x.tag=1,x.payload=a,i!=null&&(x.callback=i),a=ts(t,x,u),a!==null&&(Zn(a,t,u),Ti(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var i=pa(),u=es(i);u.tag=2,a!=null&&(u.callback=a),a=ts(t,u,i),a!==null&&(Zn(a,t,i),Ti(a,t,i))}};function G0(t,a,i,u,x,v,j){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,v,j):a.prototype&&a.prototype.isPureReactComponent?!bi(i,u)||!bi(x,v):!0}function W0(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&&_f.enqueueReplaceState(a,a.state,null)}function Ks(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 x in t)i[x]===void 0&&(i[x]=t[x])}return i}function K0(t){cc(t)}function Y0(t){console.error(t)}function Q0(t){cc(t)}function Ic(t,a){try{var i=t.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function X0(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Lf(t,a,i){return i=es(i),i.tag=3,i.payload={element:null},i.callback=function(){Ic(t,a)},i}function Z0(t){return t=es(t),t.tag=3,t}function J0(t,a,i,u){var x=i.type.getDerivedStateFromError;if(typeof x=="function"){var v=u.value;t.payload=function(){return x(v)},t.callback=function(){X0(a,i,u)}}var j=i.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(t.callback=function(){X0(a,i,u),typeof x!="function"&&(is===null?is=new Set([this]):is.add(this));var D=u.stack;this.componentDidCatch(u.value,{componentStack:D!==null?D:""})})}function wj(t,a,i,u,x){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&Sl(a,i,x,!0),i=da.current,i!==null){switch(i.tag){case 31:case 13:return La===null?qc():i.alternate===null&&Jt===0&&(Jt=3),i.flags&=-257,i.flags|=65536,i.lanes=x,u===bc?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),sm(t,u,x)),!1;case 22:return i.flags|=65536,u===bc?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)),sm(t,u,x)),!1}throw Error(l(435,i.tag))}return sm(t,u,x),qc(),!1}if(mt)return a=da.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,u!==Zd&&(t=Error(l(422),{cause:u}),wi(Aa(t,i)))):(u!==Zd&&(a=Error(l(423),{cause:u}),wi(Aa(a,i))),t=t.current.alternate,t.flags|=65536,x&=-x,t.lanes|=x,u=Aa(u,i),x=Lf(t.stateNode,u,x),uf(t,x),Jt!==4&&(Jt=2)),!1;var v=Error(l(520),{cause:u});if(v=Aa(v,i),Hi===null?Hi=[v]:Hi.push(v),Jt!==4&&(Jt=2),a===null)return!0;u=Aa(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=x&-x,i.lanes|=t,t=Lf(i.stateNode,u,t),uf(i,t),!1;case 1:if(a=i.type,v=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(is===null||!is.has(v))))return i.flags|=65536,x&=-x,i.lanes|=x,x=Z0(x),J0(x,t,i,u),uf(i,x),!1}i=i.return}while(i!==null);return!1}var Of=Error(l(461)),mn=!1;function Rn(t,a,i,u){a.child=t===null?a0(a,null,i,u):Gs(a,t.child,i,u)}function ex(t,a,i,u,x){i=i.render;var v=a.ref;if("ref"in u){var j={};for(var D in u)D!=="ref"&&(j[D]=u[D])}else j=u;return Ps(a),u=gf(t,a,i,j,v,x),D=xf(),t!==null&&!mn?(yf(t,a,x),Tr(t,a,x)):(mt&&D&&Qd(a),a.flags|=1,Rn(t,a,u,x),a.child)}function tx(t,a,i,u,x){if(t===null){var v=i.type;return typeof v=="function"&&!Wd(v)&&v.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=v,nx(t,a,v,u,x)):(t=mc(i.type,null,u,a,a.mode,x),t.ref=a.ref,t.return=a,a.child=t)}if(v=t.child,!Ff(t,x)){var j=v.memoizedProps;if(i=i.compare,i=i!==null?i:bi,i(j,u)&&t.ref===a.ref)return Tr(t,a,x)}return a.flags|=1,t=kr(v,u),t.ref=a.ref,t.return=a,a.child=t}function nx(t,a,i,u,x){if(t!==null){var v=t.memoizedProps;if(bi(v,u)&&t.ref===a.ref)if(mn=!1,a.pendingProps=u=v,Ff(t,x))(t.flags&131072)!==0&&(mn=!0);else return a.lanes=t.lanes,Tr(t,a,x)}return Df(t,a,i,u,x)}function ax(t,a,i,u){var x=u.children,v=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(v=v!==null?v.baseLanes|i:i,t!==null){for(u=a.child=t.child,x=0;u!==null;)x=x|u.lanes|u.childLanes,u=u.sibling;u=x&~v}else u=0,a.child=null;return rx(t,a,v,i,u)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&xc(a,v!==null?v.cachePool:null),v!==null?l0(a,v):ff(),i0(a);else return u=a.lanes=536870912,rx(t,a,v!==null?v.baseLanes|i:i,i,u)}else v!==null?(xc(a,v.cachePool),l0(a,v),as(),a.memoizedState=null):(t!==null&&xc(a,null),ff(),as());return Rn(t,a,x,i),a.child}function Li(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function rx(t,a,i,u,x){var v=sf();return v=v===null?null:{parent:dn._currentValue,pool:v},a.memoizedState={baseLanes:i,cachePool:v},t!==null&&xc(a,null),ff(),i0(a),t!==null&&Sl(t,a,u,!0),a.childLanes=x,null}function _c(t,a){return a=Oc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function sx(t,a,i){return Gs(a,t.child,null,i),t=_c(a,a.pendingProps),t.flags|=2,fa(a),a.memoizedState=null,t}function Sj(t,a,i){var u=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(mt){if(u.mode==="hidden")return t=_c(a,u),a.lanes=536870912,Li(null,t);if(hf(a),(t=$t)?(t=xy(t,_a),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:ir,overflow:or}:null,retryLane:536870912,hydrationErrors:null},i=Pg(t),i.return=a,a.child=i,En=a,$t=null)):t=null,t===null)throw Xr(a);return a.lanes=536870912,null}return _c(a,u)}var v=t.memoizedState;if(v!==null){var j=v.dehydrated;if(hf(a),x)if(a.flags&256)a.flags&=-257,a=sx(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(l(558));else if(mn||Sl(t,a,i,!1),x=(i&t.childLanes)!==0,mn||x){if(u=Lt,u!==null&&(j=Ce(u,i),j!==0&&j!==v.retryLane))throw v.retryLane=j,Us(t,j),Zn(u,t,j),Of;qc(),a=sx(t,a,i)}else t=v.treeContext,$t=Oa(j.nextSibling),En=a,mt=!0,Qr=null,_a=!1,t!==null&&Vg(a,t),a=_c(a,u),a.flags|=4096;return a}return t=kr(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function Lc(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(l(284));(t===null||t.ref!==i)&&(a.flags|=4194816)}}function Df(t,a,i,u,x){return Ps(a),i=gf(t,a,i,u,void 0,x),u=xf(),t!==null&&!mn?(yf(t,a,x),Tr(t,a,x)):(mt&&u&&Qd(a),a.flags|=1,Rn(t,a,i,x),a.child)}function lx(t,a,i,u,x,v){return Ps(a),a.updateQueue=null,i=c0(a,u,i,x),o0(t),u=xf(),t!==null&&!mn?(yf(t,a,v),Tr(t,a,v)):(mt&&u&&Qd(a),a.flags|=1,Rn(t,a,i,v),a.child)}function ix(t,a,i,u,x){if(Ps(a),a.stateNode===null){var v=bl,j=i.contextType;typeof j=="object"&&j!==null&&(v=An(j)),v=new i(u,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=_f,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=u,v.state=a.memoizedState,v.refs={},of(a),j=i.contextType,v.context=typeof j=="object"&&j!==null?An(j):bl,v.state=a.memoizedState,j=i.getDerivedStateFromProps,typeof j=="function"&&(If(a,i,j,u),v.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(j=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),j!==v.state&&_f.enqueueReplaceState(v,v.state,null),Ei(a,u,v,x),Mi(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){v=a.stateNode;var D=a.memoizedProps,G=Ks(i,D);v.props=G;var se=v.context,fe=i.contextType;j=bl,typeof fe=="object"&&fe!==null&&(j=An(fe));var ge=i.getDerivedStateFromProps;fe=typeof ge=="function"||typeof v.getSnapshotBeforeUpdate=="function",D=a.pendingProps!==D,fe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(D||se!==j)&&W0(a,v,u,j),Jr=!1;var oe=a.memoizedState;v.state=oe,Ei(a,u,v,x),Mi(),se=a.memoizedState,D||oe!==se||Jr?(typeof ge=="function"&&(If(a,i,ge,u),se=a.memoizedState),(G=Jr||G0(a,i,G,u,oe,se,j))?(fe||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=se),v.props=u,v.state=se,v.context=j,u=G):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{v=a.stateNode,cf(t,a),j=a.memoizedProps,fe=Ks(i,j),v.props=fe,ge=a.pendingProps,oe=v.context,se=i.contextType,G=bl,typeof se=="object"&&se!==null&&(G=An(se)),D=i.getDerivedStateFromProps,(se=typeof D=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(j!==ge||oe!==G)&&W0(a,v,u,G),Jr=!1,oe=a.memoizedState,v.state=oe,Ei(a,u,v,x),Mi();var de=a.memoizedState;j!==ge||oe!==de||Jr||t!==null&&t.dependencies!==null&&pc(t.dependencies)?(typeof D=="function"&&(If(a,i,D,u),de=a.memoizedState),(fe=Jr||G0(a,i,fe,u,oe,de,G)||t!==null&&t.dependencies!==null&&pc(t.dependencies))?(se||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(u,de,G),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(u,de,G)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||j===t.memoizedProps&&oe===t.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&oe===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=de),v.props=u,v.state=de,v.context=G,u=fe):(typeof v.componentDidUpdate!="function"||j===t.memoizedProps&&oe===t.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&oe===t.memoizedState||(a.flags|=1024),u=!1)}return v=u,Lc(t,a),u=(a.flags&128)!==0,v||u?(v=a.stateNode,i=u&&typeof i.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,t!==null&&u?(a.child=Gs(a,t.child,null,x),a.child=Gs(a,null,i,x)):Rn(t,a,i,x),a.memoizedState=v.state,t=a.child):t=Tr(t,a,x),t}function ox(t,a,i,u){return Bs(),a.flags|=256,Rn(t,a,i,u),a.child}var zf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uf(t){return{baseLanes:t,cachePool:Xg()}}function $f(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=ha),t}function cx(t,a,i){var u=a.pendingProps,x=!1,v=(a.flags&128)!==0,j;if((j=v)||(j=t!==null&&t.memoizedState===null?!1:(an.current&2)!==0),j&&(x=!0,a.flags&=-129),j=(a.flags&32)!==0,a.flags&=-33,t===null){if(mt){if(x?ns(a):as(),(t=$t)?(t=xy(t,_a),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:ir,overflow:or}:null,retryLane:536870912,hydrationErrors:null},i=Pg(t),i.return=a,a.child=i,En=a,$t=null)):t=null,t===null)throw Xr(a);return km(t)?a.lanes=32:a.lanes=536870912,null}var D=u.children;return u=u.fallback,x?(as(),x=a.mode,D=Oc({mode:"hidden",children:D},x),u=$s(u,x,i,null),D.return=a,u.return=a,D.sibling=u,a.child=D,u=a.child,u.memoizedState=Uf(i),u.childLanes=$f(t,j,i),a.memoizedState=zf,Li(null,u)):(ns(a),Bf(a,D))}var G=t.memoizedState;if(G!==null&&(D=G.dehydrated,D!==null)){if(v)a.flags&256?(ns(a),a.flags&=-257,a=Hf(t,a,i)):a.memoizedState!==null?(as(),a.child=t.child,a.flags|=128,a=null):(as(),D=u.fallback,x=a.mode,u=Oc({mode:"visible",children:u.children},x),D=$s(D,x,i,null),D.flags|=2,u.return=a,D.return=a,u.sibling=D,a.child=u,Gs(a,t.child,null,i),u=a.child,u.memoizedState=Uf(i),u.childLanes=$f(t,j,i),a.memoizedState=zf,a=Li(null,u));else if(ns(a),km(D)){if(j=D.nextSibling&&D.nextSibling.dataset,j)var se=j.dgst;j=se,u=Error(l(419)),u.stack="",u.digest=j,wi({value:u,source:null,stack:null}),a=Hf(t,a,i)}else if(mn||Sl(t,a,i,!1),j=(i&t.childLanes)!==0,mn||j){if(j=Lt,j!==null&&(u=Ce(j,i),u!==0&&u!==G.retryLane))throw G.retryLane=u,Us(t,u),Zn(j,t,u),Of;vm(D)||qc(),a=Hf(t,a,i)}else vm(D)?(a.flags|=192,a.child=t.child,a=null):(t=G.treeContext,$t=Oa(D.nextSibling),En=a,mt=!0,Qr=null,_a=!1,t!==null&&Vg(a,t),a=Bf(a,u.children),a.flags|=4096);return a}return x?(as(),D=u.fallback,x=a.mode,G=t.child,se=G.sibling,u=kr(G,{mode:"hidden",children:u.children}),u.subtreeFlags=G.subtreeFlags&65011712,se!==null?D=kr(se,D):(D=$s(D,x,i,null),D.flags|=2),D.return=a,u.return=a,u.sibling=D,a.child=u,Li(null,u),u=a.child,D=t.child.memoizedState,D===null?D=Uf(i):(x=D.cachePool,x!==null?(G=dn._currentValue,x=x.parent!==G?{parent:G,pool:G}:x):x=Xg(),D={baseLanes:D.baseLanes|i,cachePool:x}),u.memoizedState=D,u.childLanes=$f(t,j,i),a.memoizedState=zf,Li(t.child,u)):(ns(a),i=t.child,t=i.sibling,i=kr(i,{mode:"visible",children:u.children}),i.return=a,i.sibling=null,t!==null&&(j=a.deletions,j===null?(a.deletions=[t],a.flags|=16):j.push(t)),a.child=i,a.memoizedState=null,i)}function Bf(t,a){return a=Oc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function Oc(t,a){return t=ua(22,t,null,a),t.lanes=0,t}function Hf(t,a,i){return Gs(a,t.child,null,i),t=Bf(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function ux(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),tf(t.return,a,i)}function Pf(t,a,i,u,x,v){var j=t.memoizedState;j===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:x,treeForkCount:v}:(j.isBackwards=a,j.rendering=null,j.renderingStartTime=0,j.last=u,j.tail=i,j.tailMode=x,j.treeForkCount=v)}function dx(t,a,i){var u=a.pendingProps,x=u.revealOrder,v=u.tail;u=u.children;var j=an.current,D=(j&2)!==0;if(D?(j=j&1|2,a.flags|=128):j&=1,C(an,j),Rn(t,a,u,i),u=mt?ki:0,!D&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&ux(t,i,a);else if(t.tag===19)ux(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(x){case"forwards":for(i=a.child,x=null;i!==null;)t=i.alternate,t!==null&&Sc(t)===null&&(x=i),i=i.sibling;i=x,i===null?(x=a.child,a.child=null):(x=i.sibling,i.sibling=null),Pf(a,!1,x,i,v,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,x=a.child,a.child=null;x!==null;){if(t=x.alternate,t!==null&&Sc(t)===null){a.child=x;break}t=x.sibling,x.sibling=i,i=x,x=t}Pf(a,!0,i,null,v,u);break;case"together":Pf(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function Tr(t,a,i){if(t!==null&&(a.dependencies=t.dependencies),ls|=a.lanes,(i&a.childLanes)===0)if(t!==null){if(Sl(t,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(l(153));if(a.child!==null){for(t=a.child,i=kr(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=kr(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function Ff(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&pc(t)))}function jj(t,a,i){switch(a.tag){case 3:xe(a,a.stateNode.containerInfo),Zr(a,dn,t.memoizedState.cache),Bs();break;case 27:case 5:ye(a);break;case 4:xe(a,a.stateNode.containerInfo);break;case 10:Zr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,hf(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(ns(a),a.flags|=128,null):(i&a.child.childLanes)!==0?cx(t,a,i):(ns(a),t=Tr(t,a,i),t!==null?t.sibling:null);ns(a);break;case 19:var x=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(Sl(t,a,i,!1),u=(i&a.childLanes)!==0),x){if(u)return dx(t,a,i);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),C(an,an.current),u)break;return null;case 22:return a.lanes=0,ax(t,a,i,a.pendingProps);case 24:Zr(a,dn,t.memoizedState.cache)}return Tr(t,a,i)}function fx(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)mn=!0;else{if(!Ff(t,i)&&(a.flags&128)===0)return mn=!1,jj(t,a,i);mn=(t.flags&131072)!==0}else mn=!1,mt&&(a.flags&1048576)!==0&&qg(a,ki,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=qs(a.elementType),a.type=t,typeof t=="function")Wd(t)?(u=Ks(t,u),a.tag=1,a=ix(null,a,t,u,i)):(a.tag=0,a=Df(null,a,t,u,i));else{if(t!=null){var x=t.$$typeof;if(x===P){a.tag=11,a=ex(null,a,t,u,i);break e}else if(x===F){a.tag=14,a=tx(null,a,t,u,i);break e}}throw a=q(t)||t,Error(l(306,a,""))}}return a;case 0:return Df(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,x=Ks(u,a.pendingProps),ix(t,a,u,x,i);case 3:e:{if(xe(a,a.stateNode.containerInfo),t===null)throw Error(l(387));u=a.pendingProps;var v=a.memoizedState;x=v.element,cf(t,a),Ei(a,u,null,i);var j=a.memoizedState;if(u=j.cache,Zr(a,dn,u),u!==v.cache&&nf(a,[dn],i,!0),Mi(),u=j.element,v.isDehydrated)if(v={element:u,isDehydrated:!1,cache:j.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=ox(t,a,u,i);break e}else if(u!==x){x=Aa(Error(l(424)),a),wi(x),a=ox(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,$t=Oa(t.firstChild),En=a,mt=!0,Qr=null,_a=!0,i=a0(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Bs(),u===x){a=Tr(t,a,i);break e}Rn(t,a,u,i)}a=a.child}return a;case 26:return Lc(t,a),t===null?(i=Sy(a.type,null,a.pendingProps,null))?a.memoizedState=i:mt||(i=a.type,t=a.pendingProps,u=Xc(ae.current).createElement(i),u[bt]=a,u[Qt]=t,In(u,i,t),Ut(u),a.stateNode=u):a.memoizedState=Sy(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return ye(a),t===null&&mt&&(u=a.stateNode=vy(a.type,a.pendingProps,ae.current),En=a,_a=!0,x=$t,ds(a.type)?(wm=x,$t=Oa(u.firstChild)):$t=x),Rn(t,a,a.pendingProps.children,i),Lc(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&mt&&((x=u=$t)&&(u=e5(u,a.type,a.pendingProps,_a),u!==null?(a.stateNode=u,En=a,$t=Oa(u.firstChild),_a=!1,x=!0):x=!1),x||Xr(a)),ye(a),x=a.type,v=a.pendingProps,j=t!==null?t.memoizedProps:null,u=v.children,xm(x,v)?u=null:j!==null&&xm(x,j)&&(a.flags|=32),a.memoizedState!==null&&(x=gf(t,a,pj,null,null,i),Yi._currentValue=x),Lc(t,a),Rn(t,a,u,i),a.child;case 6:return t===null&&mt&&((t=i=$t)&&(i=t5(i,a.pendingProps,_a),i!==null?(a.stateNode=i,En=a,$t=null,t=!0):t=!1),t||Xr(a)),null;case 13:return cx(t,a,i);case 4:return xe(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Gs(a,null,u,i):Rn(t,a,u,i),a.child;case 11:return ex(t,a,a.type,a.pendingProps,i);case 7:return Rn(t,a,a.pendingProps,i),a.child;case 8:return Rn(t,a,a.pendingProps.children,i),a.child;case 12:return Rn(t,a,a.pendingProps.children,i),a.child;case 10:return u=a.pendingProps,Zr(a,a.type,u.value),Rn(t,a,u.children,i),a.child;case 9:return x=a.type._context,u=a.pendingProps.children,Ps(a),x=An(x),u=u(x),a.flags|=1,Rn(t,a,u,i),a.child;case 14:return tx(t,a,a.type,a.pendingProps,i);case 15:return nx(t,a,a.type,a.pendingProps,i);case 19:return dx(t,a,i);case 31:return Sj(t,a,i);case 22:return ax(t,a,i,a.pendingProps);case 24:return Ps(a),u=An(dn),t===null?(x=sf(),x===null&&(x=Lt,v=af(),x.pooledCache=v,v.refCount++,v!==null&&(x.pooledCacheLanes|=i),x=v),a.memoizedState={parent:u,cache:x},of(a),Zr(a,dn,x)):((t.lanes&i)!==0&&(cf(t,a),Ei(a,null,null,i),Mi()),x=t.memoizedState,v=a.memoizedState,x.parent!==u?(x={parent:u,cache:u},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),Zr(a,dn,u)):(u=v.cache,Zr(a,dn,u),u!==x.cache&&nf(a,[dn],i,!0))),Rn(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(l(156,a.tag))}function Mr(t){t.flags|=4}function qf(t,a,i,u,x){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(x&335544128)===x)if(t.stateNode.complete)t.flags|=8192;else if($x())t.flags|=8192;else throw Vs=bc,lf}else t.flags&=-16777217}function mx(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!My(a))if($x())t.flags|=8192;else throw Vs=bc,lf}function Dc(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Vn():536870912,t.lanes|=a,Ol|=a)}function Oi(t,a){if(!mt)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 Bt(t){var a=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(a)for(var x=t.child;x!==null;)i|=x.lanes|x.childLanes,u|=x.subtreeFlags&65011712,u|=x.flags&65011712,x.return=t,x=x.sibling;else for(x=t.child;x!==null;)i|=x.lanes|x.childLanes,u|=x.subtreeFlags,u|=x.flags,x.return=t,x=x.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function Nj(t,a,i){var u=a.pendingProps;switch(Xd(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(a),null;case 1:return Bt(a),null;case 3:return i=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),jr(dn),ie(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(wl(a)?Mr(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Jd())),Bt(a),null;case 26:var x=a.type,v=a.memoizedState;return t===null?(Mr(a),v!==null?(Bt(a),mx(a,v)):(Bt(a),qf(a,x,null,u,i))):v?v!==t.memoizedState?(Mr(a),Bt(a),mx(a,v)):(Bt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&Mr(a),Bt(a),qf(a,x,t,u,i)),null;case 27:if(ve(a),i=ae.current,x=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&Mr(a);else{if(!u){if(a.stateNode===null)throw Error(l(166));return Bt(a),null}t=Q.current,wl(a)?Gg(a):(t=vy(x,u,i),a.stateNode=t,Mr(a))}return Bt(a),null;case 5:if(ve(a),x=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&Mr(a);else{if(!u){if(a.stateNode===null)throw Error(l(166));return Bt(a),null}if(v=Q.current,wl(a))Gg(a);else{var j=Xc(ae.current);switch(v){case 1:v=j.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:v=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":v=j.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":v=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":v=j.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof u.is=="string"?j.createElement("select",{is:u.is}):j.createElement("select"),u.multiple?v.multiple=!0:u.size&&(v.size=u.size);break;default:v=typeof u.is=="string"?j.createElement(x,{is:u.is}):j.createElement(x)}}v[bt]=a,v[Qt]=u;e:for(j=a.child;j!==null;){if(j.tag===5||j.tag===6)v.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===a)break e;for(;j.sibling===null;){if(j.return===null||j.return===a)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}a.stateNode=v;e:switch(In(v,x,u),x){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Mr(a)}}return Bt(a),qf(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&Mr(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(l(166));if(t=ae.current,wl(a)){if(t=a.stateNode,i=a.memoizedProps,u=null,x=En,x!==null)switch(x.tag){case 27:case 5:u=x.memoizedProps}t[bt]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||cy(t.nodeValue,i)),t||Xr(a,!0)}else t=Xc(t).createTextNode(u),t[bt]=a,a.stateNode=t}return Bt(a),null;case 31:if(i=a.memoizedState,t===null||t.memoizedState!==null){if(u=wl(a),i!==null){if(t===null){if(!u)throw Error(l(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[bt]=a}else Bs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Bt(a),t=!1}else i=Jd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return a.flags&256?(fa(a),a):(fa(a),null);if((a.flags&128)!==0)throw Error(l(558))}return Bt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(x=wl(a),u!==null&&u.dehydrated!==null){if(t===null){if(!x)throw Error(l(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(l(317));x[bt]=a}else Bs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Bt(a),x=!1}else x=Jd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(fa(a),a):(fa(a),null)}return fa(a),(a.flags&128)!==0?(a.lanes=i,a):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=a.child,x=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(x=u.alternate.memoizedState.cachePool.pool),v=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==x&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),Dc(a,a.updateQueue),Bt(a),null);case 4:return ie(),t===null&&fm(a.stateNode.containerInfo),Bt(a),null;case 10:return jr(a.type),Bt(a),null;case 19:if(R(an),u=a.memoizedState,u===null)return Bt(a),null;if(x=(a.flags&128)!==0,v=u.rendering,v===null)if(x)Oi(u,!1);else{if(Jt!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(v=Sc(t),v!==null){for(a.flags|=128,Oi(u,!1),t=v.updateQueue,a.updateQueue=t,Dc(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)Hg(i,t),i=i.sibling;return C(an,an.current&1|2),mt&&wr(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&st()>Hc&&(a.flags|=128,x=!0,Oi(u,!1),a.lanes=4194304)}else{if(!x)if(t=Sc(v),t!==null){if(a.flags|=128,x=!0,t=t.updateQueue,a.updateQueue=t,Dc(a,t),Oi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!v.alternate&&!mt)return Bt(a),null}else 2*st()-u.renderingStartTime>Hc&&i!==536870912&&(a.flags|=128,x=!0,Oi(u,!1),a.lanes=4194304);u.isBackwards?(v.sibling=a.child,a.child=v):(t=u.last,t!==null?t.sibling=v:a.child=v,u.last=v)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=st(),t.sibling=null,i=an.current,C(an,x?i&1|2:i&1),mt&&wr(a,u.treeForkCount),t):(Bt(a),null);case 22:case 23:return fa(a),mf(),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&&(Bt(a),a.subtreeFlags&6&&(a.flags|=8192)):Bt(a),i=a.updateQueue,i!==null&&Dc(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&&R(Fs),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),jr(dn),Bt(a),null;case 25:return null;case 30:return null}throw Error(l(156,a.tag))}function Cj(t,a){switch(Xd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return jr(dn),ie(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return ve(a),null;case 31:if(a.memoizedState!==null){if(fa(a),a.alternate===null)throw Error(l(340));Bs()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(fa(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(l(340));Bs()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return R(an),null;case 4:return ie(),null;case 10:return jr(a.type),null;case 22:case 23:return fa(a),mf(),t!==null&&R(Fs),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return jr(dn),null;case 25:return null;default:return null}}function hx(t,a){switch(Xd(a),a.tag){case 3:jr(dn),ie();break;case 26:case 27:case 5:ve(a);break;case 4:ie();break;case 31:a.memoizedState!==null&&fa(a);break;case 13:fa(a);break;case 19:R(an);break;case 10:jr(a.type);break;case 22:case 23:fa(a),mf(),t!==null&&R(Fs);break;case 24:jr(dn)}}function Di(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var x=u.next;i=x;do{if((i.tag&t)===t){u=void 0;var v=i.create,j=i.inst;u=v(),j.destroy=u}i=i.next}while(i!==x)}}catch(D){Mt(a,a.return,D)}}function rs(t,a,i){try{var u=a.updateQueue,x=u!==null?u.lastEffect:null;if(x!==null){var v=x.next;u=v;do{if((u.tag&t)===t){var j=u.inst,D=j.destroy;if(D!==void 0){j.destroy=void 0,x=a;var G=i,se=D;try{se()}catch(fe){Mt(x,G,fe)}}}u=u.next}while(u!==v)}}catch(fe){Mt(a,a.return,fe)}}function px(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{s0(a,i)}catch(u){Mt(t,t.return,u)}}}function gx(t,a,i){i.props=Ks(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){Mt(t,a,u)}}function zi(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(x){Mt(t,a,x)}}function cr(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(x){Mt(t,a,x)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(x){Mt(t,a,x)}else i.current=null}function xx(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(x){Mt(t,t.return,x)}}function Vf(t,a,i){try{var u=t.stateNode;Kj(u,t.type,i,a),u[Qt]=a}catch(x){Mt(t,t.return,x)}}function yx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ds(t.type)||t.tag===4}function Gf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||yx(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&&ds(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 Wf(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=it));else if(u!==4&&(u===27&&ds(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(Wf(t,a,i),t=t.sibling;t!==null;)Wf(t,a,i),t=t.sibling}function zc(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&&ds(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(zc(t,a,i),t=t.sibling;t!==null;)zc(t,a,i),t=t.sibling}function bx(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);In(a,u,i),a[bt]=t,a[Qt]=i}catch(v){Mt(t,t.return,v)}}var Er=!1,hn=!1,Kf=!1,vx=typeof WeakSet=="function"?WeakSet:Set,Tn=null;function Tj(t,a){if(t=t.containerInfo,pm=ru,t=Ig(t),Bd(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 x=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{i.nodeType,v.nodeType}catch{i=null;break e}var j=0,D=-1,G=-1,se=0,fe=0,ge=t,oe=null;t:for(;;){for(var de;ge!==i||x!==0&&ge.nodeType!==3||(D=j+x),ge!==v||u!==0&&ge.nodeType!==3||(G=j+u),ge.nodeType===3&&(j+=ge.nodeValue.length),(de=ge.firstChild)!==null;)oe=ge,ge=de;for(;;){if(ge===t)break t;if(oe===i&&++se===x&&(D=j),oe===v&&++fe===u&&(G=j),(de=ge.nextSibling)!==null)break;ge=oe,oe=ge.parentNode}ge=de}i=D===-1||G===-1?null:{start:D,end:G}}else i=null}i=i||{start:0,end:0}}else i=null;for(gm={focusedElem:t,selectionRange:i},ru=!1,Tn=a;Tn!==null;)if(a=Tn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,Tn=t;else for(;Tn!==null;){switch(a=Tn,v=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++)x=t[i],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&v!==null){t=void 0,i=a,x=v.memoizedProps,v=v.memoizedState,u=i.stateNode;try{var Re=Ks(i.type,x);t=u.getSnapshotBeforeUpdate(Re,v),u.__reactInternalSnapshotBeforeUpdate=t}catch(Be){Mt(i,i.return,Be)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,i=t.nodeType,i===9)bm(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":bm(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(l(163))}if(t=a.sibling,t!==null){t.return=a.return,Tn=t;break}Tn=a.return}}function kx(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:Rr(t,i),u&4&&Di(5,i);break;case 1:if(Rr(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(j){Mt(i,i.return,j)}else{var x=Ks(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(x,a,t.__reactInternalSnapshotBeforeUpdate)}catch(j){Mt(i,i.return,j)}}u&64&&px(i),u&512&&zi(i,i.return);break;case 3:if(Rr(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{s0(t,a)}catch(j){Mt(i,i.return,j)}}break;case 27:a===null&&u&4&&bx(i);case 26:case 5:Rr(t,i),a===null&&u&4&&xx(i),u&512&&zi(i,i.return);break;case 12:Rr(t,i);break;case 31:Rr(t,i),u&4&&jx(t,i);break;case 13:Rr(t,i),u&4&&Nx(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=Dj.bind(null,i),n5(t,i))));break;case 22:if(u=i.memoizedState!==null||Er,!u){a=a!==null&&a.memoizedState!==null||hn,x=Er;var v=hn;Er=u,(hn=a)&&!v?Ir(t,i,(i.subtreeFlags&8772)!==0):Rr(t,i),Er=x,hn=v}break;case 30:break;default:Rr(t,i)}}function wx(t){var a=t.alternate;a!==null&&(t.alternate=null,wx(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&nr(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,Kn=!1;function Ar(t,a,i){for(i=i.child;i!==null;)Sx(t,a,i),i=i.sibling}function Sx(t,a,i){if(Te&&typeof Te.onCommitFiberUnmount=="function")try{Te.onCommitFiberUnmount(Me,i)}catch{}switch(i.tag){case 26:hn||cr(i,a),Ar(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:hn||cr(i,a);var u=qt,x=Kn;ds(i.type)&&(qt=i.stateNode,Kn=!1),Ar(t,a,i),Gi(i.stateNode),qt=u,Kn=x;break;case 5:hn||cr(i,a);case 6:if(u=qt,x=Kn,qt=null,Ar(t,a,i),qt=u,Kn=x,qt!==null)if(Kn)try{(qt.nodeType===9?qt.body:qt.nodeName==="HTML"?qt.ownerDocument.body:qt).removeChild(i.stateNode)}catch(v){Mt(i,a,v)}else try{qt.removeChild(i.stateNode)}catch(v){Mt(i,a,v)}break;case 18:qt!==null&&(Kn?(t=qt,py(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),Fl(t)):py(qt,i.stateNode));break;case 4:u=qt,x=Kn,qt=i.stateNode.containerInfo,Kn=!0,Ar(t,a,i),qt=u,Kn=x;break;case 0:case 11:case 14:case 15:rs(2,i,a),hn||rs(4,i,a),Ar(t,a,i);break;case 1:hn||(cr(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&gx(i,a,u)),Ar(t,a,i);break;case 21:Ar(t,a,i);break;case 22:hn=(u=hn)||i.memoizedState!==null,Ar(t,a,i),hn=u;break;default:Ar(t,a,i)}}function jx(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Fl(t)}catch(i){Mt(a,a.return,i)}}}function Nx(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Fl(t)}catch(i){Mt(a,a.return,i)}}function Mj(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new vx),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new vx),a;default:throw Error(l(435,t.tag))}}function Uc(t,a){var i=Mj(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var x=zj.bind(null,t,u);u.then(x,x)}})}function Yn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var x=i[u],v=t,j=a,D=j;e:for(;D!==null;){switch(D.tag){case 27:if(ds(D.type)){qt=D.stateNode,Kn=!1;break e}break;case 5:qt=D.stateNode,Kn=!1;break e;case 3:case 4:qt=D.stateNode.containerInfo,Kn=!0;break e}D=D.return}if(qt===null)throw Error(l(160));Sx(v,j,x),qt=null,Kn=!1,v=x.alternate,v!==null&&(v.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Cx(a,t),a=a.sibling}var Ga=null;function Cx(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Yn(a,t),Qn(t),u&4&&(rs(3,t,t.return),Di(3,t),rs(5,t,t.return));break;case 1:Yn(a,t),Qn(t),u&512&&(hn||i===null||cr(i,i.return)),u&64&&Er&&(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 x=Ga;if(Yn(a,t),Qn(t),u&512&&(hn||i===null||cr(i,i.return)),u&4){var v=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,x=x.ownerDocument||x;t:switch(u){case"title":v=x.getElementsByTagName("title")[0],(!v||v[Gn]||v[bt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=x.createElement(u),x.head.insertBefore(v,x.querySelector("head > title"))),In(v,u,i),v[bt]=t,Ut(v),u=v;break e;case"link":var j=Cy("link","href",x).get(u+(i.href||""));if(j){for(var D=0;D<j.length;D++)if(v=j[D],v.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&v.getAttribute("rel")===(i.rel==null?null:i.rel)&&v.getAttribute("title")===(i.title==null?null:i.title)&&v.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){j.splice(D,1);break t}}v=x.createElement(u),In(v,u,i),x.head.appendChild(v);break;case"meta":if(j=Cy("meta","content",x).get(u+(i.content||""))){for(D=0;D<j.length;D++)if(v=j[D],v.getAttribute("content")===(i.content==null?null:""+i.content)&&v.getAttribute("name")===(i.name==null?null:i.name)&&v.getAttribute("property")===(i.property==null?null:i.property)&&v.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&v.getAttribute("charset")===(i.charSet==null?null:i.charSet)){j.splice(D,1);break t}}v=x.createElement(u),In(v,u,i),x.head.appendChild(v);break;default:throw Error(l(468,u))}v[bt]=t,Ut(v),u=v}t.stateNode=u}else Ty(x,t.type,t.stateNode);else t.stateNode=Ny(x,u,t.memoizedProps);else v!==u?(v===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):v.count--,u===null?Ty(x,t.type,t.stateNode):Ny(x,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Vf(t,t.memoizedProps,i.memoizedProps)}break;case 27:Yn(a,t),Qn(t),u&512&&(hn||i===null||cr(i,i.return)),i!==null&&u&4&&Vf(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Yn(a,t),Qn(t),u&512&&(hn||i===null||cr(i,i.return)),t.flags&32){x=t.stateNode;try{Gr(x,"")}catch(Re){Mt(t,t.return,Re)}}u&4&&t.stateNode!=null&&(x=t.memoizedProps,Vf(t,x,i!==null?i.memoizedProps:x)),u&1024&&(Kf=!0);break;case 6:if(Yn(a,t),Qn(t),u&4){if(t.stateNode===null)throw Error(l(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(Re){Mt(t,t.return,Re)}}break;case 3:if(eu=null,x=Ga,Ga=Zc(a.containerInfo),Yn(a,t),Ga=x,Qn(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Fl(a.containerInfo)}catch(Re){Mt(t,t.return,Re)}Kf&&(Kf=!1,Tx(t));break;case 4:u=Ga,Ga=Zc(t.stateNode.containerInfo),Yn(a,t),Qn(t),Ga=u;break;case 12:Yn(a,t),Qn(t);break;case 31:Yn(a,t),Qn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Uc(t,u)));break;case 13:Yn(a,t),Qn(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Bc=st()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Uc(t,u)));break;case 22:x=t.memoizedState!==null;var G=i!==null&&i.memoizedState!==null,se=Er,fe=hn;if(Er=se||x,hn=fe||G,Yn(a,t),hn=fe,Er=se,Qn(t),u&8192)e:for(a=t.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(i===null||G||Er||hn||Ys(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){G=i=a;try{if(v=G.stateNode,x)j=v.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{D=G.stateNode;var ge=G.memoizedProps.style,oe=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;D.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Re){Mt(G,G.return,Re)}}}else if(a.tag===6){if(i===null){G=a;try{G.stateNode.nodeValue=x?"":G.memoizedProps}catch(Re){Mt(G,G.return,Re)}}}else if(a.tag===18){if(i===null){G=a;try{var de=G.stateNode;x?gy(de,!0):gy(G.stateNode,!1)}catch(Re){Mt(G,G.return,Re)}}}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,Uc(t,i))));break;case 19:Yn(a,t),Qn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Uc(t,u)));break;case 30:break;case 21:break;default:Yn(a,t),Qn(t)}}function Qn(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(yx(u)){i=u;break}u=u.return}if(i==null)throw Error(l(160));switch(i.tag){case 27:var x=i.stateNode,v=Gf(t);zc(t,v,x);break;case 5:var j=i.stateNode;i.flags&32&&(Gr(j,""),i.flags&=-33);var D=Gf(t);zc(t,D,j);break;case 3:case 4:var G=i.stateNode.containerInfo,se=Gf(t);Wf(t,se,G);break;default:throw Error(l(161))}}catch(fe){Mt(t,t.return,fe)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function Tx(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;Tx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Rr(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)kx(t,a.alternate,a),a=a.sibling}function Ys(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:rs(4,a,a.return),Ys(a);break;case 1:cr(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&gx(a,a.return,i),Ys(a);break;case 27:Gi(a.stateNode);case 26:case 5:cr(a,a.return),Ys(a);break;case 22:a.memoizedState===null&&Ys(a);break;case 30:Ys(a);break;default:Ys(a)}t=t.sibling}}function Ir(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,x=t,v=a,j=v.flags;switch(v.tag){case 0:case 11:case 15:Ir(x,v,i),Di(4,v);break;case 1:if(Ir(x,v,i),u=v,x=u.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(se){Mt(u,u.return,se)}if(u=v,x=u.updateQueue,x!==null){var D=u.stateNode;try{var G=x.shared.hiddenCallbacks;if(G!==null)for(x.shared.hiddenCallbacks=null,x=0;x<G.length;x++)r0(G[x],D)}catch(se){Mt(u,u.return,se)}}i&&j&64&&px(v),zi(v,v.return);break;case 27:bx(v);case 26:case 5:Ir(x,v,i),i&&u===null&&j&4&&xx(v),zi(v,v.return);break;case 12:Ir(x,v,i);break;case 31:Ir(x,v,i),i&&j&4&&jx(x,v);break;case 13:Ir(x,v,i),i&&j&4&&Nx(x,v);break;case 22:v.memoizedState===null&&Ir(x,v,i),zi(v,v.return);break;case 30:break;default:Ir(x,v,i)}a=a.sibling}}function Yf(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&&Si(i))}function Qf(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Si(t))}function Wa(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Mx(t,a,i,u),a=a.sibling}function Mx(t,a,i,u){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Wa(t,a,i,u),x&2048&&Di(9,a);break;case 1:Wa(t,a,i,u);break;case 3:Wa(t,a,i,u),x&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Si(t)));break;case 12:if(x&2048){Wa(t,a,i,u),t=a.stateNode;try{var v=a.memoizedProps,j=v.id,D=v.onPostCommit;typeof D=="function"&&D(j,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(G){Mt(a,a.return,G)}}else Wa(t,a,i,u);break;case 31:Wa(t,a,i,u);break;case 13:Wa(t,a,i,u);break;case 23:break;case 22:v=a.stateNode,j=a.alternate,a.memoizedState!==null?v._visibility&2?Wa(t,a,i,u):Ui(t,a):v._visibility&2?Wa(t,a,i,u):(v._visibility|=2,Il(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),x&2048&&Yf(j,a);break;case 24:Wa(t,a,i,u),x&2048&&Qf(a.alternate,a);break;default:Wa(t,a,i,u)}}function Il(t,a,i,u,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=t,j=a,D=i,G=u,se=j.flags;switch(j.tag){case 0:case 11:case 15:Il(v,j,D,G,x),Di(8,j);break;case 23:break;case 22:var fe=j.stateNode;j.memoizedState!==null?fe._visibility&2?Il(v,j,D,G,x):Ui(v,j):(fe._visibility|=2,Il(v,j,D,G,x)),x&&se&2048&&Yf(j.alternate,j);break;case 24:Il(v,j,D,G,x),x&&se&2048&&Qf(j.alternate,j);break;default:Il(v,j,D,G,x)}a=a.sibling}}function Ui(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,x=u.flags;switch(u.tag){case 22:Ui(i,u),x&2048&&Yf(u.alternate,u);break;case 24:Ui(i,u),x&2048&&Qf(u.alternate,u);break;default:Ui(i,u)}a=a.sibling}}var $i=8192;function _l(t,a,i){if(t.subtreeFlags&$i)for(t=t.child;t!==null;)Ex(t,a,i),t=t.sibling}function Ex(t,a,i){switch(t.tag){case 26:_l(t,a,i),t.flags&$i&&t.memoizedState!==null&&h5(i,Ga,t.memoizedState,t.memoizedProps);break;case 5:_l(t,a,i);break;case 3:case 4:var u=Ga;Ga=Zc(t.stateNode.containerInfo),_l(t,a,i),Ga=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=$i,$i=16777216,_l(t,a,i),$i=u):_l(t,a,i));break;default:_l(t,a,i)}}function Ax(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function Bi(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];Tn=u,Ix(u,t)}Ax(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Rx(t),t=t.sibling}function Rx(t){switch(t.tag){case 0:case 11:case 15:Bi(t),t.flags&2048&&rs(9,t,t.return);break;case 3:Bi(t);break;case 12:Bi(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,$c(t)):Bi(t);break;default:Bi(t)}}function $c(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];Tn=u,Ix(u,t)}Ax(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:rs(8,a,a.return),$c(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,$c(a));break;default:$c(a)}t=t.sibling}}function Ix(t,a){for(;Tn!==null;){var i=Tn;switch(i.tag){case 0:case 11:case 15:rs(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:Si(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,Tn=u;else e:for(i=t;Tn!==null;){u=Tn;var x=u.sibling,v=u.return;if(wx(u),u===i){Tn=null;break e}if(x!==null){x.return=v,Tn=x;break e}Tn=v}}}var Ej={getCacheForType:function(t){var a=An(dn),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return An(dn).controller.signal}},Aj=typeof WeakMap=="function"?WeakMap:Map,St=0,Lt=null,nt=null,ot=0,Tt=0,ma=null,ss=!1,Ll=!1,Xf=!1,_r=0,Jt=0,ls=0,Qs=0,Zf=0,ha=0,Ol=0,Hi=null,Xn=null,Jf=!1,Bc=0,_x=0,Hc=1/0,Pc=null,is=null,kn=0,os=null,Dl=null,Lr=0,em=0,tm=null,Lx=null,Pi=0,nm=null;function pa(){return(St&2)!==0&&ot!==0?ot&-ot:V.T!==null?om():xt()}function Ox(){if(ha===0)if((ot&536870912)===0||mt){var t=Nt;Nt<<=1,(Nt&3932160)===0&&(Nt=262144),ha=t}else ha=536870912;return t=da.current,t!==null&&(t.flags|=32),ha}function Zn(t,a,i){(t===Lt&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)&&(zl(t,0),cs(t,ot,ha,!1)),On(t,i),((St&2)===0||t!==Lt)&&(t===Lt&&((St&2)===0&&(Qs|=i),Jt===4&&cs(t,ot,ha,!1)),ur(t))}function Dx(t,a,i){if((St&6)!==0)throw Error(l(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||It(t,a),x=u?_j(t,a):rm(t,a,!0),v=u;do{if(x===0){Ll&&!u&&cs(t,a,0,!1);break}else{if(i=t.current.alternate,v&&!Rj(i)){x=rm(t,a,!1),v=!1;continue}if(x===2){if(v=a,t.errorRecoveryDisabledLanes&v)var j=0;else j=t.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){a=j;e:{var D=t;x=Hi;var G=D.current.memoizedState.isDehydrated;if(G&&(zl(D,j).flags|=256),j=rm(D,j,!1),j!==2){if(Xf&&!G){D.errorRecoveryDisabledLanes|=v,Qs|=v,x=4;break e}v=Xn,Xn=x,v!==null&&(Xn===null?Xn=v:Xn.push.apply(Xn,v))}x=j}if(v=!1,x!==2)continue}}if(x===1){zl(t,0),cs(t,a,0,!0);break}e:{switch(u=t,v=x,v){case 0:case 1:throw Error(l(345));case 4:if((a&4194048)!==a)break;case 6:cs(u,a,ha,!ss);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((a&62914560)===a&&(x=Bc+300-st(),10<x)){if(cs(u,a,ha,!ss),Ct(u,0,!0)!==0)break e;Lr=a,u.timeoutHandle=my(zx.bind(null,u,i,Xn,Pc,Jf,a,ha,Qs,Ol,ss,v,"Throttled",-0,0),x);break e}zx(u,i,Xn,Pc,Jf,a,ha,Qs,Ol,ss,v,null,-0,0)}}break}while(!0);ur(t)}function zx(t,a,i,u,x,v,j,D,G,se,fe,ge,oe,de){if(t.timeoutHandle=-1,ge=a.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:it},Ex(a,v,ge);var Re=(v&62914560)===v?Bc-st():(v&4194048)===v?_x-st():0;if(Re=p5(ge,Re),Re!==null){Lr=v,t.cancelPendingCommit=Re(Vx.bind(null,t,a,v,i,u,x,j,D,G,fe,ge,null,oe,de)),cs(t,v,j,!se);return}}Vx(t,a,v,i,u,x,j,D,G)}function Rj(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 x=i[u],v=x.getSnapshot;x=x.value;try{if(!ca(v(),x))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 cs(t,a,i,u){a&=~Zf,a&=~Qs,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var x=a;0<x;){var v=31-Ve(x),j=1<<v;u[v]=-1,x&=~j}i!==0&&tr(t,i,a)}function Fc(){return(St&6)===0?(Fi(0),!1):!0}function am(){if(nt!==null){if(Tt===0)var t=nt.return;else t=nt,Sr=Hs=null,bf(t),Tl=null,Ni=0,t=nt;for(;t!==null;)hx(t.alternate,t),t=t.return;nt=null}}function zl(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,Xj(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),Lr=0,am(),Lt=t,nt=i=kr(t.current,null),ot=a,Tt=0,ma=null,ss=!1,Ll=It(t,a),Xf=!1,Ol=ha=Zf=Qs=ls=Jt=0,Xn=Hi=null,Jf=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var x=31-Ve(u),v=1<<x;a|=t[x],u&=~v}return _r=a,uc(),i}function Ux(t,a){Ze=null,V.H=_i,a===Cl||a===yc?(a=e0(),Tt=3):a===lf?(a=e0(),Tt=4):Tt=a===Of?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ma=a,nt===null&&(Jt=1,Ic(t,Aa(a,t.current)))}function $x(){var t=da.current;return t===null?!0:(ot&4194048)===ot?La===null:(ot&62914560)===ot||(ot&536870912)!==0?t===La:!1}function Bx(){var t=V.H;return V.H=_i,t===null?_i:t}function Hx(){var t=V.A;return V.A=Ej,t}function qc(){Jt=4,ss||(ot&4194048)!==ot&&da.current!==null||(Ll=!0),(ls&134217727)===0&&(Qs&134217727)===0||Lt===null||cs(Lt,ot,ha,!1)}function rm(t,a,i){var u=St;St|=2;var x=Bx(),v=Hx();(Lt!==t||ot!==a)&&(Pc=null,zl(t,a)),a=!1;var j=Jt;e:do try{if(Tt!==0&&nt!==null){var D=nt,G=ma;switch(Tt){case 8:am(),j=6;break e;case 3:case 2:case 9:case 6:da.current===null&&(a=!0);var se=Tt;if(Tt=0,ma=null,Ul(t,D,G,se),i&&Ll){j=0;break e}break;default:se=Tt,Tt=0,ma=null,Ul(t,D,G,se)}}Ij(),j=Jt;break}catch(fe){Ux(t,fe)}while(!0);return a&&t.shellSuspendCounter++,Sr=Hs=null,St=u,V.H=x,V.A=v,nt===null&&(Lt=null,ot=0,uc()),j}function Ij(){for(;nt!==null;)Px(nt)}function _j(t,a){var i=St;St|=2;var u=Bx(),x=Hx();Lt!==t||ot!==a?(Pc=null,Hc=st()+500,zl(t,a)):Ll=It(t,a);e:do try{if(Tt!==0&&nt!==null){a=nt;var v=ma;t:switch(Tt){case 1:Tt=0,ma=null,Ul(t,a,v,1);break;case 2:case 9:if(Zg(v)){Tt=0,ma=null,Fx(a);break}a=function(){Tt!==2&&Tt!==9||Lt!==t||(Tt=7),ur(t)},v.then(a,a);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:Zg(v)?(Tt=0,ma=null,Fx(a)):(Tt=0,ma=null,Ul(t,a,v,7));break;case 5:var j=null;switch(nt.tag){case 26:j=nt.memoizedState;case 5:case 27:var D=nt;if(j?My(j):D.stateNode.complete){Tt=0,ma=null;var G=D.sibling;if(G!==null)nt=G;else{var se=D.return;se!==null?(nt=se,Vc(se)):nt=null}break t}}Tt=0,ma=null,Ul(t,a,v,5);break;case 6:Tt=0,ma=null,Ul(t,a,v,6);break;case 8:am(),Jt=6;break e;default:throw Error(l(462))}}Lj();break}catch(fe){Ux(t,fe)}while(!0);return Sr=Hs=null,V.H=u,V.A=x,St=i,nt!==null?0:(Lt=null,ot=0,uc(),Jt)}function Lj(){for(;nt!==null&&!xn();)Px(nt)}function Px(t){var a=fx(t.alternate,t,_r);t.memoizedProps=t.pendingProps,a===null?Vc(t):nt=a}function Fx(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=lx(i,a,a.pendingProps,a.type,void 0,ot);break;case 11:a=lx(i,a,a.pendingProps,a.type.render,a.ref,ot);break;case 5:bf(a);default:hx(i,a),a=nt=Hg(a,_r),a=fx(i,a,_r)}t.memoizedProps=t.pendingProps,a===null?Vc(t):nt=a}function Ul(t,a,i,u){Sr=Hs=null,bf(a),Tl=null,Ni=0;var x=a.return;try{if(wj(t,x,a,i,ot)){Jt=1,Ic(t,Aa(i,t.current)),nt=null;return}}catch(v){if(x!==null)throw nt=x,v;Jt=1,Ic(t,Aa(i,t.current)),nt=null;return}a.flags&32768?(mt||u===1?t=!0:Ll||(ot&536870912)!==0?t=!1:(ss=t=!0,(u===2||u===9||u===3||u===6)&&(u=da.current,u!==null&&u.tag===13&&(u.flags|=16384))),qx(a,t)):Vc(a)}function Vc(t){var a=t;do{if((a.flags&32768)!==0){qx(a,ss);return}t=a.return;var i=Nj(a.alternate,a,_r);if(i!==null){nt=i;return}if(a=a.sibling,a!==null){nt=a;return}nt=a=t}while(a!==null);Jt===0&&(Jt=5)}function qx(t,a){do{var i=Cj(t.alternate,t);if(i!==null){i.flags&=32767,nt=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(t=t.sibling,t!==null)){nt=t;return}nt=t=i}while(t!==null);Jt=6,nt=null}function Vx(t,a,i,u,x,v,j,D,G){t.cancelPendingCommit=null;do Gc();while(kn!==0);if((St&6)!==0)throw Error(l(327));if(a!==null){if(a===t.current)throw Error(l(177));if(v=a.lanes|a.childLanes,v|=Vd,Nn(t,i,v,j,D,G),t===Lt&&(nt=Lt=null,ot=0),Dl=a,os=t,Lr=i,em=v,tm=x,Lx=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Uj(Ne,function(){return Qx(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,x=W.p,W.p=2,j=St,St|=4;try{Tj(t,a,i)}finally{St=j,W.p=x,V.T=u}}kn=1,Gx(),Wx(),Kx()}}function Gx(){if(kn===1){kn=0;var t=os,a=Dl,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=V.T,V.T=null;var u=W.p;W.p=2;var x=St;St|=4;try{Cx(a,t);var v=gm,j=Ig(t.containerInfo),D=v.focusedElem,G=v.selectionRange;if(j!==D&&D&&D.ownerDocument&&Rg(D.ownerDocument.documentElement,D)){if(G!==null&&Bd(D)){var se=G.start,fe=G.end;if(fe===void 0&&(fe=se),"selectionStart"in D)D.selectionStart=se,D.selectionEnd=Math.min(fe,D.value.length);else{var ge=D.ownerDocument||document,oe=ge&&ge.defaultView||window;if(oe.getSelection){var de=oe.getSelection(),Re=D.textContent.length,Be=Math.min(G.start,Re),Rt=G.end===void 0?Be:Math.min(G.end,Re);!de.extend&&Be>Rt&&(j=Rt,Rt=Be,Be=j);var J=Ag(D,Be),Y=Ag(D,Rt);if(J&&Y&&(de.rangeCount!==1||de.anchorNode!==J.node||de.anchorOffset!==J.offset||de.focusNode!==Y.node||de.focusOffset!==Y.offset)){var ne=ge.createRange();ne.setStart(J.node,J.offset),de.removeAllRanges(),Be>Rt?(de.addRange(ne),de.extend(Y.node,Y.offset)):(ne.setEnd(Y.node,Y.offset),de.addRange(ne))}}}}for(ge=[],de=D;de=de.parentNode;)de.nodeType===1&&ge.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;D<ge.length;D++){var pe=ge[D];pe.element.scrollLeft=pe.left,pe.element.scrollTop=pe.top}}ru=!!pm,gm=pm=null}finally{St=x,W.p=u,V.T=i}}t.current=a,kn=2}}function Wx(){if(kn===2){kn=0;var t=os,a=Dl,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=V.T,V.T=null;var u=W.p;W.p=2;var x=St;St|=4;try{kx(t,a.alternate,a)}finally{St=x,W.p=u,V.T=i}}kn=3}}function Kx(){if(kn===4||kn===3){kn=0,yn();var t=os,a=Dl,i=Lr,u=Lx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?kn=5:(kn=0,Dl=os=null,Yx(t,t.pendingLanes));var x=t.pendingLanes;if(x===0&&(is=null),lt(i),a=a.stateNode,Te&&typeof Te.onCommitFiberRoot=="function")try{Te.onCommitFiberRoot(Me,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=V.T,x=W.p,W.p=2,V.T=null;try{for(var v=t.onRecoverableError,j=0;j<u.length;j++){var D=u[j];v(D.value,{componentStack:D.stack})}}finally{V.T=a,W.p=x}}(Lr&3)!==0&&Gc(),ur(t),x=t.pendingLanes,(i&261930)!==0&&(x&42)!==0?t===nm?Pi++:(Pi=0,nm=t):Pi=0,Fi(0)}}function Yx(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,Si(a)))}function Gc(){return Gx(),Wx(),Kx(),Qx()}function Qx(){if(kn!==5)return!1;var t=os,a=em;em=0;var i=lt(Lr),u=V.T,x=W.p;try{W.p=32>i?32:i,V.T=null,i=tm,tm=null;var v=os,j=Lr;if(kn=0,Dl=os=null,Lr=0,(St&6)!==0)throw Error(l(331));var D=St;if(St|=4,Rx(v.current),Mx(v,v.current,j,i),St=D,Fi(0,!1),Te&&typeof Te.onPostCommitFiberRoot=="function")try{Te.onPostCommitFiberRoot(Me,v)}catch{}return!0}finally{W.p=x,V.T=u,Yx(t,a)}}function Xx(t,a,i){a=Aa(i,a),a=Lf(t.stateNode,a,2),t=ts(t,a,2),t!==null&&(On(t,2),ur(t))}function Mt(t,a,i){if(t.tag===3)Xx(t,t,i);else for(;a!==null;){if(a.tag===3){Xx(a,t,i);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(is===null||!is.has(u))){t=Aa(i,t),i=Z0(2),u=ts(a,i,2),u!==null&&(J0(i,u,a,t),On(u,2),ur(u));break}}a=a.return}}function sm(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new Aj;var x=new Set;u.set(a,x)}else x=u.get(a),x===void 0&&(x=new Set,u.set(a,x));x.has(i)||(Xf=!0,x.add(i),t=Oj.bind(null,t,a,i),a.then(t,t))}function Oj(t,a,i){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,Lt===t&&(ot&i)===i&&(Jt===4||Jt===3&&(ot&62914560)===ot&&300>st()-Bc?(St&2)===0&&zl(t,0):Zf|=i,Ol===ot&&(Ol=0)),ur(t)}function Zx(t,a){a===0&&(a=Vn()),t=Us(t,a),t!==null&&(On(t,a),ur(t))}function Dj(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),Zx(t,i)}function zj(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,x=t.memoizedState;x!==null&&(i=x.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(l(314))}u!==null&&u.delete(a),Zx(t,i)}function Uj(t,a){return wn(t,a)}var Wc=null,$l=null,lm=!1,Kc=!1,im=!1,us=0;function ur(t){t!==$l&&t.next===null&&($l===null?Wc=$l=t:$l=$l.next=t),Kc=!0,lm||(lm=!0,Bj())}function Fi(t,a){if(!im&&Kc){im=!0;do for(var i=!1,u=Wc;u!==null;){if(t!==0){var x=u.pendingLanes;if(x===0)var v=0;else{var j=u.suspendedLanes,D=u.pingedLanes;v=(1<<31-Ve(42|t)+1)-1,v&=x&~(j&~D),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(i=!0,ny(u,v))}else v=ot,v=Ct(u,u===Lt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||It(u,v)||(i=!0,ny(u,v));u=u.next}while(i);im=!1}}function $j(){Jx()}function Jx(){Kc=lm=!1;var t=0;us!==0&&Qj()&&(t=us);for(var a=st(),i=null,u=Wc;u!==null;){var x=u.next,v=ey(u,a);v===0?(u.next=null,i===null?Wc=x:i.next=x,x===null&&($l=i)):(i=u,(t!==0||(v&3)!==0)&&(Kc=!0)),u=x}kn!==0&&kn!==5||Fi(t),us!==0&&(us=0)}function ey(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,x=t.expirationTimes,v=t.pendingLanes&-62914561;0<v;){var j=31-Ve(v),D=1<<j,G=x[j];G===-1?((D&i)===0||(D&u)!==0)&&(x[j]=jn(D,a)):G<=a&&(t.expiredLanes|=D),v&=~D}if(a=Lt,i=ot,i=Ct(t,t===a?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===a&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Pt(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||It(t,i)){if(a=i&-i,a===t.callbackPriority)return a;switch(u!==null&&Pt(u),lt(i)){case 2:case 8:i=me;break;case 32:i=Ne;break;case 268435456:i=Oe;break;default:i=Ne}return u=ty.bind(null,t),i=wn(i,u),t.callbackPriority=a,t.callbackNode=i,a}return u!==null&&u!==null&&Pt(u),t.callbackPriority=2,t.callbackNode=null,2}function ty(t,a){if(kn!==0&&kn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(Gc()&&t.callbackNode!==i)return null;var u=ot;return u=Ct(t,t===Lt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(Dx(t,u,a),ey(t,st()),t.callbackNode!=null&&t.callbackNode===i?ty.bind(null,t):null)}function ny(t,a){if(Gc())return null;Dx(t,a,!0)}function Bj(){Zj(function(){(St&6)!==0?wn(X,$j):Jx()})}function om(){if(us===0){var t=jl;t===0&&(t=bn,bn<<=1,(bn&261888)===0&&(bn=256)),us=t}return us}function ay(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:pt(""+t)}function ry(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 Hj(t,a,i,u,x){if(a==="submit"&&i&&i.stateNode===x){var v=ay((x[Qt]||null).action),j=u.submitter;j&&(a=(a=j[Qt]||null)?ay(a.formAction):j.getAttribute("formAction"),a!==null&&(v=a,j=null));var D=new lc("action","action",null,u,x);t.push({event:D,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(us!==0){var G=j?ry(x,j):new FormData(x);Mf(i,{pending:!0,data:G,method:x.method,action:v},null,G)}}else typeof v=="function"&&(D.preventDefault(),G=j?ry(x,j):new FormData(x),Mf(i,{pending:!0,data:G,method:x.method,action:v},v,G))},currentTarget:x}]})}}for(var cm=0;cm<qd.length;cm++){var um=qd[cm],Pj=um.toLowerCase(),Fj=um[0].toUpperCase()+um.slice(1);Va(Pj,"on"+Fj)}Va(Og,"onAnimationEnd"),Va(Dg,"onAnimationIteration"),Va(zg,"onAnimationStart"),Va("dblclick","onDoubleClick"),Va("focusin","onFocus"),Va("focusout","onBlur"),Va(sj,"onTransitionRun"),Va(lj,"onTransitionStart"),Va(ij,"onTransitionCancel"),Va(Ug,"onTransitionEnd"),Ca("onMouseEnter",["mouseout","mouseover"]),Ca("onMouseLeave",["mouseout","mouseover"]),Ca("onPointerEnter",["pointerout","pointerover"]),Ca("onPointerLeave",["pointerout","pointerover"]),Hn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),qj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qi));function sy(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],x=u.event;u=u.listeners;e:{var v=void 0;if(a)for(var j=u.length-1;0<=j;j--){var D=u[j],G=D.instance,se=D.currentTarget;if(D=D.listener,G!==v&&x.isPropagationStopped())break e;v=D,x.currentTarget=se;try{v(x)}catch(fe){cc(fe)}x.currentTarget=null,v=G}else for(j=0;j<u.length;j++){if(D=u[j],G=D.instance,se=D.currentTarget,D=D.listener,G!==v&&x.isPropagationStopped())break e;v=D,x.currentTarget=se;try{v(x)}catch(fe){cc(fe)}x.currentTarget=null,v=G}}}}function at(t,a){var i=a[oa];i===void 0&&(i=a[oa]=new Set);var u=t+"__bubble";i.has(u)||(ly(a,t,2,!1),i.add(u))}function dm(t,a,i){var u=0;a&&(u|=4),ly(i,t,u,a)}var Yc="_reactListening"+Math.random().toString(36).slice(2);function fm(t){if(!t[Yc]){t[Yc]=!0,As.forEach(function(i){i!=="selectionchange"&&(qj.has(i)||dm(i,!1,t),dm(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Yc]||(a[Yc]=!0,dm("selectionchange",!1,a))}}function ly(t,a,i,u){switch(Oy(a)){case 2:var x=y5;break;case 8:x=b5;break;default:x=Tm}i=x.bind(null,a,i,t),x=void 0,!Rd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),u?x!==void 0?t.addEventListener(a,i,{capture:!0,passive:x}):t.addEventListener(a,i,!0):x!==void 0?t.addEventListener(a,i,{passive:x}):t.addEventListener(a,i,!1)}function mm(t,a,i,u,x){var v=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var j=u.tag;if(j===3||j===4){var D=u.stateNode.containerInfo;if(D===x)break;if(j===4)for(j=u.return;j!==null;){var G=j.tag;if((G===3||G===4)&&j.stateNode.containerInfo===x)return;j=j.return}for(;D!==null;){if(j=Na(D),j===null)return;if(G=j.tag,G===5||G===6||G===26||G===27){u=v=j;continue e}D=D.parentNode}}u=u.return}dg(function(){var se=v,fe=_s(i),ge=[];e:{var oe=$g.get(t);if(oe!==void 0){var de=lc,Re=t;switch(t){case"keypress":if(rc(i)===0)break e;case"keydown":case"keyup":de=zS;break;case"focusin":Re="focus",de=Od;break;case"focusout":Re="blur",de=Od;break;case"beforeblur":case"afterblur":de=Od;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":de=hg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=NS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=BS;break;case Og:case Dg:case zg:de=MS;break;case Ug:de=PS;break;case"scroll":case"scrollend":de=SS;break;case"wheel":de=qS;break;case"copy":case"cut":case"paste":de=AS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=gg;break;case"toggle":case"beforetoggle":de=GS}var Be=(a&4)!==0,Rt=!Be&&(t==="scroll"||t==="scrollend"),J=Be?oe!==null?oe+"Capture":null:oe;Be=[];for(var Y=se,ne;Y!==null;){var pe=Y;if(ne=pe.stateNode,pe=pe.tag,pe!==5&&pe!==26&&pe!==27||ne===null||J===null||(pe=fi(Y,J),pe!=null&&Be.push(Vi(Y,pe,ne))),Rt)break;Y=Y.return}0<Be.length&&(oe=new de(oe,Re,null,i,fe),ge.push({event:oe,listeners:Be}))}}if((a&7)===0){e:{if(oe=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",oe&&i!==Ma&&(Re=i.relatedTarget||i.fromElement)&&(Na(Re)||Re[Xt]))break e;if((de||oe)&&(oe=fe.window===fe?fe:(oe=fe.ownerDocument)?oe.defaultView||oe.parentWindow:window,de?(Re=i.relatedTarget||i.toElement,de=se,Re=Re?Na(Re):null,Re!==null&&(Rt=c(Re),Be=Re.tag,Re!==Rt||Be!==5&&Be!==27&&Be!==6)&&(Re=null)):(de=null,Re=se),de!==Re)){if(Be=hg,pe="onMouseLeave",J="onMouseEnter",Y="mouse",(t==="pointerout"||t==="pointerover")&&(Be=gg,pe="onPointerLeave",J="onPointerEnter",Y="pointer"),Rt=de==null?oe:rr(de),ne=Re==null?oe:rr(Re),oe=new Be(pe,Y+"leave",de,i,fe),oe.target=Rt,oe.relatedTarget=ne,pe=null,Na(fe)===se&&(Be=new Be(J,Y+"enter",Re,i,fe),Be.target=ne,Be.relatedTarget=Rt,pe=Be),Rt=pe,de&&Re)t:{for(Be=Vj,J=de,Y=Re,ne=0,pe=J;pe;pe=Be(pe))ne++;pe=0;for(var ze=Y;ze;ze=Be(ze))pe++;for(;0<ne-pe;)J=Be(J),ne--;for(;0<pe-ne;)Y=Be(Y),pe--;for(;ne--;){if(J===Y||Y!==null&&J===Y.alternate){Be=J;break t}J=Be(J),Y=Be(Y)}Be=null}else Be=null;de!==null&&iy(ge,oe,de,Be,!1),Re!==null&&Rt!==null&&iy(ge,Rt,Re,Be,!0)}}e:{if(oe=se?rr(se):window,de=oe.nodeName&&oe.nodeName.toLowerCase(),de==="select"||de==="input"&&oe.type==="file")var vt=jg;else if(wg(oe))if(Ng)vt=nj;else{vt=ej;var Le=JS}else de=oe.nodeName,!de||de.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?se&&le(se.elementType)&&(vt=jg):vt=tj;if(vt&&(vt=vt(t,se))){Sg(ge,vt,i,fe);break e}Le&&Le(t,oe,se),t==="focusout"&&se&&oe.type==="number"&&se.memoizedProps.value!=null&&Is(oe,"number",oe.value)}switch(Le=se?rr(se):window,t){case"focusin":(wg(Le)||Le.contentEditable==="true")&&(gl=Le,Hd=se,vi=null);break;case"focusout":vi=Hd=gl=null;break;case"mousedown":Pd=!0;break;case"contextmenu":case"mouseup":case"dragend":Pd=!1,_g(ge,i,fe);break;case"selectionchange":if(rj)break;case"keydown":case"keyup":_g(ge,i,fe)}var Je;if(zd)e:{switch(t){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else pl?vg(t,i)&&(ct="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(ct="onCompositionStart");ct&&(xg&&i.locale!=="ko"&&(pl||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&pl&&(Je=fg()):(Kr=fe,Id="value"in Kr?Kr.value:Kr.textContent,pl=!0)),Le=Qc(se,ct),0<Le.length&&(ct=new pg(ct,t,null,i,fe),ge.push({event:ct,listeners:Le}),Je?ct.data=Je:(Je=kg(i),Je!==null&&(ct.data=Je)))),(Je=KS?YS(t,i):QS(t,i))&&(ct=Qc(se,"onBeforeInput"),0<ct.length&&(Le=new pg("onBeforeInput","beforeinput",null,i,fe),ge.push({event:Le,listeners:ct}),Le.data=Je)),Hj(ge,t,se,i,fe)}sy(ge,a)})}function Vi(t,a,i){return{instance:t,listener:a,currentTarget:i}}function Qc(t,a){for(var i=a+"Capture",u=[];t!==null;){var x=t,v=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||v===null||(x=fi(t,i),x!=null&&u.unshift(Vi(t,x,v)),x=fi(t,a),x!=null&&u.push(Vi(t,x,v))),t.tag===3)return u;t=t.return}return[]}function Vj(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function iy(t,a,i,u,x){for(var v=a._reactName,j=[];i!==null&&i!==u;){var D=i,G=D.alternate,se=D.stateNode;if(D=D.tag,G!==null&&G===u)break;D!==5&&D!==26&&D!==27||se===null||(G=se,x?(se=fi(i,v),se!=null&&j.unshift(Vi(i,se,G))):x||(se=fi(i,v),se!=null&&j.push(Vi(i,se,G)))),i=i.return}j.length!==0&&t.push({event:a,listeners:j})}var Gj=/\r\n?/g,Wj=/\u0000|\uFFFD/g;function oy(t){return(typeof t=="string"?t:""+t).replace(Gj,`
|
|
9
|
-
`).replace(Wj,"")}function cy(t,a){return a=oy(a),oy(t)===a}function At(t,a,i,u,x,v){switch(i){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||Gr(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&Gr(t,""+u);break;case"className":ue(t,"class",u);break;case"tabIndex":ue(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":ue(t,i,u);break;case"style":di(t,u,v);break;case"data":if(a!=="object"){ue(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=pt(""+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 v=="function"&&(i==="formAction"?(a!=="input"&&At(t,a,"name",x.name,x,null),At(t,a,"formEncType",x.formEncType,x,null),At(t,a,"formMethod",x.formMethod,x,null),At(t,a,"formTarget",x.formTarget,x,null)):(At(t,a,"encType",x.encType,x,null),At(t,a,"method",x.method,x,null),At(t,a,"target",x.target,x,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=pt(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=it);break;case"onScroll":u!=null&&at("scroll",t);break;case"onScrollEnd":u!=null&&at("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(l(61));if(i=u.__html,i!=null){if(x.children!=null)throw Error(l(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=pt(""+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":at("beforetoggle",t),at("toggle",t),lr(t,"popover",u);break;case"xlinkActuate":Se(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Se(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Se(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Se(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Se(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Se(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Se(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Se(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Se(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":lr(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=je.get(i)||i,lr(t,i,u))}}function hm(t,a,i,u,x,v){switch(i){case"style":di(t,u,v);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(l(61));if(i=u.__html,i!=null){if(x.children!=null)throw Error(l(60));t.innerHTML=i}}break;case"children":typeof u=="string"?Gr(t,u):(typeof u=="number"||typeof u=="bigint")&&Gr(t,""+u);break;case"onScroll":u!=null&&at("scroll",t);break;case"onScrollEnd":u!=null&&at("scrollend",t);break;case"onClick":u!=null&&(t.onclick=it);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rs.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(x=i.endsWith("Capture"),a=i.slice(2,x?i.length-7:void 0),v=t[Qt]||null,v=v!=null?v[i]:null,typeof v=="function"&&t.removeEventListener(a,v,x),typeof u=="function")){typeof v!="function"&&v!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,x);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):lr(t,i,u)}}}function In(t,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",t),at("load",t);var u=!1,x=!1,v;for(v in i)if(i.hasOwnProperty(v)){var j=i[v];if(j!=null)switch(v){case"src":u=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,a));default:At(t,a,v,j,i,null)}}x&&At(t,a,"srcSet",i.srcSet,i,null),u&&At(t,a,"src",i.src,i,null);return;case"input":at("invalid",t);var D=v=j=x=null,G=null,se=null;for(u in i)if(i.hasOwnProperty(u)){var fe=i[u];if(fe!=null)switch(u){case"name":x=fe;break;case"type":j=fe;break;case"checked":G=fe;break;case"defaultChecked":se=fe;break;case"value":v=fe;break;case"defaultValue":D=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(l(137,a));break;default:At(t,a,u,fe,i,null)}}hl(t,v,D,G,se,j,x,!1);return;case"select":at("invalid",t),u=j=v=null;for(x in i)if(i.hasOwnProperty(x)&&(D=i[x],D!=null))switch(x){case"value":v=D;break;case"defaultValue":j=D;break;case"multiple":u=D;default:At(t,a,x,D,i,null)}a=v,i=j,t.multiple=!!u,a!=null?Dn(t,!!u,a,!1):i!=null&&Dn(t,!!u,i,!0);return;case"textarea":at("invalid",t),v=x=u=null;for(j in i)if(i.hasOwnProperty(j)&&(D=i[j],D!=null))switch(j){case"value":u=D;break;case"defaultValue":x=D;break;case"children":v=D;break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(l(91));break;default:At(t,a,j,D,i,null)}nc(t,u,x,v);return;case"option":for(G in i)i.hasOwnProperty(G)&&(u=i[G],u!=null)&&(G==="selected"?t.selected=u&&typeof u!="function"&&typeof u!="symbol":At(t,a,G,u,i,null));return;case"dialog":at("beforetoggle",t),at("toggle",t),at("cancel",t),at("close",t);break;case"iframe":case"object":at("load",t);break;case"video":case"audio":for(u=0;u<qi.length;u++)at(qi[u],t);break;case"image":at("error",t),at("load",t);break;case"details":at("toggle",t);break;case"embed":case"source":case"link":at("error",t),at("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(se in i)if(i.hasOwnProperty(se)&&(u=i[se],u!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,a));default:At(t,a,se,u,i,null)}return;default:if(le(a)){for(fe in i)i.hasOwnProperty(fe)&&(u=i[fe],u!==void 0&&hm(t,a,fe,u,i,void 0));return}}for(D in i)i.hasOwnProperty(D)&&(u=i[D],u!=null&&At(t,a,D,u,i,null))}function Kj(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 x=null,v=null,j=null,D=null,G=null,se=null,fe=null;for(de in i){var ge=i[de];if(i.hasOwnProperty(de)&&ge!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":G=ge;default:u.hasOwnProperty(de)||At(t,a,de,null,u,ge)}}for(var oe in u){var de=u[oe];if(ge=i[oe],u.hasOwnProperty(oe)&&(de!=null||ge!=null))switch(oe){case"type":v=de;break;case"name":x=de;break;case"checked":se=de;break;case"defaultChecked":fe=de;break;case"value":j=de;break;case"defaultValue":D=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(l(137,a));break;default:de!==ge&&At(t,a,oe,de,u,ge)}}br(t,j,D,G,se,fe,v,x);return;case"select":de=j=D=oe=null;for(v in i)if(G=i[v],i.hasOwnProperty(v)&&G!=null)switch(v){case"value":break;case"multiple":de=G;default:u.hasOwnProperty(v)||At(t,a,v,null,u,G)}for(x in u)if(v=u[x],G=i[x],u.hasOwnProperty(x)&&(v!=null||G!=null))switch(x){case"value":oe=v;break;case"defaultValue":D=v;break;case"multiple":j=v;default:v!==G&&At(t,a,x,v,u,G)}a=D,i=j,u=de,oe!=null?Dn(t,!!i,oe,!1):!!u!=!!i&&(a!=null?Dn(t,!!i,a,!0):Dn(t,!!i,i?[]:"",!1));return;case"textarea":de=oe=null;for(D in i)if(x=i[D],i.hasOwnProperty(D)&&x!=null&&!u.hasOwnProperty(D))switch(D){case"value":break;case"children":break;default:At(t,a,D,null,u,x)}for(j in u)if(x=u[j],v=i[j],u.hasOwnProperty(j)&&(x!=null||v!=null))switch(j){case"value":oe=x;break;case"defaultValue":de=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(l(91));break;default:x!==v&&At(t,a,j,x,u,v)}tc(t,oe,de);return;case"option":for(var Re in i)oe=i[Re],i.hasOwnProperty(Re)&&oe!=null&&!u.hasOwnProperty(Re)&&(Re==="selected"?t.selected=!1:At(t,a,Re,null,u,oe));for(G in u)oe=u[G],de=i[G],u.hasOwnProperty(G)&&oe!==de&&(oe!=null||de!=null)&&(G==="selected"?t.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":At(t,a,G,oe,u,de));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 Be in i)oe=i[Be],i.hasOwnProperty(Be)&&oe!=null&&!u.hasOwnProperty(Be)&&At(t,a,Be,null,u,oe);for(se in u)if(oe=u[se],de=i[se],u.hasOwnProperty(se)&&oe!==de&&(oe!=null||de!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(l(137,a));break;default:At(t,a,se,oe,u,de)}return;default:if(le(a)){for(var Rt in i)oe=i[Rt],i.hasOwnProperty(Rt)&&oe!==void 0&&!u.hasOwnProperty(Rt)&&hm(t,a,Rt,void 0,u,oe);for(fe in u)oe=u[fe],de=i[fe],!u.hasOwnProperty(fe)||oe===de||oe===void 0&&de===void 0||hm(t,a,fe,oe,u,de);return}}for(var J in i)oe=i[J],i.hasOwnProperty(J)&&oe!=null&&!u.hasOwnProperty(J)&&At(t,a,J,null,u,oe);for(ge in u)oe=u[ge],de=i[ge],!u.hasOwnProperty(ge)||oe===de||oe==null&&de==null||At(t,a,ge,oe,u,de)}function uy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Yj(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var x=i[u],v=x.transferSize,j=x.initiatorType,D=x.duration;if(v&&D&&uy(j)){for(j=0,D=x.responseEnd,u+=1;u<i.length;u++){var G=i[u],se=G.startTime;if(se>D)break;var fe=G.transferSize,ge=G.initiatorType;fe&&uy(ge)&&(G=G.responseEnd,j+=fe*(G<D?1:(D-se)/(G-se)))}if(--u,a+=8*(v+j)/(x.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 pm=null,gm=null;function Xc(t){return t.nodeType===9?t:t.ownerDocument}function dy(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 fy(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 xm(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 ym=null;function Qj(){var t=window.event;return t&&t.type==="popstate"?t===ym?!1:(ym=t,!0):(ym=null,!1)}var my=typeof setTimeout=="function"?setTimeout:void 0,Xj=typeof clearTimeout=="function"?clearTimeout:void 0,hy=typeof Promise=="function"?Promise:void 0,Zj=typeof queueMicrotask=="function"?queueMicrotask:typeof hy<"u"?function(t){return hy.resolve(null).then(t).catch(Jj)}:my;function Jj(t){setTimeout(function(){throw t})}function ds(t){return t==="head"}function py(t,a){var i=a,u=0;do{var x=i.nextSibling;if(t.removeChild(i),x&&x.nodeType===8)if(i=x.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(x),Fl(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")Gi(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,Gi(i);for(var v=i.firstChild;v;){var j=v.nextSibling,D=v.nodeName;v[Gn]||D==="SCRIPT"||D==="STYLE"||D==="LINK"&&v.rel.toLowerCase()==="stylesheet"||i.removeChild(v),v=j}}else i==="body"&&Gi(t.ownerDocument.body);i=x}while(i);Fl(a)}function gy(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 bm(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":bm(i),nr(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function e5(t,a,i,u){for(;t.nodeType===1;){var x=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Gn])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(v=t.getAttribute("rel"),v==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(v!==x.rel||t.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||t.getAttribute("title")!==(x.title==null?null:x.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(v=t.getAttribute("src"),(v!==(x.src==null?null:x.src)||t.getAttribute("type")!==(x.type==null?null:x.type)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&v&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var v=x.name==null?null:""+x.name;if(x.type==="hidden"&&t.getAttribute("name")===v)return t}else return t;if(t=Oa(t.nextSibling),t===null)break}return null}function t5(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Oa(t.nextSibling),t===null))return null;return t}function xy(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Oa(t.nextSibling),t===null))return null;return t}function vm(t){return t.data==="$?"||t.data==="$~"}function km(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function n5(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 Oa(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 wm=null;function yy(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return Oa(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function by(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 vy(t,a,i){switch(a=Xc(i),t){case"html":if(t=a.documentElement,!t)throw Error(l(452));return t;case"head":if(t=a.head,!t)throw Error(l(453));return t;case"body":if(t=a.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function Gi(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);nr(t)}var Da=new Map,ky=new Set;function Zc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Or=W.d;W.d={f:a5,r:r5,D:s5,C:l5,L:i5,m:o5,X:u5,S:c5,M:d5};function a5(){var t=Or.f(),a=Fc();return t||a}function r5(t){var a=ar(t);a!==null&&a.tag===5&&a.type==="form"?U0(a):Or.r(t)}var Bl=typeof document>"u"?null:document;function wy(t,a,i){var u=Bl;if(u&&typeof a=="string"&&a){var x=un(a);x='link[rel="'+t+'"][href="'+x+'"]',typeof i=="string"&&(x+='[crossorigin="'+i+'"]'),ky.has(x)||(ky.add(x),t={rel:t,crossOrigin:i,href:a},u.querySelector(x)===null&&(a=u.createElement("link"),In(a,"link",t),Ut(a),u.head.appendChild(a)))}}function s5(t){Or.D(t),wy("dns-prefetch",t,null)}function l5(t,a){Or.C(t,a),wy("preconnect",t,a)}function i5(t,a,i){Or.L(t,a,i);var u=Bl;if(u&&t&&a){var x='link[rel="preload"][as="'+un(a)+'"]';a==="image"&&i&&i.imageSrcSet?(x+='[imagesrcset="'+un(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(x+='[imagesizes="'+un(i.imageSizes)+'"]')):x+='[href="'+un(t)+'"]';var v=x;switch(a){case"style":v=Hl(t);break;case"script":v=Pl(t)}Da.has(v)||(t=y({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),Da.set(v,t),u.querySelector(x)!==null||a==="style"&&u.querySelector(Wi(v))||a==="script"&&u.querySelector(Ki(v))||(a=u.createElement("link"),In(a,"link",t),Ut(a),u.head.appendChild(a)))}}function o5(t,a){Or.m(t,a);var i=Bl;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+un(u)+'"][href="'+un(t)+'"]',v=x;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Pl(t)}if(!Da.has(v)&&(t=y({rel:"modulepreload",href:t},a),Da.set(v,t),i.querySelector(x)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Ki(v)))return}u=i.createElement("link"),In(u,"link",t),Ut(u),i.head.appendChild(u)}}}function c5(t,a,i){Or.S(t,a,i);var u=Bl;if(u&&t){var x=Bn(u).hoistableStyles,v=Hl(t);a=a||"default";var j=x.get(v);if(!j){var D={loading:0,preload:null};if(j=u.querySelector(Wi(v)))D.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":a},i),(i=Da.get(v))&&Sm(t,i);var G=j=u.createElement("link");Ut(G),In(G,"link",t),G._p=new Promise(function(se,fe){G.onload=se,G.onerror=fe}),G.addEventListener("load",function(){D.loading|=1}),G.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Jc(j,a,u)}j={type:"stylesheet",instance:j,count:1,state:D},x.set(v,j)}}}function u5(t,a){Or.X(t,a);var i=Bl;if(i&&t){var u=Bn(i).hoistableScripts,x=Pl(t),v=u.get(x);v||(v=i.querySelector(Ki(x)),v||(t=y({src:t,async:!0},a),(a=Da.get(x))&&jm(t,a),v=i.createElement("script"),Ut(v),In(v,"link",t),i.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(x,v))}}function d5(t,a){Or.M(t,a);var i=Bl;if(i&&t){var u=Bn(i).hoistableScripts,x=Pl(t),v=u.get(x);v||(v=i.querySelector(Ki(x)),v||(t=y({src:t,async:!0,type:"module"},a),(a=Da.get(x))&&jm(t,a),v=i.createElement("script"),Ut(v),In(v,"link",t),i.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(x,v))}}function Sy(t,a,i,u){var x=(x=ae.current)?Zc(x):null;if(!x)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=Hl(i.href),i=Bn(x).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=Hl(i.href);var v=Bn(x).hoistableStyles,j=v.get(t);if(j||(x=x.ownerDocument||x,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,j),(v=x.querySelector(Wi(t)))&&!v._p&&(j.instance=v,j.state.loading=5),Da.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},Da.set(t,i),v||f5(x,t,i,j.state))),a&&u===null)throw Error(l(528,""));return j}if(a&&u!==null)throw Error(l(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Pl(i),i=Bn(x).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(l(444,t))}}function Hl(t){return'href="'+un(t)+'"'}function Wi(t){return'link[rel="stylesheet"]['+t+"]"}function jy(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function f5(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}),In(a,"link",i),Ut(a),t.head.appendChild(a))}function Pl(t){return'[src="'+un(t)+'"]'}function Ki(t){return"script[async]"+t}function Ny(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+un(i.href)+'"]');if(u)return a.instance=u,Ut(u),u;var x=y({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Ut(u),In(u,"style",x),Jc(u,i.precedence,t),a.instance=u;case"stylesheet":x=Hl(i.href);var v=t.querySelector(Wi(x));if(v)return a.state.loading|=4,a.instance=v,Ut(v),v;u=jy(i),(x=Da.get(x))&&Sm(u,x),v=(t.ownerDocument||t).createElement("link"),Ut(v);var j=v;return j._p=new Promise(function(D,G){j.onload=D,j.onerror=G}),In(v,"link",u),a.state.loading|=4,Jc(v,i.precedence,t),a.instance=v;case"script":return v=Pl(i.src),(x=t.querySelector(Ki(v)))?(a.instance=x,Ut(x),x):(u=i,(x=Da.get(v))&&(u=y({},i),jm(u,x)),t=t.ownerDocument||t,x=t.createElement("script"),Ut(x),In(x,"link",u),t.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(l(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Jc(u,i.precedence,t));return a.instance}function Jc(t,a,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=u.length?u[u.length-1]:null,v=x,j=0;j<u.length;j++){var D=u[j];if(D.dataset.precedence===a)v=D;else if(v!==x)break}v?v.parentNode.insertBefore(t,v.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function Sm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function jm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var eu=null;function Cy(t,a,i){if(eu===null){var u=new Map,x=eu=new Map;x.set(i,u)}else x=eu,u=x.get(i),u||(u=new Map,x.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),x=0;x<i.length;x++){var v=i[x];if(!(v[Gn]||v[bt]||t==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var j=v.getAttribute(a)||"";j=t+j;var D=u.get(j);D?D.push(v):u.set(j,[v])}}return u}function Ty(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function m5(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 My(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function h5(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 x=Hl(u.href),v=a.querySelector(Wi(x));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=tu.bind(t),a.then(t,t)),i.state.loading|=4,i.instance=v,Ut(v);return}v=a.ownerDocument||a,u=jy(u),(x=Da.get(x))&&Sm(u,x),v=v.createElement("link"),Ut(v);var j=v;j._p=new Promise(function(D,G){j.onload=D,j.onerror=G}),In(v,"link",u),i.instance=v}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=tu.bind(t),a.addEventListener("load",i),a.addEventListener("error",i))}}var Nm=0;function p5(t,a){return t.stylesheets&&t.count===0&&au(t,t.stylesheets),0<t.count||0<t.imgCount?function(i){var u=setTimeout(function(){if(t.stylesheets&&au(t,t.stylesheets),t.unsuspend){var v=t.unsuspend;t.unsuspend=null,v()}},6e4+a);0<t.imgBytes&&Nm===0&&(Nm=62500*Yj());var x=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&au(t,t.stylesheets),t.unsuspend)){var v=t.unsuspend;t.unsuspend=null,v()}},(t.imgBytes>Nm?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(x)}}:null}function tu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)au(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var nu=null;function au(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,nu=new Map,a.forEach(g5,t),nu=null,tu.call(t))}function g5(t,a){if(!(a.state.loading&4)){var i=nu.get(t);if(i)var u=i.get(null);else{i=new Map,nu.set(t,i);for(var x=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<x.length;v++){var j=x[v];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(i.set(j.dataset.precedence,j),u=j)}u&&i.set(null,u)}x=a.instance,j=x.getAttribute("data-precedence"),v=i.get(j)||u,v===u&&i.set(null,x),i.set(j,x),this.count++,u=tu.bind(this),x.addEventListener("load",u),x.addEventListener("error",u),v?v.parentNode.insertBefore(x,v.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(x,t.firstChild)),a.state.loading|=4}}var Yi={$$typeof:O,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function x5(t,a,i,u,x,v,j,D,G){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=la(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=la(0),this.hiddenUpdates=la(null),this.identifierPrefix=u,this.onUncaughtError=x,this.onCaughtError=v,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function Ey(t,a,i,u,x,v,j,D,G,se,fe,ge){return t=new x5(t,a,i,j,G,se,fe,ge,D),a=1,v===!0&&(a|=24),v=ua(3,null,null,a),t.current=v,v.stateNode=t,a=af(),a.refCount++,t.pooledCache=a,a.refCount++,v.memoizedState={element:u,isDehydrated:i,cache:a},of(v),t}function Ay(t){return t?(t=bl,t):bl}function Ry(t,a,i,u,x,v){x=Ay(x),u.context===null?u.context=x:u.pendingContext=x,u=es(a),u.payload={element:i},v=v===void 0?null:v,v!==null&&(u.callback=v),i=ts(t,u,a),i!==null&&(Zn(i,t,a),Ti(i,t,a))}function Iy(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function Cm(t,a){Iy(t,a),(t=t.alternate)&&Iy(t,a)}function _y(t){if(t.tag===13||t.tag===31){var a=Us(t,67108864);a!==null&&Zn(a,t,67108864),Cm(t,67108864)}}function Ly(t){if(t.tag===13||t.tag===31){var a=pa();a=Ie(a);var i=Us(t,a);i!==null&&Zn(i,t,a),Cm(t,a)}}var ru=!0;function y5(t,a,i,u){var x=V.T;V.T=null;var v=W.p;try{W.p=2,Tm(t,a,i,u)}finally{W.p=v,V.T=x}}function b5(t,a,i,u){var x=V.T;V.T=null;var v=W.p;try{W.p=8,Tm(t,a,i,u)}finally{W.p=v,V.T=x}}function Tm(t,a,i,u){if(ru){var x=Mm(u);if(x===null)mm(t,a,u,su,i),Dy(t,u);else if(k5(x,t,a,i,u))u.stopPropagation();else if(Dy(t,u),a&4&&-1<v5.indexOf(t)){for(;x!==null;){var v=ar(x);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var j=vn(v.pendingLanes);if(j!==0){var D=v;for(D.pendingLanes|=2,D.entangledLanes|=2;j;){var G=1<<31-Ve(j);D.entanglements[1]|=G,j&=~G}ur(v),(St&6)===0&&(Hc=st()+500,Fi(0))}}break;case 31:case 13:D=Us(v,2),D!==null&&Zn(D,v,2),Fc(),Cm(v,2)}if(v=Mm(u),v===null&&mm(t,a,u,su,i),v===x)break;x=v}x!==null&&u.stopPropagation()}else mm(t,a,u,null,i)}}function Mm(t){return t=_s(t),Em(t)}var su=null;function Em(t){if(su=null,t=Na(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 su=t,null}function Oy(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Wt()){case X:return 2;case me:return 8;case Ne:case Ae:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var Am=!1,fs=null,ms=null,hs=null,Qi=new Map,Xi=new Map,ps=[],v5="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 Dy(t,a){switch(t){case"focusin":case"focusout":fs=null;break;case"dragenter":case"dragleave":ms=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":Qi.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xi.delete(a.pointerId)}}function Zi(t,a,i,u,x,v){return t===null||t.nativeEvent!==v?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:v,targetContainers:[x]},a!==null&&(a=ar(a),a!==null&&_y(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),t)}function k5(t,a,i,u,x){switch(a){case"focusin":return fs=Zi(fs,t,a,i,u,x),!0;case"dragenter":return ms=Zi(ms,t,a,i,u,x),!0;case"mouseover":return hs=Zi(hs,t,a,i,u,x),!0;case"pointerover":var v=x.pointerId;return Qi.set(v,Zi(Qi.get(v)||null,t,a,i,u,x)),!0;case"gotpointercapture":return v=x.pointerId,Xi.set(v,Zi(Xi.get(v)||null,t,a,i,u,x)),!0}return!1}function zy(t){var a=Na(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,zt(t.priority,function(){Ly(i)});return}}else if(a===31){if(a=f(i),a!==null){t.blockedOn=a,zt(t.priority,function(){Ly(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 lu(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var i=Mm(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);Ma=u,i.target.dispatchEvent(u),Ma=null}else return a=ar(i),a!==null&&_y(a),t.blockedOn=i,!1;a.shift()}return!0}function Uy(t,a,i){lu(t)&&i.delete(a)}function w5(){Am=!1,fs!==null&&lu(fs)&&(fs=null),ms!==null&&lu(ms)&&(ms=null),hs!==null&&lu(hs)&&(hs=null),Qi.forEach(Uy),Xi.forEach(Uy)}function iu(t,a){t.blockedOn===a&&(t.blockedOn=null,Am||(Am=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,w5)))}var ou=null;function $y(t){ou!==t&&(ou=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ou===t&&(ou=null);for(var a=0;a<t.length;a+=3){var i=t[a],u=t[a+1],x=t[a+2];if(typeof u!="function"){if(Em(u||i)===null)continue;break}var v=ar(i);v!==null&&(t.splice(a,3),a-=3,Mf(v,{pending:!0,data:x,method:i.method,action:u},u,x))}}))}function Fl(t){function a(G){return iu(G,t)}fs!==null&&iu(fs,t),ms!==null&&iu(ms,t),hs!==null&&iu(hs,t),Qi.forEach(a),Xi.forEach(a);for(var i=0;i<ps.length;i++){var u=ps[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<ps.length&&(i=ps[0],i.blockedOn===null);)zy(i),i.blockedOn===null&&ps.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var x=i[u],v=i[u+1],j=x[Qt]||null;if(typeof v=="function")j||$y(i);else if(j){var D=null;if(v&&v.hasAttribute("formAction")){if(x=v,j=v[Qt]||null)D=j.formAction;else if(Em(x)!==null)continue}else D=j.action;typeof D=="function"?i[u+1]=D:(i.splice(u,3),u-=3),$y(i)}}}function By(){function t(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(j){return x=j})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),u||setTimeout(i,20)}function i(){if(!u&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,x=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),x!==null&&(x(),x=null)}}}function Rm(t){this._internalRoot=t}cu.prototype.render=Rm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(l(409));var i=a.current,u=pa();Ry(i,u,t,a,null,null)},cu.prototype.unmount=Rm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;Ry(t.current,2,null,t,null,null),Fc(),a[Xt]=null}};function cu(t){this._internalRoot=t}cu.prototype.unstable_scheduleHydration=function(t){if(t){var a=xt();t={blockedOn:null,target:t,priority:a};for(var i=0;i<ps.length&&a!==0&&a<ps[i].priority;i++);ps.splice(i,0,t),i===0&&zy(t)}};var Hy=n.version;if(Hy!=="19.2.7")throw Error(l(527,Hy,"19.2.7"));W.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=h(a),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var S5={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Me=uu.inject(S5),Te=uu}catch{}}return eo.createRoot=function(t,a){if(!o(t))throw Error(l(299));var i=!1,u="",x=K0,v=Y0,j=Q0;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),a=Ey(t,1,!1,null,null,i,u,null,x,v,j,By),t[Xt]=a.current,fm(t),new Rm(a)},eo.hydrateRoot=function(t,a,i){if(!o(t))throw Error(l(299));var u=!1,x="",v=K0,j=Y0,D=Q0,G=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onUncaughtError!==void 0&&(v=i.onUncaughtError),i.onCaughtError!==void 0&&(j=i.onCaughtError),i.onRecoverableError!==void 0&&(D=i.onRecoverableError),i.formState!==void 0&&(G=i.formState)),a=Ey(t,1,!0,a,i??null,u,x,G,v,j,D,By),a.context=Ay(null),i=a.current,u=pa(),u=Ie(u),x=es(u),x.callback=null,ts(i,x,u),i=u,a.current.lanes=i,On(a,i),ur(a),t[Xt]=a.current,fm(t),new cu(a)},eo.version="19.2.7",eo}var Xy;function I5(){if(Xy)return Lm.exports;Xy=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(),Lm.exports=R5(),Lm.exports}var _5=I5();const Ov={appName:"PenguinHarness",nav:{chat:"对话",newChat:"新对话",agents:"智能体",skills:"技能库",models:"模型库",usage:"成本中心",traces:"轨迹观测",benchmark:"评估中心",lastConversation:"最近一次对话",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",collapseGroup:"折叠",expandGroup:"展开",pinGroup:"置顶分组",unpinGroup:"取消置顶"},settings:{language:"语言",showCliSessions:"显示 CLI 会话",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:"检查中…",foundNew:e=>`发现新版本 v${e},点击下方更新入口即可安装`,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-1234),登录后请尽快修改密码"},account:{changePassword:"修改密码",oldPassword:"当前密码",oldPasswordHint:"内置管理员的初始密码在服务端首次启动时打印(形如 penguin-1234)",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:"移除",chatDefaultsTitle:"新对话默认值",chatDefaultsHint:"新建对话时预填的默认值:Agent、工作目录、审批模式、思考等级与默认模型。",chatDefaultsAgent:"Agent",chatDefaultsNotSet:"未设置",chatDefaultsApprovalNotSet:"未设置(默认全部放行)",chatDefaultsThinkingNotSet:"未设置(跟随智能体配置)",chatDefaultsWorkspaceHint:"留空表示自动临时目录",chatDefaultsModelHint:"与模型页的默认模型同步",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:"工具",tabSkills:"技能",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} 吗?已安装的技能文件(含本地改动)将被删除。`,agentTabDesc:"该 Agent 已安装的技能(agent_state/skills/,文件即事实来源):元数据注入系统提示词,正文由模型按需读取;卸载会删除整个技能目录。",agentTabEmpty:"尚未安装任何技能",exportSkill:"打包导出",importSkill:"导入技能",importChatTitle:"推荐:让 Agent 在对话中安装",importChatWhy:"Agent 能完整阅读、审查并按需调整技能内容,比直接上传更可靠。",importSourceLabel:"技能来源",importSourceHint:"支持网页 / GitHub 仓库或目录 / 本地路径 / 其他生态的安装命令",importSourcePlaceholder:"https://…、git 仓库、/path/to/skill 或 npx skills add <name>",importSourceToken:"<来源>",importPromptLabel:"发送给 Agent 的 Prompt(预览)",importPromptLead:{webUrl:e=>`请阅读这个网页,并把其中的 Skill 安装到你的技能目录:${e}。`,repoUrl:e=>`请获取这个仓库或目录(git clone 或直接抓取),定位其中含 SKILL.md 的技能目录,并安装到你的技能目录:${e}。`,localPath:e=>`请直接读取这个本地路径下的技能文件,并安装到你的技能目录:${e}。`,command:e=>`这是一条其他生态的技能/插件安装命令,请不要直接执行:先解读它会安装什么,从对应的仓库或注册表获取相同内容,再安装到你的技能目录:${e}。`,reference:e=>`请根据这个技能/插件引用找到其来源(仓库、插件市场或文档页),并把对应的 Skill 安装到你的技能目录:${e}。`},importPromptTail:"安装前请完整阅读全部内容,确认安全、无恶意指令后再写入,并向我说明它的用途。如果你安装了 skill-porting 技能,请先阅读并按其流程处理。",importCopyPrompt:"复制 Prompt",importCopied:"已复制到剪贴板",importOpenChat:"打开新对话",importUploadTitle:"上传技能 zip 包",importUploadDesc:"zip 根目录为 SKILL.md,或仅含一个内含 SKILL.md 的顶层目录。",importUploadAction:"选择 zip 文件",importUploading:"上传中…",importDoneToast:"技能已安装",importOverwriteTitle:"覆盖已安装技能",importOverwriteBody:e=>`技能「${e}」已存在,覆盖安装将替换其全部文件(含本地改动),不可恢复。确认继续?`,importOverwriteAction:"覆盖安装"},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
|
-
- desired_baseline_score:\`<75\`
|
|
62
|
-
- pilot_iteration_limit:\`5\`
|
|
63
|
-
|
|
64
|
-
场景:
|
|
65
|
-
1. 根据历史比赛与当前信息进行足球投注决策。
|
|
66
|
-
2. 根据售后政策与工单事实选择处置动作。
|
|
67
|
-
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- runs:`3`\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:"回到最新消息",loadingEarlier:"正在加载更早的对话…",loadEarlierRetry:"更早的对话加载失败,点击重试",historyBeginning:"已是对话开头",outlineTitle:"对话索引",outlineTickLabel:(e,n)=>`第 ${e} 轮:${n}`,outlineNoText:"(图片或附件)",outlineAnswering:"回答生成中…",inputPlaceholder:"输入消息,Enter 发送,Shift+Enter 换行,可粘贴图片",inputPlaceholderShort:"输入消息…",steerPlaceholder:"给运行中的 Agent 留言,随下一轮对话送达",steerPlaceholderShort:"给运行中的 Agent 留言…",steerSend:"发送给运行中的 Agent",steerQueuedIndicator:"插话已排队,将随下一轮送达",steerQueuedItem:e=>`插话已排队,将随下一轮送达:${e}`,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,l)=>{const o=e==="timeout"?"连接超时或网络中断":e==="malformed"?"响应不完整或无法解析":"模型服务返回错误",c=n==="gaveUp"?"已停止重试":n==="retried"?`已发起第 ${r} 次重试`:l!==void 0?`第 ${r} 次重试,${l} 秒后发起…`:`正在发起第 ${r} 次重试…`;return`[重试] ${o},${c}`},reconnectRetryNow:"立即重试",reconnectGiveUp:"放弃",imageAlt:"用户上传的图片",toolImageAlt:"工具输出的图片",imagesAsPathHint:"当前模型不支持直接查看图片:发送时图片将保存到会话临时目录,以文件路径转交(模型经 describe_image 查看)",infoPanel:"Session 信息",sessionStats:"统计",viewTrace:"查看轨迹",statTokens:"Token 累计",statElapsed:"用时",statInput:"输入 tokens",statCached:"已缓存",statOutput:"输出 tokens",statTps:"输出 TPS",statParenOpen:"(",statParenClose:")",noSessions:"还没有 Session",emptyStream:"发送一条消息开始对话",historyLoadFailed:"历史消息加载失败",statsLabel:"统计信息",removeImage:"移除图片",openWorkspace:"打开工作区",openAgents:"智能体面板",filesInMessage:e=>`${e} 个文件`,imagesInMessage:e=>`${e} 张图片`,openPreview:"点击预览",showMoreFiles:e=>`显示其余 ${e} 个文件`,showLess:"收起",moreGroups:e=>`更多分组(${e})`,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,n)=>e==="aborted"?"[压缩] 已中断,保留当前上下文":n!==void 0?`[压缩] 失败(${n}),保留当前上下文`:"[压缩] 失败,保留当前上下文",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",importAgent:"导入到 Agent",importPickFile:"选择文件",importing:"导入中…",fileTooLarge:"文件超过 14MB 上限。"},benchmark:{title:"评估中心",selectBenchmark:"在左侧选择一个 Benchmark",emptyAgent:"该 Agent 暂无 Benchmark",caseCount:e=>`${e} 题`,trendTitle:e=>`${e}随时间变化`,cases:"题目",viewCase:"查看详情",taskMaterials:"任务材料",rubric:"评分标准",agentHidden:"被测 Agent 不可见",caseFileUnavailable:"案例文件暂时无法读取",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:"用户名或密码错误。",too_many_attempts:"登录失败次数过多,请稍后重试。",password_mismatch:"当前密码不正确。",invalid_password:"密码至少 8 位。",admin_required:"仅管理员可执行此操作。",not_found:"资源不存在,或你没有访问权限。",agent_not_found:"该 Agent 已不存在。",unknown_agent:"该 Agent 不存在于本 Project。",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 p=Ov;function L5(e){p=e}const O5={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",showCliSessions:"Show CLI sessions",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…",foundNew:e=>`New version v${e} found — use the update entry below to install`,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” with the initial password printed in the server startup output (looks like penguin-1234), then change it soon"},account:{changePassword:"Change password",oldPassword:"Current password",oldPasswordHint:"The built-in admin's initial password is printed in the server startup output (looks like penguin-1234)",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",chatDefaultsTitle:"New chat defaults",chatDefaultsHint:"Prefilled defaults for every new chat: agent, working directory, approval mode, thinking level and default model.",chatDefaultsAgent:"Agent",chatDefaultsNotSet:"Not set",chatDefaultsApprovalNotSet:"Not set (defaults to allow all)",chatDefaultsThinkingNotSet:"Not set (follow the agent's config)",chatDefaultsWorkspaceHint:"Empty = auto temp directory",chatDefaultsModelHint:"Same default model as the Models page",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",tabSkills:"Skills",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.`,agentTabDesc:"Skills installed on this agent (agent_state/skills/ — the files are the source of truth): metadata is injected into the system prompt and the body is read by the model on demand; uninstalling deletes the whole skill directory.",agentTabEmpty:"No skills installed yet",exportSkill:"Export",importSkill:"Import skill",importChatTitle:"Recommended: install by chatting with the agent",importChatWhy:"The agent can read, review and adapt the skill content in full — more reliable than a raw upload.",importSourceLabel:"Skill source",importSourceHint:"A web page / GitHub repo or directory / local path / an install command from another ecosystem",importSourcePlaceholder:"https://…, a git repo, /path/to/skill, or npx skills add <name>",importSourceToken:"<source>",importPromptLabel:"Prompt to send to the agent (preview)",importPromptLead:{webUrl:e=>`Please read this page and install the skill it describes into your skills directory: ${e}.`,repoUrl:e=>`Please fetch this repository or directory (git clone or fetch it directly), locate the skill directories containing SKILL.md, and install them into your skills directory: ${e}.`,localPath:e=>`Please read the skill files under this local path directly and install them into your skills directory: ${e}.`,command:e=>`This is a skill/plugin install command from another ecosystem — do not run it blindly: work out what it would install, fetch the same content from its repository or registry, then install it into your skills directory: ${e}.`,reference:e=>`Please resolve this skill/plugin reference to its source (repository, plugin marketplace, or docs page) and install the corresponding skill into your skills directory: ${e}.`},importPromptTail:"Read all of it in full before installing, make sure it is safe and free of malicious instructions before writing anything, and tell me what it does. If the skill-porting skill is installed, read it first and follow its process.",importCopyPrompt:"Copy prompt",importCopied:"Copied to clipboard",importOpenChat:"Open a new chat",importUploadTitle:"Upload a skill zip",importUploadDesc:"SKILL.md at the zip root, or exactly one top-level directory containing SKILL.md.",importUploadAction:"Choose zip file",importUploading:"Uploading…",importDoneToast:"Skill installed",importOverwriteTitle:"Overwrite installed skill",importOverwriteBody:e=>`The skill "${e}" is already installed. Overwriting replaces all of its files (local edits included) and cannot be undone. Continue?`,importOverwriteAction:"Overwrite"},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.
|
|
68
|
-
|
|
69
|
-
## How to split the work
|
|
70
|
-
- 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.
|
|
71
|
-
- 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.
|
|
72
|
-
|
|
73
|
-
## Each game
|
|
74
|
-
- Its own \`games/<slug>/index.html\`: pure frontend, a single file that runs straight from file://, with no backend and no CDN assets.
|
|
75
|
-
- Start / restart, live score or timer, a lose-or-clear summary, both keyboard and touch controls, and the rules written on the page.
|
|
76
|
-
- A way back to the index page.
|
|
77
|
-
|
|
78
|
-
## Index page
|
|
79
|
-
- \`index.html\` at the root: a card grid listing all 10 games (name + one-line mechanic + controls), each card opening its game.
|
|
80
|
-
- One design language shared with every game, following the web-design skill.
|
|
81
|
-
|
|
82
|
-
## Wrap-up
|
|
83
|
-
- Review as a whole: the 10 mechanics really are distinct, the styling is consistent, and every index link resolves.
|
|
84
|
-
- 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://.
|
|
85
|
-
|
|
86
|
-
## Technical constraints
|
|
87
|
-
- Use the SC.Widget JS API (widget.load / widget.toggle / widget.setVolume / widget.seekTo), loading https://w.soundcloud.com/player/api.js
|
|
88
|
-
- The iframe must stay visible (180px tall), with visual=true color=f0b90b single_active=true
|
|
89
|
-
- Include ONLY these 8 tracks confirmed playable (oEmbed-verified); do not add tracks that are not oEmbed-verified:
|
|
90
|
-
- Warriors (S4) — soundcloud.com/leagueoflegends/warriors
|
|
91
|
-
- Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
|
|
92
|
-
- Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
|
|
93
|
-
- Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
|
|
94
|
-
- Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
|
|
95
|
-
- GODS (S13) — soundcloud.com/leagueoflegends/gods
|
|
96
|
-
- Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
|
|
97
|
-
- Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
|
|
98
|
-
|
|
99
|
-
## Layout
|
|
100
|
-
- 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
|
|
101
|
-
- Right main area: hero title + a desktop clock (80px monospace gold HH:MM:SS, refreshed every second, blinking colons) + a mood tag
|
|
102
|
-
- Player card: the SoundCloud iframe + a custom control bar (⏮ ▶/⏸ ⏭ + track info + a volume slider; clicking the speaker icon toggles mute)
|
|
103
|
-
- Mood-wave section: 15 gold animated bars, re-randomized on every track switch
|
|
104
|
-
- Keyboard shortcuts: Space play/pause, ← → previous/next, ↑ ↓ volume
|
|
105
|
-
|
|
106
|
-
## Design
|
|
107
|
-
Penguin visual style (see the web-design skill), dark by default. On phones the sidebar becomes a horizontally scrolling top bar.
|
|
108
|
-
|
|
109
|
-
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.
|
|
110
|
-
|
|
111
|
-
Agent:
|
|
112
|
-
- id: \`finite_choice_agent\`
|
|
113
|
-
- capability: make stable, explainable finite choices when public information is incomplete or conflicting
|
|
114
|
-
- installed_skills: \`[]\`
|
|
115
|
-
|
|
116
|
-
Benchmark:
|
|
117
|
-
- id: \`contextual-choice-adaptation\`
|
|
118
|
-
- capability: form and transfer a stable finite-choice decision process from public rules, historical examples, and current facts
|
|
119
|
-
- desired_baseline_score: \`<75\`
|
|
120
|
-
- pilot_iteration_limit: \`5\`
|
|
121
|
-
|
|
122
|
-
Scenarios:
|
|
123
|
-
1. Make football betting decisions from historical matches and current information.
|
|
124
|
-
2. Choose after-sales actions from policy and ticket facts.
|
|
125
|
-
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- runs: `3`\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",loadingEarlier:"Loading earlier messages…",loadEarlierRetry:"Failed to load earlier messages — click to retry",historyBeginning:"Beginning of conversation",outlineTitle:"Outline",outlineTickLabel:(e,n)=>`Turn ${e}: ${n}`,outlineNoText:"(image or attachment)",outlineAnswering:"Answering…",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",steerQueuedItem:e=>`Steering queued — delivered with the next turn: ${e}`,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,l)=>{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`:l!==void 0?`retry #${r} in ${l}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",viewTrace:"View trace",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"}`,imagesInMessage:e=>`${e} ${e===1?"image":"images"}`,openPreview:"Click to preview",showMoreFiles:e=>`Show ${e} more ${e===1?"file":"files"}`,showLess:"Show less",moreGroups:e=>`More groups (${e})`,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,n)=>e==="aborted"?"[Compaction] aborted, keeping current context":n!==void 0?`[Compaction] failed (${n}), keeping current context`:"[Compaction] 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",importAgent:"Import into Agent",importPickFile:"Choose file",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 details",taskMaterials:"Task materials",rubric:"Scoring rubric",agentHidden:"Hidden from Target Agent",caseFileUnavailable:"Case files are 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.",too_many_attempts:"Too many failed sign-in attempts. Try again shortly.",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.",unknown_agent:"That agent does not exist in this Project.",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."}}},Dv="penguin.lang",zv=b.createContext(null);function D5(e){return e?.toLowerCase().startsWith("zh")?"zh":"en"}function z5(){return D5(navigator.language)}function U5(e){return e==="system"?z5():e}function $5(){const e=localStorage.getItem(Dv);return e==="zh"||e==="en"||e==="system"?e:"system"}function B5({children:e}){const[n,r]=b.useState($5),[,l]=b.useState(0),o=U5(n);L5(o==="en"?O5:Ov),b.useEffect(()=>{if(n!=="system")return;const d=()=>l(f=>f+1);return window.addEventListener("languagechange",d),()=>window.removeEventListener("languagechange",d)},[n]);const c=b.useCallback(d=>{localStorage.setItem(Dv,d),r(d)},[]);return s.jsx(zv.Provider,{value:{lang:n,locale:o,setLang:c},children:e})}function H5({children:e}){const{locale:n}=Pa();return s.jsx("div",{className:"contents",children:e},n)}function Pa(){const e=b.useContext(zv);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}const mp=7,Uv="penguin.theme",$v="penguin.fontScale",Bv="penguin.accent",Hv="penguin.currency",P5={sm:"16px",md:"18px",lg:"20px"},Pv=b.createContext(null);function F5(){const e=localStorage.getItem(Uv);return e==="light"||e==="dark"||e==="system"?e:"system"}function q5(){const e=localStorage.getItem($v);return e==="sm"||e==="md"||e==="lg"?e:"md"}function V5(){const e=localStorage.getItem(Bv);return e==="neutral"||e==="blue"||e==="green"||e==="violet"||e==="rose"||e==="amber"?e:"neutral"}function G5(){return localStorage.getItem(Hv)==="CNY"?"CNY":"USD"}function W5(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function K5({children:e}){const[n,r]=b.useState(F5),[l,o]=b.useState(W5),[c,d]=b.useState(q5),[f,m]=b.useState(V5),[h,g]=b.useState(G5),y=n==="system"?l:n==="dark";b.useEffect(()=>{document.documentElement.classList.toggle("dark",y)},[y]),b.useEffect(()=>{document.documentElement.style.fontSize=P5[c]},[c]),b.useEffect(()=>{f==="neutral"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=f},[f]),b.useEffect(()=>{if(n!=="system")return;const E=window.matchMedia("(prefers-color-scheme: dark)"),M=L=>o(L.matches);return o(E.matches),E.addEventListener("change",M),()=>E.removeEventListener("change",M)},[n]);const k=b.useCallback(E=>{localStorage.setItem(Uv,E),r(E)},[]),w=b.useCallback(E=>{localStorage.setItem($v,E),d(E)},[]),S=b.useCallback(E=>{localStorage.setItem(Bv,E),m(E)},[]),T=b.useCallback(E=>{localStorage.setItem(Hv,E),g(E)},[]);return s.jsx(Pv.Provider,{value:{mode:n,dark:y,setMode:k,fontScale:c,setFontScale:w,accent:f,setAccent:S,currency:h,setCurrency:T},children:e})}function Cs(){const e=b.useContext(Pv);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}const Y5=[{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,l){super(l),this.name="ApiError",this.status=n,this.code=r}}let Fv=null;function Zy(e){Fv=e}function Q5(e){return e.startsWith("/api/auth/")}async function Ee(e,n={}){return(await qv(e,n)).data}async function qv(e,n={}){let r=e;if(n.query){const f=new URLSearchParams;for(const[h,g]of Object.entries(n.query))g!==void 0&&f.set(h,String(g));const m=f.toString();m&&(r+=`?${m}`)}let l;try{l=await fetch(r,{method:n.method??"GET",credentials:"same-origin",...n.body!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(n.body)}:{}})}catch{throw new ka(0,"network_error",p.errors.networkError)}if(!l.ok){let f="http_error",m=p.common.unknownError;try{const h=await l.json();h.error?.code&&(f=h.error.code),h.error?.message&&(m=h.error.message)}catch{}throw l.status===401&&!Q5(e)&&Fv?.(),new ka(l.status,f,m)}const o=Date.parse(l.headers.get("date")??""),c=Number.isFinite(o)?o:null;if(l.status===204)return{data:void 0,serverNowMs:c};const d=await l.text();return d?{data:JSON.parse(d),serverNowMs:c}:{data:void 0,serverNowMs:c}}const X5=e=>Ee("/api/auth/login",{method:"POST",body:e}),Z5=()=>Ee("/api/auth/logout",{method:"POST",body:{}}),Uu=()=>Ee("/api/me"),J5=e=>Ee("/api/me/password",{method:"PUT",body:e}),Vv=()=>Ee("/api/me/prefs"),hp=e=>Ee("/api/me/prefs",{method:"PUT",body:e}),eN=()=>Ee("/api/admin/users"),tN=e=>Ee("/api/admin/users",{method:"POST",body:e}),nN=(e,n)=>Ee(`/api/admin/users/${encodeURIComponent(e)}/password`,{method:"POST",body:n}),aN=e=>Ee(`/api/admin/users/${encodeURIComponent(e)}`,{method:"DELETE"}),rN=()=>Ee("/api/projects"),sN=e=>Ee("/api/projects",{method:"POST",body:e}),lN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),iN=e=>Ee(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE"}),Um=e=>Ee(`/api/projects/${encodeURIComponent(e)}/members`),oN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:n}),cN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(n)}`,{method:"DELETE"}),Gv=e=>Ee(`/api/projects/${encodeURIComponent(e)}/chat-defaults`),uN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/chat-defaults`,{method:"PUT",body:n}),$o=e=>Ee(`/api/projects/${encodeURIComponent(e)}/models`),dN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/models`,{method:"PUT",body:n}),fN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/models/default`,{method:"PUT",body:n}),Wv=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/models/test`,{method:"POST",body:n}),mN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`),hN=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`,{method:"PUT",body:r}),pN=e=>Ee(`/api/projects/${encodeURIComponent(e)}/agents`),gN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents`,{method:"POST",body:n}),pp=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`),Kv=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`,{method:"PUT",body:r}),xN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config/reset`,{method:"POST"}),Yv=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces${r?`?limit=${r.limit}&offset=${r.offset}`+(r.category?`&category=${r.category}`:"")+(r.cli?"&cli=1":""):""}`),Jy=(e,n,r)=>{const l=r?`?limit=${r.limit}&offset=${r.offset}`+(r.category?`&category=${r.category}`:"")+(r.withCounts?"&counts=1":"")+(r.cli?"&cli=1":""):"";return Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions${l}`)},e1=(e,n="")=>Ee(`/api/projects/${encodeURIComponent(e)}/dirs?path=${encodeURIComponent(n)}`),Nh=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions`,{method:"POST",body:r}),t1=e=>Ee(`/api/sessions/${encodeURIComponent(e)}`),Ch=(e,n)=>Ee(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),Fu=e=>Ee(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),yN=(e,n)=>{const r=n===void 0?"":n.kind==="tail"?`?tailLimit=${n.limit}`:`?before=${encodeURIComponent(n.cursor)}&limit=${n.limit}`;return qv(`/api/sessions/${encodeURIComponent(e)}/messages${r}`).then(({data:l,serverNowMs:o})=>({...l,serverNowMs:o}))},xo=(e,n)=>Ee(`/api/sessions/${encodeURIComponent(e)}/tasks`,{method:"POST",body:n}),bN=e=>Ee(`/api/sessions/${encodeURIComponent(e)}/goal`),vN=(e,n,r)=>Ee(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(n)}`,{method:"POST",body:r}),kN=e=>Ee(`/api/sessions/${encodeURIComponent(e)}/abort`,{method:"POST",body:{}}),wN=e=>Ee(`/api/sessions/${encodeURIComponent(e)}/retry-now`,{method:"POST",body:{}}),SN=(e,n)=>Ee(`/api/sessions/${encodeURIComponent(e)}/steer`,{method:"POST",body:n}),jN=e=>Ee(`/api/sessions/${encodeURIComponent(e)}/compact`,{method:"POST",body:{}}),NN=(e,n,r,l,o,c)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${l}`,{query:{offset:o,limit:c}}),CN=(e,n,r,l)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${l}/analysis`),TN=(e,n,r,l)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${l}/download`,MN=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/import`,{method:"POST",body:r}),EN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/usage/errors`,{query:{offset:String(n.offset),limit:String(n.limit),from:n.from,to:n.to,agentId:n.agentId}}),Qv=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/usage`,{query:{from:n.from,to:n.to,groupBy:n.groupBy,agentId:n.agentId,provider:n.provider,modelId:n.modelId}}),AN=(e,n)=>Ee(`/api/projects/${e}/agents/${n}`,{method:"DELETE"}),RN=(e,n)=>Ee(`/api/sessions/${e}/files`,{query:{path:n}}),xs=(e,n,r=!1)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(n)}${r?"&download=1":""}`,n1=(e,n)=>`/api/sessions/${e}/files/preview-redirect?path=${encodeURIComponent(n)}`,IN=(e,n,r)=>Ee(`/api/sessions/${e}/files/content`,{method:"PUT",body:{dataBase64:r},query:{path:n}}),_N=(e,n)=>Ee(`/api/sessions/${e}/files/stat`,{method:"POST",body:{paths:n}}),LN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`),ON=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`,{method:"POST",body:r}),a1=(e,n,r,l)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"PUT",body:l}),DN=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"DELETE"}),zN=()=>Ee("/api/skills"),ud=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`),r1=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`,{method:"POST",body:{names:r}}),UN=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/archive`,{method:"POST",body:r}),$N=(e,n,r)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/${encodeURIComponent(r)}/archive`,Xv=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/${encodeURIComponent(r)}`,{method:"DELETE"}),BN=(e,n)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks`),HN=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks/${encodeURIComponent(r)}/cases`),Zv=(e,n,r,l,o)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks/${encodeURIComponent(r)}/cases/${encodeURIComponent(l)}${o==="rubric"?"/rubric":""}/files`,PN=(e,n,r,l,o,c)=>Ee(Zv(e,n,r,l,c),{query:{path:o}}),FN=(e,n,r,l,o,c,d)=>`${Zv(e,n,r,l,c)}/content?path=${encodeURIComponent(o)}`+(d?.download?"&download=1":"")+(d?.preview&&!d.download?"&preview=1":""),qN=(e,n)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/export`,VN=(e,n,r)=>Ee(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/import`,{method:"POST",body:r}),GN=()=>Ee("/api/version"),Jv=(e=!1)=>Ee(`/api/version/update-check${e?"?force=1":""}`),WN=()=>Ee("/api/version/update",{method:"POST",body:{}}),ek=b.createContext(null);function KN({children:e}){const[n,r]=b.useState(void 0),[l,o]=b.useState(!0),[c,d]=b.useState(!1),[f,m]=b.useState("password");b.useEffect(()=>(Zy(()=>r(null)),()=>Zy(null)),[]),b.useEffect(()=>{let k=!1;return Uu().then(w=>{k||(r(w.user),o(w.previewIsolated),d(w.desktopMode),m(w.sessionVia))}).catch(w=>{k||(w instanceof ka&&w.status,r(null))}),()=>{k=!0}},[]);const h=b.useCallback(async(k,w)=>{const S=await X5({userId:k,password:w});r(S.user);try{const T=await Uu();r(T.user),o(T.previewIsolated),d(T.desktopMode),m(T.sessionVia)}catch{}},[]),g=b.useCallback(async()=>{try{await Z5()}finally{r(null)}},[]),y=b.useCallback(async()=>{const k=await Uu();r(k.user),o(k.previewIsolated),d(k.desktopMode),m(k.sessionVia)},[]);return s.jsx(ek.Provider,{value:{user:n,previewIsolated:l,desktopMode:c,sessionVia:f,login:h,logout:g,refresh:y},children:e})}function Ln(){const e=b.useContext(ek);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const gp=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,tk=/^[\\/]{2}/;function YN(e,n){return n+e.replace(/\\/g,"/")}const s1="popstate";function l1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function QN(e={}){function n(l,o){let c=o.state?.masked,{pathname:d,search:f,hash:m}=c||l.location;return Th("",{pathname:d,search:f,hash:m},o.state&&o.state.usr||null,o.state&&o.state.key||"default",c?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function r(l,o){return typeof o=="string"?o:Eo(o)}return ZN(n,r,null,e)}function Ht(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function pr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function XN(){return Math.random().toString(36).substring(2,10)}function i1(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 Th(e,n,r=null,l,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ai(n):n,state:r,key:n&&n.key||l||XN(),mask:o}}function Eo({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 ai(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let l=e.indexOf("?");l>=0&&(n.search=e.substring(l),e=e.substring(0,l)),e&&(n.pathname=e)}return n}function ZN(e,n,r,l={}){let{window:o=document.defaultView,v5Compat:c=!1}=l,d=o.history,f="POP",m=null,h=g();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function g(){return(d.state||{idx:null}).idx}function y(){f="POP";let E=g(),M=E==null?null:E-h;h=E,m&&m({action:f,location:T.location,delta:M})}function k(E,M){f="PUSH";let L=l1(E)?E:Th(T.location,E,M);h=g()+1;let O=i1(L,h),P=T.createHref(L.mask||L);try{d.pushState(O,"",P)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;o.location.assign(P)}c&&m&&m({action:f,location:T.location,delta:1})}function w(E,M){f="REPLACE";let L=l1(E)?E:Th(T.location,E,M);h=g();let O=i1(L,h),P=T.createHref(L.mask||L);d.replaceState(O,"",P),c&&m&&m({action:f,location:T.location,delta:0})}function S(E){return JN(o,E)}let T={get action(){return f},get location(){return e(o,d)},listen(E){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(s1,y),m=E,()=>{o.removeEventListener(s1,y),m=null}},createHref(E){return n(o,E)},createURL:S,encodeLocation(E){let M=S(E);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:k,replace:w,go(E){return d.go(E)}};return T}function JN(e,n,r=!1){let l="http://localhost";e&&(l=e.location.origin!=="null"?e.location.origin:e.location.href),Ht(l,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:Eo(n);return o=o.replace(/ $/,"%20"),!r&&tk.test(o)&&(o=l+o),new URL(o,l)}function nk(e,n,r="/"){return eC(e,n,r,!1)}function eC(e,n,r,l,o){let c=js((typeof n=="string"?ai(n):n).pathname||"/",r);if(c==null)return null;let d=tC(e),f=null,m=ik(c);for(let h=0;f==null&&h<d.length;++h)f=mC(d[h],m,l);return f}function tC(e){let n=ak(e);return nC(n),n}function ak(e,n=[],r=[],l="",o=!1){let c=(d,f,m=o,h)=>{let g={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(l)&&m)return;Ht(g.relativePath.startsWith(l),`Absolute route path "${g.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(l.length)}let y=Xa([l,g.relativePath]),k=r.concat(g);d.children&&d.children.length>0&&(Ht(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),ak(d.children,n,k,y,m)),!(d.path==null&&!d.index)&&n.push({path:y,score:dC(y,d.index),routesMeta:k.map((w,S)=>{let[T,E]=lk(w.relativePath,w.caseSensitive,S===k.length-1);return{...w,matcher:T,compiledParams:E}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let m of rk(d.path))c(d,f,!0,m)}),n}function rk(e){let n=e.split("/");if(n.length===0)return[];let[r,...l]=n,o=r.endsWith("?"),c=r.replace(/\?$/,"");if(l.length===0)return o?[c,""]:[c];let d=rk(l.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 nC(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:fC(n.routesMeta.map(l=>l.childrenIndex),r.routesMeta.map(l=>l.childrenIndex)))}const aC=/^:[\w-]+$/,rC=/^:[\w-]+/,sC=3.5,lC=3,iC=2,oC=1,cC=10,uC=-2,o1=e=>e==="*";function dC(e,n){let r=e.split("/"),l=r.length;return r.some(o1)&&(l+=uC),n&&(l+=iC),r.filter(o=>!o1(o)).reduce((o,c)=>o+(aC.test(c)?lC:rC.test(c)?sC:c===""?oC:cC),l)}function fC(e,n){return e.length===n.length&&e.slice(0,-1).every((r,l)=>r===n[l])?e[e.length-1]-n[n.length-1]:0}function mC(e,n,r=!1){let{routesMeta:l}=e,o={},c="/",d=[];for(let f=0;f<l.length;++f){let m=l[f],h=f===l.length-1,g=c==="/"?n:n.slice(c.length)||"/",y={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},k=m.matcher&&m.compiledParams?sk(y,g,m.matcher,m.compiledParams):Ao(y,g),w=m.route;if(!k&&h&&r&&!l[l.length-1].route.index&&(k=Ao({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!k)return null;Object.assign(o,k.params),d.push({params:o,pathname:Xa([c,k.pathname]),pathnameBase:gC(Xa([c,k.pathnameBase])),route:w}),k.pathnameBase!=="/"&&(c=Xa([c,k.pathnameBase]))}return d}function Ao(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,l]=lk(e.path,e.caseSensitive,e.end);return sk(e,n,r,l)}function sk(e,n,r,l){let o=n.match(r);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:l.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let w=f[y]||"";d=c.slice(0,c.length-w.length).replace(/(.)\/+$/,"$1")}const k=f[y];return g&&!k?m[h]=void 0:m[h]=(k||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function lk(e,n=!1,r=!0){pr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let l=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,f,m,h)=>{if(l.push({paramName:d,isOptional:f!=null}),f){let g=h.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,"(?:/$1)?");return e.endsWith("*")?(l.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),l]}function ik(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return pr(!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 js(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,l=e.charAt(r);return l&&l!=="/"?null:e.slice(r)||"/"}function hC(e,n="/"){let{pathname:r,search:l="",hash:o=""}=typeof e=="string"?ai(e):e,c;return r?(r=ok(r),r.startsWith("/")?c=c1(r.substring(1),"/"):c=c1(r,n)):c=n,{pathname:c,search:xC(l),hash:yC(o)}}function c1(e,n){let r=ck(n).split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function $m(e,n,r,l){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function pC(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function xp(e){let n=pC(e);return n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase)}function dd(e,n,r,l=!1){let o;typeof e=="string"?o=ai(e):(o={...e},Ht(!o.pathname||!o.pathname.includes("?"),$m("?","pathname","search",o)),Ht(!o.pathname||!o.pathname.includes("#"),$m("#","pathname","hash",o)),Ht(!o.search||!o.search.includes("#"),$m("#","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(!l&&d.startsWith("..")){let k=d.split("/");for(;k[0]==="..";)k.shift(),y-=1;o.pathname=k.join("/")}f=y>=0?n[y]:"/"}let m=hC(o,f),h=d&&d!=="/"&&d.endsWith("/"),g=(c||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}const ok=e=>e.replace(/[\\/]{2,}/g,"/"),Xa=e=>ok(e.join("/")),ck=e=>e.replace(/\/+$/,""),gC=e=>ck(e).replace(/^\/*/,"/"),xC=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,yC=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var bC=class{status;statusText;data;error;internal;constructor(e,n,r,l=!1){this.status=e,this.statusText=n||"",this.internal=l,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function vC(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function kC(e){return Xa(e.map(n=>n.route.path).filter(Boolean))||"/"}const uk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function dk(e,n){let r=e;if(typeof r!="string"||!gp.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let l=r,o=!1;if(uk)try{let c=new URL(window.location.href),d=tk.test(r)?new URL(YN(r,c.protocol)):new URL(r),f=js(d.pathname,n);d.origin===c.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{pr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:o,to:r}}const fk=["POST","PUT","PATCH","DELETE"];new Set(fk);const wC=["GET",...fk];new Set(wC);const SC=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function jC(e){try{return SC.includes(new URL(e).protocol)}catch{return!1}}const ri=b.createContext(null);ri.displayName="DataRouter";const fd=b.createContext(null);fd.displayName="DataRouterState";const mk=b.createContext(!1);function NC(){return b.useContext(mk)}const hk=b.createContext({isTransitioning:!1});hk.displayName="ViewTransition";const CC=b.createContext(new Map);CC.displayName="Fetchers";const TC=b.createContext(null);TC.displayName="Await";const Fa=b.createContext(null);Fa.displayName="Navigation";const Bo=b.createContext(null);Bo.displayName="Location";const qa=b.createContext({outlet:null,matches:[],isDataRoute:!1});qa.displayName="Route";const yp=b.createContext(null);yp.displayName="RouteError";const pk="REACT_ROUTER_ERROR",MC="REDIRECT",EC="ROUTE_ERROR_RESPONSE";function AC(e){if(e.startsWith(`${pk}:${MC}:{`))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 RC(e){if(e.startsWith(`${pk}:${EC}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new bC(n.status,n.statusText,n.data)}catch{}}function IC(e,{relative:n}={}){Ht(ul(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:l}=b.useContext(Fa),{hash:o,pathname:c,search:d}=Ho(e,{relative:n}),f=c;return r!=="/"&&(f=c==="/"?r:Xa([r,c])),l.createHref({pathname:f,search:d,hash:o})}function ul(){return b.useContext(Bo)!=null}function ja(){return Ht(ul(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Bo).location}function gk(e){Ht(ul(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:n}=ja();return b.useMemo(()=>Ao(e,ik(n)),[n,e])}const xk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function aa(){let{isDataRoute:e}=b.useContext(qa);return e?KC():_C()}function _C(){Ht(ul(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(ri),{basename:n,navigator:r}=b.useContext(Fa),{matches:l}=b.useContext(qa),{pathname:o}=ja(),c=JSON.stringify(xp(l)),d=b.useRef(!1);return b.useLayoutEffect(()=>{d.current=!0}),b.useCallback((f,m={})=>{if(pr(d.current,xk),!d.current)return;if(typeof f=="number"){r.go(f);return}let h=dd(f,JSON.parse(c),o,m.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Xa([n,h.pathname])),(m.replace?r.replace:r.push)(h,m.state,m)},[n,r,c,o,e])}const LC=b.createContext(null);function OC(e){let n=b.useContext(qa).outlet;return b.useMemo(()=>n&&b.createElement(LC.Provider,{value:e},n),[n,e])}function yk(){let{matches:e}=b.useContext(qa);return e[e.length-1]?.params??{}}function Ho(e,{relative:n}={}){let{matches:r}=b.useContext(qa),{pathname:l}=ja(),o=JSON.stringify(xp(r));return b.useMemo(()=>dd(e,JSON.parse(o),l,n==="path"),[e,o,l,n])}function DC(e,n){return bk(e,n)}function bk(e,n,r){Ht(ul(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=b.useContext(Fa),{matches:o}=b.useContext(qa),c=o[o.length-1],d=c?c.params:{};c&&c.pathname;let f=c?c.pathnameBase:"/";c&&c.route;let m=ja(),h;if(n){let S=typeof n=="string"?ai(n):n;Ht(f==="/"||S.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 "${S.pathname}" was given in the \`location\` prop.`),h=S}else h=m;let g=h.pathname||"/",y=g;if(f!=="/"){let S=f.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let k=r&&r.state.matches.length?r.state.matches.map(S=>Object.assign(S,{route:r.manifest[S.route.id]||S.route})):nk(e,{pathname:y}),w=PC(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},d,S.params),pathname:Xa([f,l.encodeLocation?l.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Xa([f,l.encodeLocation?l.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),o,r);return n&&w?b.createElement(Bo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...h},navigationType:"POP"}},w):w}function zC(){let e=WC(),n=vC(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null;return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},n),r?b.createElement("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"}},r):null,null)}const UC=b.createElement(zC,null);var $C=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=mk;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=RC(e.digest);r&&(e=r)}let n=e!==void 0?b.createElement(qa.Provider,{value:this.props.routeContext},b.createElement(yp.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(BC,{error:e},n):n}};const Bm=new WeakMap;function BC({children:e,error:n}){let{basename:r}=b.useContext(Fa);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let l=AC(n.digest);if(l){let o=Bm.get(n);if(o)throw o;let c=dk(l.location,r),d=c.absoluteURL||c.to;if(jC(d))throw new Error("Invalid redirect location");if(uk&&!Bm.get(n))if(c.isExternal||l.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:l.replace}));throw Bm.set(n,f),f}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function HC({routeContext:e,match:n,children:r}){let l=b.useContext(ri);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(qa.Provider,{value:e},r)}function PC(e,n=[],r){let l=r?.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(n.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let o=e,c=l?.errors;if(c!=null){let g=o.findIndex(y=>y.route.id&&c?.[y.route.id]!==void 0);Ht(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,g+1))}let d=!1,f=-1;if(r&&l){d=l.renderFallback;for(let g=0;g<o.length;g++){let y=o[g];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(f=g),y.route.id){let{loaderData:k,errors:w}=l,S=y.route.loader&&!k.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||S){r.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let m=r?.onError,h=l&&m?(g,y)=>{m(g,{location:l.location,params:l.matches?.[0]?.params??{},pattern:kC(l.matches),errorInfo:y})}:void 0;return o.reduceRight((g,y,k)=>{let w,S=!1,T=null,E=null;l&&(w=c&&y.route.id?c[y.route.id]:void 0,T=y.route.errorElement||UC,d&&(f<0&&k===0?(YC("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,E=null):f===k&&(S=!0,E=y.route.hydrateFallbackElement||null)));let M=n.concat(o.slice(0,k+1)),L=()=>{let O;return w?O=T:S?O=E:y.route.Component?O=b.createElement(y.route.Component,null):y.route.element?O=y.route.element:O=g,b.createElement(HC,{match:y,routeContext:{outlet:g,matches:M,isDataRoute:l!=null},children:O})};return l&&(y.route.ErrorBoundary||y.route.errorElement||k===0)?b.createElement($C,{location:l.location,revalidation:l.revalidation,component:T,error:w,children:L(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:h}):L()},null)}function bp(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function FC(e){let n=b.useContext(ri);return Ht(n,bp(e)),n}function qC(e){let n=b.useContext(fd);return Ht(n,bp(e)),n}function VC(e){let n=b.useContext(qa);return Ht(n,bp(e)),n}function vp(e){let n=VC(e),r=n.matches[n.matches.length-1];return Ht(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function GC(){return vp("useRouteId")}function WC(){let e=b.useContext(yp),n=qC("useRouteError"),r=vp("useRouteError");return e!==void 0?e:n.errors?.[r]}function KC(){let{router:e}=FC("useNavigate"),n=vp("useNavigate"),r=b.useRef(!1);return b.useLayoutEffect(()=>{r.current=!0}),b.useCallback(async(l,o={})=>{pr(r.current,xk),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...o}))},[e,n])}const u1={};function YC(e,n,r){u1[e]||(u1[e]=!0,pr(!1,r))}b.memo(QC);function QC({routes:e,manifest:n,future:r,state:l,isStatic:o,onError:c}){return bk(e,void 0,{manifest:n,state:l,isStatic:o,onError:c})}function Ro({to:e,replace:n,state:r,relative:l}){Ht(ul(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=b.useContext(Fa);pr(!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}=b.useContext(qa),{pathname:d}=ja(),f=aa(),m=dd(e,xp(c),d,l==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:n,state:r,relative:l})},[f,h,l,n,r]),null}function XC(e){return OC(e.context)}function Jn(e){Ht(!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 ZC({basename:e="/",children:n=null,location:r,navigationType:l="POP",navigator:o,static:c=!1,useTransitions:d}){Ht(!ul(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:o,static:c,useTransitions:d,future:{}}),[f,o,c,d]);typeof r=="string"&&(r=ai(r));let{pathname:h="/",search:g="",hash:y="",state:k=null,key:w="default",mask:S}=r,T=b.useMemo(()=>{let E=js(h,f);return E==null?null:{location:{pathname:E,search:g,hash:y,state:k,key:w,mask:S},navigationType:l}},[f,h,g,y,k,w,l,S]);return pr(T!=null,`<Router basename="${f}"> is not able to match the URL "${h}${g}${y}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:b.createElement(Fa.Provider,{value:m},b.createElement(Bo.Provider,{children:n,value:T}))}function JC({children:e,location:n}){return DC(Mh(e),n)}function Mh(e,n=[]){let r=[];return b.Children.forEach(e,(l,o)=>{if(!b.isValidElement(l))return;let c=[...n,o];if(l.type===b.Fragment){r.push.apply(r,Mh(l.props.children,c));return}Ht(l.type===Jn,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let d=l.props;Ht(!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=Mh(d.children,c)),r.push(f)}),r}const $u="application/x-www-form-urlencoded";function md(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function e4(e){return md(e)&&e.tagName.toLowerCase()==="button"}function t4(e){return md(e)&&e.tagName.toLowerCase()==="form"}function n4(e){return md(e)&&e.tagName.toLowerCase()==="input"}function a4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function r4(e,n){return e.button===0&&(!n||n==="_self")&&!a4(e)}function Eh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let l=e[r];return n.concat(Array.isArray(l)?l.map(o=>[r,o]):[[r,l]])},[]))}function s4(e,n){let r=Eh(e);return n&&n.forEach((l,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}let du=null;function l4(){if(du===null)try{new FormData(document.createElement("form"),0),du=!1}catch{du=!0}return du}const i4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hm(e){return e!=null&&!i4.has(e)?(pr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$u}"`),null):e}function o4(e,n){let r,l,o,c,d;if(t4(e)){let f=e.getAttribute("action");l=f?js(f,n):null,r=e.getAttribute("method")||"get",o=Hm(e.getAttribute("enctype"))||$u,c=new FormData(e)}else if(e4(e)||n4(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(l=m?js(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||"get",o=Hm(e.getAttribute("formenctype"))||Hm(f.getAttribute("enctype"))||$u,c=new FormData(f,e),!l4()){let{name:h,type:g,value:y}=e;if(g==="image"){let k=h?`${h}.`:"";c.append(`${k}x`,"0"),c.append(`${k}y`,"0")}else h&&c.append(h,y)}}else{if(md(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r="get",l=null,o=$u,d=e}return c&&o==="text/plain"&&(d=c,c=void 0),{action:l,method:r.toLowerCase(),encType:o,formData:c,body:d}}function kp(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function vk(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 c4(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 u4(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 d4(e,n,r){return p4((await Promise.all(e.map(async l=>{let o=n.routes[l.route.id];if(o){let c=await c4(o,r);return c.links?c.links():[]}return[]}))).flat(1).filter(u4).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function d1(e,n,r,l,o,c){let d=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,f=(m,h)=>r[h].pathname!==m.pathname||r[h].route.path?.endsWith("*")&&r[h].params["*"]!==m.params["*"];return c==="assets"?n.filter((m,h)=>d(m,h)||f(m,h)):c==="data"?n.filter((m,h)=>{let g=l.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(d(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let 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 f4(e,n,{includeHydrateFallback:r}={}){return m4(e.map(l=>{let o=n.routes[l.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 m4(e){return[...new Set(e)]}function h4(e){let n={},r=Object.keys(e).sort();for(let l of r)n[l]=e[l];return n}function p4(e,n){let r=new Set;return new Set(n),e.reduce((l,o)=>{let c=JSON.stringify(h4(o));return r.has(c)||(r.add(c),l.push({key:c,link:o})),l},[])}function g4(){let e=b.useContext(ri);return kp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function x4(){let e=b.useContext(fd);return kp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}const wp=b.createContext(void 0);wp.displayName="FrameworkContext";function Sp(){let e=b.useContext(wp);return kp(e,"You must render this element inside a <HydratedRouter> element"),e}function y4(e,n){let r=b.useContext(wp),[l,o]=b.useState(!1),[c,d]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:y}=n,k=b.useRef(null);b.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let T=M=>{M.forEach(L=>{d(L.isIntersecting)})},E=new IntersectionObserver(T,{threshold:.5});return k.current&&E.observe(k.current),()=>{E.disconnect()}}},[e]),b.useEffect(()=>{if(l){let T=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(T)}}},[l]);let w=()=>{o(!0)},S=()=>{o(!1),d(!1)};return r?e!=="intent"?[c,k,{}]:[c,k,{onFocus:to(f,w),onBlur:to(m,S),onMouseEnter:to(h,w),onMouseLeave:to(g,S),onTouchStart:to(y,w)}]:[!1,k,{}]}function to(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function b4({page:e,...n}){let r=NC(),{nonce:l}=Sp(),{router:o}=g4(),c=b.useMemo(()=>nk(o.routes,e,o.basename),[o.routes,e,o.basename]);return c?(n.nonce==null&&l&&(n={...n,nonce:l}),r?b.createElement(k4,{page:e,matches:c,...n}):b.createElement(w4,{page:e,matches:c,...n})):null}function v4(e){let{manifest:n,routeModules:r}=Sp(),[l,o]=b.useState([]);return b.useEffect(()=>{let c=!1;return d4(e,n,r).then(d=>{c||o(d)}),()=>{c=!0}},[e,n,r]),l}function k4({page:e,matches:n,...r}){let l=ja(),o=b.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let c=vk(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,l,n]);return b.createElement(b.Fragment,null,o.map(c=>b.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...r})))}function w4({page:e,matches:n,...r}){let l=ja(),{manifest:o,routeModules:c}=Sp(),{loaderData:d,matches:f}=x4(),m=b.useMemo(()=>d1(e,n,f,o,l,"data"),[e,n,f,o,l]),h=b.useMemo(()=>d1(e,n,f,o,l,"assets"),[e,n,f,o,l]),g=b.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let w=new Set,S=!1;if(n.forEach(E=>{let M=o.routes[E.route.id];!M||!M.hasLoader||(!m.some(L=>L.route.id===E.route.id)&&E.route.id in d&&c[E.route.id]?.shouldRevalidate||M.hasClientLoader?S=!0:w.add(E.route.id))}),w.size===0)return[];let T=vk(e,"data");return S&&w.size>0&&T.searchParams.set("_routes",n.filter(E=>w.has(E.route.id)).map(E=>E.route.id).join(",")),[T.pathname+T.search]},[d,l,o,m,n,e,c]),y=b.useMemo(()=>f4(h,o),[h,o]),k=v4(h);return b.createElement(b.Fragment,null,g.map(w=>b.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),y.map(w=>b.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),k.map(({key:w,link:S})=>b.createElement("link",{key:w,nonce:r.nonce,...S,crossOrigin:S.crossOrigin??r.crossOrigin})))}function S4(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}const j4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{j4&&(window.__reactRouterVersion="8.3.0")}catch{}function N4({basename:e,children:n,useTransitions:r,window:l}){let o=b.useRef(null);o.current==null&&(o.current=QN({window:l,v5Compat:!0}));let c=o.current,[d,f]=b.useState({action:c.action,location:c.location}),m=b.useCallback(h=>{r===!1?f(h):b.startTransition(()=>f(h))},[r]);return b.useLayoutEffect(()=>c.listen(m),[c,m]),b.createElement(ZC,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:r})}const jp=b.forwardRef(function({onClick:n,discover:r="render",prefetch:l="none",relative:o,reloadDocument:c,replace:d,mask:f,state:m,target:h,to:g,preventScrollReset:y,viewTransition:k,defaultShouldRevalidate:w,...S},T){let{basename:E,navigator:M,useTransitions:L}=b.useContext(Fa),O=typeof g=="string"&&gp.test(g),P=dk(g,E);g=P.to;let H=IC(g,{relative:o}),I=ja(),F=null;if(f){let U=dd(f,[],I.mask?I.mask.pathname:"/",!0);E!=="/"&&(U.pathname=U.pathname==="/"?E:Xa([E,U.pathname])),F=M.createHref(U)}let[K,Z,z]=y4(l,S),B=M4(g,{replace:d,mask:f,state:m,target:h,preventScrollReset:y,relative:o,viewTransition:k,defaultShouldRevalidate:w,useTransitions:L});function A(U){n&&n(U),U.defaultPrevented||B(U)}let $=!(P.isExternal||c),q=b.createElement("a",{...S,...z,href:($?F:void 0)||P.absoluteURL||H,onClick:$?A:n,ref:S4(T,Z),target:h,"data-discover":!O&&r==="render"?"true":void 0});return K&&!O?b.createElement(b.Fragment,null,q,b.createElement(b4,{page:H})):q});jp.displayName="Link";const Np=b.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:l="",end:o=!1,style:c,to:d,viewTransition:f,children:m,...h},g){let y=Ho(d,{relative:h.relative}),k=ja(),w=b.useContext(fd),{navigator:S,basename:T}=b.useContext(Fa),E=w!=null&&_4(y)&&f===!0,M=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,L=k.pathname,O=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(L=L.toLowerCase(),O=O?O.toLowerCase():null,M=M.toLowerCase()),O&&T&&(O=js(O,T)||O);const P=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let H=L===M||!o&&L.startsWith(M)&&L.charAt(P)==="/",I=O!=null&&(O===M||!o&&O.startsWith(M)&&O.charAt(P)==="/"),F={isActive:H,isPending:I,isTransitioning:E},K=H?n:void 0,Z;typeof l=="function"?Z=l(F):Z=[l,H?"active":null,I?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let z=typeof c=="function"?c(F):c;return b.createElement(jp,{...h,"aria-current":K,className:Z,ref:g,style:z,to:d,viewTransition:f},typeof m=="function"?m(F):m)});Np.displayName="NavLink";const C4=b.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:l,replace:o,state:c,method:d="get",action:f,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:k,...w},S)=>{let{useTransitions:T}=b.useContext(Fa),E=R4(),M=I4(f,{relative:h}),L=d.toLowerCase()==="get"?"get":"post",O=typeof f=="string"&&gp.test(f),P=H=>{if(m&&m(H),H.defaultPrevented)return;H.preventDefault();let I=H.nativeEvent.submitter,F=I?.getAttribute("formmethod")||d,K=()=>E(I||H.currentTarget,{fetcherKey:n,method:F,navigate:r,replace:o,state:c,relative:h,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:k});T&&r!==!1?b.startTransition(()=>K()):K()};return b.createElement("form",{ref:S,method:L,action:M,onSubmit:l?m:P,...w,"data-discover":!O&&e==="render"?"true":void 0})});C4.displayName="Form";function T4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kk(e){let n=b.useContext(ri);return Ht(n,T4(e)),n}function M4(e,{target:n,replace:r,mask:l,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:h}={}){let g=aa(),y=ja(),k=Ho(e,{relative:d});return b.useCallback(w=>{if(r4(w,n)){w.preventDefault();let S=r!==void 0?r:Eo(y)===Eo(k),T=()=>g(e,{replace:S,mask:l,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m});h?b.startTransition(()=>T()):T()}},[y,g,k,r,l,o,n,e,c,d,f,m,h])}function hd(e){pr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=b.useRef(Eh(e)),r=b.useRef(!1),l=ja(),o=b.useMemo(()=>s4(l.search,r.current?null:n.current),[l.search]),c=aa();return[o,b.useCallback((d,f)=>{const m=Eh(typeof d=="function"?d(new URLSearchParams(o)):d);r.current=!0,c("?"+m,f)},[c,o])]}let E4=0,A4=()=>`__${String(++E4)}__`;function R4(){let{router:e}=kk("useSubmit"),{basename:n}=b.useContext(Fa),r=GC(),l=e.fetch,o=e.navigate;return b.useCallback(async(c,d={})=>{let{action:f,method:m,encType:h,formData:g,body:y}=o4(c,n);d.navigate===!1?await l(d.fetcherKey||A4(),r,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||m,formEncType:d.encType||h,flushSync:d.flushSync}):await o(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||m,formEncType:d.encType||h,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[l,o,n,r])}function I4(e,{relative:n}={}){let{basename:r}=b.useContext(Fa),l=b.useContext(qa);Ht(l,"useFormAction must be used inside a RouteContext");let[o]=l.matches.slice(-1),c={...Ho(e||".",{relative:n})},d=ja();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),m=f.getAll("index");if(m.some(h=>h==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let h=f.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:Xa([r,c.pathname])),Eo(c)}function _4(e,{relative:n}={}){let r=b.useContext(hk);Ht(r!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=kk("useViewTransitionState"),o=Ho(e,{relative:n});if(!r.isTransitioning)return!1;let c=js(r.currentLocation.pathname,l)||r.currentLocation.pathname,d=js(r.nextLocation.pathname,l)||r.nextLocation.pathname;return Ao(o.pathname,d)!=null||Ao(o.pathname,c)!=null}const f1="penguin.lastProjectId",m1=e=>`penguin.lastAgentId.${e}`,wk=b.createContext(null);function Ah(e){return e.name??e.projectId}function Gt(e){return e.name??e.agentId}function L4({children:e}){const[n,r]=b.useState([]),[l,o]=b.useState(!0),[c,d]=b.useState(null),[f,m]=b.useState([]),[h,g]=b.useState(!0),[y,k]=b.useState(null),w=b.useCallback(async()=>{o(!0);try{const L=await rN();r(L.projects),d(O=>{const P=O??localStorage.getItem(f1);return(L.projects.find(I=>I.projectId===P)??L.projects[0])?.projectId??null})}finally{o(!1)}},[]);b.useEffect(()=>{w()},[w]);const S=b.useCallback(L=>{L!==c&&(localStorage.setItem(f1,L),d(L),k(null),m([]),g(!0),hp({lastProjectId:L}).catch(()=>{}))},[c]),T=b.useCallback(async()=>{if(c){g(!0);try{const L=await pN(c);m(L.agents),k(O=>{const P=O??localStorage.getItem(m1(c)),H=L.agents.find(F=>F.agentId===P),I=L.agents.find(F=>F.agentId==="default_agent")??L.agents[0]??null;return(H??I)?.agentId??null})}finally{g(!1)}}},[c]);b.useEffect(()=>{m([]),T()},[T]);const E=b.useCallback(L=>{c&&localStorage.setItem(m1(c),L),k(L)},[c]),M=b.useMemo(()=>{const L=n.find(P=>P.projectId===c)??null,O=f.find(P=>P.agentId===y)??null;return{projects:n,projectsLoading:l,currentProject:L,setCurrentProjectId:S,reloadProjects:w,agents:f,agentsLoading:h,currentAgent:O,setCurrentAgentId:E,reloadAgents:T}},[n,l,c,S,w,f,h,y,E,T]);return s.jsx(wk.Provider,{value:M,children:e})}function on(){const e=b.useContext(wk);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function Sk(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:l}=n;return l&&(r.onerror=()=>l(r.readyState===EventSource.CLOSED)),{close:()=>r.close()}}function O4(e,n){return Sk(`/api/sessions/${encodeURIComponent(e)}/stream`,n)}function D4(e){return Sk("/api/events",e)}const jk="\0temp-workspaces",z4=/[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;function U4(e){const n=e.trim();return n===""||z4.test(n)}function qu(e){return U4(e)?jk:e.trim()}function $4(e){const n=e.trim().split(/[/\\]+/).filter(Boolean);return n[n.length-1]??"/"}const nl=10,fu=10;function Rh(e,n){return e.length>n?{items:e.slice(0,n),hasMore:!0}:{items:e,hasMore:!1}}function Qa(e){return e.archived?"archived":e.source==="subagent"||e.source==="schedule"?e.source:"active"}const Po=["subagent","schedule","archived"];function h1(e){const n={active:[],subagent:[],schedule:[],archived:[]};for(const r of e)n[Qa(r)].push(r);return n}const B4=["active",...Po];function Nk(e){const n=new Map;for(const[r,l]of e)for(const[o,c]of Object.entries(l)){const d=qu(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 B4){const h=c[m];h>0&&(f.totals[m]+=h,f.agents[m].includes(r)||f.agents[m].push(r))}}return n}function Ck(e){let n=null;for(const r of e){const l=Qa(r);l!=="active"&&l!=="schedule"||(!n||r.createdAt>n.createdAt||r.createdAt===n.createdAt&&r.sessionId>n.sessionId)&&(n=r)}return n}function Tk(e){const n=new Map;for(const o of e){const c=qu(o.workspace);let d=n.get(c);if(!d){const f=c===jk;d={key:c,label:f?"":$4(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,l=[...n.values()];for(const o of l)o.sessions.sort((c,d)=>r(c.createdAt,d.createdAt));return l.sort((o,c)=>o.temp!==c.temp?o.temp?1:-1:r(o.sessions[0]?.createdAt??"",c.sessions[0]?.createdAt??"")),l}function Ih(e,n,r){if(r.size===0)return[...e];const l=[],o=[];for(const c of e)(r.has(n(c))?l:o).push(c);return[...l,...o]}const Mk=b.createContext(null),ys=(e,n)=>`${e}\0${n}`;function H4({children:e}){const{currentProject:n,agents:r}=on(),l=n?.projectId??null,o=r.map(te=>te.agentId).join(","),[c,d]=b.useState([]),[f,m]=b.useState(new Map),[h,g]=b.useState(new Map),[y,k]=b.useState(new Map),[w,S]=b.useState(!0),[T,E]=b.useState(!1);b.useEffect(()=>{let te=!1;return Vv().then(N=>{!te&&N.prefs.showCliSessions===!0&&E(!0)}).catch(()=>{}),()=>{te=!0}},[]);const M=b.useCallback(te=>{E(te),hp({showCliSessions:te}).catch(()=>{})},[]),L=b.useRef(0),O=b.useRef([]);O.current=c;const P=b.useRef(f);P.current=f;const H=b.useRef(h);H.current=h;const I=b.useCallback(async()=>{const te=o===""?[]:o.split(",");if(!l||te.length===0)return;const N=++L.current;S(!0);try{const _=await Promise.all(te.map(async he=>{const xe=["active",...Po.filter(ie=>P.current.has(ys(he,ie)))];try{const ie=await Promise.all(xe.map(async ye=>{const ve=await Jy(l,he,{offset:0,limit:nl+1,category:ye,...ye==="active"?{withCounts:!0}:{},...T?{cli:!0}:{}});return{category:ye,counts:ve.counts,workspaceCounts:ve.workspaceCounts,...Rh(ve.sessions,nl)}}));return{agentId:he,pages:ie}}catch{return{agentId:he,pages:[]}}}));if(N!==L.current)return;const R=[],C=new Set,Q=new Map,ee=new Map,ae=new Map;for(const he of _)for(const xe of he.pages){Q.set(ys(he.agentId,xe.category),{hasMore:xe.hasMore,fetched:xe.items.length}),xe.counts&&ee.set(he.agentId,xe.counts),xe.workspaceCounts&&ae.set(he.agentId,xe.workspaceCounts);for(const ie of xe.items)C.has(ie.sessionId)||(C.add(ie.sessionId),R.push(ie))}d(R),m(Q),g(ee),k(ae)}finally{N===L.current&&S(!1)}},[l,o,T]);b.useEffect(()=>{d([]),P.current=new Map,m(P.current),g(new Map),k(new Map),I()},[I]);const F=b.useCallback(async(te,N)=>{if(!l)return;const _=[...new Set(te)].filter(ee=>{const ae=P.current.get(ys(ee,N));return ae===void 0?(H.current.get(ee)?.[N]??0)>0:ae.hasMore});if(_.length===0)return;const R=L.current,C=await Promise.all(_.map(async ee=>{const ae=P.current.get(ys(ee,N))?.fetched??0;try{const he=(await Jy(l,ee,{offset:ae,limit:nl+1,category:N,...T?{cli:!0}:{}})).sessions;return{agentId:ee,...Rh(he,nl)}}catch{return null}}));if(R!==L.current)return;const Q=C.filter(ee=>ee!==null);d(ee=>{const ae=new Set(ee.map(xe=>xe.sessionId)),he=Q.flatMap(xe=>xe.items.filter(ie=>!ae.has(ie.sessionId)));return he.length>0?[...ee,...he]:ee}),m(ee=>{const ae=new Map(ee);for(const he of Q){const xe=ys(he.agentId,N);ae.set(xe,{hasMore:he.hasMore,fetched:(ee.get(xe)?.fetched??0)+he.items.length})}return ae})},[l,T]),K=b.useCallback((te,N)=>f.has(ys(te,N)),[f]),Z=b.useCallback((te,N)=>{const _=f.get(ys(te,N));return _!==void 0?_.hasMore:(h.get(te)?.[N]??0)>0},[f,h]),z=b.useCallback((te,N,_)=>{const{agentId:R,workspace:C}=te;g(Q=>{const ee=Q.get(R);if(!ee)return Q;const ae=new Map(Q);return ae.set(R,{...ee,[N]:Math.max(0,ee[N]+_)}),ae}),k(Q=>{const ee=Q.get(R);if(!ee)return Q;const ae=ee[C]??{active:0,subagent:0,schedule:0,archived:0},he=new Map(Q);return he.set(R,{...ee,[C]:{...ae,[N]:Math.max(0,ae[N]+_)}}),he})},[]),B=b.useRef(I);B.current=I;const A=b.useRef(l);A.current=l,b.useEffect(()=>{const te=D4({onOmniMessage:()=>{},onServerEvent:N=>{N.type==="schedule_fired"&&N.projectId===A.current&&B.current()}});return()=>te.close()},[]);const $=b.useCallback(te=>{L.current+=1,!O.current.some(_=>_.sessionId===te.sessionId)&&P.current.get(ys(te.agentId,Qa(te)))?.hasMore===!1&&z(te,Qa(te),1),d(_=>[te,..._.filter(R=>R.sessionId!==te.sessionId)])},[z]),q=b.useCallback(te=>{L.current+=1;const N=O.current.find(_=>_.sessionId===te);N&&z(N,Qa(N),-1),d(_=>_.filter(R=>R.sessionId!==te))},[z]),U=b.useCallback(te=>{const N=O.current.find(_=>_.sessionId===te.sessionId);N&&Qa(N)!==Qa(te)&&(z(te,Qa(N),-1),z(te,Qa(te),1)),d(_=>_.map(R=>R.sessionId===te.sessionId?te:R))},[z]),V=b.useCallback((te,N)=>{d(_=>{const R=_.find(C=>C.sessionId===te);return!R||R.status===N?_:_.map(C=>C.sessionId===te?{...C,status:N}:C)})},[]),W=b.useCallback((te,N)=>{d(_=>_.map(R=>R.sessionId===te?{...R,title:N}:R))},[]),ce=b.useMemo(()=>{const te=new Map;for(const N of c){const _=te.get(N.agentId);_?_.push(N):te.set(N.agentId,[N])}for(const N of te.values())N.sort((_,R)=>R.createdAt.localeCompare(_.createdAt)||R.sessionId.localeCompare(_.sessionId));return{sessions:c,byAgent:te,countsByAgent:h,workspaceCountsByAgent:y,isLoadedFor:K,hasMoreFor:Z,loading:w,reload:I,loadMoreFor:F,add:$,remove:q,replace:U,setStatus:V,setTitle:W,showCliSessions:T,setShowCliSessions:M}},[c,h,y,K,Z,w,I,F,$,q,U,V,W,T,M]);return s.jsx(Mk.Provider,{value:ce,children:e})}function dl(){const e=b.useContext(Mk);if(!e)throw new Error("useSessions must be used within a SessionsProvider");return e}function ra({open:e,size:n=14,className:r=""}){return s.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:s.jsx("path",{d:"M9 5l7 7-7 7"})})}function xa({d:e,size:n=16}){return s.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:s.jsx("path",{d:e})})}const Cp="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",Ek="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",Ak="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",Rk="penguin.sidebarGroupMode";function Ik(){return localStorage.getItem(Rk)==="agent"?"agent":"workspace"}function _k(e){localStorage.setItem(Rk,e)}function Lk({value:e,onChange:n}){return s.jsx("div",{className:"flex items-center gap-0.5",children:[{value:"workspace",icon:Cp,label:p.chat.groupByWorkspace},{value:"agent",icon:Ak,label:p.chat.groupByAgent}].map(r=>s.jsx("button",{type:"button",title:r.label,"aria-label":r.label,"aria-pressed":e===r.value,onClick:()=>n(r.value),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150 ${e===r.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:s.jsx(xa,{d:r.icon,size:14})},r.value))})}const Ok="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";function Xl({label:e,pending:n=!1,onClick:r,className:l}){return s.jsxs("button",{type:"button","aria-label":p.chat.loadMore,disabled:n,onClick:r,className:`${Ok}${l?` ${l}`:""} disabled:opacity-60`,children:[s.jsx("span",{className:"w-3","aria-hidden":!0}),n?p.common.loading:e]})}function Dk({label:e,open:n,onToggle:r,more:l=!1,pending:o=!1,onMore:c,children:d}){return s.jsxs("div",{className:"mt-1",children:[s.jsxs("button",{type:"button",onClick:r,className:Ok,children:[s.jsx(ra,{open:n,size:12}),e]}),n&&d,n&&l&&s.jsx(Xl,{label:p.chat.loadMore,pending:o,onClick:()=>c?.()})]})}function Vu({open:e,onToggle:n,icon:r,label:l,uppercase:o=!1,count:c,title:d,actions:f}){return s.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[s.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-label":e?p.nav.collapseGroup:p.nav.expandGroup,...d!==void 0?{title:d}:{},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:[r,s.jsx("span",{className:`min-w-0 truncate text-xs font-semibold ${o?"uppercase tracking-wide ":""}text-gray-500 dark:text-gray-400`,children:l}),c!==void 0&&s.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:c}),s.jsx(ra,{open:e,size:12,className:"text-gray-400"}),s.jsx("span",{className:"min-w-0 flex-1"})]}),f]})}function Fo({size:e=12,className:n=""}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function zk({size:e=13,className:n=""}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:s.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Uk({size:e=13,className:n=""}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:s.jsx("path",{d:"M12 4v11m0 0l-5-5m5 5l5-5M4 20h16",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function p1({size:e=13,className:n=""}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:s.jsx("path",{d:"M12 15V4m0 0L7 9m5-5l5 5M4 20h16",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Tp({onClose:e,className:n="",...r}){return s.jsx("button",{type:"button","aria-label":p.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:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})}const ya={agents:Ak,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"};function P4({open:e,side:n="left",title:r,onClose:l,children:o,widthClass:c}){return b.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&l()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l]),e?s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"anim-fade absolute inset-0 bg-black/45",onMouseDown:l}),s.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:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[s.jsx("span",{className:"text-base font-semibold",children:r??""}),s.jsx(Tp,{onClose:l})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-[env(safe-area-inset-bottom)]",children:o})]})]}):null}function Pe({d:e,size:n=13,className:r=""}){return s.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:s.jsx("path",{d:e})})}function sl(e){const n=e.toFixed(1);return n.endsWith(".0")?n.slice(0,-2):n}function yt(e){const n=Math.abs(e);return n<1e3?`${e}`:n<1e6?`${sl(e/1e3)}k`:`${sl(e/1e6)}M`}function Mn(e,n){if(e<1e3)return`${Math.round(e)}ms`;const r=e/1e3;if(r<60&&!(n?.compact&&r>=10))return`${sl(r)}s`;const l=Math.round(r);return l<60?`${l}s`:`${Math.floor(l/60)}m${l%60}s`}function $k(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m${n%60}s`}function _h(e,n){return n>0?e/(n/1e3):null}function Gu(e){return e==null||!Number.isFinite(e)?"—":`${Math.abs(e)<1e3?sl(e):yt(e)} tok/s`}function Bk(e,n){const r=e+n;return r>0?e/r:null}function Mp(e){return e==null||!Number.isFinite(e)?"—":`${Math.round(e*100)}%`}function er(e,n="USD",r){if(e==null)return"—";const l=n==="CNY"?"¥":"$",o=n==="CNY"?e*7:e;if(o===0)return`${l}0`;const c=Math.abs(o);if(r?.compact&&c<1)return`${l}${Number(o.toPrecision(2))}`;const d=c>=100?0:c>=1?2:4;return`${l}${o.toFixed(d)}`}function Io(e){return Number.isInteger(e)?`${e}`:e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function g1(e){return Number(e.toFixed(1))<1024}function _o(e){if(e<1024)return`${e}B`;const n=e/1024;if(g1(n))return`${sl(n)}KB`;const r=n/1024;return g1(r)?`${sl(r)}MB`:`${sl(r/1024)}GB`}function al(e){return e<10?`0${e}`:`${e}`}function wa(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${n.getFullYear()}-${al(n.getMonth()+1)}-${al(n.getDate())} ${al(n.getHours())}:${al(n.getMinutes())}`}const F4=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Hk(e,n){const r=/^\d{4}-(\d{2})-(\d{2})(?:$|T)/.exec(e);if(!r)return e;const l=Number(r[1]),o=Number(r[2]);return l<1||l>12||o<1||o>31?e:n==="en"?`${F4[l-1]} ${o}`:`${l} 月 ${o} 日`}function Pk(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 Wu(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function q4(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const l=Math.round((Wu(new Date)-Wu(r))/864e5);return l<0?wa(e):l===0?n==="en"?"today":"今天":l===1?n==="en"?"yesterday":"昨天":n==="en"?`${l} days ago`:`${l} 天前`}function Fk(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const l=Math.round((Wu(new Date)-Wu(r))/864e5);return l<0?e:l===0?n==="en"?"updated today":"今天更新":l===1?n==="en"?"updated yesterday":"昨天更新":n==="en"?`updated ${l} days ago`:`${l} 天前更新`}function V4(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${al(n.getHours())}:${al(n.getMinutes())}:${al(n.getSeconds())}`}function _e(e,n){return e instanceof ka?e.code==="model_credential_missing"?n?.modelId?p.errors.modelCredentialMissing(n.modelId):e.message:e.code==="no_default_model"?p.errors.noDefaultModel:p.errors.byCode[e.code]??e.message:p.common.unknownError}function Ep({checked:e,onChange:n,disabled:r,className:l,...o}){return s.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:r,onClick:()=>n(!e),className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 "+(e?"bg-[var(--accent-bg)]":"bg-gray-300 dark:bg-gray-600")+` ${l??""}`,...o,children:s.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"}`})})}var si=Lv();const Lo=[];function qk(){const e=Symbol("esc-layer");return Lo.push(e),e}function Vk(e){const n=Lo.lastIndexOf(e);n!==-1&&Lo.splice(n,1)}function Gk(e){return Lo[Lo.length-1]===e}function ln({open:e,title:n,onClose:r,children:l,footer:o,widthClass:c,headerless:d}){return b.useEffect(()=>{if(!e)return;const f=qk(),m=h=>{h.key==="Escape"&&Gk(f)&&r()};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m),Vk(f)}},[e,r]),e?si.createPortal(s.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:s.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&&s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[s.jsx("h2",{className:"text-base font-semibold",children:n}),s.jsx(Tp,{onClose:r})]}),s.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-4 py-4",children:l}),o&&s.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 mu=4,no=8;function Sa({button:e,open:n,setOpen:r,children:l,menuClass:o,menuStyle:c,className:d,portal:f,onEscape:m}){const h=b.useRef(null),g=b.useRef(null),[y,k]=b.useState(null),w=b.useRef(r);w.current=r;const S=b.useRef(m);S.current=m,b.useEffect(()=>{if(!n)return;const M=P=>{const H=P.target;h.current?.contains(H)||g.current?.contains(H)||w.current(!1)},L=qk(),O=P=>{if(P.key!=="Escape"||!Gk(L))return;const H=S.current;H?H():w.current(!1)};return window.addEventListener("mousedown",M),window.addEventListener("keydown",O),()=>{Vk(L),window.removeEventListener("mousedown",M),window.removeEventListener("keydown",O)}},[n]);const T=b.useCallback(()=>{if(!n||!f||!h.current){k(null);return}const M=h.current.getBoundingClientRect(),L=g.current,O=L?.offsetWidth??0,P=L?.offsetHeight??0,H=f.align==="right"?M.right-O:M.left,I=Math.max(no,Math.min(H,window.innerWidth-O-no)),F=window.innerHeight-M.bottom-mu-no,K=M.top-mu-no,Z=f.direction==="up",B=(Z?P<=K:P<=F)?Z:K>F;k({left:I,maxHeight:Math.max(0,B?K:F),...B?{bottom:window.innerHeight-M.top+mu}:{top:M.bottom+mu}})},[n,f?.direction,f?.align,l]);b.useLayoutEffect(T,[T]),b.useEffect(()=>{if(!n||!f)return;const M=L=>{g.current?.contains(L.target)||T()};return window.addEventListener("scroll",M,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",T)}},[n,f,T]);const E=`anim-pop ${f?"z-[60]":"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 s.jsxs("div",{className:`relative ${d??""}`,ref:h,children:[e,n&&(f?si.createPortal(s.jsx("div",{ref:g,style:{position:"fixed",...y?{left:y.left,maxHeight:y.maxHeight,...y.top!==void 0?{top:y.top}:{},...y.bottom!==void 0?{bottom:y.bottom}:{}}:{left:0,top:0,visibility:"hidden"},maxWidth:`calc(100vw - ${no*2}px)`,...c},className:E,children:l}),document.body):s.jsx("div",{ref:g,...c!==void 0?{style:c}:{},className:`absolute ${E}`,children:l}))]})}function G4(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 W4(e){return G4(e)%360}function Wk(e){const n=W4(e);return{bg:`hsl(${n} 55% 50% / 0.14)`,fg:`hsl(${n} 55% 28%)`,fgDark:`hsl(${n} 55% 73%)`}}const x1=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function y1(e){if(e){if(!x1)return Array.from(e)[0];for(const n of x1.segment(e))return n.segment}}function Kk(e,n){const r=y1(e.trim())??y1((n??"").trim());return r?r.toUpperCase():"?"}function na({id:e,name:n,size:r=18,className:l}){const o=Wk(e);return s.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",className:l,style:{"--tile-fg":o.fg,"--tile-fg-dark":o.fgDark},"aria-hidden":!0,role:"img",children:[s.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:o.bg}),s.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:Kk(n??"",e)})]})}const K4={success:2500,info:4e3,error:6e3};let $r=[],Y4=1;const Lh=new Set;function Oh(){for(const e of Lh)e($r)}const Q4=160;function Yk(e){const n=$r.find(r=>r.id===e);!n||n.leaving||($r=$r.map(r=>r.id===e?{...r,leaving:!0}:r),Oh(),setTimeout(()=>{$r=$r.filter(r=>r.id!==e),Oh()},Q4))}function Ap(e,n){if(!n)return;const r=Y4++;$r=[...$r,{id:r,kind:e,text:n}],Oh(),setTimeout(()=>Yk(r),K4[e])}const _n=e=>Ap("success",e),ht=e=>Ap("error",e),Ts=e=>Ap("info",e),X4={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 Z4(){const[e,n]=b.useState($r);return b.useEffect(()=>(Lh.add(n),()=>{Lh.delete(n)}),[]),e.length===0?null:si.createPortal(s.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=>s.jsx("button",{type:"button",onClick:()=>Yk(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"} ${X4[r.kind]}`,children:r.text},r.id))}),document.body)}function pd({text:e,className:n=""}){const r=b.useRef(null),[l,o]=b.useState(!1);return b.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]),s.jsx("span",{ref:r,className:`truncate ${n}`,...l?{title:e}:{},children:e})}const J4={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 sn({tone:e="gray",children:n}){return s.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ${J4[e]}`,children:n})}function e3(e){switch(e){case"completed":return"green";case"aborted":return"amber";default:return"red"}}const t3={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"},n3={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 we({variant:e="secondary",size:n="md",className:r,...l}){return s.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 ${t3[e]} ${n3[n]} ${r??""}`,...l})}function a3({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 s.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:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:n})})})}function qn({open:e,title:n,onClose:r,onConfirm:l,confirmLabel:o,tone:c="danger",busy:d=!1,children:f}){return s.jsxs(ln,{open:e,title:n,onClose:r,headerless:!0,widthClass:"sm:max-w-sm",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(a3,{tone:c}),s.jsx("div",{className:"min-w-0 flex-1 pt-1.5",children:f})]}),s.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[s.jsx(we,{size:"sm",onClick:r,disabled:d,children:p.common.cancel}),s.jsx(we,{size:"sm",variant:c,disabled:d,onClick:l,children:o??p.common.confirm})]})]})}function gd(){const[e,n]=b.useState(null),r=s.jsx(qn,{open:e!==null,title:p.common.confirmSaveTitle,tone:"primary",confirmLabel:p.common.save,onClose:()=>n(null),onConfirm:()=>{e?.(),n(null)},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.common.confirmSaveBody})});return{requestSave:l=>n(()=>l),element:r}}const qo="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",Qk="w-full px-3 py-1.5 text-left transition-colors duration-150";function ws({children:e,required:n}){return s.jsxs("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:[e,n&&s.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]})}function Ku({children:e}){return s.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:e})}function ks({id:e,children:n}){return s.jsx("span",{id:e,role:"alert",className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:n})}function Vo({label:e,hint:n,error:r,errorId:l,required:o,children:c}){return!e&&!n&&!r?s.jsx(s.Fragment,{children:c}):s.jsxs("label",{className:"block",children:[e!=null&&e!==""&&s.jsx(ws,{required:o,children:e}),c,r?s.jsx(ks,{id:l,children:r}):n?s.jsx(Ku,{children:n}):null]})}const Xk=`w-full ${qo} placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500`,Go={base:"px-3 py-2 text-base",sm:"px-2 py-1 text-xs"},xd="!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 Rp(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 yd=Rp(void 0,!1);function tt({label:e,hint:n,error:r,invalid:l,required:o,size:c="base",className:d,autoComplete:f,...m}){const h=!!r||!!l,g=b.useId();return s.jsx(Vo,{label:e,hint:n,error:r,errorId:g,required:o,children:s.jsx("input",{className:`${Xk} ${Go[c]} ${h?xd:""} ${d??""}`,"aria-invalid":h?!0:void 0,"aria-required":o||void 0,"aria-describedby":r?g:void 0,...Rp(f,m.type==="password"),...m})})}const ol=b.forwardRef(function({label:n,hint:r,error:l,invalid:o,required:c,mono:d,size:f="base",className:m,autoComplete:h,...g},y){const k=!!l||!!o,w=b.useId();return s.jsx(Vo,{label:n,hint:r,error:l,errorId:w,required:c,children:s.jsx("textarea",{ref:y,className:`${Xk} px-3 py-2 ${f==="sm"?"text-xs leading-relaxed":"text-base"} ${d?"font-mono":""} ${k?xd:""} ${m??""}`,"aria-invalid":k?!0:void 0,"aria-required":c||void 0,"aria-describedby":l?w:void 0,...Rp(h,!1),...g})})});function Ql({options:e,value:n,onChange:r,cols:l=3}){return s.jsx("div",{className:`grid ${l===2?"grid-cols-2":"grid-cols-3"} gap-0.5 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800`,children:e.map(o=>s.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 s.jsx("div",{className:`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${e??"h-4 w-full"}`})}function ba({rows:e=3}){return s.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:e},(n,r)=>s.jsx(Vt,{className:"h-8 w-full"},r))})}function Zk({className:e,children:n}){return s.jsx("div",{className:`rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900 ${e??"p-4"}`,children:n??s.jsxs(s.Fragment,{children:[s.jsx(Vt,{className:"h-3 w-20"}),s.jsx(Vt,{className:"mt-2.5 h-6 w-28"}),s.jsx(Vt,{className:"mt-2.5 h-3 w-24"})]})})}function gr(e){b.useEffect(()=>{document.title=e?`${e} · ${p.appName}`:p.appName},[e])}var r3=["partial_text","partial_thinking","partial_tool_call","partial_tool_call_output"];function Yu(e){return r3.includes(e.type??"")}function Ip(e){return e.type==="event_msg"}function s3(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _p(e,n){return`[${e}]
|
|
126
|
-
${n}
|
|
127
|
-
[/${e}]`}function Wo(e,n,r=""){const l=s3(e);return[new RegExp(`\\[${l}\\]${n}\\[/${l}\\]`,r),new RegExp(`<${l}>${n}</${l}>`,r)]}function bd(e,n){return e[0].exec(n)??e[1].exec(n)}var mr={summary:"summary",userSteering:"user_steering",useSkills:"use_skills",handoffFrom:"handoff_from",scheduledTask:"scheduled_task",modelSwitchFrom:"model_switch_from"},l3="[attached image: ",i3="[attached file: ",o3=/^\[attached image: (.+)\]$/,c3=/^\[attached file: (.+)\]$/;function u3(e){return o3.exec(e)?.[1]??null}function d3(e){return c3.exec(e)?.[1]??null}Wo(mr.summary,"([\\s\\S]*?)","g");function Dh(e,n){if(e.length===0)return n;const r=_p(mr.useSkills,`skills: ${e.join(", ")}`);return n?`${r}
|
|
128
|
-
|
|
129
|
-
${n}`:r}var f3=Wo(mr.useSkills,"\\nskills: ([^\\n]+)\\n");function Jk(e){const n=bd(f3,e);if(!n||n.index!==0)return null;const r=n[1].split(",").map(l=>l.trim()).filter(l=>l.length>0);return r.length===0?null:{skills:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}}function ew(e){const n=/^([\w-]+) \((.*)\)$/.exec(e);return n?{id:n[1],label:n[2]}:{id:e}}function Lp(e,n){const r=new RegExp(`^(${n.join("|")}): (.+)$`),l=[];for(const o of e.split(`
|
|
130
|
-
`)){const c=r.exec(o);c&&l.push([c[1],c[2]])}return l}function m3(e){const n=e.agentName&&e.agentName!==e.agentId?` (${e.agentName})`:"",r=[`agent: ${e.agentId}${n}`];if(e.sessionId){const l=e.sessionTitle?` (${e.sessionTitle})`:"";r.push(`session: ${e.sessionId}${l}`)}return e.workspace&&r.push(`workspace: ${e.workspace}`),_p(mr.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(`
|
|
131
|
-
`))}var h3=Wo(mr.handoffFrom,"\\n([\\s\\S]*)\\n","");function tw(e){const n=e.trim(),r=bd(h3,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const l={agentId:""};for(const[o,c]of Lp(r[1],["agent","session","workspace"])){if(o==="workspace"){l.workspace=c;continue}const{id:d,label:f}=ew(c);o==="agent"?(l.agentId=d,f!==void 0&&(l.agentName=f)):(l.sessionId=d,f!==void 0&&(l.sessionTitle=f))}return l.agentId?l:null}var p3=Wo(mr.scheduledTask,"\\n([\\s\\S]*?)\\n");function nw(e){const n=bd(p3,e);if(!n||n.index!==0)return null;const r={name:"",firedAt:""};for(const[l,o]of Lp(n[1],["schedule","fired_at"]))l==="schedule"?r.name=o:r.firedAt=o;return r.name?{origin:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}:null}function g3(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}`),_p(mr.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(`
|
|
132
|
-
`))}var x3=Wo(mr.modelSwitchFrom,"\\n([\\s\\S]*)\\n");function aw(e){const n=e.trim(),r=bd(x3,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const l={sessionId:""},o=["session","trace","workspace","previous_model","previous_provider"];for(const[c,d]of Lp(r[1],o))if(c==="session"){const{id:f,label:m}=ew(d);l.sessionId=f,m!==void 0&&(l.sessionTitle=m)}else c==="trace"?l.tracePath=d:c==="workspace"?l.workspace=d:c==="previous_model"?l.prevModelId=d:l.prevProvider=d;return l.sessionId?l:null}var y3=new RegExp(`^\\[${mr.userSteering}\\]\\n([\\s\\S]*?)\\n\\[/${mr.userSteering}\\]\\s*$`);function b3(e){const n=y3.exec(e);return n?n[1]:null}function rw(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 b1(e,n){return n?(e.cacheRead*n.cacheRead+e.cacheWrite*n.cacheWrite+e.output*n.output)/1e6:null}function v3(){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 v1(e,n){e.subagentTotal=n.subagentTokens,e.sessionElapsedMs=n.elapsedMs,e.sessionTotal=n.sessionTokens,e.contextNow=n.contextTokens,e.contextAtLastStats=n.contextTokens}function sw(e,n){e.taskCacheRead+=n.request.cache_read,e.taskCacheWrite+=n.request.cache_write,e.taskOutput+=n.request.output}function k3(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,sw(e,n),e.contextNow=n.request.total,e.contextStale=!1,e.taskMainOutput+=n.request.output,e.hasUsage=!0}function w3(e){e.pendingCompactionTokens!==0&&(e.taskTokens+=e.pendingCompactionTokens,e.taskCacheRead+=e.pendingCompactionCacheRead,e.taskCacheWrite+=e.pendingCompactionCacheWrite,e.taskOutput+=e.pendingCompactionOutput,e.hasUsage=!0,Op(e))}function Op(e){e.pendingCompactionTokens=0,e.pendingCompactionCacheRead=0,e.pendingCompactionCacheWrite=0,e.pendingCompactionOutput=0}function S3(e,n){n>0&&(e.taskLlmMs+=n)}function j3(e,n){e.taskTokens+=n.request.total,sw(e,n),e.subagentTotal+=n.request.total,e.hasUsage=!0}function N3(e){e.compactionActive=!0}function C3(e,n){e.compactionActive=!1,n==="completed"&&(e.contextStale=!0)}function T3(e){e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,Op(e),e.hasUsage=!1,e.compactionActive=!1}function M3(e,n){if(e.sessionElapsedMs+=n,Op(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:_h(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 E3(e,n,r,l){const o=n&&r!=null?Math.max(0,l-r):0;return e.sessionElapsedMs+o}function A3(e,n){const r=e.tokensByBucket;return`[${n.stats}] ${n.input} ${yt(r.cacheRead+r.cacheWrite)}${n.parenOpen}${n.cached} ${yt(r.cacheRead)}${n.parenClose} · ${n.output} ${yt(r.output)} · ${Gu(e.outputTps)}`}function R3(e){return e==="failed"||e==="timeout"||e==="malformed"}function lw(e,n){return{items:[],nested:e,meta:null,stats:v3(),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,lastAuthFailureMs:null,taskOpen:!1,taskStartLocalMs:0,taskFirstTsMs:0,taskLastTsMs:0,taskLastReqEndMs:null,nextItemId:1}}function yo(e=new Set){return lw(!1,e)}function I3(e,n){return e===null?!1:n===null||e>n}function ta(e){return e.nextItemId++}function Qu(e,n,r=Date.now()){if(n.origin&&n.origin.length>0){q3(e,n,r);return}if(_3(n)||(e.openSteering=null),n.type==="model_msg"){if(e.stats.compactionActive){Ba(e,n.timestamp),Pm(e,n.timestamp);return}if(Yu(n.payload)){Ba(e,n.timestamp),B3(e,n.payload,Ka(n.timestamp));return}H3(e,n.payload,n.timestamp,r),Pm(e,n.timestamp);return}if(Ip(n)){Ba(e,n.timestamp),P3(e,n.payload,Ka(n.timestamp),r),Pm(e,n.timestamp);return}if(n.type==="session_meta"&&e.nested){const l=n.payload,o={agentId:L3(l.agent_state),provider:l.provider,modelId:l.model_id};l.source!==void 0&&(o.source=l.source),e.meta=o}}function _3(e){return e.type==="model_msg"&&e.payload.type==="image_url"}function L3(e){const n=e.split(/[\\/]/).filter(r=>r.length>0);return n.length>=2?n[n.length-2]:null}function O3(e,n){const r=n.join("/");for(const l of e)if(l.startsWith(`${r} `)||l.startsWith(`${r}/`))return!0;return!1}function Ka(e){const n=Date.parse(e);return Number.isFinite(n)?n:void 0}function Pm(e,n){const r=Date.parse(n);Number.isFinite(r)&&(e.lastTsMs=r)}function k1(e,n,r=Date.now(),l=null){for(const o of n)Qu(e,o,r);if(e.taskOpen){const o=e.taskLastTsMs-e.taskFirstTsMs,c=l===null?0:l-e.taskFirstTsMs;e.taskStartLocalMs=r-Math.max(0,o,c)}}function D3(e){Dp(e)}function w1(e){Dp(e)}function z3(e,n){e.localDecisions.add(n)}function Jl(e,n){return`${e?.join("/")??""} ${n}`}function U3(e,n,r){let l=e;for(const o of n??[])if(l=l.subagents.get(o),!l)return null;return l.toolCards.get(r)??null}function Ba(e,n){if(!e.taskOpen||e.stats.compactionActive)return;const r=Date.parse(n);!Number.isFinite(r)||r<=e.taskLastTsMs||(e.taskLastTsMs=r)}function S1(e,n,r){Dp(e);const l=Bh(e);l&&(l.gaveUp=!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,T3(e.stats)}function Dp(e){if(!e.taskOpen)return;e.taskOpen=!1,iw(e);const n=e.taskLastReqEndMs??e.taskLastTsMs,r=Math.max(0,n-e.taskFirstTsMs),l=M3(e.stats,r);if(e.nested)return;const o=$3(e);if(l===null&&o.text==="")return;const c={kind:"task_stats",id:ta(e),stats:l,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 $3(e){const n=[];let r;for(let l=e.items.length-1;l>=0;l--){const o=e.items[l];if(o.kind==="task_stats")break;o.kind==="assistant_text"&&o.text.trim()&&(n.push(o.text),r===void 0&&(r=o.atMs))}return{text:n.reverse().join(`
|
|
133
|
-
|
|
134
|
-
`),...r!==void 0?{atMs:r}:{}}}function B3(e,n,r){switch(n.type){case"partial_text":{if(n.event_type==="start"){e.pendingText=null;const o={kind:"assistant_text",id:ta(e),text:n.text??"",streaming:!0,...r!==void 0?{atMs:r}:{}};e.openText=o,e.items.push(o);return}const l=e.openText;if(!l)return;n.text&&(l.text+=n.text),n.event_type==="stop"&&(l.streaming=!1,n.stop_reason!==void 0&&(l.stopReason=n.stop_reason),e.pendingText=l,e.openText=null);return}case"partial_thinking":{if(n.event_type==="start"){e.pendingThinking=null;const o={kind:"thinking",id:ta(e),thinking:n.thinking??"",streaming:!0};r!==void 0&&(o.startedAtMs=r),e.openThinking=o,e.items.push(o);return}const l=e.openThinking;if(!l)return;n.thinking&&(l.thinking+=n.thinking),n.event_type==="stop"&&(l.streaming=!1,n.stop_reason!==void 0&&(l.stopReason=n.stop_reason),zh(l,r),e.pendingThinking=l,e.openThinking=null);return}case"partial_tool_call":{const l=e.toolCards.get(n.tool_call_id);if(l?.callComplete)return;if(n.event_type==="start"){if(l){l.name=n.name||l.name,l.argumentsText=n.arguments??"",l.callStreaming=!0,r!==void 0&&l.argStartedAtMs===void 0&&(l.argStartedAtMs=r);return}const o=$h(e,{toolCallId:n.tool_call_id,name:n.name,argumentsText:n.arguments??"",callStreaming:!0});r!==void 0&&(o.argStartedAtMs=r);return}if(!l)return;n.name&&!l.name&&(l.name=n.name),n.arguments&&(l.argumentsText+=n.arguments),n.event_type==="stop"&&(l.callStreaming=!1,n.stop_reason!==void 0&&(l.callStopReason=n.stop_reason),r!==void 0&&(l.callStartedAtMs=r));return}case"partial_tool_call_output":{const l=e.toolCards.get(n.tool_call_id);if(!l||l.outputComplete)return;if(n.event_type==="start"){l.outputStreaming=!0,n.output&&(l.output+=n.output),n.images&&n.images.length>0&&(l.images=n.images);return}if(!l.outputStreaming)return;n.output&&(l.output+=n.output),n.images&&n.images.length>0&&(l.images=n.images),n.event_type==="stop"&&(l.outputStreaming=!1,n.stop_reason!==void 0&&(l.outputStopReason=n.stop_reason),ow(l,r));return}}}function H3(e,n,r,l){switch(n.type){case"text":{if(n.role==="user"){if(n.text.startsWith("[context_summary]")||n.text.startsWith("<context_summary>")){Ba(e,r);return}const f=b3(n.text);if(f!==null){Ba(e,r);const h=Ka(r),g={kind:"user_steering",id:ta(e),text:f,...h!==void 0?{atMs:h}:{}};e.items.push(g),e.openSteering=g;return}S1(e,r,l);const m=Ka(r);e.items.push({kind:"user_text",id:ta(e),text:n.text,...m!==void 0?{atMs:m}:{}});return}Ba(e,r);const o=e.pendingText??e.openText;if(o){if(!n.text.trim()){ko(e,o),o===e.openText&&(e.openText=null),e.pendingText=null;return}o.text=n.text,o.streaming=!1;const f=Ka(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=Ka(r),d={kind:"assistant_text",id:ta(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){Ba(e,r),e.openSteering.images=[...e.openSteering.images??[],n.image_url];return}S1(e,r,l);const o=Ka(r);e.items.push({kind:"user_image",id:ta(e),imageUrl:n.image_url,...o!==void 0?{atMs:o}:{}});return}case"thinking":{Ba(e,r);const o=Ka(r),c=e.pendingThinking??e.openThinking;if(c){if(!n.thinking.trim()){ko(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),zh(c,o),c===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}if(!n.thinking.trim())return;const d={kind:"thinking",id:ta(e),thinking:n.thinking,streaming:!1};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.lastTsMs>0&&(d.startedAtMs=e.lastTsMs),zh(d,o),e.items.push(d);return}case"tool_call":{Ba(e,r);const o=Ka(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),Uh(e,d),j1(d);return}c&&!c.outputComplete&&(c.outputComplete=!0,c.outputStreaming=!1,c.outputStopReason??="aborted");const f=$h(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),Uh(e,f),e.lastTsMs>0&&(f.argStartedAtMs=e.lastTsMs),j1(f);return}case"tool_call_output":{Ba(e,r);let o=e.toolCards.get(n.tool_call_id);o||(o=$h(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),ow(o,Ka(r));return}case"inline_data":case"inline_thinking":Ba(e,r);return}}function iw(e){for(const n of e.toolCards.values())n.callComplete&&!n.outputComplete&&(n.outputComplete=!0,n.outputStreaming=!1,n.outputStopReason??="aborted")}function j1(e){!e.callStopReason||e.callStopReason==="completed"||e.outputComplete||(e.outputComplete=!0,e.outputStreaming=!1,e.outputStopReason??=e.callStopReason)}function zh(e,n){n===void 0||e.startedAtMs===void 0||(e.durationMs=Math.max(0,n-e.startedAtMs))}function ow(e,n){if(n===void 0)return;const r=e.approvalAtMs??e.callStartedAtMs;if(r===void 0)return;const l=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0;e.durationMs=l+Math.max(0,n-r)}function Uh(e,n){if(n.approvalWaitCounted)return;const{callStartedAtMs:r,approvalAtMs:l}=n;if(r===void 0||l===void 0)return;n.approvalWaitCounted=!0;const o=l-r;o>0&&(e.openApprovalWaitMs+=o)}function $h(e,n){const r={kind:"tool_call",id:ta(e),toolCallId:n.toolCallId,name:n.name,argumentsText:n.argumentsText,callStreaming:n.callStreaming,callComplete:!1,output:"",outputStreaming:!1,outputComplete:!1},l=e.pendingDecisions.get(n.toolCallId);if(l!==void 0){r.decision=l,r.decisionSource=e.localDecisions.has(n.toolCallId)?"manual":"remote",e.pendingDecisions.delete(n.toolCallId);const o=e.pendingDecisionTs.get(n.toolCallId);o!==void 0&&(r.approvalAtMs=o,e.pendingDecisionTs.delete(n.toolCallId))}return e.toolCards.set(n.toolCallId,r),e.items.push(r),r}function P3(e,n,r,l){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),Uh(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":{iw(e);const o=Bh(e);o&&(o.gaveUp=!0);const c={kind:"abort",id:ta(e)};n.reason!=null&&(c.reason=n.reason),e.items.push(c);return}case"token_usage":k3(e.stats,n);return;case"compaction_begin":{N3(e.stats),e.items.push({kind:"compaction",id:ta(e),reason:n.reason,mode:n.mode,running:!0});return}case"compaction_end":{C3(e.stats,n.status);const o=F3(e);if(o)o.running=!1,o.status=n.status,n.error_message!==void 0&&(o.errorMessage=n.error_message);else{const c={kind:"compaction",id:ta(e),reason:n.reason,mode:n.mode,running:!1,status:n.status,...n.error_message!==void 0?{errorMessage:n.error_message}:{}};e.items.push(c)}return}case"request_begin":{const o=Bh(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&&S3(e.stats,r-e.openRequestBeginMs-e.openApprovalWaitMs),e.openRequestBeginMs=null,e.openApprovalWaitMs=0,r!==void 0&&(e.taskLastReqEndMs=r),w3(e.stats),R3(n.status)){const o={kind:"reconnect",id:ta(e),status:n.status,attempt:n.attempt??1,retrying:!1};typeof n.retry_in_ms=="number"&&n.retry_in_ms>0&&(o.plannedDelayMs=n.retry_in_ms,o.arrivedAtMs=l??Date.now()),e.items.push(o)}return}}}function F3(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 Bh(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 q3(e,n,r){const l=n.origin[0];Ip(n)&&n.payload.type==="token_usage"&&j3(e.stats,n.payload),Ba(e,n.timestamp);let o=e.subagents.get(l);o||(o=lw(!0,e.localDecisions),o.firstSeenLocalMs=r,e.subagents.set(l,o),V3(e,l,o)),o.lastActivityLocalMs=r;const c=Ka(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,Qu(o,f,r)}function V3(e,n,r){for(let l=e.items.length-1;l>=0;l--){const o=e.items[l];if(o.kind==="tool_call"&&o.name==="run_subagent"&&!o.subagent&&!o.outputComplete&&o.decision==="allow"){o.subagent=r,o.subagentSessionId=n;return}}e.items.push({kind:"subagent",id:ta(e),sessionId:n,model:r})}function G3(e,n=100){const r=new Set;for(let l=Math.max(0,e.length-n);l<e.length;l++)r.add(JSON.stringify(e[l]));return r}function W3(e,n){return e.has(JSON.stringify(n))}function cw(e,n){if(n.origin&&n.origin.length>0){const l=e.subagents.get(n.origin[0]);if(!l)return;const o=n.origin.slice(1),c={...n};o.length>0?c.origin=o:delete c.origin,cw(l,c);return}if(n.type!=="model_msg"||Yu(n.payload))return;const r=n.payload;switch(r.type){case"text":{if(r.role!=="assistant")return;const l=e.pendingText??e.openText;l&&(ko(e,l),l===e.openText&&(e.openText=null),e.pendingText=null);return}case"thinking":{const l=e.pendingThinking??e.openThinking;l&&(ko(e,l),l===e.openThinking&&(e.openThinking=null),e.pendingThinking=null);return}case"tool_call":{const l=e.toolCards.get(r.tool_call_id);l&&!l.callComplete&&(ko(e,l),e.toolCards.delete(r.tool_call_id));return}case"tool_call_output":{const l=e.toolCards.get(r.tool_call_id);l&&!l.outputComplete&&(l.output="",l.outputStreaming=!1);return}default:return}}function ko(e,n){const r=e.items.indexOf(n);r>=0&&e.items.splice(r,1)}function hr({title:e,description:n,action:r}){return s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[s.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:e}),n&&s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:n}),r&&s.jsx("div",{className:"mt-2",children:r})]})}const gn={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"},uw=/[/\\]scratchpad[/\\]([^/\\]+)[/\\]([^/\\]+)$/;function K3(e){if(/^https?:\/\//i.test(e))return e;const n=uw.exec(e);return n?`/api/sessions/${encodeURIComponent(n[1])}/scratchpad/${encodeURIComponent(n[2])}`:null}function Xu(e){if(!e.includes(l3)&&!e.includes(i3))return{text:e,images:[],files:[]};const n=[],r=[],l=[];for(const o of e.split(`
|
|
135
|
-
`)){const c=o.trim(),d=u3(c),f=d!==null?K3(d):null;if(f){r.push(f);continue}const m=d3(c);if(m!==null&&uw.test(m)){l.push(m);continue}n.push(o)}return{text:n.join(`
|
|
136
|
-
`).replace(/\n+$/,""),images:r,files:l}}function Y3(e){const n=e.split(/[/\\]/);return n[n.length-1]||e}function Q3(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const X3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Z3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,J3={};function N1(e,n){return(J3.jsx?Z3:X3).test(e)}const eT=/[ \t\n\f\r]/g;function tT(e){return typeof e=="object"?e.type==="text"?C1(e.value):!1:C1(e)}function C1(e){return e.replace(eT,"")===""}class Ko{constructor(n,r,l){this.normal=r,this.property=n,l&&(this.space=l)}}Ko.prototype.normal={};Ko.prototype.property={};Ko.prototype.space=void 0;function dw(e,n){const r={},l={};for(const o of e)Object.assign(r,o.property),Object.assign(l,o.normal);return new Ko(r,l,n)}function Hh(e){return e.toLowerCase()}class sa{constructor(n,r){this.attribute=r,this.property=n}}sa.prototype.attribute="";sa.prototype.booleanish=!1;sa.prototype.boolean=!1;sa.prototype.commaOrSpaceSeparated=!1;sa.prototype.commaSeparated=!1;sa.prototype.defined=!1;sa.prototype.mustUseProperty=!1;sa.prototype.number=!1;sa.prototype.overloadedBoolean=!1;sa.prototype.property="";sa.prototype.spaceSeparated=!1;sa.prototype.space=void 0;let nT=0;const We=fl(),pn=fl(),Ph=fl(),be=fl(),Ot=fl(),ll=fl(),ga=fl();function fl(){return 2**++nT}const Fh=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:pn,commaOrSpaceSeparated:ga,commaSeparated:ll,number:be,overloadedBoolean:Ph,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),Fm=Object.keys(Fh);class zp extends sa{constructor(n,r,l,o){let c=-1;if(super(n,r),T1(this,"space",o),typeof l=="number")for(;++c<Fm.length;){const d=Fm[c];T1(this,Fm[c],(l&Fh[d])===Fh[d])}}}zp.prototype.defined=!0;function T1(e,n,r){r&&(e[n]=r)}function li(e){const n={},r={};for(const[l,o]of Object.entries(e.properties)){const c=new zp(l,e.transform(e.attributes||{},l),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(c.mustUseProperty=!0),n[l]=c,r[Hh(l)]=l,r[Hh(c.attribute)]=l}return new Ko(n,r,e.space)}const fw=li({properties:{ariaActiveDescendant:null,ariaAtomic:pn,ariaAutoComplete:null,ariaBusy:pn,ariaChecked:pn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:pn,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:pn,ariaFlowTo:Ot,ariaGrabbed:pn,ariaHasPopup:null,ariaHidden:pn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:be,ariaLive:null,ariaModal:pn,ariaMultiLine:pn,ariaMultiSelectable:pn,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:pn,ariaReadOnly:pn,ariaRelevant:null,ariaRequired:pn,ariaRoleDescription:Ot,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:pn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function mw(e,n){return n in e?e[n]:n}function hw(e,n){return mw(e,n.toLowerCase())}const aT=li({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ll,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alpha:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:Ot,autoFocus:We,autoPlay:We,blocking:Ot,capture:null,charSet:null,checked:We,cite:null,className:Ot,closedBy:null,colorSpace:null,cols:be,colSpan:be,command:null,commandFor:null,content:null,contentEditable:pn,controls:We,controlsList:Ot,coords:be|ll,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:Ph,draggable:pn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:Ot,height:be,hidden:Ph,high:be,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:We,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,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:We,optimum:be,pattern:null,ping:Ot,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:Ot,required:We,reversed:We,rows:be,rowSpan:be,sandbox:Ot,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootCustomElementRegistry:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shadowRootSerializable:We,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:pn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:We,useMap:null,value:pn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:pn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:We,disablePictureInPicture:We,disableRemotePlayback:We,exportParts:ll,part:Ot,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:hw}),rT=li({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:ga,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Ot,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:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:We,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,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:ll,g2:ll,glyphName:ll,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:ga,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,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:be,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:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ga,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ga,rev:ga,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ga,requiredFeatures:ga,requiredFonts:ga,requiredFormats:ga,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:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:ga,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ga,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ga,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mw}),pw=li({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()}}),gw=li({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hw}),xw=li({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),sT={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"},lT=/[A-Z]/g,M1=/-[a-z]/g,iT=/^data[-\w.:]+$/i;function oT(e,n){const r=Hh(n);let l=n,o=sa;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&iT.test(n)){if(n.charAt(4)==="-"){const c=n.slice(5).replace(M1,uT);l="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=n.slice(4);if(!M1.test(c)){let d=c.replace(lT,cT);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=zp}return new o(l,n)}function cT(e){return"-"+e.toLowerCase()}function uT(e){return e.charAt(1).toUpperCase()}const dT=dw([fw,aT,pw,gw,xw],"html"),Up=dw([fw,rT,pw,gw,xw],"svg");function fT(e){return e.join(" ").trim()}var ql={},qm,E1;function mT(){if(E1)return qm;E1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
137
|
-
`,h="/",g="*",y="",k="comment",w="declaration";function S(E,M){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];M=M||{};var L=1,O=1;function P(q){var U=q.match(n);U&&(L+=U.length);var V=q.lastIndexOf(m);O=~V?q.length-V:O+q.length}function H(){var q={line:L,column:O};return function(U){return U.position=new I(q),Z(),U}}function I(q){this.start=q,this.end={line:L,column:O},this.source=M.source}I.prototype.content=E;function F(q){var U=new Error(M.source+":"+L+":"+O+": "+q);if(U.reason=q,U.filename=M.source,U.line=L,U.column=O,U.source=E,!M.silent)throw U}function K(q){var U=q.exec(E);if(U){var V=U[0];return P(V),E=E.slice(V.length),U}}function Z(){K(r)}function z(q){var U;for(q=q||[];U=B();)U!==!1&&q.push(U);return q}function B(){var q=H();if(!(h!=E.charAt(0)||g!=E.charAt(1))){for(var U=2;y!=E.charAt(U)&&(g!=E.charAt(U)||h!=E.charAt(U+1));)++U;if(U+=2,y===E.charAt(U-1))return F("End of comment missing");var V=E.slice(2,U-2);return O+=2,P(V),E=E.slice(U),O+=2,q({type:k,comment:V})}}function A(){var q=H(),U=K(l);if(U){if(B(),!K(o))return F("property missing ':'");var V=K(c),W=q({type:w,property:T(U[0].replace(e,y)),value:V?T(V[0].replace(e,y)):y});return K(d),W}}function $(){var q=[];z(q);for(var U;U=A();)U!==!1&&(q.push(U),z(q));return q}return Z(),$()}function T(E){return E?E.replace(f,y):y}return qm=S,qm}var A1;function hT(){if(A1)return ql;A1=1;var e=ql&&ql.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(ql,"__esModule",{value:!0}),ql.default=r;const n=e(mT());function r(l,o){let c=null;if(!l||typeof l!="string")return c;const d=(0,n.default)(l),f=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:g}=m;f?o(h,g,m):g&&(c=c||{},c[h]=g)}),c}return ql}var ao={},R1;function pT(){if(R1)return ao;R1=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(h){return!h||r.test(h)||e.test(h)},d=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},m=function(h,g){return g===void 0&&(g={}),c(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,f):h=h.replace(l,f),h.replace(n,d))};return ao.camelCase=m,ao}var ro,I1;function gT(){if(I1)return ro;I1=1;var e=ro&&ro.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(hT()),r=pT();function l(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 l.default=l,ro=l,ro}var xT=gT();const yT=_v(xT),yw=bw("end"),$p=bw("start");function bw(e){return n;function n(r){const l=r&&r.position&&r.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function bT(e){const n=$p(e),r=yw(e);if(n&&r)return{start:n,end:r}}function wo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?_1(e.position):"start"in e||"end"in e?_1(e):"line"in e||"column"in e?qh(e):""}function qh(e){return L1(e&&e.line)+":"+L1(e&&e.column)}function _1(e){return qh(e&&e.start)+"-"+qh(e&&e.end)}function L1(e){return e&&typeof e=="number"?e:1}class $n extends Error{constructor(n,r,l){super(),typeof r=="string"&&(l=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 l=="string"){const m=l.indexOf(":");m===-1?c.ruleId=l:(c.source=l.slice(0,m),c.ruleId=l.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=wo(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}}$n.prototype.file="";$n.prototype.name="";$n.prototype.reason="";$n.prototype.message="";$n.prototype.stack="";$n.prototype.column=void 0;$n.prototype.line=void 0;$n.prototype.ancestors=void 0;$n.prototype.cause=void 0;$n.prototype.fatal=void 0;$n.prototype.place=void 0;$n.prototype.ruleId=void 0;$n.prototype.source=void 0;const Bp={}.hasOwnProperty,vT=new Map,kT=/[A-Z]/g,wT=new Set(["table","tbody","thead","tfoot","tr"]),ST=new Set(["td","th"]),vw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jT(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let l;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=IT(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=RT(r,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Up:dT,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},c=kw(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function kw(e,n,r){if(n.type==="element")return NT(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return CT(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return MT(e,n,r);if(n.type==="mdxjsEsm")return TT(e,n);if(n.type==="root")return ET(e,n,r);if(n.type==="text")return AT(e,n)}function NT(e,n,r){const l=e.schema;let o=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=Up,e.schema=o),e.ancestors.push(n);const c=Sw(e,n.tagName,!1),d=_T(e,n);let f=Pp(e,n);return wT.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!tT(m):!0})),ww(e,d,c,n),Hp(d,f),e.ancestors.pop(),e.schema=l,e.create(n,c,d,r)}function CT(e,n){if(n.data&&n.data.estree&&e.evaluater){const l=n.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}Oo(e,n.position)}function TT(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Oo(e,n.position)}function MT(e,n,r){const l=e.schema;let o=l;n.name==="svg"&&l.space==="html"&&(o=Up,e.schema=o),e.ancestors.push(n);const c=n.name===null?e.Fragment:Sw(e,n.name,!0),d=LT(e,n),f=Pp(e,n);return ww(e,d,c,n),Hp(d,f),e.ancestors.pop(),e.schema=l,e.create(n,c,d,r)}function ET(e,n,r){const l={};return Hp(l,Pp(e,n)),e.create(n,e.Fragment,l,r)}function AT(e,n){return n.value}function ww(e,n,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=l)}function Hp(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function RT(e,n,r){return l;function l(o,c,d,f){const h=Array.isArray(d.children)?r:n;return f?h(c,d,f):h(c,d)}}function IT(e,n){return r;function r(l,o,c,d){const f=Array.isArray(c.children),m=$p(l);return n(o,c,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function _T(e,n){const r={};let l,o;for(o in n.properties)if(o!=="children"&&Bp.call(n.properties,o)){const c=OT(e,o,n.properties[o]);if(c){const[d,f]=c;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&ST.has(n.tagName)?l=f:r[d]=f}}if(l){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function LT(e,n){const r={};for(const l of n.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const c=l.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 Oo(e,n.position);else{const o=l.name;let c;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const f=l.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else Oo(e,n.position);else c=l.value===null?!0:l.value;r[o]=c}return r}function Pp(e,n){const r=[];let l=-1;const o=e.passKeys?new Map:vT;for(;++l<n.children.length;){const c=n.children[l];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=kw(e,c,d);f!==void 0&&r.push(f)}return r}function OT(e,n,r){const l=oT(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=l.commaSeparated?Q3(r):fT(r)),l.property==="style"){let o=typeof r=="object"?r:DT(e,String(r));return e.stylePropertyNameCase==="css"&&(o=zT(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&l.space?sT[l.property]||l.property:l.attribute,r]}}function DT(e,n){try{return yT(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,o=new $n("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=vw+"#cannot-parse-style-attribute",o}}function Sw(e,n,r){let l;if(!r)l={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let c=-1,d;for(;++c<o.length;){const f=N1(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}l=d}else l=N1(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(l.type==="Literal"){const o=l.value;return Bp.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(l);Oo(e)}function Oo(e,n){const r=new $n("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=vw+"#cannot-handle-mdx-estrees-without-createevaluater",r}function zT(e){const n={};let r;for(r in e)Bp.call(e,r)&&(n[UT(r)]=e[r]);return n}function UT(e){let n=e.replace(kT,$T);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function $T(e){return"-"+e.toLowerCase()}const Vm={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"]},BT={};function Fp(e,n){const r=BT,l=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return jw(e,l,o)}function jw(e,n,r){if(HT(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 O1(e.children,n,r)}return Array.isArray(e)?O1(e,n,r):""}function O1(e,n,r){const l=[];let o=-1;for(;++o<e.length;)l[o]=jw(e[o],n,r);return l.join("")}function HT(e){return!!(e&&typeof e=="object")}const D1=document.createElement("i");function qp(e){const n="&"+e+";";D1.innerHTML=n;const r=D1.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function va(e,n,r,l){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,l.length<1e4)d=Array.from(l),d.unshift(n,r),e.splice(...d);else for(r&&e.splice(n,r);c<l.length;)d=l.slice(c,c+1e4),d.unshift(n,0),e.splice(...d),c+=1e4,n+=1e4}function Ha(e,n){return e.length>0?(va(e,e.length,0,n),e):n}const z1={}.hasOwnProperty;function Nw(e){const n={};let r=-1;for(;++r<e.length;)PT(n,e[r]);return n}function PT(e,n){let r;for(r in n){const o=(z1.call(e,r)?e[r]:void 0)||(e[r]={}),c=n[r];let d;if(c)for(d in c){z1.call(o,d)||(o[d]=[]);const f=c[d];FT(o[d],Array.isArray(f)?f:f?[f]:[])}}}function FT(e,n){let r=-1;const l=[];for(;++r<n.length;)(n[r].add==="after"?e:l).push(n[r]);va(e,0,0,l)}function Cw(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 Za(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fn=Ms(/[A-Za-z]/),Un=Ms(/[\dA-Za-z]/),qT=Ms(/[#-'*+\--9=?A-Z^-~]/);function Zu(e){return e!==null&&(e<32||e===127)}const Vh=Ms(/\d/),VT=Ms(/[\dA-Fa-f]/),GT=Ms(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function rt(e){return e===-2||e===-1||e===32}const vd=Ms(new RegExp("\\p{P}|\\p{S}","u")),cl=Ms(/\s/);function Ms(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ii(e){const n=[];let r=-1,l=0,o=0;for(;++r<e.length;){const c=e.charCodeAt(r);let d="";if(c===37&&Un(e.charCodeAt(r+1))&&Un(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(l,r),encodeURIComponent(d)),l=r+o+1,d=""),o&&(r+=o,o=0)}return n.join("")+e.slice(l)}function gt(e,n,r,l){const o=l?l-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return rt(m)?(e.enter(r),f(m)):n(m)}function f(m){return rt(m)&&c++<o?(e.consume(m),f):(e.exit(r),n(m))}}const WT={tokenize:KT};function KT(e){const n=e.attempt(this.parser.constructs.contentInitial,l,o);let r;return n;function l(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),gt(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 Ue(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),d)}}const YT={tokenize:QT},U1={tokenize:XT};function QT(e){const n=this,r=[];let l=0,o,c,d;return f;function f(O){if(l<r.length){const P=r[l];return n.containerState=P[1],e.attempt(P[0].continuation,m,h)(O)}return h(O)}function m(O){if(l++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&L();const P=n.events.length;let H=P,I;for(;H--;)if(n.events[H][0]==="exit"&&n.events[H][1].type==="chunkFlow"){I=n.events[H][1].end;break}M(l);let F=P;for(;F<n.events.length;)n.events[F][1].end={...I},F++;return va(n.events,H+1,0,n.events.slice(P)),n.events.length=F,h(O)}return f(O)}function h(O){if(l===r.length){if(!o)return k(O);if(o.currentConstruct&&o.currentConstruct.concrete)return S(O);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(U1,g,y)(O)}function g(O){return o&&L(),M(l),k(O)}function y(O){return n.parser.lazy[n.now().line]=l!==r.length,d=n.now().offset,S(O)}function k(O){return n.containerState={},e.attempt(U1,w,S)(O)}function w(O){return l++,r.push([n.currentConstruct,n.containerState]),k(O)}function S(O){if(O===null){o&&L(),M(0),e.consume(O);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),T(O)}function T(O){if(O===null){E(e.exit("chunkFlow"),!0),M(0),e.consume(O);return}return Ue(O)?(e.consume(O),E(e.exit("chunkFlow")),l=0,n.interrupt=void 0,f):(e.consume(O),T)}function E(O,P){const H=n.sliceStream(O);if(P&&H.push(null),O.previous=c,c&&(c.next=O),c=O,o.defineSkip(O.start),o.write(H),n.parser.lazy[O.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 F=n.events.length;let K=F,Z,z;for(;K--;)if(n.events[K][0]==="exit"&&n.events[K][1].type==="chunkFlow"){if(Z){z=n.events[K][1].end;break}Z=!0}for(M(l),I=F;I<n.events.length;)n.events[I][1].end={...z},I++;va(n.events,K+1,0,n.events.slice(F)),n.events.length=I}}function M(O){let P=r.length;for(;P-- >O;){const H=r[P];n.containerState=H[1],H[0].exit.call(n,e)}r.length=O}function L(){o.write([null]),c=void 0,o=void 0,n.containerState._closeFlow=void 0}}function XT(e,n,r){return gt(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ei(e){if(e===null||Dt(e)||cl(e))return 1;if(vd(e))return 2}function kd(e,n,r){const l=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!l.includes(c)&&(n=c(n,r),l.push(c))}return n}const Gh={name:"attention",resolveAll:ZT,tokenize:JT};function ZT(e,n){let r=-1,l,o,c,d,f,m,h,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(l=r;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&n.sliceSerialize(e[l][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[l][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[l][1].end.offset-e[l][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[l][1].end},k={...e[r][1].start};$1(y,-m),$1(k,m),d={type:m>1?"strongSequence":"emphasisSequence",start:y,end:{...e[l][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:k},c={type:m>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[l][1].end={...d.start},e[r][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=Ha(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=Ha(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",c,n]]),h=Ha(h,kd(n.parser.constructs.insideSpan.null,e.slice(l+1,r),n)),h=Ha(h,[["exit",c,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,h=Ha(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):g=0,va(e,l-1,r-l+3,h),r=l+h.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function JT(e,n){const r=this.parser.constructs.attentionMarkers.null,l=this.previous,o=ei(l);let c;return d;function d(m){return c=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===c)return e.consume(m),f;const h=e.exit("attentionSequence"),g=ei(m),y=!g||g===2&&o||r.includes(m),k=!o||o===2&&g||r.includes(l);return h._open=!!(c===42?y:y&&(o||!k)),h._close=!!(c===42?k:k&&(g||!y)),n(m)}}function $1(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const eM={name:"autolink",tokenize:tM};function tM(e,n,r){let l=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(w){return Fn(w)?(e.consume(w),d):w===64?r(w):h(w)}function d(w){return w===43||w===45||w===46||Un(w)?(l=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),l=0,m):(w===43||w===45||w===46||Un(w))&&l++<32?(e.consume(w),f):(l=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||Zu(w)?r(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),g):qT(w)?(e.consume(w),h):r(w)}function g(w){return Un(w)?y(w):r(w)}function y(w){return w===46?(e.consume(w),l=0,g):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):k(w)}function k(w){if((w===45||Un(w))&&l++<63){const S=w===45?k:y;return e.consume(w),S}return r(w)}}const Yo={partial:!0,tokenize:nM};function nM(e,n,r){return l;function l(c){return rt(c)?gt(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||Ue(c)?n(c):r(c)}}const Tw={continuation:{tokenize:rM},exit:sM,name:"blockQuote",tokenize:aM};function aM(e,n,r){const l=this;return o;function o(d){if(d===62){const f=l.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),c}return r(d)}function c(d){return rt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function rM(e,n,r){const l=this;return o;function o(d){return rt(d)?gt(e,c,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(Tw,n,r)(d)}}function sM(e){e.exit("blockQuote")}const Mw={name:"characterEscape",tokenize:lM};function lM(e,n,r){return l;function l(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return GT(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(c)}}const Ew={name:"characterReference",tokenize:iM};function iM(e,n,r){const l=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=Un,g(y))}function h(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,d=VT,g):(e.enter("characterReferenceValue"),c=7,d=Vh,g(y))}function g(y){if(y===59&&o){const k=e.exit("characterReferenceValue");return d===Un&&!qp(l.sliceSerialize(k))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(y)&&o++<c?(e.consume(y),g):r(y)}}const B1={partial:!0,tokenize:cM},H1={concrete:!0,name:"codeFenced",tokenize:oM};function oM(e,n,r){const l=this,o={partial:!0,tokenize:H};let c=0,d=0,f;return m;function m(I){return h(I)}function h(I){const F=l.events[l.events.length-1];return c=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,f=I,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(I)}function g(I){return I===f?(d++,e.consume(I),g):d<3?r(I):(e.exit("codeFencedFenceSequence"),rt(I)?gt(e,y,"whitespace")(I):y(I))}function y(I){return I===null||Ue(I)?(e.exit("codeFencedFence"),l.interrupt?n(I):e.check(B1,T,P)(I)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),k(I))}function k(I){return I===null||Ue(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(I)):rt(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),gt(e,w,"whitespace")(I)):I===96&&I===f?r(I):(e.consume(I),k)}function w(I){return I===null||Ue(I)?y(I):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(I))}function S(I){return I===null||Ue(I)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(I)):I===96&&I===f?r(I):(e.consume(I),S)}function T(I){return e.attempt(o,P,E)(I)}function E(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),M}function M(I){return c>0&&rt(I)?gt(e,L,"linePrefix",c+1)(I):L(I)}function L(I){return I===null||Ue(I)?e.check(B1,T,P)(I):(e.enter("codeFlowValue"),O(I))}function O(I){return I===null||Ue(I)?(e.exit("codeFlowValue"),L(I)):(e.consume(I),O)}function P(I){return e.exit("codeFenced"),n(I)}function H(I,F,K){let Z=0;return z;function z(U){return I.enter("lineEnding"),I.consume(U),I.exit("lineEnding"),B}function B(U){return I.enter("codeFencedFence"),rt(U)?gt(I,A,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):A(U)}function A(U){return U===f?(I.enter("codeFencedFenceSequence"),$(U)):K(U)}function $(U){return U===f?(Z++,I.consume(U),$):Z>=d?(I.exit("codeFencedFenceSequence"),rt(U)?gt(I,q,"whitespace")(U):q(U)):K(U)}function q(U){return U===null||Ue(U)?(I.exit("codeFencedFence"),F(U)):K(U)}}}function cM(e,n,r){const l=this;return o;function o(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return l.parser.lazy[l.now().line]?r(d):n(d)}}const Gm={name:"codeIndented",tokenize:dM},uM={partial:!0,tokenize:fM};function dM(e,n,r){const l=this;return o;function o(h){return e.enter("codeIndented"),gt(e,c,"linePrefix",5)(h)}function c(h){const g=l.events[l.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(h):r(h)}function d(h){return h===null?m(h):Ue(h)?e.attempt(uM,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Ue(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),n(h)}}function fM(e,n,r){const l=this;return o;function o(d){return l.parser.lazy[l.now().line]?r(d):Ue(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):gt(e,c,"linePrefix",5)(d)}function c(d){const f=l.events[l.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):Ue(d)?o(d):r(d)}}const mM={name:"codeText",previous:pM,resolve:hM,tokenize:gM};function hM(e){let n=e.length-4,r=3,l,o;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=r;++l<n;)if(e[l][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(l=r-1,n++;++l<=n;)o===void 0?l!==n&&e[l][1].type!=="lineEnding"&&(o=l):(l===n||e[l][1].type==="lineEnding")&&(e[o][1].type="codeTextData",l!==o+2&&(e[o][1].end=e[l-1][1].end,e.splice(o+2,l-o-2),n-=l-o-2,l=o+2),o=void 0);return e}function pM(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gM(e,n,r){let l=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),l++,f):(e.exit("codeTextSequence"),m(y))}function m(y){return y===null?r(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),m):y===96?(c=e.enter("codeTextSequence"),o=0,g(y)):Ue(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||Ue(y)?(e.exit("codeTextData"),m(y)):(e.consume(y),h)}function g(y){return y===96?(e.consume(y),o++,g):o===l?(e.exit("codeTextSequence"),e.exit("codeText"),n(y)):(c.type="codeTextData",h(y))}}class xM{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const l=r??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(n,l):n>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(n,r,l){const o=r||0;this.setCursor(Math.trunc(n));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&so(this.left,l),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),so(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),so(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);so(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);so(this.left,r.reverse())}}}function so(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 Aw(e){const n={};let r=-1,l,o,c,d,f,m,h;const g=new xM(e);for(;++r<g.length;){for(;r in n;)r=n[r];if(l=g.get(r),r&&l[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(m=l[1]._tokenizer.events,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(l[0]==="enter")l[1].contentType&&(Object.assign(n,yM(g,r)),r=n[r],h=!0);else if(l[1]._container){for(c=r,o=void 0;c--;)if(d=g.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(l[1].end={...g.get(o)[1].start},f=g.slice(o,r),f.unshift(l),g.splice(o,r-o+1,f))}}return va(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function yM(e,n){const r=e.get(n)[1],l=e.get(n)[2];let o=n-1;const c=[];let d=r._tokenizer;d||(d=l.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let g,y,k=-1,w=r,S=0,T=0;const E=[T];for(;w;){for(;e.get(++o)[1]!==w;);c.push(o),w._tokenizer||(g=l.sliceStream(w),w.next||g.push(null),y&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=w,w=w.next}for(w=r;++k<f.length;)f[k][0]==="exit"&&f[k-1][0]==="enter"&&f[k][1].type===f[k-1][1].type&&f[k][1].start.line!==f[k][1].end.line&&(T=k+1,E.push(T),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(d.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),k=E.length;k--;){const M=f.slice(E[k],E[k+1]),L=c.pop();m.push([L,L+M.length-1]),e.splice(L,2,M)}for(m.reverse(),k=-1;++k<m.length;)h[S+m[k][0]]=S+m[k][1],S+=m[k][1]-m[k][0]-1;return h}const bM={resolve:kM,tokenize:wM},vM={partial:!0,tokenize:SM};function kM(e){return Aw(e),e}function wM(e,n){let r;return l;function l(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?c(f):Ue(f)?e.check(vM,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 SM(e,n,r){const l=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),gt(e,c,"linePrefix")}function c(d){if(d===null||Ue(d))return r(d);const f=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):e.interrupt(l.parser.constructs.flow,r,n)(d)}}function Rw(e,n,r,l,o,c,d,f,m){const h=m||Number.POSITIVE_INFINITY;let g=0;return y;function y(M){return M===60?(e.enter(l),e.enter(o),e.enter(c),e.consume(M),e.exit(c),k):M===null||M===32||M===41||Zu(M)?r(M):(e.enter(l),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),T(M))}function k(M){return M===62?(e.enter(c),e.consume(M),e.exit(c),e.exit(o),e.exit(l),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(M))}function w(M){return M===62?(e.exit("chunkString"),e.exit(f),k(M)):M===null||M===60||Ue(M)?r(M):(e.consume(M),M===92?S:w)}function S(M){return M===60||M===62||M===92?(e.consume(M),w):w(M)}function T(M){return!g&&(M===null||M===41||Dt(M))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(l),n(M)):g<h&&M===40?(e.consume(M),g++,T):M===41?(e.consume(M),g--,T):M===null||M===32||M===40||Zu(M)?r(M):(e.consume(M),M===92?E:T)}function E(M){return M===40||M===41||M===92?(e.consume(M),T):T(M)}}function Iw(e,n,r,l,o,c){const d=this;let f=0,m;return h;function h(w){return e.enter(l),e.enter(o),e.consume(w),e.exit(o),e.enter(c),g}function g(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?r(w):w===93?(e.exit(c),e.enter(o),e.consume(w),e.exit(o),e.exit(l),n):Ue(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Ue(w)||f++>999?(e.exit("chunkString"),g(w)):(e.consume(w),m||(m=!rt(w)),w===92?k:y)}function k(w){return w===91||w===92||w===93?(e.consume(w),f++,y):y(w)}}function _w(e,n,r,l,o,c){let d;return f;function f(k){return k===34||k===39||k===40?(e.enter(l),e.enter(o),e.consume(k),e.exit(o),d=k===40?41:k,m):r(k)}function m(k){return k===d?(e.enter(o),e.consume(k),e.exit(o),e.exit(l),n):(e.enter(c),h(k))}function h(k){return k===d?(e.exit(c),m(d)):k===null?r(k):Ue(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),gt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===d||k===null||Ue(k)?(e.exit("chunkString"),h(k)):(e.consume(k),k===92?y:g)}function y(k){return k===d||k===92?(e.consume(k),g):g(k)}}function So(e,n){let r;return l;function l(o){return Ue(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,l):rt(o)?gt(e,l,r?"linePrefix":"lineSuffix")(o):n(o)}}const jM={name:"definition",tokenize:CM},NM={partial:!0,tokenize:TM};function CM(e,n,r){const l=this;let o;return c;function c(w){return e.enter("definition"),d(w)}function d(w){return Iw.call(l,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return o=Za(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return Dt(w)?So(e,h)(w):h(w)}function h(w){return Rw(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(NM,y,y)(w)}function y(w){return rt(w)?gt(e,k,"whitespace")(w):k(w)}function k(w){return w===null||Ue(w)?(e.exit("definition"),l.parser.defined.push(o),n(w)):r(w)}}function TM(e,n,r){return l;function l(f){return Dt(f)?So(e,o)(f):r(f)}function o(f){return _w(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return rt(f)?gt(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Ue(f)?n(f):r(f)}}const MM={name:"hardBreakEscape",tokenize:EM};function EM(e,n,r){return l;function l(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return Ue(c)?(e.exit("hardBreakEscape"),n(c)):r(c)}}const AM={name:"headingAtx",resolve:RM,tokenize:IM};function RM(e,n){let r=e.length-2,l=3,o,c;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(o={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},c={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},va(e,l,r-l+1,[["enter",o,n],["enter",c,n],["exit",c,n],["exit",o,n]])),e}function IM(e,n,r){let l=0;return o;function o(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&l++<6?(e.consume(g),d):g===null||Dt(g)?(e.exit("atxHeadingSequence"),f(g)):r(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),m(g)):g===null||Ue(g)?(e.exit("atxHeading"),n(g)):rt(g)?gt(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function m(g){return g===35?(e.consume(g),m):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||Dt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const _M=["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"],P1=["pre","script","style","textarea"],LM={concrete:!0,name:"htmlFlow",resolveTo:zM,tokenize:UM},OM={partial:!0,tokenize:BM},DM={partial:!0,tokenize:$M};function zM(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 UM(e,n,r){const l=this;let o,c,d,f,m;return h;function h(C){return g(C)}function g(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),y}function y(C){return C===33?(e.consume(C),k):C===47?(e.consume(C),c=!0,T):C===63?(e.consume(C),o=3,l.interrupt?n:N):Fn(C)?(e.consume(C),d=String.fromCharCode(C),E):r(C)}function k(C){return C===45?(e.consume(C),o=2,w):C===91?(e.consume(C),o=5,f=0,S):Fn(C)?(e.consume(C),o=4,l.interrupt?n:N):r(C)}function w(C){return C===45?(e.consume(C),l.interrupt?n:N):r(C)}function S(C){const Q="CDATA[";return C===Q.charCodeAt(f++)?(e.consume(C),f===Q.length?l.interrupt?n:A:S):r(C)}function T(C){return Fn(C)?(e.consume(C),d=String.fromCharCode(C),E):r(C)}function E(C){if(C===null||C===47||C===62||Dt(C)){const Q=C===47,ee=d.toLowerCase();return!Q&&!c&&P1.includes(ee)?(o=1,l.interrupt?n(C):A(C)):_M.includes(d.toLowerCase())?(o=6,Q?(e.consume(C),M):l.interrupt?n(C):A(C)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(C):c?L(C):O(C))}return C===45||Un(C)?(e.consume(C),d+=String.fromCharCode(C),E):r(C)}function M(C){return C===62?(e.consume(C),l.interrupt?n:A):r(C)}function L(C){return rt(C)?(e.consume(C),L):z(C)}function O(C){return C===47?(e.consume(C),z):C===58||C===95||Fn(C)?(e.consume(C),P):rt(C)?(e.consume(C),O):z(C)}function P(C){return C===45||C===46||C===58||C===95||Un(C)?(e.consume(C),P):H(C)}function H(C){return C===61?(e.consume(C),I):rt(C)?(e.consume(C),H):O(C)}function I(C){return C===null||C===60||C===61||C===62||C===96?r(C):C===34||C===39?(e.consume(C),m=C,F):rt(C)?(e.consume(C),I):K(C)}function F(C){return C===m?(e.consume(C),m=null,Z):C===null||Ue(C)?r(C):(e.consume(C),F)}function K(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Dt(C)?H(C):(e.consume(C),K)}function Z(C){return C===47||C===62||rt(C)?O(C):r(C)}function z(C){return C===62?(e.consume(C),B):r(C)}function B(C){return C===null||Ue(C)?A(C):rt(C)?(e.consume(C),B):r(C)}function A(C){return C===45&&o===2?(e.consume(C),V):C===60&&o===1?(e.consume(C),W):C===62&&o===4?(e.consume(C),_):C===63&&o===3?(e.consume(C),N):C===93&&o===5?(e.consume(C),te):Ue(C)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(OM,R,$)(C)):C===null||Ue(C)?(e.exit("htmlFlowData"),$(C)):(e.consume(C),A)}function $(C){return e.check(DM,q,R)(C)}function q(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),U}function U(C){return C===null||Ue(C)?$(C):(e.enter("htmlFlowData"),A(C))}function V(C){return C===45?(e.consume(C),N):A(C)}function W(C){return C===47?(e.consume(C),d="",ce):A(C)}function ce(C){if(C===62){const Q=d.toLowerCase();return P1.includes(Q)?(e.consume(C),_):A(C)}return Fn(C)&&d.length<8?(e.consume(C),d+=String.fromCharCode(C),ce):A(C)}function te(C){return C===93?(e.consume(C),N):A(C)}function N(C){return C===62?(e.consume(C),_):C===45&&o===2?(e.consume(C),N):A(C)}function _(C){return C===null||Ue(C)?(e.exit("htmlFlowData"),R(C)):(e.consume(C),_)}function R(C){return e.exit("htmlFlow"),n(C)}}function $M(e,n,r){const l=this;return o;function o(d){return Ue(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):r(d)}function c(d){return l.parser.lazy[l.now().line]?r(d):n(d)}}function BM(e,n,r){return l;function l(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Yo,n,r)}}const HM={name:"htmlText",tokenize:PM};function PM(e,n,r){const l=this;let o,c,d;return f;function f(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),m}function m(N){return N===33?(e.consume(N),h):N===47?(e.consume(N),H):N===63?(e.consume(N),O):Fn(N)?(e.consume(N),K):r(N)}function h(N){return N===45?(e.consume(N),g):N===91?(e.consume(N),c=0,S):Fn(N)?(e.consume(N),L):r(N)}function g(N){return N===45?(e.consume(N),w):r(N)}function y(N){return N===null?r(N):N===45?(e.consume(N),k):Ue(N)?(d=y,W(N)):(e.consume(N),y)}function k(N){return N===45?(e.consume(N),w):y(N)}function w(N){return N===62?V(N):N===45?k(N):y(N)}function S(N){const _="CDATA[";return N===_.charCodeAt(c++)?(e.consume(N),c===_.length?T:S):r(N)}function T(N){return N===null?r(N):N===93?(e.consume(N),E):Ue(N)?(d=T,W(N)):(e.consume(N),T)}function E(N){return N===93?(e.consume(N),M):T(N)}function M(N){return N===62?V(N):N===93?(e.consume(N),M):T(N)}function L(N){return N===null||N===62?V(N):Ue(N)?(d=L,W(N)):(e.consume(N),L)}function O(N){return N===null?r(N):N===63?(e.consume(N),P):Ue(N)?(d=O,W(N)):(e.consume(N),O)}function P(N){return N===62?V(N):O(N)}function H(N){return Fn(N)?(e.consume(N),I):r(N)}function I(N){return N===45||Un(N)?(e.consume(N),I):F(N)}function F(N){return Ue(N)?(d=F,W(N)):rt(N)?(e.consume(N),F):V(N)}function K(N){return N===45||Un(N)?(e.consume(N),K):N===47||N===62||Dt(N)?Z(N):r(N)}function Z(N){return N===47?(e.consume(N),V):N===58||N===95||Fn(N)?(e.consume(N),z):Ue(N)?(d=Z,W(N)):rt(N)?(e.consume(N),Z):V(N)}function z(N){return N===45||N===46||N===58||N===95||Un(N)?(e.consume(N),z):B(N)}function B(N){return N===61?(e.consume(N),A):Ue(N)?(d=B,W(N)):rt(N)?(e.consume(N),B):Z(N)}function A(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),o=N,$):Ue(N)?(d=A,W(N)):rt(N)?(e.consume(N),A):(e.consume(N),q)}function $(N){return N===o?(e.consume(N),o=void 0,U):N===null?r(N):Ue(N)?(d=$,W(N)):(e.consume(N),$)}function q(N){return N===null||N===34||N===39||N===60||N===61||N===96?r(N):N===47||N===62||Dt(N)?Z(N):(e.consume(N),q)}function U(N){return N===47||N===62||Dt(N)?Z(N):r(N)}function V(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),n):r(N)}function W(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),ce}function ce(N){return rt(N)?gt(e,te,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):te(N)}function te(N){return e.enter("htmlTextData"),d(N)}}const Vp={name:"labelEnd",resolveAll:GM,resolveTo:WM,tokenize:KM},FM={tokenize:YM},qM={tokenize:QM},VM={tokenize:XM};function GM(e){let n=-1;const r=[];for(;++n<e.length;){const l=e[n][1];if(r.push(e[n]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const o=l.type==="labelImage"?4:2;l.type="data",n+=o}}return e.length!==r.length&&va(e,0,e.length,r),e}function WM(e,n){let r=e.length,l=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")){l=2;break}}else o.type==="labelEnd"&&(d=r);const m={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[c][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[c+l+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=Ha(f,e.slice(c+1,c+l+3)),f=Ha(f,[["enter",g,n]]),f=Ha(f,kd(n.parser.constructs.insideSpan.null,e.slice(c+l+4,d-3),n)),f=Ha(f,[["exit",g,n],e[d-2],e[d-1],["exit",h,n]]),f=Ha(f,e.slice(d+1)),f=Ha(f,[["exit",m,n]]),va(e,c,e.length,f),e}function KM(e,n,r){const l=this;let o=l.events.length,c,d;for(;o--;)if((l.events[o][1].type==="labelImage"||l.events[o][1].type==="labelLink")&&!l.events[o][1]._balanced){c=l.events[o][1];break}return f;function f(k){return c?c._inactive?y(k):(d=l.parser.defined.includes(Za(l.sliceSerialize({start:c.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(k),e.exit("labelMarker"),e.exit("labelEnd"),m):r(k)}function m(k){return k===40?e.attempt(FM,g,d?g:y)(k):k===91?e.attempt(qM,g,d?h:y)(k):d?g(k):y(k)}function h(k){return e.attempt(VM,g,y)(k)}function g(k){return n(k)}function y(k){return c._balanced=!0,r(k)}}function YM(e,n,r){return l;function l(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return Dt(y)?So(e,c)(y):c(y)}function c(y){return y===41?g(y):Rw(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Dt(y)?So(e,m)(y):g(y)}function f(y){return r(y)}function m(y){return y===34||y===39||y===40?_w(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function h(y){return Dt(y)?So(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),n):r(y)}}function QM(e,n,r){const l=this;return o;function o(f){return Iw.call(l,e,c,d,"reference","referenceMarker","referenceString")(f)}function c(f){return l.parser.defined.includes(Za(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function d(f){return r(f)}}function XM(e,n,r){return l;function l(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 ZM={name:"labelStartImage",resolveAll:Vp.resolveAll,tokenize:JM};function JM(e,n,r){const l=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 l.parser.constructs?r(f):n(f)}}const eE={name:"labelStartLink",resolveAll:Vp.resolveAll,tokenize:tE};function tE(e,n,r){const l=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),c}function c(d){return d===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(d):n(d)}}const Wm={name:"lineEnding",tokenize:nE};function nE(e,n){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),gt(e,n,"linePrefix")}}const Bu={name:"thematicBreak",tokenize:aE};function aE(e,n,r){let l=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)):l>=3&&(h===null||Ue(h))?(e.exit("thematicBreak"),n(h)):r(h)}function m(h){return h===o?(e.consume(h),l++,m):(e.exit("thematicBreakSequence"),rt(h)?gt(e,f,"whitespace")(h):f(h))}}const ea={continuation:{tokenize:iE},exit:cE,name:"list",tokenize:lE},rE={partial:!0,tokenize:uE},sE={partial:!0,tokenize:oE};function lE(e,n,r){const l=this,o=l.events[l.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 S=l.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!l.containerState.marker||w===l.containerState.marker:Vh(w)){if(l.containerState.type||(l.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Bu,r,h)(w):h(w);if(!l.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return Vh(w)&&++d<10?(e.consume(w),m):(!l.interrupt||d<2)&&(l.containerState.marker?w===l.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):r(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||w,e.check(Yo,l.interrupt?r:g,e.attempt(rE,k,y))}function g(w){return l.containerState.initialBlankLine=!0,c++,k(w)}function y(w){return rt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),k):r(w)}function k(w){return l.containerState.size=c+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function iE(e,n,r){const l=this;return l.containerState._closeFlow=void 0,e.check(Yo,o,c);function o(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,gt(e,n,"listItemIndent",l.containerState.size+1)(f)}function c(f){return l.containerState.furtherBlankLines||!rt(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,d(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(sE,n,d)(f))}function d(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,gt(e,e.attempt(ea,n,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function oE(e,n,r){const l=this;return gt(e,o,"listItemIndent",l.containerState.size+1);function o(c){const d=l.events[l.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===l.containerState.size?n(c):r(c)}}function cE(e){e.exit(this.containerState.type)}function uE(e,n,r){const l=this;return gt(e,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=l.events[l.events.length-1];return!rt(c)&&d&&d[1].type==="listItemPrefixWhitespace"?n(c):r(c)}}const F1={name:"setextUnderline",resolveTo:dE,tokenize:fE};function dE(e,n){let r=e.length,l,o,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const d={type:"setextHeading",start:{...e[l][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[l][1],n]),e[l][1].end={...e[c][1].end}):e[l][1]=d,e.push(["exit",d,n]),e}function fE(e,n,r){const l=this;let o;return c;function c(h){let g=l.events.length,y;for(;g--;)if(l.events[g][1].type!=="lineEnding"&&l.events[g][1].type!=="linePrefix"&&l.events[g][1].type!=="content"){y=l.events[g][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.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"),rt(h)?gt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Ue(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const mE={tokenize:hE};function hE(e){const n=this,r=e.attempt(Yo,l,e.attempt(this.parser.constructs.flowInitial,o,gt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(bM,o)),"linePrefix")));return r;function l(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 pE={resolveAll:Ow()},gE=Lw("string"),xE=Lw("text");function Lw(e){return{resolveAll:Ow(e==="text"?yE:void 0),tokenize:n};function n(r){const l=this,o=this.parser.constructs[e],c=r.attempt(o,d,f);return d;function d(g){return h(g)?c(g):f(g)}function f(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),m}function m(g){return h(g)?(r.exit("data"),c(g)):(r.consume(g),m)}function h(g){if(g===null)return!0;const y=o[g];let k=-1;if(y)for(;++k<y.length;){const w=y[k];if(!w.previous||w.previous.call(l,l.previous))return!0}return!1}}}function Ow(e){return n;function n(r,l){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,l):r}}function yE(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const l=e[r-1][1],o=n.sliceStream(l);let 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:l.start._bufferIndex+d,_index:l.start._index+c,line:l.end.line,column:l.end.column-f,offset:l.end.offset-f},end:{...l.end}};l.end={...h.start},l.start.offset===l.end.offset?Object.assign(l,h):(e.splice(r,0,["enter",h,n],["exit",h,n]),r+=2)}r++}return e}const bE={42:ea,43:ea,45:ea,48:ea,49:ea,50:ea,51:ea,52:ea,53:ea,54:ea,55:ea,56:ea,57:ea,62:Tw},vE={91:jM},kE={[-2]:Gm,[-1]:Gm,32:Gm},wE={35:AM,42:Bu,45:[F1,Bu],60:LM,61:F1,95:Bu,96:H1,126:H1},SE={38:Ew,92:Mw},jE={[-5]:Wm,[-4]:Wm,[-3]:Wm,33:ZM,38:Ew,42:Gh,60:[eM,HM],91:eE,92:[MM,Mw],93:Vp,95:Gh,96:mM},NE={null:[Gh,pE]},CE={null:[42,95]},TE={null:[]},ME=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:CE,contentInitial:vE,disable:TE,document:bE,flow:wE,flowInitial:kE,insideSpan:NE,string:SE,text:jE},Symbol.toStringTag,{value:"Module"}));function EE(e,n,r){let l={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const o={},c=[];let d=[],f=[];const m={attempt:F(H),check:F(I),consume:L,enter:O,exit:P,interrupt:F(I,{interrupt:!0})},h={code:null,containerState:{},defineSkip:T,events:[],now:S,parser:e,previous:null,sliceSerialize:k,sliceStream:w,write:y};let g=n.tokenize.call(h,m);return n.resolveAll&&c.push(n),h;function y(B){return d=Ha(d,B),E(),d[d.length-1]!==null?[]:(K(n,0),h.events=kd(c,h.events,h),h.events)}function k(B,A){return RE(w(B),A)}function w(B){return AE(d,B)}function S(){const{_bufferIndex:B,_index:A,line:$,column:q,offset:U}=l;return{_bufferIndex:B,_index:A,line:$,column:q,offset:U}}function T(B){o[B.line]=B.column,z()}function E(){let B;for(;l._index<d.length;){const A=d[l._index];if(typeof A=="string")for(B=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===B&&l._bufferIndex<A.length;)M(A.charCodeAt(l._bufferIndex));else M(A)}}function M(B){g=g(B)}function L(B){Ue(B)?(l.line++,l.column=1,l.offset+=B===-3?2:1,z()):B!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===d[l._index].length&&(l._bufferIndex=-1,l._index++)),h.previous=B}function O(B,A){const $=A||{};return $.type=B,$.start=S(),h.events.push(["enter",$,h]),f.push($),$}function P(B){const A=f.pop();return A.end=S(),h.events.push(["exit",A,h]),A}function H(B,A){K(B,A.from)}function I(B,A){A.restore()}function F(B,A){return $;function $(q,U,V){let W,ce,te,N;return Array.isArray(q)?R(q):"tokenize"in q?R([q]):_(q);function _(ae){return he;function he(xe){const ie=xe!==null&&ae[xe],ye=xe!==null&&ae.null,ve=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return R(ve)(xe)}}function R(ae){return W=ae,ce=0,ae.length===0?V:C(ae[ce])}function C(ae){return he;function he(xe){return N=Z(),te=ae,ae.partial||(h.currentConstruct=ae),ae.name&&h.parser.constructs.disable.null.includes(ae.name)?ee():ae.tokenize.call(A?Object.assign(Object.create(h),A):h,m,Q,ee)(xe)}}function Q(ae){return B(te,N),U}function ee(ae){return N.restore(),++ce<W.length?C(W[ce]):V}}}function K(B,A){B.resolveAll&&!c.includes(B)&&c.push(B),B.resolve&&va(h.events,A,h.events.length-A,B.resolve(h.events.slice(A),h)),B.resolveTo&&(h.events=B.resolveTo(h.events,h))}function Z(){const B=S(),A=h.previous,$=h.currentConstruct,q=h.events.length,U=Array.from(f);return{from:q,restore:V};function V(){l=B,h.previous=A,h.currentConstruct=$,h.events.length=q,f=U,z()}}function z(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function AE(e,n){const r=n.start._index,l=n.start._bufferIndex,o=n.end._index,c=n.end._bufferIndex;let d;if(r===o)d=[e[r].slice(l,c)];else{if(d=e.slice(r,o),l>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(l):d.shift()}c>0&&d.push(e[o].slice(0,c))}return d}function RE(e,n){let r=-1;const l=[];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=`
|
|
138
|
-
`;break}case-3:{d=`\r
|
|
139
|
-
`;break}case-2:{d=n?" ":" ";break}case-1:{if(!n&&o)continue;d=" ";break}default:d=String.fromCharCode(c)}o=c===-2,l.push(d)}return l.join("")}function IE(e){const l={constructs:Nw([ME,...(e||{}).extensions||[]]),content:o(WT),defined:[],document:o(YT),flow:o(mE),lazy:{},string:o(gE),text:o(xE)};return l;function o(c){return d;function d(f){return EE(l,c,f)}}}function _E(e){for(;!Aw(e););return e}const q1=/[\0\t\n\r]/g;function LE(){let e=1,n="",r=!0,l;return o;function o(c,d,f){const m=[];let h,g,y,k,w;for(c=n+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c)),y=0,n="",r&&(c.charCodeAt(0)===65279&&y++,r=void 0);y<c.length;){if(q1.lastIndex=y,h=q1.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&&l)m.push(-3),l=void 0;else switch(l&&(m.push(-5),l=void 0),y<k&&(m.push(c.slice(y,k)),e+=k-y),w){case 0:{m.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,m.push(-2);e++<g;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:l=!0,e=1}y=k+1}return f&&(l&&m.push(-5),n&&m.push(n),m.push(null)),m}}const OE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function DE(e){return e.replace(OE,zE)}function zE(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),c=o===120||o===88;return Cw(r.slice(c?2:1),c?16:10)}return qp(r)||e}const Dw={}.hasOwnProperty;function UE(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),$E(r)(_E(IE(r).document().write(LE()(e,n,!0))))}function $E(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(tn),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:c(Qe),blockQuote:c(ye),characterEscape:Z,characterReference:Z,codeFenced:c(ve),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(ve,d),codeText:c(Ke,d),codeTextData:Z,data:Z,codeFlowValue:Z,definition:c(He),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c(Ge),hardBreakEscape:c(ut),hardBreakTrailing:c(ut),htmlFlow:c(Yt,d),htmlFlowData:Z,htmlText:c(Yt,d),htmlTextData:Z,image:c(en),label:d,link:c(tn),listItem:c(Pt),listItemValue:k,listOrdered:c(wn,y),listUnordered:c(wn),paragraph:c(xn),reference:C,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(Qe),strong:c(yn),thematicBreak:c(Wt)},exit:{atxHeading:m(),atxHeadingSequence:H,autolink:m(),autolinkEmail:ie,autolinkProtocol:xe,blockQuote:m(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:ae,characterReference:he,codeFenced:m(E),codeFencedFence:T,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:z,codeIndented:m(M),codeText:m(U),codeTextData:z,data:z,definition:m(),definitionDestinationString:P,definitionLabelString:L,definitionTitleString:O,emphasis:m(),hardBreakEscape:m(A),hardBreakTrailing:m(A),htmlFlow:m($),htmlFlowData:z,htmlText:m(q),htmlTextData:z,image:m(W),label:te,labelText:ce,lineEnding:B,link:m(V),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Q,resourceDestinationString:N,resourceTitleString:_,resource:R,setextHeading:m(K),setextHeadingLineSequence:F,setextHeadingText:I,strong:m(),thematicBreak:m()}};zw(n,(e||{}).mdastExtensions||[]);const r={};return l;function l(X){let me={type:"root",children:[]};const Ne={stack:[me],tokenStack:[],config:n,enter:f,exit:h,buffer:d,resume:g,data:r},Ae=[];let Oe=-1;for(;++Oe<X.length;)if(X[Oe][1].type==="listOrdered"||X[Oe][1].type==="listUnordered")if(X[Oe][0]==="enter")Ae.push(Oe);else{const re=Ae.pop();Oe=o(X,re,Oe)}for(Oe=-1;++Oe<X.length;){const re=n[X[Oe][0]];Dw.call(re,X[Oe][1].type)&&re[X[Oe][1].type].call(Object.assign({sliceSerialize:X[Oe][2].sliceSerialize},Ne),X[Oe][1])}if(Ne.tokenStack.length>0){const re=Ne.tokenStack[Ne.tokenStack.length-1];(re[1]||V1).call(Ne,void 0,re[0])}for(me.position={start:bs(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:bs(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe<n.transforms.length;)me=n.transforms[Oe](me)||me;return me}function o(X,me,Ne){let Ae=me-1,Oe=-1,re=!1,ke,Me,Te,$e;for(;++Ae<=Ne;){const Ve=X[Ae];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?Oe++:Oe--,$e=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(ke&&!$e&&!Oe&&!Te&&(Te=Ae),$e=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$e=void 0}if(!Oe&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||Oe===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(ke){let Xe=Ae;for(Me=void 0;Xe--;){const et=X[Xe];if(et[1].type==="lineEnding"||et[1].type==="lineEndingBlank"){if(et[0]==="exit")continue;Me&&(X[Me][1].type="lineEndingBlank",re=!0),et[1].type="lineEnding",Me=Xe}else if(!(et[1].type==="linePrefix"||et[1].type==="blockQuotePrefix"||et[1].type==="blockQuotePrefixWhitespace"||et[1].type==="blockQuoteMarker"||et[1].type==="listItemIndent"))break}Te&&(!Me||Te<Me)&&(ke._spread=!0),ke.end=Object.assign({},Me?X[Me][1].start:Ve[1].end),X.splice(Me||Ae,0,["exit",ke,Ve[2]]),Ae++,Ne++}if(Ve[1].type==="listItemPrefix"){const Xe={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};ke=Xe,X.splice(Ae,0,["enter",Xe,Ve[2]]),Ae++,Ne++,Te=void 0,$e=!0}}}return X[me][1]._spread=re,Ne}function c(X,me){return Ne;function Ne(Ae){f.call(this,X(Ae),Ae),me&&me.call(this,Ae)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(X,me,Ne){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([me,Ne||void 0]),X.position={start:bs(me.start),end:void 0}}function m(X){return me;function me(Ne){X&&X.call(this,Ne),h.call(this,Ne)}}function h(X,me){const Ne=this.stack.pop(),Ae=this.tokenStack.pop();if(Ae)Ae[0].type!==X.type&&(me?me.call(this,X,Ae[0]):(Ae[1]||V1).call(this,X,Ae[0]));else throw new Error("Cannot close `"+X.type+"` ("+wo({start:X.start,end:X.end})+"): it’s not open");Ne.position.end=bs(X.end)}function g(){return Fp(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function k(X){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function w(){const X=this.resume(),me=this.stack[this.stack.length-1];me.lang=X}function S(){const X=this.resume(),me=this.stack[this.stack.length-1];me.meta=X}function T(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const X=this.resume(),me=this.stack[this.stack.length-1];me.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const X=this.resume(),me=this.stack[this.stack.length-1];me.value=X.replace(/(\r?\n|\r)$/g,"")}function L(X){const me=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=me,Ne.identifier=Za(this.sliceSerialize(X)).toLowerCase()}function O(){const X=this.resume(),me=this.stack[this.stack.length-1];me.title=X}function P(){const X=this.resume(),me=this.stack[this.stack.length-1];me.url=X}function H(X){const me=this.stack[this.stack.length-1];if(!me.depth){const Ne=this.sliceSerialize(X).length;me.depth=Ne}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function F(X){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(X){const Ne=this.stack[this.stack.length-1].children;let Ae=Ne[Ne.length-1];(!Ae||Ae.type!=="text")&&(Ae=st(),Ae.position={start:bs(X.start),end:void 0},Ne.push(Ae)),this.stack.push(Ae)}function z(X){const me=this.stack.pop();me.value+=this.sliceSerialize(X),me.position.end=bs(X.end)}function B(X){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=me.children[me.children.length-1];Ne.position.end=bs(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(me.type)&&(Z.call(this,X),z.call(this,X))}function A(){this.data.atHardBreak=!0}function $(){const X=this.resume(),me=this.stack[this.stack.length-1];me.value=X}function q(){const X=this.resume(),me=this.stack[this.stack.length-1];me.value=X}function U(){const X=this.resume(),me=this.stack[this.stack.length-1];me.value=X}function V(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=me,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function W(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=me,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function ce(X){const me=this.sliceSerialize(X),Ne=this.stack[this.stack.length-2];Ne.label=DE(me),Ne.identifier=Za(me).toLowerCase()}function te(){const X=this.stack[this.stack.length-1],me=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const Ae=X.children;Ne.children=Ae}else Ne.alt=me}function N(){const X=this.resume(),me=this.stack[this.stack.length-1];me.url=X}function _(){const X=this.resume(),me=this.stack[this.stack.length-1];me.title=X}function R(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function Q(X){const me=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=me,Ne.identifier=Za(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ee(X){this.data.characterReferenceType=X.type}function ae(X){const me=this.sliceSerialize(X),Ne=this.data.characterReferenceType;let Ae;Ne?(Ae=Cw(me,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=qp(me);const Oe=this.stack[this.stack.length-1];Oe.value+=Ae}function he(X){const me=this.stack.pop();me.position.end=bs(X.end)}function xe(X){z.call(this,X);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(X)}function ie(X){z.call(this,X);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(X)}function ye(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function He(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ge(){return{type:"emphasis",children:[]}}function Qe(){return{type:"heading",depth:0,children:[]}}function ut(){return{type:"break"}}function Yt(){return{type:"html",value:""}}function en(){return{type:"image",title:null,url:"",alt:null}}function tn(){return{type:"link",title:null,url:"",children:[]}}function wn(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function Pt(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function xn(){return{type:"paragraph",children:[]}}function yn(){return{type:"strong",children:[]}}function st(){return{type:"text",value:""}}function Wt(){return{type:"thematicBreak"}}}function bs(e){return{line:e.line,column:e.column,offset:e.offset}}function zw(e,n){let r=-1;for(;++r<n.length;){const l=n[r];Array.isArray(l)?zw(e,l):BE(e,l)}}function BE(e,n){let r;for(r in n)if(Dw.call(n,r))switch(r){case"canContainEols":{const l=n[r];l&&e[r].push(...l);break}case"transforms":{const l=n[r];l&&e[r].push(...l);break}case"enter":case"exit":{const l=n[r];l&&Object.assign(e[r],l);break}}}function V1(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+wo({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+wo({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+wo({start:n.start,end:n.end})+") is still open")}function HE(e){const n=this;n.parser=r;function r(l){return UE(l,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function PE(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 FE(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
140
|
-
`}]}function qE(e,n){const r=n.value?n.value+`
|
|
141
|
-
`:"",l={},o=n.lang?n.lang.split(/\s+/):[];o.length>0&&(l.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:l,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 VE(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function GE(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function WE(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),o=ii(l.toLowerCase()),c=e.footnoteOrder.indexOf(l);let d,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),d=e.footnoteOrder.length):d=c+1,f+=1,e.footnoteCounts.set(l,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(n,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,h),e.applyData(n,h)}function KE(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 YE(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function Uw(e,n){const r=n.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const o=e.all(n),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+=l:o.push({type:"text",value:l}),o}function QE(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Uw(e,n);const o={src:ii(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,c),e.applyData(n,c)}function XE(e,n){const r={src:ii(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,l),e.applyData(n,l)}function ZE(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,l),e.applyData(n,l)}function JE(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Uw(e,n);const o={href:ii(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const c={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,c),e.applyData(n,c)}function eA(e,n){const r={href:ii(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function tA(e,n,r){const l=e.all(n),o=r?nA(r):$w(n),c={},d=[];if(typeof n.checked=="boolean"){const g=l[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},l.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<l.length;){const g=l[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
|
|
142
|
-
`}),g.type==="element"&&g.tagName==="p"&&!o?d.push(...g.children):d.push(g)}const m=l[l.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
|
|
143
|
-
`});const h={type:"element",tagName:"li",properties:c,children:d};return e.patch(n,h),e.applyData(n,h)}function nA(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let l=-1;for(;!n&&++l<r.length;)n=$w(r[l])}return n}function $w(e){const n=e.spread;return n??e.children.length>1}function aA(e,n){const r={},l=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++o<l.length;){const d=l[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(l,!0)};return e.patch(n,c),e.applyData(n,c)}function rA(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function sA(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function lA(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function iA(e,n){const r=e.all(n),l=r.shift(),o=[];if(l){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([l],!0)};e.patch(n.children[0],d),o.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=$p(n.children[1]),m=yw(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 oA(e,n,r){const l=r?r.children:void 0,c=(l?l.indexOf(n):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,f=d?d.length:n.children.length;let m=-1;const h=[];for(;++m<f;){const y=n.children[m],k={},w=d?d[m]:void 0;w&&(k.align=w);let S={type:"element",tagName:c,properties:k,children:[]};y&&(S.children=e.all(y),e.patch(y,S),S=e.applyData(y,S)),h.push(S)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(n,g),e.applyData(n,g)}function cA(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const G1=9,W1=32;function uA(e){const n=String(e),r=/\r?\n|\r/g;let l=r.exec(n),o=0;const c=[];for(;l;)c.push(K1(n.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=r.exec(n);return c.push(K1(n.slice(o),o>0,!1)),c.join("")}function K1(e,n,r){let l=0,o=e.length;if(n){let c=e.codePointAt(l);for(;c===G1||c===W1;)l++,c=e.codePointAt(l)}if(r){let c=e.codePointAt(o-1);for(;c===G1||c===W1;)o--,c=e.codePointAt(o-1)}return o>l?e.slice(l,o):""}function dA(e,n){const r={type:"text",value:uA(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function fA(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const mA={blockquote:PE,break:FE,code:qE,delete:VE,emphasis:GE,footnoteReference:WE,heading:KE,html:YE,imageReference:QE,image:XE,inlineCode:ZE,linkReference:JE,link:eA,listItem:tA,list:aA,paragraph:rA,root:sA,strong:lA,table:iA,tableCell:cA,tableRow:oA,text:dA,thematicBreak:fA,toml:hu,yaml:hu,definition:hu,footnoteDefinition:hu};function hu(){}const Bw=-1,wd=0,jo=1,Ju=2,Gp=3,Wp=4,Kp=5,Yp=6,Hw=7,Pw=8,hA=typeof self=="object"?self:globalThis,Y1=(e,n)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new hA[e](n)},pA=(e,n)=>{const r=(o,c)=>(e.set(c,o),o),l=o=>{if(e.has(o))return e.get(o);const[c,d]=n[o];switch(c){case wd:case Bw:return r(d,o);case jo:{const f=r([],o);for(const m of d)f.push(l(m));return f}case Ju:{const f=r({},o);for(const[m,h]of d)f[l(m)]=l(h);return f}case Gp:return r(new Date(d),o);case Wp:{const{source:f,flags:m}=d;return r(new RegExp(f,m),o)}case Kp:{const f=r(new Map,o);for(const[m,h]of d)f.set(l(m),l(h));return f}case Yp:{const f=r(new Set,o);for(const m of d)f.add(l(m));return f}case Hw:{const{name:f,message:m}=d;return r(Y1(f,m),o)}case Pw:return r(BigInt(d),o);case"BigInt":return r(Object(BigInt(d)),o);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:f}=new Uint8Array(d);return r(new DataView(f),d)}}return r(Y1(c,d),o)};return l},Q1=e=>pA(new Map,e)(0),Js="",{toString:gA}={},{keys:xA}=Object,lo=e=>{const n=typeof e;if(n!=="object"||!e)return[wd,n];const r=gA.call(e).slice(8,-1);switch(r){case"Array":return[jo,Js];case"Object":return[Ju,Js];case"Date":return[Gp,Js];case"RegExp":return[Wp,Js];case"Map":return[Kp,Js];case"Set":return[Yp,Js];case"DataView":return[jo,r]}return r.includes("Array")?[jo,r]:r.includes("Error")?[Hw,r]:[Ju,r]},pu=([e,n])=>e===wd&&(n==="function"||n==="symbol"),yA=(e,n,r,l)=>{const o=(d,f)=>{const m=l.push(d)-1;return r.set(f,m),m},c=d=>{if(r.has(d))return r.get(d);let[f,m]=lo(d);switch(f){case wd:{let g=d;switch(m){case"bigint":f=Pw,g=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return o([Bw],d)}return o([f,g],d)}case jo:{if(m){let k=d;return m==="DataView"?k=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(k=new Uint8Array(d)),o([m,[...k]],d)}const g=[],y=o([f,g],d);for(const k of d)g.push(c(k));return y}case Ju:{if(m)switch(m){case"BigInt":return o([m,d.toString()],d);case"Boolean":case"Number":case"String":return o([m,d.valueOf()],d)}if(n&&"toJSON"in d)return c(d.toJSON());const g=[],y=o([f,g],d);for(const k of xA(d))(e||!pu(lo(d[k])))&&g.push([c(k),c(d[k])]);return y}case Gp:return o([f,isNaN(d.getTime())?Js:d.toISOString()],d);case Wp:{const{source:g,flags:y}=d;return o([f,{source:g,flags:y}],d)}case Kp:{const g=[],y=o([f,g],d);for(const[k,w]of d)(e||!(pu(lo(k))||pu(lo(w))))&&g.push([c(k),c(w)]);return y}case Yp:{const g=[],y=o([f,g],d);for(const k of d)(e||!pu(lo(k)))&&g.push(c(k));return y}}const{message:h}=d;return o([f,{name:m,message:h}],d)};return c},X1=(e,{json:n,lossy:r}={})=>{const l=[];return yA(!(n||r),!!n,new Map,l)(e),l},ed=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Q1(X1(e,n)):structuredClone(e):(e,n)=>Q1(X1(e,n));function bA(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 vA(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function kA(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||bA,l=e.options.footnoteBackLabel||vA,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const g=e.all(h),y=String(h.identifier).toUpperCase(),k=ii(y.toLowerCase());let w=0;const S=[],T=e.footnoteCounts.get(y);for(;T!==void 0&&++w<=T;){S.length>0&&S.push({type:"text",value:" "});let L=typeof r=="string"?r:r(m,w);typeof L=="string"&&(L={type:"text",value:L}),S.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+k+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(m,w),className:["data-footnote-backref"]},children:Array.isArray(L)?L:[L]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const L=E.children[E.children.length-1];L&&L.type==="text"?L.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else g.push(...S);const M={type:"element",tagName:"li",properties:{id:n+"fn-"+k},children:e.wrap(g,!0)};e.patch(h,M),f.push(M)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...ed(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
144
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
145
|
-
`}]}}const Sd=(function(e){if(e==null)return NA;if(typeof e=="function")return jd(e);if(typeof e=="object")return Array.isArray(e)?wA(e):SA(e);if(typeof e=="string")return jA(e);throw new Error("Expected function, string, or object as test")});function wA(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Sd(e[r]);return jd(l);function l(...o){let c=-1;for(;++c<n.length;)if(n[c].apply(this,o))return!0;return!1}}function SA(e){const n=e;return jd(r);function r(l){const o=l;let c;for(c in e)if(o[c]!==n[c])return!1;return!0}}function jA(e){return jd(n);function n(r){return r&&r.type===e}}function jd(e){return n;function n(r,l,o){return!!(CA(r)&&e.call(this,r,typeof l=="number"?l:void 0,o||void 0))}}function NA(){return!0}function CA(e){return e!==null&&typeof e=="object"&&"type"in e}const Fw=[],TA=!0,Wh=!1,MA="skip";function qw(e,n,r,l){let o;typeof n=="function"&&typeof r!="function"?(l=r,r=n):o=n;const c=Sd(o),d=l?-1:1;f(e,void 0,[])();function f(m,h,g){const y=m&&typeof m=="object"?m:{};if(typeof y.type=="string"){const w=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(k,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return k;function k(){let w=Fw,S,T,E;if((!n||c(m,h,g[g.length-1]||void 0))&&(w=EA(r(m,g)),w[0]===Wh))return w;if("children"in m&&m.children){const M=m;if(M.children&&w[0]!==MA)for(T=(l?M.children.length:-1)+d,E=g.concat(M);T>-1&&T<M.children.length;){const L=M.children[T];if(S=f(L,T,E)(),S[0]===Wh)return S;T=typeof S[1]=="number"?S[1]:T+d}}return w}}}function EA(e){return Array.isArray(e)?e:typeof e=="number"?[TA,e]:e==null?Fw:[e]}function Qp(e,n,r,l){let o,c,d;typeof n=="function"&&typeof r!="function"?(c=void 0,d=n,o=r):(c=n,d=r,o=l),qw(e,c,f,o);function f(m,h){const g=h[h.length-1],y=g?g.children.indexOf(m):void 0;return d(m,y,g)}}const Kh={}.hasOwnProperty,AA={};function RA(e,n){const r=n||AA,l=new Map,o=new Map,c=new Map,d={...mA,...r.handlers},f={all:h,applyData:_A,definitionById:l,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:r,patch:IA,wrap:OA};return Qp(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?l:o,k=String(g.identifier).toUpperCase();y.has(k)||y.set(k,g)}}),f;function m(g,y){const k=g.type,w=f.handlers[k];if(Kh.call(f.handlers,k)&&w)return w(f,g,y);if(f.options.passThrough&&f.options.passThrough.includes(k)){if("children"in g){const{children:T,...E}=g,M=ed(E);return M.children=f.all(g),M}return ed(g)}return(f.options.unknownHandler||LA)(f,g,y)}function h(g){const y=[];if("children"in g){const k=g.children;let w=-1;for(;++w<k.length;){const S=f.one(k[w],g);if(S){if(w&&k[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Z1(S.value)),!Array.isArray(S)&&S.type==="element")){const T=S.children[0];T&&T.type==="text"&&(T.value=Z1(T.value))}Array.isArray(S)?y.push(...S):y.push(S)}}}return y}}function IA(e,n){e.position&&(n.position=bT(e))}function _A(e,n){let r=n;if(e&&e.data){const l=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof l=="string")if(r.type==="element")r.tagName=l;else{const d="children"in r?r.children:[r];r={type:"element",tagName:l,properties:{},children:d}}r.type==="element"&&c&&Object.assign(r.properties,ed(c)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function LA(e,n){const r=n.data||{},l="value"in n&&!(Kh.call(r,"hProperties")||Kh.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function OA(e,n){const r=[];let l=-1;for(n&&r.push({type:"text",value:`
|
|
146
|
-
`});++l<e.length;)l&&r.push({type:"text",value:`
|
|
147
|
-
`}),r.push(e[l]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
148
|
-
`}),r}function Z1(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function J1(e,n){const r=RA(e,n),l=r.one(e,void 0),o=kA(r),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
|
|
149
|
-
`},o),c}function DA(e,n){return e&&"run"in e?async function(r,l){const o=J1(r,{file:l,...n});await e.run(o,l)}:function(r,l){return J1(r,{file:l,...e||n})}}function eb(e){if(e)throw e}var Km,tb;function zA(){if(tb)return Km;tb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},c=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!y)return!1;var k;for(k in h);return typeof k>"u"||e.call(h,k)},d=function(h,g){r&&g.name==="__proto__"?r(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(l)return l(h,g).value}else return;return h[g]};return Km=function m(){var h,g,y,k,w,S,T=arguments[0],E=1,M=arguments.length,L=!1;for(typeof T=="boolean"&&(L=T,T=arguments[1]||{},E=2),(T==null||typeof T!="object"&&typeof T!="function")&&(T={});E<M;++E)if(h=arguments[E],h!=null)for(g in h)y=f(T,g),k=f(h,g),T!==k&&(L&&k&&(c(k)||(w=o(k)))?(w?(w=!1,S=y&&o(y)?y:[]):S=y&&c(y)?y:{},d(T,{name:g,newValue:m(L,S,k)})):typeof k<"u"&&d(T,{name:g,newValue:k}));return T},Km}var UA=zA();const Ym=_v(UA);function Yh(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 $A(){const e=[],n={run:r,use:l};return n;function r(...o){let c=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);f(null,...o);function f(m,...h){const g=e[++c];let y=-1;if(m){d(m);return}for(;++y<o.length;)(h[y]===null||h[y]===void 0)&&(h[y]=o[y]);o=h,g?BA(g,f)(...h):d(null,...h)}}function l(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function BA(e,n){let r;return l;function l(...d){const f=e.length>d.length;let m;f&&d.push(o);try{m=e.apply(this,d)}catch(h){const g=h;if(f&&r)throw g;return o(g)}f||(m&&m.then&&typeof m.then=="function"?m.then(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 fr={basename:HA,dirname:PA,extname:FA,join:qA,sep:"/"};function HA(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Qo(e);let r=0,l=-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 l<0&&(c=!0,l=o+1);return l<0?"":e.slice(r,l)}if(n===e)return"";let d=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else d<0&&(c=!0,d=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(l=o):(f=-1,l=d));return r===l?l=d:l<0&&(l=e.length),e.slice(r,l)}function PA(e){if(Qo(e),e.length===0)return".";let n=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){n=r;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function FA(e){Qo(e);let n=e.length,r=-1,l=0,o=-1,c=0,d;for(;n--;){const f=e.codePointAt(n);if(f===47){if(d){l=n+1;break}continue}r<0&&(d=!0,r=n+1),f===46?o<0?o=n:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||r<0||c===0||c===1&&o===r-1&&o===l+1?"":e.slice(o,r)}function qA(...e){let n=-1,r;for(;++n<e.length;)Qo(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":VA(r)}function VA(e){Qo(e);const n=e.codePointAt(0)===47;let r=GA(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function GA(e,n){let r="",l=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||l!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",l=0):(r=r.slice(0,m),l=r.length-1-r.lastIndexOf("/")),o=d,c=0;continue}}else if(r.length>0){r="",l=0,o=d,c=0;continue}}n&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),l=d-o-1;o=d,c=0}else f===46&&c>-1?c++:c=-1}return r}function Qo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const WA={cwd:KA};function KA(){return"/"}function Qh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function YA(e){if(typeof e=="string")e=new URL(e);else if(!Qh(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 QA(e)}function QA(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const l=n.codePointAt(r+2);if(l===70||l===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(n)}const Qm=["history","path","basename","stem","extname","dirname"];class Vw{constructor(n){let r;n?Qh(n)?r={path:n}:typeof n=="string"||XA(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":WA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<Qm.length;){const c=Qm[l];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let o;for(o in r)Qm.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?fr.basename(this.path):void 0}set basename(n){Zm(n,"basename"),Xm(n,"basename"),this.path=fr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?fr.dirname(this.path):void 0}set dirname(n){nb(this.basename,"dirname"),this.path=fr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?fr.extname(this.path):void 0}set extname(n){if(Xm(n,"extname"),nb(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=fr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Qh(n)&&(n=YA(n)),Zm(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?fr.basename(this.path,this.extname):void 0}set stem(n){Zm(n,"stem"),Xm(n,"stem"),this.path=fr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,l){const o=this.message(n,r,l);throw o.fatal=!0,o}info(n,r,l){const o=this.message(n,r,l);return o.fatal=void 0,o}message(n,r,l){const o=new $n(n,r,l);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Xm(e,n){if(e&&e.includes(fr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+fr.sep+"`")}function Zm(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function nb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function XA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ZA=(function(e){const l=this.constructor.prototype,o=l[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,l),c}),JA={}.hasOwnProperty;class Xp extends ZA{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=$A()}copy(){const n=new Xp;let r=-1;for(;++r<this.attachers.length;){const l=this.attachers[r];n.use(...l)}return n.data(Ym(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(th("data",this.frozen),this.namespace[n]=r,this):JA.call(this.namespace,n)&&this.namespace[n]||void 0:n?(th("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const o=r.call(n,...l);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=gu(n),l=this.parser||this.Parser;return Jm("parse",l),l(String(r),r)}process(n,r){const l=this;return this.freeze(),Jm("process",this.parser||this.Parser),eh("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(c,d){const f=gu(n),m=l.parse(f);l.run(m,f,function(g,y,k){if(g||!y||!k)return h(g);const w=y,S=l.stringify(w,k);n6(S)?k.value=S:k.result=S,h(g,k)});function h(g,y){g||!y?d(g):c?c(y):r(void 0,y)}}}processSync(n){let r=!1,l;return this.freeze(),Jm("processSync",this.parser||this.Parser),eh("processSync",this.compiler||this.Compiler),this.process(n,o),rb("processSync","process",r),l;function o(c,d){r=!0,eb(c),l=d}}run(n,r,l){ab(n),this.freeze();const o=this.transformers;return!l&&typeof r=="function"&&(l=r,r=void 0),l?c(void 0,l):new Promise(c);function c(d,f){const m=gu(r);o.run(n,m,h);function h(g,y,k){const w=y||n;g?f(g):d?d(w):l(void 0,w,k)}}}runSync(n,r){let l=!1,o;return this.run(n,r,c),rb("runSync","run",l),o;function c(d,f){eb(d),o=f,l=!0}}stringify(n,r){this.freeze();const l=gu(r),o=this.compiler||this.Compiler;return eh("stringify",o),ab(n),o(n,l)}use(n,...r){const l=this.attachers,o=this.namespace;if(th("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):d(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function c(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...y]=h;m(g,y)}else d(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function d(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(o.settings=Ym(!0,o.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const y=h[g];c(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,g){let y=-1,k=-1;for(;++y<l.length;)if(l[y][0]===h){k=y;break}if(k===-1)l.push([h,...g]);else if(g.length>0){let[w,...S]=g;const T=l[k][1];Yh(T)&&Yh(w)&&(w=Ym(!0,T,w)),l[k]=[h,w,...S]}}}}const e6=new Xp().freeze();function Jm(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function eh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function th(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 ab(e){if(!Yh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function rb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function gu(e){return t6(e)?e:new Vw(e)}function t6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function n6(e){return typeof e=="string"||a6(e)}function a6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",sb=[],lb={allowDangerousHtml:!0},s6=/^(https?|ircs?|mailto|xmpp)$/i,l6=[{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 Xo(e){const n=i6(e),r=o6(e);return c6(n.runSync(n.parse(r),r),e)}function i6(e){const n=e.rehypePlugins||sb,r=e.remarkPlugins||sb,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...lb}:lb;return e6().use(HE).use(r).use(DA,l).use(n)}function o6(e){const n=e.children||"",r=new Vw;return typeof n=="string"&&(r.value=n),r}function c6(e,n){const r=n.allowedElements,l=n.allowElement,o=n.components,c=n.disallowedElements,d=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||u6;for(const g of l6)Object.hasOwn(n,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+r6+g.id,void 0);return Qp(e,h),jT(e,{Fragment:s.Fragment,components:o,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function h(g,y,k){if(g.type==="raw"&&k&&typeof y=="number")return d?k.children.splice(y,1):k.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let w;for(w in Vm)if(Object.hasOwn(Vm,w)&&Object.hasOwn(g.properties,w)){const S=g.properties[w],T=Vm[w];(T===null||T.includes(g.tagName))&&(g.properties[w]=m(String(S||""),w,g))}}if(g.type==="element"){let w=r?!r.includes(g.tagName):c?c.includes(g.tagName):!1;if(!w&&l&&typeof y=="number"&&(w=!l(g,y,k)),w&&k&&typeof y=="number")return f&&g.children?k.children.splice(y,1,...g.children):k.children.splice(y,1),y}}}function u6(e){const n=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||r!==-1&&n>r||l!==-1&&n>l||s6.test(e.slice(0,n))?e:""}function ib(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let l=0,o=r.indexOf(n);for(;o!==-1;)l++,o=r.indexOf(n,o+n.length);return l}function d6(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function f6(e,n,r){const o=Sd((r||{}).ignore||[]),c=m6(n);let d=-1;for(;++d<c.length;)qw(e,"text",f);function f(h,g){let y=-1,k;for(;++y<g.length;){const w=g[y],S=k?k.children:void 0;if(o(w,S?S.indexOf(w):void 0,k))return;k=w}if(k)return m(h,g)}function m(h,g){const y=g[g.length-1],k=c[d][0],w=c[d][1];let S=0;const E=y.children.indexOf(h);let M=!1,L=[];k.lastIndex=0;let O=k.exec(h.value);for(;O;){const P=O.index,H={index:O.index,input:O.input,stack:[...g,h]};let I=w(...O,H);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?k.lastIndex=P+1:(S!==P&&L.push({type:"text",value:h.value.slice(S,P)}),Array.isArray(I)?L.push(...I):I&&L.push(I),S=P+O[0].length,M=!0),!k.global)break;O=k.exec(h.value)}return M?(S<h.value.length&&L.push({type:"text",value:h.value.slice(S)}),y.children.splice(E,1,...L)):L=[h],E+L.length}}function m6(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let l=-1;for(;++l<r.length;){const o=r[l];n.push([h6(o[0]),p6(o[1])])}return n}function h6(e){return typeof e=="string"?new RegExp(d6(e),"g"):e}function p6(e){return typeof e=="function"?e:function(){return e}}const nh="phrasing",ah=["autolink","link","image","label"];function g6(){return{transforms:[S6],enter:{literalAutolink:y6,literalAutolinkEmail:rh,literalAutolinkHttp:rh,literalAutolinkWww:rh},exit:{literalAutolink:w6,literalAutolinkEmail:k6,literalAutolinkHttp:b6,literalAutolinkWww:v6}}}function x6(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:nh,notInConstruct:ah},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:nh,notInConstruct:ah},{character:":",before:"[ps]",after:"\\/",inConstruct:nh,notInConstruct:ah}]}}function y6(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function rh(e){this.config.enter.autolinkProtocol.call(this,e)}function b6(e){this.config.exit.autolinkProtocol.call(this,e)}function v6(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 k6(e){this.config.exit.autolinkEmail.call(this,e)}function w6(e){this.exit(e)}function S6(e){f6(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,j6],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),N6]],{ignore:["link","linkReference"]})}function j6(e,n,r,l,o){let c="";if(!Gw(o)||(/^w/i.test(n)&&(r=n+r,n="",c="http://"),!C6(r)))return!1;const d=T6(r+l);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 N6(e,n,r,l){return!Gw(l,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function C6(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 T6(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],l=r.indexOf(")");const o=ib(e,"(");let c=ib(e,")");for(;l!==-1&&o>c;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),c++;return[e,r]}function Gw(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||cl(r)||vd(r))&&(!n||r!==47)}Ww.peek=D6;function M6(){this.buffer()}function E6(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function A6(){this.buffer()}function R6(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function I6(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Za(this.sliceSerialize(e)).toLowerCase(),r.label=n}function _6(e){this.exit(e)}function L6(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Za(this.sliceSerialize(e)).toLowerCase(),r.label=n}function O6(e){this.exit(e)}function D6(){return"["}function Ww(e,n,r,l){const o=r.createTracker(l);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 z6(){return{enter:{gfmFootnoteCallString:M6,gfmFootnoteCall:E6,gfmFootnoteDefinitionLabelString:A6,gfmFootnoteDefinition:R6},exit:{gfmFootnoteCallString:I6,gfmFootnoteCall:_6,gfmFootnoteDefinitionLabelString:L6,gfmFootnoteDefinition:O6}}}function U6(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:Ww},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,o,c,d){const f=c.createTracker(d);let m=f.move("[^");const h=c.enter("footnoteDefinition"),g=c.enter("label");return m+=f.move(c.safe(c.associationId(l),{before:m,after:"]"})),g(),m+=f.move("]:"),l.children&&l.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
150
|
-
`:" ")+c.indentLines(c.containerFlow(l,f.current()),n?Kw:$6))),h(),m}}function $6(e,n,r){return n===0?e:Kw(e,n,r)}function Kw(e,n,r){return(r?"":" ")+e}const B6=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Yw.peek=V6;function H6(){return{canContainEols:["delete"],enter:{strikethrough:F6},exit:{strikethrough:q6}}}function P6(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:B6}],handlers:{delete:Yw}}}function F6(e){this.enter({type:"delete",children:[]},e)}function q6(e){this.exit(e)}function Yw(e,n,r,l){const o=r.createTracker(l),c=r.enter("strikethrough");let d=o.move("~~");return d+=r.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function V6(){return"~"}function G6(e){return e.length}function W6(e,n){const r=n||{},l=(r.align||[]).concat(),o=r.stringLength||G6,c=[],d=[],f=[],m=[];let h=0,g=-1;for(;++g<e.length;){const T=[],E=[];let M=-1;for(e[g].length>h&&(h=e[g].length);++M<e[g].length;){const L=K6(e[g][M]);if(r.alignDelimiters!==!1){const O=o(L);E[M]=O,(m[M]===void 0||O>m[M])&&(m[M]=O)}T.push(L)}d[g]=T,f[g]=E}let y=-1;if(typeof l=="object"&&"length"in l)for(;++y<h;)c[y]=ob(l[y]);else{const T=ob(l);for(;++y<h;)c[y]=T}y=-1;const k=[],w=[];for(;++y<h;){const T=c[y];let E="",M="";T===99?(E=":",M=":"):T===108?E=":":T===114&&(M=":");let L=r.alignDelimiters===!1?1:Math.max(1,m[y]-E.length-M.length);const O=E+"-".repeat(L)+M;r.alignDelimiters!==!1&&(L=E.length+L+M.length,L>m[y]&&(m[y]=L),w[y]=L),k[y]=O}d.splice(1,0,k),f.splice(1,0,w),g=-1;const S=[];for(;++g<d.length;){const T=d[g],E=f[g];y=-1;const M=[];for(;++y<h;){const L=T[y]||"";let O="",P="";if(r.alignDelimiters!==!1){const H=m[y]-(E[y]||0),I=c[y];I===114?O=" ".repeat(H):I===99?H%2?(O=" ".repeat(H/2+.5),P=" ".repeat(H/2-.5)):(O=" ".repeat(H/2),P=O):P=" ".repeat(H)}r.delimiterStart!==!1&&!y&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&L==="")&&(r.delimiterStart!==!1||y)&&M.push(" "),r.alignDelimiters!==!1&&M.push(O),M.push(L),r.alignDelimiters!==!1&&M.push(P),r.padding!==!1&&M.push(" "),(r.delimiterEnd!==!1||y!==h-1)&&M.push("|")}S.push(r.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return S.join(`
|
|
151
|
-
`)}function K6(e){return e==null?"":String(e)}function ob(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 Y6(e,n,r,l){const o=r.enter("blockquote"),c=r.createTracker(l);c.move("> "),c.shift(2);const d=r.indentLines(r.containerFlow(e,c.current()),Q6);return o(),d}function Q6(e,n,r){return">"+(r?"":" ")+e}function X6(e,n){return cb(e,n.inConstruct,!0)&&!cb(e,n.notInConstruct,!1)}function cb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let l=-1;for(;++l<n.length;)if(e.includes(n[l]))return!0;return!1}function ub(e,n,r,l){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
|
|
152
|
-
`&&X6(r.stack,r.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
|
|
153
|
-
`}function Z6(e,n){const r=String(e);let l=r.indexOf(n),o=l,c=0,d=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===o?++c>d&&(d=c):c=1,o=l+n.length,l=r.indexOf(n,o);return d}function J6(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 eR(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 tR(e,n,r,l){const o=eR(r),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(J6(e,r)){const y=r.enter("codeIndented"),k=r.indentLines(c,nR);return y(),k}const f=r.createTracker(l),m=o.repeat(Math.max(Z6(c,o)+1,3)),h=r.enter("codeFenced");let g=f.move(m);if(e.lang){const y=r.enter(`codeFencedLang${d}`);g+=f.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${d}`);g+=f.move(" "),g+=f.move(r.safe(e.meta,{before:g,after:`
|
|
154
|
-
`,encode:["`"],...f.current()})),y()}return g+=f.move(`
|
|
155
|
-
`),c&&(g+=f.move(c+`
|
|
156
|
-
`)),g+=f.move(m),h(),g}function nR(e,n,r){return(r?"":" ")+e}function Zp(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 aR(e,n,r,l){const o=Zp(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("definition");let f=r.enter("label");const m=r.createTracker(l);let h=m.move("[");return h+=m.move(r.safe(r.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":`
|
|
157
|
-
`,...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 rR(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 Do(e){return"&#x"+e.toString(16).toUpperCase()+";"}function td(e,n,r){const l=ei(e),o=ei(n);return l===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Qw.peek=sR;function Qw(e,n,r,l){const o=rR(r),c=r.enter("emphasis"),d=r.createTracker(l),f=d.move(o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=td(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(m=Do(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=td(l.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+Do(y));const w=d.move(o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function sR(e,n,r){return r.options.emphasis||"*"}function lR(e,n){let r=!1;return Qp(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,Wh}),!!((!e.depth||e.depth<3)&&Fp(e)&&(n.options.setext||r))}function iR(e,n,r,l){const o=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(l);if(lR(e,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),k=r.containerPhrasing(e,{...c.current(),before:`
|
|
158
|
-
`,after:`
|
|
159
|
-
`});return y(),g(),k+`
|
|
160
|
-
`+(o===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(`
|
|
161
|
-
`))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),m=r.enter("phrasing");c.move(d+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
|
|
162
|
-
`,...c.current()});return/^[\t ]/.test(h)&&(h=Do(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,r.options.closeAtx&&(h+=" "+d),m(),f(),h}Xw.peek=oR;function Xw(e){return e.value||""}function oR(){return"<"}Zw.peek=cR;function Zw(e,n,r,l){const o=Zp(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("image");let f=r.enter("label");const m=r.createTracker(l);let h=m.move("![");return h+=m.move(r.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${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 cR(){return"!"}Jw.peek=uR;function Jw(e,n,r,l){const o=e.referenceType,c=r.enter("imageReference");let d=r.enter("label");const f=r.createTracker(l);let m=f.move("![");const h=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function uR(){return"!"}e2.peek=dR;function e2(e,n,r){let l=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++c<r.unsafe.length;){const d=r.unsafe[c],f=r.compilePattern(d);let m;if(d.atBreak)for(;m=f.exec(l);){let h=m.index;l.charCodeAt(h)===10&&l.charCodeAt(h-1)===13&&h--,l=l.slice(0,h)+" "+l.slice(m.index+1)}}return o+l+o}function dR(){return"`"}function t2(e,n){const r=Fp(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))}n2.peek=fR;function n2(e,n,r,l){const o=Zp(r),c=o==='"'?"Quote":"Apostrophe",d=r.createTracker(l);let f,m;if(t2(e,r)){const g=r.stack;r.stack=[],f=r.enter("autolink");let y=d.move("<");return y+=d.move(r.containerPhrasing(e,{before:y,after:">",...d.current()})),y+=d.move(">"),f(),r.stack=g,y}f=r.enter("link"),m=r.enter("label");let h=d.move("[");return h+=d.move(r.containerPhrasing(e,{before:h,after:"](",...d.current()})),h+=d.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(m=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),m(),e.title&&(m=r.enter(`title${c}`),h+=d.move(" "+o),h+=d.move(r.safe(e.title,{before:h,after:o,...d.current()})),h+=d.move(o),m()),h+=d.move(")"),f(),h}function fR(e,n,r){return t2(e,r)?"<":"["}a2.peek=mR;function a2(e,n,r,l){const o=e.referenceType,c=r.enter("linkReference");let d=r.enter("label");const f=r.createTracker(l);let m=f.move("[");const h=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function mR(){return"["}function Jp(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 hR(e){const n=Jp(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 pR(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 r2(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 gR(e,n,r,l){const o=r.enter("list"),c=r.bulletCurrent;let d=e.ordered?pR(r):Jp(r);const f=e.ordered?d==="."?")":".":hR(r);let m=n&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),r2(r)===d&&g){let y=-1;for(;++y<e.children.length;){const k=e.children[y];if(k&&k.type==="listItem"&&k.children&&k.children[0]&&k.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=f),r.bulletCurrent=d;const h=r.containerFlow(e,l);return r.bulletLastUsed=d,r.bulletCurrent=c,o(),h}function xR(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 yR(e,n,r,l){const o=xR(r);let c=r.bulletCurrent||Jp(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(l);f.move(c+" ".repeat(d-c.length)),f.shift(d);const m=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,f.current()),g);return m(),h;function g(y,k,w){return k?(w?"":" ".repeat(d))+y:(w?c:c+" ".repeat(d-c.length))+y}}function bR(e,n,r,l){const o=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(e,l);return c(),o(),d}const vR=Sd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function kR(e,n,r,l){return(e.children.some(function(d){return vR(d)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function wR(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}s2.peek=SR;function s2(e,n,r,l){const o=wR(r),c=r.enter("strong"),d=r.createTracker(l),f=d.move(o+o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=td(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(m=Do(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=td(l.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+Do(y));const w=d.move(o+o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function SR(e,n,r){return r.options.strong||"*"}function jR(e,n,r,l){return r.safe(e.value,l)}function NR(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 CR(e,n,r){const l=(r2(r)+(r.options.ruleSpaces?" ":"")).repeat(NR(r));return r.options.ruleSpaces?l.slice(0,-1):l}const l2={blockquote:Y6,break:ub,code:tR,definition:aR,emphasis:Qw,hardBreak:ub,heading:iR,html:Xw,image:Zw,imageReference:Jw,inlineCode:e2,link:n2,linkReference:a2,list:gR,listItem:yR,paragraph:bR,root:kR,strong:s2,text:jR,thematicBreak:CR};function TR(){return{enter:{table:MR,tableData:db,tableHeader:db,tableRow:AR},exit:{codeText:RR,table:ER,tableData:sh,tableHeader:sh,tableRow:sh}}}function MR(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 ER(e){this.exit(e),this.data.inTable=void 0}function AR(e){this.enter({type:"tableRow",children:[]},e)}function sh(e){this.exit(e)}function db(e){this.enter({type:"tableCell",children:[]},e)}function RR(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,IR));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function IR(e,n){return n==="|"?n:e}function _R(e){const n=e||{},r=n.tableCellPadding,l=n.tablePipeAlign,o=n.stringLength,c=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
163
|
-
`,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,S,T,E){return h(g(w,T,E),w.align)}function f(w,S,T,E){const M=y(w,T,E),L=h([M]);return L.slice(0,L.indexOf(`
|
|
164
|
-
`))}function m(w,S,T,E){const M=T.enter("tableCell"),L=T.enter("phrasing"),O=T.containerPhrasing(w,{...E,before:c,after:c});return L(),M(),O}function h(w,S){return W6(w,{align:S,alignDelimiters:l,padding:r,stringLength:o})}function g(w,S,T){const E=w.children;let M=-1;const L=[],O=S.enter("table");for(;++M<E.length;)L[M]=y(E[M],S,T);return O(),L}function y(w,S,T){const E=w.children;let M=-1;const L=[],O=S.enter("tableRow");for(;++M<E.length;)L[M]=m(E[M],w,S,T);return O(),L}function k(w,S,T){let E=l2.inlineCode(w,S,T);return T.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function LR(){return{exit:{taskListCheckValueChecked:fb,taskListCheckValueUnchecked:fb,paragraph:DR}}}function OR(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:zR}}}function fb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function DR(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const l=r.children[0];if(l&&l.type==="text"){const o=n.children;let c=-1,d;for(;++c<o.length;){const f=o[c];if(f.type==="paragraph"){d=f;break}}d===r&&(l.value=l.value.slice(1),l.value.length===0?r.children.shift():r.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,r.position.start=Object.assign({},l.position.start)))}}this.exit(e)}function zR(e,n,r,l){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=r.createTracker(l);c&&f.move(d);let m=l2.listItem(e,n,r,{...l,...f.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(g){return g+d}}function UR(){return[g6(),z6(),H6(),TR(),LR()]}function $R(e){return{extensions:[x6(),U6(e),P6(),_R(e),OR()]}}const BR={tokenize:GR,partial:!0},i2={tokenize:WR,partial:!0},o2={tokenize:KR,partial:!0},c2={tokenize:YR,partial:!0},HR={tokenize:QR,partial:!0},u2={name:"wwwAutolink",tokenize:qR,previous:f2},d2={name:"protocolAutolink",tokenize:VR,previous:m2},Fr={name:"emailAutolink",tokenize:FR,previous:h2},xr={};function PR(){return{text:xr}}let Xs=48;for(;Xs<123;)xr[Xs]=Fr,Xs++,Xs===58?Xs=65:Xs===91&&(Xs=97);xr[43]=Fr;xr[45]=Fr;xr[46]=Fr;xr[95]=Fr;xr[72]=[Fr,d2];xr[104]=[Fr,d2];xr[87]=[Fr,u2];xr[119]=[Fr,u2];function FR(e,n,r){const l=this;let o,c;return d;function d(y){return!Xh(y)||!h2.call(l,l.previous)||eg(l.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return Xh(y)?(e.consume(y),f):y===64?(e.consume(y),m):r(y)}function m(y){return y===46?e.check(HR,g,h)(y):y===45||y===95||Un(y)?(c=!0,e.consume(y),m):g(y)}function h(y){return e.consume(y),o=!0,m}function g(y){return c&&o&&Fn(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(y)):r(y)}}function qR(e,n,r){const l=this;return o;function o(d){return d!==87&&d!==119||!f2.call(l,l.previous)||eg(l.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(BR,e.attempt(i2,e.attempt(o2,c),r),r)(d))}function c(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(d)}}function VR(e,n,r){const l=this;let o="",c=!1;return d;function d(y){return(y===72||y===104)&&m2.call(l,l.previous)&&!eg(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),f):r(y)}function f(y){if(Fn(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||Zu(y)||Dt(y)||cl(y)||vd(y)?r(y):e.attempt(i2,e.attempt(o2,g),r)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(y)}}function GR(e,n,r){let l=0;return o;function o(d){return(d===87||d===119)&&l<3?(l++,e.consume(d),o):d===46&&l===3?(e.consume(d),c):r(d)}function c(d){return d===null?r(d):n(d)}}function WR(e,n,r){let l,o,c;return d;function d(h){return h===46||h===95?e.check(c2,m,f)(h):h===null||Dt(h)||cl(h)||h!==45&&vd(h)?m(h):(c=!0,e.consume(h),d)}function f(h){return h===95?l=!0:(o=l,l=void 0),e.consume(h),d}function m(h){return o||l||!c?r(h):n(h)}}function KR(e,n){let r=0,l=0;return o;function o(d){return d===40?(r++,e.consume(d),o):d===41&&l<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(c2,n,c)(d):d===null||Dt(d)||cl(d)?n(d):(e.consume(d),o)}function c(d){return d===41&&l++,e.consume(d),o}}function YR(e,n,r){return l;function l(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),l):f===38?(e.consume(f),c):f===93?(e.consume(f),o):f===60||f===null||Dt(f)||cl(f)?n(f):r(f)}function o(f){return f===null||f===40||f===91||Dt(f)||cl(f)?n(f):l(f)}function c(f){return Fn(f)?d(f):r(f)}function d(f){return f===59?(e.consume(f),l):Fn(f)?(e.consume(f),d):r(f)}}function QR(e,n,r){return l;function l(c){return e.consume(c),o}function o(c){return Un(c)?r(c):n(c)}}function f2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function m2(e){return!Fn(e)}function h2(e){return!(e===47||Xh(e))}function Xh(e){return e===43||e===45||e===46||e===95||Un(e)}function eg(e){let n=e.length,r=!1;for(;n--;){const l=e[n][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){r=!0;break}if(l._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const XR={tokenize:s8,partial:!0};function ZR(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:n8,continuation:{tokenize:a8},exit:r8}},text:{91:{name:"gfmFootnoteCall",tokenize:t8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:JR,resolveTo:e8}}}}function JR(e,n,r){const l=this;let o=l.events.length;const c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;o--;){const m=l.events[o][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!d||!d._balanced)return r(m);const h=Za(l.sliceSerialize({start:d.end,end:l.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 e8(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const 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",l,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",l,n]];return e.splice(r,e.length-r+1,...f),e}function t8(e,n,r){const l=this,o=l.parser.gfmFootnotes||(l.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||Dt(y))return r(y);if(y===93){e.exit("chunkString");const k=e.exit("gfmFootnoteCallString");return o.includes(Za(l.sliceSerialize(k)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(y)}return Dt(y)||(d=!0),c++,e.consume(y),y===92?g:h}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,h):h(y)}}function n8(e,n,r){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c,d=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(S)}function g(S){if(d>999||S===93&&!f||S===null||S===91||Dt(S))return r(S);if(S===93){e.exit("chunkString");const T=e.exit("gfmFootnoteDefinitionLabelString");return c=Za(l.sliceSerialize(T)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),k}return Dt(S)||(f=!0),d++,e.consume(S),S===92?y:g}function y(S){return S===91||S===92||S===93?(e.consume(S),d++,g):g(S)}function k(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),o.includes(c)||o.push(c),gt(e,w,"gfmFootnoteDefinitionWhitespace")):r(S)}function w(S){return n(S)}}function a8(e,n,r){return e.check(Yo,n,e.attempt(XR,n,r))}function r8(e){e.exit("gfmFootnoteDefinition")}function s8(e,n,r){const l=this;return gt(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const d=l.events[l.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?n(c):r(c)}}function l8(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:c,resolveAll:o};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function o(d,f){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let h=m;for(;h--;)if(d[h][0]==="exit"&&d[h][1].type==="strikethroughSequenceTemporary"&&d[h][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[h][1].end.offset-d[h][1].start.offset){d[m][1].type="strikethroughSequence",d[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},d[h][1].start),end:Object.assign({},d[m][1].end)},y={type:"strikethroughText",start:Object.assign({},d[h][1].end),end:Object.assign({},d[m][1].start)},k=[["enter",g,f],["enter",d[h][1],f],["exit",d[h][1],f],["enter",y,f]],w=f.parser.constructs.insideSpan.null;w&&va(k,k.length,0,kd(w,d.slice(h+1,m),f)),va(k,k.length,0,[["exit",y,f],["enter",d[m][1],f],["exit",d[m][1],f],["exit",g,f]]),va(d,h-1,m-h+3,k),m=h+k.length-2;break}}for(m=-1;++m<d.length;)d[m][1].type==="strikethroughSequenceTemporary"&&(d[m][1].type="data");return d}function c(d,f,m){const h=this.previous,g=this.events;let y=0;return k;function k(S){return h===126&&g[g.length-1][1].type!=="characterEscape"?m(S):(d.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const T=ei(h);if(S===126)return y>1?m(S):(d.consume(S),y++,w);if(y<2&&!r)return m(S);const E=d.exit("strikethroughSequenceTemporary"),M=ei(S);return E._open=!M||M===2&&!!T,E._close=!T||T===2&&!!M,f(S)}}}class i8{constructor(){this.map=[]}add(n,r,l){o8(this,n,r,l)}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 l=[];for(;r>0;)r-=1,l.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];l.push(n.slice()),n.length=0;let o=l.pop();for(;o;){for(const c of o)n.push(c);o=l.pop()}this.map.length=0}}function o8(e,n,r,l){let o=0;if(!(r===0&&l.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=r,e.map[o][2].push(...l);return}o+=1}e.map.push([n,r,l])}}function c8(e,n){let r=!1;const l=[];for(;n<e.length;){const o=e[n];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const c=l.length-1;l[c]=l[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return l}function u8(){return{flow:{null:{name:"table",tokenize:d8,resolveAll:f8}}}}function d8(e,n,r){const l=this;let o=0,c=0,d;return f;function f(z){let B=l.events.length-1;for(;B>-1;){const q=l.events[B][1].type;if(q==="lineEnding"||q==="linePrefix")B--;else break}const A=B>-1?l.events[B][1].type:null,$=A==="tableHead"||A==="tableRow"?I:m;return $===I&&l.parser.lazy[l.now().line]?r(z):$(z)}function m(z){return e.enter("tableHead"),e.enter("tableRow"),h(z)}function h(z){return z===124||(d=!0,c+=1),g(z)}function g(z){return z===null?r(z):Ue(z)?c>1?(c=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),w):r(z):rt(z)?gt(e,g,"whitespace")(z):(c+=1,d&&(d=!1,o+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),d=!0,g):(e.enter("data"),y(z)))}function y(z){return z===null||z===124||Dt(z)?(e.exit("data"),g(z)):(e.consume(z),z===92?k:y)}function k(z){return z===92||z===124?(e.consume(z),y):y(z)}function w(z){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(z):(e.enter("tableDelimiterRow"),d=!1,rt(z)?gt(e,S,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):S(z))}function S(z){return z===45||z===58?E(z):z===124?(d=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),T):H(z)}function T(z){return rt(z)?gt(e,E,"whitespace")(z):E(z)}function E(z){return z===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),M):z===45?(c+=1,M(z)):z===null||Ue(z)?P(z):H(z)}function M(z){return z===45?(e.enter("tableDelimiterFiller"),L(z)):H(z)}function L(z){return z===45?(e.consume(z),L):z===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),O):(e.exit("tableDelimiterFiller"),O(z))}function O(z){return rt(z)?gt(e,P,"whitespace")(z):P(z)}function P(z){return z===124?S(z):z===null||Ue(z)?!d||o!==c?H(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(z)):H(z)}function H(z){return r(z)}function I(z){return e.enter("tableRow"),F(z)}function F(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),F):z===null||Ue(z)?(e.exit("tableRow"),n(z)):rt(z)?gt(e,F,"whitespace")(z):(e.enter("data"),K(z))}function K(z){return z===null||z===124||Dt(z)?(e.exit("data"),F(z)):(e.consume(z),z===92?Z:K)}function Z(z){return z===92||z===124?(e.consume(z),K):K(z)}}function f8(e,n){let r=-1,l=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,g,y;const k=new i8;for(;++r<e.length;){const w=e[r],S=w[1];w[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(mb(k,n,m,h,g),g=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},k.add(r,0,[["enter",h,n]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(l=!0,y=void 0,c=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},k.add(r,0,[["enter",g,n]])),o=S.type==="tableDelimiterRow"?2:g?3:1):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(l=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],y=xu(k,n,c,o,void 0,y),c=[0,0,0,0]),d[2]=r)):S.type==="tableCellDivider"&&(l?l=!1:(c[1]!==0&&(d[0]=d[1],y=xu(k,n,c,o,void 0,y)),c=d,d=[c[1],r,0,0])):S.type==="tableHead"?(f=!0,m=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=r,c[1]!==0?(d[0]=d[1],y=xu(k,n,c,o,r,y)):d[1]!==0&&(y=xu(k,n,d,o,r,y)),o=0):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&mb(k,n,m,h,g),k.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=c8(n.events,r))}return e}function xu(e,n,r,l,o,c){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(c.end=Object.assign({},Wl(n.events,r[0])),e.add(r[0],0,[["exit",c,n]]));const m=Wl(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=Wl(n.events,r[2]),g=Wl(n.events,r[3]),y={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",y,n]]),l!==2){const k=n.events[r[2]],w=n.events[r[3]];if(k[1].end=Object.assign({},w[1].end),k[1].type="chunkText",k[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,T=r[3]-r[2]-1;e.add(S,T,[])}}e.add(r[3]+1,0,[["exit",y,n]])}return o!==void 0&&(c.end=Object.assign({},Wl(n.events,o)),e.add(o,0,[["exit",c,n]]),c=void 0),c}function mb(e,n,r,l,o){const c=[],d=Wl(n.events,r);o&&(o.end=Object.assign({},d),c.push(["exit",o,n])),l.end=Object.assign({},d),c.push(["exit",l,n]),e.add(r+1,0,c)}function Wl(e,n){const r=e[n],l=r[0]==="enter"?"start":"end";return r[1][l]}const m8={name:"tasklistCheck",tokenize:p8};function h8(){return{text:{91:m8}}}function p8(e,n,r){const l=this;return o;function o(m){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return Dt(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 Ue(m)?n(m):rt(m)?e.check({tokenize:g8},n,r)(m):r(m)}}function g8(e,n,r){return gt(e,l,"whitespace");function l(o){return o===null?r(o):n(o)}}function x8(e){return Nw([PR(),ZR(),l8(e),u8(),h8()])}const y8={};function Zo(e){const n=this,r=e||y8,l=n.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),c=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(x8(r)),c.push(UR()),d.push($R(r))}const b8="modulepreload",v8=function(e){return"/"+e},hb={},k8=function(n,r,l){let o=Promise.resolve();if(r&&r.length>0){let m=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(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=v8(h),h in hb)return;hb[h]=!0;const g=h.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const k=document.createElement("link");if(k.rel=g?"stylesheet":b8,g||(k.as="script"),k.crossOrigin="",k.href=h,f&&k.setAttribute("nonce",f),document.head.appendChild(k),g)return new Promise((w,S)=>{k.addEventListener("load",w),k.addEventListener("error",()=>S(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)})},w8=1500;function S8({code:e}){const[n,r]=b.useState(!1),l=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),w8)};return s.jsx("button",{type:"button",title:n?p.common.copied:p.chat.copyCode,"aria-label":p.chat.copyCode,onClick:l,className:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx(Pe,{d:n?gn.check:gn.copy})})}function tg({language:e,code:n,highlight:r=!0}){const[l,o]=b.useState(null);return b.useEffect(()=>{if(!r){o(null);return}let c=!0;return k8(()=>import("./index-DTZ3P5wj.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]),s.jsxs("div",{className:"code-block my-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800",children:[s.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:[s.jsx("span",{className:"font-mono text-xs lowercase text-gray-500 dark:text-gray-400",children:e||"text"}),s.jsx(S8,{code:n})]}),s.jsx("div",{className:"overflow-x-auto bg-white text-[13px] leading-relaxed dark:bg-gray-950",children:l?s.jsx("div",{dangerouslySetInnerHTML:{__html:l}}):s.jsx("pre",{className:"m-0 px-3 py-2.5 font-mono text-gray-800 dark:text-gray-200",children:s.jsx("code",{children:n})})})]})}function j8(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(n=>typeof n=="string").join(""):""}function p2({children:e,streaming:n}){if(b.isValidElement(e)){const r=e.props,l=/language-([\w+-]+)/.exec(r.className??"")?.[1]??"";return s.jsx(tg,{language:l,code:j8(r.children).replace(/\n$/,""),highlight:!n})}return s.jsx("pre",{children:e})}function g2({node:e,children:n,...r}){return s.jsx("a",{...r,target:"_blank",rel:"noreferrer",children:n})}const N8={pre:e=>s.jsx(p2,{streaming:!0,children:e.children}),a:g2},C8={pre:e=>s.jsx(p2,{streaming:!1,children:e.children}),a:g2},x2=b.memo(function({text:n,streaming:r=!1}){return s.jsx(Xo,{remarkPlugins:[Zo],components:r?N8:C8,children:n})});function Br({src:e,alt:n,className:r}){const[l,o]=b.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"block cursor-zoom-in",onClick:()=>o(!0),children:s.jsx("img",{src:e,alt:n,className:r})}),l&&s.jsx(T8,{src:e,alt:n,onClose:()=>o(!1)})]})}function T8({src:e,alt:n,onClose:r}){return b.useEffect(()=>{const l=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),si.createPortal(s.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-10",onMouseDown:l=>{l.target===l.currentTarget&&r()},children:s.jsxs("div",{className:"anim-pop relative",children:[s.jsx("button",{type:"button","aria-label":p.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:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}),s.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 M8=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"]),E8=/^[a-z][a-z0-9+.-]*:\/\//i;function A8(e){const n=e.trim();if(n.length===0||n.length>200||/\s/.test(n)||E8.test(n)||n.startsWith("www."))return!1;const r=/\.([A-Za-z0-9]{1,8})$/.exec(n);if(!r)return!1;const l=r[1].toLowerCase();return/^\d+$/.test(l)?!1:M8.has(l)}const R8=512;function I8(e,n){const r=e.trim();if(r.length===0||r.length>R8||r.startsWith("~"))return null;const l=n!==null&&n.length>0?n:null,o=l!==null&&(l.includes("\\")||/^[A-Za-z]:/.test(l)),c=y=>{if(!o)return y;const k=y.replaceAll("\\","/");return/^[A-Za-z]:/.test(k)?k[0].toLowerCase()+k.slice(1):k},d=c(r),f=l===null?null:c(l),m=d.startsWith("/")||o&&/^[a-z]:/.test(d);let h=d;if(m){if(f===null||!d.startsWith(`${f}/`))return null;h=d.slice(f.length+1)}const g=[];for(const y of h.split("/"))if(!(y===""||y===".")){if(y===".."){if(g.length===0)return null;g.pop();continue}g.push(y)}return g.length>0?g.join("/"):null}const pb=3;function _8(e){const n=[],r=new Set;for(const l of e.matchAll(/`([^`\n]+)`/g)){const o=l[1].trim();!A8(o)||r.has(o)||(r.add(o),n.push(o))}return n}function L8({path:e}){const n=e.lastIndexOf("/"),r=n>=0?e.slice(0,n+1):"",l=n>=0?e.slice(n+1):e;return s.jsxs("span",{className:"flex min-w-0 items-baseline font-mono text-sm",children:[r&&s.jsx("span",{className:"min-w-0 shrink-[9999] truncate text-gray-400 dark:text-gray-500",children:r}),s.jsx("span",{className:"min-w-0 truncate font-semibold text-gray-800 dark:text-gray-100",children:l})]})}function gb({text:e,workspace:n,statFiles:r,onOpenFile:l}){const o=b.useMemo(()=>{const y=[],k=new Set;for(const w of _8(e)){const S=I8(w,n);S===null||k.has(S)||(k.add(S),y.push(S))}return y},[e,n]),[c,d]=b.useState(null);b.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]=b.useState(!1);if(c===null||c.length===0)return null;const h=f?c:c.slice(0,pb),g=c.length-h.length;return s.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:[s.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:[s.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:s.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:p.chat.filesInMessage(c.length)})]}),s.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[h.map(y=>s.jsxs("button",{type:"button",title:y,onClick:()=>l(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:[s.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:s.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),s.jsx(L8,{path:y}),s.jsx("span",{className:"min-w-0 flex-1"}),s.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:p.chat.openPreview})]},y)),(g>0||f)&&c.length>pb&&s.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?p.chat.showLess:p.chat.showMoreFiles(g),s.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:s.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})]})}const O8={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"},xb={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 Jo({state:e,size:n=13,label:r}){return e==="running"?s.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 ${xb.running}`}):s.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 ${xb[e]}`,children:[r&&s.jsx("title",{children:r}),s.jsx("path",{d:O8[e]})]})}function zo({sinceMs:e,offsetMs:n=0}){const[r,l]=b.useState(()=>Date.now());return b.useEffect(()=>{const o=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(o)},[]),e===void 0?s.jsx("span",{className:"animate-pulse",children:"…"}):s.jsx(s.Fragment,{children:$k(Math.max(0,n)+Math.max(0,r-e))})}function D8({item:e}){const[n,r]=b.useState(!1),l=b.useRef(null),o=e.stopReason!==void 0&&e.stopReason!=="completed",c=e.streaming?"running":o?"failed":"done",d=e.streaming?p.chat.workRunning:o?e.stopReason:p.chat.workDone;return s.jsxs("div",{ref:l,children:[s.jsxs("button",{type:"button",onClick:()=>{const f=n;r(m=>!m),f&&requestAnimationFrame(()=>l.current?.scrollIntoView({block:"nearest"}))},"aria-expanded":n,className:"sticky top-4 z-[4] flex w-full items-center gap-2 bg-white px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800",children:[s.jsx(Jo,{state:c,label:d}),s.jsx("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:p.chat.thinking}),s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.streaming?s.jsx(zo,{sinceMs:e.startedAtMs}):e.durationMs!==void 0?Mn(e.durationMs):null}),o&&s.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(ra,{open:n,className:"text-gray-400"})]}),n&&s.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:s.jsx(x2,{text:e.thinking,streaming:e.streaming})})]})}const z8=/\x1b(?:\[[0-9:;<=>?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\^_])/g,U8=/\x1b(?:\[[0-9:;<=>?]*[ -/]*|\][^\x07]*)?$/;function y2(e){return e.includes("\x1B")?e.replace(z8,"").replace(U8,""):e}function $8({onDecide:e}){const[n,r]=b.useState(!1),l=async o=>{r(!0);try{await e(o)}finally{r(!1)}};return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(we,{size:"sm",variant:"primary",disabled:n,onClick:()=>{l("allow")},children:p.chat.approve}),s.jsx(we,{size:"sm",disabled:n,onClick:()=>{l("deny")},children:p.chat.deny})]})}function b2(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 B8(e){let n=0;for(const r of e)(r.kind==="user_text"||r.kind==="user_image")&&(n+=1);return n}function v2(e,n){try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"){const l=r[n];if(typeof l=="string"&&l.length>0)return l}}catch{}return null}function k2(e){return v2(e,"agent_id")}function H8(e){return v2(e,"description")}function P8(e,n,r){return w2(e.items.slice(b2(e.items)),n,{running:r})}function F8(e,n,r,l){const o=e.items,c=o.findIndex(m=>m.kind==="tool_call"&&m.subagentSessionId===l||m.kind==="subagent"&&m.sessionId===l);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 w2(o.slice(d,f),n,{running:f===o.length&&r})}function w2(e,n,r){const l=[{sessionId:n,agentId:null,description:null,running:r.running,depth:0,origin:[],parentId:null}],o=new Set([n]),c=(f,m,h,g,y,k,w)=>{if(o.has(f))return;o.add(f);const S=[...y,f],T=m.firstTsMs??m.firstSeenLocalMs,E=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;l.push({sessionId:f,agentId:m.meta?.agentId??k,description:w,running:h,depth:S.length,origin:S,parentId:g,...T!==void 0?{startedMs:T}:{},...E!==void 0?{elapsedMs:E}:{}}),d(m.items,f,S)},d=(f,m,h)=>{for(const g of f)g.kind==="tool_call"&&g.subagent&&g.subagentSessionId?c(g.subagentSessionId,g.subagent,!g.outputComplete,m,h,k2(g.argumentsText),H8(g.argumentsText)):g.kind==="subagent"&&c(g.sessionId,g.model,!1,m,h,null,null)};return d(e,n,[]),l}function q8(e){const n=e.items;for(let r=b2(n);r<n.length;r++){const l=n[r];if(l.kind==="tool_call"&&l.subagent!==void 0||l.kind==="subagent")return!0}return!1}function V8(e,n){if(n.length===0)return null;let r=e;for(const l of n){const o=r.subagents.get(l);if(!o)return null;r=o}return r}const Hu=200,bo=46,lh=32,yb=10,yu=6;function G8(e){const n=new Map;for(const g of e){if(g.parentId===null)continue;const y=n.get(g.parentId);y?y.push(g):n.set(g.parentId,[g])}const r=new Map;let l=0;const o=g=>{const y=n.get(g.sessionId)??[];let k;if(y.length===0)k=l++;else{const w=y.map(o);k=(w[0]+w[w.length-1])/2}return r.set(g.sessionId,k),k};for(const g of e)g.parentId===null&&o(g);const c=e.map(g=>({node:g,x:yu+g.depth*(Hu+lh),y:yu+(r.get(g.sessionId)??0)*(bo+yb)})),d=new Map(c.map(g=>[g.node.sessionId,g])),f=[];for(const g of c){if(g.node.parentId===null)continue;const y=d.get(g.node.parentId);if(!y)continue;const k=y.x+Hu,w=y.y+bo/2,S=g.x,T=g.y+bo/2,E=k+lh/2;f.push({fromId:y.node.sessionId,toId:g.node.sessionId,path:w===T?`M ${k} ${w} H ${S}`:`M ${k} ${w} H ${E} V ${T} H ${S}`})}const m=e.reduce((g,y)=>Math.max(g,y.depth),0),h=Math.max(1,l);return{width:yu*2+(m+1)*Hu+m*lh,height:yu*2+h*bo+(h-1)*yb,nodes:c,edges:f}}function Zh(e,n,r){const l=r.find(c=>c.sessionId===e.sessionId),o=e.agentId??l?.agentId??null;if(o!==null){const c=n.find(d=>d.agentId===o);return c?c.name?.length?c.name:c.agentId:o}return l?.title??null}function Jh(e){return e.length>8?e.slice(-8):e}function S2({sessionId:e,model:n,running:r,ctx:l,agentId:o=null}){const{agents:c}=on(),{sessions:d}=dl(),f=Zh({sessionId:e,agentId:n.meta?.agentId??o},c,d)??p.chat.subagent,m=O3(l.pendingApprovals.keys(),[...l.origin,e]),h=`${p.chat.subagent} ${f}${m?` · ${p.chat.approvalWaiting}`:""}`;return s.jsxs("button",{type:"button","aria-label":h,title:h,onClick:()=>l.onOpenSubagent?.(e,l.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:[s.jsx(na,{id:n.meta?.agentId??o??e,name:f,size:16}),s.jsx("span",{className:"min-w-0 truncate text-xs font-medium text-gray-700 dark:text-gray-300",children:f}),e&&s.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:Jh(e)}),r&&s.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&&s.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}),s.jsx("span",{className:"min-w-0 flex-1"})]})}const bb=new Set(["exec_command","input_command","run_subagent","input_subagent"]),nd=new Set(["read_file","edit_file","write_file"]);function j2(e){const n=e.split("/").filter(r=>r.length>0);return n.length<=2?e:`…/${n[n.length-2]}/${n[n.length-1]}`}function W8(e,n){if(e==="exec_command"){const r=ad(n,"cmd");if(r!==null)return`$ ${r.value.replace(/\s+/g," ").trim()}`}if(nd.has(e)){const r=ad(n,"file_path");if(r!==null)return j2(r.value.replace(/\s+/g," ").trim())}return n.replace(/\s+/g," ").trim()}function K8(e,n,r=!0){if(bb.has(e)||nd.has(e)){const l=ad(n,"description");if(l!==null){if(!l.complete&&!r)return null;const o=l.value.replace(/\s+/g," ").trim();if(o)return o}if(bb.has(e))return null}if(nd.has(e)){const l=ad(n,"file_path");if(l!==null){if(!l.complete&&!r)return null;const o=l.value.replace(/\s+/g," ").trim();if(o)return j2(o)}}return null}function Y8(e,n){if(!nd.has(e))return null;let r;try{r=JSON.parse(n)}catch{return null}if(r===null||typeof r!="object")return null;const l=r,o=[],c=(d,f)=>{f!==void 0&&(typeof f=="string"&&f.includes(`
|
|
165
|
-
`)?o.push(`${d}:
|
|
166
|
-
${f}`):o.push(`${d}: ${typeof f=="string"?f:JSON.stringify(f)}`))};return c("file_path",l.file_path),e==="read_file"?(c("offset",l.offset),c("limit",l.limit)):e==="edit_file"?(c("old_string",l.old_string),c("new_string",l.new_string),l.replace_all===!0&&c("replace_all",!0)):e==="write_file"&&c("content",l.content),o.join(`
|
|
167
|
-
`)}function ad(e,n){const r=`"${n}"`,l=e.indexOf(r);if(l===-1)return null;let o=l+r.length;for(;/\s/.test(e[o]??"");)o+=1;if(e[o]!==":")return null;for(o+=1;/\s/.test(e[o]??"");)o+=1;if(e[o]!=='"')return null;o+=1;let c="",d=!1;for(;o<e.length;o+=1){const f=e[o];if(d){c+=f==="n"?`
|
|
168
|
-
`:f==="t"?" ":f,d=!1;continue}if(f==="\\"){d=!0;continue}if(f==='"')return{value:c,complete:!0};c+=f}return{value:c,complete:!1}}function Q8({item:e,ctx:n}){const[r,l]=b.useState(!1),o=b.useRef(!1),c=b.useRef(null),d=n.pendingApprovals.get(Jl(n.origin,e.toolCallId)),f=W8(e.name,e.argumentsText),m=b.useMemo(()=>y2(e.output),[e.output]),h=K8(e.name,e.argumentsText,!e.callStreaming),g=e.callComplete&&!e.outputComplete&&!d,y=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0,k=e.callStopReason!==void 0&&e.callStopReason!=="completed"||e.outputStopReason!==void 0&&e.outputStopReason!=="completed",w=d?"waiting":g||e.callStreaming?"running":k?"failed":"done",S=e.decision?`${e.decision==="allow"?p.chat.decisionAllow:p.chat.decisionDeny} · ${e.decisionSource==="manual"?p.chat.decisionManual:p.chat.decisionAuto}`:null,T=e.decision==="deny"&&e.outputStopReason==="aborted",E=d?p.chat.approvalWaiting:w==="running"?p.chat.workRunning:w==="done"?S??p.chat.workDone:T?S??void 0:e.outputStopReason??e.callStopReason;return s.jsxs("div",{ref:c,children:[s.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{o.current=!0;const M=r;l(L=>!L),M&&requestAnimationFrame(()=>c.current?.scrollIntoView({block:"nearest"}))},className:"sticky top-4 z-[4] flex w-full items-center gap-2 bg-white px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800",children:[s.jsx(Jo,{state:w,label:E}),s.jsx("span",{className:"shrink-0 truncate font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:e.name||p.chat.unknownTool}),h&&s.jsx("span",{className:"min-w-0 shrink truncate text-xs text-gray-500 dark:text-gray-400",children:h}),s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.durationMs!==void 0?Mn(e.durationMs):g?s.jsx(zo,{sinceMs:e.approvalAtMs??e.callStartedAtMs,offsetMs:y}):d?y>0?Mn(y):null:e.callStreaming?e.argStartedAtMs!==void 0?s.jsx(zo,{sinceMs:e.argStartedAtMs}):s.jsx("span",{className:"animate-pulse",children:"…"}):null}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(ra,{open:r,className:"text-gray-400"})]}),d&&s.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:[s.jsxs("div",{className:"mb-2 flex items-start gap-2 sm:items-center",children:[s.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||p.chat.unknownTool}),s.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:f})]}),(()=>{const M=Y8(e.name,e.argumentsText);return M!==null?s.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:M}):null})(),s.jsx($8,{onDecide:M=>n.onApprove(e.toolCallId,M,n.origin)})]}),r&&s.jsxs("div",{className:"anim-fade",children:[e.argumentsText&&s.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)&&s.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:[m,e.outputStreaming&&s.jsx("span",{className:"animate-pulse",children:"▌"})]}),e.images&&e.images.length>0&&s.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((M,L)=>s.jsx(Br,{src:M,alt:p.chat.toolImageAlt,className:"max-h-40 max-w-full rounded-md border border-gray-200 dark:border-gray-700"},L))})]}),e.subagent&&s.jsx("div",{className:"px-3 pb-2 pt-2",children:s.jsx(S2,{sessionId:e.subagentSessionId??"",model:e.subagent,running:!e.outputComplete,agentId:k2(e.argumentsText),ctx:n})})]})}function X8({item:e}){if(e.running)return s.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:[s.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}),p.chat.compactionRunning(e.mode)]});const n=e.status==="completed"?p.chat.compactionDone(e.mode):p.chat.compactionFailed(e.status??"failed",e.errorMessage);return s.jsx("p",{className:"my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:n})}const ng=-1,Uo="M21 12A9 9 0 1 1 12 3M17 12A5 5 0 1 1 12 7M12 12L15 9V5L18 2V6H22L19 9H15";function bu(e){const n=e.trim();if(n==="")return ng;const r=/^(\d+(?:\.\d+)?)([km])?$/i.exec(n);if(!r)return null;const l=r[2]?.toLowerCase()==="m"?1e6:r[2]?.toLowerCase()==="k"?1e3:1,o=Math.round(Number(r[1])*l);return o>0?o:null}const Z8="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 J8({images:e,showFull:n,onExpand:r}){return e.length===0?null:n?s.jsx("div",{className:"mt-1.5 flex max-w-[88%] flex-wrap justify-end gap-1.5 md:max-w-[75%]",children:e.map((l,o)=>s.jsx(Br,{src:l,alt:p.chat.imageAlt,className:"max-h-40 max-w-full rounded-md"},o))}):s.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:[s.jsx(Pe,{d:Z8,size:12,className:"shrink-0"}),p.chat.goalRoundImages(e.length)]})}function eI({round:e,objective:n,images:r=[]}){const[l,o]=b.useState(!1),c=r.length>0&&(e===1||l);return n!==void 0&&n!==""?s.jsxs("div",{className:"anim-msg my-4 flex flex-col items-end",children:[s.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:s.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:n})}),s.jsx(J8,{images:r,showFull:c,onExpand:()=>o(!0)}),s.jsxs("p",{className:"mt-1 flex items-center gap-1.5 px-0.5 text-xs text-gray-400 dark:text-gray-500",children:[s.jsx(Pe,{d:Uo,size:12,className:"shrink-0"}),p.chat.goalRoundBanner(e)]})]}):s.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:[s.jsx(Pe,{d:Uo,className:"text-gray-400 dark:text-gray-500"}),p.chat.goalRoundBanner(e)]})}function tI({goal:e}){const n=e.budget>0&&e.budget!==ng?`${yt(e.used)}/${yt(e.budget)}`:yt(e.used),r=e.status!=="active";return s.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:[s.jsx(Pe,{d:Uo,className:"shrink-0 text-gray-400 dark:text-gray-500"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",title:e.objective,children:e.objective}),s.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:p.chat.goalProgress(e.rounds,n)}),s.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:p.chat.goalStatus[e.status]})]})}function nI(e){return e.agentName&&e.agentName!==e.agentId?`${e.agentName} (${e.agentId})`:e.agentId}const ep="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 aI({origin:e}){const n=aa(),r=p.chat.handoffFrom(nI(e));if(!e.sessionId)return s.jsx("p",{className:ep,children:r});const l=e.sessionId;return s.jsxs("button",{type:"button",title:p.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${l}`),className:`${ep} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[r,s.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function rI({origin:e}){const n=aa(),r=e.sessionId;return s.jsxs("button",{type:"button",title:p.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${r}`),className:`${ep} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[p.chat.modelSwitchFrom(e.prevModelId),s.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function sI({origin:e}){return s.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:[p.chat.scheduledFrom(e.name),e.firedAt&&s.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:wa(e.firedAt)})]})}const ag="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 lI(e,n,r){return e==="zh"&&r?r:n}function oi(e,n){return e==="zh"?n.shortDescriptionZh||n.shortDescription||n.description:n.shortDescription||n.description}function iI(e,n,r){const l=r.trim().toLowerCase();return l?e.filter(o=>o.name.toLowerCase().includes(l)||oi(n,o).toLowerCase().includes(l)):e}function oI(e,n){return e.map(r=>({name:r.name,cmd:`/${r.name}`,desc:oi(n,r)}))}function vb({names:e}){return s.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:[s.jsx(Pe,{d:ag,className:"text-gray-400 dark:text-gray-500"}),p.chat.skillsBanner(e)]})}const tp="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 kb({files:e}){const n=p.chat.attachedFilesBanner(e.map(Y3));return s.jsxs("p",{title:n,className:"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:[s.jsx(Pe,{d:tp,className:"shrink-0 text-gray-400 dark:text-gray-500"}),s.jsx("span",{className:"min-w-0 truncate",children:n})]})}const cI=m3,uI=g3;function dI(e,n){const r=n.trim().toLowerCase();return r?e.filter(l=>l.agentId.toLowerCase().includes(r)||(l.name??"").toLowerCase().includes(r)):e}function fI({handoffTarget:e,pendingModel:n,canSwitchModel:r,sessionBusy:l}){return e?"handoff":!n||!r?"post":l?"blocked":"model"}function io({icon:e,value:n,compactValue:r,label:l,display:o="flex"}){return s.jsxs("span",{title:l,"aria-label":l,className:`${o} items-center gap-1`,children:[s.jsx(Pe,{d:e}),r!==void 0&&r!==n?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sm:hidden",children:r}),s.jsx("span",{className:"hidden sm:inline",children:n})]}):n]})}function mI({stats:e,assistantText:n,cost:r,atMs:l}){const[o,c]=b.useState(!1),{currency:d}=Cs(),{locale:f}=Pa(),m=e?.tokensByBucket,h=m?m.cacheRead+m.cacheWrite:0,g=()=>{const y=n?.trim()||e===null?n??"":A3(e,{stats:p.chat.statsLabel,input:p.chat.statInput,cached:p.chat.statCached,output:p.chat.statOutput,parenOpen:p.chat.statParenOpen,parenClose:p.chat.statParenClose});navigator.clipboard?.writeText(y).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})};return s.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:[s.jsxs("span",{className:"no-scrollbar flex min-w-0 items-center gap-x-2 overflow-x-auto sm:gap-x-3",children:[l!==void 0&&s.jsx("span",{children:Pk(l,f)}),e&&m&&s.jsxs(s.Fragment,{children:[s.jsx(io,{icon:gn.input,value:yt(h),label:p.chat.statInput}),s.jsx(io,{icon:gn.output,value:yt(m.output),label:p.chat.statOutput}),s.jsx(io,{icon:gn.tps,value:Gu(e.outputTps),label:p.chat.statTps,display:"hidden sm:flex"}),r!=null&&s.jsx(io,{icon:gn.cost,value:er(r,d),compactValue:er(r,d,{compact:!0}),label:`${p.common.cost}(${d})`}),s.jsx(io,{icon:gn.elapsed,value:Mn(e.elapsedDeltaMs),compactValue:Mn(e.elapsedDeltaMs,{compact:!0}),label:p.chat.statElapsed})]})]}),s.jsx("button",{type:"button",title:o?p.common.copied:p.chat.copyReply,"aria-label":p.chat.copyReply,onClick:g,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:s.jsx(Pe,{d:o?gn.check:gn.copy})})]})}const hI=1200,pI="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 oo({atMs:e,text:n,align:r="left"}){const{locale:l}=Pa(),[o,c]=b.useState(!1),d=()=>{n!==void 0&&(navigator.clipboard.writeText(n),c(!0),setTimeout(()=>c(!1),hI))};return s.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&&s.jsx("span",{className:"text-[11px] text-gray-400",children:Pk(e,l)}),n!==void 0&&s.jsx("button",{type:"button",title:o?p.common.copied:p.chat.copyMessage,"aria-label":p.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:s.jsx(Pe,{d:o?gn.check:gn.copy})})]})}const gI=2e3;function xI({item:e,ctx:n}){const r=e.gaveUp?"gaveUp":e.retrying?"retried":"waiting",l=r==="waiting"&&e.plannedDelayMs!==void 0&&e.plannedDelayMs>=gI&&e.arrivedAtMs!==void 0?e.arrivedAtMs+e.plannedDelayMs:null,[o,c]=b.useState(()=>Date.now()),[d,f]=b.useState(!1);b.useEffect(()=>{if(l===null||Date.now()>=l)return;const k=setInterval(()=>{c(Date.now()),Date.now()>=l&&clearInterval(k)},250);return()=>clearInterval(k)},[l]);const m=l!==null?l-o:0,h=l!==null&&m>0,g=h?Math.ceil(m/1e3):void 0,y=h&&n.origin.length===0&&(n.onRetryNow!==void 0||n.onGiveUp!==void 0);return s.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:[s.jsx("span",{children:p.chat.reconnect(e.status,r,e.attempt,g)}),y&&s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[n.onRetryNow&&s.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:p.chat.reconnectRetryNow}),n.onGiveUp&&s.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:p.chat.reconnectGiveUp})]})]})}function N2({item:e,ctx:n}){switch(e.kind){case"user_text":{const r=tw(e.text);if(r)return s.jsx(aI,{origin:r});const l=aw(e.text);if(l)return s.jsx(rI,{origin:l});const o=rw(e.text),c=o?o.rest:e.text,d=nw(c),f=d?d.rest:c,m=Jk(f),{text:h,images:g,files:y}=Xu(m?m.rest:f);return o?s.jsxs(s.Fragment,{children:[m&&s.jsx(vb,{names:m.skills}),s.jsx(eI,{round:o.round,objective:h,images:g})]}):s.jsxs(s.Fragment,{children:[d&&s.jsx(sI,{origin:d.origin}),m&&s.jsx(vb,{names:m.skills}),h&&s.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[s.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:s.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:h})}),s.jsx(oo,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:h,align:"right"})]}),y.length>0&&s.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[s.jsx(kb,{files:y}),s.jsx(oo,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]}),g.map((k,w)=>s.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[s.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:s.jsx(Br,{src:k,alt:p.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),s.jsx(oo,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]},w))]})}case"user_steering":{const{text:r,images:l,files:o}=Xu(e.text),c=[...l,...e.images??[]];return s.jsxs("div",{className:"anim-msg group my-2 flex flex-col items-end",children:[s.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:[s.jsxs("div",{className:"flex items-start gap-1.5",children:[s.jsx(Pe,{d:pI,className:"mt-1 shrink-0 text-gray-400 dark:text-gray-500"}),s.jsxs("p",{className:"wrap-anywhere whitespace-pre-wrap text-sm leading-relaxed text-gray-800 dark:text-gray-100",children:[s.jsx("span",{className:"mr-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400",children:p.chat.userSteering}),r]})]}),c.length>0&&s.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:c.map((d,f)=>s.jsx(Br,{src:d,alt:p.chat.imageAlt,className:"max-h-28 max-w-full rounded-md"},f))}),o.length>0&&s.jsx("div",{className:"flex justify-end",children:s.jsx(kb,{files:o})})]}),s.jsx(oo,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:r,align:"right"})]})}case"user_image":return s.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[s.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:s.jsx(Br,{src:e.imageUrl,alt:p.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),s.jsx(oo,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]});case"assistant_text":return s.jsxs("div",{className:"md-body anim-msg my-3 text-base leading-relaxed text-gray-800 dark:text-gray-100",children:[s.jsx(x2,{text:e.text,streaming:e.streaming}),e.streaming&&s.jsx("span",{className:"animate-pulse text-gray-400",children:"▌"}),e.stopReason&&e.stopReason!=="completed"&&s.jsxs("span",{className:"ml-1 font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),n.origin.length>0&&!e.streaming&&n.onOpenFile&&n.statFiles&&s.jsx(gb,{text:e.text,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile})]});case"thinking":return s.jsx(D8,{item:e});case"tool_call":return s.jsx(Q8,{item:e,ctx:n});case"subagent":return s.jsx("div",{className:"anim-msg my-2",children:s.jsx(S2,{sessionId:e.sessionId,model:e.model,running:!1,ctx:n})});case"abort":return s.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:p.chat.aborted(e.reason)});case"reconnect":return s.jsx(xI,{item:e,ctx:n});case"compaction":return s.jsx(X8,{item:e});case"task_stats":return s.jsxs(s.Fragment,{children:[n.origin.length===0&&n.onOpenFile&&n.statFiles&&e.assistantText.trim()!==""&&s.jsx(gb,{text:e.assistantText,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile}),s.jsx(mI,{stats:e.stats,assistantText:e.assistantText,cost:e.stats?n.taskCost?.(e.stats)??null:null,...e.atMs!==void 0?{atMs:e.atMs}:{}})]})}}function yI(e){let n=0,r=0,l,o;const c=m=>{m!==void 0&&(l===void 0||m<l)&&(l=m)},d=(m,h)=>{if(h<=0)return;if(m===void 0){r+=h;return}c(m);const g=m+h;(o===void 0||g>o)&&(o=g)};for(const m of e){if(m.kind==="thinking"){c(m.startedAtMs),m.durationMs!==void 0&&d(m.startedAtMs,m.durationMs);continue}if(m.kind!=="tool_call"||(n+=1,c(m.argStartedAtMs??m.callStartedAtMs??m.approvalAtMs),m.durationMs===void 0))continue;const h=m.argStartedAtMs!==void 0&&m.callStartedAtMs!==void 0?Math.min(m.durationMs,Math.max(0,m.callStartedAtMs-m.argStartedAtMs)):0;d(m.argStartedAtMs,h),d(m.approvalAtMs??m.callStartedAtMs,m.durationMs-h)}const f=l!==void 0&&o!==void 0?o-l:0;return{steps:n,durationMs:f+r,...l!==void 0?{startMs:l}:{}}}function bI(e){return e.kind==="thinking"||e.kind==="tool_call"}function vI(e,n){return e.kind==="thinking"?e.streaming:e.kind==="tool_call"?e.callStreaming||e.outputStreaming||e.callComplete&&!e.outputComplete?!0:n.pendingApprovals.has(Jl(n.origin,e.toolCallId)):!1}function kI(e,n){return e.some(r=>r.kind==="tool_call"&&n.pendingApprovals.has(Jl(n.origin,r.toolCallId)))}function wI({items:e,ctx:n,isLast:r}){const l=e.some(S=>vI(S,n)),o=r&&n.taskRunning||l,c=kI(e,n),[d,f]=b.useState(r),m=b.useRef(!1),h=b.useRef(null);b.useEffect(()=>{m.current||f(r)},[r]);const g=d||c,{steps:y,durationMs:k,startMs:w}=yI(e);return s.jsxs("div",{ref:h,className:"anim-msg my-2 overflow-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("button",{type:"button","data-group-header":!0,"aria-expanded":g,onClick:()=>{m.current=!0;const S=d&&!c;f(T=>!T),S&&requestAnimationFrame(()=>h.current?.scrollIntoView({block:"nearest"}))},className:"sticky -top-4 z-[5] 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",children:[s.jsx(Jo,{state:o?"running":"done",size:12}),s.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?p.chat.workRunning:p.chat.workDone}),y>0&&s.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:inline",children:p.chat.workGroupSteps(y)}),l?w!==void 0&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:s.jsx(zo,{sinceMs:w})}):k>0&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:Mn(k)}),c&&!g&&s.jsxs(s.Fragment,{children:[s.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:p.chat.approvalWaiting}),s.jsx("span",{role:"img",title:p.chat.approvalWaiting,"aria-label":p.chat.approvalWaiting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500 sm:hidden"})]}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(ra,{open:g,className:"text-gray-400"})]}),g&&s.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(S=>s.jsx(N2,{item:S,ctx:n},S.id))})]})}function SI(){let e=!0,n=null,r=null;return{get stick(){return e},wheel(l){l<0&&(e=!1)},touchStart(l){r=l},touchMove(l){r!==null&&l>r&&(e=!1),r=l},touchEnd(){r=null},scrolled(l){const o=l.scrollHeight-l.scrollTop-l.clientHeight,c=n;if(n=l.scrollTop,c===null){e=o<80;return}if(l.scrollTop<c&&o>1){e=!1;return}o<80&&(e=!0)},resume(){e=!0,n=null}}}function jI({items:e,ctx:n}){const r=[];let l=[];const o=()=>{l.length>0&&(r.push({type:"group",items:l}),l=[])};for(const h of e)bI(h)?l.push(h):(o(),r.push({type:"single",item:h}));o();const c=(h,g)=>h.type==="group"?s.jsx(wI,{items:h.items,ctx:n,isLast:g===r.length-1},`wg-${h.items[0].id}`):s.jsx(N2,{item:h.item,ctx:n},h.item.id),d=[];let f=[];const m=()=>{if(f.length===0)return;const h=f[0].seg,g=h.type==="group"?h.items[0].id:h.item.id,y=f;f=[],d.push(s.jsx("div",{className:"group",children:y.map(k=>c(k.seg,k.i))},`turn-${g}`))};for(let h=0;h<r.length;h++){const g=r[h];if(g.type==="single"&&(g.item.kind==="user_text"||g.item.kind==="user_image")){m(),d.push(n.origin.length===0?s.jsx("div",{"data-outline-anchor":g.item.id,children:c(g,h)},`anchor-${g.item.id}`):c(g,h));continue}f.push({seg:g,i:h}),g.type==="single"&&g.item.kind==="task_stats"&&m()}return m(),s.jsx(s.Fragment,{children:d})}const NI=300;function C2({items:e,version:n,ctx:r,scrollElRef:l,outline:o,older:c}){const d=b.useRef(null),f=b.useRef(null),m=f.current??=SI(),[h,g]=b.useState(!1),y=b.useRef(!1),k=b.useRef(null),w=()=>{k.current!==null&&(cancelAnimationFrame(k.current),k.current=null),y.current=!1};b.useEffect(()=>()=>w(),[]);const S=b.useRef(null),T=()=>{const I=d.current;g(!y.current&&!m.stick&&I!==null&&I.scrollHeight-I.scrollTop-I.clientHeight>1)},E=b.useRef(c);E.current=c;const M=b.useRef(c?.prependedCount??0),L=b.useRef(0),O=I=>{const F=E.current;!F||!F.hasMore||F.loading||F.error!==null||I.scrollTop<NI&&F.onLoad()},P=()=>{const I=d.current;if(!I)return;const F=S.current;S.current=I.scrollTop,y.current&&F!==null&&I.scrollTop<F-1&&w(),m.scrolled({scrollTop:I.scrollTop,scrollHeight:I.scrollHeight,clientHeight:I.clientHeight}),O(I),T()};b.useLayoutEffect(()=>{const I=d.current,F=c?.prependedCount??0;I&&F>M.current&&!m.stick&&!y.current&&(I.scrollTop+=I.scrollHeight-L.current),M.current=F,I&&(L.current=I.scrollHeight),I&&m.stick&&!y.current&&(I.scrollTop=I.scrollHeight),T()},[n,m,c?.prependedCount]);const H=()=>{const I=d.current;if(!I)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){m.resume(),I.scrollTop=I.scrollHeight,T();return}w(),y.current=!0,I.scrollHeight-I.clientHeight-I.scrollTop>3*I.clientHeight&&(I.scrollTop=I.scrollHeight-4*I.clientHeight);let K=performance.now();const Z=z=>{k.current=null;const B=d.current;if(!B||!y.current)return;const A=Math.min(.05,Math.max(.001,(z-K)/1e3));K=z;const $=B.scrollHeight-B.clientHeight-B.scrollTop;if($<=1){y.current=!1,m.resume(),B.scrollTop=B.scrollHeight,T();return}const q=Math.max($*Math.min(1,A*10),3200*A);B.scrollTop+=Math.min(q,$),k.current=requestAnimationFrame(Z)};k.current=requestAnimationFrame(Z),T()};return s.jsxs("div",{className:"relative h-full min-h-0",children:[s.jsx("div",{ref:I=>{d.current=I,l&&(l.current=I)},onScroll:P,onWheel:I=>{m.wheel(I.deltaY),I.deltaY<0&&w(),T()},onTouchStart:I=>{const F=I.touches[0];F&&m.touchStart(F.clientY)},onTouchMove:I=>{const F=I.touches[0];F&&m.touchMove(F.clientY),y.current&&w(),T()},onTouchEnd:()=>m.touchEnd(),className:"anim-fade h-full overflow-y-auto px-4 py-4 md:px-6",children:s.jsxs("div",{className:"mx-auto max-w-3xl",children:[c&&e.length>0&&s.jsx("div",{className:"flex justify-center pb-2",children:c.loading?s.jsxs("span",{className:"flex items-center gap-2 py-1 text-xs text-gray-400 dark:text-gray-500",children:[s.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}),p.chat.loadingEarlier]}):c.error!==null?s.jsx("button",{type:"button",onClick:c.onLoad,className:"py-1 text-xs text-red-600 transition-colors duration-150 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:p.chat.loadEarlierRetry}):!c.hasMore&&c.prependedCount>0?s.jsx("span",{className:"py-1 text-xs text-gray-400 dark:text-gray-500",children:p.chat.historyBeginning}):null}),e.length===0?s.jsx(hr,{title:p.chat.emptyStream}):s.jsx(jI,{items:e,ctx:r})]})}),o,h&&s.jsx("button",{type:"button","aria-label":p.chat.jumpToLatest,title:p.chat.jumpToLatest,onClick:H,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:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M12 5v14M6 13l6 6 6-6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}const CI=128e3;function T2(e){const n=typeof e=="string"?Number(e):e;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:CI}const TI=/[\s"'/]on[a-z]+\s*=/i,MI=/href\s*=/i;function EI(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")||MI.test(n)||TI.test(n)?null:n}const ih=["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"],AI={firecrawl:3,"data-analysis":1,"web-design":2,"penguin-sdk":0};function M2(e){const n=AI[e];if(n!==void 0)return ih[n];let r=0;for(let l=0;l<e.length;l++)r=r*31+e.charCodeAt(l)>>>0;return ih[r%ih.length]}function Nd({icon:e,size:n=20,className:r=""}){const l=EI(e);return l?s.jsx("span",{"aria-hidden":!0,style:{width:n,height:n},className:`block shrink-0 [&>svg]:block [&>svg]:h-full [&>svg]:w-full ${r}`,dangerouslySetInnerHTML:{__html:l}}):s.jsx(Pe,{d:ag,size:n,className:r})}const wb={viewBox:"-0.76 -0.47 28.6 28.6",path:s.jsxs(s.Fragment,{children:[s.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"}),s.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"}),s.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"}),s.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"}),s.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"}),s.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"})]})},RI={anthropic:{path:s.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:s.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:s.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:s.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:s.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:s.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:s.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:s.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":wb,"qwen-pay-as-you-go":wb,fireworks:{viewBox:"0 0 638 315",path:s.jsxs(s.Fragment,{children:[s.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"}),s.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"}),s.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:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 2.8 20.5 7.4v9.2L12 21.2 3.5 16.6V7.4L12 2.8Z"}),s.jsx("path",{d:"M3.5 7.4 12 12l8.5-4.6M12 12v9.2"})]})}};function ti({provider:e,className:n}){const r=RI[e];if(!r){const l=Wk(e);return s.jsxs("svg",{viewBox:"0 0 24 24",className:n,style:{"--tile-fg":l.fg,"--tile-fg-dark":l.fgDark},"aria-hidden":!0,children:[s.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:l.bg}),s.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:Kk(e)})]})}return s.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 jt="https://openrouter.ai/api/v1",Ur="https://api.siliconflow.cn/v1",Kl="https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",Yl="https://dashscope.aliyuncs.com/compatible-mode/v1",el="https://api.fireworks.ai/inference/v1",Ns=[{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:jt},{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:el},{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:Ur},{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:Kl},{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:Yl},{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 Kt(e,n,r){const l=o=>Math.round(o/7*1e6)/1e6;return De(l(e),l(n),l(r))}function De(e,n,r){return{unit:"usd_per_mtok",cache_read:e,cache_write:n,output:r}}var E2=[{modelId:"deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"deepseek",contextWindow:1e6,pricing:Kt(.02,1,2),supportsVision:!1},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"deepseek",contextWindow:1e6,pricing:Kt(.025,3,6),supportsVision:!1},{modelId:"anthropic/claude-fable-5",displayName:"Claude Fable 5",provider:"openrouter",contextWindow:1e6,pricing:De(1,12.5,50),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"anthropic/claude-opus-5",displayName:"Claude Opus 5",provider:"openrouter",contextWindow:1e6,pricing:De(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"anthropic/claude-opus-4.8",displayName:"Claude Opus 4.8",provider:"openrouter",contextWindow:1e6,pricing:De(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"anthropic/claude-opus-4.7",displayName:"Claude Opus 4.7",provider:"openrouter",contextWindow:1e6,pricing:De(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"anthropic/claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"openrouter",contextWindow:1e6,pricing:De(.2,2.5,10),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"deepseek/deepseek-v4-flash-0731",displayName:"DeepSeek V4 Flash 0731",provider:"openrouter",contextWindow:1e6,pricing:De(.018,.09,.18),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"deepseek/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"openrouter",contextWindow:1e6,pricing:De(.028,.14,.28),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"deepseek/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"openrouter",contextWindow:1e6,pricing:De(.003625,.435,.87),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"google/gemini-3.6-flash",displayName:"Gemini 3.6 Flash",provider:"openrouter",contextWindow:1048576,pricing:De(.15,1.5,7.5),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"google/gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"openrouter",contextWindow:1048576,pricing:De(.15,1.5,9),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"google/gemini-3.5-flash-lite",displayName:"Gemini 3.5 Flash-Lite",provider:"openrouter",contextWindow:1048576,pricing:De(.03,.3,2.5),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"inclusionai/ling-3.0-flash:free",displayName:"Ling 3.0 Flash (free)",provider:"openrouter",contextWindow:262144,pricing:De(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"minimax/minimax-m3",displayName:"MiniMax M3",provider:"openrouter",contextWindow:1048576,pricing:De(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"moonshotai/kimi-k3",displayName:"Kimi K3",provider:"openrouter",contextWindow:1e6,pricing:De(.3,3,15),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"moonshotai/kimi-k2.6",displayName:"Kimi K2.6",provider:"openrouter",contextWindow:262144,pricing:De(.2,.6,3.41),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"nvidia/nemotron-3-ultra-550b-a55b:free",displayName:"Nemotron 3 Ultra (free)",provider:"openrouter",contextWindow:1e6,pricing:De(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"openai/gpt-5.6-luna",displayName:"GPT-5.6 Luna",provider:"openrouter",contextWindow:1e6,pricing:De(.01,.125,.6),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"openai/gpt-5.6-sol",displayName:"GPT-5.6 Sol",provider:"openrouter",contextWindow:1e6,pricing:De(.5,6.25,30),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"openai/gpt-5.6-terra",displayName:"GPT-5.6 Terra",provider:"openrouter",contextWindow:1e6,pricing:De(.1,1.25,6),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"openai/gpt-5.5",displayName:"GPT-5.5",provider:"openrouter",contextWindow:1e6,pricing:De(.5,5,30),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"openrouter/free",displayName:"Free Models Router",provider:"openrouter",contextWindow:128e3,pricing:De(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"qwen/qwen3.8-max",displayName:"Qwen 3.8 Max",provider:"openrouter",contextWindow:1e6,pricing:De(.25,2.5,6),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"qwen/qwen3.6-35b-a3b",displayName:"Qwen 3.6 35B A3B",provider:"openrouter",contextWindow:262144,pricing:De(.14,.14,1),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"stepfun/step-3.7-flash",displayName:"Step 3.7 Flash",provider:"openrouter",contextWindow:256e3,pricing:De(.04,.2,1.15),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"tencent/hy3",displayName:"Hy3",provider:"openrouter",contextWindow:262144,pricing:De(.033,.132,.528),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"x-ai/grok-4.5",displayName:"Grok 4.5",provider:"openrouter",contextWindow:5e5,pricing:De(.3,2,6),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"xiaomi/mimo-v2.5",displayName:"MiMo-V2.5",provider:"openrouter",contextWindow:1048576,pricing:De(.0028,.14,.28),supportsVision:!0,clientType:"openai",baseUrl:jt},{modelId:"z-ai/glm-5.2",displayName:"GLM-5.2",provider:"openrouter",contextWindow:1e6,pricing:De(.221,1.19,3.74),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"z-ai/glm-5.1",displayName:"GLM-5.1",provider:"openrouter",contextWindow:204800,pricing:De(.1794,.966,3.036),supportsVision:!1,clientType:"openai",baseUrl:jt},{modelId:"accounts/fireworks/models/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"fireworks",contextWindow:1e6,pricing:De(.03,.14,.28),supportsVision:!1,clientType:"openai",baseUrl:el},{modelId:"accounts/fireworks/models/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"fireworks",contextWindow:1e6,pricing:De(.15,1.74,3.48),supportsVision:!1,clientType:"openai",baseUrl:el},{modelId:"accounts/fireworks/models/glm-5p2",displayName:"GLM-5.2",provider:"fireworks",contextWindow:1e6,pricing:De(.14,1.4,4.4),supportsVision:!1,clientType:"openai",baseUrl:el},{modelId:"accounts/fireworks/models/kimi-k3",displayName:"Kimi K3",provider:"fireworks",contextWindow:1e6,pricing:De(.3,3,15),supportsVision:!0,clientType:"openai",baseUrl:el},{modelId:"accounts/fireworks/models/kimi-k2p7-code",displayName:"Kimi K2.7 Code",provider:"fireworks",contextWindow:262144,pricing:De(.19,.95,4),supportsVision:!0,clientType:"openai",baseUrl:el},{modelId:"accounts/fireworks/models/minimax-m3",displayName:"MiniMax M3",provider:"fireworks",contextWindow:524288,pricing:De(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:el},{modelId:"deepseek-ai/DeepSeek-V4-Flash",displayName:"DeepSeek V4 Flash",provider:"siliconflow",contextWindow:1e6,pricing:Kt(.02,1,2),supportsVision:!1,clientType:"openai",baseUrl:Ur},{modelId:"deepseek-ai/DeepSeek-V4-Pro",displayName:"DeepSeek V4 Pro",provider:"siliconflow",contextWindow:1e6,pricing:Kt(.1,12,24),supportsVision:!1,clientType:"openai",baseUrl:Ur},{modelId:"meituan-longcat/LongCat-2.0",displayName:"LongCat 2.0",provider:"siliconflow",contextWindow:1e6,pricing:Kt(.1,5,20),supportsVision:!1,clientType:"openai",baseUrl:Ur},{modelId:"moonshotai/Kimi-K2.7-Code",displayName:"Kimi K2.7 Code",provider:"siliconflow",contextWindow:262144,pricing:Kt(1.3,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:Ur},{modelId:"Pro/moonshotai/Kimi-K2.6",displayName:"Kimi K2.6",provider:"siliconflow",contextWindow:262144,pricing:Kt(1.1,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:Ur},{modelId:"Pro/zai-org/GLM-5.1",displayName:"GLM-5.1",provider:"siliconflow",contextWindow:2e5,pricing:Kt(1.3,6,24),supportsVision:!1,clientType:"openai",baseUrl:Ur},{modelId:"Qwen/Qwen3.6-35B-A3B",displayName:"Qwen 3.6 35B A3B",provider:"siliconflow",contextWindow:262144,pricing:Kt(1.8,1.8,10.8),supportsVision:!0,clientType:"openai",baseUrl:Ur},{modelId:"zai-org/GLM-5.2",displayName:"GLM-5.2",provider:"siliconflow",contextWindow:1e6,pricing:Kt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Ur},{modelId:"deepseek-v4-flash-0731",displayName:"DeepSeek V4 Flash 0731",provider:"qwen-token-plan",contextWindow:1e6,pricing:Kt(.2,1,2),supportsVision:!1,clientType:"openai",baseUrl:Kl},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"qwen-token-plan",contextWindow:1e6,pricing:Kt(1,12,24),supportsVision:!1,clientType:"openai",baseUrl:Kl},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"qwen-token-plan",contextWindow:1048576,pricing:Kt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Kl},{modelId:"qwen3.8-max",displayName:"Qwen 3.8 Max",provider:"qwen-token-plan",contextWindow:1e6,pricing:Kt(1.5,12,36),supportsVision:!0,clientType:"openai",baseUrl:Kl},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-token-plan",contextWindow:1e6,pricing:Kt(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:Kl},{modelId:"deepseek-v4-flash-0731",displayName:"DeepSeek V4 Flash 0731",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Kt(.2,1,2),supportsVision:!1,clientType:"openai",baseUrl:Yl},{modelId:"kimi/kimi-k3",displayName:"Kimi K3",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:Kt(2,20,100),supportsVision:!0,clientType:"openai",baseUrl:Yl},{modelId:"qwen3.8-max",displayName:"Qwen 3.8 Max",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Kt(1.5,12,36),supportsVision:!0,clientType:"openai",baseUrl:Yl},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Kt(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:Yl},{modelId:"ZHIPU/GLM-5.2",displayName:"GLM-5.2",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:Kt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Yl},{modelId:"gemini-3.6-flash",displayName:"Gemini 3.6 Flash",provider:"google",contextWindow:1048576,pricing:De(.15,1.5,7.5),supportsVision:!0},{modelId:"gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"google",contextWindow:1048576,pricing:De(.15,1.5,9),supportsVision:!0},{modelId:"gemini-3.5-flash-lite",displayName:"Gemini 3.5 Flash-Lite",provider:"google",contextWindow:1048576,pricing:De(.03,.3,2.5),supportsVision:!0},{modelId:"gemini-3.1-flash-lite",displayName:"Gemini 3.1 Flash-Lite",provider:"google",contextWindow:1048576,pricing:De(.025,.25,1.5),supportsVision:!0},{modelId:"gemini-3.1-pro-preview",displayName:"Gemini 3.1 Pro (Preview)",provider:"google",contextWindow:1048576,pricing:De(.2,2,12),supportsVision:!0},{modelId:"gemini-3-flash-preview",displayName:"Gemini 3 Flash (Preview)",provider:"google",contextWindow:1048576,pricing:De(.05,.5,3),supportsVision:!0},{modelId:"claude-fable-5",displayName:"Claude Fable 5",provider:"anthropic",contextWindow:1e6,pricing:De(1,12.5,50),supportsVision:!0},{modelId:"claude-opus-4-8",displayName:"Claude Opus 4.8",provider:"anthropic",contextWindow:1e6,pricing:De(.5,6.25,25),supportsVision:!0},{modelId:"claude-opus-4-7",displayName:"Claude Opus 4.7",provider:"anthropic",contextWindow:1e6,pricing:De(.5,6.25,25),supportsVision:!0},{modelId:"claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"anthropic",contextWindow:1e6,pricing:De(.2,2.5,10),supportsVision:!0},{modelId:"claude-sonnet-4-6",displayName:"Claude Sonnet 4.6",provider:"anthropic",contextWindow:1e6,pricing:De(.3,3.75,15),supportsVision:!0},{modelId:"gpt-5.5",displayName:"GPT-5.5",provider:"openai",contextWindow:105e4,pricing:De(.5,5,30),supportsVision:!0},{modelId:"gpt-5.5-pro",displayName:"GPT-5.5 Pro",provider:"openai",contextWindow:105e4,pricing:De(30,30,180),supportsVision:!0},{modelId:"gpt-5.4",displayName:"GPT-5.4",provider:"openai",contextWindow:105e4,pricing:De(.25,2.5,15),supportsVision:!0},{modelId:"gpt-5.4-mini",displayName:"GPT-5.4 mini",provider:"openai",contextWindow:4e5,pricing:De(.075,.75,4.5),supportsVision:!0},{modelId:"gpt-5.4-nano",displayName:"GPT-5.4 nano",provider:"openai",contextWindow:4e5,pricing:De(.02,.2,1.25),supportsVision:!0},{modelId:"gpt-5.4-pro",displayName:"GPT-5.4 Pro",provider:"openai",contextWindow:105e4,pricing:De(30,30,180),supportsVision:!0},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"zhipu",contextWindow:1e6,pricing:De(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5.1",displayName:"GLM-5.1",provider:"zhipu",contextWindow:2e5,pricing:De(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5",displayName:"GLM-5",provider:"zhipu",contextWindow:2e5,pricing:De(.2,1,3.2),supportsVision:!1},{modelId:"kimi-k3",displayName:"Kimi K3",provider:"moonshot",contextWindow:1048576,pricing:Kt(2,20,100),supportsVision:!0},{modelId:"kimi-k2.6",displayName:"Kimi K2.6",provider:"moonshot",contextWindow:262144,pricing:Kt(1.1,6.5,27),supportsVision:!0},{modelId:"kimi-k2.5",displayName:"Kimi K2.5",provider:"moonshot",contextWindow:262144,pricing:Kt(.7,4,21),supportsVision:!0}];function rg(e,n){return E2.find(r=>r.provider===e&&r.modelId===n)}function Hr(e){return Ns.find(n=>n.id===e)}function II(e,n){const r=(n||e).toLowerCase(),l=o=>({envKey:`${o}_API_KEY`,envBaseUrlKey:`${o}_BASE_URL`});if(r.includes("gemini-3")||r.includes("gemini-embedding"))return l("GEMINI");if(r.includes("claude")&&(r.includes("4-7")||r.includes("4-8")||r.includes("-5")||r.includes("4-6")))return l("ANTHROPIC");if(r.includes("gpt-5.4")||r.includes("gpt-5.5"))return l("OPENAI");if(r.includes("glm-5"))return l("ZAI");if(r.includes("kimi-k3")||r.includes("kimi-k2.5")||r.includes("kimi-k2.6"))return l("MOONSHOT");if(r.includes("deepseek-v4"))return l("DEEPSEEK");if(r.includes("openai"))return l("OPENAI")}function _I(){return E2.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 Sb(e,n){if(e==="openrouter")return`https://openrouter.ai/${n}`;if(e==="qwen-token-plan")return`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]}`:Hr(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]}`:Hr(e)?.modelsUrl}if(e!=="custom")return Hr(e)?.modelsUrl}function wt(e,n){return!!e&&!!n&&e.provider===n.provider&&e.modelId===n.modelId}function A2(e){return{id:e,label:e,envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}}function R2(e,n){const r=n.trim().toLowerCase();if(!r)return!0;const l=Ns.find(o=>o.id===e.provider);return e.modelId.toLowerCase().includes(r)||(e.displayName??"").toLowerCase().includes(r)||e.provider.toLowerCase().includes(r)||(l?.label??"").toLowerCase().includes(r)}function I2(e,n){const r=n.trim()!=="",l=e.filter(f=>R2(f,n)),o=Ns.map(f=>({provider:f,rows:l.filter(m=>m.provider===f.id)})),d=[...new Set(l.map(f=>f.provider).filter(f=>!Ns.some(m=>m.id===f)))].sort().map(f=>({provider:A2(f),rows:l.filter(m=>m.provider===f)}));return[...o,...d].filter(f=>f.rows.length>0||!r&&f.provider.id==="custom")}function LI(e){return I2(e,"").flatMap(n=>n.rows)}function np(e){return!!e.credential?.apiKeyMasked}function _2(e){return e?[e.cacheRead,e.cacheWrite,e.output].every(n=>typeof n=="string"?n.trim()!==""&&Number(n)===0:n===0):!1}function jb(e,{showAll:n,query:r,selected:l,defaultModel:o}){const c=LI(e);return(n||!c.some(np)?c:c.filter(f=>np(f)||wt(f,l)||wt(f,o))).filter(f=>R2(f,r))}function No(e){return e.displayName??e.modelId}const OI="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 L2({items:e,itemKey:n,isCurrent:r,query:l,onQueryChange:o,searchPlaceholder:c,emptyText:d,onPick:f,renderRow:m,footer:h}){const[g,y]=b.useState(-1),k=g>=0&&g<e.length?n(e[g]):null,w=S=>{if(e.length!==0){if(S.key==="ArrowDown"){S.preventDefault(),y(T=>(T+1)%e.length);return}if(S.key==="ArrowUp"){S.preventDefault(),y(T=>T<=0?e.length-1:T-1);return}(S.key==="Enter"&&!S.shiftKey||S.key==="Tab")&&!S.nativeEvent.isComposing&&(S.preventDefault(),f(e[g>=0?g:0]))}};return s.jsxs("div",{className:"contents",onKeyDown:w,children:[s.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:s.jsx("input",{autoFocus:!0,value:l,onChange:S=>{o(S.target.value),y(-1)},placeholder:c,"aria-label":c,...yd,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"})}),s.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:d}),e.map(S=>{const T=n(S),E=r?.(S)??!1;return s.jsxs("button",{type:"button",ref:T===k?M=>M?.scrollIntoView({block:"nearest"}):void 0,onClick:()=>f(S),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 ${E?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}${T===k?" bg-gray-100 dark:bg-gray-800":""}`,children:[m(S),s.jsx("span",{className:"w-3 shrink-0 text-center text-xs",children:E?"✓":""})]},T)})]}),h]})}function O2({models:e,value:n,defaultModel:r,onPick:l}){const[o,c]=b.useState(""),[d,f]=b.useState(!1),m=jb(e,{showAll:d,query:o,selected:n,defaultModel:r}),h=d?0:jb(e,{showAll:!0,query:o,selected:n,defaultModel:r}).length-m.length;return s.jsx(L2,{items:m,itemKey:g=>`${g.provider}:${g.modelId}`,isCurrent:g=>wt(g,n),query:o,onQueryChange:c,searchPlaceholder:p.models.searchPlaceholder,emptyText:p.models.noSearchResults,onPick:l,renderRow:g=>s.jsxs(s.Fragment,{children:[s.jsx(ti,{provider:g.provider,className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:No(g)}),_2(g.pricing)&&s.jsx("span",{className:"shrink-0",children:s.jsx(sn,{tone:"yellow",children:p.models.freeBadge})}),!np(g)&&s.jsx("span",{role:"img",title:p.models.noKey,"aria-label":p.models.noKey,className:"shrink-0 text-gray-400 dark:text-gray-500",children:s.jsx(Pe,{d:OI,size:13})}),wt(g,r)&&s.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:p.models.default})]}),...h>0?{footer:s.jsx("div",{className:"border-t border-gray-100 dark:border-gray-800",children:s.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:p.models.showModelsWithoutKey(h)})})}:{}})}function D2({models:e,value:n,defaultModel:r,onChange:l,disabled:o,variant:c="pill"}){const[d,f]=b.useState(!1),m=e.find(y=>wt(y,n)),h=m?No(m):n?.modelId??"…",g=s.jsx(ti,{provider:m?.provider??n?.provider??"custom",className:"h-4 w-4 shrink-0"});return s.jsx(Sa,{open:d,setOpen:f,menuClass:`w-max min-w-56 ${c==="form"?"origin-top-left":"origin-top-right"}`,portal:{direction:"down",align:c==="form"?"left":"right"},button:c==="form"?s.jsxs("button",{type:"button",title:`${p.chat.chooseModel}:${h}`,"aria-label":p.chat.chooseModel,"aria-haspopup":"listbox","aria-expanded":d,disabled:o||e.length===0,onClick:()=>f(!d),className:`flex w-full items-center gap-2 text-left ${qo} ${Go.sm} disabled:cursor-not-allowed disabled:opacity-60`,children:[g,s.jsx("span",{className:"min-w-0 flex-1 truncate",children:h}),s.jsx(Fo,{className:"text-gray-400"})]}):s.jsxs("button",{type:"button",title:`${p.chat.chooseModel}:${h}`,"aria-label":p.chat.chooseModel,disabled:o||e.length===0,onClick:()=>f(!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:[g,s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:h}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:s.jsx(O2,{models:e,value:n,...r!==void 0?{defaultModel:r}:{},onPick:y=>{l({provider:y.provider,modelId:y.modelId}),f(!1)}})})}const DI=/^[\w-]*$/;function Nb(e,n){const r=e.slice(0,n),l=r.lastIndexOf("/");if(l<0||l>0&&!/\s/.test(r[l-1]))return null;const o=r.slice(l+1);if(!DI.test(o))return null;const c=/^[\w-]*/.exec(e.slice(n))[0];return{start:l,end:n+c.length,query:o}}function zI(e,n){const r=e.slice(0,n.start),l=e.slice(n.end),o=r.endsWith(" ")&&l.startsWith(" ")?r+l.slice(1):r+l;return/^\s*$/.test(o)?"":o}const UI=["none","low","medium","high","xhigh"],z2=["low","medium","high","xhigh"];function $I(e,n){return e||(n??"medium")}function BI(e,n){return n&&UI.includes(n)?e[n]??n:null}function HI(e,n,r){const l=e.filter(([o])=>o!=="").map(([o,c])=>({value:o,triggerLabel:o,label:o,description:c}));return r==="none"&&l.push({value:"none",triggerLabel:"none",label:"none",description:n}),l}function U2(e){if(tw(e)||aw(e))return null;const n=rw(e),r=n?n.rest:e,l=nw(r),o=l?l.rest:r,c=Jk(o),{text:d}=Xu(c?c.rest:o);return{body:d.trim(),...n?{goalRound:n.round}:{},scheduled:l!==null}}function PI(e){const n=[],r=l=>{l!==""&&n[n.length-1]!==l&&n.push(l)};for(const l of e)if(l.kind==="user_text"){const o=U2(l.text);if(!o||o.scheduled||o.goalRound!==void 0&&o.goalRound>1)continue;r(o.body)}else l.kind==="user_steering"&&r(Xu(l.text).text.trim());return n}function FI(e,n,r){if(e.length===0)return null;if(n===null){if(r.trim()!=="")return null;const c=e.length-1,d=e[c];return{nav:{index:c,stash:r,recalled:d},text:d}}if(r!==n.recalled)return null;if(n.index===0)return{nav:n,text:n.recalled};const l=n.index-1,o=e[l];return{nav:{...n,index:l,recalled:o},text:o}}function qI(e,n,r){if(n===null||r!==n.recalled)return null;if(n.index>=e.length-1)return{nav:null,text:n.stash};const l=n.index+1,o=e[l];return{nav:{...n,index:l,recalled:o},text:o}}function VI(e,n){return!e.slice(0,n).includes(`
|
|
169
|
-
`)}function GI(e,n){return!e.slice(n).includes(`
|
|
170
|
-
`)}function WI(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.hasFiles)&&!e.followUpMode?"steer":n&&e.canQueueChannel&&e.stagedRoute!=="blocked"&&e.hasContent?"queue":"stop"}const KI=["always-ask","read-only","allow-all","deny-all"],Cb={"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 YI({value:e,onChange:n,disabled:r,direction:l="up"}){const[o,c]=b.useState(!1);return s.jsx(Sa,{open:o,setOpen:c,menuClass:"w-max",portal:{direction:l,align:"left"},button:s.jsxs("button",{type:"button","aria-label":p.chat.approvalMode,title:`${p.chat.approvalMode}:${p.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:[s.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:s.jsx("path",{d:Cb[e]})}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:p.chat.approvalModeNames[e]??e}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:KI.map(d=>s.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:[s.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:s.jsx("path",{d:Cb[d]})}),s.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-nowrap",children:p.chat.approvalModes[d]??d}),s.jsx("span",{className:"w-3 shrink-0 text-center",children:d===e?"✓":""})]},d))})}function QI({agents:e,currentAgentId:n,onPick:r}){const[l,o]=b.useState("");return s.jsx(L2,{items:dI(e,l),itemKey:c=>c.agentId,isCurrent:c=>c.agentId===n,query:l,onQueryChange:o,searchPlaceholder:p.chat.agentSearchPlaceholder,emptyText:p.chat.agentsNoMatch,onPick:r,renderRow:c=>s.jsxs(s.Fragment,{children:[s.jsx(na,{id:c.agentId,name:Gt(c),size:16,className:"shrink-0 rounded"}),s.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:c.agentId}),c.name&&c.name!==c.agentId&&s.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:c.name})]})})}function Tb({panelRef:e,maxHeight:n,title:r,children:l}){return s.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:[s.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}),l]})}const XI="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z";function Mb({value:e,onChange:n,disabled:r,direction:l="down"}){const[o,c]=b.useState(!1),d=e===null?"…":BI(p.chat.thinkingLevelNames,e)??"—";return s.jsxs(Sa,{open:o,setOpen:c,menuClass:"w-max min-w-36",portal:{direction:l,align:"right"},button:s.jsxs("button",{type:"button",title:`${p.chat.thinkingLevel}:${d}`,"aria-label":p.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:[s.jsx(Pe,{d:XI,size:14,className:"shrink-0"}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:d}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[s.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:p.chat.thinkingLevel}),z2.map(f=>s.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:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.chat.thinkingLevelNames[f]??f}),s.jsx("span",{className:"w-3 shrink-0 text-center",children:f===e?"✓":""})]},f))]})}const $2="penguin.steerMode";function ZI(){return localStorage.getItem($2)==="followup"?"followup":"steer"}const JI="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6";function e_({steerMode:e,onChangeSteerMode:n}){const r=(l,o,c)=>s.jsx("button",{type:"button",title:c,"aria-pressed":e===l,onClick:()=>n(l),className:`h-5 rounded px-1.5 text-xs transition-colors duration-150 ${e===l?"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 s.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-1 text-xs",children:[s.jsx(Pe,{d:JI,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-600 dark:text-gray-400",children:p.chat.steerModeLabel}),s.jsxs("div",{role:"group","aria-label":p.chat.steerModeLabel,className:"flex shrink-0 items-center gap-0.5",children:[r("steer",p.chat.steerModeSteer,p.chat.steerModeSteerHint),r("followup",p.chat.steerModeFollowUp,p.chat.steerModeFollowUpHint)]})]})}function t_({skills:e,selected:n,onToggle:r,disabled:l,direction:o="up"}){const{locale:c}=Pa(),[d,f]=b.useState(!1),[m,h]=b.useState(""),g=iI(e,c,m);return s.jsxs(Sa,{open:d,setOpen:f,menuClass:"w-[26rem]",portal:{direction:o,align:"left"},button:s.jsxs("button",{type:"button","aria-label":p.chat.skillsSelect,title:p.chat.skillsSelect,disabled:l,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:[s.jsx(Pe,{d:ag,size:14,className:"shrink-0"}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:p.chat.skillsSelect}),n.length>0&&s.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}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:s.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[s.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:s.jsx("input",{autoFocus:!0,value:m,onChange:y=>h(y.target.value),placeholder:p.chat.skillsSearchPlaceholder,"aria-label":p.chat.skillsSearchPlaceholder,...yd,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"})}),s.jsx("div",{className:"max-h-56 overflow-y-auto",children:e.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:p.chat.skillsEmptyHint}):g.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:p.chat.skillsNoMatch}):g.map(y=>{const k=n.includes(y.name);return s.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:[s.jsx(Nd,{icon:y.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),s.jsx("span",{className:"shrink-0 font-mono",children:y.name}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:oi(c,y)}),s.jsx("span",{className:"w-3 shrink-0 text-center",children:k?"✓":""})]},y.name)})})]})}const n_="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 a_({items:e,footer:n,direction:r="up"}){const[l,o]=b.useState(!1);return s.jsxs(Sa,{open:l,setOpen:o,menuClass:"w-72",portal:{direction:r,align:"left"},button:s.jsx("button",{type:"button","aria-label":p.chat.plusMenu,title:p.chat.plusMenu,onClick:()=>o(!l),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:s.jsx(Pe,{d:"M12 5v14M5 12h14",size:15,className:"shrink-0"})}),children:[e.map(c=>s.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:[s.jsx(Pe,{d:c.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),s.jsx("span",{className:"shrink-0",children:c.label}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:c.desc}),s.jsx("span",{className:"w-3 shrink-0 text-center",children:c.active?"✓":""})]},c.key)),n&&s.jsx("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:n})]})}function r_({now:e,window:n,unknown:r=!1}){const l=T2(n),o=r?0:Math.min(1,e/l),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 s.jsxs("span",{title:r?p.chat.contextUnknown:`${p.chat.contextUsage} ${Math.round(o*100)}%`,className:`flex shrink-0 items-center gap-1 font-mono ${c}`,children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block shrink-0",children:[s.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),s.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)"})]}),s.jsxs("span",{className:"hidden @md:inline",children:[r?"—":yt(e),"/",yt(l)]})]})}const s_=10*1024*1024;function l_(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 i_(e){const n=[],r=e.text.replace(/\s+/g," ").trim();return r&&n.push(r),e.images>0&&n.push(p.chat.imagesInMessage(e.images)),e.files>0&&n.push(p.chat.filesInMessage(e.files)),n.join(" · ")}function o_(e,n,r){for(const l of n)e.push({type:"image_url",imageUrl:l});for(const l of r)e.push({type:"file",fileName:l.name,dataUrl:l.dataUrl})}function B2({status:e,onSend:n,onSteer:r,steeringDeliveredCount:l,pendingSteering:o=[],onQueueFollowUp:c,queuedFollowUps:d=0,onStop:f,onCompact:m,modelRef:h,models:g,onChangeModel:y,onSwitchModel:k,defaultModel:w,thinkingLevel:S,onChangeThinkingLevel:T,turnThinkingLevel:E,onChangeTurnThinkingLevel:M,contextWindow:L,contextNow:O,contextStale:P=!1,vision:H,approvalMode:I,onChangeApprovalMode:F,modeSaving:K,autoFocus:Z,agents:z,currentAgentId:B,skills:A,initialSkills:$,onSkillsChange:q,onHandoff:U,initialText:V,onTextChange:W,history:ce=[],initialHandoffTargetId:te,onHandoffTargetChange:N,initialPendingModelRef:_,onPendingModelChange:R,modelAuthDead:C=!1,onOpenModels:Q,onRetryModelAuth:ee,onNewSession:ae}){const{locale:he}=Pa(),[xe,ie]=b.useState(V??""),ye=b.useRef(xe);ye.current=xe;const[ve,Ke]=b.useState([]),[He,Ge]=b.useState([]),[Qe,ut]=b.useState(!1),[Yt,en]=b.useState(0),[tn,wn]=b.useState(null),[Pt,xn]=b.useState(!1),yn=b.useRef(null),[st,Wt]=b.useState(!1),X=b.useRef(null),me=b.useRef(null),[Ne,Ae]=b.useState(),[Oe,re]=b.useState(null),[ke,Me]=b.useState(null),[Te,$e]=b.useState($??[]),[Ve,Xe]=b.useState(0),et=b.useRef(null),cn=b.useRef(null),[bn]=b.useState(()=>window.matchMedia("(max-width: 767px)").matches),Nt=e==="running",Sn=e==="compacting",vn=xe.trim().length>0||ve.length>0||He.length>0||Oe!==null||ke!==null||Te.length>0,[Ct,It]=b.useState(!1),[jn,Vn]=b.useState(""),[la,On]=b.useState(!1),[Nn,tr]=b.useState(""),ia=Ct?bu(jn):null,Ie=bu(Nn)===null,lt=ia!==null&&ia!==ng?p.chat.goalBudgetValue(yt(ia)):p.chat.goalBudgetUnlimited,xt=fI({handoffTarget:Oe!==null,pendingModel:ke!==null,canSwitchModel:k!==void 0,sessionBusy:Nt||Sn}),zt=!Nt&&!Sn&&!Qe&&!C&&(Ct?xe.trim().length>0&&He.length===0&&ia!==null&&!(la&&Ie):vn),dt=b.useCallback(le=>{if(le){tr(jn),On(!0);return}bu(Nn)!==null&&(Vn(Nn.trim()),On(!1))},[jn,Nn]),bt=b.useCallback(()=>{On(!1),et.current?.focus()},[]),Qt=b.useCallback(()=>{bu(Nn)!==null&&(Vn(Nn.trim()),On(!1),et.current?.focus())},[Nn]),Xt=b.useCallback(le=>{It(le),On(!1),tr(""),le&&(Vn(""),re(null),N?.(null),Me(null),R?.(null),Ge([]))},[N,R]),[oa,yr]=b.useState(ZI),ml=le=>{yr(le),localStorage.setItem($2,le)},Es=oa==="followup"&&c!==void 0,Gn=WI({sending:Qe,goalOn:Ct,modelAuthDead:C,canSteerChannel:r!==void 0,canQueueChannel:c!==void 0,followUpMode:Es,stagedRoute:xt,hasHandoffTarget:Oe!==null,hasPendingModel:ke!==null,hasText:xe.trim().length>0,hasImages:ve.length>0,hasFiles:He.length>0,hasContent:vn}),nr=Nt&&Gn==="steer",Na=Nt&&Gn==="queue",ar=nr||Na,rr=Gn==="queue"?p.chat.followUpSend:p.chat.steerSend,Bn=Nt&&Gn==="stop",[Ut,As]=b.useState(!1),Rs=b.useRef(0);b.useEffect(()=>{Ut&&(!Nt||(l??0)>Rs.current)&&As(!1)},[Ut,Nt,l]);const Hn=b.useCallback(le=>{const je=Te.includes(le)?Te.filter(Fe=>Fe!==le):[...Te,le];$e(je),q?.(je)},[Te,q]),Ca=b.useRef(null),ci=b.useMemo(()=>{const le=()=>{const je=Ca.current,Fe=je?zI(ye.current,je):"";ie(Fe),W?.(Fe)};return[{cmd:"/compact",desc:p.chat.compact,run:()=>{le(),m()}},{cmd:"/goal",desc:p.chat.goalModeDesc,run:()=>{le(),Xt(!Ct)}},...k&&g&&g.length>0?[{cmd:"/model",desc:p.chat.switchModel,run:()=>{le(),xn(!0)}}]:[],...U&&z.length>0?[{cmd:"/agent",desc:p.chat.switchAgent,run:()=>{le(),Wt(!0)}}]:[],...oI(A,he).map(je=>({cmd:je.cmd,desc:je.desc,run:()=>{le(),Hn(je.name)}}))]},[m,k,g,z,W,A,he,Hn,Xt,Ct]),sr=!Nt&&!Sn&&!Pt&&!st?Nb(xe,Ve):null;Ca.current=sr;const Ta=sr&&sr.start!==tn?ci.filter(le=>le.cmd.startsWith(`/${sr.query}`)):[],qr=Ta.length>0,lr=Ta[Math.min(Yt,Ta.length-1)];b.useEffect(()=>{if(!Pt&&!st)return;const le=()=>{xn(!1),Wt(!1),et.current?.focus()},je=pt=>{const it=Pt?yn.current:X.current;it&&!it.contains(pt.target)&&le()},Fe=pt=>{pt.key==="Escape"&&!pt.isComposing&&le()};return window.addEventListener("mousedown",je),window.addEventListener("keydown",Fe),()=>{window.removeEventListener("mousedown",je),window.removeEventListener("keydown",Fe)}},[Pt,st]);const ue=le=>{Me(le),R?.(le?{provider:le.provider,modelId:le.modelId}:null)},Se=le=>{if(xn(!1),et.current?.focus(),wt(le,h)){ue(null);return}ue(le),re(null),N?.(null),It(!1)},qe=le=>{Wt(!1),re(le),N?.(le.agentId),ue(null),It(!1),et.current?.focus()},ft=()=>{Oe!==null&&(re(null),N?.(null)),ue(null)};b.useEffect(()=>{if(!qr&&!Pt&&!st)return;const le=()=>{const je=me.current;if(!je)return;let Fe=0;for(let it=je.parentElement;it;it=it.parentElement)if(getComputedStyle(it).overflowY!=="visible"){Fe=it.getBoundingClientRect().top;break}const pt=je.getBoundingClientRect().top-Fe-14;Ae(Math.max(96,Math.min(320,Math.round(pt))))};return le(),window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[qr,Pt,st]);const Ft=()=>{const le=et.current;le&&(le.style.height="auto",le.style.height=`${Math.min(le.scrollHeight,176)}px`)};b.useLayoutEffect(Ft,[xe]),b.useEffect(()=>{const le=cn.current;le&&xe!==le.recalled&&(cn.current=null)},[xe]),b.useEffect(()=>{const le=et.current;if(le&&le.value.length>0){const je=le.value.length;le.setSelectionRange(je,je),le.scrollTop=le.scrollHeight,Xe(je)}},[]);const _t=b.useRef(!1);b.useEffect(()=>{if(!_t.current&&(_t.current=!0,A.length===0))return;const le=Te.filter(je=>A.some(Fe=>Fe.name===je));le.length!==Te.length&&($e(le),q?.(le))},[A,Te,q]);const nn=Oe!==null||ke!==null||Ct,Cn=b.useRef(!1);b.useEffect(()=>{if(Cn.current||!te||z.length===0||(Cn.current=!0,nn))return;const le=z.find(je=>je.agentId===te);le&&re(le)},[z,te,nn]);const Vr=b.useRef(!1);b.useEffect(()=>{if(Vr.current||!_||!g||g.length===0||(Vr.current=!0,nn||!k))return;const le=g.find(je=>wt(je,_));le&&!wt(le,h)&&Me(le)},[g,_,h,k,nn]);const un=async(le=n)=>{const je=xe.trim();if(Ct){ut(!0);try{const _s=[{type:"text",text:Dh(Te,je)}];for(const Wr of ve)_s.push({type:"image_url",imageUrl:Wr});await n(_s,{budget:ia})&&(ie(""),Ke([]),$e([]),Xt(!1))}finally{ut(!1),et.current?.focus()}return}if(xt==="blocked")return;const Fe=xt==="model"?ke:null,pt=je!==""?je:Te.length>0?p.chat.skillsAutoMessage(Te):Fe?p.chat.modelSwitchAutoMessage:je,it=Dh(Te,pt),Ma=[];it&&Ma.push({type:"text",text:it}),o_(Ma,ve,He),ut(!0);try{(Oe?await U(Oe,Ma):Fe?await k({provider:Fe.provider,modelId:Fe.modelId},Ma):await le(Ma,null))&&(ie(""),Ke([]),Ge([]),re(null),Me(null),$e([]))}finally{ut(!1),et.current?.focus()}},br=async()=>{if(Nt){if(Na){await un(c);return}if(!nr)return;const le=xe.trim(),je=ve,Fe=He.map(it=>({fileName:it.name,dataUrl:it.dataUrl}));ut(!0);let pt="failed";try{pt=await r(le,je,Fe),pt==="queued"&&(Rs.current=l??0,As(!0),ie(""),Ke([]),Ge([]))}finally{ut(!1),et.current?.focus()}pt==="not_running"&&await un();return}zt&&await un()},hl=le=>{cn.current=le.nav,ie(le.text),W?.(le.text),Xe(le.text.length),requestAnimationFrame(()=>{const je=et.current;je&&(je.setSelectionRange(je.value.length,je.value.length),je.scrollTop=je.scrollHeight)})},Is=le=>{if(qr){if(le.key==="ArrowDown"){le.preventDefault(),en(je=>(je+1)%Ta.length);return}if(le.key==="ArrowUp"){le.preventDefault(),en(je=>(je-1+Ta.length)%Ta.length);return}if((le.key==="Enter"&&!le.shiftKey||le.key==="Tab")&&!le.nativeEvent.isComposing){le.preventDefault(),lr?.run();return}if(le.key==="Escape"){wn(sr?.start??null);return}}if((le.key==="ArrowUp"||le.key==="ArrowDown")&&!le.nativeEvent.isComposing){const je=le.currentTarget.selectionStart??0,Fe=le.currentTarget.selectionEnd??je,pt=le.key==="ArrowUp"?VI(xe,je)?FI(ce,cn.current,xe):null:GI(xe,Fe)?qI(ce,cn.current,xe):null;if(pt){le.preventDefault(),hl(pt);return}}if(le.key==="Backspace"&&(Oe!==null||ke!==null)&&le.currentTarget.selectionStart===0&&le.currentTarget.selectionEnd===0){le.preventDefault(),ft();return}le.key==="Enter"&&!le.shiftKey&&!le.nativeEvent.isComposing&&(le.preventDefault(),br())},Dn=le=>{for(const je of le){if(!je.type.startsWith("image/"))continue;const Fe=new FileReader;Fe.onload=()=>{typeof Fe.result=="string"&&Ke(pt=>[...pt,Fe.result])},Fe.readAsDataURL(je)}},tc=le=>{const je=[];for(const Fe of le.clipboardData.items)if(Fe.kind==="file"){const pt=Fe.getAsFile();pt&&je.push(pt)}je.length>0&&(le.preventDefault(),Dn(je))},nc=le=>{le.target.files&&Dn(le.target.files),le.target.value=""},Gr=le=>{if(Ct)return;const je=[];for(const Fe of le){if(Fe.size>s_){ht(p.chat.attachmentTooLarge(Fe.name));continue}je.push(Fe)}je.length!==0&&Promise.all(je.map(l_)).then(Fe=>{const pt=je.flatMap((it,Ma)=>Fe[Ma]?[{name:it.name,size:it.size,dataUrl:Fe[Ma]}]:[]);pt.length>0&&Ge(it=>[...it,...pt])})},Ed=le=>{le.target.files&&Gr(le.target.files),le.target.value=""},ui=b.useRef(null),di=b.useRef(null);return s.jsxs("div",{className:"relative",ref:me,children:[qr&&s.jsx("div",{style:{maxHeight:Ne},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:Ta.map((le,je)=>s.jsxs("button",{type:"button",ref:le===lr?Fe=>Fe?.scrollIntoView({block:"nearest"}):void 0,onMouseEnter:()=>en(je),onClick:()=>le.run(),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${le===lr?"bg-gray-100 dark:bg-gray-800":""}`,children:[s.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:le.cmd}),s.jsx("span",{title:le.desc,className:"min-w-0 flex-1 truncate text-xs text-gray-500 dark:text-gray-400",children:le.desc})]},le.cmd))}),Pt&&g&&s.jsx(Tb,{panelRef:yn,maxHeight:Ne,title:p.chat.switchModelTitle,children:s.jsx(O2,{models:g,value:h,...w!==void 0?{defaultModel:w}:{},onPick:Se})}),st&&s.jsx(Tb,{panelRef:X,maxHeight:Ne,title:p.chat.switchAgentTitle,children:s.jsx(QI,{agents:z,...B!==void 0?{currentAgentId:B}:{},onPick:qe})}),ve.length>0&&s.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:ve.map((le,je)=>s.jsxs("div",{className:"anim-pop relative",children:[s.jsx(Br,{src:le,alt:p.chat.imageAlt,className:"h-16 w-16 rounded-md border border-gray-200 object-cover dark:border-gray-700"}),s.jsx("button",{type:"button","aria-label":p.chat.removeImage,onClick:()=>Ke(Fe=>Fe.filter((pt,it)=>it!==je)),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:"×"})]},je))}),He.length>0&&s.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:He.map((le,je)=>s.jsxs("span",{title:le.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:[s.jsx(Pe,{d:tp,size:13,className:"shrink-0 text-gray-400 dark:text-gray-500"}),s.jsx("span",{className:"min-w-0 truncate",children:le.name}),s.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:_o(le.size)}),s.jsx("button",{type:"button","aria-label":`${p.chat.removeFile} ${le.name}`,onClick:()=>Ge(Fe=>Fe.filter((pt,it)=>it!==je)),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},je))}),!H&&ve.length>0&&s.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:p.chat.imagesAsPathHint}),xt==="blocked"&&s.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:p.chat.modelSwitchBusyHint}),o.length>0?s.jsx("div",{className:"anim-fade mb-1",children:o.map((le,je)=>s.jsx("p",{className:"truncate text-xs text-gray-400 dark:text-gray-500",children:p.chat.steerQueuedItem(i_(le))},je))}):Ut&&s.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:p.chat.steerQueuedIndicator}),d>0&&s.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:p.chat.followUpQueuedChip(d)}),C&&s.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:[s.jsx("span",{className:"min-w-0 flex-1 basis-56",children:p.chat.modelAuthDead}),s.jsxs("span",{className:"flex shrink-0 flex-wrap items-center gap-1.5",children:[Q&&s.jsx("button",{type:"button",onClick:Q,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:p.chat.modelAuthDeadOpenModels}),ee&&s.jsx("button",{type:"button",onClick:ee,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:p.chat.modelAuthDeadRetry}),ae&&s.jsx("button",{type:"button",onClick:ae,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:p.chat.modelAuthDeadCta})]})]}),s.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${C?" opacity-50 grayscale":""}`,children:[(Oe!==null||ke!==null||Te.length>0||Ct)&&s.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-1",children:[Ct&&s.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:[s.jsxs("span",{className:"flex shrink-0 items-center gap-1",title:p.chat.goalModeDesc,children:[s.jsx(Pe,{d:Uo,size:13,className:"text-gray-500 dark:text-gray-400"}),s.jsx("span",{children:p.chat.goalMode})]}),s.jsx("span",{"aria-hidden":!0,className:"mx-0.5 h-4 w-px shrink-0 bg-gray-300 dark:bg-gray-600"}),s.jsx(Sa,{open:la,setOpen:dt,onEscape:bt,className:"min-w-0",menuClass:"bottom-full left-1/2 -ml-32 mb-2 w-64 max-w-[calc(100vw-2rem)] origin-bottom",button:s.jsxs("button",{type:"button","aria-label":lt,"aria-expanded":la,onClick:()=>dt(!la),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:[s.jsx("span",{className:"truncate",children:lt}),s.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:s.jsx("path",{d:"M3 4.5l3 3 3-3"})})]}),children:s.jsxs("div",{className:"px-3 py-2",children:[s.jsx("label",{htmlFor:"goal-budget-input",className:"block text-xs font-medium text-gray-700 dark:text-gray-200",children:p.chat.goalBudgetLabel}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[s.jsx("input",{id:"goal-budget-input",autoFocus:!0,value:Nn,onChange:le=>tr(le.target.value),onFocus:le=>le.currentTarget.select(),onKeyDown:le=>{le.key==="Enter"&&(le.preventDefault(),le.stopPropagation(),Qt())},placeholder:p.chat.goalBudgetPlaceholder,"aria-invalid":Ie,"aria-describedby":"goal-budget-hint",...yd,title:Ie?p.chat.goalBudgetInvalid:p.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 ${Ie?"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"}`}),s.jsx("button",{type:"button","aria-label":p.chat.goalBudgetSave,title:p.chat.goalBudgetSave,disabled:Ie,onClick:Qt,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:s.jsx(Pe,{d:"M5 12l4 4L19 6",size:14})})]}),s.jsx("p",{id:"goal-budget-hint",className:`mt-1.5 text-[11px] leading-4 ${Ie?"text-red-500 dark:text-red-400":"text-gray-400 dark:text-gray-500"}`,children:Ie?p.chat.goalBudgetInvalid:p.chat.goalBudgetHint})]})}),s.jsx("button",{type:"button","aria-label":p.chat.goalRemove,onClick:()=>Xt(!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:"×"})]}),Oe!==null&&s.jsxs("span",{title:p.chat.handoffTargetTitle(Gt(Oe)),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:[s.jsx(na,{id:Oe.agentId,name:Gt(Oe),size:13,className:"shrink-0 rounded-sm"}),s.jsx("span",{className:"truncate",children:Oe.agentId}),s.jsx("button",{type:"button","aria-label":p.chat.handoffRemove,onClick:()=>{re(null),N?.(null),et.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:"×"})]}),ke!==null&&s.jsxs("span",{title:p.chat.modelSwitchTargetTitle(No(ke)),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:[s.jsx(ti,{provider:ke.provider,className:"h-3.5 w-3.5 shrink-0"}),s.jsx("span",{className:"truncate",children:No(ke)}),s.jsx("button",{type:"button","aria-label":p.chat.modelSwitchRemove,onClick:()=>{ue(null),et.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:"×"})]}),Te.map(le=>{const je=A.find(Fe=>Fe.name===le);return s.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",...je?{title:oi(he,je)}:{},children:[s.jsx(Nd,{icon:je?.icon,size:13,className:"shrink-0 text-gray-500 dark:text-gray-400"}),s.jsx("span",{className:"truncate",children:le}),s.jsx("button",{type:"button","aria-label":`${p.chat.skillRemove} ${le}`,onClick:()=>Hn(le),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},le)})]}),s.jsx("textarea",{ref:et,rows:2,value:xe,autoFocus:Z,onChange:le=>{const je=le.target.value,Fe=le.target.selectionStart??je.length;ie(je),W?.(je),Xe(Fe),en(0),wn(pt=>{if(pt===null)return null;const it=Nb(je,Fe);return it&&it.start===pt?pt:null})},onSelect:le=>Xe(le.currentTarget.selectionStart??0),onKeyDown:Is,onPaste:tc,disabled:C,placeholder:C?p.chat.modelAuthDeadPlaceholder:Nt&&Es?bn?p.chat.followUpPlaceholderShort:p.chat.followUpPlaceholder:Nt&&r?bn?p.chat.steerPlaceholderShort:p.chat.steerPlaceholder:bn?p.chat.inputPlaceholderShort:p.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"}),s.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 text-xs",children:[s.jsxs("div",{className:"no-scrollbar flex min-w-0 flex-1 items-center gap-2 overflow-x-auto",children:[s.jsx("input",{ref:ui,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:nc}),s.jsx("input",{ref:di,type:"file",multiple:!0,disabled:Ct,className:"hidden",onChange:Ed}),s.jsx(a_,{items:[{key:"image",icon:n_,label:p.chat.uploadImage,desc:H&&!Ct?p.chat.uploadImageDesc:p.chat.imagesAsPathHint,active:ve.length>0,onSelect:()=>ui.current?.click()},{key:"file",icon:tp,label:p.chat.uploadFile,desc:p.chat.uploadFileDesc,active:He.length>0,disabled:Ct,onSelect:()=>di.current?.click()},{key:"goal",icon:Uo,label:p.chat.goalMode,desc:p.chat.goalModeDesc,active:Ct,disabled:Nt||Sn||Qe,onSelect:()=>Xt(!Ct)}],footer:s.jsx(e_,{steerMode:oa,onChangeSteerMode:ml}),direction:g&&y?"down":"up"}),s.jsx(YI,{value:I,onChange:F,disabled:K,direction:g&&y?"down":"up"}),s.jsx(t_,{skills:A,selected:Te,onToggle:Hn,disabled:Nt||Sn||Qe,direction:g&&y?"down":"up"}),s.jsx("span",{title:p.chat.slashHint,className:"hidden min-w-0 truncate text-gray-300 @lg:block dark:text-gray-600",children:p.chat.slashHint})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!y&&s.jsx(r_,{now:O,unknown:P,...L!==void 0?{window:L}:{}}),g&&y&&T&&s.jsx(Mb,{value:S??null,onChange:T,disabled:Qe}),!y&&M&&s.jsx(Mb,{value:E??"",onChange:M,disabled:Qe,direction:"up"}),g&&y?s.jsx(D2,{models:g,value:h,...w!==void 0?{defaultModel:w}:{},onChange:y,disabled:Qe}):s.jsxs("span",{title:h?.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:[s.jsx(ti,{provider:h?.provider??"custom",className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:(()=>{const le=g?.find(je=>wt(je,h));return le?No(le):h?.modelId??"…"})()})]}),s.jsx("button",{type:"button",title:Bn?p.chat.stop:Nt?rr:p.chat.send,"aria-label":Bn?p.chat.stop:Nt?rr:p.chat.send,disabled:Bn?!1:Nt?!ar:!zt,onClick:()=>Bn?void f():void br(),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?s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block",children:s.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})}):s.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:s.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]})]})]})]})}const Eb=500,c_=5;function u_(e,n){return e+n+1}function ap(e,n){return e+n>=c_}const H2=20,d_=20;function f_(e,n,r=H2,l=d_){const o=r+1+l;if(e<=o)return{start:0,end:e};if(n===null||n<0||n>=e)return{start:e-o,end:e};const c=Math.min(Math.max(0,n-r),e-o);return{start:c,end:c+o}}const m_=12,P2=5,F2=48;function h_(e,n){return Math.max(P2,Math.min(m_,Math.floor((e-F2)/Math.max(1,n))))}function p_(e){const n=Math.floor((e-F2)/P2);return Math.min(H2,Math.max(0,Math.floor((n-1)/2)))}function g_(e){const n=[];let r=null,l=!1;for(const o of e){if(o.kind==="user_text"||o.kind==="user_image"){let c="";if(o.kind==="user_text"){const d=U2(o.text);if(!d||d.goalRound!==void 0&&d.goalRound>1){l=!1;continue}c=d.body}l&&r?r.question===""&&c!==""&&(r.question=c):(r={anchorId:o.id,question:c,answer:""},n.push(r)),l=!0;continue}if(l=!1,o.kind==="assistant_text"&&r&&r.answer.length<Eb){const c=o.text.trim();c!==""&&(r.answer=(r.answer===""?c:`${r.answer} ${c}`).slice(0,Eb))}}return n}function x_(e,n){let r=e.replace(/```[^\n]*/g,"").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[ \t]*(?:#{1,6}[ \t]+|>[ \t]?|[-*+][ \t]+|\d+[.)][ \t]+)/gm,"").replace(/[*_`~]/g,"").replace(/\s+/g," ").trim();return r.length>n&&(r=`${r.slice(0,n).trimEnd()}…`),r}const y_="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm4 0v16M12 9h5m-5 4h5",b_=96,v_=1e3,k_=56,w_=48,Ab="(hover: hover) and (pointer: fine)";function S_(e,n){const[r,l]=b.useState(()=>window.matchMedia(Ab).matches),[o,c]=b.useState({gutterOk:!1,height:0});return b.useEffect(()=>{const d=window.matchMedia(Ab),f=m=>l(m.matches);return d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[]),b.useEffect(()=>{const d=e.current;if(!d)return;const f=()=>{const h=parseFloat(getComputedStyle(document.documentElement).fontSize)||16,g=(d.clientWidth-w_*h)/2;c({gutterOk:g>=k_,height:d.clientHeight})};f();const m=new ResizeObserver(f);return m.observe(d),()=>m.disconnect()},[e,n]),{shown:r&&o.gutterOk,height:o.height}}function q2(e,n){const r=e.querySelectorAll("[data-outline-anchor]");if(r.length===0)return null;let l=null,o=null;const c=e.scrollTop+b_;for(const f of r){const m=Number(f.dataset.outlineAnchor);n.has(m)&&(l=m,f.offsetTop<=c&&(o=m))}return e.scrollHeight-e.scrollTop-e.clientHeight<2?l:o}let Rb=null,Ib;function V2(e,n){const r=e?.querySelector(`[data-outline-anchor="${n}"]`);!e||!r||(e.scrollTo({top:Math.max(0,r.offsetTop-8)}),window.clearTimeout(Ib),Rb?.classList.remove("outline-flash"),Rb=r,r.classList.remove("outline-flash"),r.offsetWidth,r.classList.add("outline-flash"),Ib=window.setTimeout(()=>r.classList.remove("outline-flash"),v_))}function _b({edge:e}){return s.jsx("div",{"data-outline-overflow":e,"aria-hidden":!0,className:`flex w-10 flex-col items-start gap-[3px] pl-4 ${e==="above"?"pb-1.5":"pt-1.5"}`,children:[0,1,2].map(n=>s.jsx("span",{className:"h-[2px] w-[2px] rounded-full bg-gray-300 dark:bg-gray-700"},n))})}function G2(e,n,r,l){return e.answer?x_(e.answer,l):r&&e===n[n.length-1]?p.chat.outlineAnswering:""}function j_({entries:e,turnOffset:n=0,version:r,scrollRef:l,running:o,fit:c}){const[d,f]=b.useState(null),[m,h]=b.useState(null),g=b.useRef(null);if(b.useEffect(()=>{const O=l.current;if(!c.shown||!O||!ap(n,e.length))return;const P=new Set(e.map(K=>K.anchorId));let H=null;const I=()=>{H=null;const K=l.current;K&&f(q2(K,P))},F=()=>{H??=requestAnimationFrame(I)};return I(),O.addEventListener("scroll",F,{passive:!0}),()=>{O.removeEventListener("scroll",F),H!==null&&cancelAnimationFrame(H)}},[c.shown,l,e.length,n,r]),!c.shown||!ap(n,e.length))return null;const y=O=>{const P=O.currentTarget.getBoundingClientRect();return P.top+P.height/2-(g.current?.getBoundingClientRect().top??0)},k=p_(c.height),{start:w,end:S}=f_(e.length,e.findIndex(O=>O.anchorId===d),k,k),T=e.slice(w,S),E=h_(c.height,T.length),M=m===null?null:T.find(O=>O.anchorId===m.id)??null,L=M===null?"":G2(M,e,o,160);return s.jsxs("nav",{ref:g,"aria-label":p.chat.outlineTitle,className:"pointer-events-none absolute inset-y-0 left-0 z-10 flex flex-col items-start justify-center",children:[s.jsxs("div",{className:"max-h-full overflow-hidden",children:[(w>0||n>0)&&s.jsx(_b,{edge:"above"}),T.map((O,P)=>{const H=O.anchorId===d;return s.jsx("button",{type:"button","data-outline-tick":O.anchorId,"aria-current":H||void 0,"aria-label":p.chat.outlineTickLabel(u_(n,w+P),O.question||p.chat.outlineNoText),style:{height:E},onMouseEnter:I=>h({id:O.anchorId,top:y(I)}),onMouseLeave:()=>h(null),onFocus:I=>h({id:O.anchorId,top:y(I)}),onBlur:()=>h(null),onClick:()=>{V2(l.current,O.anchorId),f(O.anchorId)},className:"group/tick pointer-events-auto flex w-10 items-center pl-2.5",children:s.jsx("span",{className:`h-[2px] rounded-full transition-all duration-150 ${H?"w-5 bg-gray-800 dark:bg-gray-200":"w-3.5 bg-gray-300 group-hover/tick:bg-gray-500 dark:bg-gray-700 dark:group-hover/tick:bg-gray-400"}`})},O.anchorId)}),S<e.length&&s.jsx(_b,{edge:"below"})]}),M&&s.jsxs("div",{"data-outline-card":!0,"aria-hidden":!0,className:"anim-pop pointer-events-none absolute left-10 w-80 -translate-y-1/2 rounded-xl border border-gray-200 bg-white px-4 py-3 shadow-lg dark:border-gray-700 dark:bg-gray-900",style:{top:Math.min(Math.max(m.top,56),Math.max(56,c.height-56))},children:[s.jsx("p",{className:`truncate text-sm ${M.question===""?"italic text-gray-500 dark:text-gray-400":"font-semibold text-gray-900 dark:text-gray-100"}`,children:M.question||p.chat.outlineNoText}),L!==""&&s.jsx("p",{className:`mt-1 line-clamp-3 text-sm leading-snug text-gray-500 dark:text-gray-400 ${M.answer===""?"animate-pulse":""}`,children:L})]})]})}function N_({entries:e,turnOffset:n=0,scrollRef:r,running:l}){const[o,c]=b.useState(!1),[d,f]=b.useState(null);if(!ap(n,e.length))return null;const m=h=>{h&&r.current&&f(q2(r.current,new Set(e.map(g=>g.anchorId)))),c(h)};return s.jsx(Sa,{open:o,setOpen:m,menuClass:"right-0 top-full mt-1 w-72 max-w-[calc(100vw-1.5rem)] origin-top-right",button:s.jsx("button",{type:"button",title:p.chat.outlineTitle,"aria-label":p.chat.outlineTitle,onClick:()=>m(!o),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:s.jsx(Pe,{d:y_,size:15})}),children:s.jsx("div",{className:"max-h-[60vh] overflow-y-auto py-1",children:e.map(h=>{const g=G2(h,e,l,80),y=h.anchorId===d;return s.jsxs("button",{type:"button","data-outline-menu-entry":h.anchorId,"aria-current":y||void 0,onClick:()=>{V2(r.current,h.anchorId),c(!1)},className:`block w-full px-3 py-1.5 text-left transition-colors duration-150 ${y?"bg-gray-100 dark:bg-gray-800":"hover:bg-gray-50 dark:hover:bg-gray-800/60"}`,children:[s.jsx("span",{className:`block truncate text-sm ${h.question===""?"italic text-gray-500 dark:text-gray-400":"font-medium text-gray-800 dark:text-gray-200"}`,children:h.question||p.chat.outlineNoText}),g!==""&&s.jsx("span",{className:`mt-0.5 block truncate text-xs text-gray-500 dark:text-gray-400 ${h.answer===""?"animate-pulse":""}`,children:g})]},h.anchorId)})})})}function W2({className:e}){return s.jsx("img",{src:"/penguin-logo.svg",alt:"","aria-hidden":!0,draggable:!1,className:`select-none ${e??"h-9 w-9 rounded-lg"}`})}let oh=null,ch=null,Pu=null,Zl=null;const rp=new Set;function C_(e){return e.disabled===!0?{kind:"disabled"}:e.error!==void 0?{kind:"failed"}:e.updateAvailable&&e.latestVersion!==null?{kind:"found",latestVersion:e.latestVersion}:{kind:"up-to-date"}}function K2(e){const[n,r]=b.useState(oh),[l,o]=b.useState(Pu);return b.useEffect(()=>{const c=()=>{r(oh),o(Pu)};return rp.add(c),()=>{rp.delete(c)}},[]),b.useEffect(()=>{if(!e)return;let c=!1;return ch??=GN().then(d=>(oh=d,d)),ch.then(d=>{c||r(d)}).catch(()=>{ch=null}),Zl??=Jv().then(d=>(Pu=d,d)),Zl.then(d=>{c||o(d)}).catch(()=>{Zl=null}),()=>{c=!0}},[e]),{version:n,update:l}}async function Lb(){const e=Jv(!0).then(n=>(Pu=n,n));Zl=e;try{return await e}catch(n){throw Zl===e&&(Zl=null),n}finally{for(const n of rp)n()}}const sp=[{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:[]}]}];sp.flatMap(e=>[...e.tasks]);const T_=["always-ask","read-only","allow-all","deny-all"],rl=(e,n)=>`penguin.chatDraft.${e}.${n}`,Y2=(e,n)=>`penguin.chatDraft.session.${e}.${n}`;function Ob(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 M_(e){if(!e)return{};try{const n=JSON.parse(e);if(typeof n!="object"||n===null)return{};const r=n,l={};typeof r.text=="string"&&(l.text=r.text),typeof r.agentId=="string"&&(l.agentId=r.agentId),typeof r.workspace=="string"&&(l.workspace=r.workspace);const o=Ob(r.modelRef);o&&(l.modelRef=o),typeof r.handoffAgentId=="string"&&(l.handoffAgentId=r.handoffAgentId);const c=Ob(r.switchModelRef);if(c&&(l.switchModelRef=c),Array.isArray(r.skills)){const d=r.skills.filter(f=>typeof f=="string");d.length>0&&(l.skills=d)}return typeof r.approvalMode=="string"&&T_.includes(r.approvalMode)&&(l.approvalMode=r.approvalMode),l}catch{return{}}}function ec(e,n=localStorage){try{return M_(n.getItem(e))}catch{return{}}}function ni(e,n,r=localStorage){try{r.setItem(e,JSON.stringify(n))}catch{}}function rd(e,n=localStorage){try{n.removeItem(e)}catch{}}function Q2(e,n,r=localStorage){const l=rl(e,n),o=ec(l,r);o.modelRef&&ni(l,{...o,modelRef:void 0},r)}const X2="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 Z2({projectId:e,workspace:n,onChange:r,variant:l="pill"}){const[o,c]=b.useState(!1),[d,f]=b.useState({right:!1}),m=b.useRef(!1),[h,g]=b.useState(null),[y,k]=b.useState(!1),[w,S]=b.useState(null),[T,E]=b.useState("");b.useEffect(()=>{E(h?.path??"")},[h]);const M=b.useCallback(Z=>{k(!0),S(null),e1(e,Z).then(g).catch(z=>S(_e(z))).finally(()=>k(!1))},[e]),L=Z=>{const z=!o;if(z&&l==="pill"){const B=Z.currentTarget.getBoundingClientRect(),A=parseFloat(getComputedStyle(document.documentElement).fontSize),$=12,q=Math.min(20*A,window.innerWidth-2*A),U=window.innerWidth-$-B.left,V=B.right-$;U>=q?f({right:!1}):V>U?f({right:!0,...V<q?{maxWidth:V}:{}}):f({right:!1,maxWidth:U})}if(c(z),z&&!m.current){m.current=!0;const B=n.trim();M(B.startsWith("/")?B:"")}},O=async()=>{const Z=T.trim();if(!Z||Z===h?.path){E(h?.path??"");return}try{g(await e1(e,Z))}catch{ht(p.chat.workspaceDirInvalid),E(h?.path??"")}},P=n.trim(),H=P?P.split("/").filter(Boolean).pop()??"/":p.chat.workspaceAuto,I=h?.parent??null,F=(h?.entries??[]).filter(Z=>!Z.name.startsWith(".")),K=Z=>s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:`shrink-0 text-gray-400 ${Z}`,"aria-hidden":!0,children:s.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"})});return s.jsx(Sa,{open:o,setOpen:c,...l==="form"?{menuClass:"w-80",portal:{direction:"down",align:"left"}}:{menuClass:`top-full mt-1 w-80 max-w-[calc(100vw-2rem)] ${d.right?"right-0 origin-top-right":"left-0 origin-top-left"}`,...d.maxWidth!==void 0?{menuStyle:{maxWidth:d.maxWidth}}:{}},button:l==="form"?s.jsxs("button",{type:"button",title:P?`${p.chat.workspace}:${P}`:p.chat.workspaceHint,"aria-label":p.chat.workspace,"aria-haspopup":"dialog","aria-expanded":o,onClick:L,className:`flex w-full items-center gap-2 text-left ${qo} ${Go.sm}`,children:[K(""),s.jsx("span",{className:`min-w-0 flex-1 truncate ${P?"font-mono":""}`,children:H}),s.jsx(Fo,{className:"text-gray-400"})]}):s.jsxs("button",{type:"button",title:P?`${p.chat.workspace}:${P}`:p.chat.workspaceHint,"aria-label":p.chat.workspace,onClick:L,className:X2,children:[K("ml-0.5"),s.jsx("span",{className:`min-w-0 truncate ${P?"font-mono":""}`,children:H}),s.jsx(ra,{open:o,size:12,className:"shrink-0 text-gray-400"})]}),children:s.jsxs("div",{className:"space-y-1.5 px-2.5 pb-2.5 pt-2",children:[s.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800",children:[s.jsxs("div",{className:"flex items-center gap-1.5 border-b border-gray-100 px-1.5 py-1 dark:border-gray-800",children:[s.jsx("input",{value:T,placeholder:"…","aria-label":p.chat.workspace,...yd,onChange:Z=>E(Z.target.value),onBlur:()=>{O()},onKeyDown:Z=>{Z.key==="Enter"&&!Z.nativeEvent.isComposing?(Z.preventDefault(),O()):Z.key==="Escape"&&E(h?.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"}),s.jsx("button",{type:"button",disabled:!h,onClick:()=>{h&&(r(h.path),c(!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:p.chat.workspaceUseThis})]}),s.jsxs("ul",{className:"max-h-40 overflow-y-auto py-1",children:[I!==null&&s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>M(I),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:["↰ ",p.chat.workspaceUp]})}),F.map(Z=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>M(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:[s.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:s.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"})}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z.name})]})},Z.path)),h&&F.length===0&&s.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:p.chat.workspaceNoSubdirs}),y&&s.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:p.common.loading}),w&&s.jsxs("li",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 text-xs text-red-500",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",title:w,children:w}),s.jsx("button",{type:"button",onClick:()=>M(""),className:"shrink-0 rounded border border-gray-300 px-1.5 py-0.5 text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:p.common.retry})]})]})]}),P&&s.jsx("button",{type:"button",onClick:()=>{r(""),c(!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:p.chat.workspaceClear}),s.jsx("p",{className:"px-0.5 text-xs leading-5 text-gray-400 dark:text-gray-500",children:p.chat.workspaceHint})]})})}const E_=300;function Db(e){try{return sessionStorage.getItem(`penguin.chatRouteApplied.${e}`)}catch{return null}}function zb(e,n){try{sessionStorage.setItem(`penguin.chatRouteApplied.${e}`,n)}catch{}}const A_={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 R_({projectId:e,models:n}){const r=aa(),l=ja(),{agents:o,currentAgent:c,setCurrentAgentId:d}=on(),{add:f}=dl(),m=Ln().user?.userId??null,[h]=b.useState(()=>m?ec(rl(m,e)):{}),[g,y]=b.useState(h.agentId??c?.agentId??null),[k,w]=b.useState(h.workspace??""),[S,T]=b.useState(h.approvalMode??"allow-all"),[E,M]=b.useState(h.modelRef??null),L=b.useRef(h.text??""),O=b.useRef(h.skills??[]),[P,H]=b.useState(null);b.useEffect(()=>{let X=!1;return Gv(e).then(me=>{X||H(me)}).catch(()=>{X||H({})}),()=>{X=!0}},[e]);const I=b.useRef({agent:!1,workspace:!1,approval:!1}),F=l.state,K=F?.agentId,Z=b.useRef(null),z=b.useRef(!1);b.useEffect(()=>{if(o.length===0)return;const X=me=>!!me&&o.some(Ne=>Ne.agentId===me);if(K&&Z.current!==l.key&&Db("agentId")!==l.key&&(Z.current=l.key,zb("agentId",l.key),X(K))){y(K);return}if(P?.agentId!==void 0&&!z.current&&(z.current=!0,Z.current===null&&h.agentId===void 0&&!I.current.agent&&X(P.agentId))){y(P.agentId);return}X(g)||y((o.find(me=>me.agentId==="default_agent")??o[0])?.agentId??null)},[o,g,l.key,K,P,h.agentId]);const B=F?.workspace,A=b.useRef(null);b.useEffect(()=>{B===void 0||A.current===l.key||Db("workspace")===l.key||(A.current=l.key,zb("workspace",l.key),w(B))},[l.key,B]);const $=b.useRef(!1);b.useEffect(()=>{P===null||$.current||($.current=!0,P.workspace!==void 0&&B===void 0&&h.workspace===void 0&&!I.current.workspace&&w(P.workspace),P.approvalMode!==void 0&&h.approvalMode===void 0&&!I.current.approval&&T(P.approvalMode))},[P,B,h.workspace,h.approvalMode]),b.useEffect(()=>{if(!n||E&&n.models.some(me=>wt(me,E)))return;const X=n.models[0];M(n.defaultModel??(X?{provider:X.provider,modelId:X.modelId}:null))},[n,E]);const[q,U]=b.useState(null);b.useEffect(()=>{if(U(null),!g)return;let X=!1;return pp(e,g).then(me=>{X||U(me.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{X=!0}},[e,g]);const V=q===null||P===null?null:$I(q,P.thinkingLevel),W=b.useRef(null);W.current=q;const ce=b.useCallback(X=>{if(!g||!X)return;const me=W.current;U(X),Kv(e,g,{config:{model:{thinkingLevel:X}}}).catch(Ne=>{U(me),ht(_e(Ne))})},[e,g]),[te,N]=b.useState([]),[_,R]=b.useState(!1);b.useEffect(()=>{if(N(me=>me.length>0?[]:me),R(!1),!g)return;let X=!1;return ud(e,g).then(me=>{X||N(me.skills)}).catch(()=>{}).finally(()=>{X||R(!0)}),()=>{X=!0}},[e,g]);const C=b.useRef(null),Q=b.useCallback(()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null)},[]),ee=b.useCallback(()=>{if(Q(),!m)return;const X={text:L.current,workspace:k,approvalMode:S};g&&(X.agentId=g),E&&(X.modelRef=E),O.current.length>0&&(X.skills=O.current),ni(rl(m,e),X)},[Q,m,e,g,k,S,E]),ae=b.useRef(ee);b.useEffect(()=>{ae.current=ee,ee()},[ee]);const he=b.useCallback(X=>{L.current=X,Q(),C.current=window.setTimeout(()=>{C.current=null,ae.current()},E_)},[Q]),xe=b.useCallback(X=>{O.current=X,ae.current()},[]);b.useEffect(()=>()=>{C.current!==null&&(window.clearTimeout(C.current),ae.current())},[]);const ie=b.useCallback(()=>{Q(),O.current=[],m&&(E?ni(rl(m,e),{modelRef:E}):rd(rl(m,e)))},[Q,m,e,E]),ye=X=>{I.current.agent=!0,y(X.agentId),d(X.agentId)},ve=b.useCallback(X=>{I.current.workspace=!0,w(X)},[]),Ke=b.useCallback(X=>{I.current.approval=!0,T(X)},[]),He=b.useRef(!1),[Ge,Qe]=b.useState(!1),ut=b.useCallback(async(X,me=!1,Ne=null)=>{if(!g||He.current)return!1;He.current=!0,Qe(!0);let Ae=null;try{const Oe={approvalMode:S};E&&(Oe.modelId=E.modelId,Oe.provider=E.provider),k.trim()&&(Oe.workspace=k.trim());const re=await Nh(e,g,Oe);Ae=re.session.sessionId;const ke=await xo(Ae,{input:X,...Ne?{goal:Ne}:{}});return f(re.session),me||ie(),r(`/chat/${ke.sessionId}`,{replace:!0}),!0}catch(Oe){return Ae&&Fu(Ae).catch(()=>{}),ht(_e(Oe,E?{modelId:E.modelId}:{})),!1}finally{He.current=!1,Qe(!1)}},[e,g,S,E,k,f,ie,r]),[Yt,en]=b.useState(null),tn=b.useCallback(async X=>{if(Yt===null){en(X.id);try{const me=X.skills.filter(Ne=>te.some(Ae=>Ae.name===Ne));await ut([{type:"text",text:Dh(me,p.chat.exampleTasks[X.id].prompt)}],!0)}finally{en(null)}}},[Yt,te,ut]),[wn,Pt]=b.useState(sp[0].id),xn=o.find(X=>X.agentId===g)??null,yn=n?.models.find(X=>wt(X,E)),st=yn?.contextWindow,Wt=yn?.vision!==!1;return s.jsxs("div",{className:"anim-fade flex min-h-0 flex-1 flex-col overflow-y-auto px-3 py-6 md:px-4",children:[s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[s.jsxs("div",{className:"mb-10 text-center",children:[s.jsx(W2,{className:"mx-auto mb-1 h-36 w-36 rounded-3xl"}),s.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:p.appName}),s.jsx("p",{className:"mt-2 text-base text-gray-400 dark:text-gray-500",children:p.chat.draftSubtitle}),s.jsx(I_,{})]}),s.jsx(B2,{status:"idle",onSend:(X,me)=>ut(X,!1,me),onStop:async()=>{},onCompact:async()=>{},modelRef:E,models:n?.models??[],onChangeModel:M,thinkingLevel:V,onChangeThinkingLevel:ce,...n?.defaultModel!==void 0?{defaultModel:n.defaultModel}:{},...st!==void 0?{contextWindow:st}:{},contextNow:0,vision:Wt,approvalMode:S,onChangeApprovalMode:Ke,modeSaving:!1,autoFocus:!0,agents:o,...g?{currentAgentId:g}:{},skills:te,...h.skills&&h.skills.length>0?{initialSkills:h.skills}:{},onSkillsChange:xe,initialText:h.text??"",onTextChange:he}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsx(__,{agents:o,selected:xn,onSelect:ye}),s.jsx(Z2,{projectId:e,workspace:k,onChange:ve})]}),s.jsx("div",{className:"mt-6 space-y-1",children:sp.map(X=>{const me=X.id===wn;return s.jsxs("div",{children:[s.jsxs("button",{type:"button","aria-expanded":me,onClick:()=>Pt(X.id),className:`flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left transition-colors duration-150 ${me?"bg-gray-100 dark:bg-gray-800/70":"hover:bg-gray-100 dark:hover:bg-gray-800/70"}`,children:[s.jsx("span",{className:"shrink-0 text-brand-500 dark:text-brand-400",children:s.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:s.jsx("path",{d:A_[X.id]})})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-gray-700 dark:text-gray-300",children:p.chat.exampleFolders[X.id]}),s.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:X.tasks.length}),s.jsx(ra,{open:me,size:14,className:"text-gray-400"})]}),me&&s.jsx("ul",{className:"mt-0.5 space-y-0.5 pl-4",children:X.tasks.map(Ne=>{const Ae=p.chat.exampleTasks[Ne.id];return s.jsx("li",{children:s.jsxs("button",{type:"button",title:Ae.desc,disabled:Yt!==null||Ge||!_||!g||!n,onClick:()=>{tn(Ne)},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:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:Ae.label}),Yt===Ne.id&&s.jsx("span",{className:"shrink-0 text-xs text-gray-400",children:p.common.loading})]})},Ne.id)})})]},X.id)})})]}),s.jsx("div",{className:"flex-1"})]})}const Ub="ml-1.5 inline-block align-super text-[10px] leading-4 text-gray-400 dark:text-gray-500";function I_(){const{locale:e}=Pa(),{version:n,update:r}=K2(!0);if(n===null)return null;const l=n.buildDate;return s.jsxs("p",{className:"mt-1.5 text-xs text-gray-400 dark:text-gray-500",children:[`v${n.version}${l!==null?` · ${p.update.lastUpdated(Hk(l,e))}`:""}`,r!==null&&r.updateAvailable&&r.latestVersion!==null&&(r.releaseUrl!==null?s.jsx("a",{href:r.releaseUrl,target:"_blank",rel:"noopener noreferrer",title:p.update.newVersion(r.latestVersion),"aria-label":p.update.newVersion(r.latestVersion),className:`${Ub} hover:underline`,children:p.update.newVersionBadge}):s.jsx("span",{className:Ub,children:p.update.newVersionBadge}))]})}function __({agents:e,selected:n,onSelect:r}){const[l,o]=b.useState(!1);return s.jsx(Sa,{open:l,setOpen:o,menuClass:"left-0 top-full mt-1 w-72 max-w-[calc(100vw-2rem)] origin-top-left",button:s.jsxs("button",{type:"button",title:p.chat.chooseAgent,"aria-label":p.chat.chooseAgent,onClick:()=>o(!l),className:X2,children:[n?s.jsx(na,{id:n.agentId,name:Gt(n),size:16,className:"shrink-0 rounded"}):null,s.jsx("span",{className:"min-w-0 truncate",children:n?Gt(n):p.common.loading}),s.jsx(ra,{open:l,size:12,className:"shrink-0 text-gray-400"})]}),children:s.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&s.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:p.common.loading}),e.map(c=>{const d=c.agentId===n?.agentId;return s.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:[s.jsx(na,{id:c.agentId,name:Gt(c),size:20,className:"shrink-0 rounded"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.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:Gt(c)}),c.description&&s.jsx("span",{className:"block truncate text-[11px] text-gray-400 dark:text-gray-500",children:c.description})]}),s.jsx("span",{className:"w-4 shrink-0 text-center text-xs text-gray-500 dark:text-gray-400",children:d?"✓":""})]},c.agentId)})]})})}function J2(){return{sessionId:null,taskCount:0,sessionCost:null,costUncosted:!1,settledUsd:0,lastLiveUsd:0,liveAtFetchUsd:0,pendingFetchSnapshot:!1,shownUsd:null,shownUncosted:!1}}function L_(e,n,r){e.sessionId===n&&r!==null&&(e.costUncosted=r.hasUncosted,r.cost!=null&&(e.sessionCost=r.cost,e.settledUsd=0,e.pendingFetchSnapshot=!0))}function $b(e){return e.sessionCost!=null||e.settledUsd>0?(e.sessionCost??0)+e.settledUsd:null}function Bb(e,n,r,l){return n!=null&&(e.shownUsd=n,e.shownUncosted=r),{costText:n!=null?er(n,l):null,costUncosted:r}}function O_(e,n){if(n.sessionId!==e.sessionId&&Object.assign(e,J2(),{sessionId:n.sessionId}),n.loading){const f=e.shownUsd??$b(e),m=e.shownUsd!=null?e.shownUncosted:e.costUncosted;return Bb(e,f,m,n.currency)}if(n.taskCount<e.taskCount&&(e.taskCount=n.taskCount,e.lastLiveUsd=0,e.liveAtFetchUsd=0),e.pendingFetchSnapshot&&(!n.taskOpen||n.liveUsd!=null)){e.pendingFetchSnapshot=!1;const f=n.taskOpen?n.liveUsd??0:0;e.liveAtFetchUsd=f,e.lastLiveUsd=f}(n.taskCount>e.taskCount||!n.taskOpen&&(e.lastLiveUsd>0||e.liveAtFetchUsd>0))&&(e.settledUsd+=Math.max(0,e.lastLiveUsd-e.liveAtFetchUsd),e.lastLiveUsd=0,e.liveAtFetchUsd=0),e.taskCount=n.taskCount,n.taskOpen&&n.liveUsd!=null&&(e.lastLiveUsd=n.liveUsd);const r=$b(e),l=n.taskOpen&&n.liveUsd!=null?Math.max(0,n.liveUsd-e.liveAtFetchUsd):null,o=l!=null&&(l>0||r!=null)?(r??0)+l:r;let c;o==null||n.taskOpen&&e.shownUsd!=null&&o<e.shownUsd?c=e.shownUsd:c=o;const d=o==null?e.shownUncosted:e.costUncosted;return Bb(e,c,d,n.currency)}const lp={damping:1,response:.35},Hb={damping:.8,response:.3};function D_(e,n,r,l,o){const c=2*Math.PI/l.response,d=c*c,f=2*l.damping*c;let m=e,h=n,g=Math.min(o,64);for(;g>0;){const y=Math.min(g,8)/1e3,k=-d*(m-r)-f*h;h+=k*y,m+=h*y,g-=8}return[m,h]}function Pb(e,n,r){return Math.abs(e-r)<.5&&Math.abs(n)<5}function z_(e,n){let r=e,l=0,o=e,c=lp,d,f=0,m=0;const h=()=>{f&&cancelAnimationFrame(f),f=0,m=0,d=void 0},g=y=>{const k=m?y-m:16;if(m=y,[r,l]=D_(r,l,o,c,k),Pb(r,l,o)){r=o,l=0,f=0,m=0,n(r);const w=d;d=void 0,w?.();return}n(r),f=requestAnimationFrame(g)};return{get value(){return r},get velocity(){return l},animateTo(y,k,w){if(o=y,c=k,w?.velocity!==void 0&&(l=w.velocity),d=w?.onSettle,Pb(r,l,o)){r=o,l=0,n(r);const S=d;d=void 0,S?.();return}f||(f=requestAnimationFrame(g))},stop(){return h(),[r,l]},set(y){h(),r=y,l=0,n(r)},dispose:h}}function U_(e,n=.998){return e/1e3*n/(1-n)}function $_(e,n,r=.55){return e*n*r/(n+r*Math.abs(e))}function B_(e,n){let r=n[0];for(const l of n)Math.abs(l-e)<Math.abs(r-e)&&(r=l);return r}const H_=.92,P_=.6;function F_(){const[e,n]=b.useState(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches);return b.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)"),l=o=>n(o.matches);return r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[]),e}function eS({open:e,snap:n,onSnapChange:r,onClose:l,title:o,children:c}){const[d,f]=b.useState(e),m=b.useRef(null),h=b.useRef(null),g=b.useRef(null),y=b.useRef(0),k=b.useRef(!1),w=b.useRef(!1),S=b.useRef(null),T=b.useRef([]),E=b.useRef({pointerY:0,sheetY:0}),M=b.useRef(e);M.current=e;const L=b.useRef(null),O=F_(),P=b.useCallback(B=>{const A=y.current||1;m.current&&(m.current.style.transform=`translate3d(0, ${B}px, 0)`),h.current&&(h.current.style.opacity=String(Math.min(1,Math.max(0,1-B/A))))},[]),H=b.useCallback(B=>{const A=y.current;return B==="full"?0:A*(1-P_/H_)},[]);b.useEffect(()=>{e&&f(!0)},[e]),b.useLayoutEffect(()=>{if(!d)return;const B=m.current;B&&(y.current=B.offsetHeight,g.current||(g.current=z_(y.current,P),g.current.set(y.current)))},[d,P]),b.useEffect(()=>{if(!d)return;const B=g.current;if(B)if(e){if(w.current=!1,k.current)return;const A=H(n);if(S.current!==null&&Math.abs(S.current-A)<1)return;if(S.current=A,O){B.set(A);return}B.animateTo(A,lp)}else{if(w.current=!0,S.current=y.current,O){f(!1);return}B.animateTo(y.current,lp,{onSettle:()=>f(!1)})}},[d,e,n,O,H]),b.useEffect(()=>{d||(g.current?.dispose(),g.current=null,S.current=null,k.current=!1,w.current=!1)},[d]),b.useEffect(()=>()=>g.current?.dispose(),[]),b.useEffect(()=>{if(!d)return;const B=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=B}},[d]),b.useEffect(()=>{if(!d||!e)return;const B=A=>{A.key==="Escape"&&l()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[d,e,l]),b.useEffect(()=>{if(d)return L.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>L.current?.focus()},[d]),b.useEffect(()=>{if(!d)return;const B=()=>{const A=m.current;if(!A||(y.current=A.offsetHeight,k.current||w.current))return;const $=H(n);S.current=$,g.current?.set($)};return window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[d,n,H]);const I=B=>{if(w.current)return;const A=g.current;if(!A)return;B.currentTarget.setPointerCapture(B.pointerId);const[$]=A.stop();k.current=!0,E.current={pointerY:B.clientY,sheetY:$},T.current=[{y:B.clientY,t:performance.now()}]},F=B=>{if(!k.current)return;const A=g.current;if(!A)return;const $=E.current.sheetY+(B.clientY-E.current.pointerY),q=y.current,U=$<0?-$_(-$,q):Math.min($,q);A.set(U);const V=performance.now(),W=T.current;for(W.push({y:B.clientY,t:V});W.length>2&&V-W[0].t>100;)W.shift()},K=B=>{k.current=!1;const A=g.current;if(!A)return;const $=y.current,q=H("half"),U=M.current?A.value+U_(B):$,V=B_(U,[0,q,$]);if(S.current=V,V===$){if(w.current=!0,O){f(!1),l();return}A.animateTo($,Hb,{velocity:B,onSettle:()=>{f(!1),l()}});return}A.animateTo(V,Hb,{velocity:B});const W=V===0?"full":"half";W!==n&&r?.(W)},Z=()=>{if(!k.current)return;const B=T.current,A=B[B.length-1],$=B[0],q=A&&$?A.t-$.t:0;K(q>0?(A.y-$.y)/q*1e3:0)},z=()=>{k.current&&K(0)};return d?s.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":o,children:[s.jsx("div",{ref:h,className:`absolute inset-0 bg-black/45 ${O?"anim-fade":""}`,style:{opacity:0},onPointerDown:()=>l()}),s.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 ${O?"anim-fade":""}`,style:{transform:"translate3d(0, 100%, 0)"},children:[s.jsxs("div",{className:"shrink-0 cursor-grab touch-none select-none active:cursor-grabbing",onPointerDown:I,onPointerMove:F,onPointerUp:Z,onPointerCancel:z,onLostPointerCapture:z,children:[s.jsx("div",{className:"mx-auto mt-2 h-1 w-9 rounded-full bg-gray-300 dark:bg-gray-600"}),s.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 pt-1.5",children:[s.jsx("span",{className:"text-base font-semibold",children:o??""}),s.jsx(Tp,{onClose:l,onPointerDown:B=>B.stopPropagation()})]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]",children:c})]})]}):null}function Cd(e){return s.jsx("span",{className:"relative",children:s.jsx("input",{type:"file",className:"sr-only",...e})})}const q_=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"]),V_=new Set(["png","jpg","jpeg","gif","webp","svg"]),G_=new Set(["html","htm"]),vu=256*1024,Fb=64*1024,W_={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 K_(e){return W_[e]??"text"}function qb(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function ku(e,n){return e===""?n:`${e}/${n}`}function Vb(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}const Gb=/^[a-z][a-z0-9+.-]*:/i;function Wb(e,n){const r=n.startsWith("/")||e===""?[]:e.split("/");for(const l of n.split("/"))l===""||l==="."||(l===".."?r.pop():r.push(l));return r.join("/")}const uh="<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 Y_(e){return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,n=>n+uh):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,n=>n+uh):uh+e}let wu=0;function Kb({session:e,openRequest:n,active:r,onPreviewOpen:l}){const{previewIsolated:o}=Ln(),[c,d]=b.useState(""),[f,m]=b.useState(null),[h,g]=b.useState(null),[y,k]=b.useState(null),[w,S]=b.useState(!1),[T,E]=b.useState(null),[M,L]=b.useState(0),[O,P]=b.useState(!1),[H,I]=b.useState("rendered"),[F,K]=b.useState(null),Z=b.useRef(o);Z.current=o,b.useEffect(()=>{let N=!1;return g(null),RN(e.sessionId,c).then(_=>{N||m(_)}).catch(_=>{N||g(_ instanceof ka?_.message:p.files.loadFailed)}),()=>{N=!0}},[e.sessionId,c,M]);const[z,B]=b.useState(e.sessionId);z!==e.sessionId&&(B(e.sessionId),d(""),k(null),m(null),K(null),wu++);const A=b.useRef(r);b.useEffect(()=>{r&&!A.current&&L(N=>N+1),A.current=r},[r]);const $=b.useRef(l);$.current=l;const q=b.useCallback(async N=>{$.current?.();const _=N.includes("/")?N.slice(N.lastIndexOf("/")+1):N,R=qb(_),C=++wu,Q=he=>{C===wu&&k(he)};if(I("rendered"),K(null),V_.has(R)){Q({path:N,name:_,kind:"image",nonce:C});return}if(R==="pdf"){Q({path:N,name:_,kind:"pdf",nonce:C});return}const ee=G_.has(R),ae=R==="md";if(!ee&&!q_.has(R)){Q({path:N,name:_,kind:"unsupported",nonce:C});return}if(ee&&Z.current){Q({path:N,name:_,kind:"html",nonce:C});return}try{const he=await fetch(xs(e.sessionId,N),{credentials:"same-origin"});if(!he.ok)throw new Error(String(he.status));const xe=await he.text(),ie=xe.length>vu;ae&&xe.length>Fb&&C===wu&&I("source"),Q({path:N,name:_,kind:ee?"html":ae?"md":"text",content:ie?xe.slice(0,vu):xe,truncated:ie,nonce:C})}catch{Q({path:N,name:_,kind:"unsupported",nonce:C})}},[e.sessionId]);b.useEffect(()=>{if(y?.kind!=="html"||y.content!==void 0||H!=="source"&&o)return;const N=y.path;let _=!1;return K(null),(async()=>{try{const R=await fetch(xs(e.sessionId,N),{credentials:"same-origin"});if(!R.ok)throw new Error(String(R.status));const C=await R.text();if(_)return;const Q=C.length>vu;k(ee=>ee!==null&&ee.kind==="html"&&ee.path===N&&ee.content===void 0?{...ee,content:Q?C.slice(0,vu):C,truncated:Q}:ee)}catch{_||K(p.files.loadFailed)}})(),()=>{_=!0}},[y,H,o,e.sessionId]);const U=b.useRef(null);b.useEffect(()=>{if(!n||U.current===n)return;U.current=n;const N=n.path,_=N.includes("/")?N.slice(0,N.lastIndexOf("/")):"";d(_),L(R=>R+1),q(N)},[n,q]);const V=N=>{q(ku(c,N))},W=N=>{S(!0),g(null),(async()=>{try{for(const _ of N){const R=await new Promise((C,Q)=>{const ee=new FileReader;ee.onload=()=>{const ae=ee.result;C(ae.slice(ae.indexOf(",")+1))},ee.onerror=()=>Q(new Error("read failed")),ee.readAsDataURL(_)});await IN(e.sessionId,ku(c,_.name),R)}_n(p.files.uploaded),L(_=>_+1)}catch(_){ht(_e(_))}finally{S(!1)}})()},ce=N=>{const _=N.target.files?[...N.target.files]:[];if(N.target.value="",_.length===0)return;const R=new Set((f?.entries??[]).map(Q=>Q.name)),C=_.filter(Q=>R.has(Q.name)).map(Q=>Q.name);C.length>0?E({files:_,clashes:C}):W(_)},te=c===""?[]:c.split("/");return y!==null?s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.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:[s.jsxs("button",{type:"button",onClick:()=>{k(null),L(N=>N+1)},title:p.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:[s.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:s.jsx("path",{d:"M15 18l-6-6 6-6"})}),p.files.backToList]}),s.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")&&s.jsx("div",{className:"flex shrink-0 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800",children:[["rendered",p.files.htmlRendered],["source",p.files.htmlSource]].map(([N,_])=>s.jsx("button",{type:"button",onClick:()=>I(N),className:`rounded px-2 py-0.5 text-xs transition-colors duration-150 ${H===N?"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:_},N))}),/\.html?$/i.test(y.name)&&s.jsxs("a",{href:n1(e.sessionId,y.path),target:"_blank",rel:"noopener noreferrer",title:o?void 0:p.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:[p.files.openInNewTab,!o&&s.jsx("span",{"aria-label":p.files.previewNotIsolatedHint,className:"text-amber-600 dark:text-amber-500",children:"⚠"})]}),s.jsx("a",{href:xs(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:p.files.download})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:y.kind==="image"?s.jsx("img",{src:xs(e.sessionId,y.path),alt:y.name,className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):y.kind==="pdf"?s.jsx("iframe",{src:xs(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"&&H==="rendered"?o?s.jsx("iframe",{src:n1(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?F!==null?s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:F}):s.jsx(ba,{rows:6}):s.jsx("iframe",{srcDoc:Y_(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"&&H==="rendered"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"md-body text-base leading-relaxed text-gray-800 dark:text-gray-100",children:s.jsx(Xo,{remarkPlugins:[Zo],components:{img:({src:N,alt:_})=>s.jsx("img",{src:typeof N=="string"&&!Gb.test(N)?xs(e.sessionId,Wb(Vb(y.path),N)):N,alt:_??"",loading:"lazy",className:"max-w-full"}),a:({href:N,children:_})=>{if(typeof N!="string"||N.startsWith("#"))return s.jsx("a",{href:N,children:_});if(Gb.test(N))return s.jsx("a",{href:N,target:"_blank",rel:"noreferrer",children:_});const R=Wb(Vb(y.path),N);return s.jsx("a",{href:xs(e.sessionId,R),onClick:C=>{C.preventDefault(),q(R)},children:_})}},children:y.content??""})}),y.truncated&&s.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",p.files.previewTruncated]})]}):y.kind==="text"||y.kind==="html"||y.kind==="md"?y.content===void 0?F!==null?s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:F}):s.jsx(ba,{rows:6}):s.jsxs(s.Fragment,{children:[s.jsx(tg,{language:K_(qb(y.name)),code:y.content,highlight:y.content.length<=Fb}),y.truncated&&s.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",p.files.previewTruncated]})]}):s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:p.files.previewUnsupported})})]}):s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.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:[s.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:p.files.root}),te.map((N,_)=>s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),s.jsx("button",{type:"button",onClick:()=>d(te.slice(0,_+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:N})]},_)),s.jsx("span",{className:"flex-1"}),s.jsx(Sa,{open:O,setOpen:P,menuClass:"right-0 top-full mt-1 w-max max-w-72 origin-top-right",button:s.jsx(we,{size:"sm",variant:O?"primary":"ghost",onClick:()=>P(N=>!N),children:p.files.details}),children:s.jsxs("div",{className:"px-3.5 py-2.5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:p.files.workspacePath}),s.jsx("p",{className:"mt-1 break-all font-mono text-xs leading-5",children:e.workspace})]})}),s.jsx(we,{size:"sm",variant:"ghost",onClick:()=>L(N=>N+1),children:p.files.refresh}),s.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:[s.jsx(Cd,{multiple:!0,onChange:ce,disabled:w}),w?p.common.saving:p.files.upload]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:h?s.jsx("p",{className:"px-3 py-3 text-sm text-red-600 dark:text-red-400",children:h}):f===null?s.jsx(ba,{rows:6}):f.entries.length===0?s.jsx("p",{className:"px-3 py-3 text-sm text-gray-400",children:p.files.empty}):s.jsx("ul",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:f.entries.map(N=>s.jsx("li",{children:s.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:[s.jsxs("button",{type:"button",onClick:()=>N.kind==="dir"?d(ku(c,N.name)):V(N.name),className:"flex min-w-0 flex-1 items-center gap-2 text-left",title:N.name,children:[s.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:N.kind==="dir"?s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:s.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"})}):s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:s.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:N.name})]}),s.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400 dark:text-gray-500",children:N.kind==="file"?_o(N.sizeBytes):""}),s.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:block dark:text-gray-500",children:N.mtime?wa(N.mtime):""}),N.kind==="file"&&s.jsx("a",{href:xs(e.sessionId,ku(c,N.name),!0),download:N.name,title:p.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:s.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:s.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})})]})},N.name))})}),s.jsx(qn,{open:T!==null,title:p.files.overwriteTitle,tone:"primary",confirmLabel:p.files.upload,onClose:()=>E(null),onConfirm:()=>{T&&W(T.files),E(null)},children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.files.overwriteConfirm(T?.clashes.length??0)}),s.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:(T?.clashes??[]).map(N=>s.jsx("li",{className:"truncate py-0.5 font-mono text-xs",title:N,children:N},N))})]})})]})}function Q_(){return s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function X_({session:e,panel:n}){return n.isDocked?s.jsxs(s.Fragment,{children:[n.open&&s.jsx("div",{onMouseDown:n.startResize,onDoubleClick:n.resetWidth,title:p.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"}`}),s.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:s.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[s.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:p.files.title}),s.jsx("button",{type:"button",onClick:()=>n.setOpen(!1),title:p.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:s.jsx(Q_,{})})]}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(Kb,{session:e,openRequest:n.openRequest,active:n.open})})]})})]}):s.jsx(eS,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:p.files.title,children:s.jsx("div",{className:"flex h-full min-h-0 flex-col",children:s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(Kb,{session:e,openRequest:n.openRequest,active:n.open,onPreviewOpen:()=>n.setSheetSnap("full")})})})})}const Td=320,sd="penguin.panelWidth",Z_=["penguin.filesPanelWidth","penguin.subagentsPanelWidth"];function ld(e){return Math.max(Td,Math.min(720,Math.round(e*.5)))}function tS(e){return Math.min(ld(e),Math.max(Td,Math.round(e*.4)))}function J_(){try{const e=Number(localStorage.getItem(sd));if(Number.isFinite(e)&&e>0)return e;let n=null;for(const r of Z_){const l=Number(localStorage.getItem(r));Number.isFinite(l)&&l>0&&(n=Math.max(n??0,l)),localStorage.removeItem(r)}return n!==null&&localStorage.setItem(sd,String(Math.round(n))),n}catch{return null}}function eL(){const e=J_();return e===null?tS(window.innerWidth):Math.min(ld(window.innerWidth),Math.max(Td,Math.round(e)))}let id=null;const ip=new Set;function Su(){return id??=eL(),id}function dh(e){if(e!==id){id=e;for(const n of ip)n()}}function tL(e){return ip.add(e),()=>ip.delete(e)}function nS(){const e=b.useSyncExternalStore(tL,Su,Su),[n,r]=b.useState(!1),l=b.useRef(null);b.useEffect(()=>{if(!n)return;const d=m=>{const h=l.current?.getBoundingClientRect(),g=h?h.right:window.innerWidth;dh(Math.min(ld(window.innerWidth),Math.max(Td,g-m.clientX)))},f=()=>{r(!1);try{localStorage.setItem(sd,String(Math.round(Su())))}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=b.useCallback(d=>{d.preventDefault(),r(!0)},[]),c=b.useCallback(()=>{dh(tS(window.innerWidth));try{localStorage.removeItem(sd)}catch{}},[]);return b.useEffect(()=>{const d=()=>dh(Math.min(Su(),ld(window.innerWidth)));return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),{width:e,resizing:n,startResize:o,resetWidth:c,panelRef:l}}const Yb="(min-width: 1024px)";function nL(e){const[n,r]=b.useState(!1),[l,o]=b.useState("half"),[c,d]=b.useState(null),f=b.useCallback(k=>{k&&o("half"),r(k)},[]),m=nS(),[h,g]=b.useState(()=>window.matchMedia(Yb).matches);b.useEffect(()=>{d(null)},[e]),b.useEffect(()=>{const k=window.matchMedia(Yb),w=S=>g(S.matches);return k.addEventListener("change",w),()=>k.removeEventListener("change",w)},[]);const y=b.useCallback(k=>{o("full"),d({path:k})},[]);return{open:n,setOpen:f,sheetSnap:l,setSheetSnap:o,browsePath:y,openRequest:c,isDocked:h,...m}}function aL({nodes:e,selectedId:n,labelFor:r,onSelect:l}){const o=G8(e);return s.jsx("div",{role:"group","aria-label":p.subagentPanel.topologyLabel,className:"overflow-x-auto",children:s.jsxs("div",{className:"relative",style:{width:o.width,height:o.height},children:[s.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=>s.jsx("path",{d:c.path,fill:"none",stroke:"currentColor",strokeWidth:"1.5"},`${c.fromId}>${c.toId}`))}),o.nodes.map(({node:c,x:d,y:f})=>{const m=r(c),h=c.sessionId===n,g=c.running?p.subagentPanel.nodeRunning:p.subagentPanel.nodeDone,y=c.description!==null?`${m} · ${g}
|
|
171
|
-
${c.description}`:`${m} · ${g}`;return s.jsxs("button",{type:"button","aria-label":`${m} · ${g}`,"aria-pressed":h,title:y,onClick:()=>l(c),style:{left:d,top:f,width:Hu,height:bo},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:[s.jsxs("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[s.jsx(na,{id:c.agentId??c.sessionId,name:m,size:18}),s.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&&s.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:s.jsx(zo,{sinceMs:c.startedMs})}):c.elapsedMs!==void 0&&s.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:Mn(c.elapsedMs)}),s.jsx(Jo,{state:c.running?"running":"done",size:10})]}),c.description!==null&&s.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 rL({session:e,model:n,version:r,taskRunning:l,ctx:o,focusRequest:c,taskScope:d}){const{agents:f}=on(),{sessions:m}=dl(),[h,g]=b.useState(null);b.useEffect(()=>{c&&g({sessionId:c.sessionId,origin:c.origin})},[c]);const y=b.useMemo(()=>(d?F8(n,e.sessionId,l,d.anchorSessionId):null)??P8(n,e.sessionId,l),[n,r,e.sessionId,l,d]),k=y.find(H=>H.depth>0)??null,w=h??(k?{sessionId:k.sessionId,origin:k.origin}:null),S=H=>{if(H.depth===0){const I=f.find(F=>F.agentId===e.agentId);return I?I.name?.length?I.name:I.agentId:e.agentId}return Zh(H,f,m)??Jh(H.sessionId)},T=w!==null&&w.origin.length===0,E=w?y.find(H=>H.sessionId===w.sessionId)??null:null,M=w&&!T?V8(n,w.origin):null,L=E?S(E):w?Zh({sessionId:w.sessionId,agentId:M?.meta?.agentId??null},f,m)??p.chat.subagent:"",O=E?.running??!1,P=w?{...o,origin:w.origin,taskRunning:O}:null;return s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"shrink-0 border-b border-gray-200 px-3 pb-2 pt-1.5 dark:border-gray-800",children:[s.jsx("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:p.subagentPanel.topologyLabel}),y.length>1?s.jsx("div",{className:"max-h-48 overflow-y-auto",children:s.jsx(aL,{nodes:y,selectedId:w?.sessionId??null,labelFor:S,onSelect:H=>g({sessionId:H.sessionId,origin:H.origin})})}):s.jsx("p",{className:"py-1 text-xs text-gray-400 dark:text-gray-500",children:p.subagentPanel.empty})]}),w===null?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(hr,{title:p.subagentPanel.empty})}):T?s.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-4",children:s.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:p.subagentPanel.mainSessionNote})}):M===null?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(hr,{title:p.subagentPanel.empty})}):s.jsxs(s.Fragment,{children:[s.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:[s.jsx(na,{id:M.meta?.agentId??w.sessionId,name:L,size:16}),s.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-gray-700 dark:text-gray-300",children:L}),s.jsx("span",{title:w.sessionId,className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:Jh(w.sessionId)}),O&&s.jsx(Jo,{state:"running",size:10,label:p.chat.subagentRunning})]}),s.jsx("div",{className:"min-h-0 flex-1",children:P&&s.jsx(C2,{items:M.items,version:r,ctx:P},w.sessionId)})]})]})}function sL(){return s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function lL({session:e,panel:n,model:r,version:l,taskRunning:o,ctx:c}){const d=s.jsx(rL,{session:e,model:r,version:l,taskRunning:o,ctx:c,focusRequest:n.focusRequest,taskScope:n.taskScope},e.sessionId);return n.isDocked?s.jsxs(s.Fragment,{children:[n.open&&s.jsx("div",{onMouseDown:n.startResize,onDoubleClick:n.resetWidth,title:p.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"}`}),s.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:s.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[s.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:p.subagentPanel.title}),s.jsx("button",{type:"button",onClick:()=>n.setOpen(!1),title:p.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:s.jsx(sL,{})})]}),s.jsx("div",{className:"min-h-0 flex-1",children:d})]})})]}):s.jsx(eS,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:p.subagentPanel.title,children:s.jsx("div",{className:"flex h-full min-h-0 flex-col",children:s.jsx("div",{className:"min-h-0 flex-1",children:d})})})}const Qb="(min-width: 1024px)";function iL(){return{sessionId:null,taskCount:0,autoOpenedAt:null}}function oL(e,n){const r=n.sessionId!==e.sessionId,l=!r&&n.taskCount<e.taskCount;return(r||n.taskCount!==e.taskCount)&&(e.sessionId=n.sessionId,e.taskCount=n.taskCount,e.autoOpenedAt=l?n.taskCount:null),n.liveSpawn&&e.autoOpenedAt!==e.taskCount?(e.autoOpenedAt=e.taskCount,"autoOpen"):null}function cL(e){const[n,r]=b.useState(!1),[l,o]=b.useState("half"),[c,d]=b.useState(null),[f,m]=b.useState(null),h=b.useCallback(S=>{S&&(o("half"),m(null)),r(S)},[]),g=nS(),[y,k]=b.useState(()=>window.matchMedia(Qb).matches);b.useEffect(()=>{d(null),m(null)},[e]),b.useEffect(()=>{const S=window.matchMedia(Qb),T=E=>k(E.matches);return S.addEventListener("change",T),()=>S.removeEventListener("change",T)},[]);const w=b.useCallback((S,T)=>{o("full"),m({anchorSessionId:T[0]??S}),d({sessionId:S,origin:T})},[]);return{open:n,setOpen:h,sheetSnap:l,setSheetSnap:o,focusSubagent:w,focusRequest:c,taskScope:f,isDocked:y,...g}}const uL=300;function dL(e){const n=Ln().user?.userId??null,r=n&&e?Y2(n,e):null,l=b.useMemo(()=>r?ec(r):{},[r]),o=b.useRef(l.text??""),c=b.useRef(l.handoffAgentId??null),d=b.useRef(l.switchModelRef??null),f=b.useRef(l.skills??[]),m=b.useRef(null),h=b.useCallback(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),g=b.useCallback(()=>{if(h(),!r)return;const E=o.current,M=c.current,L=d.current,O=f.current;if(!E&&!M&&!L&&O.length===0){rd(r);return}const P={text:E};M&&(P.handoffAgentId=M),L&&(P.switchModelRef=L),O.length>0&&(P.skills=O),ni(r,P)},[h,r]);b.useEffect(()=>(o.current=l.text??"",c.current=l.handoffAgentId??null,d.current=l.switchModelRef??null,f.current=l.skills??[],()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null,g())}),[l,g]);const y=b.useCallback(E=>{o.current=E,h(),m.current=window.setTimeout(()=>{m.current=null,g()},uL)},[h,g]),k=b.useCallback(E=>{c.current=E,g()},[g]),w=b.useCallback(E=>{d.current=E,g()},[g]),S=b.useCallback(E=>{f.current=E,g()},[g]),T=b.useCallback(()=>{h(),o.current="",f.current=[],c.current=null,d.current=null,r&&rd(r)},[h,r]);return{initial:l,onTextChange:y,onHandoffTargetChange:k,onPendingModelChange:w,onSkillsChange:S,discard:T}}function fh(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}}const mh=200,fL=100,mL=1e6;function hL(e){const n=e.now??(()=>Date.now()),r=new Set,l=new Map;let o=yo(r),c=!1,d="buffering",f=[],m=null,h=null,g=0,y=!1,k=[],w=new Map,S=0,T=null,E=null;const M={hasMore:!1,loading:!1,error:null};let L=0;const O=()=>{k=[],w=new Map,S=0,T=null,E=null,M.hasMore=!1,M.loading=!1,M.error=null,L=0},P=A=>{O(),A!==void 0&&(T=A.before??null,E=A.before??null,M.hasMore=A.before!==void 0,L=A.earlierTurns)},H=()=>{l.size!==0&&(l.clear(),e.onPendingChange())},I=(A,$)=>{if(Ip(A)&&A.payload.type==="approval_decision"&&l.delete(Jl(A.origin,A.payload.tool_call_id))&&e.onPendingChange(),$&&!Yu(A.payload)&&W3($,A)){cw(o,A);return}Qu(o,A,n())},F=A=>{switch(A.type){case"approval_request":{const $=A.toolCall.payload.tool_call_id,q={toolCall:A.toolCall};if(A.origin&&(q.origin=A.origin),l.set(Jl(A.origin,$),q),!U3(o,A.origin,$)){const U={...A.toolCall};A.origin&&A.origin.length>0?U.origin=[...A.origin]:delete U.origin,Qu(o,U,n()),e.onModelChange()}e.onPendingChange();return}case"task_state":{m=A.state,e.onTaskState(A.state),e.onQueuedFollowUps?.(A.queued??0),e.onPendingSteering?.(A.pendingSteering??[]),A.state==="idle"&&(D3(o),H(),e.onModelChange());return}case"resync_required":{K();return}case"credentials_updated":{o.lastAuthFailureMs=null,e.onModelChange();return}case"hello":return}},K=async()=>{g+=1,d="buffering",f=[],H(),await z(g,yo(r),{page:{kind:"tail",limit:mh},splice:k.length>0})},Z=(A,$)=>{const q=fh($.cursor);if(!q)return A;const U=h===null?null:fh(h);if(U!==null&&U.epoch!==q.epoch)return A;const V=[],W=[];for(const te of A){const N=te.id===null?null:fh(te.id);N!==null&&N.epoch===q.epoch&&N.seq<=q.seq?(te.kind!=="omni"||!Yu(te.msg.payload))&&V.push(te):W.push(te)}const ce=$.fragments.map(te=>({kind:"omni",msg:te,id:null,seeded:!0}));return[...V,...ce,...W]},z=async(A,$,q={})=>{try{let U=await e.loadMessages(q.page);if(c||A!==g)return;if(q.splice===!0){const R=U.page?.before??null;if(!(U.page!==void 0&&R!==null&&R===E))if(U.page!==void 0&&R===null)P(U.page);else{if(U=await e.loadMessages(),c||A!==g)return;P(void 0)}}else q.page!==void 0?P(U.page):P(void 0);const{messages:V,live:W,serverNowMs:ce}=U;$&&(o=$);const te=o;U.page!==void 0&&v1(te.stats,U.page.prior),k1(te,V,n(),ce??null);const N=G3(V,100),_=W!==void 0?Z(f,W):f;f=[];for(let R=0;R<_.length;R+=1){const C=_[R];if(C.kind==="omni"?I(C.msg,N):F(C.ev),c)return;if(A!==g){f.push(..._.slice(R+1).filter(Q=>Q.kind!=="omni"||!Q.seeded));return}}d="live",m==="idle"&&w1(te),y=!1,e.onError(null),e.onLoading(!1),e.onModelChange()}catch(U){if(c||A!==g)return;y=!0,e.onLoading(!1),e.onError(U instanceof Error?U.message:String(U))}};return{get model(){return o},get prefixItems(){return k},get prefixSubagents(){return w},get outlineOffset(){return L},get older(){return M},get pendingApprovals(){return l},load:()=>(g+=1,z(g,void 0,{page:{kind:"tail",limit:mh}})),retry:async()=>{c||!y||(e.onError(null),e.onLoading(!0),g+=1,await z(g,yo(r),{page:{kind:"tail",limit:mh}}))},loadOlder:async()=>{if(c||d!=="live"||y||M.loading||!M.hasMore||T===null)return;const A=g;M.loading=!0,M.error=null,e.onModelChange();try{const $=await e.loadMessages({kind:"before",cursor:T,limit:fL});if(c||A!==g)return;if($.page===void 0)throw new Error("windowed history not supported");S+=1;const q=yo(r);q.nextItemId=-S*mL,v1(q.stats,$.page.prior),k1(q,$.messages,n(),null),w1(q),k=[...q.items,...k];const U=new Map(q.subagents);for(const[V,W]of w)U.set(V,W);w=U,T=$.page.before??null,M.hasMore=$.page.before!==void 0,L=$.page.earlierTurns}catch($){if(c||A!==g)return;M.error=$ instanceof Error?$.message:String($)}finally{!c&&A===g&&(M.loading=!1,e.onModelChange())}},handleOmni:(A,$=null)=>{if(!c){if($!==null&&(h=$),d==="buffering"){f.push({kind:"omni",msg:A,id:$});return}I(A,null),e.onModelChange()}},handleServer:(A,$=null)=>{if(!c){if($!==null&&(h=$),A.type==="session_title"){e.onSessionTitle?.(A.sessionId,A.title);return}if(A.type==="session_created"){e.onSessionCreated?.(A.sessionId);return}if(A.type==="goal_started"||A.type==="goal_round"||A.type==="goal_finished"){e.onGoalEvent?.(A);return}if(d==="buffering"){A.type==="task_state"&&(m=A.state,e.onTaskState(A.state),e.onQueuedFollowUps?.(A.queued??0),e.onPendingSteering?.(A.pendingSteering??[])),f.push({kind:"server",ev:A,id:$});return}F(A)}},markLocalDecision:A=>{z3(o,A)},resolveApproval:A=>{l.delete(A)&&e.onPendingChange()},dispose:()=>{c=!0}}}const pL=120,gL=new Map,xL=[],yL=new Map,bL={hasMore:!1,loading:!1,error:null};function vL(e,n,r,l){const[o,c]=b.useState(0),[d,f]=b.useState(!0),[m,h]=b.useState(n),[g,y]=b.useState(0),[k,w]=b.useState([]),[S,T]=b.useState(null),[E,M]=b.useState(0),[L,O]=b.useState(null),P=b.useCallback(ce=>{O(te=>ce.type==="goal_started"?{objective:ce.objective,status:"active",budget:ce.budget,used:0,rounds:0}:ce.type==="goal_round"?{objective:te?.objective??"",status:"active",budget:ce.budget,used:ce.used,rounds:ce.round}:{objective:te?.objective??"",status:ce.outcome,budget:te?.budget??-1,used:ce.used,rounds:ce.rounds})},[]),H=b.useRef(r);H.current=r;const I=b.useRef(l);I.current=l;const F=b.useRef(null),K=b.useRef(null);K.current===null&&(K.current=yo());const Z=b.useRef(null),z=b.useRef(null),B=b.useRef(0),A=b.useCallback(()=>{if(Z.current!==null||z.current!==null)return;const ce=()=>{B.current=Date.now(),c(N=>N+1)},te=B.current+pL-Date.now();if(te>0){z.current=window.setTimeout(()=>{z.current=null,ce()},te);return}Z.current=requestAnimationFrame(()=>{Z.current=null,ce()})},[]);b.useEffect(()=>{if(!e){F.current?.dispose(),F.current=null,h("idle"),y(0),w([]),f(!1),T(null),O(null),M(R=>R+1),c(R=>R+1);return}c(R=>R+1),f(!0),T(null),h(n),O(null),y(0),w([]),M(R=>R+1);let ce=!1;const te=()=>{bN(e).then(R=>{ce||!R.goal||R.goal.status!=="active"||O(C=>C??R.goal)}).catch(()=>{})},N=hL({loadMessages:R=>yN(e,R),onTaskState:h,onQueuedFollowUps:y,onPendingSteering:w,onLoading:f,onError:T,onModelChange:A,onPendingChange:()=>M(R=>R+1),onSessionTitle:(R,C)=>H.current?.(R,C),onSessionCreated:()=>I.current?.(),onGoalEvent:P});F.current=N;const _=O4(e,{onOmniMessage:N.handleOmni,onServerEvent:N.handleServer,onOpen:te,onError:R=>{R&&Uu().catch(()=>{})}});return N.load(),()=>{ce=!0,N.dispose(),_.close(),Z.current!==null&&(cancelAnimationFrame(Z.current),Z.current=null),z.current!==null&&(window.clearTimeout(z.current),z.current=null)}},[e]);const $=b.useCallback(ce=>{F.current?.markLocalDecision(ce)},[]),q=b.useCallback(ce=>{F.current?.resolveApproval(ce)},[]),U=b.useCallback(()=>{F.current?.retry()},[]),V=b.useCallback(()=>{F.current?.loadOlder()},[]),W=b.useCallback(()=>{const ce=F.current?.model;ce&&ce.lastAuthFailureMs!==null&&(ce.lastAuthFailureMs=null,c(te=>te+1))},[]);return{model:F.current?.model??K.current,prefixItems:F.current?.prefixItems??xL,prefixSubagents:F.current?.prefixSubagents??yL,outlineOffset:F.current?.outlineOffset??0,older:F.current?.older??bL,loadOlder:V,version:o,loading:d,taskState:m,queuedFollowUps:g,pendingSteering:k,lastAuthFailureMs:(F.current?.model??K.current).lastAuthFailureMs,dismissModelAuthDead:W,pendingApprovals:F.current?.pendingApprovals??gL,markLocalDecision:$,resolveApproval:q,error:S,retry:U,goal:L}}const ju={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 hh({icon:e,value:n,label:r}){return s.jsxs("span",{title:r,className:"flex shrink-0 items-center gap-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:[s.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:s.jsx("path",{d:e})}),n]})}function kL({stats:e,taskOpen:n,taskStartLocalMs:r}){const[l,o]=b.useState(()=>Date.now());return b.useEffect(()=>{if(!n)return;o(Date.now());const c=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(c)},[n]),n?s.jsx(s.Fragment,{children:$k(E3(e,n,r,l))}):s.jsx(s.Fragment,{children:Mn(e.sessionElapsedMs)})}function wL(e,n){const r=e.stats;return{tokensText:yt(r.sessionTotal+r.subagentTotal),costText:n.costText,costUncosted:n.costUncosted,elapsedNode:s.jsx(kL,{stats:r,taskOpen:e.taskOpen,taskStartLocalMs:e.taskStartLocalMs})}}const Ja="new",Xb=100;function SL(){const e=aa(),n=yk(),{currency:r}=Cs(),{currentProject:l,currentAgent:o,setCurrentAgentId:c,reloadAgents:d,agents:f}=on(),m=l?.projectId??null,h=o?.agentId??null,{sessions:g,loading:y,reload:k,add:w,replace:S,setStatus:T,setTitle:E}=dl(),M=b.useRef(J2()),L=b.useRef(null),[,O]=b.useState(0),[P,H]=b.useState(!1),[I,F]=b.useState(!1),[K,Z]=b.useState(!1),[z,B]=b.useState(null),[A,$]=b.useState(""),q=n.sessionId??null,U=nL(q),V=cL(q),W={...U,setOpen:Ce=>{Ce&&V.setOpen(!1),U.setOpen(Ce)}},ce={...V,setOpen:Ce=>{Ce&&U.setOpen(!1),V.setOpen(Ce)}},te=q===Ja,N=te?null:g.find(Ce=>Ce.sessionId===q)??null,_=N?{provider:N.provider,modelId:N.modelId}:null;gr(N?N.title??p.chat.defaultSessionTitle:p.nav.chat);const R=vL(N?.sessionId??null,N?.status??"idle",E,()=>{k()}),{initial:C,onTextChange:Q,onHandoffTargetChange:ee,onPendingModelChange:ae,onSkillsChange:he,discard:xe}=dL(N?.sessionId??null),ie=b.useMemo(()=>R.prefixItems.length>0?[...R.prefixItems,...R.model.items]:R.model.items,[R.version,q]),ye=b.useMemo(()=>PI(ie),[R.version,q]),ve=b.useMemo(()=>g_(ie),[R.version,q]),Ke=b.useMemo(()=>R.prefixItems.length>0||R.prefixSubagents.size>0?{...R.model,items:[...ie],subagents:new Map([...R.prefixSubagents,...R.model.subagents])}:R.model,[R.version,q]),He=b.useRef(null),Ge=S_(He,R.version),Qe=N?.sessionId??null,ut=N?.agentId??null;b.useEffect(()=>{Qe&&ut&&c(ut)},[Qe,ut,c]),b.useEffect(()=>{te&&(U.setOpen(!1),V.setOpen(!1))},[te]);const Yt=b.useRef(iL()),en=B8(R.model.items),tn=R.taskState!=="idle"&&q8(R.model);b.useEffect(()=>{oL(Yt.current,{sessionId:Qe,taskCount:en,liveSpawn:tn})==="autoOpen"&&V.isDocked&&!V.open&&!U.open&&V.setOpen(!0)},[Qe,en,tn]);const[wn,Pt]=b.useState([]);b.useEffect(()=>{if(Pt(Ie=>Ie.length>0?[]:Ie),!m||!ut)return;let Ce=!1;return ud(m,ut).then(Ie=>{Ce||Pt(Ie.skills)}).catch(()=>{}),()=>{Ce=!0}},[m,ut]);const[xn,yn]=b.useState("");b.useEffect(()=>{if(yn(""),!m||!ut)return;let Ce=!1;return pp(m,ut).then(Ie=>{Ce||yn(Ie.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{Ce=!0}},[m,ut]);const[st,Wt]=b.useState(null);b.useEffect(()=>{if(te||!q||y||g.some(Ie=>Ie.sessionId===q))return;let Ce=!1;return t1(q).then(Ie=>{Ce||w(Ie.session)},()=>{Ce||Wt(q)}),()=>{Ce=!0}},[te,q,y,g,w]),b.useEffect(()=>{if(y||te||q&&g.some(Ie=>Ie.sessionId===q)||q&&st!==q)return;const Ce=Ck(g);e(Ce?`/chat/${Ce.sessionId}`:`/chat/${Ja}`,{replace:!0})},[y,te,q,st,g,e]),b.useEffect(()=>{N&&T(N.sessionId,R.taskState)},[R.taskState,N,T]);const X=b.useRef(R.taskState);b.useEffect(()=>{const Ce=X.current;X.current=R.taskState,Ce!=="idle"&&R.taskState==="idle"&&(k(),d())},[R.taskState,k,d]);const me=b.useRef(new Map);b.useEffect(()=>{L.current=null,$(""),me.current=new Map},[q]);const Ne=b.useCallback(async Ce=>{const Ie=N?.sessionId??null,lt=me.current,xt=Ie===null?[]:Ce.filter(dt=>!lt.has(dt));if(Ie!==null&&xt.length>0)for(let dt=0;dt<xt.length;dt+=Xb){const bt=xt.slice(dt,dt+Xb),Qt=_N(Ie,bt).then(Xt=>new Set(Xt.existing)).catch(()=>null);for(const Xt of bt){const oa=Qt.then(yr=>yr?.has(Xt)??!1);lt.set(Xt,oa),oa.then(yr=>{lt.get(Xt)===oa&&(yr?lt.set(Xt,!0):lt.delete(Xt))})}}const zt=new Set;return await Promise.all(Ce.map(async dt=>{const bt=lt.get(dt);(bt===!0||bt instanceof Promise&&await bt)&&zt.add(dt)})),zt},[N?.sessionId]);b.useEffect(()=>{if(!m||!N||L.current===N.sessionId&&R.taskState!=="idle")return;let Ce=!1;return Qv(m,{groupBy:"session",agentId:N.agentId}).then(Ie=>{if(Ce)return;L.current=N.sessionId;const lt=Ie.groups.find(xt=>xt.key===N.sessionId);L_(M.current,N.sessionId,lt??null),O(xt=>xt+1)}).catch(()=>{}),()=>{Ce=!0}},[m,N,R.taskState]),b.useEffect(()=>{if(!m)return;let Ce=!1;return B(null),(async()=>{try{const Ie=await $o(m);if(Ce)return;B(Ie);const{prefs:lt}=await Vv();if(Ce||lt.credentialGuideSeen)return;const xt=Ie.models.find(dt=>wt(dt,Ie.defaultModel));(!Ie.defaultModel||!xt?.credential?.apiKeyMasked)&&H(!0),hp({credentialGuideSeen:!0}).catch(()=>{})}catch{}})(),()=>{Ce=!0}},[m]);const Ae=b.useCallback(async(Ce,Ie)=>{Ie!==Ce&&(await k(),e(`/chat/${Ie}`,{replace:!0}))},[k,e]),Oe=b.useCallback(async(Ce,Ie)=>{if(!N)return!1;try{const lt=await xo(N.sessionId,{input:Ce,...Ie?{goal:Ie}:{},...A?{thinkingLevel:A}:{}});return xe(),await Ae(N.sessionId,lt.sessionId),!0}catch(lt){return ht(_e(lt,{modelId:N.modelId})),!1}},[N,A,xe,Ae]),re=b.useCallback(async(Ce,Ie)=>{if(!m||!N)return!1;const lt=await t1(N.sessionId).then(dt=>dt.session.tracePath).catch(()=>{}),xt={type:"text",text:uI({sessionId:N.sessionId,...N.title!==void 0?{sessionTitle:N.title}:{},...lt!==void 0?{tracePath:lt}:{},workspace:N.workspace,prevProvider:N.provider,prevModelId:N.modelId})};let zt=null;try{const dt=await Nh(m,N.agentId,{provider:Ce.provider,modelId:Ce.modelId,workspace:N.workspace,approvalMode:N.approvalMode});zt=dt.session.sessionId;const bt=await xo(zt,{input:[xt,...Ie]});return w(dt.session),xe(),e(`/chat/${bt.sessionId}`),!0}catch(dt){return zt&&Fu(zt).catch(()=>{}),ht(_e(dt,{modelId:Ce.modelId})),!1}},[m,N,w,xe,e]),ke=b.useCallback(async(Ce,Ie)=>{if(!m||!o||!N)return!1;const lt={type:"text",text:cI({agentId:o.agentId,...o.name!==void 0?{agentName:o.name}:{},sessionId:N.sessionId,workspace:N.workspace,...N.title!==void 0?{sessionTitle:N.title}:{}})};let xt=null;try{const zt=await Nh(m,Ce.agentId,{approvalMode:N.approvalMode});xt=zt.session.sessionId;const dt=await xo(xt,{input:[lt,...Ie]});return w(zt.session),xe(),e(`/chat/${dt.sessionId}`),!0}catch(zt){return xt&&Fu(xt).catch(()=>{}),ht(_e(zt,z?.defaultModel?{modelId:z.defaultModel.modelId}:{})),!1}},[m,o,N,w,xe,e,z]),Me=b.useCallback(async()=>{N&&await kN(N.sessionId).catch(()=>{})},[N]),Te=b.useCallback(async Ce=>{if(!N)return!1;try{const Ie=await xo(N.sessionId,{input:Ce,queueIfBusy:!0});return xe(),await Ae(N.sessionId,Ie.sessionId),!0}catch(Ie){return ht(_e(Ie,{modelId:N.modelId})),!1}},[N,xe,Ae]),$e=b.useCallback(async(Ce,Ie=[],lt=[])=>{if(!N)return"failed";try{return await SN(N.sessionId,{text:Ce,...Ie.length>0?{images:Ie}:{},...lt.length>0?{files:lt}:{}}),xe(),"queued"}catch(xt){return xt instanceof ka&&xt.status===409?"not_running":(ht(_e(xt,{modelId:N.modelId})),"failed")}},[N,xe]),Ve=b.useCallback(async(Ce,Ie,lt)=>{if(!N)return;R.markLocalDecision(Ce);const xt=Jl(lt,Ce);try{await vN(N.sessionId,Ce,{decision:Ie}),R.resolveApproval(xt)}catch(zt){zt instanceof ka&&zt.status===404&&R.resolveApproval(xt)}},[N,R]),Xe=b.useCallback(Ce=>{!N||K||(Z(!0),Ch(N.sessionId,{approvalMode:Ce}).then(Ie=>S(Ie.session)).catch(Ie=>{ht(_e(Ie))}).finally(()=>Z(!1)))},[N,K,S]),et=b.useCallback(async()=>{if(N)try{const Ce=await jN(N.sessionId);await Ae(N.sessionId,Ce.sessionId)}catch(Ce){ht(_e(Ce,{modelId:N.modelId}))}},[N,Ae]),cn=b.useCallback(()=>{e(`/chat/${Ja}`)},[e]),bn=b.useCallback(()=>{e("/models")},[e]),Nt=z?.models.find(Ce=>wt(Ce,_))?.pricing,Sn={pendingApprovals:R.pendingApprovals,onApprove:Ve,origin:[],taskRunning:R.taskState!=="idle",taskCost:Ce=>b1(Ce.tokensByBucket,Nt),onRetryNow:()=>{N&&wN(N.sessionId).catch(()=>{})},onGiveUp:()=>{Me()},onOpenFile:Ce=>{W.setOpen(!0),W.browsePath(Ce)},onOpenSubagent:(Ce,Ie)=>{ce.setOpen(!0),ce.focusSubagent(Ce,[...Ie,Ce])},workspace:N?.workspace??null,statFiles:Ne},vn=[...R.pendingApprovals.keys()].some(Ce=>!Ce.startsWith(" "));if(!m||!h)return s.jsx("div",{className:"p-6",children:s.jsx(Vt,{className:"h-6 w-64"})});const Ct=R.model.taskOpen?b1({cacheRead:R.model.stats.taskCacheRead,cacheWrite:R.model.stats.taskCacheWrite,output:R.model.stats.taskOutput},Nt):null,It=wL(R.model,O_(M.current,{sessionId:N?.sessionId??null,taskCount:en,taskOpen:R.model.taskOpen,loading:R.loading,liveUsd:Ct,currency:r})),jn=z?.models.find(Ce=>wt(Ce,_)),Vn=jn?.contextWindow,la=jn?.vision!==!1,On=N!==null&&!R.loading&&!R.error&&R.model.items.length===0,Nn=z?.updatedAt!==void 0?Date.parse(z.updatedAt):NaN,tr=I3(R.lastAuthFailureMs,Number.isFinite(Nn)?Nn:null),ia=N&&s.jsx(B2,{status:R.taskState,modelAuthDead:tr,onOpenModels:bn,onRetryModelAuth:R.dismissModelAuthDead,onNewSession:cn,onSend:Oe,onSteer:$e,steeringDeliveredCount:R.model.items.filter(Ce=>Ce.kind==="user_steering").length,pendingSteering:R.pendingSteering,onQueueFollowUp:Te,queuedFollowUps:R.queuedFollowUps,onStop:Me,onCompact:et,modelRef:_,...z!==null?{models:z.models}:{},...z?.defaultModel!==void 0?{defaultModel:z.defaultModel}:{},onSwitchModel:re,turnThinkingLevel:A||xn,onChangeTurnThinkingLevel:$,...Vn!==void 0?{contextWindow:Vn}:{},contextNow:R.model.stats.contextNow,contextStale:R.model.stats.contextStale,vision:la,approvalMode:N.approvalMode,onChangeApprovalMode:Xe,modeSaving:K,autoFocus:!0,agents:f,currentAgentId:N.agentId,skills:wn,...C.skills&&C.skills.length>0?{initialSkills:C.skills}:{},onSkillsChange:he,onHandoff:ke,initialText:C.text??"",onTextChange:Q,history:ye,...C.handoffAgentId?{initialHandoffTargetId:C.handoffAgentId}:{},onHandoffTargetChange:ee,...C.switchModelRef?{initialPendingModelRef:C.switchModelRef}:{},onPendingModelChange:ae});return s.jsxs("div",{className:"flex h-full flex-col bg-white dark:bg-gray-950",children:[N&&s.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:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("h1",{className:"flex min-w-0 text-[15px] font-semibold",children:s.jsx(pd,{text:N.title??p.chat.defaultSessionTitle})}),R.taskState==="running"&&s.jsxs("span",{title:p.chat.statusRunning,className:"flex shrink-0 items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500"}),s.jsx("span",{className:"hidden sm:inline",children:p.chat.statusRunning})]})]}),s.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[s.jsx(hh,{icon:ju.tokens,value:It.tokensText,label:`${p.chat.statTokens}(Token)`}),It.costText!=null&&s.jsx(hh,{icon:ju.cost,value:`${It.costText}${It.costUncosted?" *":""}`,label:`${p.common.cost}(${r})${It.costUncosted?` · ${p.usage.uncostedNote}`:""}`}),s.jsx(hh,{icon:ju.elapsed,value:It.elapsedNode,label:p.chat.statElapsed})]}),s.jsxs("button",{type:"button","aria-expanded":ce.open,onClick:()=>ce.setOpen(!ce.open),title:p.chat.openAgents,"aria-label":p.chat.openAgents,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors duration-150 ${ce.open?"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200":"text-gray-500 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`,children:[s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:[s.jsx("circle",{cx:"5",cy:"12",r:"2.5"}),s.jsx("circle",{cx:"19",cy:"5.5",r:"2.5"}),s.jsx("circle",{cx:"19",cy:"18.5",r:"2.5"}),s.jsx("path",{d:"M7.4 11 16.7 6.6M7.4 13l9.3 4.4"})]}),s.jsx("span",{className:"hidden sm:inline",children:p.chat.openAgents}),vn&&s.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-amber-500"})]}),s.jsxs("button",{type:"button","aria-expanded":W.open,onClick:()=>W.setOpen(!W.open),title:p.chat.openWorkspace,"aria-label":p.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 ${W.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:[s.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:s.jsx("path",{d:ju.folder})}),s.jsx("span",{className:"hidden sm:inline",children:p.chat.openWorkspace})]}),!Ge.shown&&s.jsx(N_,{entries:ve,turnOffset:R.outlineOffset,scrollRef:He,running:R.taskState!=="idle"}),s.jsxs(Sa,{open:I,setOpen:F,menuClass:"right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] origin-top-right",button:s.jsx("button",{type:"button",title:p.chat.infoPanel,onClick:()=>F(!I),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:s.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:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"M12 11v5m0-8h.01"})]})}),children:[s.jsxs("div",{className:"space-y-3 px-3.5 py-2.5 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:p.chat.model}),s.jsxs("p",{className:"truncate text-xs",children:[s.jsx("span",{className:"font-mono",children:N.modelId}),s.jsx("span",{className:"ml-1.5 text-gray-400 dark:text-gray-500",children:Hr(N.provider)?.label??N.provider})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:p.chat.workspace}),s.jsx("p",{className:"break-all font-mono text-xs leading-5",children:N.workspace})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:p.common.created}),s.jsx("p",{className:"font-mono text-xs",children:wa(N.createdAt)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:p.chat.sessionStats}),s.jsxs("p",{className:"font-mono text-xs",children:[p.chat.statTokens," ",It.tokensText,It.costText!=null&&` · ${p.common.cost} ${It.costText}`," ·"," ",p.chat.statElapsed," ",It.elapsedNode]})]})]}),s.jsx("div",{className:"border-t border-gray-100 py-1 dark:border-gray-800",children:s.jsxs("button",{type:"button",onClick:()=>{F(!1),e(`/traces?agentId=${encodeURIComponent(N.agentId)}&sessionId=${encodeURIComponent(N.sessionId)}`)},className:"flex w-full items-center gap-2 px-3.5 py-2 text-left text-sm transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800",children:[s.jsx("svg",{width:"15",height:"15",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:s.jsx("path",{d:ya.traces})}),p.chat.viewTrace]})})]})]}),s.jsxs("div",{className:"flex min-h-0 flex-1",children:[s.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:te?s.jsx(R_,{projectId:m,models:z},`draft:${m}`):s.jsx("div",{className:"anim-fade flex min-h-0 flex-1 flex-col",children:N?R.error?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6",children:[s.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400",children:[p.chat.historyLoadFailed,":",R.error]}),s.jsx(we,{onClick:R.retry,children:p.common.retry})]}):R.loading?s.jsxs("div",{className:"space-y-3 p-6",children:[s.jsx(Vt,{className:"h-5 w-1/3"}),s.jsx(Vt,{className:"h-5 w-2/3"}),s.jsx(Vt,{className:"h-5 w-1/2"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-h-0 flex-1",children:On?s.jsx("div",{className:"flex h-full items-center justify-center px-4",children:s.jsx("p",{className:"text-lg font-medium text-gray-400 dark:text-gray-500",children:p.chat.emptyGreeting})}):s.jsx(C2,{items:ie,version:R.version,ctx:Sn,scrollElRef:He,older:{hasMore:R.older.hasMore,loading:R.older.loading,error:R.older.error,prependedCount:R.prefixItems.length,onLoad:R.loadOlder},outline:s.jsx(j_,{entries:ve,turnOffset:R.outlineOffset,version:R.version,scrollRef:He,running:R.taskState!=="idle",fit:Ge})})}),s.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:s.jsxs("div",{className:"mx-auto max-w-3xl",children:[R.goal&&s.jsx(tI,{goal:R.goal}),ia]})})]}):y?s.jsx("div",{className:"space-y-3 p-6",children:s.jsx(Vt,{className:"h-5 w-1/2"})}):s.jsx(hr,{title:p.chat.noSessions,action:s.jsx(we,{onClick:cn,children:p.nav.newChat})})},N?.sessionId??"empty")}),N&&s.jsx(lL,{session:N,panel:ce,model:Ke,version:R.version,taskRunning:R.taskState!=="idle",ctx:Sn}),N&&s.jsx(X_,{session:N,panel:W})]}),s.jsx(ln,{open:P,title:p.project.noCredentialTitle,onClose:()=>H(!1),footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:()=>H(!1),children:p.project.later}),s.jsx(we,{variant:"primary",onClick:()=>{H(!1),e("/models")},children:p.project.goToModels})]}),children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.project.noCredentialBody})})]})}const aS=/^[a-z][a-z0-9_]{1,63}$/,Zb=/^[a-z][a-z0-9_]{1,31}$/,jL=/^[a-z0-9_]+$/,NL=64,Jb=4,ev=16;function rS({open:e,onClose:n,estimatedHeight:r,panelWidth:l}){const o=b.useRef(null),c=b.useRef(null),[d,f]=b.useState(null),m=b.useRef(n);return m.current=n,b.useLayoutEffect(()=>{if(!e||!o.current)return;const h=o.current.getBoundingClientRect(),g=window.innerHeight-h.bottom,y=h.top,k=Math.min(r,window.innerHeight*.7),w=g<k&&y>g,S=l??h.width,T=Math.max(ev,Math.min(h.left,window.innerWidth-S-ev));f({topPx:w?void 0:h.bottom+Jb,bottomPx:w?window.innerHeight-h.top+Jb:void 0,left:T,triggerWidth:h.width})},[e,r,l]),b.useEffect(()=>{if(!e)return;const h=w=>{const S=w.target;o.current?.contains(S)||c.current?.contains(S)||m.current()},g=w=>{w.key==="Escape"&&(w.stopPropagation(),m.current())},y=w=>{c.current?.contains(w.target)||m.current()},k=()=>m.current();return window.addEventListener("mousedown",h),window.addEventListener("keydown",g,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",g,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",k)}},[e]),{triggerRef:o,panelRef:c,position:d}}function CL(e){const n=[];return b.Children.forEach(e,r=>{if(!b.isValidElement(r)||r.type!=="option")return;const l=r.props;n.push({value:l.value!==void 0?String(l.value):"",label:l.children??"",...l.disabled?{disabled:!0}:{}})}),n}const TL=`flex w-full items-center gap-2 text-left ${qo} disabled:cursor-not-allowed disabled:opacity-60`,ML={base:"text-base",sm:"text-xs"};function Pr({label:e,hint:n,error:r,required:l,size:o="base",className:c,children:d,value:f,onChange:m,disabled:h}){const g=CL(d),y=String(f??""),k=g.find(H=>H.value===y),w=b.useId(),[S,T]=b.useState(!1),{triggerRef:E,panelRef:M,position:L}=rS({open:S,onClose:()=>T(!1),estimatedHeight:g.length*36+8}),O=H=>{T(!1),m?.({target:{value:H}}),E.current?.focus()},P=s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:E,type:"button",disabled:h,"aria-haspopup":"listbox","aria-expanded":S,"aria-required":l||void 0,"aria-invalid":r?!0:void 0,"aria-describedby":r?w:void 0,onClick:()=>T(H=>!H),className:`${TL} ${Go[o]} ${r?xd:""} ${c??""}`,children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:k?.label??g[0]?.label??""}),s.jsx(Fo,{className:"text-gray-400"})]}),S&&L&&si.createPortal(s.jsx("div",{ref:M,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:L.left,width:L.triggerWidth,top:L.topPx,bottom:L.bottomPx},children:g.map((H,I)=>s.jsxs("button",{type:"button",role:"option","aria-selected":H.value===y,disabled:H.disabled,onClick:()=>O(H.value),className:`flex items-center ${Qk} ${ML[o]} disabled:opacity-50 ${H.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:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:H.label}),H.value===y&&s.jsx(zk,{className:"text-gray-500 dark:text-gray-400"})]},`${H.value}-${I}`))}),document.body)]});return s.jsx(Vo,{label:e,hint:n,error:r,errorId:w,required:l,children:P})}const EL=["always-ask","read-only","allow-all","deny-all"];function AL({open:e,onClose:n,onCreated:r}){const{user:l}=Ln(),o=l&&!l.isAdmin?`${l.userId}-`:"",[c,d]=b.useState(""),[f,m]=b.useState(""),[h,g]=b.useState(void 0),[y,k]=b.useState(!1);b.useEffect(()=>{e&&(d(""),m(""),g(void 0))},[e]);const w=async()=>{const S=o+c.trim();if(!c.trim()){g(p.common.requiredField);return}if(!(o?jL.test(c.trim())&&S.length<=NL:aS.test(S))){g(o?p.project.idPrefixHint:p.project.idHint);return}k(!0),g(void 0);try{const E=await sN({projectId:S,...f.trim()?{name:f.trim()}:{}});r(E.project.projectId)}catch(E){g(_e(E))}finally{k(!1)}};return s.jsx(ln,{open:e,title:p.project.createTitle,onClose:n,footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:n,children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:y,onClick:()=>{w()},children:p.common.create})]}),children:s.jsxs("div",{className:"space-y-3",children:[o?s.jsxs("div",{children:[s.jsx(ws,{required:!0,children:p.project.id}),s.jsxs("div",{className:"flex items-stretch",children:[s.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}),s.jsx(tt,{size:"sm",className:"rounded-l-none",value:c,invalid:!!h,onChange:S=>{d(S.target.value),g(void 0)},autoFocus:!0})]}),h?s.jsx(ks,{children:h}):s.jsx(Ku,{children:p.project.idPrefixHint})]}):s.jsx(tt,{label:p.project.id,required:!0,size:"sm",value:c,error:h,onChange:S=>{d(S.target.value),g(void 0)},hint:p.project.idHint,autoFocus:!0}),s.jsx(tt,{label:p.project.name,size:"sm",value:f,onChange:S=>m(S.target.value)})]})})}function RL({open:e,onClose:n}){const{user:r}=Ln(),{currentProject:l,setCurrentProjectId:o,projects:c,reloadProjects:d}=on(),[f,m]=b.useState(null),[h,g]=b.useState(""),[y,k]=b.useState(null),[w,S]=b.useState(!1),[T,E]=b.useState(""),[M,L]=b.useState(!1),[O,P]=b.useState(void 0),H=l?.projectId,I=l?.role==="owner",F=l?Ah(l):"";if(b.useEffect(()=>{!e||!H||(m(null),k(null),S(!1),E(F),P(void 0),Um(H).then(A=>m(A.members)).catch(A=>k(_e(A))))},[e,H]),!l||!H)return null;const K=async()=>{const A=T.trim();if(!(!A||A===F||M)){L(!0),P(void 0);try{await lN(H,{name:A}),await d()}catch($){P(_e($))}finally{L(!1)}}},Z=async()=>{if(h.trim())try{await oN(H,{userId:h.trim()}),g("");const A=await Um(H);m(A.members)}catch(A){ht(_e(A))}},z=async A=>{try{await cN(H,A);const $=await Um(H);m($.members)}catch($){ht(_e($))}},B=async()=>{try{await iN(H),n();const A=c.find($=>$.projectId!==H);await d(),A&&o(A.projectId)}catch(A){ht(_e(A))}};return s.jsxs(ln,{open:e,title:p.project.settingsTitle,onClose:n,children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[I?s.jsxs(s.Fragment,{children:[s.jsx(ws,{children:p.project.displayName}),s.jsxs("div",{className:"flex items-stretch gap-2",children:[s.jsx(tt,{size:"sm",className:"min-w-0 flex-1",value:T,invalid:!!O,maxLength:100,onChange:A=>{E(A.target.value),O&&P(void 0)},onKeyDown:A=>{A.key==="Enter"&&K()}}),s.jsx(we,{size:"sm",disabled:M||!T.trim()||T.trim()===F,onClick:()=>{K()},children:p.common.save})]}),O!==void 0&&s.jsx(ks,{children:O})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:p.project.switcher}),s.jsx("p",{className:"text-sm",children:F})]}),s.jsx("p",{className:"mt-1 font-mono text-xs text-gray-400",children:H})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500",children:p.project.members}),y?s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:y}):f===null?s.jsx("p",{className:"text-xs text-gray-400",children:p.common.loading}):s.jsx("div",{className:"overflow-x-auto rounded-md border border-gray-200 dark:border-gray-800",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.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:[s.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:p.common.username}),s.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:p.common.role}),s.jsx("th",{className:"w-20 whitespace-nowrap px-2.5 py-1.5 text-right font-medium",children:p.common.actions})]})}),s.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[f.map(A=>s.jsxs("tr",{children:[s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:A.userId}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:s.jsx(sn,{tone:"gray",children:A.role})}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:I&&A.role!=="owner"&&A.userId!==r?.userId&&s.jsx(we,{size:"sm",variant:"ghost",onClick:()=>{z(A.userId)},children:p.project.removeMember})})]},A.userId)),I&&s.jsxs("tr",{children:[s.jsx("td",{className:"px-2.5 py-1.5",children:s.jsx(tt,{placeholder:p.common.username,size:"sm",value:h,onChange:A=>g(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Z()}})}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:s.jsx(sn,{tone:"gray",children:"member"})}),s.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:s.jsx(we,{size:"sm",disabled:!h.trim(),onClick:()=>{Z()},children:p.project.addMember})})]})]})]})})]}),s.jsx(IL,{projectId:H,isOwner:I}),I&&s.jsx("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:H==="default_project"?s.jsx("p",{className:"text-xs text-gray-400",children:p.project.deleteDefaultForbidden}):c.length<=1?s.jsx("p",{className:"text-xs text-gray-400",children:p.project.deleteLastForbidden}):s.jsx(we,{size:"sm",variant:"danger",onClick:()=>S(!0),children:p.project.deleteProject})})]}),s.jsx(qn,{open:w,title:p.project.deleteProject,onClose:()=>S(!1),onConfirm:()=>{B()},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.project.deleteConfirm})})]})}function IL({projectId:e,isOwner:n}){const{user:r}=Ln(),{agents:l}=on(),[o,c]=b.useState(null),[d,f]=b.useState(null),[m,h]=b.useState(null),[g,y]=b.useState(!1),[k,w]=b.useState(""),[S,T]=b.useState(""),[E,M]=b.useState(""),[L,O]=b.useState(""),[P,H]=b.useState(null);b.useEffect(()=>{let B=!1;return Gv(e).then(A=>{B||(c(A),w(A.agentId??""),T(A.workspace??""),M(A.approvalMode??""),O(A.thinkingLevel??""))}).catch(A=>{B||h(_e(A))}),$o(e).then(A=>{B||(f(A),H(A.defaultModel??null))}).catch(A=>{B||h(_e(A))}),()=>{B=!0}},[e]);const I=o!==null&&(k!==(o.agentId??"")||S.trim()!==(o.workspace??"")||E!==(o.approvalMode??"")||L!==(o.thinkingLevel??"")),F=d!==null&&P!==null&&!wt(d.defaultModel,P),K=async()=>{if(!(g||!I&&!F)){y(!0);try{if(I){const B={...k?{agentId:k}:{},...S.trim()?{workspace:S.trim()}:{},...E?{approvalMode:E}:{},...L?{thinkingLevel:L}:{}};c(await uN(e,B))}if(F&&P){const B=await fN(e,{provider:P.provider,modelId:P.modelId});f(A=>A&&{...A,defaultModel:B.defaultModel}),r&&Q2(r.userId,e)}}catch(B){ht(_e(B))}finally{y(!1)}}},Z=o?.agentId?(()=>{const B=l.find(A=>A.agentId===o.agentId);return B?Gt(B):o.agentId})():p.project.chatDefaultsNotSet,z=d?.models.find(B=>wt(B,d.defaultModel));return s.jsxs("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:[s.jsx("p",{className:"text-xs font-medium text-gray-500",children:p.project.chatDefaultsTitle}),s.jsx("p",{className:"mb-2 mt-0.5 text-xs text-gray-400",children:p.project.chatDefaultsHint}),m?s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:m}):o===null||d===null?s.jsx("p",{className:"text-xs text-gray-400",children:p.common.loading}):n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsxs(Pr,{label:p.project.chatDefaultsAgent,size:"sm",value:k,onChange:B=>w(B.target.value),children:[s.jsx("option",{value:"",children:p.project.chatDefaultsNotSet}),l.map(B=>s.jsx("option",{value:B.agentId,children:Gt(B)},B.agentId))]}),s.jsxs(Pr,{label:p.chat.approvalMode,size:"sm",value:E,onChange:B=>M(B.target.value),children:[s.jsx("option",{value:"",children:p.project.chatDefaultsApprovalNotSet}),EL.map(B=>s.jsx("option",{value:B,children:p.chat.approvalModeNames[B]??B},B))]}),s.jsxs(Pr,{label:p.chat.thinkingLevel,size:"sm",value:L,onChange:B=>O(B.target.value),children:[s.jsx("option",{value:"",children:p.project.chatDefaultsThinkingNotSet}),z2.map(B=>s.jsx("option",{value:B,children:p.chat.thinkingLevelNames[B]??B},B))]}),s.jsxs("div",{children:[s.jsx(ws,{children:p.chat.model}),d.models.length>0?s.jsxs(s.Fragment,{children:[s.jsx(D2,{models:d.models,value:P,defaultModel:d.defaultModel,onChange:H,disabled:g,variant:"form"}),s.jsx(Ku,{children:p.project.chatDefaultsModelHint})]}):s.jsx("p",{className:"text-xs text-gray-400",children:p.models.empty})]}),s.jsxs("div",{className:"sm:col-span-2",children:[s.jsx(ws,{children:p.chat.workspace}),s.jsx(Z2,{projectId:e,workspace:S,onChange:T,variant:"form"}),s.jsx(Ku,{children:p.project.chatDefaultsWorkspaceHint})]})]}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(we,{size:"sm",disabled:g||!I&&!F,onClick:()=>{K()},children:p.common.save})})]}):s.jsx("div",{className:"space-y-1 text-sm",children:[[p.project.chatDefaultsAgent,Z],[p.chat.workspace,o.workspace??p.chat.workspaceAuto],[p.chat.approvalMode,o.approvalMode?p.chat.approvalModeNames[o.approvalMode]??o.approvalMode:p.project.chatDefaultsApprovalNotSet],[p.chat.thinkingLevel,o.thinkingLevel?p.chat.thinkingLevelNames[o.thinkingLevel]??o.thinkingLevel:p.project.chatDefaultsThinkingNotSet],[p.chat.model,z?z.displayName??z.modelId:p.project.chatDefaultsNotSet]].map(([B,A])=>s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("span",{className:"w-24 shrink-0 text-xs text-gray-500",children:B}),s.jsx("span",{className:"min-w-0 flex-1 break-all",children:A})]},B))})]})}const _L="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",LL="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 Ss({label:e,hint:n,error:r,invalid:l,required:o,size:c="base",className:d,...f}){const[m,h]=b.useState(!1),g=m?p.auth.hidePassword:p.auth.showPassword,y=b.useId();return s.jsx(Vo,{label:e,hint:n,error:r,errorId:y,required:o,children:s.jsxs("div",{className:"relative",children:[s.jsx(tt,{...f,required:o,size:c,type:m?"text":"password",invalid:!!r||!!l,"aria-describedby":r?y:void 0,className:`${c==="sm"?"pr-8":"pr-10"} ${d??""}`}),s.jsx("button",{type:"button","aria-label":g,title:g,tabIndex:-1,onClick:()=>h(k=>!k),className:`absolute inset-y-0 right-0 flex items-center justify-center text-gray-400 transition-colors duration-150 hover:text-gray-600 dark:hover:text-gray-300 ${c==="sm"?"w-8":"w-10"}`,children:s.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:s.jsx("path",{d:m?LL:_L})})})]})})}function sS({open:e,onClose:n}){const{refresh:r,sessionVia:l}=Ln(),o=l==="desktop",[c,d]=b.useState(""),[f,m]=b.useState(""),[h,g]=b.useState(""),[y,k]=b.useState({}),[w,S]=b.useState(!1),T=()=>k(M=>M.old||M.new||M.confirm?{}:M);b.useEffect(()=>{e&&(d(""),m(""),g(""),k({}))},[e]);const E=async()=>{const M={};if(!o&&!c&&(M.old=p.common.requiredField),f||(M.new=p.common.requiredField),h||(M.confirm=p.common.requiredField),!M.confirm&&f!==h&&(M.confirm=p.account.passwordMismatch),M.old||M.new||M.confirm){k(M);return}S(!0),k({});try{await J5(o?{newPassword:f}:{oldPassword:c,newPassword:f}),await r(),n()}catch(L){L instanceof ka&&L.code==="invalid_password"?k({new:_e(L)}):k({old:_e(L)})}finally{S(!1)}};return s.jsx(ln,{open:e,title:p.account.changePassword,onClose:n,footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:n,disabled:w,children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:w,onClick:()=>{E()},children:p.common.save})]}),children:s.jsxs("div",{className:"space-y-3",children:[!o&&s.jsx(Ss,{label:p.account.oldPassword,required:!0,size:"sm",value:c,onChange:M=>{d(M.target.value),T()},error:y.old,autoComplete:"current-password",hint:p.account.oldPasswordHint,autoFocus:!0}),s.jsx(Ss,{label:p.account.newPassword,required:!0,size:"sm",value:f,onChange:M=>{m(M.target.value),T()},error:y.new,autoComplete:"new-password",hint:p.auth.passwordHint,autoFocus:o}),s.jsx(Ss,{label:p.account.confirmPassword,required:!0,size:"sm",value:h,onChange:M=>{g(M.target.value),T()},error:y.confirm,autoComplete:"new-password"})]})})}function OL({open:e,onClose:n,latestVersion:r,releaseUrl:l=null,canUpdate:o,onRunFinished:c}){const[d,f]=b.useState("confirm"),[m,h]=b.useState(null);b.useEffect(()=>{e&&(f("confirm"),h(null))},[e]);const g=()=>{d==="done"&&c?.(),n()},y=async()=>{f("running");try{h(await WN())}catch(w){h({status:"failed",output:_e(w),needsRestart:!1})}f("done")},k=m===null?null:m.status==="updated"?{text:p.update.updated,className:"text-green-600 dark:text-green-400"}:m.status==="unsupported"?{text:p.update.unsupported,className:"text-amber-600 dark:text-amber-400"}:{text:p.update.failed,className:"text-red-600 dark:text-red-400"};return s.jsx(ln,{open:e,title:o?p.update.updateNow:r!==null?p.update.newVersion(r):p.update.releaseNotes,onClose:d==="running"?()=>{}:g,footer:d==="done"||!o?s.jsx(we,{onClick:g,children:p.common.close}):s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:g,disabled:d==="running",children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:d==="running",onClick:()=>{y()},children:d==="running"?p.update.updating:p.update.updateNow})]}),children:d==="done"&&m!==null&&k!==null?s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:`text-sm font-medium ${k.className}`,children:k.text}),m.status==="updated"&&s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:p.update.restartHint}),m.output!==""&&s.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:y2(m.output)})]}):s.jsxs("div",{className:"space-y-2",children:[r!==null&&s.jsx("p",{className:"text-sm font-medium",children:p.update.newVersion(r)}),l!==null&&s.jsx("p",{children:s.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:p.update.releaseNotes})}),s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:o?p.update.confirmBody:p.update.adminOnly}),d==="running"&&s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:p.update.updating})]})})}const lS="M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z",DL="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",zL="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",co="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",UL=e=>`penguin.sidebarCollapsedGroups.${e}`,$L=e=>`penguin.sidebarPinnedGroups.${e}`;function Nu(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 tv(e,n){if(e)try{localStorage.setItem(e,JSON.stringify([...n]))}catch{}}const Cu=(e,n)=>`${n}\0${e}`;function BL({session:e}){return e.status==="running"?s.jsx("span",{title:p.chat.statusRunning,className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):e.status==="compacting"?s.jsx("span",{title:p.chat.statusCompacting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}):null}function nv({onNavigate:e,onCollapse:n}){const r=aa(),{user:l,logout:o,desktopMode:c}=Ln(),{mode:d,setMode:f,fontScale:m,setFontScale:h,accent:g,setAccent:y,currency:k,setCurrency:w}=Cs(),{lang:S,locale:T,setLang:E}=Pa(),{projects:M,currentProject:L,setCurrentProjectId:O,reloadProjects:P,agents:H,currentAgent:I,setCurrentAgentId:F}=on(),{sessions:K,byAgent:Z,countsByAgent:z,workspaceCountsByAgent:B,isLoadedFor:A,hasMoreFor:$,loadMoreFor:q,loading:U,remove:V,replace:W,showCliSessions:ce,setShowCliSessions:te}=dl(),_=gk("/chat/:sessionId")?.params.sessionId??null,[R,C]=b.useState(!1),[Q,ee]=b.useState(!1),[ae,he]=b.useState(!1),[xe,ie]=b.useState(!1),[ye,ve]=b.useState(!1),[Ke,He]=b.useState(!1),{version:Ge,update:Qe}=K2(Q),ut=Qe?.updateAvailable===!0,Yt=ut?Qe?.latestVersion??null:null,en=Ge?.buildDate??null,[tn,wn]=b.useState(!1),Pt=async()=>{if(!tn){wn(!0);try{const ue=C_(await Lb());ue.kind==="disabled"?Ts(p.update.checkDisabled):ue.kind==="failed"?ht(p.update.checkFailed):ue.kind==="found"?_n(p.update.foundNew(ue.latestVersion)):_n(p.update.upToDate)}catch(ue){ht(_e(ue))}finally{wn(!1)}}},xn=L?.projectId??null,yn=xn===null?null:UL(xn),st=xn===null?null:$L(xn),[Wt,X]=b.useState(Ik),[me,Ne]=b.useState(()=>Nu(yn)),[Ae,Oe]=b.useState(()=>Nu(st));b.useEffect(()=>{Ne(Nu(yn)),Oe(Nu(st)),et(fu)},[yn,st]);const[re,ke]=b.useState(new Set),[Me,Te]=b.useState(new Set),[$e,Ve]=b.useState(new Map),[Xe,et]=b.useState(fu),[cn,bn]=b.useState(null),[Nt,Sn]=b.useState(!1),[vn,Ct]=b.useState(null),[It,jn]=b.useState(""),[Vn,la]=b.useState(!1),[On,Nn]=b.useState(null),tr=ue=>{_k(ue),X(ue),et(fu)},ia=b.useMemo(()=>Tk(K),[K]),Ce=b.useMemo(()=>Nk(B),[B]),Ie=b.useMemo(()=>Ih(H,ue=>ue.agentId,Ae),[H,Ae]),lt=b.useMemo(()=>Ih(ia,ue=>ue.key,Ae),[ia,Ae]),xt=ue=>Wt==="agent"?ue.agentId:qu(ue.workspace),zt=ue=>{const Se=new Set(me);Se.has(ue)?Se.delete(ue):Se.add(ue),Ne(Se),tv(yn,Se)},dt=ue=>{const Se=new Set(Ae);Se.has(ue)?Se.delete(ue):Se.add(ue),Oe(Se),tv(st,Se)},bt=(ue,Se)=>`${Se}\0${ue}`,Qt=(ue,Se,qe)=>{const ft=bt(ue,Se);Te(Ft=>new Set(Ft).add(ft)),q(qe,Se).finally(()=>{Te(Ft=>{const _t=new Set(Ft);return _t.delete(ft),_t})})},Xt=(ue,Se,qe)=>{const ft=Cu(ue,Se),Ft=!re.has(ft);if(ke(_t=>{const nn=new Set(_t);return Ft?nn.add(ft):nn.delete(ft),nn}),Ft){const _t=qe.filter(nn=>!A(nn,Se));_t.length>0&&q(_t,Se)}},oa=b.useRef(null);b.useEffect(()=>{if(!_)return;const ue=K.find(_t=>_t.sessionId===_);if(!ue)return;const Se=Qa(ue);if(Se==="active"||Se==="archived")return;const qe=`${Wt}\0${_}`;if(oa.current===qe)return;oa.current=qe;const ft=Wt==="agent"?ue.agentId:qu(ue.workspace),Ft=Cu(ft,Se);ke(_t=>_t.has(Ft)?_t:new Set(_t).add(Ft)),A(ue.agentId,Se)||q([ue.agentId],Se)},[_,K,Wt,A,q]);const yr=async ue=>{!ue.archived&&ue.sessionId===_&&ke(Se=>new Set(Se).add(Cu(xt(ue),"archived")));try{const Se=await Ch(ue.sessionId,{archived:!ue.archived});W(Se.session)}catch{}},ml=async()=>{if(!vn)return;const ue=It.trim();if(ue){la(!0),Nn(null);try{const Se=await Ch(vn.sessionId,{title:ue});W(Se.session),Ct(null)}catch(Se){Nn(_e(Se))}finally{la(!1)}}},Es=async()=>{if(!cn)return;Sn(!0);const ue=cn;try{if(await Fu(ue.sessionId),V(ue.sessionId),l&&rd(Y2(l.userId,ue.sessionId)),bn(null),_===ue.sessionId){const Se=(Z.get(ue.agentId)??[]).filter(qe=>{const ft=Qa(qe);return qe.sessionId!==ue.sessionId&&(ft==="active"||ft==="schedule")});r(Se[0]?`/chat/${Se[0].sessionId}`:"/chat")}}catch(Se){ht(_e(Se))}finally{Sn(!1)}},Gn=ue=>{r(ue),e?.()},nr=(ue,Se)=>{ue&&F(ue);const qe={...ue?{agentId:ue}:{},...Se!==void 0?{workspace:Se}:{}};r(`/chat/${Ja}`,Object.keys(qe).length>0?{state:qe}:void 0),e?.()},Na=(H.find(ue=>ue.agentId==="default_agent")??H[0])?.agentId,ar=I?.agentId??Na,rr=ue=>{F(ue.agentId),Gn(`/chat/${ue.sessionId}`)},Bn=b.useMemo(()=>new Map(H.map(ue=>[ue.agentId,Gt(ue)])),[H]),Ut=(ue,Se)=>s.jsx("ul",{className:"space-y-0.5",children:ue.map(qe=>s.jsx(HL,{s:qe,active:qe.sessionId===_,...Se?{agentHint:Bn.get(qe.agentId)??qe.agentId}:{},onOpen:rr,onRename:ft=>{Nn(null),jn(ft.title??""),Ct(ft)},onDelete:ft=>bn(ft),onToggleArchive:ft=>{yr(ft)}},qe.sessionId))}),As=(ue,Se,qe,ft,Ft,_t)=>{const nn=qe[Se],Cn=Math.max(_t?.[Se]??0,nn.length);if(Cn===0)return null;const Vr=nn.length<Cn&&Ft.some(un=>$(un,Se));return s.jsx(Dk,{label:p.chat.folderGroups[Se](Cn),open:re.has(Cu(ue,Se)),onToggle:()=>Xt(ue,Se,Ft),more:Vr,pending:Me.has(bt(ue,Se)),onMore:()=>Qt(ue,Se,Ft),children:Ut(nn,ft)},Se)},Rs=(ue,Se)=>{Ve(qe=>{const ft=new Map(qe);return ft.set(ue,(qe.get(ue)??nl)+nl),ft}),Se.length>0&&Qt(ue,"active",Se)},Hn=(ue,Se,qe,ft,Ft)=>{const _t=$e.get(ue)??nl,nn=Se.active.slice(0,_t),Cn=Ft("active"),Vr=Math.max(ft?.active??0,Se.active.length),un=Se.active.length>_t||Se.active.length<Vr&&Cn.some(Dn=>$(Dn,"active")),br=Po.map(Dn=>As(ue,Dn,Se,qe,Ft(Dn),ft)),hl=Se.active.length===0&&br.every(Dn=>Dn===null),Is=Me.has(bt(ue,"active"));return s.jsxs(s.Fragment,{children:[hl?s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:p.chat.noSessions}):Ut(nn,qe),un&&s.jsx(Xl,{label:p.chat.loadMore,pending:Is,onClick:()=>Rs(ue,Cn),className:"mt-0.5"}),br]})},Ca=ue=>s.jsx(Xl,{label:p.chat.moreGroups(ue-Xe),onClick:()=>et(Se=>Se+fu),className:"mt-1"}),ci=[{to:"/agents",label:p.nav.agents,icon:ya.agents},{to:"/skills",label:p.nav.skills,icon:ya.skills},{to:"/models",label:p.nav.models,icon:ya.models},{to:"/usage",label:p.nav.usage,icon:ya.usage},{to:"/traces",label:p.nav.traces,icon:ya.traces},{to:"/benchmark",label:p.nav.benchmark,icon:ya.benchmark}],sr=[{value:"light",label:p.settings.themeLight},{value:"dark",label:p.settings.themeDark},{value:"system",label:p.settings.followSystem}],Ta=[{value:"en",label:p.settings.langEn},{value:"zh",label:p.settings.langZh},{value:"system",label:p.settings.followSystem}],qr=[{value:"sm",label:p.settings.fontSmall},{value:"md",label:p.settings.fontMedium},{value:"lg",label:p.settings.fontLarge}],lr=[{value:"USD",label:p.models.currencyUsd},{value:"CNY",label:p.models.currencyCny}];return s.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-2 pt-2",children:[n&&s.jsx("button",{type:"button",title:p.nav.collapseSidebar,"aria-label":p.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:s.jsx(xa,{d:"M15 6l-6 6 6 6M4 4v16",size:18})}),s.jsxs(Sa,{open:R,setOpen:C,className:"min-w-0 flex-1",menuClass:"left-0 right-0 top-full mt-1 origin-top",button:s.jsxs("button",{type:"button",onClick:()=>C(!R),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:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:L?Ah(L):p.common.loading}),s.jsx("span",{className:"text-gray-400",children:s.jsx(Fo,{})})]}),children:[M.map(ue=>s.jsxs("button",{type:"button",onClick:()=>{O(ue.projectId),C(!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 ${ue.projectId===L?.projectId?"font-semibold":""}`,children:[s.jsx("span",{className:"truncate",children:Ah(ue)}),s.jsx(sn,{tone:"gray",children:ue.role})]},ue.projectId)),s.jsxs("div",{className:"mt-1.5 border-t border-gray-100 pt-1.5 dark:border-gray-800",children:[s.jsxs("button",{type:"button",className:co,onClick:()=>{C(!1),he(!0)},children:["+ ",p.project.create]}),L&&s.jsx("button",{type:"button",className:co,onClick:()=>{C(!1),ie(!0)},children:p.project.settings})]})]})]}),s.jsx("div",{className:"shrink-0 px-2 pb-2 pt-2",children:s.jsxs("button",{type:"button",onClick:()=>nr(Na),className:`flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors duration-150 ${_===Ja?"bg-gray-200/70 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[s.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:s.jsx(xa,{d:lS})}),p.chat.newSessionMenu]})}),s.jsxs("div",{className:"relative min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:[s.jsx("nav",{className:"space-y-0.5",children:ci.map(ue=>s.jsxs(Np,{to:ue.to,onClick:()=>e?.(),className:({isActive:Se})=>`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${Se?"bg-gray-200/70 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[s.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:s.jsx(xa,{d:ue.icon})}),ue.label]},ue.to))}),s.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:[s.jsx("span",{className:"px-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:p.chat.sessionList}),s.jsx(Lk,{value:Wt,onChange:tr})]}),Wt==="agent"?U&&H.length===0?s.jsx(ba,{rows:5}):Ie.slice(0,Xe).map(ue=>{const Se=h1(Z.get(ue.agentId)??[]),qe=me.has(ue.agentId),ft=Ae.has(ue.agentId);return s.jsxs("div",{className:"pt-2.5",children:[s.jsx(Vu,{open:!qe,onToggle:()=>zt(ue.agentId),icon:s.jsx(na,{id:ue.agentId,name:Gt(ue),size:18,className:"shrink-0 rounded"}),label:Gt(ue),uppercase:!0,actions:s.jsxs(s.Fragment,{children:[s.jsx(av,{pinned:ft,onToggle:()=>dt(ue.agentId)}),s.jsx("button",{type:"button",title:p.chat.newSessionMenu,"aria-label":p.chat.newSessionMenu,onClick:()=>nr(ue.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:s.jsx(xa,{d:"M12 5v14M5 12h14",size:18})}),s.jsx("button",{type:"button",title:p.agent.settings,onClick:()=>Gn(`/agents/${ue.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:s.jsx(xa,{d:DL,size:16})})]})}),qe?null:Hn(ue.agentId,Se,!1,z.get(ue.agentId),()=>[ue.agentId])]},ue.agentId)}):null,Wt==="agent"&&Ie.length>Xe?Ca(Ie.length):null,Wt==="agent"?null:U&&K.length===0?s.jsx(ba,{rows:5}):lt.length===0?s.jsx("p",{className:"px-2.5 pt-3 text-xs text-gray-400 dark:text-gray-600",children:p.chat.noSessions}):lt.slice(0,Xe).map(ue=>{const Se=h1(ue.sessions),qe=me.has(ue.key),ft=Ae.has(ue.key),Ft=Ce.get(ue.key),_t=[...new Set(ue.sessions.map(Cn=>Cn.agentId))],nn=Cn=>[...new Set([...Ft?.agents[Cn]??[],..._t])];return s.jsxs("div",{className:"pt-2.5",children:[s.jsx(Vu,{open:!qe,onToggle:()=>zt(ue.key),icon:s.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:s.jsx(xa,{d:qe?Cp:Ek,size:15})}),label:ue.temp?p.chat.tempWorkspaces:ue.label,count:Math.max(Ft?.totals.active??0,Se.active.length),...ue.fullPath!==null?{title:ue.fullPath}:{},actions:s.jsxs(s.Fragment,{children:[s.jsx(av,{pinned:ft,onToggle:()=>dt(ue.key)}),s.jsx("button",{type:"button",title:p.chat.newSessionInWorkspace,"aria-label":p.chat.newSessionInWorkspace,onClick:()=>nr(ar,ue.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:s.jsx(xa,{d:"M12 5v14M5 12h14",size:18})})]})}),qe?null:Hn(ue.key,Se,!0,Ft?.totals,nn)]},ue.key)}),Wt==="workspace"&<.length>Xe?Ca(lt.length):null]}),s.jsx("div",{className:"shrink-0 border-t border-gray-200 p-2 dark:border-gray-800",children:s.jsxs(Sa,{open:Q,setOpen:ee,menuClass:"bottom-full left-0 right-0 mb-1 origin-bottom",button:s.jsxs("button",{type:"button",onClick:()=>ee(!Q),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:[s.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:[(l?.userId??"?").slice(0,1).toUpperCase(),ut&&s.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"})]}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:l?.userId}),l?.isAdmin&&s.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:p.auth.admin})]}),children:[s.jsxs("div",{className:"space-y-2.5 px-3 py-2",children:[s.jsx(Vl,{label:p.settings.theme,children:s.jsx(Ql,{options:sr,value:d,onChange:f})}),s.jsx(Vl,{label:p.settings.fontSize,children:s.jsx(Ql,{options:qr,value:m,onChange:h})}),s.jsx(Vl,{label:p.settings.accent,children:s.jsx(PL,{value:g,onChange:y})}),s.jsx(Vl,{label:p.models.currency,children:s.jsx(Ql,{options:lr,value:k,onChange:w,cols:2})}),s.jsx(Vl,{label:p.settings.language,children:s.jsx(Ql,{options:Ta,value:S,onChange:E})}),s.jsx(Vl,{label:p.settings.showCliSessions,children:s.jsx(Ep,{checked:ce,onChange:te})})]}),s.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[s.jsx("button",{type:"button",className:co,onClick:()=>{ee(!1),ve(!0)},children:p.account.changePassword}),!c&&s.jsxs("button",{type:"button",disabled:tn,onClick:()=>{Yt!==null?(ee(!1),He(!0)):Pt()},...en!==null?{title:p.update.lastUpdated(Hk(en,T))}:{},className:`${co} flex items-center justify-between gap-2 disabled:cursor-default disabled:opacity-60`,children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[tn&&s.jsx("span",{"aria-hidden":!0,className:"inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent opacity-70"}),!tn&&Yt!==null&&s.jsx("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent-bg)]"}),s.jsx("span",{className:"min-w-0 truncate",children:tn?p.update.checking:Yt!==null?p.update.newVersion(Yt):p.update.checkNow})]}),Ge!==null&&s.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:`v${Ge.version}`})]}),l?.isAdmin&&s.jsx("button",{type:"button",className:co,onClick:()=>{ee(!1),Gn("/admin/users")},children:p.admin.users}),!c&&s.jsx("button",{type:"button",className:"block w-full px-3.5 py-2 text-left text-sm text-red-600 transition-colors duration-150 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40",onClick:()=>{ee(!1),o().then(()=>r("/login"))},children:p.auth.logout})]})]})}),s.jsx(sS,{open:ye,onClose:()=>ve(!1)}),s.jsx(OL,{open:Ke,onClose:()=>He(!1),latestVersion:Yt,releaseUrl:Qe?.releaseUrl??null,canUpdate:l?.isAdmin===!0,onRunFinished:()=>{Lb().catch(()=>{})}}),s.jsx(AL,{open:ae,onClose:()=>he(!1),onCreated:ue=>{he(!1),P().then(()=>O(ue))}}),L&&s.jsx(RL,{open:xe,onClose:()=>ie(!1)}),s.jsx(ln,{open:vn!==null,title:p.chat.renameSession,onClose:()=>Vn?void 0:Ct(null),footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:()=>Ct(null),disabled:Vn,children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:Vn||!It.trim(),onClick:()=>{ml()},children:p.common.save})]}),children:s.jsx(tt,{label:p.chat.renameSessionLabel,value:It,error:On??void 0,autoFocus:!0,maxLength:120,onChange:ue=>{jn(ue.target.value),On&&Nn(null)},onKeyDown:ue=>{ue.key==="Enter"&&It.trim()&&!Vn&&ml()}})}),s.jsx(qn,{open:cn!==null,title:p.chat.deleteSession,confirmLabel:p.common.delete,busy:Nt,onClose:()=>Nt?void 0:bn(null),onConfirm:()=>{Es()},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:cn?p.chat.deleteSessionConfirm(cn.title??p.chat.defaultSessionTitle):""})})]})}function av({pinned:e,onToggle:n}){return s.jsx("button",{type:"button",title:e?p.nav.unpinGroup:p.nav.pinGroup,"aria-label":p.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:s.jsx(xa,{d:zL,size:15})})}function HL({s:e,active:n,agentHint:r,onOpen:l,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 s.jsx("li",{children:s.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:[s.jsxs("button",{type:"button",onClick:()=>l(e),className:"flex min-w-0 flex-1 items-center gap-1.5 px-2.5 py-1.5 text-left",children:[r!==void 0&&s.jsxs("span",{title:r,className:"flex shrink-0 items-center",children:[s.jsx(na,{id:e.agentId,name:r,size:14,className:"rounded"}),s.jsx("span",{className:"sr-only",children:r})]}),s.jsx(pd,{text:e.title??p.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"}`}),s.jsx(BL,{session:e}),e.pendingApprovalCount>0&&s.jsx("span",{title:p.chat.pendingApprovals(e.pendingApprovalCount),children:s.jsx(sn,{tone:"amber",children:e.pendingApprovalCount})})]}),s.jsxs("div",{className:"flex shrink-0 items-center",children:[s.jsx("button",{type:"button",title:p.chat.renameSession,"aria-label":p.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:s.jsx(xa,{d:"M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",size:14})}),s.jsx("button",{type:"button",title:e.archived?p.chat.unarchiveSession:p.chat.archiveSession,"aria-label":e.archived?p.chat.unarchiveSession:p.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:s.jsx(xa,{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})}),s.jsx("button",{type:"button",title:p.chat.deleteSession,"aria-label":p.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:s.jsx(xa,{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 Vl({label:e,children:n}){return s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-[11px] font-medium text-gray-500 dark:text-gray-400",children:e}),n]})}function PL({value:e,onChange:n}){return s.jsx("div",{className:"flex items-center gap-1.5",children:Y5.map(r=>s.jsx("button",{type:"button",title:p.settings.accentNames[r.value],"aria-label":p.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 FL="M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5",ph=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 qL({onExpand:e}){const{user:n}=Ln(),r=aa(),{agents:l,setCurrentAgentId:o}=on(),{sessions:c,loading:d}=dl(),f=gk("/chat/:sessionId")?.params.sessionId??null,m=f!==null&&f!==Ja,h=b.useMemo(()=>Ck(c),[c]),g=()=>{h&&(o(h.agentId),r(`/chat/${h.sessionId}`))},y=()=>{const w=(l.find(S=>S.agentId==="default_agent")??l[0])?.agentId;w&&o(w),r(`/chat/${Ja}`,w?{state:{agentId:w}}:void 0)},k=[{to:"/agents",label:p.nav.agents,icon:ya.agents},{to:"/skills",label:p.nav.skills,icon:ya.skills},{to:"/models",label:p.nav.models,icon:ya.models},{to:"/usage",label:p.nav.usage,icon:ya.usage},{to:"/traces",label:p.nav.traces,icon:ya.traces},{to:"/benchmark",label:p.nav.benchmark,icon:ya.benchmark}];return s.jsxs("div",{className:"flex h-full flex-col items-center gap-1 py-2.5",children:[s.jsx("button",{type:"button",title:p.nav.expandSidebar,"aria-label":p.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:s.jsx(Pe,{d:"M9 6l6 6-6 6M20 4v16",size:18})}),s.jsxs("nav",{className:"no-scrollbar mt-1 flex min-h-0 flex-1 flex-col items-center gap-1 overflow-y-auto",children:[s.jsx("button",{type:"button",title:p.nav.lastConversation,"aria-label":p.nav.lastConversation,disabled:!h&&!d,onClick:g,className:h||d?ph(m):"flex h-8 w-8 cursor-not-allowed items-center justify-center rounded-md text-gray-300 dark:text-gray-700",children:s.jsx(Pe,{d:FL,size:18})}),s.jsx("button",{type:"button",title:p.chat.newSessionMenu,"aria-label":p.chat.newSessionMenu,onClick:y,className:ph(f===Ja),children:s.jsx(Pe,{d:lS,size:18})}),k.map(w=>s.jsx(Np,{to:w.to,title:w.label,"aria-label":w.label,className:({isActive:S})=>ph(S),children:s.jsx(Pe,{d:w.icon,size:18})},w.to))]}),s.jsx("button",{type:"button",title:`${n?.userId??""} · ${p.nav.expandSidebar}`,"aria-label":n?.userId??p.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 VL(){const{user:e,desktopMode:n}=Ln(),[r,l]=b.useState(!1),[o,c]=b.useState(!1),[d,f]=b.useState(()=>localStorage.getItem("penguin.sidebarCollapsed")==="1"),m=()=>f(h=>{const g=!h;return localStorage.setItem("penguin.sidebarCollapsed",g?"1":"0"),g});return s.jsxs("div",{className:"flex h-full",children:[s.jsx("aside",{className:`hidden shrink-0 border-r border-gray-200 bg-gray-50 md:block dark:border-gray-800 dark:bg-gray-900 ${d?"w-12":"w-64 lg:w-72"}`,children:d?s.jsx(qL,{onExpand:m}):s.jsx(nv,{onCollapse:m})}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.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:[s.jsx("button",{type:"button","aria-label":p.chat.sessionList,onClick:()=>l(!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:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round","aria-hidden":!0,children:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}),s.jsx("span",{className:"text-sm font-semibold",children:p.appName})]}),e?.passwordIsInitial&&!n&&s.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:[s.jsx("span",{children:p.account.initialPasswordBanner}),s.jsx("button",{type:"button",className:"shrink-0 font-medium underline underline-offset-2 hover:text-amber-950 dark:hover:text-amber-100",onClick:()=>c(!0),children:p.account.changeNow})]}),s.jsx("main",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(XC,{})})]}),s.jsx(sS,{open:o,onClose:()=>c(!1)}),s.jsx(P4,{open:r,side:"left",title:p.appName,onClose:()=>l(!1),children:s.jsx("div",{className:"h-full bg-gray-50 dark:bg-gray-900",children:s.jsx(nv,{onNavigate:()=>l(!1)})})})]})}const sg=1440,lg=900,op=3,GL=3,rv=sg/op,sv=lg/GL,Tu=28,Mu=14;function WL(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 KL(e,n){return e.x1-Mu<=n.x2&&e.x2+Mu>=n.x1&&e.y1-Mu<=n.y2&&e.y2+Mu>=n.y1}function YL(e,n,r,l){return{x1:Math.min(e,r),y1:Math.min(n,l),x2:Math.max(e,r),y2:Math.max(n,l)}}const QL=[{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 XL(){const e=WL(12696599),n=[];for(const{cell:r,edge:l}of QL){const o=r%op*rv+Tu,c=Math.floor(r/op)*sv+Tu,d=o+rv-2*Tu,f=c+sv-2*Tu,m=[],h=(O,P,H,I)=>{const F=H[0]>0?d-O:H[0]<0?O-o:H[1]>0?f-P:P-c;for(let K=Math.min(60+e()*150,F);K>=40;K/=2){const Z=Math.round(O+H[0]*K),z=Math.round(P+H[1]*K),B=YL(O,P,Z,z);if(m.every((A,$)=>I.has($)||!KL(B,A)))return m.push(B),[Z,z]}return null},g=(O,P,H)=>(H-O)*(.35+e()*.3)>O-P?1:-1,y=(O,P,H,I,F,K,Z)=>{let[z,B]=[O,P],A=H;const $=[`M${Math.round(z)},${Math.round(B)}`],q=[];for(let U=0;U<I;U+=1){const V=U===0?Z:new Set([m.length-1]),W=h(z,B,A,V);if(!W)break;[z,B]=W,$.push(`L${z},${B}`),q.push([z,B]),A=A[0]!==0?[0,g(B,c,f)]:[g(z,o,d),0]}return q.length>=2&&n.push({d:$.join(" "),end:q[q.length-1],dur:F,delay:K}),q},k=.15+e()*.7,w=l==="left"?0:l==="right"?sg:Math.round(o+(d-o)*k),S=l==="top"?0:l==="bottom"?lg:Math.round(c+(f-c)*k),T=l==="left"?[1,0]:l==="right"?[-1,0]:l==="top"?[0,1]:[0,-1],E=12+e()*8,M=e()*3.2,L=y(w,S,T,3+Math.floor(e()*3),E,M,new Set);if(r%2===0&&L.length>=3){const[O,P]=L[1],[H,I]=L[2],F=[-Math.sign(H-O),-Math.sign(I-P)];y(O,P,F,2,E,M+1.4,new Set([1,2]))}}return n}const ZL=XL();function JL(){return s.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 ${sg} ${lg}`,preserveAspectRatio:"xMidYMid slice",fill:"none",children:ZL.map((e,n)=>s.jsxs("g",{style:{"--trace-dur":`${e.dur.toFixed(1)}s`},children:[s.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`}}),s.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 e7(){gr(p.auth.login);const{login:e}=Ln(),{mode:n,setMode:r}=Cs(),{lang:l,setLang:o}=Pa(),c=aa(),[d,f]=b.useState(""),[m,h]=b.useState(""),[g,y]=b.useState({}),[k,w]=b.useState(!1),S=()=>y(L=>L.userId||L.password||L.form?{}:L),T=async()=>{const L={};if(d.trim()||(L.userId=p.common.requiredField),m||(L.password=p.common.requiredField),L.userId||L.password){y(L);return}w(!0),y({});try{await e(d.trim(),m),c("/chat",{replace:!0})}catch(O){y({form:_e(O)})}finally{w(!1)}},E=[{value:"light",label:p.settings.themeLight},{value:"dark",label:p.settings.themeDark},{value:"system",label:p.settings.followSystem}],M=[{value:"en",label:p.settings.langEn},{value:"zh",label:p.settings.langZh},{value:"system",label:p.settings.followSystem}];return s.jsxs("div",{className:"relative flex min-h-full items-center justify-center overflow-hidden p-4",children:[s.jsx(JL,{}),s.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:[s.jsx("div",{"aria-label":p.settings.language,children:s.jsx(Ql,{options:M,value:l,onChange:o})}),s.jsx("div",{"aria-label":p.settings.theme,children:s.jsx(Ql,{options:E,value:n,onChange:r})})]}),s.jsxs("div",{className:"anim-rise relative w-full max-w-sm",children:[s.jsx(W2,{className:"mx-auto mb-3 h-16 w-16 rounded-2xl"}),s.jsx("h1",{className:"mb-6 text-center text-3xl font-semibold tracking-tight",children:p.appName}),s.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("form",{className:"space-y-4",onSubmit:L=>{L.preventDefault(),T()},children:[s.jsx(tt,{label:p.common.username,required:!0,value:d,onChange:L=>{f(L.target.value),S()},error:g.userId,autoComplete:"username",autoFocus:!0}),s.jsx(Ss,{label:p.auth.password,required:!0,value:m,onChange:L=>{h(L.target.value),S()},error:g.password,autoComplete:"current-password"}),g.form&&s.jsx("p",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900 dark:bg-red-950/50 dark:text-red-300",children:g.form}),s.jsx(we,{type:"submit",variant:"primary",className:"w-full justify-center py-2.5 text-sm font-semibold",disabled:k,children:p.auth.login})]}),s.jsx("p",{className:"mt-4 text-center text-xs text-gray-400 dark:text-gray-500",children:p.auth.defaultAdminNote})]})]})]})}const uo=100,vs=30,za=2;function t7({data:e,label:n,className:r=""}){const l=Math.max(1,...e),o=e.length>1?(uo-2*za)/(e.length-1):0,c=e.map((h,g)=>[za+g*o,vs-za-h/l*(vs-2*za)]),d=`${za},${vs-za} ${uo-za},${vs-za}`,f=c.length>1?c.map(([h,g])=>`${h},${g}`).join(" "):d,m=c.length>1?`${f} ${uo-za},${vs-za} ${za},${vs-za}`:null;return s.jsxs("svg",{width:uo,height:vs,viewBox:`0 0 ${uo} ${vs}`,role:"img","aria-label":n,className:`text-emerald-600 dark:text-emerald-500 ${r}`,children:[s.jsx("title",{children:n}),m!==null&&s.jsx("polygon",{points:m,fill:"currentColor",fillOpacity:"0.12"}),s.jsx("polyline",{points:f,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const n7=new Set(["default_agent"]),dr={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"},Eu="inline-flex min-w-[2.25rem] shrink-0 cursor-pointer items-center gap-1 tabular-nums transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200";function a7(){const e=aa();gr(p.nav.agents);const{locale:n}=Pa(),{currentProject:r,agents:l,agentsLoading:o,reloadAgents:c,setCurrentAgentId:d}=on(),[f,m]=b.useState(!1),[h,g]=b.useState(""),[y,k]=b.useState(""),[w,S]=b.useState(""),[T,E]=b.useState(void 0),[M,L]=b.useState(!1),O=()=>{g(""),k(""),S(""),E(void 0),m(!0)},[P,H]=b.useState(null),[I,F]=b.useState(null),K=r?.projectId,Z=async()=>{if(!K)return;const $=h.trim();if(!$){E(p.common.requiredField);return}if(!aS.test($)){E(p.agent.idHint);return}L(!0),E(void 0);try{const q={agentId:$};y.trim()&&(q.name=y.trim()),w.trim()&&(q.description=w.trim());const U=await gN(K,q);m(!1),await c(),d(U.agent.agentId),e(`/agents/${U.agent.agentId}`)}catch(q){E(_e(q))}finally{L(!1)}},z=$=>{d($),e(`/chat/${Ja}`,{state:{agentId:$}})},B=($,q)=>{d($),e(`/agents/${$}?tab=${q}`)},A=async()=>{if(!(!K||!P)){L(!0),F(null);try{await AN(K,P.agentId),H(null),await c()}catch($){F(_e($))}finally{L(!1)}}};return s.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[s.jsxs("div",{className:"mx-auto max-w-5xl",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[s.jsx("h1",{className:"text-xl font-semibold",children:p.agent.listTitle}),s.jsx(we,{variant:"primary",onClick:O,children:p.agent.create})]}),o?s.jsx("div",{className:"space-y-3",children:Array.from({length:4},($,q)=>s.jsxs(Zk,{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4",children:[s.jsxs("div",{className:"min-w-[14rem] flex-1",children:[s.jsx(Vt,{className:"h-[18px] w-40"}),s.jsx(Vt,{className:"mt-1.5 h-4 w-2/3"}),s.jsx(Vt,{className:"mt-1.5 h-4 w-48"})]}),s.jsx(Vt,{className:"hidden h-9 w-40 md:block"}),s.jsx(Vt,{className:"h-8 w-52"})]},q))}):l.length===0?s.jsx(hr,{title:p.common.none}):s.jsx("div",{className:"space-y-3",children:l.map($=>{const q=n7.has($.agentId);return s.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:[s.jsxs("div",{className:"min-w-[14rem] flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(na,{id:$.agentId,name:Gt($),size:18,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 truncate text-base font-bold",children:Gt($)}),s.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500",children:$.agentId}),s.jsxs(sn,{tone:"gray",children:["v",$.version]})]}),s.jsx("p",{className:"mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400",children:$.description??""}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2.5 text-xs text-gray-500 dark:text-gray-400",children:[s.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:p.agent.sessionCount($.sessionCount),children:[s.jsx(Pe,{d:dr.sessions,size:12}),$.sessionCount]}),s.jsxs("button",{type:"button",className:Eu,title:p.agent.toolCount($.toolCount),"aria-label":p.agent.toolCount($.toolCount),onClick:()=>B($.agentId,"tools"),children:[s.jsx(Pe,{d:gn.toolCalls,size:12}),$.toolCount]}),s.jsxs("button",{type:"button",className:Eu,title:p.agent.vaultKeyCount($.vaultKeyCount),"aria-label":p.agent.vaultKeyCount($.vaultKeyCount),onClick:()=>B($.agentId,"vault"),children:[s.jsx(Pe,{d:dr.vaultKeys,size:12}),$.vaultKeyCount]}),s.jsxs("button",{type:"button",className:Eu,title:p.agent.scheduleCount($.scheduleCount),"aria-label":p.agent.scheduleCount($.scheduleCount),onClick:()=>B($.agentId,"schedules"),children:[s.jsx(Pe,{d:dr.schedules,size:12}),$.scheduleCount]}),s.jsxs("button",{type:"button",className:Eu,title:p.skills.skillCount($.skillCount),"aria-label":p.skills.skillCount($.skillCount),onClick:()=>B($.agentId,"skills"),children:[s.jsx(Pe,{d:dr.skills,size:12}),$.skillCount]}),s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${p.agent.updatedAt} ${$.updatedAt?wa($.updatedAt):"—"}`,children:[s.jsx(Pe,{d:gn.elapsed,size:12}),$.updatedAt?q4($.updatedAt,n):"—"]})]})]}),s.jsx(t7,{data:$.sessionActivity,label:p.agent.activity($.sessionActivity.length||30),className:"hidden shrink-0 md:block"}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(we,{size:"sm",variant:"primary",onClick:()=>z($.agentId),children:[s.jsx(Pe,{d:dr.newChat}),p.chat.newSessionMenu]}),s.jsxs(we,{size:"sm",onClick:()=>{d($.agentId),e(`/agents/${$.agentId}`)},children:[s.jsx(Pe,{d:dr.settings,className:"text-gray-600 dark:text-gray-300"}),p.common.settings]}),s.jsx(we,{size:"icon",title:p.nav.usage,"aria-label":p.nav.usage,onClick:()=>e(`/usage?agentId=${encodeURIComponent($.agentId)}`),children:s.jsx(Pe,{d:dr.usage,size:15,className:"text-gray-600 dark:text-gray-300"})}),s.jsx(we,{size:"icon",title:p.nav.traces,"aria-label":p.nav.traces,onClick:()=>e(`/traces?agentId=${encodeURIComponent($.agentId)}`),children:s.jsx(Pe,{d:dr.traces,size:15,className:"text-gray-600 dark:text-gray-300"})}),q?s.jsx("span",{role:"img",title:p.agent.builtinUndeletable,"aria-label":p.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:s.jsx(Pe,{d:dr.trash,size:15})}):s.jsx(we,{size:"icon",variant:"danger",title:p.agent.deleteAgent,"aria-label":p.agent.deleteAgent,onClick:()=>H({agentId:$.agentId,name:Gt($)}),children:s.jsx(Pe,{d:dr.trash,size:15})})]})]},$.agentId)})})]}),s.jsx(ln,{open:f,title:p.agent.createTitle,onClose:()=>m(!1),footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:()=>m(!1),children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:M,onClick:()=>{Z()},children:p.common.create})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(tt,{label:p.agent.id,required:!0,size:"sm",value:h,onChange:$=>{g($.target.value),E(void 0)},error:T,hint:p.agent.idHint,autoFocus:!0}),s.jsx(tt,{label:p.common.name,size:"sm",value:y,onChange:$=>k($.target.value),hint:p.agent.nameHint}),s.jsx(ol,{label:p.agent.description,size:"sm",rows:3,value:w,onChange:$=>S($.target.value)})]})}),s.jsxs(qn,{open:P!==null,title:p.agent.deleteAgent,busy:M,onClose:()=>{H(null),F(null)},onConfirm:()=>{A()},children:[s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:P?p.agent.deleteConfirm(P.name):""}),I&&s.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:I})]})]})}function r7({items:e,active:n,onChange:r}){return s.jsx("div",{role:"tablist",className:"flex max-w-full gap-1 overflow-x-auto overflow-y-hidden border-b border-gray-200 dark:border-gray-800",children:e.map(l=>s.jsx("button",{type:"button",role:"tab","aria-selected":l.key===n,onClick:()=>r(l.key),className:`-mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors duration-150 ${l.key===n?"border-gray-900 font-semibold text-gray-900 dark:border-gray-100 dark:text-gray-100":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-800 dark:text-gray-400 dark:hover:border-gray-700 dark:hover:text-gray-200"}`,children:l.label},l.key))})}const s7=288,l7={base:"text-base",sm:"text-xs"},i7={base:"text-xs",sm:"text-[11px]"};function cp({options:e,value:n,onChange:r,placeholder:l,mono:o,label:c,error:d,required:f,fullWidth:m,size:h="base","aria-label":g}){const[y,k]=b.useState(!1),{triggerRef:w,panelRef:S,position:T}=rS({open:y,onClose:()=>k(!1),estimatedHeight:e.length*48+16,panelWidth:s7}),E=n!=null?e.find(O=>O.value===n):void 0,M=b.useId(),L=s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:w,type:"button","aria-label":g,"aria-haspopup":"listbox","aria-expanded":y,"aria-required":f||void 0,"aria-invalid":d?!0:void 0,"aria-describedby":d?M:void 0,onClick:()=>k(O=>!O),className:`flex items-center gap-2 ${qo} ${Go[h]} ${d?xd:""}`+(m?" w-full justify-between":""),children:[s.jsx("span",{className:`min-w-0 truncate ${o?"font-mono":""}`,children:E?.triggerLabel??l??"—"}),s.jsx(Fo,{className:"text-gray-400"})]}),y&&T&&si.createPortal(s.jsx("div",{ref:S,role:"listbox",style:{position:"fixed",top:T.topPx,bottom:T.bottomPx,left:T.left,minWidth:T.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(O=>s.jsxs("button",{type:"button",role:"option","aria-selected":O.value===n,onClick:()=>{r(O.value),k(!1)},className:`block ${Qk} hover:bg-gray-100 dark:hover:bg-gray-800 ${O.value===n?"bg-gray-100 dark:bg-gray-800":""}`,children:[s.jsxs("span",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:`${l7[h]} ${O.value===n?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:O.label}),O.value===n&&s.jsx(zk,{className:"text-gray-500 dark:text-gray-400"})]}),s.jsx("span",{className:`mt-0.5 block ${i7[h]} text-gray-500 dark:text-gray-400`,children:O.description})]},O.value))}),document.body)]});return s.jsx(Vo,{label:c,error:d,errorId:M,required:f,children:L})}const o7=/^(www\.)?(github|gitlab|gitee|bitbucket)\.(com|org)$/i;function c7(e){const n=e.trim();if(/^git@[\w.-]+:/.test(n)||/\.git$/i.test(n))return"repoUrl";if(/^https?:\/\//i.test(n)){try{if(o7.test(new URL(n).hostname))return"repoUrl"}catch{}return"webUrl"}return/^(\/|~\/|\.{1,2}\/|[A-Za-z]:[\\/]|\\\\)/.test(n)?"localPath":/^[A-Za-z@][\w@./-]*\s+\S/.test(n)?"command":"reference"}function gh(e){return`${p.skills.importPromptLead[c7(e)](e)}
|
|
172
|
-
${p.skills.importPromptTail}`}const u7="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",d7="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";function f7({agentId:e}){const n=aa(),{locale:r}=Pa(),l=Ln().user?.userId??null,{currentProject:o,agents:c,setCurrentAgentId:d}=on(),f=o?.projectId??null,[m,h]=b.useState(null),[g,y]=b.useState(null),[k,w]=b.useState(!1),[S,T]=b.useState(null),[E,M]=b.useState(!1),[L,O]=b.useState(""),[P,H]=b.useState(!1),[I,F]=b.useState(null),[K,Z]=b.useState(null),z=b.useCallback(async()=>{if(!(!f||!e)){h(null),y(null);try{const C=await ud(f,e);h(C.skills)}catch(C){y(_e(C))}}},[f,e]);b.useEffect(()=>{z()},[z]);const B=c.find(C=>C.agentId===e),A=B?Gt(B):e,$=async C=>{if(f)try{const Q=await fetch($N(f,e,C));if(!Q.ok){const xe=await Q.json().catch(()=>null);throw new ka(Q.status,xe?.error?.code??"unknown",xe?.error?.message??p.common.unknownError)}const ee=/filename\*=UTF-8''([^;]+)/i.exec(Q.headers.get("content-disposition")??"")?.[1],ae=URL.createObjectURL(await Q.blob()),he=document.createElement("a");he.href=ae,he.download=ee?decodeURIComponent(ee):`${C}.zip`,document.body.appendChild(he),he.click(),he.remove(),URL.revokeObjectURL(ae)}catch(Q){ht(_e(Q))}},q=async()=>{if(!(!f||S===null)){w(!0);try{await Xv(f,e,S),_n(p.skills.uninstalledToast(S,A)),await z()}catch(C){ht(_e(C))}finally{w(!1),T(null)}}},U=()=>{O(""),F(null),Z(null),M(!0)},V=L.trim(),W=gh(V||p.skills.importSourceToken),ce=()=>{navigator.clipboard.writeText(gh(V)).then(()=>_n(p.skills.importCopied)).catch(()=>ht(p.common.unknownError))},te=()=>{if(l&&f&&V){const C=rl(l,f);ni(C,{...ec(C),agentId:e,text:gh(V),skills:[],handoffAgentId:void 0})}d(e),n(`/chat/${Ja}`,{state:{agentId:e}})},N=async(C,Q,ee)=>{if(f){H(!0),F(null);try{await UN(f,e,{dataBase64:C,...ee?{overwrite:!0}:{}}),Z(null),M(!1),_n(p.skills.importDoneToast),await z()}catch(ae){if(ae instanceof ka&&ae.status===409&&ae.code==="skill_exists"){const he=/:\s*([A-Za-z0-9_-]+)$/.exec(ae.message)?.[1]??Q;Z({dataBase64:C,name:he})}else Z(null),F(_e(ae))}finally{H(!1)}}},_=C=>{const Q=C.target.files?.[0];if(C.target.value="",!Q)return;F(null);const ee=Q.name.replace(/\.zip$/i,""),ae=new FileReader;ae.onload=()=>{const he=ae.result;N(he.slice(he.indexOf(",")+1),ee,!1)},ae.onerror=()=>F(p.common.unknownError),ae.readAsDataURL(Q)},R=C=>[`v${C.version}`,C.updated?Fk(C.updated,r):null].filter(Q=>Q!==null).join(" · ");return f?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:p.skills.agentTabDesc}),s.jsx(we,{size:"sm",variant:"primary",className:"shrink-0",disabled:m===null,onClick:U,children:p.skills.importSkill})]}),m===null?s.jsx(ba,{rows:4}):m.length===0?s.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:p.skills.agentTabEmpty}):s.jsx("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:m.map(C=>s.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 px-3 py-2.5 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[s.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${M2(C.name)}`,children:s.jsx(Nd,{icon:C.icon,size:20})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate font-mono text-[13px] font-semibold",title:C.name,children:C.name}),s.jsx("p",{className:"mt-0.5 truncate text-xs text-gray-500 dark:text-gray-400",title:C.description,children:oi(r,C)})]}),s.jsx("span",{className:"hidden shrink-0 text-[11px] text-gray-400 sm:block dark:text-gray-500",title:R(C),children:R(C)}),s.jsx(we,{size:"icon",title:p.skills.exportSkill,"aria-label":`${p.skills.exportSkill} ${C.name}`,disabled:k,onClick:()=>{$(C.name)},children:s.jsx(Uk,{size:14,className:"text-gray-600 dark:text-gray-300"})}),s.jsx(we,{size:"icon",variant:"danger",title:p.skills.uninstall,"aria-label":`${p.skills.uninstall} ${C.name}`,disabled:k,onClick:()=>T(C.name),children:s.jsx(Pe,{d:d7,size:14})})]},C.name))}),s.jsx(ln,{open:E,title:p.skills.importSkill,onClose:()=>M(!1),widthClass:"sm:max-w-lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("section",{children:[s.jsx("p",{className:"text-sm font-medium",children:p.skills.importChatTitle}),s.jsx("p",{className:"mt-0.5 text-xs text-gray-500 dark:text-gray-400",children:p.skills.importChatWhy}),s.jsxs("div",{className:"mt-2.5 space-y-2.5",children:[s.jsx(tt,{size:"sm",label:p.skills.importSourceLabel,hint:p.skills.importSourceHint,value:L,onChange:C=>O(C.target.value),placeholder:p.skills.importSourcePlaceholder,autoComplete:"off"}),s.jsx(ol,{label:p.skills.importPromptLabel,size:"sm",rows:5,readOnly:!0,value:W,className:"text-gray-600 dark:text-gray-300"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(we,{size:"sm",disabled:V==="",onClick:ce,children:p.skills.importCopyPrompt}),s.jsx(we,{size:"sm",variant:"primary",onClick:te,children:p.skills.importOpenChat})]})]})]}),s.jsxs("section",{className:"border-t border-gray-200 pt-4 dark:border-gray-800",children:[s.jsx("p",{className:"text-sm font-medium",children:p.skills.importUploadTitle}),s.jsx("p",{className:"mt-0.5 text-xs text-gray-500 dark:text-gray-400",children:p.skills.importUploadDesc}),s.jsxs("label",{className:`${u7} mt-2.5 ${P?"pointer-events-none opacity-60":""}`,children:[s.jsx(Cd,{accept:".zip",disabled:P,onChange:_}),P?p.skills.importUploading:p.skills.importUploadAction]}),I&&s.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:I})]})]})}),s.jsx(qn,{open:K!==null,title:p.skills.importOverwriteTitle,confirmLabel:p.skills.importOverwriteAction,busy:P,onClose:()=>Z(null),onConfirm:()=>{K!==null&&N(K.dataBase64,K.name,!0)},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:K!==null?p.skills.importOverwriteBody(K.name):""})}),s.jsx(qn,{open:S!==null,title:S!==null?p.skills.uninstallConfirmTitle(S):"",busy:k,onClose:()=>T(null),onConfirm:()=>{q()},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:S!==null?p.skills.uninstallConfirmBody(S,A):""})}),g&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:g})]}):null}const m7=/^[A-Za-z_][A-Za-z0-9_]*$/;function h7({agentId:e}){const{currentProject:n}=on(),r=n?.projectId??null,l=n?.role==="owner",[o,c]=b.useState(null),[d,f]=b.useState(null),[m,h]=b.useState(!1),[g,y]=b.useState(!1),[k,w]=b.useState(""),[S,T]=b.useState(""),[E,M]=b.useState({}),L=()=>M($=>$.key||$.value?{}:$),[O,P]=b.useState(null),[H,I]=b.useState(null),F=b.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{const $=await mN(r,e);c($.entries)}catch($){f(_e($))}}},[r,e]);b.useEffect(()=>{F()},[F]);const K=async $=>{if(!r||!e)return p.common.unknownError;h(!0);try{const q=await hN(r,e,$);return c(q.entries),_n(p.common.saved),null}catch(q){return _e(q)}finally{h(!1)}},Z=$=>(o??[]).filter(q=>q.key!==$).map(q=>({key:q.key})),z=()=>{w(""),T(""),M({}),y(!0)},B=async()=>{const $=k.trim(),q={};if($?m7.test($)||(q.key=p.vault.keyInvalid):q.key=p.common.requiredField,S||(q.value=p.vault.valueRequired),q.key||q.value){M(q);return}if(M({}),H!==$&&(o??[]).some(V=>V.key===$)){I($);return}I(null);const U=await K({entries:[...Z($),{key:$,value:S}]});if(U!==null){M({key:U});return}y(!1)},A=async()=>{if(O===null)return;const $=await K({entries:Z(O)});$!==null&&ht($),P(null)};return r?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:p.vault.desc}),!l&&s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:p.vault.readOnlyHint})]}),o===null?s.jsx(ba,{rows:4}):o.length===0?s.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:p.vault.empty}):s.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:s.jsxs("table",{className:"w-full min-w-[420px] text-left text-sm",children:[s.jsx("thead",{children:s.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:[s.jsx("th",{className:"px-3 py-2.5",children:p.vault.key}),s.jsx("th",{className:"px-3 py-2.5",children:p.vault.valueMasked}),s.jsx("th",{className:"px-3 py-2.5"})]})}),s.jsx("tbody",{children:o.map($=>s.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:[s.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:$.key}),s.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400",children:$.valueMasked}),s.jsx("td",{className:"px-3 py-2 text-right",children:l&&s.jsx(we,{size:"sm",variant:"ghost",disabled:m,onClick:()=>P($.key),children:p.vault.remove})})]},$.key))})]})}),l&&o!==null&&s.jsx(we,{size:"sm",variant:"primary",disabled:m,onClick:z,children:p.vault.add}),s.jsx(ln,{open:g,title:p.vault.addTitle,onClose:()=>y(!1),footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:()=>y(!1),children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:m,onClick:()=>{B()},children:p.vault.add})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(tt,{size:"sm",label:p.vault.key,required:!0,hint:p.vault.keyHint,error:E.key,value:k,onChange:$=>{w($.target.value),L()},className:"font-mono",placeholder:"OPENAI_API_KEY",autoComplete:"off"}),s.jsx(Ss,{size:"sm",label:p.vault.value,required:!0,error:E.value,value:S,onChange:$=>{T($.target.value),L()},className:"font-mono",autoComplete:"off",onKeyDown:$=>{$.key==="Enter"&&!m&&B()}})]})}),s.jsx(qn,{open:H!==null,title:p.vault.overwriteTitle,tone:"primary",confirmLabel:p.common.save,busy:m,onClose:()=>I(null),onConfirm:()=>{B()},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:H!==null?p.vault.overwriteConfirm(H):""})}),s.jsx(qn,{open:O!==null,title:p.vault.deleteTitle,busy:m,onClose:()=>P(null),onConfirm:()=>{A()},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:O!==null?p.vault.deleteConfirm(O):""})}),d&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]}):null}const p7={active:"green",disabled:"gray",expired:"amber",done:"brand",missed:"amber",invalid:"red"};function lv(e){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=l=>l<10?`0${l}`:`${l}`;return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}const xh=e=>JSON.stringify([e.provider,e.modelId]),g7=e=>{if(!e)return null;const[n,r]=JSON.parse(e);return{provider:n,modelId:r}},iv=e=>`${e.modelId} · ${Hr(e.provider)?.label??e.provider}`,ov=e=>e.modelId&&e.provider?{provider:e.provider,modelId:e.modelId}:null,x7={editing:null,name:"",prompt:"",enabled:!0,startAt:"",endAt:"",period:"",target:"new",sessionId:"",workspace:"",model:null};function y7({agentId:e}){const{currentProject:n}=on(),r=n?.projectId??null,l=n?.role==="owner",[o,c]=b.useState(null),[d,f]=b.useState(null),[m,h]=b.useState(!1),[g,y]=b.useState(null),[k,w]=b.useState(null),[S,T]=b.useState({}),[E,M]=b.useState(null),[L,O]=b.useState(null),[P,H]=b.useState([]),I=b.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{c(await LN(r,e))}catch(U){f(_e(U))}}},[r,e]);b.useEffect(()=>{I()},[I]),b.useEffect(()=>{!r||!l||$o(r).then(U=>H(U.models)).catch(()=>H([]))},[r,l]);const F=U=>{T(V=>V.name||V.prompt||V.startAt||V.sessionId?{}:V),M(V=>V&&null),y(V=>V===null?V:{...V,...U})},K=U=>{T({}),M(null),y(U),w(U)},Z=async()=>{if(!r||g===null)return;M(null);const U=g.editing??g.name.trim(),V={};if(U||(V.name=p.common.requiredField),g.prompt.trim()||(V.prompt=p.common.requiredField),g.startAt||(V.startAt=p.common.requiredField),g.target==="session"&&!g.sessionId.trim()&&(V.sessionId=p.common.requiredField),V.name||V.prompt||V.startAt||V.sessionId){T(V);return}if(T({}),g.editing!==null&&JSON.stringify(g)===JSON.stringify(k)){Ts(p.common.noChangesToSave);return}const W={prompt:g.prompt,enabled:g.enabled,startAt:new Date(g.startAt).toISOString(),...g.period.trim()?{period:g.period.trim()}:{},...g.endAt?{endAt:new Date(g.endAt).toISOString()}:{},...g.target==="session"&&g.sessionId.trim()?{sessionId:g.sessionId.trim()}:{},...g.target==="new"&&g.workspace.trim()?{workspace:g.workspace.trim()}:{},...g.target==="new"&&g.model?{modelId:g.model.modelId,provider:g.model.provider}:{}};h(!0);try{g.editing!==null?await a1(r,e,g.editing,W):await ON(r,e,{name:U,...W}),y(null),_n(p.common.saved),await I()}catch(ce){M(_e(ce))}finally{h(!1)}},z=async U=>{if(!r)return;h(!0);const V=ov(U);try{await a1(r,e,U.name,{prompt:U.prompt,enabled:!U.enabled,startAt:U.startAt,...U.period!==void 0?{period:U.period}:{},...U.endAt!==void 0?{endAt:U.endAt}:{},...U.sessionId!==void 0?{sessionId:U.sessionId}:{},...U.workspace!==void 0?{workspace:U.workspace}:{},...V?{modelId:V.modelId,provider:V.provider}:{}}),_n(p.common.saved),await I()}catch(W){ht(_e(W))}finally{h(!1)}},B=U=>{K({editing:U.name,name:U.name,prompt:U.prompt,enabled:U.enabled,startAt:lv(U.startAt),endAt:lv(U.endAt),period:U.period??"",target:U.sessionId?"session":"new",sessionId:U.sessionId??"",workspace:U.workspace??"",model:ov(U)})},A=async()=>{if(!(!r||L===null)){h(!0);try{await DN(r,e,L),g?.editing===L&&y(null),await I()}catch(U){ht(_e(U))}finally{h(!1),O(null)}}};if(!r)return null;const $=o?.schedules??[],q=o?.invalidFiles??[];return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:p.schedule.desc}),!l&&s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:p.schedule.readOnlyHint})]}),o===null?s.jsx(ba,{rows:4}):$.length===0?s.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:p.schedule.empty}):s.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:s.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[s.jsx("thead",{children:s.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:[s.jsx("th",{className:"px-3 py-2.5",children:p.common.name}),s.jsx("th",{className:"px-3 py-2.5",children:p.schedule.colStatus}),s.jsx("th",{className:"px-3 py-2.5",children:p.schedule.colPeriod}),s.jsx("th",{className:"px-3 py-2.5",children:p.schedule.colTarget}),s.jsx("th",{className:"px-3 py-2.5",children:p.schedule.colFireTimes}),s.jsx("th",{className:"px-3 py-2.5",children:p.schedule.colQueued}),l&&s.jsx("th",{className:"px-3 py-2.5"})]})}),s.jsx("tbody",{children:$.map(U=>s.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:[s.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:U.name}),s.jsx("td",{className:"px-3 py-2",children:s.jsx("span",{title:U.invalidReason,children:s.jsx(sn,{tone:p7[U.status],children:p.schedule.statusNames[U.status]??U.status})})}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:U.period!==void 0?s.jsx("span",{className:"font-mono",children:U.period}):p.schedule.once}),s.jsx("td",{className:"max-w-36 truncate px-3 py-2 text-xs text-gray-500 dark:text-gray-400",title:U.sessionId,children:U.sessionId!==void 0?s.jsx("span",{className:"font-mono",children:U.sessionId}):p.schedule.newSession}),s.jsxs("td",{className:"px-3 py-2 text-xs",children:[s.jsx("span",{className:"block text-gray-600 dark:text-gray-300",children:U.nextFireAt?wa(U.nextFireAt):"—"}),s.jsx("span",{className:"block text-gray-400 dark:text-gray-500",children:U.lastFiredAt?wa(U.lastFiredAt):"—"})]}),s.jsx("td",{className:"px-3 py-2",children:U.queued&&s.jsx(sn,{tone:"brand",children:p.schedule.queued})}),l&&s.jsxs("td",{className:"whitespace-nowrap px-3 py-2 text-right",children:[s.jsx(we,{size:"sm",variant:"ghost",disabled:m,onClick:()=>{z(U)},children:U.enabled?p.schedule.disable:p.schedule.enable}),s.jsx(we,{size:"sm",variant:"ghost",disabled:m,onClick:()=>B(U),children:p.common.edit}),s.jsx(we,{size:"sm",variant:"ghost",disabled:m,onClick:()=>O(U.name),children:p.common.delete})]})]},U.name))})]})}),q.length>0&&s.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400",children:[s.jsx("p",{className:"font-medium",children:p.schedule.invalidFiles}),s.jsx("ul",{className:"mt-0.5 space-y-0.5 font-mono",children:q.map(U=>s.jsxs("li",{children:[U.name,": ",U.error]},U.name))})]}),l&&o!==null&&s.jsx(we,{size:"sm",variant:"primary",disabled:m,onClick:()=>K(x7),children:p.schedule.addTitle}),s.jsx(ln,{open:g!==null,title:g?.editing!=null?p.schedule.editTitle(g.editing):p.schedule.addTitle,onClose:()=>y(null),widthClass:"sm:max-w-lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:()=>y(null),children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:m,onClick:()=>{Z()},children:g?.editing!=null?p.common.save:p.common.create})]}),children:g!==null&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[s.jsx(tt,{size:"sm",label:p.common.name,required:!0,hint:p.schedule.nameHint,error:S.name,value:g.name,disabled:g.editing!==null,onChange:U=>F({name:U.target.value}),className:"font-mono",placeholder:"daily_report",autoComplete:"off"}),s.jsx(tt,{size:"sm",label:p.schedule.period,value:g.period,onChange:U=>F({period:U.target.value}),className:"font-mono",placeholder:p.schedule.periodPlaceholder,autoComplete:"off"}),s.jsx(tt,{size:"sm",label:p.schedule.startAt,required:!0,type:"datetime-local",error:S.startAt,value:g.startAt,onChange:U=>F({startAt:U.target.value}),className:"font-mono"}),s.jsx(tt,{size:"sm",label:p.schedule.endAt,type:"datetime-local",value:g.endAt,onChange:U=>F({endAt:U.target.value}),className:"font-mono"}),s.jsxs(Pr,{size:"sm",label:p.schedule.target,value:g.target,onChange:U=>F({target:U.target.value}),children:[s.jsx("option",{value:"new",children:p.schedule.targetNew}),s.jsx("option",{value:"session",children:p.schedule.targetSession})]}),g.target==="session"?s.jsx(tt,{size:"sm",label:p.schedule.sessionId,required:!0,error:S.sessionId,value:g.sessionId,onChange:U=>F({sessionId:U.target.value}),className:"font-mono",autoComplete:"off"}):s.jsxs(s.Fragment,{children:[s.jsxs(Pr,{size:"sm",label:p.schedule.model,value:g.model?xh(g.model):"",onChange:U=>F({model:g7(U.target.value)}),children:[s.jsx("option",{value:"",children:p.schedule.modelDefault}),g.model&&!P.some(U=>U.modelId===g.model.modelId&&U.provider===g.model.provider)&&s.jsx("option",{value:xh(g.model),children:iv(g.model)}),P.map(U=>s.jsx("option",{value:xh({provider:U.provider,modelId:U.modelId}),children:iv({provider:U.provider,modelId:U.modelId})},`${U.provider}:${U.modelId}`))]}),s.jsx(tt,{size:"sm",label:p.schedule.workspace,value:g.workspace,onChange:U=>F({workspace:U.target.value}),className:"font-mono",autoComplete:"off"})]})]}),s.jsx(ol,{label:p.schedule.prompt,required:!0,size:"sm",rows:4,error:S.prompt,value:g.prompt,onChange:U=>F({prompt:U.target.value})}),s.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[s.jsx("input",{type:"checkbox",checked:g.enabled,onChange:U=>F({enabled:U.target.checked})}),p.schedule.enabled]}),E&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:E})]})}),s.jsx(qn,{open:L!==null,title:p.schedule.deleteTitle,busy:m,onClose:()=>O(null),onConfirm:()=>{A()},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:L!==null?p.schedule.deleteConfirm(L):""})}),d&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]})}function b7(e){return e.filter(([n])=>n!=="").map(([n,r])=>({value:n,triggerLabel:n,label:n,description:r}))}function fo(e){const n=e.trim();if(!n)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function tl(e){return e===void 0?"":String(e)}function v7(e,n,r){return n.some(l=>l.key===e)?e:r}function k7(){const e=[{key:"overview",label:p.agent.tabOverview},{key:"prompt",label:p.agent.tabPrompt},{key:"runtime",label:p.agent.tabRuntime},{key:"tools",label:p.agent.tabTools},{key:"skills",label:p.agent.tabSkills},{key:"vault",label:p.agent.tabVault},{key:"schedules",label:p.agent.tabSchedules}],n=aa(),l=yk().agentId??"";gr(p.agent.settings);const{currentProject:o,reloadAgents:c}=on(),d=o?.projectId??null,[f,m]=b.useState(null),[h,g]=hd(),[y,k]=b.useState(()=>v7(h.get("tab"),e,"overview")),w=b.useCallback(P=>{k(P),g(H=>{const I=new URLSearchParams(H);return I.set("tab",P),I},{replace:!0})},[g]),[S,T]=b.useState(null),E=b.useCallback(()=>{!d||!l||(m(null),T(null),pp(d,l).then(m).catch(P=>T(_e(P))))},[d,l]);b.useEffect(()=>{E()},[E]);const M=b.useCallback(P=>{_n(p.agent.importDone(P)),E(),c()},[E,c]),L=b.useCallback(()=>{_n(p.agent.resetConfigDone),E(),c()},[E,c]),O=b.useCallback(async P=>{if(!(!d||!l))try{const H=await Kv(d,l,P);m(H),_n(p.common.saved),(P.config?.name!==void 0||P.config?.description!==void 0)&&c()}catch(H){ht(_e(H))}},[d,l,c]);return d?S&&!f?s.jsx("p",{className:"p-6 text-sm text-red-600 dark:text-red-400",children:S}):f?s.jsx("div",{className:"no-scrollbar relative h-full overflow-y-auto p-4 md:p-6",children:s.jsxs("div",{className:"mx-auto max-w-3xl",children:[s.jsxs(we,{variant:"ghost",size:"sm",onClick:()=>n("/agents"),className:"-ml-2 mb-3 text-gray-500 dark:text-gray-400",children:[s.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:[s.jsx("path",{d:"M15 18l-6-6 6-6"}),s.jsx("path",{d:"M9 12h12"})]}),p.agent.backToList]}),s.jsx("h1",{className:"mb-1 text-xl font-semibold",children:f.config.name??l}),s.jsx("p",{className:"mb-4 font-mono text-xs text-gray-400",children:l}),s.jsx(r7,{items:e,active:y,onChange:w}),s.jsxs("div",{className:"py-4",children:[y==="overview"&&s.jsx(w7,{data:f,agentId:l,onSave:O,onImported:M,onConfigReset:L}),y==="prompt"&&s.jsx(S7,{data:f,onSave:O}),y==="runtime"&&s.jsx(j7,{data:f,onSave:O}),y==="tools"&&s.jsx(N7,{data:f,onSave:O}),y==="skills"&&s.jsx(f7,{agentId:l}),y==="vault"&&s.jsx(h7,{agentId:l}),y==="schedules"&&s.jsx(y7,{agentId:l})]})]})}):s.jsxs("div",{className:"space-y-3 p-6",children:[s.jsx(Vt,{className:"h-6 w-64"}),s.jsx(Vt,{className:"h-32 w-full"})]}):null}const cv="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 w7({data:e,agentId:n,onSave:r,onImported:l,onConfigReset:o}){const{currentProject:c}=on(),d=c?.projectId??null,f=c?.role==="owner",[m,h]=b.useState(e.config.name??""),[g,y]=b.useState(e.config.description??""),[k,w]=b.useState(!1),[S,T]=b.useState(null),[E,M]=b.useState(null),[L,O]=b.useState(!1),[P,H]=b.useState(!1),{requestSave:I,element:F}=gd(),K=async()=>{if(d){H(!0);try{await xN(d,n),O(!1),o()}catch(A){ht(_e(A))}finally{H(!1)}}},Z=()=>{const A={};if(m.trim()!==(e.config.name??"")&&(A.name=m.trim()),g.trim()!==(e.config.description??"")&&(A.description=g.trim()),Object.keys(A).length===0){Ts(p.common.noChangesToSave);return}I(()=>{r({config:A})})},z=async(A,$)=>{if(d){w(!0),T(null);try{const q=await VN(d,n,{dataBase64:A,...$?{confirm:!0}:{}});M(null),l(q.version)}catch(q){q instanceof ka&&q.status===409&&q.code==="version_conflict"?M(A):(M(null),T(_e(q)))}finally{w(!1)}}},B=A=>{const $=A.target.files?.[0];if(A.target.value="",!$)return;T(null);const q=new FileReader;q.onload=()=>{const U=q.result;z(U.slice(U.indexOf(",")+1),!1)},q.onerror=()=>T(p.common.unknownError),q.readAsDataURL($)};return s.jsxs("div",{className:"space-y-4",children:[s.jsx(tt,{size:"sm",label:p.common.name,value:m,onChange:A=>h(A.target.value)}),s.jsx(ol,{label:p.agent.description,size:"sm",rows:3,value:g,onChange:A=>y(A.target.value)}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:p.agent.stateDir}),s.jsx("p",{className:"break-all font-mono text-xs text-gray-500 dark:text-gray-400",children:e.stateDir})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:p.agent.activeSessions}),s.jsx("p",{className:"text-sm",children:e.activeSessionCount})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:p.agent.stateVersion}),s.jsxs("p",{className:"font-mono text-sm",children:["v",e.config.version]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:p.agent.transferTitle}),s.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:p.agent.transferDesc}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d&&s.jsx("a",{href:qN(d,n),download:!0,className:cv,children:p.agent.exportSnapshot}),f&&s.jsxs("label",{className:`${cv} ${k?"pointer-events-none opacity-60":""}`,children:[s.jsx(Cd,{accept:".tar.gz,.tgz",disabled:k,onChange:B}),k?p.agent.importing:p.agent.importSnapshot]})]}),S&&s.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:S})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:p.agent.resetConfigTitle}),s.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:p.agent.resetConfigDesc}),s.jsx(we,{size:"sm",disabled:P,onClick:()=>O(!0),children:p.agent.resetConfigAction})]}),s.jsx(we,{size:"sm",variant:"primary",onClick:Z,children:p.common.save}),F,s.jsx(qn,{open:E!==null,title:p.agent.importConflictTitle,busy:k,onClose:()=>M(null),onConfirm:()=>{E!==null&&z(E,!0)},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.agent.importConflictBody})}),s.jsx(qn,{open:L,title:p.agent.resetConfigTitle,busy:P,onClose:()=>O(!1),onConfirm:()=>{K()},confirmLabel:p.agent.resetConfigAction,children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.agent.resetConfigConfirmBody})})]})}function S7({data:e,onSave:n}){const[r,l]=b.useState(e.agentsMd),[o,c]=b.useState(e.config.systemPrompt),d=b.useRef(null),{requestSave:f,element:m}=gd(),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){Ts(p.common.noChangesToSave);return}f(()=>{n(y)})},g=y=>{const k=d.current;if(k&&(k.focus(),document.execCommand?.("insertText",!1,y)))return;const w=k?k.selectionStart:o.length,S=k?k.selectionEnd:o.length;c(o.slice(0,w)+y+o.slice(S)),requestAnimationFrame(()=>{if(!k)return;k.focus();const T=w+y.length;k.setSelectionRange(T,T)})};return s.jsxs("div",{className:"space-y-4",children:[s.jsx(ol,{label:p.agent.agentsMd,mono:!0,size:"sm",rows:14,value:r,onChange:y=>l(y.target.value)}),s.jsx(ol,{ref:d,label:p.agent.systemPrompt,mono:!0,size:"sm",rows:12,value:o,onChange:y=>c(y.target.value)}),s.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:p.agent.placeholdersTitle}),s.jsx("ul",{className:"space-y-1",children:p.agent.placeholders.map(([y,k])=>s.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[s.jsx("button",{type:"button",onClick:()=>g(y),title:p.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}),s.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:k})]},y))})]}),s.jsx(we,{size:"sm",variant:"primary",onClick:h,children:p.common.save}),m]})}function j7({data:e,onSave:n}){const r=e.config,[l,o]=b.useState(tl(r.maxTurns)),[c,d]=b.useState(tl(r.model?.maxTokens)),[f,m]=b.useState(r.model?.thinkingLevel??""),[h,g]=b.useState(tl(r.model?.timeoutMs)),[y,k]=b.useState(tl(r.compaction?.maxContextLength)),[w,S]=b.useState(tl(r.compaction?.maxSessionTurns)),[T,E]=b.useState(r.compaction?.mode??""),[M,L]=b.useState(r.compaction?.prompt??""),[O,P]=b.useState({}),H=()=>P(B=>B.maxTurns||B.timeoutMs?{}:B),{requestSave:I,element:F}=gd(),K=()=>{P({});const B={},A=fo(l);if(A!==void 0&&A!==r.maxTurns){if(A<=0&&A!==-1){P({maxTurns:p.agent.maxTurnsInvalid});return}B.maxTurns=A}const $={},q=fo(c);q!==void 0&&q!==r.model?.maxTokens&&($.maxTokens=q),f&&f!==(r.model?.thinkingLevel??"")&&($.thinkingLevel=f);const U=fo(h);if(U!==void 0&&U!==r.model?.timeoutMs){if(U<=0&&U!==-1){P({timeoutMs:p.agent.timeoutInvalid});return}$.timeoutMs=U}Object.keys($).length>0&&(B.model=$);const V={},W=fo(y);W!==void 0&&W!==r.compaction?.maxContextLength&&(V.maxContextLength=W);const ce=fo(w);if(ce!==void 0&&ce!==r.compaction?.maxSessionTurns&&(V.maxSessionTurns=ce),T&&T!==(r.compaction?.mode??"")&&(V.mode=T),M!==(r.compaction?.prompt??"")&&(V.prompt=M),Object.keys(V).length>0&&(B.compaction=V),Object.keys(B).length===0){Ts(p.common.noChangesToSave);return}I(()=>{n({config:B})})},Z=HI(p.agent.thinkingLevelOptions,p.agent.thinkingLevelNoneKept,r.model?.thinkingLevel),z=b7(p.agent.compactionModeOptions);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("div",{className:"p-3",children:s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[s.jsx(tt,{label:p.agent.maxTurns,size:"sm",value:l,error:O.maxTurns,onChange:B=>{o(B.target.value),H()},inputMode:"numeric",className:"font-mono"}),s.jsx(tt,{label:p.agent.maxTokens,size:"sm",value:c,onChange:B=>d(B.target.value),inputMode:"numeric",className:"font-mono"}),s.jsx(cp,{label:p.agent.thinkingLevel,fullWidth:!0,size:"sm",placeholder:p.agent.defaultValue,value:f,onChange:m,options:Z}),s.jsx(tt,{label:p.agent.timeoutMs,hint:p.agent.timeoutMsHint,size:"sm",value:h,error:O.timeoutMs,onChange:B=>{g(B.target.value),H()},inputMode:"numeric",className:"font-mono"})]})}),s.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:p.agent.compaction}),s.jsx("div",{className:"p-3",children:s.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[s.jsx(tt,{label:p.agent.maxContextLength,hint:p.agent.maxContextLengthHint,size:"sm",value:y,onChange:B=>k(B.target.value),inputMode:"numeric",className:"font-mono"}),s.jsx(tt,{label:p.agent.maxSessionTurns,hint:p.agent.maxSessionTurnsHint,size:"sm",value:w,onChange:B=>S(B.target.value),inputMode:"numeric",className:"font-mono"}),s.jsx(cp,{label:p.agent.compactionMode,fullWidth:!0,size:"sm",placeholder:p.agent.defaultValue,value:T,onChange:E,options:z})]})}),s.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:p.agent.compactionPrompt}),s.jsx("div",{className:"p-3",children:s.jsx(ol,{"aria-label":p.agent.compactionPrompt,mono:!0,size:"sm",rows:4,value:M,onChange:B=>L(B.target.value)})})]}),s.jsx(we,{size:"sm",variant:"primary",onClick:K,children:p.common.save}),F]})}function N7({data:e,onSave:n}){const r=[{value:"r",triggerLabel:"r",label:p.agent.permissionReadLabel,description:p.agent.permissionReadDescription},{value:"rw",triggerLabel:"rw",label:p.agent.permissionReadWriteLabel,description:p.agent.permissionReadWriteDescription}],[l,o]=b.useState(()=>e.config.toolsBuiltin.map(k=>({base:{...k},timeoutMs:tl(k.timeoutMs),maxOutputLength:tl(k.maxOutputLength)}))),[c,d]=b.useState({}),{requestSave:f,element:m}=gd(),h=(k,w)=>{o(S=>S.map((T,E)=>E===k?{...T,...w}:T)),d(S=>{const T=`${k}-timeoutMs`,E=`${k}-maxOutputLength`;if(!S[T]&&!S[E])return S;const M={...S};return delete M[T],delete M[E],M})},g=()=>{const k={},w=[];for(const[E,M]of l.entries()){const L={...M.base};delete L.timeoutMs,delete L.maxOutputLength;const O=M.timeoutMs.trim();if(O){const I=Number(O);!Number.isInteger(I)||I<=0&&I!==-1?k[`${E}-timeoutMs`]=p.agent.toolFieldInvalid(M.base.name,"timeoutMs"):L.timeoutMs=I}const P=M.maxOutputLength.trim();if(P){const I=Number(P);!Number.isInteger(I)||I<=0&&I!==-1?k[`${E}-maxOutputLength`]=p.agent.toolFieldInvalid(M.base.name,"maxOutputLength"):L.maxOutputLength=I}const H=e.config.toolsBuiltin[E];L.call_description===!0&&H?.call_description===void 0&&delete L.call_description,w.push(L)}if(Object.keys(k).length>0){d(k);return}d({});const S=e.config.toolsBuiltin;if(!(w.length!==S.length||w.some((E,M)=>{const L=S[M];return E.permission!==L.permission||E.timeoutMs!==L.timeoutMs||E.maxOutputLength!==L.maxOutputLength||E.call_description!==L.call_description}))){Ts(p.common.noChangesToSave);return}f(()=>{n({config:{toolsBuiltin:w}})})},y=k=>{const w=k.parameters?.properties;return w!=null&&w.description!==void 0};return s.jsxs("div",{className:"space-y-4",children:[s.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:s.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[s.jsx("thead",{children:s.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:[s.jsx("th",{className:"px-3 py-2",children:p.common.name}),s.jsx("th",{className:"px-3 py-2",children:p.agent.toolPermission}),s.jsx("th",{className:"px-3 py-2",children:p.agent.toolTimeout}),s.jsx("th",{className:"px-3 py-2",children:p.agent.toolMaxOutput}),s.jsx("th",{className:"px-3 py-2",children:p.agent.toolCallDescription})]})}),s.jsx("tbody",{children:l.map((k,w)=>s.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800/60",children:[s.jsx("td",{className:"px-3 py-2 align-top font-mono text-xs",children:k.base.name}),s.jsx("td",{className:"px-3 py-2 align-top",children:s.jsx(cp,{mono:!0,size:"sm","aria-label":p.agent.toolPermission,placeholder:p.agent.defaultValue,options:r,value:k.base.permission,onChange:S=>h(w,{base:{...k.base,permission:S}})})}),s.jsx("td",{className:"px-3 py-2 align-top",children:s.jsx(tt,{size:"sm",value:k.timeoutMs,error:c[`${w}-timeoutMs`],inputMode:"numeric",className:"font-mono",onChange:S=>h(w,{timeoutMs:S.target.value})})}),s.jsx("td",{className:"px-3 py-2 align-top",children:s.jsx(tt,{size:"sm",value:k.maxOutputLength,error:c[`${w}-maxOutputLength`],inputMode:"numeric",className:"font-mono",onChange:S=>h(w,{maxOutputLength:S.target.value})})}),s.jsx("td",{className:"px-3 py-2 align-top",children:y(k.base)?s.jsx(Ep,{checked:k.base.call_description!==!1,onChange:S=>h(w,{base:{...k.base,call_description:S}}),"aria-label":`${k.base.name} ${p.agent.toolCallDescription}`}):s.jsx("span",{className:"text-xs text-gray-300 dark:text-gray-600",children:"—"})})]},k.base.name))})]})}),s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:p.agent.callDescriptionHint}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:p.agent.mcpServers}),s.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)})]}),s.jsx(we,{size:"sm",variant:"primary",onClick:g,children:p.common.save}),m]})}const C7="M22 2 11 13M22 2 15 22 11 13 2 9 22 2",T7="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",M7="M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";function E7(e,n,r,l){return e.filter(o=>{const c=n.get(o)?.get(r);return c!==void 0&&c<l})}function A7(){gr(p.nav.skills);const e=aa(),{locale:n}=Pa(),r=Ln().user?.userId??null,{currentProject:l,agents:o,setCurrentAgentId:c}=on(),d=l?.projectId??null,[f,m]=b.useState(null),[h,g]=b.useState(null),[y,k]=b.useState(new Map),[w,S]=b.useState(new Set);b.useEffect(()=>{let H=!1;return g(null),zN().then(I=>{H||m(I.groups)}).catch(I=>{H||g(_e(I))}),()=>{H=!0}},[]);const T=o.map(H=>H.agentId).join(",");b.useEffect(()=>{if(k(new Map),!d||T==="")return;let H=!1;const I=T.split(",");return Promise.all(I.map(async F=>{try{const K=await ud(d,F);return[F,new Map(K.skills.map(Z=>[Z.name,Z.version]))]}catch{return[F,new Map]}})).then(F=>{H||k(K=>{const Z=new Map(F);for(const[z,B]of K)Z.set(z,B);return Z})}),()=>{H=!0}},[d,T]);const E=(H,I,F)=>k(K=>{const Z=new Map(K),z=new Map(Z.get(H)??[]);return F!==void 0?z.set(I,F):z.delete(I),Z.set(H,z),Z}),M=(H,I)=>k(F=>new Map(F).set(H,new Map(I.map(K=>[K.name,K.version])))),L=async(H,I,F,K)=>{if(!d)return;const Z=y.get(H)?.get(I);E(H,I,F?K:void 0);const z=o.find(A=>A.agentId===H),B=z?Gt(z):H;try{if(F){const A=await r1(d,H,[I]);M(H,A.skills),_n(p.skills.installedToast(I,B))}else await Xv(d,H,I),_n(p.skills.uninstalledToast(I,B))}catch(A){if(!F&&A instanceof ka&&A.status===404)return;E(H,I,Z),ht(_e(A))}},O=async(H,I)=>{if(!d||I.length===0)return;const K=(await Promise.allSettled(I.map(async Z=>{const z=await r1(d,Z,[H]);M(Z,z.skills)}))).find(Z=>Z.status==="rejected");K?ht(_e(K.reason)):_n(p.skills.updatedToast(H,I.length))},P=H=>{if(r&&d){const I=rl(r,d);ni(I,{...ec(I),agentId:"default_agent",text:p.skills.quickInvokeText(H),skills:[H],handoffAgentId:void 0})}c("default_agent"),e(`/chat/${Ja}`,{state:{agentId:"default_agent"}})};return s.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:s.jsxs("div",{className:"mx-auto max-w-5xl",children:[s.jsx("h1",{className:"text-xl font-semibold",children:p.skills.pageTitle}),s.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:p.skills.pageDesc}),h?s.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h}),s.jsx(we,{size:"sm",onClick:()=>window.location.reload(),children:p.common.retry})]}):f===null?s.jsx("div",{className:"mt-6 grid gap-2.5 sm:grid-cols-2",children:Array.from({length:4},(H,I)=>s.jsxs(Zk,{className:"p-4",children:[s.jsx(Vt,{className:"h-4 w-32"}),s.jsx(Vt,{className:"mt-2 h-4 w-3/4"}),s.jsx(Vt,{className:"mt-3 h-6 w-36"})]},I))}):s.jsx("div",{className:"mt-6 space-y-3",children:f.map(H=>{const I=!w.has(H.id);return s.jsxs("section",{className:"overflow-hidden rounded-md bg-white dark:bg-gray-900",children:[s.jsxs("button",{type:"button","aria-expanded":I,onClick:()=>S(F=>{const K=new Set(F);return K.has(H.id)?K.delete(H.id):K.add(H.id),K}),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:[s.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:lI(n,H.title,H.titleZh)}),s.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:p.skills.skillCount(H.skills.length)}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(ra,{open:I,className:"text-gray-400"})]}),s.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${I?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:s.jsx("div",{className:"overflow-hidden",inert:!I,children:s.jsx("div",{className:`grid gap-2.5 p-2.5 transition-opacity duration-200 sm:grid-cols-2 ${I?"opacity-100":"opacity-0"}`,children:H.skills.map(F=>s.jsx(R7,{skill:F,installed:y,onQuickInvoke:P,onToggleInstall:L,onUpdateOutdated:O},F.name))})})})]},H.id)})})]})})}function R7({skill:e,installed:n,onQuickInvoke:r,onToggleInstall:l,onUpdateOutdated:o}){const{locale:c}=Pa(),{agents:d}=on(),[f,m]=b.useState(!1),[h,g]=b.useState(null),[y,k]=b.useState(!1),[w,S]=b.useState(null),T=async()=>{h&&(k(!0),await o(e.name,h),k(!1),g(null))},E=w!==null?d.find(F=>F.agentId===w):void 0,M=E?Gt(E):void 0;let L=0;for(const F of n.values())F.has(e.name)&&(L+=1);const O=E7(d.map(F=>F.agentId),n,e.name,e.version),P=oi(c,e),H=e.description,I=[`v${e.version}`,e.updated?Fk(e.updated,c):null,p.skills.usedByAgents(L)].filter(F=>F!==null).join(" · ");return s.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:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${M2(e.name)}`,children:s.jsx(Nd,{icon:e.icon,size:20})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate font-mono text-[13px] font-semibold",title:e.name,children:e.name}),s.jsx("p",{className:"mt-0.5 truncate text-xs leading-5 text-gray-500 dark:text-gray-400",title:H,children:P})]})]}),s.jsx("p",{className:"mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500",title:I,children:I})]}),s.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-1.5",children:[O.length>0&&s.jsx(we,{size:"sm",variant:"secondary",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${p.skills.updateOutdated(O.length)} ${e.name}`,title:p.skills.updateOutdated(O.length),onClick:()=>g(O),children:s.jsx(Pe,{d:M7,size:13})}),s.jsx(we,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${p.skills.quickInvoke} ${e.name}`,title:p.skills.quickInvoke,onClick:()=>r(e.name),children:s.jsx(Pe,{d:C7,size:15})}),s.jsx(we,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${p.skills.manageInstall} ${e.name}`,title:p.skills.manageInstall,onClick:()=>m(!0),children:s.jsx(Pe,{d:T7,size:15})})]}),f&&s.jsx(ln,{open:!0,title:p.skills.manageInstallTitle(e.name),onClose:()=>m(!1),children:s.jsxs("div",{className:"space-y-0.5",children:[d.length===0&&s.jsx("p",{className:"py-1.5 text-xs text-gray-400",children:p.common.loading}),d.map(F=>s.jsx(I7,{agentId:F.agentId,name:Gt(F),installed:n.get(F.agentId)?.has(e.name)??!1,outdated:O.includes(F.agentId),onToggle:K=>{K?l(F.agentId,e.name,!0,e.version):S(F.agentId)},onUpdate:()=>g([F.agentId])},F.agentId))]})}),h&&s.jsx(qn,{open:!0,title:p.skills.updateConfirmTitle(e.name),tone:"primary",confirmLabel:p.skills.updateAction,busy:y,onClose:()=>g(null),onConfirm:()=>{T()},children:s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.skills.updateConfirmWarning(e.name)}),s.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(F=>{const K=n.get(F)?.get(e.name),Z=d.find(z=>z.agentId===F);return s.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-1.5 text-xs",children:[s.jsx("span",{className:"min-w-0 truncate",children:Z?Gt(Z):F}),s.jsxs("span",{className:"shrink-0 font-mono text-gray-500 dark:text-gray-400",children:["v",K??"?"," → v",e.version]})]},F)})})]})}),w!==null&&s.jsx(qn,{open:!0,title:p.skills.uninstallConfirmTitle(e.name),confirmLabel:p.skills.uninstall,onClose:()=>S(null),onConfirm:()=>{const F=w;S(null),l(F,e.name,!1,e.version)},children:s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.skills.uninstallConfirmBody(e.name,M??w)})})]})}function I7({agentId:e,name:n,installed:r,outdated:l,onToggle:o,onUpdate:c}){return s.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:[s.jsx(na,{id:e,name:n,size:22,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",title:e,children:n}),r&&l&&s.jsx(we,{size:"sm",variant:"secondary",className:"shrink-0","aria-label":`${p.skills.updateAction} ${e}`,onClick:c,children:p.skills.updateAction}),r?s.jsxs(we,{size:"sm",variant:"ghost",className:"group shrink-0","aria-label":`${p.skills.uninstall} ${e}`,onClick:()=>o(!1),children:[s.jsx("span",{className:"group-hover:hidden",children:p.skills.installed}),s.jsx("span",{className:"hidden text-red-600 group-hover:inline dark:text-red-400",children:p.skills.uninstall})]}):s.jsx(we,{size:"sm",className:"shrink-0","aria-label":`${p.skills.install} ${e}`,onClick:()=>o(!0),children:p.skills.install})]})}function iS(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 _7(e){return{provider:e.provider,modelId:e.model_id,original:null,...iS(e),maxTokens:"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}function L7(e,n=_I()){const r=(f,m)=>`${f}\0${m}`,l=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=l.get(r(f.provider,f.model_id));if(m===void 0){o.push(_7(f)),c+=1;continue}const h=o[m],g=iS(f);Object.keys(g).some(k=>h[k]!==g[k])&&(o[m]={...h,...g},d+=1)}return{rows:o,added:c,updated:d}}function O7(e){return e<1e3?"green":e<=3e3?"yellow":"red"}function D7(e){return e>=40?"green":e>=15?"yellow":"red"}const oS={USD:"$",CNY:"¥"};function uv(e){return Number.isFinite(e)?String(Math.round(e*1e6)/1e6):"0"}function up(e){return Number.isFinite(e)?String(Math.round(e*1e4)/1e4):"0"}function yh(e,n){const r=Number(e||"0"),l=n==="CNY"?r*mp:r;return`${oS[n]}${up(l)}`}function Gl(e,n){const r=e.trim();if(!r)return"";const l=Number(r);return Number.isFinite(l)?up(n==="CNY"?l*mp:l):r}function bh(e,n){const r=e.trim();if(!r)return"";const l=Number(r);return Number.isFinite(l)?uv(n==="CNY"?l/mp:l):r}const z7="M12 5v14M5 12h14",U7="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",$7="M12 14l3.5-3.5M20.49 17A10 10 0 1 0 3.5 17",B7="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 7v5l3.5 2",H7="M13 2 3 14h9l-1 8 10-12h-9l1-8Z",dv={green:"text-green-600 dark:text-green-400",yellow:"text-amber-600 dark:text-amber-400",red:"text-red-600 dark:text-red-400"},fv=(e,n)=>`${e}\0${n}`,vh=128e3;function mv(e){return e.replace(/[^\d]/g,"")}function P7(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 $a(e){return{provider:e.provider,modelId:e.modelId}}function F7(e){const{editing:n,ref:r,action:l,defaultModel:o,visionModel:c}=e,d=n===null,f=!d&&!wt(n,r)?n:null,m=h=>wt(h,f)?r:h;return{defaultModel:l==="setDefault"||d&&!o?r:m(o),visionModel:l==="setVisionModel"?r:m(c)}}function q7(e){return e.original!==null&&rg(e.original.provider,e.original.modelId)!==void 0}function V7(e){return!e.clearApiKey&&(!!e.apiKeyInput.trim()||!!e.credential?.apiKeyMasked)}function hv(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 G7(e){const n={provider:e.provider,modelId:e.modelId};e.original&&!wt(e.original,$a(e))&&(n.renamedFrom=e.original),e.displayName?.trim()&&(n.displayName=e.displayName.trim());const r=Number(e.contextWindow.trim());e.contextWindow.trim()&&Number.isFinite(r)&&(n.contextWindow=r),e.clientType.trim()&&(n.clientType=e.clientType.trim()),e.vision||(n.vision=!1);const l=Number(e.maxTokens.trim());e.maxTokens.trim()&&Number.isFinite(l)&&l>0&&(n.maxTokens=l);const o=Number(e.cacheRead.trim()),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 W7(){gr(p.models.title);const{currentProject:e}=on(),n=e?.projectId??null,r=e?.role==="owner",l=Ln().user?.userId??null,[o,c]=b.useState(new Map),[d,f]=b.useState(null),[m,h]=b.useState(null),[g,y]=b.useState(null),[k,w]=b.useState(void 0),[S,T]=b.useState(void 0),[E,M]=b.useState(null),[L,O]=b.useState(null),[P,H]=b.useState(""),[I,F]=b.useState(new Set),[K,Z]=b.useState(null),[z,B]=b.useState(!1),[A,$]=b.useState(""),[q,U]=b.useState(null),[V,W]=b.useState(null),[ce,te]=b.useState(!1),{currency:N}=Cs(),_=b.useCallback(async()=>{if(n){y(null),W(null),c(new Map);try{const ie=await $o(n);y(ie.models.map(hv)),w(ie.defaultModel),T(ie.visionModel)}catch(ie){W(_e(ie))}}},[n]);b.useEffect(()=>{_()},[_]);const R=async(ie,ye,ve,Ke)=>{if(!n)return!1;te(!0);const He=ve&&ie.some(Ge=>wt($a(Ge),ve)&&Ge.vision)?ve:void 0;try{const Ge={models:ie.map(G7)};ye&&(Ge.defaultModel=ye),He&&(Ge.visionModel=He);const Qe=await dN(n,Ge);return y(Qe.models.map(hv)),w(Qe.defaultModel),T(Qe.visionModel),l&&Qe.defaultModel&&!wt(Qe.defaultModel,k)&&Q2(l,n),_n(Ke??p.common.saved),!0}catch(Ge){return y(ie),ye!==void 0&&w(ye),He!==void 0&&T(He),ht(_e(Ge)),!1}finally{te(!1)}},C=b.useMemo(()=>g?I2(g,P):[],[g,P]),Q=async()=>{if(!g)return;const ie=L7(g);if(ie.added===0&&ie.updated===0){Ts(p.models.syncUpToDate);return}await R(ie.rows,k,S,p.models.syncDone(ie.added,ie.updated))},ee=async ie=>{if(!n||!g)return;const ye=g.filter(ve=>ve.provider===ie);h(ie);try{for(const ve of ye){const Ke=fv(ve.provider,ve.modelId);c(He=>new Map(He).set(Ke,"pending"));try{const He=await Wv(n,{provider:ve.provider,modelId:ve.modelId,speed:!0});c(Ge=>new Map(Ge).set(Ke,He))}catch(He){c(Ge=>new Map(Ge).set(Ke,{ok:!1,message:_e(He)}))}}}finally{h(null)}},ae=()=>{const ie=A.trim();if(!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(ie)){U(p.models.groupNameInvalid);return}if(Ns.some(ye=>ye.id===ie)||g?.some(ye=>ye.provider===ie)){U(p.models.groupNameExists);return}B(!1),$(""),O(ie)},he=E!==null?g?.find(ie=>wt($a(ie),E)):void 0;if(!n)return null;const xe=ie=>F(ye=>{const ve=new Set(ye);return ve.has(ie)?ve.delete(ie):ve.add(ie),ve});return s.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[s.jsxs("div",{className:"mx-auto max-w-5xl",children:[s.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold",children:p.models.title}),!r&&s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:p.models.readOnlyHint})]}),s.jsxs("div",{className:"flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0",children:[s.jsx("div",{className:"min-w-0 flex-1 sm:w-56 sm:flex-none",children:s.jsx(tt,{size:"sm",value:P,onChange:ie=>H(ie.target.value),placeholder:p.models.searchPlaceholder})}),r&&s.jsx(we,{size:"sm",onClick:()=>{Q()},disabled:ce||g===null,title:p.models.syncCatalogHint,children:p.models.syncCatalog})]})]}),g===null?s.jsx(ba,{rows:4}):g.length===0?s.jsx(hr,{title:p.models.empty,action:r&&s.jsx(we,{onClick:()=>O("custom"),children:p.models.addCustom})}):C.length===0?s.jsx(hr,{title:p.models.noSearchResults}):s.jsxs("div",{className:"space-y-3",children:[C.map(ie=>{const ye=!I.has(ie.provider.id);return s.jsxs("section",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[s.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:[s.jsxs("button",{type:"button","aria-expanded":ye,onClick:()=>xe(ie.provider.id),className:"flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left",children:[s.jsx(ti,{provider:ie.provider.id,className:"h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"}),s.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:ie.provider.label}),s.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:p.models.modelCount(ie.rows.length)})]}),r&&s.jsx("span",{className:"shrink-0",children:s.jsxs(we,{size:"sm",variant:"ghost",disabled:ce,onClick:()=>O(ie.provider.id),children:[s.jsx(Pe,{d:z7,size:13}),p.models.addToGroup]})}),r&&ie.provider.id!=="custom"&&s.jsx("span",{className:"hidden shrink-0 sm:block",children:s.jsxs(we,{size:"sm",variant:"ghost",disabled:ce,onClick:()=>Z(ie.provider.id),children:[s.jsx(Pe,{d:U7,size:13}),p.models.groupApiKey]})}),r&&s.jsxs(we,{size:"sm",variant:"ghost",className:"shrink-0",disabled:ce||m!==null,"aria-label":`${p.models.speedTest} ${ie.provider.label}`,title:m===ie.provider.id?p.models.speedPending:p.models.speedTest,onClick:()=>f(ie.provider.id),children:[s.jsx(Pe,{d:$7,size:13}),s.jsx("span",{className:"hidden sm:inline",children:m===ie.provider.id?p.models.speedPending:p.models.speedTest})]}),ie.provider.apiKeyUrl&&s.jsxs("a",{href:ie.provider.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"hidden shrink-0 whitespace-nowrap text-xs text-brand-600 underline-offset-2 hover:underline sm:inline dark:text-brand-300",children:[p.models.getApiKey," ↗"]}),s.jsx("button",{type:"button","aria-expanded":ye,"aria-label":ie.provider.label,onClick:()=>xe(ie.provider.id),className:"shrink-0 p-1.5",children:s.jsx(ra,{open:ye,className:"text-gray-400"})})]}),s.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${ye?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:s.jsx("div",{className:"overflow-hidden",inert:!ye,children:s.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 ${ye?"opacity-100":"opacity-0"}`,children:ie.rows.length===0?s.jsx("p",{className:"col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500",children:p.models.groupEmptyHint}):ie.rows.map(ve=>s.jsx(K7,{row:ve,currency:N,isDefault:wt($a(ve),k),isVisionModel:wt($a(ve),S),speed:o.get(fv(ve.provider,ve.modelId)),onOpen:()=>M($a(ve))},`${ve.provider}:${ve.modelId}`))})})})]},ie.provider.id)}),r&&P.trim()===""&&s.jsxs("button",{type:"button",onClick:()=>{$(""),U(null),B(!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:["+ ",p.models.addGroup]})]}),V&&s.jsx("p",{className:"mt-3 text-xs text-red-600 dark:text-red-400",children:V})]}),g&&K&&s.jsx(Z7,{provider:Ns.find(ie=>ie.id===K)??A2(K),count:g.filter(ie=>ie.provider===K).length,onClose:()=>Z(null),onSubmit:ie=>{const ye=K;Z(null);const ve=g.filter(He=>He.provider===ye);if(ve.length===0)return;const Ke=g.map(He=>He.provider===ye?{...He,apiKeyInput:ie,clearApiKey:!1}:He);R(Ke,k,S,p.models.groupKeyApplied(ve.length))}}),d!==null&&s.jsxs(ln,{open:!0,title:p.models.speedTestTitle,onClose:()=>f(null),children:[s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:p.models.speedTestConfirm(g?.filter(ie=>ie.provider===d).length??0)}),s.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[s.jsx(we,{onClick:()=>f(null),children:p.common.cancel}),s.jsx(we,{variant:"primary",onClick:()=>{const ie=d;f(null),ie&&ee(ie)},children:p.models.speedTestStart})]})]}),z&&s.jsxs(ln,{open:!0,title:p.models.addGroupTitle,onClose:()=>B(!1),widthClass:"sm:max-w-sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:()=>B(!1),children:p.common.cancel}),s.jsx(we,{variant:"primary",onClick:ae,children:p.common.confirm})]}),children:[s.jsxs("label",{className:"block",children:[s.jsx(tt,{size:"sm",label:p.models.groupNameLabel,required:!0,value:A,invalid:!!q,onChange:ie=>{$(ie.target.value),U(null)},onKeyDown:ie=>{ie.key==="Enter"&&ae()},placeholder:p.models.groupNameHint,className:"font-mono",autoFocus:!0}),q&&s.jsx(ks,{children:q})]}),s.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:p.models.addGroupDesc})]}),g&&(L!==null||he)&&s.jsx(X7,{projectId:n,row:L!==null?null:he??null,addProvider:L??"custom",existingRefs:g.map($a),currency:N,canEdit:r,isDefault:he!==void 0&&wt($a(he),k),isVisionModel:he!==void 0&&wt($a(he),S),onClose:()=>{M(null),O(null)},onSubmit:(ie,ye)=>{const ve=L!==null;if(M(null),O(null),ye==="remove"){const Ge=ie.original;R(g.filter(Qe=>!wt($a(Qe),Ge)),wt(Ge,k)?void 0:k,wt(Ge,S)?void 0:S);return}const Ke=ve?[...g,ie]:g.map(Ge=>wt($a(Ge),E)?ie:Ge),He=F7({editing:ve?null:E,ref:$a(ie),action:ye,defaultModel:k,visionModel:S});R(Ke,He.defaultModel,He.visionModel)}})]})}function K7({row:e,currency:n,isDefault:r,isVisionModel:l,speed:o,onOpen:c}){const d=e.cacheRead||e.cacheWrite||e.output,f=[e.contextWindow?yt(Number(e.contextWindow)):null,d?`${yh(e.cacheRead,n)} / ${yh(e.cacheWrite,n)} / ${yh(e.output,n)}`:null,e.credential?.apiKeyMasked&&!e.clearApiKey?e.credential.apiKeyMasked:V7(e)?p.models.keyConfigured:p.models.noKey].filter(h=>h!==null),m=o==="pending"?s.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:p.models.speedPending}):o?o.ok?s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] font-medium",children:[o.ttftMs!==void 0&&s.jsxs("span",{className:`flex items-center gap-0.5 ${dv[O7(o.ttftMs)]}`,title:p.models.ttftTitle,children:[s.jsx(Pe,{d:B7,size:11}),Math.round(o.ttftMs),"ms"]}),o.tps!==void 0&&s.jsxs("span",{className:`flex items-center gap-0.5 ${dv[D7(o.tps)]}`,title:p.models.tpsTitle,children:[s.jsx(Pe,{d:H7,size:11}),o.tps," tok/s"]})]}):s.jsx("span",{className:"shrink-0 text-[11px] font-medium text-red-600 dark:text-red-400",title:o.message,children:p.models.speedFailed}):null;return s.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:[s.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-sm font-medium",children:e.displayName??e.modelId}),r&&s.jsx(sn,{tone:"brand",children:p.models.default}),_2(e)&&s.jsx(sn,{tone:"yellow",children:p.models.freeBadge}),e.vision&&s.jsx(sn,{tone:"green",children:p.models.visionBadge}),l&&s.jsx(sn,{tone:"amber",children:p.models.visionModelBadge})]}),e.displayName!==void 0&&s.jsx("span",{className:"truncate font-mono text-[11px] text-gray-500 dark:text-gray-400",children:e.modelId}),s.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-gray-400 dark:text-gray-500",children:f.join(" · ")}),m]})]})}const Y7={save:()=>p.models.confirmSaveTitle,setDefault:()=>p.models.confirmDefaultTitle,setVisionModel:()=>p.models.confirmVisionModelTitle,remove:()=>p.models.confirmDeleteTitle},Q7={save:e=>p.models.confirmSave(e),setDefault:e=>p.models.confirmDefault(e),setVisionModel:e=>p.models.confirmVisionModel(e),remove:e=>p.models.confirmDelete(e)};function X7({projectId:e,row:n,addProvider:r,existingRefs:l,currency:o,canEdit:c,isDefault:d,isVisionModel:f,onClose:m,onSubmit:h}){const[g,y]=b.useState(()=>{if(n)return{...n,cacheRead:Gl(n.cacheRead,o),cacheWrite:Gl(n.cacheWrite,o),output:Gl(n.output,o)};const W=Hr(r),ce=W!==void 0&&W.id!=="custom"&&W.gatewayBaseUrl===void 0;return{provider:r,modelId:"",original:null,vision:!0,contextWindow:"",maxTokens:"",clientType:ce?"":"openai",cacheRead:"",cacheWrite:"",output:"",baseUrl:W?.gatewayBaseUrl??"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}),[k,w]=b.useState({}),[S,T]=b.useState(!1),[E,M]=b.useState(null),L=n===null,O=n!==null&&q7(n),P=W=>{y(ce=>({...ce,...W})),w(ce=>{const te={...ce};for(const N of Object.keys(W))delete te[N];return te})},H=async()=>{T(!0);try{const W=g.apiKeyInput.trim(),ce=g.baseUrl.trim(),te={provider:g.provider,modelId:g.modelId.trim(),baseUrl:ce||null};W?te.apiKey=W:g.clearApiKey&&(te.clearApiKey=!0),g.clientType.trim()&&(te.clientType=g.clientType.trim());const N=await Wv(e,te);N.ok?_n(p.models.testOk(N.latencyMs??0)):ht(p.models.testFailed(N.message??""))}catch(W){ht(p.models.testFailed(_e(W)))}finally{T(!1)}},I=g.clientType.trim().toLowerCase().includes("openai")||g.provider==="custom"||Hr(g.provider)===void 0,F=!O&&I,K=()=>{const W=g.modelId.trim(),ce={provider:g.provider,modelId:W},te=g.baseUrl.trim(),N={};W?!wt(ce,g.original)&&l.some(ee=>wt(ee,ce))&&(N.modelId=p.models.modelIdExists):N.modelId=p.common.requiredField,F&&!te&&(N.baseUrl=p.models.baseUrlRequired);const _=[["cacheRead",g.cacheRead.trim()],["cacheWrite",g.cacheWrite.trim()],["output",g.output.trim()]],R=_.filter(([,ee])=>ee!=="").length;for(const[ee,ae]of _)ae===""&&R>0?N[ee]=p.models.pricingAllOrNone:ae!==""&&!Number.isFinite(Number(ae))&&(N[ee]=p.models.pricingInvalid);const C=g.contextWindow.trim();C&&!Number.isFinite(Number(C))&&(N.contextWindow=p.models.contextWindowInvalid);const Q=g.maxTokens.trim();return Q&&!(Number.isInteger(Number(Q))&&Number(Q)>0)&&(N.maxTokens=p.models.maxTokensInvalid),Object.keys(N).length>0?(w(N),null):(w({}),{...g,modelId:W,contextWindow:!O&&!C?String(vh):g.contextWindow,cacheRead:bh(g.cacheRead,o),cacheWrite:bh(g.cacheWrite,o),output:bh(g.output,o)})},Z=W=>{const ce=K();ce&&h(ce,W)},z=Hr(g.provider),B=II(g.modelId.trim(),g.clientType.trim()||void 0)?.envKey,A=z!==void 0&&z.id!=="custom"&&z.gatewayBaseUrl===void 0,$=L&&A&&!g.clientType.trim()&&g.modelId.trim()!==""&&B===void 0,q=s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"block",children:[s.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[s.jsxs("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:[p.models.modelId,s.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]}),s.jsx("span",{className:"flex shrink-0 items-baseline gap-2.5",children:z?.modelsUrl&&s.jsxs("a",{href:z.modelsUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[p.models.getModelIds," ↗"]})})]}),s.jsx(tt,{size:"sm",required:!0,value:g.modelId,disabled:!c,invalid:!!k.modelId,onChange:W=>P({modelId:W.target.value}),className:"font-mono",autoFocus:L,placeholder:p.models.modelIdHint}),k.modelId&&s.jsx(ks,{children:k.modelId}),$&&s.jsx("span",{className:"mt-1 block text-xs text-amber-600 dark:text-amber-400",children:p.models.autoRouteNone})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(tt,{size:"sm",label:p.models.displayName,value:g.displayName??"",disabled:!c,onChange:W=>P({displayName:W.target.value}),placeholder:p.models.displayNameHint}),s.jsxs(Pr,{size:"sm",label:p.models.providerGroup,value:g.provider,disabled:!c,onChange:W=>P({provider:W.target.value}),children:[Ns.map(W=>s.jsx("option",{value:W.id,children:W.label},W.id)),[...new Set(l.map(W=>W.provider).concat(g.provider))].filter(W=>!Ns.some(ce=>ce.id===W)).sort().map(W=>s.jsx("option",{value:W,children:W},W))]})]})]}),U=g.credential?.apiKeyMasked?p.models.apiKeyKeepHint:B?p.models.apiKeyEnvHint(B):p.models.apiKeyKeepHint,V=!g.credential?.apiKeyMasked&&B&&B===z?.envKey?p.models.providerEnvNotes[g.provider]:void 0;return s.jsxs(ln,{open:!0,title:L?A?p.models.addTitleVendor:p.models.addTitle:p.models.editTitle,onClose:m,widthClass:"sm:max-w-lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:m,children:p.common.cancel}),c&&s.jsx(we,{variant:"primary",onClick:()=>{if(!K())return;if(L||n===null){Z("save");return}const W={...n,cacheRead:Gl(n.cacheRead,o),cacheWrite:Gl(n.cacheWrite,o),output:Gl(n.output,o)};if(JSON.stringify(g)===JSON.stringify(W)){Ts(p.common.noChangesToSave);return}M("save")},children:p.common.confirm})]}),children:[s.jsxs("div",{className:"space-y-3",children:[!L&&s.jsxs("div",{className:"flex items-center gap-2.5 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60",children:[s.jsx(ti,{provider:g.provider,className:"h-6 w-6 shrink-0 text-gray-700 dark:text-gray-300"}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 text-sm font-medium",children:[g.displayName??g.modelId,d&&s.jsx(sn,{tone:"brand",children:p.models.default}),g.vision&&s.jsx(sn,{tone:"green",children:p.models.visionBadge}),f&&s.jsx(sn,{tone:"amber",children:p.models.visionModelBadge})]}),g.displayName!==void 0&&s.jsx("span",{className:"truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:g.modelId})]}),n&&Sb(n.provider,n.modelId)&&s.jsxs("a",{href:Sb(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:[p.models.homepage,s.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:s.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"})})]})]}),L&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:A?p.models.addAutoRouteHint:p.models.addProtocolHint}),q]}),c&&s.jsx("div",{className:"space-y-1.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(we,{size:"sm",disabled:S||!g.modelId.trim(),onClick:()=>{H()},children:S?p.models.testing:p.models.testConnection}),!L&&!d&&s.jsx(we,{size:"sm",onClick:()=>M("setDefault"),children:p.models.setDefault}),!L&&g.vision&&!f&&s.jsx(we,{size:"sm",title:p.models.visionModelHint,onClick:()=>M("setVisionModel"),children:p.models.setVisionModel}),!L&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx(we,{size:"sm",variant:"danger",onClick:()=>M("remove"),children:p.models.remove})]})]})}),s.jsxs("div",{className:"block",children:[s.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[s.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:p.models.apiKey}),z?.apiKeyUrl&&s.jsxs("a",{href:z.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[p.models.getApiKey," ↗"]})]}),s.jsx(Ss,{size:"sm",value:g.apiKeyInput,disabled:!c,onChange:W=>P({apiKeyInput:W.target.value,clearApiKey:!1}),className:"font-mono",autoComplete:"off",autoFocus:!L,placeholder:U})]}),V&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:V}),g.credential?.apiKeyMasked&&!g.apiKeyInput&&s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[s.jsx("span",{className:"font-mono",children:g.credential.apiKeyMasked}),g.credential.createdAt&&s.jsxs("span",{className:"text-gray-400",children:[p.common.created," ",wa(g.credential.createdAt)]}),c&&s.jsxs("label",{className:"flex items-center gap-1.5",children:[s.jsx("input",{type:"checkbox",checked:g.clearApiKey,onChange:W=>P({clearApiKey:W.target.checked})}),p.models.clearApiKey]})]}),s.jsx(tt,{size:"sm",label:p.models.baseUrl,required:F,value:g.baseUrl,disabled:!c,onChange:W=>P({baseUrl:W.target.value}),className:"font-mono",placeholder:O?p.models.baseUrlHint:"https://…",...k.baseUrl?{error:k.baseUrl}:{},...I?{}:{hint:p.models.baseUrlOfficialNote}}),s.jsxs("div",{className:"grid grid-cols-2 items-start gap-2",children:[s.jsxs("label",{className:"block",children:[s.jsx(ws,{children:p.models.contextWindow}),s.jsxs("span",{className:"relative block",children:[s.jsx(tt,{size:"sm",value:g.contextWindow,inputMode:"numeric",disabled:!c,invalid:!!k.contextWindow,onChange:W=>P({contextWindow:mv(W.target.value)}),className:"pr-12 font-mono",title:O?p.models.contextWindowHint:p.models.contextWindowDefaultHint(vh),placeholder:O?p.models.contextWindowHint:p.models.contextWindowDefaultHint(vh)}),s.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:p.models.tokenUnit})]}),k.contextWindow&&s.jsx(ks,{children:k.contextWindow})]}),s.jsxs("label",{className:"block",children:[s.jsx(ws,{children:p.models.maxTokens}),s.jsxs("span",{className:"relative block",children:[s.jsx(tt,{size:"sm",value:g.maxTokens,inputMode:"numeric",disabled:!c,invalid:!!k.maxTokens,onChange:W=>P({maxTokens:mv(W.target.value)}),className:"pr-12 font-mono",title:p.models.maxTokensTitle,placeholder:p.models.maxTokensHint}),s.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:p.models.tokenUnit})]}),k.maxTokens&&s.jsx(ks,{children:k.maxTokens})]})]}),s.jsx("div",{className:"grid grid-cols-3 items-start gap-2",children:[["cacheRead",p.models.priceCacheRead,g.cacheRead],["cacheWrite",p.models.priceCacheWrite,g.cacheWrite],["output",p.models.priceOutput,g.output]].map(([W,ce,te])=>s.jsxs("label",{className:"block",children:[s.jsx(ws,{children:ce}),s.jsxs("span",{className:"relative block",children:[s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-2 flex items-center text-xs text-gray-400",children:oS[o]}),s.jsx(tt,{size:"sm",value:te,inputMode:"decimal",disabled:!c,invalid:!!k[W],onChange:N=>P({[W]:P7(N.target.value)}),className:"pl-4 pr-11 text-right font-mono"}),s.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:p.models.priceUnitShort})]}),k[W]&&s.jsx(ks,{children:k[W]})]},W))}),!L&&q,!L&&!O&&g.clientType&&g.clientType!=="openai"&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:p.models.clientTypeLocked(g.clientType)}),!O&&s.jsxs("div",{children:[s.jsxs("label",{className:`inline-flex items-center gap-2 ${c?"cursor-pointer":"cursor-not-allowed"}`,children:[s.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:p.models.vision}),s.jsx(Ep,{checked:g.vision,disabled:!c,onChange:W=>P({vision:W}),"aria-label":p.models.vision})]}),!g.vision&&s.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:p.models.visionOffProxyHint})]})]}),E&&s.jsx(qn,{open:!0,title:Y7[E](),tone:E==="remove"?"danger":"primary",onClose:()=>M(null),onConfirm:()=>{const W=E;M(null),Z(W)},children:s.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:Q7[E](g.displayName??g.modelId)})})]})}function Z7({provider:e,count:n,onClose:r,onSubmit:l}){const[o,c]=b.useState("");return s.jsx(ln,{open:!0,title:p.models.groupApiKeyTitle(e.label),onClose:r,footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:r,children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:!o.trim(),onClick:()=>l(o.trim()),children:p.common.confirm})]}),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(tt,{size:"sm",label:p.models.apiKey,required:!0,type:"password",value:o,onChange:d=>c(d.target.value),className:"font-mono",autoComplete:"off",autoFocus:!0,placeholder:p.models.apiKeyEnvHint(e.envKey)}),s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:p.models.groupApiKeyHint(n)}),p.models.providerEnvNotes[e.id]&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:p.models.providerEnvNotes[e.id]}),e.apiKeyUrl&&s.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:[p.models.getApiKey," ↗"]})]})})}const vo=200,il=46,od=8,Co=10,J7=22;function cS(e,n,r){return uS(e,0,n,r)}function uS(e,n,r,l){const o=Math.max(0,l-il-od),c=vo-Co-J7,d=e>0?o/e:o,f=r-n;return{n:e,min:n,max:r,w:l,innerW:o,innerH:c,step:d,x:m=>il+d*m+d/2,y:m=>Co+c*(1-(f>0?(m-n)/f:0))}}function eO(e,n){return n.map((r,l)=>`${l===0?"M":"L"}${e.x(l)},${e.y(r)}`).join(" ")}function tO(e,n){const r=n.length;if(r===0)return"";const l=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)},${l}`),o.push(`L${e.x(0)},${l}`),o.push("Z"),o.join(" ")}function nO(e){return e<=0?[]:e===1?[0]:e===2?[0,1]:[0,Math.floor((e-1)/2),e-1]}const aO=40;function rO(e,n){if(e<=0)return[];const r=n>0?Math.max(1,Math.ceil(aO/n)):e,l=[];for(let o=0;o<e;o+=r)l.push(o);return l}function sO(e,n){return n>0?e/n:1}const Au=12;function lO(e,n,r,l,o){let c=e+Au;c+r>o.right&&(c=e-Au-r);let d=n+Au;return d+l>o.bottom&&(d=n-Au-l),{left:Math.max(o.left,Math.min(c,o.right-r)),top:Math.max(0,Math.min(d,o.bottom-l))}}const kh=25,iO=8;function oO(e,n){const r=Math.max(0,e-il-od),l=2*kh*n;return l<=r?{barW:kh,chartW:e,scroll:!1}:{barW:kh,chartW:il+l+od,scroll:!0}}function cO(e,n,r){const l=e.length;if(l===0)return[];if(n<=l*r)return e.map(()=>n/l);const o=new Set;for(;;){const c=n-o.size*r,d=e.reduce((h,g,y)=>o.has(y)?h:h+g,0),f=h=>d>0?e[h]/d*c:c/(l-o.size),m=e.findIndex((h,g)=>!o.has(g)&&f(g)<r);if(m<0)return e.map((h,g)=>o.has(g)?r:f(g));o.add(m)}}const uO=["output","cacheWrite","cacheRead"];function dO(e,n){const r=uO.map(m=>({key:m,value:n[m]})).filter(m=>m.value>0);if(r.length===0)return[];const l=[];let o=0;for(const m of r){const h=e.y(o);o+=m.value;const g=e.y(o);l.push({y:g,h:h-g})}const c=e.y(0),d=cO(l.map(m=>m.h),c-e.y(o),iO);let f=c;return r.map((m,h)=>{const g=d[h],y={key:m.key,value:m.value,y:l[h].y,h:l[h].h,hitY:f-g,hitH:g};return f-=g,y})}const dS=Math.PI*2,cd=e=>Math.round(e*100)/100;function Ru(e,n,r,l){const o=l-Math.PI/2;return[cd(e+r*Math.cos(o)),cd(n+r*Math.sin(o))]}function fO(e,n,r,l,o){if(o-l>=dS-1e-9){const[g,y]=Ru(e,n,r,0),[k,w]=Ru(e,n,r,Math.PI);return`M${g},${y} A${r},${r} 0 1 1 ${k},${w} A${r},${r} 0 1 1 ${g},${y} Z`}const[c,d]=Ru(e,n,r,l),[f,m]=Ru(e,n,r,o),h=o-l>Math.PI?1:0;return`M${cd(e)},${cd(n)} L${c},${d} A${r},${r} 0 ${h} 1 ${f},${m} Z`}function mO(e,n,r,l){const o=e.reduce((f,m)=>f+Math.max(0,m),0);if(o<=0)return[];const c=[];let d=0;return e.forEach((f,m)=>{if(f<=0)return;const h=f/o,g=d+h*dS;c.push({index:m,value:f,frac:h,start:d,end:g,path:fO(n,r,l,d,g)}),d=g}),c}function ig(){const e=b.useRef(null),[n,r]=b.useState(0);return b.useLayoutEffect(()=>{const l=e.current;if(!l)return;const o=()=>r(Math.floor(l.getBoundingClientRect().width));o();const c=new ResizeObserver(o);return c.observe(l),()=>c.disconnect()},[]),[e,n]}function og({geom:e,fmtY:n,dates:r,hover:l,onHover:o,bubble:c,hitLayer:d,labels:f,yTicks:m,hoverLine:h=!0,scrollToEnd:g=!1,children:y}){const{x:k,y:w,w:S,innerH:T,step:E,min:M,max:L}=e,O=m??[0,.25,.5,.75,1].map(A=>M+(L-M)*A),P=f??nO(r.length),H=b.useRef(null);b.useLayoutEffect(()=>{const A=H.current;!g||!A||(A.scrollLeft=A.scrollWidth-A.clientWidth)},[g,S,r.length]);const I=b.useRef(null),F=b.useRef(null),K=b.useRef(null),Z=b.useRef(0),z=()=>{const A=F.current,$=I.current,q=H.current,U=K.current;if(!A||!$||!q||!U)return;const V=$.getBoundingClientRect(),W=lO(U.cx-V.left,U.cy-V.top,A.offsetWidth,A.offsetHeight,{left:q.scrollLeft,right:q.scrollLeft+q.clientWidth,bottom:vo});A.style.left=`${W.left}px`,A.style.top=`${W.top}px`,A.style.visibility="visible"},B=()=>{Z.current||(Z.current=requestAnimationFrame(()=>{Z.current=0,z()}))};return b.useEffect(()=>()=>cancelAnimationFrame(Z.current),[]),b.useLayoutEffect(z,[c,l]),s.jsxs("div",{ref:H,className:"relative overflow-x-auto",children:[s.jsxs("svg",{ref:I,viewBox:`0 0 ${S} ${vo}`,width:S,height:vo,className:"text-gray-600 dark:text-gray-400",role:"img",onMouseLeave:()=>{o(null),K.current=null},onMouseMove:A=>{K.current={cx:A.clientX,cy:A.clientY},B()},children:[O.map((A,$)=>s.jsxs("g",{children:[s.jsx("line",{x1:il,x2:S-od,y1:w(A),y2:w(A),className:"stroke-gray-200 dark:stroke-gray-800",strokeWidth:1}),s.jsx("text",{x:il-6,y:w(A)+3,textAnchor:"end",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:n(A)})]},$)),h&&l!==null&&r[l]&&s.jsx("line",{x1:k(l),x2:k(l),y1:Co,y2:Co+T,className:"stroke-gray-300 dark:stroke-gray-700",strokeWidth:1}),y,P.map(A=>{const $=r[A];return $?s.jsx("text",{x:k(A),y:vo-6,textAnchor:"middle",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:$.slice(5)},A):null}),d??r.map((A,$)=>s.jsx("rect",{x:il+E*$,y:Co,width:E,height:T,fill:"transparent",className:"cursor-crosshair",onMouseEnter:()=>o($)},`hit-${$}`))]}),c&&l!==null&&r[l]&&s.jsx("div",{ref:F,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(l)})]})}function hO({points:e,currency:n="USD"}){const[r,l]=b.useState(null),[o,c]=ig(),d=e.map(g=>g.cost??0),f=Math.max(1e-9,...d),m=cS(e.length,f,c),h=e.map(g=>g.date);return s.jsx("div",{ref:o,children:c>0&&s.jsx(og,{geom:m,fmtY:g=>er(g,n),dates:h,hover:r,onHover:l,bubble:g=>{const y=e[g];return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-gray-400",children:y.date}),s.jsx("p",{className:"font-mono",children:er(y.cost,n)})]})},children:s.jsxs("g",{children:[s.jsx("path",{d:tO(m,d),className:"fill-current",stroke:"none",opacity:r!==null?.06:.1}),s.jsx("path",{d:eO(m,d),fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),e.map((g,y)=>s.jsx("circle",{cx:m.x(y),cy:m.y(g.cost??0),r:r===y?4:2.5,className:"fill-current",opacity:r!==null&&r!==y?.25:1},g.date))]})})})}const To={cacheRead:"#7dd3fc",cacheWrite:"#0ea5e9",output:"#0369a1"},pv=[{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 gv(e){return pv[e%pv.length]}const xv=[{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 fS(e){return xv[e%xv.length]}function Md({text:e}){return s.jsx("p",{className:"py-6 text-center text-xs text-gray-400",children:e??p.usage.empty})}function pO(e){return e==="cacheRead"?p.usage.colCacheRead:e==="cacheWrite"?p.usage.colCacheWrite:p.usage.colOutput}const mS="opacity-25",Iu=160,gO=75;function xO({data:e}){const[n,r]=b.useState(null),l=e.reduce((m,h)=>m+h.requests,0);if(e.length===0||l<=0)return s.jsx(Md,{});const o=[...e].sort((m,h)=>h.requests-m.requests),c=mO(o.map(m=>m.requests),Iu/2,Iu/2,gO),d=m=>`${Math.round(m/l*100)}%`,f=m=>n!==null&&n!==m?mS:"";return s.jsxs("div",{className:"flex items-center gap-3",onMouseLeave:()=>r(null),children:[s.jsx("svg",{viewBox:`0 0 ${Iu} ${Iu}`,className:"h-40 w-40 shrink-0",role:"img","aria-label":p.usage.chartAgentCalls,children:c.map(m=>{const h=o[m.index];return s.jsx("path",{d:m.path,onMouseEnter:()=>r(m.index),className:`cursor-pointer ${gv(m.index).fill} transition-opacity duration-150 ${f(m.index)}`,children:s.jsx("title",{children:`${h.agentId} · ${h.requests} ${p.usage.requests} · ${d(h.requests)}`})},h.agentId)})}),s.jsx("ul",{className:"flex max-h-40 min-w-0 flex-1 flex-col gap-1 overflow-y-auto",children:o.map((m,h)=>s.jsxs("li",{onMouseEnter:()=>r(m.requests>0?h:null),title:`${m.agentId} · ${m.requests} ${p.usage.requests} · ${yt(m.total)}`,className:`flex cursor-pointer items-center gap-1.5 text-[10px] transition-opacity duration-150 ${f(h)}`,children:[s.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${gv(h).swatch}`}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-gray-500 dark:text-gray-400",children:m.agentId}),s.jsx("span",{className:"shrink-0 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:m.requests}),s.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 yO({dimmed:e,onEnter:n,title:r,label:l,value:o,children:c}){return s.jsxs("div",{onMouseEnter:n,className:`flex cursor-pointer items-center gap-2 transition-opacity duration-150 ${e?mS:""}`,title:r,children:[s.jsx("span",{className:"w-24 shrink-0 truncate font-mono text-[10px] text-gray-500 dark:text-gray-400",children:l}),c,s.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 bO(e){return rg(e.provider,e.modelId)?.displayName??e.modelId}function vO(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(`${p.usage.successAborted} ${e.aborted}`);const r=Hr(e.provider)?.label??e.provider;return`${e.modelId} · ${r} · ${n.join(" · ")}`}function kO({data:e}){const[n,r]=b.useState(null);return e.length===0?s.jsx(Md,{}):s.jsx("div",{className:"flex flex-col gap-1.5",onMouseLeave:()=>r(null),children:e.map((l,o)=>{const c=sO(l.completed,l.total),d=Math.round(c*100);return s.jsx(yO,{dimmed:n!==null&&n!==o,onEnter:()=>r(o),title:vO(l),label:bO(l),value:`${d}%`,children:s.jsx("div",{className:"h-3 min-w-0 flex-1 overflow-hidden rounded-sm bg-gray-200 dark:bg-gray-800",children:s.jsx("div",{className:"h-full rounded-sm bg-sky-500 dark:bg-sky-400",style:{width:`${c*100}%`}})})},`${l.provider}:${l.modelId}`)})})}function wO({trend:e,legend:n}){const[r,l]=b.useState(null),[o,c]=ig();if(e.length===0)return s.jsx(Md,{});const d=e.map(T=>T.cacheRead+T.cacheWrite+T.output),f=Math.max(1,...d),{barW:m,chartW:h,scroll:g}=oO(c,e.length),y=cS(e.length,f,h),k=e.map(T=>T.date),w=e.map(T=>dO(y,T)),S=(T,E)=>r!==null&&!(r.i===T&&r.key===E)||n!=null&&n!==E;return s.jsx("div",{ref:o,children:c>0&&s.jsx(og,{geom:y,fmtY:T=>yt(Math.round(T)),dates:k,hover:r?.i??null,labels:rO(e.length,y.step),hoverLine:!1,scrollToEnd:g,onHover:T=>{T===null&&l(null)},bubble:T=>{const E=e[T],M=r?.key;if(!M)return null;const L=M==="cacheRead"?Bk(E.cacheRead,E.cacheWrite):null;return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-gray-400",children:E.date}),s.jsxs("p",{className:"font-mono",children:[pO(M)," ",yt(E[M])]}),L!==null&&s.jsxs("p",{className:"font-mono",children:[p.traces.hitRate," ",Mp(L)]})]})},hitLayer:e.map((T,E)=>w[E].map(M=>s.jsx("rect",{x:y.x(E)-m/2,y:M.hitY,width:m,height:M.hitH,fill:"transparent",className:"cursor-pointer",onMouseEnter:()=>l({i:E,key:M.key}),onMouseLeave:()=>l(null)},`hit-${T.date}-${M.key}`))),children:e.map((T,E)=>w[E].map(M=>s.jsx("rect",{x:y.x(E)-m/2,y:M.y,width:m,height:M.h,fill:To[M.key],className:"transition-opacity duration-150",opacity:S(E,M.key)?.2:1},`${T.date}-${M.key}`)))})})}function SO({active:e,onHover:n}){const r=[["cacheRead",p.usage.colCacheRead],["cacheWrite",p.usage.colCacheWrite],["output",p.usage.colOutput]];return s.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:r.map(([l,o])=>s.jsxs("button",{type:"button",onMouseEnter:()=>n?.(l),onMouseLeave:()=>n?.(null),className:`flex items-center gap-1 text-[10px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${e!=null&&e!==l?"opacity-30":""}`,children:[s.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{backgroundColor:To[l]}}),o]},l))})}function jO(e){return e==="unexpected"?p.usage.errorsUnexpected:p.usage.errorsExpected}function NO(e){return e==="unexpected"?"unexpected":"expected"}const CO={environment:"env"};function yv(e,n){return`[${CO[e]??e}] ${n}`}function _u({label:e,value:n,alert:r,muted:l}){const o=r?"text-rose-600 dark:text-rose-400":l?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e}),s.jsx("span",{className:`font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function Lu({children:e,className:n=""}){return s.jsx("th",{className:`py-1.5 pr-2 font-medium ${n}`,children:e})}function TO({errors:e,projectId:n,filters:r}){const{total:l,unexpected:o,topCode:c,recent:d}=e,f=Math.max(1,d.length),[m,h]=b.useState(0),[g,y]=b.useState(d),[k,w]=b.useState(l),[S,T]=b.useState(null),[E,M]=b.useState(!1);b.useEffect(()=>h(0),[d]),b.useEffect(()=>{if(m===0){y(d),w(l),T(null);return}let I=!1;return M(!0),T(null),EN(n,{offset:m*f,limit:f,...r}).then(F=>{I||(y(F.items),w(F.total))}).catch(F=>{I||T(_e(F))}).finally(()=>{I||M(!1)}),()=>{I=!0}},[m,f,n,r,d,l]);const L=Math.max(1,Math.ceil(k/f)),[O,P]=b.useState(new Set);b.useEffect(()=>P(new Set),[g]);const H=I=>P(F=>{const K=new Set(F);return K.has(I)?K.delete(I):K.add(I),K});return s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-6 gap-y-1.5",children:[s.jsx(_u,{label:p.usage.errorsTotal,value:String(l)}),s.jsx(_u,{label:p.usage.errorsUnexpected,value:String(o),alert:o>0,muted:o===0}),s.jsx(_u,{label:p.usage.errorsExpected,value:String(l-o),muted:!0}),c&&s.jsx(_u,{label:p.usage.errorsTopCode,value:`${yv(c.source,c.code)} ×${c.count}`})]}),g.length===0?s.jsx(Md,{text:p.usage.errorsEmpty}):s.jsx("div",{className:"mt-2.5 max-h-72 overflow-y-auto border-t border-gray-200 dark:border-gray-800",children:s.jsxs("table",{className:"w-full table-fixed text-xs",children:[s.jsx("thead",{className:"sticky top-0 bg-white text-left text-gray-400 dark:bg-gray-900 dark:text-gray-500",children:s.jsxs("tr",{children:[s.jsx(Lu,{className:"w-32",children:p.common.time}),s.jsx(Lu,{className:"w-72",children:p.usage.errorsColCode}),s.jsx(Lu,{className:"w-20",children:p.usage.errorsColKind}),s.jsx(Lu,{children:p.usage.errorsColMessage})]})}),s.jsx("tbody",{children:g.map((I,F)=>{const K=NO(I.kind);return s.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[s.jsx("td",{className:"py-1.5 pr-2 align-top font-mono tabular-nums text-gray-400",children:wa(I.ts)}),s.jsx("td",{className:"py-1.5 pr-2 align-top font-mono text-gray-500 dark:text-gray-400",children:s.jsx("span",{className:"block break-words",children:yv(I.source,I.code)})}),s.jsx("td",{className:"py-1.5 pr-2 align-top",children:s.jsx(sn,{tone:K==="unexpected"?"red":"gray",children:jO(K)})}),s.jsx("td",{className:"py-1.5 align-top text-gray-500 dark:text-gray-400",children:s.jsx("button",{type:"button",title:I.message,onClick:()=>H(F),className:`block w-full cursor-pointer text-left transition-colors hover:text-gray-700 dark:hover:text-gray-300 ${O.has(F)?"whitespace-pre-wrap break-words":"truncate"}`,children:I.message})})]},`${I.ts}-${F}`)})})]})}),(L>1||m>0)&&s.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2 text-xs text-gray-500 dark:text-gray-400",children:[S!==null&&s.jsx("span",{className:"mr-auto text-rose-500",children:S}),s.jsx("span",{className:"tabular-nums",children:p.usage.errorsPageOf(m+1,L,k)}),s.jsx(bv,{label:p.usage.errorsNewer,disabled:m===0||E,onClick:()=>h(I=>Math.max(0,I-1))}),s.jsx(bv,{label:p.usage.errorsOlder,disabled:m+1>=L||E,onClick:()=>h(I=>I+1)})]})]})}function bv({label:e,disabled:n,onClick:r}){return s.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 vv(e){const n=r=>r<10?`0${r}`:`${r}`;return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function wh({label:e,value:n,muted:r,sup:l}){const o=r?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return s.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[s.jsxs("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:[e,l&&s.jsx("sup",{className:"ml-px",children:"*"})]}),s.jsx("span",{className:`min-w-0 truncate font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function Sh({title:e,bucket:n,currency:r}){return s.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[s.jsx("p",{className:"mb-1.5 text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(wh,{label:p.usage.tokens,value:yt(n.total)}),s.jsx(wh,{label:p.usage.requests,value:String(n.requests),muted:!0}),s.jsx(wh,{label:p.common.cost,value:er(n.cost,r),sup:n.hasUncosted})]})]})}function mo({title:e,extra:n,children:r}){return s.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[s.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),n]}),r]})}function MO(){gr(p.usage.title);const{currency:e}=Cs(),{currentProject:n}=on(),r=n?.projectId??null,[l]=hd(),o=l.get("agentId"),[c,d]=b.useState(o??""),[f,m]=b.useState(null);b.useEffect(()=>{d(o??"")},[o]);const[h,g]=b.useState(()=>{const z=new Date;return z.setDate(z.getDate()-29),vv(z)}),[y,k]=b.useState(()=>vv(new Date)),[w,S]=b.useState(null),[T,E]=b.useState(null),[M,L]=b.useState(null),O=b.useCallback(async()=>{if(r){E(null);try{const z=await Qv(r,{from:h,to:y,groupBy:"date",...c?{agentId:c}:{},...f?{provider:f.provider,modelId:f.modelId}:{}});S(z)}catch(z){E(_e(z))}}},[r,h,y,c,f?.provider,f?.modelId]);b.useEffect(()=>{S(null),O()},[O]);const P=b.useMemo(()=>({from:h,to:y,...c?{agentId:c}:{}}),[h,y,c]);if(!r)return null;const H=w?.models??[],I=f?H.findIndex(z=>z.provider===f.provider&&z.modelId===f.modelId):-1,F=I>=0?String(I):"",K=w?.summary,Z=(K?.today.hasUncosted??!1)||(K?.last7d.hasUncosted??!1)||(K?.total.hasUncosted??!1);return s.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:s.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("h1",{className:"text-xl font-semibold",children:p.usage.title}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("div",{className:"w-32",children:s.jsxs(Pr,{size:"sm",value:c,onChange:z=>d(z.target.value),children:[s.jsx("option",{value:"",children:p.usage.filterAllAgents}),c&&!(w?.agentIds??[]).includes(c)&&s.jsx("option",{value:c,children:c}),(w?.agentIds??[]).map(z=>s.jsx("option",{value:z,children:z},z))]})}),s.jsx("div",{className:"w-32",children:s.jsxs(Pr,{size:"sm",value:F,onChange:z=>{const B=z.target.value;m(B===""?null:H[Number(B)]??null)},children:[s.jsx("option",{value:"",children:p.usage.filterAllModels}),H.map((z,B)=>s.jsx("option",{value:String(B),children:rg(z.provider,z.modelId)?.displayName??z.modelId},`${z.provider}:${z.modelId}`))]})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(tt,{size:"sm",type:"date","aria-label":p.usage.from,value:h,onChange:z=>g(z.target.value)}),s.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:"–"}),s.jsx(tt,{size:"sm",type:"date","aria-label":p.usage.to,value:y,onChange:z=>k(z.target.value)})]})]})]}),w?s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[s.jsx(Sh,{title:p.usage.today,bucket:w.summary.today,currency:e}),s.jsx(Sh,{title:p.usage.last7d,bucket:w.summary.last7d,currency:e}),s.jsx(Sh,{title:p.usage.total,bucket:w.summary.total,currency:e})]}):s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[s.jsx(Vt,{className:"h-24"}),s.jsx(Vt,{className:"h-24"}),s.jsx(Vt,{className:"h-24"})]}),w?s.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[s.jsx(mo,{title:p.usage.chartAgentCalls,children:s.jsx(xO,{data:w.byAgent})}),s.jsx(mo,{title:p.usage.chartSuccessRate,children:s.jsx(kO,{data:w.success})}),s.jsx(mo,{title:p.usage.chartTokenTrend,extra:s.jsx(SO,{active:M,onHover:L}),children:s.jsx(wO,{trend:w.trend,legend:M})}),s.jsx(mo,{title:p.usage.chartCostTrend,children:s.jsx(hO,{points:w.trend,currency:e})})]}):s.jsx(Vt,{className:"h-64"}),w&&s.jsx(mo,{title:p.usage.errors,children:s.jsx(TO,{errors:w.errors,projectId:r,filters:P})}),Z&&s.jsx("p",{className:"text-xs text-gray-400",children:p.usage.uncostedNote}),T&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:T})]})})}function EO({cacheRead:e,cacheWrite:n,output:r,max:l,size:o=44}){const c=e+n+r,d=Math.max(2,Math.round(o*.16)),f=o/2,m=(o-d)/2,h=2*Math.PI*m,g=Math.max(l,c,1),y=l>0?c/l: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:To.cacheRead,label:p.usage.colCacheRead},{key:"cacheWrite",value:n,color:To.cacheWrite,label:p.usage.colCacheWrite},{key:"output",value:r,color:To.output,label:p.usage.colOutput}],S=`${p.chat.contextUsage} ${yt(c)}/${yt(l)}`+w.map(E=>` · ${E.label} ${yt(E.value)}`).join("");let T=0;return s.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,className:`block shrink-0 ${k}`,role:"img","aria-label":S,children:[s.jsx("title",{children:S}),s.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:"currentColor",strokeOpacity:.35,strokeWidth:d}),w.map(E=>{if(E.value<=0)return null;const M=E.value/g*h,L=-(T/g)*h;return T+=E.value,s.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:E.color,strokeWidth:d,strokeDasharray:`${M} ${h}`,strokeDashoffset:L,transform:`rotate(-90 ${f} ${f})`},E.key)})]})}const Ya={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"},cg="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",hS="truncate font-mono text-[11px]",kv=.25,dp=24,AO=1/dp,Dr=(e,n,r)=>Math.min(r,Math.max(n,e));function RO(e){return e==="thinking"?Ya.thinking:e==="text"?Ya.text:Ya.toolgen}function IO(e){return e==="thinking"?p.traces.kindThinking:e==="text"?p.traces.kindModelReply:p.traces.kindToolGen}function _O(e){return e==="thinking"?"thinking":e==="text"?"text":"toolgen"}function ho(e){if(e===void 0)return null;const n=Date.parse(e);return Number.isFinite(n)?n:null}function LO(e,n){const r=new Map,l=c=>{let d=r.get(c);return d||(d={segs:[],spans:[]},r.set(c,d)),d};for(const c of e){const d=ho(c.startTs),f=ho(c.endTs);d===null||f===null||l(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=ho(c.callTs);d!==null&&l(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:ho(c.approvalTs),outputMs:ho(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(S=>S.startMs),...f.map(S=>S.callMs)],h=[...d.map(S=>S.endMs),...f.map(S=>S.outputMs??S.approvalMs??S.callMs)],g=Math.min(...m),y=Math.max(...h,...m),k=Math.max(1,y-g);f.sort((S,T)=>S.callMs-T.callMs);const w=[...new Set(f.map(S=>S.name))];o.push({taskIndex:c,segs:d,spans:f,t0:g,total:k,toolNames:w})}return o}function pS({children:e}){return s.jsx("div",{className:"relative h-4 min-w-0 flex-1 overflow-hidden bg-gray-100 dark:bg-gray-800/60",children:e})}function OO({label:e,children:n}){return s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{className:`${cg} text-gray-400 dark:text-gray-500`,title:e,children:s.jsx("span",{className:hS,children:e})}),s.jsx(pS,{children:n})]})}function DO({total:e}){const n=[0,.25,.5,.75,1];return s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{className:cg}),s.jsx("div",{className:"relative h-4 min-w-0 flex-1",children:n.map((r,l)=>s.jsx("span",{className:`absolute top-0 font-mono text-[11px] text-gray-400 dark:text-gray-500 ${l===0?"":l===n.length-1?"-translate-x-full":"-translate-x-1/2"}`,style:{left:`${r*100}%`},children:Mn(r*e)},l))})]})}function zO({segments:e,toolSpans:n,highlight:r,onHighlight:l,onJump:o,hideTaskLabel:c=!1}){const d=b.useMemo(()=>LO(e,n),[e,n]),{firstBarKeyByTs:f,barKeys:m}=b.useMemo(()=>{const R=new Map,C=new Set,Q=(ee,ae)=>{C.add(ae),R.has(ee)||R.set(ee,ae)};for(const ee of d){ee.segs.forEach((ae,he)=>Q(ae.ts,`s-${ee.taskIndex}-${he}`));for(const ae of ee.spans)ae.approvalMs!==null&&ae.approvalMs>ae.callMs&&Q(ae.approvalTsRaw??ae.callTs,`w-${ae.toolCallId}`),ae.approvalMs===null&&ae.outputMs===null?Q(ae.callTs,`p-${ae.toolCallId}`):Q(ae.outputTsRaw??ae.callTs,`e-${ae.toolCallId}`)}return{firstBarKeyByTs:R,barKeys:C}},[d]),[h,g]=b.useState(null),[y,k]=b.useState(1),[w,S]=b.useState({left:0,width:1}),T=b.useRef(null),E=b.useRef(null),M=b.useRef(w);M.current=w;const L=b.useRef(y);L.current=y;const O=b.useRef(null),P=b.useRef(null),H=b.useCallback(()=>{const R=T.current;if(!R)return;const C=R.scrollWidth||1;S({left:R.scrollLeft/C,width:Math.min(1,R.clientWidth/C)})},[]);if(b.useLayoutEffect(()=>{const R=T.current;if(R){if(O.current){const C=R.scrollWidth-R.clientWidth;R.scrollLeft=Dr(O.current(R),0,Math.max(0,C)),O.current=null}H()}},[y,d,H]),b.useLayoutEffect(()=>{const R=T.current;if(!R||typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>H());return C.observe(R),()=>C.disconnect()},[H]),b.useLayoutEffect(()=>()=>P.current?.(),[]),d.length===0)return s.jsx("p",{className:"text-xs text-gray-400",children:p.common.none});const I=r?.ts,F=r?.key,K=(R,C)=>l?.(C?{ts:C,key:R}:null),Z=()=>l?.(null),z=F??(I!==void 0?f.get(I):void 0),B=z!==void 0&&m.has(z)?z:void 0,A=B!==void 0,$=R=>B===R,q=(R,C)=>h!==null&&!C||A&&!R?"opacity-15":"",U=(R,C,Q,ee)=>{const ae=Dr((R-Q)/ee*100,0,100),he=Dr((C-R)/ee*100,0,100-ae);return ae>=100?{left:"100%",width:"0%",marginLeft:"-2px"}:{left:`${ae}%`,width:`${he}%`}},V=[{key:"thinking",className:Ya.thinking,label:p.traces.kindThinking},{key:"text",className:Ya.text,label:p.traces.kindModelReply},{key:"toolgen",className:Ya.toolgen,label:p.traces.kindToolGen},{key:"approvalWait",className:Ya.approvalWait,label:p.traces.legendApprovalWait},{key:"exec",className:Ya.exec,label:p.traces.legendToolExec}],W=(R,C)=>{const Q=Dr(C,AO,1),ee=Dr(1/Q,kv,dp),ae=Dr(R,0,1-Q);O.current=he=>ae*he.scrollWidth,k(ee)},ce=R=>{R.preventDefault();const C=E.current,Q=T.current;if(!C||!Q)return;const ee=C.getBoundingClientRect().width||1,ae=R.clientX,he=Q.scrollLeft,xe=Math.max(0,Q.scrollWidth-Q.clientWidth),ie=ve=>{const Ke=(ve.clientX-ae)/ee;Q.scrollLeft=Dr(he+Ke*Q.scrollWidth,0,xe),H()},ye=()=>{window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",ye),P.current=null};window.addEventListener("pointermove",ie),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",ye),P.current=ye},te=R=>C=>{C.preventDefault(),C.stopPropagation();const Q=E.current;if(!Q)return;const ee=Q.getBoundingClientRect(),ae=xe=>{const ie=Dr((xe.clientX-ee.left)/(ee.width||1),0,1),ye=M.current;if(R==="right")W(ye.left,ie-ye.left);else{const ve=ye.left+ye.width;W(ie,ve-ie)}},he=()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he),P.current=null};window.addEventListener("pointermove",ae),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he),P.current=he},N=()=>{O.current=()=>0,k(1)},_=R=>{const C=T.current,Q=Dr(L.current*R,kv,dp);if(Q!==L.current){if(C){const ee=C.clientWidth/2,ae=(C.scrollLeft+ee)/(C.scrollWidth||1);O.current=he=>ae*he.scrollWidth-ee}k(Q)}};return s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{ref:T,className:"no-scrollbar overflow-x-auto overflow-y-hidden",children:s.jsx("div",{className:"space-y-4",style:{width:`${y*100}%`},children:d.map(R=>s.jsxs("div",{className:"space-y-1",children:[!c&&s.jsxs("div",{className:"flex items-center gap-2 pl-[5.5rem]",children:[s.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:p.traces.task(R.taskIndex+1)}),s.jsx("span",{className:"font-mono text-[11px] text-gray-400",children:Mn(R.total)})]}),s.jsx(OO,{label:p.traces.laneLLM,children:R.segs.map((C,Q)=>{const ee=_O(C.kind),ae=h===null||h===ee,he=`s-${R.taskIndex}-${Q}`,xe=$(he);return s.jsx("span",{onMouseEnter:()=>K(he,C.ts),onMouseLeave:Z,onClick:()=>o?.(C.ts),title:`${IO(C.kind)}${C.name?` ${C.name}`:""} · ${Mn(C.endMs-C.startMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${RO(C.kind)} ${q(xe,ae)}`,style:U(C.startMs,C.endMs,R.t0,R.total)},Q)})}),R.spans.map(C=>{const Q=C.approvalMs??C.callMs,ee=C.outputMs===null,ae=C.outputMs??R.t0+R.total,he=C.approvalTsRaw??C.callTs,xe=C.outputTsRaw??C.callTs;return s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{className:`${cg} text-gray-500 dark:text-gray-400`,title:C.name,children:s.jsx("span",{className:hS,children:C.name})}),s.jsxs(pS,{children:[C.approvalMs!==null&&C.approvalMs>C.callMs&&s.jsx("span",{onMouseEnter:()=>K(`w-${C.toolCallId}`,he),onMouseLeave:Z,onClick:()=>o?.(he),title:`${C.name} · ${p.traces.legendApprovalWait}${C.decision?` (${C.decision})`:""} · ${Mn(C.approvalMs-C.callMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Ya.approvalWait} ${q($(`w-${C.toolCallId}`),h===null||h==="approvalWait")}`,style:U(C.callMs,C.approvalMs,R.t0,R.total)}),C.approvalMs===null&&ee?(()=>{const ie=q($(`p-${C.toolCallId}`),h===null||h==="approvalWait");return s.jsx("span",{onMouseEnter:()=>K(`p-${C.toolCallId}`,C.callTs),onMouseLeave:Z,onClick:()=>o?.(C.callTs),title:`${C.name} · ${p.traces.legendApprovalWait} · ${p.traces.inProgress}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Ya.approvalWait} ${ie||"animate-pulse"}`,style:U(C.callMs,ae,R.t0,R.total)})})():(()=>{const ie=q($(`e-${C.toolCallId}`),h===null||h==="exec"),ye=ee&&!ie;return s.jsx("span",{onMouseEnter:()=>K(`e-${C.toolCallId}`,xe),onMouseLeave:Z,onClick:()=>o?.(xe),title:`${C.name} · ${p.traces.legendToolExec} · ${ee?p.traces.inProgress:Mn(ae-Q)}${C.failed?` · ${C.status}`:""}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Ya.exec} ${C.failed?"ring-1 ring-red-500":""} ${ye?"animate-pulse opacity-70":ie}`,style:U(Q,ae,R.t0,R.total)})})()]})]},C.toolCallId)}),s.jsx(DO,{total:R.total})]},R.taskIndex))})}),s.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:V.map(R=>s.jsxs("button",{type:"button",onMouseEnter:()=>g(R.key),onMouseLeave:()=>g(null),className:`flex items-center gap-1 px-1 font-mono text-[11px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${h!==null&&h!==R.key?"opacity-30":""}`,children:[s.jsx("span",{className:`inline-block h-2 w-3 rounded-sm ${R.className}`}),R.label]},R.key))}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:p.traces.zoom}),s.jsx("button",{type:"button","aria-label":p.traces.zoomOut,title:p.traces.zoomOut,onClick:()=>_(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:s.jsx("span",{className:"text-[11px] leading-none",children:"−"})}),s.jsx("div",{ref:E,onDoubleClick:N,title:p.traces.zoomReset,className:"relative h-3 min-w-0 flex-1 rounded bg-gray-100 dark:bg-gray-800",children:s.jsxs("div",{role:"scrollbar","aria-label":p.traces.zoom,onPointerDown:ce,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:[s.jsx("span",{onPointerDown:te("left"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-l bg-gray-500/80 dark:bg-gray-400/80"}),s.jsx("span",{onPointerDown:te("right"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-r bg-gray-500/80 dark:bg-gray-400/80"})]})}),s.jsx("button",{type:"button","aria-label":p.traces.zoomIn,title:p.traces.zoomIn,onClick:()=>_(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:s.jsx("span",{className:"text-[11px] leading-none",children:"+"})}),s.jsxs("span",{className:"w-9 shrink-0 text-right font-mono text-[11px] tabular-nums text-gray-400",children:[y.toFixed(2),"×"]})]}),l&&s.jsx("p",{className:"text-[11px] text-gray-400 dark:text-gray-600",children:p.traces.linkHint})]})}function UO(e){return e==="session_meta"?"brand":e==="model_msg"?"gray":"amber"}const $O={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"},BO="M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";function HO({type:e}){return s.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:s.jsx("path",{d:$O[e]??BO})})}function PO(e){const n=e.payload;switch(n.type){case void 0:return"";case"text":return`${String(n.role)}: ${String(n.text??"").slice(0,120)}`;case"thinking":return String(n.thinking??"").slice(0,120);case"image_url":return"[image]";case"inline_data":return`[image] ${String(n.mime_type??"")}`;case"tool_call":return`${String(n.name)} ${String(n.arguments??"").slice(0,100)}`;case"tool_call_output":{const r=String(n.output??"").slice(0,120);return Array.isArray(n.images)&&n.images.length>0?`[image] ${r}`:r}case"token_usage":{const r=n.request,l=n.session;return`request.total=${r?.total??0} session.total=${l?.total??0}`}case"request_end":return`status=${String(n.status)}`;case"approval_decision":return`${String(n.decision)} · ${String(n.tool_call_id)}`;case"compaction_begin":case"compaction_end":return`${String(n.mode)} (${String(n.reason)})${n.status?` · ${String(n.status)}`:""}`;case"abort":return n.reason!=null?String(n.reason):"";case"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 FO(e){const n=e.payload;return n.stop_reason??n.status}const Ou="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 qO({p:e}){const n=e.request??{},r=e.session??{},l=(o,c)=>s.jsxs("tr",{children:[s.jsx("td",{className:"pr-3 text-gray-400",children:o}),s.jsx("td",{className:"pr-3 text-right font-mono",children:yt(c.cache_read??0)}),s.jsx("td",{className:"pr-3 text-right font-mono",children:yt(c.cache_write??0)}),s.jsx("td",{className:"pr-3 text-right font-mono",children:yt(c.output??0)}),s.jsx("td",{className:"text-right font-mono",children:yt(c.total??0)})]});return s.jsxs("table",{className:"text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-gray-400",children:[s.jsx("th",{}),s.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheRead"}),s.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheWrite"}),s.jsx("th",{className:"pr-3 text-right font-normal",children:"output"}),s.jsx("th",{className:"text-right font-normal",children:"total"})]})}),s.jsxs("tbody",{children:[l("request",n),l("session",r)]})]})}const wv="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 VO({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??""),l=Array.isArray(e.tools)?e.tools:[];return s.jsxs("div",{className:"space-y-2.5",children:[s.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs",children:n.map(([o,c])=>s.jsxs(b.Fragment,{children:[s.jsx("dt",{className:"text-gray-400",children:o}),s.jsx("dd",{className:"min-w-0 break-all font-mono text-gray-700 dark:text-gray-300",children:c||"—"})]},o))}),r.trim()&&s.jsxs("details",{children:[s.jsx("summary",{className:wv,children:p.traces.systemPrompt}),s.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:s.jsx(Xo,{remarkPlugins:[Zo],children:r})})]}),l.length>0&&s.jsxs("details",{children:[s.jsx("summary",{className:wv,children:p.traces.toolDefs(l.length)}),s.jsx("ul",{className:"mt-1.5 space-y-1",children:l.map((o,c)=>s.jsxs("li",{className:"text-xs",children:[s.jsx("span",{className:"font-mono font-semibold text-gray-700 dark:text-gray-300",children:o.name??"—"}),o.description&&s.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:o.description})]},c))})]})]})}function GO({msg:e}){const n=e.payload;if(e.type==="session_meta")return s.jsx(VO,{p:n});switch(n.type){case"text":case"thinking":{const r=String(n.text??n.thinking??"");return r.trim()?s.jsx("div",{className:"md-body text-sm leading-relaxed text-gray-700 dark:text-gray-300",children:s.jsx(Xo,{remarkPlugins:[Zo],children:r})}):s.jsx("p",{className:"text-xs text-gray-400",children:"—"})}case"image_url":return s.jsx(Br,{src:String(n.image_url??""),alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"inline_data":return s.jsx(Br,{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 s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:String(n.name??"")}),s.jsx("pre",{className:Ou,children:String(n.arguments??"")})]});case"tool_call_output":{const r=Array.isArray(n.images)?n.images:[];return r.length===0?s.jsx("pre",{className:Ou,children:String(n.output??"")}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("pre",{className:Ou,children:String(n.output??"")}),s.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((l,o)=>s.jsx(Br,{src:l,alt:"trace",className:"max-h-48 max-w-full rounded-md"},o))})]})}case"token_usage":return s.jsx(qO,{p:n});default:return s.jsx("pre",{className:Ou,children:JSON.stringify(n,null,2)})}}function WO({msg:e,rowKey:n,matched:r,onHighlight:l}){const[o,c]=b.useState(!1),d=e.payload.type??e.type,f=FO(e);return s.jsxs("li",{"data-trace-row":n,children:[s.jsxs("button",{type:"button",onClick:()=>c(m=>!m),onMouseEnter:()=>l?.({ts:e.timestamp,rowKey:n}),onMouseLeave:()=>l?.(null),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 ${r?"bg-amber-50 dark:bg-amber-950/40":"hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,children:[s.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:V4(e.timestamp)}),s.jsx(HO,{type:d}),s.jsx(sn,{tone:UO(e.type),children:d}),e.origin&&e.origin.length>0&&s.jsx(sn,{tone:"brand",children:"origin"}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:PO(e)})]}),o&&s.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:[s.jsx(GO,{msg:e}),f&&s.jsx("div",{className:"mt-1.5 flex justify-end",children:s.jsx(sn,{tone:e3(f),children:f})})]})]})}const Sv=()=>({cacheRead:0,cacheWrite:0,output:0}),KO=2500,jv=(e,n)=>`${e}-${n}`;function zr({label:e,value:n}){return s.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-0.5",children:[s.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:e}),s.jsx("span",{className:"truncate font-mono text-sm font-semibold tabular-nums",children:n})]})}const gS=e=>e.cacheRead+e.cacheWrite,xS=e=>Bk(e.cacheRead,e.cacheWrite),yS="flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";function po({icon:e,value:n,label:r}){return s.jsxs("span",{title:r,"aria-label":r,className:`${yS} gap-1`,children:[s.jsx(Pe,{d:e,className:"text-gray-400"}),n]})}function YO({buckets:e}){const n=gS(e),r=`${p.traces.cacheHit} ${yt(e.cacheRead)} · ${p.traces.hitRate} ${Mp(xS(e))}`;return s.jsxs("span",{"aria-label":`${p.traces.taskInput} ${yt(n)} · ${r}`,className:yS,children:[s.jsxs("span",{title:p.traces.taskInput,className:"flex items-center gap-1",children:[s.jsx(Pe,{d:gn.input,className:"text-gray-400"}),yt(n)]}),s.jsxs("span",{title:r,className:"ml-1 flex items-center gap-0.5 text-gray-400",children:[s.jsx("span",{children:"("}),s.jsx(Pe,{d:gn.cacheHit}),s.jsx("span",{children:yt(e.cacheRead)}),s.jsx("span",{children:")"})]})]})}function QO({projectId:e,agentId:n,sessionId:r,index:l,highlight:o,onHighlight:c}){const{currency:d}=Cs(),[f,m]=b.useState(null),[h,g]=b.useState([]),[y,k]=b.useState(0),[w,S]=b.useState(0),[T,E]=b.useState(null),[M,L]=b.useState(null),[O,P]=b.useState(new Set),[H,I]=b.useState(null),F=b.useRef(null),K=b.useRef(null);b.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]),b.useEffect(()=>{m(null),g([]),L(null),P(new Set),I(null);let _=!1;return Promise.all([CN(e,n,r,l),NN(e,n,r,l,0,1e3),$o(e).catch(()=>null)]).then(([R,C,Q])=>{_||(m(R),g(C.events),k(C.offset),S(C.total),E(Q))}).catch(R=>{_||L(_e(R))}),()=>{_=!0}},[e,n,r,l]);const Z=b.useMemo(()=>{const _=h.find(C=>C.type==="session_meta"),R=_?_.payload:void 0;if(!(!R?.model_id||!R.provider))return T?.models.find(C=>C.modelId===R.model_id&&C.provider===R.provider)?.pricing},[h,T]),z=_=>Z?(_.cacheRead*Z.cacheRead+_.cacheWrite*Z.cacheWrite+_.output*Z.output)/1e6:null,B=b.useMemo(()=>{const _=h.find(R=>R.type==="session_meta");return T2(_?_.payload.model_context_window:void 0)},[h]),{tasks:A,global:$,statsByTask:q,globalLlmMs:U}=b.useMemo(()=>{const _={buckets:Sv(),toolCalls:0},R=new Map;if(!f)return{tasks:[],global:_,statsByTask:R,globalLlmMs:0};const C=new Map;for(const ye of f.tasks){const ve=Date.parse(ye.startTs),Ke=Date.parse(ye.endTs);Number.isFinite(ve)&&Number.isFinite(Ke)&&C.set(ye.taskIndex,{min:ve,max:Ke})}const Q=new Map,ee=ye=>{let ve=Q.get(ye);if(!ve){const Ke=C.get(ye);ve={taskIndex:ye,segments:[],spans:[],messages:[],toolCalls:0,durationMs:Ke?Math.max(0,Ke.max-Ke.min):0},Q.set(ye,ve)}return ve};for(const ye of f.tasks)ee(ye.taskIndex);for(const ye of f.modelSegments)ee(ye.taskIndex).segments.push(ye);for(const ye of f.toolSpans){const ve=ee(ye.taskIndex);ve.spans.push(ye),ve.toolCalls+=1}const ae=ye=>{for(const ve of f.tasks)if(ye>=ve.messageFrom&&ye<=ve.messageTo)return ve.taskIndex;return null};for(let ye=0;ye<h.length;ye++){const ve=h[ye];if(ve.origin&&ve.origin.length>0)continue;const Ke=ae(y+ye);Ke!==null&&ee(Ke).messages.push(ve)}_.toolCalls=f.toolSpans.length;const he=new Map(f.tasks.map(ye=>[ye.taskIndex,ye]));for(const ye of f.tasks)_.buckets.cacheRead+=ye.tokens.cacheRead,_.buckets.cacheWrite+=ye.tokens.cacheWrite,_.buckets.output+=ye.tokens.output;const xe=f.tasks.reduce((ye,ve)=>ye+ve.llmMs,0);return{tasks:[...Q.values()].sort((ye,ve)=>ye.taskIndex-ve.taskIndex),global:_,statsByTask:he,globalLlmMs:xe}},[f,h,y]);if(M)return s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:M});if(!f)return s.jsx(Vt,{className:"h-40"});const V=f.elapsedMs,W=_=>P(R=>{const C=new Set(R);return C.has(_)?C.delete(_):C.add(_),C}),ce=_=>{for(const R of A){const C=R.messages.findIndex(Q=>Q.timestamp===_);if(C>=0)return jv(R.taskIndex,C)}return null},te=o?.rowKey??(o?.ts!==void 0?ce(o.ts):null),N=_=>{const R=ce(_);R!==null&&(I(R),requestAnimationFrame(()=>{F.current?.querySelector(`[data-trace-row="${R}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})}),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>I(null),KO))};return s.jsxs("div",{ref:F,className:"space-y-4",children:[s.jsxs("div",{className:"rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[s.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:p.traces.globalSummary}),s.jsxs("div",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-3",children:[s.jsxs("div",{children:[s.jsx(zr,{label:p.traces.tasksLabel,value:String(f.tasks.length)}),s.jsx(zr,{label:p.traces.toolCalls,value:String($.toolCalls)}),s.jsx(zr,{label:p.traces.compactions,value:String(f.compactionCount)})]}),s.jsxs("div",{children:[s.jsx(zr,{label:p.chat.statInput,value:yt(gS($.buckets))}),s.jsx(zr,{label:p.traces.cacheHit,value:`${yt($.buckets.cacheRead)} · ${Mp(xS($.buckets))}`}),s.jsx(zr,{label:p.chat.statOutput,value:yt($.buckets.output)})]}),s.jsxs("div",{children:[s.jsx(zr,{label:p.common.cost,value:er(z($.buckets),d)}),s.jsx(zr,{label:p.chat.statElapsed,value:Mn(Math.max(0,V))}),s.jsx(zr,{label:p.chat.statTps,value:Gu(_h($.buckets.output,U))})]})]})]}),A.map(_=>{const R=!O.has(_.taskIndex),C=q.get(_.taskIndex),Q=C?.context,ee=C?.tokens??Sv();return s.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[s.jsxs("button",{type:"button",onClick:()=>W(_.taskIndex),"aria-expanded":R,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:[s.jsx(ra,{open:R,size:13,className:"text-gray-400"}),s.jsx("span",{className:"shrink-0 text-sm font-semibold",children:p.traces.task(_.taskIndex+1)}),C?.compaction===!0&&s.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:p.traces.compactionRound}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[s.jsx(po,{icon:gn.toolCalls,value:String(_.toolCalls),label:p.traces.toolCalls}),s.jsx(YO,{buckets:ee}),s.jsx(po,{icon:gn.output,value:yt(ee.output),label:p.traces.taskOutput}),s.jsx(po,{icon:gn.cost,value:er(z(ee),d),label:`${p.common.cost}(${d})`}),s.jsx(po,{icon:gn.elapsed,value:Mn(_.durationMs),label:p.chat.statElapsed}),s.jsx(po,{icon:gn.tps,value:Gu(_h(ee.output,C?.llmMs??0)),label:p.chat.statTps})]}),Q&&s.jsx(EO,{cacheRead:Q.cacheRead,cacheWrite:Q.cacheWrite,output:Q.output,max:B,size:22})]}),R&&s.jsxs("div",{className:"space-y-3 p-3",children:[(_.segments.length>0||_.spans.length>0)&&s.jsxs("div",{className:"rounded-md border border-gray-100 p-2 dark:border-gray-800/60",children:[s.jsx("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:p.traces.timeline}),s.jsx(zO,{segments:_.segments,toolSpans:_.spans,highlight:o,onHighlight:c,onJump:N,hideTaskLabel:!0})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:[p.traces.messages,"(",_.messages.length,")"]}),_.messages.length===0?s.jsx("p",{className:"text-xs text-gray-400",children:p.common.none}):s.jsx("ul",{className:"divide-y divide-gray-100 rounded-md border border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:_.messages.map((ae,he)=>{const xe=jv(_.taskIndex,he);return s.jsx(WO,{msg:ae,rowKey:xe,matched:xe===te||xe===H,onHighlight:ie=>c(ie)},he)})})]})]})]},_.taskIndex)}),h.length<w&&s.jsx("p",{className:"text-xs text-gray-400",children:p.traces.truncatedNote(h.length,w)})]})}const Mo=20,go=15;function bS(e){if(e.sessions)return e.sessions.map(r=>({sessionId:r.sessionId,...r.title!==void 0?{title:r.title}:{},category:r.category,workspace:r.workspace,files:[...r.files].sort((l,o)=>o.index-l.index)}));const n=new Map;for(const r of e.dates)for(const l of r.sessions){const o=n.get(l.sessionId)??[];for(const c of l.files)o.push({index:c.index,date:r.date,sizeBytes:c.sizeBytes});n.set(l.sessionId,o)}return[...n.entries()].sort((r,l)=>l[0].localeCompare(r[0])).map(([r,l])=>({sessionId:r,category:"active",workspace:"",files:l.sort((o,c)=>c.index-o.index)}))}function Nv(e){const n={active:[],subagent:[],schedule:[],archived:[]};for(const r of e)n[r.category].push(r);return n}const Ua=(e,n)=>`${e}\0${n}`;function XO(e,n=!1){const[r,l]=b.useState(new Map),[o,c]=b.useState(new Map),[d,f]=b.useState(new Map),[m,h]=b.useState(new Map),[g,y]=b.useState(new Map),[k,w]=b.useState(new Set),S=b.useRef(0),T=b.useRef(new Set),E=b.useRef(o);E.current=o;const M=b.useRef(d);M.current=d,b.useEffect(()=>{S.current+=1,T.current.clear();const z=new Map;E.current=z,l(new Map),c(z),f(new Map),h(new Map),y(new Map),w(new Set)},[e,n]);const L=b.useCallback(async(z,B,A,$)=>{const q=await Yv(z,B,{offset:$,limit:Mo+1,category:A,...n?{cli:!0}:{}}),U=Rh(bS(q),Mo);return{agentId:B,category:A,items:U.items.map(V=>({...V,agentId:B})),hasMore:U.hasMore,...q.counts!==void 0?{counts:q.counts}:{},...q.workspaceCounts!==void 0?{workspaceCounts:q.workspaceCounts}:{}}},[n]),O=b.useCallback((z,B)=>{l(A=>{const $=new Map(A);if(B!==void 0)for(const[q,U]of A)U.agentId===B&&$.delete(q);for(const q of z)for(const U of q.items)$.set(U.sessionId,U);return $}),c(A=>{const $=new Map(A);if(B!==void 0)for(const q of A.keys())q.startsWith(`${B}\0`)&&$.delete(q);for(const q of z){const U=Ua(q.agentId,q.category);$.set(U,{hasMore:q.hasMore,fetched:(B===void 0?A.get(U)?.fetched??0:0)+q.items.length})}return $});for(const A of z)A.counts&&f($=>new Map($).set(A.agentId,A.counts)),A.workspaceCounts&&h($=>new Map($).set(A.agentId,A.workspaceCounts))},[]),P=b.useCallback(z=>{if(!e)return;const B=[...new Set(z)].filter($=>{const q=Ua($,"active");return!E.current.has(q)&&!T.current.has(q)});if(B.length===0)return;const A=S.current;for(const $ of B)T.current.add(Ua($,"active"));w($=>{const q=new Set($);for(const U of B)q.add(Ua(U,"active"));return q}),y($=>{if(!B.some(U=>$.has(U)))return $;const q=new Map($);for(const U of B)q.delete(U);return q}),Promise.all(B.map(async $=>{try{return await L(e,$,"active",0)}catch(q){return A===S.current&&y(U=>new Map(U).set($,_e(q))),null}})).then($=>{for(const q of B)T.current.delete(Ua(q,"active"));w(q=>{const U=new Set(q);for(const V of B)U.delete(Ua(V,"active"));return U}),A===S.current&&O($.filter(q=>q!==null))})},[e,L,O]),H=b.useCallback(async(z,B)=>{if(!e)return;const A=[...new Set(z)].filter(U=>{const V=E.current.get(Ua(U,B));return V===void 0?(M.current.get(U)?.[B]??0)>0:V.hasMore});if(A.length===0)return;const $=S.current,q=await Promise.all(A.map(async U=>{const V=E.current.get(Ua(U,B))?.fetched??0;try{return await L(e,U,B,V)}catch{return null}}));$===S.current&&O(q.filter(U=>U!==null))},[e,L,O]),I=b.useCallback(async z=>{if(!e)return;const B=["active",...Po.filter(q=>E.current.has(Ua(z,q)))],A=S.current,$=await Promise.all(B.map(async q=>{try{return await L(e,z,q,0)}catch{return null}}));A===S.current&&O($.filter(q=>q!==null),z)},[e,L,O]),F=b.useCallback((z,B)=>o.has(Ua(z,B)),[o]),K=b.useCallback((z,B)=>k.has(Ua(z,B)),[k]),Z=b.useCallback((z,B)=>{const A=o.get(Ua(z,B));return A!==void 0?A.hasMore:(d.get(z)?.[B]??0)>0},[o,d]);return b.useMemo(()=>{const z=new Map;for(const A of r.values()){const $=z.get(A.agentId);$?$.push(A):z.set(A.agentId,[A])}for(const A of z.values())A.sort(($,q)=>q.sessionId.localeCompare($.sessionId));const B=[...z.values()].flat();return{rowsByAgent:z,allRows:B,countsByAgent:d,workspaceCountsByAgent:m,errorByAgent:g,isLoadedFor:F,isPendingFor:K,hasMoreFor:Z,ensureFirstFor:P,loadMoreFor:H,refreshAgent:I}},[r,d,m,g,F,K,Z,P,H,I])}const ZO=14*1024*1024,jh=10,Cv=(e,n)=>`${n}\0${e}`;function JO(){gr(p.traces.title);const{currentProject:e,agents:n,agentsLoading:r}=on(),{byAgent:l,showCliSessions:o}=dl(),c=e?.projectId??null,d=XO(c,o),[f]=hd(),m=f.get("agentId"),h=f.get("sessionId"),[g,y]=b.useState(Ik),k=m!==null?"agent":g,[w,S]=b.useState(null),[T,E]=b.useState(null),[M,L]=b.useState(go),[O,P]=b.useState(new Map),[H,I]=b.useState(null),[F,K]=b.useState(new Set),[Z,z]=b.useState(new Set),[B,A]=b.useState(new Set),[$,q]=b.useState(!1),[U,V]=b.useState(""),[W,ce]=b.useState(null),[te,N]=b.useState(!1),[_,R]=b.useState(null),C=b.useRef(null),Q=re=>{_k(re),y(re),L(go)};b.useEffect(()=>{S(null),E(null),L(go),P(new Map),I(null),K(new Set),z(new Set)},[c]),b.useEffect(()=>{R(null)},[w,T]),b.useEffect(()=>{N(!1)},[w]);const ee=b.useMemo(()=>{const re=new Map;for(const ke of l.values())for(const Me of ke)Me.title!==void 0&&re.set(Me.sessionId,Me.title);return re},[l]),ae=b.useCallback((re,ke)=>ee.get(re)??ke??p.chat.defaultSessionTitle,[ee]),he=b.useMemo(()=>new Map(n.map(re=>[re.agentId,Gt(re)])),[n]),xe=b.useMemo(()=>Ih(n,re=>re.agentId,new Set(m===null?[]:[m])),[n,m]),ie=b.useMemo(()=>{if(H!==null)return H;const re=m??xe[0]?.agentId;return new Set(re===void 0?[]:[re])},[H,m,xe]),ye=re=>{const ke=new Set(ie);ke.has(re)?ke.delete(re):ke.add(re),I(ke)},ve=re=>{K(ke=>{const Me=new Set(ke);return Me.has(re)?Me.delete(re):Me.add(re),Me})},Ke=d.ensureFirstFor;b.useEffect(()=>{if(!c||k!=="agent")return;const re=xe.slice(0,M).map(ke=>ke.agentId).filter(ke=>ie.has(ke));re.length>0&&Ke(re)},[c,k,xe,M,ie,Ke]),b.useEffect(()=>{!c||k!=="workspace"||n.length===0||Ke(n.map(re=>re.agentId))},[c,k,n,Ke]);const He=b.useMemo(()=>Tk(d.allRows.map(re=>({...re,createdAt:re.sessionId}))),[d.allRows]),Ge=b.useMemo(()=>Nk(d.workspaceCountsByAgent),[d.workspaceCountsByAgent]),Qe=b.useCallback(re=>{S({agentId:re.agentId,sessionId:re.sessionId,...re.title!==void 0?{title:re.title}:{},files:re.files}),E(re.files[0]?.index??null)},[]),ut=b.useCallback((re,ke)=>{c&&Yv(c,re).then(Me=>{const Te=bS(Me).find($e=>$e.sessionId===ke);Te&&Qe({...Te,agentId:re})}).catch(()=>{})},[c,Qe]),Yt=b.useRef(!1);b.useEffect(()=>{if(Yt.current||!h||!m||!d.isLoadedFor(m,"active"))return;Yt.current=!0;const re=d.rowsByAgent.get(m)?.find(ke=>ke.sessionId===h);re?Qe(re):ut(m,h)},[d,h,m,Qe,ut]),b.useEffect(()=>{const re=C.current;if(re===null)return;const ke=d.rowsByAgent.get(re.agentId);if(ke===void 0)return;C.current=null;const Me=ke.find(Te=>Te.sessionId===re.sessionId);Me?Qe(Me):ut(re.agentId,re.sessionId)},[d,Qe,ut]);const en=async(re,ke)=>{if(c){ce(re);try{const Me=await MN(c,re,{dataBase64:ke});C.current={agentId:re,sessionId:Me.sessionId},ie.has(re)||ye(re),await d.refreshAgent(re)}catch(Me){ht(_e(Me))}finally{ce(null)}}},tn=re=>{const ke=U,Me=re.target.files?.[0];if(re.target.value="",!Me||ke==="")return;if(Me.size>ZO){ht(p.traces.fileTooLarge);return}q(!1);const Te=new FileReader;Te.onload=()=>{const $e=Te.result;en(ke,$e.slice($e.indexOf(",")+1))},Te.onerror=()=>ht(p.common.unknownError),Te.readAsDataURL(Me)},wn=()=>{V(m??xe[0]?.agentId??""),q(!0)},Pt=(re,ke)=>`${ke}\0${re}`,xn=(re,ke,Me)=>{const Te=Pt(re,ke);A($e=>new Set($e).add(Te)),d.loadMoreFor(Me,ke).finally(()=>{A($e=>{const Ve=new Set($e);return Ve.delete(Te),Ve})})},yn=(re,ke,Me)=>{const Te=Cv(re,ke),$e=!Z.has(Te);if(z(Ve=>{const Xe=new Set(Ve);return $e?Xe.add(Te):Xe.delete(Te),Xe}),$e){const Ve=Me.filter(Xe=>!d.isLoadedFor(Xe,ke));Ve.length>0&&d.loadMoreFor(Ve,ke)}},st=(re,ke)=>s.jsx("ul",{className:"space-y-0.5",children:re.map(Me=>{const Te=w?.sessionId===Me.sessionId,$e=he.get(Me.agentId)??Me.agentId;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>Qe(Me),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${Te?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[ke&&s.jsxs("span",{title:$e,className:"flex shrink-0 items-center",children:[s.jsx(na,{id:Me.agentId,name:$e,size:14,className:"rounded"}),s.jsx("span",{className:"sr-only",children:$e})]}),s.jsx(pd,{text:ae(Me.sessionId,Me.title),className:`min-w-0 flex-1 text-sm ${Te?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),s.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:Me.files.length})]})},Me.sessionId)})}),Wt=(re,ke,Me,Te,$e,Ve)=>{const Xe=Me[ke],et=Math.max(Ve?.[ke]??0,Xe.length);if(et===0)return null;const cn=Xe.length<et&&$e.some(bn=>d.hasMoreFor(bn,ke));return s.jsx(Dk,{label:p.chat.folderGroups[ke](et),open:Z.has(Cv(re,ke)),onToggle:()=>yn(re,ke,$e),more:cn,pending:B.has(Pt(re,ke)),onMore:()=>xn(re,ke,$e),children:st(Xe,Te)},ke)},X=(re,ke)=>{P(Me=>{const Te=new Map(Me);return Te.set(re,(Me.get(re)??Mo)+Mo),Te}),ke.length>0&&xn(re,"active",ke)},me=(re,ke,Me,Te,$e,Ve)=>{const Xe=Nv(ke),et=O.get(re)??Mo,cn=Xe.active.slice(0,et),bn=$e("active"),Nt=Math.max(Te?.active??0,Xe.active.length),Sn=Xe.active.length>et||Xe.active.length<Nt&&bn.some(jn=>d.hasMoreFor(jn,"active")),vn=Po.map(jn=>Wt(re,jn,Xe,Me,$e(jn),Te)),Ct=Xe.active.length===0&&vn.every(jn=>jn===null),It=B.has(Pt(re,"active"));return s.jsxs(s.Fragment,{children:[Ct?s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:Ve}):st(cn,Me),Sn&&s.jsx(Xl,{label:p.chat.loadMore,pending:It,onClick:()=>X(re,bn),className:"mt-0.5"}),vn]})};if(!c)return null;const Ne=w===null?null:w.files.find(re=>re.index===T)??w.files[0]??null,Ae=w===null||te?null:w.files.slice(0,jh),Oe=d.allRows.length===0&&n.some(re=>d.isPendingFor(re.agentId,"active"));return s.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[s.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:[s.jsxs("div",{className:"flex items-center justify-between px-3 pb-1",children:[s.jsx("p",{className:"text-xs font-bold uppercase tracking-wide text-gray-500",children:p.traces.title}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[e?.role==="owner"&&s.jsx("button",{type:"button",title:W!==null?p.traces.importing:p.traces.importTrace,"aria-label":W!==null?p.traces.importing:p.traces.importTrace,disabled:W!==null,onClick:wn,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 hover:text-gray-700 disabled:opacity-60 dark:text-gray-500 dark:hover:bg-gray-800/70 dark:hover:text-gray-300",children:s.jsx(p1,{size:14})}),m===null&&s.jsx(Lk,{value:g,onChange:Q})]})]}),r||k==="workspace"&&Oe?s.jsx(ba,{rows:4}):k==="agent"?s.jsxs(s.Fragment,{children:[xe.slice(0,M).map(re=>{const ke=ie.has(re.agentId),Me=Gt(re),Te=d.errorByAgent.get(re.agentId),$e=d.isLoadedFor(re.agentId,"active");return s.jsxs("div",{className:"pt-2.5",children:[s.jsx(Vu,{open:ke,onToggle:()=>ye(re.agentId),icon:s.jsx(na,{id:re.agentId,name:Me,size:18,className:"shrink-0 rounded"}),label:Me,uppercase:!0}),ke&&s.jsxs("div",{className:"anim-fade",children:[Te!==void 0&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:Te}),!$e&&Te===void 0&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:p.common.loading}),$e&&me(re.agentId,d.rowsByAgent.get(re.agentId)??[],!1,d.countsByAgent.get(re.agentId),()=>[re.agentId],p.traces.empty)]})]},re.agentId)}),xe.length>M&&s.jsx(Xl,{label:p.chat.moreGroups(xe.length-M),onClick:()=>L(re=>re+go),className:"mt-1"})]}):He.length===0?s.jsx("p",{className:"px-2.5 pt-3 text-xs text-gray-400 dark:text-gray-600",children:p.chat.noSessions}):s.jsxs(s.Fragment,{children:[He.slice(0,M).map(re=>{const ke=F.has(re.key),Me=Nv(re.sessions),Te=Ge.get(re.key),$e=[...new Set(re.sessions.map(Xe=>Xe.agentId))],Ve=Xe=>[...new Set([...Te?.agents[Xe]??[],...$e])];return s.jsxs("div",{className:"pt-2.5",children:[s.jsx(Vu,{open:!ke,onToggle:()=>ve(re.key),icon:s.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:s.jsx(xa,{d:ke?Cp:Ek,size:15})}),label:re.temp?p.chat.tempWorkspaces:re.label,count:Math.max(Te?.totals.active??0,Me.active.length),...re.fullPath!==null?{title:re.fullPath}:{}}),ke?null:me(re.key,re.sessions,!0,Te?.totals,Ve,p.chat.noSessions)]},re.key)}),He.length>M&&s.jsx(Xl,{label:p.chat.moreGroups(He.length-M),onClick:()=>L(re=>re+go),className:"mt-1"})]})]}),s.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:w&&Ne?s.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("p",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:ae(w.sessionId,w.title)}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[s.jsx("span",{className:"mr-1 text-xs text-gray-400",children:p.traces.filesTitle}),(Ae??w.files).map(re=>s.jsxs("button",{type:"button",onClick:()=>E(re.index),title:`${re.date} · ${_o(re.sizeBytes)}`,className:`rounded-md border px-2 py-0.5 font-mono text-xs transition-colors duration-150 ${re.index===Ne.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(re.index).padStart(3,"0")]},re.index)),Ae!==null&&w.files.length>jh&&s.jsxs("button",{type:"button",title:p.chat.loadMore,"aria-label":p.chat.loadMore,onClick:()=>N(!0),className:"rounded-md border border-gray-200 px-2 py-0.5 font-mono 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:["+",w.files.length-jh]})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("p",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-400",children:[Ne.date," · ",_o(Ne.sizeBytes)]}),s.jsxs("a",{href:TN(c,w.agentId,w.sessionId,Ne.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:[s.jsx(Uk,{size:12}),p.traces.exportFile]})]}),s.jsx(QO,{projectId:c,agentId:w.agentId,sessionId:w.sessionId,index:Ne.index,highlight:_,onHighlight:R})]}):s.jsx(hr,{title:p.traces.selectSession})}),s.jsx(ln,{open:$,title:p.traces.importTrace,onClose:()=>q(!1),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(Pr,{label:p.traces.importAgent,value:U,onChange:re=>V(re.target.value),children:n.map(re=>s.jsx("option",{value:re.agentId,children:Gt(re)},re.agentId))}),s.jsx("div",{className:"flex justify-end",children:s.jsxs("label",{className:"inline-flex cursor-pointer items-center justify-center gap-1 rounded-md border border-[var(--accent-bg)] bg-[var(--accent-bg)] px-3 py-1.5 text-sm font-medium text-[var(--accent-fg)] transition-opacity hover:opacity-90",children:[s.jsx(Cd,{accept:".jsonl",onChange:tn}),s.jsx(p1,{size:14}),p.traces.importPickFile]})})]})})]})}function vS(e){return e.map(n=>typeof n.score=="number"&&Number.isFinite(n.score)?n.score:null)}const Du=0,zu=100,Tv=10,eD=[1,2,2.5,5,10,20];function tD(e){const n=e.filter(g=>g!==null&&g>=Du&&g<=zu);if(n.length===0)return{min:Du,max:zu,ticks:[0,20,40,60,80,100]};const r=Math.min(...n),l=Math.max(...n),o=Math.max(Du,r-Tv),c=Math.min(zu,l+Tv),d=eD.find(g=>(c-o)/g<=5),f=Math.max(Du,Math.floor(o/d)*d),m=Math.min(zu,Math.ceil(c/d)*d),h=Array.from({length:Math.round((m-f)/d)+1},(g,y)=>f+y*d);return{min:f,max:m,ticks:h}}function nD(e){const n=[];let r=[];return e.forEach((l,o)=>{if(l===null){r.length>0&&n.push(r),r=[];return}r.push({index:o,value:l})}),r.length>0&&n.push(r),n}function aD(e){const n=new Map;e.forEach((l,o)=>{const c=l.modelId!==void 0&&l.modelId!=="",d=c?`${l.modelId}\0${l.thinkingLevel??""}`:"";let f=n.get(d);f||(f={key:d,...c&&l.modelId!==void 0?{modelId:l.modelId}:{},...c&&l.thinkingLevel!==void 0?{thinkingLevel:l.thinkingLevel}:{},indices:[]},n.set(d,f)),f.indices.push(o)});const r=[...n.values()];return[...r.filter(l=>l.key!==""),...r.filter(l=>l.key==="")]}function rD(e,n){const r=new Set(n.indices);return vS(e).map((l,o)=>r.has(o)?l:null)}const sD=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"]),lD=new Set(["png","jpg","jpeg","gif","webp"]),Mv=/^[a-z][a-z0-9+.-]*:/i,iD=64*1024;function kS(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function Ev(e,n){return e===""?n:`${e}/${n}`}function Av(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}function Rv(e,n){const r=n.startsWith("/")||e===""?[]:e.split("/");for(const l of n.split("/"))l===""||l==="."||(l===".."?r.pop():r.push(l));return r.join("/")}function oD(e){const n=kS(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 Iv({projectId:e,agentId:n,benchmarkId:r,caseSummary:l,material:o,label:c,hiddenLabel:d,defaultOpen:f=!1,onPreview:m}){const[h,g]=b.useState(f),[y,k]=b.useState(""),[w,S]=b.useState(null),[T,E]=b.useState(null),M=b.useRef(!1);b.useEffect(()=>{if(!h)return;S(null),E(null);let P=!1;return PN(e,n,r,l.id,y,o).then(H=>{if(!P&&(S(H),y===""&&!M.current)){M.current=!0;const I=H.entries.find(F=>F.kind==="file"&&F.name.toLowerCase()==="readme.md");I&&m(o,I.name)}}).catch(H=>{P||E(_e(H))}),()=>{P=!0}},[e,n,r,l.id,o,m,h,y]);const L=y===""?[]:y.split("/"),O=P=>{if(P.kind==="dir"){k(Ev(y,P.name));return}m(o,Ev(y,P.name))};return s.jsxs("div",{className:"border-b border-gray-200 last:border-b-0 dark:border-gray-800",children:[s.jsxs("button",{type:"button","aria-expanded":h,onClick:()=>g(P=>!P),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-800/60",children:[s.jsx("span",{className:"text-xs text-gray-400",children:h?"▾":"▸"}),s.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:c}),d&&s.jsx("span",{className:"shrink-0 rounded bg-gray-200/70 px-1.5 py-0.5 text-[10px] text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:d})]}),h&&s.jsxs("div",{children:[L.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-t border-gray-100 px-5 py-1.5 dark:border-gray-800/70",children:[s.jsx("button",{type:"button",onClick:()=>k(""),className:"rounded px-1 py-0.5 text-xs text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",children:c}),L.map((P,H)=>s.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[s.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),s.jsx("button",{type:"button",onClick:()=>k(L.slice(0,H+1).join("/")),className:"max-w-24 truncate rounded px-1 py-0.5 text-xs text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",children:P})]},`${P}-${H}`))]}),T&&s.jsx("p",{className:"px-6 py-2 text-xs text-red-500",children:T}),!w&&!T&&s.jsx(ba,{rows:3}),w?.entries.length===0&&s.jsx("p",{className:"px-6 py-2 text-xs text-gray-400",children:p.files.empty}),w?.entries.map(P=>s.jsxs("button",{type:"button",onClick:()=>O(P),className:"flex w-full items-center gap-2 border-t border-gray-100 px-6 py-2 text-left hover:bg-gray-100 dark:border-gray-800/70 dark:hover:bg-gray-800/60",children:[s.jsx("span",{className:"text-sm text-gray-400",children:P.kind==="dir"?"▸":"·"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:P.name}),P.kind==="file"&&s.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:_o(P.sizeBytes)})]},`${P.kind}/${P.name}`))]})]})}function cD({projectId:e,agentId:n,benchmarkId:r,caseSummary:l}){const[o,c]=b.useState(null),d=b.useRef(0),f=b.useCallback((k,w,S)=>FN(e,n,r,l.id,w,k,S),[e,n,r,l.id]),m=b.useCallback(async(k,w)=>{const S=++d.current,T=w.includes("/")?w.slice(w.lastIndexOf("/")+1):w,E=kS(T);if(lD.has(E)){c({material:k,path:w,name:T,kind:"image"});return}if(E==="pdf"){c({material:k,path:w,name:T,kind:"pdf"});return}const M=E==="md";if(!sD.has(E)){c({material:k,path:w,name:T,kind:"unsupported"});return}c({material:k,path:w,name:T,kind:M?"md":"text",loading:!0});try{const L=await fetch(f(k,w,{preview:!0}),{credentials:"same-origin"});if(!L.ok)throw new Error(String(L.status));const O=await L.text();if(S!==d.current)return;c({material:k,path:w,name:T,kind:M?"md":"text",content:O,truncated:L.headers.get("x-content-truncated")==="1"})}catch(L){if(S!==d.current)return;c({material:k,path:w,name:T,kind:M?"md":"text",error:_e(L)})}},[f]),h=o?f(o.material,o.path,{download:!0}):null,g=o?.material==="rubric"?p.benchmark.rubric:p.benchmark.taskMaterials,y={img:({src:k,alt:w})=>s.jsx("img",{src:typeof k=="string"&&!Mv.test(k)?f(o?.material??"statement",Rv(Av(o?.path??""),k)):k,alt:w??"",loading:"lazy",className:"max-w-full"}),a:({href:k,children:w})=>{if(typeof k!="string"||k.startsWith("#"))return s.jsx("a",{href:k,children:w});if(Mv.test(k))return s.jsx("a",{href:k,target:"_blank",rel:"noreferrer",children:w});const S=Rv(Av(o?.path??""),k),T=o?.material??"statement";return s.jsx("a",{href:f(T,S),onClick:E=>{E.preventDefault(),m(T,S)},children:w})}};return s.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:[s.jsx("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:s.jsxs("div",{className:"max-h-44 overflow-y-auto md:max-h-[53vh]",children:[s.jsx(Iv,{projectId:e,agentId:n,benchmarkId:r,caseSummary:l,material:"statement",label:p.benchmark.taskMaterials,defaultOpen:!0,onPreview:m}),s.jsx(Iv,{projectId:e,agentId:n,benchmarkId:r,caseSummary:l,material:"rubric",label:p.benchmark.rubric,hiddenLabel:p.benchmark.agentHidden,onPreview:m})]})}),s.jsxs("section",{className:"min-w-0",children:[s.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:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx("p",{className:"truncate font-mono text-xs text-gray-500",children:o?`${g} / ${o.path}`:l.id})}),h&&o&&s.jsx("a",{href:h,download:o.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:p.files.download})]}),s.jsx("div",{className:"max-h-[52vh] min-h-[52vh] overflow-auto p-3",children:o?o.loading?s.jsx(ba,{rows:8}):o.error?s.jsx("p",{className:"text-sm text-red-500",children:o.error}):o.kind==="image"?s.jsx("img",{src:f(o.material,o.path),alt:o.name,loading:"lazy",className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):o.kind==="pdf"?s.jsx("iframe",{src:f(o.material,o.path),title:o.name,className:"h-[50vh] w-full rounded-md border border-gray-200 dark:border-gray-800"}):o.kind==="md"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"md-body text-sm text-gray-800 dark:text-gray-100",children:s.jsx(Xo,{remarkPlugins:[Zo],components:y,children:o.content??""})}),o.truncated&&s.jsx("p",{className:"mt-2 text-xs text-gray-400",children:p.files.previewTruncated})]}):o.kind==="text"?s.jsxs(s.Fragment,{children:[s.jsx(tg,{language:oD(o.name),code:o.content??"",highlight:(o.content?.length??0)<=iD}),o.truncated&&s.jsx("p",{className:"mt-2 text-xs text-gray-400",children:p.files.previewTruncated})]}):s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:p.files.previewUnsupported}):s.jsx("p",{className:"text-sm text-gray-400",children:p.benchmark.caseFileUnavailable})})]})]})}function uD({projectId:e,agentId:n,name:r,defaultOpen:l,selection:o,onSelect:c}){const[d,f]=b.useState(l),[m,h]=b.useState(null),[g,y]=b.useState(null);return b.useEffect(()=>{!d||m||BN(e,n).then(k=>h(k.benchmarks)).catch(k=>y(_e(k)))},[d,m,e,n]),s.jsxs("li",{className:"pt-2.5",children:[s.jsx("div",{className:"flex items-center px-1 pb-0.5",children:s.jsxs("button",{type:"button",onClick:()=>f(k=>!k),"aria-label":d?p.nav.collapseGroup:p.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:[s.jsx(na,{id:n,name:r,size:18,className:"shrink-0 rounded"}),s.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),s.jsx(ra,{open:d,size:12,className:"text-gray-400"}),s.jsx("span",{className:"min-w-0 flex-1"})]})}),d&&s.jsxs("div",{className:"anim-fade",children:[g&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:g}),!m&&!g&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:p.common.loading}),m&&m.length===0&&s.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:p.benchmark.emptyAgent}),s.jsx("ul",{className:"space-y-0.5",children:m?.map(k=>{const w=o?.agentId===n&&o.benchmark.id===k.id;return s.jsx("li",{children:s.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:[s.jsx(pd,{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"}`}),s.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:k.caseCount})]})},k.id)})})]})]})}function dD({evaluations:e,series:n}){const[r,l]=b.useState(null),[o,c]=ig(),d=vS(e),f=tD(d),m=uS(e.length,f.min,f.max,c),h=e.map(g=>wa(g.time));return s.jsx("div",{ref:o,children:c>0&&s.jsx(og,{geom:m,fmtY:Io,dates:h,hover:r,onHover:l,yTicks:f.ticks,bubble:g=>{const y=e[g],k=d[g]??null;return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-gray-400",children:wa(y.time)}),s.jsxs("p",{className:"font-mono",children:[k===null?"—":Io(k),y.version!==void 0&&s.jsxs("span",{className:"ml-1.5 text-gray-400",children:["v",y.version]})]}),s.jsxs("p",{className:"font-mono text-gray-400",children:[y.modelId," · ",y.thinkingLevel]})]})},children:n.map((g,y)=>{const k=nD(rD(e,g));return s.jsx("g",{className:g.modelId?fS(y).text:"text-gray-400 dark:text-gray-500",children:k.map((w,S)=>{const T=w.map((E,M)=>`${M===0?"M":"L"}${m.x(E.index)},${m.y(E.value)}`).join(" ");return s.jsxs("g",{children:[w.length>1&&s.jsx("path",{d:T,fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),w.map(E=>s.jsx("circle",{cx:m.x(E.index),cy:m.y(E.value),r:r===E.index?4:2.5,className:"fill-current",opacity:r!==null&&r!==E.index?.25:1},E.index))]},S)})},g.key===""?"unlabeled":g.key)})})})}function fD({evaluations:e}){const n=aD(e),r=l=>l.modelId?l.thinkingLevel?`${l.modelId} · ${l.thinkingLevel}`:l.modelId:p.benchmark.legendUnlabeled;return s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:p.benchmark.trendTitle(p.benchmark.colScore)}),n.length>=2&&s.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1",children:n.map((l,o)=>s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400",children:[s.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${l.modelId?fS(o).swatch:"bg-gray-400 dark:bg-gray-500"}`}),s.jsx("span",{className:"font-mono",children:r(l)})]},l.key===""?"unlabeled":l.key))}),s.jsx(dD,{evaluations:e,series:n})]})}const Zs="px-3 py-2";function mD({agentId:e,evaluation:n,caseTitles:r,onOpenCase:l,currency:o}){const[c,d]=b.useState(!1);return s.jsxs(s.Fragment,{children:[s.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:[s.jsx("td",{className:Zs,children:s.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[s.jsx(ra,{open:c,size:12,className:"text-gray-400"}),wa(n.time)]})}),s.jsx("td",{className:`${Zs} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.version!==void 0?`v${n.version}`:"—"}),s.jsx("td",{className:`${Zs} max-w-40 truncate font-mono text-xs text-gray-500 dark:text-gray-400`,title:n.provider,children:n.modelId}),s.jsx("td",{className:`${Zs} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.thinkingLevel}),s.jsx("td",{className:`${Zs} font-mono text-xs font-semibold tabular-nums`,children:Io(n.score)}),s.jsx("td",{className:`${Zs} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:er(n.cost,o)}),s.jsx("td",{className:`${Zs} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:n.durationMs!==void 0?Mn(n.durationMs):"—"})]}),c&&s.jsx("tr",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800/60",children:s.jsxs("td",{colSpan:7,className:"bg-gray-50/80 px-3 py-2 dark:bg-gray-950/40",children:[(n.summaryTitle||n.summary)&&s.jsxs("div",{className:"mb-2",children:[n.summaryTitle?s.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:n.summaryTitle}):s.jsx("p",{className:"text-xs font-semibold text-gray-500",children:p.benchmark.summaryLabel}),n.summary&&s.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-xs text-gray-600 dark:text-gray-300",children:n.summary})]}),s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-500",children:[s.jsx("th",{className:"px-2 py-1 font-medium",children:p.benchmark.colCase}),s.jsx("th",{className:"px-2 py-1 font-medium",children:p.benchmark.colScore}),s.jsx("th",{className:"px-2 py-1 font-medium",children:p.common.cost}),s.jsx("th",{className:"px-2 py-1 font-medium",children:p.benchmark.colDuration}),s.jsx("th",{className:"px-2 py-1 font-medium",children:p.benchmark.colSession})]})}),s.jsx("tbody",{children:n.cases.map(f=>s.jsx(pD,{agentId:e,caseScore:f,title:r.get(f.case),onOpenCase:r.has(f.case)?l:void 0,currency:o},f.case))})]})]})})]})}function hD({agentId:e,sessionId:n}){return n?s.jsx(jp,{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}):s.jsx("span",{className:"text-gray-400",children:"—"})}function pD({agentId:e,caseScore:n,title:r,onOpenCase:l,currency:o}){const[c,d]=b.useState(!1),f=n.runs;return s.jsxs(s.Fragment,{children:[s.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:[s.jsx("td",{className:"px-2 py-1",children:s.jsxs("span",{className:"flex items-start gap-1.5",children:[s.jsx(ra,{open:c,size:12,className:"text-gray-400"}),s.jsxs("span",{className:"min-w-0",children:[l?s.jsx("button",{type:"button",className:"block text-left font-medium text-gray-800 hover:underline dark:text-gray-200",onClick:m=>{m.stopPropagation(),l(n.case)},children:r??n.case}):s.jsx("span",{className:"block font-medium text-gray-800 dark:text-gray-200",children:r??n.case}),r&&r!==n.case&&s.jsx("span",{className:"block font-mono text-[11px] text-gray-400",children:n.case})]})]})}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Io(n.score)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:er(n.cost,o)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:n.durationMs!==void 0?Mn(n.durationMs):"—"}),s.jsx("td",{className:"px-2 py-1",children:s.jsx("span",{className:"text-gray-400",children:"—"})})]}),c&&f.map((m,h)=>s.jsxs("tr",{className:"text-xs text-gray-500 dark:text-gray-400",children:[s.jsxs("td",{className:"py-1 pl-7 pr-2 font-mono",children:[p.benchmark.colRun," #",h+1]}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Io(m.score)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:er(m.cost,o)}),s.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:m.durationMs!==void 0?Mn(m.durationMs):"—"}),s.jsx("td",{className:"px-2 py-1",children:s.jsx(hD,{agentId:e,...m.sessionId?{sessionId:m.sessionId}:{}})})]},h))]})}function gD({cases:e,error:n,onOpenCase:r}){return s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:p.benchmark.cases}),s.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[n&&s.jsx("p",{className:"px-3 py-2 text-xs text-red-500",children:n}),!e&&!n&&s.jsx("p",{className:"px-3 py-2 text-xs text-gray-400",children:p.common.loading}),e?.map(l=>s.jsxs("button",{type:"button",onClick:()=>r(l.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:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block text-sm font-medium text-gray-800 dark:text-gray-200",children:l.title}),s.jsx("span",{className:"block truncate font-mono text-[11px] text-gray-400",children:l.id})]}),s.jsx("span",{className:"shrink-0 rounded-md px-2.5 py-1 text-xs font-medium text-gray-600 dark:text-gray-300",children:p.benchmark.viewCase})]},l.id))]})]})}function xD(){gr(p.benchmark.title);const{currentProject:e,agents:n,agentsLoading:r}=on(),{currency:l}=Cs(),o=e?.projectId??null,[c]=hd(),d=c.get("agentId"),[f,m]=b.useState(null),[h,g]=b.useState(null),[y,k]=b.useState(null),[w,S]=b.useState(null);if(b.useEffect(()=>{m(null)},[o]),b.useEffect(()=>{if(g(null),k(null),S(null),!o||!f)return;let O=!1;return HN(o,f.agentId,f.benchmark.id).then(P=>{O||g(P.cases)}).catch(P=>{O||k(_e(P))}),()=>{O=!0}},[o,f]),!o)return null;const T=f?.benchmark??null,E=T?[...T.evaluations]:[],M=new Map(h?.map(O=>[O.id,O.title])??[]),L=h?.find(O=>O.id===w)??null;return s.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[s.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:[s.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:p.benchmark.title}),r?s.jsx(ba,{rows:4}):s.jsx("ul",{children:n.map(O=>s.jsx(uD,{projectId:o,agentId:O.agentId,name:Gt(O),defaultOpen:d===null||d===O.agentId,selection:f,onSelect:m},O.agentId))})]}),s.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:f&&T?s.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[s.jsx("h1",{className:"min-w-0 truncate text-lg font-semibold",children:T.title}),s.jsx("span",{className:"text-xs text-gray-500",children:p.benchmark.caseCount(T.caseCount)})]}),T.description&&s.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:T.description})]}),s.jsx(gD,{cases:h,error:y,onOpenCase:S}),E.length===0?s.jsx(hr,{title:p.benchmark.noEvaluations}):s.jsxs(s.Fragment,{children:[s.jsx(fD,{evaluations:E}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:p.benchmark.evaluations}),s.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:s.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[s.jsx("thead",{children:s.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:[s.jsx("th",{className:"px-3 py-2.5",children:p.common.time}),s.jsx("th",{className:"px-3 py-2.5",children:p.benchmark.colVersion}),s.jsx("th",{className:"px-3 py-2.5",children:p.benchmark.colModel}),s.jsx("th",{className:"px-3 py-2.5",children:p.benchmark.colThinkingLevel}),s.jsx("th",{className:"px-3 py-2.5",children:p.benchmark.colScore}),s.jsx("th",{className:"px-3 py-2.5",children:p.common.cost}),s.jsx("th",{className:"px-3 py-2.5",children:p.benchmark.colDuration})]})}),s.jsx("tbody",{children:[...E].reverse().map((O,P)=>s.jsx(mD,{agentId:f.agentId,evaluation:O,caseTitles:M,onOpenCase:S,currency:l},P))})]})})]})]}),L&&s.jsx(ln,{open:!0,title:L.title,widthClass:"sm:max-w-6xl",onClose:()=>S(null),children:s.jsx(cD,{projectId:o,agentId:f.agentId,benchmarkId:T.id,caseSummary:L})})]},`${f.agentId}/${T.id}`):s.jsx(hr,{title:p.benchmark.selectBenchmark})})]})}function yD(){gr(p.admin.users);const{user:e}=Ln(),[n,r]=b.useState(null),[l,o]=b.useState(null),[c,d]=b.useState(!1),[f,m]=b.useState(null),[h,g]=b.useState(null),y=b.useCallback(async()=>{try{r((await eN()).users),o(null)}catch(k){o(_e(k))}},[]);return b.useEffect(()=>{e?.isAdmin&&y()},[e?.isAdmin,y]),e&&!e.isAdmin?s.jsx(Ro,{to:"/chat",replace:!0}):s.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[s.jsxs("div",{className:"mx-auto max-w-3xl",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("h1",{className:"text-xl font-semibold",children:p.admin.users}),s.jsx(we,{variant:"primary",onClick:()=>d(!0),children:p.admin.createUser})]}),n===null?s.jsx("p",{className:"text-sm text-gray-400",children:p.common.loading}):s.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.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:[s.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:p.common.username}),s.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:p.common.role}),s.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:p.common.created}),s.jsx("th",{className:"whitespace-nowrap px-3 py-2 text-right font-medium",children:p.common.actions})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:n.map(k=>s.jsxs("tr",{children:[s.jsxs("td",{className:"whitespace-nowrap px-3 py-2 font-medium",children:[k.userId,k.passwordIsInitial&&s.jsx("span",{className:"ml-2 align-middle",children:s.jsx(sn,{tone:"gray",children:p.admin.initialPasswordFlag})})]}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:s.jsx(sn,{tone:"gray",children:k.isAdmin?p.admin.roleAdmin:p.admin.roleUser})}),s.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-gray-500 dark:text-gray-400",children:wa(k.createdAt)}),s.jsxs("td",{className:"whitespace-nowrap px-3 py-1.5 text-right",children:[s.jsx(we,{size:"sm",variant:"ghost",onClick:()=>m(k),children:p.admin.resetPassword}),!k.isAdmin&&s.jsx(we,{size:"sm",variant:"ghost",onClick:()=>g(k),children:p.common.delete})]})]},k.userId))})]})}),l&&s.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]}),s.jsx(bD,{open:c,onClose:()=>d(!1),onDone:()=>{d(!1),y()}}),s.jsx(vD,{user:f,onClose:()=>m(null)}),s.jsx(kD,{user:h,onClose:()=>g(null),onDone:()=>{g(null),y()}})]})}function bD({open:e,onClose:n,onDone:r}){const[l,o]=b.useState(""),[c,d]=b.useState(""),[f,m]=b.useState({}),[h,g]=b.useState(!1),y=()=>m(w=>w.userId||w.password?{}:w);b.useEffect(()=>{e&&(o(""),d(""),m({}))},[e]);const k=async()=>{const w=l.trim(),S={};if(w?Zb.test(w)||(S.userId=p.auth.usernameHint):S.userId=p.common.requiredField,c||(S.password=p.common.requiredField),S.userId||S.password){m(S);return}g(!0),m({});try{await tN({userId:w,password:c}),r()}catch(T){T instanceof ka&&T.code==="invalid_password"?m({password:_e(T)}):m({userId:_e(T)})}finally{g(!1)}};return s.jsx(ln,{open:e,title:p.admin.createUser,onClose:n,footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:n,disabled:h,children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:h,onClick:()=>{k()},children:p.common.create})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(tt,{label:p.common.username,required:!0,size:"sm",value:l,onChange:w=>{o(w.target.value),y()},error:f.userId,hint:p.auth.usernameHint,autoFocus:!0}),s.jsx(Ss,{label:p.admin.initialPassword,required:!0,size:"sm",value:c,onChange:w=>{d(w.target.value),y()},error:f.password,autoComplete:"new-password",hint:p.auth.passwordHint}),Zb.test(l.trim())&&s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:p.admin.defaultProjectNote(`${l.trim()}-default_project`)})]})})}function vD({user:e,onClose:n}){const[r,l]=b.useState(""),[o,c]=b.useState(void 0),[d,f]=b.useState(!1);b.useEffect(()=>{e&&(l(""),c(void 0))},[e]);const m=async()=>{if(e){if(!r){c(p.common.requiredField);return}f(!0),c(void 0);try{await nN(e.userId,{password:r}),n()}catch(h){c(_e(h))}finally{f(!1)}}};return s.jsx(ln,{open:e!==null,title:e?p.admin.resetPasswordTitle(e.userId):"",onClose:n,footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:n,disabled:d,children:p.common.cancel}),s.jsx(we,{variant:"primary",disabled:d,onClick:()=>{m()},children:p.common.save})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ss,{label:p.admin.initialPassword,required:!0,size:"sm",value:r,onChange:h=>{l(h.target.value),c(void 0)},error:o,autoComplete:"new-password",hint:p.auth.passwordHint,autoFocus:!0}),s.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:p.admin.resetPasswordNote})]})})}function kD({user:e,onClose:n,onDone:r}){const[l,o]=b.useState(!1),[c,d]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(o(!1),d(null))},[e]);const h=async()=>{if(e){m(!0),d(null);try{await aN(e.userId),r()}catch(g){d(_e(g))}finally{m(!1)}}};return s.jsx(ln,{open:e!==null,title:e?p.admin.deleteUserTitle(e.userId):"",onClose:n,footer:s.jsxs(s.Fragment,{children:[s.jsx(we,{onClick:n,disabled:f,children:p.common.cancel}),l?s.jsx(we,{variant:"danger",disabled:f,onClick:()=>{h()},children:p.common.confirm}):s.jsx(we,{variant:"danger",onClick:()=>o(!0),children:p.common.delete})]}),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:e?p.admin.deleteUserConfirm(e.userId):""}),c&&s.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:c})]})})}function wD(){const{user:e}=Ln();return e===void 0?null:e===null?s.jsx(Ro,{to:"/login",replace:!0}):s.jsx(L4,{children:s.jsx(H4,{children:s.jsx(VL,{})})})}function SD(){const{user:e}=Ln();return e?s.jsx(Ro,{to:"/chat",replace:!0}):s.jsx(e7,{})}function jD(){return s.jsx(N4,{children:s.jsxs(JC,{children:[s.jsx(Jn,{path:"/login",element:s.jsx(SD,{})}),s.jsxs(Jn,{element:s.jsx(wD,{}),children:[s.jsx(Jn,{index:!0,element:s.jsx(Ro,{to:"/chat",replace:!0})}),s.jsx(Jn,{path:"/chat/:sessionId?",element:s.jsx(SL,{})}),s.jsx(Jn,{path:"/agents",element:s.jsx(a7,{})}),s.jsx(Jn,{path:"/agents/:agentId",element:s.jsx(k7,{})}),s.jsx(Jn,{path:"/skills",element:s.jsx(A7,{})}),s.jsx(Jn,{path:"/models",element:s.jsx(W7,{})}),s.jsx(Jn,{path:"/usage",element:s.jsx(MO,{})}),s.jsx(Jn,{path:"/traces",element:s.jsx(JO,{})}),s.jsx(Jn,{path:"/benchmark",element:s.jsx(xD,{})}),s.jsx(Jn,{path:"/admin/users",element:s.jsx(yD,{})}),s.jsx(Jn,{path:"*",element:s.jsx(Ro,{to:"/chat",replace:!0})})]})]})})}function ND(){return s.jsx(B5,{children:s.jsx(K5,{children:s.jsx(KN,{children:s.jsxs(H5,{children:[s.jsx(jD,{}),s.jsx(Z4,{})]})})})})}const wS=document.getElementById("root");if(!wS)throw new Error("#root mount point not found");_5.createRoot(wS).render(s.jsx(b.StrictMode,{children:s.jsx(ND,{})}));export{k8 as _,Q3 as a,fT as b,ib as c,oT as f,dT as h,Up as s,tT as w};
|