@cnrai/pave 0.11.108 → 0.11.109
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/package.json +1 -1
- package/pave.js +2 -2
- package/web/assets/{abnfDiagram-VCTEODGH-C7FOL3-u.js → abnfDiagram-VCTEODGH-CC-xFYNg.js} +1 -1
- package/web/assets/{arc-BRc5A1yw.js → arc-BcCUbsSP.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-D3BcYg2r.js → architectureDiagram-5GKGNRK7-CyQSqHig.js} +1 -1
- package/web/assets/{blockDiagram-I7D4REHJ-CF_-iaun.js → blockDiagram-I7D4REHJ-CJ91dcD6.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-zhW2gHSL.js → c4Diagram-7LVT6UL2-D_-X7Yjr.js} +1 -1
- package/web/assets/channel-CEjU4fDa.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-DY7QZMMo.js → chunk-2Q5K7J3B-C6gOro1m.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-3I_pofP_.js → chunk-5VM5RSS4-CGRJglaM.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-D5u5N7KW.js → chunk-F27PBJKO-UOTghLZP.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-BfbbGVlB.js → chunk-IMKFNOWR-C0b-G0_V.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-io3vEm5B.js → chunk-JWPE2WC7-Di_kgSVz.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-Bf6OrRZ9.js → chunk-POPQ4Y6H-C4nqNNN7.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-BOXaKiCJ.js → chunk-SVP7TREG-DU6uDevm.js} +1 -1
- package/web/assets/{chunk-TICWLB2K-B60vk_SL.js → chunk-TICWLB2K-4vOTFWBb.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-DQB-D5Kw.js → chunk-XXDRQBXY-DTOcYtq8.js} +1 -1
- package/web/assets/classDiagram-ZZMXUADV-E-NgWlu-.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-E-NgWlu-.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-bfMKYaaU.js → cose-bilkent-JH36ORCC-CdWw2GLP.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-CzRtRY7-.js → cynefin-OW5HDTMX-Blt6fqKS.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-CUMCB_Zy.js → cynefinDiagram-5FMLGOSQ-D9qoRKTN.js} +1 -1
- package/web/assets/{dagre-GXQ25YYZ-BvEOwwtY.js → dagre-GXQ25YYZ-CC-1na9O.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-DQemhM43.js → diagram-S7CK7UJ4-Df-CWY8A.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-sc4h0Qsv.js → diagram-UQ7AKVKN-aW8Ek_JV.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-BBwa4wEL.js → diagram-VSXAHHWV-B6xr9JII.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-UuCdZHOf.js → diagram-VX7I27RA-DWIu_d6p.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-BktpqFre.js → diagram-Z3DM3KII-EXgUmMTe.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-CacOYoaf.js → ebnfDiagram-PWID7BFC-CBOMqJHL.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-CmmKnMIP.js → erDiagram-RLTQ6QDP-BF3gbnFL.js} +1 -1
- package/web/assets/{flowDiagram-HODETNUW-evvyUXb_.js → flowDiagram-HODETNUW-7J0X-4Nv.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-dWUFeIWw.js → ganttDiagram-EL5Y4UJY-BpmyN_um.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-By-K_SPc.js → gitGraphDiagram-WWUBYQGX-DIRj87w-.js} +1 -1
- package/web/assets/index-CXCEwDUr.js +130 -0
- package/web/assets/index-Dnk1ymJh.css +10 -0
- package/web/assets/{infoDiagram-27XIBGKW-BP3Wh-VS.js → infoDiagram-27XIBGKW-DtRkk-vx.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-DGuSWCyR.js → ishikawaDiagram-5VMMS53U-BIgfj1dB.js} +1 -1
- package/web/assets/{journeyDiagram-3NMN7TZE-DNp0ft2I.js → journeyDiagram-3NMN7TZE-DMq06vMx.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-CzCZvBfP.js → kanban-definition-UXKFOSKX-BkqsW8j9.js} +1 -1
- package/web/assets/{layout-9WDlxMrA.js → layout-981Tzerw.js} +1 -1
- package/web/assets/{linear-CZP__jeZ.js → linear-4S4e-iAF.js} +1 -1
- package/web/assets/{mermaid.core-Cx9gMKa8.js → mermaid.core-DMFcbM4K.js} +5 -5
- package/web/assets/{mindmap-definition-YA3MSWOX-BtEk9JE9.js → mindmap-definition-YA3MSWOX-D8ZZIE_M.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-BJP2ukXu.js → pegDiagram-XKGWAZYB-B8laLHQf.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-Dn4m8Ddk.js → pieDiagram-E7YTZNPT-BRvCWlLN.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-DT1B_hW-.js → quadrantDiagram-AXDQQJYC-CN57k84W.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-_onKS9cV.js → railroadDiagram-O6MQD6OU-DlW8247Y.js} +1 -1
- package/web/assets/{requirementDiagram-BXWQKSXE-nm1t_F4E.js → requirementDiagram-BXWQKSXE-lt5wlCYl.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-CVEAGkS-.js → sankeyDiagram-P5KCCOFB-C_RfLG0h.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-ZfkSEG_C.js → sequenceDiagram-WJ2MYXX4-xYFGXmlV.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-BHhMi6Lx.js → sizeCapture-INFHLROL-ClbfSNGT.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-BmkZMrir.js → stateDiagram-D77RDMKH-D-js6COB.js} +1 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-DGfvbiyu.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-Dl_7Ltat.js → swimlanes-42K2YHIH-DFWAuiLv.js} +1 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-B0BGIkSi.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-C7dD_6nn.js → timeline-definition-24CTP7MA-BxiETTFR.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-D0DPqLIf.js → vennDiagram-4TSXK5OY-DH4jDRVe.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-Bq7v6XT1.js → wardleyDiagram-VM6X3IG4-Dnf37haz.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-By7o4pD7.js → xychartDiagram-S5SC5T6Z-JHevdcLS.js} +1 -1
- package/web/assets/{zh-TW-CoR3jQfM.js → zh-TW-BuoM8LhP.js} +1 -1
- package/web/fonts/OFL.txt +92 -0
- package/web/fonts/inter-var-latin.woff2 +0 -0
- package/web/index.html +2 -2
- package/web/assets/channel-B9jLDYtV.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-DEWInF6E.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-DEWInF6E.js +0 -1
- package/web/assets/index-B87hi2au.js +0 -130
- package/web/assets/index-X3umQNqs.css +0 -10
- package/web/assets/stateDiagram-v2-MP3YSRHH-BgI6gtUp.js +0 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-CCIza_Fw.js +0 -8
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var Sd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dp={exports:{}},_c={},fp={exports:{}},fr={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var r_;function fI(){if(r_)return fr;r_=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),h=Symbol.iterator;function m(U){return U===null||typeof U!="object"?null:(U=h&&U[h]||U["@@iterator"],typeof U=="function"?U:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,k={};function _(U,Z,P){this.props=U,this.context=Z,this.refs=k,this.updater=P||y}_.prototype.isReactComponent={},_.prototype.setState=function(U,Z){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,Z,"setState")},_.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function w(){}w.prototype=_.prototype;function S(U,Z,P){this.props=U,this.context=Z,this.refs=k,this.updater=P||y}var E=S.prototype=new w;E.constructor=S,v(E,_.prototype),E.isPureReactComponent=!0;var A=Array.isArray,T=Object.prototype.hasOwnProperty,C={current:null},j={key:!0,ref:!0,__self:!0,__source:!0};function L(U,Z,P){var K,V={},W=null,ae=null;if(Z!=null)for(K in Z.ref!==void 0&&(ae=Z.ref),Z.key!==void 0&&(W=""+Z.key),Z)T.call(Z,K)&&!j.hasOwnProperty(K)&&(V[K]=Z[K]);var Q=arguments.length-2;if(Q===1)V.children=P;else if(1<Q){for(var he=Array(Q),Ne=0;Ne<Q;Ne++)he[Ne]=arguments[Ne+2];V.children=he}if(U&&U.defaultProps)for(K in Q=U.defaultProps,Q)V[K]===void 0&&(V[K]=Q[K]);return{$$typeof:e,type:U,key:W,ref:ae,props:V,_owner:C.current}}function O(U,Z){return{$$typeof:e,type:U.type,key:Z,ref:U.ref,props:U.props,_owner:U._owner}}function I(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function B(U){var Z={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(P){return Z[P]})}var z=/\/+/g;function ee(U,Z){return typeof U=="object"&&U!==null&&U.key!=null?B(""+U.key):Z.toString(36)}function $(U,Z,P,K,V){var W=typeof U;(W==="undefined"||W==="boolean")&&(U=null);var ae=!1;if(U===null)ae=!0;else switch(W){case"string":case"number":ae=!0;break;case"object":switch(U.$$typeof){case e:case t:ae=!0}}if(ae)return ae=U,V=V(ae),U=K===""?"."+ee(ae,0):K,A(V)?(P="",U!=null&&(P=U.replace(z,"$&/")+"/"),$(V,Z,P,"",function(Ne){return Ne})):V!=null&&(I(V)&&(V=O(V,P+(!V.key||ae&&ae.key===V.key?"":(""+V.key).replace(z,"$&/")+"/")+U)),Z.push(V)),1;if(ae=0,K=K===""?".":K+":",A(U))for(var Q=0;Q<U.length;Q++){W=U[Q];var he=K+ee(W,Q);ae+=$(W,Z,P,he,V)}else if(he=m(U),typeof he=="function")for(U=he.call(U),Q=0;!(W=U.next()).done;)W=W.value,he=K+ee(W,Q++),ae+=$(W,Z,P,he,V);else if(W==="object")throw Z=String(U),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return ae}function M(U,Z,P){if(U==null)return U;var K=[],V=0;return $(U,K,"","",function(W){return Z.call(P,W,V++)}),K}function G(U){if(U._status===-1){var Z=U._result;Z=Z(),Z.then(function(P){(U._status===0||U._status===-1)&&(U._status=1,U._result=P)},function(P){(U._status===0||U._status===-1)&&(U._status=2,U._result=P)}),U._status===-1&&(U._status=0,U._result=Z)}if(U._status===1)return U._result.default;throw U._result}var Y={current:null},X={transition:null},ie={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:X,ReactCurrentOwner:C};function F(){throw Error("act(...) is not supported in production builds of React.")}return fr.Children={map:M,forEach:function(U,Z,P){M(U,function(){Z.apply(this,arguments)},P)},count:function(U){var Z=0;return M(U,function(){Z++}),Z},toArray:function(U){return M(U,function(Z){return Z})||[]},only:function(U){if(!I(U))throw Error("React.Children.only expected to receive a single React element child.");return U}},fr.Component=_,fr.Fragment=r,fr.Profiler=i,fr.PureComponent=S,fr.StrictMode=a,fr.Suspense=d,fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ie,fr.act=F,fr.cloneElement=function(U,Z,P){if(U==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+U+".");var K=v({},U.props),V=U.key,W=U.ref,ae=U._owner;if(Z!=null){if(Z.ref!==void 0&&(W=Z.ref,ae=C.current),Z.key!==void 0&&(V=""+Z.key),U.type&&U.type.defaultProps)var Q=U.type.defaultProps;for(he in Z)T.call(Z,he)&&!j.hasOwnProperty(he)&&(K[he]=Z[he]===void 0&&Q!==void 0?Q[he]:Z[he])}var he=arguments.length-2;if(he===1)K.children=P;else if(1<he){Q=Array(he);for(var Ne=0;Ne<he;Ne++)Q[Ne]=arguments[Ne+2];K.children=Q}return{$$typeof:e,type:U.type,key:V,ref:W,props:K,_owner:ae}},fr.createContext=function(U){return U={$$typeof:l,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},U.Provider={$$typeof:o,_context:U},U.Consumer=U},fr.createElement=L,fr.createFactory=function(U){var Z=L.bind(null,U);return Z.type=U,Z},fr.createRef=function(){return{current:null}},fr.forwardRef=function(U){return{$$typeof:u,render:U}},fr.isValidElement=I,fr.lazy=function(U){return{$$typeof:g,_payload:{_status:-1,_result:U},_init:G}},fr.memo=function(U,Z){return{$$typeof:f,type:U,compare:Z===void 0?null:Z}},fr.startTransition=function(U){var Z=X.transition;X.transition={};try{U()}finally{X.transition=Z}},fr.unstable_act=F,fr.useCallback=function(U,Z){return Y.current.useCallback(U,Z)},fr.useContext=function(U){return Y.current.useContext(U)},fr.useDebugValue=function(){},fr.useDeferredValue=function(U){return Y.current.useDeferredValue(U)},fr.useEffect=function(U,Z){return Y.current.useEffect(U,Z)},fr.useId=function(){return Y.current.useId()},fr.useImperativeHandle=function(U,Z,P){return Y.current.useImperativeHandle(U,Z,P)},fr.useInsertionEffect=function(U,Z){return Y.current.useInsertionEffect(U,Z)},fr.useLayoutEffect=function(U,Z){return Y.current.useLayoutEffect(U,Z)},fr.useMemo=function(U,Z){return Y.current.useMemo(U,Z)},fr.useReducer=function(U,Z,P){return Y.current.useReducer(U,Z,P)},fr.useRef=function(U){return Y.current.useRef(U)},fr.useState=function(U){return Y.current.useState(U)},fr.useSyncExternalStore=function(U,Z,P){return Y.current.useSyncExternalStore(U,Z,P)},fr.useTransition=function(){return Y.current.useTransition()},fr.version="18.3.1",fr}var n_;function yv(){return n_||(n_=1,fp.exports=fI()),fp.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var a_;function gI(){if(a_)return _c;a_=1;var e=yv(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,f){var g,h={},m=null,y=null;f!==void 0&&(m=""+f),d.key!==void 0&&(m=""+d.key),d.ref!==void 0&&(y=d.ref);for(g in d)a.call(d,g)&&!o.hasOwnProperty(g)&&(h[g]=d[g]);if(u&&u.defaultProps)for(g in d=u.defaultProps,d)h[g]===void 0&&(h[g]=d[g]);return{$$typeof:t,type:u,key:m,ref:y,props:h,_owner:i.current}}return _c.Fragment=r,_c.jsx=l,_c.jsxs=l,_c}var i_;function pI(){return i_||(i_=1,dp.exports=gI()),dp.exports}var n=pI(),x=yv();const Mt=jo(x);var Ed={},gp={exports:{}},ya={},pp={exports:{}},hp={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var s_;function hI(){return s_||(s_=1,(function(e){function t(X,ie){var F=X.length;X.push(ie);e:for(;0<F;){var U=F-1>>>1,Z=X[U];if(0<i(Z,ie))X[U]=ie,X[F]=Z,F=U;else break e}}function r(X){return X.length===0?null:X[0]}function a(X){if(X.length===0)return null;var ie=X[0],F=X.pop();if(F!==ie){X[0]=F;e:for(var U=0,Z=X.length,P=Z>>>1;U<P;){var K=2*(U+1)-1,V=X[K],W=K+1,ae=X[W];if(0>i(V,F))W<Z&&0>i(ae,V)?(X[U]=ae,X[W]=F,U=W):(X[U]=V,X[K]=F,U=K);else if(W<Z&&0>i(ae,F))X[U]=ae,X[W]=F,U=W;else break e}}return ie}function i(X,ie){var F=X.sortIndex-ie.sortIndex;return F!==0?F:X.id-ie.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],g=1,h=null,m=3,y=!1,v=!1,k=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(X){for(var ie=r(f);ie!==null;){if(ie.callback===null)a(f);else if(ie.startTime<=X)a(f),ie.sortIndex=ie.expirationTime,t(d,ie);else break;ie=r(f)}}function A(X){if(k=!1,E(X),!v)if(r(d)!==null)v=!0,G(T);else{var ie=r(f);ie!==null&&Y(A,ie.startTime-X)}}function T(X,ie){v=!1,k&&(k=!1,w(L),L=-1),y=!0;var F=m;try{for(E(ie),h=r(d);h!==null&&(!(h.expirationTime>ie)||X&&!B());){var U=h.callback;if(typeof U=="function"){h.callback=null,m=h.priorityLevel;var Z=U(h.expirationTime<=ie);ie=e.unstable_now(),typeof Z=="function"?h.callback=Z:h===r(d)&&a(d),E(ie)}else a(d);h=r(d)}if(h!==null)var P=!0;else{var K=r(f);K!==null&&Y(A,K.startTime-ie),P=!1}return P}finally{h=null,m=F,y=!1}}var C=!1,j=null,L=-1,O=5,I=-1;function B(){return!(e.unstable_now()-I<O)}function z(){if(j!==null){var X=e.unstable_now();I=X;var ie=!0;try{ie=j(!0,X)}finally{ie?ee():(C=!1,j=null)}}else C=!1}var ee;if(typeof S=="function")ee=function(){S(z)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,M=$.port2;$.port1.onmessage=z,ee=function(){M.postMessage(null)}}else ee=function(){_(z,0)};function G(X){j=X,C||(C=!0,ee())}function Y(X,ie){L=_(function(){X(e.unstable_now())},ie)}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(X){X.callback=null},e.unstable_continueExecution=function(){v||y||(v=!0,G(T))},e.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return r(d)},e.unstable_next=function(X){switch(m){case 1:case 2:case 3:var ie=3;break;default:ie=m}var F=m;m=ie;try{return X()}finally{m=F}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,ie){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var F=m;m=X;try{return ie()}finally{m=F}},e.unstable_scheduleCallback=function(X,ie,F){var U=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?U+F:U):F=U,X){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=F+Z,X={id:g++,callback:ie,priorityLevel:X,startTime:F,expirationTime:Z,sortIndex:-1},F>U?(X.sortIndex=F,t(f,X),r(d)===null&&X===r(f)&&(k?(w(L),L=-1):k=!0,Y(A,F-U))):(X.sortIndex=Z,t(d,X),v||y||(v=!0,G(T))),X},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(X){var ie=m;return function(){var F=m;m=ie;try{return X.apply(this,arguments)}finally{m=F}}}})(hp)),hp}var o_;function mI(){return o_||(o_=1,pp.exports=hI()),pp.exports}/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var l_;function xI(){if(l_)return ya;l_=1;var e=yv(),t=mI();function r(s){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+s,p=1;p<arguments.length;p++)c+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+s+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=new Set,i={};function o(s,c){l(s,c),l(s+"Capture",c)}function l(s,c){for(i[s]=c,s=0;s<c.length;s++)a.add(c[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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]*$/,g={},h={};function m(s){return d.call(h,s)?!0:d.call(g,s)?!1:f.test(s)?h[s]=!0:(g[s]=!0,!1)}function y(s,c,p,b){if(p!==null&&p.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return b?!1:p!==null?!p.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function v(s,c,p,b){if(c===null||typeof c>"u"||y(s,c,p,b))return!0;if(b)return!1;if(p!==null)switch(p.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function k(s,c,p,b,N,R,q){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=b,this.attributeNamespace=N,this.mustUseProperty=p,this.propertyName=s,this.type=c,this.sanitizeURL=R,this.removeEmptyString=q}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){_[s]=new k(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var c=s[0];_[c]=new k(c,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){_[s]=new k(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){_[s]=new k(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){_[s]=new k(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){_[s]=new k(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){_[s]=new k(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){_[s]=new k(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){_[s]=new k(s,5,!1,s.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function S(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var c=s.replace(w,S);_[c]=new k(c,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var c=s.replace(w,S);_[c]=new k(c,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var c=s.replace(w,S);_[c]=new k(c,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){_[s]=new k(s,1,!1,s.toLowerCase(),null,!1,!1)}),_.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){_[s]=new k(s,1,!1,s.toLowerCase(),null,!0,!0)});function E(s,c,p,b){var N=_.hasOwnProperty(c)?_[c]:null;(N!==null?N.type!==0:b||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,p,N,b)&&(p=null),b||N===null?m(c)&&(p===null?s.removeAttribute(c):s.setAttribute(c,""+p)):N.mustUseProperty?s[N.propertyName]=p===null?N.type===3?!1:"":p:(c=N.attributeName,b=N.attributeNamespace,p===null?s.removeAttribute(c):(N=N.type,p=N===3||N===4&&p===!0?"":""+p,b?s.setAttributeNS(b,c,p):s.setAttribute(c,p))))}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),B=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),X=Symbol.iterator;function ie(s){return s===null||typeof s!="object"?null:(s=X&&s[X]||s["@@iterator"],typeof s=="function"?s:null)}var F=Object.assign,U;function Z(s){if(U===void 0)try{throw Error()}catch(p){var c=p.stack.trim().match(/\n( *(at )?)/);U=c&&c[1]||""}return`
|
|
34
|
-
`+U+s}var P=!1;function K(s,c){if(!s||P)return"";P=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(Re){var b=Re}Reflect.construct(s,[],c)}else{try{c.call()}catch(Re){b=Re}s.call(c.prototype)}else{try{throw Error()}catch(Re){b=Re}s()}}catch(Re){if(Re&&b&&typeof Re.stack=="string"){for(var N=Re.stack.split(`
|
|
35
|
-
`),R=b.stack.split(`
|
|
36
|
-
`),q=N.length-1,se=R.length-1;1<=q&&0<=se&&N[q]!==R[se];)se--;for(;1<=q&&0<=se;q--,se--)if(N[q]!==R[se]){if(q!==1||se!==1)do if(q--,se--,0>se||N[q]!==R[se]){var ge=`
|
|
37
|
-
`+N[q].replace(" at new "," at ");return s.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",s.displayName)),ge}while(1<=q&&0<=se);break}}}finally{P=!1,Error.prepareStackTrace=p}return(s=s?s.displayName||s.name:"")?Z(s):""}function V(s){switch(s.tag){case 5:return Z(s.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return s=K(s.type,!1),s;case 11:return s=K(s.type.render,!1),s;case 1:return s=K(s.type,!0),s;default:return""}}function W(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case C:return"Portal";case O:return"Profiler";case L:return"StrictMode";case ee:return"Suspense";case $:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case B:return(s.displayName||"Context")+".Consumer";case I:return(s._context.displayName||"Context")+".Provider";case z:var c=s.render;return s=s.displayName,s||(s=c.displayName||c.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case M:return c=s.displayName||null,c!==null?c:W(s.type)||"Memo";case G:c=s._payload,s=s._init;try{return W(s(c))}catch{}}return null}function ae(s){var c=s.type;switch(s.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=c.render,s=s.displayName||s.name||"",c.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return W(c);case 8:return c===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function Q(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function he(s){var c=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Ne(s){var c=he(s)?"checked":"value",p=Object.getOwnPropertyDescriptor(s.constructor.prototype,c),b=""+s[c];if(!s.hasOwnProperty(c)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var N=p.get,R=p.set;return Object.defineProperty(s,c,{configurable:!0,get:function(){return N.call(this)},set:function(q){b=""+q,R.call(this,q)}}),Object.defineProperty(s,c,{enumerable:p.enumerable}),{getValue:function(){return b},setValue:function(q){b=""+q},stopTracking:function(){s._valueTracker=null,delete s[c]}}}}function De(s){s._valueTracker||(s._valueTracker=Ne(s))}function Ve(s){if(!s)return!1;var c=s._valueTracker;if(!c)return!0;var p=c.getValue(),b="";return s&&(b=he(s)?s.checked?"true":"false":s.value),s=b,s!==p?(c.setValue(s),!0):!1}function at(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function lt(s,c){var p=c.checked;return F({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??s._wrapperState.initialChecked})}function Ce(s,c){var p=c.defaultValue==null?"":c.defaultValue,b=c.checked!=null?c.checked:c.defaultChecked;p=Q(c.value!=null?c.value:p),s._wrapperState={initialChecked:b,initialValue:p,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function $e(s,c){c=c.checked,c!=null&&E(s,"checked",c,!1)}function Be(s,c){$e(s,c);var p=Q(c.value),b=c.type;if(p!=null)b==="number"?(p===0&&s.value===""||s.value!=p)&&(s.value=""+p):s.value!==""+p&&(s.value=""+p);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}c.hasOwnProperty("value")?ut(s,c.type,p):c.hasOwnProperty("defaultValue")&&ut(s,c.type,Q(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(s.defaultChecked=!!c.defaultChecked)}function gt(s,c,p){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var b=c.type;if(!(b!=="submit"&&b!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+s._wrapperState.initialValue,p||c===s.value||(s.value=c),s.defaultValue=c}p=s.name,p!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,p!==""&&(s.name=p)}function ut(s,c,p){(c!=="number"||at(s.ownerDocument)!==s)&&(p==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+p&&(s.defaultValue=""+p))}var jt=Array.isArray;function Ge(s,c,p,b){if(s=s.options,c){c={};for(var N=0;N<p.length;N++)c["$"+p[N]]=!0;for(p=0;p<s.length;p++)N=c.hasOwnProperty("$"+s[p].value),s[p].selected!==N&&(s[p].selected=N),N&&b&&(s[p].defaultSelected=!0)}else{for(p=""+Q(p),c=null,N=0;N<s.length;N++){if(s[N].value===p){s[N].selected=!0,b&&(s[N].defaultSelected=!0);return}c!==null||s[N].disabled||(c=s[N])}c!==null&&(c.selected=!0)}}function we(s,c){if(c.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},c,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Ue(s,c){var p=c.value;if(p==null){if(p=c.children,c=c.defaultValue,p!=null){if(c!=null)throw Error(r(92));if(jt(p)){if(1<p.length)throw Error(r(93));p=p[0]}c=p}c==null&&(c=""),p=c}s._wrapperState={initialValue:Q(p)}}function Ae(s,c){var p=Q(c.value),b=Q(c.defaultValue);p!=null&&(p=""+p,p!==s.value&&(s.value=p),c.defaultValue==null&&s.defaultValue!==p&&(s.defaultValue=p)),b!=null&&(s.defaultValue=""+b)}function rt(s){var c=s.textContent;c===s._wrapperState.initialValue&&c!==""&&c!==null&&(s.value=c)}function fe(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(s,c){return s==null||s==="http://www.w3.org/1999/xhtml"?fe(c):s==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var ve,ye=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,p,b,N){MSApp.execUnsafeLocalFunction(function(){return s(c,p,b,N)})}:s})(function(s,c){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=c;else{for(ve=ve||document.createElement("div"),ve.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=ve.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}});function it(s,c){if(c){var p=s.firstChild;if(p&&p===s.lastChild&&p.nodeType===3){p.nodeValue=c;return}}s.textContent=c}var qe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ye=["Webkit","ms","Moz","O"];Object.keys(qe).forEach(function(s){Ye.forEach(function(c){c=c+s.charAt(0).toUpperCase()+s.substring(1),qe[c]=qe[s]})});function yt(s,c,p){return c==null||typeof c=="boolean"||c===""?"":p||typeof c!="number"||c===0||qe.hasOwnProperty(s)&&qe[s]?(""+c).trim():c+"px"}function ht(s,c){s=s.style;for(var p in c)if(c.hasOwnProperty(p)){var b=p.indexOf("--")===0,N=yt(p,c[p],b);p==="float"&&(p="cssFloat"),b?s.setProperty(p,N):s[p]=N}}var Dt=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nt(s,c){if(c){if(Dt[s]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(r(137,s));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(r(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(r(61))}if(c.style!=null&&typeof c.style!="object")throw Error(r(62))}}function Pt(s,c){if(s.indexOf("-")===-1)return typeof c.is=="string";switch(s){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 $t=null;function lr(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var pr=null,_r=null,cr=null;function ir(s){if(s=Dn(s)){if(typeof pr!="function")throw Error(r(280));var c=s.stateNode;c&&(c=Pn(c),pr(s.stateNode,s.type,c))}}function ue(s){_r?cr?cr.push(s):cr=[s]:_r=s}function Me(){if(_r){var s=_r,c=cr;if(cr=_r=null,ir(s),c)for(s=0;s<c.length;s++)ir(c[s])}}function Ke(s,c){return s(c)}function Te(){}var oe=!1;function bt(s,c,p){if(oe)return s(c,p);oe=!0;try{return Ke(s,c,p)}finally{oe=!1,(_r!==null||cr!==null)&&(Te(),Me())}}function Pe(s,c){var p=s.stateNode;if(p===null)return null;var b=Pn(p);if(b===null)return null;p=b[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(s=s.type,b=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!b;break e;default:s=!1}if(s)return null;if(p&&typeof p!="function")throw Error(r(231,c,typeof p));return p}var te=!1;if(u)try{var be={};Object.defineProperty(be,"passive",{get:function(){te=!0}}),window.addEventListener("test",be,be),window.removeEventListener("test",be,be)}catch{te=!1}function ze(s,c,p,b,N,R,q,se,ge){var Re=Array.prototype.slice.call(arguments,3);try{c.apply(p,Re)}catch(et){this.onError(et)}}var Je=!1,Bt=null,Ft=!1,Jt=null,Fe={onError:function(s){Je=!0,Bt=s}};function kt(s,c,p,b,N,R,q,se,ge){Je=!1,Bt=null,ze.apply(Fe,arguments)}function Qt(s,c,p,b,N,R,q,se,ge){if(kt.apply(this,arguments),Je){if(Je){var Re=Bt;Je=!1,Bt=null}else throw Error(r(198));Ft||(Ft=!0,Jt=Re)}}function Wr(s){var c=s,p=s;if(s.alternate)for(;c.return;)c=c.return;else{s=c;do c=s,(c.flags&4098)!==0&&(p=c.return),s=c.return;while(s)}return c.tag===3?p:null}function ln(s){if(s.tag===13){var c=s.memoizedState;if(c===null&&(s=s.alternate,s!==null&&(c=s.memoizedState)),c!==null)return c.dehydrated}return null}function Jr(s){if(Wr(s)!==s)throw Error(r(188))}function yr(s){var c=s.alternate;if(!c){if(c=Wr(s),c===null)throw Error(r(188));return c!==s?null:s}for(var p=s,b=c;;){var N=p.return;if(N===null)break;var R=N.alternate;if(R===null){if(b=N.return,b!==null){p=b;continue}break}if(N.child===R.child){for(R=N.child;R;){if(R===p)return Jr(N),s;if(R===b)return Jr(N),c;R=R.sibling}throw Error(r(188))}if(p.return!==b.return)p=N,b=R;else{for(var q=!1,se=N.child;se;){if(se===p){q=!0,p=N,b=R;break}if(se===b){q=!0,b=N,p=R;break}se=se.sibling}if(!q){for(se=R.child;se;){if(se===p){q=!0,p=R,b=N;break}if(se===b){q=!0,b=R,p=N;break}se=se.sibling}if(!q)throw Error(r(189))}}if(p.alternate!==b)throw Error(r(190))}if(p.tag!==3)throw Error(r(188));return p.stateNode.current===p?s:c}function ca(s){return s=yr(s),s!==null?ni(s):null}function ni(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var c=ni(s);if(c!==null)return c;s=s.sibling}return null}var ai=t.unstable_scheduleCallback,dn=t.unstable_cancelCallback,Ei=t.unstable_shouldYield,Xn=t.unstable_requestPaint,vr=t.unstable_now,ji=t.unstable_getCurrentPriorityLevel,bn=t.unstable_ImmediatePriority,ii=t.unstable_UserBlockingPriority,nn=t.unstable_NormalPriority,st=t.unstable_LowPriority,Nt=t.unstable_IdlePriority,Ht=null,er=null;function ur(s){if(er&&typeof er.onCommitFiberRoot=="function")try{er.onCommitFiberRoot(Ht,s,void 0,(s.current.flags&128)===128)}catch{}}var tr=Math.clz32?Math.clz32:zr,Qn=Math.log,si=Math.LN2;function zr(s){return s>>>=0,s===0?32:31-(Qn(s)/si|0)|0}var Ur=64,fn=4194304;function Zn(s){switch(s&-s){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: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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function jn(s,c){var p=s.pendingLanes;if(p===0)return 0;var b=0,N=s.suspendedLanes,R=s.pingedLanes,q=p&268435455;if(q!==0){var se=q&~N;se!==0?b=Zn(se):(R&=q,R!==0&&(b=Zn(R)))}else q=p&~N,q!==0?b=Zn(q):R!==0&&(b=Zn(R));if(b===0)return 0;if(c!==0&&c!==b&&(c&N)===0&&(N=b&-b,R=c&-c,N>=R||N===16&&(R&4194240)!==0))return c;if((b&4)!==0&&(b|=p&16),c=s.entangledLanes,c!==0)for(s=s.entanglements,c&=b;0<c;)p=31-tr(c),N=1<<p,b|=s[p],c&=~N;return b}function oi(s,c){switch(s){case 1:case 2:case 4:return c+250;case 8:case 16:case 32:case 64: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vn(s,c){for(var p=s.suspendedLanes,b=s.pingedLanes,N=s.expirationTimes,R=s.pendingLanes;0<R;){var q=31-tr(R),se=1<<q,ge=N[q];ge===-1?((se&p)===0||(se&b)!==0)&&(N[q]=oi(se,c)):ge<=c&&(s.expiredLanes|=se),R&=~se}}function Yi(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Fa(){var s=Ur;return Ur<<=1,(Ur&4194240)===0&&(Ur=64),s}function Un(s){for(var c=[],p=0;31>p;p++)c.push(s);return c}function Jn(s,c,p){s.pendingLanes|=c,c!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,c=31-tr(c),s[c]=p}function On(s,c){var p=s.pendingLanes&~c;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=c,s.mutableReadLanes&=c,s.entangledLanes&=c,c=s.entanglements;var b=s.eventTimes;for(s=s.expirationTimes;0<p;){var N=31-tr(p),R=1<<N;c[N]=0,b[N]=-1,s[N]=-1,p&=~R}}function ea(s,c){var p=s.entangledLanes|=c;for(s=s.entanglements;p;){var b=31-tr(p),N=1<<b;N&c|s[b]&c&&(s[b]|=c),p&=~N}}var dr=0;function He(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Ci,Vr,wr,Ba,Cn,wa=!1,Xe=[],H=null,le=null,Se=null,We=new Map,pt=new Map,_t=[],Er="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 submit".split(" ");function jr(s,c){switch(s){case"focusin":case"focusout":H=null;break;case"dragenter":case"dragleave":le=null;break;case"mouseover":case"mouseout":Se=null;break;case"pointerover":case"pointerout":We.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":pt.delete(c.pointerId)}}function an(s,c,p,b,N,R){return s===null||s.nativeEvent!==R?(s={blockedOn:c,domEventName:p,eventSystemFlags:b,nativeEvent:R,targetContainers:[N]},c!==null&&(c=Dn(c),c!==null&&Vr(c)),s):(s.eventSystemFlags|=b,c=s.targetContainers,N!==null&&c.indexOf(N)===-1&&c.push(N),s)}function Tn(s,c,p,b,N){switch(c){case"focusin":return H=an(H,s,c,p,b,N),!0;case"dragenter":return le=an(le,s,c,p,b,N),!0;case"mouseover":return Se=an(Se,s,c,p,b,N),!0;case"pointerover":var R=N.pointerId;return We.set(R,an(We.get(R)||null,s,c,p,b,N)),!0;case"gotpointercapture":return R=N.pointerId,pt.set(R,an(pt.get(R)||null,s,c,p,b,N)),!0}return!1}function za(s){var c=br(s.target);if(c!==null){var p=Wr(c);if(p!==null){if(c=p.tag,c===13){if(c=ln(p),c!==null){s.blockedOn=c,Cn(s.priority,function(){wr(p)});return}}else if(c===3&&p.stateNode.current.memoizedState.isDehydrated){s.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}s.blockedOn=null}function sn(s){if(s.blockedOn!==null)return!1;for(var c=s.targetContainers;0<c.length;){var p=Mi(s.domEventName,s.eventSystemFlags,c[0],s.nativeEvent);if(p===null){p=s.nativeEvent;var b=new p.constructor(p.type,p);$t=b,p.target.dispatchEvent(b),$t=null}else return c=Dn(p),c!==null&&Vr(c),s.blockedOn=p,!1;c.shift()}return!0}function Ti(s,c,p){sn(s)&&p.delete(c)}function Do(){wa=!1,H!==null&&sn(H)&&(H=null),le!==null&&sn(le)&&(le=null),Se!==null&&sn(Se)&&(Se=null),We.forEach(Ti),pt.forEach(Ti)}function Xi(s,c){s.blockedOn===c&&(s.blockedOn=null,wa||(wa=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Do)))}function Ri(s){function c(N){return Xi(N,s)}if(0<Xe.length){Xi(Xe[0],s);for(var p=1;p<Xe.length;p++){var b=Xe[p];b.blockedOn===s&&(b.blockedOn=null)}}for(H!==null&&Xi(H,s),le!==null&&Xi(le,s),Se!==null&&Xi(Se,s),We.forEach(c),pt.forEach(c),p=0;p<_t.length;p++)b=_t[p],b.blockedOn===s&&(b.blockedOn=null);for(;0<_t.length&&(p=_t[0],p.blockedOn===null);)za(p),p.blockedOn===null&&_t.shift()}var li=A.ReactCurrentBatchConfig,Ai=!0;function Ii(s,c,p,b){var N=dr,R=li.transition;li.transition=null;try{dr=1,hs(s,c,p,b)}finally{dr=N,li.transition=R}}function Na(s,c,p,b){var N=dr,R=li.transition;li.transition=null;try{dr=4,hs(s,c,p,b)}finally{dr=N,li.transition=R}}function hs(s,c,p,b){if(Ai){var N=Mi(s,c,p,b);if(N===null)oc(s,c,b,ci,p),jr(s,b);else if(Tn(N,s,c,p,b))b.stopPropagation();else if(jr(s,b),c&4&&-1<Er.indexOf(s)){for(;N!==null;){var R=Dn(N);if(R!==null&&Ci(R),R=Mi(s,c,p,b),R===null&&oc(s,c,b,ci,p),R===N)break;N=R}N!==null&&b.stopPropagation()}else oc(s,c,b,null,p)}}var ci=null;function Mi(s,c,p,b){if(ci=null,s=lr(b),s=br(s),s!==null)if(c=Wr(s),c===null)s=null;else if(p=c.tag,p===13){if(s=ln(c),s!==null)return s;s=null}else if(p===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;s=null}else c!==s&&(s=null);return ci=s,null}function Po(s){switch(s){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ji()){case bn:return 1;case ii:return 4;case nn:case st:return 16;case Nt:return 536870912;default:return 16}default:return 16}}var gn=null,Fo=null,ua=null;function xu(){if(ua)return ua;var s,c=Fo,p=c.length,b,N="value"in gn?gn.value:gn.textContent,R=N.length;for(s=0;s<p&&c[s]===N[s];s++);var q=p-s;for(b=1;b<=q&&c[p-b]===N[R-b];b++);return ua=N.slice(s,1<b?1-b:void 0)}function Bo(s){var c=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&c===13&&(s=13)):s=c,s===10&&(s=13),32<=s||s===13?s:0}function ms(){return!0}function yu(){return!1}function ta(s){function c(p,b,N,R,q){this._reactName=p,this._targetInst=N,this.type=b,this.nativeEvent=R,this.target=q,this.currentTarget=null;for(var se in s)s.hasOwnProperty(se)&&(p=s[se],this[se]=p?p(R):R[se]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?ms:yu,this.isPropagationStopped=yu,this}return F(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=ms)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=ms)},persist:function(){},isPersistent:ms}),c}var xs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zo=ta(xs),Li=F({},xs,{view:0,detail:0}),bu=ta(Li),Bl,ys,Qi,Gs=F({},Li,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hl,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Qi&&(Qi&&s.type==="mousemove"?(Bl=s.screenX-Qi.screenX,ys=s.screenY-Qi.screenY):ys=Bl=0,Qi=s),Bl)},movementY:function(s){return"movementY"in s?s.movementY:ys}}),Uo=ta(Gs),zl=F({},Gs,{dataTransfer:0}),vu=ta(zl),Ul=F({},Li,{relatedTarget:0}),ql=ta(Ul),Jf=F({},xs,{animationName:0,elapsedTime:0,pseudoElement:0}),ku=ta(Jf),qo=F({},xs,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),bs=ta(qo),_u=F({},xs,{data:0}),wu=ta(_u),Nu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ks={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"},Su={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ys(s){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(s):(s=Su[s])?!!c[s]:!1}function Hl(){return Ys}var $l=F({},Li,{key:function(s){if(s.key){var c=Nu[s.key]||s.key;if(c!=="Unidentified")return c}return s.type==="keypress"?(s=Bo(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Ks[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hl,charCode:function(s){return s.type==="keypress"?Bo(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Bo(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),eg=ta($l),Wl=F({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eu=ta(Wl),Ho=F({},Li,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hl}),tg=ta(Ho),Vl=F({},xs,{propertyName:0,elapsedTime:0,pseudoElement:0}),ju=ta(Vl),It=F({},Gs,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Cu=ta(It),ra=[9,13,27,32],Gl=u&&"CompositionEvent"in window,Zi=null;u&&"documentMode"in document&&(Zi=document.documentMode);var Kl=u&&"TextEvent"in window&&!Zi,Ji=u&&(!Gl||Zi&&8<Zi&&11>=Zi),Tu=" ",ui=!1;function $o(s,c){switch(s){case"keyup":return ra.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function da(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var di=!1;function Wo(s,c){switch(s){case"compositionend":return da(c);case"keypress":return c.which!==32?null:(ui=!0,Tu);case"textInput":return s=c.data,s===Tu&&ui?null:s;default:return null}}function Vo(s,c){if(di)return s==="compositionend"||!Gl&&$o(s,c)?(s=xu(),ua=Fo=gn=null,di=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return Ji&&c.locale!=="ko"?null:c.data;default:return null}}var rg={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 Yl(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c==="input"?!!rg[s.type]:c==="textarea"}function Xs(s,c,p,b){ue(b),c=to(c,"onChange"),0<c.length&&(p=new zo("onChange","change",null,p,b),s.push({event:p,listeners:c}))}var Ua=null,Qs=null;function Xl(s){zu(s,0)}function Oi(s){var c=Ha(s);if(Ve(c))return s}function ng(s,c){if(s==="change")return c}var Go=!1;if(u){var Sa;if(u){var Ql="oninput"in document;if(!Ql){var Ru=document.createElement("div");Ru.setAttribute("oninput","return;"),Ql=typeof Ru.oninput=="function"}Sa=Ql}else Sa=!1;Go=Sa&&(!document.documentMode||9<document.documentMode)}function fa(){Ua&&(Ua.detachEvent("onpropertychange",Au),Qs=Ua=null)}function Au(s){if(s.propertyName==="value"&&Oi(Qs)){var c=[];Xs(c,Qs,s,lr(s)),bt(Xl,c)}}function ag(s,c,p){s==="focusin"?(fa(),Ua=c,Qs=p,Ua.attachEvent("onpropertychange",Au)):s==="focusout"&&fa()}function Ko(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Oi(Qs)}function Zl(s,c){if(s==="click")return Oi(c)}function ga(s,c){if(s==="input"||s==="change")return Oi(c)}function ig(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var Ea=typeof Object.is=="function"?Object.is:ig;function Zs(s,c){if(Ea(s,c))return!0;if(typeof s!="object"||s===null||typeof c!="object"||c===null)return!1;var p=Object.keys(s),b=Object.keys(c);if(p.length!==b.length)return!1;for(b=0;b<p.length;b++){var N=p[b];if(!d.call(c,N)||!Ea(s[N],c[N]))return!1}return!0}function Iu(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Jl(s,c){var p=Iu(s);s=0;for(var b;p;){if(p.nodeType===3){if(b=s+p.textContent.length,s<=c&&b>=c)return{node:p,offset:c-s};s=b}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=Iu(p)}}function ec(s,c){return s&&c?s===c?!0:s&&s.nodeType===3?!1:c&&c.nodeType===3?ec(s,c.parentNode):"contains"in s?s.contains(c):s.compareDocumentPosition?!!(s.compareDocumentPosition(c)&16):!1:!1}function Mu(){for(var s=window,c=at();c instanceof s.HTMLIFrameElement;){try{var p=typeof c.contentWindow.location.href=="string"}catch{p=!1}if(p)s=c.contentWindow;else break;c=at(s.document)}return c}function tc(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c&&(c==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||c==="textarea"||s.contentEditable==="true")}function sg(s){var c=Mu(),p=s.focusedElem,b=s.selectionRange;if(c!==p&&p&&p.ownerDocument&&ec(p.ownerDocument.documentElement,p)){if(b!==null&&tc(p)){if(c=b.start,s=b.end,s===void 0&&(s=c),"selectionStart"in p)p.selectionStart=c,p.selectionEnd=Math.min(s,p.value.length);else if(s=(c=p.ownerDocument||document)&&c.defaultView||window,s.getSelection){s=s.getSelection();var N=p.textContent.length,R=Math.min(b.start,N);b=b.end===void 0?R:Math.min(b.end,N),!s.extend&&R>b&&(N=b,b=R,R=N),N=Jl(p,R);var q=Jl(p,b);N&&q&&(s.rangeCount!==1||s.anchorNode!==N.node||s.anchorOffset!==N.offset||s.focusNode!==q.node||s.focusOffset!==q.offset)&&(c=c.createRange(),c.setStart(N.node,N.offset),s.removeAllRanges(),R>b?(s.addRange(c),s.extend(q.node,q.offset)):(c.setEnd(q.node,q.offset),s.addRange(c)))}}for(c=[],s=p;s=s.parentNode;)s.nodeType===1&&c.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<c.length;p++)s=c[p],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var og=u&&"documentMode"in document&&11>=document.documentMode,vs=null,Yo=null,es=null,Xo=!1;function Lu(s,c,p){var b=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Xo||vs==null||vs!==at(b)||(b=vs,"selectionStart"in b&&tc(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),es&&Zs(es,b)||(es=b,b=to(Yo,"onSelect"),0<b.length&&(c=new zo("onSelect","select",null,c,p),s.push({event:c,listeners:b}),c.target=vs)))}function Qo(s,c){var p={};return p[s.toLowerCase()]=c.toLowerCase(),p["Webkit"+s]="webkit"+c,p["Moz"+s]="moz"+c,p}var ks={animationend:Qo("Animation","AnimationEnd"),animationiteration:Qo("Animation","AnimationIteration"),animationstart:Qo("Animation","AnimationStart"),transitionend:Qo("Transition","TransitionEnd")},rc={},Ou={};u&&(Ou=document.createElement("div").style,"AnimationEvent"in window||(delete ks.animationend.animation,delete ks.animationiteration.animation,delete ks.animationstart.animation),"TransitionEvent"in window||delete ks.transitionend.transition);function Di(s){if(rc[s])return rc[s];if(!ks[s])return s;var c=ks[s],p;for(p in c)if(c.hasOwnProperty(p)&&p in Ou)return rc[s]=c[p];return s}var Du=Di("animationend"),Pu=Di("animationiteration"),_s=Di("animationstart"),Zo=Di("transitionend"),qa=new Map,Fu="abort auxClick 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(" ");function Pi(s,c){qa.set(s,c),o(c,[s])}for(var nc=0;nc<Fu.length;nc++){var ac=Fu[nc],lg=ac.toLowerCase(),ja=ac[0].toUpperCase()+ac.slice(1);Pi(lg,"on"+ja)}Pi(Du,"onAnimationEnd"),Pi(Pu,"onAnimationIteration"),Pi(_s,"onAnimationStart"),Pi("dblclick","onDoubleClick"),Pi("focusin","onFocus"),Pi("focusout","onBlur"),Pi(Zo,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ts="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(" "),ic=new Set("cancel close invalid load scroll toggle".split(" ").concat(ts));function Bu(s,c,p){var b=s.type||"unknown-event";s.currentTarget=p,Qt(b,c,void 0,s),s.currentTarget=null}function zu(s,c){c=(c&4)!==0;for(var p=0;p<s.length;p++){var b=s[p],N=b.event;b=b.listeners;e:{var R=void 0;if(c)for(var q=b.length-1;0<=q;q--){var se=b[q],ge=se.instance,Re=se.currentTarget;if(se=se.listener,ge!==R&&N.isPropagationStopped())break e;Bu(N,se,Re),R=ge}else for(q=0;q<b.length;q++){if(se=b[q],ge=se.instance,Re=se.currentTarget,se=se.listener,ge!==R&&N.isPropagationStopped())break e;Bu(N,se,Re),R=ge}}}if(Ft)throw s=Jt,Ft=!1,Jt=null,s}function Cr(s,c){var p=c[Ct];p===void 0&&(p=c[Ct]=new Set);var b=s+"__bubble";p.has(b)||(Uu(c,s,2,!1),p.add(b))}function sc(s,c,p){var b=0;c&&(b|=4),Uu(p,s,b,c)}var ws="_reactListening"+Math.random().toString(36).slice(2);function Js(s){if(!s[ws]){s[ws]=!0,a.forEach(function(p){p!=="selectionchange"&&(ic.has(p)||sc(p,!1,s),sc(p,!0,s))});var c=s.nodeType===9?s:s.ownerDocument;c===null||c[ws]||(c[ws]=!0,sc("selectionchange",!1,c))}}function Uu(s,c,p,b){switch(Po(c)){case 1:var N=Ii;break;case 4:N=Na;break;default:N=hs}p=N.bind(null,c,p,s),N=void 0,!te||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(N=!0),b?N!==void 0?s.addEventListener(c,p,{capture:!0,passive:N}):s.addEventListener(c,p,!0):N!==void 0?s.addEventListener(c,p,{passive:N}):s.addEventListener(c,p,!1)}function oc(s,c,p,b,N){var R=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var q=b.tag;if(q===3||q===4){var se=b.stateNode.containerInfo;if(se===N||se.nodeType===8&&se.parentNode===N)break;if(q===4)for(q=b.return;q!==null;){var ge=q.tag;if((ge===3||ge===4)&&(ge=q.stateNode.containerInfo,ge===N||ge.nodeType===8&&ge.parentNode===N))return;q=q.return}for(;se!==null;){if(q=br(se),q===null)return;if(ge=q.tag,ge===5||ge===6){b=R=q;continue e}se=se.parentNode}}b=b.return}bt(function(){var Re=R,et=lr(p),ot=[];e:{var Ze=qa.get(s);if(Ze!==void 0){var vt=zo,Tt=s;switch(s){case"keypress":if(Bo(p)===0)break e;case"keydown":case"keyup":vt=eg;break;case"focusin":Tt="focus",vt=ql;break;case"focusout":Tt="blur",vt=ql;break;case"beforeblur":case"afterblur":vt=ql;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":vt=Uo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":vt=vu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":vt=tg;break;case Du:case Pu:case _s:vt=ku;break;case Zo:vt=ju;break;case"scroll":vt=bu;break;case"wheel":vt=Cu;break;case"copy":case"cut":case"paste":vt=bs;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":vt=Eu}var At=(c&4)!==0,cn=!At&&s==="scroll",_e=At?Ze!==null?Ze+"Capture":null:Ze;At=[];for(var xe=Re,je;xe!==null;){je=xe;var ft=je.stateNode;if(je.tag===5&&ft!==null&&(je=ft,_e!==null&&(ft=Pe(xe,_e),ft!=null&&At.push(eo(xe,ft,je)))),cn)break;xe=xe.return}0<At.length&&(Ze=new vt(Ze,Tt,null,p,et),ot.push({event:Ze,listeners:At}))}}if((c&7)===0){e:{if(Ze=s==="mouseover"||s==="pointerover",vt=s==="mouseout"||s==="pointerout",Ze&&p!==$t&&(Tt=p.relatedTarget||p.fromElement)&&(br(Tt)||Tt[mt]))break e;if((vt||Ze)&&(Ze=et.window===et?et:(Ze=et.ownerDocument)?Ze.defaultView||Ze.parentWindow:window,vt?(Tt=p.relatedTarget||p.toElement,vt=Re,Tt=Tt?br(Tt):null,Tt!==null&&(cn=Wr(Tt),Tt!==cn||Tt.tag!==5&&Tt.tag!==6)&&(Tt=null)):(vt=null,Tt=Re),vt!==Tt)){if(At=Uo,ft="onMouseLeave",_e="onMouseEnter",xe="mouse",(s==="pointerout"||s==="pointerover")&&(At=Eu,ft="onPointerLeave",_e="onPointerEnter",xe="pointer"),cn=vt==null?Ze:Ha(vt),je=Tt==null?Ze:Ha(Tt),Ze=new At(ft,xe+"leave",vt,p,et),Ze.target=cn,Ze.relatedTarget=je,ft=null,br(et)===Re&&(At=new At(_e,xe+"enter",Tt,p,et),At.target=je,At.relatedTarget=cn,ft=At),cn=ft,vt&&Tt)t:{for(At=vt,_e=Tt,xe=0,je=At;je;je=fi(je))xe++;for(je=0,ft=_e;ft;ft=fi(ft))je++;for(;0<xe-je;)At=fi(At),xe--;for(;0<je-xe;)_e=fi(_e),je--;for(;xe--;){if(At===_e||_e!==null&&At===_e.alternate)break t;At=fi(At),_e=fi(_e)}At=null}else At=null;vt!==null&&Ns(ot,Ze,vt,At,!1),Tt!==null&&cn!==null&&Ns(ot,cn,Tt,At,!0)}}e:{if(Ze=Re?Ha(Re):window,vt=Ze.nodeName&&Ze.nodeName.toLowerCase(),vt==="select"||vt==="input"&&Ze.type==="file")var Lt=ng;else if(Yl(Ze))if(Go)Lt=ga;else{Lt=Ko;var zt=ag}else(vt=Ze.nodeName)&&vt.toLowerCase()==="input"&&(Ze.type==="checkbox"||Ze.type==="radio")&&(Lt=Zl);if(Lt&&(Lt=Lt(s,Re))){Xs(ot,Lt,p,et);break e}zt&&zt(s,Ze,Re),s==="focusout"&&(zt=Ze._wrapperState)&&zt.controlled&&Ze.type==="number"&&ut(Ze,"number",Ze.value)}switch(zt=Re?Ha(Re):window,s){case"focusin":(Yl(zt)||zt.contentEditable==="true")&&(vs=zt,Yo=Re,es=null);break;case"focusout":es=Yo=vs=null;break;case"mousedown":Xo=!0;break;case"contextmenu":case"mouseup":case"dragend":Xo=!1,Lu(ot,p,et);break;case"selectionchange":if(og)break;case"keydown":case"keyup":Lu(ot,p,et)}var Ut;if(Gl)e:{switch(s){case"compositionstart":var Kt="onCompositionStart";break e;case"compositionend":Kt="onCompositionEnd";break e;case"compositionupdate":Kt="onCompositionUpdate";break e}Kt=void 0}else di?$o(s,p)&&(Kt="onCompositionEnd"):s==="keydown"&&p.keyCode===229&&(Kt="onCompositionStart");Kt&&(Ji&&p.locale!=="ko"&&(di||Kt!=="onCompositionStart"?Kt==="onCompositionEnd"&&di&&(Ut=xu()):(gn=et,Fo="value"in gn?gn.value:gn.textContent,di=!0)),zt=to(Re,Kt),0<zt.length&&(Kt=new wu(Kt,s,null,p,et),ot.push({event:Kt,listeners:zt}),Ut?Kt.data=Ut:(Ut=da(p),Ut!==null&&(Kt.data=Ut)))),(Ut=Kl?Wo(s,p):Vo(s,p))&&(Re=to(Re,"onBeforeInput"),0<Re.length&&(et=new wu("onBeforeInput","beforeinput",null,p,et),ot.push({event:et,listeners:Re}),et.data=Ut))}zu(ot,c)})}function eo(s,c,p){return{instance:s,listener:c,currentTarget:p}}function to(s,c){for(var p=c+"Capture",b=[];s!==null;){var N=s,R=N.stateNode;N.tag===5&&R!==null&&(N=R,R=Pe(s,p),R!=null&&b.unshift(eo(s,R,N)),R=Pe(s,c),R!=null&&b.push(eo(s,R,N))),s=s.return}return b}function fi(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Ns(s,c,p,b,N){for(var R=c._reactName,q=[];p!==null&&p!==b;){var se=p,ge=se.alternate,Re=se.stateNode;if(ge!==null&&ge===b)break;se.tag===5&&Re!==null&&(se=Re,N?(ge=Pe(p,R),ge!=null&&q.unshift(eo(p,ge,se))):N||(ge=Pe(p,R),ge!=null&&q.push(eo(p,ge,se)))),p=p.return}q.length!==0&&s.push({event:c,listeners:q})}var qu=/\r\n?/g,D=/\u0000|\uFFFD/g;function re(s){return(typeof s=="string"?s:""+s).replace(qu,`
|
|
38
|
-
`).replace(D,"")}function ne(s,c,p){if(c=re(c),re(s)!==c&&p)throw Error(r(425))}function de(){}var me=null,Oe=null;function Ie(s,c){return s==="textarea"||s==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var St=typeof setTimeout=="function"?setTimeout:void 0,Tr=typeof clearTimeout=="function"?clearTimeout:void 0,Mr=typeof Promise=="function"?Promise:void 0,Or=typeof queueMicrotask=="function"?queueMicrotask:typeof Mr<"u"?function(s){return Mr.resolve(null).then(s).catch(hr)}:St;function hr(s){setTimeout(function(){throw s})}function ke(s,c){var p=c,b=0;do{var N=p.nextSibling;if(s.removeChild(p),N&&N.nodeType===8)if(p=N.data,p==="/$"){if(b===0){s.removeChild(N),Ri(c);return}b--}else p!=="$"&&p!=="$?"&&p!=="$!"||b++;p=N}while(p);Ri(c)}function J(s){for(;s!=null;s=s.nextSibling){var c=s.nodeType;if(c===1||c===3)break;if(c===8){if(c=s.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return s}function pe(s){s=s.previousSibling;for(var c=0;s;){if(s.nodeType===8){var p=s.data;if(p==="$"||p==="$!"||p==="$?"){if(c===0)return s;c--}else p==="/$"&&c++}s=s.previousSibling}return null}var Ee=Math.random().toString(36).slice(2),Le="__reactFiber$"+Ee,Qe="__reactProps$"+Ee,mt="__reactContainer$"+Ee,Ct="__reactEvents$"+Ee,Rt="__reactListeners$"+Ee,Wt="__reactHandles$"+Ee;function br(s){var c=s[Le];if(c)return c;for(var p=s.parentNode;p;){if(c=p[mt]||p[Le]){if(p=c.alternate,c.child!==null||p!==null&&p.child!==null)for(s=pe(s);s!==null;){if(p=s[Le])return p;s=pe(s)}return c}s=p,p=s.parentNode}return null}function Dn(s){return s=s[Le]||s[mt],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Ha(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function Pn(s){return s[Qe]||null}var ro=[],gi=-1;function pa(s){return{current:s}}function qr(s){0>gi||(s.current=ro[gi],ro[gi]=null,gi--)}function Lr(s,c){gi++,ro[gi]=s.current,s.current=c}var pi={},pn=pa(pi),Fn=pa(!1),Fi=pi;function rs(s,c){var p=s.type.contextTypes;if(!p)return pi;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===c)return b.__reactInternalMemoizedMaskedChildContext;var N={},R;for(R in p)N[R]=c[R];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=c,s.__reactInternalMemoizedMaskedChildContext=N),N}function sr(s){return s=s.childContextTypes,s!=null}function na(){qr(Fn),qr(pn)}function kn(s,c,p){if(pn.current!==pi)throw Error(r(168));Lr(pn,c),Lr(Fn,p)}function Rn(s,c,p){var b=s.stateNode;if(c=c.childContextTypes,typeof b.getChildContext!="function")return p;b=b.getChildContext();for(var N in b)if(!(N in c))throw Error(r(108,ae(s)||"Unknown",N));return F({},p,b)}function Jo(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||pi,Fi=pn.current,Lr(pn,s),Lr(Fn,Fn.current),!0}function Ek(s,c,p){var b=s.stateNode;if(!b)throw Error(r(169));p?(s=Rn(s,c,Fi),b.__reactInternalMemoizedMergedChildContext=s,qr(Fn),qr(pn),Lr(pn,s)):qr(Fn),Lr(Fn,p)}var ns=null,Hu=!1,cg=!1;function jk(s){ns===null?ns=[s]:ns.push(s)}function AA(s){Hu=!0,jk(s)}function Ss(){if(!cg&&ns!==null){cg=!0;var s=0,c=dr;try{var p=ns;for(dr=1;s<p.length;s++){var b=p[s];do b=b(!0);while(b!==null)}ns=null,Hu=!1}catch(N){throw ns!==null&&(ns=ns.slice(s+1)),ai(bn,Ss),N}finally{dr=c,cg=!1}}return null}var el=[],tl=0,$u=null,Wu=0,$a=[],Wa=0,no=null,as=1,is="";function ao(s,c){el[tl++]=Wu,el[tl++]=$u,$u=s,Wu=c}function Ck(s,c,p){$a[Wa++]=as,$a[Wa++]=is,$a[Wa++]=no,no=s;var b=as;s=is;var N=32-tr(b)-1;b&=~(1<<N),p+=1;var R=32-tr(c)+N;if(30<R){var q=N-N%5;R=(b&(1<<q)-1).toString(32),b>>=q,N-=q,as=1<<32-tr(c)+N|p<<N|b,is=R+s}else as=1<<R|p<<N|b,is=s}function ug(s){s.return!==null&&(ao(s,1),Ck(s,1,0))}function dg(s){for(;s===$u;)$u=el[--tl],el[tl]=null,Wu=el[--tl],el[tl]=null;for(;s===no;)no=$a[--Wa],$a[Wa]=null,is=$a[--Wa],$a[Wa]=null,as=$a[--Wa],$a[Wa]=null}var Ca=null,Ta=null,Qr=!1,hi=null;function Tk(s,c){var p=Ya(5,null,null,0);p.elementType="DELETED",p.stateNode=c,p.return=s,c=s.deletions,c===null?(s.deletions=[p],s.flags|=16):c.push(p)}function Rk(s,c){switch(s.tag){case 5:var p=s.type;return c=c.nodeType!==1||p.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(s.stateNode=c,Ca=s,Ta=J(c.firstChild),!0):!1;case 6:return c=s.pendingProps===""||c.nodeType!==3?null:c,c!==null?(s.stateNode=c,Ca=s,Ta=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(p=no!==null?{id:as,overflow:is}:null,s.memoizedState={dehydrated:c,treeContext:p,retryLane:1073741824},p=Ya(18,null,null,0),p.stateNode=c,p.return=s,s.child=p,Ca=s,Ta=null,!0):!1;default:return!1}}function fg(s){return(s.mode&1)!==0&&(s.flags&128)===0}function gg(s){if(Qr){var c=Ta;if(c){var p=c;if(!Rk(s,c)){if(fg(s))throw Error(r(418));c=J(p.nextSibling);var b=Ca;c&&Rk(s,c)?Tk(b,p):(s.flags=s.flags&-4097|2,Qr=!1,Ca=s)}}else{if(fg(s))throw Error(r(418));s.flags=s.flags&-4097|2,Qr=!1,Ca=s}}}function Ak(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Ca=s}function Vu(s){if(s!==Ca)return!1;if(!Qr)return Ak(s),Qr=!0,!1;var c;if((c=s.tag!==3)&&!(c=s.tag!==5)&&(c=s.type,c=c!=="head"&&c!=="body"&&!Ie(s.type,s.memoizedProps)),c&&(c=Ta)){if(fg(s))throw Ik(),Error(r(418));for(;c;)Tk(s,c),c=J(c.nextSibling)}if(Ak(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));e:{for(s=s.nextSibling,c=0;s;){if(s.nodeType===8){var p=s.data;if(p==="/$"){if(c===0){Ta=J(s.nextSibling);break e}c--}else p!=="$"&&p!=="$!"&&p!=="$?"||c++}s=s.nextSibling}Ta=null}}else Ta=Ca?J(s.stateNode.nextSibling):null;return!0}function Ik(){for(var s=Ta;s;)s=J(s.nextSibling)}function rl(){Ta=Ca=null,Qr=!1}function pg(s){hi===null?hi=[s]:hi.push(s)}var IA=A.ReactCurrentBatchConfig;function lc(s,c,p){if(s=p.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(r(309));var b=p.stateNode}if(!b)throw Error(r(147,s));var N=b,R=""+s;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===R?c.ref:(c=function(q){var se=N.refs;q===null?delete se[R]:se[R]=q},c._stringRef=R,c)}if(typeof s!="string")throw Error(r(284));if(!p._owner)throw Error(r(290,s))}return s}function Gu(s,c){throw s=Object.prototype.toString.call(c),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":s))}function Mk(s){var c=s._init;return c(s._payload)}function Lk(s){function c(_e,xe){if(s){var je=_e.deletions;je===null?(_e.deletions=[xe],_e.flags|=16):je.push(xe)}}function p(_e,xe){if(!s)return null;for(;xe!==null;)c(_e,xe),xe=xe.sibling;return null}function b(_e,xe){for(_e=new Map;xe!==null;)xe.key!==null?_e.set(xe.key,xe):_e.set(xe.index,xe),xe=xe.sibling;return _e}function N(_e,xe){return _e=Ms(_e,xe),_e.index=0,_e.sibling=null,_e}function R(_e,xe,je){return _e.index=je,s?(je=_e.alternate,je!==null?(je=je.index,je<xe?(_e.flags|=2,xe):je):(_e.flags|=2,xe)):(_e.flags|=1048576,xe)}function q(_e){return s&&_e.alternate===null&&(_e.flags|=2),_e}function se(_e,xe,je,ft){return xe===null||xe.tag!==6?(xe=ip(je,_e.mode,ft),xe.return=_e,xe):(xe=N(xe,je),xe.return=_e,xe)}function ge(_e,xe,je,ft){var Lt=je.type;return Lt===j?et(_e,xe,je.props.children,ft,je.key):xe!==null&&(xe.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===G&&Mk(Lt)===xe.type)?(ft=N(xe,je.props),ft.ref=lc(_e,xe,je),ft.return=_e,ft):(ft=xd(je.type,je.key,je.props,null,_e.mode,ft),ft.ref=lc(_e,xe,je),ft.return=_e,ft)}function Re(_e,xe,je,ft){return xe===null||xe.tag!==4||xe.stateNode.containerInfo!==je.containerInfo||xe.stateNode.implementation!==je.implementation?(xe=sp(je,_e.mode,ft),xe.return=_e,xe):(xe=N(xe,je.children||[]),xe.return=_e,xe)}function et(_e,xe,je,ft,Lt){return xe===null||xe.tag!==7?(xe=go(je,_e.mode,ft,Lt),xe.return=_e,xe):(xe=N(xe,je),xe.return=_e,xe)}function ot(_e,xe,je){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return xe=ip(""+xe,_e.mode,je),xe.return=_e,xe;if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case T:return je=xd(xe.type,xe.key,xe.props,null,_e.mode,je),je.ref=lc(_e,null,xe),je.return=_e,je;case C:return xe=sp(xe,_e.mode,je),xe.return=_e,xe;case G:var ft=xe._init;return ot(_e,ft(xe._payload),je)}if(jt(xe)||ie(xe))return xe=go(xe,_e.mode,je,null),xe.return=_e,xe;Gu(_e,xe)}return null}function Ze(_e,xe,je,ft){var Lt=xe!==null?xe.key:null;if(typeof je=="string"&&je!==""||typeof je=="number")return Lt!==null?null:se(_e,xe,""+je,ft);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case T:return je.key===Lt?ge(_e,xe,je,ft):null;case C:return je.key===Lt?Re(_e,xe,je,ft):null;case G:return Lt=je._init,Ze(_e,xe,Lt(je._payload),ft)}if(jt(je)||ie(je))return Lt!==null?null:et(_e,xe,je,ft,null);Gu(_e,je)}return null}function vt(_e,xe,je,ft,Lt){if(typeof ft=="string"&&ft!==""||typeof ft=="number")return _e=_e.get(je)||null,se(xe,_e,""+ft,Lt);if(typeof ft=="object"&&ft!==null){switch(ft.$$typeof){case T:return _e=_e.get(ft.key===null?je:ft.key)||null,ge(xe,_e,ft,Lt);case C:return _e=_e.get(ft.key===null?je:ft.key)||null,Re(xe,_e,ft,Lt);case G:var zt=ft._init;return vt(_e,xe,je,zt(ft._payload),Lt)}if(jt(ft)||ie(ft))return _e=_e.get(je)||null,et(xe,_e,ft,Lt,null);Gu(xe,ft)}return null}function Tt(_e,xe,je,ft){for(var Lt=null,zt=null,Ut=xe,Kt=xe=0,Mn=null;Ut!==null&&Kt<je.length;Kt++){Ut.index>Kt?(Mn=Ut,Ut=null):Mn=Ut.sibling;var Rr=Ze(_e,Ut,je[Kt],ft);if(Rr===null){Ut===null&&(Ut=Mn);break}s&&Ut&&Rr.alternate===null&&c(_e,Ut),xe=R(Rr,xe,Kt),zt===null?Lt=Rr:zt.sibling=Rr,zt=Rr,Ut=Mn}if(Kt===je.length)return p(_e,Ut),Qr&&ao(_e,Kt),Lt;if(Ut===null){for(;Kt<je.length;Kt++)Ut=ot(_e,je[Kt],ft),Ut!==null&&(xe=R(Ut,xe,Kt),zt===null?Lt=Ut:zt.sibling=Ut,zt=Ut);return Qr&&ao(_e,Kt),Lt}for(Ut=b(_e,Ut);Kt<je.length;Kt++)Mn=vt(Ut,_e,Kt,je[Kt],ft),Mn!==null&&(s&&Mn.alternate!==null&&Ut.delete(Mn.key===null?Kt:Mn.key),xe=R(Mn,xe,Kt),zt===null?Lt=Mn:zt.sibling=Mn,zt=Mn);return s&&Ut.forEach(function(Ls){return c(_e,Ls)}),Qr&&ao(_e,Kt),Lt}function At(_e,xe,je,ft){var Lt=ie(je);if(typeof Lt!="function")throw Error(r(150));if(je=Lt.call(je),je==null)throw Error(r(151));for(var zt=Lt=null,Ut=xe,Kt=xe=0,Mn=null,Rr=je.next();Ut!==null&&!Rr.done;Kt++,Rr=je.next()){Ut.index>Kt?(Mn=Ut,Ut=null):Mn=Ut.sibling;var Ls=Ze(_e,Ut,Rr.value,ft);if(Ls===null){Ut===null&&(Ut=Mn);break}s&&Ut&&Ls.alternate===null&&c(_e,Ut),xe=R(Ls,xe,Kt),zt===null?Lt=Ls:zt.sibling=Ls,zt=Ls,Ut=Mn}if(Rr.done)return p(_e,Ut),Qr&&ao(_e,Kt),Lt;if(Ut===null){for(;!Rr.done;Kt++,Rr=je.next())Rr=ot(_e,Rr.value,ft),Rr!==null&&(xe=R(Rr,xe,Kt),zt===null?Lt=Rr:zt.sibling=Rr,zt=Rr);return Qr&&ao(_e,Kt),Lt}for(Ut=b(_e,Ut);!Rr.done;Kt++,Rr=je.next())Rr=vt(Ut,_e,Kt,Rr.value,ft),Rr!==null&&(s&&Rr.alternate!==null&&Ut.delete(Rr.key===null?Kt:Rr.key),xe=R(Rr,xe,Kt),zt===null?Lt=Rr:zt.sibling=Rr,zt=Rr);return s&&Ut.forEach(function(dI){return c(_e,dI)}),Qr&&ao(_e,Kt),Lt}function cn(_e,xe,je,ft){if(typeof je=="object"&&je!==null&&je.type===j&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case T:e:{for(var Lt=je.key,zt=xe;zt!==null;){if(zt.key===Lt){if(Lt=je.type,Lt===j){if(zt.tag===7){p(_e,zt.sibling),xe=N(zt,je.props.children),xe.return=_e,_e=xe;break e}}else if(zt.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===G&&Mk(Lt)===zt.type){p(_e,zt.sibling),xe=N(zt,je.props),xe.ref=lc(_e,zt,je),xe.return=_e,_e=xe;break e}p(_e,zt);break}else c(_e,zt);zt=zt.sibling}je.type===j?(xe=go(je.props.children,_e.mode,ft,je.key),xe.return=_e,_e=xe):(ft=xd(je.type,je.key,je.props,null,_e.mode,ft),ft.ref=lc(_e,xe,je),ft.return=_e,_e=ft)}return q(_e);case C:e:{for(zt=je.key;xe!==null;){if(xe.key===zt)if(xe.tag===4&&xe.stateNode.containerInfo===je.containerInfo&&xe.stateNode.implementation===je.implementation){p(_e,xe.sibling),xe=N(xe,je.children||[]),xe.return=_e,_e=xe;break e}else{p(_e,xe);break}else c(_e,xe);xe=xe.sibling}xe=sp(je,_e.mode,ft),xe.return=_e,_e=xe}return q(_e);case G:return zt=je._init,cn(_e,xe,zt(je._payload),ft)}if(jt(je))return Tt(_e,xe,je,ft);if(ie(je))return At(_e,xe,je,ft);Gu(_e,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,xe!==null&&xe.tag===6?(p(_e,xe.sibling),xe=N(xe,je),xe.return=_e,_e=xe):(p(_e,xe),xe=ip(je,_e.mode,ft),xe.return=_e,_e=xe),q(_e)):p(_e,xe)}return cn}var nl=Lk(!0),Ok=Lk(!1),Ku=pa(null),Yu=null,al=null,hg=null;function mg(){hg=al=Yu=null}function xg(s){var c=Ku.current;qr(Ku),s._currentValue=c}function yg(s,c,p){for(;s!==null;){var b=s.alternate;if((s.childLanes&c)!==c?(s.childLanes|=c,b!==null&&(b.childLanes|=c)):b!==null&&(b.childLanes&c)!==c&&(b.childLanes|=c),s===p)break;s=s.return}}function il(s,c){Yu=s,hg=al=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&c)!==0&&(ha=!0),s.firstContext=null)}function Va(s){var c=s._currentValue;if(hg!==s)if(s={context:s,memoizedValue:c,next:null},al===null){if(Yu===null)throw Error(r(308));al=s,Yu.dependencies={lanes:0,firstContext:s}}else al=al.next=s;return c}var io=null;function bg(s){io===null?io=[s]:io.push(s)}function Dk(s,c,p,b){var N=c.interleaved;return N===null?(p.next=p,bg(c)):(p.next=N.next,N.next=p),c.interleaved=p,ss(s,b)}function ss(s,c){s.lanes|=c;var p=s.alternate;for(p!==null&&(p.lanes|=c),p=s,s=s.return;s!==null;)s.childLanes|=c,p=s.alternate,p!==null&&(p.childLanes|=c),p=s,s=s.return;return p.tag===3?p.stateNode:null}var Es=!1;function vg(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Pk(s,c){s=s.updateQueue,c.updateQueue===s&&(c.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function os(s,c){return{eventTime:s,lane:c,tag:0,payload:null,callback:null,next:null}}function js(s,c,p){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(Nr&2)!==0){var N=b.pending;return N===null?c.next=c:(c.next=N.next,N.next=c),b.pending=c,ss(s,p)}return N=b.interleaved,N===null?(c.next=c,bg(b)):(c.next=N.next,N.next=c),b.interleaved=c,ss(s,p)}function Xu(s,c,p){if(c=c.updateQueue,c!==null&&(c=c.shared,(p&4194240)!==0)){var b=c.lanes;b&=s.pendingLanes,p|=b,c.lanes=p,ea(s,p)}}function Fk(s,c){var p=s.updateQueue,b=s.alternate;if(b!==null&&(b=b.updateQueue,p===b)){var N=null,R=null;if(p=p.firstBaseUpdate,p!==null){do{var q={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};R===null?N=R=q:R=R.next=q,p=p.next}while(p!==null);R===null?N=R=c:R=R.next=c}else N=R=c;p={baseState:b.baseState,firstBaseUpdate:N,lastBaseUpdate:R,shared:b.shared,effects:b.effects},s.updateQueue=p;return}s=p.lastBaseUpdate,s===null?p.firstBaseUpdate=c:s.next=c,p.lastBaseUpdate=c}function Qu(s,c,p,b){var N=s.updateQueue;Es=!1;var R=N.firstBaseUpdate,q=N.lastBaseUpdate,se=N.shared.pending;if(se!==null){N.shared.pending=null;var ge=se,Re=ge.next;ge.next=null,q===null?R=Re:q.next=Re,q=ge;var et=s.alternate;et!==null&&(et=et.updateQueue,se=et.lastBaseUpdate,se!==q&&(se===null?et.firstBaseUpdate=Re:se.next=Re,et.lastBaseUpdate=ge))}if(R!==null){var ot=N.baseState;q=0,et=Re=ge=null,se=R;do{var Ze=se.lane,vt=se.eventTime;if((b&Ze)===Ze){et!==null&&(et=et.next={eventTime:vt,lane:0,tag:se.tag,payload:se.payload,callback:se.callback,next:null});e:{var Tt=s,At=se;switch(Ze=c,vt=p,At.tag){case 1:if(Tt=At.payload,typeof Tt=="function"){ot=Tt.call(vt,ot,Ze);break e}ot=Tt;break e;case 3:Tt.flags=Tt.flags&-65537|128;case 0:if(Tt=At.payload,Ze=typeof Tt=="function"?Tt.call(vt,ot,Ze):Tt,Ze==null)break e;ot=F({},ot,Ze);break e;case 2:Es=!0}}se.callback!==null&&se.lane!==0&&(s.flags|=64,Ze=N.effects,Ze===null?N.effects=[se]:Ze.push(se))}else vt={eventTime:vt,lane:Ze,tag:se.tag,payload:se.payload,callback:se.callback,next:null},et===null?(Re=et=vt,ge=ot):et=et.next=vt,q|=Ze;if(se=se.next,se===null){if(se=N.shared.pending,se===null)break;Ze=se,se=Ze.next,Ze.next=null,N.lastBaseUpdate=Ze,N.shared.pending=null}}while(!0);if(et===null&&(ge=ot),N.baseState=ge,N.firstBaseUpdate=Re,N.lastBaseUpdate=et,c=N.shared.interleaved,c!==null){N=c;do q|=N.lane,N=N.next;while(N!==c)}else R===null&&(N.shared.lanes=0);lo|=q,s.lanes=q,s.memoizedState=ot}}function Bk(s,c,p){if(s=c.effects,c.effects=null,s!==null)for(c=0;c<s.length;c++){var b=s[c],N=b.callback;if(N!==null){if(b.callback=null,b=p,typeof N!="function")throw Error(r(191,N));N.call(b)}}}var cc={},Bi=pa(cc),uc=pa(cc),dc=pa(cc);function so(s){if(s===cc)throw Error(r(174));return s}function kg(s,c){switch(Lr(dc,c),Lr(uc,s),Lr(Bi,cc),s=c.nodeType,s){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:ce(null,"");break;default:s=s===8?c.parentNode:c,c=s.namespaceURI||null,s=s.tagName,c=ce(c,s)}qr(Bi),Lr(Bi,c)}function sl(){qr(Bi),qr(uc),qr(dc)}function zk(s){so(dc.current);var c=so(Bi.current),p=ce(c,s.type);c!==p&&(Lr(uc,s),Lr(Bi,p))}function _g(s){uc.current===s&&(qr(Bi),qr(uc))}var en=pa(0);function Zu(s){for(var c=s;c!==null;){if(c.tag===13){var p=c.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||p.data==="$?"||p.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===s)break;for(;c.sibling===null;){if(c.return===null||c.return===s)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var wg=[];function Ng(){for(var s=0;s<wg.length;s++)wg[s]._workInProgressVersionPrimary=null;wg.length=0}var Ju=A.ReactCurrentDispatcher,Sg=A.ReactCurrentBatchConfig,oo=0,tn=null,_n=null,An=null,ed=!1,fc=!1,gc=0,MA=0;function qn(){throw Error(r(321))}function Eg(s,c){if(c===null)return!1;for(var p=0;p<c.length&&p<s.length;p++)if(!Ea(s[p],c[p]))return!1;return!0}function jg(s,c,p,b,N,R){if(oo=R,tn=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Ju.current=s===null||s.memoizedState===null?PA:FA,s=p(b,N),fc){R=0;do{if(fc=!1,gc=0,25<=R)throw Error(r(301));R+=1,An=_n=null,c.updateQueue=null,Ju.current=BA,s=p(b,N)}while(fc)}if(Ju.current=nd,c=_n!==null&&_n.next!==null,oo=0,An=_n=tn=null,ed=!1,c)throw Error(r(300));return s}function Cg(){var s=gc!==0;return gc=0,s}function zi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return An===null?tn.memoizedState=An=s:An=An.next=s,An}function Ga(){if(_n===null){var s=tn.alternate;s=s!==null?s.memoizedState:null}else s=_n.next;var c=An===null?tn.memoizedState:An.next;if(c!==null)An=c,_n=s;else{if(s===null)throw Error(r(310));_n=s,s={memoizedState:_n.memoizedState,baseState:_n.baseState,baseQueue:_n.baseQueue,queue:_n.queue,next:null},An===null?tn.memoizedState=An=s:An=An.next=s}return An}function pc(s,c){return typeof c=="function"?c(s):c}function Tg(s){var c=Ga(),p=c.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=s;var b=_n,N=b.baseQueue,R=p.pending;if(R!==null){if(N!==null){var q=N.next;N.next=R.next,R.next=q}b.baseQueue=N=R,p.pending=null}if(N!==null){R=N.next,b=b.baseState;var se=q=null,ge=null,Re=R;do{var et=Re.lane;if((oo&et)===et)ge!==null&&(ge=ge.next={lane:0,action:Re.action,hasEagerState:Re.hasEagerState,eagerState:Re.eagerState,next:null}),b=Re.hasEagerState?Re.eagerState:s(b,Re.action);else{var ot={lane:et,action:Re.action,hasEagerState:Re.hasEagerState,eagerState:Re.eagerState,next:null};ge===null?(se=ge=ot,q=b):ge=ge.next=ot,tn.lanes|=et,lo|=et}Re=Re.next}while(Re!==null&&Re!==R);ge===null?q=b:ge.next=se,Ea(b,c.memoizedState)||(ha=!0),c.memoizedState=b,c.baseState=q,c.baseQueue=ge,p.lastRenderedState=b}if(s=p.interleaved,s!==null){N=s;do R=N.lane,tn.lanes|=R,lo|=R,N=N.next;while(N!==s)}else N===null&&(p.lanes=0);return[c.memoizedState,p.dispatch]}function Rg(s){var c=Ga(),p=c.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=s;var b=p.dispatch,N=p.pending,R=c.memoizedState;if(N!==null){p.pending=null;var q=N=N.next;do R=s(R,q.action),q=q.next;while(q!==N);Ea(R,c.memoizedState)||(ha=!0),c.memoizedState=R,c.baseQueue===null&&(c.baseState=R),p.lastRenderedState=R}return[R,b]}function Uk(){}function qk(s,c){var p=tn,b=Ga(),N=c(),R=!Ea(b.memoizedState,N);if(R&&(b.memoizedState=N,ha=!0),b=b.queue,Ag(Wk.bind(null,p,b,s),[s]),b.getSnapshot!==c||R||An!==null&&An.memoizedState.tag&1){if(p.flags|=2048,hc(9,$k.bind(null,p,b,N,c),void 0,null),In===null)throw Error(r(349));(oo&30)!==0||Hk(p,c,N)}return N}function Hk(s,c,p){s.flags|=16384,s={getSnapshot:c,value:p},c=tn.updateQueue,c===null?(c={lastEffect:null,stores:null},tn.updateQueue=c,c.stores=[s]):(p=c.stores,p===null?c.stores=[s]:p.push(s))}function $k(s,c,p,b){c.value=p,c.getSnapshot=b,Vk(c)&&Gk(s)}function Wk(s,c,p){return p(function(){Vk(c)&&Gk(s)})}function Vk(s){var c=s.getSnapshot;s=s.value;try{var p=c();return!Ea(s,p)}catch{return!0}}function Gk(s){var c=ss(s,1);c!==null&&bi(c,s,1,-1)}function Kk(s){var c=zi();return typeof s=="function"&&(s=s()),c.memoizedState=c.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:pc,lastRenderedState:s},c.queue=s,s=s.dispatch=DA.bind(null,tn,s),[c.memoizedState,s]}function hc(s,c,p,b){return s={tag:s,create:c,destroy:p,deps:b,next:null},c=tn.updateQueue,c===null?(c={lastEffect:null,stores:null},tn.updateQueue=c,c.lastEffect=s.next=s):(p=c.lastEffect,p===null?c.lastEffect=s.next=s:(b=p.next,p.next=s,s.next=b,c.lastEffect=s)),s}function Yk(){return Ga().memoizedState}function td(s,c,p,b){var N=zi();tn.flags|=s,N.memoizedState=hc(1|c,p,void 0,b===void 0?null:b)}function rd(s,c,p,b){var N=Ga();b=b===void 0?null:b;var R=void 0;if(_n!==null){var q=_n.memoizedState;if(R=q.destroy,b!==null&&Eg(b,q.deps)){N.memoizedState=hc(c,p,R,b);return}}tn.flags|=s,N.memoizedState=hc(1|c,p,R,b)}function Xk(s,c){return td(8390656,8,s,c)}function Ag(s,c){return rd(2048,8,s,c)}function Qk(s,c){return rd(4,2,s,c)}function Zk(s,c){return rd(4,4,s,c)}function Jk(s,c){if(typeof c=="function")return s=s(),c(s),function(){c(null)};if(c!=null)return s=s(),c.current=s,function(){c.current=null}}function e1(s,c,p){return p=p!=null?p.concat([s]):null,rd(4,4,Jk.bind(null,c,s),p)}function Ig(){}function t1(s,c){var p=Ga();c=c===void 0?null:c;var b=p.memoizedState;return b!==null&&c!==null&&Eg(c,b[1])?b[0]:(p.memoizedState=[s,c],s)}function r1(s,c){var p=Ga();c=c===void 0?null:c;var b=p.memoizedState;return b!==null&&c!==null&&Eg(c,b[1])?b[0]:(s=s(),p.memoizedState=[s,c],s)}function n1(s,c,p){return(oo&21)===0?(s.baseState&&(s.baseState=!1,ha=!0),s.memoizedState=p):(Ea(p,c)||(p=Fa(),tn.lanes|=p,lo|=p,s.baseState=!0),c)}function LA(s,c){var p=dr;dr=p!==0&&4>p?p:4,s(!0);var b=Sg.transition;Sg.transition={};try{s(!1),c()}finally{dr=p,Sg.transition=b}}function a1(){return Ga().memoizedState}function OA(s,c,p){var b=As(s);if(p={lane:b,action:p,hasEagerState:!1,eagerState:null,next:null},i1(s))s1(c,p);else if(p=Dk(s,c,p,b),p!==null){var N=ia();bi(p,s,b,N),o1(p,c,b)}}function DA(s,c,p){var b=As(s),N={lane:b,action:p,hasEagerState:!1,eagerState:null,next:null};if(i1(s))s1(c,N);else{var R=s.alternate;if(s.lanes===0&&(R===null||R.lanes===0)&&(R=c.lastRenderedReducer,R!==null))try{var q=c.lastRenderedState,se=R(q,p);if(N.hasEagerState=!0,N.eagerState=se,Ea(se,q)){var ge=c.interleaved;ge===null?(N.next=N,bg(c)):(N.next=ge.next,ge.next=N),c.interleaved=N;return}}catch{}finally{}p=Dk(s,c,N,b),p!==null&&(N=ia(),bi(p,s,b,N),o1(p,c,b))}}function i1(s){var c=s.alternate;return s===tn||c!==null&&c===tn}function s1(s,c){fc=ed=!0;var p=s.pending;p===null?c.next=c:(c.next=p.next,p.next=c),s.pending=c}function o1(s,c,p){if((p&4194240)!==0){var b=c.lanes;b&=s.pendingLanes,p|=b,c.lanes=p,ea(s,p)}}var nd={readContext:Va,useCallback:qn,useContext:qn,useEffect:qn,useImperativeHandle:qn,useInsertionEffect:qn,useLayoutEffect:qn,useMemo:qn,useReducer:qn,useRef:qn,useState:qn,useDebugValue:qn,useDeferredValue:qn,useTransition:qn,useMutableSource:qn,useSyncExternalStore:qn,useId:qn,unstable_isNewReconciler:!1},PA={readContext:Va,useCallback:function(s,c){return zi().memoizedState=[s,c===void 0?null:c],s},useContext:Va,useEffect:Xk,useImperativeHandle:function(s,c,p){return p=p!=null?p.concat([s]):null,td(4194308,4,Jk.bind(null,c,s),p)},useLayoutEffect:function(s,c){return td(4194308,4,s,c)},useInsertionEffect:function(s,c){return td(4,2,s,c)},useMemo:function(s,c){var p=zi();return c=c===void 0?null:c,s=s(),p.memoizedState=[s,c],s},useReducer:function(s,c,p){var b=zi();return c=p!==void 0?p(c):c,b.memoizedState=b.baseState=c,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:c},b.queue=s,s=s.dispatch=OA.bind(null,tn,s),[b.memoizedState,s]},useRef:function(s){var c=zi();return s={current:s},c.memoizedState=s},useState:Kk,useDebugValue:Ig,useDeferredValue:function(s){return zi().memoizedState=s},useTransition:function(){var s=Kk(!1),c=s[0];return s=LA.bind(null,s[1]),zi().memoizedState=s,[c,s]},useMutableSource:function(){},useSyncExternalStore:function(s,c,p){var b=tn,N=zi();if(Qr){if(p===void 0)throw Error(r(407));p=p()}else{if(p=c(),In===null)throw Error(r(349));(oo&30)!==0||Hk(b,c,p)}N.memoizedState=p;var R={value:p,getSnapshot:c};return N.queue=R,Xk(Wk.bind(null,b,R,s),[s]),b.flags|=2048,hc(9,$k.bind(null,b,R,p,c),void 0,null),p},useId:function(){var s=zi(),c=In.identifierPrefix;if(Qr){var p=is,b=as;p=(b&~(1<<32-tr(b)-1)).toString(32)+p,c=":"+c+"R"+p,p=gc++,0<p&&(c+="H"+p.toString(32)),c+=":"}else p=MA++,c=":"+c+"r"+p.toString(32)+":";return s.memoizedState=c},unstable_isNewReconciler:!1},FA={readContext:Va,useCallback:t1,useContext:Va,useEffect:Ag,useImperativeHandle:e1,useInsertionEffect:Qk,useLayoutEffect:Zk,useMemo:r1,useReducer:Tg,useRef:Yk,useState:function(){return Tg(pc)},useDebugValue:Ig,useDeferredValue:function(s){var c=Ga();return n1(c,_n.memoizedState,s)},useTransition:function(){var s=Tg(pc)[0],c=Ga().memoizedState;return[s,c]},useMutableSource:Uk,useSyncExternalStore:qk,useId:a1,unstable_isNewReconciler:!1},BA={readContext:Va,useCallback:t1,useContext:Va,useEffect:Ag,useImperativeHandle:e1,useInsertionEffect:Qk,useLayoutEffect:Zk,useMemo:r1,useReducer:Rg,useRef:Yk,useState:function(){return Rg(pc)},useDebugValue:Ig,useDeferredValue:function(s){var c=Ga();return _n===null?c.memoizedState=s:n1(c,_n.memoizedState,s)},useTransition:function(){var s=Rg(pc)[0],c=Ga().memoizedState;return[s,c]},useMutableSource:Uk,useSyncExternalStore:qk,useId:a1,unstable_isNewReconciler:!1};function mi(s,c){if(s&&s.defaultProps){c=F({},c),s=s.defaultProps;for(var p in s)c[p]===void 0&&(c[p]=s[p]);return c}return c}function Mg(s,c,p,b){c=s.memoizedState,p=p(b,c),p=p==null?c:F({},c,p),s.memoizedState=p,s.lanes===0&&(s.updateQueue.baseState=p)}var ad={isMounted:function(s){return(s=s._reactInternals)?Wr(s)===s:!1},enqueueSetState:function(s,c,p){s=s._reactInternals;var b=ia(),N=As(s),R=os(b,N);R.payload=c,p!=null&&(R.callback=p),c=js(s,R,N),c!==null&&(bi(c,s,N,b),Xu(c,s,N))},enqueueReplaceState:function(s,c,p){s=s._reactInternals;var b=ia(),N=As(s),R=os(b,N);R.tag=1,R.payload=c,p!=null&&(R.callback=p),c=js(s,R,N),c!==null&&(bi(c,s,N,b),Xu(c,s,N))},enqueueForceUpdate:function(s,c){s=s._reactInternals;var p=ia(),b=As(s),N=os(p,b);N.tag=2,c!=null&&(N.callback=c),c=js(s,N,b),c!==null&&(bi(c,s,b,p),Xu(c,s,b))}};function l1(s,c,p,b,N,R,q){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,R,q):c.prototype&&c.prototype.isPureReactComponent?!Zs(p,b)||!Zs(N,R):!0}function c1(s,c,p){var b=!1,N=pi,R=c.contextType;return typeof R=="object"&&R!==null?R=Va(R):(N=sr(c)?Fi:pn.current,b=c.contextTypes,R=(b=b!=null)?rs(s,N):pi),c=new c(p,R),s.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=ad,s.stateNode=c,c._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=N,s.__reactInternalMemoizedMaskedChildContext=R),c}function u1(s,c,p,b){s=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(p,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(p,b),c.state!==s&&ad.enqueueReplaceState(c,c.state,null)}function Lg(s,c,p,b){var N=s.stateNode;N.props=p,N.state=s.memoizedState,N.refs={},vg(s);var R=c.contextType;typeof R=="object"&&R!==null?N.context=Va(R):(R=sr(c)?Fi:pn.current,N.context=rs(s,R)),N.state=s.memoizedState,R=c.getDerivedStateFromProps,typeof R=="function"&&(Mg(s,c,R,p),N.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(c=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),c!==N.state&&ad.enqueueReplaceState(N,N.state,null),Qu(s,p,N,b),N.state=s.memoizedState),typeof N.componentDidMount=="function"&&(s.flags|=4194308)}function ol(s,c){try{var p="",b=c;do p+=V(b),b=b.return;while(b);var N=p}catch(R){N=`
|
|
39
|
-
Error generating stack: `+R.message+`
|
|
40
|
-
`+R.stack}return{value:s,source:c,stack:N,digest:null}}function Og(s,c,p){return{value:s,source:null,stack:p??null,digest:c??null}}function Dg(s,c){try{console.error(c.value)}catch(p){setTimeout(function(){throw p})}}var zA=typeof WeakMap=="function"?WeakMap:Map;function d1(s,c,p){p=os(-1,p),p.tag=3,p.payload={element:null};var b=c.value;return p.callback=function(){dd||(dd=!0,Qg=b),Dg(s,c)},p}function f1(s,c,p){p=os(-1,p),p.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var N=c.value;p.payload=function(){return b(N)},p.callback=function(){Dg(s,c)}}var R=s.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(p.callback=function(){Dg(s,c),typeof b!="function"&&(Ts===null?Ts=new Set([this]):Ts.add(this));var q=c.stack;this.componentDidCatch(c.value,{componentStack:q!==null?q:""})}),p}function g1(s,c,p){var b=s.pingCache;if(b===null){b=s.pingCache=new zA;var N=new Set;b.set(c,N)}else N=b.get(c),N===void 0&&(N=new Set,b.set(c,N));N.has(p)||(N.add(p),s=eI.bind(null,s,c,p),c.then(s,s))}function p1(s){do{var c;if((c=s.tag===13)&&(c=s.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return s;s=s.return}while(s!==null);return null}function h1(s,c,p,b,N){return(s.mode&1)===0?(s===c?s.flags|=65536:(s.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(c=os(-1,1),c.tag=2,js(p,c,1))),p.lanes|=1),s):(s.flags|=65536,s.lanes=N,s)}var UA=A.ReactCurrentOwner,ha=!1;function aa(s,c,p,b){c.child=s===null?Ok(c,null,p,b):nl(c,s.child,p,b)}function m1(s,c,p,b,N){p=p.render;var R=c.ref;return il(c,N),b=jg(s,c,p,b,R,N),p=Cg(),s!==null&&!ha?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~N,ls(s,c,N)):(Qr&&p&&ug(c),c.flags|=1,aa(s,c,b,N),c.child)}function x1(s,c,p,b,N){if(s===null){var R=p.type;return typeof R=="function"&&!ap(R)&&R.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(c.tag=15,c.type=R,y1(s,c,R,b,N)):(s=xd(p.type,null,b,c,c.mode,N),s.ref=c.ref,s.return=c,c.child=s)}if(R=s.child,(s.lanes&N)===0){var q=R.memoizedProps;if(p=p.compare,p=p!==null?p:Zs,p(q,b)&&s.ref===c.ref)return ls(s,c,N)}return c.flags|=1,s=Ms(R,b),s.ref=c.ref,s.return=c,c.child=s}function y1(s,c,p,b,N){if(s!==null){var R=s.memoizedProps;if(Zs(R,b)&&s.ref===c.ref)if(ha=!1,c.pendingProps=b=R,(s.lanes&N)!==0)(s.flags&131072)!==0&&(ha=!0);else return c.lanes=s.lanes,ls(s,c,N)}return Pg(s,c,p,b,N)}function b1(s,c,p){var b=c.pendingProps,N=b.children,R=s!==null?s.memoizedState:null;if(b.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},Lr(cl,Ra),Ra|=p;else{if((p&1073741824)===0)return s=R!==null?R.baseLanes|p:p,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:s,cachePool:null,transitions:null},c.updateQueue=null,Lr(cl,Ra),Ra|=s,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=R!==null?R.baseLanes:p,Lr(cl,Ra),Ra|=b}else R!==null?(b=R.baseLanes|p,c.memoizedState=null):b=p,Lr(cl,Ra),Ra|=b;return aa(s,c,N,p),c.child}function v1(s,c){var p=c.ref;(s===null&&p!==null||s!==null&&s.ref!==p)&&(c.flags|=512,c.flags|=2097152)}function Pg(s,c,p,b,N){var R=sr(p)?Fi:pn.current;return R=rs(c,R),il(c,N),p=jg(s,c,p,b,R,N),b=Cg(),s!==null&&!ha?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~N,ls(s,c,N)):(Qr&&b&&ug(c),c.flags|=1,aa(s,c,p,N),c.child)}function k1(s,c,p,b,N){if(sr(p)){var R=!0;Jo(c)}else R=!1;if(il(c,N),c.stateNode===null)sd(s,c),c1(c,p,b),Lg(c,p,b,N),b=!0;else if(s===null){var q=c.stateNode,se=c.memoizedProps;q.props=se;var ge=q.context,Re=p.contextType;typeof Re=="object"&&Re!==null?Re=Va(Re):(Re=sr(p)?Fi:pn.current,Re=rs(c,Re));var et=p.getDerivedStateFromProps,ot=typeof et=="function"||typeof q.getSnapshotBeforeUpdate=="function";ot||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(se!==b||ge!==Re)&&u1(c,q,b,Re),Es=!1;var Ze=c.memoizedState;q.state=Ze,Qu(c,b,q,N),ge=c.memoizedState,se!==b||Ze!==ge||Fn.current||Es?(typeof et=="function"&&(Mg(c,p,et,b),ge=c.memoizedState),(se=Es||l1(c,p,se,b,Ze,ge,Re))?(ot||typeof q.UNSAFE_componentWillMount!="function"&&typeof q.componentWillMount!="function"||(typeof q.componentWillMount=="function"&&q.componentWillMount(),typeof q.UNSAFE_componentWillMount=="function"&&q.UNSAFE_componentWillMount()),typeof q.componentDidMount=="function"&&(c.flags|=4194308)):(typeof q.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=ge),q.props=b,q.state=ge,q.context=Re,b=se):(typeof q.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{q=c.stateNode,Pk(s,c),se=c.memoizedProps,Re=c.type===c.elementType?se:mi(c.type,se),q.props=Re,ot=c.pendingProps,Ze=q.context,ge=p.contextType,typeof ge=="object"&&ge!==null?ge=Va(ge):(ge=sr(p)?Fi:pn.current,ge=rs(c,ge));var vt=p.getDerivedStateFromProps;(et=typeof vt=="function"||typeof q.getSnapshotBeforeUpdate=="function")||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(se!==ot||Ze!==ge)&&u1(c,q,b,ge),Es=!1,Ze=c.memoizedState,q.state=Ze,Qu(c,b,q,N);var Tt=c.memoizedState;se!==ot||Ze!==Tt||Fn.current||Es?(typeof vt=="function"&&(Mg(c,p,vt,b),Tt=c.memoizedState),(Re=Es||l1(c,p,Re,b,Ze,Tt,ge)||!1)?(et||typeof q.UNSAFE_componentWillUpdate!="function"&&typeof q.componentWillUpdate!="function"||(typeof q.componentWillUpdate=="function"&&q.componentWillUpdate(b,Tt,ge),typeof q.UNSAFE_componentWillUpdate=="function"&&q.UNSAFE_componentWillUpdate(b,Tt,ge)),typeof q.componentDidUpdate=="function"&&(c.flags|=4),typeof q.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof q.componentDidUpdate!="function"||se===s.memoizedProps&&Ze===s.memoizedState||(c.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||se===s.memoizedProps&&Ze===s.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=Tt),q.props=b,q.state=Tt,q.context=ge,b=Re):(typeof q.componentDidUpdate!="function"||se===s.memoizedProps&&Ze===s.memoizedState||(c.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||se===s.memoizedProps&&Ze===s.memoizedState||(c.flags|=1024),b=!1)}return Fg(s,c,p,b,R,N)}function Fg(s,c,p,b,N,R){v1(s,c);var q=(c.flags&128)!==0;if(!b&&!q)return N&&Ek(c,p,!1),ls(s,c,R);b=c.stateNode,UA.current=c;var se=q&&typeof p.getDerivedStateFromError!="function"?null:b.render();return c.flags|=1,s!==null&&q?(c.child=nl(c,s.child,null,R),c.child=nl(c,null,se,R)):aa(s,c,se,R),c.memoizedState=b.state,N&&Ek(c,p,!0),c.child}function _1(s){var c=s.stateNode;c.pendingContext?kn(s,c.pendingContext,c.pendingContext!==c.context):c.context&&kn(s,c.context,!1),kg(s,c.containerInfo)}function w1(s,c,p,b,N){return rl(),pg(N),c.flags|=256,aa(s,c,p,b),c.child}var Bg={dehydrated:null,treeContext:null,retryLane:0};function zg(s){return{baseLanes:s,cachePool:null,transitions:null}}function N1(s,c,p){var b=c.pendingProps,N=en.current,R=!1,q=(c.flags&128)!==0,se;if((se=q)||(se=s!==null&&s.memoizedState===null?!1:(N&2)!==0),se?(R=!0,c.flags&=-129):(s===null||s.memoizedState!==null)&&(N|=1),Lr(en,N&1),s===null)return gg(c),s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((c.mode&1)===0?c.lanes=1:s.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(q=b.children,s=b.fallback,R?(b=c.mode,R=c.child,q={mode:"hidden",children:q},(b&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=q):R=yd(q,b,0,null),s=go(s,b,p,null),R.return=c,s.return=c,R.sibling=s,c.child=R,c.child.memoizedState=zg(p),c.memoizedState=Bg,s):Ug(c,q));if(N=s.memoizedState,N!==null&&(se=N.dehydrated,se!==null))return qA(s,c,q,b,se,N,p);if(R){R=b.fallback,q=c.mode,N=s.child,se=N.sibling;var ge={mode:"hidden",children:b.children};return(q&1)===0&&c.child!==N?(b=c.child,b.childLanes=0,b.pendingProps=ge,c.deletions=null):(b=Ms(N,ge),b.subtreeFlags=N.subtreeFlags&14680064),se!==null?R=Ms(se,R):(R=go(R,q,p,null),R.flags|=2),R.return=c,b.return=c,b.sibling=R,c.child=b,b=R,R=c.child,q=s.child.memoizedState,q=q===null?zg(p):{baseLanes:q.baseLanes|p,cachePool:null,transitions:q.transitions},R.memoizedState=q,R.childLanes=s.childLanes&~p,c.memoizedState=Bg,b}return R=s.child,s=R.sibling,b=Ms(R,{mode:"visible",children:b.children}),(c.mode&1)===0&&(b.lanes=p),b.return=c,b.sibling=null,s!==null&&(p=c.deletions,p===null?(c.deletions=[s],c.flags|=16):p.push(s)),c.child=b,c.memoizedState=null,b}function Ug(s,c){return c=yd({mode:"visible",children:c},s.mode,0,null),c.return=s,s.child=c}function id(s,c,p,b){return b!==null&&pg(b),nl(c,s.child,null,p),s=Ug(c,c.pendingProps.children),s.flags|=2,c.memoizedState=null,s}function qA(s,c,p,b,N,R,q){if(p)return c.flags&256?(c.flags&=-257,b=Og(Error(r(422))),id(s,c,q,b)):c.memoizedState!==null?(c.child=s.child,c.flags|=128,null):(R=b.fallback,N=c.mode,b=yd({mode:"visible",children:b.children},N,0,null),R=go(R,N,q,null),R.flags|=2,b.return=c,R.return=c,b.sibling=R,c.child=b,(c.mode&1)!==0&&nl(c,s.child,null,q),c.child.memoizedState=zg(q),c.memoizedState=Bg,R);if((c.mode&1)===0)return id(s,c,q,null);if(N.data==="$!"){if(b=N.nextSibling&&N.nextSibling.dataset,b)var se=b.dgst;return b=se,R=Error(r(419)),b=Og(R,b,void 0),id(s,c,q,b)}if(se=(q&s.childLanes)!==0,ha||se){if(b=In,b!==null){switch(q&-q){case 4:N=2;break;case 16:N=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:N=32;break;case 536870912:N=268435456;break;default:N=0}N=(N&(b.suspendedLanes|q))!==0?0:N,N!==0&&N!==R.retryLane&&(R.retryLane=N,ss(s,N),bi(b,s,N,-1))}return np(),b=Og(Error(r(421))),id(s,c,q,b)}return N.data==="$?"?(c.flags|=128,c.child=s.child,c=tI.bind(null,s),N._reactRetry=c,null):(s=R.treeContext,Ta=J(N.nextSibling),Ca=c,Qr=!0,hi=null,s!==null&&($a[Wa++]=as,$a[Wa++]=is,$a[Wa++]=no,as=s.id,is=s.overflow,no=c),c=Ug(c,b.children),c.flags|=4096,c)}function S1(s,c,p){s.lanes|=c;var b=s.alternate;b!==null&&(b.lanes|=c),yg(s.return,c,p)}function qg(s,c,p,b,N){var R=s.memoizedState;R===null?s.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:p,tailMode:N}:(R.isBackwards=c,R.rendering=null,R.renderingStartTime=0,R.last=b,R.tail=p,R.tailMode=N)}function E1(s,c,p){var b=c.pendingProps,N=b.revealOrder,R=b.tail;if(aa(s,c,b.children,p),b=en.current,(b&2)!==0)b=b&1|2,c.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=c.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&S1(s,p,c);else if(s.tag===19)S1(s,p,c);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===c)break e;for(;s.sibling===null;){if(s.return===null||s.return===c)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}b&=1}if(Lr(en,b),(c.mode&1)===0)c.memoizedState=null;else switch(N){case"forwards":for(p=c.child,N=null;p!==null;)s=p.alternate,s!==null&&Zu(s)===null&&(N=p),p=p.sibling;p=N,p===null?(N=c.child,c.child=null):(N=p.sibling,p.sibling=null),qg(c,!1,N,p,R);break;case"backwards":for(p=null,N=c.child,c.child=null;N!==null;){if(s=N.alternate,s!==null&&Zu(s)===null){c.child=N;break}s=N.sibling,N.sibling=p,p=N,N=s}qg(c,!0,p,null,R);break;case"together":qg(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function sd(s,c){(c.mode&1)===0&&s!==null&&(s.alternate=null,c.alternate=null,c.flags|=2)}function ls(s,c,p){if(s!==null&&(c.dependencies=s.dependencies),lo|=c.lanes,(p&c.childLanes)===0)return null;if(s!==null&&c.child!==s.child)throw Error(r(153));if(c.child!==null){for(s=c.child,p=Ms(s,s.pendingProps),c.child=p,p.return=c;s.sibling!==null;)s=s.sibling,p=p.sibling=Ms(s,s.pendingProps),p.return=c;p.sibling=null}return c.child}function HA(s,c,p){switch(c.tag){case 3:_1(c),rl();break;case 5:zk(c);break;case 1:sr(c.type)&&Jo(c);break;case 4:kg(c,c.stateNode.containerInfo);break;case 10:var b=c.type._context,N=c.memoizedProps.value;Lr(Ku,b._currentValue),b._currentValue=N;break;case 13:if(b=c.memoizedState,b!==null)return b.dehydrated!==null?(Lr(en,en.current&1),c.flags|=128,null):(p&c.child.childLanes)!==0?N1(s,c,p):(Lr(en,en.current&1),s=ls(s,c,p),s!==null?s.sibling:null);Lr(en,en.current&1);break;case 19:if(b=(p&c.childLanes)!==0,(s.flags&128)!==0){if(b)return E1(s,c,p);c.flags|=128}if(N=c.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),Lr(en,en.current),b)break;return null;case 22:case 23:return c.lanes=0,b1(s,c,p)}return ls(s,c,p)}var j1,Hg,C1,T1;j1=function(s,c){for(var p=c.child;p!==null;){if(p.tag===5||p.tag===6)s.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===c)break;for(;p.sibling===null;){if(p.return===null||p.return===c)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},Hg=function(){},C1=function(s,c,p,b){var N=s.memoizedProps;if(N!==b){s=c.stateNode,so(Bi.current);var R=null;switch(p){case"input":N=lt(s,N),b=lt(s,b),R=[];break;case"select":N=F({},N,{value:void 0}),b=F({},b,{value:void 0}),R=[];break;case"textarea":N=we(s,N),b=we(s,b),R=[];break;default:typeof N.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=de)}nt(p,b);var q;p=null;for(Re in N)if(!b.hasOwnProperty(Re)&&N.hasOwnProperty(Re)&&N[Re]!=null)if(Re==="style"){var se=N[Re];for(q in se)se.hasOwnProperty(q)&&(p||(p={}),p[q]="")}else Re!=="dangerouslySetInnerHTML"&&Re!=="children"&&Re!=="suppressContentEditableWarning"&&Re!=="suppressHydrationWarning"&&Re!=="autoFocus"&&(i.hasOwnProperty(Re)?R||(R=[]):(R=R||[]).push(Re,null));for(Re in b){var ge=b[Re];if(se=N!=null?N[Re]:void 0,b.hasOwnProperty(Re)&&ge!==se&&(ge!=null||se!=null))if(Re==="style")if(se){for(q in se)!se.hasOwnProperty(q)||ge&&ge.hasOwnProperty(q)||(p||(p={}),p[q]="");for(q in ge)ge.hasOwnProperty(q)&&se[q]!==ge[q]&&(p||(p={}),p[q]=ge[q])}else p||(R||(R=[]),R.push(Re,p)),p=ge;else Re==="dangerouslySetInnerHTML"?(ge=ge?ge.__html:void 0,se=se?se.__html:void 0,ge!=null&&se!==ge&&(R=R||[]).push(Re,ge)):Re==="children"?typeof ge!="string"&&typeof ge!="number"||(R=R||[]).push(Re,""+ge):Re!=="suppressContentEditableWarning"&&Re!=="suppressHydrationWarning"&&(i.hasOwnProperty(Re)?(ge!=null&&Re==="onScroll"&&Cr("scroll",s),R||se===ge||(R=[])):(R=R||[]).push(Re,ge))}p&&(R=R||[]).push("style",p);var Re=R;(c.updateQueue=Re)&&(c.flags|=4)}},T1=function(s,c,p,b){p!==b&&(c.flags|=4)};function mc(s,c){if(!Qr)switch(s.tailMode){case"hidden":c=s.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?s.tail=null:p.sibling=null;break;case"collapsed":p=s.tail;for(var b=null;p!==null;)p.alternate!==null&&(b=p),p=p.sibling;b===null?c||s.tail===null?s.tail=null:s.tail.sibling=null:b.sibling=null}}function Hn(s){var c=s.alternate!==null&&s.alternate.child===s.child,p=0,b=0;if(c)for(var N=s.child;N!==null;)p|=N.lanes|N.childLanes,b|=N.subtreeFlags&14680064,b|=N.flags&14680064,N.return=s,N=N.sibling;else for(N=s.child;N!==null;)p|=N.lanes|N.childLanes,b|=N.subtreeFlags,b|=N.flags,N.return=s,N=N.sibling;return s.subtreeFlags|=b,s.childLanes=p,c}function $A(s,c,p){var b=c.pendingProps;switch(dg(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Hn(c),null;case 1:return sr(c.type)&&na(),Hn(c),null;case 3:return b=c.stateNode,sl(),qr(Fn),qr(pn),Ng(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(Vu(c)?c.flags|=4:s===null||s.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,hi!==null&&(ep(hi),hi=null))),Hg(s,c),Hn(c),null;case 5:_g(c);var N=so(dc.current);if(p=c.type,s!==null&&c.stateNode!=null)C1(s,c,p,b,N),s.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!b){if(c.stateNode===null)throw Error(r(166));return Hn(c),null}if(s=so(Bi.current),Vu(c)){b=c.stateNode,p=c.type;var R=c.memoizedProps;switch(b[Le]=c,b[Qe]=R,s=(c.mode&1)!==0,p){case"dialog":Cr("cancel",b),Cr("close",b);break;case"iframe":case"object":case"embed":Cr("load",b);break;case"video":case"audio":for(N=0;N<ts.length;N++)Cr(ts[N],b);break;case"source":Cr("error",b);break;case"img":case"image":case"link":Cr("error",b),Cr("load",b);break;case"details":Cr("toggle",b);break;case"input":Ce(b,R),Cr("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!R.multiple},Cr("invalid",b);break;case"textarea":Ue(b,R),Cr("invalid",b)}nt(p,R),N=null;for(var q in R)if(R.hasOwnProperty(q)){var se=R[q];q==="children"?typeof se=="string"?b.textContent!==se&&(R.suppressHydrationWarning!==!0&&ne(b.textContent,se,s),N=["children",se]):typeof se=="number"&&b.textContent!==""+se&&(R.suppressHydrationWarning!==!0&&ne(b.textContent,se,s),N=["children",""+se]):i.hasOwnProperty(q)&&se!=null&&q==="onScroll"&&Cr("scroll",b)}switch(p){case"input":De(b),gt(b,R,!0);break;case"textarea":De(b),rt(b);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(b.onclick=de)}b=N,c.updateQueue=b,b!==null&&(c.flags|=4)}else{q=N.nodeType===9?N:N.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=fe(p)),s==="http://www.w3.org/1999/xhtml"?p==="script"?(s=q.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=q.createElement(p,{is:b.is}):(s=q.createElement(p),p==="select"&&(q=s,b.multiple?q.multiple=!0:b.size&&(q.size=b.size))):s=q.createElementNS(s,p),s[Le]=c,s[Qe]=b,j1(s,c,!1,!1),c.stateNode=s;e:{switch(q=Pt(p,b),p){case"dialog":Cr("cancel",s),Cr("close",s),N=b;break;case"iframe":case"object":case"embed":Cr("load",s),N=b;break;case"video":case"audio":for(N=0;N<ts.length;N++)Cr(ts[N],s);N=b;break;case"source":Cr("error",s),N=b;break;case"img":case"image":case"link":Cr("error",s),Cr("load",s),N=b;break;case"details":Cr("toggle",s),N=b;break;case"input":Ce(s,b),N=lt(s,b),Cr("invalid",s);break;case"option":N=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},N=F({},b,{value:void 0}),Cr("invalid",s);break;case"textarea":Ue(s,b),N=we(s,b),Cr("invalid",s);break;default:N=b}nt(p,N),se=N;for(R in se)if(se.hasOwnProperty(R)){var ge=se[R];R==="style"?ht(s,ge):R==="dangerouslySetInnerHTML"?(ge=ge?ge.__html:void 0,ge!=null&&ye(s,ge)):R==="children"?typeof ge=="string"?(p!=="textarea"||ge!=="")&&it(s,ge):typeof ge=="number"&&it(s,""+ge):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(i.hasOwnProperty(R)?ge!=null&&R==="onScroll"&&Cr("scroll",s):ge!=null&&E(s,R,ge,q))}switch(p){case"input":De(s),gt(s,b,!1);break;case"textarea":De(s),rt(s);break;case"option":b.value!=null&&s.setAttribute("value",""+Q(b.value));break;case"select":s.multiple=!!b.multiple,R=b.value,R!=null?Ge(s,!!b.multiple,R,!1):b.defaultValue!=null&&Ge(s,!!b.multiple,b.defaultValue,!0);break;default:typeof N.onClick=="function"&&(s.onclick=de)}switch(p){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}}b&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Hn(c),null;case 6:if(s&&c.stateNode!=null)T1(s,c,s.memoizedProps,b);else{if(typeof b!="string"&&c.stateNode===null)throw Error(r(166));if(p=so(dc.current),so(Bi.current),Vu(c)){if(b=c.stateNode,p=c.memoizedProps,b[Le]=c,(R=b.nodeValue!==p)&&(s=Ca,s!==null))switch(s.tag){case 3:ne(b.nodeValue,p,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&ne(b.nodeValue,p,(s.mode&1)!==0)}R&&(c.flags|=4)}else b=(p.nodeType===9?p:p.ownerDocument).createTextNode(b),b[Le]=c,c.stateNode=b}return Hn(c),null;case 13:if(qr(en),b=c.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Qr&&Ta!==null&&(c.mode&1)!==0&&(c.flags&128)===0)Ik(),rl(),c.flags|=98560,R=!1;else if(R=Vu(c),b!==null&&b.dehydrated!==null){if(s===null){if(!R)throw Error(r(318));if(R=c.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(r(317));R[Le]=c}else rl(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Hn(c),R=!1}else hi!==null&&(ep(hi),hi=null),R=!0;if(!R)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=p,c):(b=b!==null,b!==(s!==null&&s.memoizedState!==null)&&b&&(c.child.flags|=8192,(c.mode&1)!==0&&(s===null||(en.current&1)!==0?wn===0&&(wn=3):np())),c.updateQueue!==null&&(c.flags|=4),Hn(c),null);case 4:return sl(),Hg(s,c),s===null&&Js(c.stateNode.containerInfo),Hn(c),null;case 10:return xg(c.type._context),Hn(c),null;case 17:return sr(c.type)&&na(),Hn(c),null;case 19:if(qr(en),R=c.memoizedState,R===null)return Hn(c),null;if(b=(c.flags&128)!==0,q=R.rendering,q===null)if(b)mc(R,!1);else{if(wn!==0||s!==null&&(s.flags&128)!==0)for(s=c.child;s!==null;){if(q=Zu(s),q!==null){for(c.flags|=128,mc(R,!1),b=q.updateQueue,b!==null&&(c.updateQueue=b,c.flags|=4),c.subtreeFlags=0,b=p,p=c.child;p!==null;)R=p,s=b,R.flags&=14680066,q=R.alternate,q===null?(R.childLanes=0,R.lanes=s,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=q.childLanes,R.lanes=q.lanes,R.child=q.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=q.memoizedProps,R.memoizedState=q.memoizedState,R.updateQueue=q.updateQueue,R.type=q.type,s=q.dependencies,R.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),p=p.sibling;return Lr(en,en.current&1|2),c.child}s=s.sibling}R.tail!==null&&vr()>ul&&(c.flags|=128,b=!0,mc(R,!1),c.lanes=4194304)}else{if(!b)if(s=Zu(q),s!==null){if(c.flags|=128,b=!0,p=s.updateQueue,p!==null&&(c.updateQueue=p,c.flags|=4),mc(R,!0),R.tail===null&&R.tailMode==="hidden"&&!q.alternate&&!Qr)return Hn(c),null}else 2*vr()-R.renderingStartTime>ul&&p!==1073741824&&(c.flags|=128,b=!0,mc(R,!1),c.lanes=4194304);R.isBackwards?(q.sibling=c.child,c.child=q):(p=R.last,p!==null?p.sibling=q:c.child=q,R.last=q)}return R.tail!==null?(c=R.tail,R.rendering=c,R.tail=c.sibling,R.renderingStartTime=vr(),c.sibling=null,p=en.current,Lr(en,b?p&1|2:p&1),c):(Hn(c),null);case 22:case 23:return rp(),b=c.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(c.flags|=8192),b&&(c.mode&1)!==0?(Ra&1073741824)!==0&&(Hn(c),c.subtreeFlags&6&&(c.flags|=8192)):Hn(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function WA(s,c){switch(dg(c),c.tag){case 1:return sr(c.type)&&na(),s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 3:return sl(),qr(Fn),qr(pn),Ng(),s=c.flags,(s&65536)!==0&&(s&128)===0?(c.flags=s&-65537|128,c):null;case 5:return _g(c),null;case 13:if(qr(en),s=c.memoizedState,s!==null&&s.dehydrated!==null){if(c.alternate===null)throw Error(r(340));rl()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 19:return qr(en),null;case 4:return sl(),null;case 10:return xg(c.type._context),null;case 22:case 23:return rp(),null;case 24:return null;default:return null}}var od=!1,$n=!1,VA=typeof WeakSet=="function"?WeakSet:Set,Et=null;function ll(s,c){var p=s.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(b){on(s,c,b)}else p.current=null}function $g(s,c,p){try{p()}catch(b){on(s,c,b)}}var R1=!1;function GA(s,c){if(me=Ai,s=Mu(),tc(s)){if("selectionStart"in s)var p={start:s.selectionStart,end:s.selectionEnd};else e:{p=(p=s.ownerDocument)&&p.defaultView||window;var b=p.getSelection&&p.getSelection();if(b&&b.rangeCount!==0){p=b.anchorNode;var N=b.anchorOffset,R=b.focusNode;b=b.focusOffset;try{p.nodeType,R.nodeType}catch{p=null;break e}var q=0,se=-1,ge=-1,Re=0,et=0,ot=s,Ze=null;t:for(;;){for(var vt;ot!==p||N!==0&&ot.nodeType!==3||(se=q+N),ot!==R||b!==0&&ot.nodeType!==3||(ge=q+b),ot.nodeType===3&&(q+=ot.nodeValue.length),(vt=ot.firstChild)!==null;)Ze=ot,ot=vt;for(;;){if(ot===s)break t;if(Ze===p&&++Re===N&&(se=q),Ze===R&&++et===b&&(ge=q),(vt=ot.nextSibling)!==null)break;ot=Ze,Ze=ot.parentNode}ot=vt}p=se===-1||ge===-1?null:{start:se,end:ge}}else p=null}p=p||{start:0,end:0}}else p=null;for(Oe={focusedElem:s,selectionRange:p},Ai=!1,Et=c;Et!==null;)if(c=Et,s=c.child,(c.subtreeFlags&1028)!==0&&s!==null)s.return=c,Et=s;else for(;Et!==null;){c=Et;try{var Tt=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Tt!==null){var At=Tt.memoizedProps,cn=Tt.memoizedState,_e=c.stateNode,xe=_e.getSnapshotBeforeUpdate(c.elementType===c.type?At:mi(c.type,At),cn);_e.__reactInternalSnapshotBeforeUpdate=xe}break;case 3:var je=c.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ft){on(c,c.return,ft)}if(s=c.sibling,s!==null){s.return=c.return,Et=s;break}Et=c.return}return Tt=R1,R1=!1,Tt}function xc(s,c,p){var b=c.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var N=b=b.next;do{if((N.tag&s)===s){var R=N.destroy;N.destroy=void 0,R!==void 0&&$g(c,p,R)}N=N.next}while(N!==b)}}function ld(s,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var p=c=c.next;do{if((p.tag&s)===s){var b=p.create;p.destroy=b()}p=p.next}while(p!==c)}}function Wg(s){var c=s.ref;if(c!==null){var p=s.stateNode;switch(s.tag){case 5:s=p;break;default:s=p}typeof c=="function"?c(s):c.current=s}}function A1(s){var c=s.alternate;c!==null&&(s.alternate=null,A1(c)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(c=s.stateNode,c!==null&&(delete c[Le],delete c[Qe],delete c[Ct],delete c[Rt],delete c[Wt])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function I1(s){return s.tag===5||s.tag===3||s.tag===4}function M1(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||I1(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Vg(s,c,p){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?p.nodeType===8?p.parentNode.insertBefore(s,c):p.insertBefore(s,c):(p.nodeType===8?(c=p.parentNode,c.insertBefore(s,p)):(c=p,c.appendChild(s)),p=p._reactRootContainer,p!=null||c.onclick!==null||(c.onclick=de));else if(b!==4&&(s=s.child,s!==null))for(Vg(s,c,p),s=s.sibling;s!==null;)Vg(s,c,p),s=s.sibling}function Gg(s,c,p){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?p.insertBefore(s,c):p.appendChild(s);else if(b!==4&&(s=s.child,s!==null))for(Gg(s,c,p),s=s.sibling;s!==null;)Gg(s,c,p),s=s.sibling}var Bn=null,xi=!1;function Cs(s,c,p){for(p=p.child;p!==null;)L1(s,c,p),p=p.sibling}function L1(s,c,p){if(er&&typeof er.onCommitFiberUnmount=="function")try{er.onCommitFiberUnmount(Ht,p)}catch{}switch(p.tag){case 5:$n||ll(p,c);case 6:var b=Bn,N=xi;Bn=null,Cs(s,c,p),Bn=b,xi=N,Bn!==null&&(xi?(s=Bn,p=p.stateNode,s.nodeType===8?s.parentNode.removeChild(p):s.removeChild(p)):Bn.removeChild(p.stateNode));break;case 18:Bn!==null&&(xi?(s=Bn,p=p.stateNode,s.nodeType===8?ke(s.parentNode,p):s.nodeType===1&&ke(s,p),Ri(s)):ke(Bn,p.stateNode));break;case 4:b=Bn,N=xi,Bn=p.stateNode.containerInfo,xi=!0,Cs(s,c,p),Bn=b,xi=N;break;case 0:case 11:case 14:case 15:if(!$n&&(b=p.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){N=b=b.next;do{var R=N,q=R.destroy;R=R.tag,q!==void 0&&((R&2)!==0||(R&4)!==0)&&$g(p,c,q),N=N.next}while(N!==b)}Cs(s,c,p);break;case 1:if(!$n&&(ll(p,c),b=p.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=p.memoizedProps,b.state=p.memoizedState,b.componentWillUnmount()}catch(se){on(p,c,se)}Cs(s,c,p);break;case 21:Cs(s,c,p);break;case 22:p.mode&1?($n=(b=$n)||p.memoizedState!==null,Cs(s,c,p),$n=b):Cs(s,c,p);break;default:Cs(s,c,p)}}function O1(s){var c=s.updateQueue;if(c!==null){s.updateQueue=null;var p=s.stateNode;p===null&&(p=s.stateNode=new VA),c.forEach(function(b){var N=rI.bind(null,s,b);p.has(b)||(p.add(b),b.then(N,N))})}}function yi(s,c){var p=c.deletions;if(p!==null)for(var b=0;b<p.length;b++){var N=p[b];try{var R=s,q=c,se=q;e:for(;se!==null;){switch(se.tag){case 5:Bn=se.stateNode,xi=!1;break e;case 3:Bn=se.stateNode.containerInfo,xi=!0;break e;case 4:Bn=se.stateNode.containerInfo,xi=!0;break e}se=se.return}if(Bn===null)throw Error(r(160));L1(R,q,N),Bn=null,xi=!1;var ge=N.alternate;ge!==null&&(ge.return=null),N.return=null}catch(Re){on(N,c,Re)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)D1(c,s),c=c.sibling}function D1(s,c){var p=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(yi(c,s),Ui(s),b&4){try{xc(3,s,s.return),ld(3,s)}catch(At){on(s,s.return,At)}try{xc(5,s,s.return)}catch(At){on(s,s.return,At)}}break;case 1:yi(c,s),Ui(s),b&512&&p!==null&&ll(p,p.return);break;case 5:if(yi(c,s),Ui(s),b&512&&p!==null&&ll(p,p.return),s.flags&32){var N=s.stateNode;try{it(N,"")}catch(At){on(s,s.return,At)}}if(b&4&&(N=s.stateNode,N!=null)){var R=s.memoizedProps,q=p!==null?p.memoizedProps:R,se=s.type,ge=s.updateQueue;if(s.updateQueue=null,ge!==null)try{se==="input"&&R.type==="radio"&&R.name!=null&&$e(N,R),Pt(se,q);var Re=Pt(se,R);for(q=0;q<ge.length;q+=2){var et=ge[q],ot=ge[q+1];et==="style"?ht(N,ot):et==="dangerouslySetInnerHTML"?ye(N,ot):et==="children"?it(N,ot):E(N,et,ot,Re)}switch(se){case"input":Be(N,R);break;case"textarea":Ae(N,R);break;case"select":var Ze=N._wrapperState.wasMultiple;N._wrapperState.wasMultiple=!!R.multiple;var vt=R.value;vt!=null?Ge(N,!!R.multiple,vt,!1):Ze!==!!R.multiple&&(R.defaultValue!=null?Ge(N,!!R.multiple,R.defaultValue,!0):Ge(N,!!R.multiple,R.multiple?[]:"",!1))}N[Qe]=R}catch(At){on(s,s.return,At)}}break;case 6:if(yi(c,s),Ui(s),b&4){if(s.stateNode===null)throw Error(r(162));N=s.stateNode,R=s.memoizedProps;try{N.nodeValue=R}catch(At){on(s,s.return,At)}}break;case 3:if(yi(c,s),Ui(s),b&4&&p!==null&&p.memoizedState.isDehydrated)try{Ri(c.containerInfo)}catch(At){on(s,s.return,At)}break;case 4:yi(c,s),Ui(s);break;case 13:yi(c,s),Ui(s),N=s.child,N.flags&8192&&(R=N.memoizedState!==null,N.stateNode.isHidden=R,!R||N.alternate!==null&&N.alternate.memoizedState!==null||(Xg=vr())),b&4&&O1(s);break;case 22:if(et=p!==null&&p.memoizedState!==null,s.mode&1?($n=(Re=$n)||et,yi(c,s),$n=Re):yi(c,s),Ui(s),b&8192){if(Re=s.memoizedState!==null,(s.stateNode.isHidden=Re)&&!et&&(s.mode&1)!==0)for(Et=s,et=s.child;et!==null;){for(ot=Et=et;Et!==null;){switch(Ze=Et,vt=Ze.child,Ze.tag){case 0:case 11:case 14:case 15:xc(4,Ze,Ze.return);break;case 1:ll(Ze,Ze.return);var Tt=Ze.stateNode;if(typeof Tt.componentWillUnmount=="function"){b=Ze,p=Ze.return;try{c=b,Tt.props=c.memoizedProps,Tt.state=c.memoizedState,Tt.componentWillUnmount()}catch(At){on(b,p,At)}}break;case 5:ll(Ze,Ze.return);break;case 22:if(Ze.memoizedState!==null){B1(ot);continue}}vt!==null?(vt.return=Ze,Et=vt):B1(ot)}et=et.sibling}e:for(et=null,ot=s;;){if(ot.tag===5){if(et===null){et=ot;try{N=ot.stateNode,Re?(R=N.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(se=ot.stateNode,ge=ot.memoizedProps.style,q=ge!=null&&ge.hasOwnProperty("display")?ge.display:null,se.style.display=yt("display",q))}catch(At){on(s,s.return,At)}}}else if(ot.tag===6){if(et===null)try{ot.stateNode.nodeValue=Re?"":ot.memoizedProps}catch(At){on(s,s.return,At)}}else if((ot.tag!==22&&ot.tag!==23||ot.memoizedState===null||ot===s)&&ot.child!==null){ot.child.return=ot,ot=ot.child;continue}if(ot===s)break e;for(;ot.sibling===null;){if(ot.return===null||ot.return===s)break e;et===ot&&(et=null),ot=ot.return}et===ot&&(et=null),ot.sibling.return=ot.return,ot=ot.sibling}}break;case 19:yi(c,s),Ui(s),b&4&&O1(s);break;case 21:break;default:yi(c,s),Ui(s)}}function Ui(s){var c=s.flags;if(c&2){try{e:{for(var p=s.return;p!==null;){if(I1(p)){var b=p;break e}p=p.return}throw Error(r(160))}switch(b.tag){case 5:var N=b.stateNode;b.flags&32&&(it(N,""),b.flags&=-33);var R=M1(s);Gg(s,R,N);break;case 3:case 4:var q=b.stateNode.containerInfo,se=M1(s);Vg(s,se,q);break;default:throw Error(r(161))}}catch(ge){on(s,s.return,ge)}s.flags&=-3}c&4096&&(s.flags&=-4097)}function KA(s,c,p){Et=s,P1(s)}function P1(s,c,p){for(var b=(s.mode&1)!==0;Et!==null;){var N=Et,R=N.child;if(N.tag===22&&b){var q=N.memoizedState!==null||od;if(!q){var se=N.alternate,ge=se!==null&&se.memoizedState!==null||$n;se=od;var Re=$n;if(od=q,($n=ge)&&!Re)for(Et=N;Et!==null;)q=Et,ge=q.child,q.tag===22&&q.memoizedState!==null?z1(N):ge!==null?(ge.return=q,Et=ge):z1(N);for(;R!==null;)Et=R,P1(R),R=R.sibling;Et=N,od=se,$n=Re}F1(s)}else(N.subtreeFlags&8772)!==0&&R!==null?(R.return=N,Et=R):F1(s)}}function F1(s){for(;Et!==null;){var c=Et;if((c.flags&8772)!==0){var p=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:$n||ld(5,c);break;case 1:var b=c.stateNode;if(c.flags&4&&!$n)if(p===null)b.componentDidMount();else{var N=c.elementType===c.type?p.memoizedProps:mi(c.type,p.memoizedProps);b.componentDidUpdate(N,p.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var R=c.updateQueue;R!==null&&Bk(c,R,b);break;case 3:var q=c.updateQueue;if(q!==null){if(p=null,c.child!==null)switch(c.child.tag){case 5:p=c.child.stateNode;break;case 1:p=c.child.stateNode}Bk(c,q,p)}break;case 5:var se=c.stateNode;if(p===null&&c.flags&4){p=se;var ge=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":ge.autoFocus&&p.focus();break;case"img":ge.src&&(p.src=ge.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var Re=c.alternate;if(Re!==null){var et=Re.memoizedState;if(et!==null){var ot=et.dehydrated;ot!==null&&Ri(ot)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}$n||c.flags&512&&Wg(c)}catch(Ze){on(c,c.return,Ze)}}if(c===s){Et=null;break}if(p=c.sibling,p!==null){p.return=c.return,Et=p;break}Et=c.return}}function B1(s){for(;Et!==null;){var c=Et;if(c===s){Et=null;break}var p=c.sibling;if(p!==null){p.return=c.return,Et=p;break}Et=c.return}}function z1(s){for(;Et!==null;){var c=Et;try{switch(c.tag){case 0:case 11:case 15:var p=c.return;try{ld(4,c)}catch(ge){on(c,p,ge)}break;case 1:var b=c.stateNode;if(typeof b.componentDidMount=="function"){var N=c.return;try{b.componentDidMount()}catch(ge){on(c,N,ge)}}var R=c.return;try{Wg(c)}catch(ge){on(c,R,ge)}break;case 5:var q=c.return;try{Wg(c)}catch(ge){on(c,q,ge)}}}catch(ge){on(c,c.return,ge)}if(c===s){Et=null;break}var se=c.sibling;if(se!==null){se.return=c.return,Et=se;break}Et=c.return}}var YA=Math.ceil,cd=A.ReactCurrentDispatcher,Kg=A.ReactCurrentOwner,Ka=A.ReactCurrentBatchConfig,Nr=0,In=null,hn=null,zn=0,Ra=0,cl=pa(0),wn=0,yc=null,lo=0,ud=0,Yg=0,bc=null,ma=null,Xg=0,ul=1/0,cs=null,dd=!1,Qg=null,Ts=null,fd=!1,Rs=null,gd=0,vc=0,Zg=null,pd=-1,hd=0;function ia(){return(Nr&6)!==0?vr():pd!==-1?pd:pd=vr()}function As(s){return(s.mode&1)===0?1:(Nr&2)!==0&&zn!==0?zn&-zn:IA.transition!==null?(hd===0&&(hd=Fa()),hd):(s=dr,s!==0||(s=window.event,s=s===void 0?16:Po(s.type)),s)}function bi(s,c,p,b){if(50<vc)throw vc=0,Zg=null,Error(r(185));Jn(s,p,b),((Nr&2)===0||s!==In)&&(s===In&&((Nr&2)===0&&(ud|=p),wn===4&&Is(s,zn)),xa(s,b),p===1&&Nr===0&&(c.mode&1)===0&&(ul=vr()+500,Hu&&Ss()))}function xa(s,c){var p=s.callbackNode;vn(s,c);var b=jn(s,s===In?zn:0);if(b===0)p!==null&&dn(p),s.callbackNode=null,s.callbackPriority=0;else if(c=b&-b,s.callbackPriority!==c){if(p!=null&&dn(p),c===1)s.tag===0?AA(q1.bind(null,s)):jk(q1.bind(null,s)),Or(function(){(Nr&6)===0&&Ss()}),p=null;else{switch(He(b)){case 1:p=bn;break;case 4:p=ii;break;case 16:p=nn;break;case 536870912:p=Nt;break;default:p=nn}p=X1(p,U1.bind(null,s))}s.callbackPriority=c,s.callbackNode=p}}function U1(s,c){if(pd=-1,hd=0,(Nr&6)!==0)throw Error(r(327));var p=s.callbackNode;if(dl()&&s.callbackNode!==p)return null;var b=jn(s,s===In?zn:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||c)c=md(s,b);else{c=b;var N=Nr;Nr|=2;var R=$1();(In!==s||zn!==c)&&(cs=null,ul=vr()+500,uo(s,c));do try{ZA();break}catch(se){H1(s,se)}while(!0);mg(),cd.current=R,Nr=N,hn!==null?c=0:(In=null,zn=0,c=wn)}if(c!==0){if(c===2&&(N=Yi(s),N!==0&&(b=N,c=Jg(s,N))),c===1)throw p=yc,uo(s,0),Is(s,b),xa(s,vr()),p;if(c===6)Is(s,b);else{if(N=s.current.alternate,(b&30)===0&&!XA(N)&&(c=md(s,b),c===2&&(R=Yi(s),R!==0&&(b=R,c=Jg(s,R))),c===1))throw p=yc,uo(s,0),Is(s,b),xa(s,vr()),p;switch(s.finishedWork=N,s.finishedLanes=b,c){case 0:case 1:throw Error(r(345));case 2:fo(s,ma,cs);break;case 3:if(Is(s,b),(b&130023424)===b&&(c=Xg+500-vr(),10<c)){if(jn(s,0)!==0)break;if(N=s.suspendedLanes,(N&b)!==b){ia(),s.pingedLanes|=s.suspendedLanes&N;break}s.timeoutHandle=St(fo.bind(null,s,ma,cs),c);break}fo(s,ma,cs);break;case 4:if(Is(s,b),(b&4194240)===b)break;for(c=s.eventTimes,N=-1;0<b;){var q=31-tr(b);R=1<<q,q=c[q],q>N&&(N=q),b&=~R}if(b=N,b=vr()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*YA(b/1960))-b,10<b){s.timeoutHandle=St(fo.bind(null,s,ma,cs),b);break}fo(s,ma,cs);break;case 5:fo(s,ma,cs);break;default:throw Error(r(329))}}}return xa(s,vr()),s.callbackNode===p?U1.bind(null,s):null}function Jg(s,c){var p=bc;return s.current.memoizedState.isDehydrated&&(uo(s,c).flags|=256),s=md(s,c),s!==2&&(c=ma,ma=p,c!==null&&ep(c)),s}function ep(s){ma===null?ma=s:ma.push.apply(ma,s)}function XA(s){for(var c=s;;){if(c.flags&16384){var p=c.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var b=0;b<p.length;b++){var N=p[b],R=N.getSnapshot;N=N.value;try{if(!Ea(R(),N))return!1}catch{return!1}}}if(p=c.child,c.subtreeFlags&16384&&p!==null)p.return=c,c=p;else{if(c===s)break;for(;c.sibling===null;){if(c.return===null||c.return===s)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Is(s,c){for(c&=~Yg,c&=~ud,s.suspendedLanes|=c,s.pingedLanes&=~c,s=s.expirationTimes;0<c;){var p=31-tr(c),b=1<<p;s[p]=-1,c&=~b}}function q1(s){if((Nr&6)!==0)throw Error(r(327));dl();var c=jn(s,0);if((c&1)===0)return xa(s,vr()),null;var p=md(s,c);if(s.tag!==0&&p===2){var b=Yi(s);b!==0&&(c=b,p=Jg(s,b))}if(p===1)throw p=yc,uo(s,0),Is(s,c),xa(s,vr()),p;if(p===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=c,fo(s,ma,cs),xa(s,vr()),null}function tp(s,c){var p=Nr;Nr|=1;try{return s(c)}finally{Nr=p,Nr===0&&(ul=vr()+500,Hu&&Ss())}}function co(s){Rs!==null&&Rs.tag===0&&(Nr&6)===0&&dl();var c=Nr;Nr|=1;var p=Ka.transition,b=dr;try{if(Ka.transition=null,dr=1,s)return s()}finally{dr=b,Ka.transition=p,Nr=c,(Nr&6)===0&&Ss()}}function rp(){Ra=cl.current,qr(cl)}function uo(s,c){s.finishedWork=null,s.finishedLanes=0;var p=s.timeoutHandle;if(p!==-1&&(s.timeoutHandle=-1,Tr(p)),hn!==null)for(p=hn.return;p!==null;){var b=p;switch(dg(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&na();break;case 3:sl(),qr(Fn),qr(pn),Ng();break;case 5:_g(b);break;case 4:sl();break;case 13:qr(en);break;case 19:qr(en);break;case 10:xg(b.type._context);break;case 22:case 23:rp()}p=p.return}if(In=s,hn=s=Ms(s.current,null),zn=Ra=c,wn=0,yc=null,Yg=ud=lo=0,ma=bc=null,io!==null){for(c=0;c<io.length;c++)if(p=io[c],b=p.interleaved,b!==null){p.interleaved=null;var N=b.next,R=p.pending;if(R!==null){var q=R.next;R.next=N,b.next=q}p.pending=b}io=null}return s}function H1(s,c){do{var p=hn;try{if(mg(),Ju.current=nd,ed){for(var b=tn.memoizedState;b!==null;){var N=b.queue;N!==null&&(N.pending=null),b=b.next}ed=!1}if(oo=0,An=_n=tn=null,fc=!1,gc=0,Kg.current=null,p===null||p.return===null){wn=1,yc=c,hn=null;break}e:{var R=s,q=p.return,se=p,ge=c;if(c=zn,se.flags|=32768,ge!==null&&typeof ge=="object"&&typeof ge.then=="function"){var Re=ge,et=se,ot=et.tag;if((et.mode&1)===0&&(ot===0||ot===11||ot===15)){var Ze=et.alternate;Ze?(et.updateQueue=Ze.updateQueue,et.memoizedState=Ze.memoizedState,et.lanes=Ze.lanes):(et.updateQueue=null,et.memoizedState=null)}var vt=p1(q);if(vt!==null){vt.flags&=-257,h1(vt,q,se,R,c),vt.mode&1&&g1(R,Re,c),c=vt,ge=Re;var Tt=c.updateQueue;if(Tt===null){var At=new Set;At.add(ge),c.updateQueue=At}else Tt.add(ge);break e}else{if((c&1)===0){g1(R,Re,c),np();break e}ge=Error(r(426))}}else if(Qr&&se.mode&1){var cn=p1(q);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),h1(cn,q,se,R,c),pg(ol(ge,se));break e}}R=ge=ol(ge,se),wn!==4&&(wn=2),bc===null?bc=[R]:bc.push(R),R=q;do{switch(R.tag){case 3:R.flags|=65536,c&=-c,R.lanes|=c;var _e=d1(R,ge,c);Fk(R,_e);break e;case 1:se=ge;var xe=R.type,je=R.stateNode;if((R.flags&128)===0&&(typeof xe.getDerivedStateFromError=="function"||je!==null&&typeof je.componentDidCatch=="function"&&(Ts===null||!Ts.has(je)))){R.flags|=65536,c&=-c,R.lanes|=c;var ft=f1(R,se,c);Fk(R,ft);break e}}R=R.return}while(R!==null)}V1(p)}catch(Lt){c=Lt,hn===p&&p!==null&&(hn=p=p.return);continue}break}while(!0)}function $1(){var s=cd.current;return cd.current=nd,s===null?nd:s}function np(){(wn===0||wn===3||wn===2)&&(wn=4),In===null||(lo&268435455)===0&&(ud&268435455)===0||Is(In,zn)}function md(s,c){var p=Nr;Nr|=2;var b=$1();(In!==s||zn!==c)&&(cs=null,uo(s,c));do try{QA();break}catch(N){H1(s,N)}while(!0);if(mg(),Nr=p,cd.current=b,hn!==null)throw Error(r(261));return In=null,zn=0,wn}function QA(){for(;hn!==null;)W1(hn)}function ZA(){for(;hn!==null&&!Ei();)W1(hn)}function W1(s){var c=Y1(s.alternate,s,Ra);s.memoizedProps=s.pendingProps,c===null?V1(s):hn=c,Kg.current=null}function V1(s){var c=s;do{var p=c.alternate;if(s=c.return,(c.flags&32768)===0){if(p=$A(p,c,Ra),p!==null){hn=p;return}}else{if(p=WA(p,c),p!==null){p.flags&=32767,hn=p;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{wn=6,hn=null;return}}if(c=c.sibling,c!==null){hn=c;return}hn=c=s}while(c!==null);wn===0&&(wn=5)}function fo(s,c,p){var b=dr,N=Ka.transition;try{Ka.transition=null,dr=1,JA(s,c,p,b)}finally{Ka.transition=N,dr=b}return null}function JA(s,c,p,b){do dl();while(Rs!==null);if((Nr&6)!==0)throw Error(r(327));p=s.finishedWork;var N=s.finishedLanes;if(p===null)return null;if(s.finishedWork=null,s.finishedLanes=0,p===s.current)throw Error(r(177));s.callbackNode=null,s.callbackPriority=0;var R=p.lanes|p.childLanes;if(On(s,R),s===In&&(hn=In=null,zn=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||fd||(fd=!0,X1(nn,function(){return dl(),null})),R=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||R){R=Ka.transition,Ka.transition=null;var q=dr;dr=1;var se=Nr;Nr|=4,Kg.current=null,GA(s,p),D1(p,s),sg(Oe),Ai=!!me,Oe=me=null,s.current=p,KA(p),Xn(),Nr=se,dr=q,Ka.transition=R}else s.current=p;if(fd&&(fd=!1,Rs=s,gd=N),R=s.pendingLanes,R===0&&(Ts=null),ur(p.stateNode),xa(s,vr()),c!==null)for(b=s.onRecoverableError,p=0;p<c.length;p++)N=c[p],b(N.value,{componentStack:N.stack,digest:N.digest});if(dd)throw dd=!1,s=Qg,Qg=null,s;return(gd&1)!==0&&s.tag!==0&&dl(),R=s.pendingLanes,(R&1)!==0?s===Zg?vc++:(vc=0,Zg=s):vc=0,Ss(),null}function dl(){if(Rs!==null){var s=He(gd),c=Ka.transition,p=dr;try{if(Ka.transition=null,dr=16>s?16:s,Rs===null)var b=!1;else{if(s=Rs,Rs=null,gd=0,(Nr&6)!==0)throw Error(r(331));var N=Nr;for(Nr|=4,Et=s.current;Et!==null;){var R=Et,q=R.child;if((Et.flags&16)!==0){var se=R.deletions;if(se!==null){for(var ge=0;ge<se.length;ge++){var Re=se[ge];for(Et=Re;Et!==null;){var et=Et;switch(et.tag){case 0:case 11:case 15:xc(8,et,R)}var ot=et.child;if(ot!==null)ot.return=et,Et=ot;else for(;Et!==null;){et=Et;var Ze=et.sibling,vt=et.return;if(A1(et),et===Re){Et=null;break}if(Ze!==null){Ze.return=vt,Et=Ze;break}Et=vt}}}var Tt=R.alternate;if(Tt!==null){var At=Tt.child;if(At!==null){Tt.child=null;do{var cn=At.sibling;At.sibling=null,At=cn}while(At!==null)}}Et=R}}if((R.subtreeFlags&2064)!==0&&q!==null)q.return=R,Et=q;else e:for(;Et!==null;){if(R=Et,(R.flags&2048)!==0)switch(R.tag){case 0:case 11:case 15:xc(9,R,R.return)}var _e=R.sibling;if(_e!==null){_e.return=R.return,Et=_e;break e}Et=R.return}}var xe=s.current;for(Et=xe;Et!==null;){q=Et;var je=q.child;if((q.subtreeFlags&2064)!==0&&je!==null)je.return=q,Et=je;else e:for(q=xe;Et!==null;){if(se=Et,(se.flags&2048)!==0)try{switch(se.tag){case 0:case 11:case 15:ld(9,se)}}catch(Lt){on(se,se.return,Lt)}if(se===q){Et=null;break e}var ft=se.sibling;if(ft!==null){ft.return=se.return,Et=ft;break e}Et=se.return}}if(Nr=N,Ss(),er&&typeof er.onPostCommitFiberRoot=="function")try{er.onPostCommitFiberRoot(Ht,s)}catch{}b=!0}return b}finally{dr=p,Ka.transition=c}}return!1}function G1(s,c,p){c=ol(p,c),c=d1(s,c,1),s=js(s,c,1),c=ia(),s!==null&&(Jn(s,1,c),xa(s,c))}function on(s,c,p){if(s.tag===3)G1(s,s,p);else for(;c!==null;){if(c.tag===3){G1(c,s,p);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Ts===null||!Ts.has(b))){s=ol(p,s),s=f1(c,s,1),c=js(c,s,1),s=ia(),c!==null&&(Jn(c,1,s),xa(c,s));break}}c=c.return}}function eI(s,c,p){var b=s.pingCache;b!==null&&b.delete(c),c=ia(),s.pingedLanes|=s.suspendedLanes&p,In===s&&(zn&p)===p&&(wn===4||wn===3&&(zn&130023424)===zn&&500>vr()-Xg?uo(s,0):Yg|=p),xa(s,c)}function K1(s,c){c===0&&((s.mode&1)===0?c=1:(c=fn,fn<<=1,(fn&130023424)===0&&(fn=4194304)));var p=ia();s=ss(s,c),s!==null&&(Jn(s,c,p),xa(s,p))}function tI(s){var c=s.memoizedState,p=0;c!==null&&(p=c.retryLane),K1(s,p)}function rI(s,c){var p=0;switch(s.tag){case 13:var b=s.stateNode,N=s.memoizedState;N!==null&&(p=N.retryLane);break;case 19:b=s.stateNode;break;default:throw Error(r(314))}b!==null&&b.delete(c),K1(s,p)}var Y1;Y1=function(s,c,p){if(s!==null)if(s.memoizedProps!==c.pendingProps||Fn.current)ha=!0;else{if((s.lanes&p)===0&&(c.flags&128)===0)return ha=!1,HA(s,c,p);ha=(s.flags&131072)!==0}else ha=!1,Qr&&(c.flags&1048576)!==0&&Ck(c,Wu,c.index);switch(c.lanes=0,c.tag){case 2:var b=c.type;sd(s,c),s=c.pendingProps;var N=rs(c,pn.current);il(c,p),N=jg(null,c,b,s,N,p);var R=Cg();return c.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,sr(b)?(R=!0,Jo(c)):R=!1,c.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,vg(c),N.updater=ad,c.stateNode=N,N._reactInternals=c,Lg(c,b,s,p),c=Fg(null,c,b,!0,R,p)):(c.tag=0,Qr&&R&&ug(c),aa(null,c,N,p),c=c.child),c;case 16:b=c.elementType;e:{switch(sd(s,c),s=c.pendingProps,N=b._init,b=N(b._payload),c.type=b,N=c.tag=aI(b),s=mi(b,s),N){case 0:c=Pg(null,c,b,s,p);break e;case 1:c=k1(null,c,b,s,p);break e;case 11:c=m1(null,c,b,s,p);break e;case 14:c=x1(null,c,b,mi(b.type,s),p);break e}throw Error(r(306,b,""))}return c;case 0:return b=c.type,N=c.pendingProps,N=c.elementType===b?N:mi(b,N),Pg(s,c,b,N,p);case 1:return b=c.type,N=c.pendingProps,N=c.elementType===b?N:mi(b,N),k1(s,c,b,N,p);case 3:e:{if(_1(c),s===null)throw Error(r(387));b=c.pendingProps,R=c.memoizedState,N=R.element,Pk(s,c),Qu(c,b,null,p);var q=c.memoizedState;if(b=q.element,R.isDehydrated)if(R={element:b,isDehydrated:!1,cache:q.cache,pendingSuspenseBoundaries:q.pendingSuspenseBoundaries,transitions:q.transitions},c.updateQueue.baseState=R,c.memoizedState=R,c.flags&256){N=ol(Error(r(423)),c),c=w1(s,c,b,p,N);break e}else if(b!==N){N=ol(Error(r(424)),c),c=w1(s,c,b,p,N);break e}else for(Ta=J(c.stateNode.containerInfo.firstChild),Ca=c,Qr=!0,hi=null,p=Ok(c,null,b,p),c.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(rl(),b===N){c=ls(s,c,p);break e}aa(s,c,b,p)}c=c.child}return c;case 5:return zk(c),s===null&&gg(c),b=c.type,N=c.pendingProps,R=s!==null?s.memoizedProps:null,q=N.children,Ie(b,N)?q=null:R!==null&&Ie(b,R)&&(c.flags|=32),v1(s,c),aa(s,c,q,p),c.child;case 6:return s===null&&gg(c),null;case 13:return N1(s,c,p);case 4:return kg(c,c.stateNode.containerInfo),b=c.pendingProps,s===null?c.child=nl(c,null,b,p):aa(s,c,b,p),c.child;case 11:return b=c.type,N=c.pendingProps,N=c.elementType===b?N:mi(b,N),m1(s,c,b,N,p);case 7:return aa(s,c,c.pendingProps,p),c.child;case 8:return aa(s,c,c.pendingProps.children,p),c.child;case 12:return aa(s,c,c.pendingProps.children,p),c.child;case 10:e:{if(b=c.type._context,N=c.pendingProps,R=c.memoizedProps,q=N.value,Lr(Ku,b._currentValue),b._currentValue=q,R!==null)if(Ea(R.value,q)){if(R.children===N.children&&!Fn.current){c=ls(s,c,p);break e}}else for(R=c.child,R!==null&&(R.return=c);R!==null;){var se=R.dependencies;if(se!==null){q=R.child;for(var ge=se.firstContext;ge!==null;){if(ge.context===b){if(R.tag===1){ge=os(-1,p&-p),ge.tag=2;var Re=R.updateQueue;if(Re!==null){Re=Re.shared;var et=Re.pending;et===null?ge.next=ge:(ge.next=et.next,et.next=ge),Re.pending=ge}}R.lanes|=p,ge=R.alternate,ge!==null&&(ge.lanes|=p),yg(R.return,p,c),se.lanes|=p;break}ge=ge.next}}else if(R.tag===10)q=R.type===c.type?null:R.child;else if(R.tag===18){if(q=R.return,q===null)throw Error(r(341));q.lanes|=p,se=q.alternate,se!==null&&(se.lanes|=p),yg(q,p,c),q=R.sibling}else q=R.child;if(q!==null)q.return=R;else for(q=R;q!==null;){if(q===c){q=null;break}if(R=q.sibling,R!==null){R.return=q.return,q=R;break}q=q.return}R=q}aa(s,c,N.children,p),c=c.child}return c;case 9:return N=c.type,b=c.pendingProps.children,il(c,p),N=Va(N),b=b(N),c.flags|=1,aa(s,c,b,p),c.child;case 14:return b=c.type,N=mi(b,c.pendingProps),N=mi(b.type,N),x1(s,c,b,N,p);case 15:return y1(s,c,c.type,c.pendingProps,p);case 17:return b=c.type,N=c.pendingProps,N=c.elementType===b?N:mi(b,N),sd(s,c),c.tag=1,sr(b)?(s=!0,Jo(c)):s=!1,il(c,p),c1(c,b,N),Lg(c,b,N,p),Fg(null,c,b,!0,s,p);case 19:return E1(s,c,p);case 22:return b1(s,c,p)}throw Error(r(156,c.tag))};function X1(s,c){return ai(s,c)}function nI(s,c,p,b){this.tag=s,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ya(s,c,p,b){return new nI(s,c,p,b)}function ap(s){return s=s.prototype,!(!s||!s.isReactComponent)}function aI(s){if(typeof s=="function")return ap(s)?1:0;if(s!=null){if(s=s.$$typeof,s===z)return 11;if(s===M)return 14}return 2}function Ms(s,c){var p=s.alternate;return p===null?(p=Ya(s.tag,c,s.key,s.mode),p.elementType=s.elementType,p.type=s.type,p.stateNode=s.stateNode,p.alternate=s,s.alternate=p):(p.pendingProps=c,p.type=s.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=s.flags&14680064,p.childLanes=s.childLanes,p.lanes=s.lanes,p.child=s.child,p.memoizedProps=s.memoizedProps,p.memoizedState=s.memoizedState,p.updateQueue=s.updateQueue,c=s.dependencies,p.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},p.sibling=s.sibling,p.index=s.index,p.ref=s.ref,p}function xd(s,c,p,b,N,R){var q=2;if(b=s,typeof s=="function")ap(s)&&(q=1);else if(typeof s=="string")q=5;else e:switch(s){case j:return go(p.children,N,R,c);case L:q=8,N|=8;break;case O:return s=Ya(12,p,c,N|2),s.elementType=O,s.lanes=R,s;case ee:return s=Ya(13,p,c,N),s.elementType=ee,s.lanes=R,s;case $:return s=Ya(19,p,c,N),s.elementType=$,s.lanes=R,s;case Y:return yd(p,N,R,c);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case I:q=10;break e;case B:q=9;break e;case z:q=11;break e;case M:q=14;break e;case G:q=16,b=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return c=Ya(q,p,c,N),c.elementType=s,c.type=b,c.lanes=R,c}function go(s,c,p,b){return s=Ya(7,s,b,c),s.lanes=p,s}function yd(s,c,p,b){return s=Ya(22,s,b,c),s.elementType=Y,s.lanes=p,s.stateNode={isHidden:!1},s}function ip(s,c,p){return s=Ya(6,s,null,c),s.lanes=p,s}function sp(s,c,p){return c=Ya(4,s.children!==null?s.children:[],s.key,c),c.lanes=p,c.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},c}function iI(s,c,p,b,N){this.tag=c,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Un(0),this.expirationTimes=Un(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Un(0),this.identifierPrefix=b,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function op(s,c,p,b,N,R,q,se,ge){return s=new iI(s,c,p,se,ge),c===1?(c=1,R===!0&&(c|=8)):c=0,R=Ya(3,null,null,c),s.current=R,R.stateNode=s,R.memoizedState={element:b,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},vg(R),s}function sI(s,c,p){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:C,key:b==null?null:""+b,children:s,containerInfo:c,implementation:p}}function Q1(s){if(!s)return pi;s=s._reactInternals;e:{if(Wr(s)!==s||s.tag!==1)throw Error(r(170));var c=s;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(sr(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(r(171))}if(s.tag===1){var p=s.type;if(sr(p))return Rn(s,p,c)}return c}function Z1(s,c,p,b,N,R,q,se,ge){return s=op(p,b,!0,s,N,R,q,se,ge),s.context=Q1(null),p=s.current,b=ia(),N=As(p),R=os(b,N),R.callback=c??null,js(p,R,N),s.current.lanes=N,Jn(s,N,b),xa(s,b),s}function bd(s,c,p,b){var N=c.current,R=ia(),q=As(N);return p=Q1(p),c.context===null?c.context=p:c.pendingContext=p,c=os(R,q),c.payload={element:s},b=b===void 0?null:b,b!==null&&(c.callback=b),s=js(N,c,q),s!==null&&(bi(s,N,q,R),Xu(s,N,q)),q}function vd(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function J1(s,c){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var p=s.retryLane;s.retryLane=p!==0&&p<c?p:c}}function lp(s,c){J1(s,c),(s=s.alternate)&&J1(s,c)}function oI(){return null}var e_=typeof reportError=="function"?reportError:function(s){console.error(s)};function cp(s){this._internalRoot=s}kd.prototype.render=cp.prototype.render=function(s){var c=this._internalRoot;if(c===null)throw Error(r(409));bd(s,c,null,null)},kd.prototype.unmount=cp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var c=s.containerInfo;co(function(){bd(null,s,null,null)}),c[mt]=null}};function kd(s){this._internalRoot=s}kd.prototype.unstable_scheduleHydration=function(s){if(s){var c=Ba();s={blockedOn:null,target:s,priority:c};for(var p=0;p<_t.length&&c!==0&&c<_t[p].priority;p++);_t.splice(p,0,s),p===0&&za(s)}};function up(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function _d(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function t_(){}function lI(s,c,p,b,N){if(N){if(typeof b=="function"){var R=b;b=function(){var Re=vd(q);R.call(Re)}}var q=Z1(c,b,s,0,null,!1,!1,"",t_);return s._reactRootContainer=q,s[mt]=q.current,Js(s.nodeType===8?s.parentNode:s),co(),q}for(;N=s.lastChild;)s.removeChild(N);if(typeof b=="function"){var se=b;b=function(){var Re=vd(ge);se.call(Re)}}var ge=op(s,0,!1,null,null,!1,!1,"",t_);return s._reactRootContainer=ge,s[mt]=ge.current,Js(s.nodeType===8?s.parentNode:s),co(function(){bd(c,ge,p,b)}),ge}function wd(s,c,p,b,N){var R=p._reactRootContainer;if(R){var q=R;if(typeof N=="function"){var se=N;N=function(){var ge=vd(q);se.call(ge)}}bd(c,q,s,N)}else q=lI(p,c,s,N,b);return vd(q)}Ci=function(s){switch(s.tag){case 3:var c=s.stateNode;if(c.current.memoizedState.isDehydrated){var p=Zn(c.pendingLanes);p!==0&&(ea(c,p|1),xa(c,vr()),(Nr&6)===0&&(ul=vr()+500,Ss()))}break;case 13:co(function(){var b=ss(s,1);if(b!==null){var N=ia();bi(b,s,1,N)}}),lp(s,1)}},Vr=function(s){if(s.tag===13){var c=ss(s,134217728);if(c!==null){var p=ia();bi(c,s,134217728,p)}lp(s,134217728)}},wr=function(s){if(s.tag===13){var c=As(s),p=ss(s,c);if(p!==null){var b=ia();bi(p,s,c,b)}lp(s,c)}},Ba=function(){return dr},Cn=function(s,c){var p=dr;try{return dr=s,c()}finally{dr=p}},pr=function(s,c,p){switch(c){case"input":if(Be(s,p),c=p.name,p.type==="radio"&&c!=null){for(p=s;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<p.length;c++){var b=p[c];if(b!==s&&b.form===s.form){var N=Pn(b);if(!N)throw Error(r(90));Ve(b),Be(b,N)}}}break;case"textarea":Ae(s,p);break;case"select":c=p.value,c!=null&&Ge(s,!!p.multiple,c,!1)}},Ke=tp,Te=co;var cI={usingClientEntryPoint:!1,Events:[Dn,Ha,Pn,ue,Me,tp]},kc={findFiberByHostInstance:br,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},uI={bundleType:kc.bundleType,version:kc.version,rendererPackageName:kc.rendererPackageName,rendererConfig:kc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:A.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=ca(s),s===null?null:s.stateNode},findFiberByHostInstance:kc.findFiberByHostInstance||oI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nd.isDisabled&&Nd.supportsFiber)try{Ht=Nd.inject(uI),er=Nd}catch{}}return ya.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=cI,ya.createPortal=function(s,c){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!up(c))throw Error(r(200));return sI(s,c,null,p)},ya.createRoot=function(s,c){if(!up(s))throw Error(r(299));var p=!1,b="",N=e_;return c!=null&&(c.unstable_strictMode===!0&&(p=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onRecoverableError!==void 0&&(N=c.onRecoverableError)),c=op(s,1,!1,null,null,p,!1,b,N),s[mt]=c.current,Js(s.nodeType===8?s.parentNode:s),new cp(c)},ya.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var c=s._reactInternals;if(c===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=ca(c),s=s===null?null:s.stateNode,s},ya.flushSync=function(s){return co(s)},ya.hydrate=function(s,c,p){if(!_d(c))throw Error(r(200));return wd(null,s,c,!0,p)},ya.hydrateRoot=function(s,c,p){if(!up(s))throw Error(r(405));var b=p!=null&&p.hydratedSources||null,N=!1,R="",q=e_;if(p!=null&&(p.unstable_strictMode===!0&&(N=!0),p.identifierPrefix!==void 0&&(R=p.identifierPrefix),p.onRecoverableError!==void 0&&(q=p.onRecoverableError)),c=Z1(c,null,s,1,p??null,N,!1,R,q),s[mt]=c.current,Js(s),b)for(s=0;s<b.length;s++)p=b[s],N=p._getVersion,N=N(p._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[p,N]:c.mutableSourceEagerHydrationData.push(p,N);return new kd(c)},ya.render=function(s,c,p){if(!_d(c))throw Error(r(200));return wd(null,s,c,!1,p)},ya.unmountComponentAtNode=function(s){if(!_d(s))throw Error(r(40));return s._reactRootContainer?(co(function(){wd(null,null,s,!1,function(){s._reactRootContainer=null,s[mt]=null})}),!0):!1},ya.unstable_batchedUpdates=tp,ya.unstable_renderSubtreeIntoContainer=function(s,c,p,b){if(!_d(p))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return wd(s,c,p,!1,b)},ya.version="18.3.1-next-f1338f8080-20240426",ya}var c_;function P4(){if(c_)return gp.exports;c_=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(t){console.error(t)}}return e(),gp.exports=xI(),gp.exports}var u_;function yI(){if(u_)return Ed;u_=1;var e=P4();return Ed.createRoot=e.createRoot,Ed.hydrateRoot=e.hydrateRoot,Ed}var bI=yI();const vI=jo(bI),kI="modulepreload",_I=function(e){return"/"+e},d_={},F4=function(t,r,a){let i=Promise.resolve();if(r&&r.length>0){let l=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=l(r.map(f=>{if(f=_I(f),f in d_)return;d_[f]=!0;const g=f.endsWith(".css"),h=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const m=document.createElement("link");if(m.rel=g?"stylesheet":kI,g||(m.as="script"),m.crossOrigin="",m.href=f,d&&m.setAttribute("nonce",d),document.head.appendChild(m),g)return new Promise((y,v)=>{m.addEventListener("load",y),m.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return i.then(l=>{for(const u of l||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})},ds={"planCard.heading":"Plan ready — what next?","planCard.showPlan":"Show the plan","planCard.execute":"Switch to build & execute","planCard.keepPlanning":"Keep planning","planCard.executedStatus":"Switched to build mode — executing the plan.","planCard.dismissedStatus":"Staying in plan mode.","planCard.close":"Close","planCard.loading":"Loading…","planCard.loadError":"Couldn't load the plan.","planCard.executePrompt":"Implement the plan in PLAN.md. Follow it step by step.","agent_conversation.back":"Back","agent_conversation.message_count":"{name} - {count} messages","agent_conversation.message_queued":"Message queued for agent","agent_conversation.no_messages":"No messages yet","agent_conversation.no_messages_hint":"Use the Send Message button to contact the agent","agent_conversation.compose_button":"Send Message","agent_conversation.modal_title":"Send Message to {name}","agent_conversation.reply_to_inbox":"Notify me when complete","agent_conversation.urgent_interrupt_button":"Send Urgent Interrupt","agent_conversation.urgent_warning":"This will interrupt the agent’s current work immediately. Click again to confirm.","agent_conversation.confirm_interrupt":"Confirm Interrupt","agent_conversation.priority":"Priority:","agent_conversation.priority_high":"High","agent_conversation.priority_normal":"Normal","agent_conversation.priority_urgent":"Urgent","agent_conversation.priority_urgent_confirm":"This will send an urgent interrupt that aborts the agent's current work. Continue?","agent_conversation.priority_urgent_title":"Send Urgent Interrupt","agent_conversation.priority_urgent_hint":"Urgent: This will interrupt the agent’s current work immediately","agent_conversation.interrupt_button":"Interrupt","agent_conversation.interrupt_sent":"Urgent interrupt sent to agent","agent_conversation.queue_hint":"Messages are queued in the agent's inbox and processed on next wake","agent_conversation.refresh":"Refresh","agent_conversation.send_button":"Send","agent_conversation.send_placeholder":"Send a message to the agent's inbox...","agent_conversation.sending":"Sending","agent_conversation.title":"Conversation","confirm_dialog.cancel":"Cancel","confirm_dialog.confirm":"Confirm","agent_create.cancel":"Cancel","agent_create.configure_subtitle":"Configure your autonomous agent","agent_create.custom_model":"Custom model...","agent_create.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_create.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_create.deselect_all":"Deselect All","agent_create.display_name_hint":"Human-friendly name shown in the UI","agent_create.display_name_label":"Display Name (optional)","agent_create.display_name_placeholder":"e.g., My Development Agent","agent_create.dormant_mode":"Start in dormant mode","agent_create.dormant_mode_desc":"Agent will not process AGENTS.md on startup. It waits until it receives an inbox message.","agent_create.instructions_label":"Agent Instructions (AGENTS.md)","agent_create.instructions_optional":"(optional)","agent_create.instructions_hint":"Instructions and context for the agent. Written to workspace/AGENTS.md if workspace is set.","agent_create.loading_models":"Loading models...","agent_create.loading_skills":"Loading skills...","agent_create.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_create.model_label":"Model *","agent_create.model_placeholder":"github-copilot/claude-opus-4.6","agent_create.name_generate":"Generate random name","agent_create.name_hint":"Lowercase letters, numbers, hyphens, and underscores only","agent_create.name_label":"Agent Name *","agent_create.name_placeholder":"e.g., swift-falcon","agent_create.no_skills":"No skills installed","agent_create.random":"Random","agent_create.reset_default":"Reset to Default","agent_create.select_all":"Select All","agent_create.skills_label":"Skills","agent_create.skills_selected":"Skills selected: {count}","agent_create.soul_label":"Soul / Instructions (AGENTS.md)","agent_create.soul_placeholder":"# AGENTS.md content...","agent_create.spawn":"Spawn Agent","agent_create.spawning":"Spawning...","agent_create.start_mode":"Start Mode","agent_create.title":"Spawn New Agent","agent_create.validate_model":"Please select a model","agent_create.validate_workspace":"Workspace directory is required","agent_create.working_dir_hint":"The agent's working directory for file operations","agent_create.working_dir_label":"Workspace Directory *","agent_create.working_dir_placeholder":"/path/to/project","agent_detail.action_deleted":"Agent deleted","agent_detail.action_updated":"Settings updated successfully","agent_detail.agent_info":"Agent Info","agent_detail.back":"Back to agents list","agent_detail.edit_settings":"Edit Settings","agent_detail.failed_to_load":"Failed to load agent:","agent_detail.iteration":"Iteration","agent_detail.model":"Model","agent_detail.pid":"PID","agent_detail.port":"Port","agent_detail.session_id":"Session ID","agent_detail.soul_file":"Soul File","agent_detail.start_mode":"Start mode","agent_detail.start_mode_dormant":"Dormant","agent_detail.start_mode_normal":"Normal","agent_detail.started":"Started","agent_detail.status":"Status","agent_detail.stopped":"stopped","agent_detail.token_cached":"Cached","agent_detail.token_input":"Input","agent_detail.token_output":"Output","agent_detail.token_usage":"Token Usage","agent_detail.total_cost":"Total Cost","agent_detail.unknown_agent":"Unknown Agent","agent_detail.uptime":"Uptime","agent_detail.view_conversation":"View Conversation","agent_detail.working_dir":"Working Dir","agent_detail.working_dir_label":"Working Dir:","agent_edit.cannot_change":"(cannot be changed)","agent_edit.custom_model":"Custom model...","agent_edit.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_edit.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_edit.deselect_all":"Deselect All","agent_edit.display_name_label":"Display Name","agent_edit.display_name_placeholder":"Human-friendly name","agent_edit.dormant_mode":"Start in dormant mode","agent_edit.dormant_mode_desc":"Agent will not process AGENTS.md on startup. Takes effect on next start.","agent_edit.instructions_label":"Agent Instructions (AGENTS.md)","agent_edit.instructions_hint":"Instructions and context for the agent. This file is re-read when the agent starts or when hot-reloaded.","agent_edit.loading_models":"Loading models...","agent_edit.loading_skills":"Loading skills...","agent_edit.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_edit.model_label":"Model","agent_edit.model_placeholder":"e.g., github-copilot/claude-opus-4.6","agent_edit.name_label":"Agent Name","agent_edit.no_skills":"No skills installed","agent_edit.no_workspace_warning":"No workspace configured. AGENTS.md cannot be edited without a workspace directory.","agent_edit.not_set":"Not set","agent_edit.running_warning":"Running - restart required for changes","agent_edit.save":"Save Changes","agent_edit.saved":"Settings saved successfully","agent_edit.saving":"Saving...","agent_edit.select_all":"Select All","agent_edit.skills_label":"Skills","agent_edit.skills_selected":"Skills selected: {count}","agent_edit.soul_placeholder":"# AGENTS.md content...","agent_edit.start_mode":"Start Mode","agent_edit.stop_to_change":"Stop the agent to change workspace","agent_edit.tab_general":"General","agent_edit.tab_soul":"AGENTS.md","agent_edit.title":"Edit Agent Settings","agent_edit.will_be_created":"(will be created)","agent_edit.working_dir_hint":"The agent's working directory for file operations","agent_edit.working_dir_label":"Workspace Directory *","agent_edit.working_dir_placeholder":"/path/to/project","agent_edit.workspace_changed_warning":"Workspace has changed. AGENTS.md editing is disabled to prevent overwriting files in the new workspace. Save your changes, then re-open settings to edit AGENTS.md in the new workspace.","agent_edit.workspace_move_warning":"Changing workspace will not move existing AGENTS.md. You may need to re-configure the agent's instructions.","agents.back_to_chat":"Back to Chat","agents.collapse_panel":"Collapse panel","agents.expand_panel":"Expand panel","agents.no_agents_desc":"Spawn your first autonomous agent to get started","agents.no_agents_title":"No agents yet","agents.model_label":"Model: {model}","agents.resize_terminal":"Resize terminal panel","agents.back":"Back","agents.iteration":"Iter","agents.pid":"PID","agents.port":"Port","agents.refresh":"Refresh","agents.restart":"Restart","agents.restarting":"Restarting...","agents.clean_restart":"Clean Restart","agents.clean_restart_tooltip":"Restart with a new session (starts a fresh conversation)","agents.spawn_button":"Spawn Agent","agents.start":"Start","agents.starting":"Starting...","agents.stop":"Stop","agents.stopping":"Stopping...","agents.subtitle":"Manage autonomous agents","agents.title":"Agents","agents.uptime":"Uptime","agents.drop_to_import":"Drop YAML file to import agent","agents.export":"Export","agents.export_error":"Failed to export agent","agents.import":"Import","agents.import_button":"Import Agent","agents.import_error":"Failed to import agent","agents.import_invalid_file":"Invalid file type. Please select a .yaml or .yml file.","agents.import_file_too_large":"File too large (max 10MB)","agents.import_read_error":"Failed to read file","agents.import_success":"Agent imported successfully","agents.view_details":"Agent details","agents.pause":"Pause","agents.pausing":"Pausing...","agents.unpause":"Unpause","agents.resume":"Resume","agents.resuming":"Resuming...","agents.paused":"Paused","agents.select":"Select","agents.selected":"{count} selected","agents.selectAll":"Select All","agents.deselectAll":"Deselect All","agents.pauseAll":"Pause All","agents.unpauseAll":"Unpause All","agents.stopAll":"Stop All","agents.restartAll":"Restart All","agents.startAll":"Start All","app.agents_tab":"Agents","app.chat_tab":"Chat","app.close_search":"Close search","app.activities_panel":"Activities","app.close_activities":"Close activities panel","app.dismiss_error":"Dismiss error","app.hacker_mode_enter":"Enter hacker mode (Ctrl+H or Ctrl+Shift+M)","app.hacker_mode_exit":"Exit hacker mode (Ctrl+H or Ctrl+Shift+M)","app.match_count":"{current} of {total}","app.new_chat":"New Chat","app.next_match":"Next match","app.no_matches":"No matches","app.previous_match":"Previous match","app.reconnecting":"Reconnecting to server...","app.resize_terminal":"Resize terminal panel","app.right_pane_hidden":"Activities panel hidden","app.right_pane_shown":"Activities panel shown","app.search_messages":"Search messages","app.search_placeholder":"Search in conversation...","app.settings_tab":"Settings","app.skills_tab":"Skills","app.toggle_right_pane":"Toggle activities panel ({shortcut})","app.version":"PAVE version","app.welcome_start":"Start a conversation to get going.","app.welcome_subtitle":"Your AI-powered development assistant","app.welcome_title":"Welcome to PAVE","chat.attach_image":"Attach image","chat.attach_file":"Attach file (image, docx, pdf, text)","chat.attachment":"Attachment","chat.attachment_with_index":"Attachment {index}","chat.copied":"Copied!","chat.copy":"Copy","chat.copy_message":"Copy message","chat.cancel_queued":"Remove from queue","chat.queued":"Queued","chat.edit_queued":"Edit queued message","chat.edit_resend":"Edit and resend","chat.read_only":"Read-only","chat.read_only_desc":"This is a read-only session from the TUI. Messages cannot be sent.","chat.regenerate":"Regenerate response","chat.scroll_to_bottom":"Scroll to bottom","chat.send_button":"Send message","chat.send_hint":"Press Enter to send, Shift+Enter for new line. Type / for commands","chat.send_placeholder":"Send a message...","chat.stop_generating":"Stop generating","chat.tool_bash":"Running command","chat.tool_edit":"Editing file","chat.tool_glob":"Searching files","chat.tool_grep":"Searching code","chat.tool_preparing":"Preparing tool call","chat.tool_preparing_name":"Preparing {name}","chat.tool_read":"Reading file","chat.tool_write":"Writing file","chat.viewing_terminal":"Viewing Terminal session (read-only)","chat.yesterday":"Yesterday","chat.yesterday_time":"Yesterday {time}","chat.viewing_archive":"Viewing archived session (read-only)","chat.compacting_context":"Compacting context","chat.compacted_switch_to_new":"Compacted — switch to new session","chat.unpin_compacted":"Unpin — go back to original","chat.show_thinking":"Show thinking","chat.hide_thinking":"Hide thinking","chat.thinking":"Thinking","chat.error_badge":"Error","chat.assistant_typing":"Assistant is typing","chat.whatsapp_enabled":"WhatsApp mode enabled - assistant replies will be sent to WhatsApp","chat.whatsapp_disabled":"Enable WhatsApp two-way mode","chat.whatsapp_no_chatid":"Set PAVE_WHATSAPP_CHAT_ID in Settings before enabling WhatsApp routing","chat.working_directory":"Working Directory","chat.working_directory_current":"Current:","chat.working_directory_recent":"Recent:","chat.working_directory_change":"Change","chat.working_directory_cancel":"Cancel","chat.working_directory_create":"Create Directory","chat.working_directory_not_found":"Directory does not exist","chat.working_directory_invalid":"Invalid path","chat.working_directory_checking":"Checking path...","chat.working_directory_changed":"Working directory changed to {path}","chat.working_directory_created":"Directory created: {path}","chat.working_directory_create_failed":"Failed to create directory: {error}","chat.working_directory_remove_recent":"Remove from recent","chat.working_directory_has_agents_md":"Contains AGENTS.md","chat.working_directory_no_agents_md":"No AGENTS.md in this directory","chat.working_directory_new_path":"New path","chat.working_directory_placeholder":"/path/to/directory or ~/projects/...","chat.working_directory_not_set":"(not set)","chat.idle_injection_title":"Idle Injection","chat.idle_injection_toggle":"Enable idle injection","chat.idle_injection_message":"Injection message","chat.idle_injection_message_placeholder":"Message to inject when idle","chat.idle_injection_interval":"Idle interval (seconds)","chat.idle_injection_interval_desc":"How long to wait after the LLM finishes responding before injecting.","chat.idle_injection_max":"Max injections (0 = unlimited)","chat.idle_injection_max_desc":"Stops injecting after this many times. 0 means no limit.","chat.idle_injection_timeout_toggle":"Enable LLM timeout detection","chat.idle_injection_timeout_toggle_desc":"Detect when the LLM is stuck (no response) and re-inject.","chat.idle_injection_timeout_threshold":"Timeout threshold (seconds)","chat.idle_injection_timeout_threshold_desc":"How long to wait for the first token before considering the LLM hung.","chat.idle_injection_timeout_cooldown":"Timeout cooldown (seconds)","chat.idle_injection_timeout_cooldown_desc":"How long to wait after a timeout before re-injecting.","chat.idle_injection_save":"Save","chat.idle_injection_disable":"Disable","chat.idle_injection_saving":"Saving...","chat.idle_injection_disabling":"Disabling...","chat.idle_injection_saved":"Settings saved","chat.idle_injection_disabled_toast":"Idle injection disabled","chat.idle_injection_enabled_toast":"Idle injection enabled","chat.idle_injection_fired_toast":"Idle injection fired","chat.idle_injection_timeout_toast":"LLM timeout detected — retrying","chat.idle_injection_auto_badge":"auto","scheduled_injection.title":"Scheduled Injections","scheduled_injection.subtitle":"Automatically inject messages at scheduled times","scheduled_injection.add":"Add Schedule","scheduled_injection.empty":"No schedules configured. Add one above.","scheduled_injection.time":"Time","scheduled_injection.repeat":"Repeat","scheduled_injection.repeat_every_day":"Every day","scheduled_injection.repeat_weekdays":"Weekdays","scheduled_injection.repeat_weekends":"Weekends","scheduled_injection.repeat_custom":"Custom","scheduled_injection.timezone":"Timezone","scheduled_injection.message":"Message (optional)","scheduled_injection.message_placeholder":"Leave empty for default check-in message","scheduled_injection.enabled":"Enabled","scheduled_injection.save":"Save Schedule","scheduled_injection.saving":"Saving...","scheduled_injection.delete":"Delete","scheduled_injection.day_sun":"Sun","scheduled_injection.day_mon":"Mon","scheduled_injection.day_tue":"Tue","scheduled_injection.day_wed":"Wed","scheduled_injection.day_thu":"Thu","scheduled_injection.day_fri":"Fri","scheduled_injection.day_sat":"Sat","scheduled_injection.fired_toast":"Scheduled injection fired","scheduled_injection.error_generic":"Failed to save schedule","chat.interrupted_badge":"Interrupted","chat.stopped_badge":"Stopped","chat.moe_auto":"Auto","chat.moe_fast":"Fast","chat.moe_fastest":"Fastest","chat.moe_tooltip":"Expert count — lower is faster but less accurate","chat.reasoning_max":"Max","chat.reasoning_high":"High","chat.reasoning_off":"Off","chat.reasoning_tooltip":"Reasoning effort — higher is smarter but slower","chat.idle_injection_mode":"Dispatch mode","chat.idle_injection_mode_desc":"How the injected message is queued.","chat.idle_injection_mode_urgent":"Urgent (between tool calls)","chat.idle_injection_mode_normal":"Normal (after turn)","chat.idle_injection_mode_idle":"Idle (after turn + delay)","chat.idle_injection_wait_ms":"Idle wait delay (seconds)","chat.idle_injection_wait_ms_desc":"Extra delay before dispatching when in Idle mode.","common.back":"Back","common.cancel":"Cancel","common.close":"Close","common.confirm":"Confirm","common.delete":"Delete","common.deleting":"Deleting...","common.edit":"Edit","common.error":"Error","common.loading":"Loading...","common.no":"No","common.optional":"(optional)","common.retry":"Retry","common.save":"Save","common.unknown_error":"Unknown error","common.success":"Success","common.yes":"Yes","login.email_placeholder":"Email","login.or":"or","login.password_placeholder":"Password","login.pave_subtitle":"Personal AI Virtual Environment","login.powered_by":"Powered by PAVE","login.sign_in":"Sign in to continue","login.sign_in_locally":"Sign in locally","login.signing_in":"Signing in...","login.terms":"By signing in, you agree to the terms of service.","permission.allow":"Allow","permission.allowing":"Allowing...","permission.action_clear_all":"Clear All","permission.action_grant":"Grant","permission.action_revoke":"Revoke","permission.clear_all":"Clear ALL permissions (lock down sandbox)","permission.deny":"Deny","permission.denying":"Denying...","permission.expired":"Request expired","permission.no_reason":"No reason provided","permission.reason_prefix":"Reason:","permission.request_desc":"{action} {type} permission for: {target}","permission.title":"Permission Request","permission.type_file_read":"File Read","permission.type_file_write":"File Write","permission.type_module":"Module","permission.type_network":"Network","permission.type_system":"System Command","question.already_answered":"Question already answered","question.custom_placeholder":"Or type a custom answer...","question.dismiss":"Dismiss","question.dismissing":"Dismissing...","question.error":"Question failed","question.expired":"Question expired","question.input_placeholder":"Type your answer...","question.select_all":"Select all that apply","question.submit":"Submit","question.submit_n":"Submit {count} answers","question.submitting":"Submitting...","question.reconnecting":"Reconnecting…","question.title":"Question from AI","pricing.add":"Add","pricing.add_model":"Add Model","pricing.add_model_placeholder":"Model name (e.g., gpt-4)","pricing.add_new_model":"Add New Model","pricing.cached_tokens":"Cached tokens (per 1M)","pricing.close":"Close pricing settings","pricing.configured_count":"Configured models: {count}","pricing.fallback_badge":"fallback","pricing.default_exists":'Cannot add "default" - it already exists as fallback',"pricing.discard_confirm":"Discard unsaved changes?","pricing.discard_title":"Discard Changes","pricing.heading":"Token Pricing","pricing.input_tokens":"Input tokens (per 1M)","pricing.label_cache":"Cache:","pricing.label_input":"In:","pricing.label_output":"Out:","pricing.model_column":"Model","pricing.model_exists":"Model already exists","pricing.model_required":"Model name is required","pricing.output_tokens":"Output tokens (per 1M)","pricing.rates_column":"Input / Output / Cached","pricing.rates_subtitle":"Prices in USD per 1M tokens","pricing.remove_model":"Remove model","pricing.remove_model_aria":"Remove {modelName}","pricing.remove_confirm":'Remove pricing for "{model}"?',"pricing.remove_title":"Remove Model Pricing","pricing.reset":"Reset to Defaults","pricing.reset_confirm":"Reset all pricing to default values? This cannot be undone.","pricing.reset_title":"Reset Pricing","pricing.save":"Save","pricing.save_changes":"Save Changes","pricing.subtitle":"Configure cost per 1 million tokens (USD)","pricing.title":"Token Pricing Settings","settings.back":"Back to chat","settings.category.display":"Display","settings.appearance":"Appearance","settings.mobile_frameless":"Frameless assistant messages","settings.mobile_frameless_label":"Mobile UX enhancement (experimental)","settings.mobile_frameless_desc":"Removes avatar and bubble background from assistant messages for a cleaner, full-width reading experience","settings.category.language":"Language","settings.category.marketplace":"Marketplace","settings.category.model":"AI Model & Provider","settings.category.prefillFallback":"Prefill Fallback","settings.category.models":"Models","settings.category.rate":"Rate Limiting","settings.category.systemPrompts":"System Prompts","settings.category.tools":"Tool Execution","settings.category.whatsapp":"WhatsApp","settings.category.compaction":"Compaction","settings.category.sessionBanner":"Session Banner","settings.category.sessionBehavior":"Session Behavior","settings.currently_set_to":"Currently set to: {path}","settings.default_prefix":"Default: {value}","settings.default_empty":"(empty)","settings.description":"Configure PAVE runtime settings. Most changes apply on save; some (e.g. timeouts) may require restarting PAVE.","settings.env_badge":"env","settings.env_override":"This value is currently overridden by the {envVar} environment variable.","settings.failed_to_load":"Failed to load settings: {error}","settings.language":"Language","settings.language_description":"Select your preferred language for the interface","settings.language_auto_applied":"✓ Language applied automatically","settings.no_changes":"No changes to save.","settings.not_set":"Not set","settings.enabled":"Enabled","settings.disabled":"Disabled","settings.notification_sound":"Notification Sound","settings.notification_sound_desc":"Play a sound when new inbox messages arrive","settings.native_notifications":"Native Notifications","settings.native_notifications_desc":"Show browser notifications for new inbox messages","settings.native_notifications_blocked":"Notifications blocked by browser — enable in browser settings","settings.native_notifications_permission":"Click to enable — permission will be requested","settings.native_notifications_unsupported":"Not supported in this browser","settings.auto_saved":"Changes apply immediately","settings.notifications":"Notifications","settings.partial_save":"Some settings could not be saved. See errors below.","settings.requires_restart":"(requires restart)","settings.reset":"Reset","settings.save":"Save","settings.save_failed":"Failed to save: {error}","settings.saved":"Settings saved successfully.","settings.saving":"Saving...","settings.source_default":"Default","settings.source_env":"ENV","settings.source_saved":"Saved","settings.title":"Settings","settings.category.experimental":"Experimental Features","settings.category.developer":"Developer","settings.v2.badge":"Settings","settings.v2.search_placeholder":"Search settings…","settings.v2.search_clear":"Clear search","settings.v2.no_matches":"No settings match your search.","settings.v2.search_results":"{count} matching settings","settings.v2.open":"Open","settings.v2.unsaved":"{count} unsaved","settings.v2.groups_aria":"Setting groups","settings.validating":"Validating...","settings.apply":"Apply","settings.workspace":"Workspace","settings.working_dir":"Working Directory","settings.working_dir_desc":"Set a custom working directory for file operations and tool execution. Leave empty to use the server default.","settings.working_dir_reset":"Working directory reset to server default","settings.working_dir_updated":"Working directory updated to: {path}","settings.working_dir_invalid":"Invalid directory path: {error}","settings.version_title":"Version","settings.current_version":"Current version","settings.latest_version":"Latest version","settings.update_available":"Update available","settings.update_button":"Update","settings.no_updates":"No updates available","settings.check_updates":"Check for Updates","settings.checking_updates":"Checking for updates…","settings.update_in_progress":"Update in progress…","settings.update_success":"Update successful","settings.update_failed":"Update failed","settings.check_updates_failed":"Check for updates failed","settings.model_registry.title":"Model Registry","settings.model_registry.builtin":"Built-in Models","settings.model_registry.user":"User Models","settings.model_registry.add_model":"+ Add Model","settings.model_registry.no_user_models":'No user-defined models. Click "+ Add Model" to add one.',"settings.model_registry.name":"Model Name","settings.model_registry.name_placeholder":"Model name (e.g. my-custom-model)","settings.model_registry.provider":"Provider","settings.model_registry.provider_placeholder":"e.g. openai","settings.model_registry.displayName":"Display Name","settings.model_registry.displayName_placeholder":"My Model","settings.model_registry.url":"Endpoint URL","settings.model_registry.url_placeholder":"http(s)://… or pave(s)://…","settings.model_registry.tier":"Tier","settings.model_registry.tier_placeholder":"e.g. fast, premium","settings.model_registry.limit_context":"Context Limit","settings.model_registry.limit_output":"Output Limit","settings.model_registry.cost_input":"Input Cost ($/1M tokens)","settings.model_registry.cost_output":"Output Cost ($/1M tokens)","settings.model_registry.save":"Save","settings.model_registry.saving":"Saving...","settings.model_registry.cancel":"Cancel","settings.model_registry.add":"Add","settings.model_registry.adding":"Adding...","settings.model_registry.edit":"Edit model","settings.model_registry.delete":"Delete model","settings.model_registry.delete_confirm":'Remove model "{name}" from the registry?',"settings.model_registry.loading":"Loading model registry...","settings.model_registry.load_error":"Failed to load registry: {error}","settings.model_registry.context_k":"{value}K ctx","settings.model_registry.target":"Alias Target (optional)","settings.model_registry.target_placeholder":"e.g. github-copilot/claude-opus-4.7","settings.model_registry.target_hint":"If set, this entry is an alias — selections route to the target model. Leave empty for a self-contained model with its own endpoint URL.","settings.model_registry.spec":"Model Spec","settings.model_registry.spec_placeholder":"e.g. github-copilot/claude-opus-4.7 or pave://host/path?model=…","settings.model_registry.spec_hint":"Enter a provider/model alias (e.g. github-copilot/claude-opus-4.7) or a full pave://, paves://, http://, or https:// URL. URLs are detected automatically.","settings.model_registry.kind_alias":"Alias","settings.model_registry.advanced":"Advanced (limits & cost)","settings.model_registry.error_name_required":"Model name is required","settings.model_registry.error_name_reserved":'Model name "{name}" is reserved',"settings.model_registry.error_name_exists":'A model named "{name}" already exists',"settings.model_registry.error_rename_cleanup":"Renamed, but failed to remove old entry: {error}","settings.custom_model":"Custom model...","settings.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","sidebar.conversations":"Conversations","sidebar.delete":"Delete","sidebar.delete_all":"Delete All Conversations","sidebar.delete_all_confirm":"Delete the conversations listed here? Sessions belonging to other apps are left alone. This cannot be undone.","sidebar.delete_all_title":"Delete All Sessions","sidebar.delete_confirm":"Delete this conversation?","sidebar.delete_title":"Delete Session","sidebar.hide":"Hide sidebar","sidebar.load_more":"Load more conversations","sidebar.load_more_count":"Load more — showing {loaded} of {total}","sidebar.all_loaded_count":"All {total} conversations shown","sidebar.search_result_count":"{total} matching conversations","sidebar.show_other_apps":"Show other apps","sidebar.hide_other_apps":"Hide other apps","sidebar.no_conversations":"No conversations yet","sidebar.no_matches":"No matches","sidebar.rename":"Rename","sidebar.regenerate_title":"Regenerate Title","sidebar.send_to_session":"Send to another session","send_to_session.title":"Send to another session","send_to_session.target_label":"Send to","send_to_session.message_label":"Message","send_to_session.delivery_note":"Delivered by the app that has that session open, usually within a couple of seconds. It may be a different app than this one.","send_to_session.queued":"Queued. It will be picked up by whichever app has that session open.","send_to_session.no_targets":"No other sessions to send to.","send_to_session.send":"Send","send_to_session.sending":"Sending...","send_to_session.cancel":"Cancel","send_to_session.close":"Close","sidebar.search_placeholder":"Search conversations...","sidebar.show":"Show conversations","sidebar.untitled":"Untitled","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.archive":"Archive","sidebar.unarchive":"Unarchive","sidebar.confirmArchive":"Archive this session? It will be hidden from the sidebar.","sidebar.show_archived":"Show archived","sidebar.hide_archived":"Hide archived","sidebar.pinned":"Pinned","sidebar.today":"Today","sidebar.yesterday":"Yesterday","sidebar.this_week":"This Week","sidebar.this_month":"This Month","sidebar.older":"Older","sidebar.archived":"Archived","sidebar.export":"Export as YAML","sidebar.import":"Import session","sidebar.drop_to_import":"Drop session file to import","sidebar.session_processing":"Session is processing","sidebar.more_actions":"More actions","sidebar.age_now":"now","sidebar.age_minutes":"{n}m","sidebar.age_hours":"{n}h","sidebar.age_days":"{n}d","sidebar.age_weeks":"{n}w","import.invalid_file_type":"Only .yaml or .yml session files can be imported","import.file_too_large":"Import file too large (max 10MB)","import.read_error":"Failed to read file. Please try again.","skills.back_to_chat":"Back to chat","skills.cancel":"Cancel","skills.clear_all":"Clear all","skills.clear_confirm":"Clear all credentials for {skill}?","skills.clear_title":"Clear Credentials","skills.close":"Close","skills.close_credential_editor":"Close credential editor","skills.configure":"Configure","skills.configure_skill":"Configure {skill}","skills.configured":"Configured","skills.current_value":"(current: {value})","skills.enter_token":"Enter at least one token value","skills.enter_value":"Enter value...","skills.install":"Install","skills.installed":"Installed","skills.installed_count":"{installed} installed, {available} available","skills.installing":"Installing...","skills.install_failed":"Install failed: {error}","skills.leave_blank":"Leave blank to keep current","skills.load_installed_failed":"Failed to load installed skills: {error}","skills.load_marketplace_failed":"Failed to load marketplace: {error}","skills.needs_setup":"Needs setup","skills.no_credentials_needed":"This skill does not require any credentials.","skills.no_description":"No description","skills.no_match":"No skills match your search.","skills.no_skills":"No skills found.","skills.not_installed":"Not installed","skills.oauth_connect":"Connect with {provider}","skills.oauth_connect_hint":"Use OAuth to authenticate with {provider}. Click the button below to open the authorization page.","skills.oauth_connected":"Connected to {provider}","skills.oauth_disconnect":"Disconnect from {provider}","skills.oauth_connecting":"Connecting...","skills.oauth_needs_credentials":"Enter Client ID and Client Secret above first, then you can connect to {provider}.","skills.save":"Save","skills.saving":"Saving...","skills.search_placeholder":"Search skills...","skills.skill_management":"Skill Management","skills.subtitle":"Manage AI tool capabilities","skills.tab_all":"All","skills.tab_available":"Available","skills.tab_installed":"Installed","skills.tab_marketplace":"Marketplace","skills.title":"Skills","skills.check_updates":"Check for Updates","skills.checking_updates":"Checking...","skills.update":"Update","skills.updating":"Updating...","skills.update_available":"Update available: v{version}","skills.update_success":"Updated to v{version}","skills.update_failed":"Update failed","skills.update_check_failed":"Check failed","skills.update_check_failures":"{count} check failed","skills.update_unsupported":"Manual install","skills.update_unsupported_count":"{count} not checked","skills.up_to_date":"Up to date","skills.updates_available":"{count} update(s) available","skills.no_updates":"All skills are up to date","skills.uninstall":"Uninstall","skills.uninstall_title":"Uninstall Skill","skills.uninstall_confirm":"Uninstall {skill}? Your saved credentials will be preserved.","skills.uninstalling":"Uninstalling...","skills.uninstall_failed":"Uninstall failed: {error}","skills.toggle_title":"Manage skills for this session","skills.toggle_header":"Session Skills","skills.toggle_hint":"Toggle skills on/off for this chat only","skills.builtin_tools":"Built-in Tools","skills.agent_comm":"Agent Communication","skills.default":"Default","skills.default_for_new_sessions":"Enable by default for new sessions","skills.reset_to_defaults":"Reset to defaults","auth.device_code_title":"GitHub Copilot Authentication","auth.device_code_instructions":"Open {url} and enter code: {code}","auth.device_code_waiting":"Waiting for authorization...","task.activity":"Activity","task.awaiting":"Awaiting approval","task.completed":"Completed","task.error":"Error","task.no_active":"No active tasks. Send a message to get started.","task.processing":"Processing...","task.tool_bash":"Bash","task.tool_edit":"Edit","task.tool_editing":"Editing {target}","task.tool_glob":"Glob","task.tool_glob_desc":"Searching for files","task.tool_grep":"Grep","task.tool_grep_desc":"Searching code","task.tool_read":"Read","task.tool_reading":"Reading {target}","task.tool_write":"Write","task.tool_writing":"Writing {target}","task.working":"Working on it...","terminal.decrease_font":"Decrease font size","terminal.increase_font":"Increase font size","terminal.matrix_mode":"Matrix","terminal.no_output":"No terminal output yet","terminal.prompt":"$","theme.dark":"Switch to dark mode","theme.light":"Switch to light mode","time.days":"{count}d ","time.hours":"{count}h ","time.just_now":"just now","time.milliseconds":"{count}ms","time.minutes":"{count}m ","time.seconds":"{count}s","token.cache_read":"Cache Read","token.cache_write":"Cache Write","token.generating":"Generating...","token.idle":"Idle","token.input":"Input","token.model":"Model","token.output":"Output","token.session_cost":"Session","token.tokens":"tokens","token.total_cost":"Total Cost","token_usage.compacting":"Compacting...","token_usage.generating":"Generating...","token_usage.idle":"Idle","token_usage.messages":"Messages","token_usage.model":"Model","token_usage.originally":"Originally","token_usage.session_info":"Session Info","token_usage.status":"Status","tool.completed":"Done","tool.error":"Error","tool.running":"Running...","tool.tool":"Tool","user_menu.agents":"Agent Management","user_menu.pricing":"Token Pricing","user_menu.settings":"Settings","user_menu.sign_out":"Sign Out","user_menu.skills":"Skill Management","user_menu.title":"User menu","user_inbox.clear_all":"Clear all","user_inbox.delete":"Delete","user_inbox.empty":"No notifications","user_inbox.high_priority":"urgent","user_inbox.mark_all_read":"Mark all read","user_inbox.mark_unread":"Mark as unread","user_inbox.next_message":"Next message","user_inbox.prev_message":"Previous message","user_inbox.title":"Notifications","user_inbox.unread":"Unread","user_inbox.view_agent":"View agent","user_inbox.view_message":"View message","user_inbox.close":"Close","user_inbox.mark_read":"Mark as read","voice.dismiss_error":"Dismiss voice error","voice.downloading_model":"Downloading speech model...","voice.loading_model":"Loading speech model...","voice.processing":"Transcribing audio...","voice.processing_backend":"Transcribing via cloud...","voice.processing_local":"Transcribing locally...","voice.processing_local_server":"Transcribing via local server...","voice.source_backend":"Transcribed via cloud","voice.source_local":"Transcribed locally","voice.source_local_server":"Transcribed via local server","voice.start_recording":"Start voice recording","voice.stop_recording":"Stop recording","voice.pause_recording":"Pause recording","voice.resume_recording":"Resume recording","voice.select_asr_model":"Select speech recognition model","model_selector.title":"Session model","model_selector.list_label":"Available models","model_selector.use_default":"Use default model","model_selector.no_models":"No models available","model_selector.default_label":"Default","spotlight.title":"Search Sessions","spotlight.new_chat":"New Chat","spotlight.placeholder":"Search sessions by title...","spotlight.results":"Session results","spotlight.recent_sessions":"Recent Sessions","spotlight.no_results":"No sessions found","spotlight.searching":"Searching...","spotlight.untitled":"Untitled Session","spotlight.current":"current","spotlight.navigate":"navigate","spotlight.select":"select","spotlight.close":"close","slashCommand.title":"Skills","slashCommand.skills":"Skills","slashCommand.commands":"commands","slashCommand.command":"command","slashCommand.noResults":"No matching commands","slashCommand.notConfigured":"not configured","slashCommand.back":"Back to skills","slashCommand.navigate":"navigate","slashCommand.select":"select","slashCommand.close":"close","slashCommand.hint":"Type / to see available commands","archiveViewer.title":"Original Conversation History","archiveViewer.messages":"messages","archiveViewer.loading":"Loading archived messages...","archiveViewer.noArchive":"No archived history available for this session.","archiveViewer.readOnly":"Read-only archive","archiveViewer.archivedAt":"Archived","archiveViewer.close":"Close","archiveViewer.loadError":"Failed to load archive","archiveViewer.you":"You","archiveViewer.assistant":"Assistant","compaction.title":"Conversation compacted","compaction.showSummary":"Show summary","compaction.viewOriginal":"View original history","compaction.viewInHistory":"View in History","compaction.server.title":"Server auto-compact","compaction.server.status":"Context auto-compacted by server","compaction.mode.client":"Client (PAVE summarizes)","compaction.mode.server":"Server (vllm-mlx auto-compact)","compaction.mode.auto":"Auto (detect from provider)","compaction.banner_title":"This session was compacted from a previous conversation.","compaction.view_original":"View original","compaction.dismiss":"Dismiss","compaction.user_message_label":"Summarizing our conversation to keep things efficient.","compaction.continuation_message_label":"Compaction done. Please continue.","compaction.boundary":"Context compacted — messages above are no longer in the model’s context","compaction.show_history":"Conversation summarized — {count} earlier messages collapsed; summary below","messages.load_earlier":"Load earlier messages","messages.loading_earlier":"Loading earlier messages...","compaction.hide_history":"Hide messages before compaction","compaction.empty_title":"This conversation was summarized","compaction.empty_body":"Earlier messages are collapsed to save context. Show them to see the full history.","compaction.empty_action":"Show {count} earlier messages","credits.limit_reached":"Credit Limit Reached","credits.limit_message":"You've used all your available credits. Add more to continue using the service.","credits.add_credits":"Add Credits","credits.dismiss":"Dismiss","dlp.heading":"Privacy & DLP Settings","dlp.subtitle":"Configure data loss prevention patterns and privacy mode","dlp.title":"DLP Settings","dlp.close":"Close DLP settings","dlp.cancel":"Cancel","dlp.save":"Save","dlp.saving":"Saving...","dlp.discard_title":"Discard Changes","dlp.discard_confirm":"Discard unsaved changes to DLP settings?","dlp.enable_label":"Enable Data Loss Prevention","dlp.enable_desc":"When enabled, outgoing messages are scanned for sensitive data before sending to the AI model.","dlp.default_action_label":"Default action on detection","dlp.default_action_desc":"What happens when a pattern matches. 'Ask' shows a modal, 'Always reroute' sends to the private model, 'Warn only' logs and proceeds.","dlp.reroute_model_label":"Private model (reroute target)","dlp.reroute_model_desc":"The model/provider used for private mode. Format: provider/modelID","dlp.builtin_patterns":"Built-in patterns","dlp.builtin_desc":"Always-available detection patterns. Toggle individual patterns on or off.","dlp.user_patterns":"Custom patterns","dlp.user_patterns_desc":"Patterns you define. These are saved to your policy file and persist across restarts.","dlp.no_user_patterns":"No custom patterns yet. Add one below.","dlp.add_pattern":"Add a pattern","dlp.pattern_name":"Name","dlp.regex_pattern":"Regex","dlp.severity":"Severity","dlp.add":"Add","dlp.remove_pattern":"Remove pattern","dlp.remove_pattern_aria":"Remove pattern {name}","dlp.pattern_exists":"Pattern '{name}' already exists","dlp.name_required":"Pattern name is required","dlp.regex_required":"Regex pattern is required","dlp.invalid_regex":"Invalid regex syntax","user_menu.privacy_dlp":"Privacy & DLP","user_menu.board":"Agent Board","board.title":"Agent Board","board.back_to_chat":"Back to chat","board.back_to_topics":"Back to topics","board.read_only_hint":"Agents post here via tools — this page is read-only","board.post_count":"{count} posts","board.search_placeholder":"Search the board…","board.search":"Search","board.clear_search":"Clear","board.search_results":"{count} matches","board.no_matches":"No matches","board.no_topics":"No topics yet — agents create them with the board tools","board.no_posts":"No posts","board.post_deleted":"[deleted]","board.delete_post":"Delete post","board.delete_topic":"Delete topic","board.prev_page":"Previous","board.next_page":"Next","board.page_info":"{from}–{to} of {total}"},zs={en:ds},wI={"zh-TW":()=>F4(()=>import("./zh-TW-CoR3jQfM.js"),[])},kl=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function f_(e){if(zs[e])return zs[e];const t=wI[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),ds;try{const r=await t();return zs[e]=r.default||r,zs[e]}catch(r){return console.warn(`Failed to load locale "${e}", falling back to English:`,r),ds}}function B4(e,t,r){let a=e[t];return a===void 0&&e!==ds&&(a=ds[t]),a===void 0?t:r&&typeof r=="object"?a.replace(/\{(\w+)\}/g,(i,o)=>{const l=r[o];return l!==void 0?String(l):i}):a}const z4=x.createContext(null);function NI({initialLocale:e="en",children:t}){const a=kl.map(m=>m.code).includes(e)?e:"en",[i,o]=x.useState(a),[l,u]=x.useState(zs[a]||ds),d=x.useRef(0);x.useEffect(()=>{let m=!1;if(a!=="en"&&!zs[a]){const y=++d.current;f_(a).then(v=>{if(m||d.current!==y)return;const k=v===ds&&a!=="en"?"en":a;zs[k]=v,u(v),k!==a&&o(k)})}return()=>{m=!0,d.current+=1}},[]);const f=x.useCallback(async m=>{const y=++d.current,v=await f_(m);if(d.current!==y)return;const k=v===ds&&m!=="en"?"en":m;zs[k]=v,u(v),o(k);try{localStorage.setItem("pave-locale",k)}catch{}},[]),g=x.useCallback((m,y)=>B4(l,m,y),[l]),h=x.useMemo(()=>({t:g,locale:i,setLocale:f,availableLocales:kl}),[g,i,f]);return n.jsx(z4.Provider,{value:h,children:t})}function Xt(){const e=x.useContext(z4);return e||{t:(t,r)=>B4(ds,t,r),locale:"en",setLocale:()=>{},availableLocales:kl}}function SI(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&kl.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=kl.find(i=>i.code.toLowerCase()===e);if(t)return t.code;const r=e.split("-")[0],a=kl.find(i=>i.code.toLowerCase().startsWith(r));if(a)return a.code}return"en"}function EI({darkMode:e,onToggle:t}){const{t:r}=Xt();return n.jsx("button",{onClick:t,className:"p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:r(e?"theme.light":"theme.dark"),"aria-label":r(e?"theme.light":"theme.dark"),"aria-pressed":e,children:e?n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}var U4=P4();const jI=jo(U4);function CI({open:e,onClose:t,onConfirm:r,title:a,message:i,confirmLabel:o,cancelLabel:l,destructive:u}){var{t:d}=Xt(),f=x.useRef(null),g=x.useRef(null);if(x.useEffect(function(){e&&g.current&&g.current.focus()},[e]),x.useEffect(function(){if(!e)return;function v(k){k.key==="Escape"&&(typeof k.preventDefault=="function"&&k.preventDefault(),typeof k.stopImmediatePropagation=="function"?k.stopImmediatePropagation():typeof k.stopPropagation=="function"&&k.stopPropagation(),t())}return document.addEventListener("keydown",v,!0),function(){document.removeEventListener("keydown",v,!0)}},[e,t]),x.useEffect(function(){if(!e||!f.current)return;function v(k){if(k.key==="Tab"){var _=f.current.querySelectorAll("button:not([disabled])");if(_.length!==0){var w=_[0],S=_[_.length-1];k.shiftKey?document.activeElement===w&&(k.preventDefault(),S.focus()):document.activeElement===S&&(k.preventDefault(),w.focus())}}}return document.addEventListener("keydown",v),function(){document.removeEventListener("keydown",v)}},[e]),!e)return null;var h=o||d("confirm_dialog.confirm"),m=l||d("confirm_dialog.cancel"),y=u?"bg-red-600 hover:bg-red-700 focus:ring-red-500 text-white":"bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white";return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(v){v.target===v.currentTarget&&t()},children:n.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-label":a,className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-none transition-all duration-150",children:[n.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:n.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:a})}),n.jsx("div",{className:"px-5 py-4",children:n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i})}),n.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[n.jsx("button",{ref:g,type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:m}),n.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 "+y,children:h})]})]})})}const q4=x.createContext(null);function TI({children:e}){var{t}=Xt(),r=x.useRef(null),a={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},i=x.useState(a),o=i[0],l=i[1],u=x.useCallback(function(g){r.current&&(r.current(!1),r.current=null);var h=g||{};return new Promise(function(m){r.current=m,l({open:!0,title:h.title||t("confirm_dialog.confirm"),message:h.message||"",confirmLabel:h.confirmLabel||"",cancelLabel:h.cancelLabel||"",destructive:h.destructive||!1})})},[t]),d=x.useCallback(function(){l(a),r.current&&(r.current(!1),r.current=null)},[]),f=x.useCallback(function(){l(a),r.current&&(r.current(!0),r.current=null)},[]);return n.jsxs(q4.Provider,{value:u,children:[e,n.jsx(CI,{open:o.open,onClose:d,onConfirm:f,title:o.title,message:o.message,confirmLabel:o.confirmLabel,cancelLabel:o.cancelLabel,destructive:o.destructive})]})}function ru(){var e=x.useContext(q4);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}function RI(e){const t=new Date,r=new Date(e),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(r>=a)return"today";const i=new Date(a);if(i.setDate(i.getDate()-1),r>=i)return"yesterday";const o=new Date(a);if(o.setDate(o.getDate()-o.getDay()),r>=o)return"thisWeek";const l=new Date(t.getFullYear(),t.getMonth(),1);return r>=l?"thisMonth":"older"}function AI(e,t){const r={today:[],yesterday:[],thisWeek:[],thisMonth:[],older:[]},a={today:t("sidebar.today"),yesterday:t("sidebar.yesterday"),thisWeek:t("sidebar.this_week"),thisMonth:t("sidebar.this_month"),older:t("sidebar.older")};for(let l=0;l<e.length;l++){const u=e[l],d=RI(u.time&&u.time.updated?u.time.updated:0);r[d].push(u)}const i=["today","yesterday","thisWeek","thisMonth","older"],o=[];for(let l=0;l<i.length;l++){const u=i[l];r[u].length>0&&o.push({key:u,label:a[u],sessions:r[u]})}return o}function II(e,t){if(!e)return"";const r=Date.now()-e;if(r<60*1e3)return t("sidebar.age_now");const a=Math.floor(r/(60*1e3));if(a<60)return t("sidebar.age_minutes",{n:a});const i=Math.floor(a/60);if(i<24)return t("sidebar.age_hours",{n:i});const o=Math.floor(i/24);return o<7?t("sidebar.age_days",{n:o}):t("sidebar.age_weeks",{n:Math.floor(o/7)})}function g_(e){return e.source==="archive"||e._readOnly}const MI={rename:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z",regenerate:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15",export:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",archive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4",unarchive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4l3 3m0 0l3-3m-3 3V12",delete:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",more:"M6 12h.01M12 12h.01M18 12h.01",send:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"};function po({name:e,className:t}){return n.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:MI[e]})})}function p_({className:e,filled:t}){return n.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:n.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})})}const mp=216,jd=8;function LI({anchor:e,items:t,label:r,onClose:a}){const i=x.useRef(null),[o,l]=x.useState(null);x.useEffect(()=>{const d=i.current;if(!d)return;const f=d.offsetHeight;let g=e.align==="right"?e.x-mp:e.x;g=Math.max(jd,Math.min(g,window.innerWidth-mp-jd));let h=e.y;h+f>window.innerHeight-jd&&(h=Math.max(jd,e.flipY-f)),l({left:g,top:h})},[e]),x.useEffect(()=>{if(!o||!i.current)return;const d=i.current.querySelector("[data-menuitem]");d&&d.focus()},[o]),x.useEffect(()=>{function d(g){i.current&&!i.current.contains(g.target)&&a()}function f(g){g.key==="Escape"&&(g.stopPropagation(),a())}return document.addEventListener("mousedown",d),document.addEventListener("keydown",f,!0),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f,!0),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[a]);const u=d=>{if(d.key!=="ArrowDown"&&d.key!=="ArrowUp")return;d.preventDefault();const f=Array.from(i.current.querySelectorAll("[data-menuitem]"));if(f.length===0)return;const g=f.indexOf(document.activeElement),h=d.key==="ArrowDown"?(g+1)%f.length:(g-1+f.length)%f.length;f[h].focus()};return U4.createPortal(n.jsx("div",{ref:i,role:"menu","aria-label":r,onKeyDown:u,className:"fixed z-50 py-1 rounded-lg bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 shadow-lg",style:{width:mp,left:o?o.left:0,top:o?o.top:0,visibility:o?"visible":"hidden"},children:t.map(d=>d.separator?n.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},d.key):n.jsxs("button",{"data-menuitem":"",role:"menuitem",onClick:()=>{a(),d.onSelect()},className:`w-full flex items-center gap-2.5 px-3 py-1.5 text-left text-sm rounded-md ${d.danger?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:[n.jsx("span",{className:"flex-shrink-0 opacity-70",children:d.icon}),n.jsx("span",{className:"flex-1 truncate",children:d.label}),d.hint&&n.jsx("span",{className:"flex-shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:d.hint})]},d.key))}),document.body)}function OI({sessions:e,activeSessionId:t,busySessions:r={},onSelectSession:a,onNewChat:i,onDeleteSession:o,onDeleteAllSessions:l,onRenameSession:u,onRegenerateTitle:d,onPinSession:f,onArchiveSession:g,onExportSession:h,onSendToSession:m,onImportSession:y,onImportError:v,showArchived:k,onToggleShowArchived:_,isOpen:w,onClose:S,onToggle:E,hasMoreSessions:A,onLoadMoreSessions:T,showOtherApps:C,onToggleShowOtherApps:j,hasMoreOtherApps:L,onLoadMoreOtherApps:O,otherAppsCount:I,search:B,onSearchChange:z,loadedCount:ee,totalCount:$}){const{t:M}=Xt(),G=ru(),[Y,X]=x.useState(B||"");x.useEffect(()=>{typeof B=="string"&&B!==Y&&X(B)},[B]);const ie=we=>{X(we),z&&z(we)},[F,U]=x.useState(null),[Z,P]=x.useState(""),[K,V]=x.useState(null),W=x.useRef(null),ae=x.useCallback(()=>{const we=W.current;W.current=null,V(null),we&&we.isConnected&&we.focus()},[]),Q=(we,Ue,Ae)=>{W.current=Ae||null,V({id:we.id,anchor:Ue})},he=Y?e.filter(function(we){return(we.title||M("sidebar.untitled")).toLowerCase().includes(Y.toLowerCase())}):e,{pinnedSessions:Ne,regularSessions:De,archivedSessions:Ve}=x.useMemo(()=>{const we=[],Ue=[],Ae=[];for(let rt=0;rt<he.length;rt++){const fe=he[rt];fe.archived?Ae.push(fe):fe.pinned?we.push(fe):Ue.push(fe)}return{pinnedSessions:we,regularSessions:Ue,archivedSessions:Ae}},[he]),at=x.useMemo(()=>AI(De,M),[De,M]),lt=we=>{U(we.id),P(we.title||"")},Ce=we=>{Z.trim()&&u(we,Z.trim()),U(null),P("")},$e=async we=>{!we.archived&&!await G({title:M("sidebar.archive"),message:M("sidebar.confirmArchive"),confirmLabel:M("sidebar.archive")})||g(we.id,!we.archived)},Be=async we=>{await G({title:M("sidebar.delete_title"),message:M("sidebar.delete_confirm"),destructive:!0,confirmLabel:M("sidebar.delete")})&&o(we.id)},gt=we=>{if(g_(we))return[];const Ue=[{key:"rename",label:M("sidebar.rename"),hint:"F2",icon:n.jsx(po,{name:"rename",className:"w-4 h-4"}),onSelect:()=>lt(we)}];d&&Ue.push({key:"regenerate",label:M("sidebar.regenerate_title"),icon:n.jsx(po,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>d(we.id)}),h&&Ue.push({key:"export",label:M("sidebar.export"),icon:n.jsx(po,{name:"export",className:"w-4 h-4"}),onSelect:()=>h(we.id)}),m&&Ue.push({key:"send-to-session",label:M("sidebar.send_to_session"),icon:n.jsx(po,{name:"send",className:"w-4 h-4"}),onSelect:()=>m(we.id)});const Ae=[];return f&&(!we.archived||we.pinned)&&Ae.push({key:"pin",label:we.pinned?M("sidebar.unpin"):M("sidebar.pin"),icon:n.jsx(p_,{className:"w-4 h-4",filled:we.pinned}),onSelect:()=>f(we.id,!we.pinned)}),g&&Ae.push({key:"archive",label:we.archived?M("sidebar.unarchive"):M("sidebar.archive"),icon:n.jsx(po,{name:we.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>$e(we)}),Ae.length>0&&(Ue.push({key:"sep-state",separator:!0}),Ue.push(...Ae)),Ue.push({key:"sep-danger",separator:!0}),Ue.push({key:"delete",label:M("sidebar.delete"),hint:"Del",danger:!0,icon:n.jsx(po,{name:"delete",className:"w-4 h-4"}),onSelect:()=>Be(we)}),Ue},ut=x.useMemo(()=>K&&e.find(we=>we.id===K.id)||null,[K,e]);x.useEffect(()=>{K&&!ut&&ae()},[K,ut,ae]);const jt=(we,Ue)=>{const Ae=Ue&&Ue.dimmed,rt=g_(we),fe=!!(K&&K.id===we.id),ce=!rt,ve=(ye,it)=>Q(we,ye,it);return n.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${we.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":Ae?"text-gray-400 dark:text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800":"text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800"}`,onClick:()=>a(we.id),onContextMenu:ye=>{!ce||F===we.id||(ye.preventDefault(),ve({x:ye.clientX,y:ye.clientY,flipY:ye.clientY,align:"left"},ye.currentTarget))},onKeyDown:ye=>{if(ye.currentTarget===ye.target){if(ye.key==="Enter"||ye.key===" "){ye.preventDefault(),a(we.id);return}if(ce){if(ye.key==="F2")ye.preventDefault(),lt(we);else if(ye.key==="Delete")ye.preventDefault(),Be(we);else if(ye.key==="ContextMenu"){ye.preventDefault();const it=ye.currentTarget.getBoundingClientRect();ve({x:it.right,y:it.bottom,flipY:it.top,align:"right"},ye.currentTarget)}}}},children:F===we.id?n.jsx("input",{autoFocus:!0,value:Z,onChange:ye=>P(ye.target.value),onBlur:()=>Ce(we.id),onKeyDown:ye=>{ye.key==="Enter"?(ye.preventDefault(),ye.stopPropagation(),ye.currentTarget.blur()):ye.key==="Escape"?(ye.stopPropagation(),U(null)):ye.key===" "&&ye.stopPropagation()},onClick:ye=>ye.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-none"}):n.jsxs(n.Fragment,{children:[we.pinned&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})}),we.source==="archive"&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-blue-400 dark:text-blue-500 opacity-70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"})}),we.compactedAt&&we.source!=="archive"&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),r[we.id]&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse flex-shrink-0",role:"status",title:M("sidebar.session_processing"),"aria-label":M("sidebar.session_processing")}),n.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${Ae?"italic":""}`,"data-menu-open":fe?"true":"false",children:[n.jsx("span",{className:"truncate min-w-0",children:we.title||M("sidebar.untitled")}),we.archived&&n.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["(",M("sidebar.archived"),")"]})]}),n.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[n.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${fe?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:II(we.time&&we.time.updated,M)}),n.jsxs("div",{className:`items-center gap-0.5 ${fe?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[f&&(!we.archived||we.pinned)&&n.jsx("button",{onClick:ye=>{ye.stopPropagation(),f(we.id,!we.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:we.pinned?M("sidebar.unpin"):M("sidebar.pin"),"aria-label":we.pinned?M("sidebar.unpin"):M("sidebar.pin"),children:n.jsx(p_,{className:`w-4 h-4 ${we.pinned?"text-amber-500":""}`,filled:we.pinned})}),ce&&n.jsx("button",{onClick:ye=>{ye.stopPropagation();const it=ye.currentTarget.getBoundingClientRect();ve({x:it.right,y:it.bottom+4,flipY:it.top-4,align:"right"},ye.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${fe?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":M("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":fe,children:n.jsx(po,{name:"more",className:"w-4 h-4"})})]})]})]})},we.id)},Ge=we=>n.jsx("div",{className:"px-2 pt-3 pb-1",children:n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:we})});return n.jsxs(n.Fragment,{children:[w&&n.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:S}),!w&&n.jsx("div",{className:"flex-shrink-0 w-10 flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:n.jsx("button",{onClick:E,className:"p-1.5 rounded-lg bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:M("sidebar.show"),"aria-label":M("sidebar.show"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),n.jsxs("aside",{className:`
|
|
41
|
-
${w?"translate-x-0":"-translate-x-full"}
|
|
42
|
-
transition-transform duration-200 ease-in-out
|
|
43
|
-
fixed md:relative z-30 md:z-auto
|
|
44
|
-
top-14 md:top-0 bottom-0 left-0
|
|
45
|
-
w-64 border-r border-gray-200 dark:border-gray-800
|
|
46
|
-
bg-gray-50 dark:bg-gray-900 flex flex-col
|
|
47
|
-
${w?"md:flex":"md:hidden"}
|
|
48
|
-
`,children:[n.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-1",children:[n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium",children:M("sidebar.conversations")}),n.jsx("button",{onClick:E,className:"p-1.5 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:M("sidebar.hide"),"aria-label":M("sidebar.hide"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]}),n.jsxs("div",{className:"px-3 py-2 flex gap-2",children:[n.jsx("button",{onClick:i,className:"flex-1 py-2 px-4 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:M("app.new_chat")}),y&&n.jsx("button",{onClick:()=>{const we=document.createElement("input");we.type="file",we.accept=".yaml,.yml",we.onchange=Ue=>{const Ae=Ue&&Ue.target&&Ue.target.files,rt=Ae&&Ae[0];if(rt){const fe=rt.name.toLowerCase();if(!fe.endsWith(".yaml")&&!fe.endsWith(".yml")){v&&v(M("import.invalid_file_type"));return}const ce=10*1024*1024;if(rt.size>ce){v&&v(M("import.file_too_large"));return}const ve=new FileReader;ve.onload=ye=>{const it=ye&&ye.target?ye.target.result:null;if(typeof it!="string"){v&&v(M("import.read_error"));return}y(it)},ve.onerror=()=>{v&&v(M("import.read_error"))},ve.readAsText(rt)}},we.click()},className:"py-2 px-3 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 text-sm transition-colors",title:M("sidebar.import"),"aria-label":M("sidebar.import"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})})]}),n.jsx("div",{className:"px-3 pb-2",children:n.jsx("input",{type:"text",placeholder:M("sidebar.search_placeholder"),value:Y,onChange:we=>ie(we.target.value),className:"w-full px-3 py-1.5 rounded-lg bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 outline-none focus:ring-2 focus:ring-primary-500/30"})}),n.jsxs("div",{className:"flex-1 overflow-y-auto px-2",children:[Ne.length===0&&at.every(we=>we.sessions.length===0)&&(!k||Ve.length===0)&&n.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:M(Y?"sidebar.no_matches":"sidebar.no_conversations")}),Ne.length>0&&n.jsxs(n.Fragment,{children:[Ge(M("sidebar.pinned")),Ne.map(we=>jt(we))]}),at.map(we=>n.jsxs("div",{children:[(Ne.length>0||at.length>1)&&Ge(we.label),we.sessions.map(Ue=>jt(Ue))]},we.key)),k&&Ve.length>0&&n.jsxs(n.Fragment,{children:[Ge(M("sidebar.archived")),Ve.map(we=>jt(we,{dimmed:!0}))]}),(A||L)&&(T||O)&&n.jsx("div",{className:"pt-2 pb-1 px-1",children:n.jsxs("button",{onClick:()=>{A&&T&&T(),L&&O&&O()},className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-primary-600 dark:text-primary-400 hover:bg-primary-50 dark:hover:bg-primary-900/20 transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),typeof $=="number"&&$>0&&typeof ee=="number"?M("sidebar.load_more_count",{loaded:ee+(I||0),total:$+(I||0)}):M("sidebar.load_more")]})}),!A&&!L&&typeof $=="number"&&$>0&&n.jsx("div",{className:"pt-2 pb-1 px-1 text-center text-[11px] text-gray-400 dark:text-gray-500 tabular-nums",children:Y?M("sidebar.search_result_count",{total:$+(I||0)}):M("sidebar.all_loaded_count",{total:$+(I||0)})}),j&&n.jsx("div",{className:"pt-2 pb-1 px-1",children:n.jsxs("button",{onClick:j,className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M4 5h16a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V6a1 1 0 011-1z"})}),M(C?"sidebar.hide_other_apps":"sidebar.show_other_apps")]})}),_&&n.jsx("div",{className:"pt-2 pb-1 px-1",children:n.jsxs("button",{onClick:_,className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:k?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.878 9.878L3 3m6.878 6.878L21 21"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})}),M(k?"sidebar.hide_archived":"sidebar.show_archived")]})}),he.some(function(we){return we.source!=="legacy"&&!we._readOnly})&&l&&n.jsx("div",{className:"pt-3 pb-2 px-1",children:n.jsxs("button",{onClick:async()=>{await G({title:M("sidebar.delete_all_title"),message:M("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:M("sidebar.delete_all")})&&l()},className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg border border-red-300 dark:border-red-800 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 text-xs font-medium transition-colors",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),M("sidebar.delete_all")]})})]})]}),K&&ut&&n.jsx(LI,{anchor:K.anchor,items:gt(ut),label:M("sidebar.more_actions"),onClose:ae})]})}const Bs="pave-draft-";function DI(e){return Bs+e}function PI(e){if(e)try{localStorage.removeItem(DI(e))}catch{}}const ei="",Ob="pave-working-directory";function _l(){if(typeof window>"u")return null;try{return localStorage.getItem(Ob)||null}catch{return null}}function xp(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(Ob):localStorage.setItem(Ob,e)}catch{}}const H4="web";let Db=null;function h_(e){Db=e}let wc=null,m_=0;function $4(){return wc||(Date.now()<m_?Promise.resolve(!1):(wc=(async()=>{let e=!1,t=null;try{const r=await fetch(`${ei}/auth/membership/restore`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(r.ok){const a=await r.json().catch(()=>({}));e=!!a.authenticated,t=a.user||null}}catch{e=!1}finally{m_=Date.now()+5e3,wc=null}try{Db&&Db({recovered:e,user:t})}catch{}return e})(),wc))}function FI(e){return typeof e=="string"&&e.indexOf("/auth/")===0}async function xt(e,t={}){const r=_l(),a={"Content-Type":"application/json","X-PAVE-Client":H4,...t.headers};r&&(a["x-opencode-directory"]=r);const{headers:i,...o}=t,l=await fetch(`${ei}${e}`,{...o,headers:a});if(!l.ok){l.status===401&&!FI(e)&&$4();let u=null;try{const f=await l.text();try{u=JSON.parse(f)}catch{u=null}if(!u){const g=new Error(`${l.status}: ${f||l.statusText}`);throw g.status=l.status,g}}catch(f){if(f.message)throw f.status===void 0&&(f.status=l.status),f;const g=new Error(`${l.status}: ${l.statusText}`);throw g.status=l.status,g}const d=new Error(`${l.status}: ${u.error||u.message||JSON.stringify(u)}`);throw d.status=l.status,d.body=u,u.reauthRequired&&(d.reauthRequired=!0),d}return l.json()}function vl(e){const t=new URLSearchParams;e&&(typeof e.limit=="number"&&Number.isFinite(e.limit)&&e.limit>0&&t.set("limit",String(e.limit)),typeof e.offset=="number"&&Number.isFinite(e.offset)&&t.set("offset",String(e.offset)),e.includeArchived&&t.set("includeArchived","true"),typeof e.q=="string"&&e.q.trim()&&t.set("q",e.q.trim()),e.onlyOtherApps&&t.set("onlyOtherApps","true"),e.onlyArchived&&t.set("onlyArchived","true")),t.set("includeOtherApps",e&&e.includeOtherApps===!1?"false":"true");const r=t.toString(),a=r?`/session?${r}`:"/session";return xt(a)}function x_(e){return xt("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function yp(e){return xt(`/session/${e}`)}function Qa(e,t){return xt(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function BI(e){return xt(`/session/${e}/regenerate-title`,{method:"POST"})}function zI(e,{senderSessionID:t,text:r}){return xt(`/session/${e}/mailbox`,{method:"POST",body:JSON.stringify({senderSessionID:t,text:r})})}function UI(e){return xt(`/session/${e}/fork`,{method:"POST"})}function qI(e){return xt(`/session/${e}`,{method:"DELETE"})}function HI(e){return xt(`/session/${e}/archive/session`,{method:"POST"})}function $I(){return xt("/session",{method:"DELETE"})}function y_(e,t,r){const a=new URLSearchParams;t&&a.set("fresh","1"),r&&r.limit!=null&&a.set("limit",String(r.limit)),r&&r.before&&a.set("before",r.before);const i=a.toString();return xt(`/session/${e}/message${i?"?"+i:""}`)}function Cd(e,t,r,a,i,o){const l={content:t,async:!0};return r&&r.length>0&&(l.parts=r),a&&(l.model=a),i&&(l.agent=i),o&&o.enqueue&&(l.enqueue=!0,o.priority&&(l.priority=o.priority),o.displayContent&&(l.displayContent=o.displayContent)),o&&o.moeTopK&&(l.moe_top_k=o.moeTopK),o&&o.reasoningEffort&&(l.reasoning_effort=o.reasoningEffort),o&&o.adaptiveQuality&&(l.adaptive_quality=!0),xt(`/session/${e}/message`,{method:"POST",body:JSON.stringify(l)})}function bp(e){return xt(`/session/${e}/queue`)}function b_(e,t,r){const a={content:t};return r&&r.parts&&(a.parts=r.parts),r&&r.model&&(a.model=r.model),r&&r.agent&&(a.agent=r.agent),r&&r.priority&&(a.priority=r.priority),r&&r.displayContent&&(a.displayContent=r.displayContent),r&&r.moeTopK&&(a.moe_top_k=r.moeTopK),r&&r.reasoningEffort&&(a.reasoning_effort=r.reasoningEffort),r&&r.adaptiveQuality&&(a.adaptive_quality=!0),xt(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(a)})}function v_(e,t){return xt(`/session/${e}/queue/${t}`,{method:"DELETE"})}function WI(e,t){return xt(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function VI(e){return xt(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function GI(e){return xt(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function KI(e){return xt(`/session/${e}/abort`,{method:"POST"})}function W4(e){return xt(`/session/${e}/idle-injection`)}function YI(e,t){return xt(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function XI(e){return xt(`/session/${e}/idle-injection`,{method:"DELETE"})}function QI(e){return xt(`/session/${e}/scheduled-injections`)}function ZI(e,t){return xt(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function JI(e,t,r){return xt(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(r)})}function e3(e,t){return xt(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function t3(){return xt("/config/providers")}function r3(){return xt("/api/models/registry")}function n3(){return xt("/auth/status")}function a3(){return xt("/auth/logout",{method:"POST"})}function i3(){return xt("/api/permissions/pending")}function s3(e){return xt(`/api/permissions/confirm/${e}`,{method:"POST"})}function o3(e){return xt(`/api/permissions/deny/${e}`,{method:"POST"})}function l3(){return xt("/api/questions/pending")}function c3(e,t){return xt(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function u3(e){return xt(`/api/questions/${e}/reject`,{method:"POST"})}function bv(){return xt("/skills")}function d3(){return xt("/skills/commands")}function f3(){return xt("/skills/registry")}function g3(e){return xt(`/skills/${encodeURIComponent(e)}`)}function p3(e){return xt(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function h3(e){return xt(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function m3(){return xt("/skills/check-updates")}function x3(e,t){return xt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function y3(e){return xt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function b3(e){return xt(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function V4(){return xt("/api/skill-defaults")}function v3(e){return xt("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function k3(e){return xt(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function _3(e){return xt(`/skills/${encodeURIComponent(e)}/oauth/broker/start`,{method:"POST"})}function w3(e,t){return xt(`/skills/${encodeURIComponent(e)}/oauth/broker/result?flow_id=${encodeURIComponent(t)}`)}function k_(){return xt("/config")}function N3(){return xt("/inspector/sessions")}async function S3(e){const t=_l(),r={"X-PAVE-Client":H4};t&&(r["x-opencode-directory"]=t);const a=await fetch(`${ei}/inspector/session/${encodeURIComponent(e)}/events`,{headers:r});if(!a.ok){const i=new Error(`${a.status}: ${a.statusText}`);throw i.status=a.status,i}return a.text()}function __(e,t){return xt(`/inspector/session/${encodeURIComponent(e)}/body/${encodeURIComponent(t)}`)}function E3(e){return xt(`/inspector/session/${encodeURIComponent(e)}`,{method:"DELETE"})}function j3(e){const t=e?"?model="+encodeURIComponent(e):"";return xt("/config/adaptive-quality"+t)}function Pb(){return xt("/path")}function w_(e){return xt("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function C3(e){return xt("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function Fb(){return xt("/settings")}function T3(e){return xt("/settings",{method:"PUT",body:JSON.stringify(e)})}function N_(e){const t=new URLSearchParams;e&&(e.unreadOnly&&t.set("unreadOnly","true"),typeof e.limit=="number"&&t.set("limit",String(e.limit)),typeof e.offset=="number"&&t.set("offset",String(e.offset)));const r=t.toString();return xt("/api/user/inbox"+(r?"?"+r:""))}function R3(e){return xt("/api/user/inbox/"+encodeURIComponent(e)+"/read",{method:"POST"})}function A3(e){return xt("/api/user/inbox/"+encodeURIComponent(e)+"/unread",{method:"POST"})}function I3(e){return xt("/api/user/inbox/"+encodeURIComponent(e),{method:"DELETE"})}function M3(){return xt("/api/user/inbox/read-all",{method:"POST"})}function L3(){return xt("/api/user/inbox",{method:"DELETE"})}async function O3(e){const t=await fetch(ei+"/session/"+e+"/export",{credentials:"include"});if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Export failed")}const r=await t.blob(),a=t.headers.get("X-Filename")||"session.yaml",i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=a,document.body.appendChild(o),o.click(),setTimeout(()=>{URL.revokeObjectURL(i),o.parentNode&&o.parentNode.removeChild(o)},0)}function D3(e){return xt("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function P3(e,t,r,a){const i=_l(),o={};i&&(o["x-opencode-directory"]=i),e.type?o["Content-Type"]=e.type:o["Content-Type"]="audio/webm";let l=ei+"/api/transcribe";const u=[];t&&u.push("language="+encodeURIComponent(t)),r&&u.push("model="+encodeURIComponent(r));const d=a&&a.initialPrompt;d&&u.push("initial_prompt="+encodeURIComponent(d)),u.length>0&&(l+="?"+u.join("&"));const f=await fetch(l,{method:"POST",credentials:"include",headers:o,body:e}),g=await f.text();let h=null;if(g)try{h=JSON.parse(g)}catch{}if(!f.ok){const m=new Error(h&&h.error||"Transcription failed (HTTP "+f.status+")");throw m.status=f.status,m.code=h&&h.code,m.fallback=h&&h.fallback,m}if(!h){const m=new Error("Invalid response from transcription endpoint");throw m.code="invalid_response",m.fallback=!0,m}return h}let hl=null,Ic=0;function Bb(){const e=Date.now();return hl&&e<Ic||(hl=xt("/api/transcribe/config").then(t=>(Ic=Date.now()+5e3,t)).catch(t=>{throw hl=null,Ic=0,t}),Ic=1/0),hl}function F3(e){return hl=null,Ic=0,xt("/api/asr/engine",{method:"POST",body:JSON.stringify({engine:e})})}function S_(){return xt("/session/status")}function B3(e){return xt(`/session/${encodeURIComponent(e)}/dlp/status`)}function z3(){return xt("/api/dlp/policy")}function U3(e){return xt("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function q3(e){return(await fetch(`${ei}/api/whatsapp/routing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function H3(e){return(await fetch(`${ei}/api/whatsapp/queue/${e}/pop`,{method:"POST"})).json()}async function E_(e){const t=await fetch(`${ei}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function $3(e){return(await fetch(`${ei}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function vp(e){try{const t=await fetch(`${ei}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function W3(e){const t=await fetch(`${ei}/session/${e}/plan`,{credentials:"include"});if(!t.ok){const r=new Error(t.status===404?"PLAN.md not found":`${t.status}: ${t.statusText}`);throw r.status=t.status,r}return t.json()}async function j_(e){try{const t=await fetch(`${ei}/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function V3(e){const t=new URLSearchParams;e&&(e.category&&t.set("category",e.category),t.set("limit",String(e.limit)),typeof e.offset=="number"&&t.set("offset",String(e.offset)));const r=t.toString();return xt(`/api/board/topics${r?`?${r}`:""}`)}function C_(e){return xt(`/api/board/topic/${encodeURIComponent(e)}`)}function G3(e){return xt(`/api/board/search?q=${encodeURIComponent(e)}`)}function K3(e){return xt(`/api/board/topic/${encodeURIComponent(e)}`,{method:"DELETE"})}function Y3(e,t){return xt(`/api/board/topic/${encodeURIComponent(e)}/post/${encodeURIComponent(t)}`,{method:"DELETE"})}function X3(e){var t=e&&(e.client||e.source)||"";return t==="web"?"Web":t==="agent"?"Agent":t==="tui"?"TUI":t==="acp"?"Studio":t||"Unknown"}function Q3({open:e,onClose:t,senderSessionID:r}){var{t:a}=Xt(),i=x.useRef(null),o=x.useRef(null),l=x.useState([]),u=l[0],d=l[1],f=x.useState(""),g=f[0],h=f[1],m=x.useState(""),y=m[0],v=m[1],k=x.useState(!1),_=k[0],w=k[1],S=x.useState(""),E=S[0],A=S[1],T=x.useState(!1),C=T[0],j=T[1];x.useEffect(function(){if(e){var I=!1;return A(""),j(!1),v(""),vl({includeOtherApps:!0,limit:100}).then(function(B){if(!I){var z=Array.isArray(B)?B:B&&B.sessions||[],ee=z.filter(function($){return $&&$.id!==r});d(ee),h(ee.length?ee[0].id:"")}}).catch(function(B){I||A(B&&B.message?B.message:String(B))}),function(){I=!0}}},[e,r]),x.useEffect(function(){e&&o.current&&o.current.focus()},[e]),x.useEffect(function(){if(!e)return;function I(B){B.key==="Escape"&&(typeof B.preventDefault=="function"&&B.preventDefault(),typeof B.stopImmediatePropagation=="function"?B.stopImmediatePropagation():typeof B.stopPropagation=="function"&&B.stopPropagation(),t())}return document.addEventListener("keydown",I,!0),function(){document.removeEventListener("keydown",I,!0)}},[e,t]);var L=x.useCallback(function(){!g||!y.trim()||_||(w(!0),A(""),zI(g,{senderSessionID:r,text:y}).then(function(){w(!1),j(!0)}).catch(function(I){w(!1),A(I&&I.message?I.message:String(I))}))},[g,y,_,r]);if(!e)return null;var O=!!g&&!!y.trim()&&!_;return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(I){I.target===I.currentTarget&&t()},children:n.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":a("send_to_session.title"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 outline-none transition-all duration-150",children:[n.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:n.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:a("send_to_session.title")})}),n.jsxs("div",{className:"px-5 py-4 space-y-3",children:[C?n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a("send_to_session.queued")}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[a("send_to_session.target_label"),n.jsx("select",{value:g,onChange:function(I){h(I.target.value)},className:"mt-1 block w-full rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm px-3 py-2",children:u.map(function(I){return n.jsx("option",{value:I.id,children:(I.title||I.id)+" — "+X3(I)},I.id)})})]}),u.length===0?n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("send_to_session.no_targets")}):null,n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[a("send_to_session.message_label"),n.jsx("textarea",{ref:o,value:y,onChange:function(I){v(I.target.value)},rows:4,className:"mt-1 block w-full rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm px-3 py-2"})]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("send_to_session.delivery_note")})]}),E?n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",role:"alert",children:E}):null]}),n.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[n.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:a(C?"send_to_session.close":"send_to_session.cancel")}),C?null:n.jsx("button",{type:"button",onClick:L,disabled:!O,className:"px-4 py-2 text-sm font-medium rounded-md bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-offset-2",children:a(_?"send_to_session.sending":"send_to_session.send")})]})]})})}const Nf=0,qs=1,Rl=2,G4=4;function T_(e){return()=>e}function Z3(e){e()}function K4(e,t){return r=>e(t(r))}function R_(e,t){return()=>e(t)}function J3(e,t){return r=>e(t,r)}function vv(e){return e!==void 0}function eM(...e){return()=>{e.map(Z3)}}function Al(){}function Sf(e,t){return t(e),e}function tM(e,t){return t(e)}function Xr(...e){return e}function Ir(e,t){return e(qs,t)}function rr(e,t){e(Nf,t)}function kv(e){e(Rl)}function Kr(e){return e(G4)}function Ot(e,t){return Ir(e,J3(t,Nf))}function ki(e,t){const r=e(qs,a=>{r(),t(a)});return r}function A_(e){let t,r;return a=>i=>{t=i,r&&clearTimeout(r),r=setTimeout(()=>{a(t)},e)}}function Y4(e,t){return e===t}function Yr(e=Y4){let t;return r=>a=>{e(t,a)||(t=a,r(a))}}function Gt(e){return t=>r=>{e(r)&&t(r)}}function wt(e){return t=>K4(t,e)}function $i(e){return t=>()=>{t(e)}}function tt(e,...t){const r=rM(...t);return((a,i)=>{switch(a){case Rl:kv(e);return;case qs:return Ir(e,r(i))}})}function Wi(e,t){return r=>a=>{r(t=e(t,a))}}function So(e){return t=>r=>{e>0?e--:t(r)}}function us(e){let t=null,r;return a=>i=>{t=i,!r&&(r=setTimeout(()=>{r=void 0,a(t)},e))}}function or(...e){const t=Array.from({length:e.length});let r=0,a=null;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Ir(o,d=>{const f=r;r|=u,t[l]=d,f!==i&&r===i&&a&&(a(),a=null)})}),o=>l=>{const u=()=>{o([l].concat(t))};r===i?u():a=u}}function rM(...e){return t=>e.reduceRight(tM,t)}function nM(e){let t,r;const a=()=>t==null?void 0:t();return function(i,o){switch(i){case qs:return o?r===o?void 0:(a(),r=o,t=Ir(e,o),t):(a(),Al);case Rl:a(),r=null;return}}}function dt(e){let t=e;const r=xr();return((a,i)=>{switch(a){case Nf:t=i;break;case qs:{i(t);break}case G4:return t}return r(a,i)})}function Gn(e,t){return Sf(dt(t),r=>Ot(e,r))}function xr(){const e=[];return((t,r)=>{switch(t){case Nf:e.slice().forEach(a=>{a(r)});return;case Rl:e.splice(0);return;case qs:return e.push(r),()=>{const a=e.indexOf(r);a>-1&&e.splice(a,1)}}})}function Da(e){return Sf(xr(),t=>Ot(e,t))}const aM={singleton:!0};function Ar(e,t=[],r=aM){const{singleton:a}=r;return{constructor:e,dependencies:t,id:iM(),singleton:a}}const iM=()=>Symbol("id");function sM(e){const t=new Map,r=({constructor:a,dependencies:i,id:o,singleton:l})=>{if(l&&t.has(o))return t.get(o);const u=a(i.map(d=>r(d)));return l&&t.set(o,u),u};return r(e)}function un(...e){const t=xr(),r=Array.from({length:e.length});let a=0;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Ir(o,d=>{r[l]=d,a|=u,a===i&&rr(t,r)})}),function(o,l){switch(o){case Rl:{kv(t);return}case qs:return a===i&&l(r),Ir(t,l)}}}function Vt(e,t=Y4){return tt(e,Yr(t))}function zb(...e){return function(t,r){switch(t){case Rl:return;case qs:return eM(...e.map(a=>Ir(a,r)))}}}const Sn={DEBUG:0,INFO:1,WARN:2,ERROR:3},oM={[Sn.DEBUG]:"debug",[Sn.ERROR]:"error",[Sn.INFO]:"log",[Sn.WARN]:"warn"},lM=()=>typeof globalThis>"u"?window:globalThis,Hs=Ar(()=>{const e=dt(Sn.ERROR);return{log:dt((t,r,a=Sn.INFO)=>{const i=lM().VIRTUOSO_LOG_LEVEL??Kr(e);a>=i&&console[oM[a]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,r)}),logLevel:e}},[],{singleton:!0});function cM(e){return"self"in e?e.document.documentElement:e}function X4(e){const t=cM(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl"}function ko(e,t){return X4(e)?-t:t}function I_(e,t){return X4(e)?-t:t}function Co(e,t,r){return _v(e,t,r).callbackRef}function _v(e,t,r){const a=Mt.useRef(null);let i=l=>{};const o=Mt.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(l=>{const u=()=>{const d=l[0].target;d.offsetParent!==null&&e(d)};r?u():requestAnimationFrame(u)}):null,[e,r]);return i=l=>{l&&t?(o==null||o.observe(l),a.current=l):(a.current&&(o==null||o.unobserve(a.current)),a.current=null)},{callbackRef:i,ref:a}}function uM(e,t,r,a,i,o,l,u,d){const f=Mt.useCallback(g=>{var S;const h=dM(g.children,t,u?"offsetWidth":"offsetHeight",i);let m=g.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const y=((S=m.lastElementChild)==null?void 0:S.dataset.viewportType)==="window";let v;y&&(v=m.ownerDocument.defaultView);const k=l?u?l.scrollWidth:l.scrollHeight:y?u?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight:u?m.scrollWidth:m.scrollHeight,_=l?u?l.offsetWidth:l.offsetHeight:y?u?v.innerWidth:v.innerHeight:u?m.offsetWidth:m.offsetHeight,w=l?u?ko(l,l.scrollLeft):l.scrollTop:y?u?ko(v,v.scrollX||v.document.documentElement.scrollLeft):v.scrollY||v.document.documentElement.scrollTop:u?ko(m,m.scrollLeft):m.scrollTop;a({scrollHeight:k,scrollTop:Math.max(w,0),viewportHeight:_}),o==null||o(u?M_("column-gap",getComputedStyle(g).columnGap,i):M_("row-gap",getComputedStyle(g).rowGap,i)),h!==null&&e(h)},[e,t,i,o,l,a,u]);return _v(f,r,d)}function dM(e,t,r,a){const i=e.length;if(i===0)return null;const o=[];for(let l=0;l<i;l++){const u=e.item(l);if(u.dataset.index===void 0)continue;const d=parseInt(u.dataset.index,10),f=parseFloat(u.dataset.knownSize),g=t(u,r);if(g===0&&a("Zero-sized element, this should not happen",{child:u},Sn.ERROR),g===f)continue;const h=o[o.length-1];o.length===0||h.size!==g||h.endIndex!==d-1?o.push({endIndex:d,size:g,startIndex:d}):o[o.length-1].endIndex++}return o}function M_(e,t,r){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&r(`${e} was not resolved to pixel value correctly`,t,Sn.WARN),t==="normal"?0:parseInt(t??"0",10)}const wv=typeof document>"u"?Mt.useEffect:Mt.useLayoutEffect;function Q4(e,t,r){const a=Mt.useRef(null),i=Mt.useCallback(d=>{if(!(d!=null&&d.offsetParent))return;const f=d.getBoundingClientRect(),g=f.width;let h,m;if(t){const y=t.getBoundingClientRect(),v=f.top-y.top;m=y.height-Math.max(0,v),h=v+t.scrollTop}else{const y=l.current.ownerDocument.defaultView;m=y.innerHeight-Math.max(0,f.top),h=f.top+y.scrollY}a.current={listHeight:f.height,offsetTop:h,visibleHeight:m,visibleWidth:g},e(a.current)},[e,t]),{callbackRef:o,ref:l}=_v(i,!0,r),u=Mt.useCallback(()=>{i(l.current)},[i,l]);return Mt.useEffect(()=>{var f;if(t){t.addEventListener("scroll",u);const g=new ResizeObserver(()=>{requestAnimationFrame(u)});return g.observe(t),()=>{t.removeEventListener("scroll",u),g.unobserve(t)}}const d=(f=l.current)==null?void 0:f.ownerDocument.defaultView;return d==null||d.addEventListener("scroll",u),d==null||d.addEventListener("resize",u),()=>{d==null||d.removeEventListener("scroll",u),d==null||d.removeEventListener("resize",u)}},[u,t,l]),o}const la=Ar(()=>{const e=xr(),t=xr(),r=dt(0),a=xr(),i=xr(),o=dt(0),l=xr(),u=xr(),d=dt(0),f=dt(0),g=dt(0),h=dt(0),m=xr(),y=xr(),v=dt(!1),k=dt(!1),_=dt(!1);return Ot(tt(e,wt(({scrollTop:w})=>w)),t),Ot(tt(e,wt(({scrollHeight:w})=>w)),u),Ot(t,o),{deviation:r,deviationCommitted:a,fixedFooterHeight:g,fixedHeaderHeight:f,footerHeight:h,headerHeight:d,horizontalDirection:k,scrollBy:y,scrollContainerState:e,scrollHeight:u,scrollingInProgress:v,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:_,smoothScrollTargetReached:i,statefulScrollTop:o,viewportHeight:l}},[],{singleton:!0}),Wc={lvl:0};function Z4(e,t){const r=e.length;if(r===0)return[];let{index:a,value:i}=t(e[0]);const o=[];for(let l=1;l<r;l++){const{index:u,value:d}=t(e[l]);o.push({end:u-1,start:a,value:i}),a=u,i=d}return o.push({end:1/0,start:a,value:i}),o}function Pr(e){return e===Wc}function Vc(e,t){if(!Pr(e))return t===e.k?e.v:t<e.k?Vc(e.l,t):Vc(e.r,t)}function wi(e,t,r="k"){if(Pr(e))return[-1/0,void 0];if(Number(e[r])===t)return[e.k,e.v];if(Number(e[r])<t){const a=wi(e.r,t,r);return a[0]===-1/0?[e.k,e.v]:a}return wi(e.l,t,r)}function La(e,t,r){return Pr(e)?t5(t,r,1):t===e.k?Nn(e,{k:t,v:r}):t<e.k?L_(Nn(e,{l:La(e.l,t,r)})):L_(Nn(e,{r:La(e.r,t,r)}))}function wl(){return Wc}function Nl(e,t,r){if(Pr(e))return[];const a=wi(e,t)[0];return fM(qb(e,a,r))}function Ub(e,t){if(Pr(e))return Wc;const{k:r,l:a,r:i}=e;if(t===r){if(Pr(a))return i;if(Pr(i))return a;const[o,l]=e5(a);return Zd(Nn(e,{k:o,l:J4(a),v:l}))}return t<r?Zd(Nn(e,{l:Ub(a,t)})):Zd(Nn(e,{r:Ub(i,t)}))}function _o(e){return Pr(e)?[]:[..._o(e.l),{k:e.k,v:e.v},..._o(e.r)]}function qb(e,t,r){if(Pr(e))return[];const{k:a,l:i,r:o,v:l}=e;let u=[];return a>t&&(u=u.concat(qb(i,t,r))),a>=t&&a<=r&&u.push({k:a,v:l}),a<=r&&(u=u.concat(qb(o,t,r))),u}function Zd(e){const{l:t,lvl:r,r:a}=e;if(a.lvl>=r-1&&t.lvl>=r-1)return e;if(r>a.lvl+1){if(kp(t))return r5(Nn(e,{lvl:r-1}));if(!Pr(t)&&!Pr(t.r))return Nn(t.r,{l:Nn(t,{r:t.r.l}),lvl:r,r:Nn(e,{l:t.r.r,lvl:r-1})});throw new Error("Unexpected empty nodes")}if(kp(e))return Hb(Nn(e,{lvl:r-1}));if(!Pr(a)&&!Pr(a.l)){const i=a.l,o=kp(i)?a.lvl-1:a.lvl;return Nn(i,{l:Nn(e,{lvl:r-1,r:i.l}),lvl:i.lvl+1,r:Hb(Nn(a,{l:i.r,lvl:o}))})}throw new Error("Unexpected empty nodes")}function Nn(e,t){return t5(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function J4(e){return Pr(e.r)?e.l:Zd(Nn(e,{r:J4(e.r)}))}function kp(e){return Pr(e)||e.lvl>e.r.lvl}function e5(e){return Pr(e.r)?[e.k,e.v]:e5(e.r)}function t5(e,t,r,a=Wc,i=Wc){return{k:e,l:a,lvl:r,r:i,v:t}}function L_(e){return Hb(r5(e))}function r5(e){const{l:t}=e;return!Pr(t)&&t.lvl===e.lvl?Nn(t,{r:Nn(e,{l:t.r})}):e}function Hb(e){const{lvl:t,r}=e;return!Pr(r)&&!Pr(r.r)&&r.lvl===t&&r.r.lvl===t?Nn(r,{l:Nn(e,{r:r.l}),lvl:t+1}):e}function fM(e){return Z4(e,({k:t,v:r})=>({index:t,value:r}))}function n5(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Gc(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Nv=Ar(()=>({recalcInProgress:dt(!1)}),[],{singleton:!0});function a5(e,t,r){return e[lf(e,t,r)]}function lf(e,t,r,a=0){let i=e.length-1;for(;a<=i;){const o=Math.floor((a+i)/2),l=e[o],u=r(l,t);if(u===0)return o;if(u===-1){if(i-a<2)return o-1;i=o-1}else{if(i===a)return o;a=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function gM(e,t,r,a){const i=lf(e,t,a),o=lf(e,r,a,i);return e.slice(i,o+1)}function Us(e,t){return Math.round(e.getBoundingClientRect()[t])}function Ef(e){return!Pr(e.groupOffsetTree)}function Sv({index:e},t){return t===e?0:t<e?-1:1}function pM(){return{groupIndices:[],groupOffsetTree:wl(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:wl()}}function hM(e,t){let r=Pr(e)?0:1/0;for(const a of t){const{endIndex:i,size:o,startIndex:l}=a;if(r=Math.min(r,l),Pr(e)){e=La(e,0,o);continue}const u=Nl(e,l-1,i+1);if(u.some(_M(a)))continue;let d=!1,f=!1;for(const{end:g,start:h,value:m}of u)d?(i>=h||o===m)&&(e=Ub(e,h)):(f=m!==o,d=!0),g>i&&i>=h&&m!==o&&(e=La(e,i+1,m));f&&(e=La(e,l,o))}return[e,r]}function mM(e){return e.groupIndex!==void 0}function xM({offset:e},t){return t===e?0:t<e?-1:1}function Kc(e,t,r){if(t.length===0)return 0;const{index:a,offset:i,size:o}=a5(t,e,Sv),l=e-a,u=o*l+(l-1)*r+i;return u>0?u+r:u}function i5(e,t){if(!Ef(t))return e;let r=0;for(;t.groupIndices[r]<=e+r;)r++;return e+r}function s5(e,t,r){if(mM(e))return t.groupIndices[e.groupIndex]+1;const a=e.index==="LAST"?r:e.index;let i=i5(a,t);return i=Math.max(0,Math.min(r,i)),i}function yM(e,t,r,a=0){return a>0&&(t=Math.max(t,a5(e,a,Sv).offset)),Z4(gM(e,t,r,xM),kM)}function bM(e,[t,r,a,i]){t.length>0&&a("received item sizes",t,Sn.DEBUG);const o=e.sizeTree;let l=o,u=0;if(r.length>0&&Pr(o)&&t.length===2){const m=t[0].size,y=t[1].size;l=r.reduce((v,k)=>La(La(v,k,m),k+1,y),l)}else[l,u]=hM(l,t);if(l===o)return e;const{lastIndex:d,lastOffset:f,lastSize:g,offsetTree:h}=$b(e.offsetTree,u,l,i);return{groupIndices:r,groupOffsetTree:r.reduce((m,y)=>La(m,y,Kc(y,h,i)),wl()),lastIndex:d,lastOffset:f,lastSize:g,offsetTree:h,sizeTree:l}}function vM(e){return _o(e).map(({k:t,v:r},a,i)=>{const o=i[a+1];return{endIndex:o===void 0?1/0:o.k-1,size:r,startIndex:t}})}function O_(e,t){let r=0,a=0;for(;r<e;)r+=t[a+1]-t[a]-1,a++;return a-(r===e?0:1)}function $b(e,t,r,a){let i=e,o=0,l=0,u=0,d=0;if(t===0)i=[];else{d=lf(i,t-1,Sv),u=i[d].offset;const f=wi(r,t-1);o=f[0],l=f[1],i.length&&i[d].size===wi(r,t)[1]&&(d-=1),i=i.slice(0,d+1)}for(const{start:f,value:g}of Nl(r,t,1/0)){const h=f-o,m=h*l+u+h*a;i.push({index:f,offset:m,size:g}),o=f,u=m,l=g}return{lastIndex:o,lastOffset:u,lastSize:l,offsetTree:i}}function kM(e){return{index:e.index,value:e}}function _M(e){const{endIndex:t,size:r,startIndex:a}=e;return i=>i.start===a&&(i.end===t||i.end===1/0)&&i.value===r}const wM={offsetHeight:"height",offsetWidth:"width"},Vi=Ar(([{log:e},{recalcInProgress:t}])=>{const r=xr(),a=xr(),i=Gn(a,0),o=xr(),l=xr(),u=dt(0),d=dt([]),f=dt(void 0),g=dt(void 0),h=dt(void 0),m=dt(void 0),y=dt((j,L)=>Us(j,wM[L])),v=dt(void 0),k=dt(0),_=pM(),w=Gn(tt(r,or(d,e,k),Wi(bM,_),Yr()),_),S=Gn(tt(d,Yr(),Wi((j,L)=>({current:L,prev:j.current}),{current:[],prev:[]}),wt(({prev:j})=>j)),[]);Ot(tt(d,Gt(j=>j.length>0),or(w,k),wt(([j,L,O])=>{const I=j.reduce((B,z,ee)=>La(B,z,Kc(z,L.offsetTree,O)||ee),wl());return{...L,groupIndices:j,groupOffsetTree:I}})),w),Ot(tt(a,or(w),Gt(([j,{lastIndex:L}])=>j<L),wt(([j,{lastIndex:L,lastSize:O}])=>[{endIndex:L,size:O,startIndex:j}])),r),Ot(f,g);const E=Gn(tt(f,wt(j=>j===void 0)),!0);Ot(tt(g,Gt(j=>j!==void 0&&Pr(Kr(w).sizeTree)),wt(j=>{const L=Kr(h),O=Kr(d).length>0;return L!==void 0&&L!==0?O?[{endIndex:0,size:L,startIndex:0},{endIndex:1,size:j,startIndex:1}]:[]:[{endIndex:0,size:j,startIndex:0}]})),r),Ot(tt(m,Gt(j=>j!==void 0&&j.length>0&&Pr(Kr(w).sizeTree)),wt(j=>{const L=[];let O=j[0],I=0;for(let B=1;B<j.length;B++){const z=j[B];z!==O&&(L.push({endIndex:B-1,size:O,startIndex:I}),O=z,I=B)}return L.push({endIndex:j.length-1,size:O,startIndex:I}),L})),r),Ot(tt(d,or(h,g),Gt(([,j,L])=>j!==void 0&&L!==void 0),wt(([j,L,O])=>{const I=[];for(let B=0;B<j.length;B++){const z=j[B],ee=j[B+1];I.push({startIndex:z,endIndex:z,size:L}),ee!==void 0&&I.push({startIndex:z+1,endIndex:ee-1,size:O})}return I})),r);const A=Da(tt(r,or(w),Wi(({sizes:j},[L,O])=>({changed:O!==j,sizes:O}),{changed:!1,sizes:_}),wt(j=>j.changed)));Ir(tt(u,Wi((j,L)=>({diff:j.prev-L,prev:L}),{diff:0,prev:0}),wt(j=>j.diff)),j=>{const{groupIndices:L}=Kr(w);if(j>0)rr(t,!0),rr(o,j+O_(j,L));else if(j<0){const O=Kr(S);O.length>0&&(j-=O_(-j,O)),rr(l,j)}}),Ir(tt(u,or(e)),([j,L])=>{j<0&&L("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:u},Sn.ERROR)});const T=Da(o);Ot(tt(o,or(w),wt(([j,L])=>{const O=L.groupIndices.length>0,I=[],B=L.lastSize;if(O){const z=Vc(L.sizeTree,0);let ee=0,$=0;for(;ee<j;){const G=L.groupIndices[$],Y=L.groupIndices.length===$+1?1/0:L.groupIndices[$+1]-G-1;I.push({endIndex:G,size:z,startIndex:G}),I.push({endIndex:G+1+Y-1,size:B,startIndex:G+1}),$++,ee+=Y+1}const M=_o(L.sizeTree);return ee!==j&&M.shift(),M.reduce((G,{k:Y,v:X})=>{let ie=G.ranges;return G.prevSize!==0&&(ie=[...G.ranges,{endIndex:Y+j-1,size:G.prevSize,startIndex:G.prevIndex}]),{prevIndex:Y+j,prevSize:X,ranges:ie}},{prevIndex:j,prevSize:0,ranges:I}).ranges}return _o(L.sizeTree).reduce((z,{k:ee,v:$})=>({prevIndex:ee+j,prevSize:$,ranges:[...z.ranges,{endIndex:ee+j-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:B,ranges:[]}).ranges})),r);const C=Da(tt(l,or(w,k),wt(([j,{offsetTree:L},O])=>{const I=-j;return Kc(I,L,O)})));return Ot(tt(l,or(w,k),wt(([j,L,O])=>{if(L.groupIndices.length>0){if(Pr(L.sizeTree))return L;let B=wl();const z=Kr(S);let ee=0,$=0,M=0;for(;ee<-j;){M=z[$];const G=z[$+1]-M-1;$++,ee+=G+1}if(B=_o(L.sizeTree).reduce((G,{k:Y,v:X})=>La(G,Math.max(0,Y+j),X),B),ee!==-j){const G=Vc(L.sizeTree,M);B=La(B,0,G);const Y=wi(L.sizeTree,-j+1)[1];B=La(B,1,Y)}return{...L,sizeTree:B,...$b(L.offsetTree,0,B,O)}}const I=_o(L.sizeTree).reduce((B,{k:z,v:ee})=>La(B,Math.max(0,z+j),ee),wl());return{...L,sizeTree:I,...$b(L.offsetTree,0,I,O)}})),w),{beforeUnshiftWith:T,data:v,defaultItemSize:g,firstItemIndex:u,fixedItemSize:f,fixedGroupSize:h,gap:k,groupIndices:d,heightEstimates:m,itemSize:y,listRefresh:A,shiftWith:l,shiftWithOffset:C,sizeRanges:r,sizes:w,statefulTotalCount:i,totalCount:a,trackItemSizes:E,unshiftWith:o}},Xr(Hs,Nv),{singleton:!0});function NM(e){return e.reduce((t,r)=>(t.groupIndices.push(t.totalCount),t.totalCount+=r+1,t),{groupIndices:[],totalCount:0})}const o5=Ar(([{groupIndices:e,sizes:t,totalCount:r},{headerHeight:a,scrollTop:i}])=>{const o=xr(),l=xr(),u=Da(tt(o,wt(NM)));return Ot(tt(u,wt(d=>d.totalCount)),r),Ot(tt(u,wt(d=>d.groupIndices)),e),Ot(tt(un(i,t,a),Gt(([d,f])=>Ef(f)),wt(([d,f,g])=>wi(f.groupOffsetTree,Math.max(d-g,0),"v")[0]),Yr(),wt(d=>[d])),l),{groupCounts:o,topItemsIndexes:l}},Xr(Vi,la)),$s=Ar(([{log:e}])=>{const t=dt(!1),r=Da(tt(t,Gt(a=>a),Yr()));return Ir(t,a=>{a&&Kr(e)("props updated",{},Sn.DEBUG)}),{didMount:r,propsReady:t}},Xr(Hs),{singleton:!0}),SM=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function l5(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!SM)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const nu=Ar(([{gap:e,listRefresh:t,sizes:r,totalCount:a},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:l,headerHeight:u,scrollingInProgress:d,scrollTo:f,smoothScrollTargetReached:g,viewportHeight:h},{log:m}])=>{const y=xr(),v=xr(),k=dt(0);let _=null,w=null,S=null;function E(){_!==null&&(_(),_=null),S!==null&&(S(),S=null),w&&(clearTimeout(w),w=null),rr(d,!1)}return Ot(tt(y,or(r,h,a,k,u,l,m),or(e,o,i),wt(([[A,T,C,j,L,O,I,B],z,ee,$])=>{const M=l5(A),{align:G,behavior:Y,offset:X}=M,ie=j-1,F=s5(M,T,ie);let U=Kc(F,T.offsetTree,z)+O;G==="end"?(U+=ee+wi(T.sizeTree,F)[1]-C+$,F===ie&&(U+=I)):G==="center"?U+=(ee+wi(T.sizeTree,F)[1]-C+$)/2:U-=L,X!==void 0&&X!==0&&(U+=X);const Z=P=>{E(),P?(B("retrying to scroll to",{location:A},Sn.DEBUG),rr(y,A)):(rr(v,!0),B("list did not change, scroll successful",{},Sn.DEBUG))};if(E(),Y==="smooth"){let P=!1;S=Ir(t,K=>{P=P||K}),_=ki(g,()=>{Z(P)})}else _=ki(tt(t,EM(150)),Z);return w=setTimeout(()=>{E()},1200),rr(d,!0),B("scrolling from index to",{behavior:Y,index:F,top:U},Sn.DEBUG),{behavior:Y,top:U}})),f),{scrollTargetReached:v,scrollToIndex:y,topListHeight:k}},Xr(Vi,la,Hs),{singleton:!0});function EM(e){return t=>{const r=setTimeout(()=>{t(!1)},e);return a=>{a&&(t(!0),clearTimeout(r))}}}function Ev(e,t){e===0?t():requestAnimationFrame(()=>{Ev(e-1,t)})}function jv(e,t){if(e===void 0)return 0;const r=t-1,a=typeof e=="number"?e:e.index==="LAST"?r:e.index;return Math.max(0,Math.min(a,r))}function Wb(e){return e===void 0?!0:typeof e=="number"?e===0:e.index===0&&(e.align===void 0||e.align==="start")&&(e.offset===void 0||e.offset===0)}const au=Ar(([{defaultItemSize:e,listRefresh:t,sizes:r},{scrollTop:a},{scrollTargetReached:i,scrollToIndex:o},{didMount:l}])=>{const u=dt(!0),d=dt(0),f=dt(!0);return Ot(tt(l,or(d),Gt(([g,h])=>!Wb(h)),$i(!1)),u),Ot(tt(l,or(d),Gt(([g,h])=>!Wb(h)),$i(!1)),f),Ir(tt(un(t,l),or(u,r,e,f),Gt(([[,g],h,{sizeTree:m},y,v])=>g&&(!Pr(m)||vv(y))&&!h&&!v),or(d)),([,g])=>{if(g===void 0){rr(u,!0),rr(f,!0);return}ki(i,()=>{rr(f,!0)}),Ev(4,()=>{ki(a,()=>{rr(u,!0)}),rr(o,g)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:d,scrolledToInitialItem:u}},Xr(Vi,la,nu,$s),{singleton:!0});function c5(e,t){return Math.abs(e-t)<1.01}const Yc="up",Pc="down",jM="none",CM={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},TM=0,iu=Ar(([{footerHeight:e,headerHeight:t,scrollBy:r,scrollContainerState:a,scrollTop:i,viewportHeight:o}])=>{const l=dt(!1),u=dt(!0),d=xr(),f=xr(),g=dt(4),h=dt(TM),m=Gn(tt(zb(tt(Vt(i),So(1),$i(!0)),tt(Vt(i),So(1),$i(!1),A_(100))),Yr()),!1),y=Gn(tt(zb(tt(r,$i(!0)),tt(r,$i(!1),A_(200))),Yr()),!1);Ot(tt(un(Vt(i),Vt(h)),wt(([S,E])=>S<=E),Yr()),u),Ot(tt(u,us(50)),f);const v=Da(tt(un(a,Vt(o),Vt(t),Vt(e),Vt(g)),Wi((S,[{scrollHeight:E,scrollTop:A},T,C,j,L])=>{const O=A+T-E>-L,I={scrollHeight:E,scrollTop:A,viewportHeight:T};if(O){let z,ee;return A>S.state.scrollTop?(z="SCROLLED_DOWN",ee=S.state.scrollTop-A):(z="SIZE_DECREASED",ee=S.state.scrollTop-A||S.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:ee,state:I}}let B;return I.scrollHeight>S.state.scrollHeight?B="SIZE_INCREASED":T<S.state.viewportHeight?B="VIEWPORT_HEIGHT_DECREASING":A<S.state.scrollTop?B="SCROLLING_UPWARDS":B="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:B,state:I}},CM),Yr((S,E)=>S!==void 0&&S.atBottom===E.atBottom))),k=Gn(tt(a,Wi((S,{scrollHeight:E,scrollTop:A,viewportHeight:T})=>{if(!c5(S.scrollHeight,E)){const C=E-(A+T)<1;return S.scrollTop!==A&&C?{changed:!0,jump:S.scrollTop-A,scrollHeight:E,scrollTop:A}:{changed:!0,jump:0,scrollHeight:E,scrollTop:A}}return{changed:!1,jump:0,scrollHeight:E,scrollTop:A}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Gt(S=>S.changed),wt(S=>S.jump)),0);Ot(tt(v,wt(S=>S.atBottom)),l),Ot(tt(l,us(50)),d);const _=dt(Pc);Ot(tt(a,wt(({scrollTop:S})=>S),Yr(),Wi((S,E)=>Kr(y)?{direction:S.direction,prevScrollTop:E}:{direction:E<S.prevScrollTop?Yc:Pc,prevScrollTop:E},{direction:Pc,prevScrollTop:0}),wt(S=>S.direction)),_),Ot(tt(a,us(50),$i(jM)),_);const w=dt(0);return Ot(tt(m,Gt(S=>!S),$i(0)),w),Ot(tt(i,us(100),or(m),Gt(([S,E])=>E),Wi(([S,E],[A])=>[E,A],[0,0]),wt(([S,E])=>E-S)),w),{atBottomState:v,atBottomStateChange:d,atBottomThreshold:g,atTopStateChange:f,atTopThreshold:h,isAtBottom:l,isAtTop:u,isScrolling:m,lastJumpDueToItemResize:k,scrollDirection:_,scrollVelocity:w}},Xr(la)),Xc="top",Qc="bottom",D_="none";function P_(e,t,r){return typeof e=="number"?r===Yc&&t===Xc||r===Pc&&t===Qc?e:0:r===Yc?t===Xc?e.main:e.reverse:t===Qc?e.main:e.reverse}function F_(e,t){return typeof e=="number"?e:e[t]??0}const Cv=Ar(([{deviation:e,fixedHeaderHeight:t,headerHeight:r,scrollTop:a,viewportHeight:i}])=>{const o=xr(),l=dt(0),u=dt(0),d=dt(0),f=Gn(tt(un(Vt(a),Vt(i),Vt(r),Vt(o,Gc),Vt(d),Vt(l),Vt(t),Vt(e),Vt(u)),wt(([g,h,m,[y,v],k,_,w,S,E])=>{const A=g-S,T=_+w,C=Math.max(m-A,0);let j=D_;const L=F_(E,Xc),O=F_(E,Qc);return y-=S,y+=m+w,v+=m+w,v-=S,y>g+T-L&&(j=Yc),v<g-C+h+O&&(j=Pc),j!==D_?[Math.max(A-m-P_(k,Xc,j)-L,0),A-C-w+h+P_(k,Qc,j)+O]:null}),Gt(g=>g!==null),Yr(Gc)),[0,0]);return{increaseViewportBy:u,listBoundary:o,overscan:d,topListHeight:l,visibleRange:f}},Xr(la),{singleton:!0});function RM(e,t,r){if(Ef(t)){const a=i5(e,t);return[{index:wi(t.groupOffsetTree,a)[0],offset:0,size:0},{data:r==null?void 0:r[0],index:a,offset:0,size:0}]}return[{data:r==null?void 0:r[0],index:e,offset:0,size:0}]}const _p={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Jd(e,t,r,a,i,o){const{lastIndex:l,lastOffset:u,lastSize:d}=i;let f=0,g=0;if(e.length>0){f=e[0].offset;const k=e[e.length-1];g=k.offset+k.size}const h=r-l,m=u+h*d+(h-1)*a,y=f,v=m-g;return{bottom:g,firstItemIndex:o,items:B_(e,i,o),offsetBottom:v,offsetTop:f,top:y,topItems:B_(t,i,o),topListHeight:t.reduce((k,_)=>_.size+k,0),totalCount:r}}function u5(e,t,r,a,i,o){let l=0;if(r.groupIndices.length>0)for(const g of r.groupIndices){if(g-l>=e)break;l++}const u=e+l,d=jv(t,u),f=Array.from({length:u}).map((g,h)=>({data:o[h+d],index:h+d,offset:0,size:0}));return Jd(f,[],u,i,r,a)}function B_(e,t,r){if(e.length===0)return[];if(!Ef(t))return e.map(f=>({...f,index:f.index+r,originalIndex:f.index}));const a=e[0].index,i=e[e.length-1].index,o=[],l=Nl(t.groupOffsetTree,a,i);let u,d=0;for(const f of e){(!u||u.end<f.index)&&(u=l.shift(),d=t.groupIndices.indexOf(u.start));let g;f.index===u.start?g={index:d,type:"group"}:g={groupIndex:d,index:f.index-(d+1)+r},o.push({...g,data:f.data,offset:f.offset,originalIndex:f.index,size:f.size})}return o}function z_(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const To=Ar(([{data:e,firstItemIndex:t,gap:r,sizes:a,totalCount:i},o,{listBoundary:l,topListHeight:u,visibleRange:d},{initialTopMostItemIndex:f,scrolledToInitialItem:g},{topListHeight:h},m,{didMount:y},{recalcInProgress:v}])=>{const k=dt([]),_=dt(0),w=xr(),S=dt(0);Ot(o.topItemsIndexes,k);const E=Gn(tt(un(y,v,Vt(d,Gc),Vt(i),Vt(a),Vt(f),g,Vt(k),Vt(t),Vt(r),Vt(S),e),Gt(([j,L,,O,,,,,,,,I])=>{const B=I!==void 0&&I.length!==O;return j&&!L&&!B}),wt(([,,[j,L],O,I,B,z,ee,$,M,G,Y])=>{var he,Ne;const X=I,{offsetTree:ie,sizeTree:F}=X,U=Kr(_);if(O===0)return{..._p,totalCount:O};if(j===0&&L===0)return U===0?{..._p,totalCount:O}:u5(U,B,I,$,M,Y||[]);if(Pr(F))return U>0?null:Jd(RM(jv(B,O),X,Y),[],O,M,X,$);const Z=[];if(ee.length>0){const De=ee[0],Ve=ee[ee.length-1];let at=0;for(const lt of Nl(F,De,Ve)){const Ce=lt.value,$e=Math.max(lt.start,De),Be=Math.min(lt.end,Ve);for(let gt=$e;gt<=Be;gt++)Z.push({data:Y==null?void 0:Y[gt],index:gt,offset:at,size:Ce}),at+=Ce}}if(!z)return Jd([],Z,O,M,X,$);const P=ee.length>0?ee[ee.length-1]+1:0,K=yM(ie,j,L,P);if(K.length===0)return null;const V=O-1,W=Sf([],De=>{for(const Ve of K){const at=Ve.value;let lt=at.offset,Ce=Ve.start;const $e=at.size;if(at.offset<j){Ce+=Math.floor((j-at.offset+M)/($e+M));const gt=Ce-Ve.start;lt+=gt*$e+gt*M}Ce<P&&(lt+=(P-Ce)*$e,Ce=P);const Be=Math.min(Ve.end,V);for(let gt=Ce;gt<=Be&&!(lt>=L);gt++)De.push({data:Y==null?void 0:Y[gt],index:gt,offset:lt,size:$e}),lt+=$e+M}}),ae=z_(G,Xc),Q=z_(G,Qc);if(W.length>0&&(ae>0||Q>0)){const De=W[0],Ve=W[W.length-1];if(ae>0&&De.index>P){const at=Math.min(ae,De.index-P),lt=[];let Ce=De.offset;for(let $e=De.index-1;$e>=De.index-at;$e--){const Be=((he=Nl(F,$e,$e)[0])==null?void 0:he.value)??De.size;Ce-=Be+M,lt.unshift({data:Y==null?void 0:Y[$e],index:$e,offset:Ce,size:Be})}W.unshift(...lt)}if(Q>0&&Ve.index<V){const at=Math.min(Q,V-Ve.index);let lt=Ve.offset+Ve.size+M;for(let Ce=Ve.index+1;Ce<=Ve.index+at;Ce++){const $e=((Ne=Nl(F,Ce,Ce)[0])==null?void 0:Ne.value)??Ve.size;W.push({data:Y==null?void 0:Y[Ce],index:Ce,offset:lt,size:$e}),lt+=$e+M}}}return Jd(W,Z,O,M,X,$)}),Gt(j=>j!==null),Yr()),_p);Ot(tt(e,Gt(vv),wt(j=>j==null?void 0:j.length)),i),Ot(tt(E,wt(j=>j.topListHeight)),h),Ot(h,u),Ot(tt(E,wt(j=>[j.top,j.bottom])),l),Ot(tt(E,wt(j=>j.items)),w);const A=Da(tt(E,Gt(({items:j})=>j.length>0),or(i,e),Gt(([{items:j},L])=>j[j.length-1].originalIndex===L-1),wt(([,j,L])=>[j-1,L]),Yr(Gc),wt(([j])=>j))),T=Da(tt(E,us(200),Gt(({items:j,topItems:L})=>j.length>0&&j[0].originalIndex===L.length),wt(({items:j})=>j[0].index),Yr())),C=Da(tt(E,Gt(({items:j})=>j.length>0),wt(({items:j})=>{let L=0,O=j.length-1;for(;j[L].type==="group"&&L<O;)L++;for(;j[O].type==="group"&&O>L;)O--;return{endIndex:j[O].index,startIndex:j[L].index}}),Yr(n5)));return{endReached:A,initialItemCount:_,itemsRendered:w,listState:E,minOverscanItemCount:S,rangeChanged:C,startReached:T,topItemsIndexes:k,...m}},Xr(Vi,o5,Cv,au,nu,iu,$s,Nv),{singleton:!0}),d5=Ar(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:r,headerHeight:a},{listState:i}])=>{const o=xr(),l=Gn(tt(un(r,e,a,t,i),wt(([u,d,f,g,h])=>u+d+f+g+h.offsetBottom+h.bottom)),0);return Ot(Vt(l),o),{totalListHeight:l,totalListHeightChanged:o}},Xr(la,To),{singleton:!0}),AM=Ar(([{viewportHeight:e},{totalListHeight:t}])=>{const r=dt(!1),a=Gn(tt(un(r,e,t),Gt(([i])=>i),wt(([,i,o])=>Math.max(0,i-o)),us(0),Yr()),0);return{alignToBottom:r,paddingTopAddition:a}},Xr(la,d5),{singleton:!0}),f5=Ar(()=>({context:dt(null)})),IM=({itemBottom:e,itemTop:t,locationParams:{align:r,behavior:a,...i},viewportBottom:o,viewportTop:l})=>t<l?{...i,align:r??"start",...a===void 0?{}:{behavior:a}}:e>o?{...i,align:r??"end",...a===void 0?{}:{behavior:a}}:null,g5=Ar(([{gap:e,sizes:t,totalCount:r},{fixedFooterHeight:a,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:l,scrollTop:u,viewportHeight:d},{scrollToIndex:f}])=>{const g=xr();return Ot(tt(g,or(t,d,r,o,i,a,u),or(e),wt(([[h,m,y,v,k,_,w,S],E])=>{const{calculateViewLocation:A=IM,done:T,...C}=h,j=s5(h,m,v-1),L=Kc(j,m.offsetTree,E)+k+_,O=L+wi(m.sizeTree,j)[1],I=S+_,B=S+y-w,z=A({itemBottom:O,itemTop:L,locationParams:C,viewportBottom:B,viewportTop:I});return z===null?T==null||T():T&&ki(tt(l,Gt(ee=>!ee),So(Kr(l)?1:2)),T),z}),Gt(h=>h!==null)),f),{scrollIntoView:g}},Xr(Vi,la,nu,To,Hs),{singleton:!0});function U_(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const MM=(e,t)=>typeof e=="function"?U_(e(t)):t&&U_(e),LM=Ar(([{listRefresh:e,totalCount:t,fixedItemSize:r,data:a},{atBottomState:i,isAtBottom:o},{scrollToIndex:l},{scrolledToInitialItem:u},{didMount:d,propsReady:f},{log:g},{scrollingInProgress:h},{context:m},{scrollIntoView:y}])=>{const v=dt(!1),k=xr();let _=null;function w(T){rr(l,{align:"end",behavior:T,index:"LAST"})}Ir(tt(un(tt(Vt(t),So(1)),d),or(Vt(v),o,u,h),wt(([[T,C],j,L,O,I])=>{let B=C&&O,z="auto";return B&&(z=MM(j,L||I),B=B&&z!==!1),{followOutputBehavior:z,shouldFollow:B,totalCount:T}}),Gt(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:C})=>{_!==null&&(_(),_=null),Kr(r)===void 0?_=ki(e,()=>{Kr(g)("following output to ",{totalCount:C},Sn.DEBUG),w(T),_=null}):requestAnimationFrame(()=>{Kr(g)("following output to ",{totalCount:C},Sn.DEBUG),w(T)})});function S(T){const C=ki(i,j=>{T&&!j.atBottom&&j.notAtBottomBecause==="SIZE_INCREASED"&&_===null&&(Kr(g)("scrolling to bottom due to increased size",{},Sn.DEBUG),w("auto"))});setTimeout(C,100)}Ir(tt(un(Vt(v),t,f),Gt(([T,,C])=>T!==!1&&C),Wi(({value:T},[,C])=>({refreshed:T===C,value:C}),{refreshed:!1,value:0}),Gt(({refreshed:T})=>T),or(v,t)),([,T])=>{Kr(u)&&S(T!==!1)}),Ir(k,()=>{S(Kr(v)!==!1)}),Ir(un(Vt(v),i),([T,C])=>{T!==!1&&!C.atBottom&&C.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&w("auto")});const E=dt(null),A=xr();return Ot(zb(tt(Vt(a),wt(T=>(T==null?void 0:T.length)??0)),tt(Vt(t))),A),Ir(tt(un(tt(A,So(1)),d),or(Vt(E),u,h,m),wt(([[T,C],j,L,O,I])=>C&&L&&(j==null?void 0:j({context:I,totalCount:T,scrollingInProgress:O}))),Gt(T=>!!T),us(0)),T=>{_!==null&&(_(),_=null),Kr(r)===void 0?_=ki(e,()=>{Kr(g)("scrolling into view",{}),rr(y,T),_=null}):requestAnimationFrame(()=>{Kr(g)("scrolling into view",{}),rr(y,T)})}),{autoscrollToBottom:k,followOutput:v,scrollIntoViewOnChange:E}},Xr(Vi,iu,nu,au,$s,Hs,la,f5,g5)),OM=Ar(([{data:e,firstItemIndex:t,gap:r,sizes:a},{initialTopMostItemIndex:i},{initialItemCount:o,listState:l},{didMount:u}])=>(Ot(tt(u,or(o),Gt(([,d])=>d!==0),or(i,a,t,r,e),wt(([[,d],f,g,h,m,y=[]])=>u5(d,f,g,h,m,y))),l),{}),Xr(Vi,au,To,$s),{singleton:!0}),DM=Ar(([{didMount:e},{scrollTo:t},{listState:r}])=>{const a=dt(0);return Ir(tt(e,or(a),Gt(([,i])=>i!==0),wt(([,i])=>({top:i}))),i=>{ki(tt(r,So(1),Gt(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{rr(t,i)})})}),{initialScrollTop:a}},Xr($s,la,To),{singleton:!0}),p5=Ar(([{scrollVelocity:e}])=>{const t=dt(!1),r=xr(),a=dt(!1);return Ot(tt(e,or(a,t,r),Gt(([i,o])=>o!==!1&&o!==void 0),wt(([i,o,l,u])=>{const{enter:d,exit:f}=o;if(l){if(f(i,u))return!1}else if(d(i,u))return!0;return l}),Yr()),t),Ir(tt(un(t,e,r),or(a)),([[i,o,l],u])=>{i&&u!==!1&&u!==void 0&&u.change&&u.change(o,l)}),{isSeeking:t,scrollSeekConfiguration:a,scrollSeekRangeChanged:r,scrollVelocity:e}},Xr(iu),{singleton:!0}),Tv=Ar(([{scrollContainerState:e,scrollTo:t}])=>{const r=xr(),a=xr(),i=xr(),o=dt(!1),l=dt(void 0);return Ot(tt(un(r,a),wt(([{scrollTop:u,viewportHeight:d},{offsetTop:f,listHeight:g}])=>({scrollHeight:g,scrollTop:Math.max(0,u-f),viewportHeight:d}))),e),Ot(tt(t,or(a),wt(([u,{offsetTop:d}])=>({...u,top:u.top+d}))),i),{customScrollParent:l,useWindowScroll:o,windowScrollContainerState:r,windowScrollTo:i,windowViewportRect:a}},Xr(la)),PM=Ar(([{sizeRanges:e,sizes:t},{headerHeight:r,scrollTop:a},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:l,windowScrollContainerState:u,windowViewportRect:d}])=>{const f=xr(),g=dt(void 0),h=dt(null),m=dt(null);return Ot(u,h),Ot(d,m),Ir(tt(f,or(t,a,l,h,m,r)),([y,v,k,_,w,S,E])=>{const A=vM(v.sizeTree);_&&w!==null&&S!==null&&(k=w.scrollTop-S.offsetTop),k-=E,y({ranges:A,scrollTop:k})}),Ot(tt(g,Gt(vv),wt(FM)),i),Ot(tt(o,or(g),Gt(([,y])=>y!==void 0),Yr(),wt(([,y])=>y.ranges)),e),{getState:f,restoreStateFrom:g}},Xr(Vi,la,au,$s,Tv));function FM(e){return{align:"start",index:0,offset:e.scrollTop}}const BM=Ar(([{topItemsIndexes:e}])=>{const t=dt(0);return Ot(tt(t,Gt(r=>r>=0),wt(r=>Array.from({length:r}).map((a,i)=>i))),e),{topItemCount:t}},Xr(To));function h5(e){let t=!1,r;return(()=>(t||(t=!0,r=e()),r))}const zM=h5(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),UM=Ar(([{deviation:e,deviationCommitted:t,scrollBy:r,scrollingInProgress:a,scrollTop:i},{isAtBottom:o,isScrolling:l,lastJumpDueToItemResize:u,scrollDirection:d},{listState:f},{beforeUnshiftWith:g,gap:h,shiftWithOffset:m,sizes:y},{log:v},{recalcInProgress:k}])=>{const _=Da(tt(f,or(u),Wi(([,A,T,C],[{bottom:j,items:L,offsetBottom:O,totalCount:I},B])=>{const z=j+O;let ee=0;return T===I&&A.length>0&&L.length>0&&(L[0].originalIndex===0&&A[0].originalIndex===0||(ee=z-C,ee!==0&&(ee+=B))),[ee,L,I,z]},[0,[],0,0]),Gt(([A])=>A!==0),or(i,d,a,o,v,k),Gt(([,A,T,C,,,j])=>!j&&!C&&A!==0&&T===Yc),wt(([[A],,,,,T])=>(T("Upward scrolling compensation",{amount:A},Sn.DEBUG),A))));function w(A){A>0?(rr(r,{behavior:"auto",top:-A}),rr(e,0)):(rr(e,0),rr(r,{behavior:"auto",top:-A}))}Ir(tt(_,or(e,l)),([A,T,C])=>{C&&zM()?rr(e,T-A):w(-A)}),Ir(tt(un(Gn(l,!1),e,k),Gt(([A,T,C])=>!A&&!C&&T!==0),wt(([A,T])=>T),us(1)),w),Ot(tt(m,wt(A=>({top:-A}))),r);let S=null;function E(){if(S===null)return;const{offset:A}=S;S=null,rr(r,{top:A}),requestAnimationFrame(()=>{rr(e,0),rr(k,!1)})}return Ir(t,A=>{S===null||!S.acknowledgeable||A===S.offset&&E()}),Ir(tt(g,or(y,h),wt(([A,{groupIndices:T,lastSize:C,sizeTree:j},L])=>{function O($){return $*(C+L)}if(T.length===0)return O(A);let I=0;const B=Vc(j,0);let z=0,ee=0;for(;z<A;){z++,I+=B;let $=T.length===ee+1?1/0:T[ee+1]-T[ee]-1;z+$>A&&(I-=B,$=A-z+1),z+=$,I+=O($),ee++}return I})),A=>{S={acknowledgeable:Kr(e)!==A,offset:A},rr(e,A),requestAnimationFrame(E)}),{deviation:e}},Xr(la,iu,To,Vi,Hs,Nv)),qM=Ar(([e,t,r,a,i,o,l,u,d,f,g])=>({...e,...t,...r,...a,...i,...o,...l,...u,...d,...f,...g}),Xr(Cv,OM,$s,p5,d5,DM,AM,Tv,g5,Hs,f5)),m5=Ar(([{data:e,defaultItemSize:t,firstItemIndex:r,fixedItemSize:a,fixedGroupSize:i,gap:o,groupIndices:l,heightEstimates:u,itemSize:d,sizeRanges:f,sizes:g,statefulTotalCount:h,totalCount:m,trackItemSizes:y},{initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_},w,S,E,A,{scrollToIndex:T},C,{topItemCount:j},{groupCounts:L},O])=>{const{listState:I,minOverscanItemCount:B,topItemsIndexes:z,rangeChanged:ee,...$}=A;return Ot(ee,O.scrollSeekRangeChanged),Ot(tt(un(O.windowViewportRect,w.headerHeight,w.fixedHeaderHeight),wt(([M,G,Y])=>Math.max(G+Y+1,M.visibleHeight))),w.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:r,fixedItemHeight:a,fixedGroupHeight:i,gap:o,groupCounts:L,heightEstimates:u,initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_,sizeRanges:f,topItemCount:j,topItemsIndexes:z,totalCount:m,...E,groupIndices:l,itemSize:d,listState:I,minOverscanItemCount:B,scrollToIndex:T,statefulTotalCount:h,trackItemSizes:y,rangeChanged:ee,...$,...O,...w,sizes:g,...S}},Xr(Vi,au,la,PM,LM,To,nu,UM,BM,o5,qM));function HM(e,t){const r={},a={};let i=0;const o=e.length;for(;i<o;)a[e[i]]=1,i+=1;for(const l in t)Object.hasOwn(a,l)||(r[l]=t[l]);return r}const Td=typeof document>"u"?Mt.useEffect:Mt.useLayoutEffect;function x5(e,t,r){const a=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),u=Mt.createContext({});function d(_,w){_.propsReady!==void 0&&rr(_.propsReady,!1);for(const S of a){const E=_[t.required[S]];rr(E,w[S])}for(const S of i)if(S in w){const E=_[t.optional[S]];rr(E,w[S])}_.propsReady!==void 0&&rr(_.propsReady,!0)}function f(_){return o.reduce((w,S)=>(w[S]=E=>{const A=_[t.methods[S]];rr(A,E)},w),{})}function g(_){return l.reduce((w,S)=>(w[S]=nM(_[t.events[S]]),w),{})}const h=Mt.forwardRef(function(_,w){const{children:S,...E}=_,[A]=Mt.useState(()=>Sf(sM(e),j=>{d(j,E)})),[T]=Mt.useState(R_(g,A));Td(()=>{for(const j of l)j in E&&Ir(T[j],E[j]);return()=>{Object.values(T).map(kv)}},[E,T,A]),Td(()=>{d(A,E)}),Mt.useImperativeHandle(w,T_(f(A)));const C=r;return n.jsx(u.Provider,{value:A,children:r===void 0?S:n.jsx(C,{...HM([...a,...i,...l],E),children:S})})}),m=_=>{const w=Mt.useContext(u);return Mt.useCallback(S=>{rr(w[_],S)},[w,_])},y=_=>{const w=Mt.useContext(u)[_],S=Mt.useCallback(E=>Ir(w,E),[w]);return Mt.useSyncExternalStore(S,()=>Kr(w),()=>Kr(w))},v=_=>{const w=Mt.useContext(u)[_],[S,E]=Mt.useState(R_(Kr,w));return Td(()=>Ir(w,A=>{A!==S&&E(T_(A))}),[w,S]),S},k=parseInt(Mt.version,10)>=18?y:v;return{Component:h,useEmitter:(_,w)=>{const S=Mt.useContext(u)[_];Td(()=>Ir(S,w),[w,S])},useEmitterValue:k,usePublisher:m}}const y5=Mt.createContext(void 0),b5=Mt.createContext(void 0),wp="-webkit-sticky",q_="sticky",Rv=h5(()=>{if(typeof document>"u")return q_;const e=document.createElement("div");return e.style.position=wp,e.style.position===wp?wp:q_});function Np(e){return"self"in e}function $M(e){return"body"in e}function v5(e,t,r,a=Al,i,o){const l=Mt.useRef(null),u=Mt.useRef(null),d=Mt.useRef(null),f=Mt.useCallback(h=>{let m,y,v;const k=h.target;if($M(k)||Np(k)){const w=Np(k)?k:k.defaultView;v=o===!0?ko(w,w.scrollX):w.scrollY,m=o===!0?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight,y=o===!0?w.innerWidth:w.innerHeight}else v=o===!0?ko(k,k.scrollLeft):k.scrollTop,m=o===!0?k.scrollWidth:k.scrollHeight,y=o===!0?k.offsetWidth:k.offsetHeight;const _=()=>{e({scrollHeight:m,scrollTop:Math.max(v,0),viewportHeight:y})};h.suppressFlushSync===!0?_():jI.flushSync(_),u.current!==null&&(v===u.current||v<=0||v===m-y)&&(u.current=null,t(!0),d.current&&(clearTimeout(d.current),d.current=null))},[e,t,o]);Mt.useEffect(()=>{const h=i??l.current;return a(i??l.current),f({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",f,{passive:!0}),()=>{a(null),h.removeEventListener("scroll",f)}},[l,f,r,a,i]);function g(h){const m=l.current;if(!m||(o===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const y=h.behavior==="smooth";let v,k,_;Np(m)?(k=Math.max(Us(m.document.documentElement,o===!0?"width":"height"),o===!0?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),v=o===!0?m.innerWidth:m.innerHeight,_=o===!0?ko(m,m.scrollX):m.scrollY):(k=m[o===!0?"scrollWidth":"scrollHeight"],v=Us(m,o===!0?"width":"height"),_=o===!0?ko(m,m.scrollLeft):m.scrollTop);const w=k-v;if(h.top===void 0){m.scrollTo(h);return}const S=Math.ceil(Math.max(Math.min(w,h.top),0));if(h.top=S,c5(v,k)||S===_){e({scrollHeight:k,scrollTop:_,viewportHeight:v}),y&&t(!0);return}y?(u.current=S,d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,u.current=null,t(!0)},1e3)):u.current=null,o===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},left:I_(m,S)}),m.scrollTo(h)}return{scrollByCallback:Mt.useCallback(h=>{o===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},...h.top===void 0?{}:{left:I_(l.current,h.top)}}),l.current.scrollBy(h)},[o]),scrollerRef:l,scrollToCallback:g}}function Av(e){return e}const WM=Ar(()=>{const e=dt(u=>`Item ${u}`),t=dt(u=>`Group ${u}`),r=dt({}),a=dt(Av),i=dt("div"),o=dt(Al),l=(u,d=null)=>Gn(tt(r,wt(f=>f[u]),Yr()),d);return{components:r,computeItemKey:a,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:i,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),VM=Ar(([e,t])=>({...e,...t}),Xr(m5,WM)),GM=({height:e})=>n.jsx("div",{style:{height:e}}),KM={overflowAnchor:"none",position:Rv(),zIndex:1},k5={overflowAnchor:"none"},YM={...k5,display:"inline-block",height:"100%"},H_=Mt.memo(function({showTopList:e=!1}){const t=Yt("listState"),r=Oa("sizeRanges"),a=Yt("useWindowScroll"),i=Yt("customScrollParent"),o=Oa("windowScrollContainerState"),l=Oa("scrollContainerState"),u=i||a?o:l,d=Yt("itemContent"),f=Yt("context"),g=Yt("groupContent"),h=Yt("trackItemSizes"),m=Yt("itemSize"),y=Yt("log"),v=Oa("gap"),k=Yt("horizontalDirection"),{callbackRef:_}=uM(r,m,h,e?Al:u,y,v,i,k,Yt("skipAnimationFrameInResizeObserver")),[w,S]=Mt.useState(0);Mv("deviation",M=>{w!==M&&S(M)});const E=Oa("deviationCommitted");wv(()=>{E(w)},[w,E]);const A=Yt("EmptyPlaceholder"),T=Yt("ScrollSeekPlaceholder")??GM,C=Yt("ListComponent"),j=Yt("ItemComponent"),L=Yt("GroupComponent"),O=Yt("computeItemKey"),I=Yt("isSeeking"),B=Yt("groupIndices").length>0,z=Yt("alignToBottom"),ee=Yt("initialItemFinalLocationReached"),$=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginInlineStart:w===0?z?"auto":0:w,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:w===0?z?"auto":0:w,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...ee?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&A!==null&&A!==void 0?n.jsx(A,{...Vn(A,f)}):n.jsx(C,{...Vn(C,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:_,style:$,children:(e?t.topItems:t.items).map(M=>{const G=M.originalIndex,Y=O(G+t.firstItemIndex,M.data,f);return I?x.createElement(T,{...Vn(T,f),height:M.size,index:M.index,key:Y,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?x.createElement(L,{...Vn(L,f),"data-index":G,"data-item-index":M.index,"data-known-size":M.size,key:Y,style:KM},g(M.index,f)):x.createElement(j,{...Vn(j,f),...JM(j,M.data),"data-index":G,"data-item-group-index":M.groupIndex,"data-item-index":M.index,"data-known-size":M.size,key:Y,style:k?YM:k5},B?d(M.index,M.groupIndex,M.data,f):d(M.index,M.data,f))})})}),XM={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},QM={outline:"none",overflowX:"auto",position:"relative"},Iv=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),_5=(e,t,r=0)=>({...Iv(e),position:t?"relative":"absolute",top:t?-r:0}),ZM={position:Rv(),top:0,width:"100%",zIndex:1};function Vn(e,t){if(typeof e!="string")return{context:t}}function JM(e,t){return{item:typeof e=="string"?void 0:t}}const eL=Mt.memo(function(){const e=Yt("HeaderComponent"),t=Oa("headerHeight"),r=Yt("HeaderFooterTag"),a=Co(Mt.useMemo(()=>o=>{t(Us(o,"height"))},[t]),!0,Yt("skipAnimationFrameInResizeObserver")),i=Yt("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Vn(e,i)})}):null}),tL=Mt.memo(function(){const e=Yt("FooterComponent"),t=Oa("footerHeight"),r=Yt("HeaderFooterTag"),a=Co(Mt.useMemo(()=>o=>{t(Us(o,"height"))},[t]),!0,Yt("skipAnimationFrameInResizeObserver")),i=Yt("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Vn(e,i)})}):null});function w5({useEmitter:e,useEmitterValue:t,usePublisher:r}){return Mt.memo(function({children:a,style:i,context:o,...l}){const u=r("scrollContainerState"),d=t("ScrollerComponent"),f=r("smoothScrollTargetReached"),g=t("scrollerRef"),h=t("horizontalDirection")||!1,{scrollByCallback:m,scrollerRef:y,scrollToCallback:v}=v5(u,f,d,g,void 0,h);return e("scrollTo",v),e("scrollBy",m),n.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:y,style:{...h?QM:XM,...i},tabIndex:0,...l,...Vn(d,o),children:a})})}function N5({useEmitter:e,useEmitterValue:t,usePublisher:r}){return Mt.memo(function({children:a,style:i,context:o,...l}){const u=r("windowScrollContainerState"),d=t("ScrollerComponent"),f=r("smoothScrollTargetReached"),g=t("totalListHeight"),h=t("deviation"),m=t("customScrollParent"),y=Mt.useRef(null),v=t("scrollerRef"),{scrollByCallback:k,scrollerRef:_,scrollToCallback:w}=v5(u,f,d,v,m);return wv(()=>{var S;return _.current=m??((S=y.current)==null?void 0:S.ownerDocument.defaultView),()=>{_.current=null}},[_,m]),e("windowScrollTo",w),e("scrollBy",k),n.jsx(d,{ref:y,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...g===0?void 0:{height:g+h}},...l,...Vn(d,o),children:a})})}const rL=({children:e})=>{const t=Mt.useContext(y5),r=Oa("viewportHeight"),a=Oa("fixedItemHeight"),i=Yt("alignToBottom"),o=Yt("horizontalDirection"),l=Mt.useMemo(()=>K4(r,d=>Us(d,o?"width":"height")),[r,o]),u=Co(l,!0,Yt("skipAnimationFrameInResizeObserver"));return Mt.useEffect(()=>{t&&(r(t.viewportHeight),a(t.itemHeight))},[t,r,a]),n.jsx("div",{"data-viewport-type":"element",ref:u,style:Iv(i),children:e})},nL=({children:e})=>{const t=Mt.useContext(y5),r=Oa("windowViewportRect"),a=Oa("fixedItemHeight"),i=Yt("customScrollParent"),o=Yt("useWindowScroll"),l=Yt("topListHeight"),u=Q4(r,i,Yt("skipAnimationFrameInResizeObserver")),d=Yt("alignToBottom");return Mt.useEffect(()=>{t&&(a(t.itemHeight),r({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,r,a]),n.jsx("div",{"data-viewport-type":"window",ref:u,style:_5(d,o,l),children:e})},aL=({children:e})=>{const t=Yt("TopItemListComponent")??"div",r=Yt("headerHeight"),a={...ZM,marginTop:`${r}px`},i=Yt("context");return n.jsx(t,{style:a,...Vn(t,i),children:e})},iL=Mt.memo(function(e){const t=Yt("useWindowScroll"),r=Yt("topItemsIndexes").length>0,a=Yt("customScrollParent"),i=Yt("context");return n.jsxs(a||t?lL:oL,{...e,context:i,children:[r&&n.jsx(aL,{children:n.jsx(H_,{showTopList:!0})}),n.jsxs(a||t?nL:rL,{children:[n.jsx(eL,{}),n.jsx(H_,{}),n.jsx(tL,{})]})]})}),{Component:sL,useEmitter:Mv,useEmitterValue:Yt,usePublisher:Oa}=x5(VM,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},iL),oL=w5({useEmitter:Mv,useEmitterValue:Yt,usePublisher:Oa}),lL=N5({useEmitter:Mv,useEmitterValue:Yt,usePublisher:Oa}),S5=sL,cL=Ar(()=>{const e=dt(f=>n.jsxs("td",{children:["Item $",f]})),t=dt(null),r=dt(f=>n.jsxs("td",{colSpan:1e3,children:["Group ",f]})),a=dt(null),i=dt(null),o=dt({}),l=dt(Av),u=dt(Al),d=(f,g=null)=>Gn(tt(o,wt(h=>h[f]),Yr()),g);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:d("EmptyPlaceholder"),FillerRow:d("FillerRow"),fixedFooterContent:i,fixedHeaderContent:a,itemContent:e,groupContent:r,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder"),TableBodyComponent:d("TableBody","tbody"),TableComponent:d("Table","table"),TableFooterComponent:d("TableFoot","tfoot"),TableHeadComponent:d("TableHead","thead"),TableRowComponent:d("TableRow","tr"),GroupComponent:d("Group","tr")}});Xr(m5,cL);Rv();const $_={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},uL={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:W_,floor:cf,max:Fc,min:Sp,round:V_}=Math;function G_(e,t,r){return Array.from({length:t-e+1}).map((a,i)=>({data:r===null?null:r[i+e],index:i+e}))}function dL(e){return{...uL,items:e}}function Rd(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function fL(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const gL=Ar(([{increaseViewportBy:e,listBoundary:t,overscan:r,visibleRange:a},{footerHeight:i,headerHeight:o,scrollBy:l,scrollContainerState:u,scrollTo:d,scrollTop:f,smoothScrollTargetReached:g,viewportHeight:h},m,y,{didMount:v,propsReady:k},{customScrollParent:_,useWindowScroll:w,windowScrollContainerState:S,windowScrollTo:E,windowViewportRect:A},T])=>{const C=dt(0),j=dt(0),L=dt($_),O=dt({height:0,width:0}),I=dt({height:0,width:0}),B=xr(),z=xr(),ee=dt(0),$=dt(null),M=dt({column:0,row:0}),G=xr(),Y=xr(),X=dt(!1),ie=dt(0),F=dt(!0),U=dt(!1),Z=dt(!1);Ir(tt(v,or(ie),Gt(([Q,he])=>!Wb(he))),()=>{rr(F,!1)}),Ir(tt(un(v,F,I,O,ie,U),Gt(([Q,he,Ne,De,,Ve])=>Q&&!he&&Ne.height!==0&&De.height!==0&&!Ve)),([,,,,Q])=>{if(Q===void 0){rr(F,!0);return}rr(U,!0),Ev(1,()=>{rr(B,Q)}),ki(tt(f),()=>{rr(t,[0,0]),rr(F,!0)})}),Ot(tt(Y,Gt(Q=>Q!=null&&Q.scrollTop>0),$i(0)),j),Ir(tt(v,or(Y),Gt(([,Q])=>Q!=null)),([,Q])=>{Q&&(rr(O,Q.viewport),rr(I,Q.item),rr(M,Q.gap),Q.scrollTop>0&&(rr(X,!0),ki(tt(f,So(1)),he=>{rr(X,!1)}),rr(d,{top:Q.scrollTop})))}),Ot(tt(O,wt(({height:Q})=>Q)),h),Ot(tt(un(Vt(O,Rd),Vt(I,Rd),Vt(M,(Q,he)=>Q!==void 0&&Q.column===he.column&&Q.row===he.row),Vt(f)),wt(([Q,he,Ne,De])=>({gap:Ne,item:he,scrollTop:De,viewport:Q}))),G),Ot(tt(un(Vt(C),a,Vt(M,fL),Vt(I,Rd),Vt(O,Rd),Vt($),Vt(j),Vt(X),Vt(F),Vt(ie)),Gt(([,,,,,,,Q])=>!Q),wt(([Q,[he,Ne],De,Ve,at,lt,Ce,,$e,Be])=>{const{column:gt,row:ut}=De,{height:jt,width:Ge}=Ve,{width:we}=at;if(Ce===0&&(Q===0||we===0))return $_;if(Ge===0){const qe=jv(Be,Q),Ye=qe+Math.max(Ce-1,0);return dL(G_(qe,Ye,lt))}const Ue=E5(we,Ge,gt);let Ae,rt;$e?he===0&&Ne===0&&Ce>0?(Ae=0,rt=Ce-1):(Ae=Ue*cf((he+ut)/(jt+ut)),rt=Ue*W_((Ne+ut)/(jt+ut))-1,rt=Sp(Q-1,Fc(rt,Ue-1)),Ae=Sp(rt,Fc(0,Ae))):(Ae=0,rt=-1);const fe=G_(Ae,rt,lt),{bottom:ce,top:ve}=K_(at,De,Ve,fe),ye=W_(Q/Ue),it=ye*jt+(ye-1)*ut-ce;return{bottom:ce,itemHeight:jt,items:fe,itemWidth:Ge,offsetBottom:it,offsetTop:ve,top:ve}})),L),Ot(tt($,Gt(Q=>Q!==null),wt(Q=>Q.length)),C),Ot(tt(un(O,I,L,M),Gt(([Q,he,{items:Ne}])=>Ne.length>0&&he.height!==0&&Q.height!==0),wt(([Q,he,{items:Ne},De])=>{const{bottom:Ve,top:at}=K_(Q,De,he,Ne);return[at,Ve]}),Yr(Gc)),t);const P=dt(!1);Ot(tt(f,or(P),wt(([Q,he])=>he||Q!==0)),P);const K=Da(tt(un(L,C),Gt(([{items:Q}])=>Q.length>0),or(P),Gt(([[Q,he],Ne])=>{const De=Q.items[Q.items.length-1].index===he-1;return(Ne||Q.bottom>0&&Q.itemHeight>0&&Q.offsetBottom===0&&Q.items.length===he)&&De}),wt(([[,Q]])=>Q-1),Yr())),V=Da(tt(Vt(L),Gt(({items:Q})=>Q.length>0&&Q[0].index===0),$i(0),Yr())),W=Da(tt(Vt(L),or(X),Gt(([{items:Q},he])=>Q.length>0&&!he),wt(([{items:Q}])=>({endIndex:Q[Q.length-1].index,startIndex:Q[0].index})),Yr(n5),us(0)));Ot(W,y.scrollSeekRangeChanged),Ot(tt(B,or(O,I,C,M),wt(([Q,he,Ne,De,Ve])=>{const at=l5(Q),{align:lt,behavior:Ce,offset:$e}=at;let Be=at.index;Be==="LAST"&&(Be=De-1),Be=Fc(0,Be,Sp(De-1,Be));let gt=Vb(he,Ve,Ne,Be);return lt==="end"?gt=V_(gt-he.height+Ne.height):lt==="center"&&(gt=V_(gt-he.height/2+Ne.height/2)),$e!==void 0&&$e!==0&&(gt+=$e),{behavior:Ce,top:gt}})),d);const ae=Gn(tt(L,wt(Q=>Q.offsetBottom+Q.bottom)),0);return Ot(tt(A,wt(Q=>({height:Q.visibleHeight,width:Q.visibleWidth}))),O),{customScrollParent:_,data:$,deviation:ee,footerHeight:i,gap:M,headerHeight:o,increaseViewportBy:e,initialItemCount:j,itemDimensions:I,overscan:r,restoreStateFrom:Y,scrollBy:l,scrollContainerState:u,scrollHeight:z,scrollTo:d,scrollToIndex:B,scrollTop:f,smoothScrollTargetReached:g,totalCount:C,useWindowScroll:w,viewportDimensions:O,windowScrollContainerState:S,windowScrollTo:E,windowViewportRect:A,...y,gridState:L,horizontalDirection:Z,initialTopMostItemIndex:ie,totalListHeight:ae,...m,endReached:K,propsReady:k,rangeChanged:W,startReached:V,stateChanged:G,stateRestoreInProgress:X,...T}},Xr(Cv,la,iu,p5,$s,Tv,Hs));function E5(e,t,r){return Fc(1,cf((e+r)/(cf(t)+r)))}function K_(e,t,r,a){const{height:i}=r;if(i===void 0||a.length===0)return{bottom:0,top:0};const o=Vb(e,t,r,a[0].index);return{bottom:Vb(e,t,r,a[a.length-1].index)+i,top:o}}function Vb(e,t,r,a){const i=E5(e.width,r.width,t.column),o=cf(a/i),l=o*r.height+Fc(0,o-1)*t.row;return l>0?l+t.row:l}const pL=Ar(()=>{const e=dt(h=>`Item ${h}`),t=dt({}),r=dt(null),a=dt("virtuoso-grid-item"),i=dt("virtuoso-grid-list"),o=dt(Av),l=dt("div"),u=dt(Al),d=(h,m=null)=>Gn(tt(t,wt(y=>y[h]),Yr()),m),f=dt(!1),g=dt(!1);return Ot(Vt(g),f),{components:t,computeItemKey:o,context:r,FooterComponent:d("Footer"),HeaderComponent:d("Header"),headerFooterTag:l,itemClassName:a,ItemComponent:d("Item","div"),itemContent:e,listClassName:i,ListComponent:d("List","div"),readyStateChanged:f,reportReadyState:g,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),hL=Ar(([e,t])=>({...e,...t}),Xr(gL,pL)),mL=Mt.memo(function(){const e=Gr("gridState"),t=Gr("listClassName"),r=Gr("itemClassName"),a=Gr("itemContent"),i=Gr("computeItemKey"),o=Gr("isSeeking"),l=Ja("scrollHeight"),u=Gr("ItemComponent"),d=Gr("ListComponent"),f=Gr("ScrollSeekPlaceholder"),g=Gr("context"),h=Ja("itemDimensions"),m=Ja("gap"),y=Gr("log"),v=Gr("stateRestoreInProgress"),k=Ja("reportReadyState"),_=Co(Mt.useMemo(()=>w=>{const S=w.parentElement.parentElement.scrollHeight;l(S);const E=w.firstChild;if(E!==null){const{height:A,width:T}=E.getBoundingClientRect();h({height:A,width:T})}m({column:Y_("column-gap",getComputedStyle(w).columnGap,y),row:Y_("row-gap",getComputedStyle(w).rowGap,y)})},[l,h,m,y]),!0,!1);return wv(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),v?null:n.jsx(d,{className:t,ref:_,...Vn(d,g),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(w=>{const S=i(w.index,w.data,g);return o?n.jsx(f,{...Vn(f,g),height:e.itemHeight,index:w.index,width:e.itemWidth},S):x.createElement(u,{...Vn(u,g),className:r,"data-index":w.index,key:S},a(w.index,w.data,g))})})}),xL=Mt.memo(function(){const e=Gr("HeaderComponent"),t=Ja("headerHeight"),r=Gr("headerFooterTag"),a=Co(Mt.useMemo(()=>o=>{t(Us(o,"height"))},[t]),!0,!1),i=Gr("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Vn(e,i)})}):null}),yL=Mt.memo(function(){const e=Gr("FooterComponent"),t=Ja("footerHeight"),r=Gr("headerFooterTag"),a=Co(Mt.useMemo(()=>o=>{t(Us(o,"height"))},[t]),!0,!1),i=Gr("context");return e!=null?n.jsx(r,{ref:a,children:n.jsx(e,{...Vn(e,i)})}):null}),bL=({children:e})=>{const t=Mt.useContext(b5),r=Ja("itemDimensions"),a=Ja("viewportDimensions"),i=Co(Mt.useMemo(()=>o=>{a(o.getBoundingClientRect())},[a]),!0,!1);return Mt.useEffect(()=>{t&&(a({height:t.viewportHeight,width:t.viewportWidth}),r({height:t.itemHeight,width:t.itemWidth}))},[t,a,r]),n.jsx("div",{ref:i,style:Iv(!1),children:e})},vL=({children:e})=>{const t=Mt.useContext(b5),r=Ja("windowViewportRect"),a=Ja("itemDimensions"),i=Gr("customScrollParent"),o=Gr("useWindowScroll"),l=Q4(r,i,!1);return Mt.useEffect(()=>{t&&(a({height:t.itemHeight,width:t.itemWidth}),r({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,r,a]),n.jsx("div",{ref:l,style:_5(!1,o),children:e})},kL=Mt.memo(function({...e}){const t=Gr("useWindowScroll"),r=Gr("customScrollParent"),a=r||t?wL:_L,i=r||t?vL:bL,o=Gr("context");return n.jsx(a,{...e,...Vn(a,o),children:n.jsxs(i,{children:[n.jsx(xL,{}),n.jsx(mL,{}),n.jsx(yL,{})]})})}),{useEmitter:j5,useEmitterValue:Gr,usePublisher:Ja}=x5(hL,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},kL),_L=w5({useEmitter:j5,useEmitterValue:Gr,usePublisher:Ja}),wL=N5({useEmitter:j5,useEmitterValue:Gr,usePublisher:Ja});function Y_(e,t,r){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&r(`${e} was not resolved to pixel value correctly`,t,Sn.WARN),t==="normal"?0:parseInt(t??"0",10)}function NL(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const SL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,EL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jL={};function X_(e,t){return(jL.jsx?EL:SL).test(e)}const CL=/[ \t\n\f\r]/g;function TL(e){return typeof e=="object"?e.type==="text"?Q_(e.value):!1:Q_(e)}function Q_(e){return e.replace(CL,"")===""}class su{constructor(t,r,a){this.normal=r,this.property=t,a&&(this.space=a)}}su.prototype.normal={};su.prototype.property={};su.prototype.space=void 0;function C5(e,t){const r={},a={};for(const i of e)Object.assign(r,i.property),Object.assign(a,i.normal);return new su(r,a,t)}function Gb(e){return e.toLowerCase()}class _a{constructor(t,r){this.attribute=r,this.property=t}}_a.prototype.attribute="";_a.prototype.booleanish=!1;_a.prototype.boolean=!1;_a.prototype.commaOrSpaceSeparated=!1;_a.prototype.commaSeparated=!1;_a.prototype.defined=!1;_a.prototype.mustUseProperty=!1;_a.prototype.number=!1;_a.prototype.overloadedBoolean=!1;_a.prototype.property="";_a.prototype.spaceSeparated=!1;_a.prototype.space=void 0;let RL=0;const Zt=Ro(),mn=Ro(),Kb=Ro(),ct=Ro(),Hr=Ro(),wo=Ro(),Ia=Ro();function Ro(){return 2**++RL}const Yb=Object.freeze(Object.defineProperty({__proto__:null,boolean:Zt,booleanish:mn,commaOrSpaceSeparated:Ia,commaSeparated:wo,number:ct,overloadedBoolean:Kb,spaceSeparated:Hr},Symbol.toStringTag,{value:"Module"})),Ep=Object.keys(Yb);class Lv extends _a{constructor(t,r,a,i){let o=-1;if(super(t,r),Z_(this,"space",i),typeof a=="number")for(;++o<Ep.length;){const l=Ep[o];Z_(this,Ep[o],(a&Yb[l])===Yb[l])}}}Lv.prototype.defined=!0;function Z_(e,t,r){r&&(e[t]=r)}function Il(e){const t={},r={};for(const[a,i]of Object.entries(e.properties)){const o=new Lv(a,e.transform(e.attributes||{},a),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,r[Gb(a)]=a,r[Gb(o.attribute)]=a}return new su(t,r,e.space)}const T5=Il({properties:{ariaActiveDescendant:null,ariaAtomic:mn,ariaAutoComplete:null,ariaBusy:mn,ariaChecked:mn,ariaColCount:ct,ariaColIndex:ct,ariaColSpan:ct,ariaControls:Hr,ariaCurrent:null,ariaDescribedBy:Hr,ariaDetails:null,ariaDisabled:mn,ariaDropEffect:Hr,ariaErrorMessage:null,ariaExpanded:mn,ariaFlowTo:Hr,ariaGrabbed:mn,ariaHasPopup:null,ariaHidden:mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Hr,ariaLevel:ct,ariaLive:null,ariaModal:mn,ariaMultiLine:mn,ariaMultiSelectable:mn,ariaOrientation:null,ariaOwns:Hr,ariaPlaceholder:null,ariaPosInSet:ct,ariaPressed:mn,ariaReadOnly:mn,ariaRelevant:null,ariaRequired:mn,ariaRoleDescription:Hr,ariaRowCount:ct,ariaRowIndex:ct,ariaRowSpan:ct,ariaSelected:mn,ariaSetSize:ct,ariaSort:null,ariaValueMax:ct,ariaValueMin:ct,ariaValueNow:ct,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function R5(e,t){return t in e?e[t]:t}function A5(e,t){return R5(e,t.toLowerCase())}const AL=Il({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:wo,acceptCharset:Hr,accessKey:Hr,action:null,allow:null,allowFullScreen:Zt,allowPaymentRequest:Zt,allowUserMedia:Zt,alpha:Zt,alt:null,as:null,async:Zt,autoCapitalize:null,autoComplete:Hr,autoFocus:Zt,autoPlay:Zt,blocking:Hr,capture:null,charSet:null,checked:Zt,cite:null,className:Hr,closedBy:null,colorSpace:null,cols:ct,colSpan:ct,command:null,commandFor:null,content:null,contentEditable:mn,controls:Zt,controlsList:Hr,coords:ct|wo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Zt,defer:Zt,dir:null,dirName:null,disabled:Zt,download:Kb,draggable:mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Zt,formTarget:null,headers:Hr,height:ct,hidden:Kb,high:ct,href:null,hrefLang:null,htmlFor:Hr,httpEquiv:Hr,id:null,imageSizes:null,imageSrcSet:null,inert:Zt,inputMode:null,integrity:null,is:null,isMap:Zt,itemId:null,itemProp:Hr,itemRef:Hr,itemScope:Zt,itemType:Hr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Zt,low:ct,manifest:null,max:null,maxLength:ct,media:null,method:null,min:null,minLength:ct,multiple:Zt,muted:Zt,name:null,nonce:null,noModule:Zt,noValidate:Zt,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:Zt,optimum:ct,pattern:null,ping:Hr,placeholder:null,playsInline:Zt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Zt,referrerPolicy:null,rel:Hr,required:Zt,reversed:Zt,rows:ct,rowSpan:ct,sandbox:Hr,scope:null,scoped:Zt,seamless:Zt,selected:Zt,shadowRootClonable:Zt,shadowRootCustomElementRegistry:Zt,shadowRootDelegatesFocus:Zt,shadowRootMode:null,shadowRootSerializable:Zt,shape:null,size:ct,sizes:null,slot:null,span:ct,spellCheck:mn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ct,step:null,style:null,tabIndex:ct,target:null,title:null,translate:null,type:null,typeMustMatch:Zt,useMap:null,value:mn,width:ct,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Hr,axis:null,background:null,bgColor:null,border:ct,borderColor:null,bottomMargin:ct,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Zt,declare:Zt,event:null,face:null,frame:null,frameBorder:null,hSpace:ct,leftMargin:ct,link:null,longDesc:null,lowSrc:null,marginHeight:ct,marginWidth:ct,noResize:Zt,noHref:Zt,noShade:Zt,noWrap:Zt,object:null,profile:null,prompt:null,rev:null,rightMargin:ct,rules:null,scheme:null,scrolling:mn,standby:null,summary:null,text:null,topMargin:ct,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ct,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Zt,disablePictureInPicture:Zt,disableRemotePlayback:Zt,exportParts:wo,part:Hr,prefix:null,property:null,results:ct,security:null,unselectable:null},space:"html",transform:A5}),IL=Il({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:Ia,accentHeight:ct,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ct,amplitude:ct,arabicForm:null,ascent:ct,attributeName:null,attributeType:null,azimuth:ct,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ct,by:null,calcMode:null,capHeight:ct,className:Hr,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:ct,diffuseConstant:ct,direction:null,display:null,dur:null,divisor:ct,dominantBaseline:null,download:Zt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ct,enableBackground:null,end:null,event:null,exponent:ct,externalResourcesRequired:null,fill:null,fillOpacity:ct,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:wo,g2:wo,glyphName:wo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ct,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ct,horizOriginX:ct,horizOriginY:ct,id:null,ideographic:ct,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ct,k:ct,k1:ct,k2:ct,k3:ct,k4:ct,kernelMatrix:Ia,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ct,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:ct,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:ct,overlineThickness:ct,paintOrder:null,panose1:null,path:null,pathLength:ct,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Hr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ct,pointsAtY:ct,pointsAtZ:ct,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ia,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ia,rev:Ia,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ia,requiredFeatures:Ia,requiredFonts:Ia,requiredFormats:Ia,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:ct,specularExponent:ct,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ct,strikethroughThickness:ct,string:null,stroke:null,strokeDashArray:Ia,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ct,strokeOpacity:ct,strokeWidth:null,style:null,surfaceScale:ct,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ia,tabIndex:ct,tableValues:null,target:null,targetX:ct,targetY:ct,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ia,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ct,underlineThickness:ct,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ct,values:null,vAlphabetic:ct,vMathematical:ct,vectorEffect:null,vHanging:ct,vIdeographic:ct,version:null,vertAdvY:ct,vertOriginX:ct,vertOriginY:ct,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ct,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:R5}),I5=Il({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),M5=Il({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:A5}),L5=Il({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ML={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"},LL=/[A-Z]/g,J_=/-[a-z]/g,OL=/^data[-\w.:]+$/i;function DL(e,t){const r=Gb(t);let a=t,i=_a;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&OL.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(J_,FL);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!J_.test(o)){let l=o.replace(LL,PL);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Lv}return new i(a,t)}function PL(e){return"-"+e.toLowerCase()}function FL(e){return e.charAt(1).toUpperCase()}const BL=C5([T5,AL,I5,M5,L5],"html"),Ov=C5([T5,IL,I5,M5,L5],"svg");function zL(e){return e.join(" ").trim()}var fl={},jp,ew;function UL(){if(ew)return jp;ew=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,d=`
|
|
49
|
-
`,f="/",g="*",h="",m="comment",y="declaration";function v(_,w){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];w=w||{};var S=1,E=1;function A($){var M=$.match(t);M&&(S+=M.length);var G=$.lastIndexOf(d);E=~G?$.length-G:E+$.length}function T(){var $={line:S,column:E};return function(M){return M.position=new C($),O(),M}}function C($){this.start=$,this.end={line:S,column:E},this.source=w.source}C.prototype.content=_;function j($){var M=new Error(w.source+":"+S+":"+E+": "+$);if(M.reason=$,M.filename=w.source,M.line=S,M.column=E,M.source=_,!w.silent)throw M}function L($){var M=$.exec(_);if(M){var G=M[0];return A(G),_=_.slice(G.length),M}}function O(){L(r)}function I($){var M;for($=$||[];M=B();)M!==!1&&$.push(M);return $}function B(){var $=T();if(!(f!=_.charAt(0)||g!=_.charAt(1))){for(var M=2;h!=_.charAt(M)&&(g!=_.charAt(M)||f!=_.charAt(M+1));)++M;if(M+=2,h===_.charAt(M-1))return j("End of comment missing");var G=_.slice(2,M-2);return E+=2,A(G),_=_.slice(M),E+=2,$({type:m,comment:G})}}function z(){var $=T(),M=L(a);if(M){if(B(),!L(i))return j("property missing ':'");var G=L(o),Y=$({type:y,property:k(M[0].replace(e,h)),value:G?k(G[0].replace(e,h)):h});return L(l),Y}}function ee(){var $=[];I($);for(var M;M=z();)M!==!1&&($.push(M),I($));return $}return O(),ee()}function k(_){return _?_.replace(u,h):h}return jp=v,jp}var tw;function qL(){if(tw)return fl;tw=1;var e=fl&&fl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(fl,"__esModule",{value:!0}),fl.default=r;const t=e(UL());function r(a,i){let o=null;if(!a||typeof a!="string")return o;const l=(0,t.default)(a),u=typeof i=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:g}=d;u?i(f,g,d):g&&(o=o||{},o[f]=g)}),o}return fl}var Nc={},rw;function HL(){if(rw)return Nc;rw=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(f){return!f||r.test(f)||e.test(f)},l=function(f,g){return g.toUpperCase()},u=function(f,g){return"".concat(g,"-")},d=function(f,g){return g===void 0&&(g={}),o(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(i,u):f=f.replace(a,u),f.replace(t,l))};return Nc.camelCase=d,Nc}var Sc,nw;function $L(){if(nw)return Sc;nw=1;var e=Sc&&Sc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(qL()),r=HL();function a(i,o){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(u,d){u&&d&&(l[(0,r.camelCase)(u,o)]=d)}),l}return a.default=a,Sc=a,Sc}var WL=$L();const VL=jo(WL),O5=D5("end"),Dv=D5("start");function D5(e){return t;function t(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function GL(e){const t=Dv(e),r=O5(e);if(t&&r)return{start:t,end:r}}function Bc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?aw(e.position):"start"in e||"end"in e?aw(e):"line"in e||"column"in e?Xb(e):""}function Xb(e){return iw(e&&e.line)+":"+iw(e&&e.column)}function aw(e){return Xb(e&&e.start)+"-"+Xb(e&&e.end)}function iw(e){return e&&typeof e=="number"?e:1}class Yn extends Error{constructor(t,r,a){super(),typeof r=="string"&&(a=r,r=void 0);let i="",o={},l=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof t=="string"?i=t:!o.cause&&t&&(l=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const d=a.indexOf(":");d===-1?o.ruleId=a:(o.source=a.slice(0,d),o.ruleId=a.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Bc(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yn.prototype.file="";Yn.prototype.name="";Yn.prototype.reason="";Yn.prototype.message="";Yn.prototype.stack="";Yn.prototype.column=void 0;Yn.prototype.line=void 0;Yn.prototype.ancestors=void 0;Yn.prototype.cause=void 0;Yn.prototype.fatal=void 0;Yn.prototype.place=void 0;Yn.prototype.ruleId=void 0;Yn.prototype.source=void 0;const Pv={}.hasOwnProperty,KL=new Map,YL=/[A-Z]/g,XL=new Set(["table","tbody","thead","tfoot","tr"]),QL=new Set(["td","th"]),P5="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ZL(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=sO(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=iO(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ov:BL,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=F5(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function F5(e,t,r){if(t.type==="element")return JL(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return eO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rO(e,t,r);if(t.type==="mdxjsEsm")return tO(e,t);if(t.type==="root")return nO(e,t,r);if(t.type==="text")return aO(e,t)}function JL(e,t,r){const a=e.schema;let i=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(i=Ov,e.schema=i),e.ancestors.push(t);const o=z5(e,t.tagName,!1),l=oO(e,t);let u=Bv(e,t);return XL.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!TL(d):!0})),B5(e,l,o,t),Fv(l,u),e.ancestors.pop(),e.schema=a,e.create(t,o,l,r)}function eO(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}Zc(e,t.position)}function tO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zc(e,t.position)}function rO(e,t,r){const a=e.schema;let i=a;t.name==="svg"&&a.space==="html"&&(i=Ov,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:z5(e,t.name,!0),l=lO(e,t),u=Bv(e,t);return B5(e,l,o,t),Fv(l,u),e.ancestors.pop(),e.schema=a,e.create(t,o,l,r)}function nO(e,t,r){const a={};return Fv(a,Bv(e,t)),e.create(t,e.Fragment,a,r)}function aO(e,t){return t.value}function B5(e,t,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=a)}function Fv(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function iO(e,t,r){return a;function a(i,o,l,u){const f=Array.isArray(l.children)?r:t;return u?f(o,l,u):f(o,l)}}function sO(e,t){return r;function r(a,i,o,l){const u=Array.isArray(o.children),d=Dv(a);return t(i,o,l,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function oO(e,t){const r={};let a,i;for(i in t.properties)if(i!=="children"&&Pv.call(t.properties,i)){const o=cO(e,i,t.properties[i]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&QL.has(t.tagName)?a=u:r[l]=u}}if(a){const o=r.style||(r.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function lO(e,t){const r={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const l=o.expression;l.type;const u=l.properties[0];u.type,Object.assign(r,e.evaluater.evaluateExpression(u.argument))}else Zc(e,t.position);else{const i=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const u=a.value.data.estree.body[0];u.type,o=e.evaluater.evaluateExpression(u.expression)}else Zc(e,t.position);else o=a.value===null?!0:a.value;r[i]=o}return r}function Bv(e,t){const r=[];let a=-1;const i=e.passKeys?new Map:KL;for(;++a<t.children.length;){const o=t.children[a];let l;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const f=i.get(d)||0;l=d+"-"+f,i.set(d,f+1)}}const u=F5(e,o,l);u!==void 0&&r.push(u)}return r}function cO(e,t,r){const a=DL(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?NL(r):zL(r)),a.property==="style"){let i=typeof r=="object"?r:uO(e,String(r));return e.stylePropertyNameCase==="css"&&(i=dO(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&a.space?ML[a.property]||a.property:a.attribute,r]}}function uO(e,t){try{return VL(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,i=new Yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=P5+"#cannot-parse-style-attribute",i}}function z5(e,t,r){let a;if(!r)a={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,l;for(;++o<i.length;){const u=X_(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}a=l}else a=X_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const i=a.value;return Pv.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(a);Zc(e)}function Zc(e,t){const r=new Yn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=P5+"#cannot-handle-mdx-estrees-without-createevaluater",r}function dO(e){const t={};let r;for(r in e)Pv.call(e,r)&&(t[fO(r)]=e[r]);return t}function fO(e){let t=e.replace(YL,gO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function gO(e){return"-"+e.toLowerCase()}const Cp={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"]},pO={};function zv(e,t){const r=pO,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return U5(e,a,i)}function U5(e,t,r){if(hO(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return sw(e.children,t,r)}return Array.isArray(e)?sw(e,t,r):""}function sw(e,t,r){const a=[];let i=-1;for(;++i<e.length;)a[i]=U5(e[i],t,r);return a.join("")}function hO(e){return!!(e&&typeof e=="object")}const ow=document.createElement("i");function Uv(e){const t="&"+e+";";ow.innerHTML=t;const r=ow.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Pa(e,t,r,a){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,a.length<1e4)l=Array.from(a),l.unshift(t,r),e.splice(...l);else for(r&&e.splice(t,r);o<a.length;)l=a.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function Za(e,t){return e.length>0?(Pa(e,e.length,0,t),e):t}const lw={}.hasOwnProperty;function q5(e){const t={};let r=-1;for(;++r<e.length;)mO(t,e[r]);return t}function mO(e,t){let r;for(r in t){const i=(lw.call(e,r)?e[r]:void 0)||(e[r]={}),o=t[r];let l;if(o)for(l in o){lw.call(i,l)||(i[l]=[]);const u=o[l];xO(i[l],Array.isArray(u)?u:u?[u]:[])}}}function xO(e,t){let r=-1;const a=[];for(;++r<t.length;)(t[r].add==="after"?e:a).push(t[r]);Pa(e,0,0,a)}function H5(e,t){const r=Number.parseInt(e,t);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 _i(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const oa=Ws(/[A-Za-z]/),Kn=Ws(/[\dA-Za-z]/),yO=Ws(/[#-'*+\--9=?A-Z^-~]/);function uf(e){return e!==null&&(e<32||e===127)}const Qb=Ws(/\d/),bO=Ws(/[\dA-Fa-f]/),vO=Ws(/[!-/:-@[-`{-~]/);function qt(e){return e!==null&&e<-2}function $r(e){return e!==null&&(e<0||e===32)}function gr(e){return e===-2||e===-1||e===32}const jf=Ws(new RegExp("\\p{P}|\\p{S}","u")),Eo=Ws(/\s/);function Ws(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ml(e){const t=[];let r=-1,a=0,i=0;for(;++r<e.length;){const o=e.charCodeAt(r);let l="";if(o===37&&Kn(e.charCodeAt(r+1))&&Kn(e.charCodeAt(r+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const u=e.charCodeAt(r+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(a,r),encodeURIComponent(l)),a=r+i+1,l=""),i&&(r+=i,i=0)}return t.join("")+e.slice(a)}function kr(e,t,r,a){const i=a?a-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(d){return gr(d)?(e.enter(r),u(d)):t(d)}function u(d){return gr(d)&&o++<i?(e.consume(d),u):(e.exit(r),t(d))}}const kO={tokenize:_O};function _O(e){const t=e.attempt(this.parser.constructs.contentInitial,a,i);let r;return t;function a(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),kr(e,t,"linePrefix")}function i(u){return e.enter("paragraph"),o(u)}function o(u){const d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return qt(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}const wO={tokenize:NO},cw={tokenize:SO};function NO(e){const t=this,r=[];let a=0,i,o,l;return u;function u(E){if(a<r.length){const A=r[a];return t.containerState=A[1],e.attempt(A[0].continuation,d,f)(E)}return f(E)}function d(E){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&S();const A=t.events.length;let T=A,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}w(a);let j=A;for(;j<t.events.length;)t.events[j][1].end={...C},j++;return Pa(t.events,T+1,0,t.events.slice(A)),t.events.length=j,f(E)}return u(E)}function f(E){if(a===r.length){if(!i)return m(E);if(i.currentConstruct&&i.currentConstruct.concrete)return v(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(cw,g,h)(E)}function g(E){return i&&S(),w(a),m(E)}function h(E){return t.parser.lazy[t.now().line]=a!==r.length,l=t.now().offset,v(E)}function m(E){return t.containerState={},e.attempt(cw,y,v)(E)}function y(E){return a++,r.push([t.currentConstruct,t.containerState]),m(E)}function v(E){if(E===null){i&&S(),w(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),k(E)}function k(E){if(E===null){_(e.exit("chunkFlow"),!0),w(0),e.consume(E);return}return qt(E)?(e.consume(E),_(e.exit("chunkFlow")),a=0,t.interrupt=void 0,u):(e.consume(E),k)}function _(E,A){const T=t.sliceStream(E);if(A&&T.push(null),E.previous=o,o&&(o.next=E),o=E,i.defineSkip(E.start),i.write(T),t.parser.lazy[E.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<l&&(!i.events[C][1].end||i.events[C][1].end.offset>l))return;const j=t.events.length;let L=j,O,I;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(O){I=t.events[L][1].end;break}O=!0}for(w(a),C=j;C<t.events.length;)t.events[C][1].end={...I},C++;Pa(t.events,L+1,0,t.events.slice(j)),t.events.length=C}}function w(E){let A=r.length;for(;A-- >E;){const T=r[A];t.containerState=T[1],T[0].exit.call(t,e)}r.length=E}function S(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function SO(e,t,r){return kr(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Cl(e){if(e===null||$r(e)||Eo(e))return 1;if(jf(e))return 2}function Cf(e,t,r){const a=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!a.includes(o)&&(t=o(t,r),a.push(o))}return t}const Zb={name:"attention",resolveAll:EO,tokenize:jO};function EO(e,t){let r=-1,a,i,o,l,u,d,f,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;d=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[a][1].end},m={...e[r][1].start};uw(h,-d),uw(m,d),l={type:d>1?"strongSequence":"emphasisSequence",start:h,end:{...e[a][1].end}},u={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:m},o={type:d>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},i={type:d>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[a][1].end={...l.start},e[r][1].start={...u.end},f=[],e[a][1].end.offset-e[a][1].start.offset&&(f=Za(f,[["enter",e[a][1],t],["exit",e[a][1],t]])),f=Za(f,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),f=Za(f,Cf(t.parser.constructs.insideSpan.null,e.slice(a+1,r),t)),f=Za(f,[["exit",o,t],["enter",u,t],["exit",u,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,f=Za(f,[["enter",e[r][1],t],["exit",e[r][1],t]])):g=0,Pa(e,a-1,r-a+3,f),r=a+f.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function jO(e,t){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,i=Cl(a);let o;return l;function l(d){return o=d,e.enter("attentionSequence"),u(d)}function u(d){if(d===o)return e.consume(d),u;const f=e.exit("attentionSequence"),g=Cl(d),h=!g||g===2&&i||r.includes(d),m=!i||i===2&&g||r.includes(a);return f._open=!!(o===42?h:h&&(i||!m)),f._close=!!(o===42?m:m&&(g||!h)),t(d)}}function uw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const CO={name:"autolink",tokenize:TO};function TO(e,t,r){let a=0;return i;function i(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return oa(y)?(e.consume(y),l):y===64?r(y):f(y)}function l(y){return y===43||y===45||y===46||Kn(y)?(a=1,u(y)):f(y)}function u(y){return y===58?(e.consume(y),a=0,d):(y===43||y===45||y===46||Kn(y))&&a++<32?(e.consume(y),u):(a=0,f(y))}function d(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||uf(y)?r(y):(e.consume(y),d)}function f(y){return y===64?(e.consume(y),g):yO(y)?(e.consume(y),f):r(y)}function g(y){return Kn(y)?h(y):r(y)}function h(y){return y===46?(e.consume(y),a=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):m(y)}function m(y){if((y===45||Kn(y))&&a++<63){const v=y===45?m:h;return e.consume(y),v}return r(y)}}const ou={partial:!0,tokenize:RO};function RO(e,t,r){return a;function a(o){return gr(o)?kr(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||qt(o)?t(o):r(o)}}const $5={continuation:{tokenize:IO},exit:MO,name:"blockQuote",tokenize:AO};function AO(e,t,r){const a=this;return i;function i(l){if(l===62){const u=a.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return r(l)}function o(l){return gr(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function IO(e,t,r){const a=this;return i;function i(l){return gr(l)?kr(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt($5,t,r)(l)}}function MO(e){e.exit("blockQuote")}const W5={name:"characterEscape",tokenize:LO};function LO(e,t,r){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return vO(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(o)}}const V5={name:"characterReference",tokenize:OO};function OO(e,t,r){const a=this;let i=0,o,l;return u;function u(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),d}function d(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,l=Kn,g(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=bO,g):(e.enter("characterReferenceValue"),o=7,l=Qb,g(h))}function g(h){if(h===59&&i){const m=e.exit("characterReferenceValue");return l===Kn&&!Uv(a.sliceSerialize(m))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(h)&&i++<o?(e.consume(h),g):r(h)}}const dw={partial:!0,tokenize:PO},fw={concrete:!0,name:"codeFenced",tokenize:DO};function DO(e,t,r){const a=this,i={partial:!0,tokenize:T};let o=0,l=0,u;return d;function d(C){return f(C)}function f(C){const j=a.events[a.events.length-1];return o=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,u=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(C)}function g(C){return C===u?(l++,e.consume(C),g):l<3?r(C):(e.exit("codeFencedFenceSequence"),gr(C)?kr(e,h,"whitespace")(C):h(C))}function h(C){return C===null||qt(C)?(e.exit("codeFencedFence"),a.interrupt?t(C):e.check(dw,k,A)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||qt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):gr(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),kr(e,y,"whitespace")(C)):C===96&&C===u?r(C):(e.consume(C),m)}function y(C){return C===null||qt(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===null||qt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===u?r(C):(e.consume(C),v)}function k(C){return e.attempt(i,A,_)(C)}function _(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),w}function w(C){return o>0&&gr(C)?kr(e,S,"linePrefix",o+1)(C):S(C)}function S(C){return C===null||qt(C)?e.check(dw,k,A)(C):(e.enter("codeFlowValue"),E(C))}function E(C){return C===null||qt(C)?(e.exit("codeFlowValue"),S(C)):(e.consume(C),E)}function A(C){return e.exit("codeFenced"),t(C)}function T(C,j,L){let O=0;return I;function I(M){return C.enter("lineEnding"),C.consume(M),C.exit("lineEnding"),B}function B(M){return C.enter("codeFencedFence"),gr(M)?kr(C,z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):z(M)}function z(M){return M===u?(C.enter("codeFencedFenceSequence"),ee(M)):L(M)}function ee(M){return M===u?(O++,C.consume(M),ee):O>=l?(C.exit("codeFencedFenceSequence"),gr(M)?kr(C,$,"whitespace")(M):$(M)):L(M)}function $(M){return M===null||qt(M)?(C.exit("codeFencedFence"),j(M)):L(M)}}}function PO(e,t,r){const a=this;return i;function i(l){return l===null?r(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return a.parser.lazy[a.now().line]?r(l):t(l)}}const Tp={name:"codeIndented",tokenize:BO},FO={partial:!0,tokenize:zO};function BO(e,t,r){const a=this;return i;function i(f){return e.enter("codeIndented"),kr(e,o,"linePrefix",5)(f)}function o(f){const g=a.events[a.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?l(f):r(f)}function l(f){return f===null?d(f):qt(f)?e.attempt(FO,l,d)(f):(e.enter("codeFlowValue"),u(f))}function u(f){return f===null||qt(f)?(e.exit("codeFlowValue"),l(f)):(e.consume(f),u)}function d(f){return e.exit("codeIndented"),t(f)}}function zO(e,t,r){const a=this;return i;function i(l){return a.parser.lazy[a.now().line]?r(l):qt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):kr(e,o,"linePrefix",5)(l)}function o(l){const u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):qt(l)?i(l):r(l)}}const UO={name:"codeText",previous:HO,resolve:qO,tokenize:$O};function qO(e){let t=e.length-4,r=3,a,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=r;++a<t;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(a=r-1,t++;++a<=t;)i===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(i=a):(a===t||e[a][1].type==="lineEnding")&&(e[i][1].type="codeTextData",a!==i+2&&(e[i][1].end=e[a-1][1].end,e.splice(i+2,a-i-2),t-=a-i-2,a=i+2),i=void 0);return e}function HO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function $O(e,t,r){let a=0,i,o;return l;function l(h){return e.enter("codeText"),e.enter("codeTextSequence"),u(h)}function u(h){return h===96?(e.consume(h),a++,u):(e.exit("codeTextSequence"),d(h))}function d(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),d):h===96?(o=e.enter("codeTextSequence"),i=0,g(h)):qt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||qt(h)?(e.exit("codeTextData"),d(h)):(e.consume(h),f)}function g(h){return h===96?(e.consume(h),i++,g):i===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(o.type="codeTextData",f(h))}}class WO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,r,a){const i=r||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return a&&Ec(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ec(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ec(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Ec(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ec(this.left,r.reverse())}}}function Ec(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function G5(e){const t={};let r=-1,a,i,o,l,u,d,f;const g=new WO(e);for(;++r<g.length;){for(;r in t;)r=t[r];if(a=g.get(r),r&&a[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(d=a[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,VO(g,r)),r=t[r],f=!0);else if(a[1]._container){for(o=r,i=void 0;o--;)if(l=g.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(g.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(a[1].end={...g.get(i)[1].start},u=g.slice(i,r),u.unshift(a),g.splice(i,r-i+1,u))}}return Pa(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function VO(e,t){const r=e.get(t)[1],a=e.get(t)[2];let i=t-1;const o=[];let l=r._tokenizer;l||(l=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,d=[],f={};let g,h,m=-1,y=r,v=0,k=0;const _=[k];for(;y;){for(;e.get(++i)[1]!==y;);o.push(i),y._tokenizer||(g=a.sliceStream(y),y.next||g.push(null),h&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(g),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),h=y,y=y.next}for(y=r;++m<u.length;)u[m][0]==="exit"&&u[m-1][0]==="enter"&&u[m][1].type===u[m-1][1].type&&u[m][1].start.line!==u[m][1].end.line&&(k=m+1,_.push(k),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):_.pop(),m=_.length;m--;){const w=u.slice(_[m],_[m+1]),S=o.pop();d.push([S,S+w.length-1]),e.splice(S,2,w)}for(d.reverse(),m=-1;++m<d.length;)f[v+d[m][0]]=v+d[m][1],v+=d[m][1]-d[m][0]-1;return f}const GO={resolve:YO,tokenize:XO},KO={partial:!0,tokenize:QO};function YO(e){return G5(e),e}function XO(e,t){let r;return a;function a(u){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?o(u):qt(u)?e.check(KO,l,o)(u):(e.consume(u),i)}function o(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function QO(e,t,r){const a=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),kr(e,o,"linePrefix")}function o(l){if(l===null||qt(l))return r(l);const u=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(a.parser.constructs.flow,r,t)(l)}}function K5(e,t,r,a,i,o,l,u,d){const f=d||Number.POSITIVE_INFINITY;let g=0;return h;function h(w){return w===60?(e.enter(a),e.enter(i),e.enter(o),e.consume(w),e.exit(o),m):w===null||w===32||w===41||uf(w)?r(w):(e.enter(a),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),k(w))}function m(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(i),e.exit(a),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(u),m(w)):w===null||w===60||qt(w)?r(w):(e.consume(w),w===92?v:y)}function v(w){return w===60||w===62||w===92?(e.consume(w),y):y(w)}function k(w){return!g&&(w===null||w===41||$r(w))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(a),t(w)):g<f&&w===40?(e.consume(w),g++,k):w===41?(e.consume(w),g--,k):w===null||w===32||w===40||uf(w)?r(w):(e.consume(w),w===92?_:k)}function _(w){return w===40||w===41||w===92?(e.consume(w),k):k(w)}}function Y5(e,t,r,a,i,o){const l=this;let u=0,d;return f;function f(y){return e.enter(a),e.enter(i),e.consume(y),e.exit(i),e.enter(o),g}function g(y){return u>999||y===null||y===91||y===93&&!d||y===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?r(y):y===93?(e.exit(o),e.enter(i),e.consume(y),e.exit(i),e.exit(a),t):qt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===null||y===91||y===93||qt(y)||u++>999?(e.exit("chunkString"),g(y)):(e.consume(y),d||(d=!gr(y)),y===92?m:h)}function m(y){return y===91||y===92||y===93?(e.consume(y),u++,h):h(y)}}function X5(e,t,r,a,i,o){let l;return u;function u(m){return m===34||m===39||m===40?(e.enter(a),e.enter(i),e.consume(m),e.exit(i),l=m===40?41:m,d):r(m)}function d(m){return m===l?(e.enter(i),e.consume(m),e.exit(i),e.exit(a),t):(e.enter(o),f(m))}function f(m){return m===l?(e.exit(o),d(l)):m===null?r(m):qt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),kr(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(m))}function g(m){return m===l||m===null||qt(m)?(e.exit("chunkString"),f(m)):(e.consume(m),m===92?h:g)}function h(m){return m===l||m===92?(e.consume(m),g):g(m)}}function zc(e,t){let r;return a;function a(i){return qt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,a):gr(i)?kr(e,a,r?"linePrefix":"lineSuffix")(i):t(i)}}const ZO={name:"definition",tokenize:eD},JO={partial:!0,tokenize:tD};function eD(e,t,r){const a=this;let i;return o;function o(y){return e.enter("definition"),l(y)}function l(y){return Y5.call(a,e,u,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return i=_i(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):r(y)}function d(y){return $r(y)?zc(e,f)(y):f(y)}function f(y){return K5(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(JO,h,h)(y)}function h(y){return gr(y)?kr(e,m,"whitespace")(y):m(y)}function m(y){return y===null||qt(y)?(e.exit("definition"),a.parser.defined.push(i),t(y)):r(y)}}function tD(e,t,r){return a;function a(u){return $r(u)?zc(e,i)(u):r(u)}function i(u){return X5(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return gr(u)?kr(e,l,"whitespace")(u):l(u)}function l(u){return u===null||qt(u)?t(u):r(u)}}const rD={name:"hardBreakEscape",tokenize:nD};function nD(e,t,r){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return qt(o)?(e.exit("hardBreakEscape"),t(o)):r(o)}}const aD={name:"headingAtx",resolve:iD,tokenize:sD};function iD(e,t){let r=e.length-2,a=3,i,o;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(i={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},o={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},Pa(e,a,r-a+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function sD(e,t,r){let a=0;return i;function i(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),l(g)}function l(g){return g===35&&a++<6?(e.consume(g),l):g===null||$r(g)?(e.exit("atxHeadingSequence"),u(g)):r(g)}function u(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||qt(g)?(e.exit("atxHeading"),t(g)):gr(g)?kr(e,u,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),u(g))}function f(g){return g===null||g===35||$r(g)?(e.exit("atxHeadingText"),u(g)):(e.consume(g),f)}}const oD=["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"],gw=["pre","script","style","textarea"],lD={concrete:!0,name:"htmlFlow",resolveTo:dD,tokenize:fD},cD={partial:!0,tokenize:pD},uD={partial:!0,tokenize:gD};function dD(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function fD(e,t,r){const a=this;let i,o,l,u,d;return f;function f(P){return g(P)}function g(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),h}function h(P){return P===33?(e.consume(P),m):P===47?(e.consume(P),o=!0,k):P===63?(e.consume(P),i=3,a.interrupt?t:F):oa(P)?(e.consume(P),l=String.fromCharCode(P),_):r(P)}function m(P){return P===45?(e.consume(P),i=2,y):P===91?(e.consume(P),i=5,u=0,v):oa(P)?(e.consume(P),i=4,a.interrupt?t:F):r(P)}function y(P){return P===45?(e.consume(P),a.interrupt?t:F):r(P)}function v(P){const K="CDATA[";return P===K.charCodeAt(u++)?(e.consume(P),u===K.length?a.interrupt?t:z:v):r(P)}function k(P){return oa(P)?(e.consume(P),l=String.fromCharCode(P),_):r(P)}function _(P){if(P===null||P===47||P===62||$r(P)){const K=P===47,V=l.toLowerCase();return!K&&!o&&gw.includes(V)?(i=1,a.interrupt?t(P):z(P)):oD.includes(l.toLowerCase())?(i=6,K?(e.consume(P),w):a.interrupt?t(P):z(P)):(i=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(P):o?S(P):E(P))}return P===45||Kn(P)?(e.consume(P),l+=String.fromCharCode(P),_):r(P)}function w(P){return P===62?(e.consume(P),a.interrupt?t:z):r(P)}function S(P){return gr(P)?(e.consume(P),S):I(P)}function E(P){return P===47?(e.consume(P),I):P===58||P===95||oa(P)?(e.consume(P),A):gr(P)?(e.consume(P),E):I(P)}function A(P){return P===45||P===46||P===58||P===95||Kn(P)?(e.consume(P),A):T(P)}function T(P){return P===61?(e.consume(P),C):gr(P)?(e.consume(P),T):E(P)}function C(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(e.consume(P),d=P,j):gr(P)?(e.consume(P),C):L(P)}function j(P){return P===d?(e.consume(P),d=null,O):P===null||qt(P)?r(P):(e.consume(P),j)}function L(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||$r(P)?T(P):(e.consume(P),L)}function O(P){return P===47||P===62||gr(P)?E(P):r(P)}function I(P){return P===62?(e.consume(P),B):r(P)}function B(P){return P===null||qt(P)?z(P):gr(P)?(e.consume(P),B):r(P)}function z(P){return P===45&&i===2?(e.consume(P),G):P===60&&i===1?(e.consume(P),Y):P===62&&i===4?(e.consume(P),U):P===63&&i===3?(e.consume(P),F):P===93&&i===5?(e.consume(P),ie):qt(P)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(cD,Z,ee)(P)):P===null||qt(P)?(e.exit("htmlFlowData"),ee(P)):(e.consume(P),z)}function ee(P){return e.check(uD,$,Z)(P)}function $(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),M}function M(P){return P===null||qt(P)?ee(P):(e.enter("htmlFlowData"),z(P))}function G(P){return P===45?(e.consume(P),F):z(P)}function Y(P){return P===47?(e.consume(P),l="",X):z(P)}function X(P){if(P===62){const K=l.toLowerCase();return gw.includes(K)?(e.consume(P),U):z(P)}return oa(P)&&l.length<8?(e.consume(P),l+=String.fromCharCode(P),X):z(P)}function ie(P){return P===93?(e.consume(P),F):z(P)}function F(P){return P===62?(e.consume(P),U):P===45&&i===2?(e.consume(P),F):z(P)}function U(P){return P===null||qt(P)?(e.exit("htmlFlowData"),Z(P)):(e.consume(P),U)}function Z(P){return e.exit("htmlFlow"),t(P)}}function gD(e,t,r){const a=this;return i;function i(l){return qt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):r(l)}function o(l){return a.parser.lazy[a.now().line]?r(l):t(l)}}function pD(e,t,r){return a;function a(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ou,t,r)}}const hD={name:"htmlText",tokenize:mD};function mD(e,t,r){const a=this;let i,o,l;return u;function u(F){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(F),d}function d(F){return F===33?(e.consume(F),f):F===47?(e.consume(F),T):F===63?(e.consume(F),E):oa(F)?(e.consume(F),L):r(F)}function f(F){return F===45?(e.consume(F),g):F===91?(e.consume(F),o=0,v):oa(F)?(e.consume(F),S):r(F)}function g(F){return F===45?(e.consume(F),y):r(F)}function h(F){return F===null?r(F):F===45?(e.consume(F),m):qt(F)?(l=h,Y(F)):(e.consume(F),h)}function m(F){return F===45?(e.consume(F),y):h(F)}function y(F){return F===62?G(F):F===45?m(F):h(F)}function v(F){const U="CDATA[";return F===U.charCodeAt(o++)?(e.consume(F),o===U.length?k:v):r(F)}function k(F){return F===null?r(F):F===93?(e.consume(F),_):qt(F)?(l=k,Y(F)):(e.consume(F),k)}function _(F){return F===93?(e.consume(F),w):k(F)}function w(F){return F===62?G(F):F===93?(e.consume(F),w):k(F)}function S(F){return F===null||F===62?G(F):qt(F)?(l=S,Y(F)):(e.consume(F),S)}function E(F){return F===null?r(F):F===63?(e.consume(F),A):qt(F)?(l=E,Y(F)):(e.consume(F),E)}function A(F){return F===62?G(F):E(F)}function T(F){return oa(F)?(e.consume(F),C):r(F)}function C(F){return F===45||Kn(F)?(e.consume(F),C):j(F)}function j(F){return qt(F)?(l=j,Y(F)):gr(F)?(e.consume(F),j):G(F)}function L(F){return F===45||Kn(F)?(e.consume(F),L):F===47||F===62||$r(F)?O(F):r(F)}function O(F){return F===47?(e.consume(F),G):F===58||F===95||oa(F)?(e.consume(F),I):qt(F)?(l=O,Y(F)):gr(F)?(e.consume(F),O):G(F)}function I(F){return F===45||F===46||F===58||F===95||Kn(F)?(e.consume(F),I):B(F)}function B(F){return F===61?(e.consume(F),z):qt(F)?(l=B,Y(F)):gr(F)?(e.consume(F),B):O(F)}function z(F){return F===null||F===60||F===61||F===62||F===96?r(F):F===34||F===39?(e.consume(F),i=F,ee):qt(F)?(l=z,Y(F)):gr(F)?(e.consume(F),z):(e.consume(F),$)}function ee(F){return F===i?(e.consume(F),i=void 0,M):F===null?r(F):qt(F)?(l=ee,Y(F)):(e.consume(F),ee)}function $(F){return F===null||F===34||F===39||F===60||F===61||F===96?r(F):F===47||F===62||$r(F)?O(F):(e.consume(F),$)}function M(F){return F===47||F===62||$r(F)?O(F):r(F)}function G(F){return F===62?(e.consume(F),e.exit("htmlTextData"),e.exit("htmlText"),t):r(F)}function Y(F){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),X}function X(F){return gr(F)?kr(e,ie,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):ie(F)}function ie(F){return e.enter("htmlTextData"),l(F)}}const qv={name:"labelEnd",resolveAll:vD,resolveTo:kD,tokenize:_D},xD={tokenize:wD},yD={tokenize:ND},bD={tokenize:SD};function vD(e){let t=-1;const r=[];for(;++t<e.length;){const a=e[t][1];if(r.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const i=a.type==="labelImage"?4:2;a.type="data",t+=i}}return e.length!==r.length&&Pa(e,0,e.length,r),e}function kD(e,t){let r=e.length,a=0,i,o,l,u;for(;r--;)if(i=e[r][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=r,i.type!=="labelLink")){a=2;break}}else i.type==="labelEnd"&&(l=r);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},g={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",d,t],["enter",f,t]],u=Za(u,e.slice(o+1,o+a+3)),u=Za(u,[["enter",g,t]]),u=Za(u,Cf(t.parser.constructs.insideSpan.null,e.slice(o+a+4,l-3),t)),u=Za(u,[["exit",g,t],e[l-2],e[l-1],["exit",f,t]]),u=Za(u,e.slice(l+1)),u=Za(u,[["exit",d,t]]),Pa(e,o,e.length,u),e}function _D(e,t,r){const a=this;let i=a.events.length,o,l;for(;i--;)if((a.events[i][1].type==="labelImage"||a.events[i][1].type==="labelLink")&&!a.events[i][1]._balanced){o=a.events[i][1];break}return u;function u(m){return o?o._inactive?h(m):(l=a.parser.defined.includes(_i(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),d):r(m)}function d(m){return m===40?e.attempt(xD,g,l?g:h)(m):m===91?e.attempt(yD,g,l?f:h)(m):l?g(m):h(m)}function f(m){return e.attempt(bD,g,h)(m)}function g(m){return t(m)}function h(m){return o._balanced=!0,r(m)}}function wD(e,t,r){return a;function a(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return $r(h)?zc(e,o)(h):o(h)}function o(h){return h===41?g(h):K5(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function l(h){return $r(h)?zc(e,d)(h):g(h)}function u(h){return r(h)}function d(h){return h===34||h===39||h===40?X5(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):g(h)}function f(h){return $r(h)?zc(e,g)(h):g(h)}function g(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):r(h)}}function ND(e,t,r){const a=this;return i;function i(u){return Y5.call(a,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return a.parser.defined.includes(_i(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(u):r(u)}function l(u){return r(u)}}function SD(e,t,r){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):r(o)}}const ED={name:"labelStartImage",resolveAll:qv.resolveAll,tokenize:jD};function jD(e,t,r){const a=this;return i;function i(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),o}function o(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):r(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(u):t(u)}}const CD={name:"labelStartLink",resolveAll:qv.resolveAll,tokenize:TD};function TD(e,t,r){const a=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(l):t(l)}}const Rp={name:"lineEnding",tokenize:RD};function RD(e,t){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),kr(e,t,"linePrefix")}}const ef={name:"thematicBreak",tokenize:AD};function AD(e,t,r){let a=0,i;return o;function o(f){return e.enter("thematicBreak"),l(f)}function l(f){return i=f,u(f)}function u(f){return f===i?(e.enter("thematicBreakSequence"),d(f)):a>=3&&(f===null||qt(f))?(e.exit("thematicBreak"),t(f)):r(f)}function d(f){return f===i?(e.consume(f),a++,d):(e.exit("thematicBreakSequence"),gr(f)?kr(e,u,"whitespace")(f):u(f))}}const ba={continuation:{tokenize:OD},exit:PD,name:"list",tokenize:LD},ID={partial:!0,tokenize:FD},MD={partial:!0,tokenize:DD};function LD(e,t,r){const a=this,i=a.events[a.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return u;function u(y){const v=a.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!a.containerState.marker||y===a.containerState.marker:Qb(y)){if(a.containerState.type||(a.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(ef,r,f)(y):f(y);if(!a.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return r(y)}function d(y){return Qb(y)&&++l<10?(e.consume(y),d):(!a.interrupt||l<2)&&(a.containerState.marker?y===a.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):r(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||y,e.check(ou,a.interrupt?r:g,e.attempt(ID,m,h))}function g(y){return a.containerState.initialBlankLine=!0,o++,m(y)}function h(y){return gr(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),m):r(y)}function m(y){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function OD(e,t,r){const a=this;return a.containerState._closeFlow=void 0,e.check(ou,i,o);function i(u){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,kr(e,t,"listItemIndent",a.containerState.size+1)(u)}function o(u){return a.containerState.furtherBlankLines||!gr(u)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,l(u)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(MD,t,l)(u))}function l(u){return a.containerState._closeFlow=!0,a.interrupt=void 0,kr(e,e.attempt(ba,t,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function DD(e,t,r){const a=this;return kr(e,i,"listItemIndent",a.containerState.size+1);function i(o){const l=a.events[a.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===a.containerState.size?t(o):r(o)}}function PD(e){e.exit(this.containerState.type)}function FD(e,t,r){const a=this;return kr(e,i,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=a.events[a.events.length-1];return!gr(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):r(o)}}const pw={name:"setextUnderline",resolveTo:BD,tokenize:zD};function BD(e,t){let r=e.length,a,i,o;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!o&&e[r][1].type==="definition"&&(o=r);const l={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=l,e.push(["exit",l,t]),e}function zD(e,t,r){const a=this;let i;return o;function o(f){let g=a.events.length,h;for(;g--;)if(a.events[g][1].type!=="lineEnding"&&a.events[g][1].type!=="linePrefix"&&a.events[g][1].type!=="content"){h=a.events[g][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||h)?(e.enter("setextHeadingLine"),i=f,l(f)):r(f)}function l(f){return e.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===i?(e.consume(f),u):(e.exit("setextHeadingLineSequence"),gr(f)?kr(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||qt(f)?(e.exit("setextHeadingLine"),t(f)):r(f)}}const UD={tokenize:qD};function qD(e){const t=this,r=e.attempt(ou,a,e.attempt(this.parser.constructs.flowInitial,i,kr(e,e.attempt(this.parser.constructs.flow,i,e.attempt(GO,i)),"linePrefix")));return r;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const HD={resolveAll:Z5()},$D=Q5("string"),WD=Q5("text");function Q5(e){return{resolveAll:Z5(e==="text"?VD:void 0),tokenize:t};function t(r){const a=this,i=this.parser.constructs[e],o=r.attempt(i,l,u);return l;function l(g){return f(g)?o(g):u(g)}function u(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),d}function d(g){return f(g)?(r.exit("data"),o(g)):(r.consume(g),d)}function f(g){if(g===null)return!0;const h=i[g];let m=-1;if(h)for(;++m<h.length;){const y=h[m];if(!y.previous||y.previous.call(a,a.previous))return!0}return!1}}}function Z5(e){return t;function t(r,a){let i=-1,o;for(;++i<=r.length;)o===void 0?r[i]&&r[i][1].type==="data"&&(o=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==o+2&&(r[o][1].end=r[i-1][1].end,r.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(r,a):r}}function VD(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],i=t.sliceStream(a);let o=i.length,l=-1,u=0,d;for(;o--;){const f=i[o];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(f===-2)d=!0,u++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(u=0),u){const f={type:r===e.length||d||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:a.start._bufferIndex+l,_index:a.start._index+o,line:a.end.line,column:a.end.column-u,offset:a.end.offset-u},end:{...a.end}};a.end={...f.start},a.start.offset===a.end.offset?Object.assign(a,f):(e.splice(r,0,["enter",f,t],["exit",f,t]),r+=2)}r++}return e}const GD={42:ba,43:ba,45:ba,48:ba,49:ba,50:ba,51:ba,52:ba,53:ba,54:ba,55:ba,56:ba,57:ba,62:$5},KD={91:ZO},YD={[-2]:Tp,[-1]:Tp,32:Tp},XD={35:aD,42:ef,45:[pw,ef],60:lD,61:pw,95:ef,96:fw,126:fw},QD={38:V5,92:W5},ZD={[-5]:Rp,[-4]:Rp,[-3]:Rp,33:ED,38:V5,42:Zb,60:[CO,hD],91:CD,92:[rD,W5],93:qv,95:Zb,96:UO},JD={null:[Zb,HD]},eP={null:[42,95]},tP={null:[]},rP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:eP,contentInitial:KD,disable:tP,document:GD,flow:XD,flowInitial:YD,insideSpan:JD,string:QD,text:ZD},Symbol.toStringTag,{value:"Module"}));function nP(e,t,r){let a={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},o=[];let l=[],u=[];const d={attempt:j(T),check:j(C),consume:S,enter:E,exit:A,interrupt:j(C,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:e,previous:null,sliceSerialize:m,sliceStream:y,write:h};let g=t.tokenize.call(f,d);return t.resolveAll&&o.push(t),f;function h(B){return l=Za(l,B),_(),l[l.length-1]!==null?[]:(L(t,0),f.events=Cf(o,f.events,f),f.events)}function m(B,z){return iP(y(B),z)}function y(B){return aP(l,B)}function v(){const{_bufferIndex:B,_index:z,line:ee,column:$,offset:M}=a;return{_bufferIndex:B,_index:z,line:ee,column:$,offset:M}}function k(B){i[B.line]=B.column,I()}function _(){let B;for(;a._index<l.length;){const z=l[a._index];if(typeof z=="string")for(B=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===B&&a._bufferIndex<z.length;)w(z.charCodeAt(a._bufferIndex));else w(z)}}function w(B){g=g(B)}function S(B){qt(B)?(a.line++,a.column=1,a.offset+=B===-3?2:1,I()):B!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===l[a._index].length&&(a._bufferIndex=-1,a._index++)),f.previous=B}function E(B,z){const ee=z||{};return ee.type=B,ee.start=v(),f.events.push(["enter",ee,f]),u.push(ee),ee}function A(B){const z=u.pop();return z.end=v(),f.events.push(["exit",z,f]),z}function T(B,z){L(B,z.from)}function C(B,z){z.restore()}function j(B,z){return ee;function ee($,M,G){let Y,X,ie,F;return Array.isArray($)?Z($):"tokenize"in $?Z([$]):U($);function U(W){return ae;function ae(Q){const he=Q!==null&&W[Q],Ne=Q!==null&&W.null,De=[...Array.isArray(he)?he:he?[he]:[],...Array.isArray(Ne)?Ne:Ne?[Ne]:[]];return Z(De)(Q)}}function Z(W){return Y=W,X=0,W.length===0?G:P(W[X])}function P(W){return ae;function ae(Q){return F=O(),ie=W,W.partial||(f.currentConstruct=W),W.name&&f.parser.constructs.disable.null.includes(W.name)?V():W.tokenize.call(z?Object.assign(Object.create(f),z):f,d,K,V)(Q)}}function K(W){return B(ie,F),M}function V(W){return F.restore(),++X<Y.length?P(Y[X]):G}}}function L(B,z){B.resolveAll&&!o.includes(B)&&o.push(B),B.resolve&&Pa(f.events,z,f.events.length-z,B.resolve(f.events.slice(z),f)),B.resolveTo&&(f.events=B.resolveTo(f.events,f))}function O(){const B=v(),z=f.previous,ee=f.currentConstruct,$=f.events.length,M=Array.from(u);return{from:$,restore:G};function G(){a=B,f.previous=z,f.currentConstruct=ee,f.events.length=$,u=M,I()}}function I(){a.line in i&&a.column<2&&(a.column=i[a.line],a.offset+=i[a.line]-1)}}function aP(e,t){const r=t.start._index,a=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(r===i)l=[e[r].slice(a,o)];else{if(l=e.slice(r,i),a>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(a):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function iP(e,t){let r=-1;const a=[];let i;for(;++r<e.length;){const o=e[r];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
|
|
50
|
-
`;break}case-3:{l=`\r
|
|
51
|
-
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,a.push(l)}return a.join("")}function sP(e){const a={constructs:q5([rP,...(e||{}).extensions||[]]),content:i(kO),defined:[],document:i(wO),flow:i(UD),lazy:{},string:i($D),text:i(WD)};return a;function i(o){return l;function l(u){return nP(a,o,u)}}}function oP(e){for(;!G5(e););return e}const hw=/[\0\t\n\r]/g;function lP(){let e=1,t="",r=!0,a;return i;function i(o,l,u){const d=[];let f,g,h,m,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),h=0,t="",r&&(o.charCodeAt(0)===65279&&h++,r=void 0);h<o.length;){if(hw.lastIndex=h,f=hw.exec(o),m=f&&f.index!==void 0?f.index:o.length,y=o.charCodeAt(m),!f){t=o.slice(h);break}if(y===10&&h===m&&a)d.push(-3),a=void 0;else switch(a&&(d.push(-5),a=void 0),h<m&&(d.push(o.slice(h,m)),e+=m-h),y){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:a=!0,e=1}h=m+1}return u&&(a&&d.push(-5),t&&d.push(t),d.push(null)),d}}const cP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uP(e){return e.replace(cP,dP)}function dP(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),o=i===120||i===88;return H5(r.slice(o?2:1),o?16:10)}return Uv(r)||e}const J5={}.hasOwnProperty;function fP(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),gP(r)(oP(sP(r).document().write(lP()(e,t,!0))))}function gP(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ut),autolinkProtocol:O,autolinkEmail:O,atxHeading:o(Ce),blockQuote:o(Ne),characterEscape:O,characterReference:O,codeFenced:o(De),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(De,l),codeText:o(Ve,l),codeTextData:O,data:O,codeFlowValue:O,definition:o(at),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(lt),hardBreakEscape:o($e),hardBreakTrailing:o($e),htmlFlow:o(Be,l),htmlFlowData:O,htmlText:o(Be,l),htmlTextData:O,image:o(gt),label:l,link:o(ut),listItem:o(Ge),listItemValue:m,listOrdered:o(jt,h),listUnordered:o(jt),paragraph:o(we),reference:P,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(Ce),strong:o(Ue),thematicBreak:o(rt)},exit:{atxHeading:d(),atxHeadingSequence:T,autolink:d(),autolinkEmail:he,autolinkProtocol:Q,blockQuote:d(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:W,characterReference:ae,codeFenced:d(_),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:I,codeIndented:d(w),codeText:d(M),codeTextData:I,data:I,definition:d(),definitionDestinationString:A,definitionLabelString:S,definitionTitleString:E,emphasis:d(),hardBreakEscape:d(z),hardBreakTrailing:d(z),htmlFlow:d(ee),htmlFlowData:I,htmlText:d($),htmlTextData:I,image:d(Y),label:ie,labelText:X,lineEnding:B,link:d(G),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:K,resourceDestinationString:F,resourceTitleString:U,resource:Z,setextHeading:d(L),setextHeadingLineSequence:j,setextHeadingText:C,strong:d(),thematicBreak:d()}};eT(t,(e||{}).mdastExtensions||[]);const r={};return a;function a(fe){let ce={type:"root",children:[]};const ve={stack:[ce],tokenStack:[],config:t,enter:u,exit:f,buffer:l,resume:g,data:r},ye=[];let it=-1;for(;++it<fe.length;)if(fe[it][1].type==="listOrdered"||fe[it][1].type==="listUnordered")if(fe[it][0]==="enter")ye.push(it);else{const qe=ye.pop();it=i(fe,qe,it)}for(it=-1;++it<fe.length;){const qe=t[fe[it][0]];J5.call(qe,fe[it][1].type)&&qe[fe[it][1].type].call(Object.assign({sliceSerialize:fe[it][2].sliceSerialize},ve),fe[it][1])}if(ve.tokenStack.length>0){const qe=ve.tokenStack[ve.tokenStack.length-1];(qe[1]||mw).call(ve,void 0,qe[0])}for(ce.position={start:Os(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Os(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},it=-1;++it<t.transforms.length;)ce=t.transforms[it](ce)||ce;return ce}function i(fe,ce,ve){let ye=ce-1,it=-1,qe=!1,Ye,yt,ht,Dt;for(;++ye<=ve;){const nt=fe[ye];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?it++:it--,Dt=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(Ye&&!Dt&&!it&&!ht&&(ht=ye),Dt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Dt=void 0}if(!it&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||it===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(Ye){let Pt=ye;for(yt=void 0;Pt--;){const $t=fe[Pt];if($t[1].type==="lineEnding"||$t[1].type==="lineEndingBlank"){if($t[0]==="exit")continue;yt&&(fe[yt][1].type="lineEndingBlank",qe=!0),$t[1].type="lineEnding",yt=Pt}else if(!($t[1].type==="linePrefix"||$t[1].type==="blockQuotePrefix"||$t[1].type==="blockQuotePrefixWhitespace"||$t[1].type==="blockQuoteMarker"||$t[1].type==="listItemIndent"))break}ht&&(!yt||ht<yt)&&(Ye._spread=!0),Ye.end=Object.assign({},yt?fe[yt][1].start:nt[1].end),fe.splice(yt||ye,0,["exit",Ye,nt[2]]),ye++,ve++}if(nt[1].type==="listItemPrefix"){const Pt={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};Ye=Pt,fe.splice(ye,0,["enter",Pt,nt[2]]),ye++,ve++,ht=void 0,Dt=!0}}}return fe[ce][1]._spread=qe,ve}function o(fe,ce){return ve;function ve(ye){u.call(this,fe(ye),ye),ce&&ce.call(this,ye)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(fe,ce,ve){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([ce,ve||void 0]),fe.position={start:Os(ce.start),end:void 0}}function d(fe){return ce;function ce(ve){fe&&fe.call(this,ve),f.call(this,ve)}}function f(fe,ce){const ve=this.stack.pop(),ye=this.tokenStack.pop();if(ye)ye[0].type!==fe.type&&(ce?ce.call(this,fe,ye[0]):(ye[1]||mw).call(this,fe,ye[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Bc({start:fe.start,end:fe.end})+"): it’s not open");ve.position.end=Os(fe.end)}function g(){return zv(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(fe){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function y(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=fe}function v(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=fe}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.value=fe.replace(/(\r?\n|\r)$/g,"")}function S(fe){const ce=this.resume(),ve=this.stack[this.stack.length-1];ve.label=ce,ve.identifier=_i(this.sliceSerialize(fe)).toLowerCase()}function E(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.title=fe}function A(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.url=fe}function T(fe){const ce=this.stack[this.stack.length-1];if(!ce.depth){const ve=this.sliceSerialize(fe).length;ce.depth=ve}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function j(fe){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function O(fe){const ve=this.stack[this.stack.length-1].children;let ye=ve[ve.length-1];(!ye||ye.type!=="text")&&(ye=Ae(),ye.position={start:Os(fe.start),end:void 0},ve.push(ye)),this.stack.push(ye)}function I(fe){const ce=this.stack.pop();ce.value+=this.sliceSerialize(fe),ce.position.end=Os(fe.end)}function B(fe){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=ce.children[ce.children.length-1];ve.position.end=Os(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ce.type)&&(O.call(this,fe),I.call(this,fe))}function z(){this.data.atHardBreak=!0}function ee(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.value=fe}function $(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.value=fe}function M(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.value=fe}function G(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ce,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function Y(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ce,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function X(fe){const ce=this.sliceSerialize(fe),ve=this.stack[this.stack.length-2];ve.label=uP(ce),ve.identifier=_i(ce).toLowerCase()}function ie(){const fe=this.stack[this.stack.length-1],ce=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const ye=fe.children;ve.children=ye}else ve.alt=ce}function F(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.url=fe}function U(){const fe=this.resume(),ce=this.stack[this.stack.length-1];ce.title=fe}function Z(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function K(fe){const ce=this.resume(),ve=this.stack[this.stack.length-1];ve.label=ce,ve.identifier=_i(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function V(fe){this.data.characterReferenceType=fe.type}function W(fe){const ce=this.sliceSerialize(fe),ve=this.data.characterReferenceType;let ye;ve?(ye=H5(ce,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ye=Uv(ce);const it=this.stack[this.stack.length-1];it.value+=ye}function ae(fe){const ce=this.stack.pop();ce.position.end=Os(fe.end)}function Q(fe){I.call(this,fe);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(fe)}function he(fe){I.call(this,fe);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(fe)}function Ne(){return{type:"blockquote",children:[]}}function De(){return{type:"code",lang:null,meta:null,value:""}}function Ve(){return{type:"inlineCode",value:""}}function at(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function lt(){return{type:"emphasis",children:[]}}function Ce(){return{type:"heading",depth:0,children:[]}}function $e(){return{type:"break"}}function Be(){return{type:"html",value:""}}function gt(){return{type:"image",title:null,url:"",alt:null}}function ut(){return{type:"link",title:null,url:"",children:[]}}function jt(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function Ge(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function we(){return{type:"paragraph",children:[]}}function Ue(){return{type:"strong",children:[]}}function Ae(){return{type:"text",value:""}}function rt(){return{type:"thematicBreak"}}}function Os(e){return{line:e.line,column:e.column,offset:e.offset}}function eT(e,t){let r=-1;for(;++r<t.length;){const a=t[r];Array.isArray(a)?eT(e,a):pP(e,a)}}function pP(e,t){let r;for(r in t)if(J5.call(t,r))switch(r){case"canContainEols":{const a=t[r];a&&e[r].push(...a);break}case"transforms":{const a=t[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=t[r];a&&Object.assign(e[r],a);break}}}function mw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Bc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Bc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Bc({start:t.start,end:t.end})+") is still open")}function hP(e){const t=this;t.parser=r;function r(a){return fP(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function mP(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function xP(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
52
|
-
`}]}function yP(e,t){const r=t.value?t.value+`
|
|
53
|
-
`:"",a={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(a.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:r}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function bP(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function vP(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function kP(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),i=Ml(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let l,u=e.footnoteCounts.get(a);u===void 0?(u=0,e.footnoteOrder.push(a),l=e.footnoteOrder.length):l=o+1,u+=1,e.footnoteCounts.set(a,u);const d={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function _P(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wP(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function tT(e,t){const r=t.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=a:i.push({type:"text",value:a}),i}function NP(e,t){const r=String(t.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return tT(e,t);const i={src:Ml(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(i.title=a.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function SP(e,t){const r={src:Ml(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,a),e.applyData(t,a)}function EP(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,a),e.applyData(t,a)}function jP(e,t){const r=String(t.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return tT(e,t);const i={href:Ml(a.url||"")};a.title!==null&&a.title!==void 0&&(i.title=a.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function CP(e,t){const r={href:Ml(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const a={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function TP(e,t,r){const a=e.all(t),i=r?RP(r):rT(t),o={},l=[];if(typeof t.checked=="boolean"){const g=a[0];let h;g&&g.type==="element"&&g.tagName==="p"?h=g:(h={type:"element",tagName:"p",properties:{},children:[]},a.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<a.length;){const g=a[u];(i||u!==0||g.type!=="element"||g.tagName!=="p")&&l.push({type:"text",value:`
|
|
54
|
-
`}),g.type==="element"&&g.tagName==="p"&&!i?l.push(...g.children):l.push(g)}const d=a[a.length-1];d&&(i||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
55
|
-
`});const f={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,f),e.applyData(t,f)}function RP(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let a=-1;for(;!t&&++a<r.length;)t=rT(r[a])}return t}function rT(e){const t=e.spread;return t??e.children.length>1}function AP(e,t){const r={},a=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<a.length;){const l=a[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function IP(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function MP(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function LP(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function OP(e,t){const r=e.all(t),a=r.shift(),i=[];if(a){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],l),i.push(l)}if(r.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},u=Dv(t.children[1]),d=O5(t.children[t.children.length-1]);u&&d&&(l.position={start:u,end:d}),i.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function DP(e,t,r){const a=r?r.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",l=r&&r.type==="table"?r.align:void 0,u=l?l.length:t.children.length;let d=-1;const f=[];for(;++d<u;){const h=t.children[d],m={},y=l?l[d]:void 0;y&&(m.align=y);let v={type:"element",tagName:o,properties:m,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,v)),f.push(v)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,g),e.applyData(t,g)}function PP(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const xw=9,yw=32;function FP(e){const t=String(e),r=/\r?\n|\r/g;let a=r.exec(t),i=0;const o=[];for(;a;)o.push(bw(t.slice(i,a.index),i>0,!0),a[0]),i=a.index+a[0].length,a=r.exec(t);return o.push(bw(t.slice(i),i>0,!1)),o.join("")}function bw(e,t,r){let a=0,i=e.length;if(t){let o=e.codePointAt(a);for(;o===xw||o===yw;)a++,o=e.codePointAt(a)}if(r){let o=e.codePointAt(i-1);for(;o===xw||o===yw;)i--,o=e.codePointAt(i-1)}return i>a?e.slice(a,i):""}function BP(e,t){const r={type:"text",value:FP(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function zP(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const UP={blockquote:mP,break:xP,code:yP,delete:bP,emphasis:vP,footnoteReference:kP,heading:_P,html:wP,imageReference:NP,image:SP,inlineCode:EP,linkReference:jP,link:CP,listItem:TP,list:AP,paragraph:IP,root:MP,strong:LP,table:OP,tableCell:PP,tableRow:DP,text:BP,thematicBreak:zP,toml:Ad,yaml:Ad,definition:Ad,footnoteDefinition:Ad};function Ad(){}const nT=-1,Tf=0,Uc=1,df=2,Hv=3,$v=4,Wv=5,Vv=6,aT=7,iT=8,{defineProperty:qP}=Object,sT=typeof self=="object"?self:globalThis,vw=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new sT[e](t)},HP=(e,t)=>{const r=(i,o)=>(e.set(o,i),i),a=i=>{if(e.has(i))return e.get(i);const[o,l]=t[i];switch(o){case Tf:case nT:return r(l,i);case Uc:{const u=r([],i);for(const d of l)u.push(a(d));return u}case df:{const u=r({},i);for(const[d,f]of l){const g=a(d),h=a(f);g==="__proto__"?qP(u,g,{value:h,configurable:!0,enumerable:!0,writable:!0}):u[g]=h}return u}case Hv:return r(new Date(l),i);case $v:{const{source:u,flags:d}=l;return r(new RegExp(u,d),i)}case Wv:{const u=r(new Map,i);for(const[d,f]of l)u.set(a(d),a(f));return u}case Vv:{const u=r(new Set,i);for(const d of l)u.add(a(d));return u}case aT:{const{name:u,message:d}=l;return r(typeof sT[u]=="function"?vw(u,d):new Error(d),i)}case iT:return r(BigInt(l),i);case"BigInt":return r(Object(BigInt(l)),i);case"ArrayBuffer":return r(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return r(new DataView(u),l)}case"-0":return-0}return r(vw(o,l),i)};return a},kw=e=>HP(new Map,e)(0),yo="",{toString:$P}={},{keys:WP,is:VP}=Object,jc=e=>{const t=typeof e;if(t!=="object"||!e)return[Tf,t];const r=$P.call(e).slice(8,-1);switch(r){case"Array":return[Uc,yo];case"Object":return[df,yo];case"Date":return[Hv,yo];case"RegExp":return[$v,yo];case"Map":return[Wv,yo];case"Set":return[Vv,yo];case"DataView":return[Uc,r]}return r.includes("Array")?[Uc,r]:e instanceof Error?[aT,e.name||"Error"]:[df,r]},Id=([e,t])=>e===Tf&&(t==="function"||t==="symbol"),GP=(e,t,r,a)=>{const i=(l,u)=>{const d=a.push(l)-1;return r.set(u,d),d},o=l=>{if(r.has(l))return r.get(l);let[u,d]=jc(l);switch(u){case Tf:{let g=l;switch(d){case"bigint":u=iT,g=l.toString();break;case"number":if(!l&&VP(l,-0))return a.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return i([nT],l)}return i([u,g],l)}case Uc:{if(d){let m=l;return d==="DataView"?m=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(m=new Uint8Array(l)),i([d,[...m]],l)}const g=[],h=i([u,g],l);for(const m of l)g.push(o(m));return h}case df:{if(d)switch(d){case"BigInt":return i([d,l.toString()],l);case"Boolean":case"Number":case"String":return i([d,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const g=[],h=i([u,g],l);for(const m of WP(l))(e||!Id(jc(l[m])))&&g.push([o(m),o(l[m])]);return h}case Hv:return i([u,isNaN(l.getTime())?yo:l.toISOString()],l);case $v:{const{source:g,flags:h}=l;return i([u,{source:g,flags:h}],l)}case Wv:{const g=[],h=i([u,g],l);for(const[m,y]of l)(e||!(Id(jc(m))||Id(jc(y))))&&g.push([o(m),o(y)]);return h}case Vv:{const g=[],h=i([u,g],l);for(const m of l)(e||!Id(jc(m)))&&g.push(o(m));return h}}const{message:f}=l;return i([u,{name:d,message:f}],l)};return o},_w=(e,{json:t,lossy:r}={})=>{const a=[];return GP(!(t||r),!!t,new Map,a)(e),a},ff=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?kw(_w(e,t)):structuredClone(e):(e,t)=>kw(_w(e,t));function KP(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function YP(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function XP(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||KP,a=e.options.footnoteBackLabel||YP,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const g=e.all(f),h=String(f.identifier).toUpperCase(),m=Ml(h.toLowerCase());let y=0;const v=[],k=e.footnoteCounts.get(h);for(;k!==void 0&&++y<=k;){v.length>0&&v.push({type:"text",value:" "});let S=typeof r=="string"?r:r(d,y);typeof S=="string"&&(S={type:"text",value:S}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(d,y),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const _=g[g.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const S=_.children[_.children.length-1];S&&S.type==="text"?S.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...v)}else g.push(...v);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(g,!0)};e.patch(f,w),u.push(w)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ff(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
56
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
57
|
-
`}]}}const lu=(function(e){if(e==null)return e6;if(typeof e=="function")return Rf(e);if(typeof e=="object")return Array.isArray(e)?QP(e):ZP(e);if(typeof e=="string")return JP(e);throw new Error("Expected function, string, or object as test")});function QP(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=lu(e[r]);return Rf(a);function a(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function ZP(e){const t=e;return Rf(r);function r(a){const i=a;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function JP(e){return Rf(t);function t(r){return r&&r.type===e}}function Rf(e){return t;function t(r,a,i){return!!(t6(r)&&e.call(this,r,typeof a=="number"?a:void 0,i||void 0))}}function e6(){return!0}function t6(e){return e!==null&&typeof e=="object"&&"type"in e}const oT=[],r6=!0,Jb=!1,n6="skip";function lT(e,t,r,a){let i;typeof t=="function"&&typeof r!="function"?(a=r,r=t):i=t;const o=lu(i),l=a?-1:1;u(e,void 0,[])();function u(d,f,g){const h=d&&typeof d=="object"?d:{};if(typeof h.type=="string"){const y=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return m;function m(){let y=oT,v,k,_;if((!t||o(d,f,g[g.length-1]||void 0))&&(y=a6(r(d,g)),y[0]===Jb))return y;if("children"in d&&d.children){const w=d;if(w.children&&y[0]!==n6)for(k=(a?w.children.length:-1)+l,_=g.concat(w);k>-1&&k<w.children.length;){const S=w.children[k];if(v=u(S,k,_)(),v[0]===Jb)return v;k=typeof v[1]=="number"?v[1]:k+l}}return y}}}function a6(e){return Array.isArray(e)?e:typeof e=="number"?[r6,e]:e==null?oT:[e]}function Af(e,t,r,a){let i,o,l;typeof t=="function"&&typeof r!="function"?(o=void 0,l=t,i=r):(o=t,l=r,i=a),lT(e,o,u,i);function u(d,f){const g=f[f.length-1],h=g?g.children.indexOf(d):void 0;return l(d,h,g)}}const ev={}.hasOwnProperty,i6={};function s6(e,t){const r=t||i6,a=new Map,i=new Map,o=new Map,l={...UP,...r.handlers},u={all:f,applyData:l6,definitionById:a,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:l,one:d,options:r,patch:o6,wrap:u6};return Af(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const h=g.type==="definition"?a:i,m=String(g.identifier).toUpperCase();h.has(m)||h.set(m,g)}}),u;function d(g,h){const m=g.type,y=u.handlers[m];if(ev.call(u.handlers,m)&&y)return y(u,g,h);if(u.options.passThrough&&u.options.passThrough.includes(m)){if("children"in g){const{children:k,..._}=g,w=ff(_);return w.children=u.all(g),w}return ff(g)}return(u.options.unknownHandler||c6)(u,g,h)}function f(g){const h=[];if("children"in g){const m=g.children;let y=-1;for(;++y<m.length;){const v=u.one(m[y],g);if(v){if(y&&m[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=ww(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=ww(k.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function o6(e,t){e.position&&(t.position=GL(e))}function l6(e,t){let r=t;if(e&&e.data){const a=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const l="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:l}}r.type==="element"&&o&&Object.assign(r.properties,ff(o)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function c6(e,t){const r=t.data||{},a="value"in t&&!(ev.call(r,"hProperties")||ev.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function u6(e,t){const r=[];let a=-1;for(t&&r.push({type:"text",value:`
|
|
58
|
-
`});++a<e.length;)a&&r.push({type:"text",value:`
|
|
59
|
-
`}),r.push(e[a]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
60
|
-
`}),r}function ww(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Nw(e,t){const r=s6(e,t),a=r.one(e,void 0),i=XP(r),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
|
|
61
|
-
`},i),o}function d6(e,t){return e&&"run"in e?async function(r,a){const i=Nw(r,{file:a,...t});await e.run(i,a)}:function(r,a){return Nw(r,{file:a,...e||t})}}function Sw(e){if(e)throw e}var Ap,Ew;function f6(){if(Ew)return Ap;Ew=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var g=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!h)return!1;var m;for(m in f);return typeof m>"u"||e.call(f,m)},l=function(f,g){r&&g.name==="__proto__"?r(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},u=function(f,g){if(g==="__proto__")if(e.call(f,g)){if(a)return a(f,g).value}else return;return f[g]};return Ap=function d(){var f,g,h,m,y,v,k=arguments[0],_=1,w=arguments.length,S=!1;for(typeof k=="boolean"&&(S=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_<w;++_)if(f=arguments[_],f!=null)for(g in f)h=u(k,g),m=u(f,g),k!==m&&(S&&m&&(o(m)||(y=i(m)))?(y?(y=!1,v=h&&i(h)?h:[]):v=h&&o(h)?h:{},l(k,{name:g,newValue:d(S,v,m)})):typeof m<"u"&&l(k,{name:g,newValue:m}));return k},Ap}var g6=f6();const Ip=jo(g6);function tv(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function p6(){const e=[],t={run:r,use:a};return t;function r(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...i);function u(d,...f){const g=e[++o];let h=-1;if(d){l(d);return}for(;++h<i.length;)(f[h]===null||f[h]===void 0)&&(f[h]=i[h]);i=f,g?h6(g,u)(...f):l(null,...f)}}function a(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function h6(e,t){let r;return a;function a(...l){const u=e.length>l.length;let d;u&&l.push(i);try{d=e.apply(this,l)}catch(f){const g=f;if(u&&r)throw g;return i(g)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,i):d instanceof Error?i(d):o(d))}function i(l,...u){r||(r=!0,t(l,...u))}function o(l){i(null,l)}}const Hi={basename:m6,dirname:x6,extname:y6,join:b6,sep:"/"};function m6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');cu(e);let r=0,a=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){r=i+1;break}}else a<0&&(o=!0,a=i+1);return a<0?"":e.slice(r,a)}if(t===e)return"";let l=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){r=i+1;break}}else l<0&&(o=!0,l=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(a=i):(u=-1,a=l));return r===a?a=l:a<0&&(a=e.length),e.slice(r,a)}function x6(e){if(cu(e),e.length===0)return".";let t=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){t=r;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function y6(e){cu(e);let t=e.length,r=-1,a=0,i=-1,o=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){a=t+1;break}continue}r<0&&(l=!0,r=t+1),u===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||r<0||o===0||o===1&&i===r-1&&i===a+1?"":e.slice(i,r)}function b6(...e){let t=-1,r;for(;++t<e.length;)cu(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":v6(r)}function v6(e){cu(e);const t=e.codePointAt(0)===47;let r=k6(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function k6(e,t){let r="",a=0,i=-1,o=0,l=-1,u,d;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(i===l-1||o===1))if(i!==l-1&&o===2){if(r.length<2||a!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",a=0):(r=r.slice(0,d),a=r.length-1-r.lastIndexOf("/")),i=l,o=0;continue}}else if(r.length>0){r="",a=0,i=l,o=0;continue}}t&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(i+1,l):r=e.slice(i+1,l),a=l-i-1;i=l,o=0}else u===46&&o>-1?o++:o=-1}return r}function cu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _6={cwd:w6};function w6(){return"/"}function rv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function N6(e){if(typeof e=="string")e=new URL(e);else if(!rv(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return S6(e)}function S6(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const a=t.codePointAt(r+2);if(a===70||a===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Mp=["history","path","basename","stem","extname","dirname"];class cT{constructor(t){let r;t?rv(t)?r={path:t}:typeof t=="string"||E6(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":_6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Mp.length;){const o=Mp[a];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let i;for(i in r)Mp.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Hi.basename(this.path):void 0}set basename(t){Op(t,"basename"),Lp(t,"basename"),this.path=Hi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Hi.dirname(this.path):void 0}set dirname(t){jw(this.basename,"dirname"),this.path=Hi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Hi.extname(this.path):void 0}set extname(t){if(Lp(t,"extname"),jw(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Hi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){rv(t)&&(t=N6(t)),Op(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Hi.basename(this.path,this.extname):void 0}set stem(t){Op(t,"stem"),Lp(t,"stem"),this.path=Hi.join(this.dirname||"",t+(this.extname||""))}fail(t,r,a){const i=this.message(t,r,a);throw i.fatal=!0,i}info(t,r,a){const i=this.message(t,r,a);return i.fatal=void 0,i}message(t,r,a){const i=new Yn(t,r,a);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Lp(e,t){if(e&&e.includes(Hi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Hi.sep+"`")}function Op(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function E6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const j6=(function(e){const a=this.constructor.prototype,i=a[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),C6={}.hasOwnProperty;class Gv extends j6{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=p6()}copy(){const t=new Gv;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];t.use(...a)}return t.data(Ip(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Fp("data",this.frozen),this.namespace[t]=r,this):C6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const i=r.call(t,...a);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Md(t),a=this.parser||this.Parser;return Dp("parse",a),a(String(r),r)}process(t,r){const a=this;return this.freeze(),Dp("process",this.parser||this.Parser),Pp("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(o,l){const u=Md(t),d=a.parse(u);a.run(d,u,function(g,h,m){if(g||!h||!m)return f(g);const y=h,v=a.stringify(y,m);A6(v)?m.value=v:m.result=v,f(g,m)});function f(g,h){g||!h?l(g):o?o(h):r(void 0,h)}}}processSync(t){let r=!1,a;return this.freeze(),Dp("processSync",this.parser||this.Parser),Pp("processSync",this.compiler||this.Compiler),this.process(t,i),Tw("processSync","process",r),a;function i(o,l){r=!0,Sw(o),a=l}}run(t,r,a){Cw(t),this.freeze();const i=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?o(void 0,a):new Promise(o);function o(l,u){const d=Md(r);i.run(t,d,f);function f(g,h,m){const y=h||t;g?u(g):l?l(y):a(void 0,y,m)}}}runSync(t,r){let a=!1,i;return this.run(t,r,o),Tw("runSync","run",a),i;function o(l,u){Sw(l),i=u,a=!0}}stringify(t,r){this.freeze();const a=Md(r),i=this.compiler||this.Compiler;return Pp("stringify",i),Cw(t),i(t,a)}use(t,...r){const a=this.attachers,i=this.namespace;if(Fp("use",this.frozen),t!=null)if(typeof t=="function")d(t,r);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[g,...h]=f;d(g,h)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))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");u(f.plugins),f.settings&&(i.settings=Ip(!0,i.settings,f.settings))}function u(f){let g=-1;if(f!=null)if(Array.isArray(f))for(;++g<f.length;){const h=f[g];o(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,g){let h=-1,m=-1;for(;++h<a.length;)if(a[h][0]===f){m=h;break}if(m===-1)a.push([f,...g]);else if(g.length>0){let[y,...v]=g;const k=a[m][1];tv(k)&&tv(y)&&(y=Ip(!0,k,y)),a[m]=[f,y,...v]}}}}const T6=new Gv().freeze();function Dp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Pp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Cw(e){if(!tv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tw(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Md(e){return R6(e)?e:new cT(e)}function R6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function A6(e){return typeof e=="string"||I6(e)}function I6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const M6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Rw=[],Aw={allowDangerousHtml:!0},L6=/^(https?|ircs?|mailto|xmpp)$/i,O6=[{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 Sl(e){const t=D6(e),r=P6(e);return F6(t.runSync(t.parse(r),r),e)}function D6(e){const t=e.rehypePlugins||Rw,r=e.remarkPlugins||Rw,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Aw}:Aw;return T6().use(hP).use(r).use(d6,a).use(t)}function P6(e){const t=e.children||"",r=new cT;return typeof t=="string"&&(r.value=t),r}function F6(e,t){const r=t.allowedElements,a=t.allowElement,i=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||B6;for(const g of O6)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+M6+g.id,void 0);return Af(e,f),ZL(e,{Fragment:n.Fragment,components:i,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function f(g,h,m){if(g.type==="raw"&&m&&typeof h=="number")return l?m.children.splice(h,1):m.children[h]={type:"text",value:g.value},h;if(g.type==="element"){let y;for(y in Cp)if(Object.hasOwn(Cp,y)&&Object.hasOwn(g.properties,y)){const v=g.properties[y],k=Cp[y];(k===null||k.includes(g.tagName))&&(g.properties[y]=d(String(v||""),y,g))}}if(g.type==="element"){let y=r?!r.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&a&&typeof h=="number"&&(y=!a(g,h,m)),y&&m&&typeof h=="number")return u&&g.children?m.children.splice(h,1,...g.children):m.children.splice(h,1),h}}}function B6(e){const t=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||a!==-1&&t>a||L6.test(e.slice(0,t))?e:""}function Iw(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,i=r.indexOf(t);for(;i!==-1;)a++,i=r.indexOf(t,i+t.length);return a}function z6(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function U6(e,t,r){const i=lu((r||{}).ignore||[]),o=q6(t);let l=-1;for(;++l<o.length;)lT(e,"text",u);function u(f,g){let h=-1,m;for(;++h<g.length;){const y=g[h],v=m?m.children:void 0;if(i(y,v?v.indexOf(y):void 0,m))return;m=y}if(m)return d(f,g)}function d(f,g){const h=g[g.length-1],m=o[l][0],y=o[l][1];let v=0;const _=h.children.indexOf(f);let w=!1,S=[];m.lastIndex=0;let E=m.exec(f.value);for(;E;){const A=E.index,T={index:E.index,input:E.input,stack:[...g,f]};let C=y(...E,T);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?m.lastIndex=A+1:(v!==A&&S.push({type:"text",value:f.value.slice(v,A)}),Array.isArray(C)?S.push(...C):C&&S.push(C),v=A+E[0].length,w=!0),!m.global)break;E=m.exec(f.value)}return w?(v<f.value.length&&S.push({type:"text",value:f.value.slice(v)}),h.children.splice(_,1,...S)):S=[f],_+S.length}}function q6(e){const t=[];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 a=-1;for(;++a<r.length;){const i=r[a];t.push([H6(i[0]),$6(i[1])])}return t}function H6(e){return typeof e=="string"?new RegExp(z6(e),"g"):e}function $6(e){return typeof e=="function"?e:function(){return e}}const Bp="phrasing",zp=["autolink","link","image","label"];function W6(){return{transforms:[Z6],enter:{literalAutolink:G6,literalAutolinkEmail:Up,literalAutolinkHttp:Up,literalAutolinkWww:Up},exit:{literalAutolink:Q6,literalAutolinkEmail:X6,literalAutolinkHttp:K6,literalAutolinkWww:Y6}}}function V6(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bp,notInConstruct:zp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bp,notInConstruct:zp},{character:":",before:"[ps]",after:"\\/",inConstruct:Bp,notInConstruct:zp}]}}function G6(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Up(e){this.config.enter.autolinkProtocol.call(this,e)}function K6(e){this.config.exit.autolinkProtocol.call(this,e)}function Y6(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function X6(e){this.config.exit.autolinkEmail.call(this,e)}function Q6(e){this.exit(e)}function Z6(e){U6(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,J6],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),e8]],{ignore:["link","linkReference"]})}function J6(e,t,r,a,i){let o="";if(!uT(i)||(/^w/i.test(t)&&(r=t+r,t="",o="http://"),!t8(r)))return!1;const l=r8(r+a);if(!l[0])return!1;const u={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function e8(e,t,r,a){return!uT(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function t8(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function r8(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],a=r.indexOf(")");const i=Iw(e,"(");let o=Iw(e,")");for(;a!==-1&&i>o;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),o++;return[e,r]}function uT(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Eo(r)||jf(r))&&(!t||r!==47)}dT.peek=d8;function n8(){this.buffer()}function a8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function i8(){this.buffer()}function s8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function o8(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=_i(this.sliceSerialize(e)).toLowerCase(),r.label=t}function l8(e){this.exit(e)}function c8(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=_i(this.sliceSerialize(e)).toLowerCase(),r.label=t}function u8(e){this.exit(e)}function d8(){return"["}function dT(e,t,r,a){const i=r.createTracker(a);let o=i.move("[^");const l=r.enter("footnoteReference"),u=r.enter("reference");return o+=i.move(r.safe(r.associationId(e),{after:"]",before:o})),u(),l(),o+=i.move("]"),o}function f8(){return{enter:{gfmFootnoteCallString:n8,gfmFootnoteCall:a8,gfmFootnoteDefinitionLabelString:i8,gfmFootnoteDefinition:s8},exit:{gfmFootnoteCallString:o8,gfmFootnoteCall:l8,gfmFootnoteDefinitionLabelString:c8,gfmFootnoteDefinition:u8}}}function g8(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:dT},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,i,o,l){const u=o.createTracker(l);let d=u.move("[^");const f=o.enter("footnoteDefinition"),g=o.enter("label");return d+=u.move(o.safe(o.associationId(a),{before:d,after:"]"})),g(),d+=u.move("]:"),a.children&&a.children.length>0&&(u.shift(4),d+=u.move((t?`
|
|
62
|
-
`:" ")+o.indentLines(o.containerFlow(a,u.current()),t?fT:p8))),f(),d}}function p8(e,t,r){return t===0?e:fT(e,t,r)}function fT(e,t,r){return(r?"":" ")+e}const h8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];gT.peek=v8;function m8(){return{canContainEols:["delete"],enter:{strikethrough:y8},exit:{strikethrough:b8}}}function x8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:h8}],handlers:{delete:gT}}}function y8(e){this.enter({type:"delete",children:[]},e)}function b8(e){this.exit(e)}function gT(e,t,r,a){const i=r.createTracker(a),o=r.enter("strikethrough");let l=i.move("~~");return l+=r.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),o(),l}function v8(){return"~"}function k8(e){return e.length}function _8(e,t){const r=t||{},a=(r.align||[]).concat(),i=r.stringLength||k8,o=[],l=[],u=[],d=[];let f=0,g=-1;for(;++g<e.length;){const k=[],_=[];let w=-1;for(e[g].length>f&&(f=e[g].length);++w<e[g].length;){const S=w8(e[g][w]);if(r.alignDelimiters!==!1){const E=i(S);_[w]=E,(d[w]===void 0||E>d[w])&&(d[w]=E)}k.push(S)}l[g]=k,u[g]=_}let h=-1;if(typeof a=="object"&&"length"in a)for(;++h<f;)o[h]=Mw(a[h]);else{const k=Mw(a);for(;++h<f;)o[h]=k}h=-1;const m=[],y=[];for(;++h<f;){const k=o[h];let _="",w="";k===99?(_=":",w=":"):k===108?_=":":k===114&&(w=":");let S=r.alignDelimiters===!1?1:Math.max(1,d[h]-_.length-w.length);const E=_+"-".repeat(S)+w;r.alignDelimiters!==!1&&(S=_.length+S+w.length,S>d[h]&&(d[h]=S),y[h]=S),m[h]=E}l.splice(1,0,m),u.splice(1,0,y),g=-1;const v=[];for(;++g<l.length;){const k=l[g],_=u[g];h=-1;const w=[];for(;++h<f;){const S=k[h]||"";let E="",A="";if(r.alignDelimiters!==!1){const T=d[h]-(_[h]||0),C=o[h];C===114?E=" ".repeat(T):C===99?T%2?(E=" ".repeat(T/2+.5),A=" ".repeat(T/2-.5)):(E=" ".repeat(T/2),A=E):A=" ".repeat(T)}r.delimiterStart!==!1&&!h&&w.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&S==="")&&(r.delimiterStart!==!1||h)&&w.push(" "),r.alignDelimiters!==!1&&w.push(E),w.push(S),r.alignDelimiters!==!1&&w.push(A),r.padding!==!1&&w.push(" "),(r.delimiterEnd!==!1||h!==f-1)&&w.push("|")}v.push(r.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return v.join(`
|
|
63
|
-
`)}function w8(e){return e==null?"":String(e)}function Mw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function N8(e,t,r,a){const i=r.enter("blockquote"),o=r.createTracker(a);o.move("> "),o.shift(2);const l=r.indentLines(r.containerFlow(e,o.current()),S8);return i(),l}function S8(e,t,r){return">"+(r?"":" ")+e}function E8(e,t){return Lw(e,t.inConstruct,!0)&&!Lw(e,t.notInConstruct,!1)}function Lw(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function Ow(e,t,r,a){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
64
|
-
`&&E8(r.stack,r.unsafe[i]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
65
|
-
`}function j8(e,t){const r=String(e);let a=r.indexOf(t),i=a,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===i?++o>l&&(l=o):o=1,i=a+t.length,a=r.indexOf(t,i);return l}function C8(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function T8(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function R8(e,t,r,a){const i=T8(r),o=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(C8(e,r)){const h=r.enter("codeIndented"),m=r.indentLines(o,A8);return h(),m}const u=r.createTracker(a),d=i.repeat(Math.max(j8(o,i)+1,3)),f=r.enter("codeFenced");let g=u.move(d);if(e.lang){const h=r.enter(`codeFencedLang${l}`);g+=u.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...u.current()})),h()}if(e.lang&&e.meta){const h=r.enter(`codeFencedMeta${l}`);g+=u.move(" "),g+=u.move(r.safe(e.meta,{before:g,after:`
|
|
66
|
-
`,encode:["`"],...u.current()})),h()}return g+=u.move(`
|
|
67
|
-
`),o&&(g+=u.move(o+`
|
|
68
|
-
`)),g+=u.move(d),f(),g}function A8(e,t,r){return(r?"":" ")+e}function Kv(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function I8(e,t,r,a){const i=Kv(r),o=i==='"'?"Quote":"Apostrophe",l=r.enter("definition");let u=r.enter("label");const d=r.createTracker(a);let f=d.move("[");return f+=d.move(r.safe(r.associationId(e),{before:f,after:"]",...d.current()})),f+=d.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=r.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(r.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=r.enter("destinationRaw"),f+=d.move(r.safe(e.url,{before:f,after:e.title?" ":`
|
|
69
|
-
`,...d.current()}))),u(),e.title&&(u=r.enter(`title${o}`),f+=d.move(" "+i),f+=d.move(r.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),l(),f}function M8(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Jc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function gf(e,t,r){const a=Cl(e),i=Cl(t);return a===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}pT.peek=L8;function pT(e,t,r,a){const i=M8(r),o=r.enter("emphasis"),l=r.createTracker(a),u=l.move(i);let d=l.move(r.containerPhrasing(e,{after:i,before:u,...l.current()}));const f=d.charCodeAt(0),g=gf(a.before.charCodeAt(a.before.length-1),f,i);g.inside&&(d=Jc(f)+d.slice(1));const h=d.charCodeAt(d.length-1),m=gf(a.after.charCodeAt(0),h,i);m.inside&&(d=d.slice(0,-1)+Jc(h));const y=l.move(i);return o(),r.attentionEncodeSurroundingInfo={after:m.outside,before:g.outside},u+d+y}function L8(e,t,r){return r.options.emphasis||"*"}function O8(e,t){let r=!1;return Af(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,Jb}),!!((!e.depth||e.depth<3)&&zv(e)&&(t.options.setext||r))}function D8(e,t,r,a){const i=Math.max(Math.min(6,e.depth||1),1),o=r.createTracker(a);if(O8(e,r)){const g=r.enter("headingSetext"),h=r.enter("phrasing"),m=r.containerPhrasing(e,{...o.current(),before:`
|
|
70
|
-
`,after:`
|
|
71
|
-
`});return h(),g(),m+`
|
|
72
|
-
`+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
|
|
73
|
-
`))+1))}const l="#".repeat(i),u=r.enter("headingAtx"),d=r.enter("phrasing");o.move(l+" ");let f=r.containerPhrasing(e,{before:"# ",after:`
|
|
74
|
-
`,...o.current()});return/^[\t ]/.test(f)&&(f=Jc(f.charCodeAt(0))+f.slice(1)),f=f?l+" "+f:l,r.options.closeAtx&&(f+=" "+l),d(),u(),f}hT.peek=P8;function hT(e){return e.value||""}function P8(){return"<"}mT.peek=F8;function mT(e,t,r,a){const i=Kv(r),o=i==='"'?"Quote":"Apostrophe",l=r.enter("image");let u=r.enter("label");const d=r.createTracker(a);let f=d.move("![");return f+=d.move(r.safe(e.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=r.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(r.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=r.enter("destinationRaw"),f+=d.move(r.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=r.enter(`title${o}`),f+=d.move(" "+i),f+=d.move(r.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),f+=d.move(")"),l(),f}function F8(){return"!"}xT.peek=B8;function xT(e,t,r,a){const i=e.referenceType,o=r.enter("imageReference");let l=r.enter("label");const u=r.createTracker(a);let d=u.move("![");const f=r.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const g=r.stack;r.stack=[],l=r.enter("reference");const h=r.safe(r.associationId(e),{before:d,after:"]",...u.current()});return l(),r.stack=g,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function B8(){return"!"}yT.peek=z8;function yT(e,t,r){let a=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(a);)i+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<r.unsafe.length;){const l=r.unsafe[o],u=r.compilePattern(l);let d;if(l.atBreak)for(;d=u.exec(a);){let f=d.index;a.charCodeAt(f)===10&&a.charCodeAt(f-1)===13&&f--,a=a.slice(0,f)+" "+a.slice(d.index+1)}}return i+a+i}function z8(){return"`"}function bT(e,t){const r=zv(e);return!!(!t.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))}vT.peek=U8;function vT(e,t,r,a){const i=Kv(r),o=i==='"'?"Quote":"Apostrophe",l=r.createTracker(a);let u,d;if(bT(e,r)){const g=r.stack;r.stack=[],u=r.enter("autolink");let h=l.move("<");return h+=l.move(r.containerPhrasing(e,{before:h,after:">",...l.current()})),h+=l.move(">"),u(),r.stack=g,h}u=r.enter("link"),d=r.enter("label");let f=l.move("[");return f+=l.move(r.containerPhrasing(e,{before:f,after:"](",...l.current()})),f+=l.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),f+=l.move("<"),f+=l.move(r.safe(e.url,{before:f,after:">",...l.current()})),f+=l.move(">")):(d=r.enter("destinationRaw"),f+=l.move(r.safe(e.url,{before:f,after:e.title?" ":")",...l.current()}))),d(),e.title&&(d=r.enter(`title${o}`),f+=l.move(" "+i),f+=l.move(r.safe(e.title,{before:f,after:i,...l.current()})),f+=l.move(i),d()),f+=l.move(")"),u(),f}function U8(e,t,r){return bT(e,r)?"<":"["}kT.peek=q8;function kT(e,t,r,a){const i=e.referenceType,o=r.enter("linkReference");let l=r.enter("label");const u=r.createTracker(a);let d=u.move("[");const f=r.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const g=r.stack;r.stack=[],l=r.enter("reference");const h=r.safe(r.associationId(e),{before:d,after:"]",...u.current()});return l(),r.stack=g,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function q8(){return"["}function Yv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function H8(e){const t=Yv(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function $8(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function _T(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function W8(e,t,r,a){const i=r.enter("list"),o=r.bulletCurrent;let l=e.ordered?$8(r):Yv(r);const u=e.ordered?l==="."?")":".":H8(r);let d=t&&r.bulletLastUsed?l===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&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&&(d=!0),_T(r)===l&&g){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(l=u),r.bulletCurrent=l;const f=r.containerFlow(e,a);return r.bulletLastUsed=l,r.bulletCurrent=o,i(),f}function V8(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function G8(e,t,r,a){const i=V8(r);let o=r.bulletCurrent||Yv(r);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=r.createTracker(a);u.move(o+" ".repeat(l-o.length)),u.shift(l);const d=r.enter("listItem"),f=r.indentLines(r.containerFlow(e,u.current()),g);return d(),f;function g(h,m,y){return m?(y?"":" ".repeat(l))+h:(y?o:o+" ".repeat(l-o.length))+h}}function K8(e,t,r,a){const i=r.enter("paragraph"),o=r.enter("phrasing"),l=r.containerPhrasing(e,a);return o(),i(),l}const Y8=lu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function X8(e,t,r,a){return(e.children.some(function(l){return Y8(l)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function Q8(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}wT.peek=Z8;function wT(e,t,r,a){const i=Q8(r),o=r.enter("strong"),l=r.createTracker(a),u=l.move(i+i);let d=l.move(r.containerPhrasing(e,{after:i,before:u,...l.current()}));const f=d.charCodeAt(0),g=gf(a.before.charCodeAt(a.before.length-1),f,i);g.inside&&(d=Jc(f)+d.slice(1));const h=d.charCodeAt(d.length-1),m=gf(a.after.charCodeAt(0),h,i);m.inside&&(d=d.slice(0,-1)+Jc(h));const y=l.move(i+i);return o(),r.attentionEncodeSurroundingInfo={after:m.outside,before:g.outside},u+d+y}function Z8(e,t,r){return r.options.strong||"*"}function J8(e,t,r,a){return r.safe(e.value,a)}function e7(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function t7(e,t,r){const a=(_T(r)+(r.options.ruleSpaces?" ":"")).repeat(e7(r));return r.options.ruleSpaces?a.slice(0,-1):a}const NT={blockquote:N8,break:Ow,code:R8,definition:I8,emphasis:pT,hardBreak:Ow,heading:D8,html:hT,image:mT,imageReference:xT,inlineCode:yT,link:vT,linkReference:kT,list:W8,listItem:G8,paragraph:K8,root:X8,strong:wT,text:J8,thematicBreak:t7};function r7(){return{enter:{table:n7,tableData:Dw,tableHeader:Dw,tableRow:i7},exit:{codeText:s7,table:a7,tableData:qp,tableHeader:qp,tableRow:qp}}}function n7(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function a7(e){this.exit(e),this.data.inTable=void 0}function i7(e){this.enter({type:"tableRow",children:[]},e)}function qp(e){this.exit(e)}function Dw(e){this.enter({type:"tableCell",children:[]},e)}function s7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,o7));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function o7(e,t){return t==="|"?t:e}function l7(e){const t=e||{},r=t.tableCellPadding,a=t.tablePipeAlign,i=t.stringLength,o=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
75
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:l,tableCell:d,tableRow:u}};function l(y,v,k,_){return f(g(y,k,_),y.align)}function u(y,v,k,_){const w=h(y,k,_),S=f([w]);return S.slice(0,S.indexOf(`
|
|
76
|
-
`))}function d(y,v,k,_){const w=k.enter("tableCell"),S=k.enter("phrasing"),E=k.containerPhrasing(y,{..._,before:o,after:o});return S(),w(),E}function f(y,v){return _8(y,{align:v,alignDelimiters:a,padding:r,stringLength:i})}function g(y,v,k){const _=y.children;let w=-1;const S=[],E=v.enter("table");for(;++w<_.length;)S[w]=h(_[w],v,k);return E(),S}function h(y,v,k){const _=y.children;let w=-1;const S=[],E=v.enter("tableRow");for(;++w<_.length;)S[w]=d(_[w],y,v,k);return E(),S}function m(y,v,k){let _=NT.inlineCode(y,v,k);return k.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function c7(){return{exit:{taskListCheckValueChecked:Pw,taskListCheckValueUnchecked:Pw,paragraph:d7}}}function u7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:f7}}}function Pw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function d7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const a=r.children[0];if(a&&a.type==="text"){const i=t.children;let o=-1,l;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){l=u;break}}l===r&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function f7(e,t,r,a){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=r.createTracker(a);o&&u.move(l);let d=NT.listItem(e,t,r,{...a,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(g){return g+l}}function g7(){return[W6(),f8(),m8(),r7(),c7()]}function p7(e){return{extensions:[V6(),g8(e),x8(),l7(e),u7()]}}const h7={tokenize:k7,partial:!0},ST={tokenize:_7,partial:!0},ET={tokenize:w7,partial:!0},jT={tokenize:N7,partial:!0},m7={tokenize:S7,partial:!0},CT={name:"wwwAutolink",tokenize:b7,previous:RT},TT={name:"protocolAutolink",tokenize:v7,previous:AT},fs={name:"emailAutolink",tokenize:y7,previous:IT},Gi={};function x7(){return{text:Gi}}let ho=48;for(;ho<123;)Gi[ho]=fs,ho++,ho===58?ho=65:ho===91&&(ho=97);Gi[43]=fs;Gi[45]=fs;Gi[46]=fs;Gi[95]=fs;Gi[72]=[fs,TT];Gi[104]=[fs,TT];Gi[87]=[fs,CT];Gi[119]=[fs,CT];function y7(e,t,r){const a=this;let i,o;return l;function l(h){return!nv(h)||!IT.call(a,a.previous)||Xv(a.events)?r(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return nv(h)?(e.consume(h),u):h===64?(e.consume(h),d):r(h)}function d(h){return h===46?e.check(m7,g,f)(h):h===45||h===95||Kn(h)?(o=!0,e.consume(h),d):g(h)}function f(h){return e.consume(h),i=!0,d}function g(h){return o&&i&&oa(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):r(h)}}function b7(e,t,r){const a=this;return i;function i(l){return l!==87&&l!==119||!RT.call(a,a.previous)||Xv(a.events)?r(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(h7,e.attempt(ST,e.attempt(ET,o),r),r)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function v7(e,t,r){const a=this;let i="",o=!1;return l;function l(h){return(h===72||h===104)&&AT.call(a,a.previous)&&!Xv(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):r(h)}function u(h){if(oa(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(h),d}return r(h)}function d(h){return h===47?(e.consume(h),o?f:(o=!0,d)):r(h)}function f(h){return h===null||uf(h)||$r(h)||Eo(h)||jf(h)?r(h):e.attempt(ST,e.attempt(ET,g),r)(h)}function g(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function k7(e,t,r){let a=0;return i;function i(l){return(l===87||l===119)&&a<3?(a++,e.consume(l),i):l===46&&a===3?(e.consume(l),o):r(l)}function o(l){return l===null?r(l):t(l)}}function _7(e,t,r){let a,i,o;return l;function l(f){return f===46||f===95?e.check(jT,d,u)(f):f===null||$r(f)||Eo(f)||f!==45&&jf(f)?d(f):(o=!0,e.consume(f),l)}function u(f){return f===95?a=!0:(i=a,a=void 0),e.consume(f),l}function d(f){return i||a||!o?r(f):t(f)}}function w7(e,t){let r=0,a=0;return i;function i(l){return l===40?(r++,e.consume(l),i):l===41&&a<r?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(jT,t,o)(l):l===null||$r(l)||Eo(l)?t(l):(e.consume(l),i)}function o(l){return l===41&&a++,e.consume(l),i}}function N7(e,t,r){return a;function a(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),a):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||$r(u)||Eo(u)?t(u):r(u)}function i(u){return u===null||u===40||u===91||$r(u)||Eo(u)?t(u):a(u)}function o(u){return oa(u)?l(u):r(u)}function l(u){return u===59?(e.consume(u),a):oa(u)?(e.consume(u),l):r(u)}}function S7(e,t,r){return a;function a(o){return e.consume(o),i}function i(o){return Kn(o)?r(o):t(o)}}function RT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||$r(e)}function AT(e){return!oa(e)}function IT(e){return!(e===47||nv(e))}function nv(e){return e===43||e===45||e===46||e===95||Kn(e)}function Xv(e){let t=e.length,r=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const E7={tokenize:L7,partial:!0};function j7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:A7,continuation:{tokenize:I7},exit:M7}},text:{91:{name:"gfmFootnoteCall",tokenize:R7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:C7,resolveTo:T7}}}}function C7(e,t,r){const a=this;let i=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l;for(;i--;){const d=a.events[i][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return u;function u(d){if(!l||!l._balanced)return r(d);const f=_i(a.sliceSerialize({start:l.end,end:a.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function T7(e,t){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 a={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[r+1],e[r+2],["enter",a,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(r,e.length-r+1,...u),e}function R7(e,t,r){const a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,l;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),d}function d(h){return h!==94?r(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(h){if(o>999||h===93&&!l||h===null||h===91||$r(h))return r(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(_i(a.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(h)}return $r(h)||(l=!0),o++,e.consume(h),h===92?g:f}function g(h){return h===91||h===92||h===93?(e.consume(h),o++,f):f(h)}}function A7(e,t,r){const a=this,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,l=0,u;return d;function d(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(v)}function g(v){if(l>999||v===93&&!u||v===null||v===91||$r(v))return r(v);if(v===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=_i(a.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return $r(v)||(u=!0),l++,e.consume(v),v===92?h:g}function h(v){return v===91||v===92||v===93?(e.consume(v),l++,g):g(v)}function m(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),i.includes(o)||i.push(o),kr(e,y,"gfmFootnoteDefinitionWhitespace")):r(v)}function y(v){return t(v)}}function I7(e,t,r){return e.check(ou,t,e.attempt(E7,t,r))}function M7(e){e.exit("gfmFootnoteDefinition")}function L7(e,t,r){const a=this;return kr(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=a.events[a.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):r(o)}}function O7(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:i};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function i(l,u){let d=-1;for(;++d<l.length;)if(l[d][0]==="enter"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._close){let f=d;for(;f--;)if(l[f][0]==="exit"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._open&&l[d][1].end.offset-l[d][1].start.offset===l[f][1].end.offset-l[f][1].start.offset){l[d][1].type="strikethroughSequence",l[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},l[f][1].start),end:Object.assign({},l[d][1].end)},h={type:"strikethroughText",start:Object.assign({},l[f][1].end),end:Object.assign({},l[d][1].start)},m=[["enter",g,u],["enter",l[f][1],u],["exit",l[f][1],u],["enter",h,u]],y=u.parser.constructs.insideSpan.null;y&&Pa(m,m.length,0,Cf(y,l.slice(f+1,d),u)),Pa(m,m.length,0,[["exit",h,u],["enter",l[d][1],u],["exit",l[d][1],u],["exit",g,u]]),Pa(l,f-1,d-f+3,m),d=f+m.length-2;break}}for(d=-1;++d<l.length;)l[d][1].type==="strikethroughSequenceTemporary"&&(l[d][1].type="data");return l}function o(l,u,d){const f=this.previous,g=this.events;let h=0;return m;function m(v){return f===126&&g[g.length-1][1].type!=="characterEscape"?d(v):(l.enter("strikethroughSequenceTemporary"),y(v))}function y(v){const k=Cl(f);if(v===126)return h>1?d(v):(l.consume(v),h++,y);if(h<2&&!r)return d(v);const _=l.exit("strikethroughSequenceTemporary"),w=Cl(v);return _._open=!w||w===2&&!!k,_._close=!k||k===2&&!!w,u(v)}}}class D7{constructor(){this.map=[],this.index=new Map}add(t,r,a){P7(this,t,r,a)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let r=this.map.length;const a=[];for(;r>0;)r-=1,a.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];a.push(t.slice()),t.length=0;let i=a.pop();for(;i;){for(const o of i)t.push(o);i=a.pop()}this.map.length=0,this.index.clear()}}function P7(e,t,r,a){if(r===0&&a.length===0)return;const i=e.index.get(t);if(i){i[1]+=r,i[2].push(...a);return}const o=[t,r,a];e.map.push(o),e.index.set(t,o)}function F7(e,t){let r=!1;const a=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return a}function B7(){return{flow:{null:{name:"table",tokenize:z7,resolveAll:U7}}}}function z7(e,t,r){const a=this;let i=0,o=0,l;return u;function u(I){let B=a.events.length-1;for(;B>-1;){const{type:$}=a.events[B][1];if($==="lineEnding"||$==="linePrefix")B--;else break}const z=B>-1?a.events[B][1].type:null,ee=z==="tableHead"||z==="tableRow"?C:d;return ee===C&&a.parser.lazy[a.now().line]?r(I):ee(I)}function d(I){return e.enter("tableHead"),e.enter("tableRow"),f(I)}function f(I){return I===124||(l=!0,o+=1),g(I)}function g(I){return I===null?r(I):qt(I)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),y):r(I):gr(I)?kr(e,g,"whitespace")(I):(o+=1,l&&(l=!1,i+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),l=!0,g):(e.enter("data"),h(I)))}function h(I){return I===null||I===124||$r(I)?(e.exit("data"),g(I)):(e.consume(I),I===92?m:h)}function m(I){return I===92||I===124?(e.consume(I),h):h(I)}function y(I){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(I):(e.enter("tableDelimiterRow"),l=!1,gr(I)?kr(e,v,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):v(I))}function v(I){return I===45||I===58?_(I):I===124?(l=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),k):T(I)}function k(I){return gr(I)?kr(e,_,"whitespace")(I):_(I)}function _(I){return I===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),w):I===45?(o+=1,w(I)):I===null||qt(I)?A(I):T(I)}function w(I){return I===45?(e.enter("tableDelimiterFiller"),S(I)):T(I)}function S(I){return I===45?(e.consume(I),S):I===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return gr(I)?kr(e,A,"whitespace")(I):A(I)}function A(I){return I===124?v(I):I===null||qt(I)?!l||i!==o?T(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):T(I)}function T(I){return r(I)}function C(I){return e.enter("tableRow"),j(I)}function j(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),j):I===null||qt(I)?(e.exit("tableRow"),t(I)):gr(I)?kr(e,j,"whitespace")(I):(e.enter("data"),L(I))}function L(I){return I===null||I===124||$r(I)?(e.exit("data"),j(I)):(e.consume(I),I===92?O:L)}function O(I){return I===92||I===124?(e.consume(I),L):L(I)}}function U7(e,t){let r=-1,a=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,d=0,f,g,h;const m=new D7;for(;++r<e.length;){const y=e[r],v=y[1];y[0]==="enter"?v.type==="tableHead"?(u=!1,d!==0&&(Fw(m,t,d,f,g),g=void 0,d=0),f={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},m.add(r,0,[["enter",f,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(a=!0,h=void 0,o=[0,0,0,0],l=[0,r+1,0,0],u&&(u=!1,g={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},m.add(r,0,[["enter",g,t]])),i=v.type==="tableDelimiterRow"?2:g?3:1):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(a=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],h=Ld(m,t,o,i,void 0,h),o=[0,0,0,0]),l[2]=r)):v.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(l[0]=l[1],h=Ld(m,t,o,i,void 0,h)),o=l,l=[o[1],r,0,0])):v.type==="tableHead"?(u=!0,d=r):v.type==="tableRow"||v.type==="tableDelimiterRow"?(d=r,o[1]!==0?(l[0]=l[1],h=Ld(m,t,o,i,r,h)):l[1]!==0&&(h=Ld(m,t,l,i,r,h)),i=0):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(l[3]=r)}for(d!==0&&Fw(m,t,d,f,g),m.consume(t.events),r=-1;++r<t.events.length;){const y=t.events[r];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=F7(t.events,r))}return e}function Ld(e,t,r,a,i,o){const l=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",u="tableContent";r[0]!==0&&(o.end=Object.assign({},ml(t.events,r[0])),e.add(r[0],0,[["exit",o,t]]));const d=ml(t.events,r[1]);if(o={type:l,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",o,t]]),r[2]!==0){const f=ml(t.events,r[2]),g=ml(t.events,r[3]),h={type:u,start:Object.assign({},f),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",h,t]]),a!==2){const m=t.events[r[2]],y=t.events[r[3]];if(m[1].end=Object.assign({},y[1].end),m[1].type="chunkText",m[1].contentType="text",r[3]>r[2]+1){const v=r[2]+1,k=r[3]-r[2]-1;e.add(v,k,[])}}e.add(r[3]+1,0,[["exit",h,t]])}return i!==void 0&&(o.end=Object.assign({},ml(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Fw(e,t,r,a,i){const o=[],l=ml(t.events,r);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),a.end=Object.assign({},l),o.push(["exit",a,t]),e.add(r+1,0,o)}function ml(e,t){const r=e[t],a=r[0]==="enter"?"start":"end";return r[1][a]}const q7={name:"tasklistCheck",tokenize:$7};function H7(){return{text:{91:q7}}}function $7(e,t,r){const a=this;return i;function i(d){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return $r(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),l):r(d)}function l(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):r(d)}function u(d){return qt(d)?t(d):gr(d)?e.check({tokenize:W7},t,r)(d):r(d)}}function W7(e,t,r){return kr(e,a,"whitespace");function a(i){return i===null?r(i):t(i)}}function V7(e){return q5([x7(),j7(),O7(e),B7(),H7()])}const G7={};function El(e){const t=this,r=e||G7,a=t.data(),i=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);i.push(V7(r)),o.push(g7()),l.push(p7(r))}const Bw=(function(e,t,r){const a=lu(r);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(a(e.children[t],t,e))return e.children[t]}),Ao=(function(e){if(e==null)return X7;if(typeof e=="string")return Y7(e);if(typeof e=="object")return K7(e);if(typeof e=="function")return Qv(e);throw new Error("Expected function, string, or array as `test`")});function K7(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Ao(e[r]);return Qv(a);function a(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function Y7(e){return Qv(t);function t(r){return r.tagName===e}}function Qv(e){return t;function t(r,a,i){return!!(Q7(r)&&e.call(this,r,typeof a=="number"?a:void 0,i||void 0))}}function X7(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function Q7(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const zw=/\n/g,Uw=/[\t ]+/g,av=Ao("br"),qw=Ao(i9),Z7=Ao("p"),Hw=Ao("tr"),J7=Ao(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",a9,s9]),MT=Ao(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function e9(e,t){const r=t||{},a="children"in e?e.children:[],i=MT(e),o=DT(e,{whitespace:r.whitespace||"normal"}),l=[];(e.type==="text"||e.type==="comment")&&l.push(...OT(e,{breakBefore:!0,breakAfter:!0}));let u=-1;for(;++u<a.length;)l.push(...LT(a[u],e,{whitespace:o,breakBefore:u?void 0:i,breakAfter:u<a.length-1?av(a[u+1]):i}));const d=[];let f;for(u=-1;++u<l.length;){const g=l[u];typeof g=="number"?f!==void 0&&g>f&&(f=g):g&&(f!==void 0&&f>-1&&d.push(`
|
|
77
|
-
`.repeat(f)||" "),f=-1,d.push(g))}return d.join("")}function LT(e,t,r){return e.type==="element"?t9(e,t,r):e.type==="text"?r.whitespace==="normal"?OT(e,r):r9(e):[]}function t9(e,t,r){const a=DT(e,r),i=e.children||[];let o=-1,l=[];if(J7(e))return l;let u,d;for(av(e)||Hw(e)&&Bw(t,e,Hw)?d=`
|
|
78
|
-
`:Z7(e)?(u=2,d=2):MT(e)&&(u=1,d=1);++o<i.length;)l=l.concat(LT(i[o],e,{whitespace:a,breakBefore:o?void 0:u,breakAfter:o<i.length-1?av(i[o+1]):d}));return qw(e)&&Bw(t,e,qw)&&l.push(" "),u&&l.unshift(u),d&&l.push(d),l}function OT(e,t){const r=String(e.value),a=[],i=[];let o=0;for(;o<=r.length;){zw.lastIndex=o;const d=zw.exec(r),f=d&&"index"in d?d.index:r.length;a.push(n9(r.slice(o,f).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),o===0?t.breakBefore:!0,f===r.length?t.breakAfter:!0)),o=f+1}let l=-1,u;for(;++l<a.length;)a[l].charCodeAt(a[l].length-1)===8203||l<a.length-1&&a[l+1].charCodeAt(0)===8203?(i.push(a[l]),u=void 0):a[l]?(typeof u=="number"&&i.push(u),i.push(a[l]),u=0):(l===0||l===a.length-1)&&i.push(0);return i}function r9(e){return[String(e.value)]}function n9(e,t,r){const a=[];let i=0,o;for(;i<e.length;){Uw.lastIndex=i;const l=Uw.exec(e);o=l?l.index:e.length,!i&&!o&&l&&!t&&a.push(""),i!==o&&a.push(e.slice(i,o)),i=l?o+l[0].length:o}return i!==o&&!r&&a.push(""),a.join(" ")}function DT(e,t){if(e.type==="element"){const r=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function a9(e){return!!(e.properties||{}).hidden}function i9(e){return e.tagName==="td"||e.tagName==="th"}function s9(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function o9(e){const t=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+a+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},y=t.optional(i)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],A={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},C=[T,h,u,r,e.C_BLOCK_COMMENT_MODE,g,f],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:A,contains:C.concat([{begin:/\(/,end:/\)/,keywords:A,contains:C.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:A,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:A,relevance:0},{begin:y,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,f,g,u,{begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,f,g,u]}]},u,r,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:A,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(j,L,T,C,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:A,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:A},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function l9(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},r=o9(e),a=r.keywords;return a.type=[...a.type,...t.type],a.literal=[...a.literal,...t.literal],a.built_in=[...a.built_in,...t.built_in],a._hints=t._hints,r.name="Arduino",r.aliases=["ino"],r.supersetOf="cpp",r}function c9(e){const t=e.regex,r={},a={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[r]}]};Object.assign(r,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},u={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,r,i]};i.contains.push(u);const d={match:/\\"/},f={className:"string",begin:/'/,end:/'/},g={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,r]},m=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],y=e.SHEBANG({binary:`(${m.join("|")})`,relevance:10}),v={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},k=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],_=["true","false"],w={match:/(\/[a-z._-]+)+/},S=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],A=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],T=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:k,literal:_,built_in:[...S,...E,"set","shopt",...A,...T]},contains:[y,e.SHEBANG(),v,h,o,l,w,u,d,f,g,r]}}function u9(e){const t=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="("+a+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},y=t.optional(i)+e.IDENT_RE+"\\s*\\(",_={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},w=[h,u,r,e.C_BLOCK_COMMENT_MODE,g,f],S={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:w.concat([{begin:/\(/,end:/\)/,keywords:_,contains:w.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:_,relevance:0},{begin:y,returnBegin:!0,contains:[e.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,f,g,u,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,f,g,u]}]},u,r,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"</",contains:[].concat(S,E,w,[h,{begin:e.IDENT_RE+"::",keywords:_},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:h,strings:f,keywords:_}}}function d9(e){const t=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+a+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},y=t.optional(i)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],A={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},C=[T,h,u,r,e.C_BLOCK_COMMENT_MODE,g,f],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:A,contains:C.concat([{begin:/\(/,end:/\)/,keywords:A,contains:C.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+l+"[\\*&\\s]+)+"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:A,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:A,relevance:0},{begin:y,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,f,g,u,{begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,f,g,u]}]},u,r,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:A,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(j,L,T,C,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:A,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:A},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function f9(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],r=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],a=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],l={keyword:i.concat(o),built_in:t,literal:a},u=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9'_]+|(\\b[\\d'_]+(\\.[\\d'_]*)?|\\.[\\d'_]+)([eE][-+]?[\\d'_]+)?)"}],relevance:0},f={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},h=e.inherit(g,{illegal:/\n/}),m={className:"subst",begin:/\{/,end:/\}/,keywords:l},y=e.inherit(m,{illegal:/\n/}),v={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,y]},k={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},_=e.inherit(k,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]});m.contains=[k,v,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.C_BLOCK_COMMENT_MODE],y.contains=[_,v,h,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const w={variants:[f,k,v,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},S={begin:"<",end:">",contains:[{beginKeywords:"in out"},u]},E=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",A={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:l,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},w,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},u,S,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[u,S,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+E+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:l,contains:[{beginKeywords:r.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,S],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,relevance:0,contains:[w,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},A]}}const g9=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),p9=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],h9=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],m9=[...p9,...h9],x9=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),y9=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),b9=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),v9=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function k9(e){const t=e.regex,r=g9(e),a={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",u=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[r.BLOCK_COMMENT,a,r.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+y9.join("|")+")"},{begin:":(:)?("+b9.join("|")+")"}]},r.CSS_VARIABLE,{className:"attribute",begin:"\\b("+v9.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,r.UNICODE_RANGE,...u,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...u,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:x9.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...u,r.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+m9.join("|")+")\\b"}]}}function _9(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+,\d+ +\+\d+ +@@/,/^@@ +-\d+ +\+\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function w9(e){const o={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:o,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:o,illegal:/["']/}]}]}}function N9(e){const t=e.regex,r=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(r,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function S9(e){const t=e.regex,r={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},a=e.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},u={begin:/\[/,end:/\]/,contains:[a,o,i,l,r,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,f=/"(\\"|[^"])*"/,g=/'[^']*'/,h=t.either(d,f,g),m=t.concat(h,"(\\s*\\.\\s*",h,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[a,u,o,i,l,r]}}]}}var xl="[0-9](_*[0-9])*",Od=`\\.(${xl})`,Dd="[0-9a-fA-F](_*[0-9a-fA-F])*",$w={className:"number",variants:[{begin:`(\\b(${xl})((${Od})|\\.)?|(${Od}))[eE][+-]?(${xl})[fFdD]?\\b`},{begin:`\\b(${xl})((${Od})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Od})[fFdD]?\\b`},{begin:`\\b(${xl})[fFdD]\\b`},{begin:`\\b0[xX]((${Dd})\\.?|(${Dd})?\\.(${Dd}))[pP][+-]?(${xl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Dd})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function PT(e,t,r){return r===-1?"":e.replace(t,a=>PT(e,t,r-1))}function E9(e){const t=e.regex,r="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",a=r+PT("(?:<"+r+"~~~(?:\\s*,\\s*"+r+"~~~)*>)?",/~~~/g,2),d={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},f={className:"meta",begin:"@"+r,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},g={className:"params",begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:d,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,r),/\s+/,r,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,r],className:{1:"keyword",3:"title.class"},contains:[g,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:d,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,$w,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},$w,f]}}const Ww="[A-Za-z$_][0-9A-Za-z$_]*",j9=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],C9=["true","false","null","undefined","NaN","Infinity"],FT=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],BT=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],zT=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],T9=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],R9=[].concat(zT,FT,BT);function A9(e){const t=e.regex,r=(X,{after:ie})=>{const F="</"+X[0].slice(1);return X.input.indexOf(F,ie)!==-1},a=Ww,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,ie)=>{const F=X[0].length+X.index,U=X.input[F];if(U==="<"||U===","){ie.ignoreMatch();return}U===">"&&(r(X,{after:F})||ie.ignoreMatch());let Z;const P=X.input.substring(F);if(Z=P.match(/^\s*=/)){ie.ignoreMatch();return}if((Z=P.match(/^\s+extends\s+/))&&Z.index===0){ie.ignoreMatch();return}}},u={$pattern:Ww,keyword:j9,literal:C9,built_in:R9,"variable.language":T9},d="[0-9](_?[0-9])*",f=`\\.(${d})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${d})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:u,contains:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},S={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:a+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,{match:/\$\d+/},h];m.contains=E.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(E)});const A=[].concat(S,m.contains),T=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(A)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},j={variants:[{match:[/class/,/\s+/,a,/\s+/,/extends/,/\s+/,t.concat(a,"(",t.concat(/\./,a),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,a],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...FT,...BT]}},O={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(X){return t.concat("(?!",X.join("|"),")")}const ee={match:t.concat(/\b/,z([...zT,"super","import","await"].map(X=>`${X}\\s*\\(`)),a,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},$={begin:t.concat(/\./,t.lookahead(t.concat(a,/(?![0-9A-Za-z$_(])/))),end:a,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},G="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",Y={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(G)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:L},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),O,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,S,{match:/\$\d+/},h,L,{scope:"attr",match:a+t.lookahead(":"),relevance:0},Y,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[S,e.REGEXP_MODE,{className:"function",begin:G,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,e.inherit(e.TITLE_MODE,{begin:a,className:"title.function"})]},{match:/\.\.\./,relevance:0},$,{match:"\\$"+a,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},ee,B,j,M,{match:/\$[(.]/}]}}const I9="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",M9={scope:"number",match:I9,relevance:0};function L9(e){const t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},r={match:/[{}[\],:]/,className:"punctuation",relevance:0},a=["true","false","null"],i={scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",aliases:["jsonc","json5"],keywords:{literal:a},contains:[t,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,M9,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var yl="[0-9](_*[0-9])*",Pd=`\\.(${yl})`,Fd="[0-9a-fA-F](_*[0-9a-fA-F])*",O9={className:"number",variants:[{begin:`(\\b(${yl})((${Pd})|\\.)?|(${Pd}))[eE][+-]?(${yl})[fFdD]?\\b`},{begin:`\\b(${yl})((${Pd})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Pd})[fFdD]?\\b`},{begin:`\\b(${yl})[fFdD]\\b`},{begin:`\\b0[xX]((${Fd})\\.?|(${Fd})?\\.(${Fd}))[pP][+-]?(${yl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Fd})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function D9(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},r={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},a={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},l={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(l);const u={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},d={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(l,{className:"string"}),"self"]}]},f=O9,g=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),h={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=h;return m.variants[1].contains=[h],h.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,g,r,a,u,d,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[h,e.C_LINE_COMMENT_MODE,g],relevance:0},e.C_LINE_COMMENT_MODE,g,u,d,l,e.C_NUMBER_MODE]},g]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},u,d]},l,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
79
|
-
`},f]}}const P9=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),F9=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],B9=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],z9=[...F9,...B9],U9=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),UT=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),qT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),q9=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),H9=UT.concat(qT).sort().reverse();function $9(e){const t=P9(e),r=H9,a="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",l=[],u=[],d=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},f=function(E,A,T){return{className:E,begin:A,relevance:T}},g={$pattern:/[a-z-]+/,keyword:a,attribute:U9.join(" ")},h={begin:"\\(",end:"\\)",contains:u,keywords:g,relevance:0};u.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d("'"),d('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.UNICODE_RANGE,t.HEXCOLOR,h,f("variable","@@?"+i,10),f("variable","@\\{"+i+"\\}"),f("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const m=u.concat({begin:/\{/,end:/\}/,contains:l}),y={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(u)},v={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+q9.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:u}}]},k={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:g,returnEnd:!0,contains:u,relevance:0}},_={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:m}},w={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,y,f("keyword","all\\b"),f("variable","@\\{"+i+"\\}"),{begin:"\\b("+z9.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,f("selector-tag",o,0),f("selector-id","#"+o),f("selector-class","\\."+o,0),f("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+UT.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+qT.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},S={begin:i+`:(:)?(${r.join("|")})`,returnBegin:!0,contains:[w]};return l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,k,_,S,v,w,y,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:l}}function W9(e){const t="\\[=*\\[",r="\\]=*\\]",a={begin:t,end:r,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,r,{contains:[a],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:r,contains:[a],relevance:5}])}}function V9(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},r={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},a={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,r]},i={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},l={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,r,a,i,o,l]}}function G9(e){const t=e.regex,r={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},a={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},l={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},u=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,u,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=e.inherit(f,{contains:[]}),m=e.inherit(g,{contains:[]});f.contains.push(m),g.contains.push(h);let y=[r,d];return[f,g,h,m].forEach(w=>{w.contains=w.contains.concat(y)}),y=y.concat(f,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:y},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:y}]}]},r,o,f,g,{className:"quote",begin:"^>\\s+",contains:y,end:"$"},i,a,d,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function K9(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r=/[a-zA-Z@][a-zA-Z0-9_]*/,u={"variable.language":["this","super"],$pattern:r,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},d={$pattern:r,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:u,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+d.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:d,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function Y9(e){const t=e.regex,r=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],a=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:r.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},l={begin:/->\{/,end:/\}/},u={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[u]},f={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[e.BACKSLASH_ESCAPE,o,d],h=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(k,_,w="\\1")=>{const S=w==="\\1"?w:t.concat(w,_);return t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,S,/(?:\\.|[^\\\/])*?/,w,a)},y=(k,_,w)=>t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,w,a),v=[d,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),l,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},f,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:m("s|tr|y",t.either(...h,{capture:!0}))},{begin:m("s|tr|y","\\(","\\)")},{begin:m("s|tr|y","\\[","\\]")},{begin:m("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:y("(?:m|qr)?",/\//,/\//)},{begin:y("m|qr",t.either(...h,{capture:!0}),/\1/)},{begin:y("m|qr",/\(/,/\)/)},{begin:y("m|qr",/\[/,/\]/)},{begin:y("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,u]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,u,f]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=v,l.contains=v,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:v}}function X9(e){const t=e.regex,r=/(?![A-Za-z0-9])(?![$])/,a=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,r),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,r),o=t.concat(/[A-Z]+/,r),l={scope:"variable",match:"\\$+"+a},u={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},f=e.inherit(e.APOS_STRING_MODE,{illegal:null}),g=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(d)}),h={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(d),"on:begin":($,M)=>{M.data._beginMatch=$[1]||$[2]},"on:end":($,M)=>{M.data._beginMatch!==$[1]&&M.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),y=`[
|
|
80
|
-
]`,v={scope:"string",variants:[g,f,h,m]},k={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},_=["false","null","true"],w=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],S=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],A={keyword:w,literal:($=>{const M=[];return $.forEach(G=>{M.push(G),G.toLowerCase()===G?M.push(G.toUpperCase()):M.push(G.toLowerCase())}),M})(_),built_in:S},T=$=>$.map(M=>M.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,t.concat(y,"+"),t.concat("(?!",T(S).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},j=t.concat(a,"\\b(?!\\()"),L={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),j],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),j],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},O={scope:"attr",match:t.concat(a,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:A,contains:[O,l,L,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,C]},B={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",T(w).join("\\b|"),"|",T(S).join("\\b|"),"\\b)"),a,t.concat(y,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(B);const z=[O,L,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,C],ee={begin:t.concat(/#\[\s*\\?/,t.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]},contains:["self",...z]},...z,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:A,contains:[ee,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},u,{scope:"variable.language",match:/\$this\b/},l,B,L,{match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},C,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:A,contains:["self",ee,l,L,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},v,k]}}function Q9(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function Z9(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function J9(e){const t=e.regex,r=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],u={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:u,illegal:/#/},g={begin:/\{\{/,relevance:0},h={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,d,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,d,g,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",y=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,v=`\\b|${a.join("|")}`,k={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${y}))[eE][+-]?(${m})[jJ]?(?=${v})`},{begin:`(${y})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${v})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${v})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${v})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${v})`},{begin:`\\b(${m})[jJ](?=${v})`}]},_={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:u,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},w={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:["self",d,k,h,e.HASH_COMMENT_MODE]}]};return f.contains=[h,k,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:u,illegal:/(<\/|\?)|=>/,contains:[d,k,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[w]},{variants:[{match:[/\bclass/,/\s+/,r,/\s*/,/\(\s*/,r,/\s*\)/]},{match:[/\bclass/,/\s+/,r]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[k,w,h]}]}}function eF(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function tF(e){const t=e.regex,r=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:r,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:r},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,a]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[o,a]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"},match:[r,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function rF(e){const t=e.regex,r="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(a,/(::\w+)*/),l={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},u={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},f=[e.COMMENT("#","$",{contains:[u]}),e.COMMENT("^=begin","^=end",{contains:[u],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:l},h={className:"string",contains:[e.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,g]})]}]},m="[1-9](_?[0-9])*|0",y="[0-9](_?[0-9])*",v={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${y}))?([eE][+-]?(${y})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},k={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:l}]},C=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:l},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{match:[/def/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[k]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:r}],relevance:0},v,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:l},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(d,f),relevance:0}].concat(d,f);g.contains=C,k.contains=C;const I=[{begin:/^\s*=>/,starts:{end:"$",contains:C}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:C}}];return f.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:l,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(I).concat(f).concat(C)}}function nF(e){const t=e.regex,r=/(r#)?/,a=t.concat(r,e.UNDERSCORE_IDENT_RE),i=t.concat(r,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},l="([ui](8|16|32|64|128|size)|f(32|64))?",u=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],f=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],g=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:g,keyword:u,literal:d,built_in:f},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+l},{begin:"\\b0o([0-7_]+)"+l},{begin:"\\b0x([A-Fa-f0-9_]+)"+l},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+l}],relevance:0},{begin:[/fn/,/\s+/,a],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,a],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,a,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:f,type:g}},{className:"punctuation",begin:"->"},o]}}const aF=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,4}(-[0-9A-Fa-f][0-9A-Fa-f]{0,4})?/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),iF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],sF=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],oF=[...iF,...sF],lF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),cF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),uF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),dF=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","unicode-range","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function fF(e){const t=aF(e),r=uF,a=cF,i="@[a-z-]+",o="and or not only",u={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+oF.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+a.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+r.join("|")+")"},u,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+dF.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,u,t.HEXCOLOR,t.CSS_NUMBER_MODE,t.UNICODE_RANGE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:lF.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},u,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function gF(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function pF(e){const t=e.regex,r=e.COMMENT("--","$"),a={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],l=["double precision","large object","with timezone","without timezone"],u=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],f=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],g=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],y=g,v=[...f,...d].filter(T=>!g.includes(T)),k={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},_={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},w={match:t.concat(/\b/,t.either(...y),/\s*\(/),relevance:0,keywords:{built_in:y}};function S(T){return t.concat(/\b/,t.either(...T.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:S(m),relevance:0};function A(T,{exceptions:C,when:j}={}){const L=j;return C=C||[],T.map(O=>O.match(/\|\d+$/)||C.includes(O)?O:L(O)?`${O}|0`:O)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:A(v,{when:T=>T.length<3}),literal:o,type:u,built_in:h},contains:[{scope:"type",match:S(l)},E,w,k,a,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,r,_]}}function HT(e){return e?typeof e=="string"?e:e.source:null}function Cc(e){return Dr("(?=",e,")")}function Dr(...e){return e.map(r=>HT(r)).join("")}function hF(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function sa(...e){return"("+(hF(e).capture?"":"?:")+e.map(a=>HT(a)).join("|")+")"}const Zv=e=>Dr(/\b/,e,/\w$/.test(e)?/\b/:/\B/),mF=["Protocol","Type"].map(Zv),Vw=["init","self"].map(Zv),xF=["Any","Self"],Hp=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Gw=["false","nil","true"],yF=["assignment","associativity","higherThan","left","lowerThan","none","right"],bF=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Kw=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],$T=sa(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),WT=sa($T,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),$p=Dr($T,WT,"*"),VT=sa(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),pf=sa(VT,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),qi=Dr(VT,pf,"*"),Bd=Dr(/[A-Z]/,pf,"*"),vF=["attached","autoclosure",Dr(/convention\(/,sa("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Dr(/objc\(/,qi,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],kF=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function _F(e){const t={match:/\s+/,relevance:0},r=e.COMMENT("/\\*","\\*/",{contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,r],i={match:[/\./,sa(...mF,...Vw)],className:{2:"keyword"}},o={match:Dr(/\./,sa(...Hp)),relevance:0},l=Hp.filter($e=>typeof $e=="string").concat(["_|0"]),u=Hp.filter($e=>typeof $e!="string").concat(xF).map(Zv),d={variants:[{className:"keyword",match:sa(...u,...Vw)}]},f={$pattern:sa(/\b\w+/,/#\w+/),keyword:l.concat(bF),literal:Gw},g=[i,o,d],h={match:Dr(/\./,sa(...Kw)),relevance:0},m={className:"built_in",match:Dr(/\b/,sa(...Kw),/(?=\()/)},y=[h,m],v={match:/->/,relevance:0},k={className:"operator",relevance:0,variants:[{match:$p},{match:`\\.(\\.|${WT})+`}]},_=[v,k],w="([0-9]_*)+",S="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${w})(\\.(${w}))?([eE][+-]?(${w}))?\\b`},{match:`\\b0x(${S})(\\.(${S}))?([pP][+-]?(${w}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},A=($e="")=>({className:"subst",variants:[{match:Dr(/\\/,$e,/[0\\tnr"']/)},{match:Dr(/\\/,$e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),T=($e="")=>({className:"subst",match:Dr(/\\/,$e,/[\t ]*(?:[\r\n]|\r\n)/)}),C=($e="")=>({className:"subst",label:"interpol",begin:Dr(/\\/,$e,/\(/),end:/\)/}),j=($e="")=>({begin:Dr($e,/"""/),end:Dr(/"""/,$e),contains:[A($e),T($e),C($e)]}),L=($e="")=>({begin:Dr($e,/"/),end:Dr(/"/,$e),contains:[A($e),C($e)]}),O={className:"string",variants:[j(),j("#"),j("##"),j("###"),L(),L("#"),L("##"),L("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],B={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},z=$e=>{const Be=Dr($e,/\//),gt=Dr(/\//,$e);return{begin:Be,end:gt,contains:[...I,{scope:"comment",begin:`#(?!.*${gt})`,end:/$/}]}},ee={scope:"regexp",variants:[z("###"),z("##"),z("#"),B]},$={match:Dr(/`/,qi,/`/)},M={className:"variable",match:/\$\d+/},G={className:"variable",match:`\\$${pf}+`},Y=[$,M,G],X={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:kF,contains:[..._,E,O]}]}},ie={scope:"keyword",match:Dr(/@/,sa(...vF),Cc(sa(/\(/,/\s+/)))},F={scope:"meta",match:Dr(/@/,qi)},U=[X,ie,F],Z={match:Cc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Dr(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,pf,"+")},{className:"type",match:Bd,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Dr(/\s+&\s+/,Cc(Bd)),relevance:0}]},P={begin:/</,end:/>/,keywords:f,contains:[...a,...g,...U,v,Z]};Z.contains.push(P);const K={match:Dr(qi,/\s*:/),keywords:"_|0",relevance:0},V={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",K,...a,ee,...g,...y,..._,E,O,...Y,...U,Z]},W={begin:/</,end:/>/,keywords:"repeat each",contains:[...a,Z]},ae={begin:sa(Cc(Dr(qi,/\s*:/)),Cc(Dr(qi,/\s+/,qi,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:qi}]},Q={begin:/\(/,end:/\)/,keywords:f,contains:[ae,...a,...g,..._,E,O,...U,Z,V],endsParent:!0,illegal:/["']/},he={match:[/(func|macro)/,/\s+/,sa($.match,qi,$p)],className:{1:"keyword",3:"title.function"},contains:[W,Q,t],illegal:[/\[/,/%/]},Ne={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[W,Q,t],illegal:/\[|%/},De={match:[/operator/,/\s+/,$p],className:{1:"keyword",3:"title"}},Ve={begin:[/precedencegroup/,/\s+/,Bd],className:{1:"keyword",3:"title"},contains:[Z],keywords:[...yF,...Gw],end:/}/},at={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},lt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ce={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,qi,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[W,...g,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:Bd},...g],relevance:0}]};for(const $e of O.variants){const Be=$e.contains.find(ut=>ut.label==="interpol");Be.keywords=f;const gt=[...g,...y,..._,E,O,...Y];Be.contains=[...gt,{begin:/\(/,end:/\)/,contains:["self",...gt]}]}return{name:"Swift",keywords:f,contains:[...a,he,Ne,at,lt,Ce,De,Ve,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0},ee,...g,...y,..._,E,O,...Y,...U,Z,V]}}const hf="[A-Za-z$_][0-9A-Za-z$_]*",GT=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],KT=["true","false","null","undefined","NaN","Infinity"],YT=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],XT=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],QT=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ZT=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],JT=[].concat(QT,YT,XT);function wF(e){const t=e.regex,r=(X,{after:ie})=>{const F="</"+X[0].slice(1);return X.input.indexOf(F,ie)!==-1},a=hf,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,ie)=>{const F=X[0].length+X.index,U=X.input[F];if(U==="<"||U===","){ie.ignoreMatch();return}U===">"&&(r(X,{after:F})||ie.ignoreMatch());let Z;const P=X.input.substring(F);if(Z=P.match(/^\s*=/)){ie.ignoreMatch();return}if((Z=P.match(/^\s+extends\s+/))&&Z.index===0){ie.ignoreMatch();return}}},u={$pattern:hf,keyword:GT,literal:KT,built_in:JT,"variable.language":ZT},d="[0-9](_?[0-9])*",f=`\\.(${d})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${d})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:u,contains:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},S={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:a+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,{match:/\$\d+/},h];m.contains=E.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(E)});const A=[].concat(S,m.contains),T=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(A)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},j={variants:[{match:[/class/,/\s+/,a,/\s+/,/extends/,/\s+/,t.concat(a,"(",t.concat(/\./,a),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,a],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...YT,...XT]}},O={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,a,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(X){return t.concat("(?!",X.join("|"),")")}const ee={match:t.concat(/\b/,z([...QT,"super","import","await"].map(X=>`${X}\\s*\\(`)),a,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},$={begin:t.concat(/\./,t.lookahead(t.concat(a,/(?![0-9A-Za-z$_(])/))),end:a,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,a,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},G="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",Y={match:[/const|var|let/,/\s+/,a,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(G)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:L},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),O,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,v,k,_,S,{match:/\$\d+/},h,L,{scope:"attr",match:a+t.lookahead(":"),relevance:0},Y,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[S,e.REGEXP_MODE,{className:"function",begin:G,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,e.inherit(e.TITLE_MODE,{begin:a,className:"title.function"})]},{match:/\.\.\./,relevance:0},$,{match:"\\$"+a,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},ee,B,j,M,{match:/\$[(.]/}]}}function NF(e){const t=e.regex,r=wF(e),a=hf,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[r.exports.CLASS_REFERENCE]},u={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},d=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:hf,keyword:GT.concat(d),literal:KT,built_in:JT.concat(i),"variable.language":ZT},g={className:"meta",begin:"@"+a},h=(k,_,w)=>{const S=k.contains.findIndex(E=>E.label===_);if(S===-1)throw new Error("can not find mode to replace");k.contains.splice(S,1,w)};Object.assign(r.keywords,f),r.exports.PARAMS_CONTAINS.push(g);const m=r.contains.find(k=>k.scope==="attr"),y=Object.assign({},m,{match:t.concat(a,t.lookahead(/\s*\?:/))});r.exports.PARAMS_CONTAINS.push([r.exports.CLASS_REFERENCE,m,y]),r.contains=r.contains.concat([g,o,l,y]),h(r,"shebang",e.SHEBANG()),h(r,"use_strict",u);const v=r.contains.find(k=>k.label==="func.def");return v.relevance=0,Object.assign(r,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),r}function SF(e){const t=e.regex,r={className:"string",begin:/"(""|[^/n])"C\b/},a={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,l=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,u=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:t.concat(/# */,t.either(o,i),/ *#/)},{begin:t.concat(/# */,u,/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,t.either(o,i),/ +/,t.either(l,u),/ *#/)}]},f={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},g={className:"label",begin:/^\w+:/},h=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[r,a,d,f,g,h,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function EF(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const r=e.COMMENT(/;;/,/$/),a=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},l={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},u={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},f={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:a},contains:[r,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,l,i,e.QUOTE_STRING_MODE,d,f,u]}}function jF(e){const t=e.regex,r=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=e.inherit(o,{begin:/\(/,end:/\)/}),u=e.inherit(e.APOS_STRING_MODE,{className:"string"}),d=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),f={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:a,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,d,u,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,l,d,u]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[f],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[f],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(r,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:r,relevance:0,starts:f}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(r,/>/))),contains:[{className:"name",begin:r,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function CF(e){const t="true false yes no null",r="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},u=e.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},y={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},v={begin:/\{/,end:/\}/,contains:[y],illegal:"\\n",relevance:0},k={begin:"\\[",end:"\\]",contains:[y],illegal:"\\n",relevance:0},_=[a,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+r},{className:"type",begin:"!<"+r+">"},{className:"type",begin:"!"+r},{className:"type",begin:"!!"+r},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},m,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},v,k,o,l],w=[..._];return w.pop(),w.push(u),y.contains=w,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:_}}const TF={arduino:l9,bash:c9,c:u9,cpp:d9,csharp:f9,css:k9,diff:_9,go:w9,graphql:N9,ini:S9,java:E9,javascript:A9,json:L9,kotlin:D9,less:$9,lua:W9,makefile:V9,markdown:G9,objectivec:K9,perl:Y9,php:X9,"php-template":Q9,plaintext:Z9,python:J9,"python-repl":eF,r:tF,ruby:rF,rust:nF,scss:fF,shell:gF,sql:pF,swift:_F,typescript:NF,vbnet:SF,wasm:EF,xml:jF,yaml:CF};var Wp,Yw;function RF(){if(Yw)return Wp;Yw=1;function e(ue){return ue instanceof Map?ue.clear=ue.delete=ue.set=function(){throw new Error("map is read-only")}:ue instanceof Set&&(ue.add=ue.clear=ue.delete=function(){throw new Error("set is read-only")}),Object.freeze(ue),Object.getOwnPropertyNames(ue).forEach(Me=>{const Ke=ue[Me],Te=typeof Ke;(Te==="object"||Te==="function")&&!Object.isFrozen(Ke)&&e(Ke)}),ue}class t{constructor(Me){Me.data===void 0&&(Me.data={}),this.data=Me.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function r(ue){return ue.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function a(ue,...Me){const Ke=Object.create(null);for(const Te in ue)Ke[Te]=ue[Te];return Me.forEach(function(Te){for(const oe in Te)Ke[oe]=Te[oe]}),Ke}const i="</span>",o=ue=>!!ue.scope,l=(ue,{prefix:Me})=>{if(ue.startsWith("language:"))return ue.replace("language:","language-");if(ue.includes(".")){const Ke=ue.split(".");return[`${Me}${Ke.shift()}`,...Ke.map((Te,oe)=>`${Te}${"_".repeat(oe+1)}`)].join(" ")}return`${Me}${ue}`};class u{constructor(Me,Ke){this.buffer="",this.classPrefix=Ke.classPrefix,Me.walk(this)}addText(Me){this.buffer+=r(Me)}openNode(Me){if(!o(Me))return;const Ke=l(Me.scope,{prefix:this.classPrefix});this.span(Ke)}closeNode(Me){o(Me)&&(this.buffer+=i)}value(){return this.buffer}span(Me){this.buffer+=`<span class="${Me}">`}}const d=(ue={})=>{const Me={children:[]};return Object.assign(Me,ue),Me};class f{constructor(){this.rootNode=d(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(Me){this.top.children.push(Me)}openNode(Me){const Ke=d({scope:Me});this.add(Ke),this.stack.push(Ke)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Me){return this.constructor._walk(Me,this.rootNode)}static _walk(Me,Ke){return typeof Ke=="string"?Me.addText(Ke):Ke.children&&(Me.openNode(Ke),Ke.children.forEach(Te=>this._walk(Me,Te)),Me.closeNode(Ke)),Me}static _collapse(Me){typeof Me!="string"&&Me.children&&(Me.children.every(Ke=>typeof Ke=="string")?Me.children=[Me.children.join("")]:Me.children.forEach(Ke=>{f._collapse(Ke)}))}}class g extends f{constructor(Me){super(),this.options=Me}addText(Me){Me!==""&&this.add(Me)}startScope(Me){this.openNode(Me)}endScope(){this.closeNode()}__addSublanguage(Me,Ke){const Te=Me.root;Ke&&(Te.scope=`language:${Ke}`),this.add(Te)}toHTML(){return new u(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function h(ue){return ue?typeof ue=="string"?ue:ue.source:null}function m(ue){return k("(?=",ue,")")}function y(ue){return k("(?:",ue,")*")}function v(ue){return k("(?:",ue,")?")}function k(...ue){return ue.map(Ke=>h(Ke)).join("")}function _(ue){const Me=ue[ue.length-1];return typeof Me=="object"&&Me.constructor===Object?(ue.splice(ue.length-1,1),Me):{}}function w(...ue){return"("+(_(ue).capture?"":"?:")+ue.map(Te=>h(Te)).join("|")+")"}function S(ue){return new RegExp(ue.toString()+"|").exec("").length-1}function E(ue,Me){const Ke=ue&&ue.exec(Me);return Ke&&Ke.index===0}const A=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function T(ue,{joinWith:Me}){let Ke=0;return ue.map(Te=>{Ke+=1;const oe=Ke;let bt=h(Te),Pe="";for(;bt.length>0;){const te=A.exec(bt);if(!te){Pe+=bt;break}Pe+=bt.substring(0,te.index),bt=bt.substring(te.index+te[0].length),te[0][0]==="\\"&&te[1]?Pe+="\\"+String(Number(te[1])+oe):(Pe+=te[0],te[0]==="("&&Ke++)}return Pe}).map(Te=>`(${Te})`).join(Me)}const C=/\b\B/,j="[a-zA-Z]\\w*",L="[a-zA-Z_]\\w*",O="\\b\\d+(\\.\\d+)?",I="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",B="\\b(0b[01]+)",z="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ee=(ue={})=>{const Me=/^#![ ]*\//;return ue.binary&&(ue.begin=k(Me,/.*\b/,ue.binary,/\b.*/)),a({scope:"meta",begin:Me,end:/$/,relevance:0,"on:begin":(Ke,Te)=>{Ke.index!==0&&Te.ignoreMatch()}},ue)},$={begin:"\\\\[\\s\\S]",relevance:0},M={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[$]},G={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[$]},Y={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},X=function(ue,Me,Ke={}){const Te=a({scope:"comment",begin:ue,end:Me,contains:[]},Ke);Te.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const oe=w("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Te.contains.push({begin:k(/[ ]+/,"(",oe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Te},ie=X("//","$"),F=X("/\\*","\\*/"),U=X("#","$"),Z={scope:"number",begin:O,relevance:0},P={scope:"number",begin:I,relevance:0},K={scope:"number",begin:B,relevance:0},V={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[$,{begin:/\[/,end:/\]/,relevance:0,contains:[$]}]},W={scope:"title",begin:j,relevance:0},ae={scope:"title",begin:L,relevance:0},Q={begin:"\\.\\s*"+L,relevance:0};var Ne=Object.freeze({__proto__:null,APOS_STRING_MODE:M,BACKSLASH_ESCAPE:$,BINARY_NUMBER_MODE:K,BINARY_NUMBER_RE:B,COMMENT:X,C_BLOCK_COMMENT_MODE:F,C_LINE_COMMENT_MODE:ie,C_NUMBER_MODE:P,C_NUMBER_RE:I,END_SAME_AS_BEGIN:function(ue){return Object.assign(ue,{"on:begin":(Me,Ke)=>{Ke.data._beginMatch=Me[1]},"on:end":(Me,Ke)=>{Ke.data._beginMatch!==Me[1]&&Ke.ignoreMatch()}})},HASH_COMMENT_MODE:U,IDENT_RE:j,MATCH_NOTHING_RE:C,METHOD_GUARD:Q,NUMBER_MODE:Z,NUMBER_RE:O,PHRASAL_WORDS_MODE:Y,QUOTE_STRING_MODE:G,REGEXP_MODE:V,RE_STARTERS_RE:z,SHEBANG:ee,TITLE_MODE:W,UNDERSCORE_IDENT_RE:L,UNDERSCORE_TITLE_MODE:ae});function De(ue,Me){ue.input[ue.index-1]==="."&&Me.ignoreMatch()}function Ve(ue,Me){ue.className!==void 0&&(ue.scope=ue.className,delete ue.className)}function at(ue,Me){Me&&ue.beginKeywords&&(ue.begin="\\b("+ue.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ue.__beforeBegin=De,ue.keywords=ue.keywords||ue.beginKeywords,delete ue.beginKeywords,ue.relevance===void 0&&(ue.relevance=0))}function lt(ue,Me){Array.isArray(ue.illegal)&&(ue.illegal=w(...ue.illegal))}function Ce(ue,Me){if(ue.match){if(ue.begin||ue.end)throw new Error("begin & end are not supported with match");ue.begin=ue.match,delete ue.match}}function $e(ue,Me){ue.relevance===void 0&&(ue.relevance=1)}const Be=(ue,Me)=>{if(!ue.beforeMatch)return;if(ue.starts)throw new Error("beforeMatch cannot be used with starts");const Ke=Object.assign({},ue);Object.keys(ue).forEach(Te=>{delete ue[Te]}),ue.keywords=Ke.keywords,ue.begin=k(Ke.beforeMatch,m(Ke.begin)),ue.starts={relevance:0,contains:[Object.assign(Ke,{endsParent:!0})]},ue.relevance=0,delete Ke.beforeMatch},gt=["of","and","for","in","not","or","if","then","parent","list","value"],ut="keyword";function jt(ue,Me,Ke=ut){const Te=Object.create(null);return typeof ue=="string"?oe(Ke,ue.split(" ")):Array.isArray(ue)?oe(Ke,ue):Object.keys(ue).forEach(function(bt){Object.assign(Te,jt(ue[bt],Me,bt))}),Te;function oe(bt,Pe){Me&&(Pe=Pe.map(te=>te.toLowerCase())),Pe.forEach(function(te){const be=te.split("|");Te[be[0]]=[bt,Ge(be[0],be[1])]})}}function Ge(ue,Me){return Me?Number(Me):we(ue)?0:1}function we(ue){return gt.includes(ue.toLowerCase())}const Ue={},Ae=ue=>{console.error(ue)},rt=(ue,...Me)=>{console.log(`WARN: ${ue}`,...Me)},fe=(ue,Me)=>{Ue[`${ue}/${Me}`]||(console.log(`Deprecated as of ${ue}. ${Me}`),Ue[`${ue}/${Me}`]=!0)},ce=new Error;function ve(ue,Me,{key:Ke}){let Te=0;const oe=ue[Ke],bt={},Pe={};for(let te=1;te<=Me.length;te++)Pe[te+Te]=oe[te],bt[te+Te]=!0,Te+=S(Me[te-1]);ue[Ke]=Pe,ue[Ke]._emit=bt,ue[Ke]._multi=!0}function ye(ue){if(Array.isArray(ue.begin)){if(ue.skip||ue.excludeBegin||ue.returnBegin)throw Ae("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ce;if(typeof ue.beginScope!="object"||ue.beginScope===null)throw Ae("beginScope must be object"),ce;ve(ue,ue.begin,{key:"beginScope"}),ue.begin=T(ue.begin,{joinWith:""})}}function it(ue){if(Array.isArray(ue.end)){if(ue.skip||ue.excludeEnd||ue.returnEnd)throw Ae("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ce;if(typeof ue.endScope!="object"||ue.endScope===null)throw Ae("endScope must be object"),ce;ve(ue,ue.end,{key:"endScope"}),ue.end=T(ue.end,{joinWith:""})}}function qe(ue){ue.scope&&typeof ue.scope=="object"&&ue.scope!==null&&(ue.beginScope=ue.scope,delete ue.scope)}function Ye(ue){qe(ue),typeof ue.beginScope=="string"&&(ue.beginScope={_wrap:ue.beginScope}),typeof ue.endScope=="string"&&(ue.endScope={_wrap:ue.endScope}),ye(ue),it(ue)}function yt(ue){function Me(Pe,te){return new RegExp(h(Pe),"m"+(ue.case_insensitive?"i":"")+(ue.unicodeRegex?"u":"")+(te?"g":""))}class Ke{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(te,be){be.position=this.position++,this.matchIndexes[this.matchAt]=be,this.regexes.push([be,te]),this.matchAt+=S(te)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const te=this.regexes.map(be=>be[1]);this.matcherRe=Me(T(te,{joinWith:"|"}),!0),this.lastIndex=0}exec(te){this.matcherRe.lastIndex=this.lastIndex;const be=this.matcherRe.exec(te);if(!be)return null;const ze=be.findIndex((Bt,Ft)=>Ft>0&&Bt!==void 0),Je=this.matchIndexes[ze];return be.splice(0,ze),Object.assign(be,Je)}}class Te{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(te){if(this.multiRegexes[te])return this.multiRegexes[te];const be=new Ke;return this.rules.slice(te).forEach(([ze,Je])=>be.addRule(ze,Je)),be.compile(),this.multiRegexes[te]=be,be}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(te,be){this.rules.push([te,be]),be.type==="begin"&&this.count++}exec(te){const be=this.getMatcher(this.regexIndex);be.lastIndex=this.lastIndex;let ze=be.exec(te);if(this.resumingScanAtSamePosition()&&!(ze&&ze.index===this.lastIndex)){const Je=this.getMatcher(0);Je.lastIndex=this.lastIndex+1,ze=Je.exec(te)}return ze&&(this.regexIndex+=ze.position+1,this.regexIndex===this.count&&this.considerAll()),ze}}function oe(Pe){const te=new Te;return Pe.contains.forEach(be=>te.addRule(be.begin,{rule:be,type:"begin"})),Pe.terminatorEnd&&te.addRule(Pe.terminatorEnd,{type:"end"}),Pe.illegal&&te.addRule(Pe.illegal,{type:"illegal"}),te}function bt(Pe,te){const be=Pe;if(Pe.isCompiled)return be;[Ve,Ce,Ye,Be].forEach(Je=>Je(Pe,te)),ue.compilerExtensions.forEach(Je=>Je(Pe,te)),Pe.__beforeBegin=null,[at,lt,$e].forEach(Je=>Je(Pe,te)),Pe.isCompiled=!0;let ze=null;return typeof Pe.keywords=="object"&&Pe.keywords.$pattern&&(Pe.keywords=Object.assign({},Pe.keywords),ze=Pe.keywords.$pattern,delete Pe.keywords.$pattern),ze=ze||/\w+/,Pe.keywords&&(Pe.keywords=jt(Pe.keywords,ue.case_insensitive)),be.keywordPatternRe=Me(ze,!0),te&&(Pe.begin||(Pe.begin=/\B|\b/),be.beginRe=Me(be.begin),!Pe.end&&!Pe.endsWithParent&&(Pe.end=/\B|\b/),Pe.end&&(be.endRe=Me(be.end)),be.terminatorEnd=h(be.end)||"",Pe.endsWithParent&&te.terminatorEnd&&(be.terminatorEnd+=(Pe.end?"|":"")+te.terminatorEnd)),Pe.illegal&&(be.illegalRe=Me(Pe.illegal)),Pe.contains||(Pe.contains=[]),Pe.contains=[].concat(...Pe.contains.map(function(Je){return Dt(Je==="self"?Pe:Je)})),Pe.contains.forEach(function(Je){bt(Je,be)}),Pe.starts&&bt(Pe.starts,te),be.matcher=oe(be),be}if(ue.compilerExtensions||(ue.compilerExtensions=[]),ue.contains&&ue.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ue.classNameAliases=a(ue.classNameAliases||{}),bt(ue)}function ht(ue){return ue?ue.endsWithParent||ht(ue.starts):!1}function Dt(ue){return ue.variants&&!ue.cachedVariants&&(ue.cachedVariants=ue.variants.map(function(Me){return a(ue,{variants:null},Me)})),ue.cachedVariants?ue.cachedVariants:ht(ue)?a(ue,{starts:ue.starts?a(ue.starts):null}):Object.isFrozen(ue)?a(ue):ue}var nt="11.11.2";class Pt extends Error{constructor(Me,Ke){super(Me),this.name="HTMLInjectionError",this.html=Ke}}const $t=r,lr=a,pr=Symbol("nomatch"),_r=7,cr=function(ue){const Me=Object.create(null),Ke=Object.create(null),Te=[];let oe=!0;const bt="Could not find the language '{}', did you forget to load/include a language module?",Pe={disableAutodetect:!0,name:"Plain text",contains:[]};let te={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function be(st){return te.noHighlightRe.test(st)}function ze(st){let Nt=st.className+" ";Nt+=st.parentNode?st.parentNode.className:"";const Ht=te.languageDetectRe.exec(Nt);if(Ht){const er=dn(Ht[1]);return er||(rt(bt.replace("{}",Ht[1])),rt("Falling back to no-highlight mode for this block.",st)),er?Ht[1]:"no-highlight"}return Nt.split(/\s+/).find(er=>be(er)||dn(er))}function Je(st,Nt,Ht){let er="",ur="";typeof Nt=="object"?(er=st,Ht=Nt.ignoreIllegals,ur=Nt.language):(fe("10.7.0","highlight(lang, code, ...args) has been deprecated."),fe("10.7.0",`Please use highlight(code, options) instead.
|
|
81
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),ur=st,er=Nt),Ht===void 0&&(Ht=!0);const tr={code:er,language:ur};ii("before:highlight",tr);const Qn=tr.result?tr.result:Bt(tr.language,tr.code,Ht);return Qn.code=tr.code,ii("after:highlight",Qn),Qn}function Bt(st,Nt,Ht,er){const ur=Object.create(null);function tr(H,le){return H.keywords[le]}function Qn(){if(!He.keywords){Vr.addText(wr);return}let H=0;He.keywordPatternRe.lastIndex=0;let le=He.keywordPatternRe.exec(wr),Se="";for(;le;){Se+=wr.substring(H,le.index);const We=On.case_insensitive?le[0].toLowerCase():le[0],pt=tr(He,We);if(pt){const[_t,Er]=pt;if(Vr.addText(Se),Se="",ur[We]=(ur[We]||0)+1,ur[We]<=_r&&(Ba+=Er),_t.startsWith("_"))Se+=le[0];else{const jr=On.classNameAliases[_t]||_t;Ur(le[0],jr)}}else Se+=le[0];H=He.keywordPatternRe.lastIndex,le=He.keywordPatternRe.exec(wr)}Se+=wr.substring(H),Vr.addText(Se)}function si(){if(wr==="")return;let H=null;if(typeof He.subLanguage=="string"){if(!Me[He.subLanguage]){Vr.addText(wr);return}H=Bt(He.subLanguage,wr,!0,Ci[He.subLanguage]),Ci[He.subLanguage]=H._top}else H=Jt(wr,He.subLanguage.length?He.subLanguage:null);He.relevance>0&&(Ba+=H.relevance),Vr.__addSublanguage(H._emitter,H.language)}function zr(){He.subLanguage!=null?si():Qn(),wr=""}function Ur(H,le){H!==""&&(Vr.startScope(le),Vr.addText(H),Vr.endScope())}function fn(H,le){let Se=1;const We=le.length-1;for(;Se<=We;){if(!H._emit[Se]){Se++;continue}const pt=On.classNameAliases[H[Se]]||H[Se],_t=le[Se];pt?Ur(_t,pt):(wr=_t,Qn(),wr=""),Se++}}function Zn(H,le){return H.scope&&typeof H.scope=="string"&&Vr.openNode(On.classNameAliases[H.scope]||H.scope),H.beginScope&&(H.beginScope._wrap?(Ur(wr,On.classNameAliases[H.beginScope._wrap]||H.beginScope._wrap),wr=""):H.beginScope._multi&&(fn(H.beginScope,le),wr="")),He=Object.create(H,{parent:{value:He}}),He}function jn(H,le,Se){let We=E(H.endRe,Se);if(We){if(H["on:end"]){const pt=new t(H);H["on:end"](le,pt),pt.isMatchIgnored&&(We=!1)}if(We){for(;H.endsParent&&H.parent;)H=H.parent;return H}}if(H.endsWithParent)return jn(H.parent,le,Se)}function oi(H){return He.matcher.regexIndex===0?(wr+=H[0],1):(Xe=!0,0)}function vn(H){const le=H[0],Se=H.rule,We=new t(Se),pt=[Se.__beforeBegin,Se["on:begin"]];for(const _t of pt)if(_t&&(_t(H,We),We.isMatchIgnored))return oi(le);return Se.skip?wr+=le:(Se.excludeBegin&&(wr+=le),zr(),!Se.returnBegin&&!Se.excludeBegin&&(wr=le)),Zn(Se,H),Se.returnBegin?0:le.length}function Yi(H){const le=H[0],Se=Nt.substring(H.index),We=jn(He,H,Se);if(!We)return pr;const pt=He;He.endScope&&He.endScope._wrap?(zr(),Ur(le,He.endScope._wrap)):He.endScope&&He.endScope._multi?(zr(),fn(He.endScope,H)):pt.skip?wr+=le:(pt.returnEnd||pt.excludeEnd||(wr+=le),zr(),pt.excludeEnd&&(wr=le));do He.scope&&Vr.closeNode(),!He.skip&&!He.subLanguage&&(Ba+=He.relevance),He=He.parent;while(He!==We.parent);return We.starts&&Zn(We.starts,H),pt.returnEnd?0:le.length}function Fa(){const H=[];for(let le=He;le!==On;le=le.parent)le.scope&&H.unshift(le.scope);H.forEach(le=>Vr.openNode(le))}let Un={};function Jn(H,le){const Se=le&&le[0];if(wr+=H,Se==null)return zr(),0;if(Un.type==="begin"&&le.type==="end"&&Un.index===le.index&&Se===""){if(wr+=Nt.slice(le.index,le.index+1),!oe){const We=new Error(`0 width match regex (${st})`);throw We.languageName=st,We.badRule=Un.rule,We}return 1}if(Un=le,le.type==="begin")return vn(le);if(le.type==="illegal"&&!Ht){const We=new Error('Illegal lexeme "'+Se+'" for mode "'+(He.scope||"<unnamed>")+'"');throw We.mode=He,We}else if(le.type==="end"){const We=Yi(le);if(We!==pr)return We}if(le.type==="illegal"&&Se==="")return le.index===Nt.length||(wr+=`
|
|
82
|
-
`),1;if(wa>1e5&&wa>le.index*3)throw new Error("potential infinite loop, way more iterations than matches");return wr+=Se,Se.length}const On=dn(st);if(!On)throw Ae(bt.replace("{}",st)),new Error('Unknown language: "'+st+'"');const ea=yt(On);let dr="",He=er||ea;const Ci={},Vr=new te.__emitter(te);Fa();let wr="",Ba=0,Cn=0,wa=0,Xe=!1;try{if(On.__emitTokens)On.__emitTokens(Nt,Vr);else{for(He.matcher.considerAll();;){wa++,Xe?Xe=!1:He.matcher.considerAll(),He.matcher.lastIndex=Cn;const H=He.matcher.exec(Nt);if(!H)break;const le=Nt.substring(Cn,H.index),Se=Jn(le,H);Cn=H.index+Se}Jn(Nt.substring(Cn))}return Vr.finalize(),dr=Vr.toHTML(),{language:st,value:dr,relevance:Ba,illegal:!1,_emitter:Vr,_top:He}}catch(H){if(H.message&&H.message.includes("Illegal"))return{language:st,value:$t(Nt),illegal:!0,relevance:0,_illegalBy:{message:H.message,index:Cn,context:Nt.slice(Cn-100,Cn+100),mode:H.mode,resultSoFar:dr},_emitter:Vr};if(oe)return{language:st,value:$t(Nt),illegal:!1,relevance:0,errorRaised:H,_emitter:Vr,_top:He};throw H}}function Ft(st){const Nt={value:$t(st),illegal:!1,relevance:0,_top:Pe,_emitter:new te.__emitter(te)};return Nt._emitter.addText(st),Nt}function Jt(st,Nt){Nt=Nt||te.languages||Object.keys(Me);const Ht=Ft(st),er=Nt.filter(dn).filter(Xn).map(zr=>Bt(zr,st,!1));er.unshift(Ht);const ur=er.sort((zr,Ur)=>{if(zr.relevance!==Ur.relevance)return Ur.relevance-zr.relevance;if(zr.language&&Ur.language){if(dn(zr.language).supersetOf===Ur.language)return 1;if(dn(Ur.language).supersetOf===zr.language)return-1}return 0}),[tr,Qn]=ur,si=tr;return si.secondBest=Qn,si}function Fe(st,Nt,Ht){const er=Nt&&Ke[Nt]||Ht;st.classList.add("hljs"),st.classList.add(`language-${er}`)}function kt(st){let Nt=null;const Ht=ze(st);if(be(Ht))return;if(ii("before:highlightElement",{el:st,language:Ht}),st.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",st);return}if(st.children.length>0&&(te.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(st)),te.throwUnescapedHTML))throw new Pt("One of your code blocks includes unescaped HTML.",st.innerHTML);Nt=st;const er=Nt.textContent,ur=Ht?Je(er,{language:Ht,ignoreIllegals:!0}):Jt(er);st.innerHTML=ur.value,st.dataset.highlighted="yes",Fe(st,Ht,ur.language),st.result={language:ur.language,re:ur.relevance,relevance:ur.relevance},ur.secondBest&&(st.secondBest={language:ur.secondBest.language,relevance:ur.secondBest.relevance}),ii("after:highlightElement",{el:st,result:ur,text:er})}function Qt(st){te=lr(te,st)}const Wr=()=>{yr(),fe("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ln(){yr(),fe("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Jr=!1;function yr(){function st(){yr()}if(document.readyState==="loading"){Jr||window.addEventListener("DOMContentLoaded",st,!1),Jr=!0;return}document.querySelectorAll(te.cssSelector).forEach(kt)}function ca(st,Nt){let Ht=null;try{Ht=Nt(ue)}catch(er){if(Ae("Language definition for '{}' could not be registered.".replace("{}",st)),oe)Ae(er);else throw er;Ht=Pe}Ht.name||(Ht.name=st),Me[st]=Ht,Ht.rawDefinition=Nt.bind(null,ue),Ht.aliases&&Ei(Ht.aliases,{languageName:st})}function ni(st){delete Me[st];for(const Nt of Object.keys(Ke))Ke[Nt]===st&&delete Ke[Nt]}function ai(){return Object.keys(Me)}function dn(st){return st=(st||"").toLowerCase(),Me[st]||Me[Ke[st]]}function Ei(st,{languageName:Nt}){typeof st=="string"&&(st=[st]),st.forEach(Ht=>{Ke[Ht.toLowerCase()]=Nt})}function Xn(st){const Nt=dn(st);return Nt&&!Nt.disableAutodetect}function vr(st){st["before:highlightBlock"]&&!st["before:highlightElement"]&&(st["before:highlightElement"]=Nt=>{st["before:highlightBlock"](Object.assign({block:Nt.el},Nt))}),st["after:highlightBlock"]&&!st["after:highlightElement"]&&(st["after:highlightElement"]=Nt=>{st["after:highlightBlock"](Object.assign({block:Nt.el},Nt))})}function ji(st){vr(st),Te.push(st)}function bn(st){const Nt=Te.indexOf(st);Nt!==-1&&Te.splice(Nt,1)}function ii(st,Nt){const Ht=st;Te.forEach(function(er){er[Ht]&&er[Ht](Nt)})}function nn(st){return fe("10.7.0","highlightBlock will be removed entirely in v12.0"),fe("10.7.0","Please use highlightElement now."),kt(st)}Object.assign(ue,{highlight:Je,highlightAuto:Jt,highlightAll:yr,highlightElement:kt,highlightBlock:nn,configure:Qt,initHighlighting:Wr,initHighlightingOnLoad:ln,registerLanguage:ca,unregisterLanguage:ni,listLanguages:ai,getLanguage:dn,registerAliases:Ei,autoDetection:Xn,inherit:lr,addPlugin:ji,removePlugin:bn}),ue.debugMode=function(){oe=!1},ue.safeMode=function(){oe=!0},ue.versionString=nt,ue.regex={concat:k,lookahead:m,either:w,optional:v,anyNumberOfTimes:y};for(const st in Ne)typeof Ne[st]=="object"&&e(Ne[st]);return Object.assign(ue,Ne),ue},ir=cr({});return ir.newInstance=()=>cr({}),Wp=ir,ir.HighlightJS=ir,ir.default=ir,Wp}var AF=RF();const IF=jo(AF),Xw={},MF="hljs-";function LF(e){const t=IF.newInstance();return e&&o(e),{highlight:r,highlightAuto:a,listLanguages:i,register:o,registerAlias:l,registered:u};function r(d,f,g){const h=g||Xw,m=typeof h.prefix=="string"?h.prefix:MF;if(!t.getLanguage(d))throw new Error("Unknown language: `"+d+"` is not registered");t.configure({__emitter:OF,classPrefix:m});const y=t.highlight(f,{ignoreIllegals:!0,language:d});if(y.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:y.errorRaised});const v=y._emitter.root,k=v.data;return k.language=y.language,k.relevance=y.relevance,v}function a(d,f){const h=(f||Xw).subset||i();let m=-1,y=0,v;for(;++m<h.length;){const k=h[m];if(!t.getLanguage(k))continue;const _=r(k,d,f);_.data&&_.data.relevance!==void 0&&_.data.relevance>y&&(y=_.data.relevance,v=_)}return v||{type:"root",children:[],data:{language:void 0,relevance:y}}}function i(){return t.listLanguages()}function o(d,f){if(typeof d=="string")t.registerLanguage(d,f);else{let g;for(g in d)Object.hasOwn(d,g)&&t.registerLanguage(g,d[g])}}function l(d,f){if(typeof d=="string")t.registerAliases(typeof f=="string"?f:[...f],{languageName:d});else{let g;for(g in d)if(Object.hasOwn(d,g)){const h=d[g];t.registerAliases(typeof h=="string"?h:[...h],{languageName:g})}}}function u(d){return!!t.getLanguage(d)}}class OF{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const r=this.stack[this.stack.length-1],a=r.children[r.children.length-1];a&&a.type==="text"?a.value+=t:r.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,r){const a=this.stack[this.stack.length-1],i=t.root.children;r?a.children.push({type:"element",tagName:"span",properties:{className:[r]},children:i}):a.children.push(...i)}openNode(t){const r=this,a=t.split(".").map(function(l,u){return u?l+"_".repeat(u):r.options.classPrefix+l}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:a},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const DF={};function Vp(e){const t=e||DF,r=t.aliases,a=t.detect||!1,i=t.languages||TF,o=t.plainText,l=t.prefix,u=t.subset;let d="hljs";const f=LF(i);if(r&&f.registerAlias(r),l){const g=l.indexOf("-");d=g===-1?l:l.slice(0,g)}return function(g,h){Af(g,"element",function(m,y,v){if(m.tagName!=="code"||!v||v.type!=="element"||v.tagName!=="pre")return;const k=PF(m);if(k===!1||!k&&!a||k&&o&&o.includes(k))return;Array.isArray(m.properties.className)||(m.properties.className=[]),m.properties.className.includes(d)||m.properties.className.unshift(d);const _=e9(m,{whitespace:"pre"});let w;try{w=k?f.highlight(k,_,{prefix:l}):f.highlightAuto(_,{prefix:l,subset:u})}catch(S){const E=S;if(k&&/Unknown language/.test(E.message)){h.message("Cannot highlight as `"+k+"`, it’s not registered",{ancestors:[v,m],cause:E,place:m.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!k&&w.data&&w.data.language&&m.properties.className.push("language-"+w.data.language),w.children.length>0&&(m.children=w.children)})}}function PF(e){const t=e.properties.className;let r=-1;if(!Array.isArray(t))return;let a;for(;++r<t.length;){const i=String(t[r]);if(i==="no-highlight"||i==="nohighlight")return!1;!a&&i.slice(0,5)==="lang-"&&(a=i.slice(5)),!a&&i.slice(0,9)==="language-"&&(a=i.slice(9))}return a}function tf(){function e(t){const r=new Set(["strong","emphasis","delete"]);function a(i){if(i.children)for(let o=0;o<i.children.length;o++){const l=i.children[o];if(r.has(l.type)){if(o>0){const f=i.children[o-1];f.type==="text"?f.value&&/[a-zA-Z0-9]$/.test(f.value)&&!f.value.endsWith(" ")&&!f.value.endsWith(`
|
|
83
|
-
`)&&(f.value+=" "):(i.children.splice(o,0,{type:"text",value:" "}),o++)}const u=o+1,d=u<i.children.length?i.children[u]:null;d&&(d.type==="text"?d.value&&/^[a-zA-Z0-9]/.test(d.value)&&!d.value.startsWith(" ")&&!d.value.startsWith(`
|
|
84
|
-
`)&&(d.value=" "+d.value):r.has(d.type)&&i.children.splice(u,0,{type:"text",value:" "}))}a(l)}}return a(t),t}return e}function rf({children:e,language:t,className:r,frameless:a,...i}){const[o,l]=x.useState(!1),u=String(e).replace(/\n$/,""),d=r||(t?"language-"+t:""),f=async()=>{try{await navigator.clipboard.writeText(u),l(!0),setTimeout(()=>l(!1),2e3)}catch{const g=document.createElement("textarea");g.value=u,document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g),l(!0),setTimeout(()=>l(!1),2e3)}};return a?n.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800/50 my-3",children:[n.jsx("button",{onClick:f,className:"absolute top-2 right-2 z-10 p-1.5 rounded-md bg-gray-200/80 dark:bg-gray-700/80 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors backdrop-blur-sm",title:"Copy","aria-label":"Copy code",children:o?n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),n.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:n.jsx("code",{className:d||void 0,children:e})})]}):n.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-900 dark:bg-gray-950 my-3 px-1.5 py-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-gray-800 dark:bg-gray-900 text-xs text-gray-400",children:[n.jsx("span",{children:t||"code"}),n.jsx("button",{onClick:f,className:"flex items-center gap-1 hover:text-gray-200 transition-colors",children:o?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied"]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]})})]}),n.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:n.jsx("code",{className:d||void 0,children:e})})]})}function If(e,t){if(!t)return"";try{const r=typeof t=="string"?JSON.parse(t):t;if(r.command)return r.command;if(r.filePath&&e==="read")return`read ${r.filePath}`;if(r.pattern&&e==="grep"){const a=r.path||r.include||".";return`grep "${r.pattern}" ${a}`}if(r.pattern&&e==="glob")return`glob "${r.pattern}"`;if(r.filePath&&e==="edit")return`edit ${r.filePath}`;if(r.filePath&&e==="write")return`write ${r.filePath}`;if(r._purpose&&e==="task")return`task "${r._purpose}"`;if(r.url&&(e==="webfetch"||e==="fetch"))return`fetch ${r.url}`;if(r.action&&e==="todo"){let a=`todo ${r.action}`;return r.text&&(a+=` "${r.text}"`),r.id&&(a+=` #${r.id}`),a}if(r.action&&e==="permission"){let a=`permission ${r.action}`;return r.type&&(a+=` ${r.type}`),r.target&&(a+=` ${r.target}`),a}{const a=[];for(const[i,o]of Object.entries(r))if(!(o==null||o===""))if(typeof o=="boolean")o&&a.push(`--${i}`);else if(Array.isArray(o)){const u=o.some(f=>typeof f=="object"&&f!==null)?JSON.stringify(o):o.map(f=>String(f)).join(", "),d=u.length>60?u.slice(0,60)+"...":u;a.push(`--${i} "${d}"`)}else{const l=typeof o=="object"&&o!==null?JSON.stringify(o):String(o),u=l.length>60?l.slice(0,60)+"...":l;a.push(`--${i} "${u}"`)}return a.length>0?`${e} ${a.join(" ")}`:e||""}}catch{return""}}function No(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function FF(e){if(!e)return null;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}return t&&t.canvas&&t.canvas.type&&t.canvas.source?t.canvas:null}function BF({part:e}){const{t}=Xt(),{tool:r,state:a}=e,[i,o]=x.useState(!1);if(!a)return null;const l=a.status||"running",u=a.title||r||t("tool.tool"),d=If(r||u,a.input),f=a.input&&a.input._purpose?a.input._purpose:null,g=l==="completed"?FF(a.output):null,h=!f||i,m={running:"border-yellow-400 bg-yellow-50 dark:bg-yellow-900/20",completed:"border-green-400 bg-green-50 dark:bg-green-900/20",error:"border-red-400 bg-red-50 dark:bg-red-900/20",pending_confirmation:"border-blue-400 bg-blue-50 dark:bg-blue-900/20"},y={running:n.jsxs("svg",{className:"w-4 h-4 text-yellow-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),completed:n.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),error:n.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),pending_confirmation:n.jsx("svg",{className:"w-4 h-4 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})};return n.jsxs("div",{className:`rounded-lg border-l-4 p-2 xs:p-3 text-xs sm:text-sm ${m[l]||m.running}`,children:[n.jsxs("div",{className:`flex items-center gap-2 ${f?"cursor-pointer select-none":""}`,onClick:f?()=>o(!i):void 0,children:[y[l]||y.running,f?n.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200 flex-1",children:f}):n.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:u}),f&&n.jsx("svg",{className:`w-4 h-4 text-gray-400 flex-shrink-0 transition-transform ${i?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h&&d&&!g&&n.jsxs("div",{className:"mt-2 font-mono text-xs bg-gray-900 dark:bg-gray-950 text-gray-100 rounded px-2 py-1.5 overflow-x-auto",children:[n.jsx("span",{className:"text-green-400 select-none",children:"$ "}),n.jsx("span",{className:"text-gray-100",children:d})]}),g?n.jsxs("div",{className:"mt-2 text-xs text-blue-700 dark:text-blue-300 flex items-center gap-1.5",children:[n.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v14a1 1 0 01-1 1H5a1 1 0 01-1-1V5z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12l3 3 5-6"})]}),n.jsxs("span",{children:[g.type==="mermaid"?"Mermaid diagram":g.type==="svg"?"SVG illustration":"Math",g.title?n.jsxs(n.Fragment,{children:[": ",n.jsx("span",{className:"font-medium",children:g.title})]}):null," rendered → see ",n.jsx("span",{className:"font-medium",children:"canvas"})," pane"]})]}):a.output&&l==="completed"&&h&&n.jsx("pre",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400 overflow-x-auto max-h-32 overflow-y-auto whitespace-pre-wrap break-all max-w-full",children:No((typeof a.output=="string"?a.output:JSON.stringify(a.output,null,2)).slice(0,600)).slice(0,500)}),a.error&&h&&n.jsx("pre",{className:"mt-2 text-xs text-red-600 dark:text-red-400 whitespace-pre-wrap break-all overflow-x-auto max-w-full",children:No(typeof a.error=="string"?a.error:a.error.message||"Error")})]})}function zF({part:e}){const{tool:t,state:r}=e,[a,i]=x.useState(!1);if(!r)return null;const o=r.status||"running",l=r.title||t||"Tool",u=If(t||l,r.input),d=r.input&&r.input._purpose?r.input._purpose:null,f=!d||a;return n.jsxs("div",{className:"py-1",children:[n.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${d?"cursor-pointer select-none":""}`,onClick:d?()=>i(!a):void 0,children:[o==="running"&&n.jsxs("svg",{className:"w-3 h-3 text-gray-400 animate-spin flex-shrink-0",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o==="completed"&&n.jsx("svg",{className:"w-3 h-3 text-green-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o==="error"&&n.jsx("svg",{className:"w-3 h-3 text-red-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),o==="pending_confirmation"&&n.jsx("svg",{className:"w-3 h-3 text-blue-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),d?n.jsx("span",{className:"font-medium truncate flex-1",children:d}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium truncate",children:l}),u&&n.jsx("span",{className:"font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u})]}),d&&n.jsx("svg",{className:`w-3 h-3 text-gray-400 flex-shrink-0 transition-transform ${a?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),f&&u&&n.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u}),r.output&&o==="completed"&&f&&n.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-500 dark:text-gray-400 break-all whitespace-pre-wrap truncate",children:No(typeof r.output=="string"?r.output:JSON.stringify(r.output,null,2)).slice(0,500)}),r.error&&f&&n.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:No(typeof r.error=="string"?r.error:r.error.message||"Error").slice(0,120)}),r.error&&!f&&n.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:No(typeof r.error=="string"?r.error:r.error.message||"Error").slice(0,120)})]})}function UF({text:e,isStreaming:t}){const{t:r}=Xt(),[a,i]=x.useState(!1),o=e&&e.trim().length>0,l=t&&!a?(e||"").slice(-400).replace(/\s+/g," ").trim():"";return n.jsxs("div",{className:"py-1",children:[n.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${o?"cursor-pointer select-none":""}`,onClick:o?()=>i(!a):void 0,children:[t?n.jsxs("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500 animate-spin flex-shrink-0",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):n.jsx("svg",{className:"w-3 h-3 text-green-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),n.jsx("span",{className:`font-medium flex-shrink-0 ${l?"":"flex-1"}`,children:r("chat.thinking")}),l&&n.jsx("span",{className:"flex-1 min-w-0 font-medium italic opacity-80 whitespace-nowrap overflow-hidden flex justify-end",style:{maskImage:"linear-gradient(to right, transparent, black 24px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 24px)"},children:l}),o&&n.jsx("svg",{className:`w-3 h-3 text-gray-400 flex-shrink-0 transition-transform ${a?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),a&&o&&n.jsx("div",{className:"mt-1 prose prose-sm dark:prose-invert max-w-none break-words text-gray-600 dark:text-gray-300 italic opacity-80",children:n.jsx(Sl,{remarkPlugins:[El,tf],children:e})})]})}function qF(e){return!!(e.hasError||e.hasText||e.hasImages||e.hasTools&&e.toolsVisibleHere||e.isFrameless&&e.hasReasoning&&!e.hideThinking||e.finish==="aborted"||e.finish==="interrupted")}const Gp=2500,Qw=5;function HF(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function $F({part:e,questionId:t}){const{t:r}=Xt(),{state:a}=e,i=a&&a.status||"running",o=a&&a.input||{},l=Array.isArray(o.questions)&&o.questions.length>0?o.questions:[{text:"(no question)",options:void 0}],u=i==="completed",d=i==="error",f=(a&&a.error||"").replace(/^Error:\s*/,""),g=a&&a.output||"",[h,m]=x.useState({}),[y,v]=x.useState({}),[k,_]=x.useState(null),[w,S]=x.useState(null),[E,A]=x.useState(t),T=x.useRef(!0),C=x.useRef(null),j=x.useRef(0),L=x.useRef(0),O=x.useRef(null);x.useEffect(()=>{t&&A(t)},[t]);const I=e.callID||e.id||null;x.useEffect(()=>{if(!a||u||d||E||!I)return;O.current!==I&&(O.current=I,j.current=0,L.current=0);let X=!1,ie=null;const F=()=>{X||!T.current||j.current>=Qw||(ie=setTimeout(U,Gp))},U=()=>{X||!T.current||(j.current+=1,L.current=Date.now(),l3().then(Z=>{if(X||!T.current)return;const P=Array.isArray(Z&&Z.pending)?Z.pending:[];for(var K=0;K<P.length;K++){var V=P[K],W=V.tool&&V.tool.callID?V.tool.callID:null;if(W===I&&V.id){A(V.id);return}}F()}).catch(()=>{F()}))};if(j.current<Qw){const Z=Date.now()-L.current;j.current===0||Z>=Gp?U():ie=setTimeout(U,Gp-Z)}return()=>{X=!0,ie&&clearTimeout(ie)}},[a,u,d,E,I]),x.useEffect(()=>()=>{T.current=!1},[]),x.useEffect(()=>{!u&&C.current&&(C.current.focus(),C.current.scrollIntoView({behavior:"smooth",block:"center"}))},[u]);const B=X=>{var ie,F;return(((ie=h[X])==null?void 0:ie.length)??0)>0||(((F=y[X])==null?void 0:F.trim().length)??0)>0},z=l.every((X,ie)=>B(ie)),ee=(X,ie,F)=>{m(U=>{const Z=U[X]??[];return F?{...U,[X]:Z.includes(ie)?Z.filter(P=>P!==ie):[...Z,ie]}:{...U,[X]:Z.includes(ie)?[]:[ie]}})},$=x.useCallback(async()=>{if(!z||!E)return;const X=l.map((ie,F)=>{var P;const U=h[F]??[],Z=(P=y[F])==null?void 0:P.trim();return Z?[...U,Z]:U});_("reply"),S(null);try{const ie=await c3(E,X);if(!T.current)return;ie&&ie.success===!1&&(S(ie.error||"Failed to reply"),_(null))}catch(ie){if(!T.current)return;S(ie.message||"Failed to reply"),_(null)}},[E,l,h,y,z]),M=x.useCallback(async()=>{if(E){_("reject"),S(null);try{const X=await u3(E);if(!T.current)return;X&&X.success===!1&&(S(X.error||"Failed to dismiss"),_(null))}catch(X){if(!T.current)return;S(X.message||"Failed to dismiss"),_(null)}}},[E]);if(!a)return null;const G=X=>{X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),$())};if(u)return n.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-primary-500 bg-primary-50/50 dark:bg-primary-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")}),n.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),l.map((X,ie)=>n.jsxs("div",{className:ie>0?"pt-2 mt-2 border-t border-gray-200 dark:border-gray-700":"",children:[n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1 whitespace-pre-wrap",children:X.text}),g&&n.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:WF(g,ie,l.length)})]},ie))]});if(d)return n.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-red-400 bg-red-50/30 dark:bg-red-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("svg",{className:"w-4 h-4 text-red-500 dark:text-red-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",children:r("question.title")}),n.jsx("svg",{className:"w-3.5 h-3.5 text-red-500 flex-shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]}),n.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:r("question.error")}),f&&n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:f})]});let Y=!1;return n.jsxs("div",{className:"my-2 rounded-lg border-l-4 border-primary-500 bg-primary-50/30 dark:bg-primary-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 flex-shrink-0 animate-pulse",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")})]}),l.map((X,ie)=>{const F=Array.isArray(X.options)?X.options:[],U=F.length>0,Z=X.multiple===!0,P=X.custom!==!1,K=h[ie]??[],V=P&&!Y;return V&&(Y=!0),n.jsxs("div",{className:ie>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(X.header||Z)&&n.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[X.header&&n.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-primary-600 dark:text-primary-400 bg-primary-100 dark:bg-primary-900/30 rounded px-1.5 py-0.5",children:X.header}),Z&&n.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-gray-400 dark:text-gray-500",children:r("question.select_all")})]}),n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2 whitespace-pre-wrap",children:X.text}),U&&n.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:F.map((W,ae)=>{const Q=HF(W),he=K.includes(Q);return n.jsx("button",{onClick:()=>ee(ie,Q,Z),disabled:k!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${he?"border-primary-500 bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300":"border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"} disabled:opacity-50 disabled:cursor-not-allowed`,"aria-pressed":he,children:Q},ae)})}),P&&n.jsx("input",{ref:V?C:void 0,type:"text",value:y[ie]??"",onChange:W=>v(ae=>({...ae,[ie]:W.target.value})),onKeyDown:G,disabled:k!==null,placeholder:r(U?"question.custom_placeholder":"question.input_placeholder"),className:"w-full px-3 py-2 text-sm rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]},ie)}),w&&n.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3 mb-2",children:w}),!E&&!u&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2",children:r("question.reconnecting")||"Reconnecting…"}),n.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[n.jsx("button",{onClick:M,disabled:k!==null||!E,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(k==="reject"?"question.dismissing":"question.dismiss")}),n.jsx("button",{onClick:$,disabled:k!==null||!z||!E,className:"px-3 py-1.5 text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:k==="reply"?r("question.submitting"):l.length>1?r("question.submit_n",{count:l.length}):r("question.submit")})]})]})}function WF(e,t,r){if(r===1){const o="User's answer: ";return e.startsWith(o)?e.slice(o.length):e}const a=e.split(`
|
|
85
|
-
`),i=`[${t+1}] `;for(const o of a)if(o.startsWith(i))return o.slice(i.length);return e}function VF({sessionId:e}){const{t}=Xt(),[r,a]=x.useState(null),[i,o]=x.useState(!1),[l,u]=x.useState(null),[d,f]=x.useState(!1),[g,h]=x.useState(null),m=x.useRef(null),y=r!==null;x.useEffect(()=>{if(!i)return;const S=E=>{E.key==="Escape"&&(E.stopPropagation(),o(!1))};return window.addEventListener("keydown",S),m.current&&m.current.focus(),()=>window.removeEventListener("keydown",S)},[i]);const v=async()=>{if(!(y||!e)){o(!0),f(!0),h(null);try{const{content:S}=await W3(e);u(typeof S=="string"?S:"")}catch(S){console.error("Failed to load PLAN.md:",S),h(t("planCard.loadError"))}finally{f(!1)}}},k=()=>{y||(a("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},_=()=>{y||a("dismissed")},w="inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed";return n.jsxs("div",{className:"mt-2 flex flex-col gap-2 rounded-xl border border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20 px-3 py-2.5 transition-opacity "+(y?"opacity-50":""),children:[n.jsx("div",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:t("planCard.heading")}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("button",{type:"button",onClick:v,disabled:y||d||!e,className:w+" border-sky-300 dark:border-sky-700 text-sky-700 dark:text-sky-300 hover:bg-sky-100 dark:hover:bg-sky-900/40",children:t("planCard.showPlan")}),n.jsx("button",{type:"button",onClick:k,disabled:y,className:w+" border-emerald-300 dark:border-emerald-700 text-emerald-700 dark:text-emerald-300 hover:bg-emerald-100 dark:hover:bg-emerald-900/40",children:t("planCard.execute")}),n.jsx("button",{type:"button",onClick:_,disabled:y,className:w+" border-amber-300 dark:border-amber-700 text-amber-700 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/40",children:t("planCard.keepPlanning")})]}),y&&n.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400","aria-live":"polite",children:t(r==="executed"?"planCard.executedStatus":"planCard.dismissedStatus")}),i&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>o(!1),children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":t("planCard.heading"),className:"flex max-h-[80vh] w-full max-w-2xl flex-col rounded-lg bg-white dark:bg-gray-800 shadow-xl",onClick:S=>S.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 dark:border-gray-700 px-4 py-2.5",children:[n.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"PLAN.md"}),n.jsx("button",{ref:m,type:"button",onClick:()=>o(!1),className:"rounded p-1 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-200","aria-label":t("planCard.close"),children:"✕"})]}),d?n.jsx("div",{className:"px-4 py-6 text-xs text-gray-500 dark:text-gray-400",children:t("planCard.loading")}):g?n.jsx("div",{className:"px-4 py-6 text-xs text-red-600 dark:text-red-400",children:g}):n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs text-gray-800 dark:text-gray-200",children:l})]})})]})}const GF="plan.md";function KF(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function YF(e){return typeof e!="string"||!e?!1:KF(e).toLowerCase()===GF}function XF(e){if(!Array.isArray(e))return null;let t=null;for(const r of e){if(!r||r.type!=="tool"||r.tool!=="write"&&r.tool!=="edit")continue;const a=r.state&&r.state.input||{};YF(a.filePath)&&(t={content:typeof a.content=="string"?a.content:null})}return t}function Jv(e,t,r=!1){if(t){const a=Object.values(t).filter(i=>i.type==="reasoning"&&r?!1:i.type==="text"||i.type==="reasoning"||i.type==="error").map(i=>i.text||i.delta||"").join(`
|
|
86
|
-
|
|
87
|
-
`);if(a)return a}return!e||e.length===0?"":e.filter(a=>a.type==="reasoning"&&r?!1:a.type==="text"||a.type==="reasoning"||a.type==="error").map(a=>a.text||"").join(`
|
|
88
|
-
|
|
89
|
-
`)}function QF(e,t,r){const a=Jv(e,t,r);if(!e||e.length===0)return a;const i=[];for(let o=0;o<e.length;o++){const l=e[o];if(l.type!=="tool")continue;const u=l.tool||l.state&&l.state.title||"",d=l.state||{},f=d.input||{},g=[];u&&g.push(u),f._purpose&&g.push(f._purpose);const h=Object.keys(f).filter(m=>m!=="_purpose");if(h.length>0){const m={};for(let y=0;y<h.length;y++)m[h[y]]=f[h[y]];try{g.push(JSON.stringify(m))}catch{}}if(d.output){let m=typeof d.output=="string"?d.output:(function(){try{return JSON.stringify(d.output,null,2)}catch{return String(d.output)}})();m=m.replace(/\x1b\[[0-9;]*m/g,""),m.length>500&&(m=m.slice(0,500)),g.push(m)}if(d.error){const m=typeof d.error=="string"?d.error:d.error.message||String(d.error);g.push(m)}g.length>0&&i.push(g.join(`
|
|
90
|
-
`))}return i.length===0?a:a+`
|
|
91
|
-
|
|
92
|
-
`+i.join(`
|
|
93
|
-
|
|
94
|
-
`)}function ZF(e){let t=e;return t=t.replace(/```[\s\S]*?```/g,`
|
|
95
|
-
`),t=t.replace(/(^|\n)\n((?:(?: {4}|\t).+\n?)+)/g,`$1
|
|
96
|
-
`),t=t.replace(/^((?:(?: {4}|\t).+\n?)+)/,`
|
|
97
|
-
`),t=t.replace(/`[^`\n]+`/g," "),t=t.replace(/!\[[^\]]*\]\([^)]*\)/g," "),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/^\[[^\]]+\]:\s.*$/gm," "),t=t.replace(/<(https?:\/\/[^>]+)>/g,"$1"),t=t.replace(/<\/?[a-zA-Z][^>]*>/g," "),t}function eR({message:e,parts:t,streamingParts:r,user:a,searchQuery:i,matchOffset:o,matchCount:l,activeMatchIndex:u,registerMatchRef:d,onRetry:f,onEditAndResend:g,onCancelQueued:h,hackerMode:m,mobileFrameless:y,hideThinking:v,isPrivate:k,isLast:_,isBusy:w,sessionID:S,questionIdMap:E,isCompactedOut:A}){var{t:T}=Xt(),C=e.role==="user",j=!C&&_&&!w?XF(t)!==null:!1,L=C&&e._queued===!0,O=a!=null&&a.name?a.name.charAt(0).toUpperCase():"U",[I,B]=x.useState(!1),[z,ee]=x.useState(!1),[$,M]=x.useState(""),G=x.useRef(null),Y=x.useRef(!0),X=x.useRef(null);x.useEffect(function(){var qe=X.current;!qe||!z||(qe.style.height="auto",qe.style.height=Math.min(qe.scrollHeight,300)+"px")},[$,z]),x.useEffect(function(){return Y.current=!0,function(){Y.current=!1,G.current&&clearTimeout(G.current)}},[]);var ie=Jv(t,r,v),F=(t||[]).filter(function(qe){return qe.type==="tool"}),U=(t||[]).filter(function(qe){return qe.type==="file"&&qe.filename}),Z=(t||[]).filter(function(qe){if(qe.type!=="image_url"||!qe.image_url)return!1;var Ye=qe.image_url.url||qe.image_url;if(typeof Ye!="string")return!1;if(Ye.startsWith("data:image/")){var yt=Ye.indexOf(";"),ht=yt>5?Ye.substring(5,yt).toLowerCase():"",Dt=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return Dt.indexOf(ht)!==-1}if(Ye.startsWith("https://"))try{var nt=new URL(Ye),Pt=nt.pathname.toLowerCase();return!Pt.endsWith(".svg")&&!Pt.endsWith(".svgz")}catch{return!1}return!1});if(!C){var P=!!ie,K=Z.length>0,V=F.length>0,W=F.some(function(qe){return(qe.tool||qe.state&&qe.state.title||"")==="question"}),ae=!m||W,Q=(t||[]).some(function(qe){return qe.type==="reasoning"&&qe.text}),he=!1;if(r)for(var Ne=Object.keys(r),De=0;De<Ne.length;De++){var Ve=r[Ne[De]];if(Ve&&Ve.type==="reasoning"&&(Ve.text||Ve.delta)){he=!0;break}}var at=Q||he,lt=(t||[]).some(function(qe){return qe.type==="error"&&qe.text});if(!qF({hasText:P,hasImages:K,hasTools:V,toolsVisibleHere:ae,hasReasoning:at,hasError:lt,isFrameless:y,hideThinking:v,finish:e.finish}))return null}var Ce=eB(e.time,T),$e=e.isAutoInjected===!0,Be=e.isCompaction===!0,gt=e.isContinuation===!0,ut=Be&&!gt,jt=function(){var qe=ie||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(qe).then(function(){Y.current&&(B(!0),G.current&&clearTimeout(G.current),G.current=setTimeout(function(){Y.current&&B(!1)},2e3))}).catch(function(){Y.current&&Ge(qe)}):Ge(qe)},Ge=function(qe){var Ye=document.createElement("textarea");Ye.value=qe,Ye.style.position="fixed",Ye.style.opacity="0",document.body.appendChild(Ye),Ye.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(Ye)}Y.current&&(B(!0),G.current&&clearTimeout(G.current),G.current=setTimeout(function(){Y.current&&B(!1)},2e3))},we=function(){M(ie||""),ee(!0)},Ue=function(){ee(!1),M("")},Ae=function(){$.trim()&&(L&&h&&h(e.id),g&&g($.trim())),ee(!1),M("")},rt=null;if(C){var fe=gt?T("compaction.continuation_message_label")||"Compaction done. Please continue.":Be?T("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":ie;i&&l>0&&!Be&&!gt?rt=tB(ie||"",i,o,u,d):rt=n.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:fe})}var ce={pre:function({node:qe,children:Ye,...yt}){if(x.isValidElement(Ye)){var ht=Ye.type;if(ht==="code"||typeof ht=="string"&&ht.toLowerCase()==="code"){var Dt=Ye.props||{},nt=Dt.className||"",Pt=nt.match(/language-(\S+)/),$t=Pt?Pt[1]:"",lr=qc(Dt.children);return n.jsx(rf,{language:$t,className:nt,frameless:ye,children:lr})}}var pr=qc(Ye);return pr?n.jsx(rf,{language:"",className:"",frameless:ye,children:pr}):n.jsx("pre",{...yt,children:Ye})},code:function({node:qe,className:Ye,children:yt,...ht}){if(qe&&qe.position&&ht["data-sourcepos"],Ye&&Ye.indexOf("language-")!==-1){var Dt=Ye.match(/language-(\S+)/),nt=Dt?Dt[1]:"";return n.jsx(rf,{language:nt,className:Ye,frameless:ye,children:qc(yt)})}return n.jsx("code",{className:ye?"px-1 py-0.5 rounded bg-gray-100 dark:bg-gray-700/50 text-sm font-mono":"px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-sm font-mono",...ht,children:yt})},a:function({node:qe,children:Ye,href:yt,...ht}){return n.jsx("a",{href:yt,...ht,target:"_blank",rel:"noopener noreferrer",children:Ye})},table:function({node:qe,children:Ye,...yt}){return n.jsx("div",{className:ye?"overflow-x-auto my-3":"overflow-x-auto",children:n.jsx("table",{className:ye?"w-full text-sm border-collapse [&>tbody>tr:nth-child(odd)]:bg-gray-50 dark:[&>tbody>tr:nth-child(odd)]:bg-gray-800/30":"",...yt,children:Ye})})},th:function({node:qe,children:Ye,...yt}){return n.jsx("th",{className:ye?"px-3 py-1.5 text-left font-medium border-b border-gray-200 dark:border-gray-700":"",...yt,children:Ye})},td:function({node:qe,children:Ye,...yt}){return n.jsx("td",{className:ye?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...yt,children:Ye})}},ve={current:0},ye=y&&!C,it=ye&&_&&w;return n.jsxs("div",{className:`group flex gap-3 ${C?"justify-end":"justify-start"} ${L?"opacity-60 italic":""}${A&&!ut?" opacity-60":""}`,"data-compacted-out":A?"true":void 0,children:[!C&&!ye&&n.jsx("div",{className:`flex-shrink-0 w-7 h-7 rounded-lg flex items-center justify-center mt-1 ${k?"bg-emerald-600":"bg-primary-500"}`,title:k?"Private model (DLP)":void 0,children:k?n.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-7a2 2 0 00-2-2H6a2 2 0 00-2 2v7a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}):n.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),n.jsxs("div",{className:`flex flex-col min-w-0 ${ye?"w-full":"max-w-[70%] 3xs:max-w-[75%] xs:max-w-[80%] sm:max-w-[85%]"}`,children:[n.jsx("div",{className:`min-w-0 overflow-hidden ${C?`bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5${L&&!z?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:ye?it?"border-t-2 border-primary-400 dark:border-primary-500/60 pt-2":"":`${k?"bg-emerald-50 dark:bg-emerald-950/40 ring-1 ring-emerald-500/30":"bg-gray-100 dark:bg-gray-800"} text-gray-900 dark:text-gray-100 rounded-2xl rounded-bl-md px-4 py-2.5`}`,...L&&!z&&g&&h?{onClick:we,title:T("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(qe){(qe.key==="Enter"||qe.key===" ")&&(qe.preventDefault(),we())}}:{},children:C?z?n.jsxs("div",{className:"space-y-2",children:[n.jsx("textarea",{ref:X,value:$,onChange:function(qe){M(qe.target.value)},className:"w-full bg-white/20 text-white placeholder-white/50 text-sm rounded-lg px-3 py-2 outline-none resize-none min-h-[60px] max-h-[300px] overflow-y-auto",rows:1,autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:Ue,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),n.jsx("button",{onClick:Ae,className:"px-3 py-1 text-xs rounded-lg bg-white/30 hover:bg-white/40 font-medium transition-colors",children:"Send"})]})]}):n.jsxs("div",{className:"text-sm whitespace-pre-wrap break-words",children:[rt,U.length>0&&n.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:U.map(function(qe,Ye){return n.jsxs("div",{className:"inline-flex items-center gap-2 bg-white/15 border border-white/30 rounded-lg px-2 py-1 text-xs max-w-xs",title:qe.mime||"",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n.jsx("span",{className:"truncate",children:qe.filename})]},qe.id||"file-"+Ye)})}),Z.length>0&&n.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Z.map(function(qe,Ye){var yt=qe.image_url.url||qe.image_url;return n.jsx("a",{href:yt,target:"_blank",rel:"noopener noreferrer",children:n.jsx("img",{src:yt,alt:T("chat.attachment_with_index",{index:Ye+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},qe.id||"img-"+Ye)})})]}):JF(t,r,Z,U,ce,ve,i,o,l,u,d,m,v,T,ye,E,_,w)}),j&&n.jsx(VF,{sessionId:S}),n.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${C?"justify-end":"justify-start"}`,children:[Ce&&n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:Ce}),$e&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400 leading-none",children:T("chat.idle_injection_auto_badge")}),(e.finish==="aborted"||e.finish==="interrupted")&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-orange-100 dark:bg-orange-900/40 text-orange-600 dark:text-orange-400 leading-none",children:e.finish==="aborted"?T("chat.stopped_badge")||"Stopped":T("chat.interrupted_badge")||"Interrupted"}),e.finish==="error"&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full bg-red-100 dark:bg-red-900/40 text-red-600 dark:text-red-400 leading-none",children:T("chat.error_badge")||"Error"}),e.moeTopK&&e.moeTopK>0&&n.jsx("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded-full leading-none ${e.moeTopK<=4?"bg-orange-100 dark:bg-orange-900/40 text-orange-600 dark:text-orange-400":e.moeTopK<=6?"bg-amber-100 dark:bg-amber-900/40 text-amber-600 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400"}`,children:e.moeTopK<=4?"Fast":e.moeTopK<=6?"Balanced":"Quality"}),n.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto focus-within:opacity-100 focus-within:pointer-events-auto transition-opacity",children:[ie&&n.jsx("button",{onClick:jt,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T(I?"chat.copied":"chat.copy_message"),title:T(I?"chat.copied":"chat.copy_message"),children:I?n.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),C&&!L&&!z&&g&&n.jsx("button",{onClick:we,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.edit_resend"),title:T("chat.edit_resend"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),C&&L&&!z&&g&&h&&n.jsx("button",{onClick:we,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.edit_resend"),title:T("chat.edit_resend"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),C&&L&&h&&n.jsx("button",{onClick:function(){h(e.id)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-red-500 dark:hover:text-red-400 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.cancel_queued"),title:T("chat.cancel_queued"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})}),!C&&f&&n.jsx("button",{onClick:f,className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors focus:outline-none focus:ring-1 focus:ring-primary-500","aria-label":T("chat.regenerate"),title:T("chat.regenerate"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]})]}),C&&n.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center mt-1",children:n.jsx("span",{className:"text-gray-700 dark:text-gray-200 font-bold text-xs",children:O})})]})}function JF(e,t,r,a,i,o,l,u,d,f,g,h,m,y,v,k,_,w){var S=(e||[]).slice();if(t){for(var E={},A=0;A<S.length;A++)E[S[A].id]=!0;for(var T=Object.keys(t),C=0;C<T.length;C++){var j=t[T[C]];(j.type==="text"||j.type==="reasoning")&&!E[j.id]&&S.push({id:j.id,type:j.type,text:j.text||j.delta||"",live:!0})}}var L=[],O="",I="",B="",z="",ee=!1;function $(){O&&(L.push({type:"text",text:O,key:I}),O="",I="")}function M(){B&&(L.push({type:"reasoning",text:B,key:z,live:ee}),B="",z="",ee=!1)}for(var G=0;G<S.length;G++){var Y=S[G];if(Y.type==="text"){M(),I||(I="text-"+(Y.id||G));var X=Y.text||"";O&&X&&!O.endsWith(`
|
|
98
|
-
`)&&(O+=`
|
|
99
|
-
`),O+=X}else if(Y.type==="reasoning"){$(),z||(z="reasoning-"+(Y.id||G)),Y.live&&(ee=!0);var ie=Y.text||"";B&&ie&&!B.endsWith(`
|
|
100
|
-
`)&&(B+=`
|
|
101
|
-
`),B+=ie}else Y.type==="error"?(M(),$(),L.push({type:"error",text:Y.text||"",key:"error-"+(Y.id||G)})):Y.type==="tool"&&(M(),$(),L.push({type:"tool",part:Y,key:"tool-"+(Y.id||G)}))}if(M(),$(),a.length>0&&L.push({type:"files",parts:a,key:"files"}),r.length>0&&L.push({type:"images",parts:r,key:"images"}),L.length===0)return null;var F=[],U=[],Z="";function P(){U.length>0&&(F.push(n.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:U},"accent-"+Z)),U=[])}for(var K=-1,V=L.length-1;V>=0;V--)if(L[V].type==="reasoning"){K=V;break}for(var W=0;W<L.length;W++){var ae=L[W];if(ae.type==="text"){P();var Q=Object.assign({},i);if(l&&d>0){var he=function(lt,Ce){return function({children:$e,node:Be,...gt}){return n.jsx(lt,{...gt,children:iv($e,l,u,Ce,f,g)})}};Q.p=he("p",o),Q.li=he("li",o),Q.td=he("td",o),Q.th=he("th",o),Q.h1=he("h1",o),Q.h2=he("h2",o),Q.h3=he("h3",o),Q.h4=he("h4",o),Q.h5=he("h5",o),Q.h6=he("h6",o),Q.blockquote=he("blockquote",o)}F.push(n.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:n.jsx(Sl,{remarkPlugins:[El,tf],rehypePlugins:[Vp],components:Q,children:ae.text})},ae.key))}else if(ae.type==="reasoning")if(v){if(P(),m)continue;U.length===0&&(Z=ae.key),U.push(n.jsx(UF,{text:ae.text,isStreaming:ae.live&&W===K&&_&&w},ae.key))}else{if(P(),m)continue;F.push(n.jsxs("div",{className:"my-2 p-3 rounded-lg bg-gray-100 dark:bg-gray-800 border-l-4 border-amber-500 dark:border-amber-400",children:[n.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 text-xs font-medium uppercase tracking-wide",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),y("chat.thinking")]}),n.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-gray-600 dark:text-gray-300 italic opacity-80",children:n.jsx(Sl,{remarkPlugins:[El,tf],rehypePlugins:[Vp],components:i,children:ae.text})})]},ae.key))}else if(ae.type==="error")P(),F.push(n.jsxs("div",{className:"my-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500 dark:border-red-400",children:[n.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs font-medium uppercase tracking-wide",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),y("chat.error_badge")||"Error"]}),n.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-red-600 dark:text-red-300",children:n.jsx(Sl,{remarkPlugins:[El,tf],rehypePlugins:[Vp],components:i,children:ae.text})})]},ae.key));else if(ae.type==="tool"){var Ne=ae.part.tool||ae.part.state&&ae.part.state.title||"",De=Ne==="question";if(De){P();var Ve=ae.part.callID||ae.part.id||"",at=k&&k[Ve]?k[Ve]:null;F.push(n.jsx("div",{className:"my-2",children:n.jsx($F,{part:ae.part,questionId:at})},ae.key))}else v&&!h?(U.length===0&&(Z=ae.key),U.push(n.jsx(zF,{part:ae.part},ae.key))):(P(),F.push(n.jsx("div",{className:`my-2 ${h?"hidden":""}`,children:n.jsx(BF,{part:ae.part})},ae.key)))}else ae.type==="files"?(P(),F.push(n.jsx("div",{className:F.length>0?"mt-2":"",children:n.jsx("div",{className:"flex flex-wrap gap-2",children:ae.parts.map(function(lt,Ce){return n.jsxs("div",{className:"inline-flex items-center gap-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm max-w-xs",title:lt.mime||"",children:[n.jsx("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n.jsx("span",{className:"truncate text-xs text-gray-700 dark:text-gray-300",children:lt.filename})]},lt.id||"file-"+Ce)})})},ae.key))):ae.type==="images"&&F.push(n.jsx("div",{className:F.length>0?"mt-2":"",children:n.jsx("div",{className:"flex flex-wrap gap-2",children:ae.parts.map(function(lt,Ce){var $e=lt.image_url.url||lt.image_url;return n.jsx("a",{href:$e,target:"_blank",rel:"noopener noreferrer",children:n.jsx("img",{src:$e,alt:y("chat.attachment_with_index",{index:Ce+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},lt.id||"img-"+Ce)})})},ae.key))}return P(),F}function qc(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(qc).join(""):x.isValidElement(e)?qc(e.props.children):""}function eB(e,t){if(!e)return"";var r=e.created||e.updated;if(!r)return"";var a=new Date(r);if(isNaN(a.getTime()))return"";var i=new Date,o=a.toDateString()===i.toDateString(),l=new Date(i);l.setDate(l.getDate()-1);var u=a.toDateString()===l.toDateString(),d=a.getHours(),f=a.getMinutes(),g=d>=12?"PM":"AM";d=d%12,d===0&&(d=12);var h=d+":"+(f<10?"0":"")+f+" "+g;if(o)return h;if(u)return t?t("chat.yesterday_time",{time:h}):"Yesterday "+h;var m=a.getMonth()+1,y=a.getDate();return m+"/"+y+" "+h}function tB(e,t,r,a,i){if(!t||!e)return n.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:e});for(var o=e.toLowerCase(),l=t.toLowerCase(),u=[],d=0,f=0;;){var g=o.indexOf(l,d);if(g===-1)break;g>d&&u.push(e.substring(d,g));var h=r+f,m=h===a;u.push(n.jsx("mark",{ref:function(y){i(h,y)},className:m?"bg-accent-400 text-gray-900 rounded-sm px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-sm px-0.5",children:e.substring(g,g+t.length)},"m-"+f)),f++,d=g+t.length}return d<e.length&&u.push(e.substring(d)),n.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:u})}function iv(e,t,r,a,i,o){if(!e)return e;if(Array.isArray(e))return e.map(function(k,_){return n.jsx(x.Fragment,{children:iv(k,t,r,a,i,o)},_)});if(typeof e=="string"){for(var l=e,u=l.toLowerCase(),d=t.toLowerCase(),f=[],g=0;;){var h=u.indexOf(d,g);if(h===-1)break;h>g&&f.push(l.substring(g,h));var m=r+a.current,y=m===i;f.push(n.jsx("mark",{ref:function(k){o(m,k)},className:y?"bg-accent-400 text-gray-900 rounded-sm px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-sm px-0.5",children:l.substring(h,h+t.length)},"m-"+a.current)),a.current++,g=h+t.length}return g<l.length&&f.push(l.substring(g)),f.length>0?f:l}if(x.isValidElement(e)){if(e.type==="code"||e.type===rf)return e;if(e.props&&e.props.children!==void 0){var v=iv(e.props.children,t,r,a,i,o);return x.cloneElement(e,void 0,v)}}return e}function rB({sessionID:e,banners:t,hidden:r,onToggle:a}){var[i,o]=x.useState(0),[l,u]=x.useState(!1);if(x.useRef(null),x.useEffect(function(){o(0)},[e,t&&t.length,t&&t[0]&&t[0].timestamp]),!e||!t||t.length===0)return null;if(r)return n.jsx("button",{type:"button",onClick:a,className:"w-full text-center text-xs text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 py-1 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 transition-colors","aria-label":"Show banner",children:"▾ Show banner"});var d=t[i]||t[0],f=function(){o(function(h){return Math.min(t.length-1,h+1)})},g=function(){o(function(h){return Math.max(0,h-1)})};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"sticky top-0 z-10 bg-white dark:bg-gray-900 group border-b border-gray-200 dark:border-gray-800",children:n.jsxs("div",{className:"relative w-full overflow-hidden cursor-zoom-in",style:{aspectRatio:"16 / 9",maxHeight:"20vh"},onClick:function(){u(!0)},title:d.prompt||"Session banner",children:[n.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-full object-cover",loading:"lazy",draggable:!1}),d.prompt?n.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent text-white text-xs px-3 py-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:n.jsx("div",{className:"line-clamp-2",children:d.prompt})}):null,t.length>1?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),f()},disabled:i>=t.length-1,className:"absolute left-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Older banner",children:"‹"}),n.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),g()},disabled:i<=0,className:"absolute right-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Newer banner",children:"›"}),n.jsx("div",{className:"absolute top-1 right-2 bg-black/40 text-white text-[10px] px-1.5 py-0.5 rounded opacity-0 group-hover:opacity-100 transition-opacity",children:i+1+" / "+t.length})]}):null]})}),l?n.jsxs("div",{className:"fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-4 cursor-zoom-out",onClick:function(){u(!1)},children:[n.jsxs("div",{className:"max-w-5xl w-full",onClick:function(h){h.stopPropagation()},children:[n.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-auto rounded shadow-2xl",style:{aspectRatio:"16 / 9",objectFit:"cover"}}),d.prompt?n.jsx("div",{className:"text-white text-sm mt-3 px-2",children:d.prompt}):null,n.jsxs("div",{className:"text-white/60 text-xs mt-1 px-2",children:[new Date(d.timestamp).toLocaleString(),t.length>1?" · "+(i+1)+" of "+t.length:""]})]}),n.jsx("button",{type:"button",className:"absolute top-4 right-4 text-white text-2xl leading-none w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20",onClick:function(){u(!1)},"aria-label":"Close",children:"×"})]}):null]})}const nB=x.forwardRef(function({messages:t,unloadedCompactedCount:r,onExpandCompactedHistory:a,hasOlderMessages:i,loadingOlderMessages:o,onLoadOlderMessages:l,streamingParts:u,streamingProgress:d,isBusy:f,compactingInfo:g,compactionResult:h,onSwitchToCompactedSession:m,onDismissCompactionResult:y,user:v,searchQuery:k,activeMatchIndex:_,onTotalMatchesChange:w,onRetry:S,onEditAndResend:E,onCancelQueued:A,hackerMode:T,mobileFrameless:C,hideThinking:j,sessionID:L,banners:O,bannerHidden:I,onToggleBanner:B,privateMessageIds:z,parentSessionID:ee,onViewParentSession:$,compactionPinned:M,onUnpinCompaction:G,questionIdMap:Y},X){const{t:ie}=Xt();var F=x.useRef(null),U=x.useRef(!0),Z=x.useRef({}),P=x.useRef(null),K=x.useRef(null),[V,W]=x.useState(!1),ae=x.useRef(-1),Q=x.useRef(0),he=x.useRef(null),Ne=x.useRef(null),De=x.useRef(t.length);De.current=t.length;var[Ve,at]=x.useState(!1),lt=x.useRef({startIndex:0,endIndex:0}),Ce=x.useRef(null),$e=x.useRef(!1),Be=x.useRef(0),gt=x.useRef(null);x.useEffect(function(){at(!1),gt.current=null},[L]);var ut=x.useCallback(function(){U.current=!0,K.current?K.current.scrollTop=K.current.scrollHeight:F.current&&F.current.scrollToIndex({index:"LAST",behavior:"smooth",align:"end"})},[]);x.useImperativeHandle(X,function(){return{scrollToBottom:ut,resetAutoScroll:function(){U.current=!0}}},[ut]);var jt=x.useCallback(function(Te,oe){oe?Z.current[Te]=oe:delete Z.current[Te]},[]),Ge=x.useRef({}),we=x.useMemo(function(){if(!k)return{perMessage:{},total:0,_nextCache:{}};for(var Te=k.toLowerCase(),oe=0,bt={},Pe={},te=Ge.current,be=0;be<t.length;be++){var ze=t[be],Je=QF(ze.parts,u[ze.info.id],j),Bt=ze.info.role==="assistant",Ft=Bt?ZF(Je):Je,Jt=Ft.toLowerCase(),Fe=ze.info.id,kt=te[Fe],Qt;kt&&kt.text===Jt&&kt.query===Te?Qt=kt.count:Qt=aB(Jt,Te),Pe[Fe]={text:Jt,query:Te,count:Qt},Qt>0&&(bt[ze.info.id]={offset:oe,count:Qt,messageIndex:be}),oe+=Qt}return{perMessage:bt,total:oe,_nextCache:Pe}},[t,u,k,j]);x.useEffect(function(){Ge.current=we._nextCache},[we]);var Ue=x.useMemo(function(){return{perMessage:we.perMessage,total:we.total}},[we]);x.useEffect(function(){w&&w(Ue.total)},[Ue.total,w]);var Ae=x.useMemo(function(){for(var Te=0,oe=0;oe<t.length;oe++)t[oe].info.compactedOut===!0&&Te++;return Te},[t]),rt=x.useMemo(function(){return Ve||Ae===0?t:t.filter(function(Te){return Te.info.compactedOut!==!0})},[t,Ve,Ae]),fe=x.useRef(rt.length);fe.current=rt.length,x.useEffect(function(){if(!(!k||Ue.total===0||Ve||Ae===0)){var Te=Ue.perMessage;for(var oe in Te)if(Te.hasOwnProperty(oe)&&Te[oe].messageIndex<Ae){at(!0);break}}},[k,Ue,Ve,Ae]),x.useLayoutEffect(function(){if(Ce.current!=null&&F.current){var Te=Ce.current;if(Ce.current=null,Te<0||Te>=rt.length)return;var oe=requestAnimationFrame(function(){F.current&&F.current.scrollToIndex({index:Te,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(oe)}}},[rt]),x.useLayoutEffect(function(){var Te=gt.current;if(!(!Te||rt.length<=Te.count||!F.current)){gt.current=null;var oe=Te.index+(rt.length-Te.count),bt=requestAnimationFrame(function(){F.current&&F.current.scrollToIndex({index:oe,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(bt)}}},[rt]);var ce=x.useCallback(function(){!l||o||($e.current=!0,gt.current={index:lt.current.startIndex,count:rt.length},Promise.resolve(l()).then(function(Te){setTimeout(function(){var oe=gt.current;(!Te||Te.length===0||oe&&fe.current<=oe.count)&&(gt.current=null)},0)},function(){gt.current=null}))},[l,o,rt.length]),ve=x.useCallback(function(){if($e.current=!0,Ve){Ce.current=0,at(!1);return}Ae>0?(Ce.current=lt.current.startIndex+Ae,at(!0)):r>0&&a&&(Ce.current=lt.current.startIndex+r,at(!0),a())},[Ve,Ae,r,a]);x.useEffect(function(){var Te=rt.length>Be.current;if(Be.current=rt.length,!Te||!U.current||$e.current){$e.current=!1;return}var oe=setTimeout(function(){U.current&&K.current&&(K.current.scrollTop=K.current.scrollHeight)},150);return function(){clearTimeout(oe)}},[rt.length]),x.useEffect(function(){!U.current||k||K.current&&(K.current.scrollTop=K.current.scrollHeight)},[u,t,k]),x.useEffect(function(){var Te=he.current!==L;he.current=L,Te&&(U.current=!0,ae.current=-1,Be.current=0,Q.current=Date.now()+600,W(!1));function oe(){U.current&&K.current&&(K.current.scrollTop=K.current.scrollHeight)}var bt=requestAnimationFrame(oe),Pe=setTimeout(oe,150),te=setTimeout(oe,450);return function(){cancelAnimationFrame(bt),clearTimeout(Pe),clearTimeout(te)}},[L,t]);var ye=x.useCallback(function(){var Te=K.current;if(Te){var oe=Te.scrollTop,bt=oe+Te.clientHeight>=Te.scrollHeight-4;bt?U.current=!0:ae.current>=0&&oe<ae.current-8&&Date.now()>Q.current&&(U.current=!1),ae.current=oe,W(!bt&&!U.current&&De.current>0)}},[]),it=x.useCallback(function(Te){!Te||Ne.current===Te||(Ne.current&&Ne.current.removeEventListener("scroll",ye),Ne.current=Te,Te.addEventListener("scroll",ye,{passive:!0}))},[ye]);x.useEffect(function(){return function(){Ne.current&&Ne.current.removeEventListener("scroll",ye)}},[ye]);var qe=x.useMemo(function(){if(!k||Ue.total===0)return[];var Te=[],oe=Ue.perMessage;for(var bt in oe)oe.hasOwnProperty(bt)&&Te.push(oe[bt]);return Te.sort(function(Pe,te){return Pe.messageIndex-te.messageIndex}),Te},[k,Ue]);x.useEffect(function(){if(!(!k||Ue.total===0||_<0)){for(var Te=-1,oe=0;oe<qe.length;oe++){var bt=qe[oe];if(_>=bt.offset&&_<bt.offset+bt.count){Te=bt.messageIndex;break}}if(!(Te<0)){var Pe=Ve||Ae===0?0:Ae,te=Te-Pe;if(!(te<0)){F.current&&F.current.scrollToIndex({index:te,align:"center",behavior:"smooth"});var be=requestAnimationFrame(function(){var ze=setTimeout(function(){var Je=Z.current[_];Je&&Je.scrollIntoView&&Je.scrollIntoView({behavior:"smooth",block:"center"})},200);P.current=ze});return function(){cancelAnimationFrame(be),P.current&&(clearTimeout(P.current),P.current=null)}}}}},[_,k,Ue.total,qe,Ve,Ae]),x.useEffect(function(){Z.current={}},[k]);for(var Ye=-1,yt=rt.length-1;yt>=0;yt--)if(rt[yt].info.role==="assistant"){Ye=yt;break}var ht=x.useCallback(function(Te){return k?!1:Te?f?"auto":"smooth":!1},[k,f]),Dt=x.useCallback(function(Te){Te&&(U.current=!0),W(!Te&&!U.current&&De.current>0)},[]),nt=x.useMemo(function(){return Ve&&Ae>0?{top:3e3,bottom:600}:{top:600,bottom:600}},[Ve,Ae]),Pt=x.useCallback(function(Te,oe){var bt=Ue.perMessage[oe.info.id]||null,Pe=Te===Ye,te=oe.info.role==="user",be=oe.info.compactedOut===!0,ze=Ve&&Te>0&&t[Te-1].info.compactedOut===!0,Je=ze&&!be;return n.jsxs("div",{className:"px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[Je?n.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none mb-6",children:[n.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:ie&&ie("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),n.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]}):null,n.jsx(eR,{isCompactedOut:be,message:oe.info,parts:oe.parts,streamingParts:u[oe.info.id],user:v,searchQuery:k,matchOffset:bt?bt.offset:-1,matchCount:bt?bt.count:0,activeMatchIndex:_,registerMatchRef:jt,isLast:Pe,isBusy:f,sessionID:L,onRetry:Pe&&!f&&!be?S:void 0,onEditAndResend:te&&!f&&!be&&!sB(oe.parts)?E:void 0,onCancelQueued:be?void 0:A,hackerMode:T,mobileFrameless:C,hideThinking:j,isPrivate:z&&z.has(oe.info.id),questionIdMap:Y})]})},[Ue,Ye,t,u,v,k,_,jt,f,L,S,E,A,T,C,j,z,Y,Ve,ie]),$t=x.useMemo(function(){return n.jsxs(n.Fragment,{children:[f&&(C?!0:!iB(t,u,T,j))&&(C?n.jsx("div",{className:"flex justify-start py-2 px-2 sm:px-4 max-w-full sm:max-w-3xl mx-auto",children:n.jsx("svg",{className:"w-4 h-4 text-indigo-400 dark:text-indigo-300 flex-shrink-0 animate-pulse",viewBox:"0 0 24 24",fill:"currentColor",role:"img","aria-label":ie("chat.assistant_typing")||"Assistant is typing",children:n.jsx("path",{d:"M12 2l2.4 7.6L22 12l-7.6 2.4L12 22l-2.4-7.6L2 12l7.6-2.4L12 2z"})})}):n.jsxs("div",{className:"flex gap-3 justify-start px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[n.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-primary-500 flex items-center justify-center mt-1",children:n.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),n.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"0ms"}}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"150ms"}}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"300ms"}})]})})]})),f&&!C&&d&&d.toolCalls>0&&n.jsxs("div",{className:"flex gap-3 justify-start px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[n.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-accent-500 flex items-center justify-center mt-1",children:n.jsxs("svg",{className:"w-4 h-4 text-white animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),n.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-2 sm:px-4 py-3 min-w-0 max-w-[75%] sm:max-w-[320px]",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:oB(d.toolNames,ie)}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:lB(d.toolArgBytes)})]}),n.jsx("div",{className:"h-1 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-accent-500 rounded-full animate-progress-indeterminate",style:{width:"40%",animation:"progress-indeterminate 1.5s ease-in-out infinite"}})})]})]})]})},[f,C,t,u,d,T,j,ie]),lr=x.useMemo(function(){return function(){return n.jsxs(n.Fragment,{children:[n.jsx(rB,{sessionID:L,banners:O,hidden:I,onToggle:B}),n.jsx(uB,{sessionID:L,parentSessionID:ee,onViewParentSession:$,compactionPinned:M,onUnpinCompaction:G,t:ie}),i?n.jsx("div",{className:"flex justify-center py-1.5",children:n.jsx("button",{type:"button",onClick:ce,disabled:o,"data-testid":"load-older-messages",className:"px-3 py-1 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors shadow-sm",children:o?ie&&ie("messages.loading_earlier")||"Loading earlier messages...":ie&&ie("messages.load_earlier")||"Load earlier messages"})}):null,Ae>0||r>0?n.jsx("div",{className:"sticky top-0 z-10 flex justify-center py-1.5 pointer-events-none",children:n.jsx("button",{type:"button",onClick:ve,"data-testid":"compaction-collapse-toggle",className:"pointer-events-auto px-3 py-1 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 transition-colors shadow-sm",children:Ve&&Ae>0?ie&&ie("compaction.hide_history")||"Hide messages before compaction":ie&&ie("compaction.show_history",{count:Ae>0?Ae:r})||"Conversation summarized — "+(Ae>0?Ae:r)+" earlier messages collapsed; summary below"})}):null]})}},[L,O,I,B,ee,$,M,G,ie,i,o,ce,Ae,r,Ve,ve]),pr=x.useRef($t);pr.current=$t;var _r=x.useRef(null);_r.current||(_r.current={version:0,listeners:new Set});var cr=_r.current;x.useEffect(function(){cr.version+=1,cr.listeners.forEach(function(Te){Te()})},[$t,cr]);var ir=x.useMemo(function(){return function(){return x.useSyncExternalStore(function(oe){return cr.listeners.add(oe),function(){cr.listeners.delete(oe)}},function(){return cr.version}),pr.current}},[]),ue=x.useMemo(function(){return{Header:lr,Footer:ir}},[lr,ir]),Me=rt.length===0&&(Ae>0||r>0),Ke=Ae>0?Ae:r;return Me?n.jsx("div",{className:"flex-1 relative overflow-hidden",children:n.jsx(cB,{count:Ke,onExpand:ve,t:ie})}):n.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[n.jsx(S5,{ref:F,scrollerRef:function(Te){K.current=Te,Te&&it(Te)},data:rt,itemContent:Pt,followOutput:ht,atBottomStateChange:Dt,rangeChanged:function(Te){lt.current=Te},increaseViewportBy:nt,defaultItemHeight:120,computeItemKey:function(Te,oe){return oe.info.id},components:ue,className:"h-full",style:{overflowY:"auto",overflowX:"hidden"}}),V&&n.jsx("button",{onClick:ut,"aria-label":ie("chat.scroll_to_bottom"),className:"fixed bottom-24 left-1/2 -translate-x-1/2 z-10 w-9 h-9 rounded-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow-lg flex items-center justify-center text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-primary-500 transition-all",title:ie("chat.scroll_to_bottom"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})});function aB(e,t){if(!t)return 0;for(var r=0,a=0;a=e.indexOf(t,a),a!==-1;)r++,a+=t.length;return r}function iB(e,t,r,a){var i=!r;for(var o of Object.keys(t)){var l=t[o];if(l){var u=Object.values(l).some(function(m){return m.type==="reasoning"&&a?!1:(m.type==="text"||m.type==="reasoning")&&(m.text||m.delta)});if(u)return!0}}for(var d=e.length-1;d>=0;d--){var f=e[d];if(f.info.role==="assistant"){var g=(f.parts||[]).some(function(m){return m.type==="reasoning"&&a?!1:(m.type==="text"||m.type==="reasoning")&&m.text}),h=(f.parts||[]).some(function(m){return m.type==="tool"});return g||i&&h}if(f.info.role==="user")break}return!1}function sB(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function oB(e,t){if(!e||e.length===0)return t?t("chat.tool_preparing"):"Preparing tool call";var r={write:t?t("chat.tool_write"):"Writing file",edit:t?t("chat.tool_edit"):"Editing file",read:t?t("chat.tool_read"):"Reading file",bash:t?t("chat.tool_bash"):"Running command",glob:t?t("chat.tool_glob"):"Searching files",grep:t?t("chat.tool_grep"):"Searching code"},a=e[0],i=r[a]||(t?t("chat.tool_preparing_name",{name:a}):"Preparing "+a);return e.length>1&&(i+=" +"+(e.length-1)),i}function lB(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function cB({count:e,onExpand:t,t:r}){return n.jsx("div",{"data-testid":"compaction-empty-state",className:"h-full flex flex-col items-center justify-center text-center px-6 py-10",children:n.jsxs("div",{className:"max-w-sm mx-auto flex flex-col items-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-full bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center mb-4",children:n.jsx("svg",{className:"w-6 h-6 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),n.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:r&&r("compaction.empty_title")||"This conversation was summarized"}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-5 leading-relaxed",children:r&&r("compaction.empty_body")||"Earlier messages are collapsed to save context. Show them to see the full history."}),n.jsx("button",{type:"button",onClick:t,"data-testid":"compaction-empty-expand",className:"px-4 py-2 rounded-lg text-xs font-medium bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 transition-colors shadow-sm",children:r&&r("compaction.empty_action",{count:e})||"Show "+e+" earlier messages"})]})})}function uB({sessionID:e,parentSessionID:t,onViewParentSession:r,compactionPinned:a,onUnpinCompaction:i,t:o}){var l="pave:compactionBannerDismissed:"+e,u=function(){try{return localStorage.getItem(l)==="1"}catch{return!1}},d=function(){try{localStorage.setItem(l,"1")}catch{}y(!0)},f=function(){r&&t&&r(t)},g=u(),h=x.useState(!g),m=h[0],y=h[1];return!t||m?null:n.jsx("div",{className:"px-2 sm:px-4 py-2 bg-blue-50 dark:bg-blue-900/20 border-b border-blue-200 dark:border-blue-800/50",children:n.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2H7a2 2 0 00-2 2v2M9 11V7a3 3 0 016 0v4"})}),n.jsx("span",{className:"text-xs text-blue-700 dark:text-blue-300 flex-1 min-w-0",children:o&&o("compaction.banner_title")||"This session was compacted from a previous conversation."}),n.jsx("button",{type:"button",onClick:f,className:"text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:o&&o("compaction.view_original")||"View original"}),a?n.jsx("button",{type:"button",onClick:function(){i&&i(e)},className:"text-xs font-medium text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 hover:underline focus:outline-none focus:underline transition-colors whitespace-nowrap flex-shrink-0",children:o&&o("chat.unpin_compacted")||"Unpin — go back to original"}):null,n.jsx("button",{type:"button",onClick:d,"aria-label":o&&o("compaction.dismiss")||"Dismiss",className:"text-blue-400 dark:text-blue-500 hover:text-blue-600 dark:hover:text-blue-300 flex-shrink-0 ml-1",children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const Mf=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],tR=["text/plain","text/markdown","text/csv","application/json","application/xml","application/x-yaml","application/yaml","application/javascript","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.oasis.opendocument.spreadsheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.ms-excel","application/msword","application/vnd.ms-powerpoint","application/rtf","text/rtf"],rR=[...Mf,...tR],mf=5,Zw=Math.floor(4*1024*1024/1.34),Jw=5*1024*1024,e2=6*1024*1024,t2=Math.floor(4*1024*1024/1.34),dB=rR.join(",");function Kp(e){return e?Mf.indexOf(e.toLowerCase())!==-1:!1}var Yp,r2;function fB(){if(r2)return Yp;r2=1;class e{constructor(r){r||(r={}),this._sampleRate=r.sampleRate||16e3,this._capacity=Math.max(1,Math.round((r.maxDuration||30)*this._sampleRate)),this._buffer=new Float32Array(this._capacity),this._start=0,this._length=0,this._totalAppended=0}get capacity(){return this._capacity}get length(){return this._length}get totalAppended(){return this._totalAppended}get sampleRate(){return this._sampleRate}append(r){if(!r||!(r instanceof Float32Array))throw new TypeError("append() requires a Float32Array argument");const a=r.length;if(a===0)return;if(this._totalAppended+=a,a>=this._capacity){const u=a-this._capacity;this._buffer.set(r.subarray(u,a)),this._start=0,this._length=this._capacity;return}const i=(this._start+this._length)%this._capacity,o=Math.min(a,this._capacity-i);this._buffer.set(r.subarray(0,o),i),o<a&&this._buffer.set(r.subarray(o,a),0);const l=this._length+a;if(l<=this._capacity)this._length=l;else{const u=l-this._capacity;this._start=(this._start+u)%this._capacity,this._length=this._capacity}}read(r,a){if(typeof r!="number"||r<0)throw new RangeError("read() offset must be >= 0, got "+r);if(typeof a!="number"||a<0)throw new RangeError("read() count must be >= 0, got "+a);if(r>=this._length||a===0)return new Float32Array(0);const i=Math.min(a,this._length-r),o=new Float32Array(i),l=(this._start+r)%this._capacity,u=Math.min(i,this._capacity-l);return o.set(this._buffer.subarray(l,l+u),0),u<i&&o.set(this._buffer.subarray(0,i-u),u),o}trimBefore(r){(typeof r!="number"||r<0)&&(r=0),r>this._length&&(r=this._length),this._start=(this._start+r)%this._capacity,this._length-=r}clear(){this._start=0,this._length=0,this._totalAppended=0}}return Yp={AudioRingBuffer:e},Yp}var gB=fB(),Xp,n2;function pB(){if(n2)return Xp;n2=1;class e{constructor(r){r||(r={}),this._sampleRate=r.sampleRate||16e3,this._chunkSamples=Math.round((r.chunkDuration||10)*this._sampleRate),this._overlapSamples=Math.round((r.overlapDuration||3)*this._sampleRate),this._minChunkSamples=Math.round((r.minChunkDuration||3)*this._sampleRate),this._maxInitialPrompt=r.maxInitialPrompt||200,this.reset()}get slotIndex(){return this._slotIndex}get pendingNewSamples(){return this._pendingNewSamples}get inflight(){return this._inflight}appendAndSchedule(r){if(this._inflight)return null;const a=r.totalAppended-this._lastSlotEndTotalAppended;this._pendingNewSamples=Math.max(0,a);const i=this._slotIndex===0?this._minChunkSamples:this._chunkSamples;return this._pendingNewSamples<i?null:this._cutSlot(r)}reportResult(r){this._inflight&&(this._inflight=!1,this._prevText=r||"")}drain(r){if(this._inflight)return null;const a=r.totalAppended-this._lastSlotEndTotalAppended;return a<=0?null:this._cutSlot(r,a)}reset(){this._slotIndex=0,this._inflight=!1,this._pendingNewSamples=0,this._lastSlotEndTotalAppended=0,this._prevText="",this._drained=!1}clearPrevText(){this._prevText=""}_cutSlot(r,a){const i=this._slotIndex===0,o=r.totalAppended-r.length,l=i?0:Math.min(this._overlapSamples,Math.max(0,this._lastSlotEndTotalAppended-o)),u=a!=null?Math.min(a,r.totalAppended-this._lastSlotEndTotalAppended):Math.min(this._pendingNewSamples,r.totalAppended-this._lastSlotEndTotalAppended),d=l+u,f=Math.max(0,this._lastSlotEndTotalAppended-o-l),g=r.read(f,d);let h="";this._prevText.length>0&&(h=this._prevText.length>this._maxInitialPrompt?this._prevText.slice(-this._maxInitialPrompt):this._prevText);const m={audio:g,overlapSamples:l,slotIndex:this._slotIndex,initialPrompt:h,chunkId:"slot-"+this._slotIndex};return this._lastSlotEndTotalAppended+=u,this._slotIndex++,this._inflight=!0,this._pendingNewSamples=0,m}}return Xp={TranscriptionScheduler:e},Xp}var hB=pB(),Qp,a2;function mB(){if(a2)return Qp;a2=1;function e(r,a){const i=r.length,o=a.length;if(i===0)return o;if(o===0)return i;let l=new Array(o+1),u=new Array(o+1);for(let d=0;d<=o;d++)l[d]=d;for(let d=1;d<=i;d++){u[0]=d;for(let g=1;g<=o;g++){const h=r[d-1]===a[g-1]?0:1;u[g]=Math.min(u[g-1]+1,l[g]+1,l[g-1]+h)}const f=l;l=u,u=f}return l[o]}function t(r,a,i){if(!r)return a||"";if(!a)return"";const o=i&&i.maxOverlapChars||50,l=i&&typeof i.maxEditRatio=="number"?i.maxEditRatio:.2,u=Math.min(o,r.length,a.length);for(let d=u;d>=1;d--){const f=r.slice(-d),g=a.slice(0,d);if(e(f,g)/d<=l)return a.slice(d)}return a}return Qp={dedupOverlap:t,levenshtein:e},Qp}var xB=mB();const gl=16e3;function zd(e,t,r,a){try{const i=localStorage.getItem(e);if(i==null||i==="")return t;const o=Number(i);return Number.isFinite(o)?Math.min(a,Math.max(r,o)):t}catch{return t}}const yB=2,bB=.6,vB=1,kB=200,i2=3,Zp=2,_B=1e3,s2=.01,o2=800;function l2(e){if(!e||e.length===0)return 0;let t=0;for(let r=0;r<e.length;r++){const a=e[r];t+=a*a}return Math.sqrt(t/e.length)}function wB(e,t){const r=e.sampleRate,a=e.getChannelData(0);if(r===t)return new Float32Array(a);const i=r/t,o=Math.round(a.length/i),l=new Float32Array(o);for(let u=0;u<o;u+=1){const d=u*i,f=Math.floor(d),g=Math.min(f+1,a.length-1),h=d-f;l[u]=a[f]*(1-h)+a[g]*h}return l}function NB(e,t){const i=t*1*2,o=1*(16/8),l=e.length*o,u=new ArrayBuffer(44+l),d=new DataView(u);let f=0;for(let g=0;g<4;g++)d.setUint8(f++,"RIFF".charCodeAt(g));d.setUint32(f,36+l,!0),f+=4;for(let g=0;g<4;g++)d.setUint8(f++,"WAVE".charCodeAt(g));for(let g=0;g<4;g++)d.setUint8(f++,"fmt ".charCodeAt(g));d.setUint32(f,16,!0),f+=4,d.setUint16(f,1,!0),f+=2,d.setUint16(f,1,!0),f+=2,d.setUint32(f,t,!0),f+=4,d.setUint32(f,i,!0),f+=4,d.setUint16(f,o,!0),f+=2,d.setUint16(f,16,!0),f+=2;for(let g=0;g<4;g++)d.setUint8(f++,"data".charCodeAt(g));d.setUint32(f,l,!0),f+=4;for(let g=0;g<e.length;g++){const h=Math.max(-1,Math.min(1,e[g]));d.setInt16(f,h<0?h*32768:h*32767,!0),f+=2}return new Blob([u],{type:"audio/wav"})}function SB({onTranscript:e,onError:t,onAutoSubmit:r,language:a,model:i}){const[o,l]=x.useState("idle"),[u,d]=x.useState(0),[f,g]=x.useState(null),[h,m]=x.useState(null),[y,v]=x.useState(""),k=x.useRef(null),_=x.useRef(null),w=x.useRef(null),S=x.useRef(null),E=x.useRef(!1),A=x.useRef(null),T=x.useRef(null),C=x.useRef(null),j=x.useRef(null),L=x.useRef(null),O=x.useRef(null),I=x.useRef(0),B=x.useRef(!1),z=x.useRef(""),ee=x.useRef(!1),$=x.useRef(null),M=x.useRef(o2),G=x.useRef(null),Y=x.useRef(!1),X=x.useRef(""),ie=x.useRef(""),F=x.useRef("idle"),U=x.useCallback(Ue=>{F.current=Ue,l(Ue)},[]),Z=x.useRef(e),P=x.useRef(t),K=x.useRef(r),V=x.useRef(a),W=x.useRef(i);x.useEffect(()=>{Z.current=e},[e]),x.useEffect(()=>{P.current=t},[t]),x.useEffect(()=>{K.current=r},[r]),x.useEffect(()=>{V.current=a},[a]),x.useEffect(()=>{W.current=i},[i]),x.useEffect(()=>{j.current&&(F.current==="recording"||F.current==="paused")&&j.current.clearPrevText()},[a]);const ae=x.useCallback(()=>L.current?Promise.resolve(L.current):(O.current||(O.current=Bb().then(Ue=>(L.current=Ue,Ue)).catch(()=>{const Ue={mode:"auto",backendAvailable:!1};return L.current=Ue,Ue})),O.current),[]);x.useEffect(()=>{ae()},[ae]);const Q=x.useCallback(()=>{if(A.current&&(A.current.getTracks().forEach(Ue=>Ue.stop()),A.current=null),G.current){try{G.current.readyState===WebSocket.OPEN&&G.current.send("Done"),G.current.close()}catch{}G.current=null}Y.current=!1},[]),he=x.useCallback(()=>{k.current&&(k.current.terminate(),k.current=null)},[]),Ne=x.useCallback(()=>{const Ue=w.current,Ae=_.current,rt=S.current;if(Ue){try{Ue.disconnect()}catch{}Ue.onaudioprocess=null,w.current=null}if(Ae){try{Ae.disconnect()}catch{}_.current=null}if(rt){try{rt.disconnect()}catch{}S.current=null}E.current=!1,Q(),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),he(),C.current&&C.current.clear(),j.current&&j.current.reset(),I.current=0},[Q,he]),De=x.useRef(null),Ve=x.useRef(null),at=x.useRef(null),lt=x.useRef(null),Ce=x.useRef(null),$e=x.useRef(null);De.current=function(Ae){const rt=Ae&&Ae.text||"";Ae&&Ae.chunkId;const fe=j.current,ce=Ae&&Ae._silent;fe&&fe.reportResult(rt);const ve=xB.dedupOverlap(z.current,rt);if(ve){const ye=z.current+ve;z.current=ye,v(ye),Z.current&&Z.current(ve)}if(I.current=0,(ce||rt.trim()==="")&&z.current.trim()&&K.current&&K.current(),F.current==="draining"&&fe&&!fe.inflight){const ye=C.current,it=fe.drain(ye);it?lt.current(it):$e.current();return}at.current()},Ve.current=function(Ae){const rt=j.current;if(rt&&rt.reportResult(""),I.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",Ae,"("+I.current+"/"+i2+")"),I.current>=i2){Ne(),U("idle"),P.current&&P.current("Voice transcription failed repeatedly. Please try again.");return}if(F.current==="draining"&&rt&&!rt.inflight){$e.current();return}at.current()},at.current=function(){const Ae=j.current,rt=C.current;if(!Ae||!rt)return;const fe=F.current;if(fe!=="recording"&&fe!=="paused"&&fe!=="draining")return;const ce=Ae.appendAndSchedule(rt);if(ce){lt.current(ce);return}if((fe==="paused"||fe==="draining")&&!Ae.inflight){const ve=Ae.drain(rt);ve?lt.current(ve):fe==="draining"&&$e.current()}},lt.current=async function(Ae){const rt=l2(Ae.audio);if(rt<s2){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+rt.toFixed(6)+")"),De.current({text:"",chunkId:Ae.chunkId,_silent:!0});return}const fe=L.current||{mode:"auto",backendAvailable:!1},ce=fe.backendAvailable&&fe.mode!=="local-only",ve=fe.mode!=="backend-only",ye=V.current,it=W.current;if(ce&&!B.current){const yt=NB(Ae.audio,gl),ht={};Ae.initialPrompt&&(ht.initialPrompt=Ae.initialPrompt);let Dt=null;for(let nt=0;nt<=Zp;nt++)try{const Pt=await P3(yt,ye,it,ht);if(typeof Pt.text=="string"){m("backend"),De.current({text:Pt.text,chunkId:Ae.chunkId});return}}catch(Pt){Dt=Pt;const $t=Pt.status;if(($t===429||$t===503)&&nt<Zp){const lr=_B*2**nt;console.warn("[useContinuousVoiceInput] Backend "+$t+", retrying in "+lr+"ms (attempt "+(nt+1)+"/"+Zp+")"),await new Promise(pr=>{setTimeout(pr,lr)});continue}($t===429||$t===503)&&(B.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!ve){Ve.current(Dt?Dt.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",Dt?Dt.message:"unknown")}if(!ve){Ve.current("Backend transcription is not available and local mode is disabled.");return}const qe=Ce.current();m("local");const Ye={type:"transcribe",audio:Ae.audio};ye&&(Ye.language=ye),Ae.initialPrompt&&(Ye.initialPrompt=Ae.initialPrompt),Ae.chunkId&&(Ye.chunkId=Ae.chunkId),qe.postMessage(Ye,[Ae.audio.buffer])},Ce.current=function(){if(k.current)return k.current;const Ae=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});return Ae.onmessage=rt=>{const fe=rt.data;if(fe)switch(fe.type){case"loading":d(fe.progress||0),g(fe.file?fe.file.split("/").pop():null);break;case"ready":F.current==="loading"&&U("recording"),d(100),g(null);break;case"result":De.current(fe);break;case"error":Ve.current(fe.error||"Transcription failed");break}},Ae.onerror=()=>{const rt=j.current;rt&&rt.reportResult(""),I.current+=1,he();const fe=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});fe.onmessage=ce=>{const ve=ce.data;if(ve)switch(ve.type){case"loading":d(ve.progress||0),g(ve.file?ve.file.split("/").pop():null);break;case"ready":F.current==="loading"&&U("recording"),d(100),g(null),at.current();break;case"result":De.current(ve);break;case"error":Ve.current(ve.error||"Transcription failed");break}},fe.onerror=()=>{fe.terminate(),k.current=null,Ne(),U("idle"),z.current="",v(""),P.current&&P.current("Voice transcription worker crashed.")},k.current=fe},k.current=Ae,Ae},$e.current=function(){const Ae=k.current;Ae&&Ae.postMessage({type:"unload"}),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),j.current&&j.current.reset(),C.current&&C.current.clear(),U("idle")};const Be=x.useCallback(async()=>{if(F.current==="idle"){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){P.current&&P.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){P.current&&P.current("Audio recording is not supported in this browser.");return}try{const Ue=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:gl,echoCancellation:!0,noiseSuppression:!0}});A.current=Ue,L.current=null,O.current=null;const Ae=await ae(),rt=!!(Ae.streaming&&Ae.streaming.wsUrl),fe=!rt&&(Ae.mode==="local-only"||!Ae.backendAvailable&&Ae.mode!=="backend-only"),ce=window.AudioContext||window.webkitAudioContext;(!T.current||T.current.state==="closed")&&(T.current=new ce);const ve=T.current;if(C.current=new gB.AudioRingBuffer({maxDuration:30,sampleRate:gl}),j.current=new hB.TranscriptionScheduler({chunkDuration:zd("pave.asr.chunkDuration",yB,.5,30),overlapDuration:zd("pave.asr.overlapDuration",bB,0,10),minChunkDuration:zd("pave.asr.minChunkDuration",vB,.3,15),sampleRate:gl,maxInitialPrompt:kB}),z.current="",v(""),I.current=0,B.current=!1,ee.current=!1,$.current=null,M.current=zd("pave.asr.vadSilenceMs",o2,200,5e3),X.current="",ie.current="",Y.current=rt,rt){const yt=(ht,Dt)=>{if(!ht)return Dt;if(!Dt)return ht;const nt=/^[\u3000-\u303F\u4E00-\u9FFF\uFF00-\uFFEF]/.test(Dt),Pt=/\s$/.test(ht)||nt?"":" ";return ht+Pt+Dt};try{const ht=new WebSocket(Ae.streaming.wsUrl);ht.binaryType="arraybuffer",G.current=ht,ht.onmessage=Dt=>{let nt="";try{nt=typeof Dt.data=="string"?Dt.data:new TextDecoder().decode(Dt.data)}catch{return}if(nt==="Done!")return;let Pt="",$t=!1;try{const pr=JSON.parse(nt);Pt=pr&&typeof pr.text=="string"?pr.text:"",$t=!!(pr&&pr.is_final)}catch{Pt=nt}Pt=(Pt||"").trim();const lr=yt(X.current,Pt);lr&&lr!==ie.current&&(ie.current=lr,z.current=lr,v(lr),m("streaming"),Z.current&&Z.current(lr,{mode:"snapshot",engine:Ae.streaming&&Ae.streaming.engine||"paraformer"})),$t&&Pt&&(K.current?(X.current="",ie.current="",z.current="",v(""),K.current()):X.current=yt(X.current,Pt))},ht.onerror=()=>{console.warn("[useContinuousVoiceInput] streaming WS error — falling back unavailable mid-session")}}catch(ht){console.warn("[useContinuousVoiceInput] streaming connect failed:",ht),Y.current=!1}}const ye=ve.createMediaStreamSource(Ue),qe=ve.createScriptProcessor(4096,1,1),Ye=ve.createGain();Ye.gain.value=0,ye.connect(qe),qe.connect(Ye),Ye.connect(ve.destination),_.current=ye,w.current=qe,S.current=Ye,E.current=!1,qe.onaudioprocess=yt=>{if(E.current)return;const ht=yt.inputBuffer,Dt=ht.sampleRate,nt=ht.getChannelData(0);let Pt;if(Dt===gl?Pt=new Float32Array(nt):Pt=wB({sampleRate:Dt,getChannelData:()=>nt},gl),Pt.length===0)return;if(Y.current&&G.current&&G.current.readyState===WebSocket.OPEN){const _r=new Float32Array(Pt.length);_r.set(Pt),G.current.send(_r.buffer);return}const $t=C.current;$t&&$t.append(Pt);const lr=l2(Pt),pr=performance.now();if(lr>=s2)ee.current=!0,$.current=null;else if(ee.current){if(!$.current)$.current=pr;else if(pr-$.current>=M.current){ee.current=!1,$.current=null;const _r=j.current;if(_r&&!_r.inflight&&$t){const cr=_r.drain($t);cr&<.current(cr)}}}at.current()},fe?(U("loading"),d(0),Ce.current().postMessage({type:"load"})):(U("recording"),d(100))}catch(Ue){Q(),U("idle");const Ae=Ue.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(Ue.message||String(Ue));P.current&&P.current(Ae)}}},[ae,Q]),gt=x.useCallback(()=>{const Ue=F.current;if(Ue==="loading"){Ne(),he(),U("idle");return}if(Ue!=="recording"&&Ue!=="paused")return;const Ae=w.current,rt=_.current,fe=S.current;if(Ae){try{Ae.disconnect()}catch{}Ae.onaudioprocess=null,w.current=null}if(rt){try{rt.disconnect()}catch{}_.current=null}if(fe){try{fe.disconnect()}catch{}S.current=null}Q(),U("draining"),setTimeout(()=>{const ce=j.current,ve=C.current;if(!ce||!ve){$e.current();return}if(!ce.inflight){const ye=ce.drain(ve);ye?lt.current(ye):$e.current()}},0)},[Q,Ne,he]),ut=x.useCallback(()=>{F.current==="recording"&&(E.current=!0,U("paused"),at.current())},[]),jt=x.useCallback(()=>{F.current==="paused"&&(E.current=!1,U("recording"))},[]),Ge=x.useCallback(()=>{F.current!=="idle"&&(Ne(),he(),z.current="",v(""),U("idle"))},[Ne,he]),we=x.useCallback(()=>{if(F.current!=="idle"){P.current&&P.current("Cannot clear cache while recording.");return}U("loading"),d(0),he(),Ce.current().postMessage({type:"clearCache"})},[he]);return x.useEffect(()=>()=>{Ne(),he()},[Ne,he]),{state:o,progress:u,downloadingFile:f,transcriptionSource:h,transcriptText:y,startRecording:Be,stopRecording:gt,pauseRecording:ut,resumeRecording:jt,cancelRecording:Ge,clearModelCache:we}}function EB({skills:e,builtins:t,filter:r,onSelect:a,visible:i,selectedIndex:o,activeSkill:l,onBack:u}){const{t:d}=Xt(),f=x.useRef(null),g=x.useRef(null);if(x.useEffect(()=>{f.current&&f.current.scrollIntoView({block:"nearest"})},[o,l,r,e.length]),!i)return null;const h=(r||"").trim().toLowerCase();let m=[],y=!1;if(l){y=!0;const v=e.find(_=>_.skill===l);m=(v&&v.commands||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"command",skill:l,name:_.name,description:_.description}))}else{const v=(t||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"builtin",name:_.name,description:_.description})),k=e.filter(_=>h?(_.skill||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h)||(_.commands||[]).some(w=>(w.name||"").toLowerCase().includes(h)||(w.description||"").toLowerCase().includes(h)):!0).map(_=>({type:"skill",skill:_.skill,description:_.description,commandCount:(_.commands||[]).length,configured:_.configured}));m=v.concat(k)}return n.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden z-50 flex flex-col",style:{maxHeight:"40vh"},children:[n.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 border-b border-gray-100 dark:border-gray-800 text-xs text-gray-500 dark:text-gray-400",role:"presentation",children:[y&&n.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 hover:text-gray-700 dark:hover:text-gray-200 transition-colors","aria-label":d("slashCommand.back"),children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),d("slashCommand.skills")]}),n.jsx("span",{className:"flex-1 text-right",children:y?l+" "+d("slashCommand.commands"):d("slashCommand.title")})]}),n.jsx("div",{ref:g,className:"flex-1 min-h-0 overflow-y-auto",id:"slash-command-listbox",role:"listbox","aria-label":l?d("slashCommand.commands")+" — "+l:d("slashCommand.title"),children:m.length===0?n.jsx("div",{className:"px-3 py-4 text-sm text-gray-400 dark:text-gray-500 text-center",children:d("slashCommand.noResults")}):m.map((v,k)=>{const _=k===o,w="slash-item-"+k;return n.jsx("div",{id:w,ref:_?f:null,role:"option","aria-selected":_,onClick:()=>{v.type==="skill"?a(v.skill,null):v.type==="builtin"?a("__builtin__",v.name):a(v.skill,v.name)},className:"flex items-center gap-3 px-3 py-2 cursor-pointer text-sm transition-colors "+(_?"bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300":"hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300"),children:v.type==="builtin"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:n.jsx("svg",{className:"w-3.5 h-3.5 text-accent-600 dark:text-accent-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"font-medium",children:["/",v.name]}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"built-in"})]}),v.description&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]}):v.type==="skill"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-xs font-medium text-gray-500 dark:text-gray-400",children:(v.skill||"?")[0].toUpperCase()}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium truncate",children:v.skill}),!v.configured&&n.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:d("slashCommand.notConfigured")})]}),v.description&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]}),n.jsxs("div",{className:"flex-shrink-0 text-xs text-gray-400 dark:text-gray-500",children:[v.commandCount," ",v.commandCount===1?d("slashCommand.command"):d("slashCommand.commands")]}),n.jsx("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:n.jsx("svg",{className:"w-3.5 h-3.5 text-accent-600 dark:text-accent-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("span",{className:"font-medium",children:["/",l," ",v.name]}),v.description&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]})},v.type+"-"+(v.skill||"_")+"-"+(v.name||""))})}),n.jsxs("div",{className:"flex-shrink-0 px-3 py-1.5 border-t border-gray-100 dark:border-gray-800 text-xs text-gray-400 dark:text-gray-500 flex gap-3",role:"presentation",children:[n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"↑↓"})," ",d("slashCommand.navigate")]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Enter"})," ",d("slashCommand.select")]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Esc"})," ",d("slashCommand.close")]})]})]})}const nf=[{name:"btw",description:"By the way… — fork the current session and continue in a new one",takesArgs:!0},{name:"compact",description:"Compact the current session — summarize history into a new, shorter session",takesArgs:!1}];function jB(){return nf.slice()}function CB(e){if(!e)return null;const t=String(e).toLowerCase();for(let r=0;r<nf.length;r++)if(nf[r].name===t)return nf[r];return null}function TB(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("/"))return null;const r=t.match(/^\/([a-zA-Z0-9_-]+)(?:\s+([\s\S]*))?$/);if(!r)return null;const a=r[1].toLowerCase(),i=CB(a);if(!i)return null;const o=(r[2]||"").trim();return{name:a,args:o,builtin:i}}const RB=x.forwardRef(function({onSend:t,onAbort:r,isBusy:a,disabled:i,sessionId:o,queuedCount:l=0,onBuiltinCommand:u},d){const{t:f}=Xt(),[g,h]=x.useState(""),[m,y]=x.useState([]),[v,k]=x.useState(!1);x.useEffect(()=>{const te=()=>k(!1);return window.addEventListener("pave:plan-execute",te),()=>window.removeEventListener("pave:plan-execute",te)},[]);const[_,w]=x.useState(null),[S,E]=x.useState([]),[A,T]=x.useState(""),[C,j]=x.useState(!1),L=x.useRef(null),O=x.useRef([]),[I,B]=x.useState(-1),z="pave-asr-language",ee=[{code:"auto",label:"Auto"},{code:"en",label:"English"},{code:"yue",label:"粵語"},{code:"zh",label:"普通話"},{code:"ja",label:"日本語"},{code:"ko",label:"한국어"},{code:"es",label:"Español"},{code:"fr",label:"Français"},{code:"de",label:"Deutsch"},{code:"fi",label:"Suomi"}],[$,M]=x.useState(()=>{try{return localStorage.getItem(z)||"auto"}catch{return"auto"}}),[G,Y]=x.useState(!1),X=x.useRef(null),ie=[{code:"whisper",label:"Whisper"},{code:"paraformer",label:"Paraformer"}],[F,U]=x.useState("whisper"),[Z,P]=x.useState(!1),K=x.useRef(null),V=x.useRef(m),W=x.useRef(null),ae=x.useRef(null),Q=x.useRef(null),he=x.useRef(o),Ne=x.useRef(g),De=x.useRef(null),[Ve,at]=x.useState(!1),[lt,Ce]=x.useState(""),[$e,Be]=x.useState([]),[gt,ut]=x.useState(0),[jt,Ge]=x.useState(null),we=x.useRef({data:null,time:0}),Ue=6e4,Ae=x.useCallback(te=>{w(te),De.current&&clearTimeout(De.current),De.current=setTimeout(()=>w(null),5e3)},[]);x.useEffect(()=>()=>{De.current&&clearTimeout(De.current)},[]),x.useLayoutEffect(()=>{Ne.current=g},[g]),x.useLayoutEffect(()=>{he.current=o,Q.current&&(clearTimeout(Q.current),Q.current=null);let te="";if(o)try{te=localStorage.getItem(Bs+o)||""}catch{}return h(te),Ne.current=te,y(be=>(be.forEach(ze=>{ze.preview&&URL.revokeObjectURL(ze.preview)}),[])),()=>{Q.current&&(clearTimeout(Q.current),Q.current=null);const be=he.current;if(be)try{Ne.current?localStorage.setItem(Bs+be,Ne.current):localStorage.removeItem(Bs+be)}catch{}}},[o]),x.useEffect(()=>{he.current&&(Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{try{g?localStorage.setItem(Bs+he.current,g):localStorage.removeItem(Bs+he.current)}catch{}},300))},[g]);const rt=x.useCallback(async()=>{const te=we.current;if(te.data&&Date.now()-te.time<Ue){Be(te.data);return}try{const be=await d3(),ze=Array.isArray(be)?be:[];we.current={data:ze,time:Date.now()},Be(ze)}catch{Be([])}},[]),fe=x.useMemo(()=>jB(),[]),ce=x.useMemo(()=>{const te=(lt||"").trim().toLowerCase();if(jt){const Je=$e.find(Ft=>Ft.skill===jt);return(Je&&Je.commands||[]).filter(Ft=>te?(Ft.name||"").toLowerCase().includes(te)||(Ft.description||"").toLowerCase().includes(te):!0).map(Ft=>({type:"command",skill:jt,name:Ft.name}))}const be=fe.filter(Je=>te?(Je.name||"").toLowerCase().includes(te)||(Je.description||"").toLowerCase().includes(te):!0).map(Je=>({type:"builtin",name:Je.name})),ze=$e.filter(Je=>te?(Je.skill||"").toLowerCase().includes(te)||(Je.description||"").toLowerCase().includes(te)||(Je.commands||[]).some(Bt=>(Bt.name||"").toLowerCase().includes(te)||(Bt.description||"").toLowerCase().includes(te)):!0).map(Je=>({type:"skill",skill:Je.skill}));return be.concat(ze)},[lt,jt,$e,fe]),ve=x.useCallback(()=>ce.length,[ce]),ye=x.useCallback(te=>{if(h(te),Ne.current=te,te.startsWith("/")){const be=te.slice(1),ze=be.split(/\s/)[0]||"";if(!ze.includes("/")&&!ze.includes(".")){if(jt){const Je=jt+" ";be.startsWith(Je)?(Ce(be.slice(Je.length)),ut(0)):(Ge(null),Ce(be),ut(0))}else Ce(be),ut(0);Ve||(rt(),at(!0),ut(0))}else at(!1),Ce(""),Ge(null),ut(0)}else at(!1),Ce(""),Ge(null),ut(0)},[Ve,jt,rt]),it=x.useCallback((te,be)=>{var ze,Je,Bt;if(te==="__builtin__"&&be){h("/"+be+" "),at(!1),Ce(""),Ge(null),ut(0),(ze=W.current)==null||ze.focus();return}if(!be)Ge(te),Ce(""),ut(0),h("/"+te+" "),(Je=W.current)==null||Je.focus();else{const Ft="/"+te+" "+be+" ";h(Ft),at(!1),Ce(""),Ge(null),ut(0),(Bt=W.current)==null||Bt.focus()}},[]),qe=x.useCallback(()=>{var te;Ge(null),Ce(""),ut(0),h("/"),(te=W.current)==null||te.focus()},[]),Ye=x.useRef(""),yt=x.useCallback((te,be)=>{if(be&&be.mode==="snapshot"){const ze=Ye.current||"",Je=ze&&!ze.endsWith(" ")&&!ze.endsWith(`
|
|
102
|
-
`)?" ":"";h(ze+Je+(te||""));return}h(ze=>{const Je=ze&&!ze.endsWith(" ")&&!ze.endsWith(`
|
|
103
|
-
`)?" ":"";return ze+Je+te})},[]),ht=x.useRef(null),Dt=x.useCallback(()=>{Ye.current="",setTimeout(()=>{ht.current&&ht.current()},50)},[]),{state:nt,progress:Pt,downloadingFile:$t,startRecording:lr,stopRecording:pr,resumeRecording:_r,cancelRecording:cr}=SB({onTranscript:yt,onError:Ae,onAutoSubmit:Dt,model:A||void 0,language:$&&$!=="auto"?$:void 0}),ir=x.useCallback(()=>(h(te=>(Ye.current=te||"",te)),lr()),[lr]);x.useEffect(()=>{try{$&&localStorage.setItem(z,$)}catch{}},[$]),x.useEffect(()=>{if(!G)return;const te=be=>{X.current&&!X.current.contains(be.target)&&Y(!1)};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[G]),x.useEffect(()=>{let te=!1;return Bb().then(be=>{te||(be&&Array.isArray(be.models)&&be.models.length>0&&(E(be.models),T(ze=>ze||be.models[0].name)),be&&(be.preferredEngine==="whisper"||be.preferredEngine==="paraformer")&&U(be.preferredEngine))}).catch(()=>{}),()=>{te=!0}},[Bb]),x.useEffect(()=>{if(!Z)return;const te=be=>{K.current&&!K.current.contains(be.target)&&P(!1)};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[Z]);const ue=x.useCallback(te=>{P(!1),U(be=>be===te?be:(F3(te).then(()=>{te==="paraformer"&&Ae("Paraformer selected — the streaming engine is starting (first use downloads ~1 GB).")}).catch(()=>{U(be),Ae("Could not switch the speech engine — is the server reachable?")}),te))},[Ae]);x.useEffect(()=>{if(!C){B(-1);return}O.current.length=S.length;function te(ze){L.current&&!L.current.contains(ze.target)&&j(!1)}function be(ze){if(ze.key==="Escape"){j(!1);return}ze.key!=="ArrowDown"&&ze.key!=="ArrowUp"&&ze.key!=="Home"&&ze.key!=="End"||(ze.preventDefault(),B(Je=>{const Bt=O.current.length;if(!Bt)return Je;const Ft=typeof Je=="number"?Je:-1;let Jt=Ft;return ze.key==="ArrowDown"?Jt=Ft<Bt-1?Ft+1:0:ze.key==="ArrowUp"?Jt=Ft>0?Ft-1:Bt-1:ze.key==="Home"?Jt=0:ze.key==="End"&&(Jt=Bt-1),O.current[Jt]&&O.current[Jt].focus(),Jt}))}return document.addEventListener("mousedown",te),document.addEventListener("keydown",be),()=>{document.removeEventListener("mousedown",te),document.removeEventListener("keydown",be)}},[C,S.length]),x.useEffect(()=>{const te=W.current;te&&(te.style.height="auto",te.style.height=Math.min(te.scrollHeight,200)+"px")},[g]),x.useEffect(()=>{V.current=m},[m]),x.useEffect(()=>{var te;(te=W.current)==null||te.focus()},[]),x.useImperativeHandle(d,()=>({focus:()=>{var te;(te=W.current)==null||te.focus()},setText:te=>{h(typeof te=="string"?te:""),requestAnimationFrame(()=>{var be;return(be=W.current)==null?void 0:be.focus()})}}),[]);const Me=async()=>{const te=g.trim();var be=m.filter(function(Ft){return Kp(Ft.type)}),ze=m.filter(function(Ft){return!Kp(Ft.type)});const Je=TB(te);if(Je&&typeof u=="function"){const Ft=he.current;try{await u(Je.name,Je.args,{imageAttachments:be.length>0?be:void 0,fileAttachments:ze.length>0?ze:void 0})}catch{return}if(h(""),at(!1),Ce(""),Ge(null),ut(0),Ft)try{localStorage.removeItem(Bs+Ft)}catch{}m.forEach(function(Jt){Jt.preview&&URL.revokeObjectURL(Jt.preview)}),y([]),W.current&&(W.current.style.height="auto");return}if(!te&&be.length===0&&ze.length===0)return;const Bt=he.current;try{await t(te,be.length>0?be:void 0,v?"plan":void 0,ze.length>0?ze:void 0)}catch{return}if(h(""),at(!1),Ce(""),Ge(null),ut(0),Bt)try{localStorage.removeItem(Bs+Bt)}catch{}m.forEach(function(Ft){Ft.preview&&URL.revokeObjectURL(Ft.preview)}),y([]),W.current&&(W.current.style.height="auto")};ht.current=Me;const Ke=te=>{if(Ve){const be=ve();if(te.key==="ArrowDown"){be>0&&(te.preventDefault(),ut(ze=>(ze+1)%be));return}if(te.key==="ArrowUp"){be>0&&(te.preventDefault(),ut(ze=>(ze-1+be)%be));return}if(te.key==="Enter"||te.key==="Tab"){if(be>0){te.preventDefault();const ze=ce[gt];ze&&(ze.type==="command"?it(ze.skill,ze.name):ze.type==="builtin"?it("__builtin__",ze.name):it(ze.skill,null));return}if(te.key==="Tab"){at(!1),Ce(""),Ge(null),ut(0);return}}if(te.key==="Escape"){te.preventDefault(),at(!1),Ce(""),Ge(null),ut(0);return}if(te.key==="Backspace"&&jt){const ze=g.slice(1),Je=jt+" ";if(ze===Je||ze===jt){te.preventDefault(),qe();return}}}te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),Me())},Te=te=>{if(!i){var be=te.clipboardData&&te.clipboardData.items;if(be){for(var ze=[],Je=0;Je<be.length;Je++){var Bt=(be[Je].type||"").toLowerCase();if(Mf.indexOf(Bt)!==-1){var Ft=be[Je].getAsFile();Ft&&ze.push(Ft)}}if(ze.length!==0){for(var Jt=!1,Fe=0;Fe<be.length;Fe++)if(be[Fe].type&&be[Fe].type.startsWith("text/")){Jt=!0;break}Jt||te.preventDefault();var kt=ze.map(function(Qt){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Qt,name:Qt.name||"pasted-image.png",size:Qt.size,type:Qt.type,preview:null}});y(function(Qt){var Wr=mf-Qt.length;if(Wr<=0)return Qt;for(var ln=kt.slice(0,Wr),Jr=0;Jr<ln.length;Jr++)ln[Jr].preview=URL.createObjectURL(ln[Jr].file);return Qt.concat(ln)})}}}},oe=te=>{const be=Array.from(te.target.files||[]);if(be.length===0)return;const ze=be.filter(Bt=>rR.indexOf(Bt.type)!==-1);if(ze.length===0){te.target.value="";return}const Je=ze.map(Bt=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Bt,name:Bt.name,size:Bt.size,type:Bt.type,preview:null}));y(Bt=>{var Ft=mf-Bt.length;if(Ft<=0)return Bt;for(var Jt=Je.slice(0,Ft),Fe=0;Fe<Jt.length;Fe++)Jt[Fe].preview=Kp(Jt[Fe].file.type)?URL.createObjectURL(Jt[Fe].file):null;return[...Bt,...Jt]}),te.target.value=""},bt=te=>{y(be=>{const ze=be.find(Je=>Je.id===te);return ze!=null&&ze.preview&&URL.revokeObjectURL(ze.preview),be.filter(Je=>Je.id!==te)})},Pe=te=>te<1024?te+" B":te<1024*1024?(te/1024).toFixed(1)+" KB":(te/(1024*1024)).toFixed(1)+" MB";return x.useEffect(()=>()=>{V.current.forEach(te=>{te.preview&&URL.revokeObjectURL(te.preview)})},[]),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 px-2 sm:px-4 py-3",children:n.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[v&&n.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg text-xs text-amber-700 dark:text-amber-300",children:[n.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),n.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),m.length>0&&n.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:m.map(te=>n.jsxs("div",{className:"relative group flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm",children:[te.preview?n.jsx("img",{src:te.preview,alt:te.name,className:"w-10 h-10 rounded object-cover"}):n.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:te.name}),n.jsx("p",{className:"text-xs text-gray-400",children:Pe(te.size)})]}),n.jsx("button",{onClick:()=>bt(te.id),"aria-label":`Remove attachment ${te.name||""}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-gray-500 hover:bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},te.id))}),n.jsxs("div",{className:"relative flex flex-col sm:flex-row sm:items-end gap-1 sm:gap-2 bg-gray-100 dark:bg-gray-800 rounded-2xl px-3 py-2",children:[n.jsx(EB,{skills:$e,builtins:fe,filter:lt,onSelect:it,visible:Ve,selectedIndex:gt,activeSkill:jt,onBack:qe}),n.jsxs("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:[n.jsx("button",{onClick:()=>{var te;return(te=ae.current)==null?void 0:te.click()},disabled:i||a,className:"flex-shrink-0 w-8 h-8 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 flex items-center justify-center transition-colors text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",title:f("chat.attach_file"),"aria-label":f("chat.attach_file"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.375 12.739l-7.693 7.693a4.5 4.5 0 01-6.364-6.364l10.94-10.94A3 3 0 1119.5 7.372L8.552 18.32m.009-.01l-.01.01m5.699-9.941l-7.81 7.81a1.5 1.5 0 002.112 2.13"})})}),n.jsx("input",{ref:ae,type:"file",multiple:!0,accept:dB,onChange:oe,className:"hidden"}),n.jsx("button",{onClick:nt==="recording"?pr:nt==="paused"?_r:nt==="loading"?cr:ir,disabled:nt==="draining"||(i||a)&&nt!=="recording"&&nt!=="loading"&&nt!=="paused",className:"flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(nt==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":nt==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":nt==="loading"||nt==="draining"?"bg-gray-200 dark:bg-gray-700 text-gray-400 cursor-wait":"hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"),title:nt==="recording"?f("voice.stop_recording")||"Stop recording":nt==="paused"?f("voice.resume_recording")||"Resume recording":nt==="loading"?f("voice.loading_model"):nt==="draining"?f("voice.processing")||"Processing remaining audio":f("voice.start_recording"),"aria-label":nt==="recording"?f("voice.stop_recording")||"Stop recording":nt==="paused"?f("voice.resume_recording")||"Resume recording":nt==="loading"?f("voice.loading_model"):nt==="draining"?f("voice.processing")||"Processing remaining audio":f("voice.start_recording"),children:nt==="draining"?n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):nt==="loading"?n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):nt==="recording"?n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}):nt==="paused"?n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("circle",{cx:"12",cy:"12",r:"6"})}):n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),nt==="loading"&&n.jsxs("div",{className:"absolute -top-6 left-1/2 -translate-x-1/2 bg-gray-800 dark:bg-gray-700 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap flex items-center gap-2",children:[n.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${Pt}%`}})}),n.jsx("span",{children:$t?`${$t} ${Pt}%`:`${Pt}%`})]}),F==="whisper"&&n.jsxs("div",{className:"relative flex-shrink-0",ref:X,children:[n.jsxs("button",{onClick:()=>Y(te=>!te),disabled:nt==="recording"||nt==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition language","aria-label":"Select speech recognition language","aria-haspopup":"menu","aria-expanded":G,children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 21l5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 016-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 01-3.827-5.802"})}),n.jsx("span",{className:"max-w-[80px] truncate",children:(ee.find(te=>te.code===$)||ee[0]).label}),n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),G&&n.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[180px] max-h-64 overflow-y-auto z-50",role:"menu","aria-label":"Speech recognition language",children:ee.map(te=>n.jsx("button",{role:"menuitemradio","aria-checked":te.code===$,onClick:()=>{M(te.code),Y(!1),te.code==="yue"&&Ae("Cantonese requires whisper-small or larger. If transcription is poor, this device may be using the tiny model (Safari, or older cached version).")},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.code===$?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:te.label},te.code))})]}),n.jsxs("div",{className:"relative flex-shrink-0",ref:K,children:[n.jsxs("button",{onClick:()=>P(te=>!te),disabled:nt==="recording"||nt==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition engine","aria-label":"Select speech recognition engine","aria-haspopup":"menu","aria-expanded":Z,children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.348 14.652a3.75 3.75 0 010-5.304m5.304 0a3.75 3.75 0 010 5.304m-7.425 2.121a6.75 6.75 0 010-9.546m9.546 0a6.75 6.75 0 010 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),n.jsx("span",{className:"max-w-[90px] truncate",children:(ie.find(te=>te.code===F)||ie[0]).label}),n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),Z&&n.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[200px] z-50",role:"menu","aria-label":"Speech recognition engine",children:ie.map(te=>n.jsxs("button",{role:"menuitemradio","aria-checked":te.code===F,onClick:()=>ue(te.code),className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.code===F?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[n.jsx("div",{children:te.label}),n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:te.code==="whisper"?"Batch · all languages (default)":"Live streaming · 中文/粵語/English"})]},te.code))})]}),F==="whisper"&&S.length>1&&n.jsxs("div",{className:"relative flex-shrink-0",ref:L,children:[n.jsxs("button",{onClick:()=>j(te=>!te),disabled:nt==="recording"||nt==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:f("voice.select_asr_model"),"aria-label":f("voice.select_asr_model"),"aria-haspopup":"menu","aria-expanded":C,children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),n.jsx("span",{className:"max-w-[80px] truncate",children:(S.find(te=>te.name===A)||S[0]).label}),n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),C&&n.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[160px] z-50",role:"menu","aria-label":f("voice.select_asr_model"),children:S.map((te,be)=>n.jsxs("button",{ref:ze=>{O.current[be]=ze},role:"menuitemradio","aria-checked":te.name===A,tabIndex:I===be?0:-1,onClick:()=>{T(te.name),j(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.name===A?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[te.label,te.type!=="openai"&&n.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",te.type,")"]})]},`${te.name}-${be}`))})]}),n.jsxs("button",{onClick:()=>k(te=>!te),disabled:i||a,className:"flex-shrink-0 h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium "+(v?"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 ring-1 ring-amber-300 dark:ring-amber-700":"hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"),title:v?"Plan mode active (read-only) — click to switch to build":"Switch to plan mode (read-only)","aria-label":v?"Disable plan mode":"Enable plan mode","aria-pressed":v,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z"})}),v?"Plan":""]})]}),n.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[n.jsx("textarea",{ref:W,value:g,onChange:te=>ye(te.target.value),onKeyDown:Ke,onPaste:Te,placeholder:f("chat.send_placeholder"),disabled:i,rows:1,role:Ve?"combobox":void 0,"aria-controls":Ve?"slash-command-listbox":void 0,"aria-activedescendant":Ve&&ve()>0?"slash-item-"+gt:void 0,"aria-expanded":Ve||void 0,className:"flex-1 bg-transparent resize-none outline-none text-sm py-1.5 min-h-[32px] text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 max-h-[200px]"}),a&&n.jsx("button",{onClick:r,className:"flex-shrink-0 w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-colors",title:f("chat.stop_generating"),"aria-label":f("chat.stop_generating"),children:n.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),n.jsxs("button",{onClick:Me,disabled:!g.trim()&&m.length===0||i,className:"relative flex-shrink-0 w-8 h-8 rounded-full bg-accent-400 hover:bg-accent-500 disabled:bg-gray-300 dark:disabled:bg-gray-600 flex items-center justify-center transition-colors",title:a?"Queue message (will send when current finishes)":f("chat.send_button"),"aria-label":a?"Queue message":f("chat.send_button"),"aria-disabled":!g.trim()&&m.length===0||i?"true":void 0,children:[n.jsx("svg",{className:"w-4 h-4 text-gray-900",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M12 5l7 7-7 7"})}),l>0&&n.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 rounded-full bg-amber-500 text-white text-[10px] font-bold flex items-center justify-center ring-2 ring-white dark:ring-gray-800","aria-label":`${l} message${l===1?"":"s"} queued`,children:l})]})]})]}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:f("chat.send_hint")}),_&&n.jsxs("div",{role:"alert",className:"mt-2 px-3 py-2 bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 text-sm rounded-lg flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),n.jsx("span",{children:_}),n.jsx("button",{onClick:()=>w(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":f("voice.dismiss_error"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})});function AB({darkMode:e,onToggleTheme:t}){const{t:r}=Xt(),a=(_,w)=>{const S=r(_);return S===_?w:S},[i,o]=x.useState(""),[l,u]=x.useState(""),[d,f]=x.useState(!1),[g,h]=x.useState(null),[m,y]=x.useState(!1);x.useEffect(()=>{fetch("/auth/membership/available").then(_=>_.json()).then(_=>y(_.available===!0)).catch(()=>{})},[]);const v=async _=>{_.preventDefault(),h(null),f(!0);try{const w=await fetch("/auth/membership/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i,password:l})}),S=await w.json().catch(()=>({}));if(!w.ok){h(S.error||"Login failed"),f(!1);return}window.location.reload()}catch(w){h("Connection error: "+w.message),f(!1)}},k=async()=>{h(null),f(!0);try{const _=await fetch("/auth/local/login",{method:"POST",credentials:"include"}),w=await _.json().catch(()=>({}));if(!_.ok){h(w.error||"Local login failed"),f(!1);return}window.location.href="/"}catch(_){h("Connection error: "+_.message),f(!1)}};return n.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[n.jsx("div",{className:"flex justify-end p-4",children:n.jsx("button",{onClick:t,className:"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",title:r(e?"theme.light":"theme.dark"),"aria-label":r(e?"theme.light":"theme.dark"),children:e?n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}),n.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:n.jsxs("div",{className:"w-full max-w-sm",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:n.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),n.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("login.pave_subtitle")})]}),n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 p-6 shadow-sm ring-1 ring-accent-400/20",children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:r("login.sign_in")}),g&&n.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm border border-red-200 dark:border-red-800",children:g}),m&&n.jsxs("form",{onSubmit:v,className:"space-y-3 mb-4",children:[n.jsx("input",{type:"email",placeholder:a("login.email_placeholder","Email"),value:i,onChange:_=>o(_.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),n.jsx("input",{type:"password",placeholder:a("login.password_placeholder","Password"),value:l,onChange:_=>u(_.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),n.jsx("button",{type:"submit",disabled:d,className:"w-full py-2.5 px-4 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:d?a("login.signing_in","Signing in..."):r("login.sign_in")})]}),m&&n.jsxs("div",{className:"flex items-center gap-3 my-4",children:[n.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("login.or","or")}),n.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),n.jsxs("button",{type:"button",onClick:k,disabled:d,className:"flex items-center justify-center gap-3 w-full py-2.5 px-4 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),a("login.sign_in_locally","Sign in locally")]}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:r("login.terms")})]})]})})]})}function IB({user:e,onLogout:t,onSkillManagement:r,onAgentManagement:a,onPricingSettings:i,onDlpSettings:o,onSettings:l,onBoard:u}){const{t:d}=Xt(),[f,g]=x.useState(!1),h=x.useRef(null);if(x.useEffect(()=>{if(!f)return;function y(v){h.current&&!h.current.contains(v.target)&&g(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[f]),!e)return null;const m=(e.name||e.email||"?").split(" ").map(y=>y[0]).join("").slice(0,2).toUpperCase();return n.jsxs("div",{className:"relative",ref:h,children:[n.jsxs("button",{onClick:()=>g(!f),className:"flex items-center gap-2 px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:e.email,"aria-label":e.name||e.email||d("user_menu.title"),children:[e.picture?n.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):n.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:n.jsx("span",{className:"text-white text-xs font-semibold",children:m})}),n.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),n.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&n.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-lg z-50 py-1",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),r&&n.jsxs("button",{type:"button",onClick:()=>{g(!1),r()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),d("user_menu.skills")]}),a&&n.jsxs("button",{onClick:()=>{g(!1),a()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),d("user_menu.agents")]}),i&&n.jsxs("button",{onClick:()=>{g(!1),i()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),d("user_menu.pricing")]}),o&&n.jsxs("button",{onClick:()=>{g(!1),o()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),d("user_menu.privacy_dlp")]}),u&&n.jsxs("button",{type:"button",onClick:()=>{g(!1),u()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),d("user_menu.board")]}),l&&n.jsxs("button",{onClick:()=>{g(!1),l()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[n.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),d("user_menu.settings")]}),t&&n.jsx("button",{onClick:()=>{g(!1),t()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:d("user_menu.sign_out")})]})]})}function nR({toolParts:e}){const{t}=Xt();return!e||e.length===0?n.jsxs("div",{className:"p-4",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):n.jsxs("div",{className:"p-4",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),n.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(r=>n.jsx(MB,{part:r},r.id))})]})}function MB({part:e}){var i,o;const t=((i=e.state)==null?void 0:i.status)||"running",r=((o=e.state)==null?void 0:o.input)||{},a=LB(e.tool,r);return n.jsxs("div",{className:"flex items-center gap-2 py-1",children:[n.jsxs("div",{className:"flex-shrink-0",children:[t==="running"&&n.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&n.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&n.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&n.jsx("svg",{className:"w-3.5 h-3.5 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),n.jsx("span",{className:`text-xs truncate ${t==="running"?"text-gray-800 dark:text-gray-200":t==="error"?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-gray-400"}`,children:a})]})}function LB(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+Ud(t.filePath);case"Write":return"Writing "+Ud(t.filePath);case"Edit":return"Editing "+Ud(t.filePath);case"Bash":{const r=t.command||"";return c2(r)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+sv(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+sv(t.url,40):"");case"Skill":{const r=t.name||t.skill||"";return OB(r)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+Ud(t.filePath):t.command?c2(t.command):"Running "+e.toLowerCase()}}function Ud(e){if(!e)return"file";const t=e.split("/"),r=t[t.length-1]||"file";return t.length<=2?r:t[t.length-2]+"/"+r}function c2(e){if(!e)return"Running command";const t=e.trim();if(/^(ls|dir)\b/i.test(t))return"Listing files";if(/^(cat|less|more)\b/i.test(t))return"Reading file contents";if(/^(mkdir)\b/i.test(t))return"Creating directory";if(/^(rm|del)\b/i.test(t))return"Removing files";if(/^(cp|copy)\b/i.test(t))return"Copying files";if(/^(mv|move|rename)\b/i.test(t))return"Moving files";if(/^(git\s+status)\b/i.test(t))return"Checking git status";if(/^(git\s+log)\b/i.test(t))return"Viewing git history";if(/^(git\s+diff)\b/i.test(t))return"Comparing changes";if(/^(git\s+add)\b/i.test(t))return"Staging changes";if(/^(git\s+commit)\b/i.test(t))return"Committing changes";if(/^(git\s+push)\b/i.test(t))return"Pushing to remote";if(/^(git\s+pull)\b/i.test(t))return"Pulling from remote";if(/^(git\s+clone)\b/i.test(t))return"Cloning repository";if(/^(git\s+checkout|git\s+switch)\b/i.test(t))return"Switching branches";if(/^(git\s+branch)\b/i.test(t))return"Managing branches";if(/^git\b/i.test(t))return"Running git command";if(/^(npm\s+install|npm\s+i|yarn\s+install|yarn\s+add|pnpm\s+install)\b/i.test(t))return"Installing dependencies";if(/^(npm\s+run\s+build|yarn\s+build|pnpm\s+build)\b/i.test(t))return"Building project";if(/^(npm\s+run\s+test|npm\s+test|yarn\s+test|jest|pytest|mocha)\b/i.test(t))return"Running tests";if(/^(npm\s+run\s+dev|npm\s+start|yarn\s+dev|yarn\s+start)\b/i.test(t))return"Starting dev server";if(/^(npm|yarn|pnpm)\b/i.test(t))return"Running package manager";if(/^(node|python|ruby|php|java)\b/i.test(t))return"Running script";if(/^(docker)\b/i.test(t))return"Running Docker command";if(/^(curl|wget)\b/i.test(t))return"Fetching URL";if(/^(chmod|chown)\b/i.test(t))return"Changing permissions";if(/^(find|locate)\b/i.test(t))return"Finding files";if(/^(grep|rg|ag)\b/i.test(t))return"Searching file contents";if(/^(sed|awk)\b/i.test(t))return"Processing text";if(/^(echo|printf)\b/i.test(t))return"Running command";if(/^(ssh|scp)\b/i.test(t))return"Connecting remotely";if(/^(ping|traceroute|nslookup|dig)\b/i.test(t))return"Checking network";if(/^(tar|zip|unzip|gzip)\b/i.test(t))return"Compressing/extracting files";const r=t.split(/\s+/)[0];return"Running "+sv(r,20)}function OB(e,t){const r=(e||"").toLowerCase();return r.includes("gmail")||r.includes("email")?"Checking email":r.includes("gdrive")||r.includes("drive")?"Accessing Google Drive":r.includes("gcal")||r.includes("calendar")?"Checking calendar":r.includes("gtasks")||r.includes("tasks")?"Managing tasks":r.includes("discord")?"Using Discord":r.includes("whatsapp")?"Using WhatsApp":r.includes("wrike")?"Checking Wrike":r.includes("dropbox")?"Accessing Dropbox":r.includes("pandadoc")?"Working with PandaDoc":r.includes("freshbooks")?"Checking FreshBooks":r.includes("mailchimp")?"Using Mailchimp":r.includes("bamboohr")?"Checking BambooHR":e?"Using "+e:"Running skill"}function sv(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const ov=10,lv=24,u2=2,DB=14,aR="pave-terminal-font-size";function PB(){try{const e=localStorage.getItem(aR);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=ov&&t<=lv)return t}}catch{}return DB}function iR({toolParts:e,matrixMode:t,onToggleMatrix:r,darkMode:a=!0}){var{t:i}=Xt();const o=x.useRef(null),l=x.useRef(null),u=x.useRef(null),[d,f]=x.useState(PB),g=x.useCallback(()=>{f(k=>Math.max(ov,k-u2))},[]),h=x.useCallback(()=>{f(k=>Math.min(lv,k+u2))},[]);x.useEffect(()=>{try{localStorage.setItem(aR,String(d))}catch{}},[d]);const m=a?{bg:"bg-gray-950",headerBg:"bg-gray-900",headerBorder:"border-gray-800",titleText:"text-gray-400",promptColor:"text-green-400",commandColor:"text-gray-200",outputColor:"text-green-300/70",waitingText:"text-gray-500",runningColor:"text-yellow-400",doneColor:"text-green-500",errorColor:"text-red-400",pendingColor:"text-blue-400"}:{bg:"bg-gray-100",headerBg:"bg-gray-200",headerBorder:"border-gray-300",titleText:"text-gray-600",promptColor:"text-green-600",commandColor:"text-gray-800",outputColor:"text-green-700/80",waitingText:"text-gray-500",runningColor:"text-yellow-600",doneColor:"text-green-600",errorColor:"text-red-600",pendingColor:"text-blue-600"},y=`px-1.5 py-0.5 text-xs font-mono rounded ${a?"bg-gray-600 text-gray-300 hover:bg-gray-500":"bg-gray-300 text-gray-700 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-default`;x.useEffect(()=>{o.current&&!t&&(o.current.scrollTop=o.current.scrollHeight)},[e,t]);const v=x.useCallback(()=>{const k=l.current;if(!k)return;const _=k.getContext("2d");if(!_)return;const w=()=>{const L=k.parentElement;if(L&&L.clientWidth>0&&L.clientHeight>0){k.width=L.clientWidth,k.height=L.clientHeight;return}const O=k.getBoundingClientRect();if(O.width>0&&O.height>0){k.width=O.width,k.height=O.height;return}k.width=0,k.height=0};w();const S=d;let E=Math.floor(k.width/S),A=new Array(E).fill(1);const T="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",C=()=>{_.fillStyle="rgba(0, 0, 0, 0.05)",_.fillRect(0,0,k.width,k.height),_.fillStyle="#0F0",_.font=S+"px monospace";for(let L=0;L<A.length;L++){const O=T.charAt(Math.floor(Math.random()*T.length));_.fillText(O,L*S,A[L]*S),A[L]*S>k.height&&Math.random()>.975&&(A[L]=0),A[L]++}u.current=requestAnimationFrame(C)},j=()=>{w(),E=Math.floor(k.width/S);const L=new Array(E).fill(0);for(let O=0;O<Math.min(A.length,L.length);O++)L[O]=A[O];A=L};return window.addEventListener("resize",j),u.current=requestAnimationFrame(C),()=>{window.removeEventListener("resize",j),u.current&&cancelAnimationFrame(u.current)}},[d]);return x.useEffect(()=>{let k;return t?k=v():u.current&&(cancelAnimationFrame(u.current),u.current=null),()=>{k&&k(),u.current&&(cancelAnimationFrame(u.current),u.current=null)}},[t,v]),e&&e.some(k=>{var _;return(((_=k.state)==null?void 0:_.status)||"running")==="running"}),n.jsxs("div",{className:`flex flex-col h-full ${m.bg} font-mono`,style:{fontSize:d+"px"},children:[n.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${m.headerBg} border-b ${m.headerBorder} flex-shrink-0`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:r,title:""}),n.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),n.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),n.jsx("span",{className:`${m.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:g,disabled:d<=ov,className:y,"aria-label":i("terminal.decrease_font"),title:i("terminal.decrease_font"),children:"A-"}),n.jsx("button",{type:"button",onClick:h,disabled:d>=lv,className:y,"aria-label":i("terminal.increase_font"),title:i("terminal.increase_font"),children:"A+"})]})]}),n.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?n.jsxs(n.Fragment,{children:[n.jsx("canvas",{ref:l,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 px-3 py-2 max-h-32 overflow-y-auto",children:e.slice(-3).map(k=>n.jsx(BB,{part:k},k.id))})]}):n.jsx("div",{ref:o,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?n.jsxs("div",{children:[n.jsxs("div",{className:m.promptColor,children:["$ ",n.jsx("span",{className:"terminal-cursor",children:"█"})]}),n.jsx("p",{className:`${m.waitingText} mt-2`,children:"Awaiting commands..."})]}):n.jsxs(n.Fragment,{children:[e.map(k=>n.jsx(FB,{part:k,theme:m},k.id)),n.jsxs("div",{className:m.promptColor,children:["$ ",n.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function FB({part:e,theme:t}){var{t:r}=Xt();const{tool:a,state:i}=e;if(!i)return null;const o=i.status||"running",u=If(a||i.title,i.input)||a||i.title||"unknown",d=i.output?No(typeof i.output=="string"?i.output:JSON.stringify(i.output,null,2)):null;return n.jsxs("div",{className:"mb-2",children:[n.jsxs("div",{className:`${t.commandColor} break-all`,children:[n.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),u]}),o==="running"&&n.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),o==="completed"&&d&&n.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:d}),o==="completed"&&!d&&n.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),o==="error"&&n.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",i.error?No(typeof i.error=="string"?i.error:i.error.message||r("common.error")):r("common.unknown_error")]}),o==="pending_confirmation"&&n.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function BB({part:e}){const{tool:t,state:r}=e;if(!r)return null;const a=r.status||"running",o=If(t||r.title,r.input)||t||r.title||"unknown",l={running:"text-yellow-400",completed:"text-green-400",error:"text-red-400",pending_confirmation:"text-blue-400"},u={running:"RUN",completed:"OK",error:"ERR",pending_confirmation:"WAIT"};return n.jsxs("div",{className:"text-xs font-mono truncate",children:[n.jsxs("span",{className:l[a]||"text-gray-400",children:["[",u[a]||a,"]"]}),n.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",o]})]})}function ek(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Jp,d2;function zB(){if(d2)return Jp;d2=1;function e(){this.__data__=[],this.size=0}return Jp=e,Jp}var eh,f2;function Ll(){if(f2)return eh;f2=1;function e(t,r){return t===r||t!==t&&r!==r}return eh=e,eh}var th,g2;function Lf(){if(g2)return th;g2=1;var e=Ll();function t(r,a){for(var i=r.length;i--;)if(e(r[i][0],a))return i;return-1}return th=t,th}var rh,p2;function UB(){if(p2)return rh;p2=1;var e=Lf(),t=Array.prototype,r=t.splice;function a(i){var o=this.__data__,l=e(o,i);if(l<0)return!1;var u=o.length-1;return l==u?o.pop():r.call(o,l,1),--this.size,!0}return rh=a,rh}var nh,h2;function qB(){if(h2)return nh;h2=1;var e=Lf();function t(r){var a=this.__data__,i=e(a,r);return i<0?void 0:a[i][1]}return nh=t,nh}var ah,m2;function HB(){if(m2)return ah;m2=1;var e=Lf();function t(r){return e(this.__data__,r)>-1}return ah=t,ah}var ih,x2;function $B(){if(x2)return ih;x2=1;var e=Lf();function t(r,a){var i=this.__data__,o=e(i,r);return o<0?(++this.size,i.push([r,a])):i[o][1]=a,this}return ih=t,ih}var sh,y2;function Of(){if(y2)return sh;y2=1;var e=zB(),t=UB(),r=qB(),a=HB(),i=$B();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=a,o.prototype.set=i,sh=o,sh}var oh,b2;function WB(){if(b2)return oh;b2=1;var e=Of();function t(){this.__data__=new e,this.size=0}return oh=t,oh}var lh,v2;function VB(){if(v2)return lh;v2=1;function e(t){var r=this.__data__,a=r.delete(t);return this.size=r.size,a}return lh=e,lh}var ch,k2;function GB(){if(k2)return ch;k2=1;function e(t){return this.__data__.get(t)}return ch=e,ch}var uh,_2;function KB(){if(_2)return uh;_2=1;function e(t){return this.__data__.has(t)}return uh=e,uh}var dh,w2;function sR(){if(w2)return dh;w2=1;var e=typeof Sd=="object"&&Sd&&Sd.Object===Object&&Sd;return dh=e,dh}var fh,N2;function Si(){if(N2)return fh;N2=1;var e=sR(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return fh=r,fh}var gh,S2;function Ol(){if(S2)return gh;S2=1;var e=Si(),t=e.Symbol;return gh=t,gh}var ph,E2;function YB(){if(E2)return ph;E2=1;var e=Ol(),t=Object.prototype,r=t.hasOwnProperty,a=t.toString,i=e?e.toStringTag:void 0;function o(l){var u=r.call(l,i),d=l[i];try{l[i]=void 0;var f=!0}catch{}var g=a.call(l);return f&&(u?l[i]=d:delete l[i]),g}return ph=o,ph}var hh,j2;function XB(){if(j2)return hh;j2=1;var e=Object.prototype,t=e.toString;function r(a){return t.call(a)}return hh=r,hh}var mh,C2;function Io(){if(C2)return mh;C2=1;var e=Ol(),t=YB(),r=XB(),a="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:a:o&&o in Object(u)?t(u):r(u)}return mh=l,mh}var xh,T2;function ti(){if(T2)return xh;T2=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return xh=e,xh}var yh,R2;function uu(){if(R2)return yh;R2=1;var e=Io(),t=ti(),r="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==a||d==i||d==r||d==o}return yh=l,yh}var bh,A2;function QB(){if(A2)return bh;A2=1;var e=Si(),t=e["__core-js_shared__"];return bh=t,bh}var vh,I2;function ZB(){if(I2)return vh;I2=1;var e=QB(),t=(function(){var a=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!t&&t in a}return vh=r,vh}var kh,M2;function oR(){if(M2)return kh;M2=1;var e=Function.prototype,t=e.toString;function r(a){if(a!=null){try{return t.call(a)}catch{}try{return a+""}catch{}}return""}return kh=r,kh}var _h,L2;function JB(){if(L2)return _h;L2=1;var e=uu(),t=ZB(),r=ti(),a=oR(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,g=RegExp("^"+d.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(m){if(!r(m)||t(m))return!1;var y=e(m)?g:o;return y.test(a(m))}return _h=h,_h}var wh,O2;function ez(){if(O2)return wh;O2=1;function e(t,r){return t==null?void 0:t[r]}return wh=e,wh}var Nh,D2;function Mo(){if(D2)return Nh;D2=1;var e=JB(),t=ez();function r(a,i){var o=t(a,i);return e(o)?o:void 0}return Nh=r,Nh}var Sh,P2;function tk(){if(P2)return Sh;P2=1;var e=Mo(),t=Si(),r=e(t,"Map");return Sh=r,Sh}var Eh,F2;function Df(){if(F2)return Eh;F2=1;var e=Mo(),t=e(Object,"create");return Eh=t,Eh}var jh,B2;function tz(){if(B2)return jh;B2=1;var e=Df();function t(){this.__data__=e?e(null):{},this.size=0}return jh=t,jh}var Ch,z2;function rz(){if(z2)return Ch;z2=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Ch=e,Ch}var Th,U2;function nz(){if(U2)return Th;U2=1;var e=Df(),t="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function i(o){var l=this.__data__;if(e){var u=l[o];return u===t?void 0:u}return a.call(l,o)?l[o]:void 0}return Th=i,Th}var Rh,q2;function az(){if(q2)return Rh;q2=1;var e=Df(),t=Object.prototype,r=t.hasOwnProperty;function a(i){var o=this.__data__;return e?o[i]!==void 0:r.call(o,i)}return Rh=a,Rh}var Ah,H2;function iz(){if(H2)return Ah;H2=1;var e=Df(),t="__lodash_hash_undefined__";function r(a,i){var o=this.__data__;return this.size+=this.has(a)?0:1,o[a]=e&&i===void 0?t:i,this}return Ah=r,Ah}var Ih,$2;function sz(){if($2)return Ih;$2=1;var e=tz(),t=rz(),r=nz(),a=az(),i=iz();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=a,o.prototype.set=i,Ih=o,Ih}var Mh,W2;function oz(){if(W2)return Mh;W2=1;var e=sz(),t=Of(),r=tk();function a(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Mh=a,Mh}var Lh,V2;function lz(){if(V2)return Lh;V2=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Lh=e,Lh}var Oh,G2;function Pf(){if(G2)return Oh;G2=1;var e=lz();function t(r,a){var i=r.__data__;return e(a)?i[typeof a=="string"?"string":"hash"]:i.map}return Oh=t,Oh}var Dh,K2;function cz(){if(K2)return Dh;K2=1;var e=Pf();function t(r){var a=e(this,r).delete(r);return this.size-=a?1:0,a}return Dh=t,Dh}var Ph,Y2;function uz(){if(Y2)return Ph;Y2=1;var e=Pf();function t(r){return e(this,r).get(r)}return Ph=t,Ph}var Fh,X2;function dz(){if(X2)return Fh;X2=1;var e=Pf();function t(r){return e(this,r).has(r)}return Fh=t,Fh}var Bh,Q2;function fz(){if(Q2)return Bh;Q2=1;var e=Pf();function t(r,a){var i=e(this,r),o=i.size;return i.set(r,a),this.size+=i.size==o?0:1,this}return Bh=t,Bh}var zh,Z2;function rk(){if(Z2)return zh;Z2=1;var e=oz(),t=cz(),r=uz(),a=dz(),i=fz();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=a,o.prototype.set=i,zh=o,zh}var Uh,J2;function gz(){if(J2)return Uh;J2=1;var e=Of(),t=tk(),r=rk(),a=200;function i(o,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<a-1)return d.push([o,l]),this.size=++u.size,this;u=this.__data__=new r(d)}return u.set(o,l),this.size=u.size,this}return Uh=i,Uh}var qh,eN;function Ff(){if(eN)return qh;eN=1;var e=Of(),t=WB(),r=VB(),a=GB(),i=KB(),o=gz();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=r,l.prototype.get=a,l.prototype.has=i,l.prototype.set=o,qh=l,qh}var Hh,tN;function nk(){if(tN)return Hh;tN=1;function e(t,r){for(var a=-1,i=t==null?0:t.length;++a<i&&r(t[a],a,t)!==!1;);return t}return Hh=e,Hh}var $h,rN;function lR(){if(rN)return $h;rN=1;var e=Mo(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return $h=t,$h}var Wh,nN;function Bf(){if(nN)return Wh;nN=1;var e=lR();function t(r,a,i){a=="__proto__"&&e?e(r,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[a]=i}return Wh=t,Wh}var Vh,aN;function zf(){if(aN)return Vh;aN=1;var e=Bf(),t=Ll(),r=Object.prototype,a=r.hasOwnProperty;function i(o,l,u){var d=o[l];(!(a.call(o,l)&&t(d,u))||u===void 0&&!(l in o))&&e(o,l,u)}return Vh=i,Vh}var Gh,iN;function du(){if(iN)return Gh;iN=1;var e=zf(),t=Bf();function r(a,i,o,l){var u=!o;o||(o={});for(var d=-1,f=i.length;++d<f;){var g=i[d],h=l?l(o[g],a[g],g,o,a):void 0;h===void 0&&(h=a[g]),u?t(o,g,h):e(o,g,h)}return o}return Gh=r,Gh}var Kh,sN;function pz(){if(sN)return Kh;sN=1;function e(t,r){for(var a=-1,i=Array(t);++a<t;)i[a]=r(a);return i}return Kh=e,Kh}var Yh,oN;function Ki(){if(oN)return Yh;oN=1;function e(t){return t!=null&&typeof t=="object"}return Yh=e,Yh}var Xh,lN;function hz(){if(lN)return Xh;lN=1;var e=Io(),t=Ki(),r="[object Arguments]";function a(i){return t(i)&&e(i)==r}return Xh=a,Xh}var Qh,cN;function fu(){if(cN)return Qh;cN=1;var e=hz(),t=Ki(),r=Object.prototype,a=r.hasOwnProperty,i=r.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(l){return t(l)&&a.call(l,"callee")&&!i.call(l,"callee")};return Qh=o,Qh}var Zh,uN;function yn(){if(uN)return Zh;uN=1;var e=Array.isArray;return Zh=e,Zh}var Mc={exports:{}},Jh,dN;function mz(){if(dN)return Jh;dN=1;function e(){return!1}return Jh=e,Jh}Mc.exports;var fN;function Dl(){return fN||(fN=1,(function(e,t){var r=Si(),a=mz(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||a;e.exports=f})(Mc,Mc.exports)),Mc.exports}var e0,gN;function Uf(){if(gN)return e0;gN=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(a,i){var o=typeof a;return i=i??e,!!i&&(o=="number"||o!="symbol"&&t.test(a))&&a>-1&&a%1==0&&a<i}return e0=r,e0}var t0,pN;function ak(){if(pN)return t0;pN=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return t0=t,t0}var r0,hN;function xz(){if(hN)return r0;hN=1;var e=Io(),t=ak(),r=Ki(),a="[object Arguments]",i="[object Array]",o="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",g="[object Number]",h="[object Object]",m="[object RegExp]",y="[object Set]",v="[object String]",k="[object WeakMap]",_="[object ArrayBuffer]",w="[object DataView]",S="[object Float32Array]",E="[object Float64Array]",A="[object Int8Array]",T="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",L="[object Uint8ClampedArray]",O="[object Uint16Array]",I="[object Uint32Array]",B={};B[S]=B[E]=B[A]=B[T]=B[C]=B[j]=B[L]=B[O]=B[I]=!0,B[a]=B[i]=B[_]=B[o]=B[w]=B[l]=B[u]=B[d]=B[f]=B[g]=B[h]=B[m]=B[y]=B[v]=B[k]=!1;function z(ee){return r(ee)&&t(ee.length)&&!!B[e(ee)]}return r0=z,r0}var n0,mN;function qf(){if(mN)return n0;mN=1;function e(t){return function(r){return t(r)}}return n0=e,n0}var Lc={exports:{}};Lc.exports;var xN;function ik(){return xN||(xN=1,(function(e,t){var r=sR(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o&&r.process,u=(function(){try{var d=i&&i.require&&i.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(Lc,Lc.exports)),Lc.exports}var a0,yN;function gu(){if(yN)return a0;yN=1;var e=xz(),t=qf(),r=ik(),a=r&&r.isTypedArray,i=a?t(a):e;return a0=i,a0}var i0,bN;function cR(){if(bN)return i0;bN=1;var e=pz(),t=fu(),r=yn(),a=Dl(),i=Uf(),o=gu(),l=Object.prototype,u=l.hasOwnProperty;function d(f,g){var h=r(f),m=!h&&t(f),y=!h&&!m&&a(f),v=!h&&!m&&!y&&o(f),k=h||m||y||v,_=k?e(f.length,String):[],w=_.length;for(var S in f)(g||u.call(f,S))&&!(k&&(S=="length"||y&&(S=="offset"||S=="parent")||v&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||i(S,w)))&&_.push(S);return _}return i0=d,i0}var s0,vN;function Hf(){if(vN)return s0;vN=1;var e=Object.prototype;function t(r){var a=r&&r.constructor,i=typeof a=="function"&&a.prototype||e;return r===i}return s0=t,s0}var o0,kN;function uR(){if(kN)return o0;kN=1;function e(t,r){return function(a){return t(r(a))}}return o0=e,o0}var l0,_N;function yz(){if(_N)return l0;_N=1;var e=uR(),t=e(Object.keys,Object);return l0=t,l0}var c0,wN;function sk(){if(wN)return c0;wN=1;var e=Hf(),t=yz(),r=Object.prototype,a=r.hasOwnProperty;function i(o){if(!e(o))return t(o);var l=[];for(var u in Object(o))a.call(o,u)&&u!="constructor"&&l.push(u);return l}return c0=i,c0}var u0,NN;function gs(){if(NN)return u0;NN=1;var e=uu(),t=ak();function r(a){return a!=null&&t(a.length)&&!e(a)}return u0=r,u0}var d0,SN;function Vs(){if(SN)return d0;SN=1;var e=cR(),t=sk(),r=gs();function a(i){return r(i)?e(i):t(i)}return d0=a,d0}var f0,EN;function bz(){if(EN)return f0;EN=1;var e=du(),t=Vs();function r(a,i){return a&&e(i,t(i),a)}return f0=r,f0}var g0,jN;function vz(){if(jN)return g0;jN=1;function e(t){var r=[];if(t!=null)for(var a in Object(t))r.push(a);return r}return g0=e,g0}var p0,CN;function kz(){if(CN)return p0;CN=1;var e=ti(),t=Hf(),r=vz(),a=Object.prototype,i=a.hasOwnProperty;function o(l){if(!e(l))return r(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!i.call(l,f))||d.push(f);return d}return p0=o,p0}var h0,TN;function Lo(){if(TN)return h0;TN=1;var e=cR(),t=kz(),r=gs();function a(i){return r(i)?e(i,!0):t(i)}return h0=a,h0}var m0,RN;function _z(){if(RN)return m0;RN=1;var e=du(),t=Lo();function r(a,i){return a&&e(i,t(i),a)}return m0=r,m0}var Oc={exports:{}};Oc.exports;var AN;function dR(){return AN||(AN=1,(function(e,t){var r=Si(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o?r.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,g){if(g)return f.slice();var h=f.length,m=u?u(h):new f.constructor(h);return f.copy(m),m}e.exports=d})(Oc,Oc.exports)),Oc.exports}var x0,IN;function fR(){if(IN)return x0;IN=1;function e(t,r){var a=-1,i=t.length;for(r||(r=Array(i));++a<i;)r[a]=t[a];return r}return x0=e,x0}var y0,MN;function gR(){if(MN)return y0;MN=1;function e(t,r){for(var a=-1,i=t==null?0:t.length,o=0,l=[];++a<i;){var u=t[a];r(u,a,t)&&(l[o++]=u)}return l}return y0=e,y0}var b0,LN;function pR(){if(LN)return b0;LN=1;function e(){return[]}return b0=e,b0}var v0,ON;function ok(){if(ON)return v0;ON=1;var e=gR(),t=pR(),r=Object.prototype,a=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,o=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return a.call(l,u)}))}:t;return v0=o,v0}var k0,DN;function wz(){if(DN)return k0;DN=1;var e=du(),t=ok();function r(a,i){return e(a,t(a),i)}return k0=r,k0}var _0,PN;function lk(){if(PN)return _0;PN=1;function e(t,r){for(var a=-1,i=r.length,o=t.length;++a<i;)t[o+a]=r[a];return t}return _0=e,_0}var w0,FN;function $f(){if(FN)return w0;FN=1;var e=uR(),t=e(Object.getPrototypeOf,Object);return w0=t,w0}var N0,BN;function hR(){if(BN)return N0;BN=1;var e=lk(),t=$f(),r=ok(),a=pR(),i=Object.getOwnPropertySymbols,o=i?function(l){for(var u=[];l;)e(u,r(l)),l=t(l);return u}:a;return N0=o,N0}var S0,zN;function Nz(){if(zN)return S0;zN=1;var e=du(),t=hR();function r(a,i){return e(a,t(a),i)}return S0=r,S0}var E0,UN;function mR(){if(UN)return E0;UN=1;var e=lk(),t=yn();function r(a,i,o){var l=i(a);return t(a)?l:e(l,o(a))}return E0=r,E0}var j0,qN;function xR(){if(qN)return j0;qN=1;var e=mR(),t=ok(),r=Vs();function a(i){return e(i,r,t)}return j0=a,j0}var C0,HN;function Sz(){if(HN)return C0;HN=1;var e=mR(),t=hR(),r=Lo();function a(i){return e(i,r,t)}return C0=a,C0}var T0,$N;function Ez(){if($N)return T0;$N=1;var e=Mo(),t=Si(),r=e(t,"DataView");return T0=r,T0}var R0,WN;function jz(){if(WN)return R0;WN=1;var e=Mo(),t=Si(),r=e(t,"Promise");return R0=r,R0}var A0,VN;function yR(){if(VN)return A0;VN=1;var e=Mo(),t=Si(),r=e(t,"Set");return A0=r,A0}var I0,GN;function Cz(){if(GN)return I0;GN=1;var e=Mo(),t=Si(),r=e(t,"WeakMap");return I0=r,I0}var M0,KN;function Pl(){if(KN)return M0;KN=1;var e=Ez(),t=tk(),r=jz(),a=yR(),i=Cz(),o=Io(),l=oR(),u="[object Map]",d="[object Object]",f="[object Promise]",g="[object Set]",h="[object WeakMap]",m="[object DataView]",y=l(e),v=l(t),k=l(r),_=l(a),w=l(i),S=o;return(e&&S(new e(new ArrayBuffer(1)))!=m||t&&S(new t)!=u||r&&S(r.resolve())!=f||a&&S(new a)!=g||i&&S(new i)!=h)&&(S=function(E){var A=o(E),T=A==d?E.constructor:void 0,C=T?l(T):"";if(C)switch(C){case y:return m;case v:return u;case k:return f;case _:return g;case w:return h}return A}),M0=S,M0}var L0,YN;function Tz(){if(YN)return L0;YN=1;var e=Object.prototype,t=e.hasOwnProperty;function r(a){var i=a.length,o=new a.constructor(i);return i&&typeof a[0]=="string"&&t.call(a,"index")&&(o.index=a.index,o.input=a.input),o}return L0=r,L0}var O0,XN;function bR(){if(XN)return O0;XN=1;var e=Si(),t=e.Uint8Array;return O0=t,O0}var D0,QN;function ck(){if(QN)return D0;QN=1;var e=bR();function t(r){var a=new r.constructor(r.byteLength);return new e(a).set(new e(r)),a}return D0=t,D0}var P0,ZN;function Rz(){if(ZN)return P0;ZN=1;var e=ck();function t(r,a){var i=a?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.byteLength)}return P0=t,P0}var F0,JN;function Az(){if(JN)return F0;JN=1;var e=/\w*$/;function t(r){var a=new r.constructor(r.source,e.exec(r));return a.lastIndex=r.lastIndex,a}return F0=t,F0}var B0,eS;function Iz(){if(eS)return B0;eS=1;var e=Ol(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function a(i){return r?Object(r.call(i)):{}}return B0=a,B0}var z0,tS;function vR(){if(tS)return z0;tS=1;var e=ck();function t(r,a){var i=a?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.length)}return z0=t,z0}var U0,rS;function Mz(){if(rS)return U0;rS=1;var e=ck(),t=Rz(),r=Az(),a=Iz(),i=vR(),o="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",g="[object Set]",h="[object String]",m="[object Symbol]",y="[object ArrayBuffer]",v="[object DataView]",k="[object Float32Array]",_="[object Float64Array]",w="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]";function L(O,I,B){var z=O.constructor;switch(I){case y:return e(O);case o:case l:return new z(+O);case v:return t(O,B);case k:case _:case w:case S:case E:case A:case T:case C:case j:return i(O,B);case u:return new z;case d:case h:return new z(O);case f:return r(O);case g:return new z;case m:return a(O)}}return U0=L,U0}var q0,nS;function kR(){if(nS)return q0;nS=1;var e=ti(),t=Object.create,r=(function(){function a(){}return function(i){if(!e(i))return{};if(t)return t(i);a.prototype=i;var o=new a;return a.prototype=void 0,o}})();return q0=r,q0}var H0,aS;function _R(){if(aS)return H0;aS=1;var e=kR(),t=$f(),r=Hf();function a(i){return typeof i.constructor=="function"&&!r(i)?e(t(i)):{}}return H0=a,H0}var $0,iS;function Lz(){if(iS)return $0;iS=1;var e=Pl(),t=Ki(),r="[object Map]";function a(i){return t(i)&&e(i)==r}return $0=a,$0}var W0,sS;function Oz(){if(sS)return W0;sS=1;var e=Lz(),t=qf(),r=ik(),a=r&&r.isMap,i=a?t(a):e;return W0=i,W0}var V0,oS;function Dz(){if(oS)return V0;oS=1;var e=Pl(),t=Ki(),r="[object Set]";function a(i){return t(i)&&e(i)==r}return V0=a,V0}var G0,lS;function Pz(){if(lS)return G0;lS=1;var e=Dz(),t=qf(),r=ik(),a=r&&r.isSet,i=a?t(a):e;return G0=i,G0}var K0,cS;function wR(){if(cS)return K0;cS=1;var e=Ff(),t=nk(),r=zf(),a=bz(),i=_z(),o=dR(),l=fR(),u=wz(),d=Nz(),f=xR(),g=Sz(),h=Pl(),m=Tz(),y=Mz(),v=_R(),k=yn(),_=Dl(),w=Oz(),S=ti(),E=Pz(),A=Vs(),T=Lo(),C=1,j=2,L=4,O="[object Arguments]",I="[object Array]",B="[object Boolean]",z="[object Date]",ee="[object Error]",$="[object Function]",M="[object GeneratorFunction]",G="[object Map]",Y="[object Number]",X="[object Object]",ie="[object RegExp]",F="[object Set]",U="[object String]",Z="[object Symbol]",P="[object WeakMap]",K="[object ArrayBuffer]",V="[object DataView]",W="[object Float32Array]",ae="[object Float64Array]",Q="[object Int8Array]",he="[object Int16Array]",Ne="[object Int32Array]",De="[object Uint8Array]",Ve="[object Uint8ClampedArray]",at="[object Uint16Array]",lt="[object Uint32Array]",Ce={};Ce[O]=Ce[I]=Ce[K]=Ce[V]=Ce[B]=Ce[z]=Ce[W]=Ce[ae]=Ce[Q]=Ce[he]=Ce[Ne]=Ce[G]=Ce[Y]=Ce[X]=Ce[ie]=Ce[F]=Ce[U]=Ce[Z]=Ce[De]=Ce[Ve]=Ce[at]=Ce[lt]=!0,Ce[ee]=Ce[$]=Ce[P]=!1;function $e(Be,gt,ut,jt,Ge,we){var Ue,Ae=gt&C,rt=gt&j,fe=gt&L;if(ut&&(Ue=Ge?ut(Be,jt,Ge,we):ut(Be)),Ue!==void 0)return Ue;if(!S(Be))return Be;var ce=k(Be);if(ce){if(Ue=m(Be),!Ae)return l(Be,Ue)}else{var ve=h(Be),ye=ve==$||ve==M;if(_(Be))return o(Be,Ae);if(ve==X||ve==O||ye&&!Ge){if(Ue=rt||ye?{}:v(Be),!Ae)return rt?d(Be,i(Ue,Be)):u(Be,a(Ue,Be))}else{if(!Ce[ve])return Ge?Be:{};Ue=y(Be,ve,Ae)}}we||(we=new e);var it=we.get(Be);if(it)return it;we.set(Be,Ue),E(Be)?Be.forEach(function(yt){Ue.add($e(yt,gt,ut,yt,Be,we))}):w(Be)&&Be.forEach(function(yt,ht){Ue.set(ht,$e(yt,gt,ut,ht,Be,we))});var qe=fe?rt?g:f:rt?T:A,Ye=ce?void 0:qe(Be);return t(Ye||Be,function(yt,ht){Ye&&(ht=yt,yt=Be[ht]),r(Ue,ht,$e(yt,gt,ut,ht,Be,we))}),Ue}return K0=$e,K0}var Y0,uS;function Fz(){if(uS)return Y0;uS=1;var e=wR(),t=4;function r(a){return e(a,t)}return Y0=r,Y0}var X0,dS;function uk(){if(dS)return X0;dS=1;function e(t){return function(){return t}}return X0=e,X0}var Q0,fS;function Bz(){if(fS)return Q0;fS=1;function e(t){return function(r,a,i){for(var o=-1,l=Object(r),u=i(r),d=u.length;d--;){var f=u[t?d:++o];if(a(l[f],f,l)===!1)break}return r}}return Q0=e,Q0}var Z0,gS;function dk(){if(gS)return Z0;gS=1;var e=Bz(),t=e();return Z0=t,Z0}var J0,pS;function fk(){if(pS)return J0;pS=1;var e=dk(),t=Vs();function r(a,i){return a&&e(a,i,t)}return J0=r,J0}var em,hS;function zz(){if(hS)return em;hS=1;var e=gs();function t(r,a){return function(i,o){if(i==null)return i;if(!e(i))return r(i,o);for(var l=i.length,u=a?l:-1,d=Object(i);(a?u--:++u<l)&&o(d[u],u,d)!==!1;);return i}}return em=t,em}var tm,mS;function Wf(){if(mS)return tm;mS=1;var e=fk(),t=zz(),r=t(e);return tm=r,tm}var rm,xS;function Oo(){if(xS)return rm;xS=1;function e(t){return t}return rm=e,rm}var nm,yS;function NR(){if(yS)return nm;yS=1;var e=Oo();function t(r){return typeof r=="function"?r:e}return nm=t,nm}var am,bS;function SR(){if(bS)return am;bS=1;var e=nk(),t=Wf(),r=NR(),a=yn();function i(o,l){var u=a(o)?e:t;return u(o,r(l))}return am=i,am}var im,vS;function ER(){return vS||(vS=1,im=SR()),im}var sm,kS;function Uz(){if(kS)return sm;kS=1;var e=Wf();function t(r,a){var i=[];return e(r,function(o,l,u){a(o,l,u)&&i.push(o)}),i}return sm=t,sm}var om,_S;function qz(){if(_S)return om;_S=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return om=t,om}var lm,wS;function Hz(){if(wS)return lm;wS=1;function e(t){return this.__data__.has(t)}return lm=e,lm}var cm,NS;function jR(){if(NS)return cm;NS=1;var e=rk(),t=qz(),r=Hz();function a(i){var o=-1,l=i==null?0:i.length;for(this.__data__=new e;++o<l;)this.add(i[o])}return a.prototype.add=a.prototype.push=t,a.prototype.has=r,cm=a,cm}var um,SS;function $z(){if(SS)return um;SS=1;function e(t,r){for(var a=-1,i=t==null?0:t.length;++a<i;)if(r(t[a],a,t))return!0;return!1}return um=e,um}var dm,ES;function CR(){if(ES)return dm;ES=1;function e(t,r){return t.has(r)}return dm=e,dm}var fm,jS;function TR(){if(jS)return fm;jS=1;var e=jR(),t=$z(),r=CR(),a=1,i=2;function o(l,u,d,f,g,h){var m=d&a,y=l.length,v=u.length;if(y!=v&&!(m&&v>y))return!1;var k=h.get(l),_=h.get(u);if(k&&_)return k==u&&_==l;var w=-1,S=!0,E=d&i?new e:void 0;for(h.set(l,u),h.set(u,l);++w<y;){var A=l[w],T=u[w];if(f)var C=m?f(T,A,w,u,l,h):f(A,T,w,l,u,h);if(C!==void 0){if(C)continue;S=!1;break}if(E){if(!t(u,function(j,L){if(!r(E,L)&&(A===j||g(A,j,d,f,h)))return E.push(L)})){S=!1;break}}else if(!(A===T||g(A,T,d,f,h))){S=!1;break}}return h.delete(l),h.delete(u),S}return fm=o,fm}var gm,CS;function Wz(){if(CS)return gm;CS=1;function e(t){var r=-1,a=Array(t.size);return t.forEach(function(i,o){a[++r]=[o,i]}),a}return gm=e,gm}var pm,TS;function gk(){if(TS)return pm;TS=1;function e(t){var r=-1,a=Array(t.size);return t.forEach(function(i){a[++r]=i}),a}return pm=e,pm}var hm,RS;function Vz(){if(RS)return hm;RS=1;var e=Ol(),t=bR(),r=Ll(),a=TR(),i=Wz(),o=gk(),l=1,u=2,d="[object Boolean]",f="[object Date]",g="[object Error]",h="[object Map]",m="[object Number]",y="[object RegExp]",v="[object Set]",k="[object String]",_="[object Symbol]",w="[object ArrayBuffer]",S="[object DataView]",E=e?e.prototype:void 0,A=E?E.valueOf:void 0;function T(C,j,L,O,I,B,z){switch(L){case S:if(C.byteLength!=j.byteLength||C.byteOffset!=j.byteOffset)return!1;C=C.buffer,j=j.buffer;case w:return!(C.byteLength!=j.byteLength||!B(new t(C),new t(j)));case d:case f:case m:return r(+C,+j);case g:return C.name==j.name&&C.message==j.message;case y:case k:return C==j+"";case h:var ee=i;case v:var $=O&l;if(ee||(ee=o),C.size!=j.size&&!$)return!1;var M=z.get(C);if(M)return M==j;O|=u,z.set(C,j);var G=a(ee(C),ee(j),O,I,B,z);return z.delete(C),G;case _:if(A)return A.call(C)==A.call(j)}return!1}return hm=T,hm}var mm,AS;function Gz(){if(AS)return mm;AS=1;var e=xR(),t=1,r=Object.prototype,a=r.hasOwnProperty;function i(o,l,u,d,f,g){var h=u&t,m=e(o),y=m.length,v=e(l),k=v.length;if(y!=k&&!h)return!1;for(var _=y;_--;){var w=m[_];if(!(h?w in l:a.call(l,w)))return!1}var S=g.get(o),E=g.get(l);if(S&&E)return S==l&&E==o;var A=!0;g.set(o,l),g.set(l,o);for(var T=h;++_<y;){w=m[_];var C=o[w],j=l[w];if(d)var L=h?d(j,C,w,l,o,g):d(C,j,w,o,l,g);if(!(L===void 0?C===j||f(C,j,u,d,g):L)){A=!1;break}T||(T=w=="constructor")}if(A&&!T){var O=o.constructor,I=l.constructor;O!=I&&"constructor"in o&&"constructor"in l&&!(typeof O=="function"&&O instanceof O&&typeof I=="function"&&I instanceof I)&&(A=!1)}return g.delete(o),g.delete(l),A}return mm=i,mm}var xm,IS;function Kz(){if(IS)return xm;IS=1;var e=Ff(),t=TR(),r=Vz(),a=Gz(),i=Pl(),o=yn(),l=Dl(),u=gu(),d=1,f="[object Arguments]",g="[object Array]",h="[object Object]",m=Object.prototype,y=m.hasOwnProperty;function v(k,_,w,S,E,A){var T=o(k),C=o(_),j=T?g:i(k),L=C?g:i(_);j=j==f?h:j,L=L==f?h:L;var O=j==h,I=L==h,B=j==L;if(B&&l(k)){if(!l(_))return!1;T=!0,O=!1}if(B&&!O)return A||(A=new e),T||u(k)?t(k,_,w,S,E,A):r(k,_,j,w,S,E,A);if(!(w&d)){var z=O&&y.call(k,"__wrapped__"),ee=I&&y.call(_,"__wrapped__");if(z||ee){var $=z?k.value():k,M=ee?_.value():_;return A||(A=new e),E($,M,w,S,A)}}return B?(A||(A=new e),a(k,_,w,S,E,A)):!1}return xm=v,xm}var ym,MS;function RR(){if(MS)return ym;MS=1;var e=Kz(),t=Ki();function r(a,i,o,l,u){return a===i?!0:a==null||i==null||!t(a)&&!t(i)?a!==a&&i!==i:e(a,i,o,l,r,u)}return ym=r,ym}var bm,LS;function Yz(){if(LS)return bm;LS=1;var e=Ff(),t=RR(),r=1,a=2;function i(o,l,u,d){var f=u.length,g=f,h=!d;if(o==null)return!g;for(o=Object(o);f--;){var m=u[f];if(h&&m[2]?m[1]!==o[m[0]]:!(m[0]in o))return!1}for(;++f<g;){m=u[f];var y=m[0],v=o[y],k=m[1];if(h&&m[2]){if(v===void 0&&!(y in o))return!1}else{var _=new e;if(d)var w=d(v,k,y,o,l,_);if(!(w===void 0?t(k,v,r|a,d,_):w))return!1}}return!0}return bm=i,bm}var vm,OS;function AR(){if(OS)return vm;OS=1;var e=ti();function t(r){return r===r&&!e(r)}return vm=t,vm}var km,DS;function Xz(){if(DS)return km;DS=1;var e=AR(),t=Vs();function r(a){for(var i=t(a),o=i.length;o--;){var l=i[o],u=a[l];i[o]=[l,u,e(u)]}return i}return km=r,km}var _m,PS;function IR(){if(PS)return _m;PS=1;function e(t,r){return function(a){return a==null?!1:a[t]===r&&(r!==void 0||t in Object(a))}}return _m=e,_m}var wm,FS;function Qz(){if(FS)return wm;FS=1;var e=Yz(),t=Xz(),r=IR();function a(i){var o=t(i);return o.length==1&&o[0][2]?r(o[0][0],o[0][1]):function(l){return l===i||e(l,i,o)}}return wm=a,wm}var Nm,BS;function Fl(){if(BS)return Nm;BS=1;var e=Io(),t=Ki(),r="[object Symbol]";function a(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Nm=a,Nm}var Sm,zS;function pk(){if(zS)return Sm;zS=1;var e=yn(),t=Fl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function i(o,l){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:a.test(o)||!r.test(o)||l!=null&&o in Object(l)}return Sm=i,Sm}var Em,US;function Zz(){if(US)return Em;US=1;var e=rk(),t="Expected a function";function r(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var l=arguments,u=i?i.apply(this,l):l[0],d=o.cache;if(d.has(u))return d.get(u);var f=a.apply(this,l);return o.cache=d.set(u,f)||d,f};return o.cache=new(r.Cache||e),o}return r.Cache=e,Em=r,Em}var jm,qS;function Jz(){if(qS)return jm;qS=1;var e=Zz(),t=500;function r(a){var i=e(a,function(l){return o.size===t&&o.clear(),l}),o=i.cache;return i}return jm=r,jm}var Cm,HS;function eU(){if(HS)return Cm;HS=1;var e=Jz(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(l,u,d,f){o.push(d?f.replace(r,"$1"):u||l)}),o});return Cm=a,Cm}var Tm,$S;function Vf(){if($S)return Tm;$S=1;function e(t,r){for(var a=-1,i=t==null?0:t.length,o=Array(i);++a<i;)o[a]=r(t[a],a,t);return o}return Tm=e,Tm}var Rm,WS;function tU(){if(WS)return Rm;WS=1;var e=Ol(),t=Vf(),r=yn(),a=Fl(),i=e?e.prototype:void 0,o=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(r(u))return t(u,l)+"";if(a(u))return o?o.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Rm=l,Rm}var Am,VS;function MR(){if(VS)return Am;VS=1;var e=tU();function t(r){return r==null?"":e(r)}return Am=t,Am}var Im,GS;function Gf(){if(GS)return Im;GS=1;var e=yn(),t=pk(),r=eU(),a=MR();function i(o,l){return e(o)?o:t(o,l)?[o]:r(a(o))}return Im=i,Im}var Mm,KS;function pu(){if(KS)return Mm;KS=1;var e=Fl();function t(r){if(typeof r=="string"||e(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return Mm=t,Mm}var Lm,YS;function Kf(){if(YS)return Lm;YS=1;var e=Gf(),t=pu();function r(a,i){i=e(i,a);for(var o=0,l=i.length;a!=null&&o<l;)a=a[t(i[o++])];return o&&o==l?a:void 0}return Lm=r,Lm}var Om,XS;function rU(){if(XS)return Om;XS=1;var e=Kf();function t(r,a,i){var o=r==null?void 0:e(r,a);return o===void 0?i:o}return Om=t,Om}var Dm,QS;function nU(){if(QS)return Dm;QS=1;function e(t,r){return t!=null&&r in Object(t)}return Dm=e,Dm}var Pm,ZS;function LR(){if(ZS)return Pm;ZS=1;var e=Gf(),t=fu(),r=yn(),a=Uf(),i=ak(),o=pu();function l(u,d,f){d=e(d,u);for(var g=-1,h=d.length,m=!1;++g<h;){var y=o(d[g]);if(!(m=u!=null&&f(u,y)))break;u=u[y]}return m||++g!=h?m:(h=u==null?0:u.length,!!h&&i(h)&&a(y,h)&&(r(u)||t(u)))}return Pm=l,Pm}var Fm,JS;function OR(){if(JS)return Fm;JS=1;var e=nU(),t=LR();function r(a,i){return a!=null&&t(a,i,e)}return Fm=r,Fm}var Bm,eE;function aU(){if(eE)return Bm;eE=1;var e=RR(),t=rU(),r=OR(),a=pk(),i=AR(),o=IR(),l=pu(),u=1,d=2;function f(g,h){return a(g)&&i(h)?o(l(g),h):function(m){var y=t(m,g);return y===void 0&&y===h?r(m,g):e(h,y,u|d)}}return Bm=f,Bm}var zm,tE;function DR(){if(tE)return zm;tE=1;function e(t){return function(r){return r==null?void 0:r[t]}}return zm=e,zm}var Um,rE;function iU(){if(rE)return Um;rE=1;var e=Kf();function t(r){return function(a){return e(a,r)}}return Um=t,Um}var qm,nE;function sU(){if(nE)return qm;nE=1;var e=DR(),t=iU(),r=pk(),a=pu();function i(o){return r(o)?e(a(o)):t(o)}return qm=i,qm}var Hm,aE;function ps(){if(aE)return Hm;aE=1;var e=Qz(),t=aU(),r=Oo(),a=yn(),i=sU();function o(l){return typeof l=="function"?l:l==null?r:typeof l=="object"?a(l)?t(l[0],l[1]):e(l):i(l)}return Hm=o,Hm}var $m,iE;function PR(){if(iE)return $m;iE=1;var e=gR(),t=Uz(),r=ps(),a=yn();function i(o,l){var u=a(o)?e:t;return u(o,r(l,3))}return $m=i,$m}var Wm,sE;function oU(){if(sE)return Wm;sE=1;var e=Object.prototype,t=e.hasOwnProperty;function r(a,i){return a!=null&&t.call(a,i)}return Wm=r,Wm}var Vm,oE;function FR(){if(oE)return Vm;oE=1;var e=oU(),t=LR();function r(a,i){return a!=null&&t(a,i,e)}return Vm=r,Vm}var Gm,lE;function lU(){if(lE)return Gm;lE=1;var e=sk(),t=Pl(),r=fu(),a=yn(),i=gs(),o=Dl(),l=Hf(),u=gu(),d="[object Map]",f="[object Set]",g=Object.prototype,h=g.hasOwnProperty;function m(y){if(y==null)return!0;if(i(y)&&(a(y)||typeof y=="string"||typeof y.splice=="function"||o(y)||u(y)||r(y)))return!y.length;var v=t(y);if(v==d||v==f)return!y.size;if(l(y))return!e(y).length;for(var k in y)if(h.call(y,k))return!1;return!0}return Gm=m,Gm}var Km,cE;function BR(){if(cE)return Km;cE=1;function e(t){return t===void 0}return Km=e,Km}var Ym,uE;function zR(){if(uE)return Ym;uE=1;var e=Wf(),t=gs();function r(a,i){var o=-1,l=t(a)?Array(a.length):[];return e(a,function(u,d,f){l[++o]=i(u,d,f)}),l}return Ym=r,Ym}var Xm,dE;function UR(){if(dE)return Xm;dE=1;var e=Vf(),t=ps(),r=zR(),a=yn();function i(o,l){var u=a(o)?e:r;return u(o,t(l,3))}return Xm=i,Xm}var Qm,fE;function cU(){if(fE)return Qm;fE=1;function e(t,r,a,i){var o=-1,l=t==null?0:t.length;for(i&&l&&(a=t[++o]);++o<l;)a=r(a,t[o],o,t);return a}return Qm=e,Qm}var Zm,gE;function uU(){if(gE)return Zm;gE=1;function e(t,r,a,i,o){return o(t,function(l,u,d){a=i?(i=!1,l):r(a,l,u,d)}),a}return Zm=e,Zm}var Jm,pE;function qR(){if(pE)return Jm;pE=1;var e=cU(),t=Wf(),r=ps(),a=uU(),i=yn();function o(l,u,d){var f=i(l)?e:a,g=arguments.length<3;return f(l,r(u,4),d,g,t)}return Jm=o,Jm}var ex,hE;function dU(){if(hE)return ex;hE=1;var e=Io(),t=yn(),r=Ki(),a="[object String]";function i(o){return typeof o=="string"||!t(o)&&r(o)&&e(o)==a}return ex=i,ex}var tx,mE;function fU(){if(mE)return tx;mE=1;var e=DR(),t=e("length");return tx=t,tx}var rx,xE;function gU(){if(xE)return rx;xE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",a="\\u20d0-\\u20ff",i=t+r+a,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+o+"]");function d(f){return u.test(f)}return rx=d,rx}var nx,yE;function pU(){if(yE)return nx;yE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",a="\\u20d0-\\u20ff",i=t+r+a,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",g="[^"+e+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",v=f+"?",k="["+o+"]?",_="(?:"+y+"(?:"+[g,h,m].join("|")+")"+k+v+")*",w=k+v+_,S="(?:"+[g+u+"?",u,h,m,l].join("|")+")",E=RegExp(d+"(?="+d+")|"+S+w,"g");function A(T){for(var C=E.lastIndex=0;E.test(T);)++C;return C}return nx=A,nx}var ax,bE;function hU(){if(bE)return ax;bE=1;var e=fU(),t=gU(),r=pU();function a(i){return t(i)?r(i):e(i)}return ax=a,ax}var ix,vE;function mU(){if(vE)return ix;vE=1;var e=sk(),t=Pl(),r=gs(),a=dU(),i=hU(),o="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(r(d))return a(d)?i(d):d.length;var f=t(d);return f==o||f==l?d.size:e(d).length}return ix=u,ix}var sx,kE;function xU(){if(kE)return sx;kE=1;var e=nk(),t=kR(),r=fk(),a=ps(),i=$f(),o=yn(),l=Dl(),u=uu(),d=ti(),f=gu();function g(h,m,y){var v=o(h),k=v||l(h)||f(h);if(m=a(m,4),y==null){var _=h&&h.constructor;k?y=v?new _:[]:d(h)?y=u(_)?t(i(h)):{}:y={}}return(k?e:r)(h,function(w,S,E){return m(y,w,S,E)}),y}return sx=g,sx}var ox,_E;function yU(){if(_E)return ox;_E=1;var e=Ol(),t=fu(),r=yn(),a=e?e.isConcatSpreadable:void 0;function i(o){return r(o)||t(o)||!!(a&&o&&o[a])}return ox=i,ox}var lx,wE;function hk(){if(wE)return lx;wE=1;var e=lk(),t=yU();function r(a,i,o,l,u){var d=-1,f=a.length;for(o||(o=t),u||(u=[]);++d<f;){var g=a[d];i>0&&o(g)?i>1?r(g,i-1,o,l,u):e(u,g):l||(u[u.length]=g)}return u}return lx=r,lx}var cx,NE;function bU(){if(NE)return cx;NE=1;function e(t,r,a){switch(a.length){case 0:return t.call(r);case 1:return t.call(r,a[0]);case 2:return t.call(r,a[0],a[1]);case 3:return t.call(r,a[0],a[1],a[2])}return t.apply(r,a)}return cx=e,cx}var ux,SE;function HR(){if(SE)return ux;SE=1;var e=bU(),t=Math.max;function r(a,i,o){return i=t(i===void 0?a.length-1:i,0),function(){for(var l=arguments,u=-1,d=t(l.length-i,0),f=Array(d);++u<d;)f[u]=l[i+u];u=-1;for(var g=Array(i+1);++u<i;)g[u]=l[u];return g[i]=o(f),e(a,this,g)}}return ux=r,ux}var dx,EE;function vU(){if(EE)return dx;EE=1;var e=uk(),t=lR(),r=Oo(),a=t?function(i,o){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:r;return dx=a,dx}var fx,jE;function kU(){if(jE)return fx;jE=1;var e=800,t=16,r=Date.now;function a(i){var o=0,l=0;return function(){var u=r(),d=t-(u-l);if(l=u,d>0){if(++o>=e)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return fx=a,fx}var gx,CE;function $R(){if(CE)return gx;CE=1;var e=vU(),t=kU(),r=t(e);return gx=r,gx}var px,TE;function Yf(){if(TE)return px;TE=1;var e=Oo(),t=HR(),r=$R();function a(i,o){return r(t(i,o,e),i+"")}return px=a,px}var hx,RE;function WR(){if(RE)return hx;RE=1;function e(t,r,a,i){for(var o=t.length,l=a+(i?1:-1);i?l--:++l<o;)if(r(t[l],l,t))return l;return-1}return hx=e,hx}var mx,AE;function _U(){if(AE)return mx;AE=1;function e(t){return t!==t}return mx=e,mx}var xx,IE;function wU(){if(IE)return xx;IE=1;function e(t,r,a){for(var i=a-1,o=t.length;++i<o;)if(t[i]===r)return i;return-1}return xx=e,xx}var yx,ME;function NU(){if(ME)return yx;ME=1;var e=WR(),t=_U(),r=wU();function a(i,o,l){return o===o?r(i,o,l):e(i,t,l)}return yx=a,yx}var bx,LE;function SU(){if(LE)return bx;LE=1;var e=NU();function t(r,a){var i=r==null?0:r.length;return!!i&&e(r,a,0)>-1}return bx=t,bx}var vx,OE;function EU(){if(OE)return vx;OE=1;function e(t,r,a){for(var i=-1,o=t==null?0:t.length;++i<o;)if(a(r,t[i]))return!0;return!1}return vx=e,vx}var kx,DE;function jU(){if(DE)return kx;DE=1;function e(){}return kx=e,kx}var _x,PE;function CU(){if(PE)return _x;PE=1;var e=yR(),t=jU(),r=gk(),a=1/0,i=e&&1/r(new e([,-0]))[1]==a?function(o){return new e(o)}:t;return _x=i,_x}var wx,FE;function TU(){if(FE)return wx;FE=1;var e=jR(),t=SU(),r=EU(),a=CR(),i=CU(),o=gk(),l=200;function u(d,f,g){var h=-1,m=t,y=d.length,v=!0,k=[],_=k;if(g)v=!1,m=r;else if(y>=l){var w=f?null:i(d);if(w)return o(w);v=!1,m=a,_=new e}else _=f?[]:k;e:for(;++h<y;){var S=d[h],E=f?f(S):S;if(S=g||S!==0?S:0,v&&E===E){for(var A=_.length;A--;)if(_[A]===E)continue e;f&&_.push(E),k.push(S)}else m(_,E,g)||(_!==k&&_.push(E),k.push(S))}return k}return wx=u,wx}var Nx,BE;function VR(){if(BE)return Nx;BE=1;var e=gs(),t=Ki();function r(a){return t(a)&&e(a)}return Nx=r,Nx}var Sx,zE;function RU(){if(zE)return Sx;zE=1;var e=hk(),t=Yf(),r=TU(),a=VR(),i=t(function(o){return r(e(o,1,a,!0))});return Sx=i,Sx}var Ex,UE;function AU(){if(UE)return Ex;UE=1;var e=Vf();function t(r,a){return e(a,function(i){return r[i]})}return Ex=t,Ex}var jx,qE;function GR(){if(qE)return jx;qE=1;var e=AU(),t=Vs();function r(a){return a==null?[]:e(a,t(a))}return jx=r,jx}var Cx,HE;function ri(){if(HE)return Cx;HE=1;var e;if(typeof ek=="function")try{e={clone:Fz(),constant:uk(),each:ER(),filter:PR(),has:FR(),isArray:yn(),isEmpty:lU(),isFunction:uu(),isUndefined:BR(),keys:Vs(),map:UR(),reduce:qR(),size:mU(),transform:xU(),union:RU(),values:GR()}}catch{}return e||(e=window._),Cx=e,Cx}var Tx,$E;function mk(){if($E)return Tx;$E=1;var e=ri();Tx=i;var t="\0",r="\0",a="";function i(g){this._isDirected=e.has(g,"directed")?g.directed:!0,this._isMultigraph=e.has(g,"multigraph")?g.multigraph:!1,this._isCompound=e.has(g,"compound")?g.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(g){return this._label=g,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(g){return e.isFunction(g)||(g=e.constant(g)),this._defaultNodeLabelFn=g,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var g=this;return e.filter(this.nodes(),function(h){return e.isEmpty(g._in[h])})},i.prototype.sinks=function(){var g=this;return e.filter(this.nodes(),function(h){return e.isEmpty(g._out[h])})},i.prototype.setNodes=function(g,h){var m=arguments,y=this;return e.each(g,function(v){m.length>1?y.setNode(v,h):y.setNode(v)}),this},i.prototype.setNode=function(g,h){return e.has(this._nodes,g)?(arguments.length>1&&(this._nodes[g]=h),this):(this._nodes[g]=arguments.length>1?h:this._defaultNodeLabelFn(g),this._isCompound&&(this._parent[g]=r,this._children[g]={},this._children[r][g]=!0),this._in[g]={},this._preds[g]={},this._out[g]={},this._sucs[g]={},++this._nodeCount,this)},i.prototype.node=function(g){return this._nodes[g]},i.prototype.hasNode=function(g){return e.has(this._nodes,g)},i.prototype.removeNode=function(g){var h=this;if(e.has(this._nodes,g)){var m=function(y){h.removeEdge(h._edgeObjs[y])};delete this._nodes[g],this._isCompound&&(this._removeFromParentsChildList(g),delete this._parent[g],e.each(this.children(g),function(y){h.setParent(y)}),delete this._children[g]),e.each(e.keys(this._in[g]),m),delete this._in[g],delete this._preds[g],e.each(e.keys(this._out[g]),m),delete this._out[g],delete this._sucs[g],--this._nodeCount}return this},i.prototype.setParent=function(g,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(h))h=r;else{h+="";for(var m=h;!e.isUndefined(m);m=this.parent(m))if(m===g)throw new Error("Setting "+h+" as parent of "+g+" would create a cycle");this.setNode(h)}return this.setNode(g),this._removeFromParentsChildList(g),this._parent[g]=h,this._children[h][g]=!0,this},i.prototype._removeFromParentsChildList=function(g){delete this._children[this._parent[g]][g]},i.prototype.parent=function(g){if(this._isCompound){var h=this._parent[g];if(h!==r)return h}},i.prototype.children=function(g){if(e.isUndefined(g)&&(g=r),this._isCompound){var h=this._children[g];if(h)return e.keys(h)}else{if(g===r)return this.nodes();if(this.hasNode(g))return[]}},i.prototype.predecessors=function(g){var h=this._preds[g];if(h)return e.keys(h)},i.prototype.successors=function(g){var h=this._sucs[g];if(h)return e.keys(h)},i.prototype.neighbors=function(g){var h=this.predecessors(g);if(h)return e.union(h,this.successors(g))},i.prototype.isLeaf=function(g){var h;return this.isDirected()?h=this.successors(g):h=this.neighbors(g),h.length===0},i.prototype.filterNodes=function(g){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var m=this;e.each(this._nodes,function(k,_){g(_)&&h.setNode(_,k)}),e.each(this._edgeObjs,function(k){h.hasNode(k.v)&&h.hasNode(k.w)&&h.setEdge(k,m.edge(k))});var y={};function v(k){var _=m.parent(k);return _===void 0||h.hasNode(_)?(y[k]=_,_):_ in y?y[_]:v(_)}return this._isCompound&&e.each(h.nodes(),function(k){h.setParent(k,v(k))}),h},i.prototype.setDefaultEdgeLabel=function(g){return e.isFunction(g)||(g=e.constant(g)),this._defaultEdgeLabelFn=g,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(g,h){var m=this,y=arguments;return e.reduce(g,function(v,k){return y.length>1?m.setEdge(v,k,h):m.setEdge(v,k),k}),this},i.prototype.setEdge=function(){var g,h,m,y,v=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(g=k.v,h=k.w,m=k.name,arguments.length===2&&(y=arguments[1],v=!0)):(g=k,h=arguments[1],m=arguments[3],arguments.length>2&&(y=arguments[2],v=!0)),g=""+g,h=""+h,e.isUndefined(m)||(m=""+m);var _=u(this._isDirected,g,h,m);if(e.has(this._edgeLabels,_))return v&&(this._edgeLabels[_]=y),this;if(!e.isUndefined(m)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(g),this.setNode(h),this._edgeLabels[_]=v?y:this._defaultEdgeLabelFn(g,h,m);var w=d(this._isDirected,g,h,m);return g=w.v,h=w.w,Object.freeze(w),this._edgeObjs[_]=w,o(this._preds[h],g),o(this._sucs[g],h),this._in[h][_]=w,this._out[g][_]=w,this._edgeCount++,this},i.prototype.edge=function(g,h,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,g,h,m);return this._edgeLabels[y]},i.prototype.hasEdge=function(g,h,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,g,h,m);return e.has(this._edgeLabels,y)},i.prototype.removeEdge=function(g,h,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,g,h,m),v=this._edgeObjs[y];return v&&(g=v.v,h=v.w,delete this._edgeLabels[y],delete this._edgeObjs[y],l(this._preds[h],g),l(this._sucs[g],h),delete this._in[h][y],delete this._out[g][y],this._edgeCount--),this},i.prototype.inEdges=function(g,h){var m=this._in[g];if(m){var y=e.values(m);return h?e.filter(y,function(v){return v.v===h}):y}},i.prototype.outEdges=function(g,h){var m=this._out[g];if(m){var y=e.values(m);return h?e.filter(y,function(v){return v.w===h}):y}},i.prototype.nodeEdges=function(g,h){var m=this.inEdges(g,h);if(m)return m.concat(this.outEdges(g,h))};function o(g,h){g[h]?g[h]++:g[h]=1}function l(g,h){--g[h]||delete g[h]}function u(g,h,m,y){var v=""+h,k=""+m;if(!g&&v>k){var _=v;v=k,k=_}return v+a+k+a+(e.isUndefined(y)?t:y)}function d(g,h,m,y){var v=""+h,k=""+m;if(!g&&v>k){var _=v;v=k,k=_}var w={v,w:k};return y&&(w.name=y),w}function f(g,h){return u(g,h.v,h.w,h.name)}return Tx}var Rx,WE;function IU(){return WE||(WE=1,Rx="2.1.8"),Rx}var Ax,VE;function MU(){return VE||(VE=1,Ax={Graph:mk(),version:IU()}),Ax}var Ix,GE;function LU(){if(GE)return Ix;GE=1;var e=ri(),t=mk();Ix={write:r,read:o};function r(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:a(l),edges:i(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function a(l){return e.map(l.nodes(),function(u){var d=l.node(u),f=l.parent(u),g={v:u};return e.isUndefined(d)||(g.value=d),e.isUndefined(f)||(g.parent=f),g})}function i(l){return e.map(l.edges(),function(u){var d=l.edge(u),f={v:u.v,w:u.w};return e.isUndefined(u.name)||(f.name=u.name),e.isUndefined(d)||(f.value=d),f})}function o(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(d){u.setNode(d.v,d.value),d.parent&&u.setParent(d.v,d.parent)}),e.each(l.edges,function(d){u.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),u}return Ix}var Mx,KE;function OU(){if(KE)return Mx;KE=1;var e=ri();Mx=t;function t(r){var a={},i=[],o;function l(u){e.has(a,u)||(a[u]=!0,o.push(u),e.each(r.successors(u),l),e.each(r.predecessors(u),l))}return e.each(r.nodes(),function(u){o=[],l(u),o.length&&i.push(o)}),i}return Mx}var Lx,YE;function KR(){if(YE)return Lx;YE=1;var e=ri();Lx=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var a=this._keyIndices[r];if(a!==void 0)return this._arr[a].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,a){var i=this._keyIndices;if(r=String(r),!e.has(i,r)){var o=this._arr,l=o.length;return i[r]=l,o.push({key:r,priority:a}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,a){var i=this._keyIndices[r];if(a>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+a);this._arr[i].priority=a,this._decrease(i)},t.prototype._heapify=function(r){var a=this._arr,i=2*r,o=i+1,l=r;i<a.length&&(l=a[i].priority<a[l].priority?i:l,o<a.length&&(l=a[o].priority<a[l].priority?o:l),l!==r&&(this._swap(r,l),this._heapify(l)))},t.prototype._decrease=function(r){for(var a=this._arr,i=a[r].priority,o;r!==0&&(o=r>>1,!(a[o].priority<i));)this._swap(r,o),r=o},t.prototype._swap=function(r,a){var i=this._arr,o=this._keyIndices,l=i[r],u=i[a];i[r]=u,i[a]=l,o[u.key]=r,o[l.key]=a},Lx}var Ox,XE;function YR(){if(XE)return Ox;XE=1;var e=ri(),t=KR();Ox=a;var r=e.constant(1);function a(o,l,u,d){return i(o,String(l),u||r,d||function(f){return o.outEdges(f)})}function i(o,l,u,d){var f={},g=new t,h,m,y=function(v){var k=v.v!==h?v.v:v.w,_=f[k],w=u(v),S=m.distance+w;if(w<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+w);S<_.distance&&(_.distance=S,_.predecessor=h,g.decrease(k,S))};for(o.nodes().forEach(function(v){var k=v===l?0:Number.POSITIVE_INFINITY;f[v]={distance:k},g.add(v,k)});g.size()>0&&(h=g.removeMin(),m=f[h],m.distance!==Number.POSITIVE_INFINITY);)d(h).forEach(y);return f}return Ox}var Dx,QE;function DU(){if(QE)return Dx;QE=1;var e=YR(),t=ri();Dx=r;function r(a,i,o){return t.transform(a.nodes(),function(l,u){l[u]=e(a,u,i,o)},{})}return Dx}var Px,ZE;function XR(){if(ZE)return Px;ZE=1;var e=ri();Px=t;function t(r){var a=0,i=[],o={},l=[];function u(d){var f=o[d]={onStack:!0,lowlink:a,index:a++};if(i.push(d),r.successors(d).forEach(function(m){e.has(o,m)?o[m].onStack&&(f.lowlink=Math.min(f.lowlink,o[m].index)):(u(m),f.lowlink=Math.min(f.lowlink,o[m].lowlink))}),f.lowlink===f.index){var g=[],h;do h=i.pop(),o[h].onStack=!1,g.push(h);while(d!==h);l.push(g)}}return r.nodes().forEach(function(d){e.has(o,d)||u(d)}),l}return Px}var Fx,JE;function PU(){if(JE)return Fx;JE=1;var e=ri(),t=XR();Fx=r;function r(a){return e.filter(t(a),function(i){return i.length>1||i.length===1&&a.hasEdge(i[0],i[0])})}return Fx}var Bx,ej;function FU(){if(ej)return Bx;ej=1;var e=ri();Bx=r;var t=e.constant(1);function r(i,o,l){return a(i,o||t,l||function(u){return i.outEdges(u)})}function a(i,o,l){var u={},d=i.nodes();return d.forEach(function(f){u[f]={},u[f][f]={distance:0},d.forEach(function(g){f!==g&&(u[f][g]={distance:Number.POSITIVE_INFINITY})}),l(f).forEach(function(g){var h=g.v===f?g.w:g.v,m=o(g);u[f][h]={distance:m,predecessor:f}})}),d.forEach(function(f){var g=u[f];d.forEach(function(h){var m=u[h];d.forEach(function(y){var v=m[f],k=g[y],_=m[y],w=v.distance+k.distance;w<_.distance&&(_.distance=w,_.predecessor=k.predecessor)})})}),u}return Bx}var zx,tj;function QR(){if(tj)return zx;tj=1;var e=ri();zx=t,t.CycleException=r;function t(a){var i={},o={},l=[];function u(d){if(e.has(o,d))throw new r;e.has(i,d)||(o[d]=!0,i[d]=!0,e.each(a.predecessors(d),u),delete o[d],l.push(d))}if(e.each(a.sinks(),u),e.size(i)!==a.nodeCount())throw new r;return l}function r(){}return r.prototype=new Error,zx}var Ux,rj;function BU(){if(rj)return Ux;rj=1;var e=QR();Ux=t;function t(r){try{e(r)}catch(a){if(a instanceof e.CycleException)return!1;throw a}return!0}return Ux}var qx,nj;function ZR(){if(nj)return qx;nj=1;var e=ri();qx=t;function t(a,i,o){e.isArray(i)||(i=[i]);var l=(a.isDirected()?a.successors:a.neighbors).bind(a),u=[],d={};return e.each(i,function(f){if(!a.hasNode(f))throw new Error("Graph does not have node: "+f);r(a,f,o==="post",d,l,u)}),u}function r(a,i,o,l,u,d){e.has(l,i)||(l[i]=!0,o||d.push(i),e.each(u(i),function(f){r(a,f,o,l,u,d)}),o&&d.push(i))}return qx}var Hx,aj;function zU(){if(aj)return Hx;aj=1;var e=ZR();Hx=t;function t(r,a){return e(r,a,"post")}return Hx}var $x,ij;function UU(){if(ij)return $x;ij=1;var e=ZR();$x=t;function t(r,a){return e(r,a,"pre")}return $x}var Wx,sj;function qU(){if(sj)return Wx;sj=1;var e=ri(),t=mk(),r=KR();Wx=a;function a(i,o){var l=new t,u={},d=new r,f;function g(m){var y=m.v===f?m.w:m.v,v=d.priority(y);if(v!==void 0){var k=o(m);k<v&&(u[y]=f,d.decrease(y,k))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(m){d.add(m,Number.POSITIVE_INFINITY),l.setNode(m)}),d.decrease(i.nodes()[0],0);for(var h=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(f).forEach(g)}return l}return Wx}var Vx,oj;function HU(){return oj||(oj=1,Vx={components:OU(),dijkstra:YR(),dijkstraAll:DU(),findCycles:PU(),floydWarshall:FU(),isAcyclic:BU(),postorder:zU(),preorder:UU(),prim:qU(),tarjan:XR(),topsort:QR()}),Vx}var Gx,lj;function $U(){if(lj)return Gx;lj=1;var e=MU();return Gx={Graph:e.Graph,json:LU(),alg:HU(),version:e.version},Gx}var Kx,cj;function Ni(){if(cj)return Kx;cj=1;var e;if(typeof ek=="function")try{e=$U()}catch{}return e||(e=window.graphlib),Kx=e,Kx}var Yx,uj;function WU(){if(uj)return Yx;uj=1;var e=wR(),t=1,r=4;function a(i){return e(i,t|r)}return Yx=a,Yx}var Xx,dj;function Xf(){if(dj)return Xx;dj=1;var e=Ll(),t=gs(),r=Uf(),a=ti();function i(o,l,u){if(!a(u))return!1;var d=typeof l;return(d=="number"?t(u)&&r(l,u.length):d=="string"&&l in u)?e(u[l],o):!1}return Xx=i,Xx}var Qx,fj;function VU(){if(fj)return Qx;fj=1;var e=Yf(),t=Ll(),r=Xf(),a=Lo(),i=Object.prototype,o=i.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,g=d.length,h=g>2?d[2]:void 0;for(h&&r(d[0],d[1],h)&&(g=1);++f<g;)for(var m=d[f],y=a(m),v=-1,k=y.length;++v<k;){var _=y[v],w=u[_];(w===void 0||t(w,i[_])&&!o.call(u,_))&&(u[_]=m[_])}return u});return Qx=l,Qx}var Zx,gj;function GU(){if(gj)return Zx;gj=1;var e=ps(),t=gs(),r=Vs();function a(i){return function(o,l,u){var d=Object(o);if(!t(o)){var f=e(l,3);o=r(o),l=function(h){return f(d[h],h,d)}}var g=i(o,l,u);return g>-1?d[f?o[g]:g]:void 0}}return Zx=a,Zx}var Jx,pj;function KU(){if(pj)return Jx;pj=1;var e=/\s/;function t(r){for(var a=r.length;a--&&e.test(r.charAt(a)););return a}return Jx=t,Jx}var ey,hj;function YU(){if(hj)return ey;hj=1;var e=KU(),t=/^\s+/;function r(a){return a&&a.slice(0,e(a)+1).replace(t,"")}return ey=r,ey}var ty,mj;function XU(){if(mj)return ty;mj=1;var e=YU(),t=ti(),r=Fl(),a=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(r(f))return a;if(t(f)){var g=typeof f.valueOf=="function"?f.valueOf():f;f=t(g)?g+"":g}if(typeof f!="string")return f===0?f:+f;f=e(f);var h=o.test(f);return h||l.test(f)?u(f.slice(2),h?2:8):i.test(f)?a:+f}return ty=d,ty}var ry,xj;function JR(){if(xj)return ry;xj=1;var e=XU(),t=1/0,r=17976931348623157e292;function a(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var o=i<0?-1:1;return o*r}return i===i?i:0}return ry=a,ry}var ny,yj;function QU(){if(yj)return ny;yj=1;var e=JR();function t(r){var a=e(r),i=a%1;return a===a?i?a-i:a:0}return ny=t,ny}var ay,bj;function ZU(){if(bj)return ay;bj=1;var e=WR(),t=ps(),r=QU(),a=Math.max;function i(o,l,u){var d=o==null?0:o.length;if(!d)return-1;var f=u==null?0:r(u);return f<0&&(f=a(d+f,0)),e(o,t(l,3),f)}return ay=i,ay}var iy,vj;function JU(){if(vj)return iy;vj=1;var e=GU(),t=ZU(),r=e(t);return iy=r,iy}var sy,kj;function eA(){if(kj)return sy;kj=1;var e=hk();function t(r){var a=r==null?0:r.length;return a?e(r,1):[]}return sy=t,sy}var oy,_j;function eq(){if(_j)return oy;_j=1;var e=dk(),t=NR(),r=Lo();function a(i,o){return i==null?i:e(i,t(o),r)}return oy=a,oy}var ly,wj;function tq(){if(wj)return ly;wj=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return ly=e,ly}var cy,Nj;function rq(){if(Nj)return cy;Nj=1;var e=Bf(),t=fk(),r=ps();function a(i,o){var l={};return o=r(o,3),t(i,function(u,d,f){e(l,d,o(u,d,f))}),l}return cy=a,cy}var uy,Sj;function xk(){if(Sj)return uy;Sj=1;var e=Fl();function t(r,a,i){for(var o=-1,l=r.length;++o<l;){var u=r[o],d=a(u);if(d!=null&&(f===void 0?d===d&&!e(d):i(d,f)))var f=d,g=u}return g}return uy=t,uy}var dy,Ej;function nq(){if(Ej)return dy;Ej=1;function e(t,r){return t>r}return dy=e,dy}var fy,jj;function aq(){if(jj)return fy;jj=1;var e=xk(),t=nq(),r=Oo();function a(i){return i&&i.length?e(i,r,t):void 0}return fy=a,fy}var gy,Cj;function tA(){if(Cj)return gy;Cj=1;var e=Bf(),t=Ll();function r(a,i,o){(o!==void 0&&!t(a[i],o)||o===void 0&&!(i in a))&&e(a,i,o)}return gy=r,gy}var py,Tj;function iq(){if(Tj)return py;Tj=1;var e=Io(),t=$f(),r=Ki(),a="[object Object]",i=Function.prototype,o=Object.prototype,l=i.toString,u=o.hasOwnProperty,d=l.call(Object);function f(g){if(!r(g)||e(g)!=a)return!1;var h=t(g);if(h===null)return!0;var m=u.call(h,"constructor")&&h.constructor;return typeof m=="function"&&m instanceof m&&l.call(m)==d}return py=f,py}var hy,Rj;function rA(){if(Rj)return hy;Rj=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return hy=e,hy}var my,Aj;function sq(){if(Aj)return my;Aj=1;var e=du(),t=Lo();function r(a){return e(a,t(a))}return my=r,my}var xy,Ij;function oq(){if(Ij)return xy;Ij=1;var e=tA(),t=dR(),r=vR(),a=fR(),i=_R(),o=fu(),l=yn(),u=VR(),d=Dl(),f=uu(),g=ti(),h=iq(),m=gu(),y=rA(),v=sq();function k(_,w,S,E,A,T,C){var j=y(_,S),L=y(w,S),O=C.get(L);if(O){e(_,S,O);return}var I=T?T(j,L,S+"",_,w,C):void 0,B=I===void 0;if(B){var z=l(L),ee=!z&&d(L),$=!z&&!ee&&m(L);I=L,z||ee||$?l(j)?I=j:u(j)?I=a(j):ee?(B=!1,I=t(L,!0)):$?(B=!1,I=r(L,!0)):I=[]:h(L)||o(L)?(I=j,o(j)?I=v(j):(!g(j)||f(j))&&(I=i(L))):B=!1}B&&(C.set(L,I),A(I,L,E,T,C),C.delete(L)),e(_,S,I)}return xy=k,xy}var yy,Mj;function lq(){if(Mj)return yy;Mj=1;var e=Ff(),t=tA(),r=dk(),a=oq(),i=ti(),o=Lo(),l=rA();function u(d,f,g,h,m){d!==f&&r(f,function(y,v){if(m||(m=new e),i(y))a(d,f,v,g,u,h,m);else{var k=h?h(l(d,v),y,v+"",d,f,m):void 0;k===void 0&&(k=y),t(d,v,k)}},o)}return yy=u,yy}var by,Lj;function cq(){if(Lj)return by;Lj=1;var e=Yf(),t=Xf();function r(a){return e(function(i,o){var l=-1,u=o.length,d=u>1?o[u-1]:void 0,f=u>2?o[2]:void 0;for(d=a.length>3&&typeof d=="function"?(u--,d):void 0,f&&t(o[0],o[1],f)&&(d=u<3?void 0:d,u=1),i=Object(i);++l<u;){var g=o[l];g&&a(i,g,l,d)}return i})}return by=r,by}var vy,Oj;function uq(){if(Oj)return vy;Oj=1;var e=lq(),t=cq(),r=t(function(a,i,o){e(a,i,o)});return vy=r,vy}var ky,Dj;function nA(){if(Dj)return ky;Dj=1;function e(t,r){return t<r}return ky=e,ky}var _y,Pj;function dq(){if(Pj)return _y;Pj=1;var e=xk(),t=nA(),r=Oo();function a(i){return i&&i.length?e(i,r,t):void 0}return _y=a,_y}var wy,Fj;function fq(){if(Fj)return wy;Fj=1;var e=xk(),t=ps(),r=nA();function a(i,o){return i&&i.length?e(i,t(o,2),r):void 0}return wy=a,wy}var Ny,Bj;function gq(){if(Bj)return Ny;Bj=1;var e=Si(),t=function(){return e.Date.now()};return Ny=t,Ny}var Sy,zj;function pq(){if(zj)return Sy;zj=1;var e=zf(),t=Gf(),r=Uf(),a=ti(),i=pu();function o(l,u,d,f){if(!a(l))return l;u=t(u,l);for(var g=-1,h=u.length,m=h-1,y=l;y!=null&&++g<h;){var v=i(u[g]),k=d;if(v==="__proto__"||v==="constructor"||v==="prototype")return l;if(g!=m){var _=y[v];k=f?f(_,v,y):void 0,k===void 0&&(k=a(_)?_:r(u[g+1])?[]:{})}e(y,v,k),y=y[v]}return l}return Sy=o,Sy}var Ey,Uj;function hq(){if(Uj)return Ey;Uj=1;var e=Kf(),t=pq(),r=Gf();function a(i,o,l){for(var u=-1,d=o.length,f={};++u<d;){var g=o[u],h=e(i,g);l(h,g)&&t(f,r(g,i),h)}return f}return Ey=a,Ey}var jy,qj;function mq(){if(qj)return jy;qj=1;var e=hq(),t=OR();function r(a,i){return e(a,i,function(o,l){return t(a,l)})}return jy=r,jy}var Cy,Hj;function xq(){if(Hj)return Cy;Hj=1;var e=eA(),t=HR(),r=$R();function a(i){return r(t(i,void 0,e),i+"")}return Cy=a,Cy}var Ty,$j;function yq(){if($j)return Ty;$j=1;var e=mq(),t=xq(),r=t(function(a,i){return a==null?{}:e(a,i)});return Ty=r,Ty}var Ry,Wj;function bq(){if(Wj)return Ry;Wj=1;var e=Math.ceil,t=Math.max;function r(a,i,o,l){for(var u=-1,d=t(e((i-a)/(o||1)),0),f=Array(d);d--;)f[l?d:++u]=a,a+=o;return f}return Ry=r,Ry}var Ay,Vj;function vq(){if(Vj)return Ay;Vj=1;var e=bq(),t=Xf(),r=JR();function a(i){return function(o,l,u){return u&&typeof u!="number"&&t(o,l,u)&&(l=u=void 0),o=r(o),l===void 0?(l=o,o=0):l=r(l),u=u===void 0?o<l?1:-1:r(u),e(o,l,u,i)}}return Ay=a,Ay}var Iy,Gj;function kq(){if(Gj)return Iy;Gj=1;var e=vq(),t=e();return Iy=t,Iy}var My,Kj;function _q(){if(Kj)return My;Kj=1;function e(t,r){var a=t.length;for(t.sort(r);a--;)t[a]=t[a].value;return t}return My=e,My}var Ly,Yj;function wq(){if(Yj)return Ly;Yj=1;var e=Fl();function t(r,a){if(r!==a){var i=r!==void 0,o=r===null,l=r===r,u=e(r),d=a!==void 0,f=a===null,g=a===a,h=e(a);if(!f&&!h&&!u&&r>a||u&&d&&g&&!f&&!h||o&&d&&g||!i&&g||!l)return 1;if(!o&&!u&&!h&&r<a||h&&i&&l&&!o&&!u||f&&i&&l||!d&&l||!g)return-1}return 0}return Ly=t,Ly}var Oy,Xj;function Nq(){if(Xj)return Oy;Xj=1;var e=wq();function t(r,a,i){for(var o=-1,l=r.criteria,u=a.criteria,d=l.length,f=i.length;++o<d;){var g=e(l[o],u[o]);if(g){if(o>=f)return g;var h=i[o];return g*(h=="desc"?-1:1)}}return r.index-a.index}return Oy=t,Oy}var Dy,Qj;function Sq(){if(Qj)return Dy;Qj=1;var e=Vf(),t=Kf(),r=ps(),a=zR(),i=_q(),o=qf(),l=Nq(),u=Oo(),d=yn();function f(g,h,m){h.length?h=e(h,function(k){return d(k)?function(_){return t(_,k.length===1?k[0]:k)}:k}):h=[u];var y=-1;h=e(h,o(r));var v=a(g,function(k,_,w){var S=e(h,function(E){return E(k)});return{criteria:S,index:++y,value:k}});return i(v,function(k,_){return l(k,_,m)})}return Dy=f,Dy}var Py,Zj;function Eq(){if(Zj)return Py;Zj=1;var e=hk(),t=Sq(),r=Yf(),a=Xf(),i=r(function(o,l){if(o==null)return[];var u=l.length;return u>1&&a(o,l[0],l[1])?l=[]:u>2&&a(l[0],l[1],l[2])&&(l=[l[0]]),t(o,e(l,1),[])});return Py=i,Py}var Fy,Jj;function jq(){if(Jj)return Fy;Jj=1;var e=MR(),t=0;function r(a){var i=++t;return e(a)+i}return Fy=r,Fy}var By,eC;function Cq(){if(eC)return By;eC=1;function e(t,r,a){for(var i=-1,o=t.length,l=r.length,u={};++i<o;){var d=i<l?r[i]:void 0;a(u,t[i],d)}return u}return By=e,By}var zy,tC;function Tq(){if(tC)return zy;tC=1;var e=zf(),t=Cq();function r(a,i){return t(a||[],i||[],e)}return zy=r,zy}var Uy,rC;function Zr(){if(rC)return Uy;rC=1;var e;if(typeof ek=="function")try{e={cloneDeep:WU(),constant:uk(),defaults:VU(),each:ER(),filter:PR(),find:JU(),flatten:eA(),forEach:SR(),forIn:eq(),has:FR(),isUndefined:BR(),last:tq(),map:UR(),mapValues:rq(),max:aq(),merge:uq(),min:dq(),minBy:fq(),now:gq(),pick:yq(),range:kq(),reduce:qR(),sortBy:Eq(),uniqueId:jq(),values:GR(),zipObject:Tq()}}catch{}return e||(e=window._),Uy=e,Uy}var qy,nC;function Rq(){if(nC)return qy;nC=1,qy=e;function e(){var a={};a._next=a._prev=a,this._sentinel=a}e.prototype.dequeue=function(){var a=this._sentinel,i=a._prev;if(i!==a)return t(i),i},e.prototype.enqueue=function(a){var i=this._sentinel;a._prev&&a._next&&t(a),a._next=i._next,i._next._prev=a,i._next=a,a._prev=i},e.prototype.toString=function(){for(var a=[],i=this._sentinel,o=i._prev;o!==i;)a.push(JSON.stringify(o,r)),o=o._prev;return"["+a.join(", ")+"]"};function t(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function r(a,i){if(a!=="_next"&&a!=="_prev")return i}return qy}var Hy,aC;function Aq(){if(aC)return Hy;aC=1;var e=Zr(),t=Ni().Graph,r=Rq();Hy=i;var a=e.constant(1);function i(f,g){if(f.nodeCount()<=1)return[];var h=u(f,g||a),m=o(h.graph,h.buckets,h.zeroIdx);return e.flatten(e.map(m,function(y){return f.outEdges(y.v,y.w)}),!0)}function o(f,g,h){for(var m=[],y=g[g.length-1],v=g[0],k;f.nodeCount();){for(;k=v.dequeue();)l(f,g,h,k);for(;k=y.dequeue();)l(f,g,h,k);if(f.nodeCount()){for(var _=g.length-2;_>0;--_)if(k=g[_].dequeue(),k){m=m.concat(l(f,g,h,k,!0));break}}}return m}function l(f,g,h,m,y){var v=y?[]:void 0;return e.forEach(f.inEdges(m.v),function(k){var _=f.edge(k),w=f.node(k.v);y&&v.push({v:k.v,w:k.w}),w.out-=_,d(g,h,w)}),e.forEach(f.outEdges(m.v),function(k){var _=f.edge(k),w=k.w,S=f.node(w);S.in-=_,d(g,h,S)}),f.removeNode(m.v),v}function u(f,g){var h=new t,m=0,y=0;e.forEach(f.nodes(),function(_){h.setNode(_,{v:_,in:0,out:0})}),e.forEach(f.edges(),function(_){var w=h.edge(_.v,_.w)||0,S=g(_),E=w+S;h.setEdge(_.v,_.w,E),y=Math.max(y,h.node(_.v).out+=S),m=Math.max(m,h.node(_.w).in+=S)});var v=e.range(y+m+3).map(function(){return new r}),k=m+1;return e.forEach(h.nodes(),function(_){d(v,k,h.node(_))}),{graph:h,buckets:v,zeroIdx:k}}function d(f,g,h){h.out?h.in?f[h.out-h.in+g].enqueue(h):f[f.length-1].enqueue(h):f[0].enqueue(h)}return Hy}var $y,iC;function Iq(){if(iC)return $y;iC=1;var e=Zr(),t=Aq();$y={run:r,undo:i};function r(o){var l=o.graph().acyclicer==="greedy"?t(o,u(o)):a(o);e.forEach(l,function(d){var f=o.edge(d);o.removeEdge(d),f.forwardName=d.name,f.reversed=!0,o.setEdge(d.w,d.v,f,e.uniqueId("rev"))});function u(d){return function(f){return d.edge(f).weight}}}function a(o){var l=[],u={},d={};function f(g){e.has(d,g)||(d[g]=!0,u[g]=!0,e.forEach(o.outEdges(g),function(h){e.has(u,h.w)?l.push(h):f(h.w)}),delete u[g])}return e.forEach(o.nodes(),f),l}function i(o){e.forEach(o.edges(),function(l){var u=o.edge(l);if(u.reversed){o.removeEdge(l);var d=u.forwardName;delete u.reversed,delete u.forwardName,o.setEdge(l.w,l.v,u,d)}})}return $y}var Wy,sC;function ka(){if(sC)return Wy;sC=1;var e=Zr(),t=Ni().Graph;Wy={addDummyNode:r,simplify:a,asNonCompoundGraph:i,successorWeights:o,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:g,addBorderNode:h,maxRank:m,partition:y,time:v,notime:k};function r(_,w,S,E){var A;do A=e.uniqueId(E);while(_.hasNode(A));return S.dummy=w,_.setNode(A,S),A}function a(_){var w=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(S){w.setNode(S,_.node(S))}),e.forEach(_.edges(),function(S){var E=w.edge(S.v,S.w)||{weight:0,minlen:1},A=_.edge(S);w.setEdge(S.v,S.w,{weight:E.weight+A.weight,minlen:Math.max(E.minlen,A.minlen)})}),w}function i(_){var w=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(S){_.children(S).length||w.setNode(S,_.node(S))}),e.forEach(_.edges(),function(S){w.setEdge(S,_.edge(S))}),w}function o(_){var w=e.map(_.nodes(),function(S){var E={};return e.forEach(_.outEdges(S),function(A){E[A.w]=(E[A.w]||0)+_.edge(A).weight}),E});return e.zipObject(_.nodes(),w)}function l(_){var w=e.map(_.nodes(),function(S){var E={};return e.forEach(_.inEdges(S),function(A){E[A.v]=(E[A.v]||0)+_.edge(A).weight}),E});return e.zipObject(_.nodes(),w)}function u(_,w){var S=_.x,E=_.y,A=w.x-S,T=w.y-E,C=_.width/2,j=_.height/2;if(!A&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var L,O;return Math.abs(T)*C>Math.abs(A)*j?(T<0&&(j=-j),L=j*A/T,O=j):(A<0&&(C=-C),L=C,O=C*T/A),{x:S+L,y:E+O}}function d(_){var w=e.map(e.range(m(_)+1),function(){return[]});return e.forEach(_.nodes(),function(S){var E=_.node(S),A=E.rank;e.isUndefined(A)||(w[A][E.order]=S)}),w}function f(_){var w=e.min(e.map(_.nodes(),function(S){return _.node(S).rank}));e.forEach(_.nodes(),function(S){var E=_.node(S);e.has(E,"rank")&&(E.rank-=w)})}function g(_){var w=e.min(e.map(_.nodes(),function(T){return _.node(T).rank})),S=[];e.forEach(_.nodes(),function(T){var C=_.node(T).rank-w;S[C]||(S[C]=[]),S[C].push(T)});var E=0,A=_.graph().nodeRankFactor;e.forEach(S,function(T,C){e.isUndefined(T)&&C%A!==0?--E:E&&e.forEach(T,function(j){_.node(j).rank+=E})})}function h(_,w,S,E){var A={width:0,height:0};return arguments.length>=4&&(A.rank=S,A.order=E),r(_,"border",A,w)}function m(_){return e.max(e.map(_.nodes(),function(w){var S=_.node(w).rank;if(!e.isUndefined(S))return S}))}function y(_,w){var S={lhs:[],rhs:[]};return e.forEach(_,function(E){w(E)?S.lhs.push(E):S.rhs.push(E)}),S}function v(_,w){var S=e.now();try{return w()}finally{console.log(_+" time: "+(e.now()-S)+"ms")}}function k(_,w){return w()}return Wy}var Vy,oC;function Mq(){if(oC)return Vy;oC=1;var e=Zr(),t=ka();Vy={run:r,undo:i};function r(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(l){a(o,l)})}function a(o,l){var u=l.v,d=o.node(u).rank,f=l.w,g=o.node(f).rank,h=l.name,m=o.edge(l),y=m.labelRank;if(g!==d+1){o.removeEdge(l);var v,k,_;for(_=0,++d;d<g;++_,++d)m.points=[],k={width:0,height:0,edgeLabel:m,edgeObj:l,rank:d},v=t.addDummyNode(o,"edge",k,"_d"),d===y&&(k.width=m.width,k.height=m.height,k.dummy="edge-label",k.labelpos=m.labelpos),o.setEdge(u,v,{weight:m.weight},h),_===0&&o.graph().dummyChains.push(v),u=v;o.setEdge(u,f,{weight:m.weight},h)}}function i(o){e.forEach(o.graph().dummyChains,function(l){var u=o.node(l),d=u.edgeLabel,f;for(o.setEdge(u.edgeObj,d);u.dummy;)f=o.successors(l)[0],o.removeNode(l),d.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(d.x=u.x,d.y=u.y,d.width=u.width,d.height=u.height),l=f,u=o.node(l)})}return Vy}var Gy,lC;function xf(){if(lC)return Gy;lC=1;var e=Zr();Gy={longestPath:t,slack:r};function t(a){var i={};function o(l){var u=a.node(l);if(e.has(i,l))return u.rank;i[l]=!0;var d=e.min(e.map(a.outEdges(l),function(f){return o(f.w)-a.edge(f).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(a.sources(),o)}function r(a,i){return a.node(i.w).rank-a.node(i.v).rank-a.edge(i).minlen}return Gy}var Ky,cC;function aA(){if(cC)return Ky;cC=1;var e=Zr(),t=Ni().Graph,r=xf().slack;Ky=a;function a(u){var d=new t({directed:!1}),f=u.nodes()[0],g=u.nodeCount();d.setNode(f,{});for(var h,m;i(d,u)<g;)h=o(d,u),m=d.hasNode(h.v)?r(u,h):-r(u,h),l(d,u,m);return d}function i(u,d){function f(g){e.forEach(d.nodeEdges(g),function(h){var m=h.v,y=g===m?h.w:m;!u.hasNode(y)&&!r(d,h)&&(u.setNode(y,{}),u.setEdge(g,y,{}),f(y))})}return e.forEach(u.nodes(),f),u.nodeCount()}function o(u,d){return e.minBy(d.edges(),function(f){if(u.hasNode(f.v)!==u.hasNode(f.w))return r(d,f)})}function l(u,d,f){e.forEach(u.nodes(),function(g){d.node(g).rank+=f})}return Ky}var Yy,uC;function Lq(){if(uC)return Yy;uC=1;var e=Zr(),t=aA(),r=xf().slack,a=xf().longestPath,i=Ni().alg.preorder,o=Ni().alg.postorder,l=ka().simplify;Yy=u,u.initLowLimValues=h,u.initCutValues=d,u.calcCutValue=g,u.leaveEdge=y,u.enterEdge=v,u.exchangeEdges=k;function u(E){E=l(E),a(E);var A=t(E);h(A),d(A,E);for(var T,C;T=y(A);)C=v(A,E,T),k(A,E,T,C)}function d(E,A){var T=o(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(C){f(E,A,C)})}function f(E,A,T){var C=E.node(T),j=C.parent;E.edge(T,j).cutvalue=g(E,A,T)}function g(E,A,T){var C=E.node(T),j=C.parent,L=!0,O=A.edge(T,j),I=0;return O||(L=!1,O=A.edge(j,T)),I=O.weight,e.forEach(A.nodeEdges(T),function(B){var z=B.v===T,ee=z?B.w:B.v;if(ee!==j){var $=z===L,M=A.edge(B).weight;if(I+=$?M:-M,w(E,T,ee)){var G=E.edge(T,ee).cutvalue;I+=$?-G:G}}}),I}function h(E,A){arguments.length<2&&(A=E.nodes()[0]),m(E,{},1,A)}function m(E,A,T,C,j){var L=T,O=E.node(C);return A[C]=!0,e.forEach(E.neighbors(C),function(I){e.has(A,I)||(T=m(E,A,T,I,C))}),O.low=L,O.lim=T++,j?O.parent=j:delete O.parent,T}function y(E){return e.find(E.edges(),function(A){return E.edge(A).cutvalue<0})}function v(E,A,T){var C=T.v,j=T.w;A.hasEdge(C,j)||(C=T.w,j=T.v);var L=E.node(C),O=E.node(j),I=L,B=!1;L.lim>O.lim&&(I=O,B=!0);var z=e.filter(A.edges(),function(ee){return B===S(E,E.node(ee.v),I)&&B!==S(E,E.node(ee.w),I)});return e.minBy(z,function(ee){return r(A,ee)})}function k(E,A,T,C){var j=T.v,L=T.w;E.removeEdge(j,L),E.setEdge(C.v,C.w,{}),h(E),d(E,A),_(E,A)}function _(E,A){var T=e.find(E.nodes(),function(j){return!A.node(j).parent}),C=i(E,T);C=C.slice(1),e.forEach(C,function(j){var L=E.node(j).parent,O=A.edge(j,L),I=!1;O||(O=A.edge(L,j),I=!0),A.node(j).rank=A.node(L).rank+(I?O.minlen:-O.minlen)})}function w(E,A,T){return E.hasEdge(A,T)}function S(E,A,T){return T.low<=A.lim&&A.lim<=T.lim}return Yy}var Xy,dC;function Oq(){if(dC)return Xy;dC=1;var e=xf(),t=e.longestPath,r=aA(),a=Lq();Xy=i;function i(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":o(d);break;default:u(d)}}var o=t;function l(d){t(d),r(d)}function u(d){a(d)}return Xy}var Qy,fC;function Dq(){if(fC)return Qy;fC=1;var e=Zr();Qy=t;function t(i){var o=a(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),d=u.edgeObj,f=r(i,o,d.v,d.w),g=f.path,h=f.lca,m=0,y=g[m],v=!0;l!==d.w;){if(u=i.node(l),v){for(;(y=g[m])!==h&&i.node(y).maxRank<u.rank;)m++;y===h&&(v=!1)}if(!v){for(;m<g.length-1&&i.node(y=g[m+1]).minRank<=u.rank;)m++;y=g[m]}i.setParent(l,y),l=i.successors(l)[0]}})}function r(i,o,l,u){var d=[],f=[],g=Math.min(o[l].low,o[u].low),h=Math.max(o[l].lim,o[u].lim),m,y;m=l;do m=i.parent(m),d.push(m);while(m&&(o[m].low>g||h>o[m].lim));for(y=m,m=u;(m=i.parent(m))!==y;)f.push(m);return{path:d.concat(f.reverse()),lca:y}}function a(i){var o={},l=0;function u(d){var f=l;e.forEach(i.children(d),u),o[d]={low:f,lim:l++}}return e.forEach(i.children(),u),o}return Qy}var Zy,gC;function Pq(){if(gC)return Zy;gC=1;var e=Zr(),t=ka();Zy={run:r,cleanup:l};function r(u){var d=t.addDummyNode(u,"root",{},"_root"),f=i(u),g=e.max(e.values(f))-1,h=2*g+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(y){u.edge(y).minlen*=h});var m=o(u)+1;e.forEach(u.children(),function(y){a(u,d,h,m,g,f,y)}),u.graph().nodeRankFactor=h}function a(u,d,f,g,h,m,y){var v=u.children(y);if(!v.length){y!==d&&u.setEdge(d,y,{weight:0,minlen:f});return}var k=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),w=u.node(y);u.setParent(k,y),w.borderTop=k,u.setParent(_,y),w.borderBottom=_,e.forEach(v,function(S){a(u,d,f,g,h,m,S);var E=u.node(S),A=E.borderTop?E.borderTop:S,T=E.borderBottom?E.borderBottom:S,C=E.borderTop?g:2*g,j=A!==T?1:h-m[y]+1;u.setEdge(k,A,{weight:C,minlen:j,nestingEdge:!0}),u.setEdge(T,_,{weight:C,minlen:j,nestingEdge:!0})}),u.parent(y)||u.setEdge(d,k,{weight:0,minlen:h+m[y]})}function i(u){var d={};function f(g,h){var m=u.children(g);m&&m.length&&e.forEach(m,function(y){f(y,h+1)}),d[g]=h}return e.forEach(u.children(),function(g){f(g,1)}),d}function o(u){return e.reduce(u.edges(),function(d,f){return d+u.edge(f).weight},0)}function l(u){var d=u.graph();u.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(u.edges(),function(f){var g=u.edge(f);g.nestingEdge&&u.removeEdge(f)})}return Zy}var Jy,pC;function Fq(){if(pC)return Jy;pC=1;var e=Zr(),t=ka();Jy=r;function r(i){function o(l){var u=i.children(l),d=i.node(l);if(u.length&&e.forEach(u,o),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,g=d.maxRank+1;f<g;++f)a(i,"borderLeft","_bl",l,d,f),a(i,"borderRight","_br",l,d,f)}}e.forEach(i.children(),o)}function a(i,o,l,u,d,f){var g={width:0,height:0,rank:f,borderType:o},h=d[o][f-1],m=t.addDummyNode(i,"border",g,l);d[o][f]=m,i.setParent(m,u),h&&i.setEdge(h,m,{weight:1})}return Jy}var eb,hC;function Bq(){if(hC)return eb;hC=1;var e=Zr();eb={adjust:t,undo:r};function t(f){var g=f.graph().rankdir.toLowerCase();(g==="lr"||g==="rl")&&a(f)}function r(f){var g=f.graph().rankdir.toLowerCase();(g==="bt"||g==="rl")&&o(f),(g==="lr"||g==="rl")&&(u(f),a(f))}function a(f){e.forEach(f.nodes(),function(g){i(f.node(g))}),e.forEach(f.edges(),function(g){i(f.edge(g))})}function i(f){var g=f.width;f.width=f.height,f.height=g}function o(f){e.forEach(f.nodes(),function(g){l(f.node(g))}),e.forEach(f.edges(),function(g){var h=f.edge(g);e.forEach(h.points,l),e.has(h,"y")&&l(h)})}function l(f){f.y=-f.y}function u(f){e.forEach(f.nodes(),function(g){d(f.node(g))}),e.forEach(f.edges(),function(g){var h=f.edge(g);e.forEach(h.points,d),e.has(h,"x")&&d(h)})}function d(f){var g=f.x;f.x=f.y,f.y=g}return eb}var tb,mC;function zq(){if(mC)return tb;mC=1;var e=Zr();tb=t;function t(r){var a={},i=e.filter(r.nodes(),function(f){return!r.children(f).length}),o=e.max(e.map(i,function(f){return r.node(f).rank})),l=e.map(e.range(o+1),function(){return[]});function u(f){if(!e.has(a,f)){a[f]=!0;var g=r.node(f);l[g.rank].push(f),e.forEach(r.successors(f),u)}}var d=e.sortBy(i,function(f){return r.node(f).rank});return e.forEach(d,u),l}return tb}var rb,xC;function Uq(){if(xC)return rb;xC=1;var e=Zr();rb=t;function t(a,i){for(var o=0,l=1;l<i.length;++l)o+=r(a,i[l-1],i[l]);return o}function r(a,i,o){for(var l=e.zipObject(o,e.map(o,function(m,y){return y})),u=e.flatten(e.map(i,function(m){return e.sortBy(e.map(a.outEdges(m),function(y){return{pos:l[y.w],weight:a.edge(y).weight}}),"pos")}),!0),d=1;d<o.length;)d<<=1;var f=2*d-1;d-=1;var g=e.map(new Array(f),function(){return 0}),h=0;return e.forEach(u.forEach(function(m){var y=m.pos+d;g[y]+=m.weight;for(var v=0;y>0;)y%2&&(v+=g[y+1]),y=y-1>>1,g[y]+=m.weight;h+=m.weight*v})),h}return rb}var nb,yC;function qq(){if(yC)return nb;yC=1;var e=Zr();nb=t;function t(r,a){return e.map(a,function(i){var o=r.inEdges(i);if(o.length){var l=e.reduce(o,function(u,d){var f=r.edge(d),g=r.node(d.v);return{sum:u.sum+f.weight*g.order,weight:u.weight+f.weight}},{sum:0,weight:0});return{v:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return nb}var ab,bC;function Hq(){if(bC)return ab;bC=1;var e=Zr();ab=t;function t(i,o){var l={};e.forEach(i,function(d,f){var g=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:f};e.isUndefined(d.barycenter)||(g.barycenter=d.barycenter,g.weight=d.weight)}),e.forEach(o.edges(),function(d){var f=l[d.v],g=l[d.w];!e.isUndefined(f)&&!e.isUndefined(g)&&(g.indegree++,f.out.push(l[d.w]))});var u=e.filter(l,function(d){return!d.indegree});return r(u)}function r(i){var o=[];function l(f){return function(g){g.merged||(e.isUndefined(g.barycenter)||e.isUndefined(f.barycenter)||g.barycenter>=f.barycenter)&&a(f,g)}}function u(f){return function(g){g.in.push(f),--g.indegree===0&&i.push(g)}}for(;i.length;){var d=i.pop();o.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,u(d))}return e.map(e.filter(o,function(f){return!f.merged}),function(f){return e.pick(f,["vs","i","barycenter","weight"])})}function a(i,o){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(o.i,i.i),o.merged=!0}return ab}var ib,vC;function $q(){if(vC)return ib;vC=1;var e=Zr(),t=ka();ib=r;function r(o,l){var u=t.partition(o,function(k){return e.has(k,"barycenter")}),d=u.lhs,f=e.sortBy(u.rhs,function(k){return-k.i}),g=[],h=0,m=0,y=0;d.sort(i(!!l)),y=a(g,f,y),e.forEach(d,function(k){y+=k.vs.length,g.push(k.vs),h+=k.barycenter*k.weight,m+=k.weight,y=a(g,f,y)});var v={vs:e.flatten(g,!0)};return m&&(v.barycenter=h/m,v.weight=m),v}function a(o,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),o.push(d.vs),u++;return u}function i(o){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:o?u.i-l.i:l.i-u.i}}return ib}var sb,kC;function Wq(){if(kC)return sb;kC=1;var e=Zr(),t=qq(),r=Hq(),a=$q();sb=i;function i(u,d,f,g){var h=u.children(d),m=u.node(d),y=m?m.borderLeft:void 0,v=m?m.borderRight:void 0,k={};y&&(h=e.filter(h,function(T){return T!==y&&T!==v}));var _=t(u,h);e.forEach(_,function(T){if(u.children(T.v).length){var C=i(u,T.v,f,g);k[T.v]=C,e.has(C,"barycenter")&&l(T,C)}});var w=r(_,f);o(w,k);var S=a(w,g);if(y&&(S.vs=e.flatten([y,S.vs,v],!0),u.predecessors(y).length)){var E=u.node(u.predecessors(y)[0]),A=u.node(u.predecessors(v)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+E.order+A.order)/(S.weight+2),S.weight+=2}return S}function o(u,d){e.forEach(u,function(f){f.vs=e.flatten(f.vs.map(function(g){return d[g]?d[g].vs:g}),!0)})}function l(u,d){e.isUndefined(u.barycenter)?(u.barycenter=d.barycenter,u.weight=d.weight):(u.barycenter=(u.barycenter*u.weight+d.barycenter*d.weight)/(u.weight+d.weight),u.weight+=d.weight)}return sb}var ob,_C;function Vq(){if(_C)return ob;_C=1;var e=Zr(),t=Ni().Graph;ob=r;function r(i,o,l){var u=a(i),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return i.node(f)});return e.forEach(i.nodes(),function(f){var g=i.node(f),h=i.parent(f);(g.rank===o||g.minRank<=o&&o<=g.maxRank)&&(d.setNode(f),d.setParent(f,h||u),e.forEach(i[l](f),function(m){var y=m.v===f?m.w:m.v,v=d.edge(y,f),k=e.isUndefined(v)?0:v.weight;d.setEdge(y,f,{weight:i.edge(m).weight+k})}),e.has(g,"minRank")&&d.setNode(f,{borderLeft:g.borderLeft[o],borderRight:g.borderRight[o]}))}),d}function a(i){for(var o;i.hasNode(o=e.uniqueId("_root")););return o}return ob}var lb,wC;function Gq(){if(wC)return lb;wC=1;var e=Zr();lb=t;function t(r,a,i){var o={},l;e.forEach(i,function(u){for(var d=r.parent(u),f,g;d;){if(f=r.parent(d),f?(g=o[f],o[f]=d):(g=l,l=d),g&&g!==d){a.setEdge(g,d);return}d=f}})}return lb}var cb,NC;function Kq(){if(NC)return cb;NC=1;var e=Zr(),t=zq(),r=Uq(),a=Wq(),i=Vq(),o=Gq(),l=Ni().Graph,u=ka();cb=d;function d(m){var y=u.maxRank(m),v=f(m,e.range(1,y+1),"inEdges"),k=f(m,e.range(y-1,-1,-1),"outEdges"),_=t(m);h(m,_);for(var w=Number.POSITIVE_INFINITY,S,E=0,A=0;A<4;++E,++A){g(E%2?v:k,E%4>=2),_=u.buildLayerMatrix(m);var T=r(m,_);T<w&&(A=0,S=e.cloneDeep(_),w=T)}h(m,S)}function f(m,y,v){return e.map(y,function(k){return i(m,k,v)})}function g(m,y){var v=new l;e.forEach(m,function(k){var _=k.graph().root,w=a(k,_,v,y);e.forEach(w.vs,function(S,E){k.node(S).order=E}),o(k,v,w.vs)})}function h(m,y){e.forEach(y,function(v){e.forEach(v,function(k,_){m.node(k).order=_})})}return cb}var ub,SC;function Yq(){if(SC)return ub;SC=1;var e=Zr(),t=Ni().Graph,r=ka();ub={positionX:v,findType1Conflicts:a,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:m,findSmallestWidthAlignment:h,balance:y};function a(w,S){var E={};function A(T,C){var j=0,L=0,O=T.length,I=e.last(C);return e.forEach(C,function(B,z){var ee=o(w,B),$=ee?w.node(ee).order:O;(ee||B===I)&&(e.forEach(C.slice(L,z+1),function(M){e.forEach(w.predecessors(M),function(G){var Y=w.node(G),X=Y.order;(X<j||$<X)&&!(Y.dummy&&w.node(M).dummy)&&l(E,G,M)})}),L=z+1,j=$)}),C}return e.reduce(S,A),E}function i(w,S){var E={};function A(C,j,L,O,I){var B;e.forEach(e.range(j,L),function(z){B=C[z],w.node(B).dummy&&e.forEach(w.predecessors(B),function(ee){var $=w.node(ee);$.dummy&&($.order<O||$.order>I)&&l(E,ee,B)})})}function T(C,j){var L=-1,O,I=0;return e.forEach(j,function(B,z){if(w.node(B).dummy==="border"){var ee=w.predecessors(B);ee.length&&(O=w.node(ee[0]).order,A(j,I,z,L,O),I=z,L=O)}A(j,I,j.length,O,C.length)}),j}return e.reduce(S,T),E}function o(w,S){if(w.node(S).dummy)return e.find(w.predecessors(S),function(E){return w.node(E).dummy})}function l(w,S,E){if(S>E){var A=S;S=E,E=A}var T=w[S];T||(w[S]=T={}),T[E]=!0}function u(w,S,E){if(S>E){var A=S;S=E,E=A}return e.has(w[S],E)}function d(w,S,E,A){var T={},C={},j={};return e.forEach(S,function(L){e.forEach(L,function(O,I){T[O]=O,C[O]=O,j[O]=I})}),e.forEach(S,function(L){var O=-1;e.forEach(L,function(I){var B=A(I);if(B.length){B=e.sortBy(B,function(G){return j[G]});for(var z=(B.length-1)/2,ee=Math.floor(z),$=Math.ceil(z);ee<=$;++ee){var M=B[ee];C[I]===I&&O<j[M]&&!u(E,I,M)&&(C[M]=I,C[I]=T[I]=T[M],O=j[M])}}})}),{root:T,align:C}}function f(w,S,E,A,T){var C={},j=g(w,S,E,T),L=T?"borderLeft":"borderRight";function O(z,ee){for(var $=j.nodes(),M=$.pop(),G={};M;)G[M]?z(M):(G[M]=!0,$.push(M),$=$.concat(ee(M))),M=$.pop()}function I(z){C[z]=j.inEdges(z).reduce(function(ee,$){return Math.max(ee,C[$.v]+j.edge($))},0)}function B(z){var ee=j.outEdges(z).reduce(function(M,G){return Math.min(M,C[G.w]-j.edge(G))},Number.POSITIVE_INFINITY),$=w.node(z);ee!==Number.POSITIVE_INFINITY&&$.borderType!==L&&(C[z]=Math.max(C[z],ee))}return O(I,j.predecessors.bind(j)),O(B,j.successors.bind(j)),e.forEach(A,function(z){C[z]=C[E[z]]}),C}function g(w,S,E,A){var T=new t,C=w.graph(),j=k(C.nodesep,C.edgesep,A);return e.forEach(S,function(L){var O;e.forEach(L,function(I){var B=E[I];if(T.setNode(B),O){var z=E[O],ee=T.edge(z,B);T.setEdge(z,B,Math.max(j(w,I,O),ee||0))}O=I})}),T}function h(w,S){return e.minBy(e.values(S),function(E){var A=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(C,j){var L=_(w,j)/2;A=Math.max(C+L,A),T=Math.min(C-L,T)}),A-T})}function m(w,S){var E=e.values(S),A=e.min(E),T=e.max(E);e.forEach(["u","d"],function(C){e.forEach(["l","r"],function(j){var L=C+j,O=w[L],I;if(O!==S){var B=e.values(O);I=j==="l"?A-e.min(B):T-e.max(B),I&&(w[L]=e.mapValues(O,function(z){return z+I}))}})})}function y(w,S){return e.mapValues(w.ul,function(E,A){if(S)return w[S.toLowerCase()][A];var T=e.sortBy(e.map(w,A));return(T[1]+T[2])/2})}function v(w){var S=r.buildLayerMatrix(w),E=e.merge(a(w,S),i(w,S)),A={},T;e.forEach(["u","d"],function(j){T=j==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(L){L==="r"&&(T=e.map(T,function(z){return e.values(z).reverse()}));var O=(j==="u"?w.predecessors:w.successors).bind(w),I=d(w,T,E,O),B=f(w,T,I.root,I.align,L==="r");L==="r"&&(B=e.mapValues(B,function(z){return-z})),A[j+L]=B})});var C=h(w,A);return m(A,C),y(A,w.graph().align)}function k(w,S,E){return function(A,T,C){var j=A.node(T),L=A.node(C),O=0,I;if(O+=j.width/2,e.has(j,"labelpos"))switch(j.labelpos.toLowerCase()){case"l":I=-j.width/2;break;case"r":I=j.width/2;break}if(I&&(O+=E?I:-I),I=0,O+=(j.dummy?S:w)/2,O+=(L.dummy?S:w)/2,O+=L.width/2,e.has(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":I=L.width/2;break;case"r":I=-L.width/2;break}return I&&(O+=E?I:-I),I=0,O}}function _(w,S){return w.node(S).width}return ub}var db,EC;function Xq(){if(EC)return db;EC=1;var e=Zr(),t=ka(),r=Yq().positionX;db=a;function a(o){o=t.asNonCompoundGraph(o),i(o),e.forEach(r(o),function(l,u){o.node(u).x=l})}function i(o){var l=t.buildLayerMatrix(o),u=o.graph().ranksep,d=0;e.forEach(l,function(f){var g=e.max(e.map(f,function(h){return o.node(h).height}));e.forEach(f,function(h){o.node(h).y=d+g/2}),d+=g+u})}return db}var fb,jC;function Qq(){if(jC)return fb;jC=1;var e=Zr(),t=Iq(),r=Mq(),a=Oq(),i=ka().normalizeRanks,o=Dq(),l=ka().removeEmptyRanks,u=Pq(),d=Fq(),f=Bq(),g=Kq(),h=Xq(),m=ka(),y=Ni().Graph;fb=v;function v(K,V){var W=V&&V.debugTiming?m.time:m.notime;W("layout",function(){var ae=W(" buildLayoutGraph",function(){return O(K)});W(" runLayout",function(){k(ae,W)}),W(" updateInputGraph",function(){_(K,ae)})})}function k(K,V){V(" makeSpaceForEdgeLabels",function(){I(K)}),V(" removeSelfEdges",function(){ie(K)}),V(" acyclic",function(){t.run(K)}),V(" nestingGraph.run",function(){u.run(K)}),V(" rank",function(){a(m.asNonCompoundGraph(K))}),V(" injectEdgeLabelProxies",function(){B(K)}),V(" removeEmptyRanks",function(){l(K)}),V(" nestingGraph.cleanup",function(){u.cleanup(K)}),V(" normalizeRanks",function(){i(K)}),V(" assignRankMinMax",function(){z(K)}),V(" removeEdgeLabelProxies",function(){ee(K)}),V(" normalize.run",function(){r.run(K)}),V(" parentDummyChains",function(){o(K)}),V(" addBorderSegments",function(){d(K)}),V(" order",function(){g(K)}),V(" insertSelfEdges",function(){F(K)}),V(" adjustCoordinateSystem",function(){f.adjust(K)}),V(" position",function(){h(K)}),V(" positionSelfEdges",function(){U(K)}),V(" removeBorderNodes",function(){X(K)}),V(" normalize.undo",function(){r.undo(K)}),V(" fixupEdgeLabelCoords",function(){G(K)}),V(" undoCoordinateSystem",function(){f.undo(K)}),V(" translateGraph",function(){$(K)}),V(" assignNodeIntersects",function(){M(K)}),V(" reversePoints",function(){Y(K)}),V(" acyclic.undo",function(){t.undo(K)})}function _(K,V){e.forEach(K.nodes(),function(W){var ae=K.node(W),Q=V.node(W);ae&&(ae.x=Q.x,ae.y=Q.y,V.children(W).length&&(ae.width=Q.width,ae.height=Q.height))}),e.forEach(K.edges(),function(W){var ae=K.edge(W),Q=V.edge(W);ae.points=Q.points,e.has(Q,"x")&&(ae.x=Q.x,ae.y=Q.y)}),K.graph().width=V.graph().width,K.graph().height=V.graph().height}var w=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],A=["width","height"],T={width:0,height:0},C=["minlen","weight","width","height","labeloffset"],j={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function O(K){var V=new y({multigraph:!0,compound:!0}),W=P(K.graph());return V.setGraph(e.merge({},S,Z(W,w),e.pick(W,E))),e.forEach(K.nodes(),function(ae){var Q=P(K.node(ae));V.setNode(ae,e.defaults(Z(Q,A),T)),V.setParent(ae,K.parent(ae))}),e.forEach(K.edges(),function(ae){var Q=P(K.edge(ae));V.setEdge(ae,e.merge({},j,Z(Q,C),e.pick(Q,L)))}),V}function I(K){var V=K.graph();V.ranksep/=2,e.forEach(K.edges(),function(W){var ae=K.edge(W);ae.minlen*=2,ae.labelpos.toLowerCase()!=="c"&&(V.rankdir==="TB"||V.rankdir==="BT"?ae.width+=ae.labeloffset:ae.height+=ae.labeloffset)})}function B(K){e.forEach(K.edges(),function(V){var W=K.edge(V);if(W.width&&W.height){var ae=K.node(V.v),Q=K.node(V.w),he={rank:(Q.rank-ae.rank)/2+ae.rank,e:V};m.addDummyNode(K,"edge-proxy",he,"_ep")}})}function z(K){var V=0;e.forEach(K.nodes(),function(W){var ae=K.node(W);ae.borderTop&&(ae.minRank=K.node(ae.borderTop).rank,ae.maxRank=K.node(ae.borderBottom).rank,V=e.max(V,ae.maxRank))}),K.graph().maxRank=V}function ee(K){e.forEach(K.nodes(),function(V){var W=K.node(V);W.dummy==="edge-proxy"&&(K.edge(W.e).labelRank=W.rank,K.removeNode(V))})}function $(K){var V=Number.POSITIVE_INFINITY,W=0,ae=Number.POSITIVE_INFINITY,Q=0,he=K.graph(),Ne=he.marginx||0,De=he.marginy||0;function Ve(at){var lt=at.x,Ce=at.y,$e=at.width,Be=at.height;V=Math.min(V,lt-$e/2),W=Math.max(W,lt+$e/2),ae=Math.min(ae,Ce-Be/2),Q=Math.max(Q,Ce+Be/2)}e.forEach(K.nodes(),function(at){Ve(K.node(at))}),e.forEach(K.edges(),function(at){var lt=K.edge(at);e.has(lt,"x")&&Ve(lt)}),V-=Ne,ae-=De,e.forEach(K.nodes(),function(at){var lt=K.node(at);lt.x-=V,lt.y-=ae}),e.forEach(K.edges(),function(at){var lt=K.edge(at);e.forEach(lt.points,function(Ce){Ce.x-=V,Ce.y-=ae}),e.has(lt,"x")&&(lt.x-=V),e.has(lt,"y")&&(lt.y-=ae)}),he.width=W-V+Ne,he.height=Q-ae+De}function M(K){e.forEach(K.edges(),function(V){var W=K.edge(V),ae=K.node(V.v),Q=K.node(V.w),he,Ne;W.points?(he=W.points[0],Ne=W.points[W.points.length-1]):(W.points=[],he=Q,Ne=ae),W.points.unshift(m.intersectRect(ae,he)),W.points.push(m.intersectRect(Q,Ne))})}function G(K){e.forEach(K.edges(),function(V){var W=K.edge(V);if(e.has(W,"x"))switch((W.labelpos==="l"||W.labelpos==="r")&&(W.width-=W.labeloffset),W.labelpos){case"l":W.x-=W.width/2+W.labeloffset;break;case"r":W.x+=W.width/2+W.labeloffset;break}})}function Y(K){e.forEach(K.edges(),function(V){var W=K.edge(V);W.reversed&&W.points.reverse()})}function X(K){e.forEach(K.nodes(),function(V){if(K.children(V).length){var W=K.node(V),ae=K.node(W.borderTop),Q=K.node(W.borderBottom),he=K.node(e.last(W.borderLeft)),Ne=K.node(e.last(W.borderRight));W.width=Math.abs(Ne.x-he.x),W.height=Math.abs(Q.y-ae.y),W.x=he.x+W.width/2,W.y=ae.y+W.height/2}}),e.forEach(K.nodes(),function(V){K.node(V).dummy==="border"&&K.removeNode(V)})}function ie(K){e.forEach(K.edges(),function(V){if(V.v===V.w){var W=K.node(V.v);W.selfEdges||(W.selfEdges=[]),W.selfEdges.push({e:V,label:K.edge(V)}),K.removeEdge(V)}})}function F(K){var V=m.buildLayerMatrix(K);e.forEach(V,function(W){var ae=0;e.forEach(W,function(Q,he){var Ne=K.node(Q);Ne.order=he+ae,e.forEach(Ne.selfEdges,function(De){m.addDummyNode(K,"selfedge",{width:De.label.width,height:De.label.height,rank:Ne.rank,order:he+ ++ae,e:De.e,label:De.label},"_se")}),delete Ne.selfEdges})})}function U(K){e.forEach(K.nodes(),function(V){var W=K.node(V);if(W.dummy==="selfedge"){var ae=K.node(W.e.v),Q=ae.x+ae.width/2,he=ae.y,Ne=W.x-Q,De=ae.height/2;K.setEdge(W.e,W.label),K.removeNode(V),W.label.points=[{x:Q+2*Ne/3,y:he-De},{x:Q+5*Ne/6,y:he-De},{x:Q+Ne,y:he},{x:Q+5*Ne/6,y:he+De},{x:Q+2*Ne/3,y:he+De}],W.label.x=W.x,W.label.y=W.y}})}function Z(K,V){return e.mapValues(e.pick(K,V),Number)}function P(K){var V={};return e.forEach(K,function(W,ae){V[ae.toLowerCase()]=W}),V}return fb}var gb,CC;function Zq(){if(CC)return gb;CC=1;var e=Zr(),t=ka(),r=Ni().Graph;gb={debugOrdering:a};function a(i){var o=t.buildLayerMatrix(i),l=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(o,function(u,d){var f="layer"+d;l.setNode(f,{rank:"same"}),e.reduce(u,function(g,h){return l.setEdge(g,h,{style:"invis"}),h})}),l}return gb}var pb,TC;function Jq(){return TC||(TC=1,pb="0.8.5"),pb}var hb,RC;function eH(){return RC||(RC=1,hb={graphlib:Ni(),layout:Qq(),debug:Zq(),util:{time:ka().time,notime:ka().notime},version:Jq()}),hb}var tH=eH();const yf=jo(tH),rH={completed:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},in_progress:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},blocked:{fill:"#fef3c7",stroke:"#f59e0b",label:"#b45309"},open:{fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"}},nH={completed:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},in_progress:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},blocked:{fill:"#78350f",stroke:"#fbbf24",label:"#fde68a"},open:{fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"}};function aH(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function AC(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function iH({todos:e,darkMode:t}){const r=Array.isArray(e)?e:[],[a,i]=x.useState(null),o=x.useRef(null),l=x.useRef(null),[u,d]=x.useState(400),[f,g]=x.useState(function(){if(typeof window<"u"){const z=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(z)&&z>.1)return z}return 1});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-zoom",String(f))},[f]);const[h,m]=x.useState(function(){return typeof window<"u"?localStorage.getItem("pave-map-show-completed")!=="false":!0});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-show-completed",h?"true":"false")},[h]);const[y,v]=x.useState(function(){if(typeof window<"u"){const z=localStorage.getItem("pave-map-rankdir");if(z==="LR"||z==="TB")return z}return"TB"});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-rankdir",y)},[y]);const k=x.useMemo(function(){if(h)return r;const z=r.filter(function($){return $.status!=="completed"}),ee={};return z.forEach(function($){ee[$.id]=!0}),z.map(function($){if(!$.blockedBy||!$.blockedBy.length)return $;const M=$.blockedBy.filter(function(G){return ee[G]});return M.length===$.blockedBy.length?$:Object.assign({},$,{blockedBy:M})})},[r,h]);x.useEffect(function(){if(!o.current)return;function z(){o.current&&d(o.current.clientWidth||400)}z();const ee=new ResizeObserver(z);return ee.observe(o.current),function(){ee.disconnect()}},[]);const _=x.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const z=new yf.graphlib.Graph;z.setGraph({rankdir:y,nodesep:24,ranksep:36,marginx:16,marginy:16}),z.setDefaultEdgeLabel(function(){return{}});const ee=180,$=56;k.forEach(function(Y){z.setNode(String(Y.id),{width:ee,height:$,todo:Y})}),k.forEach(function(Y){(Y.blockedBy||[]).forEach(function(ie){z.hasNode(String(ie))&&z.setEdge(String(ie),String(Y.id))})}),yf.layout(z);const M=z.nodes().map(function(Y){const X=z.node(Y);return{id:Y,x:X.x-ee/2,y:X.y-$/2,w:ee,h:$,todo:X.todo}}),G=z.edges().map(function(Y){const X=z.edge(Y);return{from:Y.v,to:Y.w,points:X.points}});return{nodes:M,edges:G,width:z.graph().width||ee+32,height:z.graph().height||$+32}},[k,y]),w=t?nH:rH;if(!k.length){const z=r.length-k.length;return n.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[n.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:n.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})}),z>0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[z," completed ",z===1?"todo is":"todos are"," hidden."]}),n.jsx("button",{type:"button",onClick:function(){m(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:"Show completed"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:["Ask the agent to plan the work — todos created with the ",n.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"todo"})," tool will appear here as a live DAG."]})]})]})}function S(z){if(!z||z.length<2)return"";let ee="M "+z[0].x+" "+z[0].y;for(let $=1;$<z.length;$++)ee+=" L "+z[$].x+" "+z[$].y;return ee}const E=r.reduce(function(z,ee){const $=AC(ee);return z[$]=(z[$]||0)+1,z},{}),A=E.completed||0,T=Math.max(_.width,100),C=Math.max(_.height,100),L=(T>u-24?1:(u-24)/T)*f,O=T*L,I=C*L;function B(z){(z.ctrlKey||z.metaKey)&&(z.preventDefault(),g(function(ee){const $=z.deltaY<0?ee*1.1:ee/1.1;return Math.max(.25,Math.min(4,$))}))}return n.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[n.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{children:[r.length," total"]}),E.in_progress?n.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[E.in_progress," active"]}):null,A?n.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[A," done"]}):null,E.blocked?n.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[E.blocked," blocked"]}):null,n.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[n.jsx("button",{type:"button",onClick:function(){v(function(z){return z==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:y==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:y==="TB"?"↓":"→"}),n.jsx("button",{type:"button",onClick:function(){g(function(z){return Math.max(.25,z/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),n.jsxs("button",{type:"button",onClick:function(){g(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(f*100),"%"]}),n.jsx("button",{type:"button",onClick:function(){g(function(z){return Math.min(4,z*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),A>0?n.jsx("button",{type:"button",onClick:function(){m(function(z){return!z})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(h?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:h?"Hide completed todos":"Show completed todos",children:h?"hide done":"show done"}):null]})]}),n.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:B,children:n.jsxs("svg",{viewBox:"0 0 "+T+" "+C,width:O,height:I,style:{display:"block"},children:[n.jsx("defs",{children:n.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),_.edges.map(function(z,ee){return n.jsx("path",{d:S(z.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+ee)}),_.nodes.map(function(z){const ee=AC(z.todo),$=w[ee],M=ee==="in_progress",G=a===z.id;return n.jsxs("g",{transform:"translate("+z.x+","+z.y+")",onMouseEnter:function(){i(z.id)},onMouseLeave:function(){i(null)},style:{cursor:"pointer"},children:[n.jsx("rect",{width:z.w,height:z.h,rx:6,ry:6,fill:$.fill,stroke:$.stroke,strokeWidth:M||G?2:1.25,children:M?n.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),M?n.jsx("circle",{cx:10,cy:10,r:3.5,fill:$.stroke,children:n.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,n.jsx("text",{x:z.w/2,y:z.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:$.label,children:"#"+z.todo.id}),n.jsx("text",{x:z.w/2,y:z.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:aH(z.todo.text,26)}),G&&z.todo.text&&z.todo.text.length>26?n.jsx("title",{children:z.todo.text}):null]},z.id)})]})})]})}const sH={bash:{fill:"#f1f5f9",stroke:"#64748b",label:"#334155"},read:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},Read:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},edit:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},Edit:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},write:{fill:"#dcfce7",stroke:"#15803d",label:"#14532d"},Write:{fill:"#dcfce7",stroke:"#15803d",label:"#14532d"},glob:{fill:"#ede9fe",stroke:"#8b5cf6",label:"#6d28d9"},grep:{fill:"#ede9fe",stroke:"#8b5cf6",label:"#6d28d9"},fetch:{fill:"#fce7f3",stroke:"#db2777",label:"#9d174d"},canvas:{fill:"#fef3c7",stroke:"#f59e0b",label:"#b45309"},todo:{fill:"#e0f2fe",stroke:"#0ea5e9",label:"#0369a1"}},oH={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},lH={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},cH={bash:{fill:"#1e293b",stroke:"#94a3b8",label:"#e2e8f0"},read:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},Read:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},edit:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},Edit:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},write:{fill:"#14532d",stroke:"#16a34a",label:"#bbf7d0"},Write:{fill:"#14532d",stroke:"#16a34a",label:"#bbf7d0"},glob:{fill:"#4c1d95",stroke:"#a78bfa",label:"#ddd6fe"},grep:{fill:"#4c1d95",stroke:"#a78bfa",label:"#ddd6fe"},fetch:{fill:"#831843",stroke:"#f472b6",label:"#fbcfe8"},canvas:{fill:"#78350f",stroke:"#fbbf24",label:"#fde68a"},todo:{fill:"#0c4a6e",stroke:"#38bdf8",label:"#bae6fd"}},uH={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},dH={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},fH={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},gH={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},Ds={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function pH(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function hH(e,t){return e.kind==="thought"?t?gH:fH:e.status==="error"?t?dH:lH:(t?cH:sH)[e.tool]||(t?uH:oH)}function mH({graph:e,darkMode:t,onNodeClick:r}){const a=e&&Array.isArray(e.nodes)?e.nodes:[],i=e&&Array.isArray(e.edges)?e.edges:[],o=x.useRef(null),l=x.useRef(null),[u,d]=x.useState(null),[f,g]=x.useState(400),[h,m]=x.useState(function(){if(typeof window<"u"){const M=parseFloat(localStorage.getItem("pave-toolmap-zoom")||"");if(Number.isFinite(M)&&M>.1)return M}return 1});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-zoom",String(h))},[h]);const[y,v]=x.useState(function(){if(typeof window<"u"){const M=localStorage.getItem("pave-toolmap-rankdir");if(M==="LR"||M==="TB")return M}return"TB"});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-rankdir",y)},[y]);const[k,_]=x.useState(function(){return typeof window<"u"?localStorage.getItem("pave-toolmap-show-hidden")==="true":!1});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-hidden",k?"true":"false")},[k]);const[w,S]=x.useState(function(){return!(typeof window<"u"&&localStorage.getItem("pave-toolmap-show-thoughts")==="false")});x.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-thoughts",w?"true":"false")},[w]);const E=x.useMemo(function(){let M=a;return k||(M=M.filter(function(G){return!G.hidden})),w||(M=M.filter(function(G){return G.kind!=="thought"})),M},[a,k,w]),A=x.useMemo(function(){const M={};return E.forEach(function(G){M[G.id]=!0}),i.filter(function(G){return M[G.from]&&M[G.to]})},[i,E]),T=x.useMemo(function(){if(!E.length)return{nodes:[],edges:[],width:0,height:0};const M=new yf.graphlib.Graph;M.setGraph({rankdir:y,nodesep:18,ranksep:32,marginx:14,marginy:14}),M.setDefaultEdgeLabel(function(){return{}});const G=168,Y=44,X=240,ie=60;E.forEach(function(Z){Z.kind==="thought"?M.setNode(Z.id,{width:X,height:ie,node:Z}):M.setNode(Z.id,{width:G,height:Y,node:Z})}),A.forEach(function(Z){M.hasNode(Z.from)&&M.hasNode(Z.to)&&M.setEdge(Z.from,Z.to,{kind:Z.kind})}),yf.layout(M);const F=M.nodes().map(function(Z){const P=M.node(Z);return{id:Z,x:P.x-P.width/2,y:P.y-P.height/2,w:P.width,h:P.height,node:P.node}}),U=M.edges().map(function(Z){const P=M.edge(Z);return{from:Z.v,to:Z.w,points:P.points||[],kind:P.kind||"seq"}});return{nodes:F,edges:U,width:M.graph().width||G+28,height:M.graph().height||Y+28}},[E,A,y]);x.useEffect(function(){if(!o.current)return;function M(){o.current&&g(o.current.clientWidth||400)}M();const G=new ResizeObserver(M);return G.observe(o.current),function(){G.disconnect()}},[]);const C=x.useMemo(function(){const M={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return a.forEach(function(G){if(G.kind==="thought"){M.thoughts++;return}M.total++,G.hidden&&M.hidden++,G.status==="error"?M.error++:G.status==="running"?M.running++:M.ok++}),M},[a]);if(!E.length)return n.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[n.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:n.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),n.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:"Tool invocations will appear here as a DAG showing data flow and file dependencies."}),C.hidden>0&&!k?n.jsxs("button",{type:"button",onClick:function(){_(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:["Show ",C.hidden," hidden"]}):null]});function j(M){if(!M||M.length<2)return"";let G="M "+M[0].x+" "+M[0].y;for(let Y=1;Y<M.length;Y++)G+=" L "+M[Y].x+" "+M[Y].y;return G}const L=Math.max(T.width,100),O=Math.max(T.height,100),B=(L>f-24?1:(f-24)/L)*h,z=L*B,ee=O*B;function $(M){(M.ctrlKey||M.metaKey)&&(M.preventDefault(),m(function(G){const Y=M.deltaY<0?G*1.1:G/1.1;return Math.max(.25,Math.min(4,Y))}))}return n.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[n.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{children:[C.total," tools"]}),C.running?n.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[C.running," live"]}):null,C.error?n.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[C.error," err"]}):null,n.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[n.jsx("button",{type:"button",onClick:function(){v(function(M){return M==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:y==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:y==="TB"?"↓":"→"}),n.jsx("button",{type:"button",onClick:function(){m(function(M){return Math.max(.25,M/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),n.jsxs("button",{type:"button",onClick:function(){m(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(h*100),"%"]}),n.jsx("button",{type:"button",onClick:function(){m(function(M){return Math.min(4,M*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),C.hidden>0?n.jsx("button",{type:"button",onClick:function(){_(function(M){return!M})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(k?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:k?"Hide bookkeeping tools":"Show bookkeeping tools (todo, permission, etc.)",children:k?"hide bk":"show bk"}):null,C.thoughts>0?n.jsx("button",{type:"button",onClick:function(){S(function(M){return!M})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(w?"border-yellow-500 text-yellow-700 dark:text-yellow-300 bg-yellow-50 dark:bg-yellow-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:w?"Hide reasoning bubbles":"Show reasoning bubbles ("+C.thoughts+" thoughts)",children:w?"💭 "+C.thoughts:"💭 off"}):null]})]}),n.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:$,children:n.jsxs("svg",{viewBox:"0 0 "+L+" "+O,width:z,height:ee,style:{display:"block"},children:[n.jsxs("defs",{children:[n.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?Ds.data.dark:Ds.data.light})}),n.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?Ds.file.dark:Ds.file.light})}),n.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:n.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?Ds.seq.dark:Ds.seq.light})})]}),T.edges.map(function(M,G){const Y=t?Ds[M.kind].dark:Ds[M.kind].light;return n.jsx("path",{d:j(M.points),fill:"none",stroke:Y,strokeWidth:M.kind==="data"?1.75:M.kind==="file"?1.25:1,strokeDasharray:M.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+M.kind+")"},"e"+G)}),T.nodes.map(function(M){const G=M.node,Y=hH(G,t),X=G.status==="running",ie=u===M.id;if(G.kind==="thought"){const U=G.label||"",Z=32,P=3,K=U.split(/\s+/),V=[];let W="";for(const ae of K){if(V.length===P-1&&(W+" "+ae).length>Z){V.push(W);const Q=K.slice(K.indexOf(ae)).join(" ");V.push(Q.length>Z?Q.slice(0,Z-1)+"…":Q),W="";break}if(!W){W=ae;continue}if((W+" "+ae).length<=Z?W=W+" "+ae:(V.push(W),W=ae),V.length>=P)break}return W&&V.length<P&&V.push(W),n.jsxs("g",{transform:"translate("+M.x+","+M.y+")",onMouseEnter:function(){d(M.id)},onMouseLeave:function(){d(null)},onClick:function(){r&&r(G)},style:{cursor:r?"pointer":"default"},children:[n.jsx("rect",{width:M.w,height:M.h,rx:M.h/2,ry:M.h/2,fill:Y.fill,stroke:Y.stroke,strokeWidth:ie?1.75:1,strokeDasharray:G.source==="reasoning"?void 0:"4,2"}),n.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:Y.label,children:V.map(function(ae,Q){return n.jsx("tspan",{x:14,dy:Q===0?14:11,children:(Q===0?"💭 ":"")+ae},"ln"+Q)})}),n.jsx("title",{children:(G.source==="reasoning"?"[reasoning] ":"[thought] ")+(G.fullText||G.label)})]},M.id)}return n.jsxs("g",{transform:"translate("+M.x+","+M.y+")",onMouseEnter:function(){d(M.id)},onMouseLeave:function(){d(null)},onClick:function(){r&&r(G)},style:{cursor:r?"pointer":"default"},children:[n.jsx("rect",{width:M.w,height:M.h,rx:5,ry:5,fill:Y.fill,stroke:Y.stroke,strokeWidth:X||ie?2:1.25,opacity:G.hidden?.55:1,children:X?n.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),n.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:Y.label,children:G.tool}),n.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:pH(G.label,22)}),n.jsx("title",{children:G.tool+" · "+G.label+(G.status==="error"?" · ERROR":G.status==="running"?" · RUNNING":"")}),X?n.jsxs("g",{transform:"translate("+(M.w-9)+",9)",children:[n.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:Y.stroke,strokeWidth:.75}),n.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[n.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},M.id)})]})})]})}/*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */function IC(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}function xH(e){if(Array.isArray(e))return e}function yH(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var a,i,o,l,u=[],d=!0,f=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(d=(a=o.call(r)).done)&&(u.push(a.value),u.length!==t);d=!0);}catch(g){f=!0,i=g}finally{try{if(!d&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(f)throw i}}return u}}function bH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
104
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vH(e,t){return xH(e)||yH(e,t)||kH(e,t)||bH()}function kH(e,t){if(e){if(typeof e=="string")return IC(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?IC(e,t):void 0}}const iA=Object.entries,MC=Object.setPrototypeOf,_H=Object.isFrozen,wH=Object.getPrototypeOf,NH=Object.getOwnPropertyDescriptor;let En=Object.freeze,Ln=Object.seal,bl=Object.create,sA=typeof Reflect<"u"&&Reflect,cv=sA.apply,uv=sA.construct;En||(En=function(t){return t});Ln||(Ln=function(t){return t});cv||(cv=function(t,r){for(var a=arguments.length,i=new Array(a>2?a-2:0),o=2;o<a;o++)i[o-2]=arguments[o];return t.apply(r,i)});uv||(uv=function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return new t(...a)});const bo=xn(Array.prototype.forEach),SH=xn(Array.prototype.lastIndexOf),LC=xn(Array.prototype.pop),Tc=xn(Array.prototype.push),EH=xn(Array.prototype.splice),jl=Array.isArray,Dc=xn(String.prototype.toLowerCase),mb=xn(String.prototype.toString),OC=xn(String.prototype.match),Rc=xn(String.prototype.replace),DC=xn(String.prototype.indexOf),jH=xn(String.prototype.trim),CH=xn(Number.prototype.toString),TH=xn(Boolean.prototype.toString),PC=typeof BigInt>"u"?null:xn(BigInt.prototype.toString),FC=typeof Symbol>"u"?null:xn(Symbol.prototype.toString),va=xn(Object.prototype.hasOwnProperty),Ac=xn(Object.prototype.toString),Wn=xn(RegExp.prototype.test),mo=RH(TypeError);function xn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return cv(e,t,a)}}function RH(e){return function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return uv(e,r)}}function Sr(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Dc;if(MC&&MC(e,null),!jl(t))return e;let a=t.length;for(;a--;){let i=t[a];if(typeof i=="string"){const o=r(i);o!==i&&(_H(t)||(t[a]=o),i=o)}e[i]=!0}return e}function AH(e){for(let t=0;t<e.length;t++)va(e,t)||(e[t]=null);return e}function Ma(e){const t=bl(null);for(const a of iA(e)){var r=vH(a,2);const i=r[0],o=r[1];va(e,i)&&(jl(o)?t[i]=AH(o):o&&typeof o=="object"&&o.constructor===Object?t[i]=Ma(o):t[i]=o)}return t}function IH(e){switch(typeof e){case"string":return e;case"number":return CH(e);case"boolean":return TH(e);case"bigint":return PC?PC(e):"0";case"symbol":return FC?FC(e):"Symbol()";case"undefined":return Ac(e);case"function":case"object":{if(e===null)return Ac(e);const t=e,r=Xa(t,"toString");if(typeof r=="function"){const a=r(t);return typeof a=="string"?a:Ac(a)}return Ac(e)}default:return Ac(e)}}function Xa(e,t){for(;e!==null;){const a=NH(e,t);if(a){if(a.get)return xn(a.get);if(typeof a.value=="function")return xn(a.value)}e=wH(e)}function r(){return null}return r}function MH(e){try{return Wn(e,""),!0}catch{return!1}}const BC=En(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),xb=En(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),yb=En(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),LH=En(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),bb=En(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),OH=En(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zC=En(["#text"]),UC=En(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),vb=En(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),qC=En(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qd=En(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),DH=Ln(/{{[\w\W]*|^[\w\W]*}}/g),PH=Ln(/<%[\w\W]*|^[\w\W]*%>/g),FH=Ln(/\${[\w\W]*/g),BH=Ln(/^data-[\-\w.\u00B7-\uFFFF]+$/),zH=Ln(/^aria-[\-\w]+$/),HC=Ln(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),UH=Ln(/^(?:\w+script|data):/i),qH=Ln(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),HH=Ln(/^html$/i),$H=Ln(/^[a-z][.\w]*(-[.\w]+)+$/i),$C=Ln(/<[/\w!]/g),WC=Ln(/<[/\w]/g),WH=Ln(/<\/no(script|embed|frames)/i),VH=Ln(/\/>/i),Aa={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},oA=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],GH=En(Sr({},oA)),KH=(function(){const e={};return bo(oA,t=>{e[t]=Ln(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),En(e)})(),YH=function(){return typeof window>"u"?null:window},XH=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(a=r.getAttribute(i));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},VC=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ps=function(t,r,a,i){return va(t,r)&&jl(t[r])?Sr(i.base?Ma(i.base):{},t[r],i.transform):a},kb=function(t,r,a){const i=va(t,r)?t[r]:void 0;return i&&typeof i=="object"?Ma(i):a()};function lA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:YH();const t=Xe=>lA(Xe);if(t.version="3.4.15",t.removed=[],!e||!e.document||e.document.nodeType!==Aa.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const a=r,i=a.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,l=e.Node,u=e.Element,d=e.NodeFilter,f=e.NamedNodeMap;f===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const g=e.DOMParser,h=e.trustedTypes,m=u.prototype,y=Xa(m,"cloneNode"),v=Xa(m,"remove"),k=Xa(m,"removeAttributeNode"),_=Xa(m,"nextSibling"),w=Xa(m,"childNodes"),S=Xa(m,"parentNode"),E=Xa(m,"shadowRoot"),A=Xa(m,"attributes"),T=l&&l.prototype?Xa(l.prototype,"nodeType"):null,C=l&&l.prototype?Xa(l.prototype,"nodeName"):null,j=l&&l.prototype?Xa(l.prototype,"ownerDocument"):null,L=function(H){return T?T(H):H.nodeType},O=function(H){return C?C(H):H.nodeName};if(typeof o=="function"){const Xe=r.createElement("template");Xe.content&&Xe.content.ownerDocument&&(r=Xe.content.ownerDocument)}let I,B="",z,ee=!1,$=0;const M=function(){if($>0)throw mo('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},G=function(H){M(),$++;try{return I.createHTML(H)}finally{$--}},Y=function(H){M(),$++;try{return I.createScriptURL(H)}finally{$--}},X=function(){return ee||(z=XH(h,i),ee=!0),z},ie=r,F=ie.implementation,U=ie.createNodeIterator,Z=ie.createDocumentFragment,P=ie.getElementsByTagName,K=a.importNode;let V=VC();t.isSupported=typeof iA=="function"&&typeof S=="function"&&F&&F.createHTMLDocument!==void 0;const W=DH,ae=PH,Q=FH,he=BH,Ne=zH,De=UH,Ve=qH,at=$H;let lt=HC,Ce=null;const $e=Sr({},[...BC,...xb,...yb,...bb,...zC]);let Be=null;const gt=Sr({},[...UC,...vb,...qC,...qd]);let ut=Object.seal(bl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),jt=null,Ge=null;const we=Object.seal(bl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ue=!0,Ae=!0,rt=!1,fe=!0,ce=!1,ve=!0,ye=!1,it=!1,qe=null,Ye=null,yt=!1,ht=!1,Dt=!1,nt=!1,Pt=!0,$t=!1;const lr="user-content-";let pr=!0,_r=!1,cr={},ir=null;const ue=Sr({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Me=null;const Ke=Sr({},["audio","video","img","source","image","track"]);let Te=null;const oe=Sr({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),bt="http://www.w3.org/1998/Math/MathML",Pe="http://www.w3.org/2000/svg",te="http://www.w3.org/1999/xhtml";let be=te,ze=!1,Je=null;const Bt=Sr({},[bt,Pe,te],mb),Ft=En(["mi","mo","mn","ms","mtext"]);let Jt=Sr({},Ft);const Fe=En(["annotation-xml"]);let kt=Sr({},Fe);const Qt=Sr({},["title","style","font","a","script"]);let Wr=null;const ln=["application/xhtml+xml","text/html"],Jr="text/html";let yr=null,ca=null;const ni=r.createElement("form"),ai=function(H){return H instanceof RegExp||H instanceof Function},dn=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ca&&ca===H)return;(!H||typeof H!="object")&&(H={}),H=Ma(H),Wr=ln.indexOf(H.PARSER_MEDIA_TYPE)===-1?Jr:H.PARSER_MEDIA_TYPE,yr=Wr==="application/xhtml+xml"?mb:Dc,Ce=Ps(H,"ALLOWED_TAGS",$e,{transform:yr}),Be=Ps(H,"ALLOWED_ATTR",gt,{transform:yr}),Je=Ps(H,"ALLOWED_NAMESPACES",Bt,{transform:mb}),Te=Ps(H,"ADD_URI_SAFE_ATTR",oe,{transform:yr,base:oe}),Me=Ps(H,"ADD_DATA_URI_TAGS",Ke,{transform:yr,base:Ke}),ir=Ps(H,"FORBID_CONTENTS",ue,{transform:yr}),jt=Ps(H,"FORBID_TAGS",Ma({}),{transform:yr}),Ge=Ps(H,"FORBID_ATTR",Ma({}),{transform:yr}),cr=va(H,"USE_PROFILES")?H.USE_PROFILES&&typeof H.USE_PROFILES=="object"?Ma(H.USE_PROFILES):H.USE_PROFILES:!1,Ue=H.ALLOW_ARIA_ATTR!==!1,Ae=H.ALLOW_DATA_ATTR!==!1,rt=H.ALLOW_UNKNOWN_PROTOCOLS||!1,fe=H.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ce=H.SAFE_FOR_TEMPLATES||!1,ve=H.SAFE_FOR_XML!==!1,ye=H.WHOLE_DOCUMENT||!1,ht=H.RETURN_DOM||!1,Dt=H.RETURN_DOM_FRAGMENT||!1,nt=H.RETURN_TRUSTED_TYPE||!1,yt=H.FORCE_BODY||!1,Pt=H.SANITIZE_DOM!==!1,$t=H.SANITIZE_NAMED_PROPS||!1,pr=H.KEEP_CONTENT!==!1,_r=H.IN_PLACE||!1,lt=MH(H.ALLOWED_URI_REGEXP)?H.ALLOWED_URI_REGEXP:HC,be=typeof H.NAMESPACE=="string"?H.NAMESPACE:te,Jt=kb(H,"MATHML_TEXT_INTEGRATION_POINTS",()=>Sr({},Ft)),kt=kb(H,"HTML_INTEGRATION_POINTS",()=>Sr({},Fe));const le=kb(H,"CUSTOM_ELEMENT_HANDLING",()=>bl(null));if(ut=bl(null),va(le,"tagNameCheck")&&ai(le.tagNameCheck)&&(ut.tagNameCheck=le.tagNameCheck),va(le,"attributeNameCheck")&&ai(le.attributeNameCheck)&&(ut.attributeNameCheck=le.attributeNameCheck),va(le,"allowCustomizedBuiltInElements")&&typeof le.allowCustomizedBuiltInElements=="boolean"&&(ut.allowCustomizedBuiltInElements=le.allowCustomizedBuiltInElements),Ln(ut),ce&&(Ae=!1),Dt&&(ht=!0),cr&&(Ce=Sr({},zC),Be=bl(null),cr.html===!0&&(Sr(Ce,BC),Sr(Be,UC)),cr.svg===!0&&(Sr(Ce,xb),Sr(Be,vb),Sr(Be,qd)),cr.svgFilters===!0&&(Sr(Ce,yb),Sr(Be,vb),Sr(Be,qd)),cr.mathMl===!0&&(Sr(Ce,bb),Sr(Be,qC),Sr(Be,qd))),we.tagCheck=null,we.attributeCheck=null,va(H,"ADD_TAGS")&&(typeof H.ADD_TAGS=="function"?we.tagCheck=H.ADD_TAGS:jl(H.ADD_TAGS)&&(Ce===$e&&(Ce=Ma(Ce)),Sr(Ce,H.ADD_TAGS,yr))),va(H,"ADD_ATTR")&&(typeof H.ADD_ATTR=="function"?we.attributeCheck=H.ADD_ATTR:jl(H.ADD_ATTR)&&(Be===gt&&(Be=Ma(Be)),Sr(Be,H.ADD_ATTR,yr))),va(H,"ADD_FORBID_CONTENTS")&&jl(H.ADD_FORBID_CONTENTS)&&(ir===ue&&(ir=Ma(ir)),Sr(ir,H.ADD_FORBID_CONTENTS,yr)),pr&&(Ce["#text"]=!0),ye&&Sr(Ce,["html","head","body"]),Ce.table&&(Sr(Ce,["tbody"]),delete jt.tbody),H.TRUSTED_TYPES_POLICY){if(typeof H.TRUSTED_TYPES_POLICY.createHTML!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof H.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw mo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Se=I;I=H.TRUSTED_TYPES_POLICY;try{B=G("")}catch(We){throw I=Se,We}}else H.TRUSTED_TYPES_POLICY===null?(I=void 0,B=""):(I===void 0&&(I=X()),I&&typeof B=="string"&&(B=G("")));En&&En(H),ca=H},Ei=Sr({},[...xb,...yb,...LH]),Xn=Sr({},[...bb,...OH]),vr=function(H,le,Se){return le.namespaceURI===te?H==="svg":le.namespaceURI===bt?H==="svg"&&(Se==="annotation-xml"||Jt[Se]):!!Ei[H]},ji=function(H,le,Se){return le.namespaceURI===te?H==="math":le.namespaceURI===Pe?H==="math"&&kt[Se]:!!Xn[H]},bn=function(H,le,Se){return le.namespaceURI===Pe&&!kt[Se]||le.namespaceURI===bt&&!Jt[Se]?!1:!Xn[H]&&(Qt[H]||!Ei[H])},ii=function(H){let le=S(H);(!le||!le.tagName)&&(le={namespaceURI:be,tagName:"template"});const Se=Dc(H.tagName),We=Dc(le.tagName);return Je[H.namespaceURI]?H.namespaceURI===Pe?vr(Se,le,We):H.namespaceURI===bt?ji(Se,le,We):H.namespaceURI===te?bn(Se,le,We):!!(Wr==="application/xhtml+xml"&&Je[H.namespaceURI]):!1},nn=function(H){Tc(t.removed,{element:H});try{S(H).removeChild(H)}catch{if(v(H),!S(H))throw mo("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},st=function(H,le,Se){try{k(H,le)}catch{try{H.removeAttribute(Se)}catch{}}},Nt=function(H){ur(H);const le=w(H);if(le){const We=[];bo(le,pt=>{Tc(We,pt)}),bo(We,pt=>{try{v(pt)}catch{}})}const Se=A(H);if(Se)for(let We=Se.length-1;We>=0;--We){const pt=Se[We],_t=pt&&pt.name;typeof _t=="string"&&st(H,pt,_t)}},Ht=function(H,le,Se){if(!Se)try{Se=le.getAttributeNode(H)}catch{Se=null}Tc(t.removed,{attribute:Se||null,from:le});try{Se?k(le,Se):le.removeAttribute(H)}catch{try{le.removeAttribute(H)}catch{}}if(H==="is")if(ht||Dt)try{nn(le)}catch{}else try{le.setAttribute(H,"")}catch{}},er=function(H){const le=A(H);if(le)for(let Se=le.length-1;Se>=0;--Se){const We=le[Se],pt=We&&We.name;typeof pt!="string"||Be[yr(pt)]||st(H,We,pt)}},ur=function(H){const le=[H];for(;le.length>0;){const Se=le.pop();L(Se)===Aa.element&&er(Se);const pt=w(Se);if(pt)for(let _t=pt.length-1;_t>=0;--_t)le.push(pt[_t])}},tr=function(H,le){return ve?H==="patchsrc"?!0:H==="for"&&le!=="label"&&le!=="output":!1},Qn=function(H){if(!ve)return;const le=[H];for(;le.length>0;){const Se=le.pop(),We=L(Se);if(We===Aa.processingInstruction||We===Aa.comment&&Wn(WC,Se.data)){try{v(Se)}catch{}continue}if(We===Aa.element){const _t=Se,Er=yr(O(Se));try{_t.hasAttribute&&_t.hasAttribute("patchsrc")&&_t.removeAttribute("patchsrc"),_t.hasAttribute&&_t.hasAttribute("for")&&tr("for",Er)&&_t.removeAttribute("for")}catch{}}const pt=w(Se);if(pt)for(let _t=pt.length-1;_t>=0;--_t)le.push(pt[_t])}},si=function(H){let le=null,Se=null;if(yt)H="<remove></remove>"+H;else{const _t=OC(H,/^[\r\n\t ]+/);Se=_t&&_t[0]}Wr==="application/xhtml+xml"&&be===te&&(H='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+H+"</body></html>");const We=I?G(H):H;if(be===te)try{le=new g().parseFromString(We,Wr)}catch{}if(!le||!le.documentElement){le=F.createDocument(be,"template",null);try{le.documentElement.innerHTML=ze?B:We}catch{}}const pt=le.body||le.documentElement;return H&&Se&&pt.insertBefore(r.createTextNode(Se),pt.childNodes[0]||null),be===te?P.call(le,ye?"html":"body")[0]:ye?le.documentElement:pt},zr=function(H){const le=j?j(H):H.ownerDocument;return U.call(le||H,H,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ur=function(H){return H=Rc(H,W," "),H=Rc(H,ae," "),H=Rc(H,Q," "),H},fn=function(H){var le;H.normalize();const Se=j?j(H):H.ownerDocument,We=U.call(Se||H,H,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let pt=We.nextNode();for(;pt;)pt.data=Ur(pt.data),pt=We.nextNode();const _t=(le=H.querySelectorAll)===null||le===void 0?void 0:le.call(H,"template");_t&&bo(_t,Er=>{jn(Er.content)&&fn(Er.content)})},Zn=function(H){const le=C?C(H):null;return typeof le!="string"||yr(le)!=="form"?!1:typeof H.nodeName!="string"||typeof H.textContent!="string"||typeof H.removeChild!="function"||H.attributes!==A(H)||typeof H.removeAttribute!="function"||typeof H.removeAttributeNode!="function"||typeof H.getAttributeNode!="function"||typeof H.setAttribute!="function"||typeof H.namespaceURI!="string"||typeof H.insertBefore!="function"||typeof H.hasChildNodes!="function"||H.nodeType!==T(H)||H.childNodes!==w(H)},jn=function(H){if(!T||typeof H!="object"||H===null)return!1;try{return T(H)===Aa.documentFragment}catch{return!1}},oi=function(H){if(!T||typeof H!="object"||H===null)return!1;try{return typeof T(H)=="number"}catch{return!1}};function vn(Xe,H,le){Xe.length!==0&&bo(Xe,Se=>{Se.call(t,H,le,ca)})}const Yi=function(H,le){return!!(ve&&H.hasChildNodes()&&!oi(H.firstElementChild)&&Wn($C,H.textContent)&&Wn($C,H.innerHTML)||ve&&H.namespaceURI===te&&GH[le]&&(oi(H.firstElementChild)||typeof H.textContent=="string"&&Wn(KH[le],H.textContent))||H.nodeType===Aa.processingInstruction||ve&&H.nodeType===Aa.comment&&Wn(WC,H.data))},Fa=function(H,le){if(H instanceof RegExp)return Wn(H,le);if(H instanceof Function){for(var Se=arguments.length,We=new Array(Se>2?Se-2:0),pt=2;pt<Se;pt++)We[pt-2]=arguments[pt];return!!H(le,...We)}return!1},Un=function(H,le,Se){if(!jt[le]&&Ci(le)&&Fa(ut.tagNameCheck,le))return!1;if(pr&&!ir[le]){const We=S(H),pt=w(H);if(pt&&We){const _t=pt.length;for(let Er=_t-1;Er>=0;--Er){const jr=H===Se?y(pt[Er],!0):pt[Er];We.insertBefore(jr,_(H))}}}return nn(H),!0},Jn=function(H,le,Se,We){return H.length===0?le:le===Se||le===We?Ma(le):le},On=function(H,le){return H===le||S(H)!==null?!1:(_r&&ur(H),!0)},ea=function(H,le){if(vn(V.beforeSanitizeElements,H,null),On(H,le))return!0;if(Zn(H))return nn(H),!0;const Se=yr(O(H));if(Ce=Jn(V.uponSanitizeElement,Ce,$e,qe),vn(V.uponSanitizeElement,H,{tagName:Se,allowedTags:Ce}),On(H,le))return!0;if(Yi(H,Se))return nn(H),!0;if(jt[Se]||!(we.tagCheck instanceof Function&&we.tagCheck(Se))&&!Ce[Se]){const pt=Un(H,Se,le);return pt===!1&&vn(V.afterSanitizeElements,H,null),pt}if(L(H)===Aa.element&&!ii(H)||(Se==="noscript"||Se==="noembed"||Se==="noframes")&&Wn(WH,H.innerHTML))return nn(H),!0;if(ce&&H.nodeType===Aa.text){const pt=Ur(H.textContent);H.textContent!==pt&&(Tc(t.removed,{element:H.cloneNode()}),H.textContent=pt)}return vn(V.afterSanitizeElements,H,null),!1},dr=function(H,le,Se){if(Ge[le]||tr(le,H)||Pt&&(le==="id"||le==="name")&&(Se in r||Se in ni))return!1;const We=Be[le]||we.attributeCheck instanceof Function&&we.attributeCheck(le,H);return Ae&&Wn(he,le)||Ue&&Wn(Ne,le)?!0:We?Te[le]||Wn(lt,Rc(Se,Ve,""))||(le==="src"||le==="xlink:href"||le==="href")&&H!=="script"&&DC(Se,"data:")===0&&Me[H]||rt&&!Wn(De,Rc(Se,Ve,""))?!0:!Se:Ci(H)&&Fa(ut.tagNameCheck,H)&&Fa(ut.attributeNameCheck,le,H)||le==="is"&&ut.allowCustomizedBuiltInElements&&Fa(ut.tagNameCheck,Se)},He=Sr({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ci=function(H){return!He[Dc(H)]&&Wn(at,H)},Vr=function(H,le,Se,We){if(I&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Se)switch(h.getAttributeType(H,le)){case"TrustedHTML":return G(We);case"TrustedScriptURL":return Y(We)}return We},wr=function(H,le,Se,We){try{return Se?H.setAttributeNS(Se,le,We):H.setAttribute(le,We),Zn(H)?(nn(H),!1):!0}catch{return Ht(le,H),!1}},Ba=function(H){vn(V.beforeSanitizeAttributes,H,null);const le=H.attributes;if(!le||Zn(H))return;Be=Jn(V.uponSanitizeAttribute,Be,gt,Ye);const Se={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Be,forceKeepAttr:void 0};let We=le.length;const pt=yr(H.nodeName);for(;We--;){const _t=le[We],Er=_t.name,jr=_t.namespaceURI,an=_t.value,Tn=yr(Er),za=an;let sn=Er==="value"?za:jH(za),Ti=!1;if(Se.attrName=Tn,Se.attrValue=sn,Se.keepAttr=!0,Se.forceKeepAttr=void 0,vn(V.uponSanitizeAttribute,H,Se),sn=Se.attrValue,$t&&(Tn==="id"||Tn==="name")&&DC(sn,lr)!==0&&(Ht(Er,H,_t),sn=lr+sn,Ti=!0),ve&&Wn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,sn)){Ht(Er,H,_t);continue}if(Tn==="attributename"&&OC(sn,"href")){Ht(Er,H,_t);continue}if(!Se.forceKeepAttr){if(!Se.keepAttr){Ht(Er,H,_t);continue}if(!fe&&Wn(VH,sn)){Ht(Er,H,_t);continue}if(ce&&(sn=Ur(sn)),!dr(pt,Tn,sn)){Ht(Er,H,_t);continue}sn=Vr(pt,Tn,jr,sn),sn!==za&&wr(H,Er,jr,sn)&&Ti&&LC(t.removed)}}vn(V.afterSanitizeAttributes,H,null)},Cn=function(H){let le=null;const Se=zr(H);for(vn(V.beforeSanitizeShadowDOM,H,null);le=Se.nextNode();)if(vn(V.uponSanitizeShadowNode,le,null),ea(le,H),Ba(le),jn(le.content)&&Cn(le.content),L(le)===Aa.element){const We=E(le);jn(We)&&(wa(We),Cn(We))}vn(V.afterSanitizeShadowDOM,H,null)},wa=function(H){const le=[{node:H,shadow:null}];for(;le.length>0;){const Se=le.pop();if(Se.shadow){Cn(Se.shadow);continue}const We=Se.node,_t=L(We)===Aa.element,Er=w(We);if(Er)for(let jr=Er.length-1;jr>=0;--jr)le.push({node:Er[jr],shadow:null});if(_t){const jr=C?C(We):null;if(typeof jr=="string"&&yr(jr)==="template"){const an=We.content;jn(an)&&le.push({node:an,shadow:null})}}if(_t){const jr=E(We);jn(jr)&&le.push({node:null,shadow:jr},{node:jr,shadow:null})}}};return t.sanitize=function(Xe){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},le=null,Se=null,We=null,pt=null;if(ze=!Xe,ze&&(Xe="<!-->"),typeof Xe!="string"&&!oi(Xe)&&(Xe=IH(Xe),typeof Xe!="string"))throw mo("dirty is not a string, aborting");if(!t.isSupported)return Xe;it?(Ce=qe,Be=Ye):dn(H),(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&(Ce=Ma(Ce)),V.uponSanitizeAttribute.length>0&&(Be=Ma(Be)),t.removed=[];const _t=_r&&typeof Xe!="string"&&oi(Xe);if(_t){Qn(Xe);const an=O(Xe);if(typeof an=="string"){const Tn=yr(an);if(!Ce[Tn]||jt[Tn])throw Nt(Xe),mo("root node is forbidden and cannot be sanitized in-place")}if(Zn(Xe))throw Nt(Xe),mo("root node is clobbered and cannot be sanitized in-place");try{wa(Xe)}catch(Tn){throw Nt(Xe),Tn}}else if(oi(Xe))le=si("<!---->"),Se=le.ownerDocument.importNode(Xe,!0),Se.nodeType===Aa.element&&Se.nodeName==="BODY"||Se.nodeName==="HTML"?le=Se:le.appendChild(Se),wa(le);else{if(!ht&&!ce&&!ye&&Xe.indexOf("<")===-1)return I&&nt?G(Xe):Xe;if(le=si(Xe),!le)return ht?null:nt?B:""}le&&yt&&nn(le.firstChild);const Er=_t?Xe:le;try{const an=zr(Er);for(;We=an.nextNode();)ea(We,Er),Ba(We),jn(We.content)&&Cn(We.content)}catch(an){throw _t&&(Nt(Xe),bo(t.removed,Tn=>{Tn.element&&ur(Tn.element)})),an}if(_t)return bo(t.removed,an=>{an.element&&ur(an.element)}),ce&&fn(Xe),Xe;if(ht){if(ce&&fn(le),Dt)for(pt=Z.call(le.ownerDocument);le.firstChild;)pt.appendChild(le.firstChild);else pt=le;return(Be.shadowroot||Be.shadowrootmode)&&(pt=K.call(a,pt,!0)),pt}let jr=ye?le.outerHTML:le.innerHTML;return ye&&Ce["!doctype"]&&le.ownerDocument&&le.ownerDocument.doctype&&le.ownerDocument.doctype.name&&Wn(HH,le.ownerDocument.doctype.name)&&(jr="<!DOCTYPE "+le.ownerDocument.doctype.name+`>
|
|
105
|
-
`+jr),ce&&(jr=Ur(jr)),I&&nt?G(jr):jr},t.setConfig=function(){let Xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dn(Xe),it=!0,qe=Ce,Ye=Be},t.clearConfig=function(){ca=null,it=!1,qe=null,Ye=null,I=z,B=""},t.isValidAttribute=function(Xe,H,le){ca||dn({});const Se=yr(Xe),We=yr(H);return dr(Se,We,le)},t.addHook=function(Xe,H){typeof H=="function"&&va(V,Xe)&&Tc(V[Xe],H)},t.removeHook=function(Xe,H){if(va(V,Xe)){if(H!==void 0){const le=SH(V[Xe],H);return le===-1?void 0:EH(V[Xe],le,1)[0]}return LC(V[Xe])}},t.removeHooks=function(Xe){va(V,Xe)&&(V[Xe]=[])},t.removeAllHooks=function(){V=VC()},t}var QH=lA();let _b=null;function ZH(){return _b||(_b=F4(()=>import("./mermaid.core-Cx9gMKa8.js").then(e=>e.ca),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),_b}function GC(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let KC=0;function JH(){return KC+=1,"pave-canvas-"+KC}function e$({source:e}){const t=x.useRef(null),r=x.useRef(JH()),[a,i]=x.useState(null),[o,l]=x.useState(GC());return x.useEffect(function(){if(typeof window>"u")return;const u=new MutationObserver(function(){const d=GC();l(function(f){return f!==d?d:f})});return u.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),function(){u.disconnect()}},[]),x.useEffect(function(){let u=!1;return i(null),ZH().then(function(d){u||(d.initialize({startOnLoad:!1,securityLevel:"strict",theme:o?"dark":"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),d.render(r.current,e).then(function(f){if(!u&&t.current){let g=f.svg;g=g.replace(/<svg([^>]*)\sstyle="[^"]*max-width:[^";]*;?[^"]*"/i,"<svg$1"),g=g.replace(/(<svg[^>]*)\swidth="[^"]*"/i,"$1"),g=g.replace(/(<svg[^>]*)\sheight="[^"]*"/i,"$1"),g=g.replace(/<svg\b/i,'<svg width="100%" height="100%" preserveAspectRatio="xMidYMid meet"'),t.current.innerHTML=g}}).catch(function(f){u||i(f&&f.message||String(f))}))}).catch(function(d){u||i("Failed to load mermaid: "+(d&&d.message||String(d)))}),function(){u=!0}},[e,o]),a?n.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[n.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),n.jsx("pre",{className:"whitespace-pre-wrap",children:a}),n.jsxs("details",{className:"mt-2",children:[n.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),n.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):n.jsx("div",{ref:t,className:"mermaid-canvas w-full h-full flex items-center justify-center [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:w-full [&>svg]:h-auto"})}function t$({source:e}){const t=x.useMemo(function(){return QH.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return n.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function r$({source:e}){return n.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function n$({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=n.jsx(e$,{source:e.source}):e.type==="svg"?t=n.jsx(t$,{source:e.source}):e.type==="katex"?t=n.jsx(r$,{source:e.source}):t=n.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),n.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function YC({canvases:e,onClear:t}){const r=Array.isArray(e)?e:[],[a,i]=x.useState(Math.max(0,r.length-1)),[o,l]=x.useState(1),[u,d]=x.useState(!1);x.useEffect(function(){i(function(_){return _>=r.length-2?Math.max(0,r.length-1):Math.min(_,Math.max(0,r.length-1))})},[r.length]),x.useEffect(function(){l(1)},[a]),x.useEffect(function(){if(!u)return;const _=w=>{w.key==="Escape"&&d(!1)};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[u]);const f=x.useCallback(()=>l(_=>Math.min(4,+(_+.25).toFixed(2))),[]),g=x.useCallback(()=>l(_=>Math.max(.5,+(_-.25).toFixed(2))),[]),h=x.useCallback(()=>l(1),[]);if(r.length===0)return n.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[n.jsx("svg",{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),n.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 max-w-xs",children:["Ask the agent to draw something here. It can use the ",n.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"canvas"})," tool to render Mermaid diagrams, SVG illustrations, or math."]})]});const m=Math.min(Math.max(0,a),r.length-1),y=r[m],v=n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 border-b border-gray-200 dark:border-gray-700 text-xs",children:[r.length>1?n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>i(Math.max(0,m-1)),disabled:m===0,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Previous canvas",children:"←"}),n.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[m+1,"/",r.length]}),n.jsx("button",{type:"button",onClick:()=>i(Math.min(r.length-1,m+1)),disabled:m===r.length-1,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Next canvas",children:"→"})]}):n.jsx("div",{}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:g,disabled:o<=.5,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom out",children:"−"}),n.jsxs("button",{type:"button",onClick:h,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 tabular-nums min-w-[3rem]",title:"Reset zoom",children:[Math.round(o*100),"%"]}),n.jsx("button",{type:"button",onClick:f,disabled:o>=4,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom in",children:"+"}),n.jsx("button",{type:"button",onClick:()=>d(_=>!_),className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:u?"Exit fullscreen (Esc)":"Fullscreen",children:u?"⤢":"⛶"}),t?n.jsx("button",{type:"button",onClick:t,className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-red-50 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400",title:"Clear all canvases (hides them; messages preserved)",children:"✕"}):null]})]}),k=n.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[y.title?n.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:y.title}):null,n.jsx("div",{style:{transform:`scale(${o})`,transformOrigin:"top left",width:o===1?"100%":`${100/o}%`},children:n.jsx(n$,{canvas:y})}),y.caption?n.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:y.caption}):null]});return u?n.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[v,k]}):n.jsxs("div",{className:"h-full flex flex-col",children:[v,k]})}function a$(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function i$(e,t){const r=a$(e);return{modelID:r||t||null,activeModelID:r,conversationModelID:t}}function s$(e){const{serverContextLimit:t,registryLimitMap:r={},limitModelID:a,effectiveActiveModel:i,modelLimits:o={},defaultLimit:l}=e||{};return t||r[a]||r[i]||o[a]||l}const yk={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function bk(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function vk(e){const t={};return e.forEach(r=>{const a=r.provider||"other";t[a]||(t[a]=[]),t[a].push(r)}),t}function o$({isBusy:e,isCompacting:t}={}){return e?t?"compacting":"generating":"idle"}const l$={"claude-opus-4.5":2e5,"claude-opus-4.6":2e5,"claude-sonnet-4":2e5,"claude-sonnet-4.5":2e5,"claude-sonnet-4.6":2e5,"gpt-4o":128e3,"gpt-4.1":1047576,"gpt-4-turbo":128e3,"gpt-4":8192,o1:2e5,"o1-mini":128e3,o3:2e5,"o3-mini":2e5},c$=128e3;function wb(e){const[t,r]=x.useState(e),a=x.useRef(e),i=x.useRef(0),o=x.useRef(0);return x.useEffect(()=>{if(e===a.current)return;i.current=0,a.current=t;const l=400,u=t,d=e,f=g=>{i.current||(i.current=g);const h=g-i.current,m=Math.min(h/l,1),y=1-(1-m)**3;r(Math.round(u+(d-u)*y)),m<1?o.current=requestAnimationFrame(f):r(d)};return o.current=requestAnimationFrame(f),()=>cancelAnimationFrame(o.current)},[e]),t}function u$({messages:e,isBusy:t,isCompacting:r,activeModel:a,sessionModel:i,isPrivateMode:o,registryEntries:l}){var U,Z;var{t:u}=Xt();const d=e.filter(P=>{var K;return((K=P.info)==null?void 0:K.role)==="user"}).length,f=e.filter(P=>{var K;return((K=P.info)==null?void 0:K.role)==="assistant"}).length;let g=0,h=0,m=0,y=null,v=null;for(let P=e.length-1;P>=0;P--){const K=e[P];if(((U=K.info)==null?void 0:U.role)==="assistant"&&((Z=K.info)==null?void 0:Z.mode)!=="compaction"){const V=K.info.tokens;if(V&&(V.input||V.output)){!y&&K.info.modelID&&(y=K.info.modelID),g=V.lastInput??V.input??0,h=V.lastOutput??V.output??0,m=V.lastReasoning??V.reasoning??0,K.info.contextLimit&&(v=K.info.contextLimit);break}}}const k=wb(g),_=wb(h),w=wb(m),S=k+_+w,E=g+h+m>0;let A=a;typeof i=="string"&&i?A=i:i&&i.providerID&&i.modelID&&(A=i.providerID+"/"+i.modelID);let{modelID:T,activeModelID:C}=i$(A,y),j=null;if(o){T="privacy",C="privacy";let P=null;typeof i=="string"&&i?P=i.includes("/")?i.split("/").pop():i:i&&i.modelID&&(P=i.modelID),j=P||(a?String(a).split("/").pop():null)}else y&&C&&y!==C&&(j=y);const L=x.useMemo(()=>{const P={};if(l&&l.length>0){for(const K of l)if(K.limit&&typeof K.limit.context=="number"&&K.limit.context>0){P[K.key]=K.limit.context;const V=K.key.includes("/")?K.key.split("/").pop():K.key;V&&(P[V]=K.limit.context)}}return P},[l]),I=s$({serverContextLimit:v,registryLimitMap:L,limitModelID:y||T,effectiveActiveModel:A,modelLimits:l$,defaultLimit:c$}),B=Math.min(100,Math.round(k/I*100));let z="bg-green-500";B>=90?z="bg-red-500":B>=75?z="bg-orange-500":B>=50&&(z="bg-yellow-500");const ee="border-gray-200 dark:border-gray-800",$="text-gray-500 dark:text-gray-400",M="text-gray-500 dark:text-gray-400",G="text-gray-700 dark:text-gray-300",Y="border-gray-100 dark:border-gray-800";return n.jsxs("div",{className:`p-4 border-t ${ee}`,children:[n.jsx("p",{className:`text-xs ${$} uppercase tracking-wide font-medium mb-3`,children:u("token_usage.session_info")}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${M}`,children:u("token_usage.messages")}),n.jsx("span",{className:`text-xs font-medium ${G}`,children:d+f})]}),T&&n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${M}`,children:u("token_usage.model")}),n.jsx("span",{className:`text-xs font-medium ${G} truncate ml-2 max-w-[140px]`,children:XC(T)})]}),j&&n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${M}`,children:u("token_usage.originally")}),n.jsx("span",{className:`text-xs ${M} truncate ml-2 max-w-[140px]`,children:XC(j)})]}),(()=>{const P=o$({isBusy:t,isCompacting:r}),K=P==="compacting"?"bg-amber-400 animate-pulse":P==="generating"?"bg-accent-400 animate-pulse":"bg-green-500",V=u(P==="compacting"?"token_usage.compacting":P==="generating"?"token_usage.generating":"token_usage.idle");return n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${M}`,children:u("token_usage.status")}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${K}`}),n.jsx("span",{className:`text-xs font-medium ${G}`,children:V})]})]})})(),E?n.jsx(n.Fragment,{children:n.jsxs("div",{className:`border-t ${Y} pt-2 mt-2`,children:[n.jsxs("div",{className:"mb-2",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:`text-xs ${M}`,children:"Context"}),n.jsxs("span",{className:`text-xs ${M}`,children:[B,"% of ",(I/1e3).toFixed(0),"k"]})]}),n.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:n.jsx("div",{className:`h-full ${z} transition-all duration-300`,style:{width:`${B}%`}})})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${M}`,children:"Input"}),n.jsx("span",{className:`text-xs font-medium ${G} tabular-nums`,children:k.toLocaleString()})]}),n.jsxs("div",{className:"flex items-center justify-between mt-1",children:[n.jsx("span",{className:`text-xs ${M}`,children:"Output"}),n.jsx("span",{className:`text-xs font-medium ${G} tabular-nums`,children:_.toLocaleString()})]}),m>0&&n.jsxs("div",{className:"flex items-center justify-between mt-1",children:[n.jsx("span",{className:`text-xs ${M}`,children:"Reasoning"}),n.jsx("span",{className:`text-xs font-medium ${G} tabular-nums`,children:w.toLocaleString()})]}),n.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${Y}`,children:[n.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Total"}),n.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:S.toLocaleString()})]})]})}):n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-xs ${M}`,children:"Tokens"}),n.jsx("span",{className:`text-xs ${M}`,children:"--"})]})]})]})}function XC(e){return e?{"claude-opus-4.5":"Claude Opus 4.5","claude-opus-4.6":"Claude Opus 4.6","claude-sonnet-4":"Claude Sonnet 4","claude-sonnet-4.5":"Claude Sonnet 4.5","claude-sonnet-4.6":"Claude Sonnet 4.6","gpt-4o":"GPT-4o","gpt-4.1":"GPT-4.1","gpt-4-turbo":"GPT-4 Turbo","gpt-4":"GPT-4"}[e]||e:""}function d$({sessionModel:e,activeModel:t,registryEntries:r,onModelChange:a,disabled:i,lockedReason:o}){const{t:l}=Xt(),[u,d]=x.useState(!1),f=x.useRef(null),[g,h]=x.useState(-1),m=x.useRef([]);x.useEffect(()=>{if(!u)return;function S(E){f.current&&!f.current.contains(E.target)&&d(!1)}return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[u]),x.useEffect(()=>{if(!u)return;function S(E){if(E.key==="Escape"){d(!1);return}E.key!=="ArrowDown"&&E.key!=="ArrowUp"&&E.key!=="Home"&&E.key!=="End"||(E.preventDefault(),h(A=>{const T=m.current.length;if(!T)return A;const C=typeof A=="number"?A:-1;let j=C;return E.key==="ArrowDown"?j=C<T-1?C+1:0:E.key==="ArrowUp"?j=C>0?C-1:T-1:E.key==="Home"?j=0:E.key==="End"&&(j=T-1),m.current[j]&&m.current[j].focus(),j}))}return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[u]);const y=typeof e=="string"&&e.trim()?e.trim():null,v=y!=null,k=Array.isArray(r)?r:[],_=f$(y,t,k,l),w=x.useCallback(S=>{a(S===t||y&&y===S?null:S),d(!1)},[y,t,a]);return m.current.length=k.length,n.jsxs("div",{className:"relative",ref:f,children:[n.jsxs("button",{type:"button",onClick:()=>d(S=>!S),disabled:i,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-md transition-colors "+(v||_?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800")+(i?" opacity-50 cursor-not-allowed":" cursor-pointer"),title:o||l("model_selector.title"),"aria-label":o||l("model_selector.title"),"aria-haspopup":"menu","aria-expanded":u,children:[o?n.jsxs("svg",{className:"w-3.5 h-3.5 flex-shrink-0 text-emerald-600 dark:text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 11c.667 0 2 .4 2 2v3a2 2 0 11-4 0v-3c0-1.6 1.333-2 2-2zM6 11V8a6 6 0 1112 0v3"}),n.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):n.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),n.jsx("span",{className:"max-w-[120px] truncate",children:_}),n.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),u&&n.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] max-h-72 overflow-y-auto bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",role:"menu","aria-label":l("model_selector.list_label"),children:[k.length===0&&n.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:l("model_selector.no_models")}),k.map((S,E)=>{const A=y===S.key,T=!!t&&(S.key===t||S.target===t||S.url===t),C=S.builtin?S.key:S.displayName||S.key;return n.jsxs("button",{type:"button",ref:j=>{m.current[E]=j},tabIndex:g===E?0:-1,role:"menuitemradio","aria-checked":A||!v&&T,onClick:()=>w(S.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(A||!v&&T?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"),children:[n.jsx("span",{className:"font-medium",children:C}),T&&n.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",l("model_selector.default_label"),")"]})]},S.key)})]})]})}function f$(e,t,r,a){return e?QC(e,r):t?QC(t,r):a("model_selector.default_label")}function g$(e,t){if(!e||!Array.isArray(t))return null;for(let r=0;r<t.length;r++){const a=t[r];if(a&&(a.key===e||a.target===e||a.url===e))return a}return null}function QC(e,t){if(!e)return"";const r=g$(e,t);return r?r.builtin?r.key:r.displayName||r.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function p$(e){e.sessionId;var t=e.disabledSkills,r=e.onToggle,a=e.onResetToDefaults,i=e.t,o=e.disabled,l=x.useState(!1),u=l[0],d=l[1],f=x.useState([]),g=f[0],h=f[1],m=x.useState(!1),y=m[0],v=m[1],k=x.useRef(null),_=t instanceof Array?new Set(t):new Set,w=x.useCallback(async function(){v(!0);try{var C=await bv();h(C||[])}catch{}finally{v(!1)}},[]);x.useEffect(function(){w()},[w]),x.useEffect(function(){if(!u)return;function C(j){k.current&&!k.current.contains(j.target)&&d(!1)}return document.addEventListener("mousedown",C),function(){document.removeEventListener("mousedown",C)}},[u]);var S=_.size,E=_.has("agent"),A=E?S-1:S,T=Math.max(0,g.length-A+(E?0:1));return n.jsxs("div",{className:"relative",ref:k,children:[n.jsxs("button",{onClick:function(){d(!u)},disabled:o,className:"p-1.5 rounded-lg transition-colors "+(S>0?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800")+(o?" opacity-50 cursor-not-allowed":""),title:i("skills.toggle_title"),"aria-label":i("skills.toggle_title"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),T>0&&n.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 text-[9px] font-bold flex items-center justify-center bg-primary-500 text-white rounded-full",children:T})]}),u&&n.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 max-h-80 overflow-y-auto",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[n.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:i("skills.toggle_header")}),n.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:i("skills.toggle_hint")})]}),y?n.jsx("div",{className:"flex items-center justify-center py-4",children:n.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):g.length===0?n.jsx("div",{className:"px-3 py-4 text-center",children:n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:i("skills.no_skills")})}):n.jsx("div",{className:"py-1",children:g.map(function(C){var j=_.has(C.name);return n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[n.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:C.name}),n.jsx("button",{onClick:function(){r(C.name,j)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(j?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!j,children:n.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(j?"translate-x-1":"translate-x-5")})})]},C.name)})}),n.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:n.jsx("p",{className:"text-[10px] font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wide",children:i("skills.builtin_tools")})}),n.jsx("div",{className:"py-1",children:n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[n.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:i("skills.agent_comm")}),n.jsx("button",{onClick:function(){r("agent",E)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(E?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!E,children:n.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(E?"translate-x-1":"translate-x-5")})})]})}),a&&n.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:n.jsx("button",{onClick:a,className:"w-full text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 hover:underline transition-colors text-center",children:i("skills.reset_to_defaults")})})]})]})}function h$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875S10.5 3.089 10.5 4.125c0 .369.128.713.349 1.003.215.283.401.604.401.959V6a.75.75 0 01-.75.75H7.5a.75.75 0 00-.75.75v2.25c0 .414-.336.75-.75.75S5.25 10.164 5.25 9.75V9A2.25 2.25 0 003 11.25v.75a.75.75 0 00.75.75h2.25c.414 0 .75.336.75.75s-.336.75-.75.75H3.75a.75.75 0 00-.75.75v.75A2.25 2.25 0 005.25 18h1.5a.75.75 0 01.75.75v.75c0 .414.336.75.75.75h6a.75.75 0 00.75-.75v-.75a.75.75 0 01.75-.75h1.5A2.25 2.25 0 0019.5 15.75v-.75a.75.75 0 00-.75-.75h-2.25a.75.75 0 01-.75-.75c0-.414.336-.75.75-.75h2.25a.75.75 0 00.75-.75v-.75A2.25 2.25 0 0017.25 9h-3a.75.75 0 01-.75-.75V6.087z"})})}function m$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M20 18h-2V9.25L12 13 6 9.25V18H4V6h1.2l6.8 4.25L18.8 6H20m0-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})})}function x$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M7.71 3.5l-5.71 9.94 3.48 6.06h5.44L4.07 8.56 7.71 3.5zm1.42 0L15.84 15h-6.71L2.42 3.5h6.71zm.71 12h11.46l-3.48 6.06H6.36l3.48-6.06zm.71-1L16.84 3.5l5.71 9.94-3.48.06H10.55z"})})}function y$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function b$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})})}function v$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M3 6l3.5 12h2l2.5-8 2.5 8h2L19 6h-2.5l-2.25 8L12 6h-2l-2.25 8L5.5 6H3z"})})}function k$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M5 3a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V5a2 2 0 00-2-2H5zm11.293 6.707l-5.5 5.5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 111.414-1.414L10.086 13.1l4.793-4.793a1 1 0 111.414 1.4z"})})}function _$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function w$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15.5v-5l-3 3v-4l3-3v-3l4 4-4 4v4z"})})}function N$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function S$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})}function E$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M6 2l6 3.75L6 9.5.002 5.75 6 2zm12 0l6 3.75-6 3.75-5.998-3.75L18 2zM.002 13.25L6 9.5l6 3.75L6 17 .002 13.25zm17.998-3.75l6 3.75L18 17l-5.998-3.75L18 9.5zM6 18.25l6-3.75 6 3.75-6 3.75-6-3.75z"})})}function j$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function C$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})})}function T$({className:e,...t}){return n.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}const ZC={gmail:m$,gdrive:x$,discord:y$,whatsapp:b$,wrike:v$,gtasks:k$,mailchimp:_$,bamboohr:w$,pandadoc:N$,exa:S$,dropbox:E$,freshbooks:j$,gcal:C$,docx2md:T$};function R$(e){return Object.prototype.hasOwnProperty.call(ZC,e)?ZC[e]:h$}const JC={gmail:"#EA4335",gdrive:"#4285F4",discord:"#5865F2",whatsapp:"#25D366",wrike:"#08CF65",gtasks:"#4285F4",mailchimp:"#FFE01B",bamboohr:"#73C41D",pandadoc:"#4ABB5A",exa:"#6366F1",dropbox:"#0061FF",freshbooks:"#00B7E3",gcal:"#4285F4",docx2md:"#6B7280"},A$=new Set(["current","available","error","unsupported"]);function I$(e){const t=e||{},r=A$.has(t.status)?t.status:t.error?"error":t.hasUpdate?"available":"current";return{status:r,hasUpdate:r==="available",latestVersion:t.latestVersion||null,currentVersion:t.currentVersion||null,error:t.error||null,repository:t.repository||null}}function M$(e){const t=Object.create(null);return(e||[]).forEach(r=>{!r||!r.name||(t[r.name]=I$(r))}),t}function L$(e){const t={available:0,current:0,error:0,unsupported:0};return Object.values(e||{}).forEach(r=>{r&&Object.prototype.hasOwnProperty.call(t,r.status)&&t[r.status]++}),t}function O$({installed:e,configured:t,t:r}){return e?t?n.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:[n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),r("skills.configured")]}):n.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:[n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),r("skills.needs_setup")]}):n.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:r("skills.not_installed")})}function D$({skill:e,onClose:t,onSaved:r}){var{t:a}=Xt(),i=ru(),[o,l]=x.useState({}),[u,d]=x.useState(!0),[f,g]=x.useState(!1),[h,m]=x.useState(null),[y,v]=x.useState(!1),[k,_]=x.useState(null);x.useEffect(function(){var O=!1;async function I(){try{var B=await g3(e.name);if(O)return;_(B);for(var z=Object.create(null),ee=Object.keys(B.tokens||{}),$=0;$<ee.length;$++){var M=ee[$],G=B.tokens[M]||{},Y=G.env||M;z[Y]=""}l(z),d(!1)}catch(X){O||(m(X.message),d(!1))}}return I(),function(){O=!0}},[e.name]);var w=x.useMemo(function(){if(!k||!k.tokens)return null;if(k.oauth&&k.oauth.broker){var O=!!k.oauth.connected,I=k.oauth.provider||"";return{provider:I?I.charAt(0).toUpperCase()+I.slice(1):"OAuth",brokered:!0,canConnect:!O,refreshConfigured:O,clientIdConfigured:!0,clientSecretConfigured:!0}}for(var B=Object.keys(k.tokens),z=0;z<B.length;z++){var ee=k.tokens[B[z]]||{};if(ee.description&&ee.description.includes("OAuth")){for(var $=null,M=null,G=null,Y=Object.entries(k.tokens),X=0;X<Y.length;X++){var ie=Y[X][0];ie.includes("REFRESH_TOKEN")&&($=ie),(ie.includes("CLIENT_ID")||ie.includes("APP_KEY"))&&(M=ie),(ie.includes("CLIENT_SECRET")||ie.includes("APP_SECRET"))&&(G=ie)}if($&&M){var F=k.tokens[$]&&k.tokens[$].configured,U=k.tokens[M]&&k.tokens[M].configured,Z=G&&k.tokens[G]&&k.tokens[G].configured,P="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?P="Google":e.name==="dropbox"?P="Dropbox":e.name==="freshbooks"&&(P="FreshBooks"),{provider:P,canConnect:U&&Z&&!F,refreshConfigured:F,clientIdConfigured:U,clientSecretConfigured:Z}}}}return null},[k,e.name]),S=x.useCallback(async function(){m(null),v(!0);try{if(w&&w.brokered){let V=function(){L.current&&(clearInterval(L.current),L.current=null)};var O=await _3(e.name),I=600,B=700,z=(window.screen.width-I)/2,ee=(window.screen.height-B)/2,$=window.open(O.authorizeUrl,"oauth_popup","width="+I+",height="+B+",left="+z+",top="+ee+",scrollbars=yes");if(!$){m("Popup blocked. Please allow popups or visit: "+O.authorizeUrl),v(!1);return}var M=O.flowId,G=0,Y=0;L.current=setInterval(async function(){G+=1500;try{var W=await w3(e.name,M);if(W&&W.connected){V();try{$.close()}catch{}v(!1),r();return}}catch(ae){V(),m(ae.message),v(!1);return}if($.closed&&(Y||(Y=G),G-Y>9e3)){V(),v(!1),r();return}G>3e5&&(V(),v(!1),m("Connection timed out. Please try again."))},1500);return}var X=await k3(e.name),ie=600,F=700,U=(window.screen.width-ie)/2,Z=(window.screen.height-F)/2,P=window.open(X.authorizeUrl,"oauth_popup","width="+ie+",height="+F+",left="+U+",top="+Z+",scrollbars=yes");if(P)var K=setInterval(function(){P.closed&&(clearInterval(K),v(!1),r())},500);else m("Popup blocked. Please allow popups or visit: "+X.authorizeUrl),v(!1)}catch(V){m(V.message),v(!1)}},[e.name,r,w]),E=x.useCallback(async function(){m(null),g(!0);try{for(var O=Object.create(null),I=Object.keys(o),B=0;B<I.length;B++){var z=I[B];o[z]&&o[z].trim()&&(O[z]=o[z].trim())}if(Object.keys(O).length===0){m(a("skills.enter_token")),g(!1);return}await x3(e.name,O),r()}catch(ee){m(ee.message)}finally{g(!1)}},[o,e.name,r,a]),A=x.useCallback(async function(){if(await i({title:a("skills.clear_title"),message:a("skills.clear_confirm",{skill:e.name}),destructive:!0})){m(null),g(!0);try{await y3(e.name),r()}catch(O){m(O.message)}finally{g(!1)}}},[e.name,r,i,a]),T=x.useCallback(function(O,I){l(function(B){var z=Object.assign(Object.create(null),B);return z[O]=I,z})},[]),C=k&&!(k.oauth&&k.oauth.broker)?Object.entries(k.tokens||{}).map(function(O){var I=O[0],B=O[1],z=B&&B.env||I;return{name:I,env:z,description:B.description,configured:B.configured,maskedValue:B.maskedValue}}):[],j=x.useRef(null);x.useEffect(function(){function O(I){I.key==="Escape"&&t()}return document.addEventListener("keydown",O),j.current&&j.current.focus(),function(){document.removeEventListener("keydown",O)}},[t]);var L=x.useRef(null);return x.useEffect(function(){return function(){L.current&&(clearInterval(L.current),L.current=null)}},[]),n.jsx("div",{ref:j,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,role:"dialog","aria-modal":"true","aria-label":a("skills.configure_skill",{skill:e.name}),children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(O){O.stopPropagation()},children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("skills.configure_skill",{skill:e.name})}),n.jsx("button",{onClick:t,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":a("skills.close_credential_editor"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),u&&n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!u&&C.length>0&&n.jsx("div",{className:"space-y-3 mb-4",children:C.map(function(O){return n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[O.env,O.configured&&n.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",a("skills.current_value",{value:O.maskedValue}),")"]})]}),O.description&&n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:O.description}),n.jsx("input",{type:"password",placeholder:O.configured?a("skills.leave_blank"):a("skills.enter_value"),value:o[O.env]||"",onChange:function(I){T(O.env,I.target.value)},className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})]},O.env)})}),!u&&w&&n.jsx("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700",children:w.canConnect?n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:a("skills.oauth_connect_hint",{provider:w.provider})}),n.jsx("button",{onClick:S,disabled:y||f,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white font-medium rounded-lg disabled:opacity-50 transition-colors",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),a("skills.oauth_connecting")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),a("skills.oauth_connect",{provider:w.provider})]})})]}):w.refreshConfigured?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),a("skills.oauth_connected",{provider:w.provider})]}),n.jsx("button",{onClick:A,disabled:f,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:a("skills.oauth_disconnect",{provider:w.provider})})]}):n.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:a("skills.oauth_needs_credentials",{provider:w.provider})})}),!u&&!h&&C.length===0&&!w&&n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:a("skills.no_credentials_needed")}),h&&n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:h}),!u&&C.length>0&&n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("button",{onClick:A,disabled:f,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:a("skills.clear_all")}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:t,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg",children:a("skills.cancel")}),n.jsx("button",{onClick:E,disabled:f,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 transition-colors",children:a(f?"skills.saving":"skills.save")})]})]})]})})}function P$({skill:e,installed:t,updateInfo:r,updatingSkill:a,onConfigure:i,onInstall:o,onUpdate:l,onUninstall:u,skillDefaultEnabled:d,onToggleDefault:f,t:g}){var h=R$(e.name),m=Object.prototype.hasOwnProperty.call(JC,e.name)?JC[e.name]:"#6B7280",[y,v]=x.useState(!1),k=a===e.name,_=r&&r.status==="available",w=x.useCallback(async function(){v(!0);try{await o(e)}finally{v(!1)}},[e,o]),S=x.useCallback(function(){l&&l(e.name)},[e.name,l]);return n.jsxs("div",{className:"group relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-md dark:hover:shadow-gray-800/50 transition-all flex flex-col",children:[n.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:m}}),n.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:m+"15"},children:n.jsx(h,{className:"w-5 h-5",style:{color:m}})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),n.jsx(O$,{installed:t,configured:t&&e.allTokensConfigured,t:g}),t&&_&&n.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400",children:[n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"v",r.latestVersion]}),t&&r&&r.status==="current"&&n.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:g("skills.up_to_date")}),t&&r&&r.status==="error"&&n.jsx("span",{title:r.error||"",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",children:g("skills.update_check_failed")}),t&&r&&r.status==="unsupported"&&n.jsx("span",{title:r.error||"",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:g("skills.update_unsupported")})]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||g("skills.no_description")}),e.version&&n.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),n.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:function(){i(e)},className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:g("skills.configure")}),f&&n.jsxs("button",{onClick:function(){f(e.name,!d)},title:g("skills.default_for_new_sessions"),className:"px-2 py-1.5 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 "+(d?"text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/20 hover:bg-primary-100 dark:hover:bg-primary-900/40":"text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800"),children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),g("skills.default")]}),_&&n.jsx("button",{onClick:S,disabled:k,className:"px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:k?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),g("skills.updating")]}):g("skills.update")}),u&&n.jsx("button",{onClick:function(){u(e)},title:g("skills.uninstall"),className:"px-2 py-1.5 text-xs font-medium text-gray-400 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors","aria-label":g("skills.uninstall"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}):n.jsx("button",{onClick:w,disabled:y,className:"flex-1 px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:y?n.jsxs("span",{className:"flex items-center justify-center gap-1",children:[n.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),g("skills.installing")]}):g("skills.install")})})]})}function F$({onBack:e}){var{t}=Xt(),[r,a]=x.useState([]),[i,o]=x.useState([]),[l,u]=x.useState(!0),[d,f]=x.useState(null),[g,h]=x.useState(null),[m,y]=x.useState("all"),[v,k]=x.useState(""),[_,w]=x.useState(!1),[S,E]=x.useState(Object.create(null)),[A,T]=x.useState(null),[C,j]=x.useState(!1),[L,O]=x.useState(Object.create(null)),I=ru(),B=x.useCallback(async function(){u(!0),f(null),j(!1);try{var V=await Promise.allSettled([bv(),f3(),V4()]),W=V[0].status==="fulfilled"?V[0].value:[],ae=V[1].status==="fulfilled"?V[1].value:[],Q=V[2].status==="fulfilled"?V[2].value.skillDefaults||{}:{};a(W),o(ae),O(Q);var he=[];V[0].status==="rejected"&&he.push(t("skills.load_installed_failed",{error:V[0].reason.message})),V[1].status==="rejected"&&he.push(t("skills.load_marketplace_failed",{error:V[1].reason.message})),he.length>0&&f(he.join("; "))}catch(Ne){f(Ne.message)}finally{u(!1)}},[t]);x.useEffect(function(){B()},[B]);var z=[],ee=new Set(r.map(function(V){return V.name}));r.forEach(function(V){z.push(Object.assign({},V,{_installed:!0}))}),i.forEach(function(V){ee.has(V.name)||z.push(Object.assign({},V,{_installed:!1,allTokensConfigured:!1}))});var $=z;if(m==="installed"?$=z.filter(function(V){return V._installed}):m==="available"&&($=z.filter(function(V){return!V._installed})),v){var M=v.toLowerCase();$=$.filter(function(V){return V.name&&V.name.toLowerCase().indexOf(M)!==-1||V.description&&V.description.toLowerCase().indexOf(M)!==-1||V.category&&V.category.toLowerCase().indexOf(M)!==-1})}var G=x.useCallback(async function(V){try{await p3(V.name),B()}catch(W){f(t("skills.install_failed",{error:W.message}))}},[B,t]),Y=x.useCallback(function(V){h(V)},[]),X=x.useCallback(async function(V){if(await I({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:V.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await b3(V.name),B()}catch(W){f(t("skills.uninstall_failed",{error:W.message}))}},[B,I,t]),ie=x.useCallback(function(){h(null),B()},[B]),F=x.useCallback(async function(V,W){O(function(Q){var he=Object.assign({},Q);return W?he[V]=!0:delete he[V],he});try{var ae={};ae[V]=W,await v3(ae)}catch(Q){O(function(he){var Ne=Object.assign({},he);return W?delete Ne[V]:Ne[V]=!0,Ne}),f(Q.message)}},[]),U=x.useCallback(async function(){w(!0),f(null);try{var V=await m3();E(M$(V.skills)),j(!0)}catch(W){f(W.message)}finally{w(!1)}},[]),Z=x.useCallback(async function(V){T(V),f(null);try{var W=await h3(V);W.updated&&(E(function(ae){var Q=Object.assign(Object.create(null),ae);return Q[V]={status:"current",hasUpdate:!1,latestVersion:ae[V]?ae[V].latestVersion:null,currentVersion:ae[V]?ae[V].latestVersion:null,error:null},Q}),B())}catch(ae){f(t("skills.update_failed")+": "+ae.message)}finally{T(null)}},[B,t]),P=L$(S),K=P.available;return n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[n.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:e,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":t("skills.back_to_chat"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:r.length,available:i.filter(function(V){return!ee.has(V.name)}).length})})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:U,disabled:_||l,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:_?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.checking_updates")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.check_updates")]})}),K>0&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded-full",children:t("skills.updates_available",{count:K})}),C&&P.error>0&&!_&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 rounded-full",children:t("skills.update_check_failures",{count:P.error})}),C&&P.unsupported>0&&!_&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 rounded-full",children:t("skills.update_unsupported_count",{count:P.unsupported})}),C&&K===0&&P.error===0&&P.unsupported===0&&!_&&n.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded-full",children:t("skills.no_updates")}),n.jsx("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:["all","installed","available"].map(function(V){return n.jsx("button",{onClick:function(){y(V)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(m===V?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:t("skills.tab_"+V)},V)})})]})]}),n.jsx("div",{className:"flex-shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:n.jsxs("div",{className:"relative",children:[n.jsx("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),n.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:v,onChange:function(V){k(V.target.value)},className:"w-full pl-10 pr-4 py-2 text-sm bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-900 dark:text-gray-100 placeholder-gray-400 outline-none focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500"})]})}),n.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[l&&n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),d&&n.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:d})}),!l&&$.length===0&&n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(v?"skills.no_match":"skills.no_skills")})}),!l&&$.length>0&&n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:$.map(function(V){return n.jsx(P$,{skill:V,installed:V._installed,updateInfo:S[V.name],updatingSkill:A,onConfigure:Y,onInstall:G,onUpdate:Z,onUninstall:V._installed?X:null,skillDefaultEnabled:!!L[V.name],onToggleDefault:V._installed?F:null,t},V.name)})})]}),g&&n.jsx(D$,{skill:g,onClose:function(){h(null)},onSaved:ie})]})}const Fr="";function Br(e,t={}){return fetch(e,{credentials:"include",...t})}async function B$(){const e=await Br(Fr+"/api/agents");if(!e.ok)throw new Error("Failed to fetch agents: "+e.statusText);return e.json()}async function z$(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e));if(!t.ok)throw new Error("Failed to fetch agent: "+t.statusText);return t.json()}async function dv(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/start",{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to start agent")}return t.json()}async function fv(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/stop",{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to stop agent")}return t.json()}async function bf(e,t){const r={};t&&t.clean&&(r.clean=!0);const a=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to restart agent")}return a.json()}async function gv(e,t){const r={};t&&t.level&&(r.level=t.level),t&&t.span&&(r.span=t.span);const a=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/pause",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to pause agent")}return a.json()}async function pv(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/unpause",{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to unpause agent")}return t.json()}async function U$(e,t,r,a){const i={message:t,priority:r};a!=null&&(i.replyToInbox=a);const o=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){const l=await o.json().catch(()=>({}));throw new Error(l.error||"Failed to send message to agent")}return o.json()}async function q$(e,t,r){const a={message:t};r!=null&&(a.replyToInbox=r);const i=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/interrupt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error||"Failed to send urgent interrupt to agent")}return i.json()}async function H$(e,t){let r=Fr+"/api/agents/"+encodeURIComponent(e)+"/messages";t&&t.refresh&&(r+="?refresh=true");const a=await Br(r);if(!a.ok)throw new Error("Failed to fetch agent messages: "+a.statusText);return a.json()}async function $$(){const e=await Br(Fr+"/api/pricing");if(!e.ok)throw new Error("Failed to fetch pricing: "+e.statusText);return e.json()}async function W$(e){const t=await Br(Fr+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to update pricing")}return t.json()}async function V$(){const e=await Br(Fr+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error||"Failed to reset pricing")}return e.json()}async function G$(e,t=!1){const r=Fr+"/api/agents/"+encodeURIComponent(e)+(t?"?force=true":""),a=await Br(r,{method:"DELETE"});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to delete agent")}return a.json()}async function K$(e){const t=await Br(Fr+"/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to create agent")}return t.json()}async function cA(){const e=await Br(Fr+"/api/skills");if(!e.ok)throw new Error("Failed to fetch skills: "+e.statusText);return e.json()}async function kk(){const e=await Br(Fr+"/api/models");if(!e.ok)throw new Error("Failed to fetch models: "+e.statusText);return e.json()}async function Y$(e,t){const r=await Br(Fr+"/api/agents/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to update agent")}return r.json()}async function X$(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/agents-md");if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to fetch AGENTS.md")}return t.json()}async function Q$(e,t){const r=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/agents-md",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to update AGENTS.md")}return r.json()}async function uA(e){const t=await Br(Fr+"/api/agents/"+encodeURIComponent(e)+"/export");if(!t.ok){const u=await t.json().catch(()=>({}));throw new Error(u.error||"Failed to export agent")}const r=await t.text(),a=new Blob([r],{type:"text/yaml"}),i=URL.createObjectURL(a),o=t.headers.get("X-Filename")||e+".agent.yaml",l=document.createElement("a");l.href=i,l.download=o,document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(i),5e3)}async function Z$(e,t){const r=new URLSearchParams,a=r.toString()?"?"+r.toString():"",i=await Br(Fr+"/api/agents/import"+a,{method:"POST",headers:{"Content-Type":"text/yaml"},body:e});if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.error||"Failed to import agent")}return i.json()}async function Nb(){const e=await Br(Fr+"/api/system/updates");if(!e.ok){const t="Failed to check for updates",r=await e.json().catch(()=>({})),a=r.error||r.message||r.output||e.statusText;throw a?a.indexOf(t)===0||a===t?new Error(a):new Error(t+": "+a):new Error(t)}return e.json()}async function J$(){const e=await Br(Fr+"/api/system/update-config");if(!e.ok)throw new Error("Failed to get update config");return e.json()}async function eW(){const e=await Br(Fr+"/api/system/update",{method:"POST"});if(!e.ok){const r="Failed to perform update",a=await e.json().catch(()=>({})),i=a.error||a.message||a.output||e.statusText;throw i?i.indexOf(r)===0||i===r?new Error(i):new Error(r+": "+i):new Error(r)}const t=await e.json();if(t.status!=="success"){let r=t.error||t.message||"";throw t.output&&!t.error&&!t.message?r="Update returned status: "+(t.status||"failed")+(t.output?": "+t.output:""):t.output&&(r+=t.output?" ("+t.output+")":""),r||(r="Update returned unexpected status: "+(t.status||"unknown")),new Error(r)}return t}async function e4(){const e=await Br(Fr+"/api/models/registry");if(!e.ok)throw new Error("Failed to fetch model registry: "+e.statusText);return e.json()}async function t4(e,t){const r=await Br(Fr+"/api/models/registry",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to save model: "+r.statusText)}return r.json()}async function r4(e){const t=await Br(Fr+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r.error||"Failed to delete model: "+t.statusText)}return t.json()}function dA(e){const t=typeof e=="string"?e.split("-"):null;if(t&&t.length===3){const r=Number(t[0]),a=Number(t[1]),i=Number(t[2]);if(!Number.isNaN(r)&&!Number.isNaN(a)&&!Number.isNaN(i))return new Date(r,a-1,i)}return new Date(e)}function tW(e){const t=dA(e),r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return r[t.getDay()]+", "+a[t.getMonth()]+" "+t.getDate()}function Hd(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function rW({data:e}){if(!e||e.length===0)return n.jsx("div",{className:"h-32 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No usage data available"});const t=280,r=120,a={top:10,right:10,bottom:25,left:40},i=t-a.left-a.right,o=r-a.top-a.bottom,l=Math.max(...e.map(m=>(m.input||0)+(m.output||0)+(m.cached||0)),1),u=i/e.length,d=Math.max(8,u*.6),f=(u-d)/2,g=m=>o-m/l*o,h=[0,.25,.5,.75,1].map(m=>Math.round(l*m));return n.jsxs("div",{className:"relative",children:[n.jsxs("svg",{width:"100%",height:r,viewBox:`0 0 ${t} ${r}`,className:"overflow-visible",children:[h.map((m,y)=>{const v=a.top+g(m);return n.jsxs("g",{children:[n.jsx("line",{x1:a.left,y1:v,x2:t-a.right,y2:v,stroke:"currentColor",strokeOpacity:.1,className:"text-gray-400 dark:text-gray-600"}),n.jsx("text",{x:a.left-5,y:v,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Hd(m)})]},y)}),e.map((m,y)=>{const v=a.left+y*u+f,k=m.input||0,_=m.output||0,w=m.cached||0,S=k/l*o,E=_/l*o,A=w/l*o,T=a.top+o-S,C=T-E,j=C-A,L=dA(m.date),O=["S","M","T","W","T","F","S"][L.getDay()];return n.jsxs("g",{className:"group",children:[n.jsx("rect",{x:v-f,y:a.top,width:u,height:o,fill:"transparent",className:"cursor-pointer"}),k>0&&n.jsx("rect",{x:v,y:T,width:d,height:S,rx:2,className:"fill-blue-500 dark:fill-blue-400 transition-opacity group-hover:opacity-80"}),_>0&&n.jsx("rect",{x:v,y:C,width:d,height:E,rx:2,className:"fill-green-500 dark:fill-green-400 transition-opacity group-hover:opacity-80"}),w>0&&n.jsx("rect",{x:v,y:j,width:d,height:A,rx:2,className:"fill-purple-500 dark:fill-purple-400 transition-opacity group-hover:opacity-80"}),n.jsx("text",{x:v+d/2,y:r-5,textAnchor:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:O}),n.jsxs("g",{className:"opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:[n.jsx("rect",{x:v+d/2-45,y:Math.min(j,C,T)-50,width:90,height:45,rx:4,className:"fill-gray-900 dark:fill-gray-100"}),n.jsx("text",{x:v+d/2,y:Math.min(j,C,T)-38,textAnchor:"middle",className:"text-[9px] fill-white dark:fill-gray-900 font-medium",children:tW(m.date)}),n.jsxs("text",{x:v+d/2,y:Math.min(j,C,T)-26,textAnchor:"middle",className:"text-[8px] fill-blue-300 dark:fill-blue-600",children:["In: ",Hd(k)]}),n.jsxs("text",{x:v+d/2,y:Math.min(j,C,T)-16,textAnchor:"middle",className:"text-[8px] fill-green-300 dark:fill-green-600",children:["Out: ",Hd(_)]}),n.jsxs("text",{x:v+d/2,y:Math.min(j,C,T)-6,textAnchor:"middle",className:"text-[8px] fill-purple-300 dark:fill-purple-600",children:["Cache: ",Hd(w)]})]})]},y)})]}),n.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 text-xs",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:"w-2 h-2 rounded-sm bg-blue-500 dark:bg-blue-400"}),n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Input"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:"w-2 h-2 rounded-sm bg-green-500 dark:bg-green-400"}),n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Output"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:"w-2 h-2 rounded-sm bg-purple-500 dark:bg-purple-400"}),n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Cached"})]})]})]})}function nW({agentName:e,onClose:t,onToolPartsChange:r,hackerMode:a}){var{t:i}=Xt(),[o,l]=x.useState([]),[u,d]=x.useState(!0),[f,g]=x.useState(null),[h,m]=x.useState(!1),[y,v]=x.useState(""),[k,_]=x.useState(!0),[w,S]=x.useState(!1),[E,A]=x.useState(!1),[T,C]=x.useState(!1),[j,L]=x.useState(!1),O=x.useRef(null),I=x.useRef(null),B=x.useRef(!0),z=x.useRef([]),ee=x.useRef(null),$=x.useRef(null),M=x.useRef(null),G=x.useRef(null);x.useEffect(function(){z.current=o},[o]);var Y=x.useCallback(async function(W,ae){if(e){ae!==!1&&d(!0);try{var Q=await H$(e,{refresh:!!W}),he=Q.messages||[],Ne=z.current,De=he.length!==Ne.length;if(!De&&he.length>0&&Ne.length>0){var Ve=he[he.length-1],at=Ne[Ne.length-1];if(Ve.info.id!==at.info.id&&(De=!0),!De){var lt=Ve.parts||[],Ce=at.parts||[];if(lt.length!==Ce.length)De=!0;else for(var $e=0;$e<lt.length&&!De;$e++){var Be=lt[$e]||{},gt=Ce[$e]||{},ut=Be.state?Be.state.status:Be.status,jt=gt.state?gt.state.status:gt.status;(Be.id!==gt.id||ut!==jt)&&(De=!0)}}}De&&l(he.slice()),g(null)}catch(Ge){console.error("Failed to load messages:",Ge),g(Ge.message)}finally{ae!==!1&&d(!1)}}},[e]);x.useEffect(function(){Y(!0);var W=setInterval(function(){Y(!0,!1)},5e3);return function(){clearInterval(W),$.current&&clearTimeout($.current),G.current&&clearTimeout(G.current)}},[Y]),x.useEffect(function(){B.current&&O.current&&O.current.scrollIntoView({behavior:"smooth"})},[o]);var X=x.useCallback(function(){var W=I.current;W&&(B.current=W.scrollHeight-W.scrollTop-W.clientHeight<50)},[]),ie=x.useMemo(function(){for(var W=null,ae=o.length-1;ae>=0;ae--)if(o[ae].info&&o[ae].info.role==="assistant"){W=o[ae];break}return W?(W.parts||[]).filter(function(Q){return Q.type==="tool"}):[]},[o]);x.useEffect(function(){r&&r(ie)},[ie,r]);var F=x.useCallback(async function(){if(!(!y.trim()||w)){S(!0),A(!1),C(!1),L(!1),g(null);try{await U$(e,y.trim(),"normal",k),v(""),A(!0),$.current&&clearTimeout($.current),$.current=setTimeout(function(){A(!1),m(!1),$.current=null},1500),G.current&&clearTimeout(G.current),G.current=setTimeout(function(){Y(!0,!1),G.current=null},500)}catch(W){g(W.message)}finally{S(!1)}}},[e,y,k,w,Y]),U=x.useCallback(async function(){if(!(!y.trim()||w)){if(!j){L(!0);return}S(!0),A(!1),C(!0),L(!1),g(null);try{await q$(e,y.trim(),k),v(""),A(!0),$.current&&clearTimeout($.current),$.current=setTimeout(function(){A(!1),m(!1),$.current=null},1500),G.current&&clearTimeout(G.current),G.current=setTimeout(function(){Y(!0,!1),G.current=null},500)}catch(W){g(W.message)}finally{S(!1)}}},[e,y,w,j,k,Y]),Z=x.useCallback(function(){m(!1),L(!1),g(null),$.current&&(clearTimeout($.current),$.current=null),G.current&&(clearTimeout(G.current),G.current=null),A(!1)},[]);x.useEffect(function(){if(!h)return;function W(ae){ae.key==="Escape"&&!w&&Z()}return document.addEventListener("keydown",W),function(){document.removeEventListener("keydown",W)}},[h,Z,w]),x.useEffect(function(){if(!(!h||!M.current)){var W=M.current;W.contains(document.activeElement)||W.focus()}},[h]);var P=x.useCallback(function(W){W.target===W.currentTarget&&!w&&Z()},[Z,w]),K=x.useCallback(function(W){W.key==="Enter"&&!W.shiftKey&&!j&&(W.preventDefault(),F())},[F,j]),V=x.useCallback(function(){},[]);return n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 relative",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:i("agents.back"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Conversation"}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e," - ",o.length," messages"]})]})]}),n.jsx("button",{onClick:function(){B.current=!0,Y(!0),O.current&&O.current.scrollIntoView({behavior:"smooth"})},disabled:u,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",title:i("agents.refresh"),children:n.jsx("svg",{className:`w-4 h-4 ${u?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),f&&n.jsxs("div",{className:"mx-4 mt-3 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:f}),n.jsx("button",{onClick:function(){g(null)},className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),E&&n.jsxs("div",{className:`mx-4 mt-3 px-4 py-2 text-sm rounded-lg flex items-center gap-2 ${T?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:T?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i(T?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")]}),n.jsx("div",{ref:I,onScroll:X,className:"flex-1 overflow-y-auto px-4 py-4",children:u&&o.length===0?n.jsx("div",{className:"flex items-center justify-center h-32",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):o.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-3",children:n.jsx("svg",{className:"w-6 h-6 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i("agent_conversation.no_messages")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:i("agent_conversation.no_messages_hint")})]}):n.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[o.map(function(W){return n.jsx(eR,{message:W.info,parts:W.parts,streamingParts:null,searchQuery:null,matchOffset:-1,matchCount:0,activeMatchIndex:-1,registerMatchRef:V,hackerMode:a,hideThinking:!1},W.info.id)}),n.jsx("div",{ref:O})]})}),n.jsx("div",{className:"absolute bottom-6 right-6",children:n.jsxs("button",{onClick:function(){m(!0),L(!1),g(null)},className:"px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white rounded-full shadow-lg font-medium text-sm transition-colors flex items-center gap-2","aria-label":i("agent_conversation.compose_button"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),i("agent_conversation.compose_button")]})}),h&&n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:P,children:n.jsxs("div",{ref:M,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":"compose-modal-title",className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[n.jsx("h3",{id:"compose-modal-title",className:"text-base font-semibold text-gray-900 dark:text-white",children:i("agent_conversation.modal_title",{name:e})}),n.jsx("button",{onClick:Z,disabled:w,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"+(w?" opacity-50 cursor-not-allowed":""),"aria-label":i("common.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[n.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:k,onChange:function(W){_(W.target.checked)},className:"w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),n.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:i("agent_conversation.reply_to_inbox")})]}),n.jsx("textarea",{ref:ee,value:y,onChange:function(W){v(W.target.value)},onKeyDown:K,placeholder:i("agent_conversation.send_placeholder"),className:"w-full px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 outline-none resize-none text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 focus:border-transparent",rows:4,disabled:w,autoFocus:!0}),E&&n.jsx("p",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:i(T?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")}),f&&n.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:f})]}),n.jsx("div",{className:"px-5 py-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:j?n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 font-medium",children:i("agent_conversation.urgent_warning")}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("button",{onClick:function(){L(!1)},className:"px-3 py-1.5 text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors",children:i("common.cancel")}),n.jsxs("button",{onClick:U,disabled:!y.trim()||w,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed text-xs font-medium transition-colors flex items-center gap-1.5",children:[w&&T?n.jsx("div",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),i("agent_conversation.confirm_interrupt")]})]})]}):n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("button",{onClick:U,disabled:!y.trim()||w,className:"px-3 py-1.5 text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1.5",children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),i("agent_conversation.urgent_interrupt_button")]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:Z,disabled:w,className:"px-4 py-2 text-sm transition-colors"+(w?" text-gray-400 dark:text-gray-600 cursor-not-allowed":" text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"),children:i("common.cancel")}),n.jsxs("button",{onClick:F,disabled:!y.trim()||w,className:"px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed font-medium text-sm transition-colors flex items-center gap-2",children:[w&&!T?n.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})}),i("agent_conversation.send_button")]})]})]})})]})})]})}function aW({isOpen:e,agent:t,onClose:r,onUpdated:a,onDeleted:i}){const{t:o}=Xt(),[l,u]=x.useState(""),[d,f]=x.useState(""),[g,h]=x.useState(""),[m,y]=x.useState(""),[v,k]=x.useState(!1),[_,w]=x.useState([]),[S,E]=x.useState(!1),[A,T]=x.useState(""),[C,j]=x.useState(null),[L,O]=x.useState(!1),[I,B]=x.useState([]),[z,ee]=x.useState([]),[$,M]=x.useState(!1),[G,Y]=x.useState(!0),[X,ie]=x.useState(!1),[F,U]=x.useState(!1),[Z,P]=x.useState(null),[K,V]=x.useState(!1),[W,ae]=x.useState(!1),[Q,he]=x.useState("general"),[Ne,De]=x.useState(!1);x.useEffect(()=>{const Ge={cancelled:!1};if(e&&t&&!Ne){Ve();const we=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";at(Ge,we),De(!0)}return e||(De(!1),k(!1),y(""),Y(!0),ee([])),()=>{Ge.cancelled=!0}},[e,t==null?void 0:t.name]);const Ve=()=>{if(!t)return;u(t.displayName||t.name||""),f(t.cwd||"");const Ge=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";h(Ge),k(!1),y(""),w(Array.isArray(t.skills)?t.skills:[]),E(!!t.skipInitialPrompt)},at=async(Ge,we)=>{M(!0),Y(!0),t!=null&&t.name&&ie(!0);const Ue=[cA(),kk()];t!=null&&t.name&&Ue.push(X$(t.name));const Ae=await Promise.allSettled(Ue);if(Ge.cancelled)return;const[rt,fe,ce]=Ae;if(rt.status==="fulfilled"?B(rt.value):(console.error("Failed to load skills:",rt.reason),B([])),M(!1),fe.status==="fulfilled"){const ve=fe.value;ee(ve);const ye=we;ve.find(it=>it.id===ye)||(k(!0),y(ye),h(ye))}else console.error("Failed to load models:",fe.reason),ee([]);if(Y(!1),t!=null&&t.name&&ce){if(ce.status==="fulfilled"){const ve=ce.value;T(ve.content||""),j(ve.path||null),O(ve.exists||!1)}else console.error("Failed to load AGENTS.md:",ce.reason),T(""),j(null),O(!1);ie(!1)}},lt=Ge=>{w(we=>we.includes(Ge)?we.filter(Ue=>Ue!==Ge):[...we,Ge])},Ce=()=>{_.length===I.length?w([]):w(I.map(Ge=>Ge.name))},$e=async Ge=>{if(Ge&&Ge.preventDefault(),!!(t!=null&&t.name)){P(null),U(!0);try{await Y$(t.name,{displayName:l.trim()||t.name,workspace:d.trim(),model:g,skipInitialPrompt:S,skills:_}),C&&A!==null&&!jt&&await Q$(t.name,A),a&&a(t.name),r()}catch(we){P(we.message)}finally{U(!1)}}},Be=async()=>{if(t!=null&&t.name){ae(!0),P(null);try{await G$(t.name,!0),i&&i(t.name),r()}catch(Ge){P(Ge.message),V(!1)}finally{ae(!1)}}},gt=()=>{!F&&!W&&(P(null),V(!1),he("general"),r())};if(!e||!t)return null;const ut=t.state==="working"||t.state==="idle"||t.state==="starting",jt=d.trim()!==(t.cwd||"");return n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[n.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:gt}),K&&n.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:()=>V(!1)}),n.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-xl shadow-2xl max-w-md w-full p-6",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2",children:"Delete Agent?"}),n.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:["Are you sure you want to delete ",n.jsx("strong",{children:t.displayName||t.name}),"?",ut&&n.jsx("span",{className:"block mt-2 text-yellow-600 dark:text-yellow-400",children:"Warning: This agent is currently running and will be stopped."})]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mb-4",children:"This will remove the agent registration. The workspace directory will not be deleted."}),n.jsxs("div",{className:"flex justify-end gap-3",children:[n.jsx("button",{onClick:()=>V(!1),disabled:W,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:o("common.cancel")}),n.jsx("button",{onClick:Be,disabled:W,className:"px-4 py-2 rounded-lg bg-red-600 hover:bg-red-700 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-2",children:W?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o("common.deleting")]}):o("common.delete")})]})]})]}),n.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:o("agent_edit.title")}),n.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t.name,ut&&n.jsxs("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:["(",o("agent_edit.running_warning"),")"]})]})]}),n.jsx("button",{onClick:gt,disabled:F||W,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-800 px-6",children:[n.jsx("button",{onClick:()=>he("general"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${Q==="general"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:o("agent_edit.tab_general")}),n.jsx("button",{onClick:()=>he("soul"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${Q==="soul"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:o("agent_edit.tab_soul")})]}),n.jsxs("form",{onSubmit:Ge=>Ge.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[Z&&n.jsxs("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:Z}),n.jsx("button",{type:"button",onClick:()=>P(null),className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Q==="general"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[o("agent_edit.name_label"),n.jsx("span",{className:"text-gray-400 font-normal ml-1",children:o("agent_edit.cannot_change")})]}),n.jsx("input",{type:"text",value:t.name,disabled:!0,className:"w-full px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed font-mono"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.display_name_label")}),n.jsx("input",{type:"text",value:l,onChange:Ge=>u(Ge.target.value),placeholder:o("agent_edit.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.working_dir_label")}),ut?n.jsx("div",{className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 font-mono text-sm break-all",children:d||o("agent_edit.not_set")}):n.jsx("input",{type:"text",value:d,onChange:Ge=>f(Ge.target.value),placeholder:o("agent_edit.working_dir_placeholder"),disabled:F||W,className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm disabled:opacity-50"}),ut?n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.stop_to_change")}):d.trim()!==(t.cwd||"")?n.jsx("p",{className:"mt-1 text-xs text-amber-500 dark:text-amber-400",children:o("agent_edit.workspace_move_warning")}):n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.working_dir_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.model_label")}),G?n.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:o("agent_edit.loading_models")}):z.length===0?n.jsx("input",{type:"text",value:g,onChange:Ge=>h(Ge.target.value),placeholder:o("agent_edit.model_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"}):n.jsxs(n.Fragment,{children:[n.jsxs("select",{value:v?"__custom__":g,onChange:Ge=>{Ge.target.value==="__custom__"?(k(!0),g&&g!=="__custom__"&&y(g)):(k(!1),h(Ge.target.value))},className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500",children:[(()=>{const Ge=vk(z);return Object.entries(Ge).map(([we,Ue])=>n.jsx("optgroup",{label:yk[we]||we,children:Ue.map(Ae=>n.jsxs("option",{value:Ae.id,children:[Ae.name,bk(Ae.tier)]},Ae.id))},we))})(),n.jsx("option",{value:"__custom__",children:o("agent_edit.custom_model")})]}),v&&n.jsx("input",{type:"text",value:m,onChange:Ge=>{y(Ge.target.value),h(Ge.target.value)},placeholder:o("agent_edit.custom_model_placeholder"),className:"w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"})]}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o(v?"agent_edit.custom_model_hint":"agent_edit.model_hint")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:o("agent_edit.start_mode")}),n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:S,onChange:Ge=>E(Ge.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:o("agent_edit.dormant_mode")}),n.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:o("agent_edit.dormant_mode_desc")})]})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:o("agent_edit.skills_label")}),n.jsx("button",{type:"button",onClick:Ce,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:_.length===I.length?o("agent_edit.deselect_all"):o("agent_edit.select_all")})]}),n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:$?n.jsx("div",{className:"text-center py-4 text-gray-500",children:o("agent_edit.loading_skills")}):I.length===0?n.jsx("div",{className:"text-center py-4 text-gray-500",children:o("agent_edit.no_skills")}):n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:I.map(Ge=>n.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${_.includes(Ge.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[n.jsx("input",{type:"checkbox",checked:_.includes(Ge.name),onChange:()=>lt(Ge.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),n.jsxs("span",{className:"text-sm truncate",title:Ge.description,children:[Ge.icon&&n.jsx("span",{className:"mr-1",children:Ge.icon}),Ge.name]})]},Ge.name))})}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.skills_selected",{count:_.length})})]})]}),Q==="soul"&&n.jsxs("div",{className:"space-y-4",children:[C&&n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono bg-gray-50 dark:bg-gray-800 rounded px-3 py-2",children:[C,!L&&n.jsx("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:o("agent_edit.will_be_created")})]}),!C&&!d.trim()&&n.jsx("div",{className:"px-4 py-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 text-sm rounded-lg",children:o("agent_edit.no_workspace_warning")}),jt&&n.jsx("div",{className:"px-4 py-3 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm rounded-lg",children:o("agent_edit.workspace_changed_warning")}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("agent_edit.instructions_label")}),n.jsx("textarea",{value:A,onChange:Ge=>T(Ge.target.value),disabled:!C||jt,rows:16,placeholder:o(X?"common.loading":"agent_edit.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none disabled:cursor-not-allowed disabled:opacity-50"}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:o("agent_edit.instructions_hint")})]})]})]}),n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[n.jsxs("button",{type:"button",onClick:()=>V(!0),disabled:F||W,className:"px-4 py-2 rounded-lg text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),o("common.delete")]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{type:"button",onClick:gt,disabled:F||W,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:o("common.cancel")}),n.jsx("button",{type:"button",onClick:$e,disabled:F||W,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:F?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o("agent_edit.saving")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o("agent_edit.save")]})})]})]})]})]})}const n4={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},a4={working:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:n.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:n.jsx("svg",{className:"w-4 h-4 mr-1.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})};function iW({state:e}){const t=n4[e]||n4.stopped,r=a4[e]||a4.stopped;return n.jsxs("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${t}`,children:[r,e]})}function sW(e){if(!e)return"-";const t=Date.now()-e,r=Math.floor(t/1e3);if(r<60)return r+"s";const a=Math.floor(r/60);if(a<60)return a+"m";const i=Math.floor(a/60),o=a%60;if(i<24)return i+"h "+o+"m";const l=Math.floor(i/24),u=i%24;return l+"d "+u+"h"}function Sb({label:e,value:t,max:r,color:a}){const i=r>0?Math.min(100,Math.round(t/r*100)):0;return n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:e}),n.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:t.toLocaleString()})]}),n.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:n.jsx("div",{className:`h-full ${a} transition-all duration-300`,style:{width:i+"%"}})})]})}function xo({label:e,value:t,mono:r}){return n.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 dark:border-gray-800 last:border-0",children:[n.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),n.jsx("span",{className:`text-sm text-gray-900 dark:text-gray-100 ${r?"font-mono":""}`,children:t||"-"})]})}function oW({agent:e,onClose:t,onAction:r,onToolPartsChange:a,hackerMode:i}){const{t:o}=Xt(),[l,u]=x.useState(e),[d,f]=x.useState(null),[g,h]=x.useState(null),[m,y]=x.useState(!1),[v,k]=x.useState(!1),_=x.useCallback(async()=>{if(e!=null&&e.name)try{const L=await z$(e.name);u(L),f(null)}catch(L){console.error("Failed to load agent:",L),f(L.message)}},[e==null?void 0:e.name]);x.useEffect(()=>{_();const L=setInterval(_,5e3);return()=>clearInterval(L)},[_]);const w=x.useCallback(async L=>{h(L),f(null);try{L==="start"?await dv(l.name):L==="stop"?await fv(l.name):L==="restart"?await bf(l.name):L==="cleanRestart"?await bf(l.name,{clean:!0}):L==="pause"?await gv(l.name,{level:"tools"}):L==="unpause"&&await pv(l.name),await _(),r&&r(l.name,L)}catch(O){f(O.message)}finally{h(null)}},[l==null?void 0:l.name,_,r]),S=(l==null?void 0:l.state)==="working"||(l==null?void 0:l.state)==="idle"||(l==null?void 0:l.state)==="starting"||(l==null?void 0:l.state)==="paused",E=(l==null?void 0:l.state)==="paused"||(l==null?void 0:l.paused),A=(l==null?void 0:l.displayName)||(l==null?void 0:l.name)||"Unknown Agent",T=(l==null?void 0:l.tokens)||{input:0,output:0,cached:0,total:0},C=Math.max(T.input,T.output,T.cached,1),j=(l==null?void 0:l.cost)||{input:0,output:0,cached:0,total:0};return m?n.jsx(nW,{agentName:l==null?void 0:l.name,onClose:()=>{y(!1),a&&a(null)},onToolPartsChange:a,hackerMode:i}):n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors flex-shrink-0",title:o("agent_detail.back"),"aria-label":o("agent_detail.back"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",title:A,children:A}),(l==null?void 0:l.displayName)&&l.displayName!==l.name&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:l.name,children:l.name})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>k(!0),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:o("agent_detail.edit_settings"),"aria-label":o("agent_detail.edit_settings"),children:n.jsxs("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),n.jsx(iW,{state:(l==null?void 0:l.state)||"stopped"})]})]}),n.jsx(aW,{isOpen:v,agent:l,onClose:()=>k(!1),onUpdated:L=>{_(),r&&r(L,"updated")},onDeleted:L=>{r&&r(L,"deleted"),t()}}),d&&n.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:d}),n.jsx("button",{onClick:()=>f(null),className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[n.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:S?n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>w("stop"),disabled:g,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:o(g==="stop"?"agents.stopping":"agents.stop")}),E?n.jsx("button",{onClick:()=>w("unpause"),disabled:g,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:o(g==="unpause"?"agents.resuming":"agents.resume")}):n.jsx("button",{onClick:()=>w("pause"),disabled:g,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:o(g==="pause"?"agents.pausing":"agents.pause")}),n.jsx("button",{onClick:()=>w("restart"),disabled:g,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:o(g==="restart"?"agents.restarting":"agents.restart")}),n.jsx("button",{onClick:()=>w("cleanRestart"),disabled:g,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",title:o("agents.clean_restart_tooltip"),children:o(g==="cleanRestart"?"agents.restarting":"agents.clean_restart")})]}):n.jsx("button",{onClick:()=>w("start"),disabled:g,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:o(g==="start"?"agents.starting":"agents.start")})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:o("agent_detail.agent_info")}),n.jsxs("div",{className:"space-y-0",children:[n.jsx(xo,{label:o("agent_detail.model"),value:l==null?void 0:l.model,mono:!0}),n.jsx(xo,{label:o("agent_detail.port"),value:l==null?void 0:l.port,mono:!0}),n.jsx(xo,{label:o("agent_detail.pid"),value:l==null?void 0:l.pid,mono:!0}),n.jsx(xo,{label:o("agent_detail.session_id"),value:l!=null&&l.sessionId?l.sessionId.slice(0,12)+"...":null,mono:!0}),n.jsx(xo,{label:o("agent_detail.uptime"),value:sW(l==null?void 0:l.startedAt)}),n.jsx(xo,{label:o("agent_detail.iteration"),value:l==null?void 0:l.iteration}),n.jsx(xo,{label:o("agent_detail.start_mode"),value:l!=null&&l.skipInitialPrompt?o("agent_detail.start_mode_dormant"):o("agent_detail.start_mode_normal")})]})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:o("agent_detail.token_usage")}),n.jsxs("div",{className:"space-y-3",children:[n.jsx(Sb,{label:o("agent_detail.token_input"),value:T.input,max:C,color:"bg-blue-500"}),n.jsx(Sb,{label:o("agent_detail.token_output"),value:T.output,max:C,color:"bg-green-500"}),n.jsx(Sb,{label:o("agent_detail.token_cached"),value:T.cached,max:C,color:"bg-purple-500"}),n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Total"}),n.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-gray-100",children:T.total.toLocaleString()})]})]})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Estimated Cost"}),n.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Input"}),n.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",j.input.toFixed(4)]})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Output"}),n.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",j.output.toFixed(4)]})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Cached"}),n.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",j.cached.toFixed(4)]})]})]}),n.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:o("agent_detail.total_cost")}),n.jsxs("span",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:["$",j.total.toFixed(4)]})]})]}),(l==null?void 0:l.dailyUsage)&&l.dailyUsage.length>0&&n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[n.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Daily Usage (Last 7 Days)"}),n.jsx(rW,{data:l.dailyUsage})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>y(!0),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),o("agent_detail.view_conversation")]}),n.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>k(!0),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),o("agent_detail.edit_settings")]}),n.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:async()=>{try{await uA(l.name)}catch(L){f(o("agents.export_error")+": "+L.message)}},children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),o("agents.export")]})]}),(l==null?void 0:l.cwd)&&n.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500 break-all",children:[n.jsx("span",{className:"font-medium",children:o("agent_detail.working_dir_label")}),n.jsx("br",{}),n.jsx("span",{className:"font-mono",children:l.cwd})]})]})]})}const $d=["swift","quick","rapid","agile","nimble","clever","smart","wise","bright","keen","bold","brave","calm","steady","noble","silent","shadow","storm","iron","steel","amber","azure","cobalt","crimson","golden","cosmic","cyber","digital","quantum","prime"],Wd=["falcon","hawk","eagle","raven","phoenix","wolf","fox","hound","coyote","tiger","panther","lynx","leopard","bear","orca","shark","viper","cobra","dragon","griffin","sentinel","guardian","titan","node","nexus","core","spark","pulse"];function i4(e=[],t=100){const r=new Set(e.map(l=>l.toLowerCase()));for(let l=0;l<t;l++){const u=$d[Math.floor(Math.random()*$d.length)],d=Wd[Math.floor(Math.random()*Wd.length)],f=`${u}-${d}`;if(!r.has(f))return f}const a=$d[Math.floor(Math.random()*$d.length)],i=Wd[Math.floor(Math.random()*Wd.length)],o=Math.floor(Math.random()*1e3);return`${a}-${i}-${o}`}function s4(e,t=[]){if(!e||typeof e!="string")return{valid:!1,error:"Name is required"};const r=e.trim().toLowerCase();return r.length===0?{valid:!1,error:"Name cannot be empty"}:r.length<2?{valid:!1,error:"Name must be at least 2 characters"}:r.length>50?{valid:!1,error:"Name must be 50 characters or less"}:/^[a-z0-9_-]+$/.test(r)?new Set(t.map(i=>i.toLowerCase())).has(r)?{valid:!1,error:"An agent with this name already exists"}:{valid:!0,error:null}:{valid:!1,error:"Name can only contain lowercase letters, numbers, hyphens, and underscores"}}function lW(e){return e?e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const Vd=`# AGENTS.md - AI Agent Instructions
|
|
106
|
-
|
|
107
|
-
## Overview
|
|
108
|
-
You are an autonomous AI agent. Your goal is to help users accomplish tasks efficiently.
|
|
109
|
-
|
|
110
|
-
## Guidelines
|
|
111
|
-
- Be helpful and accurate
|
|
112
|
-
- Ask for clarification when needed
|
|
113
|
-
- Use available tools appropriately
|
|
114
|
-
- Report progress on long-running tasks
|
|
115
|
-
|
|
116
|
-
## Constraints
|
|
117
|
-
- Do not make changes without user approval for destructive operations
|
|
118
|
-
- Follow security best practices
|
|
119
|
-
- Respect rate limits and resource constraints
|
|
120
|
-
`;function cW({isOpen:e,onClose:t,existingAgentNames:r=[],onCreated:a}){const{t:i}=Xt(),[o,l]=x.useState(""),[u,d]=x.useState(""),[f,g]=x.useState(""),[h,m]=x.useState("github-copilot/claude-opus-4.6"),[y,v]=x.useState(""),[k,_]=x.useState(!1),[w,S]=x.useState(Vd),[E,A]=x.useState([]),[T,C]=x.useState(!1),[j,L]=x.useState([]),[O,I]=x.useState([]),[B,z]=x.useState(!1),[ee,$]=x.useState(!0),[M,G]=x.useState({}),[Y,X]=x.useState(!1),[ie,F]=x.useState(null);x.useEffect(()=>{const Q={cancelled:!1};return e?(l(i4(r)),d(""),g(""),m("github-copilot/claude-opus-4.6"),v(""),_(!1),S(Vd),A([]),C(!1),G({}),X(!1),F(null),U(Q,"github-copilot/claude-opus-4.6")):($(!0),I([])),()=>{Q.cancelled=!0}},[e]);const U=async(Q,he)=>{z(!0),$(!0);const[Ne,De]=await Promise.allSettled([cA(),kk()]);if(!Q.cancelled){if(Ne.status==="fulfilled"?L(Ne.value):(console.error("Failed to load skills:",Ne.reason),L([])),z(!1),De.status==="fulfilled"){const Ve=De.value;I(Ve),Ve.find(at=>at.id===he)||(_(!0),v(he))}else console.error("Failed to load models:",De.reason),I([]);$(!1)}},Z=()=>{const Q=i4(r);l(Q),G(he=>({...he,name:null}))},P=Q=>{const he=Q.target.value;l(he);const Ne=s4(he,r);Ne.valid?G(De=>({...De,name:null})):G(De=>({...De,name:Ne.error}))},K=Q=>{A(he=>he.includes(Q)?he.filter(Ne=>Ne!==Q):[...he,Q])},V=()=>{E.length===j.length?A([]):A(j.map(Q=>Q.name))},W=async Q=>{Q&&Q.preventDefault(),F(null);const he={},Ne=s4(o,r);if(Ne.valid||(he.name=Ne.error),f.trim()||(he.workspace=i("agent_create.validate_workspace")),h||(he.model=i("agent_create.validate_model")),Object.keys(he).length>0){G(he);return}X(!0);try{const De={name:lW(o),displayName:u.trim()||null,workspace:f.trim(),model:h,soul:w.trim()||null,skills:E,skipInitialPrompt:T},Ve=await K$(De);l(""),d(""),g(""),m("github-copilot/claude-opus-4.6"),S(Vd),A([]),C(!1),G({}),a&&a(Ve.agent),t()}catch(De){F(De.message)}finally{X(!1)}},ae=()=>{Y||(G({}),F(null),t())};return e?n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[n.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:ae}),n.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:i("agent_create.title")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i("agent_create.configure_subtitle")})]}),n.jsx("button",{onClick:ae,disabled:Y,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("form",{onSubmit:Q=>Q.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[ie&&n.jsx("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg",children:ie}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.name_label")}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"text",value:o,onChange:P,placeholder:i("agent_create.name_placeholder"),className:`flex-1 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 ${M.name?"border-red-500":"border-gray-200 dark:border-gray-700"}`}),n.jsxs("button",{type:"button",onClick:Z,className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors flex items-center gap-2",title:i("agent_create.name_generate"),"aria-label":i("agent_create.name_generate"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),i("agent_create.random")]})]}),M.name&&n.jsx("p",{className:"mt-1 text-sm text-red-500",children:M.name}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.name_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.display_name_label")}),n.jsx("input",{type:"text",value:u,onChange:Q=>d(Q.target.value),placeholder:i("agent_create.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.display_name_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.working_dir_label")}),n.jsx("input",{type:"text",value:f,onChange:Q=>g(Q.target.value),placeholder:i("agent_create.working_dir_placeholder"),className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border ${M.workspace?"border-red-500":"border-gray-200 dark:border-gray-700"} text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm`}),M.workspace&&n.jsx("p",{className:"mt-1 text-xs text-red-500",children:M.workspace}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.working_dir_hint")})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_create.model_label")}),ee?n.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:i("agent_create.loading_models")}):O.length===0?n.jsx("input",{type:"text",value:h,onChange:Q=>m(Q.target.value),placeholder:i("agent_create.model_placeholder"),className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm ${M.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`}):n.jsxs(n.Fragment,{children:[n.jsxs("select",{value:k?"__custom__":h,onChange:Q=>{Q.target.value==="__custom__"?(_(!0),h&&h!=="__custom__"&&v(h)):(_(!1),m(Q.target.value))},className:`w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500 ${M.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`,children:[(()=>{const Q=vk(O);return Object.entries(Q).map(([Ne,De])=>n.jsx("optgroup",{label:yk[Ne]||Ne,children:De.map(Ve=>n.jsxs("option",{value:Ve.id,children:[Ve.name,bk(Ve.tier)]},Ve.id))},Ne))})(),n.jsx("option",{value:"__custom__",children:i("agent_create.custom_model")})]}),k&&n.jsx("input",{type:"text",value:y,onChange:Q=>{v(Q.target.value),m(Q.target.value)},placeholder:i("agent_create.custom_model_placeholder"),className:`w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm ${M.model?"border-red-500":"border-gray-200 dark:border-gray-700"}`})]}),M.model&&n.jsx("p",{className:"mt-1 text-sm text-red-500",children:M.model}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i(k?"agent_create.custom_model_hint":"agent_create.model_hint")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_create.start_mode")}),n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:T,onChange:Q=>C(Q.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:i("agent_create.dormant_mode")}),n.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:i("agent_create.dormant_mode_desc")})]})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_create.skills_label")}),n.jsx("button",{type:"button",onClick:V,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:E.length===j.length?i("agent_create.deselect_all"):i("agent_create.select_all")})]}),n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:B?n.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_create.loading_skills")}):j.length===0?n.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_create.no_skills")}):n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:j.map(Q=>n.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${E.includes(Q.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[n.jsx("input",{type:"checkbox",checked:E.includes(Q.name),onChange:()=>K(Q.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),n.jsxs("span",{className:"text-sm truncate",title:Q.description,children:[Q.icon&&n.jsx("span",{className:"mr-1",children:Q.icon}),Q.name]})]},Q.name))})}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.skills_selected",{count:E.length})})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[i("agent_create.instructions_label"),n.jsx("span",{className:"text-gray-400 font-normal ml-1",children:i("agent_create.instructions_optional")})]}),n.jsx("button",{type:"button",onClick:()=>S(Vd),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:i("agent_create.reset_default")})]}),n.jsx("textarea",{value:w,onChange:Q=>S(Q.target.value),rows:8,placeholder:i("agent_create.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none"}),n.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_create.instructions_hint")})]})]}),n.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[n.jsx("button",{type:"button",onClick:ae,disabled:Y,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("agent_create.cancel")}),n.jsx("button",{type:"button",onClick:W,disabled:Y||!!M.name,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:Y?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("agent_create.spawning")]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),i("agent_create.spawn")]})})]})]})]}):null}const o4="pave-agents-panel-collapsed",l4={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},c4={working:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1zm4 0a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:n.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:n.jsx("svg",{className:"w-3 h-3 mr-1 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})},uW="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z",dW="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z";function fW({state:e}){const t=l4[e]||l4.stopped,r=c4[e]||c4.stopped;return n.jsxs("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t}`,children:[r,e]})}function gW(e){if(!e)return"-";const t=Date.now()-e,r=Math.floor(t/1e3);if(r<60)return r+"s";const a=Math.floor(r/60);if(a<60)return a+"m";const i=Math.floor(a/60),o=a%60;if(i<24)return i+"h "+o+"m";const l=Math.floor(i/24),u=i%24;return l+"d "+u+"h"}function pW({agent:e,onAction:t,onSelect:r,onExport:a,actionLoading:i,isSelected:o,onToggleSelect:l}){const{t:u}=Xt(),d=e.state==="working"||e.state==="idle"||e.state==="starting"||e.state==="paused",f=e.state==="paused"||e.paused,g=f?"paused":e.state,h=e.displayName||e.name;return n.jsxs("div",{className:"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-4 hover:border-primary-300 dark:hover:border-primary-700 hover:shadow-md transition-all duration-150 cursor-pointer flex flex-col",onClick:()=>r(e),children:[n.jsxs("div",{className:"flex items-start justify-between mb-3",children:[n.jsx("input",{type:"checkbox",checked:o||!1,onChange:m=>{m.stopPropagation(),l&&l(e.name)},onClick:m=>m.stopPropagation(),className:"mt-1 mr-2 h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500 flex-shrink-0","aria-label":u("agents.select")+" "+(e.displayName||e.name)}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",title:h,children:h}),e.displayName&&e.displayName!==e.name&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:e.name,children:e.name})]}),n.jsx(fW,{state:g})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs text-gray-500 dark:text-gray-400 mb-4",children:[n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.uptime"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:gW(e.startedAt)})]}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.iteration"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.iteration||0})]}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.port"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.port||"-"})]}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[u("agents.pid"),":"]})," ",n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:e.pid||"-"})]})]}),n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mb-3 truncate",title:e.model||"",children:e.model?u("agents.model_label",{model:e.model}):" "}),n.jsxs("div",{className:"flex items-center gap-2 pt-3 border-t border-gray-100 dark:border-gray-800 mt-auto flex-wrap",children:[d?n.jsxs(n.Fragment,{children:[f?n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"unpause")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="unpause"?u("agents.resuming"):u("agents.resume")}):n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"pause")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="pause"?u("agents.pausing"):u("agents.pause")}),n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"stop")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="stop"?u("agents.stopping"):u("agents.stop")}),n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"restart")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="restart"?u("agents.restarting"):u("agents.restart")})]}):n.jsx("button",{onClick:m=>{m.stopPropagation(),t(e.name,"start")},disabled:(i==null?void 0:i.name)===e.name,className:"min-w-[80px] px-3 py-1.5 text-xs font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:(i==null?void 0:i.name)===e.name&&(i==null?void 0:i.action)==="start"?u("agents.starting"):u("agents.start")}),n.jsx("button",{onClick:m=>{m.stopPropagation(),a(e.name)},className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:u("agents.export"),"aria-label":u("agents.export"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),n.jsx("button",{type:"button",onClick:m=>{m.stopPropagation(),r(e)},className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:u("agents.view_details"),"aria-label":u("agents.view_details"),children:n.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:uW}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:dW})]})})]})]})}function hW({agents:e,totalCost:t}){const r=e.filter(i=>i.state==="working"||i.state==="idle").length,a=e.reduce((i,o)=>{var l;return i+(((l=o.tokens)==null?void 0:l.total)||0)},0);return n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 px-6 py-3",children:n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),n.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:["Active: ",n.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:[r,"/",e.length]})]})]}),n.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:["Total Tokens: ",n.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:a.toLocaleString()})]})]}),n.jsxs("div",{className:"text-gray-600 dark:text-gray-400",children:["Est. Cost: ",n.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:["$",t.toFixed(4)]})]})]})})}function mW({onBack:e,onSelectAgent:t,initialAgentName:r,onInitialAgentConsumed:a,hackerMode:i,matrixMode:o,darkMode:l,onToggleMatrix:u,terminalWidth:d,onTerminalWidthChange:f,terminalMinWidth:g,terminalMaxWidth:h}){const{t:m}=Xt(),[y,v]=x.useState([]),[k,_]=x.useState(!0),[w,S]=x.useState(!1),[E,A]=x.useState(null),[T,C]=x.useState(null),[j,L]=x.useState(null),[O,I]=x.useState(null),[B,z]=x.useState(!1),[ee,$]=x.useState(new Set),[M,G]=x.useState(null),[Y,X]=x.useState(()=>{if(typeof window>"u")return!1;try{return localStorage.getItem(o4)==="true"}catch{return!1}}),ie=x.useMemo(()=>Array.isArray(M)?M.length===0?M:!i&&M.every(ve=>ve.state&&ve.state.status==="completed"||ve.state&&ve.state.status==="error")?[]:M:null,[M,i]),F=x.useRef(null),U=x.useRef(!0);x.useEffect(()=>()=>{U.current=!1,P.current&&clearTimeout(P.current)},[]),x.useEffect(()=>{if(!(typeof window>"u"))try{localStorage.setItem(o4,Y?"true":"false")}catch{}},[Y]);const Z=x.useRef(!1),P=x.useRef(null),K=x.useCallback(async ce=>{if(F.current)return ce?(Z.current=!0,F.current.then(()=>F.current||Promise.resolve())):F.current;const ve=(async()=>{let ye=!1;try{const it=await B$();if(!U.current)return ye;const qe=Array.isArray(it)?it:[];v(qe),I(Ye=>Ye&&(qe.find(ht=>ht.name===Ye.name)||null)),C(null),ye=!0}catch(it){if(!U.current)return ye;console.error("Failed to load agents:",it),C(it.message)}finally{U.current&&_(!1),F.current=null,Z.current&&U.current&&(Z.current=!1,K())}return ye})();return F.current=ve,ve},[]),V=x.useCallback(async()=>{if(!U.current)return;S(!0),A(null),P.current&&(clearTimeout(P.current),P.current=null);let ce=!1;try{const[ve]=await Promise.all([K(!0),new Promise(ye=>{setTimeout(ye,400)})]);ce=ve===!0}catch{ce=!1}finally{U.current&&(S(!1),A(ce?"success":"error"),P.current=setTimeout(()=>{U.current&&A(null),P.current=null},1e3))}},[K]);x.useEffect(()=>{K();const ce=setInterval(K,5e3);return()=>clearInterval(ce)},[K]),x.useEffect(()=>{if(!r||y.length===0)return;const ce=y.find(ve=>ve.name===r);ce&&(I(ce),G(null),t&&t(ce),a&&a())},[r,y,t,a]);const W=x.useCallback(async(ce,ve)=>{L({name:ce,action:ve}),C(null);try{ve==="start"?await dv(ce):ve==="stop"?await fv(ce):ve==="restart"?await bf(ce):ve==="pause"?await gv(ce,{level:"iterations"}):ve==="unpause"&&await pv(ce),await K(!0)}catch(ye){C(ye.message)}finally{L(null)}},[K]),ae=y.reduce((ce,ve)=>{var ye;return ce+(((ye=ve.cost)==null?void 0:ye.total)||0)},0),Q=x.useCallback(ce=>{I(ce),G(null),t&&t(ce)},[t]),he=x.useCallback(()=>{I(null),G(null)},[]),Ne=x.useCallback(ce=>{$(ve=>{const ye=new Set(ve);return ye.has(ce)?ye.delete(ce):ye.add(ce),ye})},[]),De=x.useCallback(()=>{$(new Set(y.map(ce=>ce.name)))},[y]),Ve=x.useCallback(()=>{$(new Set)},[]),at=x.useCallback(async ce=>{var ye;if(ee.size===0)return;C(null);const ve=[...ee];try{const qe=(await Promise.allSettled(ve.map(async Ye=>{ce==="pause"?await gv(Ye,{level:"iterations"}):ce==="unpause"?await pv(Ye):ce==="stop"?await fv(Ye):ce==="restart"?await bf(Ye):ce==="start"&&await dv(Ye)}))).filter(Ye=>Ye.status==="rejected");qe.length>0&&C(((ye=qe[0].reason)==null?void 0:ye.message)||"Some actions failed"),await K(!0)}catch(it){C(it.message)}},[ee,K]),lt=x.useCallback(()=>{K(!0)},[K]),Ce=x.useCallback(ce=>{K(!0),ce&&I(ce)},[K]),[$e,Be]=x.useState(!1),[gt,ut]=x.useState(null),jt=x.useRef(null);x.useEffect(()=>()=>{jt.current&&clearTimeout(jt.current)},[]);const Ge=x.useCallback(async ce=>{try{await uA(ce)}catch(ve){C(m("agents.export_error")+": "+ve.message)}},[m]),we=x.useCallback(async ce=>{try{ut(null),await Z$(ce),ut({type:"success",message:m("agents.import_success")}),K(!0),jt.current&&clearTimeout(jt.current),jt.current=setTimeout(()=>{ut(ve=>ve&&ve.type==="success"?null:ve),jt.current=null},5e3)}catch(ve){ut({type:"error",message:m("agents.import_error")+": "+ve.message})}},[m,K]),Ue=x.useCallback(()=>{const ce=document.createElement("input");ce.type="file",ce.accept=".yaml,.yml",ce.onchange=ve=>{const ye=ve&&ve.target&&ve.target.files,it=ye&&ye[0];if(!it)return;const qe=it.name.toLowerCase();if(!qe.endsWith(".yaml")&&!qe.endsWith(".yml")){ut({type:"error",message:m("agents.import_invalid_file")});return}if(it.size>10*1024*1024){ut({type:"error",message:m("agents.import_file_too_large")});return}const Ye=new FileReader;Ye.onload=yt=>{const ht=yt&&yt.target?yt.target.result:null;typeof ht=="string"&&we(ht)},Ye.onerror=()=>{ut({type:"error",message:m("agents.import_read_error")})},Ye.readAsText(it)},ce.click()},[m,we]),Ae=x.useCallback(ce=>{ce.preventDefault(),ce.stopPropagation(),Be(!0)},[]),rt=x.useCallback(ce=>{ce.preventDefault(),ce.stopPropagation();const ve=ce.relatedTarget;(!ve||!ce.currentTarget.contains(ve))&&Be(!1)},[]),fe=x.useCallback(ce=>{ce.preventDefault(),ce.stopPropagation(),Be(!1);const ve=ce.dataTransfer&&ce.dataTransfer.files,ye=ve&&ve[0];if(!ye)return;const it=ye.name.toLowerCase();if(!it.endsWith(".yaml")&&!it.endsWith(".yml")){ut({type:"error",message:m("agents.import_invalid_file")});return}if(ye.size>10*1024*1024){ut({type:"error",message:m("agents.import_file_too_large")});return}const qe=new FileReader;qe.onload=Ye=>{const yt=Ye&&Ye.target?Ye.target.result:null;typeof yt=="string"&&we(yt)},qe.onerror=()=>{ut({type:"error",message:m("agents.import_read_error")})},qe.readAsText(ye)},[m,we]);return O?n.jsxs("div",{className:"h-full flex",children:[n.jsxs("div",{className:`${Y?"w-12":"w-80"} transition-all duration-200 border-r border-gray-200 dark:border-gray-800 flex flex-col bg-gray-50 dark:bg-gray-950`,children:[n.jsxs("div",{className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 dark:border-gray-800",children:[Y?null:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:e,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:m("agents.back_to_chat"),"aria-label":m("agents.back_to_chat"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:m("agents.title")})]}),n.jsx("button",{onClick:()=>X(ce=>!ce),className:`p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors ${Y?"mx-auto":""}`,title:m(Y?"agents.expand_panel":"agents.collapse_panel"),"aria-label":m(Y?"agents.expand_panel":"agents.collapse_panel"),"aria-expanded":!Y,"aria-controls":"agents-panel-content",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:Y?"M8.25 4.5l7.5 7.5-7.5 7.5":"M15.75 19.5L8.25 12l7.5-7.5"})})}),Y?null:n.jsx("button",{onClick:V,disabled:k||w,className:`p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50 ${E==="success"?"text-green-500":E==="error"?"text-red-500":"text-gray-400"}`,title:m("agents.refresh"),"aria-label":m("agents.refresh"),children:n.jsx("svg",{className:`w-4 h-4 ${w?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),n.jsx("div",{id:"agents-panel-content",className:"flex-1 overflow-y-auto p-2",children:Y?n.jsx("div",{className:"py-2 flex flex-col items-center gap-1.5",children:y.map(ce=>{const ve=ce.name===O.name,ye=ce.state==="working"||ce.state==="idle";return n.jsx("button",{onClick:()=>Q(ce),className:"p-0.5 rounded-full",title:ce.displayName||ce.name,"aria-label":ce.displayName||ce.name,children:n.jsx("div",{className:`w-3 h-3 rounded-full ${ve?"ring-2 ring-primary-500 bg-primary-400":ye?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`})},ce.name)})}):n.jsx("div",{className:"space-y-1",children:y.map(ce=>{const ve=ce.name===O.name,ye=ce.state==="working"||ce.state==="idle";return n.jsx("button",{onClick:()=>Q(ce),className:`w-full text-left px-3 py-2 rounded-lg transition-colors ${ve?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${ye?"bg-green-500":"bg-gray-400 dark:bg-gray-600"}`}),n.jsx("span",{className:"text-sm font-medium truncate",children:ce.displayName||ce.name})]})},ce.name)})})})]}),n.jsx("div",{className:"flex-1 overflow-hidden",children:n.jsx(oW,{agent:O,onClose:he,onAction:lt,onToolPartsChange:G,hackerMode:i})}),Array.isArray(ie)&&n.jsxs("aside",{style:{width:d},className:`border-l hidden lg:flex flex-col relative bg-gray-50 dark:bg-gray-900 ${i?l?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":m("agents.resize_terminal"),"aria-valuemin":g,"aria-valuemax":h,"aria-valuenow":d,className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize z-10 ${i?l?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}`,onMouseDown:ce=>{ce.preventDefault();const ve=ce.clientX,ye=d,it=Ye=>{const yt=ve-Ye.clientX,ht=Math.min(h,Math.max(g,ye+yt));f&&f(ht)},qe=()=>{document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",qe)};document.addEventListener("mousemove",it),document.addEventListener("mouseup",qe)}}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:i?n.jsx(iR,{toolParts:ie,matrixMode:o,onToggleMatrix:u,darkMode:l}):n.jsx(nR,{toolParts:ie})})]})]}):n.jsxs("div",{className:"h-full flex flex-col relative",onDragOver:Ae,onDragLeave:rt,onDrop:fe,children:[$e&&n.jsx("div",{className:"absolute inset-0 z-50 bg-primary-500/10 border-2 border-dashed border-primary-500 rounded-xl flex items-center justify-center pointer-events-none",children:n.jsx("div",{className:"bg-white dark:bg-gray-900 px-6 py-4 rounded-lg shadow-lg text-primary-600 dark:text-primary-400 font-medium",children:m("agents.drop_to_import")})}),n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("button",{onClick:e,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:m("agents.back_to_chat"),"aria-label":m("agents.back_to_chat"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:m("agents.title")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:m("agents.subtitle")})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:V,disabled:k||w,className:`p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50 ${E==="success"?"text-green-500":E==="error"?"text-red-500":"text-gray-500 dark:text-gray-400"}`,title:m("agents.refresh"),"aria-label":m("agents.refresh"),children:n.jsx("svg",{className:`w-4 h-4 ${w?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),n.jsxs("button",{onClick:Ue,className:"px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 font-medium text-sm transition-colors flex items-center gap-2",title:m("agents.import_button"),"aria-label":m("agents.import_button"),children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),m("agents.import_button")]}),n.jsxs("button",{onClick:()=>z(!0),className:"px-4 py-2 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),m("agents.spawn_button")]})]})]}),y.length>0&&n.jsx(hW,{agents:y,totalCost:ae}),T&&n.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[n.jsx("span",{children:T}),n.jsx("button",{onClick:()=>C(null),className:"ml-2 text-red-400 hover:text-red-600",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),gt&&n.jsxs("div",{className:`mx-6 mt-4 px-4 py-2 text-sm rounded-lg flex items-center justify-between ${gt.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:[n.jsx("span",{children:gt.message}),n.jsx("button",{onClick:()=>ut(null),"aria-label":m("common.close")||"Close",title:m("common.close")||"Close",className:`ml-2 ${gt.type==="success"?"text-green-400 hover:text-green-600":"text-red-400 hover:text-red-600"}`,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:k&&y.length===0?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):y.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center",children:[n.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-4",children:n.jsx("svg",{className:"w-8 h-8 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-1",children:m("agents.no_agents_title")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:m("agents.no_agents_desc")}),n.jsxs("button",{onClick:()=>z(!0),className:"px-4 py-2 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),m("agents.spawn_button")]}),n.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-4",children:["Or run ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded",children:"pave agent --daemon"})," in a project directory"]})]}):n.jsxs(n.Fragment,{children:[ee.size>0&&n.jsxs("div",{className:"mb-4 px-4 py-2.5 bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-800 rounded-lg flex items-center gap-3 flex-wrap",children:[n.jsx("span",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:m("agents.selected",{count:ee.size})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>at("pause"),className:"px-3 py-1 text-xs font-medium rounded-md bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 transition-colors",children:m("agents.pauseAll")}),n.jsx("button",{onClick:()=>at("unpause"),className:"px-3 py-1 text-xs font-medium rounded-md bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 transition-colors",children:m("agents.unpauseAll")}),n.jsx("button",{onClick:()=>at("stop"),className:"px-3 py-1 text-xs font-medium rounded-md bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800/40 transition-colors",children:m("agents.stopAll")}),n.jsx("button",{onClick:()=>at("restart"),className:"px-3 py-1 text-xs font-medium rounded-md bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800/40 transition-colors",children:m("agents.restartAll")}),n.jsx("button",{onClick:()=>at("start"),className:"px-3 py-1 text-xs font-medium rounded-md bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 transition-colors",children:m("agents.startAll")})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[n.jsx("button",{onClick:De,className:"px-2 py-1 text-xs text-primary-600 dark:text-primary-400 hover:underline",children:m("agents.selectAll")}),n.jsx("button",{onClick:Ve,className:"px-2 py-1 text-xs text-gray-500 dark:text-gray-400 hover:underline",children:m("agents.deselectAll")})]})]}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(ce=>n.jsx(pW,{agent:ce,onAction:W,onSelect:Q,onExport:Ge,actionLoading:j,isSelected:ee.has(ce.name),onToggleSelect:Ne},ce.name))})]})}),n.jsx(cW,{isOpen:B,onClose:()=>z(!1),existingAgentNames:y.map(ce=>ce.name),onCreated:Ce})]})}var hv=20;function _k(e){if(!e)return"";try{var t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()}catch{return String(e)}}function xW(e){var t={},r=[],a={};return(e||[]).forEach(function(i){i.parentId&&!a[i.parentId]?r.push(i):i.parentId?(t[i.parentId]=t[i.parentId]||[]).push(i):r.push(i),a[i.id]=!0}),{topLevel:r,childrenByParent:t}}function fA({post:e,childrenByParent:t,depth:r,onDelete:a,t:i}){var o=t[e.id]||[];return n.jsxs("div",{className:r>0?"ml-4 pl-3 border-l border-gray-200 dark:border-gray-700":"",children:[n.jsxs("div",{className:"py-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[n.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.author}),n.jsx("span",{children:_k(e.createdAt)}),!e.deleted&&a&&n.jsx("button",{type:"button",onClick:function(){a(e.id)},className:"ml-auto text-gray-400 hover:text-red-500 transition-colors",title:i("board.delete_post"),"aria-label":i("board.delete_post"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}),e.deleted?n.jsx("p",{className:"mt-1 text-sm text-gray-400 dark:text-gray-500 italic",children:i("board.post_deleted")}):n.jsx("p",{className:"mt-1 text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap break-words",children:e.content})]}),o.map(function(l){return n.jsx(fA,{post:l,childrenByParent:t,depth:r+1,onDelete:a,t:i},l.id)})]})}function yW({detail:e,searchQuery:t,onSearchQueryChange:r,onSearch:a,onClearSearch:i,hasSearchResults:o,onDeleteTopic:l,onBack:u,onCloseTopic:d,t:f}){return n.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:e?d:u,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":f(e?"board.back_to_topics":"board.back_to_chat"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e?e.topic.title:f("board.title")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e?f("board.post_count",{count:(e.posts||[]).length}):f("board.read_only_hint")})]})]}),!e&&n.jsxs("form",{onSubmit:a,className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:function(g){r(g.target.value)},placeholder:f("board.search_placeholder"),className:"w-48 sm:w-64 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500"}),n.jsx("button",{type:"submit",className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:f("board.search")}),o&&n.jsx("button",{type:"button",onClick:i,className:"px-3 py-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:f("board.clear_search")})]}),e&&n.jsxs("button",{type:"button",onClick:function(){l(e.topic.id)},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),f("board.delete_topic")]})]})}function bW({detail:e,onDeletePost:t,t:r}){var a=xW(e.posts);return n.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[n.jsxs("div",{className:"pb-3 mb-2 border-b border-gray-200 dark:border-gray-800 text-xs text-gray-500 dark:text-gray-400 flex items-center gap-2",children:[n.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.topic.author}),n.jsx("span",{children:_k(e.topic.createdAt)}),e.topic.category&&n.jsx("span",{className:"px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:e.topic.category})]}),a.topLevel.length===0?n.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:r("board.no_posts")}):a.topLevel.map(function(i){return n.jsx(fA,{post:i,childrenByParent:a.childrenByParent,depth:0,onDelete:t,t:r},i.id)})]})}function vW({searchResults:e,onOpenTopic:t,t:r}){return n.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:r("board.search_results",{count:e.total})}),(e.matches||[]).length===0?n.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:r("board.no_matches")}):e.matches.map(function(a,i){return n.jsxs("button",{type:"button",onClick:function(){t(a.topicId)},className:"w-full text-left px-3 py-2 mb-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:a.topicTitle}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:a.snippet})]},(a.postId||a.topicId)+":"+i)})]})}function kW({topics:e,offset:t,total:r,onOpenTopic:a,onPage:i,t:o}){var l=t-hv,u=t+hv,d=t>0,f=u<r;return n.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[e.length===0?n.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:o("board.no_topics")}):e.map(function(g){return n.jsxs("button",{type:"button",onClick:function(){a(g.id)},className:"w-full text-left px-3 py-2.5 mb-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:g.title}),g.category&&n.jsx("span",{className:"flex-shrink-0 px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 text-xs",children:g.category})]}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:[g.author," · ",_k(g.createdAt)," ·"," ",o("board.post_count",{count:g.postCount})]})]},g.id)}),(d||f)&&n.jsxs("div",{className:"flex items-center justify-between mt-4",children:[n.jsx("button",{type:"button",disabled:!d,onClick:function(){i(l)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.prev_page")}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("board.page_info",{from:t+1,to:Math.min(u,r),total:r})}),n.jsx("button",{type:"button",disabled:!f,onClick:function(){i(u)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.next_page")})]})]})}function _W({onBack:e}){var{t}=Xt(),[r,a]=x.useState([]),[i,o]=x.useState(0),[l,u]=x.useState(0),[d,f]=x.useState(!0),[g,h]=x.useState(null),[m,y]=x.useState(null),[v,k]=x.useState(""),[_,w]=x.useState(null),S=x.useCallback(async function(I){f(!0),h(null);try{var B=await V3({limit:hv,offset:I});a(B.topics||[]),o(B.total||0)}catch(z){h(z.message)}finally{f(!1)}},[]);x.useEffect(function(){S(0)},[S]);var E=x.useCallback(async function(I){f(!0),h(null),w(null);try{var B=await C_(I);y(B)}catch(z){h(z.message)}finally{f(!1)}},[]),A=x.useCallback(function(){y(null),S(l)},[S,l]),T=x.useCallback(async function(I){h(null);try{await K3(I),y(null),S(l)}catch(B){h(B.message)}},[S,l]),C=x.useCallback(async function(I){if(m){h(null);try{await Y3(m.topic.id,I);var B=await C_(m.topic.id);y(B)}catch(z){h(z.message)}}},[m]),j=x.useCallback(async function(I){I.preventDefault();var B=v.trim();if(!B){w(null);return}f(!0),h(null);try{var z=await G3(B);w(z)}catch(ee){h(ee.message)}finally{f(!1)}},[v]),L=x.useCallback(function(){k(""),w(null)},[]),O=x.useCallback(function(I){u(I),S(I)},[S]);return n.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[n.jsx(yW,{detail:m,searchQuery:v,onSearchQueryChange:k,onSearch:j,onClearSearch:L,hasSearchResults:!!_,onDeleteTopic:T,onBack:e,onCloseTopic:A,t}),n.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[g&&n.jsx("div",{className:"mx-6 mt-4 px-3 py-2 text-sm text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded-lg",children:g}),d?n.jsx("div",{className:"flex items-center justify-center py-16",children:n.jsx("svg",{className:"w-6 h-6 animate-spin text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}):m?n.jsx(bW,{detail:m,onDeletePost:C,t}):_?n.jsx(vW,{searchResults:_,onOpenTopic:E,t}):n.jsx(kW,{topics:r,offset:l,total:i,onOpenTopic:E,onPage:O,t})]})]})}var wW=["__proto__","constructor","prototype"];function Eb(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function NW(e){return{displayName:e.displayName||"",spec:e.url||e.target||"",limit:e.limit?{context:e.limit.context||128e3,output:e.limit.output||8192}:{context:128e3,output:8192},cost:e.cost?{input:e.cost.input||0,output:e.cost.output||0}:{input:0,output:0}}}function gA(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function u4(e){var t={limit:e.limit,cost:e.cost};e.displayName&&String(e.displayName).trim()!==""&&(t.displayName=String(e.displayName).trim());var r=e.spec?String(e.spec).trim():"";if(r){var a=gA(r);t[a]=r}return t}function d4(e){var t=e.name,r=e.config,a=e.setName,i=e.setConfig,o=e.onSave,l=e.onCancel,u=e.saving,d=e.isNew,f=e.t;function g(_){i(function(w){return Object.assign({},w,_)})}function h(_){i(function(w){return Object.assign({},w,{limit:Object.assign({},w.limit||{},_)})})}function m(_){i(function(w){return Object.assign({},w,{cost:Object.assign({},w.cost||{},_)})})}var y="w-full px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",v="text-xs text-gray-500 dark:text-gray-400 block mb-0.5",k=gA(r.spec);return n.jsxs("div",{className:"p-3 rounded border border-primary-300 dark:border-primary-700 bg-primary-50/50 dark:bg-primary-900/20 space-y-2",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsxs("div",{className:"col-span-2",children:[n.jsx("label",{className:v,children:f("settings.model_registry.name")}),n.jsx("input",{type:"text",value:t,onChange:function(_){a(_.target.value)},className:y+" font-mono",placeholder:f("settings.model_registry.name_placeholder"),autoFocus:d})]}),n.jsxs("div",{className:"col-span-2",children:[n.jsxs("label",{className:v,children:[f("settings.model_registry.spec"),k&&n.jsx("span",{className:"ml-2 text-[10px] px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300 uppercase tracking-wide",children:k==="url"?"URL":f("settings.model_registry.kind_alias")})]}),n.jsx("input",{type:"text",value:r.spec||"",onChange:function(_){g({spec:_.target.value})},className:y+" font-mono",placeholder:f("settings.model_registry.spec_placeholder")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:f("settings.model_registry.spec_hint")})]}),n.jsxs("div",{className:"col-span-2",children:[n.jsx("label",{className:v,children:f("settings.model_registry.displayName")}),n.jsx("input",{type:"text",value:r.displayName||"",onChange:function(_){g({displayName:_.target.value})},className:y,placeholder:f("settings.model_registry.displayName_placeholder")})]}),n.jsxs("details",{className:"col-span-2",children:[n.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-600 dark:text-gray-300 select-none",children:f("settings.model_registry.advanced")}),n.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.limit_context")}),n.jsx("input",{type:"number",value:r.limit?r.limit.context:128e3,onChange:function(_){h({context:parseInt(_.target.value,10)||128e3})},className:y})]}),n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.limit_output")}),n.jsx("input",{type:"number",value:r.limit?r.limit.output:8192,onChange:function(_){h({output:parseInt(_.target.value,10)||8192})},className:y})]}),n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.cost_input")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:r.cost?r.cost.input:0,onChange:function(_){m({input:parseFloat(_.target.value)||0})},className:y})]}),n.jsxs("div",{children:[n.jsx("label",{className:v,children:f("settings.model_registry.cost_output")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:r.cost?r.cost.output:0,onChange:function(_){m({output:parseFloat(_.target.value)||0})},className:y})]})]})]})]}),n.jsxs("div",{className:"flex gap-2 pt-1",children:[n.jsx("button",{type:"button",onClick:o,disabled:u||!t||!t.trim(),className:"px-3 py-1 text-xs font-medium rounded bg-primary-600 text-white hover:bg-primary-700 disabled:opacity-50 transition-colors",children:f(u?d?"settings.model_registry.adding":"settings.model_registry.saving":d?"settings.model_registry.add":"settings.model_registry.save")}),n.jsx("button",{type:"button",onClick:l,disabled:u,className:"px-3 py-1 text-xs font-medium rounded bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 disabled:opacity-50 transition-colors",children:f("settings.model_registry.cancel")})]})]})}function SW({value:e,onChange:t,t:r}){const[a,i]=x.useState(null),[o,l]=x.useState(!0),[u,d]=x.useState(null),[f,g]=x.useState(!1),[h,m]=x.useState(""),[y,v]=x.useState(Eb()),[k,_]=x.useState(null),[w,S]=x.useState(!1),[E,A]=x.useState(null);x.useEffect(function(){var $=!1;return l(!0),e4().then(function(M){$||(i(M),l(!1))}).catch(function(M){$||(d(M.message),l(!1))}),function(){$=!0}},[]);var T=x.useCallback(function(){l(!0),d(null),e4().then(function($){i($),l(!1)}).catch(function($){d($.message),l(!1)})},[]);function C($,M,G){var Y=($||"").trim();return Y?wW.indexOf(Y)!==-1?r("settings.model_registry.error_name_reserved",{name:Y}):Y!==G&&M.indexOf(Y)!==-1?r("settings.model_registry.error_name_exists",{name:Y}):null:r("settings.model_registry.error_name_required")}var j=x.useCallback(async function(){if(a){var $=Object.keys(a.user||{}).concat(Object.keys(a.builtin||{})),M=C(h,$,null);if(M){A(M);return}S(!0),A(null);try{await t4(h.trim(),u4(y)),g(!1),m(""),v(Eb()),T(),t&&t(e)}catch(G){A(G.message)}finally{S(!1)}}},[h,y,a,t,e,T]),L=x.useCallback(async function($){S(!0),A(null);try{await r4($),T(),t&&t(e)}catch(M){A(M.message)}finally{S(!1)}},[t,e,T]),O=x.useCallback(async function(){if(!(!k||!a)){var $=Object.keys(a.user||{}).concat(Object.keys(a.builtin||{})),M=C(k.name,$,k.originalName);if(M){A(M);return}S(!0),A(null);try{var G=k.name.trim(),Y=u4(k.config);if(await t4(G,Y),G!==k.originalName)try{await r4(k.originalName)}catch(X){A(r("settings.model_registry.error_rename_cleanup",{error:X.message}))}_(null),T(),t&&t(e)}catch(X){A(X.message)}finally{S(!1)}}},[k,a,t,e,T]);if(o)return n.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 py-2",children:[n.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary-600"}),r("settings.model_registry.loading")]});if(u)return n.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 py-2",children:r("settings.model_registry.load_error",{error:u})});var I=a&&a.user?a.user:{},B=a&&a.builtin?a.builtin:{},z=Object.keys(I),ee=Object.keys(B);return n.jsxs("div",{className:"space-y-3",children:[E&&n.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded px-2 py-1",children:E}),ee.length>0&&n.jsxs("div",{children:[n.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2",children:r("settings.model_registry.builtin")}),n.jsx("div",{className:"space-y-1",children:ee.map(function($){var M=B[$];return n.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-gray-50 dark:bg-gray-800/50 text-sm",children:[n.jsx("span",{className:"font-mono font-medium text-gray-900 dark:text-gray-100",children:$}),M.provider&&n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:M.provider}),M.limit&&M.limit.context&&n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("settings.model_registry.context_k",{value:M.limit.context/1e3})}),M.tier&&n.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300",children:M.tier})]},$)})})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:r("settings.model_registry.user")}),!f&&!k&&n.jsx("button",{type:"button",onClick:function(){g(!0),m(""),v(Eb()),A(null)},className:"text-xs px-2 py-1 rounded bg-primary-50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-900/50 transition-colors",children:r("settings.model_registry.add_model")})]}),z.length===0&&!f&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:r("settings.model_registry.no_user_models")}),n.jsxs("div",{className:"space-y-2",children:[z.map(function($){var M=I[$];return k&&k.originalName===$?n.jsx(d4,{name:k.name,config:k.config,setName:function(G){_(function(Y){return Y&&Object.assign({},Y,{name:G})})},setConfig:function(G){_(function(Y){if(!Y)return Y;var X=typeof G=="function"?G(Y.config):G;return Object.assign({},Y,{config:X})})},onSave:O,onCancel:function(){_(null),A(null)},saving:w,isNew:!1,t:r},$):n.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"font-mono text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:$}),M.displayName&&M.displayName!==$&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",M.displayName,")"]}),M.url&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",M.url]}),!M.url&&M.target&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",M.target]}),M.limit&&M.limit.context&&n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("settings.model_registry.context_k",{value:M.limit.context/1e3})})]}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsx("button",{type:"button",onClick:function(){_({originalName:$,name:$,config:NW(M)}),g(!1),A(null)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",title:r("settings.model_registry.edit"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),n.jsx("button",{type:"button",onClick:function(){window.confirm(r("settings.model_registry.delete_confirm",{name:$}))&&L($)},disabled:w,className:"p-1 rounded hover:bg-red-100 dark:hover:bg-red-900/30 text-gray-400 hover:text-red-600 dark:hover:text-red-400 transition-colors",title:r("settings.model_registry.delete"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},$)}),f&&n.jsx(d4,{name:h,config:y,setName:m,setConfig:function($){v(function(M){return typeof $=="function"?$(M):$})},onSave:j,onCancel:function(){g(!1),A(null)},saving:w,isNew:!0,t:r})]})]})]})}function EW({setting:e,value:t,onChange:r,error:a,models:i,t:o}){const[l,u]=x.useState(!1),d=e.source==="env",f="block w-full rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(a?"border-red-300 dark:border-red-600 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500")+(d?" opacity-60 cursor-not-allowed":"")+" text-gray-900 dark:text-gray-100",g=e.type==="model-select"&&i&&i.length>0&&t&&!i.find(function(m){return m.id===t});if(x.useEffect(function(){e.type!=="model-select"||!i||i.length===0||t&&i.find(function(m){return m.id===t})&&u(!1)},[t,i,e.type]),e.type==="model-select"){if(!i||i.length===0)return n.jsxs("div",{children:[n.jsx("input",{type:"text",value:t,onChange:function(v){r(v.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.custom_model_placeholder"),className:f}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});const m=l||g,y=vk(i);return n.jsxs("div",{children:[n.jsxs("select",{value:m?"__custom__":t,onChange:function(v){v.target.value==="__custom__"?u(!0):(u(!1),r(v.target.value))},disabled:d,className:f,children:[Object.entries(y).map(function(v){var k=v[0],_=v[1];return n.jsx("optgroup",{label:yk[k]||k,children:_.map(function(w){return n.jsxs("option",{value:w.id,children:[w.name,bk(w.tier)]},w.id)})},k)}),n.jsx("option",{value:"__custom__",children:o("settings.custom_model")})]}),m&&n.jsx("input",{type:"text",value:t,onChange:function(v){r(v.target.value)},disabled:d,placeholder:o("settings.custom_model_placeholder"),className:f+" mt-2 font-mono"}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]})}if(e.type==="boolean"){const m=typeof t=="string"?t.toLowerCase():String(t),y=m==="true"||m==="1";return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{type:"button",role:"switch","aria-checked":y,"aria-label":e.label,disabled:d,onClick:function(){r(y?"false":"true")},className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(y?"bg-primary-600":"bg-gray-200 dark:bg-gray-600")+(d?" opacity-50 cursor-not-allowed":""),children:n.jsx("span",{"aria-hidden":"true",className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(y?"translate-x-5":"translate-x-0")})}),n.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(y?"settings.enabled":"settings.disabled")})]}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]})}if(e.type==="select")return n.jsxs("div",{children:[n.jsx("select",{value:t,onChange:function(m){r(m.target.value)},disabled:d,className:f,children:(e.options||[]).map(function(m){var y=e.optionLabels&&e.optionLabels[m]||m;return n.jsx("option",{value:m,children:y},m)})}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});if(e.type==="number")return n.jsxs("div",{children:[n.jsx("input",{type:"number",value:t,onChange:function(m){r(m.target.value)},disabled:d,min:e.min,max:e.max,placeholder:e.defaultValue||o("settings.not_set"),className:f}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});if(e.type==="textarea")return n.jsxs("div",{children:[n.jsx("textarea",{value:t,onChange:function(m){r(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f+" resize-y min-h-[80px]",rows:4}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});if(e.type==="object")return n.jsxs("div",{children:[n.jsx(SW,{value:t,onChange:r,t:o}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]});const h=e.type==="password"?"password":"text";return n.jsxs("div",{children:[n.jsx("input",{type:h,value:t,onChange:function(m){r(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f,autoComplete:e.type==="password"?"off":void 0}),a&&n.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:a})]})}let vi=null;function pA(){if(vi&&vi.state==="closed"&&(vi=null),!vi){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{vi=new e}catch(t){throw vi=null,t}}return vi.state==="suspended"&&vi.resume().catch(()=>{}),vi}if(typeof document<"u"){const e=async()=>{let t;try{t=pA()}catch{return}if(!t){document.removeEventListener("click",e),document.removeEventListener("keydown",e);return}if(t.state==="suspended"){try{await t.resume()}catch{return}if(t.state!=="running")return}t.state==="running"&&(document.removeEventListener("click",e),document.removeEventListener("keydown",e)),t.state==="closed"&&(vi=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function hA(){let e;try{e=pA()}catch{return}if(e)try{const t=e.currentTime,r=e.createOscillator(),a=e.createGain();r.type="sine",r.frequency.value=800,a.gain.setValueAtTime(.3,t),a.gain.exponentialRampToValueAtTime(.01,t+.1),r.connect(a),a.connect(e.destination),r.start(t),r.stop(t+.1);const i=e.createOscillator(),o=e.createGain();i.type="sine",i.frequency.value=1e3,o.gain.setValueAtTime(.3,t+.1),o.gain.exponentialRampToValueAtTime(.01,t+.2),i.connect(o),o.connect(e.destination),i.start(t+.1),i.stop(t+.2)}catch{e&&e.state!=="closed"&&e.close().catch(()=>{}),vi=null}}function mA(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function jW(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const xA="pave-native-notifications";function hu(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function CW(){return hu()?Notification.permission:"unsupported"}function eu(){if(!hu()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(xA)==="true"}catch{return!1}}function TW(e){try{localStorage.setItem(xA,e?"true":"false")}catch{}}async function RW(){if(!hu())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function yA({title:e,body:t,tag:r,icon:a,onClick:i}){if(!hu()||Notification.permission!=="granted"||!eu())return null;try{const o=new Notification(e,{body:t||"",tag:r||"pave-"+Date.now(),icon:a||"/pave-logo-light.png",silent:!1});return typeof i=="function"&&(o.onclick=function(){i(),o.close()}),setTimeout(()=>{try{o.close()}catch{}},8e3),o}catch{return null}}const bA="pave-push-notifications",AW="/sw.js";function Qf(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function IW(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function MW(){try{return localStorage.getItem(bA)==="true"}catch{return!1}}function vf(e){try{localStorage.setItem(bA,e?"true":"false")}catch{}}function jb(){return typeof Notification>"u"?"unsupported":Notification.permission}async function LW(){if(!Qf())return null;try{return await navigator.serviceWorker.register(AW,{scope:"/"})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function OW(){if(!Qf())return console.warn("[web-push] Not supported in this browser"),!1;const e=await LW();if(!e)return!1;if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted")return console.warn("[web-push] Notification permission denied"),!1;let t;try{const a=await fetch("/api/push/vapid-public-key",{credentials:"include"});if(!a.ok)throw new Error("Failed to get VAPID key");const i=await a.json();t=UW(i.publicKey)}catch(a){return console.error("[web-push] Failed to get VAPID key:",a.message),!1}let r=await e.pushManager.getSubscription();if(r){let a=!0;if(r.options&&r.options.applicationServerKey){const i=new Uint8Array(r.options.applicationServerKey);a=zW(i,t)}if(a)return await f4(r),vf(!0),!0;console.log("[web-push] VAPID key changed, re-subscribing...");try{await r.unsubscribe()}catch{}}try{r=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t})}catch(a){return console.error("[web-push] Push subscription failed:",a.message),!1}return await f4(r),vf(!0),console.log("[web-push] Subscribed successfully:",r.endpoint),!0}async function DW(){if(!Qf())return!1;try{const e=await navigator.serviceWorker.getRegistration();if(e){const t=await e.pushManager.getSubscription();t&&(await fetch("/api/push/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({endpoint:t.endpoint})}).catch(()=>{}),await t.unsubscribe())}return vf(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),vf(!1),!1}}async function f4(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:g4(e.getKey("p256dh")),auth:g4(e.getKey("auth"))}},await fetch("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function PW(){const e=await fetch("/api/push/test",{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function FW(e){if(typeof document>"u"||typeof window>"u")return;function t(r){const a=typeof e=="function"?e():null,i=JSON.stringify({visible:r,activeSessionId:a});try{if(navigator.sendBeacon){const o=new Blob([i],{type:"application/json"});navigator.sendBeacon("/api/visibility",o);return}fetch("/api/visibility",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:i}).catch(()=>{})}catch{}}document.addEventListener("visibilitychange",()=>{t(document.visibilityState==="visible")}),window.addEventListener("blur",()=>{t(!1)}),window.addEventListener("focus",()=>{t(!0)}),t(document.visibilityState==="visible")}function BW(e,t){if(typeof document>"u")return;const r=JSON.stringify({visible:e,activeSessionId:t});try{if(navigator.sendBeacon){const a=new Blob([r],{type:"application/json"});navigator.sendBeacon("/api/visibility",a);return}fetch("/api/visibility",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:r}).catch(()=>{})}catch{}}function zW(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function UW(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4),a=atob(t+r),i=new Uint8Array(a.length);for(let o=0;o<a.length;o++)i[o]=a.charCodeAt(o);return i}function g4(e){if(!e)return"";const t=new Uint8Array(e);let r="";for(let a=0;a<t.length;a++)r+=String.fromCharCode(t[a]);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const mu="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900";function wk({t:e}){return n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:e("settings.auto_saved")})}function Zf({id:e,label:t,description:r,hints:a,checked:i,onToggle:o,disabled:l,supported:u=!0,unsupportedText:d="",divided:f=!1}){return n.jsxs("div",{className:"flex items-center justify-between"+(f?" mt-4 pt-4 border-t border-gray-200 dark:border-gray-700":""),children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:r}),a]}),u?n.jsx("button",{id:e,type:"button",role:"switch","aria-checked":i,onClick:o,disabled:l,className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:opacity-50 "+(i?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:n.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(i?"translate-x-5":"translate-x-0")})}):n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:d})]})}function qW(){const{t:e,locale:t,setLocale:r,availableLocales:a}=Xt();return n.jsxs("div",{className:mu,children:[n.jsx("label",{htmlFor:"settings-language",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:e("settings.language")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:e("settings.language_description")}),n.jsx("select",{id:"settings-language",value:t,onChange:function(i){r(i.target.value)},className:"block w-full rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500 text-gray-900 dark:text-gray-100",children:a.map(function(i){return n.jsxs("option",{value:i.code,children:[i.nativeName," (",i.name,")"]},i.code)})}),n.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:e("settings.language_auto_applied")})]})}function HW(){const{t:e}=Xt(),[t,r]=x.useState(()=>mA()),a=x.useCallback(function(){const i=!t;r(i),jW(i),i&&hA()},[t]);return n.jsxs("div",{className:mu,children:[n.jsx(Zf,{id:"settings-notification-sound",label:e("settings.notification_sound"),description:e("settings.notification_sound_desc"),hints:n.jsx(wk,{t:e}),checked:t,onToggle:a}),n.jsx($W,{}),n.jsx(WW,{})]})}function $W(){const{t:e}=Xt(),[t]=x.useState(()=>hu()),[r,a]=x.useState(()=>CW()),[i,o]=x.useState(()=>eu()),l=x.useCallback(async function(){if(!t)return;if(!i&&Notification.permission!=="granted"){const d=await RW();if(a(d),d!=="granted")return}const u=!i;o(u),TW(u)},[i,t]);return n.jsx(Zf,{id:"settings-native-notifications",divided:!0,label:e("settings.native_notifications"),description:e("settings.native_notifications_desc"),hints:n.jsxs(n.Fragment,{children:[r==="denied"&&n.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:e("settings.native_notifications_blocked")}),r==="default"&&n.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:e("settings.native_notifications_permission")}),n.jsx(wk,{t:e})]}),checked:i,onToggle:l,supported:t,unsupportedText:e("settings.native_notifications_unsupported")})}function WW(){const[e]=x.useState(()=>Qf()),[t,r]=x.useState(()=>MW()),[a,i]=x.useState(()=>jb()),[o,l]=x.useState(!1),u=x.useCallback(async function(){if(!(!e||o)){l(!0);try{t?(await DW(),r(!1)):(await OW()&&r(!0),i(jb()))}catch(f){console.error("[settings] Web push toggle failed:",f.message)}finally{l(!1)}}},[t,e,o]),d=x.useCallback(async function(){if(!o){l(!0);try{const f=await PW();f.sent>0?alert("Test push sent! Check your device."):f.failed>0?alert("Push delivery failed ("+f.failed+" failed). Check server logs — the subscription may need to be renewed."):alert("No active push subscriptions. Make sure you enabled push and your device is registered.")}catch(f){alert("Test push failed: "+f.message)}finally{l(!1)}}},[o]);return n.jsx(Zf,{id:"settings-web-push",divided:!0,label:"Push Notifications (PWA)",description:"Server-delivered push when you switch away from the app. Works on iOS Safari (installed to Home Screen) and desktop browsers.",hints:n.jsxs(n.Fragment,{children:[e&&!IW()&&n.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:"Add to Home Screen / Dock for background push on iOS."}),a==="denied"&&n.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:"Notifications blocked by browser — enable in browser settings."}),t&&n.jsx("button",{type:"button",onClick:d,disabled:o,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline mt-1 disabled:opacity-50",children:o?"Sending...":"Send test notification"})]}),checked:t,onToggle:u,disabled:o,supported:e,unsupportedText:"Not supported in this browser"})}function VW({mobileFrameless:e,onMobileFramelessChange:t}){const{t:r}=Xt();return n.jsx("div",{className:mu,children:n.jsx(Zf,{id:"settings-mobile-frameless",label:r("settings.mobile_frameless"),description:r("settings.mobile_frameless_desc"),hints:n.jsx(wk,{t:r}),checked:e,onToggle:()=>t(!e)})})}function GW({activeSessionId:e}){const{t}=Xt(),[r,a]=x.useState(()=>_l()||""),[i,o]=x.useState(()=>_l()||""),[l,u]=x.useState(""),[d,f]=x.useState(null),[g,h]=x.useState(!1),[m,y]=x.useState(null);x.useEffect(function(){Pb().then(function(w){u(w.home||"")}).catch(function(){})},[]);const v=x.useCallback(function(w){a(w),f(null),y(null)},[]),k=x.useCallback(async function(){const w=r.trim();if(!w){if(xp(null),o(""),a(""),f(null),y({type:"success",message:t("settings.working_dir_reset")}),e)try{await Qa(e,{directory:null})}catch(E){console.warn("[settings] failed to clear session directory:",E.message)}return}h(!0),f(null);const S=_l();try{xp(w);const E=await Pb();if(o(w),a(w),y({type:"success",message:t("settings.working_dir_updated",{path:E.cwd})}),e)try{await Qa(e,{directory:w})}catch(A){console.warn("[settings] failed to update session directory:",A.message)}}catch(E){xp(S),a(i),f(t("settings.working_dir_invalid",{error:E.message}))}finally{h(!1)}},[r,i,e,t]),_=r!==i;return n.jsxs("div",{className:mu,children:[n.jsx("label",{htmlFor:"settings-working-dir",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("settings.working_dir")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("settings.working_dir_desc")}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{id:"settings-working-dir",type:"text",value:r,onChange:function(w){v(w.target.value)},placeholder:l||"~ (home directory)",className:"flex-1 block rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 "+(d?"border-red-300 dark:border-red-600 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500")+" text-gray-900 dark:text-gray-100"}),n.jsx("button",{onClick:k,disabled:g||!_,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors whitespace-nowrap "+(_&&!g?"bg-primary-600 text-white hover:bg-primary-700":"bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed"),children:t(g?"settings.validating":"settings.apply")})]}),d&&n.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:d}),m&&n.jsx("p",{className:"mt-2 text-xs "+(m.type==="success"?"text-green-600 dark:text-green-400":m.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400"),children:m.message}),i&&n.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:t("settings.currently_set_to",{path:i})})]})}function KW(){const{t:e}=Xt(),[t,r]=x.useState("checking"),[a,i]=x.useState(null),[o,l]=x.useState(null),[u,d]=x.useState(null),f=x.useCallback(function(m){i(m.currentVersion),l(m.latestVersion),m.error?(d(m.error),r("check-error")):m.updateAvailable?r("update-available"):r("no-updates")},[]),g=x.useCallback(async function(){r("checking"),d(null);try{const m=await Nb();f(m)}catch(m){d(m.message),r("check-error")}},[f]),h=x.useCallback(async function(){r("updating"),d(null);try{await eW(),r("success");try{const m=await Nb();i(m.currentVersion),l(m.latestVersion)}catch{}}catch(m){d(m.message),r("error")}},[]);return x.useEffect(function(){var m=!1;return r("checking"),(async function(){try{const v=await Nb();m||f(v)}catch(v){m||(d(v&&v.message?v.message:String(v)),r("check-error"))}})(),function(){m=!0}},[f]),n.jsx("div",{className:mu,children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.current_version")}),n.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:a||"--"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.latest_version")}),n.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:t==="checking"?e("settings.checking_updates"):o||"--"})]}),n.jsx(YW,{t:e,updateStatus:t,updateError:u,latestVersion:o}),n.jsx(XW,{t:e,updateStatus:t,onCheckUpdates:g,onPerformUpdate:h})]})})}function YW({t:e,updateStatus:t,updateError:r,latestVersion:a}){return n.jsxs(n.Fragment,{children:[t==="update-available"&&n.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[e("settings.update_available")," (",a,")"]}),t==="no-updates"&&n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e("settings.no_updates")}),t==="success"&&n.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:e("settings.update_success")}),t==="check-error"&&r&&n.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.check_updates_failed"),": ",r]}),t==="error"&&r&&n.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.update_failed"),": ",r]})]})}function XW({t:e,updateStatus:t,onCheckUpdates:r,onPerformUpdate:a}){const i=t==="idle"||t==="no-updates"||t==="error"||t==="check-error"||t==="success";return n.jsxs("div",{className:"flex gap-2 pt-1",children:[i&&n.jsx("button",{onClick:r,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors",children:e("settings.check_updates")}),t==="update-available"&&n.jsx("button",{onClick:a,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-green-600 text-white hover:bg-green-700 transition-colors",children:e("settings.update_button")}),t==="updating"&&n.jsx("button",{disabled:!0,"aria-disabled":"true",className:"px-3 py-1.5 text-sm font-medium rounded-md bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed",children:e("settings.update_in_progress")}),t==="checking"&&n.jsx("button",{disabled:!0,"aria-disabled":"true",className:"px-3 py-1.5 text-sm font-medium rounded-md bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed",children:e("settings.checking_updates")})]})}function mv(e){const t={};for(let r=0;r<e.length;r++)t[e[r].key]=e[r].value;return t}function QW(e,t){const r={};for(let a=0;a<e.length;a++){const i=e[a];i.source!=="env"&&t[i.key]!==i.value&&(r[i.key]=t[i.key])}return r}function ZW(e,t,r){const a=mv(e);for(let i=0;i<r.length;i++)t[r[i]]!==void 0&&(a[r[i]]=t[r[i]]);return a}function JW(e){const t={};for(let r=0;r<e.length;r++){const a=e[r].category;t[a]||(t[a]=[]),t[a].push(e[r])}return t}function eV(e,t){const r=[];for(let i=0;i<t.length;i++)e[t[i]]&&r.push(t[i]);const a=Object.keys(e);for(let i=0;i<a.length;i++)r.indexOf(a[i])<0&&r.push(a[i]);return r}const tV=["AI Model & Provider","Prefill Fallback","Models","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","WhatsApp","Experimental Features","Developer"],kf={"AI Model & Provider":"settings.category.model","Prefill Fallback":"settings.category.prefillFallback",Models:"settings.category.models",Compaction:"settings.category.compaction","Tool Execution":"settings.category.tools","Rate Limiting":"settings.category.rate","Session Behavior":"settings.category.sessionBehavior",Display:"settings.category.display","Session Banner":"settings.category.sessionBanner",Marketplace:"settings.category.marketplace","System Prompts":"settings.category.systemPrompts",WhatsApp:"settings.category.whatsapp","Experimental Features":"settings.category.experimental",Developer:"settings.category.developer"};function rV(){const{t:e}=Xt(),[t,r]=x.useState([]),[a,i]=x.useState({}),[o,l]=x.useState({}),[u,d]=x.useState(!0),[f,g]=x.useState(!1),[h,m]=x.useState(null),[y,v]=x.useState(null),k=x.useCallback(async()=>{try{d(!0),v(null);const C=(await Fb()).settings||[];r(C),i(mv(C)),l({}),m(null)}catch(T){v(T.message)}finally{d(!1)}},[]),_=x.useCallback((T,C)=>{i(j=>{const L={...j};return L[T]=C,L}),l(j=>{if(!j[T])return j;const{[T]:L,...O}=j;return O}),m(null)},[]),w=QW(t,a),S=Object.keys(w).length,E=x.useCallback(async()=>{g(!0),m(null);try{if(S===0){m({type:"info",message:e("settings.no_changes")});return}const T=await T3(w),C=Object.keys(T.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(w)}}))}catch{}if(C.length>0?(l(T.errors),m({type:"warning",message:e("settings.partial_save")})):(l({}),m({type:"success",message:e("settings.saved")})),T.settings){const j=T.settings;r(j),i(L=>ZW(j,L,C))}}catch(T){m({type:"error",message:e("settings.save_failed",{error:T.message})})}finally{g(!1)}},[w,S,e]),A=x.useCallback(()=>{i(mv(t)),l({}),m(null)},[t]);return{settings:t,formValues:a,errors:o,loading:u,saving:f,saveResult:h,setSaveResult:m,loadError:y,updates:w,changedCount:S,loadSettings:k,handleChange:_,handleSave:E,handleReset:A}}function nV(){return n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})})}function aV({t:e,loadError:t,onRetry:r}){return n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[n.jsx("p",{className:"text-red-600 dark:text-red-400",children:e("settings.failed_to_load",{error:t})}),n.jsx("button",{onClick:r,className:"px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700",children:e("common.retry")})]})}const vA="__dlp__",kA="__pricing__",_A="__chat_language__",wA="__chat_notifications__",NA="__chat_appearance__",SA="__chat_workspace__",EA="__chat_version__",p4={[_A]:qW,[wA]:HW,[NA]:VW,[SA]:GW,[EA]:KW};function iV(e,t){return t?e.filter(function(r){return(r.key||"").toLowerCase().indexOf(t)>=0||(r.label||"").toLowerCase().indexOf(t)>=0||(r.description||"").toLowerCase().indexOf(t)>=0}):null}function sV(e){const t={};if(!e)return t;for(let r=0;r<e.length;r++){const a=e[r].category;t[a]=(t[a]||0)+1}return t}function oV({t:e,search:t,onSearchChange:r,onBack:a}){return n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[n.jsx("button",{onClick:a,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:e("settings.back"),"aria-label":e("settings.back"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e("settings.title")}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:e("settings.v2.badge")})]}),n.jsxs("div",{className:"flex-1 max-w-md ml-auto relative",children:[n.jsx("svg",{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-gray-500 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35M17 10.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})}),n.jsx("input",{id:"settings-v2-search",type:"text",value:t,onChange:function(i){r(i.target.value)},placeholder:e("settings.v2.search_placeholder"),"aria-label":e("settings.v2.search_placeholder"),className:"block w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900 pl-9 pr-8 py-1.5 text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"}),t&&n.jsx("button",{type:"button",onClick:function(){r("")},title:e("settings.v2.search_clear"),"aria-label":e("settings.v2.search_clear"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function lV({t:e,groups:t,activeGroup:r,matchCounts:a,searching:i,onSelect:o}){return n.jsx("nav",{"aria-label":e("settings.v2.groups_aria"),className:"w-52 flex-shrink-0 border-r border-gray-200 dark:border-gray-700 overflow-y-auto py-2","data-testid":"settings-v2-groups",children:t.map(function(l){const u=!i&&l.id===r,d=i?a[l.id]:l.kind==="registry"?l.count:null,f=!i||a[l.id];return n.jsxs("button",{type:"button",onClick:function(){o(l.id)},"aria-current":u?"page":void 0,className:"w-full flex items-center justify-between gap-2 px-3 py-2 text-left text-sm transition-colors "+(u?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 font-medium border-r-2 border-primary-600":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800/60"),children:[n.jsx("span",{className:"truncate",children:l.label}),f&&d!=null&&n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums flex-shrink-0",children:d})]},l.id)})})}function cV({setting:e,formValue:t,error:r,models:a,t:i,onChange:o}){const l=e.source==="env";return n.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900","data-setting-key":e.key,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.label}),l&&n.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 whitespace-nowrap",title:i("settings.env_override",{envVar:e.envVar}),children:i("settings.source_env")})]}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 break-words",children:[e.description,e.requiresRestart&&n.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:i("settings.requires_restart")}),e.source==="env"&&n.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:i("settings.env_override",{envVar:e.envVar})}),n.jsx("span",{className:"block mt-0.5 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:e.key})]}),n.jsx(EW,{setting:e,value:t!==void 0?t:"",onChange:o,error:r,models:a,t:i}),e.source!=="default"&&e.defaultValue!==void 0&&e.type!=="object"&&n.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:i("settings.default_prefix",{value:e.defaultValue===""?i("settings.default_empty"):String(e.defaultValue)})})]})}function h4({title:e,description:t,actionLabel:r,onOpen:a}){return n.jsxs("div",{className:"p-6 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:e}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:t}),n.jsx("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors",children:r})]})}function uV({t:e,changedCount:t,saving:r,saveResult:a,onSave:i,onReset:o}){const l=a?a.type==="success"?"text-green-600 dark:text-green-400":a.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400":"";return n.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 px-6 py-3 flex items-center gap-3 bg-gray-50 dark:bg-gray-900/60",children:[n.jsx("span",{className:"text-xs "+(t>0?"text-amber-600 dark:text-amber-400 font-medium":"text-gray-400 dark:text-gray-500"),children:t>0?e("settings.v2.unsaved",{count:t}):""}),a&&n.jsx("span",{className:"text-xs "+l,children:a.message}),n.jsxs("div",{className:"ml-auto flex gap-2",children:[n.jsx("button",{type:"button",onClick:o,disabled:t===0||r,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e("settings.reset")}),n.jsx("button",{type:"button",onClick:i,disabled:t===0||r,className:"px-4 py-1.5 text-sm font-medium rounded-md bg-primary-600 text-white hover:bg-primary-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(r?"settings.saving":"settings.save")})]})]})}function dV({t:e}){return n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[n.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35M17 10.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})}),n.jsx("p",{className:"text-sm",children:e("settings.v2.no_matches")})]})}function fV(e){const{q:t,matches:r,orderedCategories:a,grouped:i,renderRegistryRow:o,activeGroup:l,t:u,onOpenDlpSettings:d,onOpenPricingSettings:f,activeSessionId:g,mobileFrameless:h,onMobileFramelessChange:m}=e;let y;if(t&&(!r||r.length===0))y=n.jsx(dV,{t:u});else if(t)y=n.jsxs("div",{className:"space-y-6",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u("settings.v2.search_results",{count:r.length})}),a.map(function(v){const k=r.filter(function(_){return _.category===v});return k.length===0?null:n.jsxs("section",{children:[n.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 mb-2 sticky top-0 bg-gray-50 dark:bg-gray-950 py-1 z-10",children:kf[v]?u(kf[v]):v}),n.jsx("div",{className:"space-y-3",children:k.map(o)})]},"search-"+v)})]});else if(l===vA)y=n.jsx(h4,{title:u("dlp.title"),description:"Configure Data Loss Prevention rules, detectors, and audit policies.",actionLabel:u("settings.v2.open"),onOpen:d});else if(l===kA)y=n.jsx(h4,{title:u("pricing.title"),description:"Configure per-model token pricing used for cost and usage tracking.",actionLabel:u("settings.v2.open"),onOpen:f});else if(p4[l]){const v=p4[l];y=n.jsx("div",{className:"space-y-3",children:n.jsx(v,{activeSessionId:g,mobileFrameless:h,onMobileFramelessChange:m})})}else y=n.jsx("div",{className:"space-y-3",children:(i[l]||[]).map(o)});return y}function gV({onBack:e,onOpenDlpSettings:t,onOpenPricingSettings:r,activeSessionId:a,mobileFrameless:i,onMobileFramelessChange:o}){const{t:l}=Xt(),{settings:u,formValues:d,errors:f,loading:g,saving:h,saveResult:m,loadError:y,changedCount:v,loadSettings:k,handleChange:_,handleSave:w,handleReset:S}=rV(),[E,A]=x.useState([]),[T,C]=x.useState(""),[j,L]=x.useState(null);x.useEffect(()=>{k()},[k]),x.useEffect(()=>{L(function(X){return X||u[0]&&u[0].category||null})},[u]),x.useEffect(()=>{let X=!1;return kk().then(function(ie){X||A(Array.isArray(ie)?ie:ie&&ie.models||[])}).catch(function(){X||A([])}),function(){X=!0}},[]);const O=JW(u),I=eV(O,tV),B=I.map(function(X){return{id:X,kind:"registry",label:kf[X]?l(kf[X]):X,count:O[X].length}}).concat([{id:_A,kind:"chat",label:l("settings.category.language")},{id:wA,kind:"chat",label:l("settings.notifications")},{id:NA,kind:"chat",label:l("settings.appearance")},{id:SA,kind:"chat",label:l("settings.workspace")},{id:EA,kind:"chat",label:l("settings.version_title")},{id:vA,kind:"launcher",label:l("dlp.title")},{id:kA,kind:"launcher",label:l("pricing.title")}]),z=T.trim().toLowerCase(),ee=iV(u,z),$=sV(ee),M=x.useCallback(function(X){C(""),L(X)},[]),G=function(X){return n.jsx(cV,{setting:X,formValue:d[X.key],error:f[X.key],models:E,t:l,onChange:function(ie){_(X.key,ie)}},X.key)};if(g)return n.jsx(nV,{});if(y)return n.jsx(aV,{t:l,loadError:y,onRetry:k});const Y=fV({q:z,matches:ee,orderedCategories:I,grouped:O,renderRegistryRow:G,activeGroup:j,t:l,onOpenDlpSettings:t,onOpenPricingSettings:r,activeSessionId:a,mobileFrameless:i,onMobileFramelessChange:o});return n.jsxs("div",{className:"h-full flex flex-col","data-page":"settings-v2",children:[n.jsx(oV,{t:l,search:T,onSearchChange:C,onBack:e}),n.jsxs("div",{className:"flex-1 flex min-h-0",children:[n.jsx(lV,{t:l,groups:B,activeGroup:j,matchCounts:$,searching:!!z,onSelect:M}),n.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[n.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:Y}),n.jsx(uV,{t:l,changedCount:v,saving:h,saveResult:m,onSave:w,onReset:S})]})]})]})}function pV({modelName:e,rates:t,onChange:r,onDelete:a,isDefault:i,t:o}){return n.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:`text-sm font-medium truncate ${i?"text-primary-600 dark:text-primary-400":"text-gray-900 dark:text-gray-100"}`,children:e}),i&&n.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded",children:o("pricing.fallback_badge")})]})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_input")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:t.input,onChange:l=>r(e,"input",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.input_tokens")})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_output")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:t.output,onChange:l=>r(e,"output",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.output_tokens")})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_cache")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:t.cached,onChange:l=>r(e,"cached",parseFloat(l.target.value)||0),className:"w-16 px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",title:o("pricing.cached_tokens")})]}),!i&&n.jsx("button",{onClick:()=>a(e),className:"p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 transition-colors",title:o("pricing.remove_model"),"aria-label":o("pricing.remove_model_aria",{modelName:e}),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),i&&n.jsx("div",{className:"w-6"})]})]})}function hV({onAdd:e,existingModels:t,t:r}){const[a,i]=x.useState(""),[o,l]=x.useState(5),[u,d]=x.useState(15),[f,g]=x.useState(2.5),[h,m]=x.useState(""),y=v=>{v.preventDefault(),m("");const k=a.trim().toLowerCase();if(!k){m(r("pricing.model_required"));return}if(t.includes(k)){m(r("pricing.model_exists"));return}if(k==="default"){m(r("pricing.default_exists"));return}e(k,{input:o,output:u,cached:f}),i(""),l(5),d(15),g(2.5)};return n.jsxs("form",{onSubmit:y,className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:r("pricing.add_new_model")}),n.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[n.jsx("div",{className:"flex-1 min-w-[120px]",children:n.jsx("input",{type:"text",placeholder:r("pricing.add_model_placeholder"),value:a,onChange:v=>i(v.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("pricing.label_input")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:o,onChange:v=>l(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("pricing.label_output")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:u,onChange:v=>d(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("pricing.label_cache")}),n.jsx("input",{type:"number",step:"0.01",min:"0",value:f,onChange:v=>g(parseFloat(v.target.value)||0),className:"w-14 px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),n.jsx("button",{type:"submit",className:"px-3 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded transition-colors",children:r("pricing.add")})]}),h&&n.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:h})]})}function mV({onClose:e}){const{t}=Xt(),r=ru(),[a,i]=x.useState(null),[o,l]=x.useState(!0),[u,d]=x.useState(!1),[f,g]=x.useState(null),[h,m]=x.useState(!1),y=x.useRef(null);x.useEffect(()=>{let T=!1;async function C(){try{const j=await $$();T||(i(j),l(!1))}catch(j){T||(g(j.message),l(!1))}}return C(),()=>{T=!0}},[]),x.useEffect(()=>{async function T(C){C.key==="Escape"&&(h?await r({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",T),y.current&&y.current.focus(),()=>document.removeEventListener("keydown",T)},[e,h,r,t]);const v=x.useCallback((T,C,j)=>{i(L=>!L||!L.models?L:{...L,models:{...L.models,[T]:{...L.models[T],[C]:j}}}),m(!0)},[]),k=x.useCallback(async T=>{await r({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:T}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(i(C=>{if(!C||!C.models)return C;const j={...C.models};return delete j[T],{...C,models:j}}),m(!0))},[r,t]),_=x.useCallback((T,C)=>{i(j=>j?{...j,models:{...j.models,[T]:C}}:{models:{[T]:C}}),m(!0)},[]),w=x.useCallback(async()=>{g(null),d(!0);try{await W$(a),m(!1),e()}catch(T){g(T.message)}finally{d(!1)}},[a,e]),S=x.useCallback(async()=>{if(await r({title:t("pricing.reset_title"),message:t("pricing.reset_confirm"),destructive:!0,confirmLabel:t("pricing.reset")})){g(null),d(!0);try{const T=await V$();i(T.pricing),m(!1)}catch(T){g(T.message)}finally{d(!1)}}},[r,t]),E=x.useCallback(async()=>{h?await r({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[h,e,r,t]),A=a!=null&&a.models?Object.entries(a.models).sort(([T],[C])=>T==="default"?1:C==="default"?-1:T.localeCompare(C)):[];return n.jsx("div",{ref:y,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:E,role:"dialog","aria-modal":"true","aria-label":t("pricing.title"),children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:T=>T.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),n.jsx("button",{onClick:E,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("pricing.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o&&n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),f&&n.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),!o&&a&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[n.jsx("span",{children:t("pricing.configured_count",{count:A.length})}),n.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),n.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 px-3 py-2 text-xs font-medium text-gray-500 dark:text-gray-400 flex items-center gap-2",children:[n.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),n.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),n.jsx("div",{className:"w-6"})]}),n.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:A.map(([T,C])=>n.jsx(pV,{modelName:T,rates:C,onChange:v,onDelete:k,isDefault:T==="default",t},T))})]}),n.jsx(hV,{onAdd:_,existingModels:A.map(([T])=>T),t})]})]}),n.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50",children:[n.jsx("button",{onClick:S,disabled:u,className:"px-3 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors disabled:opacity-50",children:t("pricing.reset")}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:E,disabled:u,className:"px-4 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors disabled:opacity-50",children:t("common.cancel")}),n.jsxs("button",{onClick:w,disabled:u||!h,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 dark:disabled:bg-gray-700 text-white rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2",children:[u&&n.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t("pricing.save_changes")]})]})]})]})})}const xV=[{id:"email",label:"Email address",name:"email",regex:"\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b",severity:"medium"},{id:"credit_card",label:"Credit card number",name:"credit_card",regex:"\\b(?:\\d[ -]*?){13,19}\\b",severity:"high"},{id:"hk_phone",label:"HK phone number",name:"hk_phone",regex:"\\b[2-9]\\d{7}\\b",severity:"low"},{id:"intl_phone",label:"International phone",name:"intl_phone",regex:"\\+?\\d{1,3}[\\s-]?\\(?\\d{1,4}\\)?[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}\\b",severity:"low"},{id:"generic_api_key",label:"Generic API key",name:"generic_api_key",regex:"\\b(?:sk|pk|api[_-]?key)[_-][A-Za-z0-9]{20,}\\b",severity:"high"}],yV=["low","medium","high"];function bV({severity:e}){const t={high:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",medium:"bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",low:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400"};return n.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t[e]||t.medium}`,children:e})}function m4({name:e,regex:t,severity:r,enabled:a,builtin:i,onToggle:o,onRemove:l,t:u}){return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 border-b border-gray-100 dark:border-gray-800 last:border-b-0 group hover:bg-gray-50 dark:hover:bg-gray-800/40 transition-colors",children:[n.jsxs("label",{className:"relative inline-flex items-center cursor-pointer flex-shrink-0",children:[n.jsx("input",{type:"checkbox",checked:a,onChange:()=>o(e),className:"sr-only peer",disabled:!1}),n.jsx("div",{className:"w-8 h-4 bg-gray-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-primary-300 dark:peer-focus:ring-primary-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:rounded-full after:h-3 after:w-3 after:transition-all dark:border-gray-600 peer-checked:bg-primary-600"})]}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e}),i&&n.jsx("span",{className:"px-1 py-0.5 text-[10px] bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 rounded font-mono",children:"built-in"})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",title:t,children:t.length>60?t.slice(0,57)+"...":t})]}),n.jsx(bV,{severity:r}),!i&&n.jsx("button",{onClick:()=>l(e),className:"p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",title:u("dlp.remove_pattern"),"aria-label":u("dlp.remove_pattern_aria",{name:e}),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function vV({onAdd:e,existingNames:t,t:r}){const[a,i]=x.useState(""),[o,l]=x.useState(""),[u,d]=x.useState("medium"),[f,g]=x.useState(""),h=y=>{if(t.includes(y.name)){g(r("dlp.pattern_exists",{name:y.name}));return}i(y.name),l(y.regex),d(y.severity),g("")},m=y=>{if(y.preventDefault(),g(""),!a.trim()){g(r("dlp.name_required"));return}if(!o.trim()){g(r("dlp.regex_required"));return}if(t.includes(a.trim())){g(r("dlp.pattern_exists",{name:a.trim()}));return}try{new RegExp(o)}catch{g(r("dlp.invalid_regex"));return}e(a.trim(),o.trim(),u),i(""),l(""),d("medium")};return n.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:r("dlp.add_pattern")}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:xV.map(y=>n.jsx("button",{onClick:()=>h(y),className:"px-2 py-0.5 text-xs bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded hover:bg-primary-50 dark:hover:bg-primary-900/30 text-gray-700 dark:text-gray-300 transition-colors",children:y.label},y.id))}),n.jsxs("form",{onSubmit:m,className:"flex items-end gap-2 flex-wrap",children:[n.jsxs("div",{className:"flex-1 min-w-[140px]",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:r("dlp.pattern_name")}),n.jsx("input",{type:"text",placeholder:"e.g. hk_passport",value:a,onChange:y=>i(y.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"})]}),n.jsxs("div",{className:"flex-[2] min-w-[200px]",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:r("dlp.regex_pattern")}),n.jsx("input",{type:"text",placeholder:"e.g. \\b[A-Z]\\d{7}\\b",value:o,onChange:y=>l(y.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono"})]}),n.jsxs("div",{className:"w-24",children:[n.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:r("dlp.severity")}),n.jsx("select",{value:u,onChange:y=>d(y.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:yV.map(y=>n.jsx("option",{value:y,children:y},y))})]}),n.jsx("button",{type:"submit",className:"px-3 py-1.5 text-sm bg-primary-600 hover:bg-primary-700 text-white rounded transition-colors",children:r("dlp.add")})]}),f&&n.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:f})]})}function kV({onClose:e}){const{t}=Xt(),r=ru(),[a,i]=x.useState(null),[o,l]=x.useState([]),[u,d]=x.useState(!0),[f,g]=x.useState(!1),[h,m]=x.useState(null),[y,v]=x.useState(!1),[k,_]=x.useState(!0),[w,S]=x.useState("ask"),[E,A]=x.useState([]),[T,C]=x.useState({}),[j,L]=x.useState("epm/privacy"),O=x.useRef(null);x.useEffect(()=>{let G=!1;async function Y(){var X;try{const ie=await z3();G||(l(ie.builtins||[]),_(ie.enabled!==!1),S(ie.defaultAction||"ask"),A(ie.disabledBuiltins||[]),C(ie.patterns||{}),L(((X=ie.privateMode)==null?void 0:X.rerouteModel)||"epm/privacy"),i(ie),d(!1))}catch(ie){G||(m(ie.message),d(!1))}}return Y(),()=>{G=!0}},[]),x.useEffect(()=>{async function G(Y){Y.key==="Escape"&&(y?await r({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",G),O.current&&O.current.focus(),()=>document.removeEventListener("keydown",G)},[e,y,r,t]);const I=x.useCallback(G=>{A(Y=>Y.includes(G)?Y.filter(X=>X!==G):[...Y,G]),v(!0)},[]),B=x.useCallback((G,Y,X)=>{C(ie=>({...ie,[G]:{regex:Y,severity:X}})),v(!0)},[]),z=x.useCallback(G=>{C(Y=>{const X={...Y};return delete X[G],X}),v(!0)},[]),ee=x.useCallback(async()=>{m(null),g(!0);try{const Y=await U3({enabled:k,defaultAction:w,disabledBuiltins:E,privateMode:{rerouteModel:j},patterns:T});v(!1),i(Y.policy),e()}catch(G){m(G.message)}finally{g(!1)}},[k,w,E,T,j,e]),$=x.useCallback(async()=>{y?await r({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[y,e,r,t]),M=[...o.map(G=>G.name),...Object.keys(T)];return n.jsx("div",{ref:O,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:$,role:"dialog","aria-modal":"true","aria-label":t("dlp.title"),children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:G=>G.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("dlp.heading")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("dlp.subtitle")})]}),n.jsx("button",{onClick:$,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("dlp.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[u&&n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),h&&n.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),!u&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t("dlp.enable_label")}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("dlp.enable_desc")})]}),n.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:k,onChange:G=>{_(G.target.checked),v(!0)},className:"sr-only peer"}),n.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-300 dark:peer-focus:ring-primary-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-primary-600"})]})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.default_action_label")}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.default_action_desc")}),n.jsxs("select",{value:w,onChange:G=>{S(G.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:[n.jsx("option",{value:"ask",children:"Ask (show modal)"}),n.jsx("option",{value:"reroute",children:"Always reroute to private"}),n.jsx("option",{value:"warn",children:"Warn only (proceed on cloud)"})]})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.reroute_model_label")}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.reroute_model_desc")}),n.jsx("input",{type:"text",value:j,onChange:G=>{L(G.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono"})]}),n.jsxs("div",{className:"mb-4 mt-6",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.builtin_patterns")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.builtin_desc")}),n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:o.map(G=>n.jsx(m4,{name:G.name,regex:G.regex,severity:G.severity,enabled:!E.includes(G.name),builtin:!0,onToggle:I,onRemove:()=>{},t},G.name))})]}),n.jsxs("div",{className:"mb-4 mt-4",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.user_patterns")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.user_patterns_desc")}),Object.keys(T).length===0?n.jsx("div",{className:"text-sm text-gray-400 dark:text-gray-500 py-3 text-center border border-dashed border-gray-200 dark:border-gray-700 rounded-lg",children:t("dlp.no_user_patterns")}):n.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:Object.entries(T).map(([G,Y])=>n.jsx(m4,{name:G,regex:Y.regex,severity:Y.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:z,t},G))})]}),n.jsx(vV,{onAdd:B,existingNames:M,t})]})]}),!u&&n.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-800",children:[n.jsx("button",{onClick:$,className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:t("dlp.cancel")}),n.jsx("button",{onClick:ee,disabled:f||!y,className:"px-4 py-2 text-sm bg-primary-600 hover:bg-primary-700 disabled:bg-gray-300 dark:disabled:bg-gray-700 disabled:cursor-not-allowed text-white rounded-lg transition-colors",children:t(f?"dlp.saving":"dlp.save")})]})]})})}function _V(e,t){var r={grant:"permission.action_grant",revoke:"permission.action_revoke",clear:"permission.action_clear_all"},a={network:"permission.type_network","fs.read":"permission.type_file_read","fs.write":"permission.type_file_write","filesystem.read":"permission.type_file_read","filesystem.write":"permission.type_file_write",module:"permission.type_module",modules:"permission.type_module",require:"permission.type_module",system:"permission.type_system",command:"permission.type_system"};if(e.action==="clear")return t("permission.clear_all");var i=r[e.action]?t(r[e.action]):e.action,o=a[e.type]?t(a[e.type]):e.type;return t("permission.request_desc",{action:i,type:o,target:e.target||"*"})}function wV({request:e,onDismiss:t}){const{t:r}=Xt(),[a,i]=x.useState(null),[o,l]=x.useState(null),u=x.useRef(!0),d=x.useRef(null);x.useEffect(()=>()=>{u.current=!1,d.current&&clearTimeout(d.current)},[]);const f=x.useCallback(v=>{v.includes("not found")||v.includes("expired")?l("Request expired"):v.includes("already")?l("Request already processed"):l(v),i("dismissing"),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u.current&&t(e.id)},2e3)},[e.id,t]),g=x.useCallback(async()=>{i("allow"),l(null);try{const v=await s3(e.id);if(!u.current)return;if(v&&v.success===!1){const k=v.error||v.message||"Failed to confirm";f(k);return}t(e.id)}catch(v){if(!u.current)return;const k=v.message||"Failed to confirm";f(k)}},[e.id,t,f]),h=x.useCallback(async()=>{i("deny"),l(null);try{const v=await o3(e.id);if(!u.current)return;if(v&&v.success===!1){const k=v.error||v.message||"Failed to deny";f(k);return}t(e.id)}catch(v){if(!u.current)return;const k=v.message||"Failed to deny";f(k)}},[e.id,t,f]),m=e.action==="clear",y=e.action==="revoke";return n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 p-4 w-80 animate-slide-in",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 ${m?"bg-red-100 dark:bg-red-900/30":y?"bg-amber-100 dark:bg-amber-900/30":"bg-blue-100 dark:bg-blue-900/30"}`,children:n.jsx("svg",{className:`w-4 h-4 ${m?"text-red-600 dark:text-red-400":y?"text-amber-600 dark:text-amber-400":"text-blue-600 dark:text-blue-400"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),n.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:r("permission.title")})]}),n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:_V(e,r)}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:[r("permission.reason_prefix")," ",typeof e.reason=="string"&&e.reason.trim()?e.reason:r("permission.no_reason")]}),o&&n.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-2",children:o}),n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx("button",{onClick:h,disabled:a!==null,className:"px-3 py-1.5 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:r(a==="deny"?"permission.denying":"permission.deny")}),n.jsx("button",{onClick:g,disabled:a!==null,className:`px-3 py-1.5 text-sm font-medium rounded-md text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${m?"bg-red-600 hover:bg-red-700":y?"bg-amber-600 hover:bg-amber-700":"bg-blue-600 hover:bg-blue-700"}`,children:r(a==="allow"?"permission.allowing":"permission.allow")})]})]})}function NV({requests:e,onDismiss:t}){return!e||e.length===0?null:n.jsx(n.Fragment,{children:e.map(r=>n.jsx(wV,{request:r,onDismiss:t},r.id))})}var SV="https://account.openpave.ai/dashboard";function EV({open:e,onClose:t,upgradeUrl:r}){var{t:a}=Xt(),i=x.useRef(null),o=x.useRef(null),l=x.useRef(t),u=SV;if(typeof r=="string"&&r.length>0)try{var d=new URL(r),f=["account.openpave.ai"];d.protocol==="https:"&&f.indexOf(d.hostname)!==-1&&(u=d.href)}catch{}return x.useEffect(function(){l.current=t},[t]),x.useEffect(function(){e&&o.current&&o.current.focus()},[e]),x.useEffect(function(){if(!e)return;function g(h){h.key==="Escape"&&(typeof h.preventDefault=="function"&&h.preventDefault(),typeof h.stopImmediatePropagation=="function"?h.stopImmediatePropagation():typeof h.stopPropagation=="function"&&h.stopPropagation(),l.current())}return document.addEventListener("keydown",g,!0),function(){document.removeEventListener("keydown",g,!0)}},[e]),x.useEffect(function(){if(!e||!i.current)return;function g(h){if(h.key==="Tab"){var m=i.current.querySelectorAll("button:not([disabled]), a:not([disabled])");if(m.length!==0){var y=m[0],v=m[m.length-1];h.shiftKey?document.activeElement===y&&(h.preventDefault(),v.focus()):document.activeElement===v&&(h.preventDefault(),y.focus())}}}return document.addEventListener("keydown",g),function(){document.removeEventListener("keydown",g)}},[e]),e?n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(g){g.target===g.currentTarget&&t()},children:n.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":a("credits.limit_reached"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-none transition-all duration-150",children:[n.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center gap-3",children:[n.jsx("span",{className:"text-2xl",role:"img","aria-hidden":"true",children:"🪙"}),n.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:a("credits.limit_reached")})]}),n.jsx("div",{className:"px-5 py-4",children:n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a("credits.limit_message")})}),n.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[n.jsx("button",{ref:o,type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:a("credits.dismiss")}),n.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 text-sm font-medium rounded-md bg-primary-600 hover:bg-primary-700 text-white focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 inline-flex items-center gap-1.5",children:[a("credits.add_credits"),n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[n.jsx("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),n.jsx("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})}):null}function xv(e){if(e==null)return"";const t=Date.now()-e;if(t<=0)return"just now";const r=Math.floor(t/1e3);if(r<60)return`${r}s ago`;const a=Math.floor(r/60);if(a<60)return`${a}m ago`;const i=Math.floor(a/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}const jV=15e3;function CV({onNavigateToAgent:e}){const{t}=Xt(),[r,a]=x.useState(!1),[i,o]=x.useState([]),[l,u]=x.useState(0),[d,f]=x.useState(!1),[g,h]=x.useState(null),m=x.useRef(null),y=x.useRef(null),v=x.useRef(0),k=x.useRef(!1),_=x.useRef(!1),w=x.useRef(0),S=x.useRef(i);S.current=i,x.useEffect(()=>{function U(){document.visibilityState==="visible"&&(_.current=!0)}return document.addEventListener("visibilitychange",U),()=>document.removeEventListener("visibilitychange",U)},[]);const E=x.useCallback(async U=>{const Z=++w.current;try{let P,K=null;if(U){const V=await N_();if(Z!==w.current)return;K=V.messages||[],o(K),P=V.unread||0,u(P)}else{const V=await N_({unreadOnly:!0,limit:1});if(Z!==w.current)return;P=V.unread||0,u(P),eu()&&P>0&&V.messages&&V.messages.length>0&&(K=V.messages)}if(k.current&&P>v.current&&!_.current&&mA()&&hA(),k.current&&P>v.current&&eu()){const V=P-v.current,W=K||S.current||[],ae=V===1&&W.length>0?W.find(Ve=>!Ve.read):null,Q=ae&&ae.from?ae.from:"",Ne=!Q||Q==="__pave_webui__"||Q==="unknown"?"PAVE":Q,De=ae&&ae.message?ae.message.slice(0,120).replace(/\n/g," "):V===1?"New inbox message":V+" new inbox messages";yA({title:Ne,body:De,tag:"pave-inbox-"+Date.now(),onClick:function(){window.focus()}})}_.current=!1,v.current=P,k.current=!0}catch{}},[]);x.useEffect(()=>{E(r);const U=setInterval(()=>E(r),jV);return()=>clearInterval(U)},[E,r]),x.useEffect(()=>{if(!r)return;function U(Z){m.current&&!m.current.contains(Z.target)&&a(!1)}return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[r]);const A=x.useRef(new Set),T=x.useCallback(async U=>{if(!(!U.filename||U.read)&&!A.current.has(U.filename)){A.current.add(U.filename);try{await R3(U.filename),o(Z=>Z.map(P=>P.filename===U.filename?{...P,read:!0}:P)),u(Z=>Math.max(0,Z-1)),h(Z=>Z&&Z.filename===U.filename?{...Z,read:!0}:Z)}catch{}finally{A.current.delete(U.filename)}}},[]),C=x.useCallback(async()=>{f(!0);try{await M3(),o(U=>U.map(Z=>({...Z,read:!0}))),u(0)}catch{}finally{f(!1)}},[]),j=x.useCallback(async()=>{f(!0);try{await L3(),o([]),u(0)}catch{}finally{f(!1)}},[]),L=x.useCallback((U,Z)=>{Z.read||T(Z),a(!1),h(null),e&&e(U)},[e,T]),O=x.useCallback(U=>{h(U),U.read||T(U)},[T]),I=x.useCallback(()=>{h(null)},[]),B=x.useRef(new Set),z=x.useCallback(async U=>{if(!(!U.filename||!U.read)&&!B.current.has(U.filename)){B.current.add(U.filename);try{await A3(U.filename),o(Z=>{const P=Z.map(V=>V.filename===U.filename?{...V,read:!1}:V),K=P.reduce((V,W)=>V+(W.read?0:1),0);return u(K),P}),h(Z=>Z&&Z.filename===U.filename?{...Z,read:!1}:Z)}catch{}finally{B.current.delete(U.filename)}}},[]),ee=x.useCallback(async U=>{if(U.filename)try{await I3(U.filename),o(Z=>{const P=Z.filter(V=>V.filename!==U.filename),K=P.reduce((V,W)=>V+(W.read?0:1),0);return u(K),P}),h(Z=>Z&&Z.filename===U.filename?null:Z)}catch{}},[]),$=x.useMemo(()=>[...i].sort((U,Z)=>(Z.timestamp||0)-(U.timestamp||0)),[i]),M=x.useCallback(()=>{if(!g)return;const U=$.findIndex(Z=>Z.filename===g.filename);if(U>0){const Z=$[U-1];h(Z),Z.read||T(Z)}},[g,$,T]),G=x.useCallback(()=>{if(!g)return;const U=$.findIndex(Z=>Z.filename===g.filename);if(U>=0&&U<$.length-1){const Z=$[U+1];h(Z),Z.read||T(Z)}},[g,$,T]),Y=x.useMemo(()=>g?$.findIndex(U=>U.filename===g.filename):-1,[g,$]),X=Y>0,ie=Y>=0&&Y<$.length-1,F=!!g;return x.useEffect(()=>{if(!F)return;function U(Z){Z.key==="Escape"&&h(null)}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[F]),x.useEffect(()=>{F&&y.current&&y.current.focus()},[F]),n.jsxs("div",{className:"relative",ref:m,children:[n.jsxs("button",{onClick:()=>a(!r),className:"relative p-1.5 rounded-lg transition-colors text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:t("user_inbox.title"),"aria-label":t("user_inbox.title"),"aria-expanded":r,"aria-haspopup":"true",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),l>0&&n.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[16px] h-4 px-1 text-[10px] font-bold text-white bg-red-500 rounded-full leading-none",children:l>99?"99+":l})]}),r&&n.jsxs("div",{className:"absolute right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-lg z-50 flex flex-col max-h-[28rem]",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[n.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:t("user_inbox.title")}),n.jsxs("div",{className:"flex items-center gap-1",children:[i.length>0&&l>0&&n.jsx("button",{onClick:C,disabled:d,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline disabled:opacity-50",title:t("user_inbox.mark_all_read"),children:t("user_inbox.mark_all_read")}),i.length>0&&n.jsx("button",{onClick:j,disabled:d,className:"text-xs text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400 ml-2 disabled:opacity-50",title:t("user_inbox.clear_all"),children:t("user_inbox.clear_all")})]})]}),n.jsx("div",{className:"overflow-y-auto flex-1",children:$.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-gray-400 dark:text-gray-500",children:t("user_inbox.empty")}):$.map((U,Z)=>{const P=U.from||"unknown",K=P!=="unknown";return n.jsxs("div",{className:"px-3 py-2 border-b border-gray-50 dark:border-gray-800 last:border-b-0 transition-colors "+(U.read?"bg-white dark:bg-gray-900":"bg-primary-50 dark:bg-primary-900/10"),children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsx("button",{onClick:()=>{K&&L(P,U)},disabled:!K,className:"text-xs font-semibold truncate max-w-[60%] "+(K?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),title:K?t("user_inbox.view_agent")+": "+P:P,children:P}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[U.priority==="high"&&n.jsx("span",{className:"text-[10px] font-semibold text-red-500 uppercase",children:t("user_inbox.high_priority")}),n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 whitespace-nowrap",children:U.timestamp!=null?xv(U.timestamp):""}),!U.read&&n.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-500 flex-shrink-0",title:t("user_inbox.unread")})]})]}),n.jsx("div",{role:"button",tabIndex:0,onClick:()=>O(U),onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),O(U))},className:"text-left w-full text-sm text-gray-700 dark:text-gray-300 break-words line-clamp-3 hover:text-gray-900 dark:hover:text-gray-100 cursor-pointer",title:t("user_inbox.view_message"),children:n.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&>*]:m-0 [&>*]:leading-snug",children:n.jsx(Sl,{remarkPlugins:[El],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:V,children:W,href:ae,...Q}){return n.jsx("a",{href:ae,...Q,target:"_blank",rel:"noopener noreferrer",onClick:he=>he.stopPropagation(),children:W})},p:function({node:V,children:W,...ae}){return n.jsx("span",{...ae,children:W})}},children:U.message})})})]},U.filename||Z)})})]}),g&&n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:U=>{U.target===U.currentTarget&&I()},children:n.jsxs("div",{ref:y,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":t("user_inbox.view_message"),className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col outline-none focus-visible:ring-2 focus-visible:ring-primary-500",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("button",{type:"button",onClick:()=>{const U=g.from||"unknown";U!=="unknown"&&L(U,g)},disabled:!g.from||g.from==="unknown",className:"text-sm font-semibold truncate "+(g.from&&g.from!=="unknown"?"text-primary-600 dark:text-primary-400 hover:underline":"text-gray-400 dark:text-gray-500 cursor-default"),children:g.from||"unknown"}),g.priority==="high"&&n.jsx("span",{className:"text-[10px] font-semibold text-red-500 uppercase flex-shrink-0",children:t("user_inbox.high_priority")}),n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 whitespace-nowrap flex-shrink-0",children:g.timestamp?xv(g.timestamp):""})]}),n.jsx("button",{type:"button",onClick:I,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 flex-shrink-0","aria-label":t("user_inbox.close"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx("div",{className:"px-4 py-3 overflow-y-auto flex-1",children:n.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none break-words",children:n.jsx(Sl,{remarkPlugins:[El],disallowedElements:["img"],unwrapDisallowed:!0,components:{a:function({node:U,children:Z,href:P,...K}){return n.jsx("a",{href:P,...K,target:"_blank",rel:"noopener noreferrer",children:Z})},p:function({node:U,children:Z,...P}){return n.jsx("p",{...P,style:{whiteSpace:"pre-wrap"},children:Z})}},children:g.message||""})})}),n.jsxs("div",{className:"px-4 py-2 border-t border-gray-100 dark:border-gray-800 flex items-center justify-between flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:M,disabled:!X,className:"p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:t("user_inbox.prev_message"),"aria-label":t("user_inbox.prev_message"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),n.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums min-w-[3rem] text-center",children:Y>=0?`${Y+1} / ${$.length}`:""}),n.jsx("button",{type:"button",onClick:G,disabled:!ie,className:"p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:t("user_inbox.next_message"),"aria-label":t("user_inbox.next_message"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[g.read?n.jsx("button",{type:"button",onClick:()=>z(g),className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:underline",title:t("user_inbox.mark_unread"),children:t("user_inbox.mark_unread")}):n.jsx("button",{type:"button",onClick:()=>T(g),className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",title:t("user_inbox.mark_read"),children:t("user_inbox.mark_read")}),n.jsx("button",{type:"button",onClick:()=>ee(g),className:"text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 hover:underline",title:t("user_inbox.delete"),children:t("user_inbox.delete")}),n.jsx("button",{type:"button",onClick:I,className:"text-xs px-3 py-1 rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700",children:t("user_inbox.close")})]})]})]})})]})}function Cb(e,t){if(!e||!t)return!e;const r=String(e).toLowerCase(),a=String(t).toLowerCase();let i=0;for(let o=0;o<a.length&&i<r.length;o+=1)a[o]===r[i]&&(i+=1);return i===r.length}function TV(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function RV({isOpen:e,onClose:t,onSelectSession:r,onNewChat:a,activeSessionId:i,sessions:o,busySessions:l={}}){const{t:u}=Xt(),[d,f]=x.useState(""),[g,h]=x.useState(0),[m,y]=x.useState(null),[v,k]=x.useState(!1),_=x.useRef(null),w=x.useRef(null),S=x.useRef(null),E=d?d.trim():"";x.useEffect(()=>{if(e){f(""),h(0),y(null),k(!1);const O=requestAnimationFrame(()=>{_.current&&_.current.focus()});return()=>cancelAnimationFrame(O)}},[e]),x.useEffect(()=>{let O=!1;const I=d?d.trim():"";if(S.current&&(clearTimeout(S.current),S.current=null),!e){y(null),k(!1);return}if(I.length<2){y(null),k(!1);return}return y(null),k(!0),S.current=setTimeout(()=>{vl({q:I,limit:20}).then(B=>{if(O)return;const z=Array.isArray(B)?B:B.sessions||[];y(z),k(!1)}).catch(()=>{O||k(!1)})},300),()=>{O=!0,S.current&&(clearTimeout(S.current),S.current=null)}},[d,e]);const A=x.useCallback(O=>{if(!i)return O;const I=O.findIndex(ee=>ee.id===i);if(I<=0)return O;const B=O.slice(),[z]=B.splice(I,1);return B.unshift(z),B},[i]),T=x.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:u("spotlight.new_chat")}),[u]),C=x.useMemo(()=>{const O=o||[],I=!E||Cb(E,"new chat")||Cb(E,u("spotlight.new_chat")),B=$=>I&&a?i&&$.length>0&&$[0].id===i?[$[0],T,...$.slice(1)]:[T,...$]:$;if(!E)return B(A(O.slice(0,10)));const z=O.filter($=>Cb(E,$.title||""));let ee;if(m){const $=new Set(z.map(G=>G.id)),M=m.filter(G=>!$.has(G.id));ee=z.concat(M).slice(0,20)}else ee=z.slice(0,20);return B(A(ee))},[E,o,m,A,T,a,u,i]);x.useEffect(()=>{h(0)},[E]),x.useEffect(()=>{h(O=>C.length===0?0:O>=C.length?C.length-1:O)},[C.length]),x.useEffect(()=>{if(!w.current)return;const O=w.current.querySelectorAll('[role="option"]');O[g]&&O[g].scrollIntoView({block:"nearest"})},[g,C.length]);const j=x.useCallback(O=>{if(O&&O.isAction&&O.actionType==="new-chat"){a&&a(),t();return}const I=typeof O=="string"?O:O==null?void 0:O.id;I&&r(I),t()},[r,a,t]),L=x.useCallback(O=>{O.key==="ArrowDown"?(O.preventDefault(),h(I=>C.length===0?0:(I+1)%C.length)):O.key==="ArrowUp"?(O.preventDefault(),h(I=>C.length===0?0:(I-1+C.length)%C.length)):O.key==="Enter"?(O.preventDefault(),C[g]&&j(C[g])):O.key==="Escape"&&(O.preventDefault(),t())},[C,g,j,t]);return e?n.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50",onClick:t,role:"presentation",children:n.jsxs("div",{className:"w-full max-w-lg mx-4 bg-white dark:bg-gray-900 rounded-xl shadow-2xl border border-gray-200 dark:border-gray-700 overflow-hidden",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":u("spotlight.title"),children:[n.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[n.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),n.jsx("input",{ref:_,type:"text",className:"flex-1 bg-transparent text-gray-900 dark:text-white text-sm placeholder-gray-400 dark:placeholder-gray-500 outline-none",placeholder:u("spotlight.placeholder"),value:d,onChange:O=>f(O.target.value),onKeyDown:L,"aria-label":u("spotlight.placeholder"),"aria-controls":"spotlight-results","aria-activedescendant":C[g]?"spotlight-item-"+g:void 0,autoComplete:"off",spellCheck:"false"}),n.jsx("kbd",{className:"hidden sm:inline-block px-1.5 py-0.5 text-xs font-mono text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"Esc"})]}),n.jsxs("div",{id:"spotlight-results",ref:w,role:"listbox","aria-label":u("spotlight.results"),className:"max-h-80 overflow-y-auto",children:[!E&&C.length>0&&n.jsx("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider",children:u("spotlight.recent_sessions")}),C.map((O,I)=>{var B;return O.isAction&&O.actionType==="new-chat"?n.jsxs("div",{id:"spotlight-item-"+I,role:"option","aria-selected":I===g,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors border-b border-gray-100 dark:border-gray-800 ${I===g?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"}`,onClick:()=>j(O),children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("div",{className:"text-sm font-medium truncate",children:O.title})})]},O.id):n.jsxs("div",{id:"spotlight-item-"+I,role:"option","aria-selected":I===g,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${I===g?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"}`,onClick:()=>j(O),children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("div",{className:"text-sm font-medium truncate",children:O.title||u("spotlight.untitled")})}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l[O.id]&&n.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse",role:"status",title:u("sidebar.session_processing"),"aria-label":u("sidebar.session_processing")}),O.id===i&&n.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-600 dark:text-green-400 font-medium",children:u("spotlight.current")}),n.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:TV(O)}),n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:xv((B=O.time)==null?void 0:B.updated)})]})]},O.id)}),E&&C.length===0&&!v&&n.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.no_results")}),v&&C.length===0&&n.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.searching")})]}),n.jsxs("div",{className:"px-4 py-2 border-t border-gray-200 dark:border-gray-700 flex items-center gap-4 text-xs text-gray-400 dark:text-gray-500",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↑"}),n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↓"}),u("spotlight.navigate")]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"↵"}),u("spotlight.select")]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:"Esc"}),u("spotlight.close")]})]})]})}):null}const Nk="pave_recent_directories",AV=10;function x4(e,t){if(!e)return"";const r=e.replace(/\\/g,"/"),a=t?t.replace(/\\/g,"/"):"";if(a&&r.startsWith(a))return"~"+r.slice(a.length);const i=r.split("/").filter(Boolean);return i.length>4?".../"+i.slice(-2).join("/"):r}function Sk(){try{const e=localStorage.getItem(Nk);return e?JSON.parse(e):[]}catch{return[]}}function IV(e){try{let t=Sk();return t=t.filter(r=>r!==e),t.unshift(e),t=t.slice(0,AV),localStorage.setItem(Nk,JSON.stringify(t)),t}catch{return[e]}}function MV(e){try{let t=Sk();return t=t.filter(r=>r!==e),localStorage.setItem(Nk,JSON.stringify(t)),t}catch{return[]}}function jA({className:e}){return n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:n.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function LV({isOpen:e,onClose:t,sessionId:r,currentDirectory:a,homeDir:i,onDirectoryChange:o}){var{t:l}=Xt(),u=x.useRef(null),d=x.useRef(null),[f,g]=x.useState(a||""),[h,m]=x.useState("idle"),[y,v]=x.useState(null),[k,_]=x.useState([]),[w,S]=x.useState(!1),[E,A]=x.useState(!1),[T,C]=x.useState(null),j=x.useRef(null),L=x.useRef(0);x.useEffect(function(){e&&(_(Sk()),g(a||""),m("idle"),v(null),C(null))},[e,a]),x.useEffect(function(){e&&u.current&&setTimeout(function(){u.current.focus(),u.current.select()},50)},[e]);var O=x.useCallback(function(Y){if(!Y||Y.trim()===""){m("idle"),v(null);return}j.current&&clearTimeout(j.current),m("checking"),L.current+=1;var X=L.current;j.current=setTimeout(async function(){try{const ie=await w_(Y.trim());if(X!==L.current)return;v(ie),ie.exists&&ie.isDirectory?m("valid"):ie.exists?(m("error"),v({...ie,error:l("chat.working_directory_invalid")})):m("not_found")}catch(ie){if(X!==L.current)return;m("error"),v({error:ie.message})}},300)},[l]),I=x.useCallback(function(Y){var X=Y.target.value;g(X),C(null),O(X)},[O]),B=x.useCallback(function(Y){g(Y),C(null),O(Y)},[O]),z=x.useCallback(function(Y,X){Y.stopPropagation(),_(MV(X))},[]),ee=x.useCallback(async function(){if(f.trim()){S(!0),C(null);try{const Y=await C3(f.trim());if(Y.success)try{const X=await w_(Y.path);m("valid"),v(X)}catch{m("valid"),v({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:Y.path})}}catch(Y){C(l("chat.working_directory_create_failed",{error:Y.message}))}finally{S(!1)}}},[f,l]),$=x.useCallback(async function(){if(!(!f.trim()||h!=="valid")){A(!0),C(null);try{const Y=(y==null?void 0:y.path)||f.trim();await Qa(r,{directory:Y}),_(IV(Y)),o&&o(Y),t()}catch(Y){C(Y.message)}finally{A(!1)}}},[f,h,y,r,o,t]);x.useEffect(function(){if(!e)return;function Y(X){X.key==="Escape"&&(X.preventDefault(),X.stopPropagation(),t())}return document.addEventListener("keydown",Y,!0),function(){document.removeEventListener("keydown",Y,!0)}},[e,t]),x.useEffect(function(){if(!e)return;function Y(X){X.key==="Enter"&&h==="valid"&&!E&&(X.preventDefault(),$())}return document.addEventListener("keydown",Y),function(){document.removeEventListener("keydown",Y)}},[e,h,E,$]),x.useEffect(function(){return function(){j.current&&clearTimeout(j.current)}},[]);var M=x.useMemo(function(){return x4(a,i)},[a,i]);if(!e)return null;var G=null;return h==="checking"?G=n.jsxs("p",{className:"text-xs text-gray-400 mt-1 flex items-center",children:[n.jsx("span",{className:"inline-block w-3 h-3 border-2 border-gray-400 border-t-transparent rounded-full animate-spin mr-2"}),l("chat.working_directory_checking")]}):h==="valid"&&y?G=n.jsx("p",{className:"text-xs text-green-500 mt-1",children:y.hasAgentsMd?"✓ "+l("chat.working_directory_has_agents_md"):"✓ "+l("chat.working_directory_no_agents_md")}):h==="not_found"?G=n.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",l("chat.working_directory_not_found")]}):h==="error"&&(y!=null&&y.error)&&(G=n.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",y.error]})),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(Y){Y.target===Y.currentTarget&&t()},children:n.jsxs("div",{ref:d,className:"bg-gray-800 rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden",role:"dialog","aria-modal":"true","aria-labelledby":"directory-modal-title",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(jA,{className:"w-5 h-5 text-gray-400"}),n.jsx("h2",{id:"directory-modal-title",className:"text-lg font-semibold text-gray-100",children:l("chat.working_directory")})]}),n.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":l("common.close"),children:n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:l("chat.working_directory_current")}),n.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:a,children:M||a||l("chat.working_directory_not_set")})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"directory-input",className:"block text-sm font-medium text-gray-400 mb-1",children:l("chat.working_directory_new_path")}),n.jsx("input",{ref:u,id:"directory-input",type:"text",value:f,onChange:I,className:"w-full px-3 py-2 bg-gray-900 border border-gray-600 rounded text-gray-100 font-mono text-sm placeholder-gray-500 focus:outline-none focus:border-blue-500",placeholder:l("chat.working_directory_placeholder"),autoComplete:"off",spellCheck:"false"}),G]}),T&&n.jsx("p",{className:"text-sm text-red-500",children:T}),k.length>0&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:l("chat.working_directory_recent")}),n.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:k.map(function(Y){return n.jsxs("div",{onClick:function(){B(Y)},className:"flex items-center justify-between px-3 py-2 bg-gray-900 rounded cursor-pointer hover:bg-gray-700 transition-colors group",children:[n.jsx("span",{className:"text-sm text-gray-200 font-mono truncate flex-1",title:Y,children:x4(Y,i)}),n.jsx("button",{onClick:function(X){z(X,Y)},className:"text-gray-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity ml-2",title:l("chat.working_directory_remove_recent"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},Y)})})]})]}),n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-700 bg-gray-800/50",children:[n.jsx("div",{children:h==="not_found"&&n.jsx("button",{onClick:ee,disabled:w,className:"px-3 py-1.5 text-sm font-medium text-yellow-400 border border-yellow-500/50 rounded hover:bg-yellow-500/10 transition-colors disabled:opacity-50",children:w?"...":l("chat.working_directory_create")})}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-300 hover:text-gray-100 transition-colors",children:l("chat.working_directory_cancel")}),n.jsx("button",{onClick:$,disabled:h!=="valid"||E,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:E?"...":l("chat.working_directory_change")})]})]})]})})}var rn={enabled:!1,message:"Continue working on your current task.",intervalMs:15e3,maxInjections:0,mode:"normal",waitMs:0,timeout:{enabled:!0,thresholdMs:3e4,cooldownMs:5e3}};function OV(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function Gd(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function Kd(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function pl(e){var t=e.children;return n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-snug",children:t})}function DV(e){var t=e.isOpen,r=e.onClose,a=e.sessionId,i=Xt().t,o=x.useRef(null),l=x.useState(null);l[0];var u=l[1],d=x.useState(!0),f=d[0],g=d[1],h=x.useState(!1),m=h[0],y=h[1],v=x.useState(null),k=v[0],_=v[1],w=x.useState(null),S=w[0],E=w[1],A=x.useState(rn.enabled),T=A[0],C=A[1],j=x.useState(rn.message),L=j[0],O=j[1],I=x.useState(String(rn.intervalMs)),B=I[0],z=I[1],ee=x.useState(String(rn.maxInjections)),$=ee[0],M=ee[1],G=x.useState(rn.timeout.enabled),Y=G[0],X=G[1],ie=x.useState(String(rn.timeout.thresholdMs)),F=ie[0],U=ie[1],Z=x.useState(String(rn.timeout.cooldownMs)),P=Z[0],K=Z[1],V=x.useState(rn.mode),W=V[0],ae=V[1],Q=x.useState(String(rn.waitMs)),he=Q[0],Ne=Q[1],De=x.useRef(null),Ve=x.useState([]),at=Ve[0],lt=Ve[1],Ce=x.useState(!1),$e=Ce[0],Be=Ce[1],gt=x.useState(!1),ut=gt[0],jt=gt[1],Ge=x.useState("9"),we=Ge[0],Ue=Ge[1],Ae=x.useState("0"),rt=Ae[0],fe=Ae[1],ce=x.useState("AM"),ve=ce[0],ye=ce[1],it=x.useState("weekdays"),qe=it[0],Ye=it[1],yt=x.useState([1,2,3,4,5]),ht=yt[0],Dt=yt[1],nt=x.useState(""),Pt=nt[0],$t=nt[1],lr="";try{lr=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}x.useEffect(function(){return function(){De.current&&clearTimeout(De.current)}},[]);var pr=x.useCallback(function(){a&&(g(!0),_(null),W4(a).then(function(Fe){var kt=Fe&&Fe.config?Fe.config:rn;u(kt),C(kt.enabled||!1),O(kt.message||rn.message),z(Gd(kt.intervalMs!=null?kt.intervalMs:rn.intervalMs)),M(OV(kt.maxInjections!=null?kt.maxInjections:rn.maxInjections)),X(kt.timeout?kt.timeout.enabled:rn.timeout.enabled),U(Gd(kt.timeout&&kt.timeout.thresholdMs!=null?kt.timeout.thresholdMs:rn.timeout.thresholdMs)),K(Gd(kt.timeout&&kt.timeout.cooldownMs!=null?kt.timeout.cooldownMs:rn.timeout.cooldownMs)),ae(kt.mode||rn.mode),Ne(Gd(kt.waitMs!=null?kt.waitMs:rn.waitMs))}).catch(function(Fe){_(Fe.message||"Failed to load config")}).finally(function(){g(!1)}))},[a]);x.useEffect(function(){t&&pr()},[t,pr]);var _r=x.useCallback(function(){a&&QI(a).then(function(Fe){lt(Fe&&Fe.schedules?Fe.schedules:[])}).catch(function(){lt([])})},[a]);x.useEffect(function(){t&&_r()},[t,_r]),x.useEffect(function(){if(!t)return;function Fe(kt){kt.key==="Escape"&&r()}return document.addEventListener("keydown",Fe),function(){document.removeEventListener("keydown",Fe)}},[t,r]);function cr(){if(a){y(!0),_(null),E(null);var Fe={enabled:T,message:L.trim()||rn.message,intervalMs:Kd(B)||rn.intervalMs,maxInjections:parseInt($,10)||0,mode:W||rn.mode,waitMs:Kd(he),timeout:{enabled:Y,thresholdMs:Kd(F)||rn.timeout.thresholdMs,cooldownMs:Kd(P)||rn.timeout.cooldownMs}};YI(a,Fe).then(function(){u(Fe),E(i("chat.idle_injection_saved")),De.current&&clearTimeout(De.current),De.current=setTimeout(function(){E(null)},3e3)}).catch(function(kt){_(kt.message||"Failed to save")}).finally(function(){y(!1)})}}function ir(){a&&(y(!0),_(null),E(null),XI(a).then(function(){C(!1),u(null)}).catch(function(Fe){_(Fe.message||"Failed to disable")}).finally(function(){y(!1)}))}function ue(Fe,kt){var Qt=parseInt(Fe,10);return kt==="PM"&&Qt!==12&&(Qt+=12),kt==="AM"&&Qt===12&&(Qt=0),Qt}function Me(Fe){return Fe===0?{h:12,ap:"AM"}:Fe<12?{h:Fe,ap:"AM"}:Fe===12?{h:12,ap:"PM"}:{h:Fe-12,ap:"PM"}}function Ke(Fe,kt){return Fe==="every_day"?[0,1,2,3,4,5,6]:Fe==="weekdays"?[1,2,3,4,5]:Fe==="weekends"?[0,6]:kt.slice().sort()}function Te(Fe){var kt=Me(Fe.hour),Qt=String(Fe.minute).padStart(2,"0");return kt.h+":"+Qt+" "+kt.ap}function oe(Fe){var kt=Fe.daysOfWeek||[],Qt="";if(kt.length===7)Qt=i("scheduled_injection.repeat_every_day");else if(kt.length===5&&kt.indexOf(1)!==-1&&kt.indexOf(5)!==-1)Qt=i("scheduled_injection.repeat_weekdays");else if(kt.length===2&&kt.indexOf(0)!==-1&&kt.indexOf(6)!==-1)Qt=i("scheduled_injection.repeat_weekends");else{for(var Wr=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],ln=[],Jr=0;Jr<7;Jr++)kt.indexOf(Jr)!==-1&&ln.push(i("scheduled_injection."+Wr[Jr]));Qt=ln.join(", ")}return Fe.timezone&&(Qt+=" ("+Fe.timezone+")"),Qt}function bt(){if(a){jt(!0),_(null);var Fe={hour:ue(we,ve),minute:parseInt(rt,10),daysOfWeek:Ke(qe,ht),timezone:lr||null,message:Pt.trim(),enabled:!0};ZI(a,Fe).then(function(){Be(!1),$t(""),_r()}).catch(function(kt){_(kt.message||i("scheduled_injection.error_generic"))}).finally(function(){jt(!1)})}}function Pe(Fe,kt){a&&JI(a,Fe,{enabled:!kt}).then(function(){_r()}).catch(function(Qt){_(Qt.message||"Failed to toggle schedule")})}function te(Fe){a&&e3(a,Fe).then(function(){_r()}).catch(function(kt){_(kt.message||"Failed to delete schedule")})}function be(Fe){var kt=ht.indexOf(Fe);Dt(kt===-1?ht.concat([Fe]):ht.filter(function(Qt){return Qt!==Fe}))}if(!t)return null;var ze="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",Je="w-full px-3 py-2 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",Bt="space-y-3",Ft=function(Fe){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(Fe?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},Jt=function(Fe){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(Fe?"translate-x-6":"translate-x-1")};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:r,"aria-hidden":"true"}),n.jsxs("aside",{ref:o,className:"fixed right-0 top-0 bottom-0 z-50 w-96 max-w-[90vw] bg-white dark:bg-gray-950 shadow-xl border-l border-gray-200 dark:border-gray-800 flex flex-col",role:"dialog","aria-label":i("chat.idle_injection_title"),children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("chat.idle_injection_title")}),n.jsx("button",{onClick:r,className:"p-1.5 rounded-lg text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":i("common.close"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:f?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):n.jsxs(n.Fragment,{children:[k&&n.jsx("div",{className:"px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm",children:k}),S&&n.jsx("div",{className:"px-3 py-2 rounded-lg bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 text-sm",children:S}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_toggle")}),n.jsx("button",{type:"button",onClick:function(){C(!T)},className:Ft(T),"aria-pressed":T,"aria-label":i("chat.idle_injection_toggle"),children:n.jsx("span",{className:Jt(T)})})]}),n.jsxs("div",{className:Bt,children:[n.jsx("label",{className:ze,htmlFor:"ii-message",children:i("chat.idle_injection_message")}),n.jsx("textarea",{id:"ii-message",value:L,onChange:function(Fe){O(Fe.target.value)},className:Je+" resize-none",rows:3,placeholder:i("chat.idle_injection_message_placeholder"),disabled:!T})]}),n.jsxs("div",{className:Bt,children:[n.jsx("label",{className:ze,htmlFor:"ii-interval",children:i("chat.idle_injection_interval")}),n.jsx("input",{id:"ii-interval",type:"number",value:B,onChange:function(Fe){z(Fe.target.value)},className:Je,min:.5,step:.5,disabled:!T}),n.jsx(pl,{children:i("chat.idle_injection_interval_desc")})]}),n.jsxs("div",{className:Bt,children:[n.jsx("label",{className:ze,htmlFor:"ii-max",children:i("chat.idle_injection_max")}),n.jsx("input",{id:"ii-max",type:"number",value:$,onChange:function(Fe){M(Fe.target.value)},className:Je,min:0,disabled:!T}),n.jsx(pl,{children:i("chat.idle_injection_max_desc")})]}),n.jsxs("div",{className:Bt,children:[n.jsx("label",{className:ze,htmlFor:"ii-mode",children:i("chat.idle_injection_mode")}),n.jsxs("select",{id:"ii-mode",value:W,onChange:function(Fe){ae(Fe.target.value)},className:Je,disabled:!T,children:[n.jsx("option",{value:"urgent",children:i("chat.idle_injection_mode_urgent")}),n.jsx("option",{value:"normal",children:i("chat.idle_injection_mode_normal")}),n.jsx("option",{value:"idle",children:i("chat.idle_injection_mode_idle")})]}),n.jsx(pl,{children:i("chat.idle_injection_mode_desc")})]}),W==="idle"&&n.jsxs("div",{className:Bt,children:[n.jsx("label",{className:ze,htmlFor:"ii-wait",children:i("chat.idle_injection_wait_ms")}),n.jsx("input",{id:"ii-wait",type:"number",value:he,onChange:function(Fe){Ne(Fe.target.value)},className:Je,min:0,step:.5,disabled:!T}),n.jsx(pl,{children:i("chat.idle_injection_wait_ms_desc")})]}),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_timeout_toggle")}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("chat.idle_injection_timeout_toggle_desc")})]}),n.jsx("button",{type:"button",onClick:function(){X(!Y)},className:Ft(Y),"aria-pressed":Y,"aria-label":i("chat.idle_injection_timeout_toggle"),disabled:!T,children:n.jsx("span",{className:Jt(Y)})})]}),n.jsxs("div",{className:Bt,children:[n.jsx("label",{className:ze,htmlFor:"ii-threshold",children:i("chat.idle_injection_timeout_threshold")}),n.jsx("input",{id:"ii-threshold",type:"number",value:F,onChange:function(Fe){U(Fe.target.value)},className:Je,min:1,step:.5,disabled:!T||!Y}),n.jsx(pl,{children:i("chat.idle_injection_timeout_threshold_desc")})]}),n.jsxs("div",{className:Bt,children:[n.jsx("label",{className:ze,htmlFor:"ii-cooldown",children:i("chat.idle_injection_timeout_cooldown")}),n.jsx("input",{id:"ii-cooldown",type:"number",value:P,onChange:function(Fe){K(Fe.target.value)},className:Je,min:.5,step:.5,disabled:!T||!Y}),n.jsx(pl,{children:i("chat.idle_injection_timeout_cooldown_desc")})]}),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),n.jsxs("div",{className:Bt,children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("scheduled_injection.title")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("scheduled_injection.subtitle")})]}),at.length===0&&!$e&&n.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:i("scheduled_injection.empty")}),at.map(function(Fe){return n.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(Fe.enabled?"border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900":"border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 opacity-60"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:Te(Fe)}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:oe(Fe)})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{type:"button",onClick:function(){Pe(Fe.id,Fe.enabled)},className:Ft(Fe.enabled),"aria-pressed":Fe.enabled,"aria-label":i("scheduled_injection.enabled"),children:n.jsx("span",{className:Jt(Fe.enabled)})}),n.jsx("button",{type:"button",onClick:function(){te(Fe.id)},className:"p-1 rounded text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors","aria-label":i("scheduled_injection.delete"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]}),Fe.message&&n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',Fe.message,'"']})]},Fe.id)}),$e?n.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-700 p-3 space-y-3 bg-gray-50 dark:bg-gray-900/50",children:[n.jsxs("div",{children:[n.jsx("label",{className:ze,children:i("scheduled_injection.time")}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:we,onChange:function(Fe){Ue(Fe.target.value)},className:Je+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(Fe){return n.jsx("option",{value:String(Fe),children:Fe},Fe)})}),n.jsx("span",{className:"text-gray-500",children:":"}),n.jsxs("select",{value:rt,onChange:function(Fe){fe(Fe.target.value)},className:Je+" w-20",children:[n.jsx("option",{value:"0",children:"00"}),n.jsx("option",{value:"15",children:"15"}),n.jsx("option",{value:"30",children:"30"}),n.jsx("option",{value:"45",children:"45"})]}),n.jsxs("select",{value:ve,onChange:function(Fe){ye(Fe.target.value)},className:Je+" w-20",children:[n.jsx("option",{value:"AM",children:"AM"}),n.jsx("option",{value:"PM",children:"PM"})]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:ze,children:i("scheduled_injection.repeat")}),n.jsxs("select",{value:qe,onChange:function(Fe){Ye(Fe.target.value)},className:Je,children:[n.jsx("option",{value:"every_day",children:i("scheduled_injection.repeat_every_day")}),n.jsx("option",{value:"weekdays",children:i("scheduled_injection.repeat_weekdays")}),n.jsx("option",{value:"weekends",children:i("scheduled_injection.repeat_weekends")}),n.jsx("option",{value:"custom",children:i("scheduled_injection.repeat_custom")})]})]}),qe==="custom"&&n.jsx("div",{children:n.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{d:0,k:"day_sun"},{d:1,k:"day_mon"},{d:2,k:"day_tue"},{d:3,k:"day_wed"},{d:4,k:"day_thu"},{d:5,k:"day_fri"},{d:6,k:"day_sat"}].map(function(Fe){var kt=ht.indexOf(Fe.d)!==-1;return n.jsx("button",{type:"button",onClick:function(){be(Fe.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(kt?"bg-primary-600 text-white":"bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-300 dark:hover:bg-gray-700"),children:i("scheduled_injection."+Fe.k)},Fe.d)})})}),lr&&n.jsxs("div",{children:[n.jsx("label",{className:ze,children:i("scheduled_injection.timezone")}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:lr})]}),n.jsxs("div",{children:[n.jsx("label",{className:ze,children:i("scheduled_injection.message")}),n.jsx("textarea",{value:Pt,onChange:function(Fe){$t(Fe.target.value)},className:Je+" resize-none",rows:2,placeholder:i("scheduled_injection.message_placeholder")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:bt,disabled:ut||qe==="custom"&&ht.length===0,className:"flex-1 px-3 py-1.5 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i(ut?"scheduled_injection.saving":"scheduled_injection.save")}),n.jsx("button",{type:"button",onClick:function(){Be(!1)},disabled:ut,className:"px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:i("common.close")})]})]}):n.jsxs("button",{type:"button",onClick:function(){Be(!0)},className:"w-full px-3 py-2 rounded-lg border border-dashed border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 text-sm hover:border-primary-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:["+ ",i("scheduled_injection.add")]})]})]})}),!f&&n.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsx("button",{onClick:cr,disabled:m,className:"flex-1 px-4 py-2 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i(m?"chat.idle_injection_saving":"chat.idle_injection_save")}),n.jsx("button",{onClick:ir,disabled:m||!T,className:"px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i(m?"chat.idle_injection_disabling":"chat.idle_injection_disable")})]})]})]})}function PV({items:e,sessionId:t,isReadOnly:r,onReorder:a,onCancelItem:i,onEditItem:o,t:l}){var[u,d]=x.useState(null),[f,g]=x.useState(null),h=x.useRef(0),m=x.useCallback(function(S,E){if(e[E]&&e[E].status==="dispatching"){S.preventDefault();return}d(E),S.dataTransfer.effectAllowed="move";try{S.dataTransfer.setData("text/plain",String(E))}catch{}},[e]),y=x.useCallback(function(S,E){S.preventDefault(),h.current++,e[E]&&e[E].status!=="dispatching"&&g(E)},[e]),v=x.useCallback(function(S,E){S.preventDefault(),S.dataTransfer.dropEffect="move"},[]),k=x.useCallback(function(){h.current--,h.current<=0&&(h.current=0,g(null))},[]),_=x.useCallback(function(S,E){if(S.preventDefault(),h.current=0,g(null),u===null||u===E){d(null);return}var A=e.slice(),T=A.splice(u,1)[0];A.splice(E,0,T),d(null);var C=A.filter(function(j){return j.status!=="dispatching"}).map(function(j){return j.id});a(C)},[u,e,a]),w=x.useCallback(function(){d(null),g(null),h.current=0},[]);return!e||e.length===0?null:n.jsxs("div",{className:"px-4 pt-2 pb-1 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex flex-col gap-1",children:[n.jsxs("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400",children:[l("chat.queued")," (",e.length,")"]}),e.map(function(S,E){var A=S.status==="dispatching",T=u===E,C=f===E&&u!==E,j=!A&&!r;return n.jsxs("div",{draggable:j,onDragStart:j?function(L){m(L,E)}:void 0,onDragEnter:j?function(L){y(L,E)}:void 0,onDragOver:j?function(L){v(L,E)}:void 0,onDragLeave:j?k:void 0,onDrop:j?function(L){_(L,E)}:void 0,onDragEnd:j?w:void 0,className:"flex items-center justify-between gap-2 px-2 py-1 rounded border text-sm group transition-colors duration-150 "+(A?"border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 opacity-50 ":"border-dashed border-gray-300 dark:border-gray-700 ")+(T?"opacity-40 bg-gray-200 dark:bg-gray-700 ":"")+(C?"border-solid border-accent-400 dark:border-accent-500 bg-accent-50 dark:bg-accent-900/20 ":"")+(j?"cursor-grab active:cursor-grabbing ":""),children:[j&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 dark:text-gray-500 opacity-0 group-hover:opacity-100 transition-opacity",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8h16M4 16h16"})}),n.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer",role:"button",tabIndex:0,onClick:function(){o(S)},onKeyDown:function(L){(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),o(S))},title:l("chat.edit_queued"),"aria-label":l("chat.edit_queued"),children:[n.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:S.source||"queued"}),S.priority==="urgent"&&n.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-200",children:"urgent"}),n.jsx("span",{className:"truncate text-gray-700 dark:text-gray-300 group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:S.displayContent||S.text||""}),!A&&!r&&n.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 group-hover:text-accent-500 dark:text-gray-500 dark:group-hover:text-accent-400 transition-colors",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})]}),!A&&!r&&n.jsx("button",{type:"button",onClick:function(L){L.stopPropagation(),i(S.id)},className:"text-xs text-gray-500 hover:text-red-600 dark:hover:text-red-400 px-1",title:l("chat.cancel_queued"),"aria-label":l("chat.cancel_queued"),children:"×"})]},S.id)})]})}function FV(e){if(!e||typeof e!="string")return[];const t=[],r=e.split(`
|
|
121
|
-
`);for(let a=0;a<r.length;a++){const i=r[a].trim();if(i)try{t.push(JSON.parse(i))}catch{}}return t.sort((a,i)=>(a.seq||0)-(i.seq||0)),t}function tu(e){return!!e&&typeof e=="object"&&typeof e.$ref=="string"}function Tl(e){if(!tu(e))return null;const t=/(\d+)/.exec(e.$ref);return t?Number(t[1]):null}function BV(e){const t=[],r=new Map;let a=null,i=null;for(const u of e)switch(u.type){case"context":a=u;break;case"store_snapshot":i=u;break;case"request":{const d={seq:u.seq,ts:u.ts,provider:u.provider,model:u.model,url:u.url,headers:u.headers||{},body:u.body,params:u.params||{},sentEstTokens:u.estWireTokens,bodyBytes:u.bodyBytes,shrink:u.shrink||null,fingerprint:u.fingerprint||u.cache&&u.cache.fingerprint||null,cache:u.cache||null,chunks:[],response:null,context:null,store:null,bubbleMessageID:null,compaction:null,messageDrop:null};a&&(a.reqSeq==null||a.reqSeq===u.seq)&&(d.context=a,a=null),i&&(i.reqSeq==null||i.reqSeq===u.seq)&&(d.store=i,i=null),t.push(d),r.set(u.seq,d);break}case"chunk":{const d=r.get(u.reqSeq);d&&d.chunks.push(u);break}case"response_end":{const d=r.get(u.reqSeq);d&&(d.response=u);break}case"bubble_map":{const d=r.get(u.reqSeq);d&&(d.bubbleMessageID=u.messageID);break}case"compaction":{let d=null;for(const f of t)if(f.seq<=u.seq)d=f;else break;d&&(d.compaction=u);break}case"message_drop":{const d=r.get(u.reqSeq);d&&(d.messageDrop=u);break}}let o=null,l=null;for(const u of t){u.context?l=u.seq:u.contextFrom=l,u.chunks.sort((d,f)=>(d.seq||0)-(f.seq||0)),u.chunkCount=u.chunks.length,u.interArrivalGaps=[];for(let d=1;d<u.chunks.length;d++)u.interArrivalGaps.push((u.chunks[d].ts||0)-(u.chunks[d-1].ts||0));u.sentActualTokens=u.response&&u.response.usage?u.response.usage.prompt_tokens:null,u.storeTokens=u.store?u.store.storeTokens:null,u.storeMessages=u.store?u.store.storeMessages:null,u.trimmed=u.storeTokens!=null&&u.sentActualTokens!=null?Math.max(0,u.storeTokens-u.sentActualTokens):null,u.chunks.length>0&&u.ts!=null?u.ttftMs=(u.chunks[0].ts||0)-u.ts:u.response&&u.response.ttftMs!=null?u.ttftMs=u.response.ttftMs:u.ttftMs=null,u.totalMs=u.response?u.response.totalMs:null,u.status=u.response?u.response.status:null,u.finishReason=u.response?u.response.finishReason:null,u.paveContext=u.response&&u.response.paveContext||null,u.sentActualDelta=o!=null&&u.sentActualTokens!=null?u.sentActualTokens-o:null,u.sentActualTokens!=null&&(o=u.sentActualTokens),u.purpose=zV(u)}return t}function zV(e){if(e.status!=null&&e.status>=400)return"retry";const t=e.finishReason;return t==="tool_calls"?"tool-iteration":t==="length"?"length":"assistant"}function UV(e){const t=[];let r=null,a=null;for(const i of e)(r===null||a==="stop"||a==="error")&&(r={index:t.length,requests:[]},t.push(r)),r.requests.push(i),a=i.finishReason;return t}function qV(e){return e.map(t=>({seq:t.seq,ts:t.ts,storeTokens:t.storeTokens,sentEst:t.sentEstTokens,sentActual:t.sentActualTokens,trimmed:t.trimmed,tokReal:t.context?t.context.tokReal:null,threshold:t.context?t.context.threshold:null,usable:t.context?t.context.usable:null,limit:t.context?t.context.limit:null,needsCompaction:t.context?!!t.context.needsCompaction:!1,compactionMarker:!!t.compaction,dropMarker:!!t.messageDrop}))}function HV(e){return e.filter(t=>t.type==="compaction")}function $V(e){return e.filter(t=>t.type==="message_drop")}function WV(e,t){const r=f=>{const g=Array.isArray(f)?f.slice():[];return g.length&&g[0]&&g[0].role==="system"?g.slice(1):g},a=r(e),i=r(t),o=f=>{const g={};for(const h of f){const m=h&&h.role||"?";g[m]=(g[m]||0)+1}return g},l=o(a),u=o(i),d=[];for(const f of new Set([...Object.keys(l),...Object.keys(u)])){const g=l[f]||0,h=u[f]||0;g!==h&&d.push({role:f,before:g,after:h,delta:g-h})}return d.sort((f,g)=>g.delta-f.delta),{prevLen:a.length,currLen:i.length,roles:d}}function VV(e){const t=e&&e.raw;if(t==="[DONE]")return{parts:[{type:"done",piece:""}]};let r;try{r=JSON.parse(t)}catch{return{parts:[{type:"other",piece:""}]}}const a=[],i=r&&r.choices&&r.choices[0]&&r.choices[0].delta;if(i){const o=i.reasoning_content??i.reasoning??i.thinking;if(o!=null&&o!==""&&a.push({type:"reasoning",piece:o}),i.content!=null&&i.content!==""&&a.push({type:"text",piece:i.content}),i.tool_calls&&i.tool_calls.length){const u=(i.tool_calls[0]||{}).function||{};a.push({type:"tool",piece:(u.name?u.name+" ":"")+(u.arguments!=null?u.arguments:"")})}}return r&&r.usage&&a.push({type:"usage",piece:JSON.stringify(r.usage)}),a.length===0&&a.push({type:"other",piece:""}),{parts:a}}function y4(e){try{return JSON.stringify(e)}catch{return String(e)}}function b4(e){return e?e.reasoning_content!=null&&e.reasoning_content!==""?!0:Array.isArray(e.content)?e.content.some(t=>t&&t.type==="reasoning"&&t.text):!1:!1}function GV(e,t){const r=Array.isArray(e)?e:[],a=Array.isArray(t)?t:[],i=a.length&&a[0]&&a[0].role==="system"?a.slice(1):a.slice(),o=Math.max(r.length,i.length),l=[];let u=-1,d=1;for(let f=0;f<o;f++){const g=f<r.length?r[f]:void 0,h=f<i.length?i[f]:void 0,m=g===void 0?void 0:y4(g),y=h===void 0?void 0:y4(h),v=m===void 0?null:m.length,k=y===void 0?null:y.length;v!=null&&(d=Math.max(d,v)),k!=null&&(d=Math.max(d,k));const _=m!==y;let w="unchanged";if(g===void 0)w="added";else if(h===void 0)w="dropped";else if(_){const S=g.role||h.role;k<v?S==="tool"?w="tool output stubbed":b4(g)&&!b4(h)?w="reasoning stripped":w="text capped":w="changed"}_&&u<0&&(u=f),l.push({i:f,role:(g||h||{}).role||"?",beforeBytes:v,afterBytes:k,changed:_,tag:w})}return{rows:l,firstChanged:u,maxBytes:d}}function KV(e){const t=typeof e=="string"?FV(e):Array.isArray(e)?e:[],r=BV(t),a=UV(r),i=qV(r),o=HV(t),l=$V(t);return{events:t,requests:r,turns:a,timeline:i,compactions:o,messageDrops:l}}function af(e,t){if(e==null)return"(none)";if(e&&typeof e=="object"&&typeof e.$ref=="string"){const r=Tl(e);if(t&&r!=null&&t.has(r)){const a=t.get(r);try{return typeof a=="string"?a:JSON.stringify(a,null,2)}catch{return String(a)}}return`(large — spilled to ${e.$ref}, not fetched)`}try{return typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return String(e)}}function YV(e){return e?Object.keys(e).map(t=>`${t}=${typeof e[t]=="object"?JSON.stringify(e[t]):e[t]}`).join(" "):""}function CA(e,t){const r=[];r.push(`--- Request #${e.seq} [${e.purpose}] ${e.provider||"?"}/${e.model||"?"} ---`),e.url&&r.push(`url: ${e.url}`);const a=YV(e.params);if(a&&r.push(`params: ${a}`),r.push(`sent est: ${e.sentEstTokens??"?"} sent actual (prompt_tokens): ${e.sentActualTokens??"?"} store: ${e.storeTokens??"?"}`),r.push(`status: ${e.status??"?"} finishReason: ${e.finishReason??"?"} ttft: ${e.ttftMs??"?"}ms total: ${e.totalMs??"?"}ms`),e.paveContext&&r.push(`resolvedModel: ${e.paveContext.resolvedModel??"?"} contextFloor: ${e.paveContext.contextFloor??"?"}`),e.bubbleMessageID&&r.push(`bubble messageID: ${e.bubbleMessageID}`),r.push("REQUEST HEADERS (redacted):"),r.push(af(e.headers,t)),r.push("REQUEST BODY (exact bytes sent):"),r.push(af(e.body,t)),e.response){const i=e.response.assembled;r.push("RESPONSE (assembled):"),i&&typeof i=="object"&&i.$ref?r.push(af(i,t)):i&&(i.reasoning&&r.push(`reasoning: ${i.reasoning}`),r.push(`text: ${i.text||""}`),i.tool_calls&&i.tool_calls.length&&r.push(`tool_calls: ${JSON.stringify(i.tool_calls)}`))}if(e.context){const i=e.context;r.push(`CONTEXT: limit=${i.limit} usable=${i.usable} margin=${i.margin} threshold=${i.threshold} tokReal=${i.tokReal} needsCompaction=${i.needsCompaction} source=${i.source??""} windowSource=${i.windowSource??i.epmWindowSignal??""}`)}if(e.compaction){const i=e.compaction,o=[`COMPACTION [${i.trigger}]`];i.deletedMessages!=null&&o.push(`deleted=${i.deletedMessages}`),i.summaryTokens!=null&&o.push(`summaryTok=${i.summaryTokens}`),i.before!=null&&o.push(`before=${i.before}`),i.after!=null&&o.push(`after=${i.after}`),typeof i.handoffFresh=="boolean"&&o.push(`handoffFresh=${i.handoffFresh}`),r.push(o.join(" "))}if(e.messageDrop){const i=e.messageDrop;r.push(`⚠ MESSAGE DROP wire ${i.wireBefore}→${i.wireAfter} (vs req #${i.prevSeq}, no compaction`+(i.storeMessages!=null?`, store intact=${i.storeMessages}`:"")+")")}return r.join(`
|
|
122
|
-
`)}function TA(e){const t=[`--- Chunks for request #${e.seq} (${e.chunkCount}) ---`],r=e.ts;for(let a=0;a<e.chunks.length;a++){const i=e.chunks[a],o=a===0?r!=null?i.ts-r:0:i.ts-e.chunks[a-1].ts;t.push(`[+${o}ms]${i.kind?" ("+i.kind+")":""} ${i.raw}`)}return t.join(`
|
|
123
|
-
`)}function XV(e,t){if(!e.response)return`(no response captured for request #${e.seq})`;const r=e.response.assembled,a=[`--- Response for request #${e.seq} (status ${e.status}, ${e.finishReason}) ---`];return r&&typeof r=="object"&&r.$ref?a.push(af(r,t)):r&&(r.reasoning&&a.push(`reasoning:
|
|
124
|
-
${r.reasoning}`),a.push(`text:
|
|
125
|
-
${r.text||""}`),r.tool_calls&&r.tool_calls.length&&a.push(`tool_calls:
|
|
126
|
-
${JSON.stringify(r.tool_calls,null,2)}`)),e.response.usage&&a.push(`usage: ${JSON.stringify(e.response.usage)}`),a.join(`
|
|
127
|
-
`)}function v4(e,t,r){const{requests:a,timeline:i,compactions:o,messageDrops:l}=e,u=[];u.push(`=== PAVE Inspector session ${t||""} ===`);const d=(l||[]).length;u.push(`requests: ${a.length} compactions: ${o.length}`+(d?` ⚠ message-drops: ${d}`:""));const f=a.find(g=>g.context);f&&f.context&&u.push(`context window: limit ${f.context.limit} / usable ${f.context.usable} / threshold ${f.context.threshold}`),u.push("");for(const g of a)u.push(CA(g,r)),g.chunkCount&&(u.push(`CHUNKS (${g.chunkCount}):`),u.push(TA(g))),u.push("");u.push("TIMELINE:"),u.push("seq store sent_est sent_actual threshold compaction");for(const g of i)u.push(`${g.seq} ${g.storeTokens??""} ${g.sentEst??""} ${g.sentActual??""} ${g.threshold??""} ${g.compactionMarker?"YES":""}`);return u.join(`
|
|
128
|
-
`)}function QV(e){const t=new Set;for(const r of e.requests||[])for(const a of[r.body,r.response&&r.response.assembled])if(a&&typeof a=="object"&&typeof a.$ref=="string"){const i=Tl(a);i!=null&&t.add(i)}return Array.from(t)}function Fs(e){return e==null?"—":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e)}const Yd=[{key:"storeTokens",label:"store (growing)",stroke:"#10b981",dash:null,desc:"Full persisted history — grows every response, drops at compaction."},{key:"sentEst",label:"sent (est)",stroke:"#f59e0b",dash:"4 3",desc:"Our estimateWireTokens of what is sent this request."},{key:"sentActual",label:"sent (actual)",stroke:"#0ea5e9",dash:null,desc:"Provider's actual prompt_tokens — what was really sent."},{key:"tokReal",label:"tokReal (decision)",stroke:"#f43f5e",dash:"5 2",desc:"The context-token count the compaction check compares against threshold."}],k4=[{key:"threshold",label:"threshold",stroke:"#eab308",desc:"Compact when tokReal exceeds this (= ⌊usable × margin⌋)."},{key:"usable",label:"usable",stroke:"#8b5cf6",desc:"Context window minus the output reserve."},{key:"limit",label:"limit",stroke:"#ef4444",desc:"Full context window (EPM floor or model default)."}];function ZV({timeline:e,selectedSeq:t,onSelectSeq:r,height:a=240}){const[i,o]=x.useState(null),[l,u]=x.useState("data"),[d,f]=x.useState(!1),g=x.useRef(null),[h,m]=x.useState(720);x.useEffect(()=>{const j=g.current;if(!j||typeof ResizeObserver>"u")return;const L=new ResizeObserver(O=>{const I=O[0]&&O[0].contentRect&&O[0].contentRect.width;I&&I>0&&m(Math.round(I))});return L.observe(j),()=>L.disconnect()},[]);const y={top:16,right:116,bottom:34,left:56},v=Math.max(1,h-y.left-y.right),k=Math.max(1,a-y.top-y.bottom),_=Array.isArray(e)?e:[],w=x.useMemo(()=>{if(_.length===0)return 1;let j=0;for(const L of _){for(const O of Yd)L[O.key]!=null&&(j=Math.max(j,L[O.key]));L.threshold!=null&&(j=Math.max(j,L.threshold)),l==="window"&&(L.usable!=null&&(j=Math.max(j,L.usable)),L.limit!=null&&(j=Math.max(j,L.limit)))}return Math.max(1,Math.ceil(j*1.12))},[_,l]);if(_.length===0)return n.jsx("div",{className:"h-40 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No requests captured for this session yet."});const S=j=>y.left+(_.length===1?v/2:j/(_.length-1)*v),E=j=>y.top+k-Math.min(j,w)/w*k,A=j=>{const L=[];let O=!1;return _.forEach((I,B)=>{if(I[j]==null){O=!1;return}L.push(`${O?"L":"M"} ${S(B).toFixed(1)} ${E(I[j]).toFixed(1)}`),O=!0}),L.join(" ")},T=()=>{const j=[];let L=[];const O=()=>{if(L.length){const I=L.map(z=>`${S(z).toFixed(1)} ${E(_[z].storeTokens).toFixed(1)}`),B=L.slice().reverse().map(z=>`${S(z).toFixed(1)} ${E(_[z].sentActual).toFixed(1)}`);j.push("M "+I.join(" L ")+" L "+B.join(" L ")+" Z")}L=[]};return _.forEach((I,B)=>{I.storeTokens!=null&&I.sentActual!=null&&I.storeTokens>I.sentActual?L.push(B):O()}),O(),j.join(" ")},C=[0,.25,.5,.75,1].map(j=>Math.round(w*j));return n.jsxs("div",{ref:g,className:"relative",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1 px-1",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Context timeline — store vs sent"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>f(j=>!j),className:"text-[11px] px-2 py-0.5 rounded transition-colors "+(d?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"),title:"Show/hide the legend explaining every label",children:"legend"}),n.jsxs("button",{type:"button",onClick:()=>u(j=>j==="data"?"window":"data"),className:"text-[11px] px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"Toggle Y scale between fit-to-data and the full context window",children:["scale: ",l==="data"?"fit data":"full window"]})]})]}),d&&n.jsxs("div",{className:"mb-2 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/60 p-2 text-[11px] space-y-1",children:[n.jsxs("div",{className:"pb-1 mb-1 border-b border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-300",children:["The two message arrays: ",n.jsx("b",{children:"store"})," = the full persisted history (grows every response, drops at compaction). ",n.jsx("b",{children:"sent"})," = the per-request wire actually sent, rebuilt and trimmed each request — this is the one that fluctuates. (There is only one store; the fluctuating array is “sent”, not a second store.)"]}),Yd.map(j=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 h-0.5 mt-1.5 flex-shrink-0",style:{background:j.stroke}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:j.label})," ",n.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",j.desc]})]})]},j.key)),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 h-2 mt-0.5 rounded-sm flex-shrink-0",style:{background:"#10b981",opacity:.25}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"trimmed"})," ",n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— shaded only where store > sent (net trim). sent (prompt_tokens) includes system + tools, so this is a conservative floor on what was trimmed."})]})]}),k4.map(j=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 flex-shrink-0",style:{borderColor:j.stroke}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:j.label})," ",n.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",j.desc]})]})]},j.key)),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 flex-shrink-0",style:{borderColor:"#d946ef"}}),n.jsxs("span",{children:[n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"compact"})," ",n.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— a compaction ran at this request (vertical marker)."})]})]})]}),n.jsxs("svg",{width:"100%",height:a,viewBox:`0 0 ${h} ${a}`,preserveAspectRatio:"xMidYMid meet",className:"overflow-visible select-none block",onMouseLeave:()=>o(null),children:[C.map((j,L)=>{const O=E(j);return n.jsxs("g",{children:[n.jsx("line",{x1:y.left,y1:O,x2:h-y.right,y2:O,stroke:"currentColor",strokeOpacity:.08,className:"text-gray-500"}),n.jsx("text",{x:y.left-6,y:O,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Fs(j)})]},"yt"+L)}),n.jsx("path",{d:T(),fill:"#10b981",fillOpacity:.1,stroke:"none",pointerEvents:"none"}),k4.map(j=>{const L=_[_.length-1],O=L&&L[j.key];if(O==null||O>w)return null;const I=E(O);return n.jsxs("g",{children:[n.jsx("line",{x1:y.left,y1:I,x2:h-y.right,y2:I,stroke:j.stroke,strokeOpacity:.5,strokeDasharray:"2 4"}),n.jsxs("text",{x:h-y.right+4,y:I,dominantBaseline:"middle",className:"text-[9px]",fill:j.stroke,fillOpacity:.9,children:[j.label," ",Fs(O)]})]},"ref"+j.key)}),_.map((j,L)=>j.compactionMarker?n.jsxs("g",{children:[n.jsx("line",{x1:S(L),y1:y.top,x2:S(L),y2:y.top+k,stroke:"#d946ef",strokeOpacity:.7,strokeDasharray:"3 3",strokeWidth:1.5}),n.jsx("text",{x:S(L),y:y.top-4,textAnchor:"middle",className:"text-[8px] font-semibold",fill:"#d946ef",children:"compact"})]},"cm"+L):null),Yd.map(j=>n.jsx("path",{d:A(j.key),fill:"none",stroke:j.stroke,strokeWidth:2,strokeDasharray:j.dash||void 0,strokeLinejoin:"round",strokeLinecap:"round"},j.key)),_.map((j,L)=>{const O=S(L),I=t!=null&&j.seq===t;return n.jsxs("g",{children:[Yd.map(B=>j[B.key]!=null?n.jsx("circle",{cx:O,cy:E(j[B.key]),r:I?3.5:2.5,fill:B.stroke,stroke:"white",strokeWidth:I?1:.5,className:"dark:stroke-gray-950"},B.key):null),n.jsx("rect",{x:O-Math.max(6,v/_.length/2),y:y.top,width:Math.max(12,v/_.length),height:k,fill:I?"#0ea5e9":"transparent",fillOpacity:I?.06:0,className:"cursor-pointer",onMouseEnter:()=>o(L),onClick:()=>r&&r(j.seq)}),n.jsxs("text",{x:O,y:a-8,textAnchor:"middle",className:"text-[8px] fill-gray-400 dark:fill-gray-500",children:["#",j.seq]})]},"pt"+L)}),i!=null&&_[i]&&(()=>{const j=_[i],L=S(i),O=158,I=106,B=Math.min(Math.max(L-O/2,y.left),h-y.right-O),z=y.top+4;return n.jsxs("g",{className:"pointer-events-none",children:[n.jsx("rect",{x:B,y:z,width:O,height:I,rx:4,className:"fill-gray-900/95 dark:fill-gray-800/95"}),n.jsxs("text",{x:B+8,y:z+14,className:"text-[9px] font-semibold fill-white",children:["request #",j.seq,j.compactionMarker?" · compaction":""]}),n.jsxs("text",{x:B+8,y:z+28,className:"text-[9px] fill-emerald-300",children:["store: ",Fs(j.storeTokens)]}),n.jsxs("text",{x:B+8,y:z+40,className:"text-[9px] fill-amber-300",children:["sent est: ",Fs(j.sentEst)]}),n.jsxs("text",{x:B+8,y:z+52,className:"text-[9px] fill-sky-300",children:["sent actual: ",Fs(j.sentActual)]}),n.jsxs("text",{x:B+8,y:z+64,className:"text-[9px] fill-rose-300",children:["tokReal: ",Fs(j.tokReal)]}),n.jsxs("text",{x:B+8,y:z+76,className:"text-[9px] fill-yellow-300",children:["threshold: ",Fs(j.threshold)]}),n.jsxs("text",{x:B+8,y:z+90,className:"text-[9px] fill-emerald-200/80",children:["trimmed: ",Fs(j.trimmed)]})]})})()]})]})}const _4={assistant:"bg-sky-100 text-sky-700 dark:bg-sky-900/40 dark:text-sky-300","tool-iteration":"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",length:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",retry:"bg-rose-100 text-rose-700 dark:bg-rose-900/40 dark:text-rose-300"};function Tb(e){return e==null?"—":e.toLocaleString()}function JV({turns:e,selectedSeq:t,onSelect:r}){const[a,i]=x.useState(()=>new Set),o=x.useCallback(u=>{i(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),l=x.useMemo(()=>{const u=[];return(e||[]).forEach(d=>{u.push({kind:"group",turnIndex:d.index,count:d.requests.length}),a.has(d.index)||d.requests.forEach(f=>u.push({kind:"req",rec:f}))}),u},[e,a]);return!e||e.length===0?n.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"No requests."}):n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsxs("div",{className:"flex-shrink-0 px-3 py-1.5 text-[10px] leading-snug text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/40",children:[n.jsx("b",{className:"text-gray-600 dark:text-gray-300",children:"Turn"})," = one user prompt + every EPM request it triggers — the agent loop (assistant → tool call → tool result → next request) until a final answer, plus any retries and compaction injections. So one turn can be several requests."]}),n.jsx("div",{className:"flex-1 min-h-0",children:n.jsx(S5,{style:{height:"100%"},data:l,itemContent:(u,d)=>{if(d.kind==="group"){const h=a.has(d.turnIndex);return n.jsxs("button",{type:"button",onClick:()=>o(d.turnIndex),className:"w-full flex items-center gap-2 px-3 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors sticky top-0",children:[n.jsx("svg",{className:"w-3 h-3 transition-transform "+(h?"-rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),"Turn ",d.turnIndex+1,n.jsxs("span",{className:"font-normal text-gray-400 dark:text-gray-500",children:["· ",d.count," req"]})]})}const f=d.rec,g=t!=null&&f.seq===t;return n.jsxs("button",{type:"button",onClick:()=>r(f.seq),className:"w-full text-left px-3 py-2 border-b border-gray-100 dark:border-gray-800/60 transition-colors "+(g?"bg-primary-50 dark:bg-primary-900/20 border-l-2 border-l-primary-500":"hover:bg-gray-50 dark:hover:bg-gray-900 border-l-2 border-l-transparent"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 w-8 flex-shrink-0",children:["#",f.seq]}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 "+(_4[f.purpose]||_4.assistant),children:f.purpose}),n.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300 truncate min-w-0 flex-1",children:f.model}),f.compaction&&n.jsx("span",{className:"text-[9px] px-1 rounded bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-900/40 dark:text-fuchsia-300 flex-shrink-0",title:"A compaction followed this request",children:"⤵ compact"}),f.messageDrop&&n.jsx("span",{className:"text-[9px] px-1 rounded bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300 flex-shrink-0 font-semibold",title:"Unexpected wire message drop (#1858 regression canary)",children:"⚠ drop"}),f.status!=null&&n.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 "+(f.status>=400?"text-red-500":"text-green-600 dark:text-green-400"),children:f.status})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 mt-1 pl-10 text-[10px] text-gray-400 dark:text-gray-500 font-mono",children:[n.jsxs("span",{title:"actual prompt_tokens sent this request",children:["sent ",Tb(f.sentActualTokens)," tokens"]}),n.jsxs("span",{title:"growing part-store size",children:["store ",Tb(f.storeTokens)," tokens"]}),f.sentActualDelta!=null&&n.jsxs("span",{className:f.sentActualDelta>=0?"text-amber-500":"text-emerald-500",title:"Δ sent actual vs previous request",children:[f.sentActualDelta>=0?"+":"",Tb(f.sentActualDelta)," vs prev"]}),f.ttftMs!=null&&n.jsxs("span",{title:"time to first token",children:["ttft ",f.ttftMs," ms"]})]})]})}})})]})}function Hc({text:e,getText:t,label:r="Copy",className:a="",title:i}){const[o,l]=x.useState(!1),[u,d]=x.useState(!1),f=x.useRef(null);x.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const g=x.useCallback(async h=>{h.stopPropagation();const m=typeof t=="function"?t():e;f.current&&clearTimeout(f.current);try{if(!navigator.clipboard)throw new Error("clipboard unavailable");await navigator.clipboard.writeText(m==null?"":String(m)),d(!1),l(!0),f.current=setTimeout(()=>l(!1),1500)}catch(y){console.error("Copy failed:",y),l(!1),d(!0),f.current=setTimeout(()=>d(!1),1800)}},[e,t]);return n.jsx("button",{type:"button",onClick:g,title:i||r,"aria-label":i||r,className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium transition-colors "+(o?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 ":u?"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300 ":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 ")+a,children:u?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"copy failed"]}):o?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"copied"]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),r]})})}function eG(e,t){return e==="all"?!0:e==="none"?!1:t<1}function w4({name:e}){return e==null?null:typeof e=="number"?n.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:["[",e,"]"]}):n.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:JSON.stringify(e)})}function tG({value:e}){const[t,r]=x.useState(!1),a=JSON.stringify(e);return a.length<=200?n.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:a}):n.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:[t?a:a.slice(0,200)+"…",n.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),r(o=>!o)},className:"ml-1 text-[10px] text-primary-500 dark:text-primary-400 hover:underline align-baseline",children:t?"less":`+${(a.length-200).toLocaleString()} more`})]})}function rG({value:e}){return e===null?n.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"null"}):typeof e=="string"?n.jsx(tG,{value:e}):typeof e=="number"?n.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:String(e)}):typeof e=="boolean"?n.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:String(e)}):n.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:String(e)})}function RA({data:e,name:t,depth:r=0,openMode:a="auto"}){const i=Array.isArray(e),o=e&&typeof e=="object"&&!i,[l,u]=x.useState(()=>eG(a,r)),d={paddingLeft:r*12+"px"};if(!o&&!i)return n.jsxs("div",{style:d,className:"leading-5 break-all",children:[n.jsx("span",{className:"inline-block w-3"}),n.jsx(w4,{name:t}),t!=null&&n.jsx("span",{className:"text-gray-400",children:": "}),n.jsx(rG,{value:e})]});const f=i?e.map((m,y)=>[y,m]):Object.entries(e),[g,h]=i?["[","]"]:["{","}"];return n.jsxs("div",{children:[n.jsxs("div",{style:d,className:"leading-5 cursor-pointer rounded hover:bg-gray-100/60 dark:hover:bg-gray-800/40",onClick:()=>u(m=>!m),children:[n.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 select-none",children:f.length?l?"▾":"▸":" "}),n.jsx(w4,{name:t}),t!=null&&n.jsx("span",{className:"text-gray-400",children:": "}),n.jsxs("span",{className:"text-gray-400",children:[g,l?"":f.length?` … ${h}`:h]}),!l&&f.length>0&&n.jsxs("span",{className:"ml-1 text-[10px] text-gray-400 dark:text-gray-500",children:[f.length," ",i?"items":"keys"]})]}),l&&f.map(([m,y])=>n.jsx(RA,{data:y,name:m,depth:r+1,openMode:a},m)),l&&f.length>0&&n.jsxs("div",{style:d,className:"leading-5 text-gray-400",children:[n.jsx("span",{className:"inline-block w-3"}),h]})]})}function vo({value:e,bytes:t,onResolveRef:r,label:a="JSON"}){const[i,o]=x.useState(null),[l,u]=x.useState(!1),[d,f]=x.useState(null),[g,h]=x.useState("all"),[m,y]=x.useState(0),[v,k]=x.useState(!1);x.useEffect(()=>{o(null),u(!1),f(null)},[e]);const _=i??e,w=tu(_),S=x.useCallback(async()=>{if(r){u(!0),f(null);try{const T=Tl(_),C=await r(T);o(C)}catch(T){f(T&&T.message?T.message:"Failed to fetch")}finally{u(!1)}}},[_,r]);if(_==null)return n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"(none)"});if(w)return n.jsxs("div",{className:"text-xs",children:[n.jsx("button",{type:"button",onClick:S,disabled:l,className:"px-2 py-1 rounded border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:l?"Fetching…":`(large${t?" — "+t.toLocaleString()+" bytes":""}, click to fetch)`}),d&&n.jsx("div",{className:"mt-1 text-red-500 dark:text-red-400",children:d})]});const E=typeof _=="string"?_:JSON.stringify(_,null,2),A=_&&typeof _=="object";return n.jsxs("div",{className:"relative group",children:[n.jsxs("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity z-10 flex items-center gap-1",children:[A&&n.jsx("button",{type:"button",onClick:()=>k(T=>!T),className:"text-[10px] px-1.5 py-0.5 rounded "+(v?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),title:"Toggle the collapsible tree vs the original flat JSON",children:v?"tree":"raw"}),A&&!v&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>{h("all"),y(T=>T+1)},className:"text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Expand all",children:"expand"}),n.jsx("button",{type:"button",onClick:()=>{h("none"),y(T=>T+1)},className:"text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700",title:"Collapse all",children:"collapse"})]}),n.jsx(Hc,{getText:()=>E,label:"copy",title:`Copy ${a}`})]}),A&&!v?n.jsx("div",{className:"text-[11px] leading-relaxed font-mono bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-2 max-h-96 overflow-auto",children:n.jsx(RA,{data:_,openMode:g},`${g}-${m}`)}):n.jsx("pre",{className:"text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-words bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded p-2 max-h-96 overflow-auto text-gray-700 dark:text-gray-300",children:E})]})}const N4={user:"bg-sky-100 text-sky-700 dark:bg-sky-900/40 dark:text-sky-300",assistant:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",tool:"bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300",system:"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300"};function Xd(e){return e==null?"—":e>=1024?(e/1024).toFixed(1)+"KB":e+"B"}function nG({rec:e,onResolveRef:t}){const[r,a]=x.useState("idle"),[i,o]=x.useState(null),[l,u]=x.useState(null),d=e.store&&e.store.messages,f=e.body,g=d===void 0,h=x.useCallback(async()=>{a("loading"),o(null);try{const E=tu(d)?await t(Tl(d)):d,A=tu(f)?await t(Tl(f)):f,T=Array.isArray(E)?E:E&&E.messages||[],C=A&&A.messages||[];u(GV(T,C)),a("ready")}catch(E){o(E&&E.message?E.message:"failed to load"),a("error")}},[d,f,t]);if(g)return n.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 italic",children:"The store array wasn't captured for this session — relaunch openpave (Inspector Mode is default-on) to record it, then this diff will show which messages trimming rewrote and where the cache prefix breaks."});if(r!=="ready")return n.jsxs("div",{children:[n.jsx("button",{type:"button",onClick:h,disabled:r==="loading",className:"text-[11px] px-2 py-1 rounded bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",children:r==="loading"?"computing…":"Compute per-message trim diff"}),i&&n.jsx("div",{className:"text-[11px] text-red-500 mt-1",children:i})]});const{rows:m,firstChanged:y,maxBytes:v}=l,k=y>=0,_=k?m[y]:null,w=k?y:m.length,S=k?m.length-y:0;return n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"rounded-lg border p-2 text-[11px] "+(k?"border-amber-300/60 dark:border-amber-700/50 bg-amber-50 dark:bg-amber-900/20":"border-emerald-300/60 dark:border-emerald-700/50 bg-emerald-50 dark:bg-emerald-900/20"),children:k?n.jsxs(n.Fragment,{children:[n.jsxs("b",{className:"text-amber-700 dark:text-amber-300",children:["Cache prefix breaks at message #",y]})," (",_.role," · ",_.tag,"). The first ",w," message",w===1?"":"s"," are byte-identical to the store (cache-eligible); the ",S," from #",y," on differ, so they're re-prefilled."]}):n.jsxs(n.Fragment,{children:[n.jsx("b",{className:"text-emerald-700 dark:text-emerald-300",children:"No message was trimmed"})," — every message is byte-identical to the store, so nothing here forces a cache miss."]})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[10px] text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"inline-block w-3 h-2 rounded-sm bg-gray-300 dark:bg-gray-600"})," store (pre-trim)"]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"inline-block w-3 h-2 rounded-sm bg-sky-500"})," sent (post-trim)"]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"inline-block w-3 h-2 rounded-sm bg-fuchsia-400/50"})," trimmed off"]}),n.jsx("span",{className:"ml-auto",children:"oldest → newest (top → bottom)"})]}),n.jsxs("div",{className:"space-y-0.5",children:[m.slice(0,300).map(E=>{const A=k&&E.i===y,T=Math.round((E.beforeBytes||0)/v*100),C=Math.round((E.afterBytes||0)/v*100);return n.jsxs("div",{children:[A&&n.jsxs("div",{className:"flex items-center gap-2 my-1","aria-label":"cache prefix break",children:[n.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"}),n.jsx("span",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-400 whitespace-nowrap",children:"cache prefix breaks here ↓"}),n.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"})]}),n.jsxs("div",{className:"flex items-center gap-2 rounded pl-1 "+(E.changed?"bg-fuchsia-50/60 dark:bg-fuchsia-900/10":k&&E.i<y?"bg-emerald-50/50 dark:bg-emerald-900/10":""),children:[n.jsxs("span",{className:"w-7 text-right text-[10px] text-gray-400 dark:text-gray-500 flex-shrink-0",children:["#",E.i]}),n.jsx("span",{className:"text-[9px] px-1 rounded flex-shrink-0 w-14 text-center "+(N4[E.role]||N4.system),children:E.role}),n.jsxs("div",{className:"flex-1 min-w-0 h-3 rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative",title:`store ${Xd(E.beforeBytes)} → sent ${Xd(E.afterBytes)}`,children:[n.jsx("div",{className:"absolute inset-y-0 left-0 bg-gray-300 dark:bg-gray-600",style:{width:T+"%"}}),E.changed&&E.afterBytes!=null&&E.beforeBytes!=null&&E.afterBytes<E.beforeBytes&&n.jsx("div",{className:"absolute inset-y-0 bg-fuchsia-400/50",style:{left:C+"%",width:Math.max(0,T-C)+"%"}}),n.jsx("div",{className:"absolute inset-y-0 left-0 bg-sky-500",style:{width:C+"%"}})]}),n.jsx("span",{className:"w-24 text-right text-[9px] font-mono text-gray-500 dark:text-gray-400 flex-shrink-0",children:E.changed?`${Xd(E.beforeBytes)}→${Xd(E.afterBytes)}`:"cached"}),n.jsx("span",{className:"hidden sm:block w-28 text-[9px] text-gray-400 dark:text-gray-500 flex-shrink-0 truncate",title:E.tag,children:E.changed?E.tag:""})]})]},E.i)}),m.length>300&&n.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 pl-1 pt-1",children:["… ",m.length-300," more messages"]})]}),n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:"Sizes are JSON bytes per message (a proxy for tokens). “store” = the pre-trim rendered history; “sent” = what actually went on the wire this request. The first changed message is where the prompt stops matching the cached prefix."})]})}const S4=4,aG=2.8,Rb=e=>e==null?"—":e.toLocaleString();function Ab({chars:e,ratio:t,ratioNote:r,tokens:a}){if(e==null)return null;const i=Math.ceil(e/t),o=a!=null?a-i:0;return n.jsxs("span",{className:"block text-[10px] font-mono text-gray-400 dark:text-gray-500 leading-tight mt-px",children:["= ⌈",Rb(e)," chars ÷ ",t,"⌉",o?n.jsxs(n.Fragment,{children:[" + ",Rb(o)]}):null," = ",n.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/80",children:Rb(a)})," tok",n.jsxs("span",{className:"text-gray-300 dark:text-gray-600",children:[" · ",r,o?" + structure/attachments":""]})]})}function Ib({label:e,tokens:t,sub:r,calc:a,expanded:i,isOpen:o,onToggle:l}){return n.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[n.jsxs("button",{type:"button",onClick:l,className:"w-full flex items-start gap-2 py-1 px-1 text-left rounded hover:bg-gray-100/60 dark:hover:bg-gray-800/40",children:[n.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 mt-px",children:o?"▾":"▸"}),n.jsxs("span",{className:"flex-1 min-w-0",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-medium text-gray-700 dark:text-gray-200 flex-1",children:e}),n.jsxs("span",{className:"text-[11px] font-mono text-amber-600 dark:text-amber-400",children:[t==null?"—":t.toLocaleString()," tok"]}),r?n.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["· ",r]}):null]}),a]})]}),o&&n.jsx("div",{className:"pb-2 pl-1",children:i})]})}function iG({rec:e,onResolveRef:t,overheadSystem:r,overheadTools:a,toolCount:i,newMessageTokens:o,overheadSystemChars:l,overheadToolsChars:u,newMessageChars:d}){const f=tu(e.body),[g,h]=x.useState(()=>f?null:e.body),[m,y]=x.useState(()=>f?"idle":"ready"),[v,k]=x.useState(null),[_,w]=x.useState(null),S=x.useCallback(async()=>{if(!f){h(e.body),y("ready");return}y("loading"),k(null);try{const B=await t(Tl(e.body));h(B),y("ready")}catch(B){k(B&&B.message?B.message:"failed to load"),y("error")}},[f,e.body,t]),E=B=>{w(z=>z===B?null:B),m==="idle"&&S()},A=m==="ready",T=A&&g&&Array.isArray(g.messages)?g.messages:[],C=T.find(B=>B&&B.role==="system"),j=C?C.content:null,L=A&&g?g.tools:null,O=T.length?T[T.length-1]:null,I=(B,z)=>m==="loading"?n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"loading…"}):m==="error"?n.jsxs("div",{className:"text-[10px] text-red-500",children:[v||"failed to load"," —"," ",n.jsx("button",{type:"button",onClick:S,className:"underline hover:no-underline",children:"retry"})]}):B==null?n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"(not present in this request body)"}):n.jsx(vo,{value:B,onResolveRef:t,label:z});return n.jsxs("div",{className:"pt-1",children:[n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"how each figure is estimated (char-count ÷ ratio — no real tokenizer) · click to see the content:"}),n.jsx(Ib,{label:"system prompt",tokens:r,calc:n.jsx(Ab,{chars:l,ratio:S4,ratioNote:"natural language",tokens:r}),expanded:I(j,"system prompt"),isOpen:_==="system",onToggle:()=>E("system")}),n.jsx(Ib,{label:"tool schemas",tokens:a,sub:i?`${i} tools`:"",calc:n.jsx(Ab,{chars:u,ratio:aG,ratioNote:"JSON",tokens:a}),expanded:I(L,"tool schemas"),isOpen:_==="tools",onToggle:()=>E("tools")}),n.jsx(Ib,{label:"new message",tokens:o,calc:n.jsx(Ab,{chars:d,ratio:S4,ratioNote:"natural language",tokens:o}),expanded:I(O,"new message"),isOpen:_==="new",onToggle:()=>E("new")})]})}function sG({rec:e,prevRec:t,onSelectSeq:r}){const a=e&&e.messageDrop;if(!a)return null;const i=t&&t.body&&t.body.messages,o=e.body&&e.body.messages,u=Array.isArray(i)&&Array.isArray(o)?WV(i,o):null,d=t?n.jsxs("button",{type:"button",className:"underline underline-offset-2 hover:text-red-900 dark:hover:text-red-100",onClick:()=>r&&r(a.prevSeq),title:"Jump to the previous request",children:["request #",a.prevSeq]}):n.jsxs("span",{title:"That request is no longer in the capture",children:["request #",a.prevSeq]});return n.jsxs("div",{className:"mx-3 mt-2 rounded border border-red-300 bg-red-50 dark:border-red-800 dark:bg-red-950/40",children:[n.jsxs("div",{className:"px-3 py-2 border-b border-red-200 dark:border-red-900",children:[n.jsxs("div",{className:"text-[12px] font-semibold text-red-700 dark:text-red-300 flex items-center gap-1",children:["⚠ Unexpected message drop",n.jsx("span",{className:"font-normal text-red-500 dark:text-red-400",children:"— possible #1858 regression"})]}),n.jsxs("div",{className:"mt-0.5 text-[11px] text-red-700/90 dark:text-red-300/90",children:["The wire dropped ",n.jsxs("b",{children:[a.wireBefore," → ",a.wireAfter]})," conversation messages between"," ",d," and this one (#",e.seq,") with ",n.jsx("b",{children:"no compaction"}),a.storeMessages!=null&&n.jsxs(n.Fragment,{children:[" — store intact = ",n.jsx("b",{children:a.storeMessages})]}),". Trimming never drops whole messages, so this is a wrongful drop, not a designed trim."]}),n.jsxs("div",{className:"mt-1 text-[10px] text-red-600/80 dark:text-red-400/80",children:["Compare the raw wire arrays:"," ",t?n.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>r&&r(a.prevSeq),children:["raw request #",a.prevSeq]}):n.jsxs("span",{children:["request #",a.prevSeq," (evicted)"]})," · ",n.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>r&&r(e.seq),children:["raw request #",e.seq]})]})]}),u&&u.roles.length>0?n.jsxs("div",{className:"px-3 py-1.5",children:[n.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:["Messages by role (#",a.prevSeq," → #",e.seq,")"]}),u.roles.map(f=>n.jsxs("div",{className:"text-[11px] font-mono text-red-800 dark:text-red-200 flex items-center gap-2 py-0.5",children:[n.jsxs("span",{className:"inline-block w-20",children:["[",f.role,"]"]}),n.jsxs("span",{children:[f.before," → ",f.after]}),f.delta>0&&n.jsxs("span",{className:"text-red-600 dark:text-red-300 font-semibold",children:["−",f.delta," dropped"]})]},f.role)),n.jsx("div",{className:"mt-1 text-[10px] text-red-500/70 dark:text-red-400/70",children:"Exact messages: open the raw arrays above (the wire carries no ids, so per-message identity can’t be shown here)."})]}):n.jsx("div",{className:"px-3 py-1.5 text-[10px] text-red-500/80 dark:text-red-400/80",children:"Wire bodies are large (spilled) — open the raw requests above to compare the message arrays."})]})}const oG=["Request","Response","Chunks","Context","Lifecycle","Est vs actual"];function nr(e){return e==null?"—":typeof e=="number"?e.toLocaleString():String(e)}function mr({label:e,children:t,highlight:r}){return n.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 flex-shrink-0",children:e}),n.jsx("span",{className:"text-xs font-mono "+(r?"text-red-500 dark:text-red-400 font-semibold":"text-gray-700 dark:text-gray-200"),children:t==null||t===""?"—":t})]})}const _f={reasoning:"text-amber-600 dark:text-amber-400",text:"text-sky-700 dark:text-sky-300",tool:"text-violet-600 dark:text-violet-400",usage:"text-emerald-600 dark:text-emerald-400",done:"text-gray-400 dark:text-gray-600",other:"text-gray-500 dark:text-gray-500"},E4={reasoning:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",text:"bg-sky-100 text-sky-700 dark:bg-sky-900/40 dark:text-sky-300",tool:"bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300",usage:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",done:"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600",other:"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"};function lG({raw:e,parts:t}){const r="break-all whitespace-pre-wrap min-w-0 flex-1",a=[];for(const l of t){let u="";if(l.piece!==""&&(l.type==="text"||l.type==="reasoning")?u=JSON.stringify(l.piece):l.type==="usage"&&l.piece&&(u=l.piece),!u)continue;const d=e.indexOf(u);d>=0&&a.push({start:d,end:d+u.length,type:l.type})}if(!a.length)return n.jsx("span",{className:r+" text-gray-600 dark:text-gray-400",children:e});a.sort((l,u)=>l.start-u.start);const i=[];let o=0;return a.forEach((l,u)=>{l.start<o||(l.start>o&&i.push(n.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o,l.start)},"g"+u)),i.push(n.jsx("span",{className:"font-semibold "+(_f[l.type]||_f.other),children:e.slice(l.start,l.end)},"m"+u)),o=l.end)}),o<e.length&&i.push(n.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o)},"tail")),n.jsx("span",{className:r,children:i})}function Qd({n:e,name:t,sub:r,pct:a,trimmedPct:i,fill:o,dashed:l}){return n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"w-4 flex-shrink-0 text-[10px] text-gray-400 dark:text-gray-500 text-right leading-4",children:e}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[11px] text-gray-700 dark:text-gray-200",children:t}),r&&n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:r}),a!=null&&n.jsxs("div",{className:"h-2.5 w-full rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative "+(l?"ring-1 ring-inset ring-emerald-400/50":""),children:[i!=null&&n.jsx("div",{className:"absolute inset-y-0 left-0 bg-fuchsia-400/25",style:{width:Math.min(100,i)+"%"}}),n.jsx("div",{className:"absolute inset-y-0 left-0 "+(o||"bg-gray-400"),style:{width:Math.min(100,a)+"%"}})]})]})]})}function Mb({label:e}){return n.jsxs("div",{className:"pl-6 py-0.5 text-[10px] text-gray-400 dark:text-gray-500 flex items-center gap-1",children:[n.jsx("span",{"aria-hidden":!0,children:"↓"}),n.jsx("span",{children:e})]})}function cG({rec:e,prevRec:t,onSelectSeq:r,onResolveRef:a,onJumpToMessage:i,tab:o,onTabChange:l,showRaw:u,onShowRawChange:d}){if(!e)return n.jsx("div",{className:"h-full flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Select a request to inspect it."});const f=e.response,g=f?f.assembled:null,h=e.context,m=h&&h.limit!=null&&h.usable!=null?h.limit-h.usable:null,y=h&&h.threshold!=null&&h.tokReal!=null?h.threshold-h.tokReal:null,v=h?h.source==="estimate":!1,k=h&&(h.historicalEstimate!=null||h.lastPromptTokens!=null)&&h.newMessageTokens!=null,_=h?h.source==="actual"?h.lastPromptTokens:h.historicalEstimate:null,w=h&&h.historicalEstimate!=null&&h.staticOverhead!=null?h.historicalEstimate-h.staticOverhead:null;return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:["#",e.seq," · ",e.provider,"/",e.model,n.jsx("span",{className:"ml-2 text-xs font-normal px-1.5 py-0.5 rounded bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:e.purpose})]}),n.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 truncate",children:e.url})]}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsx(Hc,{getText:()=>CA(e),label:"request",title:"Copy this request (body + response + context)"}),f&&n.jsx(Hc,{getText:()=>XV(e),label:"response",title:"Copy the assembled response"}),e.chunkCount>0&&n.jsx(Hc,{getText:()=>TA(e),label:"chunks",title:"Copy all raw chunks"})]})]}),n.jsx(sG,{rec:e,prevRec:t,onSelectSeq:r}),n.jsx("div",{className:"flex items-center gap-1 px-3 pt-2 flex-shrink-0 border-b border-gray-200 dark:border-gray-800",children:oG.map(S=>n.jsx("button",{type:"button",onClick:()=>l(S),className:"px-2.5 py-1 text-xs font-medium rounded-t transition-colors "+(o===S?"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-100":"text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-900"),children:S},S))}),n.jsxs("div",{className:"flex-1 overflow-auto p-3 min-h-0",children:[o==="Request"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx(mr,{label:"fingerprint",children:e.fingerprint}),n.jsx(mr,{label:"bodyBytes",children:e.bodyBytes!=null?e.bodyBytes.toLocaleString():null}),e.shrink&&n.jsxs(mr,{label:"shrink rungs",children:[(e.shrink.rungsFired||[]).join(", ")||"(none)",e.shrink.fitted!=null?` fitted=${e.shrink.fitted}`:""]}),e.bubbleMessageID&&n.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 flex-shrink-0",children:"bubble msgID"}),i?n.jsx("button",{type:"button",onClick:()=>i(e.bubbleMessageID),className:"text-xs font-mono text-primary-600 dark:text-primary-400 hover:underline",title:"Jump to this message in the conversation",children:e.bubbleMessageID}):n.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-gray-200",children:e.bubbleMessageID})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Params"}),n.jsx(vo,{value:e.params,label:"params"})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Headers (redacted)"}),n.jsx(vo,{value:e.headers,label:"headers"})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Request body (exact bytes sent)"}),n.jsx(vo,{value:e.body,bytes:e.bodyBytes,onResolveRef:a,label:"body"})]})]}),o==="Response"&&n.jsx("div",{className:"space-y-3",children:f?n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"HTTP response (status line)"}),n.jsx(mr,{label:"HTTP status",highlight:e.status!=null&&e.status>=400,children:e.status})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Response headers (from EPM)"}),e.paveContext&&n.jsx(mr,{label:"x-pave-resolved-model",children:e.paveContext.resolvedModel}),e.paveContext&&n.jsx(mr,{label:"x-pave-context-floor",children:e.paveContext.contextFloor}),f.headers?n.jsxs("div",{className:"mt-1",children:[n.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"full header set (redacted):"}),n.jsx(vo,{value:f.headers,label:"response headers"})]}):n.jsx("div",{className:"mt-1 text-[10px] text-gray-400 dark:text-gray-500 italic",children:"Full header set is captured on newer sessions — relaunch openpave to record it."})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"From the SSE body"}),n.jsx(mr,{label:"finishReason",highlight:e.finishReason==="length",children:e.finishReason}),f.usage&&n.jsx(mr,{label:"prompt_tokens",children:nr(f.usage.prompt_tokens)}),f.usage&&n.jsx(mr,{label:"completion_tokens",children:nr(f.usage.completion_tokens)}),f.usage&&f.usage.total_tokens!=null&&n.jsx(mr,{label:"total_tokens",children:nr(f.usage.total_tokens)})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Assembled response (from the SSE body)"}),n.jsx(vo,{value:g,onResolveRef:a,label:"assembled"})]})]}):n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No response captured (in-flight or aborted)."})}),o==="Chunks"&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-3 py-1.5 bg-white/95 dark:bg-gray-950/95 backdrop-blur border-b border-gray-100 dark:border-gray-800 flex flex-wrap items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[n.jsxs("span",{children:["TTFT: ",n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.ttftMs!=null?e.ttftMs+"ms":"—"})]}),n.jsxs("span",{children:["total: ",n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.totalMs!=null?e.totalMs+"ms":"—"})]}),n.jsxs("span",{children:["chunks: ",n.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.chunkCount})]}),e.totalMs>0&&e.response&&e.response.usage&&e.response.usage.completion_tokens>0&&n.jsxs("span",{children:["throughput: ",n.jsxs("b",{className:"text-gray-700 dark:text-gray-200",children:[(e.response.usage.completion_tokens/(e.totalMs/1e3)).toFixed(1)," tok/s"]})]}),n.jsxs("label",{className:"ml-auto flex items-center gap-1 cursor-pointer select-none",children:[n.jsx("input",{type:"checkbox",checked:u,onChange:S=>d(S.target.checked),className:"accent-primary-500"}),"raw frames"]})]}),e.chunks.length===0?n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No chunks captured."}):n.jsx("div",{className:"space-y-1",children:e.chunks.map((S,E)=>{const A=E===0?e.ts!=null?S.ts-e.ts:0:S.ts-e.chunks[E-1].ts,T=VV(S).parts,C=T.filter(j=>j.piece!=="");return n.jsxs("div",{className:"flex items-start gap-2 text-[11px] font-mono",children:[n.jsxs("span",{className:"text-gray-400 dark:text-gray-600 w-12 flex-shrink-0 text-right",children:["+",A,"ms"]}),n.jsx("span",{className:"w-[72px] flex-shrink-0 flex flex-col items-start gap-0.5",children:T.map((j,L)=>n.jsx("span",{className:"px-1 rounded "+(E4[j.type]||E4.other),children:j.type},L))}),u?n.jsx(lG,{raw:S.raw,parts:T}):n.jsx("span",{className:"break-all whitespace-pre-wrap min-w-0 flex-1",title:S.raw,children:C.length?C.map((j,L)=>n.jsx("span",{className:(L?"ml-1 ":"")+(_f[j.type]||_f.other),children:j.piece},L)):n.jsx("span",{className:"italic opacity-60 text-gray-500",children:S.raw})})]},S.seq)})}),!u&&e.chunks.length>0&&n.jsxs("div",{className:"pt-1 text-[10px] text-gray-400 dark:text-gray-500",children:["Coloured by the assembled part each chunk feeds: ",n.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"reasoning"})," · ",n.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:"text"})," · ",n.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:"tool"})," · ",n.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"usage"}),". Toggle “raw frames” for the exact SSE."]})]}),o==="Context"&&n.jsxs("div",{className:"space-y-3",children:[h?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"rounded-lg border p-2.5 "+(h.needsCompaction?"border-fuchsia-300 dark:border-fuchsia-700 bg-fuchsia-50 dark:bg-fuchsia-900/20":"border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900"),children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"Compaction decision"}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(h.needsCompaction?"bg-fuchsia-200 text-fuchsia-800 dark:bg-fuchsia-800/60 dark:text-fuchsia-200":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"),children:h.needsCompaction?"TRIGGERED":"not triggered"}),n.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["evaluated ",n.jsx("b",{children:"before"})," the request is sent · once per turn"]})]}),n.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[n.jsxs("div",{children:["compact when ",n.jsx("b",{children:"tokReal > threshold"})," →"," ",n.jsxs("span",{className:h.needsCompaction?"text-fuchsia-600 dark:text-fuchsia-400 font-semibold":"text-emerald-600 dark:text-emerald-400 font-semibold",children:[nr(h.tokReal)," ",h.needsCompaction?">":"≤"," ",nr(h.threshold)]})]}),n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["headroom = threshold − tokReal = ",nr(h.threshold)," − ",nr(h.tokReal)," = ",n.jsx("b",{className:y!=null&&y<0?"text-fuchsia-600 dark:text-fuchsia-400":"",children:nr(y)})]}),n.jsxs("div",{className:"pt-1 text-gray-500 dark:text-gray-400",children:["threshold = ⌊usable × margin⌋ = ⌊",nr(h.usable)," × ",h.margin??"?","⌋ = ",nr(h.threshold)]}),n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["usable = limit − reserve = ",nr(h.limit)," − ",nr(m)," = ",nr(h.usable)]})]})]}),k&&n.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"How tokReal is computed"}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(v?"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"),children:v?"ESTIMATE":"MEASURED"})]}),n.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[n.jsxs("div",{children:["tokReal = ",v?"historical estimate":"last prompt_tokens"," + new message = ",n.jsx("b",{children:nr(_)})," + ",n.jsx("b",{children:nr(h.newMessageTokens)})," = ",n.jsx("b",{children:nr(h.tokReal)})]}),v?n.jsxs(n.Fragment,{children:[w!=null&&n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["historical estimate = conversation estimate + system+tools overhead = ",nr(w)," + ",nr(h.staticOverhead)," = ",nr(h.historicalEstimate)]}),(h.overheadSystem!=null||h.overheadTools!=null)&&n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["system+tools overhead = system prompt ",nr(h.overheadSystem)," + tool schemas ",nr(h.overheadTools),h.toolCount?` (${h.toolCount} tools)`:""," = ",nr(h.staticOverhead)]}),n.jsxs("div",{className:"text-[10px] text-amber-600 dark:text-amber-400 pt-0.5",children:["ESTIMATE — no measured ",n.jsx("code",{children:"prompt_tokens"})," was available yet, so this is openpave's own estimate. The system prompt + tool schemas (",nr(h.staticOverhead),") dominate, which is why tokReal ≫ the store."]})]}):n.jsxs("div",{className:"text-[10px] text-gray-500 dark:text-gray-400 pt-0.5",children:["MEASURED — the previous response's ",n.jsx("code",{children:"prompt_tokens"})," (",nr(h.lastPromptTokens),"), which already counts system prompt + tools + conversation."]}),n.jsx("div",{className:"font-sans",children:n.jsx(iG,{rec:e,onResolveRef:a,overheadSystem:h.overheadSystem,overheadTools:h.overheadTools,toolCount:h.toolCount,newMessageTokens:h.newMessageTokens,overheadSystemChars:h.overheadSystemChars,overheadToolsChars:h.overheadToolsChars,newMessageChars:h.newMessageChars})})]})]}),n.jsxs("div",{children:[n.jsx(mr,{label:"limit (window)",children:nr(h.limit)}),n.jsx(mr,{label:"reserve (output)",children:nr(m)}),n.jsx(mr,{label:"usable",children:nr(h.usable)}),n.jsx(mr,{label:"margin",children:h.margin}),n.jsx(mr,{label:"threshold",children:nr(h.threshold)}),n.jsx(mr,{label:"tokReal",children:nr(h.tokReal)}),n.jsx(mr,{label:"needsCompaction",highlight:!!h.needsCompaction,children:String(h.needsCompaction)}),n.jsx(mr,{label:"source",children:h.source}),n.jsx(mr,{label:"windowSource",children:h.windowSource||h.epmWindowSignal})]})]}):n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:["No compaction decision for this request. The check runs ",n.jsx("b",{children:"once per turn"})," (at the turn's first request); tool-iteration follow-ups and compaction turns reuse it.",e.contextFrom!=null&&n.jsxs(n.Fragment,{children:[" The most recent decision was evaluated at ",n.jsxs("b",{children:["request #",e.contextFrom]}),"."]})]}),e.store&&n.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[n.jsx(mr,{label:"storeTokens",children:nr(e.storeTokens)}),n.jsx(mr,{label:"storeMessages",children:e.storeMessages}),e.store.messages!==void 0&&n.jsxs("div",{className:"mt-2",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Persisted history (the store array) — full, pre-shrink · diff vs the Request-tab body (the sent wire) to see what was trimmed"}),n.jsx(vo,{value:e.store.messages,onResolveRef:a,label:"store messages"})]})]}),e.compaction&&n.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fuchsia-500 mb-1",children:"Compaction (followed this request)"}),n.jsx(mr,{label:"trigger",children:e.compaction.trigger}),n.jsx(mr,{label:"deleted",children:nr(e.compaction.deletedMessages)}),n.jsx(mr,{label:"summary tok",children:nr(e.compaction.summaryTokens)}),n.jsx(mr,{label:"before",children:nr(e.compaction.before)}),n.jsx(mr,{label:"after",children:nr(e.compaction.after)}),n.jsx(mr,{label:"handoffFresh",highlight:e.compaction.handoffFresh===!1,children:typeof e.compaction.handoffFresh=="boolean"?String(e.compaction.handoffFresh):"—"})]})]}),o==="Est vs actual"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Estimator (",n.jsx("code",{children:"estimateWireTokens"}),") vs the provider's actual ",n.jsx("code",{children:"prompt_tokens"})," — exposes tokenizer drift."]}),n.jsxs("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2",children:[n.jsx("b",{children:"sent est"})," counts the whole ",n.jsx("b",{children:"messages array"})," — the system prompt included (it's a ",n.jsx("code",{children:'role:"system"'})," message) — with a coarse byte-length ÷ 3 heuristic plus fixed per-message/tool envelopes, but ",n.jsx("b",{children:"excludes the tool schemas"})," (a top-level ",n.jsx("code",{children:"tools"})," body field, not a message). The missing tool schemas plus the byte÷3-vs-real-tokenizer gap are usually why it reads below ",n.jsx("b",{children:"sent actual"}),". ",n.jsx("b",{children:"sent actual"})," (",n.jsx("code",{children:"prompt_tokens"}),") is the provider's real tokenizer over the ",n.jsx("i",{children:"whole"})," request. Different heuristic again from the Context tab's tokReal (system ÷4, tools ÷2.8); the three don't agree by design."]}),n.jsx(mr,{label:"sent est",children:nr(e.sentEstTokens)}),n.jsx(mr,{label:"sent actual",children:nr(e.sentActualTokens)}),e.sentEstTokens!=null&&e.sentActualTokens!=null&&n.jsxs(n.Fragment,{children:[n.jsx(mr,{label:"delta (est−actual)",highlight:Math.abs(e.sentEstTokens-e.sentActualTokens)>e.sentActualTokens*.15,children:(e.sentEstTokens-e.sentActualTokens).toLocaleString()}),n.jsx(mr,{label:"drift %",children:e.sentActualTokens?((e.sentEstTokens-e.sentActualTokens)/e.sentActualTokens*100).toFixed(1)+"%":"—"})]}),n.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[n.jsx(mr,{label:"store tokens",children:nr(e.storeTokens)}),n.jsx(mr,{label:"Δ vs prev actual",children:e.sentActualDelta!=null?(e.sentActualDelta>=0?"+":"")+e.sentActualDelta.toLocaleString():null}),e.response&&e.response.usage&&n.jsxs(n.Fragment,{children:[n.jsx(mr,{label:"completion_tokens",children:e.response.usage.completion_tokens}),n.jsx(mr,{label:"total_tokens",children:e.response.usage.total_tokens}),e.response.usage.reasoning_tokens!=null&&n.jsx(mr,{label:"reasoning_tokens",children:e.response.usage.reasoning_tokens})]})]})]}),o==="Lifecycle"&&(()=>{const S=e.trimmed,E=S!=null&&S>0,A=e.finishReason==="length",T=h?h.needsCompaction:null,C=e.storeTokens,j=e.sentActualTokens,L=Math.max(C||0,j||0,e.sentEstTokens||0,1),O=I=>Math.round((I||0)/L*100);return n.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-gray-600 dark:text-gray-300",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The four layers a request passes through"}),n.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50 p-2.5 space-y-1",children:[n.jsx(Qd,{n:"1",name:"Durable store — on disk",sub:"every message ever (old ones flagged compactedOut) + the summary. This is what the web UI shows; not measured here (never shrinks)."}),n.jsx(Mb,{label:"render — internal parts → API message shape; DROP compactedOut, KEEP summary"}),n.jsx(Qd,{n:"2",name:"LLM context = formattedMessages (the inspector's ‘store’)",sub:`${nr(C)} tok · ${e.storeMessages!=null?e.storeMessages+" msgs":"—"}`,pct:O(C),fill:"bg-emerald-500"}),n.jsx(Mb,{label:"slice — shallow copy so trimming can't touch the original render"}),n.jsx(Qd,{n:"3",name:"Wire copy = conversationMessages",sub:"identical to layer 2 until trimmed",pct:O(C),fill:"bg-emerald-500/40",dashed:!0}),n.jsx(Mb,{label:E?`trim — fit to budget (−${nr(S)} tok net)`:"trim — nothing net-trimmed this request"}),n.jsx(Qd,{n:"4",name:"Sent = [system] + trimmed wire + tools",sub:`${nr(j)} tok actual · est ${nr(e.sentEstTokens)}`,pct:O(j),trimmedPct:E?O(C):null,fill:"bg-sky-500"})]}),E&&n.jsxs("div",{className:"mt-0.5 pl-6 text-[10px] text-gray-400 dark:text-gray-500",children:[n.jsx("span",{className:"inline-block w-2.5 h-2 rounded-sm bg-fuchsia-400/25 align-middle mr-1"}),"shaded = trimmed off this request (store − sent)",A?" · finishReason=length: model hit the output limit":""]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"…the four steps, in words"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px] text-gray-600 dark:text-gray-300",children:[n.jsxs("li",{children:[n.jsx("b",{children:"Compaction"})," (upstream, only near the limit): summarise old messages in the durable store — flag them ",n.jsx("code",{children:"compactedOut"})," + add a summary."]}),n.jsxs("li",{children:[n.jsx("b",{children:"Render"}),": translate the store’s internal “parts” into the API’s message shape, dropping ",n.jsx("code",{children:"compactedOut"})," and including the summary → layer 2."]}),n.jsxs("li",{children:[n.jsx("b",{children:"Slice"}),": shallow-copy layer 2 → layer 3, so trimming mutates the copy, not the original render."]}),n.jsxs("li",{children:[n.jsx("b",{children:"Trim"}),": shrink the copy to fit the budget (the ladder below), then assemble ",n.jsx("code",{children:"[system + trimmed wire + tools]"})," and send → layer 4."]})]}),n.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["So compaction is ",n.jsx("b",{children:"pre-emptive"})," — before trimming (step 1). There's also a ",n.jsx("b",{children:"reactive"})," path: if the sent request 413s (our budget was an estimate), it trims ",n.jsx("i",{children:"harder"})," and, only if that still won't fit, compacts and resends. Trimming sits between the two."]})]}),n.jsxs("div",{className:"rounded-lg border border-amber-300/60 dark:border-amber-700/50 bg-amber-50 dark:bg-amber-900/20 p-2.5 text-[11px]",children:[n.jsx("b",{className:"text-amber-700 dark:text-amber-300",children:"Cache impact:"})," prefix / KV caching needs the prompt prefix to be byte-identical across requests. Trimming ",n.jsx("b",{children:"rewrites older messages"})," (stubs tool outputs, strips reasoning, caps old text) — and the recency-weighted ladder trims the ",n.jsx("b",{children:"oldest first"}),", i.e. the cache prefix. So a trimmed request usually ",n.jsx("b",{children:"misses the cache"})," and pays a full prefill. Less trimming + a stable prefix = a higher cache-hit rate. The per-message diff below shows exactly where."]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Per-message trim diff — where the cache breaks"}),n.jsx(nG,{rec:e,onResolveRef:a})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Compaction (this request)"}),e.compaction?n.jsxs("div",{className:"rounded-lg border border-fuchsia-300 dark:border-fuchsia-700 bg-fuchsia-50 dark:bg-fuchsia-900/20 p-2.5 font-mono text-[11px]",children:["A compaction ran here [",e.compaction.trigger,"] — store rewritten ",nr(e.compaction.before)," → ",nr(e.compaction.after)," tok. The on-disk history was permanently summarised."]}):n.jsxs("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:["No compaction on this request.",T!=null&&n.jsxs(n.Fragment,{children:[" Decision at build time: ",n.jsx("b",{className:T?"text-fuchsia-600 dark:text-fuchsia-400":"text-emerald-600 dark:text-emerald-400",children:T?"TRIGGERED":"not triggered"})," (see Context tab)."]})]}),n.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["Compaction drops old messages from the ",n.jsx("b",{children:"LLM context"})," (a summary replaces them) — it does ",n.jsx("b",{children:"not"})," delete them: they stay on disk flagged ",n.jsx("code",{children:"compactedOut"})," and the web UI still shows every bubble. So the inspector's ",n.jsx("b",{children:"store"})," line = the LLM context (it drops at compaction), not the visible conversation."]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Trimming vs compaction"}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[n.jsx("th",{className:"py-1 pr-2 font-medium",children:" "}),n.jsx("th",{className:"py-1 pr-2 font-semibold text-sky-700 dark:text-sky-300",children:"Trimming"}),n.jsx("th",{className:"py-1 font-semibold text-fuchsia-700 dark:text-fuchsia-300",children:"Compaction"})]})}),n.jsx("tbody",{className:"align-top",children:[["acts on","the disposable wire copy — this one request","the persisted store — permanently"],["(1) the request","shrinks this request so it fits the window","future requests carry a summary instead of raw history"],["(2) the store array","untouched — full history stays on disk","rewritten: old messages → an LLM-written summary"],["on disk?","no — ephemeral","yes"],["lossy?","no — reversible; next request has the full store","yes — the detail is gone for good"],["uses the LLM?","no — mechanical string ops","yes — the model writes the summary"],["cost","~free, every request","a whole extra LLM turn, occasionally"],["when","while building the request — after any pre-emptive compaction, before send","BEFORE the request (pre-emptive, near threshold) or AFTER a 413 (reactive)"],["trigger","budget pressure when building; again, harder, on a 413","pre-emptive: tokReal > threshold at turn start · reactive: a 413 that trimming still can’t fit"]].map(([I,B,z])=>n.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[n.jsx("td",{className:"py-1 pr-2 text-gray-500 dark:text-gray-400 whitespace-nowrap",children:I}),n.jsx("td",{className:"py-1 pr-2 text-gray-700 dark:text-gray-200",children:B}),n.jsx("td",{className:"py-1 text-gray-700 dark:text-gray-200",children:z})]},I))})]})})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The trimming ladder (fitWireToBudget)"}),n.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400 mb-1",children:"Applied in order, checking after each rung whether the wire fits — stops as soon as it does. The newest message is always preserved."}),n.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("b",{className:"text-amber-600 dark:text-amber-400",children:"Strip historical reasoning_content"})," — blank out old “thinking” blocks."]}),n.jsxs("li",{children:[n.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool outputs"})," — replace big tool results with a size marker."]}),n.jsxs("li",{children:[n.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool-call arguments"})," — replace large args with a shape placeholder."]}),n.jsxs("li",{children:[n.jsx("b",{className:"text-sky-600 dark:text-sky-400",children:"Recency-weighted text caps"})," — cap older text to 8192 / 2048 / 512 / 128 bytes going back; newest turn stays intact."]})]}),n.jsx("div",{className:"mt-1 text-[10px] text-gray-400 dark:text-gray-500",children:"Per-rung detail for this request isn’t captured yet (would need a backend tap); the numbers above are inferred from store vs sent + finishReason + the compaction event."})]})]})})()]})]})}function uG(e){return e==null?"":e>=1048576?(e/1048576).toFixed(1)+" MB":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}const $c=(e,t,r)=>Math.min(r,Math.max(t,e)),j4=0,C4=560,T4=220,R4=200,A4=640,I4=300,wf=520;function Lb(e,t,r,a){try{const i=parseInt(window.localStorage.getItem(e),10);if(Number.isFinite(i))return $c(i,r,a)}catch{}return t}function M4(){try{return Math.max(wf,window.innerWidth)}catch{return 1600}}function L4(){try{return $c(Math.round(window.innerWidth*.9),wf,1600)}catch{return 1200}}function dG({open:e,onClose:t,activeSessionId:r,activeSessionTitle:a,onJumpToMessage:i}){const[o,l]=x.useState([]),[u,d]=x.useState(null),[f,g]=x.useState(""),[h,m]=x.useState(!1),[y,v]=x.useState(null),[k,_]=x.useState(null),[w,S]=x.useState(()=>Lb("inspectorTimelineHeight",T4,j4,C4)),[E,A]=x.useState(()=>Lb("inspectorLedgerWidth",I4,R4,A4)),[T,C]=x.useState(()=>Lb("inspectorDrawerWidth",L4(),wf,M4())),[j,L]=x.useState(!1),[O,I]=x.useState(0),[B,z]=x.useState("Request"),[ee,$]=x.useState(!1),M=x.useMemo(()=>f?KV(f):null,[f]);x.useEffect(()=>{try{window.localStorage.setItem("inspectorTimelineHeight",String(w))}catch{}},[w]),x.useEffect(()=>{try{window.localStorage.setItem("inspectorLedgerWidth",String(E))}catch{}},[E]),x.useEffect(()=>{try{window.localStorage.setItem("inspectorDrawerWidth",String(T))}catch{}},[T]);const G=x.useCallback(W=>{W.preventDefault();const ae=W.clientY,Q=w,he=De=>S($c(Q+(De.clientY-ae),j4,C4)),Ne=()=>{window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",Ne),window.removeEventListener("pointercancel",Ne),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",he),window.addEventListener("pointerup",Ne),window.addEventListener("pointercancel",Ne)},[w]),Y=x.useCallback(W=>{W.preventDefault();const ae=W.clientX,Q=E,he=De=>A($c(Q+(De.clientX-ae),R4,A4)),Ne=()=>{window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",Ne),window.removeEventListener("pointercancel",Ne),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",he),window.addEventListener("pointerup",Ne),window.addEventListener("pointercancel",Ne)},[E]),X=x.useCallback(W=>{W.preventDefault();const ae=W.clientX,Q=T,he=De=>C($c(Q+(ae-De.clientX),wf,M4())),Ne=()=>{window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",Ne),window.removeEventListener("pointercancel",Ne),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",he),window.addEventListener("pointerup",Ne),window.addEventListener("pointercancel",Ne)},[T]),ie=x.useCallback(async()=>{if(M){L(!0);try{const W=new Map;await Promise.all(QV(M).map(async De=>{try{W.set(De,await __(u,De))}catch{}}));const ae=v4(M,u,W),Q=new Blob([ae],{type:"text/plain;charset=utf-8"}),he=URL.createObjectURL(Q),Ne=document.createElement("a");Ne.href=he,Ne.download=`inspector-${u||"session"}.txt`,document.body.appendChild(Ne),Ne.click(),Ne.remove(),setTimeout(()=>URL.revokeObjectURL(he),2e3)}catch(W){v(W&&W.message?W.message:"Download failed")}finally{L(!1)}}},[M,u]),F=x.useCallback(async()=>{try{const W=await N3();l(Array.isArray(W)?W:[])}catch(W){v(W&&W.message?W.message:"Failed to list sessions")}},[]);x.useEffect(()=>{e&&F()},[e,r,F]),x.useEffect(()=>{e&&d(W=>r||(W&&o.some(ae=>ae.id===W)?W:o.length?o[0].id:null))},[e,r,o]),x.useEffect(()=>{if(!e||!u){g("");return}let W=!1;return m(!0),v(null),_(null),g(""),S3(u).then(ae=>{W||g(ae||"")}).catch(ae=>{W||(ae&&ae.status===404?g(""):v(ae&&ae.message?ae.message:"Failed to load events"))}).finally(()=>{W||m(!1)}),()=>{W=!0}},[e,u,O]);const U=x.useCallback(()=>{F(),I(W=>W+1)},[F]);x.useEffect(()=>{if(M&&M.requests.length&&k==null){const W=M.requests.find(ae=>ae.messageDrop);_((W||M.requests[0]).seq)}},[M,k]),x.useEffect(()=>{if(!e)return;const W=ae=>{ae.key==="Escape"&&t()};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[e,t]);const Z=x.useCallback(W=>__(u,W),[u]),P=x.useCallback(async()=>{if(u&&window.confirm(`Purge inspector capture for session ${u}? This deletes the on-disk NDJSON and cannot be undone.`))try{await E3(u),g(""),d(null),await F()}catch(W){v(W&&W.message?W.message:"Failed to purge")}},[u,r,F]),K=x.useMemo(()=>M&&M.requests.find(W=>W.seq===k)||null,[M,k]),V=x.useMemo(()=>M&&K&&K.messageDrop&&M.requests.find(W=>W.seq===K.messageDrop.prevSeq)||null,[M,K]);return e?n.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[n.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:t,"aria-hidden":"true"}),n.jsxs("div",{style:{width:T,maxWidth:"100vw"},className:"relative ml-auto h-full bg-white dark:bg-gray-950 shadow-2xl flex flex-col animate-[slideIn_.15s_ease-out] border-l border-gray-200 dark:border-gray-800",children:[n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector width",title:"Drag to resize the inspector · double-click to reset",onPointerDown:X,onDoubleClick:()=>C(L4()),className:"group absolute left-0 top-0 h-full w-1.5 -ml-0.5 z-20 cursor-col-resize flex items-center justify-center",children:n.jsx("div",{className:"w-0.5 h-12 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})}),n.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 h-12 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"text-base flex-shrink-0",children:"🦋"}),n.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 flex-shrink-0",children:"Inspector"}),n.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 flex-shrink-0",children:"debug"}),u&&n.jsxs("span",{className:"text-[11px] text-gray-500 dark:text-gray-400 truncate border-l border-gray-200 dark:border-gray-700 pl-2 min-w-0",title:u===r&&a?`${a} · ${u}`:u,children:[u===r&&a?a:u,u===r&&n.jsx("span",{className:"ml-1 text-emerald-500",title:"the chat you're currently in",children:"●"})]})]}),n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsxs("select",{value:u||"",onChange:W=>d(W.target.value||null),className:"max-w-[280px] text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-700 dark:text-gray-200",title:"Captured sessions (newest first)",children:[o.length===0&&!r&&n.jsx("option",{value:"",children:"(no captures)"}),r&&!o.some(W=>W.id===r)&&n.jsxs("option",{value:r,children:["● ",r.slice(0,12),"… · (current chat — no capture yet)"]}),o.map(W=>n.jsxs("option",{value:W.id,children:[W.id===r?"● ":"",W.id.slice(0,12),"… · ",W.events," ev · ",uG(W.bytes)]},W.id))]}),n.jsx("button",{type:"button",onClick:U,className:"p-1 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex-shrink-0",title:"Reload — capture is replay, so re-fetch after sending a prompt","aria-label":"Reload capture",children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20 9A8 8 0 006 5.3M4 15a8 8 0 0014 3.7"})})}),M&&n.jsx(Hc,{getText:()=>v4(M,u),label:"copy session",title:"Copy the whole replay as one LLM-friendly text blob (spilled bodies shown as refs)"}),M&&n.jsx("button",{type:"button",onClick:ie,disabled:j,className:"text-xs px-2 py-1 rounded bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",title:"Download the whole session as one file — fetches every spilled body so the exact bytes are included",children:j?"preparing…":"download"}),n.jsx("button",{type:"button",onClick:P,disabled:!u,className:"text-xs px-2 py-1 rounded text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-40",title:"Delete this session's on-disk capture",children:"Purge"}),n.jsx("button",{type:"button",onClick:t,className:"p-1.5 rounded-lg text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:"Close (Esc)","aria-label":"Close inspector",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]}),n.jsxs("div",{className:"px-4 pt-2 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[h?n.jsx("div",{style:{height:w},className:"flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Loading capture…"}):y?n.jsx("div",{style:{height:w},className:"flex items-center justify-center text-sm text-red-500 dark:text-red-400",children:y}):M?n.jsx(ZV,{timeline:M.timeline,selectedSeq:k,onSelectSeq:_,height:w}):n.jsx("div",{style:{height:w},className:"flex items-center justify-center text-center px-4 text-sm text-gray-400 dark:text-gray-500",children:u?u===r?"No capture for this chat yet — send a prompt in it, then hit reload ↻.":"No capture for the selected session.":"No captures yet — send a prompt."}),n.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize timeline",title:"Drag to resize the timeline · double-click to reset",onPointerDown:G,onDoubleClick:()=>S(T4),className:"group h-2.5 flex items-center justify-center cursor-row-resize",children:n.jsx("div",{className:"h-1 w-10 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})})]}),n.jsxs("div",{className:"flex-1 flex min-h-0",children:[n.jsx("div",{style:{width:E},className:"flex-shrink-0 border-r border-gray-200 dark:border-gray-800 min-h-0 overflow-hidden",children:M?n.jsx(JV,{turns:M.turns,selectedSeq:k,onSelect:_}):n.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"—"})}),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize the turn list",title:"Drag to resize the turn list · double-click to reset",onPointerDown:Y,onDoubleClick:()=>A(I4),className:"group w-1.5 flex-shrink-0 cursor-col-resize flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:n.jsx("div",{className:"w-0.5 h-10 rounded-full bg-gray-300 dark:bg-gray-700 group-hover:bg-primary-400 dark:group-hover:bg-primary-500 transition-colors"})}),n.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:n.jsx(cG,{rec:K,prevRec:V,onSelectSeq:_,onResolveRef:Z,onJumpToMessage:i,tab:B,onTabChange:z,showRaw:ee,onShowRawChange:$},K?K.seq:"none")})]})]}),n.jsx("style",{children:"@keyframes slideIn { from { transform: translateX(24px); opacity: .6 } to { transform: translateX(0); opacity: 1 } }"})]}):null}class fG{constructor(){this.eventSource=null,this.listeners=new Map,this.sessionId=null,this.reconnectTimeout=null,this.reconnectDelay=1e3,this.maxReconnectDelay=3e4,this.lastEventId=null,this.lastActivityAt=0,this.watchdogTimer=null,this.watchdogCheckMs=2e4,this.stalenessThresholdMs=35e3}_markActivity(){this.lastActivityAt=Date.now()}_startWatchdog(){this._stopWatchdog(),this._markActivity(),this.watchdogTimer=setInterval(()=>{if(this.eventSource&&Date.now()-this.lastActivityAt>this.stalenessThresholdMs){const t=this.eventSource;this._emit("error",{});try{t.close()}catch{}this.eventSource===t&&(this.eventSource=null),this._scheduleReconnect()}},this.watchdogCheckMs)}_stopWatchdog(){this.watchdogTimer&&(clearInterval(this.watchdogTimer),this.watchdogTimer=null)}connect(t){this.disconnect(),this.sessionId!==t&&(this.lastEventId=null),this.sessionId=t;const r=[];t&&r.push("sessionID="+encodeURIComponent(t)),this.lastEventId&&r.push("lastEventId="+encodeURIComponent(this.lastEventId));const a="/global/event"+(r.length>0?"?"+r.join("&"):"");this.eventSource=new EventSource(a);const i=this.eventSource;i.onopen=()=>{this.eventSource===i&&(this.reconnectDelay=1e3,this._markActivity(),this._emit("connected",{}))},i.onmessage=o=>{if(this.eventSource===i){this._markActivity(),o.lastEventId&&(this.lastEventId=o.lastEventId);try{const l=JSON.parse(o.data);l.type&&this._emit(l.type,l)}catch{}}},i.onerror=()=>{this.eventSource===i&&(this._emit("error",{}),i.close(),this.eventSource=null,this._scheduleReconnect())},this._startWatchdog()}disconnect(){this._stopWatchdog(),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null)}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>this.off(t,r)}off(t,r){const a=this.listeners.get(t);a&&a.delete(r)}_emit(t,r){const a=this.listeners.get(t);if(a)for(const i of a)try{i(r)}catch{}}_scheduleReconnect(){this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.connect(this.sessionId)},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,this.maxReconnectDelay))}}const ar=new fG;function gG(){const[e,t]=x.useState(()=>{if(typeof window<"u"){const d=localStorage.getItem("pave-theme");return d?d==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1});x.useEffect(()=>{const d=document.documentElement;e?(d.classList.add("dark"),d.style.colorScheme="dark"):(d.classList.remove("dark"),d.style.colorScheme="light"),localStorage.setItem("pave-theme",e?"dark":"light")},[e]);const[r,a]=x.useState(()=>typeof window<"u"?localStorage.getItem("pave-hacker")==="true":!1);x.useEffect(()=>{localStorage.setItem("pave-hacker",r?"true":"false")},[r]);const[i,o]=x.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1);x.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",i?"true":"false")},[i]);const[l,u]=x.useState(!1);return{darkMode:e,setDarkMode:t,hackerMode:r,setHackerMode:a,matrixMode:l,setMatrixMode:u,mobileFrameless:i,setMobileFrameless:o}}const sf=200,of=600,pG=288;function hG(){const[e,t]=x.useState(()=>{if(typeof window<"u"){const a=localStorage.getItem("pave-terminal-width");if(a){const i=parseInt(a,10);if(!isNaN(i)&&i>=sf&&i<=of)return i}}return pG}),r=x.useRef(e);return r.current=e,x.useEffect(()=>{const a=setTimeout(()=>{localStorage.setItem("pave-terminal-width",String(e))},200);return()=>clearTimeout(a)},[e]),x.useEffect(()=>{const a=()=>{localStorage.setItem("pave-terminal-width",String(r.current))};return window.addEventListener("beforeunload",a),()=>{a(),window.removeEventListener("beforeunload",a)}},[]),{terminalWidth:e,setTerminalWidth:t}}function mG(e){const[t,r]=x.useState(()=>{if(typeof window<"u"){const u=localStorage.getItem("pave-right-pane-visible");return u===null?!0:u==="true"}return!0}),[a,i]=x.useState(""),o=x.useRef(t);o.current=t;const l=x.useCallback(()=>{const u=!o.current;r(u),i(e(u?"app.right_pane_shown":"app.right_pane_hidden"))},[e]);return x.useEffect(()=>{localStorage.setItem("pave-right-pane-visible",t?"true":"false")},[t]),{rightPaneVisible:t,toggleRightPane:l,rightPaneAnnouncement:a}}function xG(){const[e,t]=x.useState(()=>typeof window<"u"?localStorage.getItem("pave-banner-hidden")==="true":!1),r=x.useCallback(()=>{t(a=>{const i=!a;try{localStorage.setItem("pave-banner-hidden",String(i))}catch{}return i})},[]);return{bannerHidden:e,toggleBanner:r}}function yG(){const[e,t]=x.useState(()=>typeof window<"u"&&localStorage.getItem("pave-activity-view")||"map");return x.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-activity-view",e)},[e]),{activityView:e,setActivityView:t}}const bG=["web","agent"],vG=["tui","acp"];function O4(e){return e?e.client?bG.indexOf(e.client)!==-1:vG.indexOf(e.source)===-1:!1}const D4=40;function kG(){var qu;const{t:e}=Xt(),{darkMode:t,setDarkMode:r,hackerMode:a,setHackerMode:i,matrixMode:o,setMatrixMode:l,mobileFrameless:u,setMobileFrameless:d}=gG(),{activityView:f,setActivityView:g}=yG(),{terminalWidth:h,setTerminalWidth:m}=hG(),{rightPaneVisible:y,toggleRightPane:v,rightPaneAnnouncement:k}=mG(e),{bannerHidden:_,toggleBanner:w}=xG(),S="pave-active-session";function E(){try{return localStorage.getItem(S)||null}catch{return null}}function A(D){try{D?localStorage.setItem(S,D):localStorage.removeItem(S)}catch{}}function T(){try{localStorage.removeItem(S)}catch{}}const[,C]=x.useState(0),[j,L]=x.useState(!1),O=x.useRef(null),I=x.useRef(new Map),[B,z]=x.useState(()=>new Set),[ee,$]=x.useState(()=>new Set),M=x.useRef(null),G=x.useRef("chat"),Y=x.useRef(null),X=x.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]);x.useEffect(()=>{const D=ne=>{if(!(ne instanceof HTMLElement))return!1;const de=ne.tagName;return!!(de==="INPUT"||de==="TEXTAREA"||ne.isContentEditable)},re=ne=>{if(ne.repeat)return;const de=typeof ne.key=="string"?ne.key.toLowerCase():"";if((X?ne.metaKey:ne.ctrlKey)&&!ne.altKey&&!ne.shiftKey&&de==="k"){ne.preventDefault(),L(hr=>!hr);return}if((X?ne.metaKey:ne.ctrlKey)&&!ne.altKey&&!ne.shiftKey&&de==="b"){ne.preventDefault(),lr(hr=>!hr);return}const Ie=(X?ne.metaKey:ne.ctrlKey)&&!ne.altKey&&!ne.shiftKey&&de==="j",St=window.matchMedia("(min-width: 1024px)").matches,Tr=G.current==="chat";if(Ie&&M.current&&St&&Tr){ne.preventDefault(),v();return}if(D(ne.target))return;const Mr=ne.ctrlKey&&!ne.altKey&&!ne.metaKey&&de==="h",Or=ne.ctrlKey&&ne.shiftKey&&!ne.altKey&&!ne.metaKey&&de==="m";(Mr||Or)&&(ne.preventDefault(),i(hr=>!hr))};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[e,X,v,i]);const[ie,F]=x.useState(!0),[U,Z]=x.useState(!1),[P,K]=x.useState(null),[V,W]=x.useState(null),[ae,Q]=x.useState("chat");G.current=ae;const[,he]=x.useState(null),[Ne,De]=x.useState(null),[Ve,at]=x.useState(!1),[lt,Ce]=x.useState(!1),[$e,Be]=x.useState(!1),[gt,ut]=x.useState(!1),[jt,Ge]=x.useState([]),[we,Ue]=x.useState({}),Ae=x.useRef(!1);x.useEffect(()=>{n3().then(async D=>{if(Z(D.enabled),D.authenticated&&D.user){Ae.current=!0;try{sessionStorage.removeItem("pave-restore-reloads")}catch{}K(D.user)}else D.enabled&&await $4()}).catch(D=>{console.error("Failed to check auth status:",D)}).finally(()=>F(!1))},[]),x.useEffect(()=>(h_(({recovered:D,user:re})=>{if(D){let ne=-1;try{ne=parseInt(sessionStorage.getItem("pave-restore-reloads")||"0",10)}catch{ne=-1}if(ne>=0&&ne<1){let de=!1;try{sessionStorage.setItem("pave-restore-reloads",String(ne+1)),de=!0}catch{de=!1}if(de){window.location.reload();return}}if(re){Ae.current=!0,K(re);return}}Ae.current&&He("Session expired. Please log in again."),K(null)}),()=>h_(null)),[]),x.useEffect(()=>{U&&!P&&ar.disconnect()},[P,U]),x.useEffect(()=>{if(!P)return;let D=!1;return J$().then(re=>{!D&&re&&re.currentVersion&&W(re.currentVersion)}).catch(()=>{}),()=>{D=!0}},[P]),x.useEffect(()=>{FW(()=>M.current)},[]);const rt=x.useCallback(async()=>{try{await a3()}catch(D){console.error("Logout failed:",D);return}K(null),window.location.reload()},[]),[fe,ce]=x.useState(null),[ve,ye]=x.useState(!1),[it,qe]=x.useState([]),[Ye,yt]=x.useState([]),[ht,Dt]=x.useState({}),nt=x.useRef(ht);x.useEffect(()=>{nt.current=ht},[ht]);const Pt=x.useRef({}),[$t,lr]=x.useState(!0),[pr,_r]=x.useState(!1),cr=x.useRef(!1),ir=x.useRef(null),ue=x.useRef(0);x.useEffect(function(){return function(){ue.current&&cancelAnimationFrame(ue.current)}},[]);const Me=x.useCallback(function(){ue.current&&cancelAnimationFrame(ue.current),ue.current=requestAnimationFrame(function(){ue.current=0,ir.current&&ir.current.scrollToBottom()})},[]),[Ke,Te]=x.useState([]),[oe,bt]=x.useState(null);M.current=oe,x.useEffect(()=>{A(oe)},[oe]),x.useEffect(()=>{oe&&BW(typeof document<"u"&&document.visibilityState==="visible",oe)},[oe]);const Pe=x.useMemo(()=>oe&&Ke.find(D=>D.id===oe)||null,[oe,Ke]),[te,be]=x.useState([]),[ze,Je]=x.useState(0),[Bt,Ft]=x.useState(!1),[Jt,Fe]=x.useState(null),[kt,Qt]=x.useState(!1),Wr=x.useRef(!1),[ln,Jr]=x.useState(!1),[yr,ca]=x.useState({}),ni=x.useRef(yr);ni.current=yr;const[ai,dn]=x.useState({}),[Ei,Xn]=x.useState(null),[vr,ji]=x.useState(null),bn=x.useRef(null);x.useEffect(function(){return function(){bn.current&&clearTimeout(bn.current),ur.current&&clearTimeout(ur.current)}},[]);const[ii,nn]=x.useState(null),[st,Nt]=x.useState(null),[Ht,er]=x.useState(null),ur=x.useRef(null),tr=x.useCallback((D,re)=>{if(D){const ne=!re&&!!ni.current[D];ne&&D===It.current&&(ji(null),bn.current&&(clearTimeout(bn.current),bn.current=null)),ca(de=>{const me={...de},Oe=!!de[D];if(re?me[D]=!0:delete me[D],Oe&&!re&&ra.current&&ra.current[D]&&!Kl.current.has(D)){const Ie=ra.current[D];if(Ie.length>0){const St=Ie.shift();D===It.current&&Zi(Ie.length),Promise.resolve().then(()=>{try{D===It.current&&ir.current&&ir.current.resetAutoScroll(),Zo.current&&Zo.current(D,St.content,St.imageAttachments,St.agent,St.displayContent,St.queuedTempId,St.fileAttachments),D===It.current&&ir.current&&(ir.current.resetAutoScroll(),Me())}catch(Tr){console.error("[Queue] Drain dispatch failed:",Tr)}})}}return me}),ne&&(Kl.current.delete(D),bp(D).then(de=>{const me=Array.isArray(de&&de.items)?de.items:[];dn(Oe=>{const Ie={...Oe};if(me.length===0)if(Ie[D])delete Ie[D];else return Oe;else Ie[D]=me;return Ie})}).catch(()=>{}))}D===It.current&&Jr(re)},[Me]),Qn=x.useCallback(D=>{const re={};Object.keys(D).forEach(de=>{D[de]&&D[de].type==="busy"&&(re[de]=!0)}),ca(de=>{const me={...de};return Object.keys(re).forEach(Oe=>{me[Oe]=!0}),Object.keys(D).forEach(Oe=>{D[Oe]&&D[Oe].type!=="busy"&&delete me[Oe]}),me});const ne=D[It.current];Jr(!!(ne&&ne.type==="busy"))},[]),[si,zr]=x.useState({}),Ur=x.useRef(null),fn=x.useRef(null),[Zn,jn]=x.useState({}),[oi,vn]=x.useState({});x.useEffect(()=>{f==="map"&&oe&&vp(oe).then(D=>{D&&Array.isArray(D.todos)&&vn(re=>({...re,[oe]:D.todos}))}).catch(()=>{})},[f,oe]);const[Yi,Fa]=x.useState({});x.useEffect(()=>{f==="tools"&&oe&&j_(oe).then(D=>{D&&Fa(re=>({...re,[oe]:D}))}).catch(()=>{})},[f,oe]);const[Un,Jn]=x.useState(null),[On,ea]=x.useState(null),[dr,He]=x.useState(null),[Ci,Vr]=x.useState(!1),[wr,Ba]=x.useState(null),Cn=50,[wa,Xe]=x.useState(!1),[H,le]=x.useState(0),Se=x.useRef(0),[We,pt]=x.useState(0),[_t,Er]=x.useState(()=>{try{return localStorage.getItem("pave-show-other-apps")!=="false"}catch{return!0}}),jr=x.useRef(_t),[an,Tn]=x.useState(""),za=x.useRef(""),[sn,Ti]=x.useState(!0),[Do,Xi]=x.useState(!1),[Ri,li]=x.useState(""),[Ai,Ii]=x.useState(0),[Na,hs]=x.useState(0),[ci,Mi]=x.useState(!1),Po=x.useRef(null),[gn,Fo]=x.useState(!1),[ua,xu]=x.useState(""),[Bo,ms]=x.useState(!1),[yu,ta]=x.useState(""),[xs,zo]=x.useState(!1),[Li,bu]=x.useState(null),[Bl,ys]=x.useState(!1),[Qi,Gs]=x.useState({}),Uo=x.useRef({}),[zl,vu]=x.useState({}),Ul=x.useRef({}),[ql,Jf]=x.useState({}),ku=x.useRef({}),qo=x.useRef(new Set),bs=x.useRef(null);x.useEffect(()=>{Uo.current=Qi},[Qi]),x.useEffect(()=>{Ul.current=zl},[zl]),x.useEffect(()=>{if(!oe)return;const D=Ke.find(re=>re.id===oe);D&&(D.moe_top_k!=null&&Uo.current[oe]===void 0&&Gs(re=>re[oe]===void 0?{...re,[oe]:D.moe_top_k}:re),D.reasoning_effort&&Ul.current[oe]===void 0&&vu(re=>re[oe]===void 0?{...re,[oe]:D.reasoning_effort}:re))},[oe,Ke]);const _u=Qi[oe]??null,wu=zl[oe]??"max",Nu=ql[oe]??null,Ks=x.useCallback((D,re)=>{bu({text:D,type:re||"info"}),bs.current&&clearTimeout(bs.current),bs.current=setTimeout(()=>{bu(null),bs.current=null},3e3)},[]);function Su(D,re){return(Array.isArray(D==null?void 0:D.settings)?D.settings:[]).find(de=>de&&de.key===re)||null}x.useEffect(()=>{const D=()=>{Fb().then(re=>{const ne=Su(re,"PAVE_WHATSAPP_CHAT_ID"),de=ne&&ne.value||"";xu(de)}).catch(re=>{console.error("[WhatsApp] Failed to load default chatId from settings:",re.message)})};return D(),window.addEventListener("pave:settings-updated",D),()=>window.removeEventListener("pave:settings-updated",D)},[]);const[Ys,Hl]=x.useState(!1),[$l,eg]=x.useState(!1),[Wl,Eu]=x.useState(!1);x.useEffect(()=>{const D=()=>{Fb().then(re=>{const ne=de=>{const me=Su(re,de),Oe=String(me&&me.value||"").toLowerCase();return Oe==="true"||Oe==="1"};Hl(ne("PAVE_EXPERIMENTAL_WHATSAPP")),eg(ne("PAVE_EXPERIMENTAL_SESSION_BANNER")),Eu(ne("PAVE_EXPERIMENTAL_AGENT_BOARD"))}).catch(re=>{console.error("[Experimental] Failed to load feature flags:",re.message)})};return D(),window.addEventListener("pave:settings-updated",D),()=>window.removeEventListener("pave:settings-updated",D)},[ae]),x.useEffect(()=>{!Wl&&ae==="board"&&Q("chat")},[Wl,ae]),x.useEffect(()=>{const D=()=>{k_().then(re=>{Be(!!(re&&re.inspector))}).catch(re=>{console.error("[Inspector] Failed to fetch config:",re.message)})};return window.addEventListener("pave:settings-updated",D),()=>window.removeEventListener("pave:settings-updated",D)},[]);const Ho=x.useRef(gn),tg=x.useRef(ua);x.useEffect(()=>{Ho.current=gn,tg.current=ua},[gn,ua]);const Vl=x.useRef({});x.useEffect(()=>{Ys&&q3({enabled:gn,sessionId:oe,chatId:ua}).catch(D=>{console.error("[WhatsApp routing] Failed to update:",D.message)})},[Ys,gn,oe,ua]),x.useEffect(()=>{!Ys&&gn&&Fo(!1)},[Ys,gn]),x.useEffect(()=>{ci&&Po.current&&Po.current.focus()},[ci]),x.useEffect(()=>{const D=window.matchMedia("(min-width: 1024px)"),re=ne=>{ne.matches&&Mi(!1)};return D.addEventListener("change",re),()=>D.removeEventListener("change",re)},[]);function ju(){const D=oi[oe]||[],re=[];for(const Ie of te||[])for(const St of Ie.parts||[]){if(St.type!=="tool")continue;const Tr=St.state&&St.state.output;if(!Tr)continue;let Mr=Tr;if(typeof Tr=="string")try{Mr=JSON.parse(Tr)}catch{continue}Mr&&Mr.canvas&&Mr.canvas.type&&Mr.canvas.source&&re.push(Mr.canvas)}const ne=oe?`pave-canvas-cleared:${oe}`:null;let de=new Set;if(ne&&typeof window<"u")try{const Ie=localStorage.getItem(ne);Ie&&(de=new Set(JSON.parse(Ie)))}catch{}const me=re.filter(Ie=>!de.has(Ie.type+":"+Ie.source)),Oe=()=>{if(!ne||typeof window>"u")return;const Ie=re.map(St=>St.type+":"+St.source);try{localStorage.setItem(ne,JSON.stringify(Ie))}catch{}C(St=>St+1)};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:a?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-end gap-1 px-2 py-1 border-b border-gray-200 dark:border-gray-700 text-xs",children:[n.jsx("button",{type:"button",onClick:()=>g("map"),className:`px-2 py-0.5 rounded ${f==="map"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Strategy map (todos)","aria-label":"Strategy map view",children:"map"}),n.jsx("button",{type:"button",onClick:()=>g("tools"),className:`px-2 py-0.5 rounded ${f==="tools"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Tool-call DAG (execution)","aria-label":"Tool-call map view",children:"tools"}),n.jsxs("button",{type:"button",onClick:()=>g("canvas"),className:`px-2 py-0.5 rounded relative ${f==="canvas"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Canvas (diagrams & illustrations)","aria-label":"Canvas view",children:["canvas",me.length>0?n.jsxs("span",{className:"ml-1 opacity-70",children:["(",me.length,")"]}):null]}),n.jsx("button",{type:"button",onClick:()=>g("terminal"),className:`px-2 py-0.5 rounded ${f==="terminal"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Terminal","aria-label":"Terminal view",children:"terminal"})]}),n.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:f==="map"?n.jsx(iH,{todos:D,darkMode:t}):f==="tools"?n.jsx(mH,{graph:Yi[oe]||null,darkMode:t}):f==="canvas"?n.jsx(YC,{canvases:me,onClear:me.length?Oe:null}):n.jsx(iR,{toolParts:zu,matrixMode:o,onToggleMatrix:()=>l(Ie=>!Ie),darkMode:t})})]}):me.length>0?n.jsx(YC,{canvases:me,onClear:me.length?Oe:null}):n.jsx(nR,{toolParts:Bu})}),n.jsx(u$,{messages:te,isBusy:ln,isCompacting:Ei!=null,activeModel:fe,sessionModel:ht[oe]||null,isPrivateMode:ee.has(oe),registryEntries:Ye})]})}x.useEffect(()=>{Xi(!1),li(""),Ii(0),hs(0),Mi(!1)},[oe]),x.useEffect(()=>{if(!oe)return;let D=!1;return B3(oe).then(re=>{if(D||!re)return;const ne=oe;re.privateMode&&$(de=>{if(de.has(ne))return de;const me=new Set(de);return me.add(ne),me}),Array.isArray(re.messageIds)&&re.messageIds.length&&z(de=>{let me=!1;const Oe=new Set(de);for(const Ie of re.messageIds)Oe.has(Ie)||(Oe.add(Ie),me=!0);return me?Oe:de})}).catch(()=>{}),()=>{D=!0}},[oe]),x.useEffect(()=>{if(!oe){ys(!1);return}let D=!1;return W4(oe).then(re=>{if(D)return;const ne=re&&re.config?re.config:{};ys(!!ne.enabled)}).catch(()=>{}),()=>{D=!0}},[oe]),x.useEffect(()=>{if(!oe){ye(!1);return}const D=nt.current[oe]||fe;if(!D){ye(!1);return}let re=!1;return j3(D).then(ne=>{re||ye(!!(ne&&ne.adaptiveQuality))}).catch(()=>{re||ye(!1)}),()=>{re=!0}},[oe,fe,ht]),x.useEffect(()=>{Na>0&&Ai>=Na?Ii(Na-1):Na===0&&Ai!==0&&Ii(0)},[Na,Ai]);const It=x.useRef(oe);x.useEffect(()=>{It.current=oe;const D=ra.current[oe];Zi(D?D.length:0)},[oe]),x.useEffect(()=>{if(!oe)return;let D=!1;return bp(oe).then(re=>{if(D)return;const ne=Array.isArray(re&&re.items)?re.items:[],de=oe;dn(me=>{const Oe={...me};if(ne.length===0)if(Oe[de])delete Oe[de];else return me;else Oe[de]=ne;return Oe})}).catch(re=>{console.warn("[queue] hydrate failed for",oe,re&&re.message)}),()=>{D=!0}},[oe]);const Cu=x.useRef(f);x.useEffect(()=>{Cu.current=f},[f]);const ra=x.useRef({}),[Gl,Zi]=x.useState(0),Kl=x.useRef(new Set),Ji=x.useCallback(D=>{if(D===It.current){const re=ra.current[D];Zi(re?re.length:0)}},[]),Tu=x.useCallback(D=>{if(!D)return;const re=It.current;if(!re)return;const ne=ra.current[re];Array.isArray(ne)&&ne.length>0&&(ra.current[re]=ne.filter(de=>de.queuedTempId!==D)),be(de=>de.filter(me=>me.info.id!==D)),Ji(re)},[Ji]),ui=!U||!!P;x.useEffect(()=>{!ie&&ui&&(da(),Sa(),S_().then(D=>{Qn(D)}).catch(D=>{console.error("Failed to fetch session status:",D)}))},[ie,ui]),x.useEffect(()=>{!ie&&ui&&(k_().then(D=>{D&&D.model&&ce(D.model),Be(!!(D&&D.inspector))}).catch(D=>{console.error("Failed to fetch config:",D)}),t3().then(D=>{D&&Array.isArray(D.providers)&&qe(D.providers)}).catch(D=>{console.error("Failed to fetch providers:",D)}),r3().then(D=>{D&&Array.isArray(D.entries)&&yt(D.entries)}).catch(D=>{console.error("Failed to fetch model registry:",D)}),Pb().then(D=>{D&&D.home&&ta(D.home)}).catch(D=>{console.error("Failed to fetch path info:",D)}))},[ie,ui]);const $o=x.useCallback(()=>{i3().then(D=>{const re=Array.isArray(D&&D.pending)?D.pending:[];Ge(re)}).catch(D=>{console.error("Failed to fetch pending permissions:",D)})},[]);x.useEffect(()=>{!ie&&ui&&$o()},[ie,ui,$o]),x.useEffect(()=>{const ne=setInterval(()=>{Ge(de=>{const me=Date.now(),Oe=de.filter(Ie=>me-(Ie.timestamp||0)<3e5);return Oe.length===de.length?de:Oe})},3e4);return()=>clearInterval(ne)},[]);const da=x.useCallback(async D=>{try{const re=D&&D.includeArchived||cr.current,ne=Se.current||0,de=Math.max(Cn,ne),me=D&&typeof D.q=="string"?D.q:za.current,Oe=!!(me&&me.trim()),Ie=await vl({limit:de,offset:0,includeArchived:Oe?!0:re,includeOtherApps:!1,q:me});if(Ie&&Ie.sessions){const St=Array.isArray(Ie.sessions)?Ie.sessions:[];Te(St),Xe(!!Ie.hasMore),pt(typeof Ie.total=="number"?Ie.total:St.length),le(St.length),Se.current=St.length}else{const St=Array.isArray(Ie)?Ie:[];Te(St),Xe(!1),pt(St.length),le(St.length),Se.current=St.length}}catch(re){return console.error("Failed to load sessions:",re),!1}return!0},[]);function di(D,re){var ne=re&&re.time&&re.time.updated||0,de=D&&D.time&&D.time.updated||0;return ne-de}const Wo=200,Vo=x.useRef(Wo),[rg,Yl]=x.useState(!1),[Xs,Ua]=x.useState([]),Qs=200,[Xl,Oi]=x.useState([]),ng=x.useMemo(()=>{if(!(Xs.length||Xl.length))return Ke;const re=Object.create(null),ne=[],de=Ke.concat(Xs,Xl);for(let me=0;me<de.length;me++){const Oe=de[me];!Oe||!Oe.id||re[Oe.id]||(re[Oe.id]=!0,ne.push(Oe))}return ne.sort(di)},[Ke,Xs,Xl]),Go=x.useCallback(async()=>{const D=za.current,re=!!(D&&D.trim());if(!cr.current&&!re){Oi([]);return}try{const ne=await vl({limit:Qs,offset:0,onlyArchived:!0,q:D}),de=ne&&ne.sessions?Array.isArray(ne.sessions)?ne.sessions:[]:Array.isArray(ne)?ne:[];Oi(de)}catch(ne){console.error("Failed to load archived sessions:",ne)}},[]),Sa=x.useCallback(async()=>{const D=za.current,re=!!(D&&D.trim());if(!jr.current&&!re){Ua([]);return}try{const ne=await vl({limit:Vo.current,offset:0,onlyOtherApps:!0,includeArchived:re?!0:cr.current,q:D}),de=ne&&ne.sessions?Array.isArray(ne.sessions)?ne.sessions:[]:Array.isArray(ne)?ne:[];Ua(de),Yl(!!(ne&&ne.hasMore))}catch(ne){console.warn("Failed to load other-app sessions:",ne),Ua([]),Yl(!1)}},[]),Ql=x.useCallback(async()=>{Vo.current+=Wo,await Sa()},[Sa]);x.useEffect(()=>{function D(){oe&&HI(oe).then(function(re){re&&re.sessionID&&(It.current=re.sessionID,bt(re.sessionID),da())}).catch(function(re){console.error("Failed to create archive session:",re);const ne=(()=>{if(!re)return!1;if(re.status===404||re.response&&re.response.status===404)return!0;if(typeof re.message=="string"){const de=re.message.match(/^(\d{3})\s*:/);if(de&&parseInt(de[1],10)===404)return!0}return!1})();He(e(ne?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",D),()=>document.removeEventListener("navigateToArchiveSession",D)},[oe,da,e,He]);const Ru=async()=>{try{const D=za.current,re=!!(D&&D.trim()),ne=await vl({limit:Cn,offset:H,includeArchived:re?!0:cr.current,includeOtherApps:!1,q:D});if(ne&&ne.sessions){const de=Array.isArray(ne.sessions)?ne.sessions:[];Te(me=>{for(var Oe={},Ie=0;Ie<me.length;Ie++)Oe[me[Ie].id]=!0;for(var St=[],Tr=0;Tr<de.length;Tr++)Oe[de[Tr].id]||St.push(de[Tr]);return me.concat(St)}),Xe(!!ne.hasMore),typeof ne.total=="number"&&pt(ne.total),le(me=>{var Oe=me+de.length;return Se.current=Oe,Oe})}}catch(D){console.error("Failed to load more sessions:",D)}},fa=async(D,re)=>{try{const ne=(re?re.fresh!==!1:!0)&&!Wr.current,de=await y_(D,ne,ne?{limit:D4}:void 0),me=de&&!Array.isArray(de)&&Array.isArray(de.messages),Oe=me?de.messages:de,Ie=me&&typeof de.compactedOutCount=="number"?de.compactedOutCount:0;return It.current!==D?null:Array.isArray(Oe)?(Je(ne?Ie:0),ne&&me?(Ft(de.hasMore===!0),Fe(typeof de.nextCursor=="string"?de.nextCursor:null)):(Ft(!1),Fe(null)),be(St=>{const Tr=Oe.some(Le=>Le.info.mode==="compaction"),Mr=Array.isArray(St)&&St.some(Le=>Le.info&&Le.info.mode==="compaction");if(Tr&&!Mr)return Oe;const Or=new Set(Oe.map(Le=>Le.info.id)),hr=Oe.reduce(function(Le,Qe){return Qe&&Qe.info&&Qe.info.mode==="compaction"&&Qe.info.time&&typeof Qe.info.time.created=="number"?Math.max(Le,Qe.info.time.created):Le},-1/0),ke=St.filter(Le=>Le.info.sessionID===D&&!Or.has(Le.info.id)&&!String(Le.info.id).startsWith("temp-")&&!(hr!==-1/0&&Le.info.time&&typeof Le.info.time.created=="number"&&Le.info.time.created<hr));if(ke.length===0)return Oe;const J=[];let pe=0,Ee=0;for(;pe<Oe.length||Ee<ke.length;){const Le=Oe[pe],Qe=ke[Ee],mt=Le&&Le.info.time&&typeof Le.info.time.created=="number"?Le.info.time.created:1/0,Ct=Qe&&Qe.info.time&&typeof Qe.info.time.created=="number"?Qe.info.time.created:1/0;pe<Oe.length&&(Ee>=ke.length||mt<=Ct)?(J.push(Le),pe++):(J.push(Qe),Ee++)}return J}),Oe):(be([]),null)}catch(ne){return console.error("Failed to load messages:",ne),It.current===D&&((ne&&(ne.status||ne.response&&ne.response.status))===404?(It.current=null,bt(null),Te(me=>me.filter(Oe=>Oe.id!==D)),Ua(me=>me.filter(Oe=>Oe.id!==D)),Oi(me=>me.filter(Oe=>Oe.id!==D))):He("Failed to load messages: "+(ne&&ne.message?ne.message:String(ne)))),null}},Au=x.useCallback(async D=>It.current!==D?null:(Wr.current=!0,fa(D,{fresh:!1})),[fa]),ag=async D=>{if(kt||!Bt||!Jt||Wr.current||It.current!==D)return null;Qt(!0);try{const re=await y_(D,!0,{limit:D4,before:Jt});if(It.current!==D)return null;if(!re||Array.isArray(re)||!Array.isArray(re.messages))throw new Error("Invalid paged message response");return Je(typeof re.compactedOutCount=="number"?re.compactedOutCount:0),Ft(re.hasMore===!0),Fe(typeof re.nextCursor=="string"?re.nextCursor:null),be(ne=>{const de=new Map;for(const me of re.messages.concat(ne))me&&me.info&&me.info.id&&de.set(me.info.id,me);return Array.from(de.values()).sort((me,Oe)=>{const Ie=me.info.time.created-Oe.info.time.created;return Ie!==0?Ie:me.info.id<Oe.info.id?-1:me.info.id>Oe.info.id?1:0})}),re.messages}catch(re){return It.current===D&&He("Failed to load earlier messages: "+(re&&re.message?re.message:String(re))),null}finally{It.current===D&&Qt(!1)}};x.useEffect(()=>{if(!oe){be([]),Je(0),Ft(!1),Fe(null),Qt(!1),Wr.current=!1,zr({}),ea(null),Ti(!0);return}be([]),Je(0),Ft(!1),Fe(null),Qt(!1),Wr.current=!1,ea(null),Ti(!1),Jn(null),oe&&(E_(oe).then(ke=>{ke&&Array.isArray(ke.banners)&&jn(J=>({...J,[oe]:ke.banners}))}).catch(()=>{}),vp(oe).then(ke=>{ke&&Array.isArray(ke.todos)&&vn(J=>({...J,[oe]:ke.todos}))}).catch(()=>{})),ar.connect(oe);let D=!1,re=!1,ne=!1,de=!1;const me=oe,Oe=ke=>{if(It.current!==me)return;const J=new Map;if(Array.isArray(ke))for(const pe of ke){if(!pe||!pe.info||!pe.info.id||!Array.isArray(pe.parts))continue;const Ee=new Set;for(const Le of pe.parts)Le&&(Le.type==="text"||Le.type==="reasoning")&&Ee.add(Le.type);Ee.size>0&&J.set(pe.info.id,Ee)}zr(pe=>{const Ee=pe[me];if(!Ee||Object.keys(Ee).length===0)return pe;const Le={};let Qe=!1;for(const mt of Object.keys(Ee)){const Ct=Ee[mt],Rt={};let Wt=!1;const br=J.get(mt);for(const Dn of Object.keys(Ct)){const Ha=Ct[Dn];if(Ha._fromSnapshot){Rt[Dn]=Ha,Wt=!0;continue}const Pn=Ha.type;if(br&&br.has(Pn)){Qe=!0;continue}Rt[Dn]=Ct[Dn],Wt=!0}Wt?Le[mt]=Rt:Qe=!0}if(!Qe)return pe;if(Object.keys(Le).length===0){const mt={...pe};return delete mt[me],mt}return{...pe,[me]:Le}})},Ie=setTimeout(()=>{!D&&!re&&(re=!0,fa(me).then(ke=>{ne=!0,Oe(ke),de&&It.current===me&&fa(me).then(J=>{Oe(J)})}))},3e3),St=80;function Tr(){fn.current!=null&&(clearTimeout(fn.current),fn.current=null);const ke=Ur.current;ke&&(Ur.current=null,zr(J=>{let pe=J;for(const Ee of Object.keys(ke)){const Le=ke[Ee],Qe={...pe[Ee]||{}};for(const mt of Object.keys(Le)){const Ct=Le[mt],Rt={...Qe[mt]||{}};for(const Wt of Object.keys(Ct)){const br=Ct[Wt],Dn=Rt[Wt];br.type==="text"||br.type==="reasoning"?Rt[Wt]={...br,text:((Dn==null?void 0:Dn.text)||"")+(br.delta||"")}:Rt[Wt]={...Dn,...br}}Qe[mt]=Rt}pe={...pe,[Ee]:Qe}}return pe}))}function Mr(){fn.current==null&&(fn.current=setTimeout(Tr,St))}function Or(ke,J,pe){Ur.current||(Ur.current={});const Ee=Ur.current;Ee[J]||(Ee[J]={});const Le=Ee[J];Le[pe]||(Le[pe]={});const Qe=Le[pe],mt=Qe[ke.id];ke.type==="text"||ke.type==="reasoning"?Qe[ke.id]={...ke,delta:(mt&&mt.delta||"")+(ke.delta||"")}:Qe[ke.id]={...mt,...ke}}const hr=[ar.on("connected",()=>{D=!0,clearTimeout(Ie),Ti(!0),$o(),S_().then(ke=>{Qn(ke)}).catch(()=>{}),bp(me).then(ke=>{const J=Array.isArray(ke&&ke.items)?ke.items:[];dn(pe=>{const Ee={...pe};if(J.length===0)if(Ee[me])delete Ee[me];else return pe;else Ee[me]=J;return Ee})}).catch(()=>{}),fa(me).then(ke=>{ne=!0,Oe(ke),de&&It.current===me&&fa(me).then(J=>{Oe(J)})})}),ar.on("error",()=>{Ti(!1),!D&&!re&&(clearTimeout(Ie),re=!0,fa(me).then(ke=>{ne=!0,Oe(ke),de&&It.current===me&&fa(me).then(J=>{Oe(J)})}))}),ar.on("session.status",ke=>{var Ee;const J=ke.properties||ke,pe=((Ee=J.status)==null?void 0:Ee.type)==="busy";tr(J.sessionID,pe)}),ar.on("message.part.delta",ke=>{const J=(ke.properties||ke).part;if(!J||!J.sessionID)return;I.current.has(J.sessionID)&&I.current.delete(J.sessionID);const{sessionID:pe,messageID:Ee}=J;if(Or(J,pe,Ee),Mr(),J.type==="text"&&J.delta){const Le=Vl.current;Le[pe]||(Le[pe]={}),Le[pe][Ee]=(Le[pe][Ee]||"")+J.delta,Ho.current&&console.log("[WhatsApp] Accumulating text delta:",J.delta.length,"chars, total:",Le[pe][Ee].length)}}),ar.on("streaming.snapshot",ke=>{const J=ke.properties||ke,pe=J.sessionID,Ee=J.parts;!pe||!Array.isArray(Ee)||zr(Le=>{const Qe={...Le[pe]||{}};for(const mt of Ee){const Ct={...Qe[mt.messageID]||{}};Ct[mt.id]={id:mt.id,type:mt.type,text:mt.text,sessionID:pe,messageID:mt.messageID,_fromSnapshot:!0},Qe[mt.messageID]=Ct}return{...Le,[pe]:Qe}})}),ar.on("message.progress",ke=>{const J=ke.properties||ke;J.sessionID===It.current&&ea({chunks:J.chunks||0,textLength:J.textLength||0,toolCalls:J.toolCalls||0,toolArgBytes:J.toolArgBytes||0,toolNames:J.toolNames||[]})}),ar.on("message.part.updated",ke=>{const J=(ke.properties||ke).part;if(J){if(Tr(),J.type==="text"||J.type==="reasoning"){const pe=J.sessionID;zr(Ee=>{const Le=Ee[pe];if(!Le)return Ee;const Qe=Le[J.messageID];if(!Qe)return Ee;const mt={};var Ct=!1;for(const Rt of Object.keys(Qe))Qe[Rt].type!==J.type&&(mt[Rt]=Qe[Rt],Ct=!0);if(!Ct){const Rt={...Le};if(delete Rt[J.messageID],Object.keys(Rt).length===0){const Wt={...Ee};return delete Wt[pe],Wt}return{...Ee,[pe]:Rt}}return{...Ee,[pe]:{...Le,[J.messageID]:mt}}})}if(J.sessionID===It.current){if(!ne){J.sessionID===me&&(de=!0);return}(J.type==="tool"||J.type==="tool-use")&&Cu.current==="tools"&&j_(J.sessionID).then(pe=>{pe&&Fa(Ee=>({...Ee,[J.sessionID]:pe}))}).catch(()=>{}),be(pe=>pe.map(Ee=>{if(Ee.info.id!==J.messageID)return Ee;const Le=Ee.parts.findIndex(Ct=>Ct.id===J.id);if(Le>=0)return{...Ee,parts:Ee.parts.map((Ct,Rt)=>Rt===Le?J:Ct)};const Qe=Ee.parts.slice();let mt=Qe.length;for(let Ct=Qe.length-1;Ct>=0;Ct--){if(Qe[Ct].id<=J.id){mt=Ct+1;break}Ct===0&&(mt=0)}return Qe.splice(mt,0,J),{...Ee,parts:Qe}}))}}}),ar.on("message.updated",ke=>{const J=(ke.properties||ke).info;if(!(!J||J.sessionID!==It.current)){if(Tr(),!ne){J.sessionID===me&&(de=!0);return}if(be(pe=>{const Ee=pe.findIndex(Rt=>Rt.info.id===J.id);if(Ee>=0)return pe.map((Rt,Wt)=>Wt===Ee?{...Rt,info:J}:Rt);if(J.role==="user"){const Rt=pe.findIndex(Wt=>Wt.info.id&&Wt.info.id.startsWith("temp-")&&Wt.info.role==="user");if(Rt>=0)return pe.map((Wt,br)=>br===Rt?{info:J,parts:[]}:Wt)}const Le={info:J,parts:[]};if(!J.time||typeof J.time.created!="number")return[...pe,Le];const Qe=J.time.created;let mt=pe.length;for(let Rt=pe.length-1;Rt>=0;Rt--){const Wt=pe[Rt].info.time;if(Wt&&typeof Wt.created=="number"&&Wt.created<=Qe){mt=Rt+1;break}Rt===0&&(mt=0)}const Ct=pe.slice();return Ct.splice(mt,0,Le),Ct}),J.compactedOut!==!0&&J.finish){const pe=J.sessionID;if(J.role==="assistant"&&Ho.current&&pe===It.current){const Ee=Vl.current[pe];Ee&&Ee[J.id]&&(delete Ee[J.id],Object.keys(Ee).length===0&&delete Vl.current[pe]),H3(pe).then(Le=>{if(Le&&Le.message)return console.log(`[WhatsApp] Processing queued message (${Le.remaining} remaining)`),Cd(pe,Le.message.text,null,nt.current[pe]||void 0)}).catch(Le=>{console.error("[WhatsApp] Failed to process queue:",Le)})}zr(Ee=>{const Le=Ee[pe];if(!Le||!Le[J.id])return Ee;const Qe={...Le};if(delete Qe[J.id],Object.keys(Qe).length===0){const mt={...Ee};return delete mt[pe],mt}return{...Ee,[pe]:Qe}}),ea(null),J.finish!=="compacted"&&tr(pe,!1),fa(It.current)}}}),ar.on("message.deleted",ke=>{const J=ke.properties||ke,pe=J.sessionID,Ee=J.messageID;!pe||!Ee||pe===It.current&&(be(Le=>Le.filter(Qe=>Qe.info.id!==Ee)),zr(Le=>{if(!Le[pe])return Le;const Qe=Le[pe];if(!Qe[Ee])return Le;const mt={...Le},Ct={...Qe};return delete Ct[Ee],mt[pe]=Ct,mt}))}),ar.on("session.updated",ke=>{const J=ke.properties||ke,pe=J.info||J,Ee=pe&&(pe.id||pe.sessionID)||J.sessionID||J.id;if(!Ee){da(),Sa();return}const Le=pe&&pe.time&&typeof pe.time.updated=="number",Qe=mt=>{Te(Ct=>{var Rt=!1,Wt=Ct.map(br=>br.id===Ee?(Rt=!0,{...mt,ui:{...mt.ui,...br.ui}}):br);return!Rt&&O4(mt)&&(Wt=[mt].concat(Wt)),Wt.sort(di),Wt}),Oi(Ct=>{var Rt=!1,Wt=Ct.map(br=>br.id!==Ee?br:(Rt=!0,{...mt,ui:{...mt.ui,...br.ui}}));return Rt?(Wt=Wt.filter(br=>br.archived),Wt.sort(di),Wt):Ct}),O4(mt)||Ua(Ct=>{var Rt=!1,Wt=Ct.map(br=>br.id!==Ee?br:(Rt=!0,{...mt,ui:{...mt.ui,...br.ui}}));return Rt?(Wt.sort(di),Wt):Ct})};Le?(Qe(pe),Dt(mt=>{let Ct=mt;const Rt=pe.model;return typeof Rt=="string"&&Rt||Rt&&typeof Rt=="object"&&Rt.providerID&&Rt.modelID?Ct={...mt,[Ee]:Rt}:mt[Ee]&&(Ct={...mt},delete Ct[Ee]),nt.current=Ct,Ct})):yp(Ee).then(mt=>{Qe(mt),Dt(Ct=>{let Rt=Ct;const Wt=mt&&mt.model;return typeof Wt=="string"&&Wt||Wt&&typeof Wt=="object"&&Wt.providerID&&Wt.modelID?Rt={...Ct,[Ee]:Wt}:Ct[Ee]&&(Rt={...Ct},delete Rt[Ee]),nt.current=Rt,Rt})}).catch(mt=>{console.error("Failed to fetch updated session, falling back to full reload:",mt),da()})}),ar.on("session.deleted",ke=>{const J=ke.properties||ke,pe=J.info||J,Ee=pe&&(pe.id||pe.sessionID)||J.sessionID||J.id;Ee&&(Te(Le=>Le.filter(Qe=>Qe.id!==Ee)),Ua(Le=>Le.filter(Qe=>Qe.id!==Ee)),Oi(Le=>Le.filter(Qe=>Qe.id!==Ee)),bt(Le=>Le===Ee?null:Le))}),ar.on("permission.request",ke=>{const J=ke.properties||ke;J.requestId&&Ge(pe=>pe.some(Ee=>Ee.id===J.requestId)?pe:[...pe,{id:J.requestId,action:J.action,type:J.type,target:J.target,reason:J.reason,description:J.description,timestamp:Date.now()}])}),ar.on("permission.confirmed",ke=>{const J=ke.properties||ke;J.requestId&&Ge(pe=>pe.filter(Ee=>Ee.id!==J.requestId))}),ar.on("permission.denied",ke=>{const J=ke.properties||ke;J.requestId&&Ge(pe=>pe.filter(Ee=>Ee.id!==J.requestId))}),ar.on("question.asked",ke=>{const J=ke.properties||ke;if(!J.id)return;const pe=J.tool&&J.tool.callID?J.tool.callID:null;if(pe&&Ue(Ee=>({...Ee,[pe]:J.id})),eu()){const Ee=J.questions&&J.questions[0],Le=Ee?Ee.text:"A question needs your input.",Qe=J.sessionID||null;yA({title:"PAVE — Question",body:Le.length>200?Le.slice(0,200)+"…":Le,tag:"pave-question-"+J.id,onClick:Qe?function(){ga(Qe),window.focus()}:function(){window.focus()}})}}),ar.on("question.replied",ke=>{const J=ke.properties||ke;J.requestId&&Ue(pe=>{var Ee={};for(var Le in pe)pe[Le]!==J.requestId&&(Ee[Le]=pe[Le]);return Ee})}),ar.on("question.rejected",ke=>{const J=ke.properties||ke;J.requestId&&Ue(pe=>{var Ee={};for(var Le in pe)pe[Le]!==J.requestId&&(Ee[Le]=pe[Le]);return Ee})}),ar.on("quality.hint",ke=>{const J=ke.properties||ke;if(!J.preset)return;const pe=J.sessionID;pe&&(Jf(Ee=>({...Ee,[pe]:J})),ku.current[pe]=J)}),ar.on("dlp.cancelled",ke=>{const pe=(ke.properties||ke).sessionID;if(!pe)return;const Ee=I.current.get(pe);Ee&&(Ee.tempId&&be(Le=>Le.filter(Qe=>Qe.info.id!==Ee.tempId)),pe===It.current&&O.current&&typeof O.current.setText=="function"&&O.current.setText(Ee.text||""),I.current.delete(pe)),tr(pe,!1)}),ar.on("dlp.private_message",ke=>{const J=ke.properties||ke,pe=J.sessionID,Ee=J.messageID;!pe||!Ee||(z(Le=>{if(Le.has(Ee))return Le;const Qe=new Set(Le);return Qe.add(Ee),Qe}),$(Le=>{if(Le.has(pe))return Le;const Qe=new Set(Le);return Qe.add(pe),Qe}))}),ar.on("dlp.exited_private",ke=>{const pe=(ke.properties||ke).sessionID;pe&&$(Ee=>{if(!Ee.has(pe))return Ee;const Le=new Set(Ee);return Le.delete(pe),Le})}),ar.on("session.error",ke=>{const J=ke.properties||ke;if(J.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",J.source||""),He("Session expired. Please log in again."),K(null),J.sessionID&&tr(J.sessionID,!1);return}J.sessionID&&tr(J.sessionID,!1),J.sessionID===It.current&&(J.code==="insufficient_credits"?(He(null),Ba(J.upgradeUrl||null),Vr(!0)):He(J.error||"An error occurred"))}),ar.on("session.retry",ke=>{const J=ke.properties||ke;J.reason==="rate_limit"&&J.sessionID===It.current&&(ji({attempt:J.attempt,maxRetries:J.maxRetries,delayMs:J.delayMs,elapsedMs:J.elapsedMs||0,maxDurationMs:J.maxDurationMs||0}),bn.current&&clearTimeout(bn.current),bn.current=setTimeout(()=>ji(null),1e4))}),ar.on("session.compacting",ke=>{const J=ke.properties||ke;J.sessionID===It.current&&Xn(pe=>({...pe,currentTokens:J.currentTokens??(pe==null?void 0:pe.currentTokens),threshold:J.threshold??(pe==null?void 0:pe.threshold),reason:J.reason??(pe==null?void 0:pe.reason),stage:J.stage??(pe==null?void 0:pe.stage),elapsedMs:J.elapsedMs??(pe==null?void 0:pe.elapsedMs),messageCount:J.messageCount??(pe==null?void 0:pe.messageCount),chunks:J.chunks??(pe==null?void 0:pe.chunks),textLength:J.textLength??(pe==null?void 0:pe.textLength)}))}),ar.on("session.compacted",ke=>{const J=ke.properties||ke,pe=It.current;if(J.sessionID===pe){if(Xn(null),nn(null),J.newSessionID&&J.newSessionID!==pe&&!J.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${pe} → ${J.newSessionID}`),J.newSession){Ko(J.newSession);const Qe=J.newSession.model;(typeof Qe=="string"&&Qe||Qe&&typeof Qe=="object"&&Qe.providerID&&Qe.modelID)&&Dt(Ct=>{const Rt={...Ct,[J.newSessionID]:Qe};return nt.current=Rt,Rt})}It.current=J.newSessionID,bt(J.newSessionID),Jr(!0);return}if(J.source==="server"){const Qe=J.summary?J.summary.substring(0,200)+(J.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${J.deletedMessages} messages replaced, ${J.summaryTokens||"?"} summary tokens`),Qe&&console.log("[SERVER-COMPACT] Summary: "+Qe),nn({source:"server",deletedMessages:J.deletedMessages||0,summaryTokens:J.summaryTokens||0,summary:Qe})}const Ee=J.inPlace===!0,Le=!!ni.current[pe];Ee&&Le?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(be([]),zr(Qe=>{if(!Qe[pe])return Qe;const mt={...Qe};return delete mt[pe],mt}),ea(null),fa(pe).then(()=>{requestAnimationFrame(()=>{ir.current&&It.current===pe&&ir.current.scrollToBottom()})}))}}),ar.on("banner.updated",ke=>{const J=ke.properties||ke;!J||!J.sessionID||(jn(pe=>{const Ee=pe[J.sessionID]||[];if(Ee.some(Qe=>Qe.timestamp===J.timestamp))return pe;const Le=[{url:J.url,timestamp:J.timestamp,prompt:J.prompt,createdAt:new Date(J.timestamp).toISOString()},...Ee];return{...pe,[J.sessionID]:Le}}),J.sessionID===It.current&&Jn(null))}),ar.on("banner.progress",ke=>{const J=ke.properties||ke;if(!J||J.sessionID!==It.current)return;const pe=J.stage||"working";let Ee=pe;pe==="queued"?Ee="Banner queued":pe==="summarizing"?Ee="Banner: summarizing…":pe==="rendering"?Ee=J.line?"Banner: "+J.line.substring(0,80):"Banner: rendering…":pe==="saved"?Ee="Banner saved":pe==="error"?Ee="Banner error: "+(J.message||"unknown"):pe==="skipped"&&(Ee="Banner skipped: "+(J.reason||"")),Jn({stage:pe,label:Ee,ts:Date.now()}),pe==="saved"&&J.sessionID&&E_(J.sessionID).then(Le=>{Le&&Array.isArray(Le.banners)&&jn(Qe=>({...Qe,[J.sessionID]:Le.banners}))}).catch(()=>{})}),ar.on("todo.updated",ke=>{const J=ke.properties||ke;!J||!J.sessionID||(Array.isArray(J.todos)?vn(pe=>({...pe,[J.sessionID]:J.todos})):vp(J.sessionID).then(pe=>{pe&&Array.isArray(pe.todos)&&vn(Ee=>({...Ee,[J.sessionID]:pe.todos}))}).catch(()=>{}))}),ar.on("whatsapp.message",ke=>{var pe;const J=ke.properties||ke;J.sessionId===It.current&&Ho.current&&(console.log("[WhatsApp] Injecting message:",(pe=J.text)==null?void 0:pe.substring(0,50)),Cd(J.sessionId,J.text,null,nt.current[J.sessionId]||void 0).catch(Ee=>console.error("[WhatsApp] Failed to inject message:",Ee)))}),ar.on("whatsapp.queued",ke=>{const J=ke.properties||ke;J.sessionId===It.current&&console.log(`[WhatsApp] Message queued from ${J.sender} (queue size: ${J.queueSize})`)}),ar.on("queue.updated",ke=>{const J=ke.properties||ke;if(!J||!J.sessionID)return;const pe=Array.isArray(J.items)?J.items:[];dn(Ee=>{const Le={...Ee};return pe.length===0?delete Le[J.sessionID]:Le[J.sessionID]=pe,Le}),J.change&&J.change.kind==="drain"&&J.sessionID===It.current&&ir.current&&(ir.current.resetAutoScroll(),Me())}),ar.on("idle-injection.enabled",ke=>{const J=ke.properties||ke;!J||J.sessionID!==me||(ys(!0),Ks(e("chat.idle_injection_enabled_toast"),"success"))}),ar.on("idle-injection.disabled",ke=>{const J=ke.properties||ke;!J||J.sessionID!==me||(ys(!1),Ks(e("chat.idle_injection_disabled_toast"),"info"))}),ar.on("idle-injection.fired",ke=>{const J=ke.properties||ke;!J||J.sessionID!==me||Ks(e("chat.idle_injection_fired_toast"),"success")}),ar.on("idle-injection.timeout",ke=>{const J=ke.properties||ke;!J||J.sessionID!==me||Ks(e("chat.idle_injection_timeout_toast"),"warning")}),ar.on("scheduled-injection.fired",ke=>{const J=ke.properties||ke;!J||J.sessionID!==me||Ks(e("scheduled_injection.fired_toast"),"success")}),ar.on("scheduled-injection.added",()=>{}),ar.on("scheduled-injection.removed",()=>{}),ar.on("prefill.fallback",ke=>{const J=ke.properties||ke;!J||J.sessionID!==me||(er({originalModel:J.originalModel,fallbackModel:J.fallbackModel,reason:J.reason||"prefill_too_large"}),ur.current&&clearTimeout(ur.current),ur.current=setTimeout(()=>{er(null),ur.current=null},15e3))}),ar.on("auth.device_code",ke=>{const J=ke.properties||ke;J.user_code&&J.verification_uri&&Nt({verification_uri:J.verification_uri,user_code:J.user_code,expires_in:J.expires_in||300})})];return()=>{clearTimeout(Ie),fn.current!=null&&(clearTimeout(fn.current),fn.current=null),Tr(),Ur.current=null,bs.current&&clearTimeout(bs.current),ur.current&&(clearTimeout(ur.current),ur.current=null),er(null),hr.forEach(ke=>ke()),ar.disconnect()}},[oe]),x.useEffect(()=>{if(!oe)return;const D=setTimeout(()=>{var re;(re=O.current)==null||re.focus()},50);return()=>{clearTimeout(D)}},[oe]);function Ko(D){Te(re=>{for(var ne=0;ne<re.length;ne++)if(re[ne].id===D.id)return re.map(de=>de.id===D.id?D:de);return[D,...re]})}const Zl=x.useCallback(async()=>{try{const D=await x_();Ko(D),It.current=D.id,bt(D.id)}catch(D){He("Failed to create session: "+D.message)}},[]);Y.current=Zl;const ga=x.useCallback(async D=>{var re;if(D!==It.current){It.current=D,bt(D),He(null),Jr(!!ni.current[D]),Xn(null);try{const ne=await yp(D);if(It.current!==D)return;((re=ne==null?void 0:ne.status)==null?void 0:re.type)==="busy"&&Jr(!0),Te(de=>{var Tr;if(!ne)return de;const me=de.findIndex(Mr=>Mr.id===D),Oe=((Tr=ne.time)==null?void 0:Tr.updated)||0;if(me>=0){const Mr=de[me],Or=de.filter(J=>J.id!==D),hr={...ne,ui:{...ne.ui,...Mr.ui}},ke=Or.findIndex(J=>{var pe;return(((pe=J.time)==null?void 0:pe.updated)||0)<=Oe});return Or.splice(ke<0?Or.length:ke,0,hr),Or}const Ie=de.findIndex(Mr=>{var Or;return(((Or=Mr.time)==null?void 0:Or.updated)||0)<=Oe}),St=[...de];return St.splice(Ie<0?St.length:Ie,0,ne),St}),Dt(de=>{if(ne&&ne.model)return{...de,[D]:ne.model};if(de[D]){const me={...de};return delete me[D],me}return de})}catch(ne){console.error("Failed to fetch session status for session",D,ne)}}},[]),ig=x.useCallback(async D=>{try{await qI(D),PI(D),Te(re=>re.filter(ne=>ne.id!==D)),oe===D&&(It.current=null,bt(null))}catch(re){He("Failed to delete: "+re.message)}},[oe]),Ea=x.useCallback(async()=>{try{await $I(),await da(),await Sa(),It.current=null,bt(D=>D&&null)}catch(D){He("Failed to delete sessions: "+D.message)}},[da]),Zs=x.useCallback(async(D,re)=>{try{await Qa(D,{title:re}),Te(ne=>ne.map(de=>de.id===D?{...de,title:re}:de))}catch(ne){He("Failed to rename: "+ne.message)}},[]),Iu=x.useCallback(async D=>{try{const re=await BI(D);re&&re.title&&Te(ne=>ne.map(de=>de.id===D?{...de,title:re.title}:de))}catch(re){He("Failed to regenerate title: "+re.message)}},[]),[Jl,ec]=x.useState(null),Mu=x.useCallback(D=>{ec(D)},[]),tc=x.useCallback(async(D,re)=>{try{await Qa(D,{pinned:re}),Te(ne=>ne.map(de=>de.id===D?{...de,pinned:re}:de))}catch(ne){He("Failed to pin: "+ne.message)}},[]),sg=x.useCallback(async D=>{const re=Ke.find(de=>de.id===D);if(!re||!re.parentSessionID)return;const ne=re.parentSessionID;try{await GI(D),Te(de=>de.map(me=>me.id===D?{...me,compactionPinned:!1}:me)),It.current=ne,bt(ne)}catch(de){He("Failed to unpin: "+de.message)}},[Ke]),og=x.useCallback(async(D,re)=>{try{await Qa(D,{archived:re}),!cr.current&&re?(Te(ne=>ne.filter(de=>de.id!==D)),oe===D&&(It.current=null,bt(null))):Te(ne=>ne.map(de=>de.id===D?{...de,archived:re}:de))}catch(ne){He("Failed to archive: "+ne.message)}},[oe]),vs=x.useCallback(async({readOnly:D=!1}={})=>{if(!oe)return;let re,ne,de;if(Te(me=>{var Ie;const Oe=me.find(St=>St.id===oe);return re=((Ie=Oe==null?void 0:Oe.ui)==null?void 0:Ie.hideThinking)??!1,ne=!re,de=Oe==null?void 0:Oe.ui,me.map(St=>St.id===oe?{...St,ui:{...St.ui,hideThinking:ne}}:St)}),!D)try{await Qa(oe,{ui:{...de,hideThinking:ne}})}catch(me){console.error("Failed to persist hideThinking:",me),Te(Oe=>Oe.map(Ie=>Ie.id===oe?{...Ie,ui:{...Ie.ui,hideThinking:re}}:Ie)),He("Failed to save thinking visibility preference"+(me!=null&&me.message?": "+me.message:""))}},[oe]),Yo=x.useCallback(async D=>{try{await O3(D)}catch(re){He("Export failed: "+re.message)}},[]),es=x.useCallback(async D=>{try{const re=await D3(D);re&&re.id&&(await da(),ga(re.id))}catch(re){He("Import failed: "+re.message)}},[da,ga]),Xo=x.useRef(!1);x.useEffect(()=>{if(!Xo.current&&!(!ui||Ke.length===0)){Xo.current=!0;var D=null,re=!1;try{var ne=new URLSearchParams(window.location.search);D=ne.get("session"),re=!!D}catch{}if(D||(D=E()),!!D){if(Ke.some(function(de){return de.id===D})){ga(D);return}yp(D).then(function(de){de&&de.id?ga(D):re||T()}).catch(function(){re||T()})}}},[ui,Ke,ga]),x.useEffect(()=>{function D(re){var ne=re.data;!ne||ne.type!=="navigate-session"||ne.sessionId&&ga(ne.sessionId)}return window.addEventListener("message",D),function(){window.removeEventListener("message",D)}},[ga]),x.useEffect(()=>{function D(){try{var ne=indexedDB.open("pave-sw",1);ne.onupgradeneeded=function(){ne.result.createObjectStore("pave-pending-nav")},ne.onsuccess=function(){var de=ne.result;if(!de.objectStoreNames.contains("pave-pending-nav")){de.close();return}var me=de.transaction("pave-pending-nav","readwrite"),Oe=me.objectStore("pave-pending-nav"),Ie=Oe.get("sessionId");Ie.onsuccess=function(){var St=Ie.result;Oe.delete("sessionId"),St&&St!==It.current&&ga(St)},me.oncomplete=function(){de.close()},me.onerror=function(){de.close()}},ne.onerror=function(){}}catch{}}function re(){document.visibilityState==="visible"&&(D(),setTimeout(D,500),setTimeout(D,1500))}return document.addEventListener("visibilitychange",re),function(){document.removeEventListener("visibilitychange",re)}},[ga]);const Lu=x.useCallback(async D=>{if(!oe)return;const re=Pt.current,ne=(re[oe]||0)+1;re[oe]=ne;const de=nt.current[oe];Dt(me=>{const Oe={...me};return D?Oe[oe]=D:delete Oe[oe],nt.current=Oe,Oe});try{const me=await Qa(oe,{model:D||null});if(re[oe]!==ne)return;me&&(typeof me.model=="string"&&me.model||me.model&&typeof me.model=="object"&&me.model.providerID&&me.model.modelID)?Dt(Oe=>{const Ie={...Oe,[oe]:me.model};return nt.current=Ie,Ie}):D||Dt(Oe=>{const Ie={...Oe};return delete Ie[oe],nt.current=Ie,Ie})}catch(me){if(re[oe]!==ne)return;Dt(Oe=>{const Ie={...Oe};return de!==void 0?Ie[oe]=de:delete Ie[oe],nt.current=Ie,Ie}),console.error("[ModelChange] PATCH failed for session",oe,me),He("Failed to update session model: "+me.message)}},[oe]),Qo=x.useCallback(async function(D,re){if(oe){var ne=Pe&&Pe.disabledSkills||[],de;re?de=ne.filter(function(me){return me!==D}):de=ne.concat([D]),Te(function(me){return me.map(function(Oe){return Oe.id===oe?{...Oe,disabledSkills:de}:Oe})});try{await Qa(oe,{disabledSkills:de})}catch(me){Te(function(Oe){return Oe.map(function(Ie){return Ie.id===oe?{...Ie,disabledSkills:ne}:Ie})}),console.error("[SkillToggle] PATCH failed:",me)}}},[oe,Pe]),ks=x.useCallback(async function(){if(oe)try{var D=await V4(),re=D.skillDefaults||{},ne=await bv(),de=["agent"];(ne||[]).forEach(function(me){re[me.name]||de.push(me.name)}),Te(function(me){return me.map(function(Oe){return Oe.id===oe?{...Oe,disabledSkills:de}:Oe})}),await Qa(oe,{disabledSkills:de})}catch(me){console.error("[SkillToggle] Reset to defaults failed:",me)}},[oe]),rc=x.useCallback(D=>{Te(re=>re.map(ne=>ne.id===oe?{...ne,directory:D}:ne)),ms(!1)},[oe]),Ou=x.useCallback(async()=>{const D=!jr.current;jr.current=D,Vo.current=Wo,Er(D);try{localStorage.setItem("pave-show-other-apps",D?"true":"false")}catch{}await Sa()},[]),Di=x.useRef(null),Du=x.useCallback(D=>{const re=typeof D=="string"?D:"";Tn(re),za.current=re,Di.current&&clearTimeout(Di.current),Di.current=setTimeout(()=>{Se.current=0,Vo.current=Wo,da({q:re}),Sa(),Go()},250)},[]);x.useEffect(()=>()=>{Di.current&&clearTimeout(Di.current)},[]);const Pu=x.useCallback(async()=>{const D=!cr.current;cr.current=D,await da({includeArchived:D})?(_r(D),await Promise.all([Go(),Sa()])):cr.current=!D},[Go,Sa]),_s=x.useCallback(async(D,re,ne,de,me,Oe,Ie)=>{const St=D===It.current;Oe&&St&&be(sr=>sr.filter(na=>na.info.id!==Oe));var Tr=(ne?ne.length:0)+(Ie?Ie.length:0);if(Tr>mf)throw He("Too many attachments. Maximum "+mf+" per message."),new Error("Too many attachments");var Mr=[],Or=0;if(ne&&ne.length>0){for(var hr=0;hr<ne.length;hr++){var ke=(ne[hr].file.type||"").toLowerCase();if(Mf.indexOf(ke)===-1)throw He('Unsupported image type: "'+ne[hr].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(ne[hr].file.size>Zw){var J=Math.round(ne[hr].file.size/1024/1024*10)/10,pe=Math.round(Zw/1024/1024*10)/10;throw He('Image "'+ne[hr].name+'" ('+J+"MB) exceeds the "+pe+"MB size limit."),new Error("Image too large")}Or+=ne[hr].file.size}if(Or>t2){var Ee=Math.round(Or/1024/1024*10)/10,Le=Math.round(t2/1024/1024*10)/10;throw He("Combined image size ("+Ee+"MB) exceeds the "+Le+"MB total image limit."),new Error("Combined image size too large")}try{Mr=await Promise.all(ne.map(function(sr){return new Promise(function(na,kn){var Rn=new FileReader;Rn.onload=function(){if(typeof Rn.result!="string"){kn(new Error("FileReader did not produce a data URL for: "+sr.name));return}na({type:"image_url",image_url:{url:Rn.result}})},Rn.onerror=function(){kn(new Error("Failed to read file: "+sr.name))},Rn.readAsDataURL(sr.file)})}))}catch(sr){throw He("Failed to read image: "+sr.message),sr}}var Qe=[],mt=0;if(Ie&&Ie.length>0){for(var Ct=0;Ct<Ie.length;Ct++){var Rt=(Ie[Ct].file.type||"").toLowerCase();if(tR.indexOf(Rt)===-1)throw He('Unsupported file type: "'+Ie[Ct].name+'" ('+(Rt||"unknown")+")."),new Error("Unsupported file type");if(Ie[Ct].file.size>Jw){var Wt=Math.round(Ie[Ct].file.size/1024/1024*10)/10,br=Math.round(Jw/1024/1024*10)/10;throw He('File "'+Ie[Ct].name+'" ('+Wt+"MB) exceeds the "+br+"MB size limit."),new Error("File too large")}mt+=Ie[Ct].file.size}if(Or+mt>e2){var Dn=Math.round((Or+mt)/1024/1024*10)/10,Ha=Math.round(e2/1024/1024*10)/10;throw He("Combined attachment size ("+Dn+"MB) exceeds the "+Ha+"MB total limit."),new Error("Combined attachment size too large")}try{Qe=await Promise.all(Ie.map(function(sr){return new Promise(function(na,kn){var Rn=new FileReader;Rn.onload=function(){if(typeof Rn.result!="string"){kn(new Error("FileReader did not produce a data URL for: "+sr.name));return}na({type:"file",mime:sr.file.type,filename:sr.name,url:Rn.result})},Rn.onerror=function(){kn(new Error("Failed to read file: "+sr.name))},Rn.readAsDataURL(sr.file)})}))}catch(sr){throw He("Failed to read file: "+sr.message),sr}}const Pn="temp-"+Date.now();for(var ro=[{id:Pn+"-text",type:"text",text:me}],gi=0;gi<Mr.length;gi++)ro.push({id:Pn+"-img-"+gi,type:"image_url",image_url:Mr[gi].image_url});for(var pa=0;pa<Qe.length;pa++)ro.push({id:Pn+"-file-"+pa,type:"file",mime:Qe[pa].mime,filename:Qe[pa].filename});const qr={info:{id:Pn,sessionID:D,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:ro};be(sr=>St?[...sr,qr]:sr),St&&ir.current&&(ir.current.resetAutoScroll(),Me()),tr(D,!0),I.current.set(D,{text:me,tempId:Pn});const Lr=Uo.current[D]??null,pi=Ul.current[D]??"max",pn=Lr===null&&!qo.current.has(D),Fn=ku.current[D],Fi=pn&&Fn?Fn.moe_topk||null:Lr;try{var rs=null;(Mr.length>0||Qe.length>0)&&(rs=Qe.concat(Mr)),await Cd(D,re,rs,nt.current[D]||void 0,de,{moeTopK:Fi,reasoningEffort:pi,adaptiveQuality:pn})}catch(sr){if(sr.status===409)if(Mr.length>0||Qe.length>0){const kn=Pn;ra.current[D]||(ra.current[D]=[]),ra.current[D].push({content:re,imageAttachments:ne,fileAttachments:Ie,agent:de,displayContent:me,queuedTempId:kn}),Ji(D),tr(D,!1);return}else try{await b_(D,re,{displayContent:me,agent:de||void 0,model:nt.current[D]||void 0,moeTopK:Fi,reasoningEffort:pi,adaptiveQuality:pn}),be(kn=>kn.filter(Rn=>Rn.info.id!==Pn)),tr(D,!1);return}catch(kn){throw He("Failed to queue message: "+kn.message),tr(D,!1),be(Rn=>Rn.filter(Jo=>Jo.info.id!==Pn)),kn}if(sr&&sr.reauthRequired){He("Session expired. Please log in again."),K(null),tr(D,!1),be(na=>na.filter(kn=>kn.info.id!==Pn));return}throw He("Failed to send: "+sr.message),tr(D,!1),be(na=>na.filter(kn=>kn.info.id!==Pn)),sr}},[Ji,Me]),Zo=x.useRef(_s);x.useEffect(()=>{Zo.current=_s},[_s]);const qa=x.useCallback(async(D,re,ne,de)=>{He(null);const me=D,Oe=D.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(Oe){const hr=Oe[1],ke=Oe[2],J=Oe[3]||"",pe=J||hr+" "+ke,Ee=(hr+"_"+ke).replace(/-/g,"_").slice(0,128);D="[SKILL_HINT: User explicitly requested "+hr+"."+ke+(J?" with args: "+J:"")+". Call the "+Ee+` tool with these parameters.]
|
|
129
|
-
|
|
130
|
-
`+pe}let Ie=It.current;if(!Ie)try{const hr=await x_();Ko(hr),It.current=hr.id,bt(hr.id),Ie=hr.id,await new Promise(ke=>setTimeout(ke,200))}catch(hr){throw He("Failed to create session: "+hr.message),hr}if(!!yr[Ie]){if(!(re&&re.length>0||de&&de.length>0)){try{await b_(Ie,D,{displayContent:me,agent:ne||void 0,model:nt.current[Ie]||void 0})}catch(Ee){He("Failed to queue message: "+Ee.message)}return}const ke="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),J=[{id:ke+"-text",type:"text",text:me}];if(re&&re.length>0)for(var Tr=0;Tr<re.length;Tr++){var Mr=re[Tr].preview||"";J.push({id:ke+"-img-"+Tr,type:"image_url",image_url:{url:Mr}})}if(de&&de.length>0)for(var Or=0;Or<de.length;Or++)J.push({id:ke+"-file-"+Or,type:"file",mime:de[Or].file.type,filename:de[Or].name});const pe={info:{id:ke,sessionID:Ie,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:J};be(Ee=>[...Ee,pe]),Ie===It.current&&ir.current&&(ir.current.resetAutoScroll(),Me()),ra.current[Ie]||(ra.current[Ie]=[]),ra.current[Ie].push({content:D,imageAttachments:re,agent:ne,displayContent:me,queuedTempId:ke,fileAttachments:de}),Ji(Ie);return}await _s(Ie,D,re,ne,me,null,de)},[yr,_s,Ji,Me]);x.useEffect(()=>{const D=()=>{qa(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",D),()=>window.removeEventListener("pave:plan-execute",D)},[qa,e]);const Fu=x.useCallback(async()=>{if(oe)try{const D=oe;Kl.current.add(D),await KI(D),tr(D,!1),ea(null)}catch(D){console.error("Abort failed:",D),He("Failed to stop: "+(D&&D.message?D.message:String(D)))}},[oe,tr]),Pi=x.useCallback(async(D,re,ne)=>{if(He(null),D==="btw"){const de=It.current;if(!de){He("No active session to fork.");return}let me;try{me=await UI(de)}catch(Ie){throw He("Fork failed: "+(Ie&&Ie.message?Ie.message:String(Ie))),Ie}if(!me||!me.id)throw He("Fork failed: server returned no session id."),new Error("Fork returned no session");Ko(me),It.current=me.id,bt(me.id),await new Promise(Ie=>setTimeout(Ie,200));const Oe=(re||"").trim();if(Oe)try{await qa(Oe,ne&&ne.imageAttachments?ne.imageAttachments:void 0,void 0,ne&&ne.fileAttachments?ne.fileAttachments:void 0)}catch{}return}if(D==="compact"){const de=It.current;if(!de){He("No active session to compact.");return}He(null),Xn({reason:"manual",stage:"starting"}),nn(null),VI(de).then(me=>{if(!me||!me.success){Xn(null),He("Compaction failed: "+(me&&me.error||"unknown error"));return}fa(de),Xn(null),nn(null)}).catch(me=>{Xn(null),me&&me.status===409?He("Cannot compact while the session is busy. Wait for the current response to finish."):He("Compaction failed: "+(me&&me.message?me.message:String(me)))});return}He("Unknown built-in command: /"+D)},[qa]),nc=x.useCallback(D=>{Ge(re=>re.filter(ne=>ne.id!==D))},[]),ac=x.useCallback(async()=>{for(var D=te.length-1;D>=0;D--)if(te[D].info.role==="user"){var re=te[D].parts||[],ne=Jv(re,null),de=re.filter(function(Ie){return Ie.type==="image_url"&&Ie.image_url});if(ne.trim()||de.length>0)if(de.length>0){var me=oe;if(!me)break;tr(me,!0),He(null);try{var Oe=de.map(function(Ie){return{type:"image_url",image_url:Ie.image_url}});await Cd(me,ne.trim(),Oe,nt.current[me]||void 0)}catch(Ie){He("Failed to retry: "+Ie.message),tr(me,!1)}}else try{await qa(ne.trim())}catch(Ie){He("Failed to retry: "+Ie.message),tr(oe,!1)}break}},[te,qa,oe]),lg=x.useCallback(async function(D){if(D&&D.trim()){He(null),ir.current&&ir.current.resetAutoScroll();try{await qa(D.trim()),Me()}catch(re){He("Failed to resend: "+re.message),tr(oe,!1)}}},[qa,Me]),ja=x.useMemo(()=>Pe?Pe.source==="archive"||Pe._readOnly===!0:!1,[Pe]),ts=x.useMemo(()=>Pe?Pe._readOnly===!0&&Pe.source!=="tui"&&Pe.source!=="archive":!1,[Pe]),ic=x.useMemo(()=>{if(!ts||!Pe||!Ke)return null;for(const D of Ke)if(D.parentSessionID===Pe.id)return D.id;return null},[ts,Pe,Ke]),Bu=x.useMemo(()=>{var ne;let D=null;for(let de=te.length-1;de>=0;de--)if(((ne=te[de].info)==null?void 0:ne.role)==="assistant"){D=te[de];break}if(!D)return[];const re=(D.parts||[]).filter(de=>de.type==="tool");return re.length===0?[]:!ln&&re.every(me=>{var Oe,Ie;return((Oe=me.state)==null?void 0:Oe.status)==="completed"||((Ie=me.state)==null?void 0:Ie.status)==="error"})?[]:re},[te,ln]),zu=x.useMemo(()=>{var re;const D=[];for(const ne of te)if(((re=ne.info)==null?void 0:re.role)==="assistant"){const de=(ne.parts||[]).filter(me=>me.type==="tool");D.push(...de)}return D},[te]),Cr=x.useRef(0),[sc,ws]=x.useState(!1),Js=x.useCallback(D=>{if(D.preventDefault(),D.stopPropagation(),Cr.current++,Cr.current===1){const re=D.dataTransfer;let ne=!1;re&&re.items&&re.items.length>0&&(ne=Array.from(re.items).some(de=>de.kind==="file")),ne&&ws(!0)}},[]),Uu=x.useCallback(D=>{D.preventDefault(),D.stopPropagation(),Cr.current=Math.max(0,Cr.current-1),Cr.current===0&&ws(!1)},[]),oc=x.useCallback(D=>{D.preventDefault(),D.stopPropagation()},[]),eo=x.useCallback(D=>{D.preventDefault(),D.stopPropagation(),Cr.current=0,ws(!1);const re=D.dataTransfer&&D.dataTransfer.files;if(!re||re.length===0)return;const ne=re[0],de=ne.name.toLowerCase();if(!de.endsWith(".yaml")&&!de.endsWith(".yml")){He(e("import.invalid_file_type"));return}const me=10*1024*1024;if(ne.size>me){He(e("import.file_too_large"));return}const Oe=new FileReader;Oe.onload=Ie=>{const St=Ie&&Ie.target?Ie.target.result:null;if(typeof St!="string"){He(e("import.read_error"));return}es(St)},Oe.onerror=()=>{He(e("import.read_error"))},Oe.readAsText(ne)},[es,He,e]);if(ie)return n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950",children:n.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})});if(!P)return n.jsx(AB,{darkMode:t,onToggleTheme:()=>r(!t)});const to=Pe==null?void 0:Pe.title,fi=typeof to=="string"?to.trim():"",Ns=((qu=Pe==null?void 0:Pe.ui)==null?void 0:qu.hideThinking)??!1;return n.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:Js,onDragLeave:Uu,onDragOver:oc,onDrop:eo,children:[sc&&n.jsx("div",{className:"fixed inset-0 z-50 bg-primary-500/20 dark:bg-primary-400/20 border-4 border-dashed border-primary-500 dark:border-primary-400 flex items-center justify-center pointer-events-none",children:n.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:n.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),n.jsxs("header",{className:"flex items-center justify-between px-4 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("img",{src:t?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-8"}),n.jsx("h1",{className:"sr-only",children:"PAVE"}),V&&n.jsxs("span",{className:"hidden sm:inline text-xs text-gray-400 dark:text-gray-500 select-none",title:e("app.version"),children:["v",V]})]}),ae==="chat"&&oe&&n.jsx("span",{className:"sm:hidden min-w-0 truncate text-sm font-medium text-gray-600 dark:text-gray-300",title:Pe&&Pe.title||e("sidebar.untitled"),children:Pe&&Pe.title||e("sidebar.untitled")}),n.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[n.jsx("button",{onClick:()=>Q("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ae==="chat"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.chat_tab")}),n.jsx("button",{onClick:()=>Q("agents"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ae==="agents"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.agents_tab")}),n.jsx("button",{onClick:()=>Q("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ae==="skills"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.skills_tab")}),n.jsx("button",{onClick:()=>Q("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ae==="settings"?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:e("app.settings_tab")})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(CV,{onNavigateToAgent:D=>{De(D),Q("agents")}}),$e&&n.jsx("button",{onClick:()=>ut(D=>!D),className:`p-1.5 rounded-lg transition-colors ${gt?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:"Inspector — replay EPM requests/responses & context internals","aria-label":"Inspector","aria-pressed":gt,children:n.jsx("span",{className:"text-sm leading-none",children:"🦋"})}),n.jsx("button",{onClick:()=>i(!a),className:`p-1.5 rounded-lg transition-colors ${a?"bg-green-600 text-black":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e(a?"app.hacker_mode_exit":"app.hacker_mode_enter"),"aria-label":e(a?"app.hacker_mode_exit":"app.hacker_mode_enter"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),oe&&ae==="chat"&&n.jsx("button",{onClick:v,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${y?"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400"}`,title:e("app.toggle_right_pane",{shortcut:X?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:X?"Cmd+J":"Ctrl+J"}),"aria-pressed":y,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})})}),n.jsx(EI,{darkMode:t,onToggle:()=>r(!t)}),P&&n.jsx(IB,{user:P,onLogout:rt,onSkillManagement:()=>Q("skills"),onAgentManagement:()=>Q("agents"),onPricingSettings:()=>at(!0),onDlpSettings:()=>Ce(!0),onSettings:()=>Q("settings"),onBoard:Wl?()=>Q("board"):void 0})]})]}),ae==="skills"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(F$,{onBack:()=>Q("chat")})}):ae==="agents"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(mW,{onBack:()=>Q("chat"),onSelectAgent:D=>{he(D)},initialAgentName:Ne,onInitialAgentConsumed:()=>De(null),hackerMode:a,matrixMode:o,darkMode:t,onToggleMatrix:()=>l(D=>!D),terminalWidth:h,onTerminalWidthChange:m,terminalMinWidth:sf,terminalMaxWidth:of})}):ae==="board"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(_W,{onBack:()=>Q("chat")})}):ae==="settings"?n.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:n.jsx(gV,{onBack:()=>Q("chat"),onOpenDlpSettings:()=>Ce(!0),onOpenPricingSettings:()=>at(!0),activeSessionId:oe,mobileFrameless:u,onMobileFramelessChange:d})}):n.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[n.jsx(OI,{sessions:ng,activeSessionId:oe,busySessions:yr,onSelectSession:D=>{ga(D),window.innerWidth<768&&lr(!1)},onNewChat:Zl,onDeleteSession:ig,onDeleteAllSessions:Ea,onRenameSession:Zs,onRegenerateTitle:Iu,onPinSession:tc,onArchiveSession:og,onExportSession:Yo,onSendToSession:Mu,onImportSession:es,onImportError:D=>He(D),showArchived:pr,onToggleShowArchived:Pu,isOpen:$t,onClose:()=>lr(!1),onToggle:()=>lr(D=>!D),hasMoreSessions:wa,onLoadMoreSessions:Ru,showOtherApps:_t,onToggleShowOtherApps:Ou,hasMoreOtherApps:rg,onLoadMoreOtherApps:Ql,otherAppsCount:Xs.length,search:an,onSearchChange:Du,loadedCount:Ke.length,totalCount:We}),n.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:oe?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 px-3 py-1.5 border-b border-gray-100 dark:border-gray-800/50 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(d$,{sessionModel:ee.has(oe)?"epm/privacy":ht[oe]||null,activeModel:fe,registryEntries:Ye,onModelChange:Lu,disabled:ln||ee.has(oe),lockedReason:ee.has(oe)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},oe),fi?n.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:fi,children:fi}):null,n.jsx("button",{onClick:()=>ms(!0),className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:e("chat.working_directory"),"aria-label":e("chat.working_directory"),disabled:ja,children:n.jsx(jA,{className:"w-4 h-4"})}),n.jsx(p$,{sessionId:oe,disabledSkills:Pe?Pe.disabledSkills:[],onToggle:Qo,onResetToDefaults:ks,t:e,disabled:ja}),n.jsx("button",{onClick:()=>zo(!0),className:`p-1.5 rounded-lg transition-colors ${Bl?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("chat.idle_injection_title"),"aria-label":e("chat.idle_injection_title"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),ve&&n.jsx("div",{className:"hidden sm:flex items-center rounded-lg bg-gray-100 dark:bg-gray-800 p-0.5",title:e("chat.moe_tooltip"),children:[{val:null,label:"Auto"},{val:8,label:"Quality"},{val:6,label:"Balanced"},{val:4,label:"Fast"}].map(D=>{const re=_u===null&&Nu&&!qo.current.has(oe)&&Nu.moe_topk===D.val,ne=_u===D.val;return n.jsx("button",{onClick:()=>{D.val===null?qo.current.delete(oe):qo.current.add(oe),Gs(de=>({...de,[oe]:D.val})),Qa(oe,{moe_top_k:D.val}).catch(()=>{})},disabled:ja,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${ne?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":re?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 ring-1 ring-blue-400 dark:ring-blue-600":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:D.label},D.label)})}),n.jsx("div",{className:"hidden sm:flex items-center rounded-lg bg-gray-100 dark:bg-gray-800 p-0.5",title:e("chat.reasoning_tooltip"),children:[{val:"max",label:e("chat.reasoning_max")},{val:"high",label:e("chat.reasoning_high")},{val:"off",label:e("chat.reasoning_off")}].map(D=>n.jsx("button",{onClick:()=>{vu(re=>({...re,[oe]:D.val})),Qa(oe,{reasoning_effort:D.val}).catch(()=>{})},disabled:ja,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${wu===D.val?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:D.label},D.val))})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{onClick:()=>vs({readOnly:ja}),className:`p-1.5 rounded-lg transition-colors ${Ns?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-amber-500/10 text-amber-600 dark:text-amber-400"}`,title:e(Ns?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(Ns?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!Ns,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),$l&&n.jsx("button",{onClick:async()=>{if(oe)try{await $3(oe),He("Banner generation queued (~2 min)"),setTimeout(()=>He(null),4e3)}catch(D){He(`Banner: ${D.message||D}`)}},disabled:!oe,className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Generate session banner now","aria-label":"Generate session banner now",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),$l&&n.jsx("button",{onClick:w,className:`p-1.5 rounded-lg transition-colors ${_?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}`,title:_?"Show banner":"Hide banner","aria-label":_?"Show banner":"Hide banner","aria-pressed":!_,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:_?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M3 3l18 18"}):n.jsxs(n.Fragment,{children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})}),Un?n.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${Un.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":Un.stage==="saved"?"text-green-600 dark:text-green-400 bg-green-500/10":"text-gray-500 dark:text-gray-400 bg-gray-500/10"}`,title:Un.label,children:Un.label}):null,Ys&&n.jsx("button",{"data-testid":"whatsapp-toggle",onClick:()=>{if(!ua){alert(e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.");return}Fo(D=>!D)},disabled:!ua,className:`p-1.5 rounded-lg transition-colors ${ua?gn?"bg-green-500/10 text-green-600 dark:text-green-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800":"text-gray-300 dark:text-gray-600 cursor-not-allowed"}`,title:ua?e(gn?"chat.whatsapp_enabled":"chat.whatsapp_disabled"):e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.","aria-label":e(gn?"chat.whatsapp_enabled":"chat.whatsapp_disabled"),"aria-pressed":gn,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),n.jsx("button",{onClick:()=>Mi(D=>!D),className:`p-1.5 rounded-lg transition-colors lg:hidden ${ci?"bg-primary-500/10 text-primary-600 dark:text-primary-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("app.activities_panel"),"aria-label":e("app.activities_panel"),"aria-expanded":ci,"aria-haspopup":"dialog","aria-controls":"activities-panel-dialog",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),n.jsx("button",{onClick:()=>Yo(oe),className:"p-1.5 rounded-lg transition-colors text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:e("sidebar.export"),"aria-label":e("sidebar.export"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})}),n.jsx("button",{onClick:()=>{Xi(D=>!D),Do&&(li(""),Ii(0),hs(0))},className:`p-1.5 rounded-lg transition-colors ${Do?"bg-primary-500/10 text-primary-600 dark:text-primary-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e("app.search_messages"),"aria-label":e("app.search_messages"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})]}),Do&&n.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex-shrink-0",children:[n.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),n.jsx("input",{type:"text",placeholder:e("app.search_placeholder"),value:Ri,onChange:D=>{li(D.target.value),Ii(0)},autoFocus:!0,className:"flex-1 bg-transparent text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 outline-none"}),Ri&&n.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0 tabular-nums",children:Na>0?e("app.match_count",{current:Ai+1,total:Na}):e("app.no_matches")}),Ri&&Na>0&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>Ii(D=>(D-1+Na)%Na),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.previous_match"),"aria-label":e("app.previous_match"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),n.jsx("button",{onClick:()=>Ii(D=>(D+1)%Na),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.next_match"),"aria-label":e("app.next_match"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),n.jsx("button",{onClick:()=>{Xi(!1),li(""),Ii(0),hs(0)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:e("app.close_search"),"aria-label":e("app.close_search"),children:n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!sn&&n.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),n.jsx("span",{children:e("app.reconnecting")})]}),dr&&n.jsxs("div",{className:"px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm border-b border-red-200 dark:border-red-800 flex items-center justify-between",children:[n.jsx("span",{children:dr}),n.jsx("button",{onClick:()=>He(null),className:"ml-2 text-red-400 hover:text-red-600","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Li&&n.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${Li.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":Li.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800"}`,children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{children:Li.text})]}),st&&n.jsx("div",{className:"px-4 py-3 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 text-sm border-b border-blue-200 dark:border-blue-800",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold",children:e("auth.device_code_title")}),n.jsxs("div",{className:"mt-1",children:[n.jsx("a",{href:st.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:st.verification_uri})," ","— ",n.jsx("span",{className:"font-mono font-bold text-base select-all",children:st.user_code})]}),n.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),n.jsx("button",{onClick:()=>Nt(null),className:"ml-2 text-blue-400 hover:text-blue-600 flex-shrink-0","aria-label":"Dismiss",title:"Dismiss",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),vr&&n.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Server busy (429) — retry ",vr.attempt,"/",vr.maxRetries,vr.maxDurationMs>0&&vr.elapsedMs>0&&n.jsxs(n.Fragment,{children:[" (",Math.round(vr.elapsedMs/1e3),"s / ",Math.round(vr.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(vr.delayMs/1e3),"s. Click Stop to cancel."]}),n.jsx("button",{onClick:()=>{ji(null),bn.current&&(clearTimeout(bn.current),bn.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Ht&&n.jsxs("div",{className:"px-4 py-2 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm border-b border-amber-200 dark:border-amber-800 flex items-center justify-between",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M5 19h14a2 2 0 001.84-2.75L13.74 4a2 2 0 00-3.48 0L3.16 16.25A2 2 0 005 19z"})}),"Model fallback: ",Ht.fallbackModel," (local model unavailable)"]}),n.jsx("button",{onClick:()=>{er(null),ur.current&&(clearTimeout(ur.current),ur.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsx(nB,{ref:ir,messages:te,unloadedCompactedCount:ze,onExpandCompactedHistory:oe?()=>Au(oe):void 0,hasOlderMessages:Bt,loadingOlderMessages:kt,onLoadOlderMessages:oe?()=>ag(oe):void 0,streamingParts:si[oe]||{},streamingProgress:On,isBusy:ln,compactingInfo:Ei,compactionResult:ii,onSwitchToCompactedSession:D=>{It.current=D,bt(D),nn(null)},onDismissCompactionResult:()=>nn(null),parentSessionID:Pe&&Pe.parentSessionID,compactionPinned:Pe&&Pe.compactionPinned,onUnpinCompaction:sg,onViewParentSession:D=>{It.current=D,bt(D),Te(function(re){return re.map(function(ne){return ne.id===D?{...ne,_readOnly:!0}:ne})})},user:P,searchQuery:Ri,activeMatchIndex:Ai,onTotalMatchesChange:hs,onRetry:ja?void 0:ac,onEditAndResend:ja?void 0:lg,onCancelQueued:ja?void 0:Tu,hackerMode:a,mobileFrameless:u,hideThinking:Ns,sessionID:oe,banners:($l?Zn[oe]:null)||[],bannerHidden:_,onToggleBanner:w,privateMessageIds:B,questionIdMap:we}),(ai[oe]||[]).length>0&&n.jsx(PV,{items:ai[oe]||[],sessionId:oe,isReadOnly:ja,onReorder:function(D){WI(oe,D).catch(function(re){He("Failed to reorder: "+re.message)})},onCancelItem:function(D){v_(oe,D).catch(function(re){He("Failed to cancel: "+re.message)})},onEditItem:function(D){if(!(D.status==="dispatching"||ja)){v_(oe,D.id).catch(function(){});var re=D.displayContent||D.text||"";re&&O.current&&typeof O.current.setText=="function"&&O.current.setText(re)}},t:e}),ja?n.jsx("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 flex items-center justify-center gap-2",children:ts?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})}),ic?n.jsx("button",{onClick:()=>{It.current=ic,bt(ic)},className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline transition-colors",children:e("chat.compacted_switch_to_new")||"Compacted — switch to new session"}):n.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e("chat.compacted_switch_to_new")||"Compacted — switch to new session"})]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Pe&&Pe.source==="archive"?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),n.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:Pe&&Pe.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal")})]})}):n.jsx(RB,{ref:O,sessionId:oe,onSend:qa,onBuiltinCommand:Pi,onAbort:Fu,isBusy:ln,queuedCount:Gl+(ai[oe]||[]).length})]}):n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[n.jsx("img",{src:t?"/pave-logo-dark.png":"/pave-logo-light.png",alt:"PAVE",className:"h-16 mb-4"}),n.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),n.jsx("button",{onClick:Zl,className:"py-2 px-6 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:e("app.new_chat")})]})}),oe&&n.jsxs("aside",{style:{width:h},className:`border-l hidden ${y?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 ${a?t?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":e("app.resize_terminal"),"aria-valuemin":sf,"aria-valuemax":of,"aria-valuenow":h,className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize z-10 ${a?t?"bg-gray-800 hover:bg-gray-700 active:bg-gray-600":"bg-gray-300 hover:bg-gray-400 active:bg-gray-500":"bg-gray-200 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-800 dark:hover:bg-gray-700 dark:active:bg-gray-600"}`,onMouseDown:D=>{D.preventDefault();const re=D.clientX,ne=h,de=Oe=>{const Ie=re-Oe.clientX,St=Math.min(of,Math.max(sf,ne+Ie));m(St)},me=()=>{document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",me)};document.addEventListener("mousemove",de),document.addEventListener("mouseup",me)}}),!ci&&ju()]}),ci&&oe&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>Mi(!1)}),n.jsxs("div",{id:"activities-panel-dialog",className:"fixed top-14 right-0 bottom-0 w-80 max-w-[85vw] bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800 z-40 lg:hidden flex flex-col shadow-xl",role:"dialog","aria-modal":"true","aria-labelledby":"activities-panel-heading",tabIndex:-1,onKeyDown:D=>{(D.key==="Escape"||D.key==="Esc")&&(D.stopPropagation(),Mi(!1))},ref:Po,children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 flex-shrink-0",children:[n.jsx("h2",{id:"activities-panel-heading",className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:e("app.activities_panel")}),n.jsx("button",{onClick:()=>Mi(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors","aria-label":e("app.close_activities"),children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),ju()]})]})]}),Ve&&n.jsx(mV,{onClose:()=>at(!1)}),lt&&n.jsx(kV,{onClose:()=>Ce(!1)}),$e&&n.jsx(dG,{open:gt,onClose:()=>ut(!1),activeSessionId:oe,activeSessionTitle:fi}),n.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:n.jsx(NV,{requests:jt,onDismiss:nc})}),n.jsx(EV,{open:Ci,onClose:()=>Vr(!1),upgradeUrl:wr}),n.jsx(Q3,{open:Jl!==null,onClose:()=>ec(null),senderSessionID:Jl}),n.jsx(LV,{isOpen:Bo,onClose:()=>ms(!1),sessionId:oe,currentDirectory:(Pe==null?void 0:Pe.directory)||"",homeDir:yu,onDirectoryChange:rc}),n.jsx(DV,{isOpen:xs,onClose:()=>zo(!1),sessionId:oe}),n.jsx(RV,{isOpen:j,onClose:()=>{L(!1),setTimeout(()=>{var D;return(D=O.current)==null?void 0:D.focus()},0)},onSelectSession:D=>{ga(D)},onNewChat:()=>{typeof Y.current=="function"&&Y.current()},activeSessionId:oe,sessions:Ke,busySessions:yr}),n.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:k})]})}const _G=SI();vI.createRoot(document.getElementById("root")).render(n.jsx(Mt.StrictMode,{children:n.jsx(NI,{initialLocale:_G,children:n.jsx(TI,{children:n.jsx(kG,{})})})}));export{F4 as _,jo as g,QH as p};
|