@cnrai/pave 0.11.116 → 0.11.118
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 +10 -10
- package/sandbox/SandboxRunner.js +1 -1
- package/sandbox/auth/auth.js +1 -1
- package/sandbox/permission-merge.js +1 -0
- package/sandbox/permission.js +1 -1
- package/sandbox/tools/cross-session.js +1 -1
- package/sandbox/tools/lib/shell-parse.js +1 -1
- package/sandbox/tools/session-tools.js +1 -1
- package/sandbox/utils/secure-fs.js +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-BxRoO2Ay.js → abnfDiagram-VCTEODGH-zRrhFNBn.js} +1 -1
- package/web/assets/{arc-GjbM42uO.js → arc-DH2fkX5T.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-CkKjUy7P.js → architectureDiagram-5GKGNRK7-18o9CKam.js} +1 -1
- package/web/assets/{blockDiagram-I7D4REHJ-CJb2UJ7d.js → blockDiagram-I7D4REHJ-BlZ9Cs7B.js} +5 -5
- package/web/assets/{c4Diagram-7LVT6UL2-B-D1s0Ws.js → c4Diagram-7LVT6UL2-3w6sNM30.js} +1 -1
- package/web/assets/channel-DOSIYATf.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-C3ZPaWi7.js → chunk-2Q5K7J3B-DOwnKWD5.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-0dMfihTE.js → chunk-5VM5RSS4-0Zj8cbb-.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-gttJB7lF.js → chunk-F27PBJKO-ZHDNvYdk.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-tYNvSj4t.js → chunk-IMKFNOWR-Dz5iR6Xc.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-DdivTidd.js → chunk-JWPE2WC7-3njPjsZ7.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-Lz1n1UCy.js → chunk-POPQ4Y6H-Czwjluly.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-D80qopyk.js → chunk-SVP7TREG-rh1kS9v6.js} +1 -1
- package/web/assets/{chunk-TICWLB2K-zIRKla-5.js → chunk-TICWLB2K-gaBxyl9n.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-C2m-K8GY.js → chunk-XXDRQBXY-CC3Wlgli.js} +1 -1
- package/web/assets/classDiagram-ZZMXUADV-3MjcAlEg.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-3MjcAlEg.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-B6Kpm4D3.js → cose-bilkent-JH36ORCC-jrSUBU3M.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-DsdlMk2-.js → cynefin-OW5HDTMX-MFqxALpy.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-CptuCWnV.js → cynefinDiagram-5FMLGOSQ-C0ZVLyFI.js} +1 -1
- package/web/assets/{cytoscape.esm-Ix0LnXOy.js → cytoscape.esm-BLAcgzS2.js} +6 -6
- package/web/assets/{dagre-GXQ25YYZ-IEHviwJk.js → dagre-GXQ25YYZ-sTtHh06I.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-C5sSB1Vb.js → diagram-S7CK7UJ4-2BhVaZ3U.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-B_tk01hb.js → diagram-UQ7AKVKN-BTwiIaPc.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-CJ5Vs50y.js → diagram-VSXAHHWV-BTawCfi3.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-0bnk9Epy.js → diagram-VX7I27RA-D7q4-3AT.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-DfVIK56g.js → diagram-Z3DM3KII-D85vbcL5.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-DI5ZkIJj.js → ebnfDiagram-PWID7BFC-BzCrmRd6.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-qHAo8gZs.js → erDiagram-RLTQ6QDP-DQN_iBI3.js} +1 -1
- package/web/assets/{flowDiagram-HODETNUW-C2mJ2XTb.js → flowDiagram-HODETNUW-2qG8EaAn.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-D_oBrOYP.js → ganttDiagram-EL5Y4UJY-vlHd9G-X.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-CMbXrAC_.js → gitGraphDiagram-WWUBYQGX-BP5cvu9y.js} +1 -1
- package/web/assets/index-BR8XdK24.css +10 -0
- package/web/assets/index-DbiDWni2.js +132 -0
- package/web/assets/{infoDiagram-27XIBGKW-DO4bIlJh.js → infoDiagram-27XIBGKW-COnBSVEW.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-BOHaQdvx.js → ishikawaDiagram-5VMMS53U-DXZfkdld.js} +1 -1
- package/web/assets/{journeyDiagram-3NMN7TZE-DWQW4dhs.js → journeyDiagram-3NMN7TZE-BDfX5OTv.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-DXzQyFgB.js → kanban-definition-UXKFOSKX-D1ABXW9y.js} +1 -1
- package/web/assets/{layout-DLumGGk_.js → layout-Dmezm0MZ.js} +1 -1
- package/web/assets/{linear-w-yPHw0A.js → linear-BGy1XJDe.js} +1 -1
- package/web/assets/{mermaid.core-BTzzDYtC.js → mermaid.core-Cs4mHSDx.js} +63 -63
- package/web/assets/{mindmap-definition-YA3MSWOX-BYQ33Idi.js → mindmap-definition-YA3MSWOX-EuCpImTo.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-BpqpqiPf.js → pegDiagram-XKGWAZYB-5ARCLejc.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-DEgqreGK.js → pieDiagram-E7YTZNPT-jayNmJXa.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-CNlaNbyL.js → quadrantDiagram-AXDQQJYC-Db0lU7d_.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-JPZKPUfl.js → railroadDiagram-O6MQD6OU-KM389scY.js} +1 -1
- package/web/assets/{requirementDiagram-BXWQKSXE-D_Wk1yFN.js → requirementDiagram-BXWQKSXE-WeWVDJB8.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-Da3HYMK6.js → sankeyDiagram-P5KCCOFB-C6lDQqqQ.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-DfmOGuoB.js → sequenceDiagram-WJ2MYXX4-SJLa8ZIw.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-qu_PxzPW.js → sizeCapture-INFHLROL-DxsKTZJ2.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-BA-3X91t.js → stateDiagram-D77RDMKH-DFaQrrVU.js} +1 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-E-_Zm8Sn.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-z8fO8xFK.js → swimlanes-42K2YHIH-BVmmm7t4.js} +1 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-CmRo6glR.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-CbCJs0bq.js → timeline-definition-24CTP7MA-DscrTfsz.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-BAz0a88U.js → vennDiagram-4TSXK5OY-W_q2DYL7.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-DfJS4Ulm.js → wardleyDiagram-VM6X3IG4-Csahtz7S.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-C-OUsNQO.js → xychartDiagram-S5SC5T6Z-D_jJ1aSx.js} +1 -1
- package/web/assets/zh-TW-DQuUD6Mh.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/channel-Fa_Po7RJ.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-CQixoIcn.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-CQixoIcn.js +0 -1
- package/web/assets/index-B89lUkWT.js +0 -129
- package/web/assets/index-BZHQaMW2.css +0 -10
- package/web/assets/stateDiagram-v2-MP3YSRHH-BZg2qVOU.js +0 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-NtJ-Lpip.js +0 -8
- package/web/assets/zh-TW-BHLe9f3m.js +0 -1
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var Vd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sh={exports:{}},Kc={},Nh={exports:{}},vn={};/**
|
|
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 d_;function EI(){if(d_)return vn;d_=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=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"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function m(U){return U===null||typeof U!="object"?null:(U=g&&U[g]||U["@@iterator"],typeof U=="function"?U:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,k={};function _(U,Y,q){this.props=U,this.context=Y,this.refs=k,this.updater=q||x}_.prototype.isReactComponent={},_.prototype.setState=function(U,Y){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,Y,"setState")},_.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function E(){}E.prototype=_.prototype;function S(U,Y,q){this.props=U,this.context=Y,this.refs=k,this.updater=q||x}var N=S.prototype=new E;N.constructor=S,v(N,_.prototype),N.isPureReactComponent=!0;var A=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},C={key:!0,ref:!0,__self:!0,__source:!0};function O(U,Y,q){var te,W={},$=null,fe=null;if(Y!=null)for(te in Y.ref!==void 0&&(fe=Y.ref),Y.key!==void 0&&($=""+Y.key),Y)T.call(Y,te)&&!C.hasOwnProperty(te)&&(W[te]=Y[te]);var ae=arguments.length-2;if(ae===1)W.children=q;else if(1<ae){for(var xe=Array(ae),Ie=0;Ie<ae;Ie++)xe[Ie]=arguments[Ie+2];W.children=xe}if(U&&U.defaultProps)for(te in ae=U.defaultProps,ae)W[te]===void 0&&(W[te]=ae[te]);return{$$typeof:e,type:U,key:$,ref:fe,props:W,_owner:R.current}}function M(U,Y){return{$$typeof:e,type:U.type,key:Y,ref:U.ref,props:U.props,_owner:U._owner}}function I(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function D(U){var Y={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(q){return Y[q]})}var F=/\/+/g;function ee(U,Y){return typeof U=="object"&&U!==null&&U.key!=null?D(""+U.key):Y.toString(36)}function H(U,Y,q,te,W){var $=typeof U;($==="undefined"||$==="boolean")&&(U=null);var fe=!1;if(U===null)fe=!0;else switch($){case"string":case"number":fe=!0;break;case"object":switch(U.$$typeof){case e:case t:fe=!0}}if(fe)return fe=U,W=W(fe),U=te===""?"."+ee(fe,0):te,A(W)?(q="",U!=null&&(q=U.replace(F,"$&/")+"/"),H(W,Y,q,"",function(Ie){return Ie})):W!=null&&(I(W)&&(W=M(W,q+(!W.key||fe&&fe.key===W.key?"":(""+W.key).replace(F,"$&/")+"/")+U)),Y.push(W)),1;if(fe=0,te=te===""?".":te+":",A(U))for(var ae=0;ae<U.length;ae++){$=U[ae];var xe=te+ee($,ae);fe+=H($,Y,q,xe,W)}else if(xe=m(U),typeof xe=="function")for(U=xe.call(U),ae=0;!($=U.next()).done;)$=$.value,xe=te+ee($,ae++),fe+=H($,Y,q,xe,W);else if($==="object")throw Y=String(U),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return fe}function P(U,Y,q){if(U==null)return U;var te=[],W=0;return H(U,te,"","",function($){return Y.call(q,$,W++)}),te}function K(U){if(U._status===-1){var Y=U._result;Y=Y(),Y.then(function(q){(U._status===0||U._status===-1)&&(U._status=1,U._result=q)},function(q){(U._status===0||U._status===-1)&&(U._status=2,U._result=q)}),U._status===-1&&(U._status=0,U._result=Y)}if(U._status===1)return U._result.default;throw U._result}var V={current:null},Z={transition:null},le={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:Z,ReactCurrentOwner:R};function B(){throw Error("act(...) is not supported in production builds of React.")}return vn.Children={map:P,forEach:function(U,Y,q){P(U,function(){Y.apply(this,arguments)},q)},count:function(U){var Y=0;return P(U,function(){Y++}),Y},toArray:function(U){return P(U,function(Y){return Y})||[]},only:function(U){if(!I(U))throw Error("React.Children.only expected to receive a single React element child.");return U}},vn.Component=_,vn.Fragment=n,vn.Profiler=a,vn.PureComponent=S,vn.StrictMode=r,vn.Suspense=d,vn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=le,vn.act=B,vn.cloneElement=function(U,Y,q){if(U==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+U+".");var te=v({},U.props),W=U.key,$=U.ref,fe=U._owner;if(Y!=null){if(Y.ref!==void 0&&($=Y.ref,fe=R.current),Y.key!==void 0&&(W=""+Y.key),U.type&&U.type.defaultProps)var ae=U.type.defaultProps;for(xe in Y)T.call(Y,xe)&&!C.hasOwnProperty(xe)&&(te[xe]=Y[xe]===void 0&&ae!==void 0?ae[xe]:Y[xe])}var xe=arguments.length-2;if(xe===1)te.children=q;else if(1<xe){ae=Array(xe);for(var Ie=0;Ie<xe;Ie++)ae[Ie]=arguments[Ie+2];te.children=ae}return{$$typeof:e,type:U.type,key:W,ref:$,props:te,_owner:fe}},vn.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},vn.createElement=O,vn.createFactory=function(U){var Y=O.bind(null,U);return Y.type=U,Y},vn.createRef=function(){return{current:null}},vn.forwardRef=function(U){return{$$typeof:u,render:U}},vn.isValidElement=I,vn.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:K}},vn.memo=function(U,Y){return{$$typeof:f,type:U,compare:Y===void 0?null:Y}},vn.startTransition=function(U){var Y=Z.transition;Z.transition={};try{U()}finally{Z.transition=Y}},vn.unstable_act=B,vn.useCallback=function(U,Y){return V.current.useCallback(U,Y)},vn.useContext=function(U){return V.current.useContext(U)},vn.useDebugValue=function(){},vn.useDeferredValue=function(U){return V.current.useDeferredValue(U)},vn.useEffect=function(U,Y){return V.current.useEffect(U,Y)},vn.useId=function(){return V.current.useId()},vn.useImperativeHandle=function(U,Y,q){return V.current.useImperativeHandle(U,Y,q)},vn.useInsertionEffect=function(U,Y){return V.current.useInsertionEffect(U,Y)},vn.useLayoutEffect=function(U,Y){return V.current.useLayoutEffect(U,Y)},vn.useMemo=function(U,Y){return V.current.useMemo(U,Y)},vn.useReducer=function(U,Y,q){return V.current.useReducer(U,Y,q)},vn.useRef=function(U){return V.current.useRef(U)},vn.useState=function(U){return V.current.useState(U)},vn.useSyncExternalStore=function(U,Y,q){return V.current.useSyncExternalStore(U,Y,q)},vn.useTransition=function(){return V.current.useTransition()},vn.version="18.3.1",vn}var f_;function Mv(){return f_||(f_=1,Nh.exports=EI()),Nh.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 p_;function SI(){if(p_)return Kc;p_=1;var e=Mv(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=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 p,g={},m=null,x=null;f!==void 0&&(m=""+f),d.key!==void 0&&(m=""+d.key),d.ref!==void 0&&(x=d.ref);for(p in d)r.call(d,p)&&!o.hasOwnProperty(p)&&(g[p]=d[p]);if(u&&u.defaultProps)for(p in d=u.defaultProps,d)g[p]===void 0&&(g[p]=d[p]);return{$$typeof:t,type:u,key:m,ref:x,props:g,_owner:a.current}}return Kc.Fragment=n,Kc.jsx=l,Kc.jsxs=l,Kc}var h_;function NI(){return h_||(h_=1,Sh.exports=SI()),Sh.exports}var i=NI(),y=Mv();const Lt=$o(y);var Gd={},Ch={exports:{}},Ci={},jh={exports:{}},Th={};/**
|
|
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 g_;function CI(){return g_||(g_=1,(function(e){function t(Z,le){var B=Z.length;Z.push(le);e:for(;0<B;){var U=B-1>>>1,Y=Z[U];if(0<a(Y,le))Z[U]=le,Z[B]=Y,B=U;else break e}}function n(Z){return Z.length===0?null:Z[0]}function r(Z){if(Z.length===0)return null;var le=Z[0],B=Z.pop();if(B!==le){Z[0]=B;e:for(var U=0,Y=Z.length,q=Y>>>1;U<q;){var te=2*(U+1)-1,W=Z[te],$=te+1,fe=Z[$];if(0>a(W,B))$<Y&&0>a(fe,W)?(Z[U]=fe,Z[$]=B,U=$):(Z[U]=W,Z[te]=B,U=te);else if($<Y&&0>a(fe,B))Z[U]=fe,Z[$]=B,U=$;else break e}}return le}function a(Z,le){var B=Z.sortIndex-le.sortIndex;return B!==0?B:Z.id-le.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=[],p=1,g=null,m=3,x=!1,v=!1,k=!1,_=typeof setTimeout=="function"?setTimeout:null,E=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 N(Z){for(var le=n(f);le!==null;){if(le.callback===null)r(f);else if(le.startTime<=Z)r(f),le.sortIndex=le.expirationTime,t(d,le);else break;le=n(f)}}function A(Z){if(k=!1,N(Z),!v)if(n(d)!==null)v=!0,K(T);else{var le=n(f);le!==null&&V(A,le.startTime-Z)}}function T(Z,le){v=!1,k&&(k=!1,E(O),O=-1),x=!0;var B=m;try{for(N(le),g=n(d);g!==null&&(!(g.expirationTime>le)||Z&&!D());){var U=g.callback;if(typeof U=="function"){g.callback=null,m=g.priorityLevel;var Y=U(g.expirationTime<=le);le=e.unstable_now(),typeof Y=="function"?g.callback=Y:g===n(d)&&r(d),N(le)}else r(d);g=n(d)}if(g!==null)var q=!0;else{var te=n(f);te!==null&&V(A,te.startTime-le),q=!1}return q}finally{g=null,m=B,x=!1}}var R=!1,C=null,O=-1,M=5,I=-1;function D(){return!(e.unstable_now()-I<M)}function F(){if(C!==null){var Z=e.unstable_now();I=Z;var le=!0;try{le=C(!0,Z)}finally{le?ee():(R=!1,C=null)}}else R=!1}var ee;if(typeof S=="function")ee=function(){S(F)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,P=H.port2;H.port1.onmessage=F,ee=function(){P.postMessage(null)}}else ee=function(){_(F,0)};function K(Z){C=Z,R||(R=!0,ee())}function V(Z,le){O=_(function(){Z(e.unstable_now())},le)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Z){Z.callback=null},e.unstable_continueExecution=function(){v||x||(v=!0,K(T))},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(Z){switch(m){case 1:case 2:case 3:var le=3;break;default:le=m}var B=m;m=le;try{return Z()}finally{m=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,le){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var B=m;m=Z;try{return le()}finally{m=B}},e.unstable_scheduleCallback=function(Z,le,B){var U=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?U+B:U):B=U,Z){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=B+Y,Z={id:p++,callback:le,priorityLevel:Z,startTime:B,expirationTime:Y,sortIndex:-1},B>U?(Z.sortIndex=B,t(f,Z),n(d)===null&&Z===n(f)&&(k?(E(O),O=-1):k=!0,V(A,B-U))):(Z.sortIndex=Y,t(d,Z),v||x||(v=!0,K(T))),Z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(Z){var le=m;return function(){var B=m;m=le;try{return Z.apply(this,arguments)}finally{m=B}}}})(Th)),Th}var m_;function jI(){return m_||(m_=1,jh.exports=CI()),jh.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 x_;function TI(){if(x_)return Ci;x_=1;var e=Mv(),t=jI();function n(s){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+s,h=1;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h]);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 r=new Set,a={};function o(s,c){l(s,c),l(s+"Capture",c)}function l(s,c){for(a[s]=c,s=0;s<c.length;s++)r.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]*$/,p={},g={};function m(s){return d.call(g,s)?!0:d.call(p,s)?!1:f.test(s)?g[s]=!0:(p[s]=!0,!1)}function x(s,c,h,b){if(h!==null&&h.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return b?!1:h!==null?!h.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function v(s,c,h,b){if(c===null||typeof c>"u"||x(s,c,h,b))return!0;if(b)return!1;if(h!==null)switch(h.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,h,b,w,j,z){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=b,this.attributeNamespace=w,this.mustUseProperty=h,this.propertyName=s,this.type=c,this.sanitizeURL=j,this.removeEmptyString=z}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 E=/[\-:]([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(E,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(E,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(E,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 N(s,c,h,b){var w=_.hasOwnProperty(c)?_[c]:null;(w!==null?w.type!==0:b||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,h,w,b)&&(h=null),b||w===null?m(c)&&(h===null?s.removeAttribute(c):s.setAttribute(c,""+h)):w.mustUseProperty?s[w.propertyName]=h===null?w.type===3?!1:"":h:(c=w.attributeName,b=w.attributeNamespace,h===null?s.removeAttribute(c):(w=w.type,h=w===3||w===4&&h===!0?"":""+h,b?s.setAttributeNS(b,c,h):s.setAttribute(c,h))))}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),D=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),Z=Symbol.iterator;function le(s){return s===null||typeof s!="object"?null:(s=Z&&s[Z]||s["@@iterator"],typeof s=="function"?s:null)}var B=Object.assign,U;function Y(s){if(U===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);U=c&&c[1]||""}return`
|
|
34
|
-
`+U+s}var q=!1;function te(s,c){if(!s||q)return"";q=!0;var h=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(Ne){var b=Ne}Reflect.construct(s,[],c)}else{try{c.call()}catch(Ne){b=Ne}s.call(c.prototype)}else{try{throw Error()}catch(Ne){b=Ne}s()}}catch(Ne){if(Ne&&b&&typeof Ne.stack=="string"){for(var w=Ne.stack.split(`
|
|
35
|
-
`),j=b.stack.split(`
|
|
36
|
-
`),z=w.length-1,re=j.length-1;1<=z&&0<=re&&w[z]!==j[re];)re--;for(;1<=z&&0<=re;z--,re--)if(w[z]!==j[re]){if(z!==1||re!==1)do if(z--,re--,0>re||w[z]!==j[re]){var ue=`
|
|
37
|
-
`+w[z].replace(" at new "," at ");return s.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",s.displayName)),ue}while(1<=z&&0<=re);break}}}finally{q=!1,Error.prepareStackTrace=h}return(s=s?s.displayName||s.name:"")?Y(s):""}function W(s){switch(s.tag){case 5:return Y(s.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return s=te(s.type,!1),s;case 11:return s=te(s.type.render,!1),s;case 1:return s=te(s.type,!0),s;default:return""}}function $(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 C:return"Fragment";case R:return"Portal";case M:return"Profiler";case O:return"StrictMode";case ee:return"Suspense";case H:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case D:return(s.displayName||"Context")+".Consumer";case I:return(s._context.displayName||"Context")+".Provider";case F:var c=s.render;return s=s.displayName,s||(s=c.displayName||c.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case P:return c=s.displayName||null,c!==null?c:$(s.type)||"Memo";case K:c=s._payload,s=s._init;try{return $(s(c))}catch{}}return null}function fe(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 $(c);case 8:return c===O?"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 ae(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function xe(s){var c=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Ie(s){var c=xe(s)?"checked":"value",h=Object.getOwnPropertyDescriptor(s.constructor.prototype,c),b=""+s[c];if(!s.hasOwnProperty(c)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,j=h.set;return Object.defineProperty(s,c,{configurable:!0,get:function(){return w.call(this)},set:function(z){b=""+z,j.call(this,z)}}),Object.defineProperty(s,c,{enumerable:h.enumerable}),{getValue:function(){return b},setValue:function(z){b=""+z},stopTracking:function(){s._valueTracker=null,delete s[c]}}}}function ze(s){s._valueTracker||(s._valueTracker=Ie(s))}function mt(s){if(!s)return!1;var c=s._valueTracker;if(!c)return!0;var h=c.getValue(),b="";return s&&(b=xe(s)?s.checked?"true":"false":s.value),s=b,s!==h?(c.setValue(s),!0):!1}function ut(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 $e(s,c){var h=c.checked;return B({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??s._wrapperState.initialChecked})}function qe(s,c){var h=c.defaultValue==null?"":c.defaultValue,b=c.checked!=null?c.checked:c.defaultChecked;h=ae(c.value!=null?c.value:h),s._wrapperState={initialChecked:b,initialValue:h,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function Oe(s,c){c=c.checked,c!=null&&N(s,"checked",c,!1)}function rt(s,c){Oe(s,c);var h=ae(c.value),b=c.type;if(h!=null)b==="number"?(h===0&&s.value===""||s.value!=h)&&(s.value=""+h):s.value!==""+h&&(s.value=""+h);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}c.hasOwnProperty("value")?At(s,c.type,h):c.hasOwnProperty("defaultValue")&&At(s,c.type,ae(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(s.defaultChecked=!!c.defaultChecked)}function ot(s,c,h){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,h||c===s.value||(s.value=c),s.defaultValue=c}h=s.name,h!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,h!==""&&(s.name=h)}function At(s,c,h){(c!=="number"||ut(s.ownerDocument)!==s)&&(h==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+h&&(s.defaultValue=""+h))}var sn=Array.isArray;function Xt(s,c,h,b){if(s=s.options,c){c={};for(var w=0;w<h.length;w++)c["$"+h[w]]=!0;for(h=0;h<s.length;h++)w=c.hasOwnProperty("$"+s[h].value),s[h].selected!==w&&(s[h].selected=w),w&&b&&(s[h].defaultSelected=!0)}else{for(h=""+ae(h),c=null,w=0;w<s.length;w++){if(s[w].value===h){s[w].selected=!0,b&&(s[w].defaultSelected=!0);return}c!==null||s[w].disabled||(c=s[w])}c!==null&&(c.selected=!0)}}function Ht(s,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return B({},c,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function We(s,c){var h=c.value;if(h==null){if(h=c.children,c=c.defaultValue,h!=null){if(c!=null)throw Error(n(92));if(sn(h)){if(1<h.length)throw Error(n(93));h=h[0]}c=h}c==null&&(c=""),h=c}s._wrapperState={initialValue:ae(h)}}function De(s,c){var h=ae(c.value),b=ae(c.defaultValue);h!=null&&(h=""+h,h!==s.value&&(s.value=h),c.defaultValue==null&&s.defaultValue!==h&&(s.defaultValue=h)),b!=null&&(s.defaultValue=""+b)}function et(s){var c=s.textContent;c===s._wrapperState.initialValue&&c!==""&&c!==null&&(s.value=c)}function nt(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 de(s,c){return s==null||s==="http://www.w3.org/1999/xhtml"?nt(c):s==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var _e,Ue=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,h,b,w){MSApp.execUnsafeLocalFunction(function(){return s(c,h,b,w)})}:s})(function(s,c){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=c;else{for(_e=_e||document.createElement("div"),_e.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=_e.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}});function ge(s,c){if(c){var h=s.firstChild;if(h&&h===s.lastChild&&h.nodeType===3){h.nodeValue=c;return}}s.textContent=c}var ft={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},ht=["Webkit","ms","Moz","O"];Object.keys(ft).forEach(function(s){ht.forEach(function(c){c=c+s.charAt(0).toUpperCase()+s.substring(1),ft[c]=ft[s]})});function vt(s,c,h){return c==null||typeof c=="boolean"||c===""?"":h||typeof c!="number"||c===0||ft.hasOwnProperty(s)&&ft[s]?(""+c).trim():c+"px"}function pt(s,c){s=s.style;for(var h in c)if(c.hasOwnProperty(h)){var b=h.indexOf("--")===0,w=vt(h,c[h],b);h==="float"&&(h="cssFloat"),b?s.setProperty(h,w):s[h]=w}}var Vt=B({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 Gt(s,c){if(c){if(Vt[s]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(n(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(n(61))}if(c.style!=null&&typeof c.style!="object")throw Error(n(62))}}function Ze(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 qt=null;function kt(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var $t=null,tn=null,on=null;function Dn(s){if(s=yo(s)){if(typeof $t!="function")throw Error(n(280));var c=s.stateNode;c&&(c=xl(c),$t(s.stateNode,s.type,c))}}function ie(s){tn?on?on.push(s):on=[s]:tn=s}function Le(){if(tn){var s=tn,c=on;if(on=tn=null,Dn(s),c)for(s=0;s<c.length;s++)Dn(c[s])}}function Je(s,c){return s(c)}function Ft(){}var Fe=!1;function it(s,c,h){if(Fe)return s(c,h);Fe=!0;try{return Je(s,c,h)}finally{Fe=!1,(tn!==null||on!==null)&&(Ft(),Le())}}function ve(s,c){var h=s.stateNode;if(h===null)return null;var b=xl(h);if(b===null)return null;h=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(h&&typeof h!="function")throw Error(n(231,c,typeof h));return h}var Me=!1;if(u)try{var Ye={};Object.defineProperty(Ye,"passive",{get:function(){Me=!0}}),window.addEventListener("test",Ye,Ye),window.removeEventListener("test",Ye,Ye)}catch{Me=!1}function yt(s,c,h,b,w,j,z,re,ue){var Ne=Array.prototype.slice.call(arguments,3);try{c.apply(h,Ne)}catch(Qe){this.onError(Qe)}}var se=!1,Pe=null,He=!1,wt=null,Re={onError:function(s){se=!0,Pe=s}};function Ke(s,c,h,b,w,j,z,re,ue){se=!1,Pe=null,yt.apply(Re,arguments)}function bt(s,c,h,b,w,j,z,re,ue){if(Ke.apply(this,arguments),se){if(se){var Ne=Pe;se=!1,Pe=null}else throw Error(n(198));He||(He=!0,wt=Ne)}}function bn(s){var c=s,h=s;if(s.alternate)for(;c.return;)c=c.return;else{s=c;do c=s,(c.flags&4098)!==0&&(h=c.return),s=c.return;while(s)}return c.tag===3?h:null}function dr(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 Ot(s){if(bn(s)!==s)throw Error(n(188))}function hn(s){var c=s.alternate;if(!c){if(c=bn(s),c===null)throw Error(n(188));return c!==s?null:s}for(var h=s,b=c;;){var w=h.return;if(w===null)break;var j=w.alternate;if(j===null){if(b=w.return,b!==null){h=b;continue}break}if(w.child===j.child){for(j=w.child;j;){if(j===h)return Ot(w),s;if(j===b)return Ot(w),c;j=j.sibling}throw Error(n(188))}if(h.return!==b.return)h=w,b=j;else{for(var z=!1,re=w.child;re;){if(re===h){z=!0,h=w,b=j;break}if(re===b){z=!0,b=w,h=j;break}re=re.sibling}if(!z){for(re=j.child;re;){if(re===h){z=!0,h=j,b=w;break}if(re===b){z=!0,b=j,h=w;break}re=re.sibling}if(!z)throw Error(n(189))}}if(h.alternate!==b)throw Error(n(190))}if(h.tag!==3)throw Error(n(188));return h.stateNode.current===h?s:c}function Br(s){return s=hn(s),s!==null?ye(s):null}function ye(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var c=ye(s);if(c!==null)return c;s=s.sibling}return null}var tr=t.unstable_scheduleCallback,jr=t.unstable_cancelCallback,vi=t.unstable_shouldYield,ja=t.unstable_requestPaint,Hn=t.unstable_now,Zs=t.unstable_getCurrentPriorityLevel,fi=t.unstable_ImmediatePriority,Tr=t.unstable_UserBlockingPriority,oa=t.unstable_NormalPriority,je=t.unstable_LowPriority,gt=t.unstable_IdlePriority,Mt=null,cn=null;function Fn(s){if(cn&&typeof cn.onCommitFiberRoot=="function")try{cn.onCommitFiberRoot(Mt,s,void 0,(s.current.flags&128)===128)}catch{}}var zn=Math.clz32?Math.clz32:Kn,Rr=Math.log,Vi=Math.LN2;function Kn(s){return s>>>=0,s===0?32:31-(Rr(s)/Vi|0)|0}var lr=64,Vr=4194304;function fr(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 yr(s,c){var h=s.pendingLanes;if(h===0)return 0;var b=0,w=s.suspendedLanes,j=s.pingedLanes,z=h&268435455;if(z!==0){var re=z&~w;re!==0?b=fr(re):(j&=z,j!==0&&(b=fr(j)))}else z=h&~w,z!==0?b=fr(z):j!==0&&(b=fr(j));if(b===0)return 0;if(c!==0&&c!==b&&(c&w)===0&&(w=b&-b,j=c&-c,w>=j||w===16&&(j&4194240)!==0))return c;if((b&4)!==0&&(b|=h&16),c=s.entangledLanes,c!==0)for(s=s.entanglements,c&=b;0<c;)h=31-zn(c),w=1<<h,b|=s[h],c&=~w;return b}function br(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 Gi(s,c){for(var h=s.suspendedLanes,b=s.pingedLanes,w=s.expirationTimes,j=s.pendingLanes;0<j;){var z=31-zn(j),re=1<<z,ue=w[z];ue===-1?((re&h)===0||(re&b)!==0)&&(w[z]=br(re,c)):ue<=c&&(s.expiredLanes|=re),j&=~re}}function Ii(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function la(){var s=lr;return lr<<=1,(lr&4194240)===0&&(lr=64),s}function pi(s){for(var c=[],h=0;31>h;h++)c.push(s);return c}function vr(s,c,h){s.pendingLanes|=c,c!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,c=31-zn(c),s[c]=h}function zr(s,c){var h=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<h;){var w=31-zn(h),j=1<<w;c[w]=0,b[w]=-1,s[w]=-1,h&=~j}}function ei(s,c){var h=s.entangledLanes|=c;for(s=s.entanglements;h;){var b=31-zn(h),w=1<<b;w&c|s[b]&c&&(s[b]|=c),h&=~w}}var un=0;function Wt(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Ar,Qn,xn,Gr,Kr,Ve=!1,G=[],ne=null,me=null,Ae=null,at=new Map,St=new Map,Dt=[],Nn="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 Ir(s,c){switch(s){case"focusin":case"focusout":ne=null;break;case"dragenter":case"dragleave":me=null;break;case"mouseover":case"mouseout":Ae=null;break;case"pointerover":case"pointerout":at.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":St.delete(c.pointerId)}}function ir(s,c,h,b,w,j){return s===null||s.nativeEvent!==j?(s={blockedOn:c,domEventName:h,eventSystemFlags:b,nativeEvent:j,targetContainers:[w]},c!==null&&(c=yo(c),c!==null&&Qn(c)),s):(s.eventSystemFlags|=b,c=s.targetContainers,w!==null&&c.indexOf(w)===-1&&c.push(w),s)}function Ta(s,c,h,b,w){switch(c){case"focusin":return ne=ir(ne,s,c,h,b,w),!0;case"dragenter":return me=ir(me,s,c,h,b,w),!0;case"mouseover":return Ae=ir(Ae,s,c,h,b,w),!0;case"pointerover":var j=w.pointerId;return at.set(j,ir(at.get(j)||null,s,c,h,b,w)),!0;case"gotpointercapture":return j=w.pointerId,St.set(j,ir(St.get(j)||null,s,c,h,b,w)),!0}return!1}function ca(s){var c=Xr(s.target);if(c!==null){var h=bn(c);if(h!==null){if(c=h.tag,c===13){if(c=dr(h),c!==null){s.blockedOn=c,Kr(s.priority,function(){xn(h)});return}}else if(c===3&&h.stateNode.current.memoizedState.isDehydrated){s.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}s.blockedOn=null}function cr(s){if(s.blockedOn!==null)return!1;for(var c=s.targetContainers;0<c.length;){var h=ec(s.domEventName,s.eventSystemFlags,c[0],s.nativeEvent);if(h===null){h=s.nativeEvent;var b=new h.constructor(h.type,h);qt=b,h.target.dispatchEvent(b),qt=null}else return c=yo(h),c!==null&&Qn(c),s.blockedOn=h,!1;c.shift()}return!0}function hs(s,c,h){cr(s)&&h.delete(c)}function Js(){Ve=!1,ne!==null&&cr(ne)&&(ne=null),me!==null&&cr(me)&&(me=null),Ae!==null&&cr(Ae)&&(Ae=null),at.forEach(hs),St.forEach(hs)}function Qa(s,c){s.blockedOn===c&&(s.blockedOn=null,Ve||(Ve=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Js)))}function eo(s){function c(w){return Qa(w,s)}if(0<G.length){Qa(G[0],s);for(var h=1;h<G.length;h++){var b=G[h];b.blockedOn===s&&(b.blockedOn=null)}}for(ne!==null&&Qa(ne,s),me!==null&&Qa(me,s),Ae!==null&&Qa(Ae,s),at.forEach(c),St.forEach(c),h=0;h<Dt.length;h++)b=Dt[h],b.blockedOn===s&&(b.blockedOn=null);for(;0<Dt.length&&(h=Dt[0],h.blockedOn===null);)ca(h),h.blockedOn===null&&Dt.shift()}var Mi=A.ReactCurrentBatchConfig,to=!0;function Ct(s,c,h,b){var w=un,j=Mi.transition;Mi.transition=null;try{un=1,Jo(s,c,h,b)}finally{un=w,Mi.transition=j}}function bp(s,c,h,b){var w=un,j=Mi.transition;Mi.transition=null;try{un=4,Jo(s,c,h,b)}finally{un=w,Mi.transition=j}}function Jo(s,c,h,b){if(to){var w=ec(s,c,h,b);if(w===null)Ss(s,c,b,el,h),Ir(s,b);else if(Ta(w,s,c,h,b))b.stopPropagation();else if(Ir(s,b),c&4&&-1<Nn.indexOf(s)){for(;w!==null;){var j=yo(w);if(j!==null&&Ar(j),j=ec(s,c,h,b),j===null&&Ss(s,c,b,el,h),j===w)break;w=j}w!==null&&b.stopPropagation()}else Ss(s,c,b,null,h)}}var el=null;function ec(s,c,h,b){if(el=null,s=kt(b),s=Xr(s),s!==null)if(c=bn(s),c===null)s=null;else if(h=c.tag,h===13){if(s=dr(c),s!==null)return s;s=null}else if(h===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;s=null}else c!==s&&(s=null);return el=s,null}function tc(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(Zs()){case fi:return 1;case Tr:return 4;case oa:case je:return 16;case gt:return 536870912;default:return 16}default:return 16}}var Ra=null,no=null,tl=null;function nl(){if(tl)return tl;var s,c=no,h=c.length,b,w="value"in Ra?Ra.value:Ra.textContent,j=w.length;for(s=0;s<h&&c[s]===w[s];s++);var z=h-s;for(b=1;b<=z&&c[h-b]===w[j-b];b++);return tl=w.slice(s,1<b?1-b:void 0)}function Aa(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 rl(){return!0}function il(){return!1}function ti(s){function c(h,b,w,j,z){this._reactName=h,this._targetInst=w,this.type=b,this.nativeEvent=j,this.target=z,this.currentTarget=null;for(var re in s)s.hasOwnProperty(re)&&(h=s[re],this[re]=h?h(j):j[re]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?rl:il,this.isPropagationStopped=il,this}return B(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=rl)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=rl)},persist:function(){},isPersistent:rl}),c}var gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ro=ti(gs),io=B({},gs,{view:0,detail:0}),vp=ti(io),Xa,nc,Ia,ms=B({},io,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ac,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!==Ia&&(Ia&&s.type==="mousemove"?(Xa=s.screenX-Ia.screenX,nc=s.screenY-Ia.screenY):nc=Xa=0,Ia=s),Xa)},movementY:function(s){return"movementY"in s?s.movementY:nc}}),al=ti(ms),sl=B({},ms,{dataTransfer:0}),ol=ti(sl),ao=B({},io,{relatedTarget:0}),Ki=ti(ao),Li=B({},gs,{animationName:0,elapsedTime:0,pseudoElement:0}),ll=ti(Li),xs=B({},gs,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),ys=ti(xs),rc=B({},gs,{data:0}),ic=ti(rc),Oi={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vu={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"},ua={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kp(s){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(s):(s=ua[s])?!!c[s]:!1}function ac(){return kp}var sc=B({},io,{key:function(s){if(s.key){var c=Oi[s.key]||s.key;if(c!=="Unidentified")return c}return s.type==="keypress"?(s=Aa(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Vu[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ac,charCode:function(s){return s.type==="keypress"?Aa(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Aa(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),_p=ti(sc),wp=B({},ms,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gu=ti(wp),Ku=B({},io,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ac}),cl=ti(Ku),Yu=B({},gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ep=ti(Yu),ul=B({},ms,{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}),oc=ti(ul),Qu=[9,13,27,32],so=u&&"CompositionEvent"in window,Za=null;u&&"documentMode"in document&&(Za=document.documentMode);var Xu=u&&"TextEvent"in window&&!Za,dl=u&&(!so||Za&&8<Za&&11>=Za),Zu=" ",Ju=!1;function lc(s,c){switch(s){case"keyup":return Qu.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function oo(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Di=!1;function ed(s,c){switch(s){case"compositionend":return oo(c);case"keypress":return c.which!==32?null:(Ju=!0,Zu);case"textInput":return s=c.data,s===Zu&&Ju?null:s;default:return null}}function Sp(s,c){if(Di)return s==="compositionend"||!so&&lc(s,c)?(s=nl(),tl=no=Ra=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 dl&&c.locale!=="ko"?null:c.data;default:return null}}var td={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 bs(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c==="input"?!!td[s.type]:c==="textarea"}function fl(s,c,h,b){ie(b),c=Qr(c,"onChange"),0<c.length&&(h=new ro("onChange","change",null,h,b),s.push({event:h,listeners:c}))}var da=null,lo=null;function cc(s){Yi(s,0)}function pl(s){var c=js(s);if(mt(c))return s}function uc(s,c){if(s==="change")return c}var nd=!1;if(u){var co;if(u){var dc="oninput"in document;if(!dc){var wn=document.createElement("div");wn.setAttribute("oninput","return;"),dc=typeof wn.oninput=="function"}co=dc}else co=!1;nd=co&&(!document.documentMode||9<document.documentMode)}function rd(){da&&(da.detachEvent("onpropertychange",uo),lo=da=null)}function uo(s){if(s.propertyName==="value"&&pl(lo)){var c=[];fl(c,lo,s,kt(s)),it(cc,c)}}function kr(s,c,h){s==="focusin"?(rd(),da=c,lo=h,da.attachEvent("onpropertychange",uo)):s==="focusout"&&rd()}function Np(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return pl(lo)}function id(s,c){if(s==="click")return pl(c)}function ad(s,c){if(s==="input"||s==="change")return pl(c)}function sd(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var ki=typeof Object.is=="function"?Object.is:sd;function vs(s,c){if(ki(s,c))return!0;if(typeof s!="object"||s===null||typeof c!="object"||c===null)return!1;var h=Object.keys(s),b=Object.keys(c);if(h.length!==b.length)return!1;for(b=0;b<h.length;b++){var w=h[b];if(!d.call(c,w)||!ki(s[w],c[w]))return!1}return!0}function fc(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function pc(s,c){var h=fc(s);s=0;for(var b;h;){if(h.nodeType===3){if(b=s+h.textContent.length,s<=c&&b>=c)return{node:h,offset:c-s};s=b}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=fc(h)}}function hc(s,c){return s&&c?s===c?!0:s&&s.nodeType===3?!1:c&&c.nodeType===3?hc(s,c.parentNode):"contains"in s?s.contains(c):s.compareDocumentPosition?!!(s.compareDocumentPosition(c)&16):!1:!1}function gc(){for(var s=window,c=ut();c instanceof s.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)s=c.contentWindow;else break;c=ut(s.document)}return c}function ks(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 Cp(s){var c=gc(),h=s.focusedElem,b=s.selectionRange;if(c!==h&&h&&h.ownerDocument&&hc(h.ownerDocument.documentElement,h)){if(b!==null&&ks(h)){if(c=b.start,s=b.end,s===void 0&&(s=c),"selectionStart"in h)h.selectionStart=c,h.selectionEnd=Math.min(s,h.value.length);else if(s=(c=h.ownerDocument||document)&&c.defaultView||window,s.getSelection){s=s.getSelection();var w=h.textContent.length,j=Math.min(b.start,w);b=b.end===void 0?j:Math.min(b.end,w),!s.extend&&j>b&&(w=b,b=j,j=w),w=pc(h,j);var z=pc(h,b);w&&z&&(s.rangeCount!==1||s.anchorNode!==w.node||s.anchorOffset!==w.offset||s.focusNode!==z.node||s.focusOffset!==z.offset)&&(c=c.createRange(),c.setStart(w.node,w.offset),s.removeAllRanges(),j>b?(s.addRange(c),s.extend(z.node,z.offset)):(c.setEnd(z.node,z.offset),s.addRange(c)))}}for(c=[],s=h;s=s.parentNode;)s.nodeType===1&&c.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<c.length;h++)s=c[h],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var mc=u&&"documentMode"in document&&11>=document.documentMode,Ja=null,Rt=null,_s=null,Yr=!1;function od(s,c,h){var b=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Yr||Ja==null||Ja!==ut(b)||(b=Ja,"selectionStart"in b&&ks(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}),_s&&vs(_s,b)||(_s=b,b=Qr(Rt,"onSelect"),0<b.length&&(c=new ro("onSelect","select",null,c,h),s.push({event:c,listeners:b}),c.target=Ja)))}function ws(s,c){var h={};return h[s.toLowerCase()]=c.toLowerCase(),h["Webkit"+s]="webkit"+c,h["Moz"+s]="moz"+c,h}var Ma={animationend:ws("Animation","AnimationEnd"),animationiteration:ws("Animation","AnimationIteration"),animationstart:ws("Animation","AnimationStart"),transitionend:ws("Transition","TransitionEnd")},La={},ld={};u&&(ld=document.createElement("div").style,"AnimationEvent"in window||(delete Ma.animationend.animation,delete Ma.animationiteration.animation,delete Ma.animationstart.animation),"TransitionEvent"in window||delete Ma.transitionend.transition);function Pi(s){if(La[s])return La[s];if(!Ma[s])return s;var c=Ma[s],h;for(h in c)if(c.hasOwnProperty(h)&&h in ld)return La[s]=c[h];return s}var hl=Pi("animationend"),_i=Pi("animationiteration"),fo=Pi("animationstart"),po=Pi("transitionend"),ho=new Map,cd="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 fa(s,c){ho.set(s,c),o(c,[s])}for(var Es=0;Es<cd.length;Es++){var Oa=cd[Es],jp=Oa.toLowerCase(),xc=Oa[0].toUpperCase()+Oa.slice(1);fa(jp,"on"+xc)}fa(hl,"onAnimationEnd"),fa(_i,"onAnimationIteration"),fa(fo,"onAnimationStart"),fa("dblclick","onDoubleClick"),fa("focusin","onFocus"),fa("focusout","onBlur"),fa(po,"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 pa="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(" "),Tp=new Set("cancel close invalid load scroll toggle".split(" ").concat(pa));function gl(s,c,h){var b=s.type||"unknown-event";s.currentTarget=h,bt(b,c,void 0,s),s.currentTarget=null}function Yi(s,c){c=(c&4)!==0;for(var h=0;h<s.length;h++){var b=s[h],w=b.event;b=b.listeners;e:{var j=void 0;if(c)for(var z=b.length-1;0<=z;z--){var re=b[z],ue=re.instance,Ne=re.currentTarget;if(re=re.listener,ue!==j&&w.isPropagationStopped())break e;gl(w,re,Ne),j=ue}else for(z=0;z<b.length;z++){if(re=b[z],ue=re.instance,Ne=re.currentTarget,re=re.listener,ue!==j&&w.isPropagationStopped())break e;gl(w,re,Ne),j=ue}}}if(He)throw s=wt,He=!1,wt=null,s}function $n(s,c){var h=c[Cc];h===void 0&&(h=c[Cc]=new Set);var b=s+"__bubble";h.has(b)||(ud(c,s,2,!1),h.add(b))}function yc(s,c,h){var b=0;c&&(b|=4),ud(h,s,b,c)}var ni="_reactListening"+Math.random().toString(36).slice(2);function go(s){if(!s[ni]){s[ni]=!0,r.forEach(function(h){h!=="selectionchange"&&(Tp.has(h)||yc(h,!1,s),yc(h,!0,s))});var c=s.nodeType===9?s:s.ownerDocument;c===null||c[ni]||(c[ni]=!0,yc("selectionchange",!1,c))}}function ud(s,c,h,b){switch(tc(c)){case 1:var w=Ct;break;case 4:w=bp;break;default:w=Jo}h=w.bind(null,c,h,s),w=void 0,!Me||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(w=!0),b?w!==void 0?s.addEventListener(c,h,{capture:!0,passive:w}):s.addEventListener(c,h,!0):w!==void 0?s.addEventListener(c,h,{passive:w}):s.addEventListener(c,h,!1)}function Ss(s,c,h,b,w){var j=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var z=b.tag;if(z===3||z===4){var re=b.stateNode.containerInfo;if(re===w||re.nodeType===8&&re.parentNode===w)break;if(z===4)for(z=b.return;z!==null;){var ue=z.tag;if((ue===3||ue===4)&&(ue=z.stateNode.containerInfo,ue===w||ue.nodeType===8&&ue.parentNode===w))return;z=z.return}for(;re!==null;){if(z=Xr(re),z===null)return;if(ue=z.tag,ue===5||ue===6){b=j=z;continue e}re=re.parentNode}}b=b.return}it(function(){var Ne=j,Qe=kt(h),tt=[];e:{var Ge=ho.get(s);if(Ge!==void 0){var Et=ro,Tt=s;switch(s){case"keypress":if(Aa(h)===0)break e;case"keydown":case"keyup":Et=_p;break;case"focusin":Tt="focus",Et=Ki;break;case"focusout":Tt="blur",Et=Ki;break;case"beforeblur":case"afterblur":Et=Ki;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Et=al;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Et=ol;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Et=cl;break;case hl:case _i:case fo:Et=ll;break;case po:Et=Ep;break;case"scroll":Et=vp;break;case"wheel":Et=oc;break;case"copy":case"cut":case"paste":Et=ys;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Et=Gu}var It=(c&4)!==0,gr=!It&&s==="scroll",we=It?Ge!==null?Ge+"Capture":null:Ge;It=[];for(var he=Ne,Ee;he!==null;){Ee=he;var ct=Ee.stateNode;if(Ee.tag===5&&ct!==null&&(Ee=ct,we!==null&&(ct=ve(he,we),ct!=null&&It.push(es(he,ct,Ee)))),gr)break;he=he.return}0<It.length&&(Ge=new Et(Ge,Tt,null,h,Qe),tt.push({event:Ge,listeners:It}))}}if((c&7)===0){e:{if(Ge=s==="mouseover"||s==="pointerover",Et=s==="mouseout"||s==="pointerout",Ge&&h!==qt&&(Tt=h.relatedTarget||h.fromElement)&&(Xr(Tt)||Tt[ga]))break e;if((Et||Ge)&&(Ge=Qe.window===Qe?Qe:(Ge=Qe.ownerDocument)?Ge.defaultView||Ge.parentWindow:window,Et?(Tt=h.relatedTarget||h.toElement,Et=Ne,Tt=Tt?Xr(Tt):null,Tt!==null&&(gr=bn(Tt),Tt!==gr||Tt.tag!==5&&Tt.tag!==6)&&(Tt=null)):(Et=null,Tt=Ne),Et!==Tt)){if(It=al,ct="onMouseLeave",we="onMouseEnter",he="mouse",(s==="pointerout"||s==="pointerover")&&(It=Gu,ct="onPointerLeave",we="onPointerEnter",he="pointer"),gr=Et==null?Ge:js(Et),Ee=Tt==null?Ge:js(Tt),Ge=new It(ct,he+"leave",Et,h,Qe),Ge.target=gr,Ge.relatedTarget=Ee,ct=null,Xr(Qe)===Ne&&(It=new It(we,he+"enter",Tt,h,Qe),It.target=Ee,It.relatedTarget=gr,ct=It),gr=ct,Et&&Tt)t:{for(It=Et,we=Tt,he=0,Ee=It;Ee;Ee=Ns(Ee))he++;for(Ee=0,ct=we;ct;ct=Ns(ct))Ee++;for(;0<he-Ee;)It=Ns(It),he--;for(;0<Ee-he;)we=Ns(we),Ee--;for(;he--;){if(It===we||we!==null&&It===we.alternate)break t;It=Ns(It),we=Ns(we)}It=null}else It=null;Et!==null&&dd(tt,Ge,Et,It,!1),Tt!==null&&gr!==null&&dd(tt,gr,Tt,It,!0)}}e:{if(Ge=Ne?js(Ne):window,Et=Ge.nodeName&&Ge.nodeName.toLowerCase(),Et==="select"||Et==="input"&&Ge.type==="file")var Pt=uc;else if(bs(Ge))if(nd)Pt=ad;else{Pt=Np;var Yt=kr}else(Et=Ge.nodeName)&&Et.toLowerCase()==="input"&&(Ge.type==="checkbox"||Ge.type==="radio")&&(Pt=id);if(Pt&&(Pt=Pt(s,Ne))){fl(tt,Pt,h,Qe);break e}Yt&&Yt(s,Ge,Ne),s==="focusout"&&(Yt=Ge._wrapperState)&&Yt.controlled&&Ge.type==="number"&&At(Ge,"number",Ge.value)}switch(Yt=Ne?js(Ne):window,s){case"focusin":(bs(Yt)||Yt.contentEditable==="true")&&(Ja=Yt,Rt=Ne,_s=null);break;case"focusout":_s=Rt=Ja=null;break;case"mousedown":Yr=!0;break;case"contextmenu":case"mouseup":case"dragend":Yr=!1,od(tt,h,Qe);break;case"selectionchange":if(mc)break;case"keydown":case"keyup":od(tt,h,Qe)}var Qt;if(so)e:{switch(s){case"compositionstart":var nn="onCompositionStart";break e;case"compositionend":nn="onCompositionEnd";break e;case"compositionupdate":nn="onCompositionUpdate";break e}nn=void 0}else Di?lc(s,h)&&(nn="onCompositionEnd"):s==="keydown"&&h.keyCode===229&&(nn="onCompositionStart");nn&&(dl&&h.locale!=="ko"&&(Di||nn!=="onCompositionStart"?nn==="onCompositionEnd"&&Di&&(Qt=nl()):(Ra=Qe,no="value"in Ra?Ra.value:Ra.textContent,Di=!0)),Yt=Qr(Ne,nn),0<Yt.length&&(nn=new ic(nn,s,null,h,Qe),tt.push({event:nn,listeners:Yt}),Qt?nn.data=Qt:(Qt=oo(h),Qt!==null&&(nn.data=Qt)))),(Qt=Xu?ed(s,h):Sp(s,h))&&(Ne=Qr(Ne,"onBeforeInput"),0<Ne.length&&(Qe=new ic("onBeforeInput","beforeinput",null,h,Qe),tt.push({event:Qe,listeners:Ne}),Qe.data=Qt))}Yi(tt,c)})}function es(s,c,h){return{instance:s,listener:c,currentTarget:h}}function Qr(s,c){for(var h=c+"Capture",b=[];s!==null;){var w=s,j=w.stateNode;w.tag===5&&j!==null&&(w=j,j=ve(s,h),j!=null&&b.unshift(es(s,j,w)),j=ve(s,c),j!=null&&b.push(es(s,j,w))),s=s.return}return b}function Ns(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function dd(s,c,h,b,w){for(var j=c._reactName,z=[];h!==null&&h!==b;){var re=h,ue=re.alternate,Ne=re.stateNode;if(ue!==null&&ue===b)break;re.tag===5&&Ne!==null&&(re=Ne,w?(ue=ve(h,j),ue!=null&&z.unshift(es(h,ue,re))):w||(ue=ve(h,j),ue!=null&&z.push(es(h,ue,re)))),h=h.return}z.length!==0&&s.push({event:c,listeners:z})}var Rp=/\r\n?/g,Ap=/\u0000|\uFFFD/g;function bc(s){return(typeof s=="string"?s:""+s).replace(Rp,`
|
|
38
|
-
`).replace(Ap,"")}function mo(s,c,h){if(c=bc(c),bc(s)!==c&&h)throw Error(n(425))}function ml(){}var vc=null,kc=null;function _c(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 wc=typeof setTimeout=="function"?setTimeout:void 0,Ip=typeof clearTimeout=="function"?clearTimeout:void 0,Ec=typeof Promise=="function"?Promise:void 0,Sc=typeof queueMicrotask=="function"?queueMicrotask:typeof Ec<"u"?function(s){return Ec.resolve(null).then(s).catch(fd)}:wc;function fd(s){setTimeout(function(){throw s})}function Nc(s,c){var h=c,b=0;do{var w=h.nextSibling;if(s.removeChild(h),w&&w.nodeType===8)if(h=w.data,h==="/$"){if(b===0){s.removeChild(w),eo(c);return}b--}else h!=="$"&&h!=="$?"&&h!=="$!"||b++;h=w}while(h);eo(c)}function Da(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 pd(s){s=s.previousSibling;for(var c=0;s;){if(s.nodeType===8){var h=s.data;if(h==="$"||h==="$!"||h==="$?"){if(c===0)return s;c--}else h==="/$"&&c++}s=s.previousSibling}return null}var Cs=Math.random().toString(36).slice(2),Qi="__reactFiber$"+Cs,ha="__reactProps$"+Cs,ga="__reactContainer$"+Cs,Cc="__reactEvents$"+Cs,xo="__reactListeners$"+Cs,jc="__reactHandles$"+Cs;function Xr(s){var c=s[Qi];if(c)return c;for(var h=s.parentNode;h;){if(c=h[ga]||h[Qi]){if(h=c.alternate,c.child!==null||h!==null&&h.child!==null)for(s=pd(s);s!==null;){if(h=s[Qi])return h;s=pd(s)}return c}s=h,h=s.parentNode}return null}function yo(s){return s=s[Qi]||s[ga],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function js(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function xl(s){return s[ha]||null}var Tc=[],Ts=-1;function _r(s){return{current:s}}function Bn(s){0>Ts||(s.current=Tc[Ts],Tc[Ts]=null,Ts--)}function Pn(s,c){Ts++,Tc[Ts]=s.current,s.current=c}var Pa={},qr=_r(Pa),pr=_r(!1),ts=Pa;function Fa(s,c){var h=s.type.contextTypes;if(!h)return Pa;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===c)return b.__reactInternalMemoizedMaskedChildContext;var w={},j;for(j in h)w[j]=c[j];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=c,s.__reactInternalMemoizedMaskedChildContext=w),w}function ri(s){return s=s.childContextTypes,s!=null}function yl(){Bn(pr),Bn(qr)}function hd(s,c,h){if(qr.current!==Pa)throw Error(n(168));Pn(qr,c),Pn(pr,h)}function gd(s,c,h){var b=s.stateNode;if(c=c.childContextTypes,typeof b.getChildContext!="function")return h;b=b.getChildContext();for(var w in b)if(!(w in c))throw Error(n(108,fe(s)||"Unknown",w));return B({},h,b)}function bo(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Pa,ts=qr.current,Pn(qr,s),Pn(pr,pr.current),!0}function vo(s,c,h){var b=s.stateNode;if(!b)throw Error(n(169));h?(s=gd(s,c,ts),b.__reactInternalMemoizedMergedChildContext=s,Bn(pr),Bn(qr),Pn(qr,s)):Bn(pr),Pn(pr,h)}var hi=null,ns=!1,bl=!1;function Rc(s){hi===null?hi=[s]:hi.push(s)}function md(s){ns=!0,Rc(s)}function L(){if(!bl&&hi!==null){bl=!0;var s=0,c=un;try{var h=hi;for(un=1;s<h.length;s++){var b=h[s];do b=b(!0);while(b!==null)}hi=null,ns=!1}catch(w){throw hi!==null&&(hi=hi.slice(s+1)),tr(fi,L),w}finally{un=c,bl=!1}}return null}var X=[],J=0,oe=null,pe=0,Te=[],Ce=0,_t=null,Kt=1,kn="";function Cn(s,c){X[J++]=pe,X[J++]=oe,oe=s,pe=c}function _n(s,c,h){Te[Ce++]=Kt,Te[Ce++]=kn,Te[Ce++]=_t,_t=s;var b=Kt;s=kn;var w=32-zn(b)-1;b&=~(1<<w),h+=1;var j=32-zn(c)+w;if(30<j){var z=w-w%5;j=(b&(1<<z)-1).toString(32),b>>=z,w-=z,Kt=1<<32-zn(c)+w|h<<w|b,kn=j+s}else Kt=1<<j|h<<w|b,kn=s}function be(s){s.return!==null&&(Cn(s,1),_n(s,1,0))}function Q(s){for(;s===oe;)oe=X[--J],X[J]=null,pe=X[--J],X[J]=null;for(;s===_t;)_t=Te[--Ce],Te[Ce]=null,kn=Te[--Ce],Te[Ce]=null,Kt=Te[--Ce],Te[Ce]=null}var ce=null,ke=null,Se=!1,Be=null;function xt(s,c){var h=ea(5,null,null,0);h.elementType="DELETED",h.stateNode=c,h.return=s,c=s.deletions,c===null?(s.deletions=[h],s.flags|=16):c.push(h)}function Ut(s,c){switch(s.tag){case 5:var h=s.type;return c=c.nodeType!==1||h.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(s.stateNode=c,ce=s,ke=Da(c.firstChild),!0):!1;case 6:return c=s.pendingProps===""||c.nodeType!==3?null:c,c!==null?(s.stateNode=c,ce=s,ke=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(h=_t!==null?{id:Kt,overflow:kn}:null,s.memoizedState={dehydrated:c,treeContext:h,retryLane:1073741824},h=ea(18,null,null,0),h.stateNode=c,h.return=s,s.child=h,ce=s,ke=null,!0):!1;default:return!1}}function Bt(s){return(s.mode&1)!==0&&(s.flags&128)===0}function gn(s){if(Se){var c=ke;if(c){var h=c;if(!Ut(s,c)){if(Bt(s))throw Error(n(418));c=Da(h.nextSibling);var b=ce;c&&Ut(s,c)?xt(b,h):(s.flags=s.flags&-4097|2,Se=!1,ce=s)}}else{if(Bt(s))throw Error(n(418));s.flags=s.flags&-4097|2,Se=!1,ce=s}}}function Wn(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;ce=s}function Xn(s){if(s!==ce)return!1;if(!Se)return Wn(s),Se=!0,!1;var c;if((c=s.tag!==3)&&!(c=s.tag!==5)&&(c=s.type,c=c!=="head"&&c!=="body"&&!_c(s.type,s.memoizedProps)),c&&(c=ke)){if(Bt(s))throw hr(),Error(n(418));for(;c;)xt(s,c),c=Da(c.nextSibling)}if(Wn(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,c=0;s;){if(s.nodeType===8){var h=s.data;if(h==="/$"){if(c===0){ke=Da(s.nextSibling);break e}c--}else h!=="$"&&h!=="$!"&&h!=="$?"||c++}s=s.nextSibling}ke=null}}else ke=ce?Da(s.stateNode.nextSibling):null;return!0}function hr(){for(var s=ke;s;)s=Da(s.nextSibling)}function jn(){ke=ce=null,Se=!1}function ko(s){Be===null?Be=[s]:Be.push(s)}var vl=A.ReactCurrentBatchConfig;function ma(s,c,h){if(s=h.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(n(309));var b=h.stateNode}if(!b)throw Error(n(147,s));var w=b,j=""+s;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===j?c.ref:(c=function(z){var re=w.refs;z===null?delete re[j]:re[j]=z},c._stringRef=j,c)}if(typeof s!="string")throw Error(n(284));if(!h._owner)throw Error(n(290,s))}return s}function kl(s,c){throw s=Object.prototype.toString.call(c),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":s))}function Ac(s){var c=s._init;return c(s._payload)}function Ic(s){function c(we,he){if(s){var Ee=we.deletions;Ee===null?(we.deletions=[he],we.flags|=16):Ee.push(he)}}function h(we,he){if(!s)return null;for(;he!==null;)c(we,he),he=he.sibling;return null}function b(we,he){for(we=new Map;he!==null;)he.key!==null?we.set(he.key,he):we.set(he.index,he),he=he.sibling;return we}function w(we,he){return we=Ps(we,he),we.index=0,we.sibling=null,we}function j(we,he,Ee){return we.index=Ee,s?(Ee=we.alternate,Ee!==null?(Ee=Ee.index,Ee<he?(we.flags|=2,he):Ee):(we.flags|=2,he)):(we.flags|=1048576,he)}function z(we){return s&&we.alternate===null&&(we.flags|=2),we}function re(we,he,Ee,ct){return he===null||he.tag!==6?(he=bh(Ee,we.mode,ct),he.return=we,he):(he=w(he,Ee),he.return=we,he)}function ue(we,he,Ee,ct){var Pt=Ee.type;return Pt===C?Qe(we,he,Ee.props.children,ct,Ee.key):he!==null&&(he.elementType===Pt||typeof Pt=="object"&&Pt!==null&&Pt.$$typeof===K&&Ac(Pt)===he.type)?(ct=w(he,Ee.props),ct.ref=ma(we,he,Ee),ct.return=we,ct):(ct=Fd(Ee.type,Ee.key,Ee.props,null,we.mode,ct),ct.ref=ma(we,he,Ee),ct.return=we,ct)}function Ne(we,he,Ee,ct){return he===null||he.tag!==4||he.stateNode.containerInfo!==Ee.containerInfo||he.stateNode.implementation!==Ee.implementation?(he=vh(Ee,we.mode,ct),he.return=we,he):(he=w(he,Ee.children||[]),he.return=we,he)}function Qe(we,he,Ee,ct,Pt){return he===null||he.tag!==7?(he=Ao(Ee,we.mode,ct,Pt),he.return=we,he):(he=w(he,Ee),he.return=we,he)}function tt(we,he,Ee){if(typeof he=="string"&&he!==""||typeof he=="number")return he=bh(""+he,we.mode,Ee),he.return=we,he;if(typeof he=="object"&&he!==null){switch(he.$$typeof){case T:return Ee=Fd(he.type,he.key,he.props,null,we.mode,Ee),Ee.ref=ma(we,null,he),Ee.return=we,Ee;case R:return he=vh(he,we.mode,Ee),he.return=we,he;case K:var ct=he._init;return tt(we,ct(he._payload),Ee)}if(sn(he)||le(he))return he=Ao(he,we.mode,Ee,null),he.return=we,he;kl(we,he)}return null}function Ge(we,he,Ee,ct){var Pt=he!==null?he.key:null;if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return Pt!==null?null:re(we,he,""+Ee,ct);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case T:return Ee.key===Pt?ue(we,he,Ee,ct):null;case R:return Ee.key===Pt?Ne(we,he,Ee,ct):null;case K:return Pt=Ee._init,Ge(we,he,Pt(Ee._payload),ct)}if(sn(Ee)||le(Ee))return Pt!==null?null:Qe(we,he,Ee,ct,null);kl(we,Ee)}return null}function Et(we,he,Ee,ct,Pt){if(typeof ct=="string"&&ct!==""||typeof ct=="number")return we=we.get(Ee)||null,re(he,we,""+ct,Pt);if(typeof ct=="object"&&ct!==null){switch(ct.$$typeof){case T:return we=we.get(ct.key===null?Ee:ct.key)||null,ue(he,we,ct,Pt);case R:return we=we.get(ct.key===null?Ee:ct.key)||null,Ne(he,we,ct,Pt);case K:var Yt=ct._init;return Et(we,he,Ee,Yt(ct._payload),Pt)}if(sn(ct)||le(ct))return we=we.get(Ee)||null,Qe(he,we,ct,Pt,null);kl(he,ct)}return null}function Tt(we,he,Ee,ct){for(var Pt=null,Yt=null,Qt=he,nn=he=0,$r=null;Qt!==null&&nn<Ee.length;nn++){Qt.index>nn?($r=Qt,Qt=null):$r=Qt.sibling;var In=Ge(we,Qt,Ee[nn],ct);if(In===null){Qt===null&&(Qt=$r);break}s&&Qt&&In.alternate===null&&c(we,Qt),he=j(In,he,nn),Yt===null?Pt=In:Yt.sibling=In,Yt=In,Qt=$r}if(nn===Ee.length)return h(we,Qt),Se&&Cn(we,nn),Pt;if(Qt===null){for(;nn<Ee.length;nn++)Qt=tt(we,Ee[nn],ct),Qt!==null&&(he=j(Qt,he,nn),Yt===null?Pt=Qt:Yt.sibling=Qt,Yt=Qt);return Se&&Cn(we,nn),Pt}for(Qt=b(we,Qt);nn<Ee.length;nn++)$r=Et(Qt,we,nn,Ee[nn],ct),$r!==null&&(s&&$r.alternate!==null&&Qt.delete($r.key===null?nn:$r.key),he=j($r,he,nn),Yt===null?Pt=$r:Yt.sibling=$r,Yt=$r);return s&&Qt.forEach(function(Fs){return c(we,Fs)}),Se&&Cn(we,nn),Pt}function It(we,he,Ee,ct){var Pt=le(Ee);if(typeof Pt!="function")throw Error(n(150));if(Ee=Pt.call(Ee),Ee==null)throw Error(n(151));for(var Yt=Pt=null,Qt=he,nn=he=0,$r=null,In=Ee.next();Qt!==null&&!In.done;nn++,In=Ee.next()){Qt.index>nn?($r=Qt,Qt=null):$r=Qt.sibling;var Fs=Ge(we,Qt,In.value,ct);if(Fs===null){Qt===null&&(Qt=$r);break}s&&Qt&&Fs.alternate===null&&c(we,Qt),he=j(Fs,he,nn),Yt===null?Pt=Fs:Yt.sibling=Fs,Yt=Fs,Qt=$r}if(In.done)return h(we,Qt),Se&&Cn(we,nn),Pt;if(Qt===null){for(;!In.done;nn++,In=Ee.next())In=tt(we,In.value,ct),In!==null&&(he=j(In,he,nn),Yt===null?Pt=In:Yt.sibling=In,Yt=In);return Se&&Cn(we,nn),Pt}for(Qt=b(we,Qt);!In.done;nn++,In=Ee.next())In=Et(Qt,we,nn,In.value,ct),In!==null&&(s&&In.alternate!==null&&Qt.delete(In.key===null?nn:In.key),he=j(In,he,nn),Yt===null?Pt=In:Yt.sibling=In,Yt=In);return s&&Qt.forEach(function(wI){return c(we,wI)}),Se&&Cn(we,nn),Pt}function gr(we,he,Ee,ct){if(typeof Ee=="object"&&Ee!==null&&Ee.type===C&&Ee.key===null&&(Ee=Ee.props.children),typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case T:e:{for(var Pt=Ee.key,Yt=he;Yt!==null;){if(Yt.key===Pt){if(Pt=Ee.type,Pt===C){if(Yt.tag===7){h(we,Yt.sibling),he=w(Yt,Ee.props.children),he.return=we,we=he;break e}}else if(Yt.elementType===Pt||typeof Pt=="object"&&Pt!==null&&Pt.$$typeof===K&&Ac(Pt)===Yt.type){h(we,Yt.sibling),he=w(Yt,Ee.props),he.ref=ma(we,Yt,Ee),he.return=we,we=he;break e}h(we,Yt);break}else c(we,Yt);Yt=Yt.sibling}Ee.type===C?(he=Ao(Ee.props.children,we.mode,ct,Ee.key),he.return=we,we=he):(ct=Fd(Ee.type,Ee.key,Ee.props,null,we.mode,ct),ct.ref=ma(we,he,Ee),ct.return=we,we=ct)}return z(we);case R:e:{for(Yt=Ee.key;he!==null;){if(he.key===Yt)if(he.tag===4&&he.stateNode.containerInfo===Ee.containerInfo&&he.stateNode.implementation===Ee.implementation){h(we,he.sibling),he=w(he,Ee.children||[]),he.return=we,we=he;break e}else{h(we,he);break}else c(we,he);he=he.sibling}he=vh(Ee,we.mode,ct),he.return=we,we=he}return z(we);case K:return Yt=Ee._init,gr(we,he,Yt(Ee._payload),ct)}if(sn(Ee))return Tt(we,he,Ee,ct);if(le(Ee))return It(we,he,Ee,ct);kl(we,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"?(Ee=""+Ee,he!==null&&he.tag===6?(h(we,he.sibling),he=w(he,Ee),he.return=we,we=he):(h(we,he),he=bh(Ee,we.mode,ct),he.return=we,we=he),z(we)):h(we,he)}return gr}var Ba=Ic(!0),Mc=Ic(!1),_o=_r(null),wo=null,Tn=null,wi=null;function wr(){wi=Tn=wo=null}function Mr(s){var c=_o.current;Bn(_o),s._currentValue=c}function Lc(s,c,h){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===h)break;s=s.return}}function _l(s,c){wo=s,wi=Tn=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&c)!==0&&(Ei=!0),s.firstContext=null)}function Xi(s){var c=s._currentValue;if(wi!==s)if(s={context:s,memoizedValue:c,next:null},Tn===null){if(wo===null)throw Error(n(308));Tn=s,wo.dependencies={lanes:0,firstContext:s}}else Tn=Tn.next=s;return c}var Eo=null;function Mp(s){Eo===null?Eo=[s]:Eo.push(s)}function Wk(s,c,h,b){var w=c.interleaved;return w===null?(h.next=h,Mp(c)):(h.next=w.next,w.next=h),c.interleaved=h,rs(s,b)}function rs(s,c){s.lanes|=c;var h=s.alternate;for(h!==null&&(h.lanes|=c),h=s,s=s.return;s!==null;)s.childLanes|=c,h=s.alternate,h!==null&&(h.childLanes|=c),h=s,s=s.return;return h.tag===3?h.stateNode:null}var Rs=!1;function Lp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vk(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 is(s,c){return{eventTime:s,lane:c,tag:0,payload:null,callback:null,next:null}}function As(s,c,h){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(Rn&2)!==0){var w=b.pending;return w===null?c.next=c:(c.next=w.next,w.next=c),b.pending=c,rs(s,h)}return w=b.interleaved,w===null?(c.next=c,Mp(b)):(c.next=w.next,w.next=c),b.interleaved=c,rs(s,h)}function xd(s,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194240)!==0)){var b=c.lanes;b&=s.pendingLanes,h|=b,c.lanes=h,ei(s,h)}}function Gk(s,c){var h=s.updateQueue,b=s.alternate;if(b!==null&&(b=b.updateQueue,h===b)){var w=null,j=null;if(h=h.firstBaseUpdate,h!==null){do{var z={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};j===null?w=j=z:j=j.next=z,h=h.next}while(h!==null);j===null?w=j=c:j=j.next=c}else w=j=c;h={baseState:b.baseState,firstBaseUpdate:w,lastBaseUpdate:j,shared:b.shared,effects:b.effects},s.updateQueue=h;return}s=h.lastBaseUpdate,s===null?h.firstBaseUpdate=c:s.next=c,h.lastBaseUpdate=c}function yd(s,c,h,b){var w=s.updateQueue;Rs=!1;var j=w.firstBaseUpdate,z=w.lastBaseUpdate,re=w.shared.pending;if(re!==null){w.shared.pending=null;var ue=re,Ne=ue.next;ue.next=null,z===null?j=Ne:z.next=Ne,z=ue;var Qe=s.alternate;Qe!==null&&(Qe=Qe.updateQueue,re=Qe.lastBaseUpdate,re!==z&&(re===null?Qe.firstBaseUpdate=Ne:re.next=Ne,Qe.lastBaseUpdate=ue))}if(j!==null){var tt=w.baseState;z=0,Qe=Ne=ue=null,re=j;do{var Ge=re.lane,Et=re.eventTime;if((b&Ge)===Ge){Qe!==null&&(Qe=Qe.next={eventTime:Et,lane:0,tag:re.tag,payload:re.payload,callback:re.callback,next:null});e:{var Tt=s,It=re;switch(Ge=c,Et=h,It.tag){case 1:if(Tt=It.payload,typeof Tt=="function"){tt=Tt.call(Et,tt,Ge);break e}tt=Tt;break e;case 3:Tt.flags=Tt.flags&-65537|128;case 0:if(Tt=It.payload,Ge=typeof Tt=="function"?Tt.call(Et,tt,Ge):Tt,Ge==null)break e;tt=B({},tt,Ge);break e;case 2:Rs=!0}}re.callback!==null&&re.lane!==0&&(s.flags|=64,Ge=w.effects,Ge===null?w.effects=[re]:Ge.push(re))}else Et={eventTime:Et,lane:Ge,tag:re.tag,payload:re.payload,callback:re.callback,next:null},Qe===null?(Ne=Qe=Et,ue=tt):Qe=Qe.next=Et,z|=Ge;if(re=re.next,re===null){if(re=w.shared.pending,re===null)break;Ge=re,re=Ge.next,Ge.next=null,w.lastBaseUpdate=Ge,w.shared.pending=null}}while(!0);if(Qe===null&&(ue=tt),w.baseState=ue,w.firstBaseUpdate=Ne,w.lastBaseUpdate=Qe,c=w.shared.interleaved,c!==null){w=c;do z|=w.lane,w=w.next;while(w!==c)}else j===null&&(w.shared.lanes=0);Co|=z,s.lanes=z,s.memoizedState=tt}}function Kk(s,c,h){if(s=c.effects,c.effects=null,s!==null)for(c=0;c<s.length;c++){var b=s[c],w=b.callback;if(w!==null){if(b.callback=null,b=h,typeof w!="function")throw Error(n(191,w));w.call(b)}}}var Oc={},za=_r(Oc),Dc=_r(Oc),Pc=_r(Oc);function So(s){if(s===Oc)throw Error(n(174));return s}function Op(s,c){switch(Pn(Pc,c),Pn(Dc,s),Pn(za,Oc),s=c.nodeType,s){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:de(null,"");break;default:s=s===8?c.parentNode:c,c=s.namespaceURI||null,s=s.tagName,c=de(c,s)}Bn(za),Pn(za,c)}function wl(){Bn(za),Bn(Dc),Bn(Pc)}function Yk(s){So(Pc.current);var c=So(za.current),h=de(c,s.type);c!==h&&(Pn(Dc,s),Pn(za,h))}function Dp(s){Dc.current===s&&(Bn(za),Bn(Dc))}var ar=_r(0);function bd(s){for(var c=s;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.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 Pp=[];function Fp(){for(var s=0;s<Pp.length;s++)Pp[s]._workInProgressVersionPrimary=null;Pp.length=0}var vd=A.ReactCurrentDispatcher,Bp=A.ReactCurrentBatchConfig,No=0,sr=null,Lr=null,Ur=null,kd=!1,Fc=!1,Bc=0,WA=0;function ii(){throw Error(n(321))}function zp(s,c){if(c===null)return!1;for(var h=0;h<c.length&&h<s.length;h++)if(!ki(s[h],c[h]))return!1;return!0}function qp(s,c,h,b,w,j){if(No=j,sr=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,vd.current=s===null||s.memoizedState===null?YA:QA,s=h(b,w),Fc){j=0;do{if(Fc=!1,Bc=0,25<=j)throw Error(n(301));j+=1,Ur=Lr=null,c.updateQueue=null,vd.current=XA,s=h(b,w)}while(Fc)}if(vd.current=Ed,c=Lr!==null&&Lr.next!==null,No=0,Ur=Lr=sr=null,kd=!1,c)throw Error(n(300));return s}function Up(){var s=Bc!==0;return Bc=0,s}function qa(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ur===null?sr.memoizedState=Ur=s:Ur=Ur.next=s,Ur}function Zi(){if(Lr===null){var s=sr.alternate;s=s!==null?s.memoizedState:null}else s=Lr.next;var c=Ur===null?sr.memoizedState:Ur.next;if(c!==null)Ur=c,Lr=s;else{if(s===null)throw Error(n(310));Lr=s,s={memoizedState:Lr.memoizedState,baseState:Lr.baseState,baseQueue:Lr.baseQueue,queue:Lr.queue,next:null},Ur===null?sr.memoizedState=Ur=s:Ur=Ur.next=s}return Ur}function zc(s,c){return typeof c=="function"?c(s):c}function Hp(s){var c=Zi(),h=c.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=s;var b=Lr,w=b.baseQueue,j=h.pending;if(j!==null){if(w!==null){var z=w.next;w.next=j.next,j.next=z}b.baseQueue=w=j,h.pending=null}if(w!==null){j=w.next,b=b.baseState;var re=z=null,ue=null,Ne=j;do{var Qe=Ne.lane;if((No&Qe)===Qe)ue!==null&&(ue=ue.next={lane:0,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null}),b=Ne.hasEagerState?Ne.eagerState:s(b,Ne.action);else{var tt={lane:Qe,action:Ne.action,hasEagerState:Ne.hasEagerState,eagerState:Ne.eagerState,next:null};ue===null?(re=ue=tt,z=b):ue=ue.next=tt,sr.lanes|=Qe,Co|=Qe}Ne=Ne.next}while(Ne!==null&&Ne!==j);ue===null?z=b:ue.next=re,ki(b,c.memoizedState)||(Ei=!0),c.memoizedState=b,c.baseState=z,c.baseQueue=ue,h.lastRenderedState=b}if(s=h.interleaved,s!==null){w=s;do j=w.lane,sr.lanes|=j,Co|=j,w=w.next;while(w!==s)}else w===null&&(h.lanes=0);return[c.memoizedState,h.dispatch]}function $p(s){var c=Zi(),h=c.queue;if(h===null)throw Error(n(311));h.lastRenderedReducer=s;var b=h.dispatch,w=h.pending,j=c.memoizedState;if(w!==null){h.pending=null;var z=w=w.next;do j=s(j,z.action),z=z.next;while(z!==w);ki(j,c.memoizedState)||(Ei=!0),c.memoizedState=j,c.baseQueue===null&&(c.baseState=j),h.lastRenderedState=j}return[j,b]}function Qk(){}function Xk(s,c){var h=sr,b=Zi(),w=c(),j=!ki(b.memoizedState,w);if(j&&(b.memoizedState=w,Ei=!0),b=b.queue,Wp(e1.bind(null,h,b,s),[s]),b.getSnapshot!==c||j||Ur!==null&&Ur.memoizedState.tag&1){if(h.flags|=2048,qc(9,Jk.bind(null,h,b,w,c),void 0,null),Hr===null)throw Error(n(349));(No&30)!==0||Zk(h,c,w)}return w}function Zk(s,c,h){s.flags|=16384,s={getSnapshot:c,value:h},c=sr.updateQueue,c===null?(c={lastEffect:null,stores:null},sr.updateQueue=c,c.stores=[s]):(h=c.stores,h===null?c.stores=[s]:h.push(s))}function Jk(s,c,h,b){c.value=h,c.getSnapshot=b,t1(c)&&n1(s)}function e1(s,c,h){return h(function(){t1(c)&&n1(s)})}function t1(s){var c=s.getSnapshot;s=s.value;try{var h=c();return!ki(s,h)}catch{return!0}}function n1(s){var c=rs(s,1);c!==null&&va(c,s,1,-1)}function r1(s){var c=qa();return typeof s=="function"&&(s=s()),c.memoizedState=c.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zc,lastRenderedState:s},c.queue=s,s=s.dispatch=KA.bind(null,sr,s),[c.memoizedState,s]}function qc(s,c,h,b){return s={tag:s,create:c,destroy:h,deps:b,next:null},c=sr.updateQueue,c===null?(c={lastEffect:null,stores:null},sr.updateQueue=c,c.lastEffect=s.next=s):(h=c.lastEffect,h===null?c.lastEffect=s.next=s:(b=h.next,h.next=s,s.next=b,c.lastEffect=s)),s}function i1(){return Zi().memoizedState}function _d(s,c,h,b){var w=qa();sr.flags|=s,w.memoizedState=qc(1|c,h,void 0,b===void 0?null:b)}function wd(s,c,h,b){var w=Zi();b=b===void 0?null:b;var j=void 0;if(Lr!==null){var z=Lr.memoizedState;if(j=z.destroy,b!==null&&zp(b,z.deps)){w.memoizedState=qc(c,h,j,b);return}}sr.flags|=s,w.memoizedState=qc(1|c,h,j,b)}function a1(s,c){return _d(8390656,8,s,c)}function Wp(s,c){return wd(2048,8,s,c)}function s1(s,c){return wd(4,2,s,c)}function o1(s,c){return wd(4,4,s,c)}function l1(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 c1(s,c,h){return h=h!=null?h.concat([s]):null,wd(4,4,l1.bind(null,c,s),h)}function Vp(){}function u1(s,c){var h=Zi();c=c===void 0?null:c;var b=h.memoizedState;return b!==null&&c!==null&&zp(c,b[1])?b[0]:(h.memoizedState=[s,c],s)}function d1(s,c){var h=Zi();c=c===void 0?null:c;var b=h.memoizedState;return b!==null&&c!==null&&zp(c,b[1])?b[0]:(s=s(),h.memoizedState=[s,c],s)}function f1(s,c,h){return(No&21)===0?(s.baseState&&(s.baseState=!1,Ei=!0),s.memoizedState=h):(ki(h,c)||(h=la(),sr.lanes|=h,Co|=h,s.baseState=!0),c)}function VA(s,c){var h=un;un=h!==0&&4>h?h:4,s(!0);var b=Bp.transition;Bp.transition={};try{s(!1),c()}finally{un=h,Bp.transition=b}}function p1(){return Zi().memoizedState}function GA(s,c,h){var b=Os(s);if(h={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null},h1(s))g1(c,h);else if(h=Wk(s,c,h,b),h!==null){var w=mi();va(h,s,b,w),m1(h,c,b)}}function KA(s,c,h){var b=Os(s),w={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null};if(h1(s))g1(c,w);else{var j=s.alternate;if(s.lanes===0&&(j===null||j.lanes===0)&&(j=c.lastRenderedReducer,j!==null))try{var z=c.lastRenderedState,re=j(z,h);if(w.hasEagerState=!0,w.eagerState=re,ki(re,z)){var ue=c.interleaved;ue===null?(w.next=w,Mp(c)):(w.next=ue.next,ue.next=w),c.interleaved=w;return}}catch{}finally{}h=Wk(s,c,w,b),h!==null&&(w=mi(),va(h,s,b,w),m1(h,c,b))}}function h1(s){var c=s.alternate;return s===sr||c!==null&&c===sr}function g1(s,c){Fc=kd=!0;var h=s.pending;h===null?c.next=c:(c.next=h.next,h.next=c),s.pending=c}function m1(s,c,h){if((h&4194240)!==0){var b=c.lanes;b&=s.pendingLanes,h|=b,c.lanes=h,ei(s,h)}}var Ed={readContext:Xi,useCallback:ii,useContext:ii,useEffect:ii,useImperativeHandle:ii,useInsertionEffect:ii,useLayoutEffect:ii,useMemo:ii,useReducer:ii,useRef:ii,useState:ii,useDebugValue:ii,useDeferredValue:ii,useTransition:ii,useMutableSource:ii,useSyncExternalStore:ii,useId:ii,unstable_isNewReconciler:!1},YA={readContext:Xi,useCallback:function(s,c){return qa().memoizedState=[s,c===void 0?null:c],s},useContext:Xi,useEffect:a1,useImperativeHandle:function(s,c,h){return h=h!=null?h.concat([s]):null,_d(4194308,4,l1.bind(null,c,s),h)},useLayoutEffect:function(s,c){return _d(4194308,4,s,c)},useInsertionEffect:function(s,c){return _d(4,2,s,c)},useMemo:function(s,c){var h=qa();return c=c===void 0?null:c,s=s(),h.memoizedState=[s,c],s},useReducer:function(s,c,h){var b=qa();return c=h!==void 0?h(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=GA.bind(null,sr,s),[b.memoizedState,s]},useRef:function(s){var c=qa();return s={current:s},c.memoizedState=s},useState:r1,useDebugValue:Vp,useDeferredValue:function(s){return qa().memoizedState=s},useTransition:function(){var s=r1(!1),c=s[0];return s=VA.bind(null,s[1]),qa().memoizedState=s,[c,s]},useMutableSource:function(){},useSyncExternalStore:function(s,c,h){var b=sr,w=qa();if(Se){if(h===void 0)throw Error(n(407));h=h()}else{if(h=c(),Hr===null)throw Error(n(349));(No&30)!==0||Zk(b,c,h)}w.memoizedState=h;var j={value:h,getSnapshot:c};return w.queue=j,a1(e1.bind(null,b,j,s),[s]),b.flags|=2048,qc(9,Jk.bind(null,b,j,h,c),void 0,null),h},useId:function(){var s=qa(),c=Hr.identifierPrefix;if(Se){var h=kn,b=Kt;h=(b&~(1<<32-zn(b)-1)).toString(32)+h,c=":"+c+"R"+h,h=Bc++,0<h&&(c+="H"+h.toString(32)),c+=":"}else h=WA++,c=":"+c+"r"+h.toString(32)+":";return s.memoizedState=c},unstable_isNewReconciler:!1},QA={readContext:Xi,useCallback:u1,useContext:Xi,useEffect:Wp,useImperativeHandle:c1,useInsertionEffect:s1,useLayoutEffect:o1,useMemo:d1,useReducer:Hp,useRef:i1,useState:function(){return Hp(zc)},useDebugValue:Vp,useDeferredValue:function(s){var c=Zi();return f1(c,Lr.memoizedState,s)},useTransition:function(){var s=Hp(zc)[0],c=Zi().memoizedState;return[s,c]},useMutableSource:Qk,useSyncExternalStore:Xk,useId:p1,unstable_isNewReconciler:!1},XA={readContext:Xi,useCallback:u1,useContext:Xi,useEffect:Wp,useImperativeHandle:c1,useInsertionEffect:s1,useLayoutEffect:o1,useMemo:d1,useReducer:$p,useRef:i1,useState:function(){return $p(zc)},useDebugValue:Vp,useDeferredValue:function(s){var c=Zi();return Lr===null?c.memoizedState=s:f1(c,Lr.memoizedState,s)},useTransition:function(){var s=$p(zc)[0],c=Zi().memoizedState;return[s,c]},useMutableSource:Qk,useSyncExternalStore:Xk,useId:p1,unstable_isNewReconciler:!1};function xa(s,c){if(s&&s.defaultProps){c=B({},c),s=s.defaultProps;for(var h in s)c[h]===void 0&&(c[h]=s[h]);return c}return c}function Gp(s,c,h,b){c=s.memoizedState,h=h(b,c),h=h==null?c:B({},c,h),s.memoizedState=h,s.lanes===0&&(s.updateQueue.baseState=h)}var Sd={isMounted:function(s){return(s=s._reactInternals)?bn(s)===s:!1},enqueueSetState:function(s,c,h){s=s._reactInternals;var b=mi(),w=Os(s),j=is(b,w);j.payload=c,h!=null&&(j.callback=h),c=As(s,j,w),c!==null&&(va(c,s,w,b),xd(c,s,w))},enqueueReplaceState:function(s,c,h){s=s._reactInternals;var b=mi(),w=Os(s),j=is(b,w);j.tag=1,j.payload=c,h!=null&&(j.callback=h),c=As(s,j,w),c!==null&&(va(c,s,w,b),xd(c,s,w))},enqueueForceUpdate:function(s,c){s=s._reactInternals;var h=mi(),b=Os(s),w=is(h,b);w.tag=2,c!=null&&(w.callback=c),c=As(s,w,b),c!==null&&(va(c,s,b,h),xd(c,s,b))}};function x1(s,c,h,b,w,j,z){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,j,z):c.prototype&&c.prototype.isPureReactComponent?!vs(h,b)||!vs(w,j):!0}function y1(s,c,h){var b=!1,w=Pa,j=c.contextType;return typeof j=="object"&&j!==null?j=Xi(j):(w=ri(c)?ts:qr.current,b=c.contextTypes,j=(b=b!=null)?Fa(s,w):Pa),c=new c(h,j),s.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Sd,s.stateNode=c,c._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=w,s.__reactInternalMemoizedMaskedChildContext=j),c}function b1(s,c,h,b){s=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,b),c.state!==s&&Sd.enqueueReplaceState(c,c.state,null)}function Kp(s,c,h,b){var w=s.stateNode;w.props=h,w.state=s.memoizedState,w.refs={},Lp(s);var j=c.contextType;typeof j=="object"&&j!==null?w.context=Xi(j):(j=ri(c)?ts:qr.current,w.context=Fa(s,j)),w.state=s.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(Gp(s,c,j,h),w.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(c=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),c!==w.state&&Sd.enqueueReplaceState(w,w.state,null),yd(s,h,w,b),w.state=s.memoizedState),typeof w.componentDidMount=="function"&&(s.flags|=4194308)}function El(s,c){try{var h="",b=c;do h+=W(b),b=b.return;while(b);var w=h}catch(j){w=`
|
|
39
|
-
Error generating stack: `+j.message+`
|
|
40
|
-
`+j.stack}return{value:s,source:c,stack:w,digest:null}}function Yp(s,c,h){return{value:s,source:null,stack:h??null,digest:c??null}}function Qp(s,c){try{console.error(c.value)}catch(h){setTimeout(function(){throw h})}}var ZA=typeof WeakMap=="function"?WeakMap:Map;function v1(s,c,h){h=is(-1,h),h.tag=3,h.payload={element:null};var b=c.value;return h.callback=function(){Id||(Id=!0,dh=b),Qp(s,c)},h}function k1(s,c,h){h=is(-1,h),h.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var w=c.value;h.payload=function(){return b(w)},h.callback=function(){Qp(s,c)}}var j=s.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(h.callback=function(){Qp(s,c),typeof b!="function"&&(Ms===null?Ms=new Set([this]):Ms.add(this));var z=c.stack;this.componentDidCatch(c.value,{componentStack:z!==null?z:""})}),h}function _1(s,c,h){var b=s.pingCache;if(b===null){b=s.pingCache=new ZA;var w=new Set;b.set(c,w)}else w=b.get(c),w===void 0&&(w=new Set,b.set(c,w));w.has(h)||(w.add(h),s=fI.bind(null,s,c,h),c.then(s,s))}function w1(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 E1(s,c,h,b,w){return(s.mode&1)===0?(s===c?s.flags|=65536:(s.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(c=is(-1,1),c.tag=2,As(h,c,1))),h.lanes|=1),s):(s.flags|=65536,s.lanes=w,s)}var JA=A.ReactCurrentOwner,Ei=!1;function gi(s,c,h,b){c.child=s===null?Mc(c,null,h,b):Ba(c,s.child,h,b)}function S1(s,c,h,b,w){h=h.render;var j=c.ref;return _l(c,w),b=qp(s,c,h,b,j,w),h=Up(),s!==null&&!Ei?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~w,as(s,c,w)):(Se&&h&&be(c),c.flags|=1,gi(s,c,b,w),c.child)}function N1(s,c,h,b,w){if(s===null){var j=h.type;return typeof j=="function"&&!yh(j)&&j.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(c.tag=15,c.type=j,C1(s,c,j,b,w)):(s=Fd(h.type,null,b,c,c.mode,w),s.ref=c.ref,s.return=c,c.child=s)}if(j=s.child,(s.lanes&w)===0){var z=j.memoizedProps;if(h=h.compare,h=h!==null?h:vs,h(z,b)&&s.ref===c.ref)return as(s,c,w)}return c.flags|=1,s=Ps(j,b),s.ref=c.ref,s.return=c,c.child=s}function C1(s,c,h,b,w){if(s!==null){var j=s.memoizedProps;if(vs(j,b)&&s.ref===c.ref)if(Ei=!1,c.pendingProps=b=j,(s.lanes&w)!==0)(s.flags&131072)!==0&&(Ei=!0);else return c.lanes=s.lanes,as(s,c,w)}return Xp(s,c,h,b,w)}function j1(s,c,h){var b=c.pendingProps,w=b.children,j=s!==null?s.memoizedState:null;if(b.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pn(Nl,Fi),Fi|=h;else{if((h&1073741824)===0)return s=j!==null?j.baseLanes|h:h,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:s,cachePool:null,transitions:null},c.updateQueue=null,Pn(Nl,Fi),Fi|=s,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=j!==null?j.baseLanes:h,Pn(Nl,Fi),Fi|=b}else j!==null?(b=j.baseLanes|h,c.memoizedState=null):b=h,Pn(Nl,Fi),Fi|=b;return gi(s,c,w,h),c.child}function T1(s,c){var h=c.ref;(s===null&&h!==null||s!==null&&s.ref!==h)&&(c.flags|=512,c.flags|=2097152)}function Xp(s,c,h,b,w){var j=ri(h)?ts:qr.current;return j=Fa(c,j),_l(c,w),h=qp(s,c,h,b,j,w),b=Up(),s!==null&&!Ei?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~w,as(s,c,w)):(Se&&b&&be(c),c.flags|=1,gi(s,c,h,w),c.child)}function R1(s,c,h,b,w){if(ri(h)){var j=!0;bo(c)}else j=!1;if(_l(c,w),c.stateNode===null)Cd(s,c),y1(c,h,b),Kp(c,h,b,w),b=!0;else if(s===null){var z=c.stateNode,re=c.memoizedProps;z.props=re;var ue=z.context,Ne=h.contextType;typeof Ne=="object"&&Ne!==null?Ne=Xi(Ne):(Ne=ri(h)?ts:qr.current,Ne=Fa(c,Ne));var Qe=h.getDerivedStateFromProps,tt=typeof Qe=="function"||typeof z.getSnapshotBeforeUpdate=="function";tt||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(re!==b||ue!==Ne)&&b1(c,z,b,Ne),Rs=!1;var Ge=c.memoizedState;z.state=Ge,yd(c,b,z,w),ue=c.memoizedState,re!==b||Ge!==ue||pr.current||Rs?(typeof Qe=="function"&&(Gp(c,h,Qe,b),ue=c.memoizedState),(re=Rs||x1(c,h,re,b,Ge,ue,Ne))?(tt||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(c.flags|=4194308)):(typeof z.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=ue),z.props=b,z.state=ue,z.context=Ne,b=re):(typeof z.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{z=c.stateNode,Vk(s,c),re=c.memoizedProps,Ne=c.type===c.elementType?re:xa(c.type,re),z.props=Ne,tt=c.pendingProps,Ge=z.context,ue=h.contextType,typeof ue=="object"&&ue!==null?ue=Xi(ue):(ue=ri(h)?ts:qr.current,ue=Fa(c,ue));var Et=h.getDerivedStateFromProps;(Qe=typeof Et=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(re!==tt||Ge!==ue)&&b1(c,z,b,ue),Rs=!1,Ge=c.memoizedState,z.state=Ge,yd(c,b,z,w);var Tt=c.memoizedState;re!==tt||Ge!==Tt||pr.current||Rs?(typeof Et=="function"&&(Gp(c,h,Et,b),Tt=c.memoizedState),(Ne=Rs||x1(c,h,Ne,b,Ge,Tt,ue)||!1)?(Qe||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(b,Tt,ue),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(b,Tt,ue)),typeof z.componentDidUpdate=="function"&&(c.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof z.componentDidUpdate!="function"||re===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||re===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=Tt),z.props=b,z.state=Tt,z.context=ue,b=Ne):(typeof z.componentDidUpdate!="function"||re===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||re===s.memoizedProps&&Ge===s.memoizedState||(c.flags|=1024),b=!1)}return Zp(s,c,h,b,j,w)}function Zp(s,c,h,b,w,j){T1(s,c);var z=(c.flags&128)!==0;if(!b&&!z)return w&&vo(c,h,!1),as(s,c,j);b=c.stateNode,JA.current=c;var re=z&&typeof h.getDerivedStateFromError!="function"?null:b.render();return c.flags|=1,s!==null&&z?(c.child=Ba(c,s.child,null,j),c.child=Ba(c,null,re,j)):gi(s,c,re,j),c.memoizedState=b.state,w&&vo(c,h,!0),c.child}function A1(s){var c=s.stateNode;c.pendingContext?hd(s,c.pendingContext,c.pendingContext!==c.context):c.context&&hd(s,c.context,!1),Op(s,c.containerInfo)}function I1(s,c,h,b,w){return jn(),ko(w),c.flags|=256,gi(s,c,h,b),c.child}var Jp={dehydrated:null,treeContext:null,retryLane:0};function eh(s){return{baseLanes:s,cachePool:null,transitions:null}}function M1(s,c,h){var b=c.pendingProps,w=ar.current,j=!1,z=(c.flags&128)!==0,re;if((re=z)||(re=s!==null&&s.memoizedState===null?!1:(w&2)!==0),re?(j=!0,c.flags&=-129):(s===null||s.memoizedState!==null)&&(w|=1),Pn(ar,w&1),s===null)return gn(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):(z=b.children,s=b.fallback,j?(b=c.mode,j=c.child,z={mode:"hidden",children:z},(b&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=z):j=Bd(z,b,0,null),s=Ao(s,b,h,null),j.return=c,s.return=c,j.sibling=s,c.child=j,c.child.memoizedState=eh(h),c.memoizedState=Jp,s):th(c,z));if(w=s.memoizedState,w!==null&&(re=w.dehydrated,re!==null))return eI(s,c,z,b,re,w,h);if(j){j=b.fallback,z=c.mode,w=s.child,re=w.sibling;var ue={mode:"hidden",children:b.children};return(z&1)===0&&c.child!==w?(b=c.child,b.childLanes=0,b.pendingProps=ue,c.deletions=null):(b=Ps(w,ue),b.subtreeFlags=w.subtreeFlags&14680064),re!==null?j=Ps(re,j):(j=Ao(j,z,h,null),j.flags|=2),j.return=c,b.return=c,b.sibling=j,c.child=b,b=j,j=c.child,z=s.child.memoizedState,z=z===null?eh(h):{baseLanes:z.baseLanes|h,cachePool:null,transitions:z.transitions},j.memoizedState=z,j.childLanes=s.childLanes&~h,c.memoizedState=Jp,b}return j=s.child,s=j.sibling,b=Ps(j,{mode:"visible",children:b.children}),(c.mode&1)===0&&(b.lanes=h),b.return=c,b.sibling=null,s!==null&&(h=c.deletions,h===null?(c.deletions=[s],c.flags|=16):h.push(s)),c.child=b,c.memoizedState=null,b}function th(s,c){return c=Bd({mode:"visible",children:c},s.mode,0,null),c.return=s,s.child=c}function Nd(s,c,h,b){return b!==null&&ko(b),Ba(c,s.child,null,h),s=th(c,c.pendingProps.children),s.flags|=2,c.memoizedState=null,s}function eI(s,c,h,b,w,j,z){if(h)return c.flags&256?(c.flags&=-257,b=Yp(Error(n(422))),Nd(s,c,z,b)):c.memoizedState!==null?(c.child=s.child,c.flags|=128,null):(j=b.fallback,w=c.mode,b=Bd({mode:"visible",children:b.children},w,0,null),j=Ao(j,w,z,null),j.flags|=2,b.return=c,j.return=c,b.sibling=j,c.child=b,(c.mode&1)!==0&&Ba(c,s.child,null,z),c.child.memoizedState=eh(z),c.memoizedState=Jp,j);if((c.mode&1)===0)return Nd(s,c,z,null);if(w.data==="$!"){if(b=w.nextSibling&&w.nextSibling.dataset,b)var re=b.dgst;return b=re,j=Error(n(419)),b=Yp(j,b,void 0),Nd(s,c,z,b)}if(re=(z&s.childLanes)!==0,Ei||re){if(b=Hr,b!==null){switch(z&-z){case 4:w=2;break;case 16:w=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:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(b.suspendedLanes|z))!==0?0:w,w!==0&&w!==j.retryLane&&(j.retryLane=w,rs(s,w),va(b,s,w,-1))}return xh(),b=Yp(Error(n(421))),Nd(s,c,z,b)}return w.data==="$?"?(c.flags|=128,c.child=s.child,c=pI.bind(null,s),w._reactRetry=c,null):(s=j.treeContext,ke=Da(w.nextSibling),ce=c,Se=!0,Be=null,s!==null&&(Te[Ce++]=Kt,Te[Ce++]=kn,Te[Ce++]=_t,Kt=s.id,kn=s.overflow,_t=c),c=th(c,b.children),c.flags|=4096,c)}function L1(s,c,h){s.lanes|=c;var b=s.alternate;b!==null&&(b.lanes|=c),Lc(s.return,c,h)}function nh(s,c,h,b,w){var j=s.memoizedState;j===null?s.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:h,tailMode:w}:(j.isBackwards=c,j.rendering=null,j.renderingStartTime=0,j.last=b,j.tail=h,j.tailMode=w)}function O1(s,c,h){var b=c.pendingProps,w=b.revealOrder,j=b.tail;if(gi(s,c,b.children,h),b=ar.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&&L1(s,h,c);else if(s.tag===19)L1(s,h,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(Pn(ar,b),(c.mode&1)===0)c.memoizedState=null;else switch(w){case"forwards":for(h=c.child,w=null;h!==null;)s=h.alternate,s!==null&&bd(s)===null&&(w=h),h=h.sibling;h=w,h===null?(w=c.child,c.child=null):(w=h.sibling,h.sibling=null),nh(c,!1,w,h,j);break;case"backwards":for(h=null,w=c.child,c.child=null;w!==null;){if(s=w.alternate,s!==null&&bd(s)===null){c.child=w;break}s=w.sibling,w.sibling=h,h=w,w=s}nh(c,!0,h,null,j);break;case"together":nh(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Cd(s,c){(c.mode&1)===0&&s!==null&&(s.alternate=null,c.alternate=null,c.flags|=2)}function as(s,c,h){if(s!==null&&(c.dependencies=s.dependencies),Co|=c.lanes,(h&c.childLanes)===0)return null;if(s!==null&&c.child!==s.child)throw Error(n(153));if(c.child!==null){for(s=c.child,h=Ps(s,s.pendingProps),c.child=h,h.return=c;s.sibling!==null;)s=s.sibling,h=h.sibling=Ps(s,s.pendingProps),h.return=c;h.sibling=null}return c.child}function tI(s,c,h){switch(c.tag){case 3:A1(c),jn();break;case 5:Yk(c);break;case 1:ri(c.type)&&bo(c);break;case 4:Op(c,c.stateNode.containerInfo);break;case 10:var b=c.type._context,w=c.memoizedProps.value;Pn(_o,b._currentValue),b._currentValue=w;break;case 13:if(b=c.memoizedState,b!==null)return b.dehydrated!==null?(Pn(ar,ar.current&1),c.flags|=128,null):(h&c.child.childLanes)!==0?M1(s,c,h):(Pn(ar,ar.current&1),s=as(s,c,h),s!==null?s.sibling:null);Pn(ar,ar.current&1);break;case 19:if(b=(h&c.childLanes)!==0,(s.flags&128)!==0){if(b)return O1(s,c,h);c.flags|=128}if(w=c.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),Pn(ar,ar.current),b)break;return null;case 22:case 23:return c.lanes=0,j1(s,c,h)}return as(s,c,h)}var D1,rh,P1,F1;D1=function(s,c){for(var h=c.child;h!==null;){if(h.tag===5||h.tag===6)s.appendChild(h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},rh=function(){},P1=function(s,c,h,b){var w=s.memoizedProps;if(w!==b){s=c.stateNode,So(za.current);var j=null;switch(h){case"input":w=$e(s,w),b=$e(s,b),j=[];break;case"select":w=B({},w,{value:void 0}),b=B({},b,{value:void 0}),j=[];break;case"textarea":w=Ht(s,w),b=Ht(s,b),j=[];break;default:typeof w.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=ml)}Gt(h,b);var z;h=null;for(Ne in w)if(!b.hasOwnProperty(Ne)&&w.hasOwnProperty(Ne)&&w[Ne]!=null)if(Ne==="style"){var re=w[Ne];for(z in re)re.hasOwnProperty(z)&&(h||(h={}),h[z]="")}else Ne!=="dangerouslySetInnerHTML"&&Ne!=="children"&&Ne!=="suppressContentEditableWarning"&&Ne!=="suppressHydrationWarning"&&Ne!=="autoFocus"&&(a.hasOwnProperty(Ne)?j||(j=[]):(j=j||[]).push(Ne,null));for(Ne in b){var ue=b[Ne];if(re=w!=null?w[Ne]:void 0,b.hasOwnProperty(Ne)&&ue!==re&&(ue!=null||re!=null))if(Ne==="style")if(re){for(z in re)!re.hasOwnProperty(z)||ue&&ue.hasOwnProperty(z)||(h||(h={}),h[z]="");for(z in ue)ue.hasOwnProperty(z)&&re[z]!==ue[z]&&(h||(h={}),h[z]=ue[z])}else h||(j||(j=[]),j.push(Ne,h)),h=ue;else Ne==="dangerouslySetInnerHTML"?(ue=ue?ue.__html:void 0,re=re?re.__html:void 0,ue!=null&&re!==ue&&(j=j||[]).push(Ne,ue)):Ne==="children"?typeof ue!="string"&&typeof ue!="number"||(j=j||[]).push(Ne,""+ue):Ne!=="suppressContentEditableWarning"&&Ne!=="suppressHydrationWarning"&&(a.hasOwnProperty(Ne)?(ue!=null&&Ne==="onScroll"&&$n("scroll",s),j||re===ue||(j=[])):(j=j||[]).push(Ne,ue))}h&&(j=j||[]).push("style",h);var Ne=j;(c.updateQueue=Ne)&&(c.flags|=4)}},F1=function(s,c,h,b){h!==b&&(c.flags|=4)};function Uc(s,c){if(!Se)switch(s.tailMode){case"hidden":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?s.tail=null:h.sibling=null;break;case"collapsed":h=s.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?c||s.tail===null?s.tail=null:s.tail.sibling=null:b.sibling=null}}function ai(s){var c=s.alternate!==null&&s.alternate.child===s.child,h=0,b=0;if(c)for(var w=s.child;w!==null;)h|=w.lanes|w.childLanes,b|=w.subtreeFlags&14680064,b|=w.flags&14680064,w.return=s,w=w.sibling;else for(w=s.child;w!==null;)h|=w.lanes|w.childLanes,b|=w.subtreeFlags,b|=w.flags,w.return=s,w=w.sibling;return s.subtreeFlags|=b,s.childLanes=h,c}function nI(s,c,h){var b=c.pendingProps;switch(Q(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ai(c),null;case 1:return ri(c.type)&&yl(),ai(c),null;case 3:return b=c.stateNode,wl(),Bn(pr),Bn(qr),Fp(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(Xn(c)?c.flags|=4:s===null||s.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Be!==null&&(hh(Be),Be=null))),rh(s,c),ai(c),null;case 5:Dp(c);var w=So(Pc.current);if(h=c.type,s!==null&&c.stateNode!=null)P1(s,c,h,b,w),s.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!b){if(c.stateNode===null)throw Error(n(166));return ai(c),null}if(s=So(za.current),Xn(c)){b=c.stateNode,h=c.type;var j=c.memoizedProps;switch(b[Qi]=c,b[ha]=j,s=(c.mode&1)!==0,h){case"dialog":$n("cancel",b),$n("close",b);break;case"iframe":case"object":case"embed":$n("load",b);break;case"video":case"audio":for(w=0;w<pa.length;w++)$n(pa[w],b);break;case"source":$n("error",b);break;case"img":case"image":case"link":$n("error",b),$n("load",b);break;case"details":$n("toggle",b);break;case"input":qe(b,j),$n("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!j.multiple},$n("invalid",b);break;case"textarea":We(b,j),$n("invalid",b)}Gt(h,j),w=null;for(var z in j)if(j.hasOwnProperty(z)){var re=j[z];z==="children"?typeof re=="string"?b.textContent!==re&&(j.suppressHydrationWarning!==!0&&mo(b.textContent,re,s),w=["children",re]):typeof re=="number"&&b.textContent!==""+re&&(j.suppressHydrationWarning!==!0&&mo(b.textContent,re,s),w=["children",""+re]):a.hasOwnProperty(z)&&re!=null&&z==="onScroll"&&$n("scroll",b)}switch(h){case"input":ze(b),ot(b,j,!0);break;case"textarea":ze(b),et(b);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(b.onclick=ml)}b=w,c.updateQueue=b,b!==null&&(c.flags|=4)}else{z=w.nodeType===9?w:w.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=nt(h)),s==="http://www.w3.org/1999/xhtml"?h==="script"?(s=z.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=z.createElement(h,{is:b.is}):(s=z.createElement(h),h==="select"&&(z=s,b.multiple?z.multiple=!0:b.size&&(z.size=b.size))):s=z.createElementNS(s,h),s[Qi]=c,s[ha]=b,D1(s,c,!1,!1),c.stateNode=s;e:{switch(z=Ze(h,b),h){case"dialog":$n("cancel",s),$n("close",s),w=b;break;case"iframe":case"object":case"embed":$n("load",s),w=b;break;case"video":case"audio":for(w=0;w<pa.length;w++)$n(pa[w],s);w=b;break;case"source":$n("error",s),w=b;break;case"img":case"image":case"link":$n("error",s),$n("load",s),w=b;break;case"details":$n("toggle",s),w=b;break;case"input":qe(s,b),w=$e(s,b),$n("invalid",s);break;case"option":w=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},w=B({},b,{value:void 0}),$n("invalid",s);break;case"textarea":We(s,b),w=Ht(s,b),$n("invalid",s);break;default:w=b}Gt(h,w),re=w;for(j in re)if(re.hasOwnProperty(j)){var ue=re[j];j==="style"?pt(s,ue):j==="dangerouslySetInnerHTML"?(ue=ue?ue.__html:void 0,ue!=null&&Ue(s,ue)):j==="children"?typeof ue=="string"?(h!=="textarea"||ue!=="")&&ge(s,ue):typeof ue=="number"&&ge(s,""+ue):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(a.hasOwnProperty(j)?ue!=null&&j==="onScroll"&&$n("scroll",s):ue!=null&&N(s,j,ue,z))}switch(h){case"input":ze(s),ot(s,b,!1);break;case"textarea":ze(s),et(s);break;case"option":b.value!=null&&s.setAttribute("value",""+ae(b.value));break;case"select":s.multiple=!!b.multiple,j=b.value,j!=null?Xt(s,!!b.multiple,j,!1):b.defaultValue!=null&&Xt(s,!!b.multiple,b.defaultValue,!0);break;default:typeof w.onClick=="function"&&(s.onclick=ml)}switch(h){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 ai(c),null;case 6:if(s&&c.stateNode!=null)F1(s,c,s.memoizedProps,b);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(h=So(Pc.current),So(za.current),Xn(c)){if(b=c.stateNode,h=c.memoizedProps,b[Qi]=c,(j=b.nodeValue!==h)&&(s=ce,s!==null))switch(s.tag){case 3:mo(b.nodeValue,h,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&mo(b.nodeValue,h,(s.mode&1)!==0)}j&&(c.flags|=4)}else b=(h.nodeType===9?h:h.ownerDocument).createTextNode(b),b[Qi]=c,c.stateNode=b}return ai(c),null;case 13:if(Bn(ar),b=c.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Se&&ke!==null&&(c.mode&1)!==0&&(c.flags&128)===0)hr(),jn(),c.flags|=98560,j=!1;else if(j=Xn(c),b!==null&&b.dehydrated!==null){if(s===null){if(!j)throw Error(n(318));if(j=c.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(n(317));j[Qi]=c}else jn(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;ai(c),j=!1}else Be!==null&&(hh(Be),Be=null),j=!0;if(!j)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=h,c):(b=b!==null,b!==(s!==null&&s.memoizedState!==null)&&b&&(c.child.flags|=8192,(c.mode&1)!==0&&(s===null||(ar.current&1)!==0?Or===0&&(Or=3):xh())),c.updateQueue!==null&&(c.flags|=4),ai(c),null);case 4:return wl(),rh(s,c),s===null&&go(c.stateNode.containerInfo),ai(c),null;case 10:return Mr(c.type._context),ai(c),null;case 17:return ri(c.type)&&yl(),ai(c),null;case 19:if(Bn(ar),j=c.memoizedState,j===null)return ai(c),null;if(b=(c.flags&128)!==0,z=j.rendering,z===null)if(b)Uc(j,!1);else{if(Or!==0||s!==null&&(s.flags&128)!==0)for(s=c.child;s!==null;){if(z=bd(s),z!==null){for(c.flags|=128,Uc(j,!1),b=z.updateQueue,b!==null&&(c.updateQueue=b,c.flags|=4),c.subtreeFlags=0,b=h,h=c.child;h!==null;)j=h,s=b,j.flags&=14680066,z=j.alternate,z===null?(j.childLanes=0,j.lanes=s,j.child=null,j.subtreeFlags=0,j.memoizedProps=null,j.memoizedState=null,j.updateQueue=null,j.dependencies=null,j.stateNode=null):(j.childLanes=z.childLanes,j.lanes=z.lanes,j.child=z.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=z.memoizedProps,j.memoizedState=z.memoizedState,j.updateQueue=z.updateQueue,j.type=z.type,s=z.dependencies,j.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),h=h.sibling;return Pn(ar,ar.current&1|2),c.child}s=s.sibling}j.tail!==null&&Hn()>Cl&&(c.flags|=128,b=!0,Uc(j,!1),c.lanes=4194304)}else{if(!b)if(s=bd(z),s!==null){if(c.flags|=128,b=!0,h=s.updateQueue,h!==null&&(c.updateQueue=h,c.flags|=4),Uc(j,!0),j.tail===null&&j.tailMode==="hidden"&&!z.alternate&&!Se)return ai(c),null}else 2*Hn()-j.renderingStartTime>Cl&&h!==1073741824&&(c.flags|=128,b=!0,Uc(j,!1),c.lanes=4194304);j.isBackwards?(z.sibling=c.child,c.child=z):(h=j.last,h!==null?h.sibling=z:c.child=z,j.last=z)}return j.tail!==null?(c=j.tail,j.rendering=c,j.tail=c.sibling,j.renderingStartTime=Hn(),c.sibling=null,h=ar.current,Pn(ar,b?h&1|2:h&1),c):(ai(c),null);case 22:case 23:return mh(),b=c.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(c.flags|=8192),b&&(c.mode&1)!==0?(Fi&1073741824)!==0&&(ai(c),c.subtreeFlags&6&&(c.flags|=8192)):ai(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function rI(s,c){switch(Q(c),c.tag){case 1:return ri(c.type)&&yl(),s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 3:return wl(),Bn(pr),Bn(qr),Fp(),s=c.flags,(s&65536)!==0&&(s&128)===0?(c.flags=s&-65537|128,c):null;case 5:return Dp(c),null;case 13:if(Bn(ar),s=c.memoizedState,s!==null&&s.dehydrated!==null){if(c.alternate===null)throw Error(n(340));jn()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 19:return Bn(ar),null;case 4:return wl(),null;case 10:return Mr(c.type._context),null;case 22:case 23:return mh(),null;case 24:return null;default:return null}}var jd=!1,si=!1,iI=typeof WeakSet=="function"?WeakSet:Set,jt=null;function Sl(s,c){var h=s.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(b){ur(s,c,b)}else h.current=null}function ih(s,c,h){try{h()}catch(b){ur(s,c,b)}}var B1=!1;function aI(s,c){if(vc=to,s=gc(),ks(s)){if("selectionStart"in s)var h={start:s.selectionStart,end:s.selectionEnd};else e:{h=(h=s.ownerDocument)&&h.defaultView||window;var b=h.getSelection&&h.getSelection();if(b&&b.rangeCount!==0){h=b.anchorNode;var w=b.anchorOffset,j=b.focusNode;b=b.focusOffset;try{h.nodeType,j.nodeType}catch{h=null;break e}var z=0,re=-1,ue=-1,Ne=0,Qe=0,tt=s,Ge=null;t:for(;;){for(var Et;tt!==h||w!==0&&tt.nodeType!==3||(re=z+w),tt!==j||b!==0&&tt.nodeType!==3||(ue=z+b),tt.nodeType===3&&(z+=tt.nodeValue.length),(Et=tt.firstChild)!==null;)Ge=tt,tt=Et;for(;;){if(tt===s)break t;if(Ge===h&&++Ne===w&&(re=z),Ge===j&&++Qe===b&&(ue=z),(Et=tt.nextSibling)!==null)break;tt=Ge,Ge=tt.parentNode}tt=Et}h=re===-1||ue===-1?null:{start:re,end:ue}}else h=null}h=h||{start:0,end:0}}else h=null;for(kc={focusedElem:s,selectionRange:h},to=!1,jt=c;jt!==null;)if(c=jt,s=c.child,(c.subtreeFlags&1028)!==0&&s!==null)s.return=c,jt=s;else for(;jt!==null;){c=jt;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 It=Tt.memoizedProps,gr=Tt.memoizedState,we=c.stateNode,he=we.getSnapshotBeforeUpdate(c.elementType===c.type?It:xa(c.type,It),gr);we.__reactInternalSnapshotBeforeUpdate=he}break;case 3:var Ee=c.stateNode.containerInfo;Ee.nodeType===1?Ee.textContent="":Ee.nodeType===9&&Ee.documentElement&&Ee.removeChild(Ee.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ct){ur(c,c.return,ct)}if(s=c.sibling,s!==null){s.return=c.return,jt=s;break}jt=c.return}return Tt=B1,B1=!1,Tt}function Hc(s,c,h){var b=c.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var w=b=b.next;do{if((w.tag&s)===s){var j=w.destroy;w.destroy=void 0,j!==void 0&&ih(c,h,j)}w=w.next}while(w!==b)}}function Td(s,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&s)===s){var b=h.create;h.destroy=b()}h=h.next}while(h!==c)}}function ah(s){var c=s.ref;if(c!==null){var h=s.stateNode;switch(s.tag){case 5:s=h;break;default:s=h}typeof c=="function"?c(s):c.current=s}}function z1(s){var c=s.alternate;c!==null&&(s.alternate=null,z1(c)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(c=s.stateNode,c!==null&&(delete c[Qi],delete c[ha],delete c[Cc],delete c[xo],delete c[jc])),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 q1(s){return s.tag===5||s.tag===3||s.tag===4}function U1(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||q1(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 sh(s,c,h){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?h.nodeType===8?h.parentNode.insertBefore(s,c):h.insertBefore(s,c):(h.nodeType===8?(c=h.parentNode,c.insertBefore(s,h)):(c=h,c.appendChild(s)),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=ml));else if(b!==4&&(s=s.child,s!==null))for(sh(s,c,h),s=s.sibling;s!==null;)sh(s,c,h),s=s.sibling}function oh(s,c,h){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?h.insertBefore(s,c):h.appendChild(s);else if(b!==4&&(s=s.child,s!==null))for(oh(s,c,h),s=s.sibling;s!==null;)oh(s,c,h),s=s.sibling}var Zr=null,ya=!1;function Is(s,c,h){for(h=h.child;h!==null;)H1(s,c,h),h=h.sibling}function H1(s,c,h){if(cn&&typeof cn.onCommitFiberUnmount=="function")try{cn.onCommitFiberUnmount(Mt,h)}catch{}switch(h.tag){case 5:si||Sl(h,c);case 6:var b=Zr,w=ya;Zr=null,Is(s,c,h),Zr=b,ya=w,Zr!==null&&(ya?(s=Zr,h=h.stateNode,s.nodeType===8?s.parentNode.removeChild(h):s.removeChild(h)):Zr.removeChild(h.stateNode));break;case 18:Zr!==null&&(ya?(s=Zr,h=h.stateNode,s.nodeType===8?Nc(s.parentNode,h):s.nodeType===1&&Nc(s,h),eo(s)):Nc(Zr,h.stateNode));break;case 4:b=Zr,w=ya,Zr=h.stateNode.containerInfo,ya=!0,Is(s,c,h),Zr=b,ya=w;break;case 0:case 11:case 14:case 15:if(!si&&(b=h.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){w=b=b.next;do{var j=w,z=j.destroy;j=j.tag,z!==void 0&&((j&2)!==0||(j&4)!==0)&&ih(h,c,z),w=w.next}while(w!==b)}Is(s,c,h);break;case 1:if(!si&&(Sl(h,c),b=h.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=h.memoizedProps,b.state=h.memoizedState,b.componentWillUnmount()}catch(re){ur(h,c,re)}Is(s,c,h);break;case 21:Is(s,c,h);break;case 22:h.mode&1?(si=(b=si)||h.memoizedState!==null,Is(s,c,h),si=b):Is(s,c,h);break;default:Is(s,c,h)}}function $1(s){var c=s.updateQueue;if(c!==null){s.updateQueue=null;var h=s.stateNode;h===null&&(h=s.stateNode=new iI),c.forEach(function(b){var w=hI.bind(null,s,b);h.has(b)||(h.add(b),b.then(w,w))})}}function ba(s,c){var h=c.deletions;if(h!==null)for(var b=0;b<h.length;b++){var w=h[b];try{var j=s,z=c,re=z;e:for(;re!==null;){switch(re.tag){case 5:Zr=re.stateNode,ya=!1;break e;case 3:Zr=re.stateNode.containerInfo,ya=!0;break e;case 4:Zr=re.stateNode.containerInfo,ya=!0;break e}re=re.return}if(Zr===null)throw Error(n(160));H1(j,z,w),Zr=null,ya=!1;var ue=w.alternate;ue!==null&&(ue.return=null),w.return=null}catch(Ne){ur(w,c,Ne)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)W1(c,s),c=c.sibling}function W1(s,c){var h=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(ba(c,s),Ua(s),b&4){try{Hc(3,s,s.return),Td(3,s)}catch(It){ur(s,s.return,It)}try{Hc(5,s,s.return)}catch(It){ur(s,s.return,It)}}break;case 1:ba(c,s),Ua(s),b&512&&h!==null&&Sl(h,h.return);break;case 5:if(ba(c,s),Ua(s),b&512&&h!==null&&Sl(h,h.return),s.flags&32){var w=s.stateNode;try{ge(w,"")}catch(It){ur(s,s.return,It)}}if(b&4&&(w=s.stateNode,w!=null)){var j=s.memoizedProps,z=h!==null?h.memoizedProps:j,re=s.type,ue=s.updateQueue;if(s.updateQueue=null,ue!==null)try{re==="input"&&j.type==="radio"&&j.name!=null&&Oe(w,j),Ze(re,z);var Ne=Ze(re,j);for(z=0;z<ue.length;z+=2){var Qe=ue[z],tt=ue[z+1];Qe==="style"?pt(w,tt):Qe==="dangerouslySetInnerHTML"?Ue(w,tt):Qe==="children"?ge(w,tt):N(w,Qe,tt,Ne)}switch(re){case"input":rt(w,j);break;case"textarea":De(w,j);break;case"select":var Ge=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!j.multiple;var Et=j.value;Et!=null?Xt(w,!!j.multiple,Et,!1):Ge!==!!j.multiple&&(j.defaultValue!=null?Xt(w,!!j.multiple,j.defaultValue,!0):Xt(w,!!j.multiple,j.multiple?[]:"",!1))}w[ha]=j}catch(It){ur(s,s.return,It)}}break;case 6:if(ba(c,s),Ua(s),b&4){if(s.stateNode===null)throw Error(n(162));w=s.stateNode,j=s.memoizedProps;try{w.nodeValue=j}catch(It){ur(s,s.return,It)}}break;case 3:if(ba(c,s),Ua(s),b&4&&h!==null&&h.memoizedState.isDehydrated)try{eo(c.containerInfo)}catch(It){ur(s,s.return,It)}break;case 4:ba(c,s),Ua(s);break;case 13:ba(c,s),Ua(s),w=s.child,w.flags&8192&&(j=w.memoizedState!==null,w.stateNode.isHidden=j,!j||w.alternate!==null&&w.alternate.memoizedState!==null||(uh=Hn())),b&4&&$1(s);break;case 22:if(Qe=h!==null&&h.memoizedState!==null,s.mode&1?(si=(Ne=si)||Qe,ba(c,s),si=Ne):ba(c,s),Ua(s),b&8192){if(Ne=s.memoizedState!==null,(s.stateNode.isHidden=Ne)&&!Qe&&(s.mode&1)!==0)for(jt=s,Qe=s.child;Qe!==null;){for(tt=jt=Qe;jt!==null;){switch(Ge=jt,Et=Ge.child,Ge.tag){case 0:case 11:case 14:case 15:Hc(4,Ge,Ge.return);break;case 1:Sl(Ge,Ge.return);var Tt=Ge.stateNode;if(typeof Tt.componentWillUnmount=="function"){b=Ge,h=Ge.return;try{c=b,Tt.props=c.memoizedProps,Tt.state=c.memoizedState,Tt.componentWillUnmount()}catch(It){ur(b,h,It)}}break;case 5:Sl(Ge,Ge.return);break;case 22:if(Ge.memoizedState!==null){K1(tt);continue}}Et!==null?(Et.return=Ge,jt=Et):K1(tt)}Qe=Qe.sibling}e:for(Qe=null,tt=s;;){if(tt.tag===5){if(Qe===null){Qe=tt;try{w=tt.stateNode,Ne?(j=w.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(re=tt.stateNode,ue=tt.memoizedProps.style,z=ue!=null&&ue.hasOwnProperty("display")?ue.display:null,re.style.display=vt("display",z))}catch(It){ur(s,s.return,It)}}}else if(tt.tag===6){if(Qe===null)try{tt.stateNode.nodeValue=Ne?"":tt.memoizedProps}catch(It){ur(s,s.return,It)}}else if((tt.tag!==22&&tt.tag!==23||tt.memoizedState===null||tt===s)&&tt.child!==null){tt.child.return=tt,tt=tt.child;continue}if(tt===s)break e;for(;tt.sibling===null;){if(tt.return===null||tt.return===s)break e;Qe===tt&&(Qe=null),tt=tt.return}Qe===tt&&(Qe=null),tt.sibling.return=tt.return,tt=tt.sibling}}break;case 19:ba(c,s),Ua(s),b&4&&$1(s);break;case 21:break;default:ba(c,s),Ua(s)}}function Ua(s){var c=s.flags;if(c&2){try{e:{for(var h=s.return;h!==null;){if(q1(h)){var b=h;break e}h=h.return}throw Error(n(160))}switch(b.tag){case 5:var w=b.stateNode;b.flags&32&&(ge(w,""),b.flags&=-33);var j=U1(s);oh(s,j,w);break;case 3:case 4:var z=b.stateNode.containerInfo,re=U1(s);sh(s,re,z);break;default:throw Error(n(161))}}catch(ue){ur(s,s.return,ue)}s.flags&=-3}c&4096&&(s.flags&=-4097)}function sI(s,c,h){jt=s,V1(s)}function V1(s,c,h){for(var b=(s.mode&1)!==0;jt!==null;){var w=jt,j=w.child;if(w.tag===22&&b){var z=w.memoizedState!==null||jd;if(!z){var re=w.alternate,ue=re!==null&&re.memoizedState!==null||si;re=jd;var Ne=si;if(jd=z,(si=ue)&&!Ne)for(jt=w;jt!==null;)z=jt,ue=z.child,z.tag===22&&z.memoizedState!==null?Y1(w):ue!==null?(ue.return=z,jt=ue):Y1(w);for(;j!==null;)jt=j,V1(j),j=j.sibling;jt=w,jd=re,si=Ne}G1(s)}else(w.subtreeFlags&8772)!==0&&j!==null?(j.return=w,jt=j):G1(s)}}function G1(s){for(;jt!==null;){var c=jt;if((c.flags&8772)!==0){var h=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:si||Td(5,c);break;case 1:var b=c.stateNode;if(c.flags&4&&!si)if(h===null)b.componentDidMount();else{var w=c.elementType===c.type?h.memoizedProps:xa(c.type,h.memoizedProps);b.componentDidUpdate(w,h.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var j=c.updateQueue;j!==null&&Kk(c,j,b);break;case 3:var z=c.updateQueue;if(z!==null){if(h=null,c.child!==null)switch(c.child.tag){case 5:h=c.child.stateNode;break;case 1:h=c.child.stateNode}Kk(c,z,h)}break;case 5:var re=c.stateNode;if(h===null&&c.flags&4){h=re;var ue=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":ue.autoFocus&&h.focus();break;case"img":ue.src&&(h.src=ue.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var Ne=c.alternate;if(Ne!==null){var Qe=Ne.memoizedState;if(Qe!==null){var tt=Qe.dehydrated;tt!==null&&eo(tt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}si||c.flags&512&&ah(c)}catch(Ge){ur(c,c.return,Ge)}}if(c===s){jt=null;break}if(h=c.sibling,h!==null){h.return=c.return,jt=h;break}jt=c.return}}function K1(s){for(;jt!==null;){var c=jt;if(c===s){jt=null;break}var h=c.sibling;if(h!==null){h.return=c.return,jt=h;break}jt=c.return}}function Y1(s){for(;jt!==null;){var c=jt;try{switch(c.tag){case 0:case 11:case 15:var h=c.return;try{Td(4,c)}catch(ue){ur(c,h,ue)}break;case 1:var b=c.stateNode;if(typeof b.componentDidMount=="function"){var w=c.return;try{b.componentDidMount()}catch(ue){ur(c,w,ue)}}var j=c.return;try{ah(c)}catch(ue){ur(c,j,ue)}break;case 5:var z=c.return;try{ah(c)}catch(ue){ur(c,z,ue)}}}catch(ue){ur(c,c.return,ue)}if(c===s){jt=null;break}var re=c.sibling;if(re!==null){re.return=c.return,jt=re;break}jt=c.return}}var oI=Math.ceil,Rd=A.ReactCurrentDispatcher,lh=A.ReactCurrentOwner,Ji=A.ReactCurrentBatchConfig,Rn=0,Hr=null,Er=null,Jr=0,Fi=0,Nl=_r(0),Or=0,$c=null,Co=0,Ad=0,ch=0,Wc=null,Si=null,uh=0,Cl=1/0,ss=null,Id=!1,dh=null,Ms=null,Md=!1,Ls=null,Ld=0,Vc=0,fh=null,Od=-1,Dd=0;function mi(){return(Rn&6)!==0?Hn():Od!==-1?Od:Od=Hn()}function Os(s){return(s.mode&1)===0?1:(Rn&2)!==0&&Jr!==0?Jr&-Jr:vl.transition!==null?(Dd===0&&(Dd=la()),Dd):(s=un,s!==0||(s=window.event,s=s===void 0?16:tc(s.type)),s)}function va(s,c,h,b){if(50<Vc)throw Vc=0,fh=null,Error(n(185));vr(s,h,b),((Rn&2)===0||s!==Hr)&&(s===Hr&&((Rn&2)===0&&(Ad|=h),Or===4&&Ds(s,Jr)),Ni(s,b),h===1&&Rn===0&&(c.mode&1)===0&&(Cl=Hn()+500,ns&&L()))}function Ni(s,c){var h=s.callbackNode;Gi(s,c);var b=yr(s,s===Hr?Jr:0);if(b===0)h!==null&&jr(h),s.callbackNode=null,s.callbackPriority=0;else if(c=b&-b,s.callbackPriority!==c){if(h!=null&&jr(h),c===1)s.tag===0?md(X1.bind(null,s)):Rc(X1.bind(null,s)),Sc(function(){(Rn&6)===0&&L()}),h=null;else{switch(Wt(b)){case 1:h=fi;break;case 4:h=Tr;break;case 16:h=oa;break;case 536870912:h=gt;break;default:h=oa}h=a_(h,Q1.bind(null,s))}s.callbackPriority=c,s.callbackNode=h}}function Q1(s,c){if(Od=-1,Dd=0,(Rn&6)!==0)throw Error(n(327));var h=s.callbackNode;if(jl()&&s.callbackNode!==h)return null;var b=yr(s,s===Hr?Jr:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||c)c=Pd(s,b);else{c=b;var w=Rn;Rn|=2;var j=J1();(Hr!==s||Jr!==c)&&(ss=null,Cl=Hn()+500,To(s,c));do try{uI();break}catch(re){Z1(s,re)}while(!0);wr(),Rd.current=j,Rn=w,Er!==null?c=0:(Hr=null,Jr=0,c=Or)}if(c!==0){if(c===2&&(w=Ii(s),w!==0&&(b=w,c=ph(s,w))),c===1)throw h=$c,To(s,0),Ds(s,b),Ni(s,Hn()),h;if(c===6)Ds(s,b);else{if(w=s.current.alternate,(b&30)===0&&!lI(w)&&(c=Pd(s,b),c===2&&(j=Ii(s),j!==0&&(b=j,c=ph(s,j))),c===1))throw h=$c,To(s,0),Ds(s,b),Ni(s,Hn()),h;switch(s.finishedWork=w,s.finishedLanes=b,c){case 0:case 1:throw Error(n(345));case 2:Ro(s,Si,ss);break;case 3:if(Ds(s,b),(b&130023424)===b&&(c=uh+500-Hn(),10<c)){if(yr(s,0)!==0)break;if(w=s.suspendedLanes,(w&b)!==b){mi(),s.pingedLanes|=s.suspendedLanes&w;break}s.timeoutHandle=wc(Ro.bind(null,s,Si,ss),c);break}Ro(s,Si,ss);break;case 4:if(Ds(s,b),(b&4194240)===b)break;for(c=s.eventTimes,w=-1;0<b;){var z=31-zn(b);j=1<<z,z=c[z],z>w&&(w=z),b&=~j}if(b=w,b=Hn()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*oI(b/1960))-b,10<b){s.timeoutHandle=wc(Ro.bind(null,s,Si,ss),b);break}Ro(s,Si,ss);break;case 5:Ro(s,Si,ss);break;default:throw Error(n(329))}}}return Ni(s,Hn()),s.callbackNode===h?Q1.bind(null,s):null}function ph(s,c){var h=Wc;return s.current.memoizedState.isDehydrated&&(To(s,c).flags|=256),s=Pd(s,c),s!==2&&(c=Si,Si=h,c!==null&&hh(c)),s}function hh(s){Si===null?Si=s:Si.push.apply(Si,s)}function lI(s){for(var c=s;;){if(c.flags&16384){var h=c.updateQueue;if(h!==null&&(h=h.stores,h!==null))for(var b=0;b<h.length;b++){var w=h[b],j=w.getSnapshot;w=w.value;try{if(!ki(j(),w))return!1}catch{return!1}}}if(h=c.child,c.subtreeFlags&16384&&h!==null)h.return=c,c=h;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 Ds(s,c){for(c&=~ch,c&=~Ad,s.suspendedLanes|=c,s.pingedLanes&=~c,s=s.expirationTimes;0<c;){var h=31-zn(c),b=1<<h;s[h]=-1,c&=~b}}function X1(s){if((Rn&6)!==0)throw Error(n(327));jl();var c=yr(s,0);if((c&1)===0)return Ni(s,Hn()),null;var h=Pd(s,c);if(s.tag!==0&&h===2){var b=Ii(s);b!==0&&(c=b,h=ph(s,b))}if(h===1)throw h=$c,To(s,0),Ds(s,c),Ni(s,Hn()),h;if(h===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=c,Ro(s,Si,ss),Ni(s,Hn()),null}function gh(s,c){var h=Rn;Rn|=1;try{return s(c)}finally{Rn=h,Rn===0&&(Cl=Hn()+500,ns&&L())}}function jo(s){Ls!==null&&Ls.tag===0&&(Rn&6)===0&&jl();var c=Rn;Rn|=1;var h=Ji.transition,b=un;try{if(Ji.transition=null,un=1,s)return s()}finally{un=b,Ji.transition=h,Rn=c,(Rn&6)===0&&L()}}function mh(){Fi=Nl.current,Bn(Nl)}function To(s,c){s.finishedWork=null,s.finishedLanes=0;var h=s.timeoutHandle;if(h!==-1&&(s.timeoutHandle=-1,Ip(h)),Er!==null)for(h=Er.return;h!==null;){var b=h;switch(Q(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&yl();break;case 3:wl(),Bn(pr),Bn(qr),Fp();break;case 5:Dp(b);break;case 4:wl();break;case 13:Bn(ar);break;case 19:Bn(ar);break;case 10:Mr(b.type._context);break;case 22:case 23:mh()}h=h.return}if(Hr=s,Er=s=Ps(s.current,null),Jr=Fi=c,Or=0,$c=null,ch=Ad=Co=0,Si=Wc=null,Eo!==null){for(c=0;c<Eo.length;c++)if(h=Eo[c],b=h.interleaved,b!==null){h.interleaved=null;var w=b.next,j=h.pending;if(j!==null){var z=j.next;j.next=w,b.next=z}h.pending=b}Eo=null}return s}function Z1(s,c){do{var h=Er;try{if(wr(),vd.current=Ed,kd){for(var b=sr.memoizedState;b!==null;){var w=b.queue;w!==null&&(w.pending=null),b=b.next}kd=!1}if(No=0,Ur=Lr=sr=null,Fc=!1,Bc=0,lh.current=null,h===null||h.return===null){Or=1,$c=c,Er=null;break}e:{var j=s,z=h.return,re=h,ue=c;if(c=Jr,re.flags|=32768,ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Ne=ue,Qe=re,tt=Qe.tag;if((Qe.mode&1)===0&&(tt===0||tt===11||tt===15)){var Ge=Qe.alternate;Ge?(Qe.updateQueue=Ge.updateQueue,Qe.memoizedState=Ge.memoizedState,Qe.lanes=Ge.lanes):(Qe.updateQueue=null,Qe.memoizedState=null)}var Et=w1(z);if(Et!==null){Et.flags&=-257,E1(Et,z,re,j,c),Et.mode&1&&_1(j,Ne,c),c=Et,ue=Ne;var Tt=c.updateQueue;if(Tt===null){var It=new Set;It.add(ue),c.updateQueue=It}else Tt.add(ue);break e}else{if((c&1)===0){_1(j,Ne,c),xh();break e}ue=Error(n(426))}}else if(Se&&re.mode&1){var gr=w1(z);if(gr!==null){(gr.flags&65536)===0&&(gr.flags|=256),E1(gr,z,re,j,c),ko(El(ue,re));break e}}j=ue=El(ue,re),Or!==4&&(Or=2),Wc===null?Wc=[j]:Wc.push(j),j=z;do{switch(j.tag){case 3:j.flags|=65536,c&=-c,j.lanes|=c;var we=v1(j,ue,c);Gk(j,we);break e;case 1:re=ue;var he=j.type,Ee=j.stateNode;if((j.flags&128)===0&&(typeof he.getDerivedStateFromError=="function"||Ee!==null&&typeof Ee.componentDidCatch=="function"&&(Ms===null||!Ms.has(Ee)))){j.flags|=65536,c&=-c,j.lanes|=c;var ct=k1(j,re,c);Gk(j,ct);break e}}j=j.return}while(j!==null)}t_(h)}catch(Pt){c=Pt,Er===h&&h!==null&&(Er=h=h.return);continue}break}while(!0)}function J1(){var s=Rd.current;return Rd.current=Ed,s===null?Ed:s}function xh(){(Or===0||Or===3||Or===2)&&(Or=4),Hr===null||(Co&268435455)===0&&(Ad&268435455)===0||Ds(Hr,Jr)}function Pd(s,c){var h=Rn;Rn|=2;var b=J1();(Hr!==s||Jr!==c)&&(ss=null,To(s,c));do try{cI();break}catch(w){Z1(s,w)}while(!0);if(wr(),Rn=h,Rd.current=b,Er!==null)throw Error(n(261));return Hr=null,Jr=0,Or}function cI(){for(;Er!==null;)e_(Er)}function uI(){for(;Er!==null&&!vi();)e_(Er)}function e_(s){var c=i_(s.alternate,s,Fi);s.memoizedProps=s.pendingProps,c===null?t_(s):Er=c,lh.current=null}function t_(s){var c=s;do{var h=c.alternate;if(s=c.return,(c.flags&32768)===0){if(h=nI(h,c,Fi),h!==null){Er=h;return}}else{if(h=rI(h,c),h!==null){h.flags&=32767,Er=h;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Or=6,Er=null;return}}if(c=c.sibling,c!==null){Er=c;return}Er=c=s}while(c!==null);Or===0&&(Or=5)}function Ro(s,c,h){var b=un,w=Ji.transition;try{Ji.transition=null,un=1,dI(s,c,h,b)}finally{Ji.transition=w,un=b}return null}function dI(s,c,h,b){do jl();while(Ls!==null);if((Rn&6)!==0)throw Error(n(327));h=s.finishedWork;var w=s.finishedLanes;if(h===null)return null;if(s.finishedWork=null,s.finishedLanes=0,h===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var j=h.lanes|h.childLanes;if(zr(s,j),s===Hr&&(Er=Hr=null,Jr=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||Md||(Md=!0,a_(oa,function(){return jl(),null})),j=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||j){j=Ji.transition,Ji.transition=null;var z=un;un=1;var re=Rn;Rn|=4,lh.current=null,aI(s,h),W1(h,s),Cp(kc),to=!!vc,kc=vc=null,s.current=h,sI(h),ja(),Rn=re,un=z,Ji.transition=j}else s.current=h;if(Md&&(Md=!1,Ls=s,Ld=w),j=s.pendingLanes,j===0&&(Ms=null),Fn(h.stateNode),Ni(s,Hn()),c!==null)for(b=s.onRecoverableError,h=0;h<c.length;h++)w=c[h],b(w.value,{componentStack:w.stack,digest:w.digest});if(Id)throw Id=!1,s=dh,dh=null,s;return(Ld&1)!==0&&s.tag!==0&&jl(),j=s.pendingLanes,(j&1)!==0?s===fh?Vc++:(Vc=0,fh=s):Vc=0,L(),null}function jl(){if(Ls!==null){var s=Wt(Ld),c=Ji.transition,h=un;try{if(Ji.transition=null,un=16>s?16:s,Ls===null)var b=!1;else{if(s=Ls,Ls=null,Ld=0,(Rn&6)!==0)throw Error(n(331));var w=Rn;for(Rn|=4,jt=s.current;jt!==null;){var j=jt,z=j.child;if((jt.flags&16)!==0){var re=j.deletions;if(re!==null){for(var ue=0;ue<re.length;ue++){var Ne=re[ue];for(jt=Ne;jt!==null;){var Qe=jt;switch(Qe.tag){case 0:case 11:case 15:Hc(8,Qe,j)}var tt=Qe.child;if(tt!==null)tt.return=Qe,jt=tt;else for(;jt!==null;){Qe=jt;var Ge=Qe.sibling,Et=Qe.return;if(z1(Qe),Qe===Ne){jt=null;break}if(Ge!==null){Ge.return=Et,jt=Ge;break}jt=Et}}}var Tt=j.alternate;if(Tt!==null){var It=Tt.child;if(It!==null){Tt.child=null;do{var gr=It.sibling;It.sibling=null,It=gr}while(It!==null)}}jt=j}}if((j.subtreeFlags&2064)!==0&&z!==null)z.return=j,jt=z;else e:for(;jt!==null;){if(j=jt,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:Hc(9,j,j.return)}var we=j.sibling;if(we!==null){we.return=j.return,jt=we;break e}jt=j.return}}var he=s.current;for(jt=he;jt!==null;){z=jt;var Ee=z.child;if((z.subtreeFlags&2064)!==0&&Ee!==null)Ee.return=z,jt=Ee;else e:for(z=he;jt!==null;){if(re=jt,(re.flags&2048)!==0)try{switch(re.tag){case 0:case 11:case 15:Td(9,re)}}catch(Pt){ur(re,re.return,Pt)}if(re===z){jt=null;break e}var ct=re.sibling;if(ct!==null){ct.return=re.return,jt=ct;break e}jt=re.return}}if(Rn=w,L(),cn&&typeof cn.onPostCommitFiberRoot=="function")try{cn.onPostCommitFiberRoot(Mt,s)}catch{}b=!0}return b}finally{un=h,Ji.transition=c}}return!1}function n_(s,c,h){c=El(h,c),c=v1(s,c,1),s=As(s,c,1),c=mi(),s!==null&&(vr(s,1,c),Ni(s,c))}function ur(s,c,h){if(s.tag===3)n_(s,s,h);else for(;c!==null;){if(c.tag===3){n_(c,s,h);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Ms===null||!Ms.has(b))){s=El(h,s),s=k1(c,s,1),c=As(c,s,1),s=mi(),c!==null&&(vr(c,1,s),Ni(c,s));break}}c=c.return}}function fI(s,c,h){var b=s.pingCache;b!==null&&b.delete(c),c=mi(),s.pingedLanes|=s.suspendedLanes&h,Hr===s&&(Jr&h)===h&&(Or===4||Or===3&&(Jr&130023424)===Jr&&500>Hn()-uh?To(s,0):ch|=h),Ni(s,c)}function r_(s,c){c===0&&((s.mode&1)===0?c=1:(c=Vr,Vr<<=1,(Vr&130023424)===0&&(Vr=4194304)));var h=mi();s=rs(s,c),s!==null&&(vr(s,c,h),Ni(s,h))}function pI(s){var c=s.memoizedState,h=0;c!==null&&(h=c.retryLane),r_(s,h)}function hI(s,c){var h=0;switch(s.tag){case 13:var b=s.stateNode,w=s.memoizedState;w!==null&&(h=w.retryLane);break;case 19:b=s.stateNode;break;default:throw Error(n(314))}b!==null&&b.delete(c),r_(s,h)}var i_;i_=function(s,c,h){if(s!==null)if(s.memoizedProps!==c.pendingProps||pr.current)Ei=!0;else{if((s.lanes&h)===0&&(c.flags&128)===0)return Ei=!1,tI(s,c,h);Ei=(s.flags&131072)!==0}else Ei=!1,Se&&(c.flags&1048576)!==0&&_n(c,pe,c.index);switch(c.lanes=0,c.tag){case 2:var b=c.type;Cd(s,c),s=c.pendingProps;var w=Fa(c,qr.current);_l(c,h),w=qp(null,c,b,s,w,h);var j=Up();return c.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,ri(b)?(j=!0,bo(c)):j=!1,c.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Lp(c),w.updater=Sd,c.stateNode=w,w._reactInternals=c,Kp(c,b,s,h),c=Zp(null,c,b,!0,j,h)):(c.tag=0,Se&&j&&be(c),gi(null,c,w,h),c=c.child),c;case 16:b=c.elementType;e:{switch(Cd(s,c),s=c.pendingProps,w=b._init,b=w(b._payload),c.type=b,w=c.tag=mI(b),s=xa(b,s),w){case 0:c=Xp(null,c,b,s,h);break e;case 1:c=R1(null,c,b,s,h);break e;case 11:c=S1(null,c,b,s,h);break e;case 14:c=N1(null,c,b,xa(b.type,s),h);break e}throw Error(n(306,b,""))}return c;case 0:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:xa(b,w),Xp(s,c,b,w,h);case 1:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:xa(b,w),R1(s,c,b,w,h);case 3:e:{if(A1(c),s===null)throw Error(n(387));b=c.pendingProps,j=c.memoizedState,w=j.element,Vk(s,c),yd(c,b,null,h);var z=c.memoizedState;if(b=z.element,j.isDehydrated)if(j={element:b,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},c.updateQueue.baseState=j,c.memoizedState=j,c.flags&256){w=El(Error(n(423)),c),c=I1(s,c,b,h,w);break e}else if(b!==w){w=El(Error(n(424)),c),c=I1(s,c,b,h,w);break e}else for(ke=Da(c.stateNode.containerInfo.firstChild),ce=c,Se=!0,Be=null,h=Mc(c,null,b,h),c.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(jn(),b===w){c=as(s,c,h);break e}gi(s,c,b,h)}c=c.child}return c;case 5:return Yk(c),s===null&&gn(c),b=c.type,w=c.pendingProps,j=s!==null?s.memoizedProps:null,z=w.children,_c(b,w)?z=null:j!==null&&_c(b,j)&&(c.flags|=32),T1(s,c),gi(s,c,z,h),c.child;case 6:return s===null&&gn(c),null;case 13:return M1(s,c,h);case 4:return Op(c,c.stateNode.containerInfo),b=c.pendingProps,s===null?c.child=Ba(c,null,b,h):gi(s,c,b,h),c.child;case 11:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:xa(b,w),S1(s,c,b,w,h);case 7:return gi(s,c,c.pendingProps,h),c.child;case 8:return gi(s,c,c.pendingProps.children,h),c.child;case 12:return gi(s,c,c.pendingProps.children,h),c.child;case 10:e:{if(b=c.type._context,w=c.pendingProps,j=c.memoizedProps,z=w.value,Pn(_o,b._currentValue),b._currentValue=z,j!==null)if(ki(j.value,z)){if(j.children===w.children&&!pr.current){c=as(s,c,h);break e}}else for(j=c.child,j!==null&&(j.return=c);j!==null;){var re=j.dependencies;if(re!==null){z=j.child;for(var ue=re.firstContext;ue!==null;){if(ue.context===b){if(j.tag===1){ue=is(-1,h&-h),ue.tag=2;var Ne=j.updateQueue;if(Ne!==null){Ne=Ne.shared;var Qe=Ne.pending;Qe===null?ue.next=ue:(ue.next=Qe.next,Qe.next=ue),Ne.pending=ue}}j.lanes|=h,ue=j.alternate,ue!==null&&(ue.lanes|=h),Lc(j.return,h,c),re.lanes|=h;break}ue=ue.next}}else if(j.tag===10)z=j.type===c.type?null:j.child;else if(j.tag===18){if(z=j.return,z===null)throw Error(n(341));z.lanes|=h,re=z.alternate,re!==null&&(re.lanes|=h),Lc(z,h,c),z=j.sibling}else z=j.child;if(z!==null)z.return=j;else for(z=j;z!==null;){if(z===c){z=null;break}if(j=z.sibling,j!==null){j.return=z.return,z=j;break}z=z.return}j=z}gi(s,c,w.children,h),c=c.child}return c;case 9:return w=c.type,b=c.pendingProps.children,_l(c,h),w=Xi(w),b=b(w),c.flags|=1,gi(s,c,b,h),c.child;case 14:return b=c.type,w=xa(b,c.pendingProps),w=xa(b.type,w),N1(s,c,b,w,h);case 15:return C1(s,c,c.type,c.pendingProps,h);case 17:return b=c.type,w=c.pendingProps,w=c.elementType===b?w:xa(b,w),Cd(s,c),c.tag=1,ri(b)?(s=!0,bo(c)):s=!1,_l(c,h),y1(c,b,w),Kp(c,b,w,h),Zp(null,c,b,!0,s,h);case 19:return O1(s,c,h);case 22:return j1(s,c,h)}throw Error(n(156,c.tag))};function a_(s,c){return tr(s,c)}function gI(s,c,h,b){this.tag=s,this.key=h,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 ea(s,c,h,b){return new gI(s,c,h,b)}function yh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function mI(s){if(typeof s=="function")return yh(s)?1:0;if(s!=null){if(s=s.$$typeof,s===F)return 11;if(s===P)return 14}return 2}function Ps(s,c){var h=s.alternate;return h===null?(h=ea(s.tag,c,s.key,s.mode),h.elementType=s.elementType,h.type=s.type,h.stateNode=s.stateNode,h.alternate=s,s.alternate=h):(h.pendingProps=c,h.type=s.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=s.flags&14680064,h.childLanes=s.childLanes,h.lanes=s.lanes,h.child=s.child,h.memoizedProps=s.memoizedProps,h.memoizedState=s.memoizedState,h.updateQueue=s.updateQueue,c=s.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=s.sibling,h.index=s.index,h.ref=s.ref,h}function Fd(s,c,h,b,w,j){var z=2;if(b=s,typeof s=="function")yh(s)&&(z=1);else if(typeof s=="string")z=5;else e:switch(s){case C:return Ao(h.children,w,j,c);case O:z=8,w|=8;break;case M:return s=ea(12,h,c,w|2),s.elementType=M,s.lanes=j,s;case ee:return s=ea(13,h,c,w),s.elementType=ee,s.lanes=j,s;case H:return s=ea(19,h,c,w),s.elementType=H,s.lanes=j,s;case V:return Bd(h,w,j,c);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case I:z=10;break e;case D:z=9;break e;case F:z=11;break e;case P:z=14;break e;case K:z=16,b=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return c=ea(z,h,c,w),c.elementType=s,c.type=b,c.lanes=j,c}function Ao(s,c,h,b){return s=ea(7,s,b,c),s.lanes=h,s}function Bd(s,c,h,b){return s=ea(22,s,b,c),s.elementType=V,s.lanes=h,s.stateNode={isHidden:!1},s}function bh(s,c,h){return s=ea(6,s,null,c),s.lanes=h,s}function vh(s,c,h){return c=ea(4,s.children!==null?s.children:[],s.key,c),c.lanes=h,c.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},c}function xI(s,c,h,b,w){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=pi(0),this.expirationTimes=pi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pi(0),this.identifierPrefix=b,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function kh(s,c,h,b,w,j,z,re,ue){return s=new xI(s,c,h,re,ue),c===1?(c=1,j===!0&&(c|=8)):c=0,j=ea(3,null,null,c),s.current=j,j.stateNode=s,j.memoizedState={element:b,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lp(j),s}function yI(s,c,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:b==null?null:""+b,children:s,containerInfo:c,implementation:h}}function s_(s){if(!s)return Pa;s=s._reactInternals;e:{if(bn(s)!==s||s.tag!==1)throw Error(n(170));var c=s;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(ri(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(s.tag===1){var h=s.type;if(ri(h))return gd(s,h,c)}return c}function o_(s,c,h,b,w,j,z,re,ue){return s=kh(h,b,!0,s,w,j,z,re,ue),s.context=s_(null),h=s.current,b=mi(),w=Os(h),j=is(b,w),j.callback=c??null,As(h,j,w),s.current.lanes=w,vr(s,w,b),Ni(s,b),s}function zd(s,c,h,b){var w=c.current,j=mi(),z=Os(w);return h=s_(h),c.context===null?c.context=h:c.pendingContext=h,c=is(j,z),c.payload={element:s},b=b===void 0?null:b,b!==null&&(c.callback=b),s=As(w,c,z),s!==null&&(va(s,w,z,j),xd(s,w,z)),z}function qd(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 l_(s,c){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var h=s.retryLane;s.retryLane=h!==0&&h<c?h:c}}function _h(s,c){l_(s,c),(s=s.alternate)&&l_(s,c)}function bI(){return null}var c_=typeof reportError=="function"?reportError:function(s){console.error(s)};function wh(s){this._internalRoot=s}Ud.prototype.render=wh.prototype.render=function(s){var c=this._internalRoot;if(c===null)throw Error(n(409));zd(s,c,null,null)},Ud.prototype.unmount=wh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var c=s.containerInfo;jo(function(){zd(null,s,null,null)}),c[ga]=null}};function Ud(s){this._internalRoot=s}Ud.prototype.unstable_scheduleHydration=function(s){if(s){var c=Gr();s={blockedOn:null,target:s,priority:c};for(var h=0;h<Dt.length&&c!==0&&c<Dt[h].priority;h++);Dt.splice(h,0,s),h===0&&ca(s)}};function Eh(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Hd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function u_(){}function vI(s,c,h,b,w){if(w){if(typeof b=="function"){var j=b;b=function(){var Ne=qd(z);j.call(Ne)}}var z=o_(c,b,s,0,null,!1,!1,"",u_);return s._reactRootContainer=z,s[ga]=z.current,go(s.nodeType===8?s.parentNode:s),jo(),z}for(;w=s.lastChild;)s.removeChild(w);if(typeof b=="function"){var re=b;b=function(){var Ne=qd(ue);re.call(Ne)}}var ue=kh(s,0,!1,null,null,!1,!1,"",u_);return s._reactRootContainer=ue,s[ga]=ue.current,go(s.nodeType===8?s.parentNode:s),jo(function(){zd(c,ue,h,b)}),ue}function $d(s,c,h,b,w){var j=h._reactRootContainer;if(j){var z=j;if(typeof w=="function"){var re=w;w=function(){var ue=qd(z);re.call(ue)}}zd(c,z,s,w)}else z=vI(h,c,s,w,b);return qd(z)}Ar=function(s){switch(s.tag){case 3:var c=s.stateNode;if(c.current.memoizedState.isDehydrated){var h=fr(c.pendingLanes);h!==0&&(ei(c,h|1),Ni(c,Hn()),(Rn&6)===0&&(Cl=Hn()+500,L()))}break;case 13:jo(function(){var b=rs(s,1);if(b!==null){var w=mi();va(b,s,1,w)}}),_h(s,1)}},Qn=function(s){if(s.tag===13){var c=rs(s,134217728);if(c!==null){var h=mi();va(c,s,134217728,h)}_h(s,134217728)}},xn=function(s){if(s.tag===13){var c=Os(s),h=rs(s,c);if(h!==null){var b=mi();va(h,s,c,b)}_h(s,c)}},Gr=function(){return un},Kr=function(s,c){var h=un;try{return un=s,c()}finally{un=h}},$t=function(s,c,h){switch(c){case"input":if(rt(s,h),c=h.name,h.type==="radio"&&c!=null){for(h=s;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<h.length;c++){var b=h[c];if(b!==s&&b.form===s.form){var w=xl(b);if(!w)throw Error(n(90));mt(b),rt(b,w)}}}break;case"textarea":De(s,h);break;case"select":c=h.value,c!=null&&Xt(s,!!h.multiple,c,!1)}},Je=gh,Ft=jo;var kI={usingClientEntryPoint:!1,Events:[yo,js,xl,ie,Le,gh]},Gc={findFiberByHostInstance:Xr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},_I={bundleType:Gc.bundleType,version:Gc.version,rendererPackageName:Gc.rendererPackageName,rendererConfig:Gc.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=Br(s),s===null?null:s.stateNode},findFiberByHostInstance:Gc.findFiberByHostInstance||bI,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 Wd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wd.isDisabled&&Wd.supportsFiber)try{Mt=Wd.inject(_I),cn=Wd}catch{}}return Ci.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=kI,Ci.createPortal=function(s,c){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Eh(c))throw Error(n(200));return yI(s,c,null,h)},Ci.createRoot=function(s,c){if(!Eh(s))throw Error(n(299));var h=!1,b="",w=c_;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onRecoverableError!==void 0&&(w=c.onRecoverableError)),c=kh(s,1,!1,null,null,h,!1,b,w),s[ga]=c.current,go(s.nodeType===8?s.parentNode:s),new wh(c)},Ci.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(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=Br(c),s=s===null?null:s.stateNode,s},Ci.flushSync=function(s){return jo(s)},Ci.hydrate=function(s,c,h){if(!Hd(c))throw Error(n(200));return $d(null,s,c,!0,h)},Ci.hydrateRoot=function(s,c,h){if(!Eh(s))throw Error(n(405));var b=h!=null&&h.hydratedSources||null,w=!1,j="",z=c_;if(h!=null&&(h.unstable_strictMode===!0&&(w=!0),h.identifierPrefix!==void 0&&(j=h.identifierPrefix),h.onRecoverableError!==void 0&&(z=h.onRecoverableError)),c=o_(c,null,s,1,h??null,w,!1,j,z),s[ga]=c.current,go(s),b)for(s=0;s<b.length;s++)h=b[s],w=h._getVersion,w=w(h._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[h,w]:c.mutableSourceEagerHydrationData.push(h,w);return new Ud(c)},Ci.render=function(s,c,h){if(!Hd(c))throw Error(n(200));return $d(null,s,c,!1,h)},Ci.unmountComponentAtNode=function(s){if(!Hd(s))throw Error(n(40));return s._reactRootContainer?(jo(function(){$d(null,null,s,!1,function(){s._reactRootContainer=null,s[ga]=null})}),!0):!1},Ci.unstable_batchedUpdates=gh,Ci.unstable_renderSubtreeIntoContainer=function(s,c,h,b){if(!Hd(h))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return $d(s,c,h,!1,b)},Ci.version="18.3.1-next-f1338f8080-20240426",Ci}var y_;function KT(){if(y_)return Ch.exports;y_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ch.exports=TI(),Ch.exports}var b_;function RI(){if(b_)return Gd;b_=1;var e=KT();return Gd.createRoot=e.createRoot,Gd.hydrateRoot=e.hydrateRoot,Gd}var AI=RI();const II=$o(AI),MI="modulepreload",LI=function(e){return"/"+e},v_={},YT=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};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"));a=l(n.map(f=>{if(f=LI(f),f in v_)return;v_[f]=!0;const p=f.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const m=document.createElement("link");if(m.rel=p?"stylesheet":MI,p||(m.as="script"),m.crossOrigin="",m.href=f,d&&m.setAttribute("nonce",d),document.head.appendChild(m),p)return new Promise((x,v)=>{m.addEventListener("load",x),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 a.then(l=>{for(const u of l||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})},ls={"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.hide_chat_input":"Hide chat input","chat.show_chat_input":"Show chat input","chat.monitor_only":"Monitor-only session — chat input is hidden for this seat","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","chat.session_info_title":"Session info","chat.session_info_soul":"Soul file","chat.session_info_soul_default":"Default AGENTS.md walk","chat.session_info_model":"Model","chat.session_info_reasoning":"Reasoning effort","chat.session_info_idle_injection":"Auto-injection","chat.session_info_scheduled":"Scheduled injections","chat.session_info_directory":"Working directory","chat.session_info_view_soul":"View soul","chat.session_info_copied":"Copied","chat.session_info_soul_error":"Could not read the soul file","chat.session_info_soul_loading":"Loading soul file…","chat.session_info_idle_on":"on","chat.session_info_idle_every":"every {s}s","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.","chat.quote_selection":"Quote","chat.copy_selection":"Copy","chat.quote_remove":"Remove quote","chat.quote_clear_all":"Clear all quotes","chat.quoted_from_assistant":"Quoted from assistant","chat.quoted_from_you":"Quoted from you","chat.quote_truncated":"Quote truncated to fit the limit","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_with_google":"Sign in with Google","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.resolve_failed":"Could not reach the question service.","question.retry_connection":"Retry","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.resize":"Resize sidebar","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.icon_pinned":"Pinned — kept at the top and exempt from cleanup","sidebar.icon_archive":"Archive copy — a read-only snapshot of an earlier conversation","sidebar.icon_compacted":"Compacted — older messages were summarized to free context","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.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}","user_menu.capabilities":"Capabilities","capabilities.title":"Capabilities","capabilities.back_to_chat":"Back to chat","capabilities.close":"Close","capabilities.search_placeholder":"Search capabilities…","capabilities.filter_all":"All","capabilities.filter_skill":"Skills","capabilities.filter_mcp":"MCPs","capabilities.no_capabilities":"No capabilities match.","capabilities.no_description":"No description.","capabilities.docs":"Docs","capabilities.docs_missing":"No docs found for this skill.","capabilities.install":"Install","capabilities.update":"Update","capabilities.uninstall":"Uninstall","capabilities.uninstall_confirm":"Confirm uninstall","capabilities.cancel":"Cancel","capabilities.done":"Done.","capabilities.needs_review":"Needs review — tool surface changed after approval","capabilities.requires_mcps":"Requires MCPs","capabilities.composite_installed":"Installed skill {name} with its MCPs","capabilities.changed_tools":"Changed tools (not bridged until re-approval):","capabilities.reapprove":"Re-approve","capabilities.mcp_error":"MCP error","capabilities.token_label":"API token (bearer)","capabilities.token_stored":"token stored","capabilities.token_placeholder":"Paste the token — stored in ~/.pave/tokens.yaml, never in servers.json","capabilities.token_save":"Save token","capabilities.token_clear":"Clear token","capabilities.token_note":"The token is attached only inside the MCP manager; it is never exposed to the model, shell, or skills.","capabilities.bridged":"Bridged tools","capabilities.deferred":"deferred","capabilities.retry":"Retry","capabilities.oauth_connect":"Connect account","capabilities.oauth_pending":"Waiting for authorization… complete it in the browser window that opened.","capabilities.oauth_connected":"Connected. The capability is ready.","capabilities.oauth_reconsent":"Re-consent required: the stored grant cannot be refreshed (or the server url/auth changed). Connect again — the old token is never sent to a new origin."},Ws={en:ls},OI={"zh-TW":()=>YT(()=>import("./zh-TW-BHLe9f3m.js"),[])},Fl=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function k_(e){if(Ws[e])return Ws[e];const t=OI[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),ls;try{const n=await t();return Ws[e]=n.default||n,Ws[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),ls}}function QT(e,t,n){let r=e[t];return r===void 0&&e!==ls&&(r=ls[t]),r===void 0?t:n&&typeof n=="object"?r.replace(/\{(\w+)\}/g,(a,o)=>{const l=n[o];return l!==void 0?String(l):a}):r}const XT=y.createContext(null);function DI({initialLocale:e="en",children:t}){const r=Fl.map(m=>m.code).includes(e)?e:"en",[a,o]=y.useState(r),[l,u]=y.useState(Ws[r]||ls),d=y.useRef(0);y.useEffect(()=>{let m=!1;if(r!=="en"&&!Ws[r]){const x=++d.current;k_(r).then(v=>{if(m||d.current!==x)return;const k=v===ls&&r!=="en"?"en":r;Ws[k]=v,u(v),k!==r&&o(k)})}return()=>{m=!0,d.current+=1}},[]);const f=y.useCallback(async m=>{const x=++d.current,v=await k_(m);if(d.current!==x)return;const k=v===ls&&m!=="en"?"en":m;Ws[k]=v,u(v),o(k);try{localStorage.setItem("pave-locale",k)}catch{}},[]),p=y.useCallback((m,x)=>QT(l,m,x),[l]),g=y.useMemo(()=>({t:p,locale:a,setLocale:f,availableLocales:Fl}),[p,a,f]);return i.jsx(XT.Provider,{value:g,children:t})}function rn(){const e=y.useContext(XT);return e||{t:(t,n)=>QT(ls,t,n),locale:"en",setLocale:()=>{},availableLocales:Fl}}function PI(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&Fl.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=Fl.find(a=>a.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=Fl.find(a=>a.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function FI({darkMode:e,onToggle:t}){const{t:n}=rn();return i.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:n(e?"theme.light":"theme.dark"),"aria-label":n(e?"theme.light":"theme.dark"),"aria-pressed":e,children:e?i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}):i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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 Lv=KT();const BI=$o(Lv);function zI({open:e,onClose:t,onConfirm:n,title:r,message:a,confirmLabel:o,cancelLabel:l,destructive:u}){var{t:d}=rn(),f=y.useRef(null),p=y.useRef(null);if(y.useEffect(function(){e&&p.current&&p.current.focus()},[e]),y.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]),y.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 E=_[0],S=_[_.length-1];k.shiftKey?document.activeElement===E&&(k.preventDefault(),S.focus()):document.activeElement===S&&(k.preventDefault(),E.focus())}}}return document.addEventListener("keydown",v),function(){document.removeEventListener("keydown",v)}},[e]),!e)return null;var g=o||d("confirm_dialog.confirm"),m=l||d("confirm_dialog.cancel"),x=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 i.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-xs transition-opacity duration-150",onClick:function(v){v.target===v.currentTarget&&t()},children:i.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-label":r,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-hidden transition-all duration-150",children:[i.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:i.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r})}),i.jsx("div",{className:"px-5 py-4",children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a})}),i.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[i.jsx("button",{ref:p,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-hidden focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:m}),i.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium rounded-md focus:outline-hidden focus:ring-2 focus:ring-offset-2 "+x,children:g})]})]})})}const ZT=y.createContext(null);function qI({children:e}){var{t}=rn(),n=y.useRef(null),r={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},a=y.useState(r),o=a[0],l=a[1],u=y.useCallback(function(p){n.current&&(n.current(!1),n.current=null);var g=p||{};return new Promise(function(m){n.current=m,l({open:!0,title:g.title||t("confirm_dialog.confirm"),message:g.message||"",confirmLabel:g.confirmLabel||"",cancelLabel:g.cancelLabel||"",destructive:g.destructive||!1})})},[t]),d=y.useCallback(function(){l(r),n.current&&(n.current(!1),n.current=null)},[]),f=y.useCallback(function(){l(r),n.current&&(n.current(!0),n.current=null)},[]);return i.jsxs(ZT.Provider,{value:u,children:[e,i.jsx(zI,{open:o.open,onClose:d,onConfirm:f,title:o.title,message:o.message,confirmLabel:o.confirmLabel,cancelLabel:o.cancelLabel,destructive:o.destructive})]})}function Au(){var e=y.useContext(ZT);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const Hf=180,ku=256,JT=480,UI=360;function e4(e){const n=(Number.isFinite(e)?e:1280)-UI;return Math.min(JT,Math.max(Hf,n))}function Qb(e,t){const n=e4(t),r=Number.isFinite(e)?e:ku;return Math.min(n,Math.max(Hf,Math.round(r)))}function HI(e){if(e==null||e==="")return ku;const t=parseInt(e,10);return!Number.isFinite(t)||t<Hf||t>JT?ku:t}function __(e,t,n){const r=Number.isFinite(e)?e:t;return Math.min(n,Math.max(t,Math.round(r)))}const $I=8,WI=32;function VI({effectiveWidth:e,effectiveMaxWidth:t,minWidth:n=Hf,onCommit:r,getPaneEl:a}){const{t:o}=rn(),l=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=y.useRef(e);f.current=e,y.useEffect(()=>()=>{d.current&&d.current()},[]);const p=m=>{if(m.pointerType==="mouse"&&m.button!==0)return;m.preventDefault();const x=m.currentTarget,v=a?a():null,k=m.clientX,_=f.current;try{x.setPointerCapture(m.pointerId)}catch{}l.current=m.pointerId;const E=document.body.style.cursor,S=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let N=!1;const A=O=>{if(l.current!==null&&O.pointerId!==l.current)return;const M=Qb(_+(O.clientX-k),window.innerWidth);v&&v.style.setProperty("--pave-sidebar-w",M+"px"),u.current=M},T=O=>{if(N)return;N=!0,window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",C),window.removeEventListener("pointercancel",R),window.removeEventListener("lostpointercapture",R),document.body.style.cursor=E,document.body.style.userSelect=S;const M=l.current;if(l.current=null,M!==null)try{x.releasePointerCapture(M)}catch{}O&&u.current!==null?r(u.current):v&&v.style.setProperty("--pave-sidebar-w",f.current+"px"),u.current=null,d.current=null},R=()=>T(!1),C=()=>T(!0);window.addEventListener("pointermove",A),window.addEventListener("pointerup",C),window.addEventListener("pointercancel",R),window.addEventListener("lostpointercapture",R),d.current=()=>T(!1)},g=m=>{const x=m.shiftKey?WI:$I;let v=null;m.key==="ArrowLeft"?v=e-x:m.key==="ArrowRight"?v=e+x:m.key==="Home"?v=n:m.key==="End"&&(v=t),v!==null&&(m.preventDefault(),r(Qb(v,window.innerWidth)))};return i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o("sidebar.resize"),"aria-valuemin":n,"aria-valuemax":t,"aria-valuenow":e,tabIndex:0,onPointerDown:p,onKeyDown:g,className:"hidden md:block absolute right-0 top-0 bottom-0 w-2 z-10 cursor-ew-resize touch-none select-none group",children:i.jsx("div",{className:"pointer-events-none ml-auto h-full w-0.5 bg-current text-gray-500 dark:text-gray-400 opacity-80 group-hover:w-1 group-hover:opacity-100"})})}function GI(e){const t=new Date,n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(n>=r)return"today";const a=new Date(r);if(a.setDate(a.getDate()-1),n>=a)return"yesterday";const o=new Date(r);if(o.setDate(o.getDate()-o.getDay()),n>=o)return"thisWeek";const l=new Date(t.getFullYear(),t.getMonth(),1);return n>=l?"thisMonth":"older"}function KI(e,t){const n={today:[],yesterday:[],thisWeek:[],thisMonth:[],older:[]},r={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=GI(u.time&&u.time.updated?u.time.updated:0);n[d].push(u)}const a=["today","yesterday","thisWeek","thisMonth","older"],o=[];for(let l=0;l<a.length;l++){const u=a[l];n[u].length>0&&o.push({key:u,label:r[u],sessions:n[u]})}return o}function YI(e,t){if(!e)return"";const n=Date.now()-e;if(n<60*1e3)return t("sidebar.age_now");const r=Math.floor(n/(60*1e3));if(r<60)return t("sidebar.age_minutes",{n:r});const a=Math.floor(r/60);if(a<24)return t("sidebar.age_hours",{n:a});const o=Math.floor(a/24);return o<7?t("sidebar.age_days",{n:o}):t("sidebar.age_weeks",{n:Math.floor(o/7)})}function w_(e){return e.source==="archive"||e._readOnly}const QI={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 Io({name:e,className:t}){return i.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:QI[e]})})}function E_({className:e,filled:t}){return i.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:i.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 Rh=216,Kd=8;function XI({anchor:e,items:t,label:n,onClose:r}){const a=y.useRef(null),[o,l]=y.useState(null);y.useEffect(()=>{const d=a.current;if(!d)return;const f=d.offsetHeight;let p=e.align==="right"?e.x-Rh:e.x;p=Math.max(Kd,Math.min(p,window.innerWidth-Rh-Kd));let g=e.y;g+f>window.innerHeight-Kd&&(g=Math.max(Kd,e.flipY-f)),l({left:p,top:g})},[e]),y.useEffect(()=>{if(!o||!a.current)return;const d=a.current.querySelector("[data-menuitem]");d&&d.focus()},[o]),y.useEffect(()=>{function d(p){a.current&&!a.current.contains(p.target)&&r()}function f(p){p.key==="Escape"&&(p.stopPropagation(),r())}return document.addEventListener("mousedown",d),document.addEventListener("keydown",f,!0),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f,!0),window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[r]);const u=d=>{if(d.key!=="ArrowDown"&&d.key!=="ArrowUp")return;d.preventDefault();const f=Array.from(a.current.querySelectorAll("[data-menuitem]"));if(f.length===0)return;const p=f.indexOf(document.activeElement),g=d.key==="ArrowDown"?(p+1)%f.length:(p-1+f.length)%f.length;f[g].focus()};return Lv.createPortal(i.jsx("div",{ref:a,role:"menu","aria-label":n,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:Rh,left:o?o.left:0,top:o?o.top:0,visibility:o?"visible":"hidden"},children:t.map(d=>d.separator?i.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},d.key):i.jsxs("button",{"data-menuitem":"",role:"menuitem",onClick:()=>{r(),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:[i.jsx("span",{className:"shrink-0 opacity-70",children:d.icon}),i.jsx("span",{className:"flex-1 truncate",children:d.label}),d.hint&&i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:d.hint})]},d.key))}),document.body)}function ZI({sessions:e,activeSessionId:t,busySessions:n={},onSelectSession:r,onNewChat:a,onDeleteSession:o,onDeleteAllSessions:l,onRenameSession:u,onRegenerateTitle:d,onPinSession:f,onArchiveSession:p,onExportSession:g,onSendToSession:m,onImportSession:x,onImportError:v,showArchived:k,onToggleShowArchived:_,isOpen:E,onClose:S,onToggle:N,hasMoreSessions:A,onLoadMoreSessions:T,showOtherApps:R,onToggleShowOtherApps:C,hasMoreOtherApps:O,onLoadMoreOtherApps:M,otherAppsCount:I,search:D,onSearchChange:F,loadedCount:ee,totalCount:H,sidebarWidth:P=ku,onSidebarWidthChange:K}){const{t:V}=rn(),Z=Au(),[le,B]=y.useState(D||"");y.useEffect(()=>{typeof D=="string"&&D!==le&&B(D)},[D]);const U=ge=>{B(ge),F&&F(ge)},[Y,q]=y.useState(null),[te,W]=y.useState(""),[$,fe]=y.useState(null),ae=y.useRef(null),xe=y.useRef(null),[Ie,ze]=y.useState(()=>typeof window<"u"?window.innerWidth:1280);y.useEffect(()=>{let ge=0;const ft=()=>{ge||(ge=requestAnimationFrame(()=>{ge=0,ze(window.innerWidth)}))};return window.addEventListener("resize",ft),()=>{window.removeEventListener("resize",ft),ge&&cancelAnimationFrame(ge)}},[]);const mt=Qb(P,Ie),ut=e4(Ie);y.useLayoutEffect(()=>{xe.current&&xe.current.style.setProperty("--pave-sidebar-w",mt+"px")},[mt]);const $e=y.useCallback(()=>xe.current,[]),qe=y.useCallback(()=>{const ge=ae.current;ae.current=null,fe(null),ge&&ge.isConnected&&ge.focus()},[]),Oe=(ge,ft,ht)=>{ae.current=ht||null,fe({id:ge.id,anchor:ft})},rt=le?e.filter(function(ge){return(ge.title||V("sidebar.untitled")).toLowerCase().includes(le.toLowerCase())}):e,{pinnedSessions:ot,regularSessions:At,archivedSessions:sn}=y.useMemo(()=>{const ge=[],ft=[],ht=[];for(let vt=0;vt<rt.length;vt++){const pt=rt[vt];pt.archived?ht.push(pt):pt.pinned?ge.push(pt):ft.push(pt)}return{pinnedSessions:ge,regularSessions:ft,archivedSessions:ht}},[rt]),Xt=y.useMemo(()=>KI(At,V),[At,V]),Ht=ge=>{q(ge.id),W(ge.title||"")},We=ge=>{te.trim()&&u(ge,te.trim()),q(null),W("")},De=async ge=>{!ge.archived&&!await Z({title:V("sidebar.archive"),message:V("sidebar.confirmArchive"),confirmLabel:V("sidebar.archive")})||p(ge.id,!ge.archived)},et=async ge=>{await Z({title:V("sidebar.delete_title"),message:V("sidebar.delete_confirm"),destructive:!0,confirmLabel:V("sidebar.delete")})&&o(ge.id)},nt=ge=>{if(w_(ge))return[];const ft=[{key:"rename",label:V("sidebar.rename"),hint:"F2",icon:i.jsx(Io,{name:"rename",className:"w-4 h-4"}),onSelect:()=>Ht(ge)}];d&&ft.push({key:"regenerate",label:V("sidebar.regenerate_title"),icon:i.jsx(Io,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>d(ge.id)}),g&&ft.push({key:"export",label:V("sidebar.export"),icon:i.jsx(Io,{name:"export",className:"w-4 h-4"}),onSelect:()=>g(ge.id)}),m&&ft.push({key:"send-to-session",label:V("sidebar.send_to_session"),icon:i.jsx(Io,{name:"send",className:"w-4 h-4"}),onSelect:()=>m(ge.id)});const ht=[];return f&&(!ge.archived||ge.pinned)&&ht.push({key:"pin",label:ge.pinned?V("sidebar.unpin"):V("sidebar.pin"),icon:i.jsx(E_,{className:"w-4 h-4",filled:ge.pinned}),onSelect:()=>f(ge.id,!ge.pinned)}),p&&ht.push({key:"archive",label:ge.archived?V("sidebar.unarchive"):V("sidebar.archive"),icon:i.jsx(Io,{name:ge.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>De(ge)}),ht.length>0&&(ft.push({key:"sep-state",separator:!0}),ft.push(...ht)),ft.push({key:"sep-danger",separator:!0}),ft.push({key:"delete",label:V("sidebar.delete"),hint:"Del",danger:!0,icon:i.jsx(Io,{name:"delete",className:"w-4 h-4"}),onSelect:()=>et(ge)}),ft},de=y.useMemo(()=>$&&e.find(ge=>ge.id===$.id)||null,[$,e]);y.useEffect(()=>{$&&!de&&qe()},[$,de,qe]);const _e=(ge,ft)=>{const ht=ft&&ft.dimmed,vt=w_(ge),pt=!!($&&$.id===ge.id),Vt=!vt,Gt=(Ze,qt)=>Oe(ge,Ze,qt);return i.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 ${ge.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":ht?"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:()=>r(ge.id),onContextMenu:Ze=>{!Vt||Y===ge.id||(Ze.preventDefault(),Gt({x:Ze.clientX,y:Ze.clientY,flipY:Ze.clientY,align:"left"},Ze.currentTarget))},onKeyDown:Ze=>{if(Ze.currentTarget===Ze.target){if(Ze.key==="Enter"||Ze.key===" "){Ze.preventDefault(),r(ge.id);return}if(Vt){if(Ze.key==="F2")Ze.preventDefault(),Ht(ge);else if(Ze.key==="Delete")Ze.preventDefault(),et(ge);else if(Ze.key==="ContextMenu"){Ze.preventDefault();const qt=Ze.currentTarget.getBoundingClientRect();Gt({x:qt.right,y:qt.bottom,flipY:qt.top,align:"right"},Ze.currentTarget)}}}},children:Y===ge.id?i.jsx("input",{autoFocus:!0,value:te,onChange:Ze=>W(Ze.target.value),onBlur:()=>We(ge.id),onKeyDown:Ze=>{Ze.key==="Enter"?(Ze.preventDefault(),Ze.stopPropagation(),Ze.currentTarget.blur()):Ze.key==="Escape"?(Ze.stopPropagation(),q(null)):Ze.key===" "&&Ze.stopPropagation()},onClick:Ze=>Ze.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-hidden"}):i.jsxs(i.Fragment,{children:[ge.pinned&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",role:"img",title:V("sidebar.icon_pinned"),"aria-label":V("sidebar.icon_pinned"),children:i.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"})}),ge.source==="archive"&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-blue-400 dark:text-blue-500 opacity-70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",title:V("sidebar.icon_archive"),"aria-label":V("sidebar.icon_archive"),children:i.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"})}),ge.compactedAt&&ge.source!=="archive"&&i.jsx("svg",{className:"w-3 h-3 shrink-0 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",title:V("sidebar.icon_compacted"),"aria-label":V("sidebar.icon_compacted"),children:i.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"})}),n[ge.id]&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse shrink-0",role:"status",title:V("sidebar.session_processing"),"aria-label":V("sidebar.session_processing")}),i.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${ht?"italic":""}`,"data-menu-open":pt?"true":"false",children:[i.jsx("span",{className:"truncate min-w-0",children:ge.title||V("sidebar.untitled")}),ge.archived&&i.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 shrink-0",children:["(",V("sidebar.archived"),")"]})]}),i.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[i.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${pt?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:YI(ge.time&&ge.time.updated,V)}),i.jsxs("div",{className:`items-center gap-0.5 ${pt?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[f&&(!ge.archived||ge.pinned)&&i.jsx("button",{onClick:Ze=>{Ze.stopPropagation(),f(ge.id,!ge.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:ge.pinned?V("sidebar.unpin"):V("sidebar.pin"),"aria-label":ge.pinned?V("sidebar.unpin"):V("sidebar.pin"),children:i.jsx(E_,{className:`w-4 h-4 ${ge.pinned?"text-amber-500":""}`,filled:ge.pinned})}),Vt&&i.jsx("button",{onClick:Ze=>{Ze.stopPropagation();const qt=Ze.currentTarget.getBoundingClientRect();Gt({x:qt.right,y:qt.bottom+4,flipY:qt.top-4,align:"right"},Ze.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${pt?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":V("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":pt,children:i.jsx(Io,{name:"more",className:"w-4 h-4"})})]})]})]})},ge.id)},Ue=ge=>i.jsx("div",{className:"px-2 pt-3 pb-1",children:i.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:ge})});return i.jsxs(i.Fragment,{children:[E&&i.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:S}),!E&&i.jsx("div",{className:"shrink-0 w-10 flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:i.jsx("button",{onClick:N,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:V("sidebar.show"),"aria-label":V("sidebar.show"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),i.jsxs("aside",{ref:xe,className:`
|
|
41
|
-
${E?"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 md:w-[var(--pave-sidebar-w,16rem)] border-r border-gray-200 dark:border-gray-800
|
|
46
|
-
bg-gray-50 dark:bg-gray-900 flex flex-col
|
|
47
|
-
${E?"md:flex":"md:hidden"}
|
|
48
|
-
`,children:[i.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-1",children:[i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium",children:V("sidebar.conversations")}),i.jsx("button",{onClick:N,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:V("sidebar.hide"),"aria-label":V("sidebar.hide"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]}),i.jsxs("div",{className:"px-3 py-2 flex gap-2",children:[i.jsx("button",{onClick:a,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:V("app.new_chat")}),x&&i.jsx("button",{onClick:()=>{const ge=document.createElement("input");ge.type="file",ge.accept=".yaml,.yml",ge.onchange=ft=>{const ht=ft&&ft.target&&ft.target.files,vt=ht&&ht[0];if(vt){const pt=vt.name.toLowerCase();if(!pt.endsWith(".yaml")&&!pt.endsWith(".yml")){v&&v(V("import.invalid_file_type"));return}const Vt=10*1024*1024;if(vt.size>Vt){v&&v(V("import.file_too_large"));return}const Gt=new FileReader;Gt.onload=Ze=>{const qt=Ze&&Ze.target?Ze.target.result:null;if(typeof qt!="string"){v&&v(V("import.read_error"));return}x(qt)},Gt.onerror=()=>{v&&v(V("import.read_error"))},Gt.readAsText(vt)}},ge.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:V("sidebar.import"),"aria-label":V("sidebar.import"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})})]}),i.jsx("div",{className:"px-3 pb-2",children:i.jsx("input",{type:"text",placeholder:V("sidebar.search_placeholder"),value:le,onChange:ge=>U(ge.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-hidden focus:ring-2 focus:ring-primary-500/30"})}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-2",children:[ot.length===0&&Xt.every(ge=>ge.sessions.length===0)&&(!k||sn.length===0)&&i.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:V(le?"sidebar.no_matches":"sidebar.no_conversations")}),ot.length>0&&i.jsxs(i.Fragment,{children:[Ue(V("sidebar.pinned")),ot.map(ge=>_e(ge))]}),Xt.map(ge=>i.jsxs("div",{children:[(ot.length>0||Xt.length>1)&&Ue(ge.label),ge.sessions.map(ft=>_e(ft))]},ge.key)),k&&sn.length>0&&i.jsxs(i.Fragment,{children:[Ue(V("sidebar.archived")),sn.map(ge=>_e(ge,{dimmed:!0}))]}),(A||O)&&(T||M)&&i.jsx("div",{className:"pt-2 pb-1 px-1",children:i.jsxs("button",{onClick:()=>{A&&T&&T(),O&&M&&M()},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:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),typeof H=="number"&&H>0&&typeof ee=="number"?V("sidebar.load_more_count",{loaded:ee+(I||0),total:H+(I||0)}):V("sidebar.load_more")]})}),!A&&!O&&typeof H=="number"&&H>0&&i.jsx("div",{className:"pt-2 pb-1 px-1 text-center text-[11px] text-gray-400 dark:text-gray-500 tabular-nums",children:le?V("sidebar.search_result_count",{total:H+(I||0)}):V("sidebar.all_loaded_count",{total:H+(I||0)})}),C&&i.jsx("div",{className:"pt-2 pb-1 px-1",children:i.jsxs("button",{onClick:C,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:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),V(R?"sidebar.hide_other_apps":"sidebar.show_other_apps")]})}),_&&i.jsx("div",{className:"pt-2 pb-1 px-1",children:i.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:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:k?i.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"}):i.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"})}),V(k?"sidebar.hide_archived":"sidebar.show_archived")]})}),rt.some(function(ge){return ge.source!=="legacy"&&!ge._readOnly})&&l&&i.jsx("div",{className:"pt-3 pb-2 px-1",children:i.jsxs("button",{onClick:async()=>{await Z({title:V("sidebar.delete_all_title"),message:V("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:V("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:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),V("sidebar.delete_all")]})})]}),K&&i.jsx(VI,{effectiveWidth:mt,effectiveMaxWidth:ut,onCommit:K,getPaneEl:$e})]}),$&&de&&i.jsx(XI,{anchor:$.anchor,items:nt(de),label:V("sidebar.more_actions"),onClose:qe})]})}const $s="pave-draft-";function JI(e){return $s+e}function eM(e){if(e)try{localStorage.removeItem(JI(e))}catch{}}function tM(e){const t=new Set;return e.forEach(n=>{n&&n.id&&t.add(n.id)}),t}function nM(e,t,n){return!e||!e.id||t.has(e.id)?!1:Number.isFinite(e.prependedAt)&&e.prependedAt>=n}function S_({fetched:e,current:t,prependsSince:n}={}){const r=Array.isArray(e)?e:[],a=Array.isArray(t)?t:[],o=typeof n=="number"?n:1/0,l=tM(r),u=a.filter(d=>nM(d,l,o));return u.length===0?r:u.concat(r)}function rM(){const e=typeof window<"u"&&window.__PAVE_BASE_PATH__||"";if(typeof e!="string")return"";const t=e.trim().replace(/\/+$/,"");return t?t.charAt(0)==="/"?t:"/"+t:""}function xr(e){const t=rM(),n=typeof e=="string"?e:"";return t?n?t+(n.charAt(0)==="/"?n:"/"+n):t:n}const ia=xr(""),Xb="pave-working-directory";function Bl(){if(typeof window>"u")return null;try{return localStorage.getItem(Xb)||null}catch{return null}}function Ah(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(Xb):localStorage.setItem(Xb,e)}catch{}}const t4="web";let Zb=null;function N_(e){Zb=e}let Yc=null,C_=0;function Ov(){return Yc||(Date.now()<C_?Promise.resolve(!1):(Yc=(async()=>{let e=!1,t=null;try{const n=await fetch(`${ia}/auth/membership/restore`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(n.ok){const r=await n.json().catch(()=>({}));e=!!r.authenticated,t=r.user||null}}catch{e=!1}finally{C_=Date.now()+5e3,Yc=null}try{Zb&&Zb({recovered:e,user:t})}catch{}return e})(),Yc))}function iM(e){return typeof e=="string"&&e.indexOf("/auth/")===0}async function dt(e,t={}){const n=Bl(),r={"Content-Type":"application/json","X-PAVE-Client":t4,...t.headers};n&&(r["x-opencode-directory"]=n);const{headers:a,...o}=t,l=await fetch(`${ia}${e}`,{...o,headers:r});if(!l.ok){l.status===401&&!iM(e)&&Ov();let u=null;try{const f=await l.text();try{u=JSON.parse(f)}catch{u=null}if(!u){const p=new Error(`${l.status}: ${f||l.statusText}`);throw p.status=l.status,p}}catch(f){if(f.message)throw f.status===void 0&&(f.status=l.status),f;const p=new Error(`${l.status}: ${l.statusText}`);throw p.status=l.status,p}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 Pl(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 n=t.toString(),r=n?`/session?${n}`:"/session";return dt(r)}function j_(e){return dt("/session",{method:"POST",body:JSON.stringify({title:void 0})})}function Ih(e){return dt(`/session/${e}`)}function aM(e){return dt(`/session/${e}/soul`)}function qi(e,t){return dt(`/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function sM(e){return dt(`/session/${e}/regenerate-title`,{method:"POST"})}function oM(e,{senderSessionID:t,text:n}){return dt(`/session/${e}/mailbox`,{method:"POST",body:JSON.stringify({senderSessionID:t,text:n})})}function lM(e){return dt(`/session/${e}/fork`,{method:"POST"})}function cM(e){return dt(`/session/${e}`,{method:"DELETE"})}function uM(e){return dt(`/session/${e}/archive/session`,{method:"POST"})}function dM(){return dt("/session",{method:"DELETE"})}function T_(e,t,n){const r=new URLSearchParams;t&&r.set("fresh","1"),n&&n.limit!=null&&r.set("limit",String(n.limit)),n&&n.before&&r.set("before",n.before);const a=r.toString();return dt(`/session/${e}/message${a?"?"+a:""}`)}function Yd(e,t,n,r,a,o){const l={content:t,async:!0};return n&&n.length>0&&(l.parts=n),r&&(l.model=r),a&&(l.agent=a),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),dt(`/session/${e}/message`,{method:"POST",body:JSON.stringify(l)})}function Mh(e){return dt(`/session/${e}/queue`)}function R_(e,t,n){const r={content:t};return n&&n.parts&&(r.parts=n.parts),n&&n.model&&(r.model=n.model),n&&n.agent&&(r.agent=n.agent),n&&n.priority&&(r.priority=n.priority),n&&n.displayContent&&(r.displayContent=n.displayContent),n&&n.moeTopK&&(r.moe_top_k=n.moeTopK),n&&n.reasoningEffort&&(r.reasoning_effort=n.reasoningEffort),n&&n.adaptiveQuality&&(r.adaptive_quality=!0),dt(`/session/${e}/queue`,{method:"POST",body:JSON.stringify(r)})}function A_(e,t){return dt(`/session/${e}/queue/${t}`,{method:"DELETE"})}function fM(e,t){return dt(`/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function pM(e){return dt(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function hM(e){return dt(`/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function gM(e){return dt(`/session/${e}/abort`,{method:"POST"})}function n4(e){return dt(`/session/${e}/idle-injection`)}function mM(e,t){return dt(`/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function xM(e){return dt(`/session/${e}/idle-injection`,{method:"DELETE"})}function yM(e){return dt(`/session/${e}/scheduled-injections`)}function bM(e,t){return dt(`/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function vM(e,t,n){return dt(`/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}function kM(e,t){return dt(`/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function _M(){return dt("/config/providers")}function Jb(){return dt("/api/models/registry")}function wM(){return dt("/auth/status")}function EM(){return dt("/auth/logout",{method:"POST"})}function SM(){return dt("/api/permissions/pending")}function NM(e){return dt(`/api/permissions/confirm/${e}`,{method:"POST"})}function CM(e){return dt(`/api/permissions/deny/${e}`,{method:"POST"})}function jM(){return dt("/api/questions/pending")}function TM(e,t){return dt(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function RM(e){return dt(`/api/questions/${e}/reject`,{method:"POST"})}function Dv(){return dt("/skills")}function AM(){return dt("/capabilities")}function IM(e){return dt(`/capabilities/${encodeURIComponent(e)}/docs`)}function MM(e){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/install`,{method:"POST"})}function LM(e){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/status`)}function OM(e){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/update`,{method:"POST"})}function DM(e,t){return dt(`/capabilities/mcp/${encodeURIComponent(e)}`,{method:"DELETE"})}function PM(e,t,n){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify({access:t,refresh:void 0})})}function FM(e){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function BM(e){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/review`,{method:"POST"})}function zM(e){return dt(`/capabilities/skill/${encodeURIComponent(e)}/install`,{method:"POST"})}function qM(e){return dt(`/capabilities/skill/${encodeURIComponent(e)}`,{method:"DELETE"})}function UM(e){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function HM(e,t){return dt(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/result${t?`?state=${encodeURIComponent(t)}`:""}`)}function $M(){return dt("/skills/commands")}function WM(){return dt("/skills/registry")}function VM(e){return dt(`/skills/${encodeURIComponent(e)}`)}function GM(e){return dt(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function KM(e){return dt(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function YM(){return dt("/skills/check-updates")}function QM(e,t){return dt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function XM(e){return dt(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function ZM(e){return dt(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function r4(){return dt("/api/skill-defaults")}function JM(e){return dt("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function eL(e){return dt(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function tL(e){return dt(`/skills/${encodeURIComponent(e)}/oauth/broker/start`,{method:"POST"})}function nL(e,t){return dt(`/skills/${encodeURIComponent(e)}/oauth/broker/result?flow_id=${encodeURIComponent(t)}`)}function I_(){return dt("/config")}function rL(){return dt("/inspector/sessions")}async function iL(e){const t=Bl(),n={"X-PAVE-Client":t4};t&&(n["x-opencode-directory"]=t);const r=await fetch(`${ia}/inspector/session/${encodeURIComponent(e)}/events`,{headers:n});if(!r.ok){const a=new Error(`${r.status}: ${r.statusText}`);throw a.status=r.status,a}return r.text()}function M_(e,t){return dt(`/inspector/session/${encodeURIComponent(e)}/body/${encodeURIComponent(t)}`)}function aL(e){return dt(`/inspector/session/${encodeURIComponent(e)}`,{method:"DELETE"})}function sL(e){const t=e?"?model="+encodeURIComponent(e):"";return dt("/config/adaptive-quality"+t)}function ev(){return dt("/path")}function L_(e){return dt("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function oL(e){return dt("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function tv(){return dt("/settings")}function lL(e){return dt("/settings",{method:"PUT",body:JSON.stringify(e)})}async function cL(e){const t=await fetch(ia+"/session/"+e+"/export",{credentials:"include"});if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Export failed")}const n=await t.blob(),r=t.headers.get("X-Filename")||"session.yaml",a=URL.createObjectURL(n),o=document.createElement("a");o.href=a,o.download=r,document.body.appendChild(o),o.click(),setTimeout(()=>{URL.revokeObjectURL(a),o.parentNode&&o.parentNode.removeChild(o)},0)}function uL(e){return dt("/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function dL(e,t,n,r){const a=Bl(),o={};a&&(o["x-opencode-directory"]=a),e.type?o["Content-Type"]=e.type:o["Content-Type"]="audio/webm";let l=ia+"/api/transcribe";const u=[];t&&u.push("language="+encodeURIComponent(t)),n&&u.push("model="+encodeURIComponent(n));const d=r&&r.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}),p=await f.text();let g=null;if(p)try{g=JSON.parse(p)}catch{}if(!f.ok){const m=new Error(g&&g.error||"Transcription failed (HTTP "+f.status+")");throw m.status=f.status,m.code=g&&g.code,m.fallback=g&&g.fallback,m}if(!g){const m=new Error("Invalid response from transcription endpoint");throw m.code="invalid_response",m.fallback=!0,m}return g}let Il=null,lu=0;function nv(){const e=Date.now();return Il&&e<lu||(Il=dt("/api/transcribe/config").then(t=>(lu=Date.now()+5e3,t)).catch(t=>{throw Il=null,lu=0,t}),lu=1/0),Il}function fL(e){return Il=null,lu=0,dt("/api/asr/engine",{method:"POST",body:JSON.stringify({engine:e})})}function O_(){return dt("/session/status")}function pL(e){return dt(`/session/${encodeURIComponent(e)}/dlp/status`)}function hL(){return dt("/api/dlp/policy")}function gL(e){return dt("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function mL(e){return(await fetch(`${ia}/api/whatsapp/routing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()}async function xL(e){return(await fetch(`${ia}/api/whatsapp/queue/${e}/pop`,{method:"POST"})).json()}async function D_(e){const t=await fetch(`${ia}/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function yL(e){return(await fetch(`${ia}/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function Lh(e){try{const t=await fetch(`${ia}/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function bL(e){const t=await fetch(`${ia}/session/${e}/plan`,{credentials:"include"});if(!t.ok){const n=new Error(t.status===404?"PLAN.md not found":`${t.status}: ${t.statusText}`);throw n.status=t.status,n}return t.json()}async function P_(e){try{const t=await fetch(`${ia}/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function vL(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 n=t.toString();return dt(`/api/board/topics${n?`?${n}`:""}`)}function F_(e){return dt(`/api/board/topic/${encodeURIComponent(e)}`)}function kL(e){return dt(`/api/board/search?q=${encodeURIComponent(e)}`)}function _L(e){return dt(`/api/board/topic/${encodeURIComponent(e)}`,{method:"DELETE"})}function wL(e,t){return dt(`/api/board/topic/${encodeURIComponent(e)}/post/${encodeURIComponent(t)}`,{method:"DELETE"})}const cs=xr("");async function us(e,t={}){const n=await fetch(e,{credentials:"include",...t});return n.status===401&&await Ov()?fetch(e,{credentials:"include",...t}):n}function $l(e,t){const n=new Error(t);return n.status=e.status,n}async function EL(){const e=await us(cs+"/api/pricing");if(!e.ok)throw $l(e,"Failed to fetch pricing: "+e.statusText);return e.json()}async function SL(e){const t=await us(cs+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw $l(t,n.error||"Failed to update pricing")}return t.json()}async function NL(){const e=await us(cs+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw $l(e,t.error||"Failed to reset pricing")}return e.json()}async function Oh(){const e=await us(cs+"/api/system/updates");if(!e.ok){const t="Failed to check for updates",n=await e.json().catch(()=>({})),r=n.error||n.message||n.output||e.statusText;throw r?r.indexOf(t)===0||r===t?new Error(r):new Error(t+": "+r):new Error(t)}return e.json()}async function CL(){const e=await us(cs+"/api/system/update-config");if(!e.ok)throw new Error("Failed to get update config");return e.json()}async function jL(){const e=await us(cs+"/api/system/update",{method:"POST"});if(!e.ok){const n="Failed to perform update",r=await e.json().catch(()=>({})),a=r.error||r.message||r.output||e.statusText;throw a?a.indexOf(n)===0||a===n?new Error(a):new Error(n+": "+a):new Error(n)}const t=await e.json();if(t.status!=="success"){let n=t.error||t.message||"";throw t.output&&!t.error&&!t.message?n="Update returned status: "+(t.status||"failed")+(t.output?": "+t.output:""):t.output&&(n+=t.output?" ("+t.output+")":""),n||(n="Update returned unexpected status: "+(t.status||"unknown")),new Error(n)}return t}async function B_(e,t){const n=await us(cs+"/api/models/registry",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw $l(n,r.error||"Failed to save model: "+n.statusText)}return n.json()}async function z_(e){const t=await us(cs+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw $l(t,n.error||"Failed to delete model: "+t.statusText)}return t.json()}async function TL(){const e=await us(cs+"/api/models");if(!e.ok)throw $l(e,"Failed to fetch models: "+e.statusText);return e.json()}function RL(e){var t=e&&(e.client||e.source)||"";return t==="web"?"Web":t==="agent"?"Agent":t==="tui"?"TUI":t==="acp"?"Studio":t||"Unknown"}function AL({open:e,onClose:t,senderSessionID:n}){var{t:r}=rn(),a=y.useRef(null),o=y.useRef(null),l=y.useState([]),u=l[0],d=l[1],f=y.useState(""),p=f[0],g=f[1],m=y.useState(""),x=m[0],v=m[1],k=y.useState(!1),_=k[0],E=k[1],S=y.useState(""),N=S[0],A=S[1],T=y.useState(!1),R=T[0],C=T[1];y.useEffect(function(){if(e){var I=!1;return A(""),C(!1),v(""),Pl({includeOtherApps:!0,limit:100}).then(function(D){if(!I){var F=Array.isArray(D)?D:D&&D.sessions||[],ee=F.filter(function(H){return H&&H.id!==n});d(ee),g(ee.length?ee[0].id:"")}}).catch(function(D){I||A(D&&D.message?D.message:String(D))}),function(){I=!0}}},[e,n]),y.useEffect(function(){e&&o.current&&o.current.focus()},[e]),y.useEffect(function(){if(!e)return;function I(D){D.key==="Escape"&&(typeof D.preventDefault=="function"&&D.preventDefault(),typeof D.stopImmediatePropagation=="function"?D.stopImmediatePropagation():typeof D.stopPropagation=="function"&&D.stopPropagation(),t())}return document.addEventListener("keydown",I,!0),function(){document.removeEventListener("keydown",I,!0)}},[e,t]);var O=y.useCallback(function(){!p||!x.trim()||_||(E(!0),A(""),oM(p,{senderSessionID:n,text:x}).then(function(){E(!1),C(!0)}).catch(function(I){E(!1),A(I&&I.message?I.message:String(I))}))},[p,x,_,n]);if(!e)return null;var M=!!p&&!!x.trim()&&!_;return i.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-xs transition-opacity duration-150",onClick:function(I){I.target===I.currentTarget&&t()},children:i.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":r("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-hidden transition-all duration-150",children:[i.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:i.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("send_to_session.title")})}),i.jsxs("div",{className:"px-5 py-4 space-y-3",children:[R?i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("send_to_session.queued")}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.target_label"),i.jsx("select",{value:p,onChange:function(I){g(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 i.jsx("option",{value:I.id,children:(I.title||I.id)+" — "+RL(I)},I.id)})})]}),u.length===0?i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r("send_to_session.no_targets")}):null,i.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.message_label"),i.jsx("textarea",{ref:o,value:x,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"})]}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("send_to_session.delivery_note")})]}),N?i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",role:"alert",children:N}):null]}),i.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[i.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-hidden focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:r(R?"send_to_session.close":"send_to_session.cancel")}),R?null:i.jsx("button",{type:"button",onClick:O,disabled:!M,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-hidden focus:ring-2 focus:ring-offset-2",children:r(_?"send_to_session.sending":"send_to_session.send")})]})]})})}const $f=0,Gs=1,Wl=2,i4=4;function q_(e){return()=>e}function IL(e){e()}function a4(e,t){return n=>e(t(n))}function U_(e,t){return()=>e(t)}function ML(e,t){return n=>e(t,n)}function Pv(e){return e!==void 0}function LL(...e){return()=>{e.map(IL)}}function Vl(){}function Wf(e,t){return t(e),e}function OL(e,t){return t(e)}function er(...e){return e}function On(e,t){return e(Gs,t)}function dn(e,t){e($f,t)}function Fv(e){e(Wl)}function nr(e){return e(i4)}function zt(e,t){return On(e,ML(t,$f))}function _a(e,t){const n=e(Gs,r=>{n(),t(r)});return n}function H_(e){let t,n;return r=>a=>{t=a,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function s4(e,t){return e===t}function Jn(e=s4){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function en(e){return t=>n=>{e(n)&&t(n)}}function Nt(e){return t=>a4(t,e)}function Wa(e){return t=>()=>{t(e)}}function Xe(e,...t){const n=DL(...t);return((r,a)=>{switch(r){case Wl:Fv(e);return;case Gs:return On(e,n(a))}})}function Va(e,t){return n=>r=>{n(t=e(t,r))}}function Uo(e){return t=>n=>{e>0?e--:t(n)}}function os(e){let t=null,n;return r=>a=>{t=a,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function mn(...e){const t=Array.from({length:e.length});let n=0,r=null;const a=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;On(o,d=>{const f=n;n|=u,t[l]=d,f!==a&&n===a&&r&&(r(),r=null)})}),o=>l=>{const u=()=>{o([l].concat(t))};n===a?u():r=u}}function DL(...e){return t=>e.reduceRight(OL,t)}function PL(e){let t,n;const r=()=>t==null?void 0:t();return function(a,o){switch(a){case Gs:return o?n===o?void 0:(r(),n=o,t=On(e,o),t):(r(),Vl);case Wl:r(),n=null;return}}}function lt(e){let t=e;const n=Sn();return((r,a)=>{switch(r){case $f:t=a;break;case Gs:{a(t);break}case i4:return t}return n(r,a)})}function ci(e,t){return Wf(lt(t),n=>zt(e,n))}function Sn(){const e=[];return((t,n)=>{switch(t){case $f:e.slice().forEach(r=>{r(n)});return;case Wl:e.splice(0);return;case Gs:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Wi(e){return Wf(Sn(),t=>zt(e,t))}const FL={singleton:!0};function Ln(e,t=[],n=FL){const{singleton:r}=n;return{constructor:e,dependencies:t,id:BL(),singleton:r}}const BL=()=>Symbol("id");function zL(e){const t=new Map,n=({constructor:r,dependencies:a,id:o,singleton:l})=>{if(l&&t.has(o))return t.get(o);const u=r(a.map(d=>n(d)));return l&&t.set(o,u),u};return n(e)}function mr(...e){const t=Sn(),n=Array.from({length:e.length});let r=0;const a=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;On(o,d=>{n[l]=d,r|=u,r===a&&dn(t,n)})}),function(o,l){switch(o){case Wl:{Fv(t);return}case Gs:return r===a&&l(n),On(t,l)}}}function Jt(e,t=s4){return Xe(e,Jn(t))}function rv(...e){return function(t,n){switch(t){case Wl:return;case Gs:return LL(...e.map(r=>On(r,n)))}}}const Pr={DEBUG:0,INFO:1,WARN:2,ERROR:3},qL={[Pr.DEBUG]:"debug",[Pr.ERROR]:"error",[Pr.INFO]:"log",[Pr.WARN]:"warn"},UL=()=>typeof globalThis>"u"?window:globalThis,Ks=Ln(()=>{const e=lt(Pr.ERROR);return{log:lt((t,n,r=Pr.INFO)=>{const a=UL().VIRTUOSO_LOG_LEVEL??nr(e);r>=a&&console[qL[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function HL(e){return"self"in e?e.document.documentElement:e}function o4(e){const t=HL(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl"}function Po(e,t){return o4(e)?-t:t}function $_(e,t){return o4(e)?-t:t}function Wo(e,t,n){return Bv(e,t,n).callbackRef}function Bv(e,t,n){const r=Lt.useRef(null);let a=l=>{};const o=Lt.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(l=>{const u=()=>{const d=l[0].target;d.offsetParent!==null&&e(d)};n?u():requestAnimationFrame(u)}):null,[e,n]);return a=l=>{l&&t?(o==null||o.observe(l),r.current=l):(r.current&&(o==null||o.unobserve(r.current)),r.current=null)},{callbackRef:a,ref:r}}function $L(e,t,n,r,a,o,l,u,d){const f=Lt.useCallback(p=>{var S;const g=WL(p.children,t,u?"offsetWidth":"offsetHeight",a);let m=p.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const x=((S=m.lastElementChild)==null?void 0:S.dataset.viewportType)==="window";let v;x&&(v=m.ownerDocument.defaultView);const k=l?u?l.scrollWidth:l.scrollHeight:x?u?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight:u?m.scrollWidth:m.scrollHeight,_=l?u?l.offsetWidth:l.offsetHeight:x?u?v.innerWidth:v.innerHeight:u?m.offsetWidth:m.offsetHeight,E=l?u?Po(l,l.scrollLeft):l.scrollTop:x?u?Po(v,v.scrollX||v.document.documentElement.scrollLeft):v.scrollY||v.document.documentElement.scrollTop:u?Po(m,m.scrollLeft):m.scrollTop;r({scrollHeight:k,scrollTop:Math.max(E,0),viewportHeight:_}),o==null||o(u?W_("column-gap",getComputedStyle(p).columnGap,a):W_("row-gap",getComputedStyle(p).rowGap,a)),g!==null&&e(g)},[e,t,a,o,l,r,u]);return Bv(f,n,d)}function WL(e,t,n,r){const a=e.length;if(a===0)return null;const o=[];for(let l=0;l<a;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),p=t(u,n);if(p===0&&r("Zero-sized element, this should not happen",{child:u},Pr.ERROR),p===f)continue;const g=o[o.length-1];o.length===0||g.size!==p||g.endIndex!==d-1?o.push({endIndex:d,size:p,startIndex:d}):o[o.length-1].endIndex++}return o}function W_(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Pr.WARN),t==="normal"?0:parseInt(t??"0",10)}const zv=typeof document>"u"?Lt.useEffect:Lt.useLayoutEffect;function l4(e,t,n){const r=Lt.useRef(null),a=Lt.useCallback(d=>{if(!(d!=null&&d.offsetParent))return;const f=d.getBoundingClientRect(),p=f.width;let g,m;if(t){const x=t.getBoundingClientRect(),v=f.top-x.top;m=x.height-Math.max(0,v),g=v+t.scrollTop}else{const x=l.current.ownerDocument.defaultView;m=x.innerHeight-Math.max(0,f.top),g=f.top+x.scrollY}r.current={listHeight:f.height,offsetTop:g,visibleHeight:m,visibleWidth:p},e(r.current)},[e,t]),{callbackRef:o,ref:l}=Bv(a,!0,n),u=Lt.useCallback(()=>{a(l.current)},[a,l]);return Lt.useEffect(()=>{var f;if(t){t.addEventListener("scroll",u);const p=new ResizeObserver(()=>{requestAnimationFrame(u)});return p.observe(t),()=>{t.removeEventListener("scroll",u),p.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 bi=Ln(()=>{const e=Sn(),t=Sn(),n=lt(0),r=Sn(),a=Sn(),o=lt(0),l=Sn(),u=Sn(),d=lt(0),f=lt(0),p=lt(0),g=lt(0),m=Sn(),x=Sn(),v=lt(!1),k=lt(!1),_=lt(!1);return zt(Xe(e,Nt(({scrollTop:E})=>E)),t),zt(Xe(e,Nt(({scrollHeight:E})=>E)),u),zt(t,o),{deviation:n,deviationCommitted:r,fixedFooterHeight:p,fixedHeaderHeight:f,footerHeight:g,headerHeight:d,horizontalDirection:k,scrollBy:x,scrollContainerState:e,scrollHeight:u,scrollingInProgress:v,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:_,smoothScrollTargetReached:a,statefulScrollTop:o,viewportHeight:l}},[],{singleton:!0}),_u={lvl:0};function c4(e,t){const n=e.length;if(n===0)return[];let{index:r,value:a}=t(e[0]);const o=[];for(let l=1;l<n;l++){const{index:u,value:d}=t(e[l]);o.push({end:u-1,start:r,value:a}),r=u,a=d}return o.push({end:1/0,start:r,value:a}),o}function Un(e){return e===_u}function wu(e,t){if(!Un(e))return t===e.k?e.v:t<e.k?wu(e.l,t):wu(e.r,t)}function Sa(e,t,n="k"){if(Un(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Sa(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Sa(e.l,t,n)}function Hi(e,t,n){return Un(e)?f4(t,n,1):t===e.k?Dr(e,{k:t,v:n}):t<e.k?V_(Dr(e,{l:Hi(e.l,t,n)})):V_(Dr(e,{r:Hi(e.r,t,n)}))}function zl(){return _u}function ql(e,t,n){if(Un(e))return[];const r=Sa(e,t)[0];return VL(av(e,r,n))}function iv(e,t){if(Un(e))return _u;const{k:n,l:r,r:a}=e;if(t===n){if(Un(r))return a;if(Un(a))return r;const[o,l]=d4(r);return yf(Dr(e,{k:o,l:u4(r),v:l}))}return t<n?yf(Dr(e,{l:iv(r,t)})):yf(Dr(e,{r:iv(a,t)}))}function Fo(e){return Un(e)?[]:[...Fo(e.l),{k:e.k,v:e.v},...Fo(e.r)]}function av(e,t,n){if(Un(e))return[];const{k:r,l:a,r:o,v:l}=e;let u=[];return r>t&&(u=u.concat(av(a,t,n))),r>=t&&r<=n&&u.push({k:r,v:l}),r<=n&&(u=u.concat(av(o,t,n))),u}function yf(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Dh(t))return p4(Dr(e,{lvl:n-1}));if(!Un(t)&&!Un(t.r))return Dr(t.r,{l:Dr(t,{r:t.r.l}),lvl:n,r:Dr(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Dh(e))return sv(Dr(e,{lvl:n-1}));if(!Un(r)&&!Un(r.l)){const a=r.l,o=Dh(a)?r.lvl-1:r.lvl;return Dr(a,{l:Dr(e,{lvl:n-1,r:a.l}),lvl:a.lvl+1,r:sv(Dr(r,{l:a.r,lvl:o}))})}throw new Error("Unexpected empty nodes")}function Dr(e,t){return f4(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 u4(e){return Un(e.r)?e.l:yf(Dr(e,{r:u4(e.r)}))}function Dh(e){return Un(e)||e.lvl>e.r.lvl}function d4(e){return Un(e.r)?[e.k,e.v]:d4(e.r)}function f4(e,t,n,r=_u,a=_u){return{k:e,l:r,lvl:n,r:a,v:t}}function V_(e){return sv(p4(e))}function p4(e){const{l:t}=e;return!Un(t)&&t.lvl===e.lvl?Dr(t,{r:Dr(e,{l:t.r})}):e}function sv(e){const{lvl:t,r:n}=e;return!Un(n)&&!Un(n.r)&&n.lvl===t&&n.r.lvl===t?Dr(n,{l:Dr(e,{r:n.l}),lvl:t+1}):e}function VL(e){return c4(e,({k:t,v:n})=>({index:t,value:n}))}function h4(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Eu(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const qv=Ln(()=>({recalcInProgress:lt(!1)}),[],{singleton:!0});function g4(e,t,n){return e[Cf(e,t,n)]}function Cf(e,t,n,r=0){let a=e.length-1;for(;r<=a;){const o=Math.floor((r+a)/2),l=e[o],u=n(l,t);if(u===0)return o;if(u===-1){if(a-r<2)return o-1;a=o-1}else{if(a===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function GL(e,t,n,r){const a=Cf(e,t,r),o=Cf(e,n,r,a);return e.slice(a,o+1)}function Vs(e,t){return Math.round(e.getBoundingClientRect()[t])}function Vf(e){return!Un(e.groupOffsetTree)}function Uv({index:e},t){return t===e?0:t<e?-1:1}function KL(){return{groupIndices:[],groupOffsetTree:zl(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:zl()}}function YL(e,t){let n=Un(e)?0:1/0;for(const r of t){const{endIndex:a,size:o,startIndex:l}=r;if(n=Math.min(n,l),Un(e)){e=Hi(e,0,o);continue}const u=ql(e,l-1,a+1);if(u.some(n3(r)))continue;let d=!1,f=!1;for(const{end:p,start:g,value:m}of u)d?(a>=g||o===m)&&(e=iv(e,g)):(f=m!==o,d=!0),p>a&&a>=g&&m!==o&&(e=Hi(e,a+1,m));f&&(e=Hi(e,l,o))}return[e,n]}function QL(e){return e.groupIndex!==void 0}function XL({offset:e},t){return t===e?0:t<e?-1:1}function Su(e,t,n){if(t.length===0)return 0;const{index:r,offset:a,size:o}=g4(t,e,Uv),l=e-r,u=o*l+(l-1)*n+a;return u>0?u+n:u}function m4(e,t){if(!Vf(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function x4(e,t,n){if(QL(e))return t.groupIndices[e.groupIndex]+1;const r=e.index==="LAST"?n:e.index;let a=m4(r,t);return a=Math.max(0,Math.min(n,a)),a}function ZL(e,t,n,r=0){return r>0&&(t=Math.max(t,g4(e,r,Uv).offset)),c4(GL(e,t,n,XL),t3)}function JL(e,[t,n,r,a]){t.length>0&&r("received item sizes",t,Pr.DEBUG);const o=e.sizeTree;let l=o,u=0;if(n.length>0&&Un(o)&&t.length===2){const m=t[0].size,x=t[1].size;l=n.reduce((v,k)=>Hi(Hi(v,k,m),k+1,x),l)}else[l,u]=YL(l,t);if(l===o)return e;const{lastIndex:d,lastOffset:f,lastSize:p,offsetTree:g}=ov(e.offsetTree,u,l,a);return{groupIndices:n,groupOffsetTree:n.reduce((m,x)=>Hi(m,x,Su(x,g,a)),zl()),lastIndex:d,lastOffset:f,lastSize:p,offsetTree:g,sizeTree:l}}function e3(e){return Fo(e).map(({k:t,v:n},r,a)=>{const o=a[r+1];return{endIndex:o===void 0?1/0:o.k-1,size:n,startIndex:t}})}function G_(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function ov(e,t,n,r){let a=e,o=0,l=0,u=0,d=0;if(t===0)a=[];else{d=Cf(a,t-1,Uv),u=a[d].offset;const f=Sa(n,t-1);o=f[0],l=f[1],a.length&&a[d].size===Sa(n,t)[1]&&(d-=1),a=a.slice(0,d+1)}for(const{start:f,value:p}of ql(n,t,1/0)){const g=f-o,m=g*l+u+g*r;a.push({index:f,offset:m,size:p}),o=f,u=m,l=p}return{lastIndex:o,lastOffset:u,lastSize:l,offsetTree:a}}function t3(e){return{index:e.index,value:e}}function n3(e){const{endIndex:t,size:n,startIndex:r}=e;return a=>a.start===r&&(a.end===t||a.end===1/0)&&a.value===n}const r3={offsetHeight:"height",offsetWidth:"width"},Ga=Ln(([{log:e},{recalcInProgress:t}])=>{const n=Sn(),r=Sn(),a=ci(r,0),o=Sn(),l=Sn(),u=lt(0),d=lt([]),f=lt(void 0),p=lt(void 0),g=lt(void 0),m=lt(void 0),x=lt((C,O)=>Vs(C,r3[O])),v=lt(void 0),k=lt(0),_=KL(),E=ci(Xe(n,mn(d,e,k),Va(JL,_),Jn()),_),S=ci(Xe(d,Jn(),Va((C,O)=>({current:O,prev:C.current}),{current:[],prev:[]}),Nt(({prev:C})=>C)),[]);zt(Xe(d,en(C=>C.length>0),mn(E,k),Nt(([C,O,M])=>{const I=C.reduce((D,F,ee)=>Hi(D,F,Su(F,O.offsetTree,M)||ee),zl());return{...O,groupIndices:C,groupOffsetTree:I}})),E),zt(Xe(r,mn(E),en(([C,{lastIndex:O}])=>C<O),Nt(([C,{lastIndex:O,lastSize:M}])=>[{endIndex:O,size:M,startIndex:C}])),n),zt(f,p);const N=ci(Xe(f,Nt(C=>C===void 0)),!0);zt(Xe(p,en(C=>C!==void 0&&Un(nr(E).sizeTree)),Nt(C=>{const O=nr(g),M=nr(d).length>0;return O!==void 0&&O!==0?M?[{endIndex:0,size:O,startIndex:0},{endIndex:1,size:C,startIndex:1}]:[]:[{endIndex:0,size:C,startIndex:0}]})),n),zt(Xe(m,en(C=>C!==void 0&&C.length>0&&Un(nr(E).sizeTree)),Nt(C=>{const O=[];let M=C[0],I=0;for(let D=1;D<C.length;D++){const F=C[D];F!==M&&(O.push({endIndex:D-1,size:M,startIndex:I}),M=F,I=D)}return O.push({endIndex:C.length-1,size:M,startIndex:I}),O})),n),zt(Xe(d,mn(g,p),en(([,C,O])=>C!==void 0&&O!==void 0),Nt(([C,O,M])=>{const I=[];for(let D=0;D<C.length;D++){const F=C[D],ee=C[D+1];I.push({startIndex:F,endIndex:F,size:O}),ee!==void 0&&I.push({startIndex:F+1,endIndex:ee-1,size:M})}return I})),n);const A=Wi(Xe(n,mn(E),Va(({sizes:C},[O,M])=>({changed:M!==C,sizes:M}),{changed:!1,sizes:_}),Nt(C=>C.changed)));On(Xe(u,Va((C,O)=>({diff:C.prev-O,prev:O}),{diff:0,prev:0}),Nt(C=>C.diff)),C=>{const{groupIndices:O}=nr(E);if(C>0)dn(t,!0),dn(o,C+G_(C,O));else if(C<0){const M=nr(S);M.length>0&&(C-=G_(-C,M)),dn(l,C)}}),On(Xe(u,mn(e)),([C,O])=>{C<0&&O("`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},Pr.ERROR)});const T=Wi(o);zt(Xe(o,mn(E),Nt(([C,O])=>{const M=O.groupIndices.length>0,I=[],D=O.lastSize;if(M){const F=wu(O.sizeTree,0);let ee=0,H=0;for(;ee<C;){const K=O.groupIndices[H],V=O.groupIndices.length===H+1?1/0:O.groupIndices[H+1]-K-1;I.push({endIndex:K,size:F,startIndex:K}),I.push({endIndex:K+1+V-1,size:D,startIndex:K+1}),H++,ee+=V+1}const P=Fo(O.sizeTree);return ee!==C&&P.shift(),P.reduce((K,{k:V,v:Z})=>{let le=K.ranges;return K.prevSize!==0&&(le=[...K.ranges,{endIndex:V+C-1,size:K.prevSize,startIndex:K.prevIndex}]),{prevIndex:V+C,prevSize:Z,ranges:le}},{prevIndex:C,prevSize:0,ranges:I}).ranges}return Fo(O.sizeTree).reduce((F,{k:ee,v:H})=>({prevIndex:ee+C,prevSize:H,ranges:[...F.ranges,{endIndex:ee+C-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:D,ranges:[]}).ranges})),n);const R=Wi(Xe(l,mn(E,k),Nt(([C,{offsetTree:O},M])=>{const I=-C;return Su(I,O,M)})));return zt(Xe(l,mn(E,k),Nt(([C,O,M])=>{if(O.groupIndices.length>0){if(Un(O.sizeTree))return O;let D=zl();const F=nr(S);let ee=0,H=0,P=0;for(;ee<-C;){P=F[H];const K=F[H+1]-P-1;H++,ee+=K+1}if(D=Fo(O.sizeTree).reduce((K,{k:V,v:Z})=>Hi(K,Math.max(0,V+C),Z),D),ee!==-C){const K=wu(O.sizeTree,P);D=Hi(D,0,K);const V=Sa(O.sizeTree,-C+1)[1];D=Hi(D,1,V)}return{...O,sizeTree:D,...ov(O.offsetTree,0,D,M)}}const I=Fo(O.sizeTree).reduce((D,{k:F,v:ee})=>Hi(D,Math.max(0,F+C),ee),zl());return{...O,sizeTree:I,...ov(O.offsetTree,0,I,M)}})),E),{beforeUnshiftWith:T,data:v,defaultItemSize:p,firstItemIndex:u,fixedItemSize:f,fixedGroupSize:g,gap:k,groupIndices:d,heightEstimates:m,itemSize:x,listRefresh:A,shiftWith:l,shiftWithOffset:R,sizeRanges:n,sizes:E,statefulTotalCount:a,totalCount:r,trackItemSizes:N,unshiftWith:o}},er(Ks,qv),{singleton:!0});function i3(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const y4=Ln(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:a}])=>{const o=Sn(),l=Sn(),u=Wi(Xe(o,Nt(i3)));return zt(Xe(u,Nt(d=>d.totalCount)),n),zt(Xe(u,Nt(d=>d.groupIndices)),e),zt(Xe(mr(a,t,r),en(([d,f])=>Vf(f)),Nt(([d,f,p])=>Sa(f.groupOffsetTree,Math.max(d-p,0),"v")[0]),Jn(),Nt(d=>[d])),l),{groupCounts:o,topItemsIndexes:l}},er(Ga,bi)),Ys=Ln(([{log:e}])=>{const t=lt(!1),n=Wi(Xe(t,en(r=>r),Jn()));return On(t,r=>{r&&nr(e)("props updated",{},Pr.DEBUG)}),{didMount:n,propsReady:t}},er(Ks),{singleton:!0}),a3=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function b4(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!a3)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const Iu=Ln(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:a,fixedHeaderHeight:o,footerHeight:l,headerHeight:u,scrollingInProgress:d,scrollTo:f,smoothScrollTargetReached:p,viewportHeight:g},{log:m}])=>{const x=Sn(),v=Sn(),k=lt(0);let _=null,E=null,S=null;function N(){_!==null&&(_(),_=null),S!==null&&(S(),S=null),E&&(clearTimeout(E),E=null),dn(d,!1)}return zt(Xe(x,mn(n,g,r,k,u,l,m),mn(e,o,a),Nt(([[A,T,R,C,O,M,I,D],F,ee,H])=>{const P=b4(A),{align:K,behavior:V,offset:Z}=P,le=C-1,B=x4(P,T,le);let U=Su(B,T.offsetTree,F)+M;K==="end"?(U+=ee+Sa(T.sizeTree,B)[1]-R+H,B===le&&(U+=I)):K==="center"?U+=(ee+Sa(T.sizeTree,B)[1]-R+H)/2:U-=O,Z!==void 0&&Z!==0&&(U+=Z);const Y=q=>{N(),q?(D("retrying to scroll to",{location:A},Pr.DEBUG),dn(x,A)):(dn(v,!0),D("list did not change, scroll successful",{},Pr.DEBUG))};if(N(),V==="smooth"){let q=!1;S=On(t,te=>{q=q||te}),_=_a(p,()=>{Y(q)})}else _=_a(Xe(t,s3(150)),Y);return E=setTimeout(()=>{N()},1200),dn(d,!0),D("scrolling from index to",{behavior:V,index:B,top:U},Pr.DEBUG),{behavior:V,top:U}})),f),{scrollTargetReached:v,scrollToIndex:x,topListHeight:k}},er(Ga,bi,Ks),{singleton:!0});function s3(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function Hv(e,t){e===0?t():requestAnimationFrame(()=>{Hv(e-1,t)})}function $v(e,t){if(e===void 0)return 0;const n=t-1,r=typeof e=="number"?e:e.index==="LAST"?n:e.index;return Math.max(0,Math.min(r,n))}function lv(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 Mu=Ln(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:a,scrollToIndex:o},{didMount:l}])=>{const u=lt(!0),d=lt(0),f=lt(!0);return zt(Xe(l,mn(d),en(([p,g])=>!lv(g)),Wa(!1)),u),zt(Xe(l,mn(d),en(([p,g])=>!lv(g)),Wa(!1)),f),On(Xe(mr(t,l),mn(u,n,e,f),en(([[,p],g,{sizeTree:m},x,v])=>p&&(!Un(m)||Pv(x))&&!g&&!v),mn(d)),([,p])=>{if(p===void 0){dn(u,!0),dn(f,!0);return}_a(a,()=>{dn(f,!0)}),Hv(4,()=>{_a(r,()=>{dn(u,!0)}),dn(o,p)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:d,scrolledToInitialItem:u}},er(Ga,bi,Iu,Ys),{singleton:!0});function v4(e,t){return Math.abs(e-t)<1.01}const Nu="up",pu="down",o3="none",l3={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},c3=0,Lu=Ln(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:a,viewportHeight:o}])=>{const l=lt(!1),u=lt(!0),d=Sn(),f=Sn(),p=lt(4),g=lt(c3),m=ci(Xe(rv(Xe(Jt(a),Uo(1),Wa(!0)),Xe(Jt(a),Uo(1),Wa(!1),H_(100))),Jn()),!1),x=ci(Xe(rv(Xe(n,Wa(!0)),Xe(n,Wa(!1),H_(200))),Jn()),!1);zt(Xe(mr(Jt(a),Jt(g)),Nt(([S,N])=>S<=N),Jn()),u),zt(Xe(u,os(50)),f);const v=Wi(Xe(mr(r,Jt(o),Jt(t),Jt(e),Jt(p)),Va((S,[{scrollHeight:N,scrollTop:A},T,R,C,O])=>{const M=A+T-N>-O,I={scrollHeight:N,scrollTop:A,viewportHeight:T};if(M){let F,ee;return A>S.state.scrollTop?(F="SCROLLED_DOWN",ee=S.state.scrollTop-A):(F="SIZE_DECREASED",ee=S.state.scrollTop-A||S.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:ee,state:I}}let D;return I.scrollHeight>S.state.scrollHeight?D="SIZE_INCREASED":T<S.state.viewportHeight?D="VIEWPORT_HEIGHT_DECREASING":A<S.state.scrollTop?D="SCROLLING_UPWARDS":D="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:D,state:I}},l3),Jn((S,N)=>S!==void 0&&S.atBottom===N.atBottom))),k=ci(Xe(r,Va((S,{scrollHeight:N,scrollTop:A,viewportHeight:T})=>{if(!v4(S.scrollHeight,N)){const R=N-(A+T)<1;return S.scrollTop!==A&&R?{changed:!0,jump:S.scrollTop-A,scrollHeight:N,scrollTop:A}:{changed:!0,jump:0,scrollHeight:N,scrollTop:A}}return{changed:!1,jump:0,scrollHeight:N,scrollTop:A}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),en(S=>S.changed),Nt(S=>S.jump)),0);zt(Xe(v,Nt(S=>S.atBottom)),l),zt(Xe(l,os(50)),d);const _=lt(pu);zt(Xe(r,Nt(({scrollTop:S})=>S),Jn(),Va((S,N)=>nr(x)?{direction:S.direction,prevScrollTop:N}:{direction:N<S.prevScrollTop?Nu:pu,prevScrollTop:N},{direction:pu,prevScrollTop:0}),Nt(S=>S.direction)),_),zt(Xe(r,os(50),Wa(o3)),_);const E=lt(0);return zt(Xe(m,en(S=>!S),Wa(0)),E),zt(Xe(a,os(100),mn(m),en(([S,N])=>N),Va(([S,N],[A])=>[N,A],[0,0]),Nt(([S,N])=>N-S)),E),{atBottomState:v,atBottomStateChange:d,atBottomThreshold:p,atTopStateChange:f,atTopThreshold:g,isAtBottom:l,isAtTop:u,isScrolling:m,lastJumpDueToItemResize:k,scrollDirection:_,scrollVelocity:E}},er(bi)),Cu="top",ju="bottom",K_="none";function Y_(e,t,n){return typeof e=="number"?n===Nu&&t===Cu||n===pu&&t===ju?e:0:n===Nu?t===Cu?e.main:e.reverse:t===ju?e.main:e.reverse}function Q_(e,t){return typeof e=="number"?e:e[t]??0}const Wv=Ln(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:a}])=>{const o=Sn(),l=lt(0),u=lt(0),d=lt(0),f=ci(Xe(mr(Jt(r),Jt(a),Jt(n),Jt(o,Eu),Jt(d),Jt(l),Jt(t),Jt(e),Jt(u)),Nt(([p,g,m,[x,v],k,_,E,S,N])=>{const A=p-S,T=_+E,R=Math.max(m-A,0);let C=K_;const O=Q_(N,Cu),M=Q_(N,ju);return x-=S,x+=m+E,v+=m+E,v-=S,x>p+T-O&&(C=Nu),v<p-R+g+M&&(C=pu),C!==K_?[Math.max(A-m-Y_(k,Cu,C)-O,0),A-R-E+g+Y_(k,ju,C)+M]:null}),en(p=>p!==null),Jn(Eu)),[0,0]);return{increaseViewportBy:u,listBoundary:o,overscan:d,topListHeight:l,visibleRange:f}},er(bi),{singleton:!0});function u3(e,t,n){if(Vf(t)){const r=m4(e,t);return[{index:Sa(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Ph={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function bf(e,t,n,r,a,o){const{lastIndex:l,lastOffset:u,lastSize:d}=a;let f=0,p=0;if(e.length>0){f=e[0].offset;const k=e[e.length-1];p=k.offset+k.size}const g=n-l,m=u+g*d+(g-1)*r,x=f,v=m-p;return{bottom:p,firstItemIndex:o,items:X_(e,a,o),offsetBottom:v,offsetTop:f,top:x,topItems:X_(t,a,o),topListHeight:t.reduce((k,_)=>_.size+k,0),totalCount:n}}function k4(e,t,n,r,a,o){let l=0;if(n.groupIndices.length>0)for(const x of n.groupIndices){if(x-l>=e)break;l++}const u=e+l,d=o!==void 0,f=(o==null?void 0:o.length)??0,p=$v(t,d?f:u),g=d?Math.max(0,Math.min(u,f-p)):u,m=Array.from({length:g}).map((x,v)=>({data:o==null?void 0:o[v+p],index:v+p,offset:0,size:0}));return bf(m,[],g,a,n,r)}function X_(e,t,n){if(e.length===0)return[];if(!Vf(t))return e.map(f=>({...f,index:f.index+n,originalIndex:f.index}));const r=e[0].index,a=e[e.length-1].index,o=[],l=ql(t.groupOffsetTree,r,a);let u,d=0;for(const f of e){(!u||u.end<f.index)&&(u=l.shift(),d=t.groupIndices.indexOf(u.start));let p;f.index===u.start?p={index:d,type:"group"}:p={groupIndex:d,index:f.index-(d+1)+n},o.push({...p,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 Vo=Ln(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:a},o,{listBoundary:l,topListHeight:u,visibleRange:d},{initialTopMostItemIndex:f,scrolledToInitialItem:p},{topListHeight:g},m,{didMount:x},{recalcInProgress:v}])=>{const k=lt([]),_=lt(0),E=Sn(),S=lt(0);zt(o.topItemsIndexes,k);const N=ci(Xe(mr(x,v,Jt(d,Eu),Jt(a),Jt(r),Jt(f),p,Jt(k),Jt(t),Jt(n),Jt(S),e,Jt(_)),en(([C,O,,M,,,,,,,,I])=>{const D=I!==void 0&&I.length!==M;return C&&!O&&!D}),Nt(([,,[C,O],M,I,D,F,ee,H,P,K,V,Z])=>{var xe,Ie;const le=I,{offsetTree:B,sizeTree:U}=le;if(M===0)return{...Ph,totalCount:M};if(C===0&&O===0)return Z===0?{...Ph,totalCount:M}:k4(Z,D,I,H,P,V);if(Un(U))return Z>0?null:bf(u3($v(D,M),le,V),[],M,P,le,H);const Y=[];if(ee.length>0){const ze=ee[0],mt=ee[ee.length-1];let ut=0;for(const $e of ql(U,ze,mt)){const qe=$e.value,Oe=Math.max($e.start,ze),rt=Math.min($e.end,mt);for(let ot=Oe;ot<=rt;ot++)Y.push({data:V==null?void 0:V[ot],index:ot,offset:ut,size:qe}),ut+=qe}}if(!F)return bf([],Y,M,P,le,H);const q=ee.length>0?ee[ee.length-1]+1:0,te=ZL(B,C,O,q);if(te.length===0)return null;const W=M-1,$=Wf([],ze=>{for(const mt of te){const ut=mt.value;let $e=ut.offset,qe=mt.start;const Oe=ut.size;if(ut.offset<C){qe+=Math.floor((C-ut.offset+P)/(Oe+P));const ot=qe-mt.start;$e+=ot*Oe+ot*P}qe<q&&($e+=(q-qe)*Oe,qe=q);const rt=Math.min(mt.end,W);for(let ot=qe;ot<=rt&&!($e>=O);ot++)ze.push({data:V==null?void 0:V[ot],index:ot,offset:$e,size:Oe}),$e+=Oe+P}}),fe=Z_(K,Cu),ae=Z_(K,ju);if($.length>0&&(fe>0||ae>0)){const ze=$[0],mt=$[$.length-1];if(fe>0&&ze.index>q){const ut=Math.min(fe,ze.index-q),$e=[];let qe=ze.offset;for(let Oe=ze.index-1;Oe>=ze.index-ut;Oe--){const rt=((xe=ql(U,Oe,Oe)[0])==null?void 0:xe.value)??ze.size;qe-=rt+P,$e.unshift({data:V==null?void 0:V[Oe],index:Oe,offset:qe,size:rt})}$.unshift(...$e)}if(ae>0&&mt.index<W){const ut=Math.min(ae,W-mt.index);let $e=mt.offset+mt.size+P;for(let qe=mt.index+1;qe<=mt.index+ut;qe++){const Oe=((Ie=ql(U,qe,qe)[0])==null?void 0:Ie.value)??mt.size;$.push({data:V==null?void 0:V[qe],index:qe,offset:$e,size:Oe}),$e+=Oe+P}}}return bf($,Y,M,P,le,H)}),en(C=>C!==null),Jn()),Ph);zt(Xe(e,en(Pv),Nt(C=>C==null?void 0:C.length)),a),zt(Xe(N,Nt(C=>C.topListHeight)),g),zt(g,u),zt(Xe(N,Nt(C=>[C.top,C.bottom])),l),zt(Xe(N,Nt(C=>C.items)),E);const A=Wi(Xe(N,en(({items:C})=>C.length>0),mn(a,e),en(([{items:C},O])=>C[C.length-1].originalIndex===O-1),Nt(([,C,O])=>[C-1,O]),Jn(Eu),Nt(([C])=>C))),T=Wi(Xe(N,os(200),en(({items:C,topItems:O})=>C.length>0&&C[0].originalIndex===O.length),Nt(({items:C})=>C[0].index),Jn())),R=Wi(Xe(N,en(({items:C})=>C.length>0),Nt(({items:C})=>{let O=0,M=C.length-1;for(;C[O].type==="group"&&O<M;)O++;for(;C[M].type==="group"&&M>O;)M--;return{endIndex:C[M].index,startIndex:C[O].index}}),Jn(h4)));return{endReached:A,initialItemCount:_,itemsRendered:E,listState:N,minOverscanItemCount:S,rangeChanged:R,startReached:T,topItemsIndexes:k,...m}},er(Ga,y4,Wv,Mu,Iu,Lu,Ys,qv),{singleton:!0}),_4=Ln(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:a}])=>{const o=Sn(),l=ci(Xe(mr(n,e,r,t,a),Nt(([u,d,f,p,g])=>u+d+f+p+g.offsetBottom+g.bottom)),0);return zt(Jt(l),o),{totalListHeight:l,totalListHeightChanged:o}},er(bi,Vo),{singleton:!0}),d3=Ln(([{viewportHeight:e},{totalListHeight:t}])=>{const n=lt(!1),r=ci(Xe(mr(n,e,t),en(([a])=>a),Nt(([,a,o])=>Math.max(0,a-o)),os(0),Jn()),0);return{alignToBottom:n,paddingTopAddition:r}},er(bi,_4),{singleton:!0}),w4=Ln(()=>({context:lt(null)})),f3=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...a},viewportBottom:o,viewportTop:l})=>t<l?{...a,align:n??"start",...r===void 0?{}:{behavior:r}}:e>o?{...a,align:n??"end",...r===void 0?{}:{behavior:r}}:null,E4=Ln(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:a,headerHeight:o,scrollingInProgress:l,scrollTop:u,viewportHeight:d},{scrollToIndex:f}])=>{const p=Sn();return zt(Xe(p,mn(t,d,n,o,a,r,u),mn(e),Nt(([[g,m,x,v,k,_,E,S],N])=>{const{calculateViewLocation:A=f3,done:T,...R}=g,C=x4(g,m,v-1),O=Su(C,m.offsetTree,N)+k+_,M=O+Sa(m.sizeTree,C)[1],I=S+_,D=S+x-E,F=A({itemBottom:M,itemTop:O,locationParams:R,viewportBottom:D,viewportTop:I});return F===null?T==null||T():T&&_a(Xe(l,en(ee=>!ee),Uo(nr(l)?1:2)),T),F}),en(g=>g!==null)),f),{scrollIntoView:p}},er(Ga,bi,Iu,Vo,Ks),{singleton:!0});function J_(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const p3=(e,t)=>typeof e=="function"?J_(e(t)):t&&J_(e),h3=Ln(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:a,isAtBottom:o},{scrollToIndex:l},{scrolledToInitialItem:u},{didMount:d,propsReady:f},{log:p},{scrollingInProgress:g},{context:m},{scrollIntoView:x}])=>{const v=lt(!1),k=Sn();let _=null;function E(T){dn(l,{align:"end",behavior:T,index:"LAST"})}On(Xe(mr(Xe(Jt(t),Uo(1)),d),mn(Jt(v),o,u,g),Nt(([[T,R],C,O,M,I])=>{let D=R&&M,F="auto";return D&&(F=p3(C,O||I),D=D&&F!==!1),{followOutputBehavior:F,shouldFollow:D,totalCount:T}}),en(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:R})=>{_!==null&&(_(),_=null),nr(n)===void 0?_=_a(e,()=>{nr(p)("following output to ",{totalCount:R},Pr.DEBUG),E(T),_=null}):requestAnimationFrame(()=>{nr(p)("following output to ",{totalCount:R},Pr.DEBUG),E(T)})});function S(T){const R=_a(a,C=>{T&&!C.atBottom&&C.notAtBottomBecause==="SIZE_INCREASED"&&_===null&&(nr(p)("scrolling to bottom due to increased size",{},Pr.DEBUG),E("auto"))});setTimeout(R,100)}On(Xe(mr(Jt(v),t,f),en(([T,,R])=>T!==!1&&R),Va(({value:T},[,R])=>({refreshed:T===R,value:R}),{refreshed:!1,value:0}),en(({refreshed:T})=>T),mn(v,t)),([,T])=>{nr(u)&&S(T!==!1)}),On(k,()=>{S(nr(v)!==!1)}),On(mr(Jt(v),a),([T,R])=>{T!==!1&&!R.atBottom&&R.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&E("auto")});const N=lt(null),A=Sn();return zt(rv(Xe(Jt(r),Nt(T=>(T==null?void 0:T.length)??0)),Xe(Jt(t))),A),On(Xe(mr(Xe(A,Uo(1)),d),mn(Jt(N),u,g,m),Nt(([[T,R],C,O,M,I])=>R&&O&&(C==null?void 0:C({context:I,totalCount:T,scrollingInProgress:M}))),en(T=>!!T),os(0)),T=>{_!==null&&(_(),_=null),nr(n)===void 0?_=_a(e,()=>{nr(p)("scrolling into view",{}),dn(x,T),_=null}):requestAnimationFrame(()=>{nr(p)("scrolling into view",{}),dn(x,T)})}),{autoscrollToBottom:k,followOutput:v,scrollIntoViewOnChange:N}},er(Ga,Lu,Iu,Mu,Ys,Ks,bi,w4,E4)),g3=Ln(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:a},{initialItemCount:o,listState:l},{didMount:u}])=>(zt(Xe(u,mn(o),en(([,d])=>d!==0),mn(a,r,t,n,e),Nt(([[,d],f,p,g,m,x])=>k4(d,f,p,g,m,x))),l),{}),er(Ga,Mu,Vo,Ys),{singleton:!0}),m3=Ln(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=lt(0);return On(Xe(e,mn(r),en(([,a])=>a!==0),Nt(([,a])=>({top:a}))),a=>{_a(Xe(n,Uo(1),en(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{dn(t,a)})})}),{initialScrollTop:r}},er(Ys,bi,Vo),{singleton:!0}),S4=Ln(([{scrollVelocity:e}])=>{const t=lt(!1),n=Sn(),r=lt(!1);return zt(Xe(e,mn(r,t,n),en(([a,o])=>o!==!1&&o!==void 0),Nt(([a,o,l,u])=>{const{enter:d,exit:f}=o;if(l){if(f(a,u))return!1}else if(d(a,u))return!0;return l}),Jn()),t),On(Xe(mr(t,e,n),mn(r)),([[a,o,l],u])=>{a&&u!==!1&&u!==void 0&&u.change&&u.change(o,l)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},er(Lu),{singleton:!0}),Vv=Ln(([{scrollContainerState:e,scrollTo:t}])=>{const n=Sn(),r=Sn(),a=Sn(),o=lt(!1),l=lt(void 0);return zt(Xe(mr(n,r),Nt(([{scrollTop:u,viewportHeight:d},{offsetTop:f,listHeight:p}])=>({scrollHeight:p,scrollTop:Math.max(0,u-f),viewportHeight:d}))),e),zt(Xe(t,mn(r),Nt(([u,{offsetTop:d}])=>({...u,top:u.top+d}))),a),{customScrollParent:l,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:a,windowViewportRect:r}},er(bi)),x3=Ln(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:a},{didMount:o},{useWindowScroll:l,windowScrollContainerState:u,windowViewportRect:d}])=>{const f=Sn(),p=lt(void 0),g=lt(null),m=lt(null);return zt(u,g),zt(d,m),On(Xe(f,mn(t,r,l,g,m,n)),([x,v,k,_,E,S,N])=>{const A=e3(v.sizeTree);_&&E!==null&&S!==null&&(k=E.scrollTop-S.offsetTop),k-=N,x({ranges:A,scrollTop:k})}),zt(Xe(p,en(Pv),Nt(y3)),a),zt(Xe(o,mn(p),en(([,x])=>x!==void 0),Jn(),Nt(([,x])=>x.ranges)),e),{getState:f,restoreStateFrom:p}},er(Ga,bi,Mu,Ys,Vv));function y3(e){return{align:"start",index:0,offset:e.scrollTop}}const b3=Ln(([{topItemsIndexes:e}])=>{const t=lt(0);return zt(Xe(t,en(n=>n>=0),Nt(n=>Array.from({length:n}).map((r,a)=>a))),e),{topItemCount:t}},er(Vo));function N4(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const v3=N4(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),k3=Ln(([{deviation:e,deviationCommitted:t,scrollBy:n,scrollingInProgress:r,scrollTop:a},{isAtBottom:o,isScrolling:l,lastJumpDueToItemResize:u,scrollDirection:d},{listState:f},{beforeUnshiftWith:p,gap:g,shiftWithOffset:m,sizes:x},{log:v},{recalcInProgress:k}])=>{const _=Wi(Xe(f,mn(u),Va(([,A,T,R],[{bottom:C,items:O,offsetBottom:M,totalCount:I},D])=>{const F=C+M;let ee=0;return T===I&&A.length>0&&O.length>0&&(O[0].originalIndex===0&&A[0].originalIndex===0||(ee=F-R,ee!==0&&(ee+=D))),[ee,O,I,F]},[0,[],0,0]),en(([A])=>A!==0),mn(a,d,r,o,v,k),en(([,A,T,R,,,C])=>!C&&!R&&A!==0&&T===Nu),Nt(([[A],,,,,T])=>(T("Upward scrolling compensation",{amount:A},Pr.DEBUG),A))));function E(A){A>0?(dn(n,{behavior:"auto",top:-A}),dn(e,0)):(dn(e,0),dn(n,{behavior:"auto",top:-A}))}On(Xe(_,mn(e,l)),([A,T,R])=>{R&&v3()?dn(e,T-A):E(-A)}),On(Xe(mr(ci(l,!1),e,k),en(([A,T,R])=>!A&&!R&&T!==0),Nt(([A,T])=>T),os(1)),E),zt(Xe(m,Nt(A=>({top:-A}))),n);let S=null;function N(){if(S===null)return;const{offset:A}=S;S=null,dn(n,{top:A}),requestAnimationFrame(()=>{dn(e,0),dn(k,!1)})}return On(t,A=>{S===null||!S.acknowledgeable||A===S.offset&&N()}),On(Xe(p,mn(x,g),Nt(([A,{groupIndices:T,lastSize:R,sizeTree:C},O])=>{function M(H){return H*(R+O)}if(T.length===0)return M(A);let I=0;const D=wu(C,0);let F=0,ee=0;for(;F<A;){F++,I+=D;let H=T.length===ee+1?1/0:T[ee+1]-T[ee]-1;F+H>A&&(I-=D,H=A-F+1),F+=H,I+=M(H),ee++}return I})),A=>{S={acknowledgeable:nr(e)!==A,offset:A},dn(e,A),requestAnimationFrame(N)}),{deviation:e}},er(bi,Lu,Vo,Ga,Ks,qv)),_3=Ln(([e,t,n,r,a,o,l,u,d,f,p])=>({...e,...t,...n,...r,...a,...o,...l,...u,...d,...f,...p}),er(Wv,g3,Ys,S4,_4,m3,d3,Vv,E4,Ks,w4)),C4=Ln(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:a,gap:o,groupIndices:l,heightEstimates:u,itemSize:d,sizeRanges:f,sizes:p,statefulTotalCount:g,totalCount:m,trackItemSizes:x},{initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_},E,S,N,A,{scrollToIndex:T},R,{topItemCount:C},{groupCounts:O},M])=>{const{listState:I,minOverscanItemCount:D,topItemsIndexes:F,rangeChanged:ee,...H}=A;return zt(ee,M.scrollSeekRangeChanged),zt(Xe(mr(M.windowViewportRect,E.headerHeight,E.fixedHeaderHeight),Nt(([P,K,V])=>Math.max(K+V+1,P.visibleHeight))),E.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:a,gap:o,groupCounts:O,heightEstimates:u,initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_,sizeRanges:f,topItemCount:C,topItemsIndexes:F,totalCount:m,...N,groupIndices:l,itemSize:d,listState:I,minOverscanItemCount:D,scrollToIndex:T,statefulTotalCount:g,trackItemSizes:x,rangeChanged:ee,...H,...M,...E,sizes:p,...S}},er(Ga,Mu,bi,x3,h3,Vo,Iu,k3,b3,y4,_3));function w3(e,t){const n={},r={};let a=0;const o=e.length;for(;a<o;)r[e[a]]=1,a+=1;for(const l in t)Object.hasOwn(r,l)||(n[l]=t[l]);return n}const Qd=typeof document>"u"?Lt.useEffect:Lt.useLayoutEffect;function j4(e,t,n){const r=Object.keys(t.required||{}),a=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),u=Lt.createContext({});function d(_,E){_.propsReady!==void 0&&dn(_.propsReady,!1);for(const S of r){const N=_[t.required[S]];dn(N,E[S])}for(const S of a)if(S in E){const N=_[t.optional[S]];dn(N,E[S])}_.propsReady!==void 0&&dn(_.propsReady,!0)}function f(_){return o.reduce((E,S)=>(E[S]=N=>{const A=_[t.methods[S]];dn(A,N)},E),{})}function p(_){return l.reduce((E,S)=>(E[S]=PL(_[t.events[S]]),E),{})}const g=Lt.forwardRef(function(_,E){const{children:S,...N}=_,[A]=Lt.useState(()=>Wf(zL(e),C=>{d(C,N)})),[T]=Lt.useState(U_(p,A));Qd(()=>{for(const C of l)C in N&&On(T[C],N[C]);return()=>{Object.values(T).map(Fv)}},[N,T,A]),Qd(()=>{d(A,N)}),Lt.useImperativeHandle(E,q_(f(A)));const R=n;return i.jsx(u.Provider,{value:A,children:n===void 0?S:i.jsx(R,{...w3([...r,...a,...l],N),children:S})})}),m=_=>{const E=Lt.useContext(u);return Lt.useCallback(S=>{dn(E[_],S)},[E,_])},x=_=>{const E=Lt.useContext(u)[_],S=Lt.useCallback(N=>On(E,N),[E]);return Lt.useSyncExternalStore(S,()=>nr(E),()=>nr(E))},v=_=>{const E=Lt.useContext(u)[_],[S,N]=Lt.useState(U_(nr,E));return Qd(()=>On(E,A=>{A!==S&&N(q_(A))}),[E,S]),S},k=parseInt(Lt.version,10)>=18?x:v;return{Component:g,useEmitter:(_,E)=>{const S=Lt.useContext(u)[_];Qd(()=>On(S,E),[E,S])},useEmitterValue:k,usePublisher:m}}const T4=Lt.createContext(void 0),R4=Lt.createContext(void 0),Fh="-webkit-sticky",ew="sticky",Gv=N4(()=>{if(typeof document>"u")return ew;const e=document.createElement("div");return e.style.position=Fh,e.style.position===Fh?Fh:ew});function Bh(e){return"self"in e}function E3(e){return"body"in e}function A4(e,t,n,r=Vl,a,o){const l=Lt.useRef(null),u=Lt.useRef(null),d=Lt.useRef(null),f=Lt.useCallback(g=>{let m,x,v;const k=g.target;if(E3(k)||Bh(k)){const E=Bh(k)?k:k.defaultView;v=o===!0?Po(E,E.scrollX):E.scrollY,m=o===!0?E.document.documentElement.scrollWidth:E.document.documentElement.scrollHeight,x=o===!0?E.innerWidth:E.innerHeight}else v=o===!0?Po(k,k.scrollLeft):k.scrollTop,m=o===!0?k.scrollWidth:k.scrollHeight,x=o===!0?k.offsetWidth:k.offsetHeight;const _=()=>{e({scrollHeight:m,scrollTop:Math.max(v,0),viewportHeight:x})};g.suppressFlushSync===!0?_():BI.flushSync(_),u.current!==null&&(v===u.current||v<=0||v===m-x)&&(u.current=null,t(!0),d.current&&(clearTimeout(d.current),d.current=null))},[e,t,o]);Lt.useEffect(()=>{const g=a??l.current;return r(a??l.current),f({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",f,{passive:!0}),()=>{r(null),g.removeEventListener("scroll",f)}},[l,f,n,r,a]);function p(g){const m=l.current;if(!m||(o===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const x=g.behavior==="smooth";let v,k,_;Bh(m)?(k=Math.max(Vs(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?Po(m,m.scrollX):m.scrollY):(k=m[o===!0?"scrollWidth":"scrollHeight"],v=Vs(m,o===!0?"width":"height"),_=o===!0?Po(m,m.scrollLeft):m.scrollTop);const E=k-v;if(g.top===void 0){m.scrollTo(g);return}const S=Math.ceil(Math.max(Math.min(E,g.top),0));if(g.top=S,v4(v,k)||S===_){e({scrollHeight:k,scrollTop:_,viewportHeight:v}),x&&t(!0);return}x?(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&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},left:$_(m,S)}),m.scrollTo(g)}return{scrollByCallback:Lt.useCallback(g=>{o===!0&&(g={...g.behavior===void 0?{}:{behavior:g.behavior},...g.top===void 0?{}:{left:$_(l.current,g.top)}}),l.current.scrollBy(g)},[o]),scrollerRef:l,scrollToCallback:p}}function Kv(e){return e}const S3=Ln(()=>{const e=lt(u=>`Item ${u}`),t=lt(u=>`Group ${u}`),n=lt({}),r=lt(Kv),a=lt("div"),o=lt(Vl),l=(u,d=null)=>ci(Xe(n,Nt(f=>f[u]),Jn()),d);return{components:n,computeItemKey:r,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:a,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),N3=Ln(([e,t])=>({...e,...t}),er(C4,S3)),C3=({height:e})=>i.jsx("div",{style:{height:e}}),j3={overflowAnchor:"none",position:Gv(),zIndex:1},I4={overflowAnchor:"none"},T3={...I4,display:"inline-block",height:"100%"},tw=Lt.memo(function({showTopList:e=!1}){const t=an("listState"),n=$i("sizeRanges"),r=an("useWindowScroll"),a=an("customScrollParent"),o=$i("windowScrollContainerState"),l=$i("scrollContainerState"),u=a||r?o:l,d=an("itemContent"),f=an("context"),p=an("groupContent"),g=an("trackItemSizes"),m=an("itemSize"),x=an("log"),v=$i("gap"),k=an("horizontalDirection"),{callbackRef:_}=$L(n,m,g,e?Vl:u,x,v,a,k,an("skipAnimationFrameInResizeObserver")),[E,S]=Lt.useState(0);Qv("deviation",P=>{E!==P&&S(P)});const N=$i("deviationCommitted");zv(()=>{N(E)},[E,N]);const A=an("EmptyPlaceholder"),T=an("ScrollSeekPlaceholder")??C3,R=an("ListComponent"),C=an("ItemComponent"),O=an("GroupComponent"),M=an("computeItemKey"),I=an("isSeeking"),D=an("groupIndices").length>0,F=an("alignToBottom"),ee=an("initialItemFinalLocationReached"),H=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginInlineStart:E===0?F?"auto":0:E,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:E===0?F?"auto":0:E,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...ee?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&A!==null&&A!==void 0?i.jsx(A,{...li(A,f)}):i.jsx(R,{...li(R,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:_,style:H,children:(e?t.topItems:t.items).map(P=>{const K=P.originalIndex,V=M(K+t.firstItemIndex,P.data,f);return I?y.createElement(T,{...li(T,f),height:P.size,index:P.index,key:V,type:P.type||"item",...P.type==="group"?{}:{groupIndex:P.groupIndex}}):P.type==="group"?y.createElement(O,{...li(O,f),"data-index":K,"data-item-index":P.index,"data-known-size":P.size,key:V,style:j3},p(P.index,f)):y.createElement(C,{...li(C,f),...M3(C,P.data),"data-index":K,"data-item-group-index":P.groupIndex,"data-item-index":P.index,"data-known-size":P.size,key:V,style:k?T3:I4},D?d(P.index,P.groupIndex,P.data,f):d(P.index,P.data,f))})})}),R3={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},A3={outline:"none",overflowX:"auto",position:"relative"},Yv=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),M4=(e,t,n=0)=>({...Yv(e),position:t?"relative":"absolute",top:t?-n:0}),I3={position:Gv(),top:0,width:"100%",zIndex:1};function li(e,t){if(typeof e!="string")return{context:t}}function M3(e,t){return{item:typeof e=="string"?void 0:t}}const L3=Lt.memo(function(){const e=an("HeaderComponent"),t=$i("headerHeight"),n=an("HeaderFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Vs(o,"height"))},[t]),!0,an("skipAnimationFrameInResizeObserver")),a=an("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...li(e,a)})}):null}),O3=Lt.memo(function(){const e=an("FooterComponent"),t=$i("footerHeight"),n=an("HeaderFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Vs(o,"height"))},[t]),!0,an("skipAnimationFrameInResizeObserver")),a=an("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...li(e,a)})}):null});function L4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Lt.memo(function({children:r,style:a,context:o,...l}){const u=n("scrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("scrollerRef"),g=t("horizontalDirection")||!1,{scrollByCallback:m,scrollerRef:x,scrollToCallback:v}=A4(u,f,d,p,void 0,g);return e("scrollTo",v),e("scrollBy",m),i.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...g?A3:R3,...a},tabIndex:0,...l,...li(d,o),children:r})})}function O4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Lt.memo(function({children:r,style:a,context:o,...l}){const u=n("windowScrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("totalListHeight"),g=t("deviation"),m=t("customScrollParent"),x=Lt.useRef(null),v=t("scrollerRef"),{scrollByCallback:k,scrollerRef:_,scrollToCallback:E}=A4(u,f,d,v,m);return zv(()=>{var S;return _.current=m??((S=x.current)==null?void 0:S.ownerDocument.defaultView),()=>{_.current=null}},[_,m]),e("windowScrollTo",E),e("scrollBy",k),i.jsx(d,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...p===0?void 0:{height:p+g}},...l,...li(d,o),children:r})})}const D3=({children:e})=>{const t=Lt.useContext(T4),n=$i("viewportHeight"),r=$i("fixedItemHeight"),a=an("alignToBottom"),o=an("horizontalDirection"),l=Lt.useMemo(()=>a4(n,d=>Vs(d,o?"width":"height")),[n,o]),u=Wo(l,!0,an("skipAnimationFrameInResizeObserver"));return Lt.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),i.jsx("div",{"data-viewport-type":"element",ref:u,style:Yv(a),children:e})},P3=({children:e})=>{const t=Lt.useContext(T4),n=$i("windowViewportRect"),r=$i("fixedItemHeight"),a=an("customScrollParent"),o=an("useWindowScroll"),l=an("topListHeight"),u=l4(n,a,an("skipAnimationFrameInResizeObserver")),d=an("alignToBottom");return Lt.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),i.jsx("div",{"data-viewport-type":"window",ref:u,style:M4(d,o,l),children:e})},F3=({children:e})=>{const t=an("TopItemListComponent")??"div",n=an("headerHeight"),r={...I3,marginTop:`${n}px`},a=an("context");return i.jsx(t,{style:r,...li(t,a),children:e})},B3=Lt.memo(function(e){const t=an("useWindowScroll"),n=an("topItemsIndexes").length>0,r=an("customScrollParent"),a=an("context");return i.jsxs(r||t?U3:q3,{...e,context:a,children:[n&&i.jsx(F3,{children:i.jsx(tw,{showTopList:!0})}),i.jsxs(r||t?P3:D3,{children:[i.jsx(L3,{}),i.jsx(tw,{}),i.jsx(O3,{})]})]})}),{Component:z3,useEmitter:Qv,useEmitterValue:an,usePublisher:$i}=j4(N3,{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"}},B3),q3=L4({useEmitter:Qv,useEmitterValue:an,usePublisher:$i}),U3=O4({useEmitter:Qv,useEmitterValue:an,usePublisher:$i}),D4=z3,H3=Ln(()=>{const e=lt(f=>i.jsxs("td",{children:["Item $",f]})),t=lt(null),n=lt(f=>i.jsxs("td",{colSpan:1e3,children:["Group ",f]})),r=lt(null),a=lt(null),o=lt({}),l=lt(Kv),u=lt(Vl),d=(f,p=null)=>ci(Xe(o,Nt(g=>g[f]),Jn()),p);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:d("EmptyPlaceholder"),FillerRow:d("FillerRow"),fixedFooterContent:a,fixedHeaderContent:r,itemContent:e,groupContent:n,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")}});er(C4,H3);Gv();const nw={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},$3={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:rw,floor:jf,max:hu,min:zh,round:iw}=Math;function aw(e,t,n){return Array.from({length:t-e+1}).map((r,a)=>({data:n===null?null:n[a+e],index:a+e}))}function W3(e){return{...$3,items:e}}function Xd(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function V3(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const G3=Ln(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:a,headerHeight:o,scrollBy:l,scrollContainerState:u,scrollTo:d,scrollTop:f,smoothScrollTargetReached:p,viewportHeight:g},m,x,{didMount:v,propsReady:k},{customScrollParent:_,useWindowScroll:E,windowScrollContainerState:S,windowScrollTo:N,windowViewportRect:A},T])=>{const R=lt(0),C=lt(0),O=lt(nw),M=lt({height:0,width:0}),I=lt({height:0,width:0}),D=Sn(),F=Sn(),ee=lt(0),H=lt(null),P=lt({column:0,row:0}),K=Sn(),V=Sn(),Z=lt(!1),le=lt(0),B=lt(!0),U=lt(!1),Y=lt(!1);On(Xe(v,mn(le),en(([ae,xe])=>!lv(xe))),()=>{dn(B,!1)}),On(Xe(mr(v,B,I,M,le,U),en(([ae,xe,Ie,ze,,mt])=>ae&&!xe&&Ie.height!==0&&ze.height!==0&&!mt)),([,,,,ae])=>{if(ae===void 0){dn(B,!0);return}dn(U,!0),Hv(1,()=>{dn(D,ae)}),_a(Xe(f),()=>{dn(t,[0,0]),dn(B,!0)})}),zt(Xe(V,en(ae=>ae!=null&&ae.scrollTop>0),Wa(0)),C),On(Xe(v,mn(V),en(([,ae])=>ae!=null)),([,ae])=>{ae&&(dn(M,ae.viewport),dn(I,ae.item),dn(P,ae.gap),ae.scrollTop>0&&(dn(Z,!0),_a(Xe(f,Uo(1)),xe=>{dn(Z,!1)}),dn(d,{top:ae.scrollTop})))}),zt(Xe(M,Nt(({height:ae})=>ae)),g),zt(Xe(mr(Jt(M,Xd),Jt(I,Xd),Jt(P,(ae,xe)=>ae!==void 0&&ae.column===xe.column&&ae.row===xe.row),Jt(f)),Nt(([ae,xe,Ie,ze])=>({gap:Ie,item:xe,scrollTop:ze,viewport:ae}))),K),zt(Xe(mr(Jt(R),r,Jt(P,V3),Jt(I,Xd),Jt(M,Xd),Jt(H),Jt(C),Jt(Z),Jt(B),Jt(le)),en(([,,,,,,,ae])=>!ae),Nt(([ae,[xe,Ie],ze,mt,ut,$e,qe,,Oe,rt])=>{const{column:ot,row:At}=ze,{height:sn,width:Xt}=mt,{width:Ht}=ut;if(qe===0&&(ae===0||Ht===0))return nw;if(Xt===0){const ft=$v(rt,ae),ht=ft+Math.max(qe-1,0);return W3(aw(ft,ht,$e))}const We=P4(Ht,Xt,ot);let De,et;Oe?xe===0&&Ie===0&&qe>0?(De=0,et=qe-1):(De=We*jf((xe+At)/(sn+At)),et=We*rw((Ie+At)/(sn+At))-1,et=zh(ae-1,hu(et,We-1)),De=zh(et,hu(0,De))):(De=0,et=-1);const nt=aw(De,et,$e),{bottom:de,top:_e}=sw(ut,ze,mt,nt),Ue=rw(ae/We),ge=Ue*sn+(Ue-1)*At-de;return{bottom:de,itemHeight:sn,items:nt,itemWidth:Xt,offsetBottom:ge,offsetTop:_e,top:_e}})),O),zt(Xe(H,en(ae=>ae!==null),Nt(ae=>ae.length)),R),zt(Xe(mr(M,I,O,P),en(([ae,xe,{items:Ie}])=>Ie.length>0&&xe.height!==0&&ae.height!==0),Nt(([ae,xe,{items:Ie},ze])=>{const{bottom:mt,top:ut}=sw(ae,ze,xe,Ie);return[ut,mt]}),Jn(Eu)),t);const q=lt(!1);zt(Xe(f,mn(q),Nt(([ae,xe])=>xe||ae!==0)),q);const te=Wi(Xe(mr(O,R),en(([{items:ae}])=>ae.length>0),mn(q),en(([[ae,xe],Ie])=>{const ze=ae.items[ae.items.length-1].index===xe-1;return(Ie||ae.bottom>0&&ae.itemHeight>0&&ae.offsetBottom===0&&ae.items.length===xe)&&ze}),Nt(([[,ae]])=>ae-1),Jn())),W=Wi(Xe(Jt(O),en(({items:ae})=>ae.length>0&&ae[0].index===0),Wa(0),Jn())),$=Wi(Xe(Jt(O),mn(Z),en(([{items:ae},xe])=>ae.length>0&&!xe),Nt(([{items:ae}])=>({endIndex:ae[ae.length-1].index,startIndex:ae[0].index})),Jn(h4),os(0)));zt($,x.scrollSeekRangeChanged),zt(Xe(D,mn(M,I,R,P),Nt(([ae,xe,Ie,ze,mt])=>{const ut=b4(ae),{align:$e,behavior:qe,offset:Oe}=ut;let rt=ut.index;rt==="LAST"&&(rt=ze-1),rt=hu(0,rt,zh(ze-1,rt));let ot=cv(xe,mt,Ie,rt);return $e==="end"?ot=iw(ot-xe.height+Ie.height):$e==="center"&&(ot=iw(ot-xe.height/2+Ie.height/2)),Oe!==void 0&&Oe!==0&&(ot+=Oe),{behavior:qe,top:ot}})),d);const fe=ci(Xe(O,Nt(ae=>ae.offsetBottom+ae.bottom)),0);return zt(Xe(A,Nt(ae=>({height:ae.visibleHeight,width:ae.visibleWidth}))),M),{customScrollParent:_,data:H,deviation:ee,footerHeight:a,gap:P,headerHeight:o,increaseViewportBy:e,initialItemCount:C,itemDimensions:I,overscan:n,restoreStateFrom:V,scrollBy:l,scrollContainerState:u,scrollHeight:F,scrollTo:d,scrollToIndex:D,scrollTop:f,smoothScrollTargetReached:p,totalCount:R,useWindowScroll:E,viewportDimensions:M,windowScrollContainerState:S,windowScrollTo:N,windowViewportRect:A,...x,gridState:O,horizontalDirection:Y,initialTopMostItemIndex:le,totalListHeight:fe,...m,endReached:te,propsReady:k,rangeChanged:$,startReached:W,stateChanged:K,stateRestoreInProgress:Z,...T}},er(Wv,bi,Lu,S4,Ys,Vv,Ks));function P4(e,t,n){return hu(1,jf((e+n)/(jf(t)+n)))}function sw(e,t,n,r){const{height:a}=n;if(a===void 0||r.length===0)return{bottom:0,top:0};const o=cv(e,t,n,r[0].index);return{bottom:cv(e,t,n,r[r.length-1].index)+a,top:o}}function cv(e,t,n,r){const a=P4(e.width,n.width,t.column),o=jf(r/a),l=o*n.height+hu(0,o-1)*t.row;return l>0?l+t.row:l}const K3=Ln(()=>{const e=lt(g=>`Item ${g}`),t=lt({}),n=lt(null),r=lt("virtuoso-grid-item"),a=lt("virtuoso-grid-list"),o=lt(Kv),l=lt("div"),u=lt(Vl),d=(g,m=null)=>ci(Xe(t,Nt(x=>x[g]),Jn()),m),f=lt(!1),p=lt(!1);return zt(Jt(p),f),{components:t,computeItemKey:o,context:n,FooterComponent:d("Footer"),HeaderComponent:d("Header"),headerFooterTag:l,itemClassName:r,ItemComponent:d("Item","div"),itemContent:e,listClassName:a,ListComponent:d("List","div"),readyStateChanged:f,reportReadyState:p,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),Y3=Ln(([e,t])=>({...e,...t}),er(G3,K3)),Q3=Lt.memo(function(){const e=Zn("gridState"),t=Zn("listClassName"),n=Zn("itemClassName"),r=Zn("itemContent"),a=Zn("computeItemKey"),o=Zn("isSeeking"),l=ra("scrollHeight"),u=Zn("ItemComponent"),d=Zn("ListComponent"),f=Zn("ScrollSeekPlaceholder"),p=Zn("context"),g=ra("itemDimensions"),m=ra("gap"),x=Zn("log"),v=Zn("stateRestoreInProgress"),k=ra("reportReadyState"),_=Wo(Lt.useMemo(()=>E=>{const S=E.parentElement.parentElement.scrollHeight;l(S);const N=E.firstChild;if(N!==null){const{height:A,width:T}=N.getBoundingClientRect();g({height:A,width:T})}m({column:ow("column-gap",getComputedStyle(E).columnGap,x),row:ow("row-gap",getComputedStyle(E).rowGap,x)})},[l,g,m,x]),!0,!1);return zv(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),v?null:i.jsx(d,{className:t,ref:_,...li(d,p),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(E=>{const S=a(E.index,E.data,p);return o?i.jsx(f,{...li(f,p),height:e.itemHeight,index:E.index,width:e.itemWidth},S):y.createElement(u,{...li(u,p),className:n,"data-index":E.index,key:S},r(E.index,E.data,p))})})}),X3=Lt.memo(function(){const e=Zn("HeaderComponent"),t=ra("headerHeight"),n=Zn("headerFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Vs(o,"height"))},[t]),!0,!1),a=Zn("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...li(e,a)})}):null}),Z3=Lt.memo(function(){const e=Zn("FooterComponent"),t=ra("footerHeight"),n=Zn("headerFooterTag"),r=Wo(Lt.useMemo(()=>o=>{t(Vs(o,"height"))},[t]),!0,!1),a=Zn("context");return e!=null?i.jsx(n,{ref:r,children:i.jsx(e,{...li(e,a)})}):null}),J3=({children:e})=>{const t=Lt.useContext(R4),n=ra("itemDimensions"),r=ra("viewportDimensions"),a=Wo(Lt.useMemo(()=>o=>{r(o.getBoundingClientRect())},[r]),!0,!1);return Lt.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),i.jsx("div",{ref:a,style:Yv(!1),children:e})},eO=({children:e})=>{const t=Lt.useContext(R4),n=ra("windowViewportRect"),r=ra("itemDimensions"),a=Zn("customScrollParent"),o=Zn("useWindowScroll"),l=l4(n,a,!1);return Lt.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),i.jsx("div",{ref:l,style:M4(!1,o),children:e})},tO=Lt.memo(function({...e}){const t=Zn("useWindowScroll"),n=Zn("customScrollParent"),r=n||t?rO:nO,a=n||t?eO:J3,o=Zn("context");return i.jsx(r,{...e,...li(r,o),children:i.jsxs(a,{children:[i.jsx(X3,{}),i.jsx(Q3,{}),i.jsx(Z3,{})]})})}),{useEmitter:F4,useEmitterValue:Zn,usePublisher:ra}=j4(Y3,{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"}},tO),nO=L4({useEmitter:F4,useEmitterValue:Zn,usePublisher:ra}),rO=O4({useEmitter:F4,useEmitterValue:Zn,usePublisher:ra});function ow(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Pr.WARN),t==="normal"?0:parseInt(t??"0",10)}function iO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const aO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oO={};function lw(e,t){return(oO.jsx?sO:aO).test(e)}const lO=/[ \t\n\f\r]/g;function cO(e){return typeof e=="object"?e.type==="text"?cw(e.value):!1:cw(e)}function cw(e){return e.replace(lO,"")===""}class Ou{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ou.prototype.normal={};Ou.prototype.property={};Ou.prototype.space=void 0;function B4(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Ou(n,r,t)}function uv(e){return e.toLowerCase()}class Ai{constructor(t,n){this.attribute=n,this.property=t}}Ai.prototype.attribute="";Ai.prototype.booleanish=!1;Ai.prototype.boolean=!1;Ai.prototype.commaOrSpaceSeparated=!1;Ai.prototype.commaSeparated=!1;Ai.prototype.defined=!1;Ai.prototype.mustUseProperty=!1;Ai.prototype.number=!1;Ai.prototype.overloadedBoolean=!1;Ai.prototype.property="";Ai.prototype.spaceSeparated=!1;Ai.prototype.space=void 0;let uO=0;const ln=Go(),Sr=Go(),dv=Go(),st=Go(),Vn=Go(),zo=Go(),zi=Go();function Go(){return 2**++uO}const fv=Object.freeze(Object.defineProperty({__proto__:null,boolean:ln,booleanish:Sr,commaOrSpaceSeparated:zi,commaSeparated:zo,number:st,overloadedBoolean:dv,spaceSeparated:Vn},Symbol.toStringTag,{value:"Module"})),qh=Object.keys(fv);class Xv extends Ai{constructor(t,n,r,a){let o=-1;if(super(t,n),uw(this,"space",a),typeof r=="number")for(;++o<qh.length;){const l=qh[o];uw(this,qh[o],(r&fv[l])===fv[l])}}}Xv.prototype.defined=!0;function uw(e,t,n){n&&(e[t]=n)}function Gl(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const o=new Xv(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[uv(r)]=r,n[uv(o.attribute)]=r}return new Ou(t,n,e.space)}const z4=Gl({properties:{ariaActiveDescendant:null,ariaAtomic:Sr,ariaAutoComplete:null,ariaBusy:Sr,ariaChecked:Sr,ariaColCount:st,ariaColIndex:st,ariaColSpan:st,ariaControls:Vn,ariaCurrent:null,ariaDescribedBy:Vn,ariaDetails:null,ariaDisabled:Sr,ariaDropEffect:Vn,ariaErrorMessage:null,ariaExpanded:Sr,ariaFlowTo:Vn,ariaGrabbed:Sr,ariaHasPopup:null,ariaHidden:Sr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vn,ariaLevel:st,ariaLive:null,ariaModal:Sr,ariaMultiLine:Sr,ariaMultiSelectable:Sr,ariaOrientation:null,ariaOwns:Vn,ariaPlaceholder:null,ariaPosInSet:st,ariaPressed:Sr,ariaReadOnly:Sr,ariaRelevant:null,ariaRequired:Sr,ariaRoleDescription:Vn,ariaRowCount:st,ariaRowIndex:st,ariaRowSpan:st,ariaSelected:Sr,ariaSetSize:st,ariaSort:null,ariaValueMax:st,ariaValueMin:st,ariaValueNow:st,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function q4(e,t){return t in e?e[t]:t}function U4(e,t){return q4(e,t.toLowerCase())}const dO=Gl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:zo,acceptCharset:Vn,accessKey:Vn,action:null,allow:null,allowFullScreen:ln,allowPaymentRequest:ln,allowUserMedia:ln,alpha:ln,alt:null,as:null,async:ln,autoCapitalize:null,autoComplete:Vn,autoFocus:ln,autoPlay:ln,blocking:Vn,capture:null,charSet:null,checked:ln,cite:null,className:Vn,closedBy:null,colorSpace:null,cols:st,colSpan:st,command:null,commandFor:null,content:null,contentEditable:Sr,controls:ln,controlsList:Vn,coords:st|zo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ln,defer:ln,dir:null,dirName:null,disabled:ln,download:dv,draggable:Sr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ln,formTarget:null,headers:Vn,height:st,hidden:dv,high:st,href:null,hrefLang:null,htmlFor:Vn,httpEquiv:Vn,id:null,imageSizes:null,imageSrcSet:null,inert:ln,inputMode:null,integrity:null,is:null,isMap:ln,itemId:null,itemProp:Vn,itemRef:Vn,itemScope:ln,itemType:Vn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ln,low:st,manifest:null,max:null,maxLength:st,media:null,method:null,min:null,minLength:st,multiple:ln,muted:ln,name:null,nonce:null,noModule:ln,noValidate:ln,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:ln,optimum:st,pattern:null,ping:Vn,placeholder:null,playsInline:ln,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ln,referrerPolicy:null,rel:Vn,required:ln,reversed:ln,rows:st,rowSpan:st,sandbox:Vn,scope:null,scoped:ln,seamless:ln,selected:ln,shadowRootClonable:ln,shadowRootCustomElementRegistry:ln,shadowRootDelegatesFocus:ln,shadowRootMode:null,shadowRootSerializable:ln,shape:null,size:st,sizes:null,slot:null,span:st,spellCheck:Sr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:st,step:null,style:null,tabIndex:st,target:null,title:null,translate:null,type:null,typeMustMatch:ln,useMap:null,value:Sr,width:st,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vn,axis:null,background:null,bgColor:null,border:st,borderColor:null,bottomMargin:st,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ln,declare:ln,event:null,face:null,frame:null,frameBorder:null,hSpace:st,leftMargin:st,link:null,longDesc:null,lowSrc:null,marginHeight:st,marginWidth:st,noResize:ln,noHref:ln,noShade:ln,noWrap:ln,object:null,profile:null,prompt:null,rev:null,rightMargin:st,rules:null,scheme:null,scrolling:Sr,standby:null,summary:null,text:null,topMargin:st,valueType:null,version:null,vAlign:null,vLink:null,vSpace:st,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ln,disablePictureInPicture:ln,disableRemotePlayback:ln,exportParts:zo,part:Vn,prefix:null,property:null,results:st,security:null,unselectable:null},space:"html",transform:U4}),fO=Gl({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:zi,accentHeight:st,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:st,amplitude:st,arabicForm:null,ascent:st,attributeName:null,attributeType:null,azimuth:st,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:st,by:null,calcMode:null,capHeight:st,className:Vn,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:st,diffuseConstant:st,direction:null,display:null,dur:null,divisor:st,dominantBaseline:null,download:ln,dx:null,dy:null,edgeMode:null,editable:null,elevation:st,enableBackground:null,end:null,event:null,exponent:st,externalResourcesRequired:null,fill:null,fillOpacity:st,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:zo,g2:zo,glyphName:zo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:st,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:st,horizOriginX:st,horizOriginY:st,id:null,ideographic:st,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:st,k:st,k1:st,k2:st,k3:st,k4:st,kernelMatrix:zi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:st,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:st,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:st,overlineThickness:st,paintOrder:null,panose1:null,path:null,pathLength:st,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:st,pointsAtY:st,pointsAtZ:st,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zi,rev:zi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zi,requiredFeatures:zi,requiredFonts:zi,requiredFormats:zi,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:st,specularExponent:st,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:st,strikethroughThickness:st,string:null,stroke:null,strokeDashArray:zi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:st,strokeOpacity:st,strokeWidth:null,style:null,surfaceScale:st,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zi,tabIndex:st,tableValues:null,target:null,targetX:st,targetY:st,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:st,underlineThickness:st,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:st,values:null,vAlphabetic:st,vMathematical:st,vectorEffect:null,vHanging:st,vIdeographic:st,version:null,vertAdvY:st,vertOriginX:st,vertOriginY:st,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:st,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:q4}),H4=Gl({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()}}),$4=Gl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:U4}),W4=Gl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pO={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"},hO=/[A-Z]/g,dw=/-[a-z]/g,gO=/^data[-\w.:]+$/i;function mO(e,t){const n=uv(t);let r=t,a=Ai;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&gO.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(dw,yO);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!dw.test(o)){let l=o.replace(hO,xO);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=Xv}return new a(r,t)}function xO(e){return"-"+e.toLowerCase()}function yO(e){return e.charAt(1).toUpperCase()}const bO=B4([z4,dO,H4,$4,W4],"html"),Zv=B4([z4,fO,H4,$4,W4],"svg");function vO(e){return e.join(" ").trim()}var Tl={},Uh,fw;function kO(){if(fw)return Uh;fw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,d=`
|
|
49
|
-
`,f="/",p="*",g="",m="comment",x="declaration";function v(_,E){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];E=E||{};var S=1,N=1;function A(H){var P=H.match(t);P&&(S+=P.length);var K=H.lastIndexOf(d);N=~K?H.length-K:N+H.length}function T(){var H={line:S,column:N};return function(P){return P.position=new R(H),M(),P}}function R(H){this.start=H,this.end={line:S,column:N},this.source=E.source}R.prototype.content=_;function C(H){var P=new Error(E.source+":"+S+":"+N+": "+H);if(P.reason=H,P.filename=E.source,P.line=S,P.column=N,P.source=_,!E.silent)throw P}function O(H){var P=H.exec(_);if(P){var K=P[0];return A(K),_=_.slice(K.length),P}}function M(){O(n)}function I(H){var P;for(H=H||[];P=D();)P!==!1&&H.push(P);return H}function D(){var H=T();if(!(f!=_.charAt(0)||p!=_.charAt(1))){for(var P=2;g!=_.charAt(P)&&(p!=_.charAt(P)||f!=_.charAt(P+1));)++P;if(P+=2,g===_.charAt(P-1))return C("End of comment missing");var K=_.slice(2,P-2);return N+=2,A(K),_=_.slice(P),N+=2,H({type:m,comment:K})}}function F(){var H=T(),P=O(r);if(P){if(D(),!O(a))return C("property missing ':'");var K=O(o),V=H({type:x,property:k(P[0].replace(e,g)),value:K?k(K[0].replace(e,g)):g});return O(l),V}}function ee(){var H=[];I(H);for(var P;P=F();)P!==!1&&(H.push(P),I(H));return H}return M(),ee()}function k(_){return _?_.replace(u,g):g}return Uh=v,Uh}var pw;function _O(){if(pw)return Tl;pw=1;var e=Tl&&Tl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Tl,"__esModule",{value:!0}),Tl.default=n;const t=e(kO());function n(r,a){let o=null;if(!r||typeof r!="string")return o;const l=(0,t.default)(r),u=typeof a=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;u?a(f,p,d):p&&(o=o||{},o[f]=p)}),o}return Tl}var Qc={},hw;function wO(){if(hw)return Qc;hw=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},l=function(f,p){return p.toUpperCase()},u=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,u):f=f.replace(r,u),f.replace(t,l))};return Qc.camelCase=d,Qc}var Xc,gw;function EO(){if(gw)return Xc;gw=1;var e=Xc&&Xc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(_O()),n=wO();function r(a,o){var l={};return!a||typeof a!="string"||(0,t.default)(a,function(u,d){u&&d&&(l[(0,n.camelCase)(u,o)]=d)}),l}return r.default=r,Xc=r,Xc}var SO=EO();const NO=$o(SO),V4=G4("end"),Jv=G4("start");function G4(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function CO(e){const t=Jv(e),n=V4(e);if(t&&n)return{start:t,end:n}}function gu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?mw(e.position):"start"in e||"end"in e?mw(e):"line"in e||"column"in e?pv(e):""}function pv(e){return xw(e&&e.line)+":"+xw(e&&e.column)}function mw(e){return pv(e&&e.start)+"-"+pv(e&&e.end)}function xw(e){return e&&typeof e=="number"?e:1}class di extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(l=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?o.ruleId=r:(o.source=r.slice(0,d),o.ruleId=r.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=a,this.line=u?u.line:void 0,this.name=gu(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}}di.prototype.file="";di.prototype.name="";di.prototype.reason="";di.prototype.message="";di.prototype.stack="";di.prototype.column=void 0;di.prototype.line=void 0;di.prototype.ancestors=void 0;di.prototype.cause=void 0;di.prototype.fatal=void 0;di.prototype.place=void 0;di.prototype.ruleId=void 0;di.prototype.source=void 0;const ek={}.hasOwnProperty,jO=new Map,TO=/[A-Z]/g,RO=new Set(["table","tbody","thead","tfoot","tr"]),AO=new Set(["td","th"]),K4="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function IO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=zO(n,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");r=BO(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Zv:bO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Y4(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function Y4(e,t,n){if(t.type==="element")return MO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return LO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return DO(e,t,n);if(t.type==="mdxjsEsm")return OO(e,t);if(t.type==="root")return PO(e,t,n);if(t.type==="text")return FO(e,t)}function MO(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Zv,e.schema=a),e.ancestors.push(t);const o=X4(e,t.tagName,!1),l=qO(e,t);let u=nk(e,t);return RO.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!cO(d):!0})),Q4(e,l,o,t),tk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function LO(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Tu(e,t.position)}function OO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Tu(e,t.position)}function DO(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Zv,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:X4(e,t.name,!0),l=UO(e,t),u=nk(e,t);return Q4(e,l,o,t),tk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function PO(e,t,n){const r={};return tk(r,nk(e,t)),e.create(t,e.Fragment,r,n)}function FO(e,t){return t.value}function Q4(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function tk(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function BO(e,t,n){return r;function r(a,o,l,u){const f=Array.isArray(l.children)?n:t;return u?f(o,l,u):f(o,l)}}function zO(e,t){return n;function n(r,a,o,l){const u=Array.isArray(o.children),d=Jv(r);return t(a,o,l,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function qO(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&ek.call(t.properties,a)){const o=HO(e,a,t.properties[a]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&AO.has(t.tagName)?r=u:n[l]=u}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function UO(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Tu(e,t.position);else{const a=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,o=e.evaluater.evaluateExpression(u.expression)}else Tu(e,t.position);else o=r.value===null?!0:r.value;n[a]=o}return n}function nk(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:jO;for(;++r<t.children.length;){const o=t.children[r];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=a.get(d)||0;l=d+"-"+f,a.set(d,f+1)}}const u=Y4(e,o,l);u!==void 0&&n.push(u)}return n}function HO(e,t,n){const r=mO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?iO(n):vO(n)),r.property==="style"){let a=typeof n=="object"?n:$O(e,String(n));return e.stylePropertyNameCase==="css"&&(a=WO(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?pO[r.property]||r.property:r.attribute,n]}}function $O(e,t){try{return NO(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new di("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=K4+"#cannot-parse-style-attribute",a}}function X4(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,l;for(;++o<a.length;){const u=lw(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}r=l}else r=lw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return ek.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Tu(e)}function Tu(e,t){const n=new di("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=K4+"#cannot-handle-mdx-estrees-without-createevaluater",n}function WO(e){const t={};let n;for(n in e)ek.call(e,n)&&(t[VO(n)]=e[n]);return t}function VO(e){let t=e.replace(TO,GO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function GO(e){return"-"+e.toLowerCase()}const Hh={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"]},KO={};function rk(e,t){const n=KO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Z4(e,r,a)}function Z4(e,t,n){if(YO(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return yw(e.children,t,n)}return Array.isArray(e)?yw(e,t,n):""}function yw(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Z4(e[a],t,n);return r.join("")}function YO(e){return!!(e&&typeof e=="object")}const bw=document.createElement("i");function ik(e){const t="&"+e+";";bw.innerHTML=t;const n=bw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function wa(e,t,n,r){const a=e.length;let o=0,l;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<r.length;)l=r.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function na(e,t){return e.length>0?(wa(e,e.length,0,t),e):t}const vw={}.hasOwnProperty;function J4(e){const t={};let n=-1;for(;++n<e.length;)QO(t,e[n]);return t}function QO(e,t){let n;for(n in t){const a=(vw.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){vw.call(a,l)||(a[l]=[]);const u=o[l];XO(a[l],Array.isArray(u)?u:u?[u]:[])}}}function XO(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);wa(e,0,0,r)}function eR(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ea(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const yi=Qs(/[A-Za-z]/),ui=Qs(/[\dA-Za-z]/),ZO=Qs(/[#-'*+\--9=?A-Z^-~]/);function Tf(e){return e!==null&&(e<32||e===127)}const hv=Qs(/\d/),JO=Qs(/[\dA-Fa-f]/),eD=Qs(/[!-/:-@[-`{-~]/);function Zt(e){return e!==null&&e<-2}function Gn(e){return e!==null&&(e<0||e===32)}function yn(e){return e===-2||e===-1||e===32}const Gf=Qs(new RegExp("\\p{P}|\\p{S}","u")),Ho=Qs(/\s/);function Qs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Kl(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&ui(e.charCodeAt(n+1))&&ui(e.charCodeAt(n+2)))a=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(n+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),a=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+a+1,l=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Mn(e,t,n,r){const a=r?r-1:1/0;let o=0;return l;function l(d){return yn(d)?(e.enter(n),u(d)):t(d)}function u(d){return yn(d)&&o++<a?(e.consume(d),u):(e.exit(n),t(d))}}function tR(e,t,n,r,a,o){let l=0;return u;function u(p){return yn(p)?(e.enter(r),d(p)):f(p)}function d(p){return yn(p)&&l<o?(e.consume(p),l++,d):(e.exit(r),f(p))}function f(p){return l>=a?t(p):n(p)}}const tD={tokenize:nD};function nD(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Mn(e,t,"linePrefix")}function a(u){return e.enter("paragraph"),o(u)}function o(u){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Zt(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}let Rf=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){kw(this,t,n,r,!1)}addBefore(t,n,r){kw(this,t,n,r,!0)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0,this.index.clear()}};function kw(e,t,n,r,a){if(n===0&&r.length===0)return;const o=e.index.get(t);if(o){o[1]+=n,a?(r.push(...o[2]),o[2]=r):o[2].push(...r);return}const l=[t,n,r];e.map.push(l),e.index.set(t,l)}const rD={tokenize:iD},_w={tokenize:aD};function iD(e){const t=this,n=[];let r=0,a,o,l;return u;function u(N){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,d,f)(N)}return f(N)}function d(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&S();const A=t.events.length;let T=A,R;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){R=t.events[T][1].end;break}E(r);let C=A;for(;C<t.events.length;)t.events[C][1].end={...R},C++;const O=new Rf;return O.add(T+1,0,t.events.slice(A)),O.add(A,C-A,[]),O.consume(t.events),f(N)}return u(N)}function f(N){if(r===n.length){if(!a)return m(N);if(a.currentConstruct&&a.currentConstruct.concrete)return v(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_w,p,g)(N)}function p(N){return a&&S(),E(r),m(N)}function g(N){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,v(N)}function m(N){return t.containerState={},e.attempt(_w,x,v)(N)}function x(N){return r++,n.push([t.currentConstruct,t.containerState]),m(N)}function v(N){if(N===null){a&&S(),E(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(N)}function k(N){if(N===null){_(e.exit("chunkFlow"),!0),E(0),e.consume(N);return}return Zt(N)?(e.consume(N),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(N),k)}function _(N,A){const T=t.sliceStream(N);if(A&&T.push(null),N.previous=o,o&&(o.next=N),o=N,a.defineSkip(N.start),a.write(T),t.parser.lazy[N.start.line]){let R=a.events.length;for(;R--;)if(a.events[R][1].start.offset<l&&(!a.events[R][1].end||a.events[R][1].end.offset>l))return;const C=t.events.length;let O=C,M,I;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(M){I=t.events[O][1].end;break}M=!0}for(E(r),R=C;R<t.events.length;)t.events[R][1].end={...I},R++;const D=new Rf;D.add(O+1,0,t.events.slice(C)),D.add(C,R-C,[]),D.consume(t.events)}}function E(N){let A=n.length;for(;A-- >N;){const T=n[A];t.containerState=T[1],T[0].exit.call(t,e)}n.length=N}function S(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function aD(e,t,n){return Mn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Af(e){if(e===null||Gn(e)||Ho(e))return 1;if(Gf(e))return 2}function Kf(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const gv={name:"attention",resolveAll:sD,tokenize:oD};function sD(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let a=n;for(;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[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const o=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,l={...e[a][1].end},u={...e[n][1].start};ww(l,-o),ww(u,o);const d={type:o>1?"strongSequence":"emphasisSequence",start:l,end:{...e[a][1].end}},f={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:u},p={type:o>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},g={type:o>1?"strong":"emphasis",start:{...d.start},end:{...f.end}};e[a][1].end={...d.start},e[n][1].start={...f.end},r=[],e[a][1].end.offset-e[a][1].start.offset&&(r=na(r,[["enter",e[a][1],t],["exit",e[a][1],t]])),r=na(r,[["enter",g,t],["enter",d,t],["exit",d,t],["enter",p,t]]),r=na(r,Kf(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),r=na(r,[["exit",p,t],["enter",f,t],["exit",f,t],["exit",g,t]]);let m=0;e[n][1].end.offset-e[n][1].start.offset&&(m=2,r=na(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),wa(e,a-1,n-a+3,r),n=a+r.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function oD(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Af(r);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"),p=Af(d),g=!p||p===2&&a||n.includes(d)&&d!==42&&d!==95,m=!a||a===2&&p||n.includes(r)&&r!==42&&r!==95;return f._open=!!(o===42?g:g&&(a||!m)),f._close=!!(o===42?m:m&&(p||!g)),t(d)}}function ww(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lD={name:"autolink",tokenize:cD};function cD(e,t,n){let r=0;return a;function a(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return yi(x)?(e.consume(x),l):x===64?n(x):f(x)}function l(x){return x===43||x===45||x===46||ui(x)?(r=1,u(x)):f(x)}function u(x){return x===58?(e.consume(x),r=0,d):(x===43||x===45||x===46||ui(x))&&r++<32?(e.consume(x),u):(r=0,f(x))}function d(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||Tf(x)?n(x):(e.consume(x),d)}function f(x){return x===64?(e.consume(x),p):ZO(x)?(e.consume(x),f):n(x)}function p(x){return ui(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),r=0,p):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):m(x)}function m(x){if((x===45||ui(x))&&r++<63){const v=x===45?m:g;return e.consume(x),v}return n(x)}}const Du={partial:!0,tokenize:uD};function uD(e,t,n){return r;function r(o){return yn(o)?Mn(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Zt(o)?t(o):n(o)}}const nR={continuation:{tokenize:fD},exit:pD,name:"blockQuote",tokenize:dD};function dD(e,t,n){const r=this;return a;function a(l){if(l===62){const u=r.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 n(l)}function o(l){return yn(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function fD(e,t,n){const r=this;return a;function a(l){return yn(l)?Mn(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(nR,t,n)(l)}}function pD(e){e.exit("blockQuote")}const rR={name:"characterEscape",tokenize:hD};function hD(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return eD(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const iR={name:"characterReference",tokenize:gD};function gD(e,t,n){const r=this;let a=0,o,l;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,l=ui,p(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=JO,p):(e.enter("characterReferenceValue"),o=7,l=hv,p(g))}function p(g){if(g===59&&a){const m=e.exit("characterReferenceValue");return l===ui&&!ik(r.sliceSerialize(m))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&a++<o?(e.consume(g),p):n(g)}}const mv={partial:!0,tokenize:mD};function mD(e,t,n){const r=this;return a;function a(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Ew={concrete:!0,name:"codeFenced",tokenize:xD};function xD(e,t,n){const r=this,a={partial:!0,tokenize:T};let o=0,l=0,u;return d;function d(R){return f(R)}function f(R){const C=r.events[r.events.length-1];return o=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,u=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(R)}function p(R){return R===u?(l++,e.consume(R),p):l<3?n(R):(e.exit("codeFencedFenceSequence"),yn(R)?Mn(e,g,"whitespace")(R):g(R))}function g(R){return R===null||Zt(R)?(e.exit("codeFencedFence"),r.interrupt?t(R):e.check(mv,k,A)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(R))}function m(R){return R===null||Zt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):yn(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mn(e,x,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),m)}function x(R){return R===null||Zt(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(R))}function v(R){return R===null||Zt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),v)}function k(R){return e.attempt(a,A,_)(R)}function _(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),E}function E(R){return o>0&&yn(R)?Mn(e,S,"linePrefix",o+1)(R):S(R)}function S(R){return R===null||Zt(R)?e.check(mv,k,A)(R):(e.enter("codeFlowValue"),N(R))}function N(R){return R===null||Zt(R)?(e.exit("codeFlowValue"),S(R)):(e.consume(R),N)}function A(R){return e.exit("codeFenced"),t(R)}function T(R,C,O){let M=0;return I;function I(P){return R.enter("lineEnding"),R.consume(P),R.exit("lineEnding"),D}function D(P){return R.enter("codeFencedFence"),yn(P)?Mn(R,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):F(P)}function F(P){return P===u?(R.enter("codeFencedFenceSequence"),ee(P)):O(P)}function ee(P){return P===u?(M++,R.consume(P),ee):M>=l?(R.exit("codeFencedFenceSequence"),yn(P)?Mn(R,H,"whitespace")(P):H(P)):O(P)}function H(P){return P===null||Zt(P)?(R.exit("codeFencedFence"),C(P)):O(P)}}}const $h={name:"codeIndented",tokenize:bD},yD={partial:!0,tokenize:vD};function bD(e,t,n){return r;function r(u){return e.enter("codeIndented"),tR(e,a,n,"linePrefix",4,4)(u)}function a(u){return u===null?l(u):Zt(u)?e.attempt(yD,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Zt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function vD(e,t,n){const r=this;return a;function a(l){return r.parser.lazy[r.now().line]?n(l):Zt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):tR(e,t,o,"linePrefix",4,4)(l)}function o(l){return Zt(l)?a(l):n(l)}}const kD={name:"codeText",previous:wD,resolve:_D,tokenize:ED};function _D(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function wD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ED(e,t,n){let r=0,a,o;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),r++,u):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(o=e.enter("codeTextSequence"),a=0,p(g)):Zt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Zt(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),f)}function p(g){return g===96?(e.consume(g),a++,p):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",f(g))}}class SD{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,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Zc(this.left,r),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),Zc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Zc(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 n=this.left.splice(t,Number.POSITIVE_INFINITY);Zc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Zc(this.left,n.reverse())}}}function Zc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function aR(e){const t={};let n=-1,r,a,o,l,u,d,f;const p=new SD(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(t,ND(p,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,a=void 0;o--;)if(l=p.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(a&&(p.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;a&&(r[1].end={...p.get(a)[1].start},u=p.slice(a,n),u.unshift(r),p.splice(a,n-a+1,u))}}return wa(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function ND(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const o=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,d=[],f={};let p,g,m=-1,x=n,v=0,k=0;const _=[k];for(;x;){for(;e.get(++a)[1]!==x;);o.push(a),x._tokenizer||(p=r.sliceStream(x),x.next||p.push(null),g&&l.defineSkip(x.start),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++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),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(l.events=[],x?(x._tokenizer=void 0,x.previous=void 0):_.pop(),m=_.length;m--;){const E=u.slice(_[m],_[m+1]),S=o.pop();d.push([S,S+E.length-1]),e.splice(S,2,E)}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 CD={resolve:TD,tokenize:RD},jD={partial:!0,tokenize:AD};function TD(e){return aR(e),e}function RD(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(u)}function a(u){return u===null?o(u):Zt(u)?e.check(jD,l,o)(u):(e.consume(u),a)}function o(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function AD(e,t,n){const r=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Mn(e,o,"linePrefix")}function o(l){if(l===null||Zt(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function sR(e,t,n,r,a,o,l,u,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return g;function g(E){return E===60?(e.enter(r),e.enter(a),e.enter(o),e.consume(E),e.exit(o),m):E===null||E===32||E===41||Tf(E)?n(E):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),k(E))}function m(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(a),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===62?(e.exit("chunkString"),e.exit(u),m(E)):E===null||E===60||Zt(E)?n(E):(e.consume(E),E===92?v:x)}function v(E){return E===60||E===62||E===92?(e.consume(E),x):x(E)}function k(E){return!p&&(E===null||E===41||Gn(E))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(E)):p<f&&E===40?(e.consume(E),p++,k):E===41?(e.consume(E),p--,k):E===null||E===32||E===40||Tf(E)?n(E):(e.consume(E),E===92?_:k)}function _(E){return E===40||E===41||E===92?(e.consume(E),k):k(E)}}function oR(e,t,n,r,a,o){const l=this;let u=0,d;return f;function f(x){return e.enter(r),e.enter(a),e.consume(x),e.exit(a),e.enter(o),p}function p(x){return u>999||x===null||x===91||x===93&&!d||x===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(x):x===93?(e.exit(o),e.enter(a),e.consume(x),e.exit(a),e.exit(r),t):Zt(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Zt(x)||u++>999?(e.exit("chunkString"),p(x)):(e.consume(x),d||(d=!yn(x)),x===92?m:g)}function m(x){return x===91||x===92||x===93?(e.consume(x),u++,g):g(x)}}function lR(e,t,n,r,a,o){let l;return u;function u(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),l=m===40?41:m,d):n(m)}function d(m){return m===l?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(o),f(m))}function f(m){return m===l?(e.exit(o),d(l)):m===null?n(m):Zt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Mn(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===l||m===null||Zt(m)?(e.exit("chunkString"),f(m)):(e.consume(m),m===92?g:p)}function g(m){return m===l||m===92?(e.consume(m),p):p(m)}}function mu(e,t){let n;return r;function r(a){return Zt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):yn(a)?Mn(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const ID={name:"definition",tokenize:LD},MD={partial:!0,tokenize:OD};function LD(e,t,n){const r=this;let a;return o;function o(x){return e.enter("definition"),l(x)}function l(x){return oR.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function u(x){return a=Ea(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),d):n(x)}function d(x){return Gn(x)?mu(e,f)(x):f(x)}function f(x){return sR(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(MD,g,g)(x)}function g(x){return yn(x)?Mn(e,m,"whitespace")(x):m(x)}function m(x){return x===null||Zt(x)?(e.exit("definition"),r.parser.defined.push(a),t(x)):n(x)}}function OD(e,t,n){return r;function r(u){return Gn(u)?mu(e,a)(u):n(u)}function a(u){return lR(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return yn(u)?Mn(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Zt(u)?t(u):n(u)}}const DD={name:"hardBreakEscape",tokenize:PD};function PD(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Zt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const FD={name:"headingAtx",resolve:BD,tokenize:zD};function BD(e,t){let n=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r){const a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"};wa(e,r,n-r+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])}return e}function zD(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(e.consume(p),l):p===null||Gn(p)?(e.exit("atxHeadingSequence"),u(p)):n(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||Zt(p)?(e.exit("atxHeading"),t(p)):yn(p)?Mn(e,u,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),u(p))}function f(p){return p===null||p===35||Gn(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),f)}}const qD=["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"],Sw=["pre","script","style","textarea"],UD={concrete:!0,name:"htmlFlow",resolveTo:$D,tokenize:WD},HD={partial:!0,tokenize:VD};function $D(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 WD(e,t,n){const r=this;let a,o,l,u,d;return f;function f(q){return p(q)}function p(q){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(q),g}function g(q){return q===33?(e.consume(q),m):q===47?(e.consume(q),o=!0,k):q===63?(e.consume(q),a=3,r.interrupt?t:B):yi(q)?(e.consume(q),l=String.fromCharCode(q),_):n(q)}function m(q){return q===45?(e.consume(q),a=2,x):q===91?(e.consume(q),a=5,u=0,v):yi(q)?(e.consume(q),a=4,r.interrupt?t:B):n(q)}function x(q){return q===45?(e.consume(q),r.interrupt?t:B):n(q)}function v(q){const te="CDATA[";return q===te.charCodeAt(u++)?(e.consume(q),u===te.length?r.interrupt?t:F:v):n(q)}function k(q){return yi(q)?(e.consume(q),l=String.fromCharCode(q),_):n(q)}function _(q){if(q===null||q===47||q===62||Gn(q)){const te=q===47,W=l.toLowerCase();return!te&&!o&&Sw.includes(W)?(a=1,r.interrupt?t(q):F(q)):qD.includes(l.toLowerCase())?(a=6,te?(e.consume(q),E):r.interrupt?t(q):F(q)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(q):o?S(q):N(q))}return q===45||ui(q)?(e.consume(q),l+=String.fromCharCode(q),_):n(q)}function E(q){return q===62?(e.consume(q),r.interrupt?t:F):n(q)}function S(q){return yn(q)?(e.consume(q),S):I(q)}function N(q){return q===47?(e.consume(q),I):q===58||q===95||yi(q)?(e.consume(q),A):yn(q)?(e.consume(q),N):I(q)}function A(q){return q===45||q===46||q===58||q===95||ui(q)?(e.consume(q),A):T(q)}function T(q){return q===61?(e.consume(q),R):yn(q)?(e.consume(q),T):N(q)}function R(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),d=q,C):yn(q)?(e.consume(q),R):O(q)}function C(q){return q===d?(e.consume(q),d=null,M):q===null||Zt(q)?n(q):(e.consume(q),C)}function O(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||Gn(q)?T(q):(e.consume(q),O)}function M(q){return q===47||q===62||yn(q)?N(q):n(q)}function I(q){return q===62?(e.consume(q),D):n(q)}function D(q){return q===null||Zt(q)?F(q):yn(q)?(e.consume(q),D):n(q)}function F(q){return q===45&&a===2?(e.consume(q),K):q===60&&a===1?(e.consume(q),V):q===62&&a===4?(e.consume(q),U):q===63&&a===3?(e.consume(q),B):q===93&&a===5?(e.consume(q),le):Zt(q)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(HD,Y,ee)(q)):q===null||Zt(q)?(e.exit("htmlFlowData"),ee(q)):(e.consume(q),F)}function ee(q){return e.check(mv,H,Y)(q)}function H(q){return e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),P}function P(q){return q===null||Zt(q)?ee(q):(e.enter("htmlFlowData"),F(q))}function K(q){return q===45?(e.consume(q),B):F(q)}function V(q){return q===47?(e.consume(q),l="",Z):F(q)}function Z(q){if(q===62){const te=l.toLowerCase();return Sw.includes(te)?(e.consume(q),U):F(q)}return yi(q)&&l.length<8?(e.consume(q),l+=String.fromCharCode(q),Z):F(q)}function le(q){return q===93?(e.consume(q),B):F(q)}function B(q){return q===62?(e.consume(q),U):q===45&&a===2?(e.consume(q),B):F(q)}function U(q){return q===null||Zt(q)?(e.exit("htmlFlowData"),Y(q)):(e.consume(q),U)}function Y(q){return e.exit("htmlFlow"),t(q)}}function VD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Du,t,n)}}const GD={name:"htmlText",tokenize:KD};function KD(e,t,n){const r=this;let a,o,l;return u;function u(B){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(B),d}function d(B){return B===33?(e.consume(B),f):B===47?(e.consume(B),T):B===63?(e.consume(B),N):yi(B)?(e.consume(B),O):n(B)}function f(B){return B===45?(e.consume(B),p):B===91?(e.consume(B),o=0,v):yi(B)?(e.consume(B),S):n(B)}function p(B){return B===45?(e.consume(B),x):n(B)}function g(B){return B===null?n(B):B===45?(e.consume(B),m):Zt(B)?(l=g,V(B)):(e.consume(B),g)}function m(B){return B===45?(e.consume(B),x):g(B)}function x(B){return B===62?K(B):B===45?m(B):g(B)}function v(B){const U="CDATA[";return B===U.charCodeAt(o++)?(e.consume(B),o===U.length?k:v):n(B)}function k(B){return B===null?n(B):B===93?(e.consume(B),_):Zt(B)?(l=k,V(B)):(e.consume(B),k)}function _(B){return B===93?(e.consume(B),E):k(B)}function E(B){return B===62?K(B):B===93?(e.consume(B),E):k(B)}function S(B){return B===null||B===62?K(B):Zt(B)?(l=S,V(B)):(e.consume(B),S)}function N(B){return B===null?n(B):B===63?(e.consume(B),A):Zt(B)?(l=N,V(B)):(e.consume(B),N)}function A(B){return B===62?K(B):N(B)}function T(B){return yi(B)?(e.consume(B),R):n(B)}function R(B){return B===45||ui(B)?(e.consume(B),R):C(B)}function C(B){return Zt(B)?(l=C,V(B)):yn(B)?(e.consume(B),C):K(B)}function O(B){return B===45||ui(B)?(e.consume(B),O):B===47||B===62||Gn(B)?M(B):n(B)}function M(B){return B===47?(e.consume(B),K):B===58||B===95||yi(B)?(e.consume(B),I):Zt(B)?(l=M,V(B)):yn(B)?(e.consume(B),M):K(B)}function I(B){return B===45||B===46||B===58||B===95||ui(B)?(e.consume(B),I):D(B)}function D(B){return B===61?(e.consume(B),F):Zt(B)?(l=D,V(B)):yn(B)?(e.consume(B),D):M(B)}function F(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),a=B,ee):Zt(B)?(l=F,V(B)):yn(B)?(e.consume(B),F):(e.consume(B),H)}function ee(B){return B===a?(e.consume(B),a=void 0,P):B===null?n(B):Zt(B)?(l=ee,V(B)):(e.consume(B),ee)}function H(B){return B===null||B===34||B===39||B===60||B===61||B===96?n(B):B===47||B===62||Gn(B)?M(B):(e.consume(B),H)}function P(B){return B===47||B===62||Gn(B)?M(B):n(B)}function K(B){return B===62?(e.consume(B),e.exit("htmlTextData"),e.exit("htmlText"),t):n(B)}function V(B){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),Z}function Z(B){return yn(B)?Mn(e,le,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):le(B)}function le(B){return e.enter("htmlTextData"),l(B)}}const ak={name:"labelEnd",resolveAll:ZD,resolveTo:JD,tokenize:eP},YD={tokenize:tP},QD={tokenize:nP},XD={tokenize:rP};function ZD(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&wa(e,0,e.length,n),e}function JD(e,t){let n=e.length,r=0,a,o,l;for(;n--;){const p=e[n][1];if(a){if(p.type==="link"||p.type==="labelLink"&&p._inactive)break;e[n][0]==="enter"&&p.type==="labelLink"&&(p._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(p.type==="labelImage"||p.type==="labelLink")&&!p._balanced&&(a=n,p.type!=="labelLink")){r=2;break}}else p.type==="labelEnd"&&(o=n)}const u={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},f={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,t],["enter",d,t]],l=na(l,e.slice(a+1,a+r+3)),l=na(l,[["enter",f,t]]),l=na(l,Kf(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),l=na(l,[["exit",f,t],e[o-2],e[o-1],["exit",d,t]]),l=na(l,e.slice(o+1)),l=na(l,[["exit",u,t]]),wa(e,a,e.length,l),e}function eP(e,t,n){const r=this,a=r._labelStarts;let o,l;if(a){for(;a.length>0&&a[a.length-1]._balanced;)a.pop();o=a[a.length-1]}return u;function u(m){return o?o._inactive?g(m):(l=r.parser.defined.includes(Ea(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),d):n(m)}function d(m){return m===40?e.attempt(YD,p,l?p:g)(m):m===91?e.attempt(QD,p,l?f:g)(m):l?p(m):g(m)}function f(m){return e.attempt(XD,p,g)(m)}function p(m){return a.pop(),t(m)}function g(m){return o._balanced=!0,n(m)}}function tP(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return Gn(g)?mu(e,o)(g):o(g)}function o(g){return g===41?p(g):sR(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return Gn(g)?mu(e,d)(g):p(g)}function u(g){return n(g)}function d(g){return g===34||g===39||g===40?lR(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function f(g){return Gn(g)?mu(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function nP(e,t,n){const r=this;return a;function a(u){return oR.call(r,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return r.parser.defined.includes(Ea(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function rP(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const iP={name:"labelStartImage",resolveAll:ak.resolveAll,tokenize:aP};function aP(e,t,n){const r=this;let a;return o;function o(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),a=e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(d))}}const sP={name:"labelStartLink",resolveAll:ak.resolveAll,tokenize:oP};function oP(e,t,n){const r=this;let a;return o;function o(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),a=e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(u))}}const Wh={name:"lineEnding",tokenize:lP};function lP(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Mn(e,t,"linePrefix")}}const vf={name:"thematicBreak",tokenize:cP};function cP(e,t,n){let r=0,a;return o;function o(f){return e.enter("thematicBreak"),l(f)}function l(f){return a=f,u(f)}function u(f){return f===a?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||Zt(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===a?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),yn(f)?Mn(e,u,"whitespace")(f):u(f))}}const ji={continuation:{tokenize:pP},exit:gP,name:"list",tokenize:fP},uP={partial:!0,tokenize:mP},dP={partial:!0,tokenize:hP};function fP(e,t,n){const r=this,a=r.events[r.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return u;function u(x){const v=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:hv(x)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(vf,n,f)(x):f(x);if(!r.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(x)}return n(x)}function d(x){return hv(x)&&++l<10?(e.consume(x),d):(!r.interrupt||l<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),f(x)):n(x)}function f(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,e.check(Du,r.interrupt?n:p,e.attempt(uP,m,g))}function p(x){return r.containerState.initialBlankLine=!0,o++,m(x)}function g(x){return yn(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),m):n(x)}function m(x){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function pP(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Du,a,o);function a(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Mn(e,t,"listItemIndent",r.containerState.size+1)(u)}function o(u){return r.containerState.furtherBlankLines||!yn(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(dP,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Mn(e,e.attempt(ji,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function hP(e,t,n){const r=this;return Mn(e,a,"listItemIndent",r.containerState.size+1);function a(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function gP(e){e.exit(this.containerState.type)}function mP(e,t,n){const r=this;return Mn(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const l=r.events[r.events.length-1];return!yn(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Nw={name:"setextUnderline",resolveTo:xP,tokenize:yP};function xP(e,t){const n=new Rf;let r=e.length,a,o,l;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&n.add(r,1,[]),!l&&e[r][1].type==="definition"&&(l=r);const u={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",l?(n.add(o,0,[["enter",u,t]]),n.add(l+1,0,[["exit",e[a][1],t]]),e[a][1].end={...e[l][1].end}):e[a][1]=u,n.add(e.length,0,[["exit",u,t]]),n.consume(e),e}function yP(e,t,n){const r=this;let a;return o;function o(f){let p=r.events.length,g;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){g=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),a=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===a?(e.consume(f),u):(e.exit("setextHeadingLineSequence"),yn(f)?Mn(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Zt(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const bP={tokenize:vP};function vP(e){const t=this,n=e.attempt(Du,r,e.attempt(this.parser.constructs.flowInitial,a,Mn(e,e.attempt(this.parser.constructs.flow,a,e.attempt(CD,a)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const kP={resolveAll:uR()},_P=cR("string"),wP=cR("text");function cR(e){return{resolveAll:uR(e==="text"?EP:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],o=n.attempt(a,l,u);return l;function l(p){return f(p)?o(p):u(p)}function u(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const g=a[p];let m=-1;if(g)for(;++m<g.length;){const x=g[m];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function uR(e){return t;function t(n,r){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,r):n}}function EP(e,t){const n=new Rf;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],o=t.sliceStream(a);let l=o.length,u=-1,d=0,f;for(;l--;){const p=o[l];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(p===-2)f=!0,d++;else if(p!==-1){l++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(d=0),d){const p={type:r===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:a.start._bufferIndex+u,_index:a.start._index+l,line:a.end.line,column:a.end.column-d,offset:a.end.offset-d},end:{...a.end}};a.end={...p.start},a.start.offset===a.end.offset?Object.assign(a,p):n.add(r,0,[["enter",p,t],["exit",p,t]])}r++}return n.consume(e),e}const SP={42:ji,43:ji,45:ji,48:ji,49:ji,50:ji,51:ji,52:ji,53:ji,54:ji,55:ji,56:ji,57:ji,62:nR},NP={91:ID},CP={[-2]:$h,[-1]:$h,32:$h},jP={35:FD,42:vf,45:[Nw,vf],60:UD,61:Nw,95:vf,96:Ew,126:Ew},TP={38:iR,92:rR},RP={[-5]:Wh,[-4]:Wh,[-3]:Wh,33:iP,38:iR,42:gv,60:[lD,GD],91:sP,92:[DD,rR],93:ak,95:gv,96:kD},AP={null:[gv,kP]},IP={null:[42,95]},MP={null:[]},LP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:IP,contentInitial:NP,disable:MP,document:SP,flow:jP,flowInitial:CP,insideSpan:AP,string:TP,text:RP},Symbol.toStringTag,{value:"Module"}));function OP(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let l=[],u=[];const d={attempt:C(T),check:C(R),consume:S,enter:N,exit:A,interrupt:C(R,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:e,previous:null,sliceSerialize:m,sliceStream:x,write:g};let p=t.tokenize.call(f,d);return t.resolveAll&&o.push(t),f;function g(D){return l=na(l,D),_(),l[l.length-1]!==null?[]:(O(t,0),f.events=Kf(o,f.events,f),f.events)}function m(D,F){return PP(x(D),F)}function x(D){return DP(l,D)}function v(){const{_bufferIndex:D,_index:F,line:ee,column:H,offset:P}=r;return{_bufferIndex:D,_index:F,line:ee,column:H,offset:P}}function k(D){a[D.line]=D.column,I()}function _(){for(;r._index<l.length;){const D=l[r._index];if(typeof D=="string"){const F=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<D.length;)E(D.charCodeAt(r._bufferIndex))}else E(D)}}function E(D){p=p(D)}function S(D){Zt(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,I()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=D}function N(D,F){const ee=F||{};return ee.type=D,ee.start=v(),f.events.push(["enter",ee,f]),u.push(ee),ee}function A(D){const F=u.pop();return F.end=v(),f.events.push(["exit",F,f]),F}function T(D,F){O(D,F.from)}function R(D,F){F.restore()}function C(D,F){return ee;function ee(H,P,K){let V,Z,le,B;return Array.isArray(H)?Y(H):"tokenize"in H?Y([H]):U(H);function U($){return fe;function fe(ae){const xe=ae!==null&&$[ae],Ie=ae!==null&&$.null,ze=[...Array.isArray(xe)?xe:xe?[xe]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return Y(ze)(ae)}}function Y($){return V=$,Z=0,$.length===0?K:q($[Z])}function q($){return fe;function fe(ae){return B=M(),le=$,$.partial||(f.currentConstruct=$),$.name&&f.parser.constructs.disable.null.includes($.name)?W():$.tokenize.call(F?Object.assign(Object.create(f),F):f,d,te,W)(ae)}}function te($){return D(le,B),P}function W($){return B.restore(),++Z<V.length?q(V[Z]):K}}}function O(D,F){D.resolveAll&&!o.includes(D)&&o.push(D),D.resolve&&wa(f.events,F,f.events.length-F,D.resolve(f.events.slice(F),f)),D.resolveTo&&(f.events=D.resolveTo(f.events,f))}function M(){const D=v(),F=f.previous,ee=f.currentConstruct,H=f.events.length,P=Array.from(u);return{from:H,restore:K};function K(){r=D,f.previous=F,f.currentConstruct=ee,f.events.length=H,u=P,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function DP(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let l;if(n===a)l=[e[n].slice(r,o)];else{if(l=e.slice(n,a),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}o>0&&l.push(e[a].slice(0,o))}return l}function PP(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const o=e[n];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&&a)continue;l=" ";break}default:l=String.fromCharCode(o)}a=o===-2,r.push(l)}return r.join("")}function FP(e){const r={constructs:J4([LP,...(e||{}).extensions||[]]),content:a(tD),defined:[],document:a(rD),flow:a(bP),lazy:{},string:a(_P),text:a(wP)};return r;function a(o){return l;function l(u){return OP(r,o,u)}}}function BP(e){for(;!aR(e););return e}const Cw=/[\0\t\n\r]/g;function zP(){let e=1,t="",n=!0,r;return a;function a(o,l,u){o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o));const d=[];let f=0;for(t="",n&&(o.charCodeAt(0)===65279&&f++,n=void 0);f<o.length;){Cw.lastIndex=f;const p=Cw.exec(o),g=p&&p.index!==void 0?p.index:o.length,m=o.charCodeAt(g);if(!p){t=o.slice(f);break}if(m===10&&f===g&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),f<g&&(d.push(o.slice(f,g)),e+=g-f),m){case 0:{d.push(65533),e++;break}case 9:{const x=Math.ceil(e/4)*4;for(d.push(-2);e++<x;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}f=g+1}return u&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const qP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function UP(e){return e.replace(qP,HP)}function HP(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return eR(n.slice(o?2:1),o?16:10)}return ik(n)||e}const dR={}.hasOwnProperty;function $P(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),WP(n)(BP(FP(n).document().write(zP()(e,t,!0))))}function WP(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(sn),autolinkProtocol:I,autolinkEmail:I,atxHeading:l(Oe),blockQuote:l(ze),characterEscape:I,characterReference:I,codeFenced:l(mt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(mt,u),codeText:l(ut,u),codeTextData:I,data:I,codeFlowValue:I,definition:l($e),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(qe),hardBreakEscape:l(rt),hardBreakTrailing:l(rt),htmlFlow:l(ot,u),htmlFlowData:I,htmlText:l(ot,u),htmlTextData:I,image:l(At),label:u,link:l(sn),listItem:l(Ht),listItemValue:x,listOrdered:l(Xt,m),listUnordered:l(Xt),paragraph:l(We),reference:te,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(Oe),strong:l(De),thematicBreak:l(nt)},exit:{atxHeading:f(),atxHeadingSequence:R,autolink:f(),autolinkEmail:Ie,autolinkProtocol:xe,blockQuote:f(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:fe,characterReference:ae,codeFenced:f(E),codeFencedFence:_,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:f(S),codeText:f(K),codeTextData:D,data:D,definition:f(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:A,emphasis:f(),hardBreakEscape:f(ee),hardBreakTrailing:f(ee),htmlFlow:f(H),htmlFlowData:D,htmlText:f(P),htmlTextData:D,image:f(Z),label:B,labelText:le,lineEnding:F,link:f(V),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:W,resourceDestinationString:U,resourceTitleString:Y,resource:q,setextHeading:f(M),setextHeadingLineSequence:O,setextHeadingText:C,strong:f(),thematicBreak:f()}};fR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(de){let _e={type:"root",children:[],position:void 0};const Ue={stack:[_e],tokenStack:[],config:t,enter:d,exit:p,buffer:u,resume:g,data:n},ge=[],ft=[];let ht=-1;for(;++ht<de.length;)if(ft.push(de[ht]),de[ht][1].type==="listOrdered"||de[ht][1].type==="listUnordered")if(de[ht][0]==="enter")ge.push(ft.length-1);else{const vt=ge.pop();o(ft,vt)}for(de=ft,ht=-1;++ht<de.length;){const vt=t[de[ht][0]];de[ht][0]==="enter"&&t.beforeEnter.length>0&&a(t.beforeEnter,{...Ue,sliceSerialize:de[ht][2].sliceSerialize},de[ht][1]),dR.call(vt,de[ht][1].type)&&vt[de[ht][1].type].call({...Ue,sliceSerialize:de[ht][2].sliceSerialize},de[ht][1]),de[ht][0]==="exit"&&t.afterExit.length>0&&a(t.afterExit,{...Ue,sliceSerialize:de[ht][2].sliceSerialize},de[ht][1])}if(Ue.tokenStack.length>0){const vt=Ue.tokenStack[Ue.tokenStack.length-1];(vt[1]||jw).call(Ue,void 0,vt[0])}for(_e.position={start:Bs(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Bs(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},ht=-1;++ht<t.transforms.length;)_e=t.transforms[ht](_e)||_e;return _e}function a(de,_e,Ue){let ge=-1;for(;++ge<de.length;)de[ge].call(_e,Ue)}function o(de,_e){const Ue=de.length-1;let ge=_e-1,ft=-1,ht=!1,vt,pt,Vt,Gt;const Ze=[];for(;++ge<=Ue;){const $t=de[ge];switch($t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$t[0]==="enter"?ft++:ft--,Gt=void 0;break}case"lineEndingBlank":{$t[0]==="enter"&&(vt&&!Gt&&!ft&&!Vt&&(Vt=ge),Gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Gt=void 0}if(!ft&&$t[0]==="enter"&&$t[1].type==="listItemPrefix"||ft===-1&&$t[0]==="exit"&&($t[1].type==="listUnordered"||$t[1].type==="listOrdered")){if(vt){let tn=ge;for(pt=void 0;tn--;){const on=de[tn];if(on[1].type==="lineEnding"||on[1].type==="lineEndingBlank"){if(on[0]==="exit")continue;pt&&(de[pt][1].type="lineEndingBlank",ht=!0),on[1].type="lineEnding",pt=tn}else if(!(on[1].type==="linePrefix"||on[1].type==="blockQuotePrefix"||on[1].type==="blockQuotePrefixWhitespace"||on[1].type==="blockQuoteMarker"||on[1].type==="listItemIndent"))break}Vt&&(!pt||Vt<pt)&&(vt._spread=!0),vt.end=Object.assign({},pt?de[pt][1].start:$t[1].end),Ze.push({at:pt||ge,event:["exit",vt,$t[2]]})}if($t[1].type==="listItemPrefix"){const tn={type:"listItem",_spread:!1,start:Object.assign({},$t[1].start),end:void 0};vt=tn,Ze.push({at:ge,event:["enter",tn,$t[2]]}),Vt=void 0,Gt=!0}}}const qt=de.splice(_e);let kt=0;for(ge=-1;++ge<qt.length;){for(;kt<Ze.length&&Ze[kt].at===_e+ge;)de.push(Ze[kt++].event);de.push(qt[ge])}de[_e][1]._spread=ht}function l(de,_e){return Ue;function Ue(ge){d.call(this,de(ge),ge),_e&&_e.call(this,ge)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(de,_e,Ue){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([_e,Ue||void 0]),de.position={start:Bs(_e.start),end:void 0}}function f(de){return _e;function _e(Ue){de&&de.call(this,Ue),p.call(this,Ue)}}function p(de,_e){const Ue=this.stack.pop(),ge=this.tokenStack.pop();if(!ge)throw new Error("Cannot close `"+de.type+"` ("+gu({start:de.start,end:de.end})+"): it’s not open");ge[0].type!==de.type&&(_e?_e.call(this,de,ge[0]):(ge[1]||jw).call(this,de,ge[0])),Ue.position.end=Bs(de.end)}function g(){return rk(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(de){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function v(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=de}function k(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=de}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de.replace(/(\r?\n|\r)$/g,"")}function N(de){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=_e,Ue.identifier=Ea(this.sliceSerialize(de)).toLowerCase()}function A(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.title=de}function T(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.url=de}function R(de){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Ue=this.sliceSerialize(de).length;_e.depth=Ue}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function O(de){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function I(de){const Ue=this.stack[this.stack.length-1].children;let ge=Ue[Ue.length-1];(!ge||ge.type!=="text")&&(ge=et(),ge.position={start:Bs(de.start),end:void 0},Ue.push(ge)),this.stack.push(ge)}function D(de){const _e=this.stack.pop();_e.value+=this.sliceSerialize(de),_e.position.end=Bs(de.end)}function F(de){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=_e.children[_e.children.length-1];Ue.position.end=Bs(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(I.call(this,de),D.call(this,de))}function ee(){this.data.atHardBreak=!0}function H(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de}function P(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de}function K(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.value=de}function V(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=_e,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function Z(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=_e,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function le(de){const _e=this.sliceSerialize(de),Ue=this.stack[this.stack.length-2];Ue.label=UP(_e),Ue.identifier=Ea(_e).toLowerCase()}function B(){const de=this.stack[this.stack.length-1],_e=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const ge=de.children;Ue.children=ge}else Ue.alt=_e}function U(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.url=de}function Y(){const de=this.resume(),_e=this.stack[this.stack.length-1];_e.title=de}function q(){this.data.inReference=void 0}function te(){this.data.referenceType="collapsed"}function W(de){const _e=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=_e,Ue.identifier=Ea(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function $(de){this.data.characterReferenceType=de.type}function fe(de){const _e=this.sliceSerialize(de),Ue=this.data.characterReferenceType;let ge;Ue?(ge=eR(_e,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=ik(_e);const ft=this.stack[this.stack.length-1];ft.value+=ge}function ae(de){const _e=this.stack.pop();_e.position.end=Bs(de.end)}function xe(de){D.call(this,de);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(de)}function Ie(de){D.call(this,de);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(de)}function ze(){return{type:"blockquote",children:[],position:void 0}}function mt(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function ut(){return{type:"inlineCode",value:"",position:void 0}}function $e(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function qe(){return{type:"emphasis",children:[],position:void 0}}function Oe(){return{type:"heading",depth:0,children:[],position:void 0}}function rt(){return{type:"break",position:void 0}}function ot(){return{type:"html",value:"",position:void 0}}function At(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function sn(){return{type:"link",title:null,url:"",children:[],position:void 0}}function Xt(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[],position:void 0}}function Ht(de){return{type:"listItem",spread:de._spread,checked:null,children:[],position:void 0}}function We(){return{type:"paragraph",children:[],position:void 0}}function De(){return{type:"strong",children:[],position:void 0}}function et(){return{type:"text",value:"",position:void 0}}function nt(){return{type:"thematicBreak",position:void 0}}}function Bs(e){return{line:e.line,column:e.column,offset:e.offset}}function fR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?fR(e,r):VP(e,r)}}function VP(e,t){let n;for(n in t)if(dR.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"afterExit":case"beforeEnter":{const r=t[n];r&&e[n].push(r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function jw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+gu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+gu({start:t.start,end:t.end})+") is still open")}function GP(e){const t=this;t.parser=n;function n(r){return $P(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function KP(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function YP(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
52
|
-
`}]}function QP(e,t){const n=t.value?t.value+`
|
|
53
|
-
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};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 XP(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZP(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JP(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Kl(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let l,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=o+1,u+=1,e.footnoteCounts.set(r,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(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 e6(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function t6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function pR(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const l=a[a.length-1];return l&&l.type==="text"?l.value+=r:a.push({type:"text",value:r}),a}function n6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return pR(e,t);const a={src:Kl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function r6(e,t){const n={src:Kl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function i6(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function a6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return pR(e,t);const a={href:Kl(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function s6(e,t){const n={href:Kl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function o6(e,t,n){const r=e.all(t),a=n?l6(n):hR(t),o={},l=[];if(typeof t.checked=="boolean"){const p=r[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.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<r.length;){const p=r[u];(a||u!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
|
|
54
|
-
`}),p.type==="element"&&p.tagName==="p"&&!a?l.push(...p.children):l.push(p)}const d=r[r.length-1];d&&(a||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 l6(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=hR(n[r])}return t}function hR(e){const t=e.spread;return t??e.children.length>1}function c6(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const l=r[a];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function u6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function d6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function f6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function p6(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),a.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Jv(t.children[1]),d=V4(t.children[t.children.length-1]);u&&d&&(l.position={start:u,end:d}),a.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function h6(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let d=-1;const f=[];for(;++d<u;){const g=t.children[d],m={},x=l?l[d]:void 0;x&&(m.align=x);let v={type:"element",tagName:o,properties:m,children:[]};g&&(v.children=e.all(g),e.patch(g,v),v=e.applyData(g,v)),f.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function g6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Tw=9,Rw=32;function m6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const o=[];for(;r;)o.push(Aw(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return o.push(Aw(t.slice(a),a>0,!1)),o.join("")}function Aw(e,t,n){let r=0,a=e.length;if(t){let o=e.codePointAt(r);for(;o===Tw||o===Rw;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(a-1);for(;o===Tw||o===Rw;)a--,o=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function x6(e,t){const n={type:"text",value:m6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function y6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const b6={blockquote:KP,break:YP,code:QP,delete:XP,emphasis:ZP,footnoteReference:JP,heading:e6,html:t6,imageReference:n6,image:r6,inlineCode:i6,linkReference:a6,link:s6,listItem:o6,list:c6,paragraph:u6,root:d6,strong:f6,table:p6,tableCell:g6,tableRow:h6,text:x6,thematicBreak:y6,toml:Zd,yaml:Zd,definition:Zd,footnoteDefinition:Zd};function Zd(){}const gR=-1,Yf=0,xu=1,If=2,sk=3,ok=4,lk=5,ck=6,mR=7,xR=8,{defineProperty:v6}=Object,yR=typeof self=="object"?self:globalThis,Iw=(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 yR[e](t)},k6=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),r=a=>{if(e.has(a))return e.get(a);const[o,l]=t[a];switch(o){case Yf:case gR:return n(l,a);case xu:{const u=n([],a);for(const d of l)u.push(r(d));return u}case If:{const u=n({},a);for(const[d,f]of l){const p=r(d),g=r(f);p==="__proto__"?v6(u,p,{value:g,configurable:!0,enumerable:!0,writable:!0}):u[p]=g}return u}case sk:return n(new Date(l),a);case ok:{const{source:u,flags:d}=l;return n(new RegExp(u,d),a)}case lk:{const u=n(new Map,a);for(const[d,f]of l)u.set(r(d),r(f));return u}case ck:{const u=n(new Set,a);for(const d of l)u.add(r(d));return u}case mR:{const{name:u,message:d}=l;return n(typeof yR[u]=="function"?Iw(u,d):new Error(d),a)}case xR:return n(BigInt(l),a);case"BigInt":return n(Object(BigInt(l)),a);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}case"-0":return-0}return n(Iw(o,l),a)};return r},Mw=e=>k6(new Map,e)(0),Lo="",{toString:_6}={},{keys:w6,is:E6}=Object,Jc=e=>{const t=typeof e;if(t!=="object"||!e)return[Yf,t];const n=_6.call(e).slice(8,-1);switch(n){case"Array":return[xu,Lo];case"Object":return[If,Lo];case"Date":return[sk,Lo];case"RegExp":return[ok,Lo];case"Map":return[lk,Lo];case"Set":return[ck,Lo];case"DataView":return[xu,n]}return n.includes("Array")?[xu,n]:e instanceof Error?[mR,e.name||"Error"]:[If,n]},Jd=([e,t])=>e===Yf&&(t==="function"||t==="symbol"),S6=(e,t,n,r)=>{const a=(l,u)=>{const d=r.push(l)-1;return n.set(u,d),d},o=l=>{if(n.has(l))return n.get(l);let[u,d]=Jc(l);switch(u){case Yf:{let p=l;switch(d){case"bigint":u=xR,p=l.toString();break;case"number":if(!l&&E6(l,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return a([gR],l)}return a([u,p],l)}case xu:{if(d){let m=l;return d==="DataView"?m=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(m=new Uint8Array(l)),a([d,[...m]],l)}const p=[],g=a([u,p],l);for(const m of l)p.push(o(m));return g}case If:{if(d)switch(d){case"BigInt":return a([d,l.toString()],l);case"Boolean":case"Number":case"String":return a([d,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const p=[],g=a([u,p],l);for(const m of w6(l))(e||!Jd(Jc(l[m])))&&p.push([o(m),o(l[m])]);return g}case sk:return a([u,isNaN(l.getTime())?Lo:l.toISOString()],l);case ok:{const{source:p,flags:g}=l;return a([u,{source:p,flags:g}],l)}case lk:{const p=[],g=a([u,p],l);for(const[m,x]of l)(e||!(Jd(Jc(m))||Jd(Jc(x))))&&p.push([o(m),o(x)]);return g}case ck:{const p=[],g=a([u,p],l);for(const m of l)(e||!Jd(Jc(m)))&&p.push(o(m));return g}}const{message:f}=l;return a([u,{name:d,message:f}],l)};return o},Lw=(e,{json:t,lossy:n}={})=>{const r=[];return S6(!(t||n),!!t,new Map,r)(e),r},Mf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Mw(Lw(e,t)):structuredClone(e):(e,t)=>Mw(Lw(e,t));function N6(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function C6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function j6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||N6,r=e.options.footnoteBackLabel||C6,a=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 p=e.all(f),g=String(f.identifier).toUpperCase(),m=Kl(g.toLowerCase());let x=0;const v=[],k=e.footnoteCounts.get(g);for(;k!==void 0&&++x<=k;){v.length>0&&v.push({type:"text",value:" "});let S=typeof n=="string"?n:n(d,x);typeof S=="string"&&(S={type:"text",value:S}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,x),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const _=p[p.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 p.push(...v);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(p,!0)};e.patch(f,E),u.push(E)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Mf(l),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
56
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
57
|
-
`}]}}const Pu=(function(e){if(e==null)return I6;if(typeof e=="function")return Qf(e);if(typeof e=="object")return Array.isArray(e)?T6(e):R6(e);if(typeof e=="string")return A6(e);throw new Error("Expected function, string, or object as test")});function T6(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pu(e[n]);return Qf(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function R6(e){const t=e;return Qf(n);function n(r){const a=r;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function A6(e){return Qf(t);function t(n){return n&&n.type===e}}function Qf(e){return t;function t(n,r,a){return!!(M6(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function I6(){return!0}function M6(e){return e!==null&&typeof e=="object"&&"type"in e}const bR=[],L6=!0,xv=!1,O6="skip";function vR(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const o=Pu(a),l=r?-1:1;u(e,void 0,[])();function u(d,f,p){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(d.type+(x?"<"+x+">":""))+")"})}return m;function m(){let x=bR,v,k,_;if((!t||o(d,f,p[p.length-1]||void 0))&&(x=D6(n(d,p)),x[0]===xv))return x;if("children"in d&&d.children){const E=d;if(E.children&&x[0]!==O6)for(k=(r?E.children.length:-1)+l,_=p.concat(E);k>-1&&k<E.children.length;){const S=E.children[k];if(v=u(S,k,_)(),v[0]===xv)return v;k=typeof v[1]=="number"?v[1]:k+l}}return x}}}function D6(e){return Array.isArray(e)?e:typeof e=="number"?[L6,e]:e==null?bR:[e]}function Xf(e,t,n,r){let a,o,l;typeof t=="function"&&typeof n!="function"?(o=void 0,l=t,a=n):(o=t,l=n,a=r),vR(e,o,u,a);function u(d,f){const p=f[f.length-1],g=p?p.children.indexOf(d):void 0;return l(d,g,p)}}const yv={}.hasOwnProperty,P6={};function F6(e,t){const n=t||P6,r=new Map,a=new Map,o=new Map,l={...b6,...n.handlers},u={all:f,applyData:z6,definitionById:r,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:l,one:d,options:n,patch:B6,wrap:U6};return Xf(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?r:a,m=String(p.identifier).toUpperCase();g.has(m)||g.set(m,p)}}),u;function d(p,g){const m=p.type,x=u.handlers[m];if(yv.call(u.handlers,m)&&x)return x(u,p,g);if(u.options.passThrough&&u.options.passThrough.includes(m)){if("children"in p){const{children:k,..._}=p,E=Mf(_);return E.children=u.all(p),E}return Mf(p)}return(u.options.unknownHandler||q6)(u,p,g)}function f(p){const g=[];if("children"in p){const m=p.children;let x=-1;for(;++x<m.length;){const v=u.one(m[x],p);if(v){if(x&&m[x-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=Ow(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=Ow(k.value))}Array.isArray(v)?g.push(...v):g.push(v)}}}return g}}function B6(e,t){e.position&&(t.position=CO(e))}function z6(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,Mf(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function q6(e,t){const n=t.data||{},r="value"in t&&!(yv.call(n,"hProperties")||yv.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function U6(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
58
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
59
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
60
|
-
`}),n}function Ow(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Dw(e,t){const n=F6(e,t),r=n.one(e,void 0),a=j6(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
61
|
-
`},a),o}function H6(e,t){return e&&"run"in e?async function(n,r){const a=Dw(n,{file:r,...t});await e.run(a,r)}:function(n,r){return Dw(n,{file:r,...e||t})}}function Pw(e){if(e)throw e}var Vh,Fw;function $6(){if(Fw)return Vh;Fw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=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 p=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!g)return!1;var m;for(m in f);return typeof m>"u"||e.call(f,m)},l=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},u=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Vh=function d(){var f,p,g,m,x,v,k=arguments[0],_=1,E=arguments.length,S=!1;for(typeof k=="boolean"&&(S=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_<E;++_)if(f=arguments[_],f!=null)for(p in f)g=u(k,p),m=u(f,p),k!==m&&(S&&m&&(o(m)||(x=a(m)))?(x?(x=!1,v=g&&a(g)?g:[]):v=g&&o(g)?g:{},l(k,{name:p,newValue:d(S,v,m)})):typeof m<"u"&&l(k,{name:p,newValue:m}));return k},Vh}var W6=$6();const Gh=$o(W6);function bv(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 V6(){const e=[],t={run:n,use:r};return t;function n(...a){let o=-1;const l=a.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...a);function u(d,...f){const p=e[++o];let g=-1;if(d){l(d);return}for(;++g<a.length;)(f[g]===null||f[g]===void 0)&&(f[g]=a[g]);a=f,p?G6(p,u)(...f):l(null,...f)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function G6(e,t){let n;return r;function r(...l){const u=e.length>l.length;let d;u&&l.push(a);try{d=e.apply(this,l)}catch(f){const p=f;if(u&&n)throw p;return a(p)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,a):d instanceof Error?a(d):o(d))}function a(l,...u){n||(n=!0,t(l,...u))}function o(l){a(null,l)}}const $a={basename:K6,dirname:Y6,extname:Q6,join:X6,sep:"/"};function K6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fu(e);let n=0,r=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else r<0&&(o=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else l<0&&(o=!0,l=a+1),u>-1&&(e.codePointAt(a)===t.codePointAt(u--)?u<0&&(r=a):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function Y6(e){if(Fu(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Q6(e){Fu(e);let t=e.length,n=-1,r=0,a=-1,o=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function X6(...e){let t=-1,n;for(;++t<e.length;)Fu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Z6(n)}function Z6(e){Fu(e);const t=e.codePointAt(0)===47;let n=J6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function J6(e,t){let n="",r=0,a=-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(!(a===l-1||o===1))if(a!==l-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),a=l,o=0;continue}}else if(n.length>0){n="",r=0,a=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,l):n=e.slice(a+1,l),r=l-a-1;a=l,o=0}else u===46&&o>-1?o++:o=-1}return n}function Fu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const e7={cwd:t7};function t7(){return"/"}function vv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function n7(e){if(typeof e=="string")e=new URL(e);else if(!vv(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 r7(e)}function r7(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Kh=["history","path","basename","stem","extname","dirname"];class kR{constructor(t){let n;t?vv(t)?n={path:t}:typeof t=="string"||i7(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":e7.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Kh.length;){const o=Kh[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)Kh.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?$a.basename(this.path):void 0}set basename(t){Qh(t,"basename"),Yh(t,"basename"),this.path=$a.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?$a.dirname(this.path):void 0}set dirname(t){Bw(this.basename,"dirname"),this.path=$a.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?$a.extname(this.path):void 0}set extname(t){if(Yh(t,"extname"),Bw(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=$a.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){vv(t)&&(t=n7(t)),Qh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?$a.basename(this.path,this.extname):void 0}set stem(t){Qh(t,"stem"),Yh(t,"stem"),this.path=$a.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new di(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Yh(e,t){if(e&&e.includes($a.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+$a.sep+"`")}function Qh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function i7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const a7=(function(e){const r=this.constructor.prototype,a=r[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),s7={}.hasOwnProperty;class uk extends a7{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=V6()}copy(){const t=new uk;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Gh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Jh("data",this.frozen),this.namespace[t]=n,this):s7.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Jh("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[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ef(t),r=this.parser||this.Parser;return Xh("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Xh("process",this.parser||this.Parser),Zh("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,l){const u=ef(t),d=r.parse(u);r.run(d,u,function(p,g,m){if(p||!g||!m)return f(p);const x=g,v=r.stringify(x,m);c7(v)?m.value=v:m.result=v,f(p,m)});function f(p,g){p||!g?l(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),Xh("processSync",this.parser||this.Parser),Zh("processSync",this.compiler||this.Compiler),this.process(t,a),qw("processSync","process",n),r;function a(o,l){n=!0,Pw(o),r=l}}run(t,n,r){zw(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(l,u){const d=ef(n);a.run(t,d,f);function f(p,g,m){const x=g||t;p?u(p):l?l(x):r(void 0,x,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,o),qw("runSync","run",r),a;function o(l,u){Pw(l),a=u,r=!0}}stringify(t,n){this.freeze();const r=ef(n),a=this.compiler||this.Compiler;return Zh("stringify",a),zw(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Jh("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);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[p,...g]=f;d(p,g)}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&&(a.settings=Gh(!0,a.settings,f.settings))}function u(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const g=f[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let g=-1,m=-1;for(;++g<r.length;)if(r[g][0]===f){m=g;break}if(m===-1)r.push([f,...p]);else if(p.length>0){let[x,...v]=p;const k=r[m][1];bv(k)&&bv(x)&&(x=Gh(!0,k,x)),r[m]=[f,x,...v]}}}}const o7=new uk().freeze();function Xh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Jh(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 zw(e){if(!bv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function qw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ef(e){return l7(e)?e:new kR(e)}function l7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function c7(e){return typeof e=="string"||u7(e)}function u7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const d7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Uw=[],Hw={allowDangerousHtml:!0},f7=/^(https?|ircs?|mailto|xmpp)$/i,p7=[{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 kf(e){const t=h7(e),n=g7(e);return m7(t.runSync(t.parse(n),n),e)}function h7(e){const t=e.rehypePlugins||Uw,n=e.remarkPlugins||Uw,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hw}:Hw;return o7().use(GP).use(n).use(H6,r).use(t)}function g7(e){const t=e.children||"",n=new kR;return typeof t=="string"&&(n.value=t),n}function m7(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||x7;for(const p of p7)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+d7+p.id,void 0);return Xf(e,f),IO(e,{Fragment:i.Fragment,components:a,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function f(p,g,m){if(p.type==="raw"&&m&&typeof g=="number")return l?m.children.splice(g,1):m.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let x;for(x in Hh)if(Object.hasOwn(Hh,x)&&Object.hasOwn(p.properties,x)){const v=p.properties[x],k=Hh[x];(k===null||k.includes(p.tagName))&&(p.properties[x]=d(String(v||""),x,p))}}if(p.type==="element"){let x=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!x&&r&&typeof g=="number"&&(x=!r(p,g,m)),x&&m&&typeof g=="number")return u&&p.children?m.children.splice(g,1,...p.children):m.children.splice(g,1),g}}}function x7(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||f7.test(e.slice(0,t))?e:""}function $w(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function y7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function b7(e,t,n){const a=Pu((n||{}).ignore||[]),o=v7(t);let l=-1;for(;++l<o.length;)vR(e,"text",u);function u(f,p){let g=-1,m;for(;++g<p.length;){const x=p[g],v=m?m.children:void 0;if(a(x,v?v.indexOf(x):void 0,m))return;m=x}if(m)return d(f,p)}function d(f,p){const g=p[p.length-1],m=o[l][0],x=o[l][1];let v=0;const _=g.children.indexOf(f);let E=!1,S=[];m.lastIndex=0;let N=m.exec(f.value);for(;N;){const T=N.index,R={index:N.index,input:N.input,stack:[...p,f]};let C=x(...N,R);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1)m.lastIndex=T+1;else{if(v!==T&&A({type:"text",value:f.value.slice(v,T)}),Array.isArray(C))for(const O of C)A(O);else C&&A(C);v=T+N[0].length,E=!0}if(!m.global)break;N=m.exec(f.value)}return E?(v<f.value.length&&A({type:"text",value:f.value.slice(v)}),g.children.splice(_,1,...S)):S=[f],_+S.length;function A(T){const R=S[S.length-1];R&&R.type==="text"&&T.type==="text"?R.value+=T.value:S.push(T)}}}function v7(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([k7(a[0]),_7(a[1])])}return t}function k7(e){return typeof e=="string"?new RegExp(y7(e),"g"):e}function _7(e){return typeof e=="function"?e:function(){return e}}const eg="phrasing",tg=["autolink","link","image","label"];function w7(){return{transforms:[R7],enter:{literalAutolink:S7,literalAutolinkEmail:ng,literalAutolinkHttp:ng,literalAutolinkWww:ng},exit:{literalAutolink:T7,literalAutolinkEmail:j7,literalAutolinkHttp:N7,literalAutolinkWww:C7}}}function E7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:eg,notInConstruct:tg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:eg,notInConstruct:tg},{character:":",before:"[ps]",after:"\\/",inConstruct:eg,notInConstruct:tg}]}}function S7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ng(e){this.config.enter.autolinkProtocol.call(this,e)}function N7(e){this.config.exit.autolinkProtocol.call(this,e)}function C7(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 j7(e){this.config.exit.autolinkEmail.call(this,e)}function T7(e){this.exit(e)}function R7(e){b7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,A7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),I7]],{ignore:["link","linkReference"]})}function A7(e,t,n,r,a){let o="";if(!_R(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!M7(n)))return!1;const l=L7(n+r);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 I7(e,t,n,r){return!_R(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function M7(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 L7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=$w(e,"(");let o=$w(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function _R(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ho(n)||Gf(n))&&(!t||n!==47)}wR.peek=H7;function O7(){this.buffer()}function D7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function P7(){this.buffer()}function F7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function B7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ea(this.sliceSerialize(e)).toLowerCase(),n.label=t}function z7(e){this.exit(e)}function q7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ea(this.sliceSerialize(e)).toLowerCase(),n.label=t}function U7(e){this.exit(e)}function H7(){return"["}function wR(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),u(),l(),o+=a.move("]"),o}function $7(){return{enter:{gfmFootnoteCallString:O7,gfmFootnoteCall:D7,gfmFootnoteDefinitionLabelString:P7,gfmFootnoteDefinition:F7},exit:{gfmFootnoteCallString:B7,gfmFootnoteCall:z7,gfmFootnoteDefinitionLabelString:q7,gfmFootnoteDefinition:U7}}}function W7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:wR},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,o,l){const u=o.createTracker(l);let d=u.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return d+=u.move(o.safe(o.associationId(r),{before:d,after:"]"})),p(),d+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),d+=u.move((t?`
|
|
62
|
-
`:" ")+o.indentLines(o.containerFlow(r,u.current()),t?ER:V7))),f(),d}}function V7(e,t,n){return t===0?e:ER(e,t,n)}function ER(e,t,n){return(n?"":" ")+e}const G7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];dk.attention=Z7;dk.peek=J7;function K7(){return{canContainEols:["delete"],enter:{strikethrough:Q7},exit:{strikethrough:X7}}}function Y7(){return{handlers:{delete:dk},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G7}]}}function Q7(e){this.enter({type:"delete",children:[],position:void 0},e)}function X7(e){this.exit(e)}function dk(e,t,n,r){const a=n.createTracker(r),o=n.stack.includes("strikethrough")?"~":"~~",l=n.enter("strikethrough");let u=a.move(o);return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move(o),l(),u}function Z7(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function J7(){return"~"}function e8(e){return e.length}function t8(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||e8,o=[],l=[],u=[],d=[];let f=0,p=-1;for(;++p<e.length;){const k=[],_=[];let E=-1;for(e[p].length>f&&(f=e[p].length);++E<e[p].length;){const S=n8(e[p][E]);if(n.alignDelimiters!==!1){const N=a(S);_[E]=N,(d[E]===void 0||N>d[E])&&(d[E]=N)}k.push(S)}l[p]=k,u[p]=_}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<f;)o[g]=Ww(r[g]);else{const k=Ww(r);for(;++g<f;)o[g]=k}g=-1;const m=[],x=[];for(;++g<f;){const k=o[g];let _="",E="";k===99?(_=":",E=":"):k===108?_=":":k===114&&(E=":");let S=n.alignDelimiters===!1?1:Math.max(1,d[g]-_.length-E.length);const N=_+"-".repeat(S)+E;n.alignDelimiters!==!1&&(S=_.length+S+E.length,S>d[g]&&(d[g]=S),x[g]=S),m[g]=N}l.splice(1,0,m),u.splice(1,0,x),p=-1;const v=[];for(;++p<l.length;){const k=l[p],_=u[p];g=-1;const E=[];for(;++g<f;){const S=k[g]||"";let N="",A="";if(n.alignDelimiters!==!1){const T=d[g]-(_[g]||0),R=o[g];R===114?N=" ".repeat(T):R===99?T%2?(N=" ".repeat(T/2+.5),A=" ".repeat(T/2-.5)):(N=" ".repeat(T/2),A=N):A=" ".repeat(T)}n.delimiterStart!==!1&&!g&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&S==="")&&(n.delimiterStart!==!1||g)&&E.push(" "),n.alignDelimiters!==!1&&E.push(N),E.push(S),n.alignDelimiters!==!1&&E.push(A),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||g!==f-1)&&E.push("|")}v.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return v.join(`
|
|
63
|
-
`)}function n8(e){return e==null?"":String(e)}function Ww(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}const r8=Pu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function i8(e,t,n,r){const a=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),a8);return a(),l}function a8(e,t,n){return">"+(n?"":" ")+e}function s8(e,t){return Vw(e,t.inConstruct,!0)&&!Vw(e,t.notInConstruct,!1)}function Vw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Gw(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;){const o=n.unsafe[a];if(o.character===`
|
|
64
|
-
`&&!o.before&&!o.after&&s8(n.stack,o))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
65
|
-
`}function o8(e,t){const n=String(e);let r=n.indexOf(t),a=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++o>l&&(l=o):o=1,a=r+t.length,r=n.indexOf(t,a);return l}function l8(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function c8(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 u8(e,t,n,r){const a=c8(n),o=e.value||"";if(l8(e,n)){const g=n.enter("codeIndented"),m=n.indentLines(o,d8);return g(),m}const l=n.createTracker(r),u=a.repeat(Math.max(o8(o,a)+1,3)),d=n.enter("codeFenced"),f=a==="`"?"GraveAccent":"Tilde";let p=l.move(u);if(e.lang){const g=n.enter(`codeFencedLang${f}`);p+=l.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...l.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${f}`);p+=l.move(" "),p+=l.move(n.safe(e.meta,{before:p,after:`
|
|
66
|
-
`,encode:["`"],...l.current()})),g()}return p+=l.move(`
|
|
67
|
-
`),o&&(p+=l.move(o+`
|
|
68
|
-
`)),p+=l.move(u),d(),p}function d8(e,t,n){return(n?"":" ")+e}function fk(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 f8(e,t,n,r){const a=fk(n),o=a==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("[");return f+=d.move(n.safe(n.associationId(e),{before:f,after:"]",...d.current()})),f+=d.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=n.enter("destinationRaw"),f+=d.move(n.safe(e.url,{before:f,after:e.title?" ":`
|
|
69
|
-
`,...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),f+=d.move(" "+a),f+=d.move(n.safe(e.title,{before:f,after:a,...d.current()})),f+=d.move(a),u()),l(),f}function p8(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}pk.attention=h8;pk.peek=g8;function pk(e,t,n,r){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},r);return a(),o}function h8(e,t){return{construct:"emphasis",markers:p8(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function g8(e,t,n){return n.options.emphasis||"*"}function m8(e){return"&#x"+e.toString(16).toUpperCase()+";"}function x8(e,t){let n=!1;return Xf(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,xv}),!!((!e.depth||e.depth<3)&&rk(e)&&(t.options.setext||n))}function y8(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(x8(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
|
|
70
|
-
`,after:`
|
|
71
|
-
`});return m(),g(),x+`
|
|
72
|
-
`+(a===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
73
|
-
`))+1))}const l="#".repeat(a),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(l+" ");let f=n.containerPhrasing(e,{before:"# ",after:`
|
|
74
|
-
`,...o.current()});const p=f.charCodeAt(0);return(p===9||p===32)&&(f=m8(p)+f.slice(1)),f=f?l+" "+f:l,n.options.closeAtx&&(f+=" "+l),d(),u(),f}SR.peek=b8;function SR(e){return e.value||""}function b8(){return"<"}NR.peek=v8;function NR(e,t,n,r){const a=fk(n),o=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("![");return f+=d.move(n.safe(e.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(u=n.enter("destinationRaw"),f+=d.move(n.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),f+=d.move(" "+a),f+=d.move(n.safe(e.title,{before:f,after:a,...d.current()})),f+=d.move(a),u()),f+=d.move(")"),l(),f}function v8(){return"!"}CR.peek=k8;function CR(e,t,n,r){const a=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let d=u.move("![");const f=n.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const p=n.stack;n.stack=p.filter(function(m){return m!=="phrasing"}),l=n.enter("reference");const g=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),a==="full"||!f||f!==g?d+=u.move(g+"]"):a==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function k8(){return"!"}jR.peek=_8;function jR(e,t,n){let r=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const l=n.unsafe[o],u=n.compilePattern(l);if(!l.atBreak)continue;let d;for(;d=u.exec(r);){let f=d.index;r.charCodeAt(f)===10&&r.charCodeAt(f-1)===13&&f--,r=r.slice(0,f)+" "+r.slice(d.index+1)}}return a+r+a}function _8(){return"`"}function TR(e,t){const n=rk(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}RR.peek=w8;function RR(e,t,n,r){const a=fk(n),o=a==='"'?"Quote":"Apostrophe",l=n.createTracker(r);if(TR(e,n)){const p=n.stack;n.stack=p.filter(function(x){return x!=="phrasing"});const g=n.enter("autolink");let m=l.move("<");return m+=l.move(n.containerPhrasing(e,{before:m,after:">",...l.current()})),m+=l.move(">"),g(),n.stack=p,m}const u=n.enter("link");let d=n.enter("label"),f=l.move("[");return f+=l.move(n.containerPhrasing(e,{before:f,after:"](",...l.current()})),f+=l.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=l.move("<"),f+=l.move(n.safe(e.url,{before:f,after:">",...l.current()})),f+=l.move(">")):(d=n.enter("destinationRaw"),f+=l.move(n.safe(e.url,{before:f,after:e.title?" ":")",...l.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=l.move(" "+a),f+=l.move(n.safe(e.title,{before:f,after:a,...l.current()})),f+=l.move(a),d()),f+=l.move(")"),u(),f}function w8(e,t,n){return TR(e,n)?"<":"["}AR.peek=E8;function AR(e,t,n,r){const a=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let d=u.move("[");const f=n.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(f+"]["),l();const p=n.stack;n.stack=p.filter(function(m){return m!=="phrasing"}),l=n.enter("reference");const g=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),a==="full"||!f||f!==g?d+=u.move(g+"]"):a==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function E8(){return"["}function hk(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 S8(e){const t=hk(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function N8(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 IR(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 C8(e,t,n,r){const a=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?N8(n):hk(n);const u=e.ordered?l==="."?")":".":S8(n);let d=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),IR(n)===l&&p){let g=-1;for(;++g<e.children.length;){const m=e.children[g];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(l=u),n.bulletCurrent=l;const f=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,a(),f}function j8(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 T8(e,t,n,r){const a=j8(n);let o=n.bulletCurrent||hk(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(l-o.length)),u.shift(l);const d=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,u.current()),p);return d(),f;function p(g,m,x){return m?(x?"":" ".repeat(l))+g:(x?o:o+" ".repeat(l-o.length))+g}}function R8(e,t,n,r){const a=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),a(),l}function A8(e,t,n,r){if(!e.children.some(function(u){return r8(u)}))return n.containerFlow(e,r);const o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),l}function I8(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gk.attention=M8;gk.peek=L8;function gk(e,t,n,r){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},r);return a(),o}function M8(e,t){return{construct:"strong",markers:I8(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function L8(e,t,n){return n.options.strong||"*"}function O8(e,t,n,r){const a=t?t.children:[],o=a.indexOf(e);return n.safe(e.value,{...r,afterNode:a[o+1],beforeNode:a[o-1]})}function D8(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 P8(e,t,n){const r=(IR(n)+(n.options.ruleSpaces?" ":"")).repeat(D8(n));return n.options.ruleSpaces?r.slice(0,-1):r}const MR={blockquote:i8,break:Gw,code:u8,definition:f8,emphasis:pk,hardBreak:Gw,heading:y8,html:SR,image:NR,imageReference:CR,inlineCode:jR,link:RR,linkReference:AR,list:C8,listItem:T8,paragraph:R8,root:A8,strong:gk,text:O8,thematicBreak:P8};function F8(){return{enter:{table:B8,tableData:Kw,tableHeader:Kw,tableRow:q8},exit:{codeText:U8,table:z8,tableData:rg,tableHeader:rg,tableRow:rg}}}function B8(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function z8(e){this.exit(e),this.data.inTable=void 0}function q8(e){this.enter({type:"tableRow",children:[]},e)}function rg(e){this.exit(e)}function Kw(e){this.enter({type:"tableCell",children:[]},e)}function U8(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,H8));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function H8(e,t){return t==="|"?t:e}function $8(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";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(x,v,k,_){return f(p(x,k,_),x.align)}function u(x,v,k,_){const E=g(x,k,_),S=f([E]);return S.slice(0,S.indexOf(`
|
|
76
|
-
`))}function d(x,v,k,_){const E=k.enter("tableCell"),S=k.enter("phrasing"),N=k.containerPhrasing(x,{..._,before:o,after:o});return S(),E(),N}function f(x,v){return t8(x,{align:v,alignDelimiters:r,padding:n,stringLength:a})}function p(x,v,k){const _=x.children;let E=-1;const S=[],N=v.enter("table");for(;++E<_.length;)S[E]=g(_[E],v,k);return N(),S}function g(x,v,k){const _=x.children;let E=-1;const S=[],N=v.enter("tableRow");for(;++E<_.length;)S[E]=d(_[E],x,v,k);return N(),S}function m(x,v,k){let _=MR.inlineCode(x,v,k);return k.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function W8(){return{exit:{taskListCheckValueChecked:Yw,taskListCheckValueUnchecked:Yw,paragraph:G8}}}function V8(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:K8}}}function Yw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function G8(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let o=-1,l;for(;++o<a.length;){const u=a[o];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function K8(e,t,n,r){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(l);let d=MR.listItem(e,t,n,{...r,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(p){return p+l}}function Y8(){return[w7(),$7(),K7(),F8(),W8()]}function Q8(e){return{extensions:[E7(),W7(e),Y7(),$8(e),V8()]}}const X8={tokenize:r9,partial:!0},LR={tokenize:i9,partial:!0},OR={tokenize:a9,partial:!0},DR={tokenize:s9,partial:!0},Z8={tokenize:o9,partial:!0},PR={name:"wwwAutolink",tokenize:t9,previous:BR},FR={name:"protocolAutolink",tokenize:n9,previous:zR},ds={name:"emailAutolink",tokenize:e9,previous:qR},Ka={};function J8(){return{text:Ka}}let Mo=48;for(;Mo<123;)Ka[Mo]=ds,Mo++,Mo===58?Mo=65:Mo===91&&(Mo=97);Ka[43]=ds;Ka[45]=ds;Ka[46]=ds;Ka[95]=ds;Ka[72]=[ds,FR];Ka[104]=[ds,FR];Ka[87]=[ds,PR];Ka[119]=[ds,PR];function e9(e,t,n){const r=this;let a,o;return l;function l(g){return!kv(g)||!qR.call(r,r.previous)||mk(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(g))}function u(g){return kv(g)?(e.consume(g),u):g===64?(e.consume(g),d):n(g)}function d(g){return g===46?e.check(Z8,p,f)(g):g===45||g===95||ui(g)?(o=!0,e.consume(g),d):p(g)}function f(g){return e.consume(g),a=!0,d}function p(g){return o&&a&&yi(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function t9(e,t,n){const r=this;return a;function a(l){return l!==87&&l!==119||!BR.call(r,r.previous)||mk(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(X8,e.attempt(LR,e.attempt(OR,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function n9(e,t,n){const r=this;let a="",o=!1;return l;function l(g){return(g===72||g===104)&&zR.call(r,r.previous)&&!mk(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(g),e.consume(g),u):n(g)}function u(g){if(yi(g)&&a.length<5)return a+=String.fromCodePoint(g),e.consume(g),u;if(g===58){const m=a.toLowerCase();if(m==="http"||m==="https")return e.consume(g),d}return n(g)}function d(g){return g===47?(e.consume(g),o?f:(o=!0,d)):n(g)}function f(g){return g===null||Tf(g)||Gn(g)||Ho(g)||Gf(g)?n(g):e.attempt(LR,e.attempt(OR,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function r9(e,t,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),a):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function i9(e,t,n){let r,a,o;return l;function l(f){return f===46||f===95?e.check(DR,d,u)(f):f===null||Gn(f)||Ho(f)||f!==45&&Gf(f)?d(f):(o=!0,e.consume(f),l)}function u(f){return f===95?r=!0:(a=r,r=void 0),e.consume(f),l}function d(f){return a||r||!o?n(f):t(f)}}function a9(e,t){let n=0,r=0;return a;function a(l){return l===40?(n++,e.consume(l),a):l===41&&r<n?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(DR,t,o)(l):l===null||Gn(l)||Ho(l)?t(l):(e.consume(l),a)}function o(l){return l===41&&r++,e.consume(l),a}}function s9(e,t,n){return r;function r(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),r):u===38?(e.consume(u),o):u===93?(e.consume(u),a):u===60||u===null||Gn(u)||Ho(u)?t(u):n(u)}function a(u){return u===null||u===40||u===91||Gn(u)||Ho(u)?t(u):r(u)}function o(u){return yi(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):yi(u)?(e.consume(u),l):n(u)}}function o9(e,t,n){return r;function r(o){return e.consume(o),a}function a(o){return ui(o)?n(o):t(o)}}function BR(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Gn(e)}function zR(e){return!yi(e)}function qR(e){return!(e===47||kv(e))}function kv(e){return e===43||e===45||e===46||e===95||ui(e)}function mk(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const l9={tokenize:m9,partial:!0};function c9(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:p9,continuation:{tokenize:h9},exit:g9}},text:{91:{name:"gfmFootnoteCall",tokenize:f9},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:u9,resolveTo:d9}}}}function u9(e,t,n){const r=this;let a=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const d=r.events[a][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 n(d);const f=Ea(r.sliceSerialize({start:l.end,end:r.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function d9(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.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[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function f9(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return u;function u(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),d}function d(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(g){if(o>999||g===93&&!l||g===null||g===91||Gn(g))return n(g);if(g===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return a.includes(Ea(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Gn(g)||(l=!0),o++,e.consume(g),g===92?p:f}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,f):f(g)}}function p9(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.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",p):n(v)}function p(v){if(l>999||v===93&&!u||v===null||v===91||Gn(v))return n(v);if(v===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=Ea(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Gn(v)||(u=!0),l++,e.consume(v),v===92?g:p}function g(v){return v===91||v===92||v===93?(e.consume(v),l++,p):p(v)}function m(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),a.includes(o)||a.push(o),Mn(e,x,"gfmFootnoteDefinitionWhitespace")):n(v)}function x(v){return t(v)}}function h9(e,t,n){return e.check(Du,t,e.attempt(l9,t,n))}function g9(e){e.exit("gfmFootnoteDefinition")}function m9(e,t,n){const r=this;return Mn(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function x9(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(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 p={type:"strikethrough",start:Object.assign({},l[f][1].start),end:Object.assign({},l[d][1].end)},g={type:"strikethroughText",start:Object.assign({},l[f][1].end),end:Object.assign({},l[d][1].start)},m=[["enter",p,u],["enter",l[f][1],u],["exit",l[f][1],u],["enter",g,u]],x=u.parser.constructs.insideSpan.null;x&&wa(m,m.length,0,Kf(x,l.slice(f+1,d),u)),wa(m,m.length,0,[["exit",g,u],["enter",l[d][1],u],["exit",l[d][1],u],["exit",p,u]]),wa(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,p=this.events;let g=0;return m;function m(v){return f===126&&p[p.length-1][1].type!=="characterEscape"?d(v):(l.enter("strikethroughSequenceTemporary"),x(v))}function x(v){const k=Af(f);if(v===126)return g>1?d(v):(l.consume(v),g++,x);if(g<2&&!n)return d(v);const _=l.exit("strikethroughSequenceTemporary"),E=Af(v);return _._open=!E||E===2&&!!k,_._close=!k||k===2&&!!E,u(v)}}}class y9{constructor(){this.map=[],this.index=new Map}add(t,n,r){b9(this,t,n,r)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0,this.index.clear()}}function b9(e,t,n,r){if(n===0&&r.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,a[2].push(...r);return}const o=[t,n,r];e.map.push(o),e.index.set(t,o)}function v9(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function k9(){return{flow:{null:{name:"table",tokenize:_9,resolveAll:w9}}}}function _9(e,t,n){const r=this;let a=0,o=0,l;return u;function u(I){let D=r.events.length-1;for(;D>-1;){const{type:H}=r.events[D][1];if(H==="lineEnding"||H==="linePrefix")D--;else break}const F=D>-1?r.events[D][1].type:null,ee=F==="tableHead"||F==="tableRow"?R:d;return ee===R&&r.parser.lazy[r.now().line]?n(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),p(I)}function p(I){return I===null?n(I):Zt(I)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),x):n(I):yn(I)?Mn(e,p,"whitespace")(I):(o+=1,l&&(l=!1,a+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),l=!0,p):(e.enter("data"),g(I)))}function g(I){return I===null||I===124||Gn(I)?(e.exit("data"),p(I)):(e.consume(I),I===92?m:g)}function m(I){return I===92||I===124?(e.consume(I),g):g(I)}function x(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(e.enter("tableDelimiterRow"),l=!1,yn(I)?Mn(e,v,"linePrefix",r.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 yn(I)?Mn(e,_,"whitespace")(I):_(I)}function _(I){return I===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):I===45?(o+=1,E(I)):I===null||Zt(I)?A(I):T(I)}function E(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"),N):(e.exit("tableDelimiterFiller"),N(I))}function N(I){return yn(I)?Mn(e,A,"whitespace")(I):A(I)}function A(I){return I===124?v(I):I===null||Zt(I)?!l||a!==o?T(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):T(I)}function T(I){return n(I)}function R(I){return e.enter("tableRow"),C(I)}function C(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),C):I===null||Zt(I)?(e.exit("tableRow"),t(I)):yn(I)?Mn(e,C,"whitespace")(I):(e.enter("data"),O(I))}function O(I){return I===null||I===124||Gn(I)?(e.exit("data"),C(I)):(e.consume(I),I===92?M:O)}function M(I){return I===92||I===124?(e.consume(I),O):O(I)}}function w9(e,t){let n=-1,r=!0,a=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,d=0,f,p,g;const m=new y9;for(;++n<e.length;){const x=e[n],v=x[1];x[0]==="enter"?v.type==="tableHead"?(u=!1,d!==0&&(Qw(m,t,d,f,p),p=void 0,d=0),f={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},m.add(n,0,[["enter",f,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,g=void 0,o=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},m.add(n,0,[["enter",p,t]])),a=v.type==="tableDelimiterRow"?2:p?3:1):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],g=tf(m,t,o,a,void 0,g),o=[0,0,0,0]),l[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],g=tf(m,t,o,a,void 0,g)),o=l,l=[o[1],n,0,0])):v.type==="tableHead"?(u=!0,d=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(d=n,o[1]!==0?(l[0]=l[1],g=tf(m,t,o,a,n,g)):l[1]!==0&&(g=tf(m,t,l,a,n,g)),a=0):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(l[3]=n)}for(d!==0&&Qw(m,t,d,f,p),m.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=v9(t.events,n))}return e}function tf(e,t,n,r,a,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},Ml(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const d=Ml(t.events,n[1]);if(o={type:l,start:Object.assign({},d),end:Object.assign({},d)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=Ml(t.events,n[2]),p=Ml(t.events,n[3]),g={type:u,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const m=t.events[n[2]],x=t.events[n[3]];if(m[1].end=Object.assign({},x[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,k=n[3]-n[2]-1;e.add(v,k,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return a!==void 0&&(o.end=Object.assign({},Ml(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Qw(e,t,n,r,a){const o=[],l=Ml(t.events,n);a&&(a.end=Object.assign({},l),o.push(["exit",a,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function Ml(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const E9={name:"tasklistCheck",tokenize:N9};function S9(){return{text:{91:E9}}}function N9(e,t,n){const r=this;return a;function a(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return Gn(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):n(d)}function l(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(d)}function u(d){return Zt(d)?t(d):yn(d)?e.check({tokenize:C9},t,n)(d):n(d)}}function C9(e,t,n){return Mn(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function j9(e){return J4([J8(),c9(),x9(e),k9(),S9()])}const T9={};function _f(e){const t=this,n=e||T9,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(j9(n)),o.push(Y8()),l.push(Q8(n))}const Xw=(function(e,t,n){const r=Pu(n);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(r(e.children[t],t,e))return e.children[t]}),Ko=(function(e){if(e==null)return I9;if(typeof e=="string")return A9(e);if(typeof e=="object")return R9(e);if(typeof e=="function")return xk(e);throw new Error("Expected function, string, or array as `test`")});function R9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ko(e[n]);return xk(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function A9(e){return xk(t);function t(n){return n.tagName===e}}function xk(e){return t;function t(n,r,a){return!!(M9(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function I9(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function M9(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const Zw=/\n/g,Jw=/[\t ]+/g,_v=Ko("br"),e2=Ko(q9),L9=Ko("p"),t2=Ko("tr"),O9=Ko(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",z9,U9]),UR=Ko(["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 D9(e,t){const n=t||{},r="children"in e?e.children:[],a=UR(e),o=WR(e,{whitespace:n.whitespace||"normal"}),l=[];(e.type==="text"||e.type==="comment")&&l.push(...$R(e,{breakBefore:!0,breakAfter:!0}));let u=-1;for(;++u<r.length;)l.push(...HR(r[u],e,{whitespace:o,breakBefore:u?void 0:a,breakAfter:u<r.length-1?_v(r[u+1]):a}));const d=[];let f;for(u=-1;++u<l.length;){const p=l[u];typeof p=="number"?f!==void 0&&p>f&&(f=p):p&&(f!==void 0&&f>-1&&d.push(`
|
|
77
|
-
`.repeat(f)||" "),f=-1,d.push(p))}return d.join("")}function HR(e,t,n){return e.type==="element"?P9(e,t,n):e.type==="text"?n.whitespace==="normal"?$R(e,n):F9(e):[]}function P9(e,t,n){const r=WR(e,n),a=e.children||[];let o=-1,l=[];if(O9(e))return l;let u,d;for(_v(e)||t2(e)&&Xw(t,e,t2)?d=`
|
|
78
|
-
`:L9(e)?(u=2,d=2):UR(e)&&(u=1,d=1);++o<a.length;)l=l.concat(HR(a[o],e,{whitespace:r,breakBefore:o?void 0:u,breakAfter:o<a.length-1?_v(a[o+1]):d}));return e2(e)&&Xw(t,e,e2)&&l.push(" "),u&&l.unshift(u),d&&l.push(d),l}function $R(e,t){const n=String(e.value),r=[],a=[];let o=0;for(;o<=n.length;){Zw.lastIndex=o;const d=Zw.exec(n),f=d&&"index"in d?d.index:n.length;r.push(B9(n.slice(o,f).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),o===0?t.breakBefore:!0,f===n.length?t.breakAfter:!0)),o=f+1}let l=-1,u;for(;++l<r.length;)r[l].charCodeAt(r[l].length-1)===8203||l<r.length-1&&r[l+1].charCodeAt(0)===8203?(a.push(r[l]),u=void 0):r[l]?(typeof u=="number"&&a.push(u),a.push(r[l]),u=0):(l===0||l===r.length-1)&&a.push(0);return a}function F9(e){return[String(e.value)]}function B9(e,t,n){const r=[];let a=0,o;for(;a<e.length;){Jw.lastIndex=a;const l=Jw.exec(e);o=l?l.index:e.length,!a&&!o&&l&&!t&&r.push(""),a!==o&&r.push(e.slice(a,o)),a=l?o+l[0].length:o}return a!==o&&!n&&r.push(""),r.join(" ")}function WR(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function z9(e){return!!(e.properties||{}).hidden}function q9(e){return e.tagName==="td"||e.tagName==="th"}function U9(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function H9(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(a)+"[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})"/})]},p={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},g={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:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},x=t.optional(a)+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"],E=["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:E},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},R=[T,g,u,n,e.C_BLOCK_COMMENT_MODE,p,f],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:A,contains:R.concat([{begin:/\(/,end:/\)/,keywords:A,contains:R.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:A,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:A,relevance:0},{begin:x,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:A,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,O,T,R,[g,{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 $9(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"]},n=H9(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function W9(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const a={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,n,a]};a.contains.push(u);const d={match:/\\"/},f={className:"string",begin:/'/,end:/'/},p={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},m=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],x=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"],E={match:/(\/[a-z._-]+)+/},S=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],N=["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,...N,"set","shopt",...A,...T]},contains:[x,e.SHEBANG(),v,g,o,l,E,u,d,f,p,n]}}function V9(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",l="("+r+"|"+t.optional(a)+"[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})"/})]},p={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},g={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:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},x=t.optional(a)+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"},E=[g,u,n,e.C_BLOCK_COMMENT_MODE,p,f],S={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:E.concat([{begin:/\(/,end:/\)/,keywords:_,contains:E.concat(["self"]),relevance:0}]),relevance:0},N={begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:x,returnBegin:!0,contains:[e.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"</",contains:[].concat(S,N,E,[g,{begin:e.IDENT_RE+"::",keywords:_},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:g,strings:f,keywords:_}}}function G9(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(a)+"[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})"/})]},p={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},g={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:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},x=t.optional(a)+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"],E=["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:E},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},R=[T,g,u,n,e.C_BLOCK_COMMENT_MODE,p,f],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:A,contains:R.concat([{begin:/\(/,end:/\)/,keywords:A,contains:R.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:A,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:A,relevance:0},{begin:x,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[f,p]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:A,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:A,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,O,T,R,[g,{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 K9(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],a=["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:a.concat(o),built_in:t,literal:r},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},p={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},g=e.inherit(p,{illegal:/\n/}),m={className:"subst",begin:/\{/,end:/\}/,keywords:l},x=e.inherit(m,{illegal:/\n/}),v={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,x]},k={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},_=e.inherit(k,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},x]});m.contains=[k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.C_BLOCK_COMMENT_MODE],x.contains=[_,v,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const E={variants:[f,k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},S={begin:"<",end:">",contains:[{beginKeywords:"in out"},u]},N=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"}},E,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:"("+N+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:l,contains:[{beginKeywords:n.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:[E,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},A]}}const Y9=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_-]*/}}),Q9=["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"],X9=["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=[...Q9,...X9],J9=["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(),eF=["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(),tF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),nF=["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 rF(e){const t=e.regex,n=Y9(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},a="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:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+eF.join("|")+")"},{begin:":(:)?("+tF.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+nF.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,n.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}]},n.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:a,attribute:J9.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...u,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Z9.join("|")+")\\b"}]}}function iF(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 aF(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 sF(e){const t=e.regex,n=/[_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(n,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function oF(e){const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const a={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:[r,o,a,l,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,f=/"(\\"|[^"])*"/,p=/'[^']*'/,g=t.either(d,f,p),m=t.concat(g,"(\\s*\\.\\s*",g,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[r,u,o,a,l,n]}}]}}var Ll="[0-9](_*[0-9])*",nf=`\\.(${Ll})`,rf="[0-9a-fA-F](_*[0-9a-fA-F])*",n2={className:"number",variants:[{begin:`(\\b(${Ll})((${nf})|\\.)?|(${nf}))[eE][+-]?(${Ll})[fFdD]?\\b`},{begin:`\\b(${Ll})((${nf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${nf})[fFdD]?\\b`},{begin:`\\b(${Ll})[fFdD]\\b`},{begin:`\\b0[xX]((${rf})\\.?|(${rf})?\\.(${rf}))[pP][+-]?(${Ll})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${rf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function VR(e,t,n){return n===-1?"":e.replace(t,r=>VR(e,t,n-1))}function lF(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+VR("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/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:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},p={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+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\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,n2,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},n2,f]}}const r2="[A-Za-z$_][0-9A-Za-z$_]*",cF=["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"],uF=["true","false","null","undefined","NaN","Infinity"],GR=["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"],KR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],YR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],dF=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],fF=[].concat(YR,GR,KR);function pF(e){const t=e.regex,n=(Z,{after:le})=>{const B="</"+Z[0].slice(1);return Z.input.indexOf(B,le)!==-1},r=r2,a={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Z,le)=>{const B=Z[0].length+Z.index,U=Z.input[B];if(U==="<"||U===","){le.ignoreMatch();return}U===">"&&(n(Z,{after:B})||le.ignoreMatch());let Y;const q=Z.input.substring(B);if(Y=q.match(/^\s*=/)){le.ignoreMatch();return}if((Y=q.match(/^\s+extends\s+/))&&Y.index===0){le.ignoreMatch();return}}},u={$pattern:r2,keyword:cF,literal:uF,built_in:fF,"variable.language":dF},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${p})((${f})|\\.)?|(${f}))[eE][+-]?(${d})\\b`},{begin:`\\b(${p})\\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:[]},x={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:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},N=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,{match:/\$\d+/},g];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const A=[].concat(S,m.contains),T=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(A)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},O={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:{_:[...GR,...KR]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(Z){return t.concat("(?!",Z.join("|"),")")}const ee={match:t.concat(/\b/,F([...YR,"super","import","await"].map(Z=>`${Z}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},H={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},K="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",V={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(K)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:O},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,S,{match:/\$\d+/},g,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},V,{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:K,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:a.begin,end:a.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:[R,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},H,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},ee,D,C,P,{match:/\$[(.]/}]}}const hF="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",gF={scope:"number",match:hF,relevance:0};function mF(e){const t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],a={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc","json5"],keywords:{literal:r},contains:[t,n,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,gF,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Ol="[0-9](_*[0-9])*",af=`\\.(${Ol})`,sf="[0-9a-fA-F](_*[0-9a-fA-F])*",xF={className:"number",variants:[{begin:`(\\b(${Ol})((${af})|\\.)?|(${af}))[eE][+-]?(${Ol})[fFdD]?\\b`},{begin:`\\b(${Ol})((${af})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${af})[fFdD]?\\b`},{begin:`\\b(${Ol})[fFdD]\\b`},{begin:`\\b0[xX]((${sf})\\.?|(${sf})?\\.(${sf}))[pP][+-]?(${Ol})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${sf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function yF(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"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},a={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,a]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,a]}]};a.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=xF,p=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),g={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=g;return m.variants[1].contains=[g],g.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,p,n,r,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:[g,e.C_LINE_COMMENT_MODE,p],relevance:0},e.C_LINE_COMMENT_MODE,p,u,d,l,e.C_NUMBER_MODE]},p]},{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 bF=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_-]*/}}),vF=["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"],kF=["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"],_F=[...vF,...kF],wF=["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(),QR=["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(),XR=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),EF=["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(),SF=QR.concat(XR).sort().reverse();function NF(e){const t=bF(e),n=SF,r="and or not only",a="[\\w-]+",o="("+a+"|@\\{"+a+"\\})",l=[],u=[],d=function(N){return{className:"string",begin:"~?"+N+".*?"+N}},f=function(N,A,T){return{className:N,begin:A,relevance:T}},p={$pattern:/[a-z-]+/,keyword:r,attribute:wF.join(" ")},g={begin:"\\(",end:"\\)",contains:u,keywords:p,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,g,f("variable","@@?"+a,10),f("variable","@\\{"+a+"\\}"),f("built_in","~?`[^`]*?`"),{className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const m=u.concat({begin:/\{/,end:/\}/,contains:l}),x={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("+EF.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:p,returnEnd:!0,contains:u,relevance:0}},_={className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a}],starts:{end:"[;}]",returnEnd:!0,contains:m}},E={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,x,f("keyword","all\\b"),f("variable","@\\{"+a+"\\}"),{begin:"\\b("+_F.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:":("+QR.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+XR.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},S={begin:a+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[E]};return l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,k,_,S,v,E,x,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:l}}function CF(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},a=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],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:a.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:a}].concat(a)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function jF(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={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,n]},a={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,n,r,a,o,l]}}function TF(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},a={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}/}]},p={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(f,{contains:[]}),m=e.inherit(p,{contains:[]});f.contains.push(m),p.contains.push(g);let x=[n,d];return[f,p,g,m].forEach(E=>{E.contains=E.contains.concat(x)}),x=x.concat(f,p),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:x},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:x}]}]},n,o,f,p,{className:"quote",begin:"^>\\s+",contains:x,end:"$"},a,r,d,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function RF(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+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,u={"variable.language":["this","super"],$pattern:n,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:n,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 AF(e){const t=e.regex,n=["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"],r=/[dualxmsipngr]{0,12}/,a={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},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},p=[e.BACKSLASH_ESCAPE,o,d],g=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(k,_,E="\\1")=>{const S=E==="\\1"?E:t.concat(E,_);return t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,S,/(?:\\.|[^\\\/])*?/,E,r)},x=(k,_,E)=>t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,E,r),v=[d,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),l,{className:"string",contains:p,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(...g,{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:x("(?:m|qr)?",/\//,/\//)},{begin:x("m|qr",t.either(...g,{capture:!0}),/\1/)},{begin:x("m|qr",/\(/,/\)/)},{begin:x("m|qr",/\[/,/\]/)},{begin:x("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:a,contains:v}}function IF(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),a=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o=t.concat(/[A-Z]+/,n),l={scope:"variable",match:"\\$+"+r},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}),p=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(d)}),g={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(H,P)=>{P.data._beginMatch=H[1]||H[2]},"on:end":(H,P)=>{P.data._beginMatch!==H[1]&&P.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),x=`[
|
|
80
|
-
]`,v={scope:"string",variants:[p,f,g,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"],E=["__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:E,literal:(H=>{const P=[];return H.forEach(K=>{P.push(K),K.toLowerCase()===K?P.push(K.toUpperCase()):P.push(K.toLowerCase())}),P})(_),built_in:S},T=H=>H.map(P=>P.replace(/\|\d+$/,"")),R={variants:[{match:[/new/,t.concat(x,"+"),t.concat("(?!",T(S).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(r,"\\b(?!\\()"),O={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[a,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[a,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},M={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:A,contains:[M,l,O,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,R]},D={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",T(E).join("\\b|"),"|",T(S).join("\\b|"),"\\b)"),r,t.concat(x,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(D);const F=[M,O,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,R],ee={begin:t.concat(/#\[\s*\\?/,t.either(a,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]},contains:["self",...F]},...F,{scope:"meta",variants:[{match:a},{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,D,O,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},R,{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,O,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 MF(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 LF(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function OF(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["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:r,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:/#/},p={begin:/\{\{/,relevance:0},g={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,p,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,d,p,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,p,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,p,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",x=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,v=`\\b|${r.join("|")}`,k={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${x}))[eE][+-]?(${m})[jJ]?(?=${v})`},{begin:`(${x})[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}]},E={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:["self",d,k,g,e.HASH_COMMENT_MODE]}]};return f.contains=[g,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"},g,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[E]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[k,E,g]}]}}function DF(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function PF(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=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]?/),a=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,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:n},{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:[a,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:a},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function FF(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=t.concat(r,/(::\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)],p={className:"subst",begin:/#\{/,end:/\}/,keywords:l},g={className:"string",contains:[e.BACKSLASH_ESCAPE,p],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,p]})]}]},m="[1-9](_?[0-9])*|0",x="[0-9](_?[0-9])*",v={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${x}))?([eE][+-]?(${x})|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}]},R=[g,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:l},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],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:[g,{begin:n}],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,p],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);p.contains=R,k.contains=R;const I=[{begin:/^\s*=>/,starts:{end:"$",contains:R}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:R}}];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(R)}}function BF(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),a=t.concat(n,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,a,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!"],p=["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:p,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+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:f,type:p}},{className:"punctuation",begin:"->"},o]}}const zF=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_-]*/}}),qF=["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"],UF=["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"],HF=[...qF,...UF],$F=["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(),WF=["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(),VF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),GF=["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 KF(e){const t=zF(e),n=VF,r=WF,a="@[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("+HF.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},u,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+GF.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:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:$F.join(" ")},contains:[{begin:a,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 YF(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function QF(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},a={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"],p=["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"],g=["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"],x=p,v=[...f,...d].filter(T=>!p.includes(T)),k={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},_={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},E={match:t.concat(/\b/,t.either(...x),/\s*\(/),relevance:0,keywords:{built_in:x}};function S(T){return t.concat(/\b/,t.either(...T.map(R=>R.replace(/\s+/,"\\s+"))),/\b/)}const N={scope:"keyword",match:S(m),relevance:0};function A(T,{exceptions:R,when:C}={}){const O=C;return R=R||[],T.map(M=>M.match(/\|\d+$/)||R.includes(M)?M:O(M)?`${M}|0`:M)}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:g},contains:[{scope:"type",match:S(l)},N,E,k,r,a,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,_]}}function ZR(e){return e?typeof e=="string"?e:e.source:null}function eu(e){return qn("(?=",e,")")}function qn(...e){return e.map(n=>ZR(n)).join("")}function XF(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function xi(...e){return"("+(XF(e).capture?"":"?:")+e.map(r=>ZR(r)).join("|")+")"}const yk=e=>qn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),ZF=["Protocol","Type"].map(yk),i2=["init","self"].map(yk),JF=["Any","Self"],ig=["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"],a2=["false","nil","true"],eB=["assignment","associativity","higherThan","left","lowerThan","none","right"],tB=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],s2=["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"],JR=xi(/[/=\-+!*%<>&|^~?]/,/[\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]/),e5=xi(JR,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),ag=qn(JR,e5,"*"),t5=xi(/[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]/),Lf=xi(t5,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ha=qn(t5,Lf,"*"),of=qn(/[A-Z]/,Lf,"*"),nB=["attached","autoclosure",qn(/convention\(/,xi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",qn(/objc\(/,Ha,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],rB=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function iB(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],a={match:[/\./,xi(...ZF,...i2)],className:{2:"keyword"}},o={match:qn(/\./,xi(...ig)),relevance:0},l=ig.filter(Oe=>typeof Oe=="string").concat(["_|0"]),u=ig.filter(Oe=>typeof Oe!="string").concat(JF).map(yk),d={variants:[{className:"keyword",match:xi(...u,...i2)}]},f={$pattern:xi(/\b\w+/,/#\w+/),keyword:l.concat(tB),literal:a2},p=[a,o,d],g={match:qn(/\./,xi(...s2)),relevance:0},m={className:"built_in",match:qn(/\b/,xi(...s2),/(?=\()/)},x=[g,m],v={match:/->/,relevance:0},k={className:"operator",relevance:0,variants:[{match:ag},{match:`\\.(\\.|${e5})+`}]},_=[v,k],E="([0-9]_*)+",S="([0-9a-fA-F]_*)+",N={className:"number",relevance:0,variants:[{match:`\\b(${E})(\\.(${E}))?([eE][+-]?(${E}))?\\b`},{match:`\\b0x(${S})(\\.(${S}))?([pP][+-]?(${E}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},A=(Oe="")=>({className:"subst",variants:[{match:qn(/\\/,Oe,/[0\\tnr"']/)},{match:qn(/\\/,Oe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),T=(Oe="")=>({className:"subst",match:qn(/\\/,Oe,/[\t ]*(?:[\r\n]|\r\n)/)}),R=(Oe="")=>({className:"subst",label:"interpol",begin:qn(/\\/,Oe,/\(/),end:/\)/}),C=(Oe="")=>({begin:qn(Oe,/"""/),end:qn(/"""/,Oe),contains:[A(Oe),T(Oe),R(Oe)]}),O=(Oe="")=>({begin:qn(Oe,/"/),end:qn(/"/,Oe),contains:[A(Oe),R(Oe)]}),M={className:"string",variants:[C(),C("#"),C("##"),C("###"),O(),O("#"),O("##"),O("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],D={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},F=Oe=>{const rt=qn(Oe,/\//),ot=qn(/\//,Oe);return{begin:rt,end:ot,contains:[...I,{scope:"comment",begin:`#(?!.*${ot})`,end:/$/}]}},ee={scope:"regexp",variants:[F("###"),F("##"),F("#"),D]},H={match:qn(/`/,Ha,/`/)},P={className:"variable",match:/\$\d+/},K={className:"variable",match:`\\$${Lf}+`},V=[H,P,K],Z={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:rB,contains:[..._,N,M]}]}},le={scope:"keyword",match:qn(/@/,xi(...nB),eu(xi(/\(/,/\s+/)))},B={scope:"meta",match:qn(/@/,Ha)},U=[Z,le,B],Y={match:eu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:qn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Lf,"+")},{className:"type",match:of,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:qn(/\s+&\s+/,eu(of)),relevance:0}]},q={begin:/</,end:/>/,keywords:f,contains:[...r,...p,...U,v,Y]};Y.contains.push(q);const te={match:qn(Ha,/\s*:/),keywords:"_|0",relevance:0},W={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",te,...r,ee,...p,...x,..._,N,M,...V,...U,Y]},$={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,Y]},fe={begin:xi(eu(qn(Ha,/\s*:/)),eu(qn(Ha,/\s+/,Ha,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ha}]},ae={begin:/\(/,end:/\)/,keywords:f,contains:[fe,...r,...p,..._,N,M,...U,Y,W],endsParent:!0,illegal:/["']/},xe={match:[/(func|macro)/,/\s+/,xi(H.match,Ha,ag)],className:{1:"keyword",3:"title.function"},contains:[$,ae,t],illegal:[/\[/,/%/]},Ie={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[$,ae,t],illegal:/\[|%/},ze={match:[/operator/,/\s+/,ag],className:{1:"keyword",3:"title"}},mt={begin:[/precedencegroup/,/\s+/,of],className:{1:"keyword",3:"title"},contains:[Y],keywords:[...eB,...a2],end:/}/},ut={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},$e={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},qe={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ha,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[$,...p,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:of},...p],relevance:0}]};for(const Oe of M.variants){const rt=Oe.contains.find(At=>At.label==="interpol");rt.keywords=f;const ot=[...p,...x,..._,N,M,...V];rt.contains=[...ot,{begin:/\(/,end:/\)/,contains:["self",...ot]}]}return{name:"Swift",keywords:f,contains:[...r,xe,Ie,ut,$e,qe,ze,mt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},ee,...p,...x,..._,N,M,...V,...U,Y,W]}}const Of="[A-Za-z$_][0-9A-Za-z$_]*",n5=["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"],r5=["true","false","null","undefined","NaN","Infinity"],i5=["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"],a5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],s5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],o5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],l5=[].concat(s5,i5,a5);function aB(e){const t=e.regex,n=(Z,{after:le})=>{const B="</"+Z[0].slice(1);return Z.input.indexOf(B,le)!==-1},r=Of,a={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Z,le)=>{const B=Z[0].length+Z.index,U=Z.input[B];if(U==="<"||U===","){le.ignoreMatch();return}U===">"&&(n(Z,{after:B})||le.ignoreMatch());let Y;const q=Z.input.substring(B);if(Y=q.match(/^\s*=/)){le.ignoreMatch();return}if((Y=q.match(/^\s+extends\s+/))&&Y.index===0){le.ignoreMatch();return}}},u={$pattern:Of,keyword:n5,literal:r5,built_in:l5,"variable.language":o5},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${p})((${f})|\\.)?|(${f}))[eE][+-]?(${d})\\b`},{begin:`\\b(${p})\\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:[]},x={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:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},N=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,{match:/\$\d+/},g];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const A=[].concat(S,m.contains),T=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(A)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},O={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:{_:[...i5,...a5]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(Z){return t.concat("(?!",Z.join("|"),")")}const ee={match:t.concat(/\b/,F([...s5,"super","import","await"].map(Z=>`${Z}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},H={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},K="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",V={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(K)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:O},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,S,{match:/\$\d+/},g,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},V,{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:K,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:a.begin,end:a.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:[R,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},H,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},ee,D,C,P,{match:/\$[(.]/}]}}function sB(e){const t=e.regex,n=aB(e),r=Of,a=["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:a},contains:[n.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:Of,keyword:n5.concat(d),literal:r5,built_in:l5.concat(a),"variable.language":o5},p={className:"meta",begin:"@"+r},g=(k,_,E)=>{const S=k.contains.findIndex(N=>N.label===_);if(S===-1)throw new Error("can not find mode to replace");k.contains.splice(S,1,E)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(p);const m=n.contains.find(k=>k.scope==="attr"),x=Object.assign({},m,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,m,x]),n.contains=n.contains.concat([p,o,l,x]),g(n,"shebang",e.SHEBANG()),g(n,"use_strict",u);const v=n.contains.find(k=>k.label==="func.def");return v.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function oB(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},a=/\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,a),/ *#/)},{begin:t.concat(/# */,u,/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,t.either(o,a),/ +/,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])|[%&])?/}]},p={className:"label",begin:/^\w+:/},g=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:[n,r,d,f,p,g,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 lB(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["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"],a={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:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,l,a,e.QUOTE_STRING_MODE,d,f,u]}}function cB(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,a={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:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{begin:/'/,end:/'/,contains:[a]},{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},a,{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(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:f}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function uB(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},a={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,a]},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"},x={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},v={begin:/\{/,end:/\}/,contains:[x],illegal:"\\n",relevance:0},k={begin:"\\[",end:"\\]",contains:[x],illegal:"\\n",relevance:0},_=[r,{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+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{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],E=[..._];return E.pop(),E.push(u),x.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:_}}const dB={arduino:$9,bash:W9,c:V9,cpp:G9,csharp:K9,css:rF,diff:iF,go:aF,graphql:sF,ini:oF,java:lF,javascript:pF,json:mF,kotlin:yF,less:NF,lua:CF,makefile:jF,markdown:TF,objectivec:RF,perl:AF,php:IF,"php-template":MF,plaintext:LF,python:OF,"python-repl":DF,r:PF,ruby:FF,rust:BF,scss:KF,shell:YF,sql:QF,swift:iB,typescript:sB,vbnet:oB,wasm:lB,xml:cB,yaml:uB};var sg,o2;function fB(){if(o2)return sg;o2=1;function e(ie){return ie instanceof Map?ie.clear=ie.delete=ie.set=function(){throw new Error("map is read-only")}:ie instanceof Set&&(ie.add=ie.clear=ie.delete=function(){throw new Error("set is read-only")}),Object.freeze(ie),Object.getOwnPropertyNames(ie).forEach(Le=>{const Je=ie[Le],Ft=typeof Je;(Ft==="object"||Ft==="function")&&!Object.isFrozen(Je)&&e(Je)}),ie}class t{constructor(Le){Le.data===void 0&&(Le.data={}),this.data=Le.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(ie){return ie.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(ie,...Le){const Je=Object.create(null);for(const Ft in ie)Je[Ft]=ie[Ft];return Le.forEach(function(Ft){for(const Fe in Ft)Je[Fe]=Ft[Fe]}),Je}const a="</span>",o=ie=>!!ie.scope,l=(ie,{prefix:Le})=>{if(ie.startsWith("language:"))return ie.replace("language:","language-");if(ie.includes(".")){const Je=ie.split(".");return[`${Le}${Je.shift()}`,...Je.map((Ft,Fe)=>`${Ft}${"_".repeat(Fe+1)}`)].join(" ")}return`${Le}${ie}`};class u{constructor(Le,Je){this.buffer="",this.classPrefix=Je.classPrefix,Le.walk(this)}addText(Le){this.buffer+=n(Le)}openNode(Le){if(!o(Le))return;const Je=l(Le.scope,{prefix:this.classPrefix});this.span(Je)}closeNode(Le){o(Le)&&(this.buffer+=a)}value(){return this.buffer}span(Le){this.buffer+=`<span class="${Le}">`}}const d=(ie={})=>{const Le={children:[]};return Object.assign(Le,ie),Le};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(Le){this.top.children.push(Le)}openNode(Le){const Je=d({scope:Le});this.add(Je),this.stack.push(Je)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Le){return this.constructor._walk(Le,this.rootNode)}static _walk(Le,Je){return typeof Je=="string"?Le.addText(Je):Je.children&&(Le.openNode(Je),Je.children.forEach(Ft=>this._walk(Le,Ft)),Le.closeNode(Je)),Le}static _collapse(Le){typeof Le!="string"&&Le.children&&(Le.children.every(Je=>typeof Je=="string")?Le.children=[Le.children.join("")]:Le.children.forEach(Je=>{f._collapse(Je)}))}}class p extends f{constructor(Le){super(),this.options=Le}addText(Le){Le!==""&&this.add(Le)}startScope(Le){this.openNode(Le)}endScope(){this.closeNode()}__addSublanguage(Le,Je){const Ft=Le.root;Je&&(Ft.scope=`language:${Je}`),this.add(Ft)}toHTML(){return new u(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(ie){return ie?typeof ie=="string"?ie:ie.source:null}function m(ie){return k("(?=",ie,")")}function x(ie){return k("(?:",ie,")*")}function v(ie){return k("(?:",ie,")?")}function k(...ie){return ie.map(Je=>g(Je)).join("")}function _(ie){const Le=ie[ie.length-1];return typeof Le=="object"&&Le.constructor===Object?(ie.splice(ie.length-1,1),Le):{}}function E(...ie){return"("+(_(ie).capture?"":"?:")+ie.map(Ft=>g(Ft)).join("|")+")"}function S(ie){return new RegExp(ie.toString()+"|").exec("").length-1}function N(ie,Le){const Je=ie&&ie.exec(Le);return Je&&Je.index===0}const A=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function T(ie,{joinWith:Le}){let Je=0;return ie.map(Ft=>{Je+=1;const Fe=Je;let it=g(Ft),ve="";for(;it.length>0;){const Me=A.exec(it);if(!Me){ve+=it;break}ve+=it.substring(0,Me.index),it=it.substring(Me.index+Me[0].length),Me[0][0]==="\\"&&Me[1]?ve+="\\"+String(Number(Me[1])+Fe):(ve+=Me[0],Me[0]==="("&&Je++)}return ve}).map(Ft=>`(${Ft})`).join(Le)}const R=/\b\B/,C="[a-zA-Z]\\w*",O="[a-zA-Z_]\\w*",M="\\b\\d+(\\.\\d+)?",I="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",D="\\b(0b[01]+)",F="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ee=(ie={})=>{const Le=/^#![ ]*\//;return ie.binary&&(ie.begin=k(Le,/.*\b/,ie.binary,/\b.*/)),r({scope:"meta",begin:Le,end:/$/,relevance:0,"on:begin":(Je,Ft)=>{Je.index!==0&&Ft.ignoreMatch()}},ie)},H={begin:"\\\\[\\s\\S]",relevance:0},P={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[H]},K={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[H]},V={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/},Z=function(ie,Le,Je={}){const Ft=r({scope:"comment",begin:ie,end:Le,contains:[]},Je);Ft.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 Fe=E("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 Ft.contains.push({begin:k(/[ ]+/,"(",Fe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ft},le=Z("//","$"),B=Z("/\\*","\\*/"),U=Z("#","$"),Y={scope:"number",begin:M,relevance:0},q={scope:"number",begin:I,relevance:0},te={scope:"number",begin:D,relevance:0},W={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[H,{begin:/\[/,end:/\]/,relevance:0,contains:[H]}]},$={scope:"title",begin:C,relevance:0},fe={scope:"title",begin:O,relevance:0},ae={begin:"\\.\\s*"+O,relevance:0};var Ie=Object.freeze({__proto__:null,APOS_STRING_MODE:P,BACKSLASH_ESCAPE:H,BINARY_NUMBER_MODE:te,BINARY_NUMBER_RE:D,COMMENT:Z,C_BLOCK_COMMENT_MODE:B,C_LINE_COMMENT_MODE:le,C_NUMBER_MODE:q,C_NUMBER_RE:I,END_SAME_AS_BEGIN:function(ie){return Object.assign(ie,{"on:begin":(Le,Je)=>{Je.data._beginMatch=Le[1]},"on:end":(Le,Je)=>{Je.data._beginMatch!==Le[1]&&Je.ignoreMatch()}})},HASH_COMMENT_MODE:U,IDENT_RE:C,MATCH_NOTHING_RE:R,METHOD_GUARD:ae,NUMBER_MODE:Y,NUMBER_RE:M,PHRASAL_WORDS_MODE:V,QUOTE_STRING_MODE:K,REGEXP_MODE:W,RE_STARTERS_RE:F,SHEBANG:ee,TITLE_MODE:$,UNDERSCORE_IDENT_RE:O,UNDERSCORE_TITLE_MODE:fe});function ze(ie,Le){ie.input[ie.index-1]==="."&&Le.ignoreMatch()}function mt(ie,Le){ie.className!==void 0&&(ie.scope=ie.className,delete ie.className)}function ut(ie,Le){Le&&ie.beginKeywords&&(ie.begin="\\b("+ie.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ie.__beforeBegin=ze,ie.keywords=ie.keywords||ie.beginKeywords,delete ie.beginKeywords,ie.relevance===void 0&&(ie.relevance=0))}function $e(ie,Le){Array.isArray(ie.illegal)&&(ie.illegal=E(...ie.illegal))}function qe(ie,Le){if(ie.match){if(ie.begin||ie.end)throw new Error("begin & end are not supported with match");ie.begin=ie.match,delete ie.match}}function Oe(ie,Le){ie.relevance===void 0&&(ie.relevance=1)}const rt=(ie,Le)=>{if(!ie.beforeMatch)return;if(ie.starts)throw new Error("beforeMatch cannot be used with starts");const Je=Object.assign({},ie);Object.keys(ie).forEach(Ft=>{delete ie[Ft]}),ie.keywords=Je.keywords,ie.begin=k(Je.beforeMatch,m(Je.begin)),ie.starts={relevance:0,contains:[Object.assign(Je,{endsParent:!0})]},ie.relevance=0,delete Je.beforeMatch},ot=["of","and","for","in","not","or","if","then","parent","list","value"],At="keyword";function sn(ie,Le,Je=At){const Ft=Object.create(null);return typeof ie=="string"?Fe(Je,ie.split(" ")):Array.isArray(ie)?Fe(Je,ie):Object.keys(ie).forEach(function(it){Object.assign(Ft,sn(ie[it],Le,it))}),Ft;function Fe(it,ve){Le&&(ve=ve.map(Me=>Me.toLowerCase())),ve.forEach(function(Me){const Ye=Me.split("|");Ft[Ye[0]]=[it,Xt(Ye[0],Ye[1])]})}}function Xt(ie,Le){return Le?Number(Le):Ht(ie)?0:1}function Ht(ie){return ot.includes(ie.toLowerCase())}const We={},De=ie=>{console.error(ie)},et=(ie,...Le)=>{console.log(`WARN: ${ie}`,...Le)},nt=(ie,Le)=>{We[`${ie}/${Le}`]||(console.log(`Deprecated as of ${ie}. ${Le}`),We[`${ie}/${Le}`]=!0)},de=new Error;function _e(ie,Le,{key:Je}){let Ft=0;const Fe=ie[Je],it={},ve={};for(let Me=1;Me<=Le.length;Me++)ve[Me+Ft]=Fe[Me],it[Me+Ft]=!0,Ft+=S(Le[Me-1]);ie[Je]=ve,ie[Je]._emit=it,ie[Je]._multi=!0}function Ue(ie){if(Array.isArray(ie.begin)){if(ie.skip||ie.excludeBegin||ie.returnBegin)throw De("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),de;if(typeof ie.beginScope!="object"||ie.beginScope===null)throw De("beginScope must be object"),de;_e(ie,ie.begin,{key:"beginScope"}),ie.begin=T(ie.begin,{joinWith:""})}}function ge(ie){if(Array.isArray(ie.end)){if(ie.skip||ie.excludeEnd||ie.returnEnd)throw De("skip, excludeEnd, returnEnd not compatible with endScope: {}"),de;if(typeof ie.endScope!="object"||ie.endScope===null)throw De("endScope must be object"),de;_e(ie,ie.end,{key:"endScope"}),ie.end=T(ie.end,{joinWith:""})}}function ft(ie){ie.scope&&typeof ie.scope=="object"&&ie.scope!==null&&(ie.beginScope=ie.scope,delete ie.scope)}function ht(ie){ft(ie),typeof ie.beginScope=="string"&&(ie.beginScope={_wrap:ie.beginScope}),typeof ie.endScope=="string"&&(ie.endScope={_wrap:ie.endScope}),Ue(ie),ge(ie)}function vt(ie){function Le(ve,Me){return new RegExp(g(ve),"m"+(ie.case_insensitive?"i":"")+(ie.unicodeRegex?"u":"")+(Me?"g":""))}class Je{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Me,Ye){Ye.position=this.position++,this.matchIndexes[this.matchAt]=Ye,this.regexes.push([Ye,Me]),this.matchAt+=S(Me)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Me=this.regexes.map(Ye=>Ye[1]);this.matcherRe=Le(T(Me,{joinWith:"|"}),!0),this.lastIndex=0}exec(Me){this.matcherRe.lastIndex=this.lastIndex;const Ye=this.matcherRe.exec(Me);if(!Ye)return null;const yt=Ye.findIndex((Pe,He)=>He>0&&Pe!==void 0),se=this.matchIndexes[yt];return Ye.splice(0,yt),Object.assign(Ye,se)}}class Ft{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Me){if(this.multiRegexes[Me])return this.multiRegexes[Me];const Ye=new Je;return this.rules.slice(Me).forEach(([yt,se])=>Ye.addRule(yt,se)),Ye.compile(),this.multiRegexes[Me]=Ye,Ye}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Me,Ye){this.rules.push([Me,Ye]),Ye.type==="begin"&&this.count++}exec(Me){const Ye=this.getMatcher(this.regexIndex);Ye.lastIndex=this.lastIndex;let yt=Ye.exec(Me);if(this.resumingScanAtSamePosition()&&!(yt&&yt.index===this.lastIndex)){const se=this.getMatcher(0);se.lastIndex=this.lastIndex+1,yt=se.exec(Me)}return yt&&(this.regexIndex+=yt.position+1,this.regexIndex===this.count&&this.considerAll()),yt}}function Fe(ve){const Me=new Ft;return ve.contains.forEach(Ye=>Me.addRule(Ye.begin,{rule:Ye,type:"begin"})),ve.terminatorEnd&&Me.addRule(ve.terminatorEnd,{type:"end"}),ve.illegal&&Me.addRule(ve.illegal,{type:"illegal"}),Me}function it(ve,Me){const Ye=ve;if(ve.isCompiled)return Ye;[mt,qe,ht,rt].forEach(se=>se(ve,Me)),ie.compilerExtensions.forEach(se=>se(ve,Me)),ve.__beforeBegin=null,[ut,$e,Oe].forEach(se=>se(ve,Me)),ve.isCompiled=!0;let yt=null;return typeof ve.keywords=="object"&&ve.keywords.$pattern&&(ve.keywords=Object.assign({},ve.keywords),yt=ve.keywords.$pattern,delete ve.keywords.$pattern),yt=yt||/\w+/,ve.keywords&&(ve.keywords=sn(ve.keywords,ie.case_insensitive)),Ye.keywordPatternRe=Le(yt,!0),Me&&(ve.begin||(ve.begin=/\B|\b/),Ye.beginRe=Le(Ye.begin),!ve.end&&!ve.endsWithParent&&(ve.end=/\B|\b/),ve.end&&(Ye.endRe=Le(Ye.end)),Ye.terminatorEnd=g(Ye.end)||"",ve.endsWithParent&&Me.terminatorEnd&&(Ye.terminatorEnd+=(ve.end?"|":"")+Me.terminatorEnd)),ve.illegal&&(Ye.illegalRe=Le(ve.illegal)),ve.contains||(ve.contains=[]),ve.contains=[].concat(...ve.contains.map(function(se){return Vt(se==="self"?ve:se)})),ve.contains.forEach(function(se){it(se,Ye)}),ve.starts&&it(ve.starts,Me),Ye.matcher=Fe(Ye),Ye}if(ie.compilerExtensions||(ie.compilerExtensions=[]),ie.contains&&ie.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ie.classNameAliases=r(ie.classNameAliases||{}),it(ie)}function pt(ie){return ie?ie.endsWithParent||pt(ie.starts):!1}function Vt(ie){return ie.variants&&!ie.cachedVariants&&(ie.cachedVariants=ie.variants.map(function(Le){return r(ie,{variants:null},Le)})),ie.cachedVariants?ie.cachedVariants:pt(ie)?r(ie,{starts:ie.starts?r(ie.starts):null}):Object.isFrozen(ie)?r(ie):ie}var Gt="11.11.2";class Ze extends Error{constructor(Le,Je){super(Le),this.name="HTMLInjectionError",this.html=Je}}const qt=n,kt=r,$t=Symbol("nomatch"),tn=7,on=function(ie){const Le=Object.create(null),Je=Object.create(null),Ft=[];let Fe=!0;const it="Could not find the language '{}', did you forget to load/include a language module?",ve={disableAutodetect:!0,name:"Plain text",contains:[]};let Me={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function Ye(je){return Me.noHighlightRe.test(je)}function yt(je){let gt=je.className+" ";gt+=je.parentNode?je.parentNode.className:"";const Mt=Me.languageDetectRe.exec(gt);if(Mt){const cn=jr(Mt[1]);return cn||(et(it.replace("{}",Mt[1])),et("Falling back to no-highlight mode for this block.",je)),cn?Mt[1]:"no-highlight"}return gt.split(/\s+/).find(cn=>Ye(cn)||jr(cn))}function se(je,gt,Mt){let cn="",Fn="";typeof gt=="object"?(cn=je,Mt=gt.ignoreIllegals,Fn=gt.language):(nt("10.7.0","highlight(lang, code, ...args) has been deprecated."),nt("10.7.0",`Please use highlight(code, options) instead.
|
|
81
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),Fn=je,cn=gt),Mt===void 0&&(Mt=!0);const zn={code:cn,language:Fn};Tr("before:highlight",zn);const Rr=zn.result?zn.result:Pe(zn.language,zn.code,Mt);return Rr.code=zn.code,Tr("after:highlight",Rr),Rr}function Pe(je,gt,Mt,cn){const Fn=Object.create(null);function zn(ne,me){return ne.keywords[me]}function Rr(){if(!Wt.keywords){Qn.addText(xn);return}let ne=0;Wt.keywordPatternRe.lastIndex=0;let me=Wt.keywordPatternRe.exec(xn),Ae="";for(;me;){Ae+=xn.substring(ne,me.index);const at=zr.case_insensitive?me[0].toLowerCase():me[0],St=zn(Wt,at);if(St){const[Dt,Nn]=St;if(Qn.addText(Ae),Ae="",Fn[at]=(Fn[at]||0)+1,Fn[at]<=tn&&(Gr+=Nn),Dt.startsWith("_"))Ae+=me[0];else{const Ir=zr.classNameAliases[Dt]||Dt;lr(me[0],Ir)}}else Ae+=me[0];ne=Wt.keywordPatternRe.lastIndex,me=Wt.keywordPatternRe.exec(xn)}Ae+=xn.substring(ne),Qn.addText(Ae)}function Vi(){if(xn==="")return;let ne=null;if(typeof Wt.subLanguage=="string"){if(!Le[Wt.subLanguage]){Qn.addText(xn);return}ne=Pe(Wt.subLanguage,xn,!0,Ar[Wt.subLanguage]),Ar[Wt.subLanguage]=ne._top}else ne=wt(xn,Wt.subLanguage.length?Wt.subLanguage:null);Wt.relevance>0&&(Gr+=ne.relevance),Qn.__addSublanguage(ne._emitter,ne.language)}function Kn(){Wt.subLanguage!=null?Vi():Rr(),xn=""}function lr(ne,me){ne!==""&&(Qn.startScope(me),Qn.addText(ne),Qn.endScope())}function Vr(ne,me){let Ae=1;const at=me.length-1;for(;Ae<=at;){if(!ne._emit[Ae]){Ae++;continue}const St=zr.classNameAliases[ne[Ae]]||ne[Ae],Dt=me[Ae];St?lr(Dt,St):(xn=Dt,Rr(),xn=""),Ae++}}function fr(ne,me){return ne.scope&&typeof ne.scope=="string"&&Qn.openNode(zr.classNameAliases[ne.scope]||ne.scope),ne.beginScope&&(ne.beginScope._wrap?(lr(xn,zr.classNameAliases[ne.beginScope._wrap]||ne.beginScope._wrap),xn=""):ne.beginScope._multi&&(Vr(ne.beginScope,me),xn="")),Wt=Object.create(ne,{parent:{value:Wt}}),Wt}function yr(ne,me,Ae){let at=N(ne.endRe,Ae);if(at){if(ne["on:end"]){const St=new t(ne);ne["on:end"](me,St),St.isMatchIgnored&&(at=!1)}if(at){for(;ne.endsParent&&ne.parent;)ne=ne.parent;return ne}}if(ne.endsWithParent)return yr(ne.parent,me,Ae)}function br(ne){return Wt.matcher.regexIndex===0?(xn+=ne[0],1):(G=!0,0)}function Gi(ne){const me=ne[0],Ae=ne.rule,at=new t(Ae),St=[Ae.__beforeBegin,Ae["on:begin"]];for(const Dt of St)if(Dt&&(Dt(ne,at),at.isMatchIgnored))return br(me);return Ae.skip?xn+=me:(Ae.excludeBegin&&(xn+=me),Kn(),!Ae.returnBegin&&!Ae.excludeBegin&&(xn=me)),fr(Ae,ne),Ae.returnBegin?0:me.length}function Ii(ne){const me=ne[0],Ae=gt.substring(ne.index),at=yr(Wt,ne,Ae);if(!at)return $t;const St=Wt;Wt.endScope&&Wt.endScope._wrap?(Kn(),lr(me,Wt.endScope._wrap)):Wt.endScope&&Wt.endScope._multi?(Kn(),Vr(Wt.endScope,ne)):St.skip?xn+=me:(St.returnEnd||St.excludeEnd||(xn+=me),Kn(),St.excludeEnd&&(xn=me));do Wt.scope&&Qn.closeNode(),!Wt.skip&&!Wt.subLanguage&&(Gr+=Wt.relevance),Wt=Wt.parent;while(Wt!==at.parent);return at.starts&&fr(at.starts,ne),St.returnEnd?0:me.length}function la(){const ne=[];for(let me=Wt;me!==zr;me=me.parent)me.scope&&ne.unshift(me.scope);ne.forEach(me=>Qn.openNode(me))}let pi={};function vr(ne,me){const Ae=me&&me[0];if(xn+=ne,Ae==null)return Kn(),0;if(pi.type==="begin"&&me.type==="end"&&pi.index===me.index&&Ae===""){if(xn+=gt.slice(me.index,me.index+1),!Fe){const at=new Error(`0 width match regex (${je})`);throw at.languageName=je,at.badRule=pi.rule,at}return 1}if(pi=me,me.type==="begin")return Gi(me);if(me.type==="illegal"&&!Mt){const at=new Error('Illegal lexeme "'+Ae+'" for mode "'+(Wt.scope||"<unnamed>")+'"');throw at.mode=Wt,at}else if(me.type==="end"){const at=Ii(me);if(at!==$t)return at}if(me.type==="illegal"&&Ae==="")return me.index===gt.length||(xn+=`
|
|
82
|
-
`),1;if(Ve>1e5&&Ve>me.index*3)throw new Error("potential infinite loop, way more iterations than matches");return xn+=Ae,Ae.length}const zr=jr(je);if(!zr)throw De(it.replace("{}",je)),new Error('Unknown language: "'+je+'"');const ei=vt(zr);let un="",Wt=cn||ei;const Ar={},Qn=new Me.__emitter(Me);la();let xn="",Gr=0,Kr=0,Ve=0,G=!1;try{if(zr.__emitTokens)zr.__emitTokens(gt,Qn);else{for(Wt.matcher.considerAll();;){Ve++,G?G=!1:Wt.matcher.considerAll(),Wt.matcher.lastIndex=Kr;const ne=Wt.matcher.exec(gt);if(!ne)break;const me=gt.substring(Kr,ne.index),Ae=vr(me,ne);Kr=ne.index+Ae}vr(gt.substring(Kr))}return Qn.finalize(),un=Qn.toHTML(),{language:je,value:un,relevance:Gr,illegal:!1,_emitter:Qn,_top:Wt}}catch(ne){if(ne.message&&ne.message.includes("Illegal"))return{language:je,value:qt(gt),illegal:!0,relevance:0,_illegalBy:{message:ne.message,index:Kr,context:gt.slice(Kr-100,Kr+100),mode:ne.mode,resultSoFar:un},_emitter:Qn};if(Fe)return{language:je,value:qt(gt),illegal:!1,relevance:0,errorRaised:ne,_emitter:Qn,_top:Wt};throw ne}}function He(je){const gt={value:qt(je),illegal:!1,relevance:0,_top:ve,_emitter:new Me.__emitter(Me)};return gt._emitter.addText(je),gt}function wt(je,gt){gt=gt||Me.languages||Object.keys(Le);const Mt=He(je),cn=gt.filter(jr).filter(ja).map(Kn=>Pe(Kn,je,!1));cn.unshift(Mt);const Fn=cn.sort((Kn,lr)=>{if(Kn.relevance!==lr.relevance)return lr.relevance-Kn.relevance;if(Kn.language&&lr.language){if(jr(Kn.language).supersetOf===lr.language)return 1;if(jr(lr.language).supersetOf===Kn.language)return-1}return 0}),[zn,Rr]=Fn,Vi=zn;return Vi.secondBest=Rr,Vi}function Re(je,gt,Mt){const cn=gt&&Je[gt]||Mt;je.classList.add("hljs"),je.classList.add(`language-${cn}`)}function Ke(je){let gt=null;const Mt=yt(je);if(Ye(Mt))return;if(Tr("before:highlightElement",{el:je,language:Mt}),je.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",je);return}if(je.children.length>0&&(Me.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(je)),Me.throwUnescapedHTML))throw new Ze("One of your code blocks includes unescaped HTML.",je.innerHTML);gt=je;const cn=gt.textContent,Fn=Mt?se(cn,{language:Mt,ignoreIllegals:!0}):wt(cn);je.innerHTML=Fn.value,je.dataset.highlighted="yes",Re(je,Mt,Fn.language),je.result={language:Fn.language,re:Fn.relevance,relevance:Fn.relevance},Fn.secondBest&&(je.secondBest={language:Fn.secondBest.language,relevance:Fn.secondBest.relevance}),Tr("after:highlightElement",{el:je,result:Fn,text:cn})}function bt(je){Me=kt(Me,je)}const bn=()=>{hn(),nt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function dr(){hn(),nt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ot=!1;function hn(){function je(){hn()}if(document.readyState==="loading"){Ot||window.addEventListener("DOMContentLoaded",je,!1),Ot=!0;return}document.querySelectorAll(Me.cssSelector).forEach(Ke)}function Br(je,gt){let Mt=null;try{Mt=gt(ie)}catch(cn){if(De("Language definition for '{}' could not be registered.".replace("{}",je)),Fe)De(cn);else throw cn;Mt=ve}Mt.name||(Mt.name=je),Le[je]=Mt,Mt.rawDefinition=gt.bind(null,ie),Mt.aliases&&vi(Mt.aliases,{languageName:je})}function ye(je){delete Le[je];for(const gt of Object.keys(Je))Je[gt]===je&&delete Je[gt]}function tr(){return Object.keys(Le)}function jr(je){return je=(je||"").toLowerCase(),Le[je]||Le[Je[je]]}function vi(je,{languageName:gt}){typeof je=="string"&&(je=[je]),je.forEach(Mt=>{Je[Mt.toLowerCase()]=gt})}function ja(je){const gt=jr(je);return gt&&!gt.disableAutodetect}function Hn(je){je["before:highlightBlock"]&&!je["before:highlightElement"]&&(je["before:highlightElement"]=gt=>{je["before:highlightBlock"](Object.assign({block:gt.el},gt))}),je["after:highlightBlock"]&&!je["after:highlightElement"]&&(je["after:highlightElement"]=gt=>{je["after:highlightBlock"](Object.assign({block:gt.el},gt))})}function Zs(je){Hn(je),Ft.push(je)}function fi(je){const gt=Ft.indexOf(je);gt!==-1&&Ft.splice(gt,1)}function Tr(je,gt){const Mt=je;Ft.forEach(function(cn){cn[Mt]&&cn[Mt](gt)})}function oa(je){return nt("10.7.0","highlightBlock will be removed entirely in v12.0"),nt("10.7.0","Please use highlightElement now."),Ke(je)}Object.assign(ie,{highlight:se,highlightAuto:wt,highlightAll:hn,highlightElement:Ke,highlightBlock:oa,configure:bt,initHighlighting:bn,initHighlightingOnLoad:dr,registerLanguage:Br,unregisterLanguage:ye,listLanguages:tr,getLanguage:jr,registerAliases:vi,autoDetection:ja,inherit:kt,addPlugin:Zs,removePlugin:fi}),ie.debugMode=function(){Fe=!1},ie.safeMode=function(){Fe=!0},ie.versionString=Gt,ie.regex={concat:k,lookahead:m,either:E,optional:v,anyNumberOfTimes:x};for(const je in Ie)typeof Ie[je]=="object"&&e(Ie[je]);return Object.assign(ie,Ie),ie},Dn=on({});return Dn.newInstance=()=>on({}),sg=Dn,Dn.HighlightJS=Dn,Dn.default=Dn,sg}var pB=fB();const hB=$o(pB),l2={},gB="hljs-";function mB(e){const t=hB.newInstance();return e&&o(e),{highlight:n,highlightAuto:r,listLanguages:a,register:o,registerAlias:l,registered:u};function n(d,f,p){const g=p||l2,m=typeof g.prefix=="string"?g.prefix:gB;if(!t.getLanguage(d))throw new Error("Unknown language: `"+d+"` is not registered");t.configure({__emitter:xB,classPrefix:m});const x=t.highlight(f,{ignoreIllegals:!0,language:d});if(x.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:x.errorRaised});const v=x._emitter.root,k=v.data;return k.language=x.language,k.relevance=x.relevance,v}function r(d,f){const g=(f||l2).subset||a();let m=-1,x=0,v;for(;++m<g.length;){const k=g[m];if(!t.getLanguage(k))continue;const _=n(k,d,f);_.data&&_.data.relevance!==void 0&&_.data.relevance>x&&(x=_.data.relevance,v=_)}return v||{type:"root",children:[],data:{language:void 0,relevance:x}}}function a(){return t.listLanguages()}function o(d,f){if(typeof d=="string")t.registerLanguage(d,f);else{let p;for(p in d)Object.hasOwn(d,p)&&t.registerLanguage(p,d[p])}}function l(d,f){if(typeof d=="string")t.registerAliases(typeof f=="string"?f:[...f],{languageName:d});else{let p;for(p in d)if(Object.hasOwn(d,p)){const g=d[p];t.registerAliases(typeof g=="string"?g:[...g],{languageName:p})}}}function u(d){return!!t.getLanguage(d)}}class xB{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 n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],a=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:a}):r.children.push(...a)}openNode(t){const n=this,r=t.split(".").map(function(l,u){return u?l+"_".repeat(u):n.options.classPrefix+l}),a=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};a.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const yB={};function og(e){const t=e||yB,n=t.aliases,r=t.detect||!1,a=t.languages||dB,o=t.plainText,l=t.prefix,u=t.subset;let d="hljs";const f=mB(a);if(n&&f.registerAlias(n),l){const p=l.indexOf("-");d=p===-1?l:l.slice(0,p)}return function(p,g){Xf(p,"element",function(m,x,v){if(m.tagName!=="code"||!v||v.type!=="element"||v.tagName!=="pre")return;const k=bB(m);if(k===!1||!k&&!r||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 _=D9(m,{whitespace:"pre"});let E;try{E=k?f.highlight(k,_,{prefix:l}):f.highlightAuto(_,{prefix:l,subset:u})}catch(S){const N=S;if(k&&/Unknown language/.test(N.message)){g.message("Cannot highlight as `"+k+"`, it’s not registered",{ancestors:[v,m],cause:N,place:m.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw N}!k&&E.data&&E.data.language&&m.properties.className.push("language-"+E.data.language),E.children.length>0&&(m.children=E.children)})}}function bB(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const a=String(t[n]);if(a==="no-highlight"||a==="nohighlight")return!1;!r&&a.slice(0,5)==="lang-"&&(r=a.slice(5)),!r&&a.slice(0,9)==="language-"&&(r=a.slice(9))}return r}function wf(){function e(t){const n=new Set(["strong","emphasis","delete"]);function r(a){if(a.children)for(let o=0;o<a.children.length;o++){const l=a.children[o];if(n.has(l.type)){if(o>0){const f=a.children[o-1];f.type==="text"?f.value&&/[a-zA-Z0-9]$/.test(f.value)&&!f.value.endsWith(" ")&&!f.value.endsWith(`
|
|
83
|
-
`)&&(f.value+=" "):(a.children.splice(o,0,{type:"text",value:" "}),o++)}const u=o+1,d=u<a.children.length?a.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):n.has(d.type)&&a.children.splice(u,0,{type:"text",value:" "}))}r(l)}}return r(t),t}return e}function Ef({children:e,language:t,className:n,frameless:r,...a}){const[o,l]=y.useState(!1),u=String(e).replace(/\n$/,""),d=n||(t?"language-"+t:""),f=async()=>{try{await navigator.clipboard.writeText(u),l(!0),setTimeout(()=>l(!1),2e3)}catch{const p=document.createElement("textarea");p.value=u,document.body.appendChild(p),p.select(),document.execCommand("copy"),document.body.removeChild(p),l(!0),setTimeout(()=>l(!1),2e3)}};return r?i.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800/50 my-3",children:[i.jsx("button",{onMouseDown:function(p){p.preventDefault()},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-xs",title:"Copy","aria-label":"Copy code",children:o?i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),i.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...a,children:i.jsx("code",{className:d||void 0,children:e})})]}):i.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:[i.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:[i.jsx("span",{children:t||"code"}),i.jsx("button",{onMouseDown:function(p){p.preventDefault()},onClick:f,className:"flex items-center gap-1 hover:text-gray-200 transition-colors",children:o?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied"]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"]})})]}),i.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...a,children:i.jsx("code",{className:d||void 0,children:e})})]})}function Zf(e,t){if(!t)return"";try{const n=typeof t=="string"?JSON.parse(t):t;if(n.command)return n.command;if(n.filePath&&e==="read")return`read ${n.filePath}`;if(n.pattern&&e==="grep"){const r=n.path||n.include||".";return`grep "${n.pattern}" ${r}`}if(n.pattern&&e==="glob")return`glob "${n.pattern}"`;if(n.filePath&&e==="edit")return`edit ${n.filePath}`;if(n.filePath&&e==="write")return`write ${n.filePath}`;if(n._purpose&&e==="task")return`task "${n._purpose}"`;if(n.url&&(e==="webfetch"||e==="fetch"))return`fetch ${n.url}`;if(n.action&&e==="todo"){let r=`todo ${n.action}`;return n.text&&(r+=` "${n.text}"`),n.id&&(r+=` #${n.id}`),r}if(n.action&&e==="permission"){let r=`permission ${n.action}`;return n.type&&(r+=` ${n.type}`),n.target&&(r+=` ${n.target}`),r}{const r=[];for(const[a,o]of Object.entries(n))if(!(o==null||o===""))if(typeof o=="boolean")o&&r.push(`--${a}`);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;r.push(`--${a} "${d}"`)}else{const l=typeof o=="object"&&o!==null?JSON.stringify(o):String(o),u=l.length>60?l.slice(0,60)+"...":l;r.push(`--${a} "${u}"`)}return r.length>0?`${e} ${r.join(" ")}`:e||""}}catch{return""}}function qo(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function vB(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 kB({part:e}){const{t}=rn(),{tool:n,state:r}=e,[a,o]=y.useState(!1);if(!r)return null;const l=r.status||"running",u=r.title||n||t("tool.tool"),d=Zf(n||u,r.input),f=r.input&&r.input._purpose?r.input._purpose:null,p=l==="completed"?vB(r.output):null,g=!f||a,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"},x={running:i.jsxs("svg",{className:"w-4 h-4 text-yellow-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),completed:i.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),error:i.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),pending_confirmation:i.jsx("svg",{className:"w-4 h-4 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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 i.jsxs("div",{className:`rounded-lg border-l-4 p-2 xs:p-3 text-xs sm:text-sm ${m[l]||m.running}`,children:[i.jsxs("div",{className:`flex items-center gap-2 ${f?"cursor-pointer select-none":""}`,onClick:f?()=>o(!a):void 0,children:[x[l]||x.running,f?i.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200 flex-1",children:f}):i.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:u}),f&&i.jsx("svg",{className:`w-4 h-4 text-gray-400 shrink-0 transition-transform ${a?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),g&&d&&!p&&i.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:[i.jsx("span",{className:"text-green-400 select-none",children:"$ "}),i.jsx("span",{className:"text-gray-100",children:d})]}),p?i.jsxs("div",{className:"mt-2 text-xs text-blue-700 dark:text-blue-300 flex items-center gap-1.5",children:[i.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.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"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12l3 3 5-6"})]}),i.jsxs("span",{children:[p.type==="mermaid"?"Mermaid diagram":p.type==="svg"?"SVG illustration":"Math",p.title?i.jsxs(i.Fragment,{children:[": ",i.jsx("span",{className:"font-medium",children:p.title})]}):null," rendered → see ",i.jsx("span",{className:"font-medium",children:"canvas"})," pane"]})]}):r.output&&l==="completed"&&g&&i.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:qo((typeof r.output=="string"?r.output:JSON.stringify(r.output,null,2)).slice(0,600)).slice(0,500)}),r.error&&g&&i.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:qo(typeof r.error=="string"?r.error:r.error.message||"Error")})]})}function _B({part:e}){const{tool:t,state:n}=e,[r,a]=y.useState(!1);if(!n)return null;const o=n.status||"running",l=n.title||t||"Tool",u=Zf(t||l,n.input),d=n.input&&n.input._purpose?n.input._purpose:null,f=!d||r;return i.jsxs("div",{className:"py-1",children:[i.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${d?"cursor-pointer select-none":""}`,onClick:d?()=>a(!r):void 0,children:[o==="running"&&i.jsxs("svg",{className:"w-3 h-3 text-gray-400 animate-spin shrink-0",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o==="completed"&&i.jsx("svg",{className:"w-3 h-3 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o==="error"&&i.jsx("svg",{className:"w-3 h-3 text-red-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),o==="pending_confirmation"&&i.jsx("svg",{className:"w-3 h-3 text-blue-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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?i.jsx("span",{className:"font-medium truncate flex-1",children:d}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"font-medium truncate",children:l}),u&&i.jsx("span",{className:"font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u})]}),d&&i.jsx("svg",{className:`w-3 h-3 text-gray-400 shrink-0 transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),f&&u&&i.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u}),n.output&&o==="completed"&&f&&i.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-500 dark:text-gray-400 break-all whitespace-pre-wrap truncate",children:qo(typeof n.output=="string"?n.output:JSON.stringify(n.output,null,2)).slice(0,500)}),n.error&&f&&i.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:qo(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)}),n.error&&!f&&i.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:qo(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)})]})}function wB({text:e,isStreaming:t}){const{t:n}=rn(),[r,a]=y.useState(!1),o=e&&e.trim().length>0,l=t&&!r?(e||"").slice(-400).replace(/\s+/g," ").trim():"";return i.jsxs("div",{className:"py-1",children:[i.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${o?"cursor-pointer select-none":""}`,onClick:o?()=>a(!r):void 0,children:[t?i.jsxs("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500 animate-spin shrink-0",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):i.jsx("svg",{className:"w-3 h-3 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i.jsx("span",{className:`font-medium shrink-0 ${l?"":"flex-1"}`,children:n("chat.thinking")}),l&&i.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&&i.jsx("svg",{className:`w-3 h-3 text-gray-400 shrink-0 transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),r&&o&&i.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:i.jsx(kf,{remarkPlugins:[_f,wf],children:e})})]})}function EB(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 lg=2500,lf=5,tu=new Map;function SB(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function NB({part:e,questionId:t}){const{t:n}=rn(),{state:r}=e,a=r&&r.status||"running",o=r&&r.input||{},l=Array.isArray(o.questions)&&o.questions.length>0?o.questions:[{text:"(no question)",options:void 0}],u=a==="completed",d=a==="error",f=(r&&r.error||"").replace(/^Error:\s*/,""),p=r&&r.output||"",[g,m]=y.useState({}),[x,v]=y.useState({}),[k,_]=y.useState(null),[E,S]=y.useState(null),[N,A]=y.useState(t),[T,R]=y.useState(0),[C,O]=y.useState(()=>{const U=e.callID||e.id,Y=U&&tu.get(U);return!!(Y&&Y.attempts>=lf)}),M=y.useRef(!0),I=y.useRef(null),D=y.useRef(null);y.useEffect(()=>{t&&A(t)},[t]);const F=e.callID||e.id||null;y.useEffect(()=>{if(!r||u||d||N||!F)return;let U=tu.get(F);U||(U={attempts:0,lastAt:0},tu.set(F,U)),D.current=U;let Y=!1,q=null;const te=()=>{if(!(Y||!M.current)){if(U.attempts>=lf){O(!0);return}q=setTimeout(W,lg)}},W=()=>{Y||!M.current||U.attempts>=lf||(U.attempts+=1,U.lastAt=Date.now(),jM().then($=>{if(Y||!M.current)return;const fe=Array.isArray($&&$.pending)?$.pending:[];for(var ae=0;ae<fe.length;ae++){var xe=fe[ae],Ie=xe.tool&&xe.tool.callID?xe.tool.callID:null;if(Ie===F&&xe.id){tu.delete(F),O(!1),A(xe.id);return}}te()}).catch(()=>{te()}))};if(U.attempts<lf){const $=Date.now()-U.lastAt;U.attempts===0||$>=lg?W():q=setTimeout(W,lg-$)}return()=>{Y=!0,q&&clearTimeout(q)}},[r,u,d,N,F,T]);const ee=y.useCallback(()=>{F&&tu.delete(F),O(!1),R(U=>U+1)},[F]);y.useEffect(()=>()=>{M.current=!1},[]),y.useEffect(()=>{!u&&I.current&&(I.current.focus(),I.current.scrollIntoView({behavior:"smooth",block:"center"}))},[u]);const H=U=>{var Y,q;return(((Y=g[U])==null?void 0:Y.length)??0)>0||(((q=x[U])==null?void 0:q.trim().length)??0)>0},P=l.every((U,Y)=>H(Y)),K=(U,Y,q)=>{m(te=>{const W=te[U]??[];return q?{...te,[U]:W.includes(Y)?W.filter($=>$!==Y):[...W,Y]}:{...te,[U]:W.includes(Y)?[]:[Y]}})},V=y.useCallback(async()=>{if(!P||!N)return;const U=l.map((Y,q)=>{var $;const te=g[q]??[],W=($=x[q])==null?void 0:$.trim();return W?[...te,W]:te});_("reply"),S(null);try{const Y=await TM(N,U);if(!M.current)return;Y&&Y.success===!1&&(S(Y.error||"Failed to reply"),_(null))}catch(Y){if(!M.current)return;S(Y.message||"Failed to reply"),_(null)}},[N,l,g,x,P]),Z=y.useCallback(async()=>{if(N){_("reject"),S(null);try{const U=await RM(N);if(!M.current)return;U&&U.success===!1&&(S(U.error||"Failed to dismiss"),_(null))}catch(U){if(!M.current)return;S(U.message||"Failed to dismiss"),_(null)}}},[N]);if(!r)return null;const le=U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),V())};if(u)return i.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:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:n("question.title")}),i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),l.map((U,Y)=>i.jsxs("div",{className:Y>0?"pt-2 mt-2 border-t border-gray-200 dark:border-gray-700":"",children:[i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1 whitespace-pre-wrap",children:U.text}),p&&i.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:CB(p,Y,l.length)})]},Y))]});if(d)return i.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:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("svg",{className:"w-4 h-4 text-red-500 dark:text-red-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",children:n("question.title")}),i.jsx("svg",{className:"w-3.5 h-3.5 text-red-500 shrink-0 ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})]}),i.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:n("question.error")}),f&&i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:f})]});let B=!1;return i.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:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("svg",{className:"w-4 h-4 text-primary-600 dark:text-primary-400 shrink-0 animate-pulse",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:n("question.title")})]}),l.map((U,Y)=>{const q=Array.isArray(U.options)?U.options:[],te=q.length>0,W=U.multiple===!0,$=U.custom!==!1,fe=g[Y]??[],ae=$&&!B;return ae&&(B=!0),i.jsxs("div",{className:Y>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(U.header||W)&&i.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[U.header&&i.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:U.header}),W&&i.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-gray-400 dark:text-gray-500",children:n("question.select_all")})]}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2 whitespace-pre-wrap",children:U.text}),te&&i.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:q.map((xe,Ie)=>{const ze=SB(xe),mt=fe.includes(ze);return i.jsx("button",{onClick:()=>K(Y,ze,W),disabled:k!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${mt?"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":mt,children:ze},Ie)})}),$&&i.jsx("input",{ref:ae?I:void 0,type:"text",value:x[Y]??"",onChange:xe=>v(Ie=>({...Ie,[Y]:xe.target.value})),onKeyDown:le,disabled:k!==null,placeholder:n(te?"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-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"})]},Y)}),E&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3 mb-2",children:E}),!N&&!u&&!C&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2",children:n("question.reconnecting")||"Reconnecting…"}),!N&&!u&&C&&i.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[i.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:n("question.resolve_failed")||"Could not reach the question service."}),i.jsx("button",{onClick:ee,className:"px-2 py-1 text-xs 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",children:n("question.retry_connection")||"Retry"})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[i.jsx("button",{onClick:Z,disabled:k!==null||!N,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:n(k==="reject"?"question.dismissing":"question.dismiss")}),i.jsx("button",{onClick:V,disabled:k!==null||!P||!N,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"?n("question.submitting"):l.length>1?n("question.submit_n",{count:l.length}):n("question.submit")})]})]})}function CB(e,t,n){if(n===1){const o="User's answer: ";return e.startsWith(o)?e.slice(o.length):e}const r=e.split(`
|
|
85
|
-
`),a=`[${t+1}] `;for(const o of r)if(o.startsWith(a))return o.slice(a.length);return e}function jB({sessionId:e}){const{t}=rn(),[n,r]=y.useState(null),[a,o]=y.useState(!1),[l,u]=y.useState(null),[d,f]=y.useState(!1),[p,g]=y.useState(null),m=y.useRef(null),x=n!==null;y.useEffect(()=>{if(!a)return;const S=N=>{N.key==="Escape"&&(N.stopPropagation(),o(!1))};return window.addEventListener("keydown",S),m.current&&m.current.focus(),()=>window.removeEventListener("keydown",S)},[a]);const v=async()=>{if(!(x||!e)){o(!0),f(!0),g(null);try{const{content:S}=await bL(e);u(typeof S=="string"?S:"")}catch(S){console.error("Failed to load PLAN.md:",S),g(t("planCard.loadError"))}finally{f(!1)}}},k=()=>{x||(r("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},_=()=>{x||r("dismissed")},E="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 i.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 "+(x?"opacity-50":""),children:[i.jsx("div",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:t("planCard.heading")}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("button",{type:"button",onClick:v,disabled:x||d||!e,className:E+" 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")}),i.jsx("button",{type:"button",onClick:k,disabled:x,className:E+" 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")}),i.jsx("button",{type:"button",onClick:_,disabled:x,className:E+" 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")})]}),x&&i.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400","aria-live":"polite",children:t(n==="executed"?"planCard.executedStatus":"planCard.dismissedStatus")}),a&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>o(!1),children:i.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:[i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 dark:border-gray-700 px-4 py-2.5",children:[i.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"PLAN.md"}),i.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?i.jsx("div",{className:"px-4 py-6 text-xs text-gray-500 dark:text-gray-400",children:t("planCard.loading")}):p?i.jsx("div",{className:"px-4 py-6 text-xs text-red-600 dark:text-red-400",children:p}):i.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 TB="plan.md";function RB(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function AB(e){return typeof e!="string"||!e?!1:RB(e).toLowerCase()===TB}function IB(e){if(!Array.isArray(e))return null;let t=null;for(const n of e){if(!n||n.type!=="tool"||n.tool!=="write"&&n.tool!=="edit")continue;const r=n.state&&n.state.input||{};AB(r.filePath)&&(t={content:typeof r.content=="string"?r.content:null})}return t}function bk(e,t,n=!1){if(t){const r=Object.values(t).filter(a=>a.type==="reasoning"&&n?!1:a.type==="text"||a.type==="reasoning"||a.type==="error").map(a=>a.text||a.delta||"").join(`
|
|
86
|
-
|
|
87
|
-
`);if(r)return r}return!e||e.length===0?"":e.filter(r=>r.type==="reasoning"&&n?!1:r.type==="text"||r.type==="reasoning"||r.type==="error").map(r=>r.text||"").join(`
|
|
88
|
-
|
|
89
|
-
`)}function MB(e,t,n){const r=bk(e,t,n);if(!e||e.length===0)return r;const a=[];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||{},p=[];u&&p.push(u),f._purpose&&p.push(f._purpose);const g=Object.keys(f).filter(m=>m!=="_purpose");if(g.length>0){const m={};for(let x=0;x<g.length;x++)m[g[x]]=f[g[x]];try{p.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)),p.push(m)}if(d.error){const m=typeof d.error=="string"?d.error:d.error.message||String(d.error);p.push(m)}p.length>0&&a.push(p.join(`
|
|
90
|
-
`))}return a.length===0?r:r+`
|
|
91
|
-
|
|
92
|
-
`+a.join(`
|
|
93
|
-
|
|
94
|
-
`)}function LB(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}const OB=5,DB=2e3,PB=6e3,wv="… [truncated]",FB=/^\*\*Quoted from (assistant|you)(?:, (.+?))?:\*\*$/,c5="```text",u5="```";let c2=0;function BB(){return c2+=1,"q-"+Date.now()+"-"+c2}function vk(e,t=DB){if(typeof e!="string")return"";const n=e.replace(/\r\n?/g,`
|
|
98
|
-
`).replace(/^\n+/,"").replace(/\s+$/,"");return n.length<=t?n:n.slice(0,t)+wv}function zB(e){return e.reduce((t,n)=>n&&typeof n.text=="string"?t+n.text.length:t,0)}function qB(e,t){const n=Array.isArray(e)?e:[];if(n.length>=OB)return!1;const r=vk(t);return r?zB(n)+r.length<=PB:!1}function UB(e,t){const n=e==="assistant"?"Quoted from assistant":"Quoted from you",r=typeof t=="string"?t.trim():"";return r?n+", "+r+":":n+":"}function HB(e){return e?"> "+e:">"}function u2(e,t){for(const n of t.split(`
|
|
99
|
-
`))e.push(HB(n))}function $B(e){const t=e||{},n=["> **"+UB(t.sourceRole,t.sourceTime)+"**"],r=vk(t.text);return t.fromCode===!0?(n.push("> "+c5),u2(n,r),n.push("> "+u5)):u2(n,r),n.join(`
|
|
100
|
-
`)}function WB(e,t){if(!Array.isArray(e)||e.length===0)return t;const n=String(t||"").trim(),r=e.map(a=>$B(a)).join(`
|
|
101
|
-
|
|
102
|
-
`);return n?r+`
|
|
103
|
-
|
|
104
|
-
`+n:r}function kk(e){return typeof e!="string"||e.charAt(0)!==">"?null:e.charAt(1)===" "?e.slice(2):e.slice(1)}function d5(e){if(e===null)return null;const t=FB.exec(e.trim());return t?t[0].slice(2,-2):null}function VB(e,t){const n=[];let r=t;for(;r<e.length;){const u=kk(e[r]);if(u===null)break;n.push(u),r+=1}const a=n[n.length-1],o=n.length>=2&&n[0]===c5&&a===u5;return{body:(o?n.slice(1,-1):n).join(`
|
|
105
|
-
`),fromCode:o,next:r}}function GB(e){const t=[];let n=0,r=0;for(;n<e.length;){const a=d5(kk(e[n]));if(a===null)break;const o=VB(e,n+1);t.push({header:a,body:o.body,fromCode:o.fromCode}),n=o.next,r=n,e[n]===""&&(n+=1)}return{quotes:t,end:r}}function KB(e,t){return t>=e.length?"":e.slice(t).join(`
|
|
106
|
-
`).replace(/^\n+/,"")}function YB(e){if(typeof e!="string"||e==="")return{quotes:[],rest:""};const t=e.split(`
|
|
107
|
-
`);if(d5(kk(t[0]))===null)return{quotes:[],rest:e};const n=GB(t);return{quotes:n.quotes,rest:KB(t,n.end)}}function QB(e){if(!e||!e.anchorNode)return!1;const t=e.anchorNode,n=t.nodeType===1?t:t.parentElement;return!n||typeof n.closest!="function"?!1:!!(n.closest("pre")||n.closest("[data-code-block]"))}function XB(e){return typeof e=="string"&&e.trim()!==""}function ZB(){const e=document.getSelection?document.getSelection():null;if(!e||!e.rangeCount||!e.getRangeAt)return null;const t=[];for(let n=0;n<e.rangeCount;n+=1)try{t.push(e.getRangeAt(n))}catch{}return t.length?t:null}function JB(e){if(e)try{const t=document.getSelection?document.getSelection():null;if(!t||!t.removeAllRanges||!t.addRange)return;t.removeAllRanges();for(let n=0;n<e.length;n+=1)t.addRange(e[n])}catch{}}function ez(e){let t=null;try{t=ZB()}catch{}const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.style.position="fixed",n.style.top="-1000px";let r=!1,a=!1;try{document.body.appendChild(n),a=!0,n.select(),typeof document.execCommand=="function"&&(r=document.execCommand("copy")===!0)}catch{r=!1}try{a&&document.body.removeChild(n)}catch{}return JB(t),r}async function f5(e){if(!XB(e))return!1;try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(e),!0}catch{}try{return ez(e)}catch{return!1}}const p5=e=>e&&e.type==="element"&&(e.tagName==="td"||e.tagName==="th");function h5(e,t){if(!e||e.type!=="element")return;if(e.tagName==="tr"){t.push(e);return}const n=e.children||[];for(let r=0;r<n.length;r++)h5(n[r],t)}function tz(e){let t=0,n=0;for(let o=0;o<e.length;o++)e.charAt(o)==="`"?(t+=1,t>n&&(n=t)):t=0;let r="";for(let o=0;o<=n;o++)r+="`";const a=e.charAt(0)==="`"||e.charAt(e.length-1)==="`"?" ":"";return r+a+e+a+r}function g5(e){if(!e)return"";if(e.type==="text")return e.value||"";const t=e.children||[];let n="";for(let r=0;r<t.length;r++)n+=g5(t[r]);return n}function Ev(e,t){return e.properties&&e.properties[t]||""}function nz(e,t){const n=Ev(e,"href");return n?`[${t}](${n})`:t}function rz(e){const t=Ev(e,"src"),n=Ev(e,"alt");return t?``:""}const iz={strong:["**","**"],em:["*","*"],del:["~~","~~"]};function az(e){if(!e)return"";if(e.type==="text")return(e.value||"").replace(/\\/g,"\\\\");if(e.type!=="element")return"";const t=e.tagName;if(t==="br")return" ";const n=m5(e);if(t==="code")return tz(g5(e));if(t==="a")return nz(e,n);if(t==="img")return rz(e);const r=iz[t];return r?`${r[0]}${n}${r[1]}`:n}function m5(e){const t=e.children||[];let n="";for(let r=0;r<t.length;r++)n+=az(t[r]);return n}function sz(e){return m5(e).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ").trim()}function oz(e,t){const n=(e.children||[]).filter(p5),r=[];for(let a=0;a<t;a++){const o=n[a]&&n[a].properties&&n[a].properties.align;r.push(o==="center"?":---:":o==="right"?"---:":o==="left"?":---":"---")}return`| ${r.join(" | ")} |`}function lz(e){if(!e||e.type!=="element"||e.tagName!=="table")return"";const t=[];if(h5(e,t),t.length===0)return"";const n=t.map(o=>(o.children||[]).filter(p5).map(sz));let r=0;for(let o=0;o<n.length;o++)n[o].length>r&&(r=n[o].length);if(r===0)return"";const a=n.map(o=>{const l=o.slice();for(;l.length<r;)l.push("");return`| ${l.join(" | ")} |`});return a.splice(1,0,oz(t[0],r)),a.join(`
|
|
108
|
-
`)}const cz="bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5";function x5(e){if(!e)return null;var t=e.nodeType===1?e:e.parentElement;return!t||!t.closest?null:t.closest("[data-message-id]")}function uz(e){if(typeof window>"u"||!window.getSelection)return"";var t=window.getSelection();if(!t||t.isCollapsed)return"";var n=String(t.toString());return n.trim()&&x5(t.anchorNode)===e?n:""}function dz({node:e}){var[t,n]=y.useState(!1),r=y.useRef(null),a=y.useRef(!0);y.useEffect(function(){return a.current=!0,function(){a.current=!1,r.current&&clearTimeout(r.current)}},[]);var o=function(){f5(lz(e)).then(function(l){!l||!a.current||(n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(function(){a.current&&n(!1)},2e3))})};return i.jsx("button",{type:"button",onMouseDown:function(l){l.preventDefault()},onClick:o,className:"px-2 py-0.5 rounded text-[10px] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500",title:t?"Copied!":"Copy table as Markdown","aria-label":t?"Copied!":"Copy table as Markdown",children:t?"Copied!":"Copy as Markdown"})}function d2(e){return{pre:function({node:t,children:n,...r}){if(y.isValidElement(n)){var a=n.type;if(a==="code"||typeof a=="string"&&a.toLowerCase()==="code"){var o=n.props||{},l=o.className||"",u=l.match(/language-(\S+)/),d=u?u[1]:"",f=yu(o.children);return i.jsx(Ef,{language:d,className:l,frameless:e,children:f})}}var p=yu(n);return p?i.jsx(Ef,{language:"",className:"",frameless:e,children:p}):i.jsx("pre",{...r,children:n})},code:function({node:t,className:n,children:r,...a}){if(n&&n.indexOf("language-")!==-1){var o=n.match(/language-(\S+)/),l=o?o[1]:"";return i.jsx(Ef,{language:l,className:n,frameless:e,children:yu(r)})}return i.jsx("code",{className:e?"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",...a,children:r})},a:function({node:t,children:n,href:r,...a}){return i.jsx("a",{href:r,...a,target:"_blank",rel:"noopener noreferrer",children:n})},table:function({node:t,children:n,...r}){return i.jsxs("div",{className:e?"my-3":"",children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsx("table",{className:e?"w-full text-sm border-collapse [&>tbody>tr:nth-child(odd)]:bg-gray-50 dark:[&>tbody>tr:nth-child(odd)]:bg-gray-800/30":"",...r,children:n})}),i.jsx("div",{className:"flex justify-end mt-1",children:i.jsx(dz,{node:t})})]})},th:function({node:t,children:n,...r}){return i.jsx("th",{className:e?"px-3 py-1.5 text-left font-medium border-b border-gray-200 dark:border-gray-700":"",...r,children:n})},td:function({node:t,children:n,...r}){return i.jsx("td",{className:e?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...r,children:n})}}}function fz({message:e,parts:t,streamingParts:n,user:r,searchQuery:a,matchOffset:o,matchCount:l,activeMatchIndex:u,registerMatchRef:d,onRetry:f,onEditAndResend:p,onCancelQueued:g,hackerMode:m,mobileFrameless:x,hideThinking:v,isPrivate:k,isLast:_,isBusy:E,sessionID:S,questionIdMap:N,isCompactedOut:A,onQuoteAdd:T}){var{t:R}=rn(),C=e.role==="user",O=!C&&_&&!E?IB(t)!==null:!1,M=C&&e._queued===!0,I=r!=null&&r.name?r.name.charAt(0).toUpperCase():"U",[D,F]=y.useState(!1),[ee,H]=y.useState(!1),[P,K]=y.useState(""),[V,Z]=y.useState(!1),le=y.useRef(null),B=y.useRef(!0),U=y.useRef(null);y.useEffect(function(){var ve=U.current;!ve||!ee||(ve.style.height="auto",ve.style.height=Math.min(ve.scrollHeight,300)+"px")},[P,ee]),y.useEffect(function(){return B.current=!0,function(){B.current=!1,le.current&&clearTimeout(le.current)}},[]);var Y=bk(t,n,v),q=(t||[]).filter(function(ve){return ve.type==="tool"}),te=(t||[]).filter(function(ve){return ve.type==="file"&&ve.filename}),W=(t||[]).filter(function(ve){if(ve.type!=="image_url"||!ve.image_url)return!1;var Me=ve.image_url.url||ve.image_url;if(typeof Me!="string")return!1;if(Me.startsWith("data:image/")){var Ye=Me.indexOf(";"),yt=Ye>5?Me.substring(5,Ye).toLowerCase():"",se=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return se.indexOf(yt)!==-1}if(Me.startsWith("https://"))try{var Pe=new URL(Me),He=Pe.pathname.toLowerCase();return!He.endsWith(".svg")&&!He.endsWith(".svgz")}catch{return!1}return!1}),$=x&&!C,fe=y.useRef({current:0});fe.current={current:0};var ae=y.useRef(null);ae.current={searchQuery:a,matchCount:l,matchOffset:o,activeMatchIndex:u,registerMatchRef:d};var xe=y.useMemo(function(){return d2($)},[$]),Ie=y.useMemo(function(){if(!a)return null;var ve=xe,Me=d2($),Ye=function(yt){return function({children:se,node:Pe,...He}){var wt=ae.current;return wt.matchCount>0?i.jsx(yt,{...He,children:Sv(se,wt.searchQuery,wt.matchOffset,fe.current,wt.activeMatchIndex,wt.registerMatchRef)}):i.jsx(yt,{...He,children:se})}};return Me.td=Ye(ve.td),Me.th=Ye(ve.th),Me.p=Ye("p"),Me.li=Ye("li"),Me.h1=Ye("h1"),Me.h2=Ye("h2"),Me.h3=Ye("h3"),Me.h4=Ye("h4"),Me.h5=Ye("h5"),Me.h6=Ye("h6"),Me.blockquote=Ye("blockquote"),Me},[$,a,xe,fe,ae]);if(!C){var ze=!!Y,mt=W.length>0,ut=q.length>0,$e=q.some(function(ve){return(ve.tool||ve.state&&ve.state.title||"")==="question"}),qe=!m||$e,Oe=(t||[]).some(function(ve){return ve.type==="reasoning"&&ve.text}),rt=!1;if(n)for(var ot=Object.keys(n),At=0;At<ot.length;At++){var sn=n[ot[At]];if(sn&&sn.type==="reasoning"&&(sn.text||sn.delta)){rt=!0;break}}var Xt=Oe||rt,Ht=(t||[]).some(function(ve){return ve.type==="error"&&ve.text});if(!EB({hasText:ze,hasImages:mt,hasTools:ut,toolsVisibleHere:qe,hasReasoning:Xt,hasError:Ht,isFrameless:x,hideThinking:v,finish:e.finish}))return null}var We=hz(e.time,R),De=e.isAutoInjected===!0,et=e.isCompaction===!0,nt=e.isContinuation===!0,de=et&&!nt,_e=C&&De&&!et,Ue=null,ge="",ft="";if(_e){var ht=String(Y||""),vt=ht.split(`
|
|
109
|
-
`)[0]||"",pt=vt.indexOf("[session-mail from ")===0,Vt=pt?ht.split(`
|
|
110
|
-
`).slice(1).join(`
|
|
111
|
-
`):ht;if(e.mailbox&&e.mailbox.senderSessionID)Ue="mail",ge=e.mailbox.senderSessionTitle||String(e.mailbox.senderSessionID).slice(0,10);else if(pt){var Gt=vt.slice(19),Ze=Gt.indexOf(' — "'),qt=Gt,kt="";Ze!==-1&&(qt=Gt.slice(0,Ze),kt=Gt.slice(Ze+4).replace('"]',"")),Ue="mail",ge=kt||qt.replace(/\]$/,"").slice(0,10)}else e.injectedVia==="idle-injection"?Ue="idle":e.injectedVia==="scheduled-injection"?Ue="scheduled":Ue="auto";ft=Vt.replace(/\s+/g," ").trim(),ft.length>140&&(ft=ft.slice(0,139)+"…")}var $t=function(){var ve=Y||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(ve).then(function(){B.current&&(F(!0),le.current&&clearTimeout(le.current),le.current=setTimeout(function(){B.current&&F(!1)},2e3))}).catch(function(){B.current&&tn(ve)}):tn(ve)},tn=function(ve){var Me=document.createElement("textarea");Me.value=ve,Me.style.position="fixed",Me.style.opacity="0",document.body.appendChild(Me),Me.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(Me)}B.current&&(F(!0),le.current&&clearTimeout(le.current),le.current=setTimeout(function(){B.current&&F(!1)},2e3))},on=function(){K(Y||""),H(!0)},Dn=function(){H(!1),K("")},ie=function(){P.trim()&&(M&&g&&g(e.id),p&&p(P.trim())),H(!1),K("")},Le=function(ve){if(T){var Me=x5(ve?ve.currentTarget:null),Ye=Me?uz(Me):"";T({text:Ye||Y||"",sourceMessageID:e.id,sourceRole:C?"user":"assistant",sourceTime:We||"",fromCode:!1})}};if(Ue&&!V)return i.jsxs("div",{className:"group flex items-center gap-2 px-1 py-1 min-w-0 cursor-pointer rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800/60 transition-colors","data-message-id":e.id,"data-message-role":C?"user":"assistant","data-message-time":We||void 0,"data-injected-collapsed":"true",onClick:function(){Z(!0)},children:[i.jsxs("span",{className:"inline-flex items-center gap-1 shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 leading-none",children:[i.jsx("span",{"aria-hidden":"true",children:Ue==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),Ue==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),Ue==="mail"&&ge?i.jsx("span",{className:"shrink-0 max-w-[160px] truncate text-[11px] text-gray-500 dark:text-gray-400",children:ge}):null,i.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-gray-600 dark:text-gray-300",children:ft||"…"}),i.jsx("button",{onMouseDown:function(ve){ve.preventDefault()},onClick:function(ve){ve.stopPropagation(),$t()},className:"shrink-0 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-hidden focus:ring-1 focus:ring-primary-500","aria-label":R(D?"chat.copied":"chat.copy_message"),title:R(D?"chat.copied":"chat.copy_message"),children:D?i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.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"})})})]});var Je=null;if(C){var Ft=nt?R("compaction.continuation_message_label")||"Compaction done. Please continue.":et?R("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":Y;if(a&&l>0&&!et&&!nt)Je=gz(Y||"",a,o,u,d);else{var Fe=YB(Y||"");if(Fe.quotes.length>0&&!et&&!nt){var it=Fe.rest;Je=i.jsxs(y.Fragment,{children:[Fe.quotes.map(function(ve,Me){return i.jsxs("div",{"data-testid":"quoted-block",className:"border-l-4 pl-3 my-1 bg-white/10 rounded text-white/90 text-sm whitespace-pre-wrap break-words",children:[i.jsx("div",{className:"font-medium",children:ve.header}),i.jsx("div",{children:ve.body})]},"quote-"+Me)}),it?i.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:it}):null]})}else Je=i.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:Ft})}}return i.jsxs("div",{className:`group flex gap-3 ${C?"justify-end":"justify-start"} ${M?"opacity-60 italic":""}${A&&!de?" opacity-60":""}`,"data-message-id":e.id,"data-message-role":C?"user":"assistant","data-message-time":We||void 0,"data-compacted-out":A?"true":void 0,children:[!C&&!$&&i.jsx("div",{className:`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?i.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:i.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"})}):i.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),i.jsxs("div",{className:`flex flex-col min-w-0 ${$?"w-full":"max-w-[70%] 3xs:max-w-[75%] xs:max-w-[80%] sm:max-w-[85%]"}`,children:[i.jsx("div",{className:`min-w-0 overflow-hidden ${C?`${cz}${M&&!ee?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:$?"":`${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`}`,...M&&!ee&&p&&g?{onClick:on,title:R("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(ve){(ve.key==="Enter"||ve.key===" ")&&(ve.preventDefault(),on())}}:{},children:C?ee?i.jsxs("div",{className:"space-y-2",children:[i.jsx("textarea",{ref:U,value:P,onChange:function(ve){K(ve.target.value)},className:"w-full bg-white/20 text-white placeholder-white/50 text-sm rounded-lg px-3 py-2 outline-hidden resize-none min-h-[60px] max-h-[300px] overflow-y-auto",rows:1,autoFocus:!0}),i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsx("button",{onClick:Dn,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),i.jsx("button",{onClick:ie,className:"px-3 py-1 text-xs rounded-lg bg-white/30 hover:bg-white/40 font-medium transition-colors",children:"Send"})]})]}):i.jsxs("div",{className:"text-sm whitespace-pre-wrap break-words",children:[Ue?i.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5 text-[11px] text-white/85",children:[i.jsxs("span",{className:"inline-flex items-center gap-1 shrink-0 font-medium px-1.5 py-0.5 rounded-full bg-white/20 leading-none",children:[i.jsx("span",{"aria-hidden":"true",children:Ue==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),Ue==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),Ue==="mail"&&ge?i.jsx("span",{className:"max-w-[160px] truncate opacity-80",children:ge}):null,i.jsx("button",{onClick:function(){Z(!1)},className:"p-0.5 rounded hover:bg-white/20 transition-colors focus:outline-hidden focus:ring-1 focus:ring-white/60","aria-label":"Collapse injected message",title:"Collapse",children:i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})})]}):null,Je,te.length>0&&i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:te.map(function(ve,Me){return i.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:ve.mime||"",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:i.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"})}),i.jsx("span",{className:"truncate",children:ve.filename})]},ve.id||"file-"+Me)})}),W.length>0&&i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:W.map(function(ve,Me){var Ye=ve.image_url.url||ve.image_url;return i.jsx("a",{href:Ye,target:"_blank",rel:"noopener noreferrer",children:i.jsx("img",{src:Ye,alt:R("chat.attachment_with_index",{index:Me+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},ve.id||"img-"+Me)})})]}):pz(t,n,W,te,xe,Ie,m,v,R,$,N,_,E)}),O&&i.jsx(jB,{sessionId:S}),i.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${C?"justify-end":"justify-start"}`,children:[We&&i.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:We}),De&&i.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:R("chat.idle_injection_auto_badge")}),(!E||!_)&&(e.finish==="aborted"||e.finish==="interrupted")&&i.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"?R("chat.stopped_badge")||"Stopped":R("chat.interrupted_badge")||"Interrupted"}),e.finish==="error"&&i.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:R("chat.error_badge")||"Error"}),e.moeTopK&&e.moeTopK>0&&i.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"}),i.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:[Y&&i.jsx("button",{onMouseDown:function(ve){ve.preventDefault()},onClick:$t,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-hidden focus:ring-1 focus:ring-primary-500","aria-label":R(D?"chat.copied":"chat.copy_message"),title:R(D?"chat.copied":"chat.copy_message"),children:D?i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),T&&!et&&!nt&&i.jsx("button",{onClick:Le,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-hidden focus:ring-1 focus:ring-primary-500","aria-label":R("chat.quote_selection"),title:R("chat.quote_selection"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})})}),C&&!M&&!ee&&p&&i.jsx("button",{onClick:on,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-hidden focus:ring-1 focus:ring-primary-500","aria-label":R("chat.edit_resend"),title:R("chat.edit_resend"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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&&M&&!ee&&p&&g&&i.jsx("button",{onClick:on,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-hidden focus:ring-1 focus:ring-primary-500","aria-label":R("chat.edit_resend"),title:R("chat.edit_resend"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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&&M&&g&&i.jsx("button",{onClick:function(){g(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-hidden focus:ring-1 focus:ring-primary-500","aria-label":R("chat.cancel_queued"),title:R("chat.cancel_queued"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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&&i.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-hidden focus:ring-1 focus:ring-primary-500","aria-label":R("chat.regenerate"),title:R("chat.regenerate"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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&&i.jsx("div",{className:"shrink-0 w-7 h-7 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center mt-1",children:i.jsx("span",{className:"text-gray-700 dark:text-gray-200 font-bold text-xs",children:I})})]})}function pz(e,t,n,r,a,o,l,u,d,f,p,g,m){var x=(e||[]).slice();if(t){for(var v={},k=0;k<x.length;k++)v[x[k].id]=!0;for(var _=Object.keys(t),E=0;E<_.length;E++){var S=t[_[E]];(S.type==="text"||S.type==="reasoning")&&!v[S.id]&&x.push({id:S.id,type:S.type,text:S.text||S.delta||"",live:!0})}}var N=[],A="",T="",R=!1,C=0,O=0;function M(){A&&(N.push({type:"text",text:A,key:"text-"+C}),C+=1,A="")}function I(){T&&(N.push({type:"reasoning",text:T,key:"reasoning-"+O,live:R}),O+=1,T="",R=!1)}for(var D=0;D<x.length;D++){var F=x[D];if(F.type==="text"){I();var ee=F.text||"";A&&ee&&!A.endsWith(`
|
|
112
|
-
`)&&(A+=`
|
|
113
|
-
`),A+=ee}else if(F.type==="reasoning"){M(),F.live&&(R=!0);var H=F.text||"";T&&H&&!T.endsWith(`
|
|
114
|
-
`)&&(T+=`
|
|
115
|
-
`),T+=H}else F.type==="error"?(I(),M(),N.push({type:"error",text:F.text||"",key:"error-"+(F.id||D)})):F.type==="tool"&&(I(),M(),N.push({type:"tool",part:F,key:"tool-"+(F.id||D)}))}if(I(),M(),r.length>0&&N.push({type:"files",parts:r,key:"files"}),n.length>0&&N.push({type:"images",parts:n,key:"images"}),N.length===0)return null;var P=[],K=[],V="";function Z(){K.length>0&&(P.push(i.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:K},"accent-"+V)),K=[])}for(var le=-1,B=N.length-1;B>=0;B--)if(N[B].type==="reasoning"){le=B;break}for(var U=0;U<N.length;U++){var Y=N[U];if(Y.type==="text"){Z();var q=o||a;P.push(i.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:i.jsx(kf,{remarkPlugins:[_f,wf],rehypePlugins:[og],components:q,children:Y.text})},Y.key))}else if(Y.type==="reasoning")if(f){if(Z(),u)continue;K.length===0&&(V=Y.key),K.push(i.jsx(wB,{text:Y.text,isStreaming:Y.live&&U===le&&g&&m},Y.key))}else{if(Z(),u)continue;P.push(i.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:[i.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 text-xs font-medium uppercase tracking-wide",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.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"})}),d("chat.thinking")]}),i.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:i.jsx(kf,{remarkPlugins:[_f,wf],rehypePlugins:[og],components:a,children:Y.text})})]},Y.key))}else if(Y.type==="error")Z(),P.push(i.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:[i.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs font-medium uppercase tracking-wide",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i.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"})}),d("chat.error_badge")||"Error"]}),i.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-red-600 dark:text-red-300",children:i.jsx(kf,{remarkPlugins:[_f,wf],rehypePlugins:[og],components:a,children:Y.text})})]},Y.key));else if(Y.type==="tool"){var te=Y.part.tool||Y.part.state&&Y.part.state.title||"",W=te==="question";if(W){Z();var $=Y.part.callID||Y.part.id||"",fe=p&&p[$]?p[$]:null;P.push(i.jsx("div",{className:"my-2",children:i.jsx(NB,{part:Y.part,questionId:fe})},Y.key))}else f&&!l?(K.length===0&&(V=Y.key),K.push(i.jsx(_B,{part:Y.part},Y.key))):(Z(),P.push(i.jsx("div",{className:`my-2 ${l?"hidden":""}`,children:i.jsx(kB,{part:Y.part})},Y.key)))}else Y.type==="files"?(Z(),P.push(i.jsx("div",{className:P.length>0?"mt-2":"",children:i.jsx("div",{className:"flex flex-wrap gap-2",children:Y.parts.map(function(ae,xe){return i.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:ae.mime||"",children:[i.jsx("svg",{className:"w-5 h-5 text-gray-500 dark:text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:i.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"})}),i.jsx("span",{className:"truncate text-xs text-gray-700 dark:text-gray-300",children:ae.filename})]},ae.id||"file-"+xe)})})},Y.key))):Y.type==="images"&&P.push(i.jsx("div",{className:P.length>0?"mt-2":"",children:i.jsx("div",{className:"flex flex-wrap gap-2",children:Y.parts.map(function(ae,xe){var Ie=ae.image_url.url||ae.image_url;return i.jsx("a",{href:Ie,target:"_blank",rel:"noopener noreferrer",children:i.jsx("img",{src:Ie,alt:d("chat.attachment_with_index",{index:xe+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},ae.id||"img-"+xe)})})},Y.key))}return Z(),P}function yu(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(yu).join(""):y.isValidElement(e)?yu(e.props.children):""}function hz(e,t){if(!e)return"";var n=e.created||e.updated;if(!n)return"";var r=new Date(n);if(isNaN(r.getTime()))return"";var a=new Date,o=r.toDateString()===a.toDateString(),l=new Date(a);l.setDate(l.getDate()-1);var u=r.toDateString()===l.toDateString(),d=r.getHours(),f=r.getMinutes(),p=d>=12?"PM":"AM";d=d%12,d===0&&(d=12);var g=d+":"+(f<10?"0":"")+f+" "+p;if(o)return g;if(u)return t?t("chat.yesterday_time",{time:g}):"Yesterday "+g;var m=r.getMonth()+1,x=r.getDate();return m+"/"+x+" "+g}function gz(e,t,n,r,a){if(!t||!e)return i.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 p=o.indexOf(l,d);if(p===-1)break;p>d&&u.push(e.substring(d,p));var g=n+f,m=g===r;u.push(i.jsx("mark",{ref:function(x){a(g,x)},className:m?"bg-accent-400 text-gray-900 rounded-xs px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-xs px-0.5",children:e.substring(p,p+t.length)},"m-"+f)),f++,d=p+t.length}return d<e.length&&u.push(e.substring(d)),i.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:u})}function Sv(e,t,n,r,a,o){if(!e)return e;if(Array.isArray(e))return e.map(function(k,_){return i.jsx(y.Fragment,{children:Sv(k,t,n,r,a,o)},_)});if(typeof e=="string"){for(var l=e,u=l.toLowerCase(),d=t.toLowerCase(),f=[],p=0;;){var g=u.indexOf(d,p);if(g===-1)break;g>p&&f.push(l.substring(p,g));var m=n+r.current,x=m===a;f.push(i.jsx("mark",{ref:function(k){o(m,k)},className:x?"bg-accent-400 text-gray-900 rounded-xs px-0.5":"bg-yellow-200 dark:bg-yellow-700 text-gray-900 dark:text-gray-100 rounded-xs px-0.5",children:l.substring(g,g+t.length)},"m-"+r.current)),r.current++,p=g+t.length}return p<l.length&&f.push(l.substring(p)),f.length>0?f:l}if(y.isValidElement(e)){if(e.type==="code"||e.type===Ef)return e;if(e.props&&e.props.children!==void 0){var v=Sv(e.props.children,t,n,r,a,o);return y.cloneElement(e,void 0,v)}}return e}function mz({sessionID:e,banners:t,hidden:n,onToggle:r}){var[a,o]=y.useState(0),[l,u]=y.useState(!1);if(y.useRef(null),y.useEffect(function(){o(0)},[e,t&&t.length,t&&t[0]&&t[0].timestamp]),!e||!t||t.length===0)return null;if(n)return i.jsx("button",{type:"button",onClick:r,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[a]||t[0],f=function(){o(function(g){return Math.min(t.length-1,g+1)})},p=function(){o(function(g){return Math.max(0,g-1)})};return i.jsxs(i.Fragment,{children:[i.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:i.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:[i.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-full object-cover",loading:"lazy",draggable:!1}),d.prompt?i.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:i.jsx("div",{className:"line-clamp-2",children:d.prompt})}):null,t.length>1?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:function(g){g.stopPropagation(),f()},disabled:a>=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:"‹"}),i.jsx("button",{type:"button",onClick:function(g){g.stopPropagation(),p()},disabled:a<=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:"›"}),i.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:a+1+" / "+t.length})]}):null]})}),l?i.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:[i.jsxs("div",{className:"max-w-5xl w-full",onClick:function(g){g.stopPropagation()},children:[i.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?i.jsx("div",{className:"text-white text-sm mt-3 px-2",children:d.prompt}):null,i.jsxs("div",{className:"text-white/60 text-xs mt-1 px-2",children:[new Date(d.timestamp).toLocaleString(),t.length>1?" · "+(a+1)+" of "+t.length:""]})]}),i.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 xz=y.forwardRef(function({messages:t,unloadedCompactedCount:n,onExpandCompactedHistory:r,hasOlderMessages:a,loadingOlderMessages:o,onLoadOlderMessages:l,streamingParts:u,streamingProgress:d,isBusy:f,compactingInfo:p,compactionResult:g,onSwitchToCompactedSession:m,onDismissCompactionResult:x,user:v,searchQuery:k,activeMatchIndex:_,onTotalMatchesChange:E,onRetry:S,onEditAndResend:N,onCancelQueued:A,hackerMode:T,mobileFrameless:R,hideThinking:C,sessionID:O,banners:M,bannerHidden:I,onToggleBanner:D,privateMessageIds:F,parentSessionID:ee,onViewParentSession:H,compactionPinned:P,onUnpinCompaction:K,questionIdMap:V,onQuoteAdd:Z},le){const{t:B}=rn();var U=y.useRef(null),Y=y.useRef(!0),q=y.useRef({}),te=y.useRef(null),W=y.useRef(null),[$,fe]=y.useState(!1),ae=y.useRef(-1),xe=y.useRef(0),Ie=y.useRef(null),ze=y.useRef(null),mt=y.useRef(t.length);mt.current=t.length;var[ut,$e]=y.useState(!1),qe=y.useRef({startIndex:0,endIndex:0}),Oe=y.useRef(null),rt=y.useRef(!1),ot=y.useRef(0),At=y.useRef(null);y.useEffect(function(){$e(!1),At.current=null},[O]);var sn=y.useCallback(function(){Y.current=!0,W.current?W.current.scrollTop=W.current.scrollHeight:U.current&&U.current.scrollToIndex({index:"LAST",behavior:"smooth",align:"end"})},[]);y.useImperativeHandle(le,function(){return{scrollToBottom:sn,resetAutoScroll:function(){Y.current=!0}}},[sn]);var Xt=y.useCallback(function(Fe,it){it?q.current[Fe]=it:delete q.current[Fe]},[]),Ht=y.useRef({}),We=y.useMemo(function(){if(!k)return{perMessage:{},total:0,_nextCache:{}};for(var Fe=k.toLowerCase(),it=0,ve={},Me={},Ye=Ht.current,yt=0;yt<t.length;yt++){var se=t[yt],Pe=MB(se.parts,u[se.info.id],C),He=se.info.role==="assistant",wt=He?LB(Pe):Pe,Re=wt.toLowerCase(),Ke=se.info.id,bt=Ye[Ke],bn;bt&&bt.text===Re&&bt.query===Fe?bn=bt.count:bn=yz(Re,Fe),Me[Ke]={text:Re,query:Fe,count:bn},bn>0&&(ve[se.info.id]={offset:it,count:bn,messageIndex:yt}),it+=bn}return{perMessage:ve,total:it,_nextCache:Me}},[t,u,k,C]);y.useEffect(function(){Ht.current=We._nextCache},[We]);var De=y.useMemo(function(){return{perMessage:We.perMessage,total:We.total}},[We]);y.useEffect(function(){E&&E(De.total)},[De.total,E]);var et=y.useMemo(function(){for(var Fe=0,it=0;it<t.length;it++)t[it].info.compactedOut===!0&&Fe++;return Fe},[t]),nt=y.useMemo(function(){return ut||et===0?t:t.filter(function(Fe){return Fe.info.compactedOut!==!0})},[t,ut,et]),de=y.useRef(nt.length);de.current=nt.length,y.useEffect(function(){if(!(!k||De.total===0||ut||et===0)){var Fe=De.perMessage;for(var it in Fe)if(Fe.hasOwnProperty(it)&&Fe[it].messageIndex<et){$e(!0);break}}},[k,De,ut,et]),y.useLayoutEffect(function(){if(Oe.current!=null&&U.current){var Fe=Oe.current;if(Oe.current=null,Fe<0||Fe>=nt.length)return;var it=requestAnimationFrame(function(){U.current&&U.current.scrollToIndex({index:Fe,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(it)}}},[nt]),y.useLayoutEffect(function(){var Fe=At.current;if(!(!Fe||nt.length<=Fe.count||!U.current)){At.current=null;var it=Fe.index+(nt.length-Fe.count),ve=requestAnimationFrame(function(){U.current&&U.current.scrollToIndex({index:it,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(ve)}}},[nt]);var _e=y.useCallback(function(){!l||o||(rt.current=!0,At.current={index:qe.current.startIndex,count:nt.length},Promise.resolve(l()).then(function(Fe){setTimeout(function(){var it=At.current;(!Fe||Fe.length===0||it&&de.current<=it.count)&&(At.current=null)},0)},function(){At.current=null}))},[l,o,nt.length]),Ue=y.useCallback(function(){if(rt.current=!0,ut){Oe.current=0,$e(!1);return}et>0?(Oe.current=qe.current.startIndex+et,$e(!0)):n>0&&r&&(Oe.current=qe.current.startIndex+n,$e(!0),r())},[ut,et,n,r]);y.useEffect(function(){var Fe=nt.length>ot.current;if(ot.current=nt.length,!Fe||!Y.current||rt.current){rt.current=!1;return}var it=setTimeout(function(){Y.current&&W.current&&(W.current.scrollTop=W.current.scrollHeight)},150);return function(){clearTimeout(it)}},[nt.length]),y.useEffect(function(){!Y.current||k||W.current&&(W.current.scrollTop=W.current.scrollHeight)},[u,t,k]),y.useEffect(function(){var Fe=Ie.current!==O;Ie.current=O,Fe&&(Y.current=!0,ae.current=-1,ot.current=0,xe.current=Date.now()+600,fe(!1));function it(){Y.current&&W.current&&(W.current.scrollTop=W.current.scrollHeight)}var ve=requestAnimationFrame(it),Me=setTimeout(it,150),Ye=setTimeout(it,450);return function(){cancelAnimationFrame(ve),clearTimeout(Me),clearTimeout(Ye)}},[O,t]);var ge=y.useCallback(function(){var Fe=W.current;if(Fe){var it=Fe.scrollTop,ve=it+Fe.clientHeight>=Fe.scrollHeight-4;ve?Y.current=!0:ae.current>=0&&it<ae.current-8&&Date.now()>xe.current&&(Y.current=!1),ae.current=it,fe(!ve&&!Y.current&&mt.current>0)}},[]),ft=y.useCallback(function(Fe){!Fe||ze.current===Fe||(ze.current&&ze.current.removeEventListener("scroll",ge),ze.current=Fe,Fe.addEventListener("scroll",ge,{passive:!0}))},[ge]);y.useEffect(function(){return function(){ze.current&&ze.current.removeEventListener("scroll",ge)}},[ge]);var ht=y.useMemo(function(){if(!k||De.total===0)return[];var Fe=[],it=De.perMessage;for(var ve in it)it.hasOwnProperty(ve)&&Fe.push(it[ve]);return Fe.sort(function(Me,Ye){return Me.messageIndex-Ye.messageIndex}),Fe},[k,De]);y.useEffect(function(){if(!(!k||De.total===0||_<0)){for(var Fe=-1,it=0;it<ht.length;it++){var ve=ht[it];if(_>=ve.offset&&_<ve.offset+ve.count){Fe=ve.messageIndex;break}}if(!(Fe<0)){var Me=ut||et===0?0:et,Ye=Fe-Me;if(!(Ye<0)){U.current&&U.current.scrollToIndex({index:Ye,align:"center",behavior:"smooth"});var yt=requestAnimationFrame(function(){var se=setTimeout(function(){var Pe=q.current[_];Pe&&Pe.scrollIntoView&&Pe.scrollIntoView({behavior:"smooth",block:"center"})},200);te.current=se});return function(){cancelAnimationFrame(yt),te.current&&(clearTimeout(te.current),te.current=null)}}}}},[_,k,De.total,ht,ut,et]),y.useEffect(function(){q.current={}},[k]);for(var vt=-1,pt=nt.length-1;pt>=0;pt--)if(nt[pt].info.role==="assistant"){vt=pt;break}var Vt=y.useCallback(function(Fe){return k?!1:Fe?f?"auto":"smooth":!1},[k,f]),Gt=y.useCallback(function(Fe){Fe&&(Y.current=!0),fe(!Fe&&!Y.current&&mt.current>0)},[]),Ze=y.useMemo(function(){return ut&&et>0?{top:3e3,bottom:600}:{top:600,bottom:600}},[ut,et]),qt=y.useCallback(function(Fe,it){var ve=De.perMessage[it.info.id]||null,Me=Fe===vt,Ye=it.info.role==="user",yt=it.info.compactedOut===!0,se=ut&&Fe>0&&t[Fe-1].info.compactedOut===!0,Pe=se&&!yt;return i.jsxs("div",{className:"px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[Pe?i.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none mb-6",children:[i.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:B&&B("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),i.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]}):null,i.jsx(fz,{isCompactedOut:yt,message:it.info,parts:it.parts,streamingParts:u[it.info.id],user:v,searchQuery:k,matchOffset:ve?ve.offset:-1,matchCount:ve?ve.count:0,activeMatchIndex:_,registerMatchRef:Xt,isLast:Me,isBusy:f,sessionID:O,onRetry:Me&&!f&&!yt?S:void 0,onEditAndResend:Ye&&!f&&!yt&&!vz(it.parts)?N:void 0,onCancelQueued:yt?void 0:A,hackerMode:T,mobileFrameless:R,hideThinking:C,isPrivate:F&&F.has(it.info.id),questionIdMap:V,onQuoteAdd:Z})]})},[De,vt,t,u,v,k,_,Xt,f,O,S,N,A,T,R,C,F,V,Z,ut,B]),kt=y.useMemo(function(){return i.jsxs(i.Fragment,{children:[f&&(R?!0:!bz(t,u,T,C))&&(R?i.jsx("div",{className:"flex justify-start py-2 px-2 sm:px-4 max-w-full sm:max-w-3xl mx-auto",children:i.jsx("svg",{className:"w-4 h-4 text-indigo-400 dark:text-indigo-300 shrink-0 animate-pulse",viewBox:"0 0 24 24",fill:"currentColor",role:"img","aria-label":B("chat.assistant_typing")||"Assistant is typing",children:i.jsx("path",{d:"M12 2l2.4 7.6L22 12l-7.6 2.4L12 22l-2.4-7.6L2 12l7.6-2.4L12 2z"})})}):i.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:[i.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-primary-500 flex items-center justify-center mt-1",children:i.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),i.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"0ms"}}),i.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"150ms"}}),i.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"300ms"}})]})})]})),f&&!R&&d&&d.toolCalls>0&&i.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:[i.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-accent-500 flex items-center justify-center mt-1",children:i.jsxs("svg",{className:"w-4 h-4 text-white animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.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.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:[i.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:kz(d.toolNames,B)}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:_z(d.toolArgBytes)})]}),i.jsx("div",{className:"h-1 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:i.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,R,t,u,d,T,C,B]),$t=y.useMemo(function(){return function(){return i.jsxs(i.Fragment,{children:[i.jsx(mz,{sessionID:O,banners:M,hidden:I,onToggle:D}),i.jsx(Ez,{sessionID:O,parentSessionID:ee,onViewParentSession:H,compactionPinned:P,onUnpinCompaction:K,t:B}),a?i.jsx("div",{className:"flex justify-center py-1.5",children:i.jsx("button",{type:"button",onClick:_e,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-xs",children:o?B&&B("messages.loading_earlier")||"Loading earlier messages...":B&&B("messages.load_earlier")||"Load earlier messages"})}):null,et>0||n>0?i.jsx("div",{className:"sticky top-0 z-10 flex justify-center py-1.5 pointer-events-none",children:i.jsx("button",{type:"button",onClick:Ue,"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-xs",children:ut&&et>0?B&&B("compaction.hide_history")||"Hide messages before compaction":B&&B("compaction.show_history",{count:et>0?et:n})||"Conversation summarized — "+(et>0?et:n)+" earlier messages collapsed; summary below"})}):null]})}},[O,M,I,D,ee,H,P,K,B,a,o,_e,et,n,ut,Ue]),tn=y.useRef(kt);tn.current=kt;var on=y.useRef(null);on.current||(on.current={version:0,listeners:new Set});var Dn=on.current;y.useEffect(function(){Dn.version+=1,Dn.listeners.forEach(function(Fe){Fe()})},[kt,Dn]);var ie=y.useMemo(function(){return function(){return y.useSyncExternalStore(function(it){return Dn.listeners.add(it),function(){Dn.listeners.delete(it)}},function(){return Dn.version}),tn.current}},[]),Le=y.useMemo(function(){return{Header:$t,Footer:ie}},[$t,ie]),Je=nt.length===0&&(et>0||n>0),Ft=et>0?et:n;return Je?i.jsx("div",{className:"flex-1 relative overflow-hidden",children:i.jsx(wz,{count:Ft,onExpand:Ue,t:B})}):i.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[i.jsx(D4,{ref:U,scrollerRef:function(Fe){W.current=Fe,Fe&&ft(Fe)},data:nt,itemContent:qt,followOutput:Vt,atBottomStateChange:Gt,rangeChanged:function(Fe){qe.current=Fe},increaseViewportBy:Ze,defaultItemHeight:120,computeItemKey:function(Fe,it){return it.info.id},components:Le,className:"h-full",style:{overflowY:"auto",overflowX:"hidden"}}),$&&i.jsx("button",{onClick:sn,"aria-label":B("chat.scroll_to_bottom"),className:"absolute bottom-4 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-hidden focus:ring-2 focus:ring-primary-500 transition-all",title:B("chat.scroll_to_bottom"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})});function yz(e,t){if(!t)return 0;for(var n=0,r=0;r=e.indexOf(t,r),r!==-1;)n++,r+=t.length;return n}function bz(e,t,n,r){var a=!n;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"&&r?!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 p=(f.parts||[]).some(function(m){return m.type==="reasoning"&&r?!1:(m.type==="text"||m.type==="reasoning")&&m.text}),g=(f.parts||[]).some(function(m){return m.type==="tool"});return p||a&&g}if(f.info.role==="user")break}return!1}function vz(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function kz(e,t){if(!e||e.length===0)return t?t("chat.tool_preparing"):"Preparing tool call";var n={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"},r=e[0],a=n[r]||(t?t("chat.tool_preparing_name",{name:r}):"Preparing "+r);return e.length>1&&(a+=" +"+(e.length-1)),a}function _z(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function wz({count:e,onExpand:t,t:n}){return i.jsx("div",{"data-testid":"compaction-empty-state",className:"h-full flex flex-col items-center justify-center text-center px-6 py-10",children:i.jsxs("div",{className:"max-w-sm mx-auto flex flex-col items-center",children:[i.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:i.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:i.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"})})}),i.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:n&&n("compaction.empty_title")||"This conversation was summarized"}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-5 leading-relaxed",children:n&&n("compaction.empty_body")||"Earlier messages are collapsed to save context. Show them to see the full history."}),i.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-hidden focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 transition-colors shadow-xs",children:n&&n("compaction.empty_action",{count:e})||"Show "+e+" earlier messages"})]})})}function Ez({sessionID:e,parentSessionID:t,onViewParentSession:n,compactionPinned:r,onUnpinCompaction:a,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{}x(!0)},f=function(){n&&t&&n(t)},p=u(),g=y.useState(!p),m=g[0],x=g[1];return!t||m?null:i.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:i.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 text-blue-500 dark:text-blue-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.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."}),i.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-hidden focus:underline transition-colors whitespace-nowrap shrink-0",children:o&&o("compaction.view_original")||"View original"}),r?i.jsx("button",{type:"button",onClick:function(){a&&a(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-hidden focus:underline transition-colors whitespace-nowrap shrink-0",children:o&&o("chat.unpin_compacted")||"Unpin — go back to original"}):null,i.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 shrink-0 ml-1",children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const Jf=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],y5=["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"],b5=[...Jf,...y5],Df=5,f2=Math.floor(4*1024*1024/1.34),p2=5*1024*1024,h2=6*1024*1024,g2=Math.floor(4*1024*1024/1.34),Sz=b5.join(",");function cg(e){return e?Jf.indexOf(e.toLowerCase())!==-1:!1}var ug,m2;function Nz(){if(m2)return ug;m2=1;class e{constructor(n){n||(n={}),this._sampleRate=n.sampleRate||16e3,this._capacity=Math.max(1,Math.round((n.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(n){if(!n||!(n instanceof Float32Array))throw new TypeError("append() requires a Float32Array argument");const r=n.length;if(r===0)return;if(this._totalAppended+=r,r>=this._capacity){const u=r-this._capacity;this._buffer.set(n.subarray(u,r)),this._start=0,this._length=this._capacity;return}const a=(this._start+this._length)%this._capacity,o=Math.min(r,this._capacity-a);this._buffer.set(n.subarray(0,o),a),o<r&&this._buffer.set(n.subarray(o,r),0);const l=this._length+r;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(n,r){if(typeof n!="number"||n<0)throw new RangeError("read() offset must be >= 0, got "+n);if(typeof r!="number"||r<0)throw new RangeError("read() count must be >= 0, got "+r);if(n>=this._length||r===0)return new Float32Array(0);const a=Math.min(r,this._length-n),o=new Float32Array(a),l=(this._start+n)%this._capacity,u=Math.min(a,this._capacity-l);return o.set(this._buffer.subarray(l,l+u),0),u<a&&o.set(this._buffer.subarray(0,a-u),u),o}trimBefore(n){(typeof n!="number"||n<0)&&(n=0),n>this._length&&(n=this._length),this._start=(this._start+n)%this._capacity,this._length-=n}clear(){this._start=0,this._length=0,this._totalAppended=0}}return ug={AudioRingBuffer:e},ug}var Cz=Nz(),dg,x2;function jz(){if(x2)return dg;x2=1;class e{constructor(n){n||(n={}),this._sampleRate=n.sampleRate||16e3,this._chunkSamples=Math.round((n.chunkDuration||10)*this._sampleRate),this._overlapSamples=Math.round((n.overlapDuration||3)*this._sampleRate),this._minChunkSamples=Math.round((n.minChunkDuration||3)*this._sampleRate),this._maxInitialPrompt=n.maxInitialPrompt||200,this.reset()}get slotIndex(){return this._slotIndex}get pendingNewSamples(){return this._pendingNewSamples}get inflight(){return this._inflight}appendAndSchedule(n){if(this._inflight)return null;const r=n.totalAppended-this._lastSlotEndTotalAppended;this._pendingNewSamples=Math.max(0,r);const a=this._slotIndex===0?this._minChunkSamples:this._chunkSamples;return this._pendingNewSamples<a?null:this._cutSlot(n)}reportResult(n){this._inflight&&(this._inflight=!1,this._prevText=n||"")}drain(n){if(this._inflight)return null;const r=n.totalAppended-this._lastSlotEndTotalAppended;return r<=0?null:this._cutSlot(n,r)}reset(){this._slotIndex=0,this._inflight=!1,this._pendingNewSamples=0,this._lastSlotEndTotalAppended=0,this._prevText="",this._drained=!1}clearPrevText(){this._prevText=""}_cutSlot(n,r){const a=this._slotIndex===0,o=n.totalAppended-n.length,l=a?0:Math.min(this._overlapSamples,Math.max(0,this._lastSlotEndTotalAppended-o)),u=r!=null?Math.min(r,n.totalAppended-this._lastSlotEndTotalAppended):Math.min(this._pendingNewSamples,n.totalAppended-this._lastSlotEndTotalAppended),d=l+u,f=Math.max(0,this._lastSlotEndTotalAppended-o-l),p=n.read(f,d);let g="";this._prevText.length>0&&(g=this._prevText.length>this._maxInitialPrompt?this._prevText.slice(-this._maxInitialPrompt):this._prevText);const m={audio:p,overlapSamples:l,slotIndex:this._slotIndex,initialPrompt:g,chunkId:"slot-"+this._slotIndex};return this._lastSlotEndTotalAppended+=u,this._slotIndex++,this._inflight=!0,this._pendingNewSamples=0,m}}return dg={TranscriptionScheduler:e},dg}var Tz=jz(),fg,y2;function Rz(){if(y2)return fg;y2=1;function e(n,r){const a=n.length,o=r.length;if(a===0)return o;if(o===0)return a;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<=a;d++){u[0]=d;for(let p=1;p<=o;p++){const g=n[d-1]===r[p-1]?0:1;u[p]=Math.min(u[p-1]+1,l[p]+1,l[p-1]+g)}const f=l;l=u,u=f}return l[o]}function t(n,r,a){if(!n)return r||"";if(!r)return"";const o=a&&a.maxOverlapChars||50,l=a&&typeof a.maxEditRatio=="number"?a.maxEditRatio:.2,u=Math.min(o,n.length,r.length);for(let d=u;d>=1;d--){const f=n.slice(-d),p=r.slice(0,d);if(e(f,p)/d<=l)return r.slice(d)}return r}return fg={dedupOverlap:t,levenshtein:e},fg}var Az=Rz();const Rl=16e3;function cf(e,t,n,r){try{const a=localStorage.getItem(e);if(a==null||a==="")return t;const o=Number(a);return Number.isFinite(o)?Math.min(r,Math.max(n,o)):t}catch{return t}}const Iz=2,Mz=.6,Lz=1,Oz=200,b2=3,pg=2,Dz=1e3,v2=.01,k2=800;function _2(e){if(!e||e.length===0)return 0;let t=0;for(let n=0;n<e.length;n++){const r=e[n];t+=r*r}return Math.sqrt(t/e.length)}function Pz(e,t){const n=e.sampleRate,r=e.getChannelData(0);if(n===t)return new Float32Array(r);const a=n/t,o=Math.round(r.length/a),l=new Float32Array(o);for(let u=0;u<o;u+=1){const d=u*a,f=Math.floor(d),p=Math.min(f+1,r.length-1),g=d-f;l[u]=r[f]*(1-g)+r[p]*g}return l}function Fz(e,t){const a=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 p=0;p<4;p++)d.setUint8(f++,"RIFF".charCodeAt(p));d.setUint32(f,36+l,!0),f+=4;for(let p=0;p<4;p++)d.setUint8(f++,"WAVE".charCodeAt(p));for(let p=0;p<4;p++)d.setUint8(f++,"fmt ".charCodeAt(p));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,a,!0),f+=4,d.setUint16(f,o,!0),f+=2,d.setUint16(f,16,!0),f+=2;for(let p=0;p<4;p++)d.setUint8(f++,"data".charCodeAt(p));d.setUint32(f,l,!0),f+=4;for(let p=0;p<e.length;p++){const g=Math.max(-1,Math.min(1,e[p]));d.setInt16(f,g<0?g*32768:g*32767,!0),f+=2}return new Blob([u],{type:"audio/wav"})}function Bz({onTranscript:e,onError:t,onAutoSubmit:n,language:r,model:a}){const[o,l]=y.useState("idle"),[u,d]=y.useState(0),[f,p]=y.useState(null),[g,m]=y.useState(null),[x,v]=y.useState(""),k=y.useRef(null),_=y.useRef(null),E=y.useRef(null),S=y.useRef(null),N=y.useRef(!1),A=y.useRef(null),T=y.useRef(null),R=y.useRef(null),C=y.useRef(null),O=y.useRef(null),M=y.useRef(null),I=y.useRef(0),D=y.useRef(!1),F=y.useRef(""),ee=y.useRef(!1),H=y.useRef(null),P=y.useRef(k2),K=y.useRef(null),V=y.useRef(!1),Z=y.useRef(""),le=y.useRef(""),B=y.useRef("idle"),U=y.useCallback(We=>{B.current=We,l(We)},[]),Y=y.useRef(e),q=y.useRef(t),te=y.useRef(n),W=y.useRef(r),$=y.useRef(a);y.useEffect(()=>{Y.current=e},[e]),y.useEffect(()=>{q.current=t},[t]),y.useEffect(()=>{te.current=n},[n]),y.useEffect(()=>{W.current=r},[r]),y.useEffect(()=>{$.current=a},[a]),y.useEffect(()=>{C.current&&(B.current==="recording"||B.current==="paused")&&C.current.clearPrevText()},[r]);const fe=y.useCallback(()=>O.current?Promise.resolve(O.current):(M.current||(M.current=nv().then(We=>(O.current=We,We)).catch(()=>{const We={mode:"auto",backendAvailable:!1};return O.current=We,We})),M.current),[]);y.useEffect(()=>{fe()},[fe]);const ae=y.useCallback(()=>{if(A.current&&(A.current.getTracks().forEach(We=>We.stop()),A.current=null),K.current){try{K.current.readyState===WebSocket.OPEN&&K.current.send("Done"),K.current.close()}catch{}K.current=null}V.current=!1},[]),xe=y.useCallback(()=>{k.current&&(k.current.terminate(),k.current=null)},[]),Ie=y.useCallback(()=>{const We=E.current,De=_.current,et=S.current;if(We){try{We.disconnect()}catch{}We.onaudioprocess=null,E.current=null}if(De){try{De.disconnect()}catch{}_.current=null}if(et){try{et.disconnect()}catch{}S.current=null}N.current=!1,ae(),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),xe(),R.current&&R.current.clear(),C.current&&C.current.reset(),I.current=0},[ae,xe]),ze=y.useRef(null),mt=y.useRef(null),ut=y.useRef(null),$e=y.useRef(null),qe=y.useRef(null),Oe=y.useRef(null);ze.current=function(De){const et=De&&De.text||"";De&&De.chunkId;const nt=C.current,de=De&&De._silent;nt&&nt.reportResult(et);const _e=Az.dedupOverlap(F.current,et);if(_e){const Ue=F.current+_e;F.current=Ue,v(Ue),Y.current&&Y.current(_e)}if(I.current=0,(de||et.trim()==="")&&F.current.trim()&&te.current&&te.current(),B.current==="draining"&&nt&&!nt.inflight){const Ue=R.current,ge=nt.drain(Ue);ge?$e.current(ge):Oe.current();return}ut.current()},mt.current=function(De){const et=C.current;if(et&&et.reportResult(""),I.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",De,"("+I.current+"/"+b2+")"),I.current>=b2){Ie(),U("idle"),q.current&&q.current("Voice transcription failed repeatedly. Please try again.");return}if(B.current==="draining"&&et&&!et.inflight){Oe.current();return}ut.current()},ut.current=function(){const De=C.current,et=R.current;if(!De||!et)return;const nt=B.current;if(nt!=="recording"&&nt!=="paused"&&nt!=="draining")return;const de=De.appendAndSchedule(et);if(de){$e.current(de);return}if((nt==="paused"||nt==="draining")&&!De.inflight){const _e=De.drain(et);_e?$e.current(_e):nt==="draining"&&Oe.current()}},$e.current=async function(De){const et=_2(De.audio);if(et<v2){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+et.toFixed(6)+")"),ze.current({text:"",chunkId:De.chunkId,_silent:!0});return}const nt=O.current||{mode:"auto",backendAvailable:!1},de=nt.backendAvailable&&nt.mode!=="local-only",_e=nt.mode!=="backend-only",Ue=W.current,ge=$.current;if(de&&!D.current){const vt=Fz(De.audio,Rl),pt={};De.initialPrompt&&(pt.initialPrompt=De.initialPrompt);let Vt=null;for(let Gt=0;Gt<=pg;Gt++)try{const Ze=await dL(vt,Ue,ge,pt);if(typeof Ze.text=="string"){m("backend"),ze.current({text:Ze.text,chunkId:De.chunkId});return}}catch(Ze){Vt=Ze;const qt=Ze.status;if((qt===429||qt===503)&&Gt<pg){const kt=Dz*2**Gt;console.warn("[useContinuousVoiceInput] Backend "+qt+", retrying in "+kt+"ms (attempt "+(Gt+1)+"/"+pg+")"),await new Promise($t=>{setTimeout($t,kt)});continue}(qt===429||qt===503)&&(D.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!_e){mt.current(Vt?Vt.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",Vt?Vt.message:"unknown")}if(!_e){mt.current("Backend transcription is not available and local mode is disabled.");return}const ft=qe.current();m("local");const ht={type:"transcribe",audio:De.audio};Ue&&(ht.language=Ue),De.initialPrompt&&(ht.initialPrompt=De.initialPrompt),De.chunkId&&(ht.chunkId=De.chunkId),ft.postMessage(ht,[De.audio.buffer])},qe.current=function(){if(k.current)return k.current;const De=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});return De.onmessage=et=>{const nt=et.data;if(nt)switch(nt.type){case"loading":d(nt.progress||0),p(nt.file?nt.file.split("/").pop():null);break;case"ready":B.current==="loading"&&U("recording"),d(100),p(null);break;case"result":ze.current(nt);break;case"error":mt.current(nt.error||"Transcription failed");break}},De.onerror=()=>{const et=C.current;et&&et.reportResult(""),I.current+=1,xe();const nt=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});nt.onmessage=de=>{const _e=de.data;if(_e)switch(_e.type){case"loading":d(_e.progress||0),p(_e.file?_e.file.split("/").pop():null);break;case"ready":B.current==="loading"&&U("recording"),d(100),p(null),ut.current();break;case"result":ze.current(_e);break;case"error":mt.current(_e.error||"Transcription failed");break}},nt.onerror=()=>{nt.terminate(),k.current=null,Ie(),U("idle"),F.current="",v(""),q.current&&q.current("Voice transcription worker crashed.")},k.current=nt},k.current=De,De},Oe.current=function(){const De=k.current;De&&De.postMessage({type:"unload"}),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),C.current&&C.current.reset(),R.current&&R.current.clear(),U("idle")};const rt=y.useCallback(async()=>{if(B.current==="idle"){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){q.current&&q.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){q.current&&q.current("Audio recording is not supported in this browser.");return}try{const We=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:Rl,echoCancellation:!0,noiseSuppression:!0}});A.current=We,O.current=null,M.current=null;const De=await fe(),et=!!(De.streaming&&De.streaming.wsUrl),nt=!et&&(De.mode==="local-only"||!De.backendAvailable&&De.mode!=="backend-only"),de=window.AudioContext||window.webkitAudioContext;(!T.current||T.current.state==="closed")&&(T.current=new de);const _e=T.current;if(R.current=new Cz.AudioRingBuffer({maxDuration:30,sampleRate:Rl}),C.current=new Tz.TranscriptionScheduler({chunkDuration:cf("pave.asr.chunkDuration",Iz,.5,30),overlapDuration:cf("pave.asr.overlapDuration",Mz,0,10),minChunkDuration:cf("pave.asr.minChunkDuration",Lz,.3,15),sampleRate:Rl,maxInitialPrompt:Oz}),F.current="",v(""),I.current=0,D.current=!1,ee.current=!1,H.current=null,P.current=cf("pave.asr.vadSilenceMs",k2,200,5e3),Z.current="",le.current="",V.current=et,et){const vt=(pt,Vt)=>{if(!pt)return Vt;if(!Vt)return pt;const Gt=/^[\u3000-\u303F\u4E00-\u9FFF\uFF00-\uFFEF]/.test(Vt),Ze=/\s$/.test(pt)||Gt?"":" ";return pt+Ze+Vt};try{const pt=new WebSocket(De.streaming.wsUrl);pt.binaryType="arraybuffer",K.current=pt,pt.onmessage=Vt=>{let Gt="";try{Gt=typeof Vt.data=="string"?Vt.data:new TextDecoder().decode(Vt.data)}catch{return}if(Gt==="Done!")return;let Ze="",qt=!1;try{const $t=JSON.parse(Gt);Ze=$t&&typeof $t.text=="string"?$t.text:"",qt=!!($t&&$t.is_final)}catch{Ze=Gt}Ze=(Ze||"").trim();const kt=vt(Z.current,Ze);kt&&kt!==le.current&&(le.current=kt,F.current=kt,v(kt),m("streaming"),Y.current&&Y.current(kt,{mode:"snapshot",engine:De.streaming&&De.streaming.engine||"paraformer"})),qt&&Ze&&(te.current?(Z.current="",le.current="",F.current="",v(""),te.current()):Z.current=vt(Z.current,Ze))},pt.onerror=()=>{console.warn("[useContinuousVoiceInput] streaming WS error — falling back unavailable mid-session")}}catch(pt){console.warn("[useContinuousVoiceInput] streaming connect failed:",pt),V.current=!1}}const Ue=_e.createMediaStreamSource(We),ft=_e.createScriptProcessor(4096,1,1),ht=_e.createGain();ht.gain.value=0,Ue.connect(ft),ft.connect(ht),ht.connect(_e.destination),_.current=Ue,E.current=ft,S.current=ht,N.current=!1,ft.onaudioprocess=vt=>{if(N.current)return;const pt=vt.inputBuffer,Vt=pt.sampleRate,Gt=pt.getChannelData(0);let Ze;if(Vt===Rl?Ze=new Float32Array(Gt):Ze=Pz({sampleRate:Vt,getChannelData:()=>Gt},Rl),Ze.length===0)return;if(V.current&&K.current&&K.current.readyState===WebSocket.OPEN){const tn=new Float32Array(Ze.length);tn.set(Ze),K.current.send(tn.buffer);return}const qt=R.current;qt&&qt.append(Ze);const kt=_2(Ze),$t=performance.now();if(kt>=v2)ee.current=!0,H.current=null;else if(ee.current){if(!H.current)H.current=$t;else if($t-H.current>=P.current){ee.current=!1,H.current=null;const tn=C.current;if(tn&&!tn.inflight&&qt){const on=tn.drain(qt);on&&$e.current(on)}}}ut.current()},nt?(U("loading"),d(0),qe.current().postMessage({type:"load"})):(U("recording"),d(100))}catch(We){ae(),U("idle");const De=We.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(We.message||String(We));q.current&&q.current(De)}}},[fe,ae]),ot=y.useCallback(()=>{const We=B.current;if(We==="loading"){Ie(),xe(),U("idle");return}if(We!=="recording"&&We!=="paused")return;const De=E.current,et=_.current,nt=S.current;if(De){try{De.disconnect()}catch{}De.onaudioprocess=null,E.current=null}if(et){try{et.disconnect()}catch{}_.current=null}if(nt){try{nt.disconnect()}catch{}S.current=null}ae(),U("draining"),setTimeout(()=>{const de=C.current,_e=R.current;if(!de||!_e){Oe.current();return}if(!de.inflight){const Ue=de.drain(_e);Ue?$e.current(Ue):Oe.current()}},0)},[ae,Ie,xe]),At=y.useCallback(()=>{B.current==="recording"&&(N.current=!0,U("paused"),ut.current())},[]),sn=y.useCallback(()=>{B.current==="paused"&&(N.current=!1,U("recording"))},[]),Xt=y.useCallback(()=>{B.current!=="idle"&&(Ie(),xe(),F.current="",v(""),U("idle"))},[Ie,xe]),Ht=y.useCallback(()=>{if(B.current!=="idle"){q.current&&q.current("Cannot clear cache while recording.");return}U("loading"),d(0),xe(),qe.current().postMessage({type:"clearCache"})},[xe]);return y.useEffect(()=>()=>{Ie(),xe()},[Ie,xe]),{state:o,progress:u,downloadingFile:f,transcriptionSource:g,transcriptText:x,startRecording:rt,stopRecording:ot,pauseRecording:At,resumeRecording:sn,cancelRecording:Xt,clearModelCache:Ht}}function zz({skills:e,builtins:t,filter:n,onSelect:r,visible:a,selectedIndex:o,activeSkill:l,onBack:u}){const{t:d}=rn(),f=y.useRef(null),p=y.useRef(null);if(y.useEffect(()=>{f.current&&f.current.scrollIntoView({block:"nearest"})},[o,l,n,e.length]),!a)return null;const g=(n||"").trim().toLowerCase();let m=[],x=!1;if(l){x=!0;const v=e.find(_=>_.skill===l);m=(v&&v.commands||[]).filter(_=>g?(_.name||"").toLowerCase().includes(g)||(_.description||"").toLowerCase().includes(g):!0).map(_=>({type:"command",skill:l,name:_.name,description:_.description}))}else{const v=(t||[]).filter(_=>g?(_.name||"").toLowerCase().includes(g)||(_.description||"").toLowerCase().includes(g):!0).map(_=>({type:"builtin",name:_.name,description:_.description})),k=e.filter(_=>g?(_.skill||"").toLowerCase().includes(g)||(_.description||"").toLowerCase().includes(g)||(_.commands||[]).some(E=>(E.name||"").toLowerCase().includes(g)||(E.description||"").toLowerCase().includes(g)):!0).map(_=>({type:"skill",skill:_.skill,description:_.description,commandCount:(_.commands||[]).length,configured:_.configured}));m=v.concat(k)}return i.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:[i.jsxs("div",{className:"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:[x&&i.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:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),d("slashCommand.skills")]}),i.jsx("span",{className:"flex-1 text-right",children:x?l+" "+d("slashCommand.commands"):d("slashCommand.title")})]}),i.jsx("div",{ref:p,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?i.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,E="slash-item-"+k;return i.jsx("div",{id:E,ref:_?f:null,role:"option","aria-selected":_,onClick:()=>{v.type==="skill"?r(v.skill,null):v.type==="builtin"?r("__builtin__",v.name):r(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"?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:i.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:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"font-medium",children:["/",v.name]}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"built-in"})]}),v.description&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]}):v.type==="skill"?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"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()}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium truncate",children:v.skill}),!v.configured&&i.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:d("slashCommand.notConfigured")})]}),v.description&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]}),i.jsxs("div",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:[v.commandCount," ",v.commandCount===1?d("slashCommand.command"):d("slashCommand.commands")]}),i.jsx("svg",{className:"w-4 h-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:i.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:i.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"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("span",{className:"font-medium",children:["/",l," ",v.name]}),v.description&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]})},v.type+"-"+(v.skill||"_")+"-"+(v.name||""))})}),i.jsxs("div",{className:"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:[i.jsxs("span",{children:[i.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"↑↓"})," ",d("slashCommand.navigate")]}),i.jsxs("span",{children:[i.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Enter"})," ",d("slashCommand.select")]}),i.jsxs("span",{children:[i.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Esc"})," ",d("slashCommand.close")]})]})]})}function qz({quotes:e,onRemove:t,onClearAll:n}){var{t:r}=rn();function a(u){var d=u.sourceRole==="assistant"?r("chat.quoted_from_assistant"):r("chat.quoted_from_you");return u.sourceTime?d+" · "+u.sourceTime:d}function o(u){var d=typeof u.text=="string"?u.text:"";return d.replace(/\s+/g," ").trim()}function l(u){var d=typeof u.text=="string"?u.text:"";return d.slice(0-wv.length)===wv}return!Array.isArray(e)||e.length===0?null:i.jsxs("div",{"data-testid":"quote-composer",className:"mb-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r("chat.quote_selection")}),i.jsx("button",{type:"button",onClick:n,className:"text-[11px] text-gray-500 hover:text-red-500 dark:text-gray-400 dark:hover:text-red-400",children:r("chat.quote_clear_all")})]}),e.map(function(u){return i.jsxs("div",{"data-testid":"quote-chip",className:"flex items-start gap-2 px-3 py-2 border-t border-gray-200 dark:border-gray-700 border-l-2 border-l-accent-400",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block text-[11px] font-medium text-gray-500 dark:text-gray-400 truncate",children:a(u)}),i.jsx("span",{className:"block text-xs text-gray-700 dark:text-gray-200 truncate",title:l(u)?r("chat.quote_truncated"):void 0,children:o(u)})]}),i.jsx("button",{type:"button",onClick:function(){t(u.qid)},"aria-label":r("chat.quote_remove"),className:"shrink-0 w-5 h-5 rounded-full text-gray-400 hover:text-red-500 hover:bg-gray-200 dark:hover:bg-gray-700 flex items-center justify-center",children:i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},u.qid)})]})}const Sf=[{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 Uz(){return Sf.slice()}function Hz(e){if(!e)return null;const t=String(e).toLowerCase();for(let n=0;n<Sf.length;n++)if(Sf[n].name===t)return Sf[n];return null}function $z(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("/"))return null;const n=t.match(/^\/([a-zA-Z0-9_-]+)(?:\s+([\s\S]*))?$/);if(!n)return null;const r=n[1].toLowerCase(),a=Hz(r);if(!a)return null;const o=(n[2]||"").trim();return{name:r,args:o,builtin:a}}const Wz=y.forwardRef(function({onSend:t,onAbort:n,isBusy:r,disabled:a,sessionId:o,queuedCount:l=0,onBuiltinCommand:u,pendingQuotes:d=[],onRemoveQuote:f,onClearQuotes:p},g){const{t:m}=rn(),[x,v]=y.useState(""),[k,_]=y.useState([]),[E,S]=y.useState(!1);y.useEffect(()=>{const se=()=>S(!1);return window.addEventListener("pave:plan-execute",se),()=>window.removeEventListener("pave:plan-execute",se)},[]);const[N,A]=y.useState(null),[T,R]=y.useState([]),[C,O]=y.useState(""),[M,I]=y.useState(!1),D=y.useRef(null),F=y.useRef([]),[ee,H]=y.useState(-1),P="pave-asr-language",K=[{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"}],[V,Z]=y.useState(()=>{try{return localStorage.getItem(P)||"auto"}catch{return"auto"}}),[le,B]=y.useState(!1),U=y.useRef(null),Y=[{code:"whisper",label:"Whisper"},{code:"paraformer",label:"Paraformer"}],[q,te]=y.useState("whisper"),[W,$]=y.useState(!1),fe=y.useRef(null),ae=y.useRef(k),xe=y.useRef(null),Ie=y.useRef(null),ze=y.useRef(null),mt=y.useRef(o),ut=y.useRef(x),$e=y.useRef(null),[qe,Oe]=y.useState(!1),[rt,ot]=y.useState(""),[At,sn]=y.useState([]),[Xt,Ht]=y.useState(0),[We,De]=y.useState(null),et=y.useRef({data:null,time:0}),nt=6e4,de=y.useCallback(se=>{A(se),$e.current&&clearTimeout($e.current),$e.current=setTimeout(()=>A(null),5e3)},[]);y.useEffect(()=>()=>{$e.current&&clearTimeout($e.current)},[]),y.useLayoutEffect(()=>{ut.current=x},[x]),y.useLayoutEffect(()=>{mt.current=o,ze.current&&(clearTimeout(ze.current),ze.current=null);let se="";if(o)try{se=localStorage.getItem($s+o)||""}catch{}return v(se),ut.current=se,_(Pe=>(Pe.forEach(He=>{He.preview&&URL.revokeObjectURL(He.preview)}),[])),()=>{ze.current&&(clearTimeout(ze.current),ze.current=null);const Pe=mt.current;if(Pe)try{ut.current?localStorage.setItem($s+Pe,ut.current):localStorage.removeItem($s+Pe)}catch{}}},[o]),y.useEffect(()=>{mt.current&&(ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>{try{x?localStorage.setItem($s+mt.current,x):localStorage.removeItem($s+mt.current)}catch{}},300))},[x]);const _e=y.useCallback(async()=>{const se=et.current;if(se.data&&Date.now()-se.time<nt){sn(se.data);return}try{const Pe=await $M(),He=Array.isArray(Pe)?Pe:[];et.current={data:He,time:Date.now()},sn(He)}catch{sn([])}},[]),Ue=y.useMemo(()=>Uz(),[]),ge=y.useMemo(()=>{const se=(rt||"").trim().toLowerCase();if(We){const wt=At.find(Ke=>Ke.skill===We);return(wt&&wt.commands||[]).filter(Ke=>se?(Ke.name||"").toLowerCase().includes(se)||(Ke.description||"").toLowerCase().includes(se):!0).map(Ke=>({type:"command",skill:We,name:Ke.name}))}const Pe=Ue.filter(wt=>se?(wt.name||"").toLowerCase().includes(se)||(wt.description||"").toLowerCase().includes(se):!0).map(wt=>({type:"builtin",name:wt.name})),He=At.filter(wt=>se?(wt.skill||"").toLowerCase().includes(se)||(wt.description||"").toLowerCase().includes(se)||(wt.commands||[]).some(Re=>(Re.name||"").toLowerCase().includes(se)||(Re.description||"").toLowerCase().includes(se)):!0).map(wt=>({type:"skill",skill:wt.skill}));return Pe.concat(He)},[rt,We,At,Ue]),ft=y.useCallback(()=>ge.length,[ge]),ht=y.useCallback(se=>{if(v(se),ut.current=se,se.startsWith("/")){const Pe=se.slice(1),He=Pe.split(/\s/)[0]||"";if(!He.includes("/")&&!He.includes(".")){if(We){const wt=We+" ";Pe.startsWith(wt)?(ot(Pe.slice(wt.length)),Ht(0)):(De(null),ot(Pe),Ht(0))}else ot(Pe),Ht(0);qe||(_e(),Oe(!0),Ht(0))}else Oe(!1),ot(""),De(null),Ht(0)}else Oe(!1),ot(""),De(null),Ht(0)},[qe,We,_e]),vt=y.useCallback((se,Pe)=>{var He,wt,Re;if(se==="__builtin__"&&Pe){v("/"+Pe+" "),Oe(!1),ot(""),De(null),Ht(0),(He=xe.current)==null||He.focus();return}if(!Pe)De(se),ot(""),Ht(0),v("/"+se+" "),(wt=xe.current)==null||wt.focus();else{const Ke="/"+se+" "+Pe+" ";v(Ke),Oe(!1),ot(""),De(null),Ht(0),(Re=xe.current)==null||Re.focus()}},[]),pt=y.useCallback(()=>{var se;De(null),ot(""),Ht(0),v("/"),(se=xe.current)==null||se.focus()},[]),Vt=y.useRef(""),Gt=y.useCallback((se,Pe)=>{if(Pe&&Pe.mode==="snapshot"){const He=Vt.current||"",wt=He&&!He.endsWith(" ")&&!He.endsWith(`
|
|
116
|
-
`)?" ":"";v(He+wt+(se||""));return}v(He=>{const wt=He&&!He.endsWith(" ")&&!He.endsWith(`
|
|
117
|
-
`)?" ":"";return He+wt+se})},[]),Ze=y.useRef(null),qt=y.useCallback(()=>{Vt.current="",setTimeout(()=>{Ze.current&&Ze.current()},50)},[]),{state:kt,progress:$t,downloadingFile:tn,startRecording:on,stopRecording:Dn,resumeRecording:ie,cancelRecording:Le}=Bz({onTranscript:Gt,onError:de,onAutoSubmit:qt,model:C||void 0,language:V&&V!=="auto"?V:void 0}),Je=y.useCallback(()=>(v(se=>(Vt.current=se||"",se)),on()),[on]);y.useEffect(()=>{try{V&&localStorage.setItem(P,V)}catch{}},[V]),y.useEffect(()=>{if(!le)return;const se=Pe=>{U.current&&!U.current.contains(Pe.target)&&B(!1)};return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[le]),y.useEffect(()=>{let se=!1;return nv().then(Pe=>{se||(Pe&&Array.isArray(Pe.models)&&Pe.models.length>0&&(R(Pe.models),O(He=>He||Pe.models[0].name)),Pe&&(Pe.preferredEngine==="whisper"||Pe.preferredEngine==="paraformer")&&te(Pe.preferredEngine))}).catch(()=>{}),()=>{se=!0}},[nv]),y.useEffect(()=>{if(!W)return;const se=Pe=>{fe.current&&!fe.current.contains(Pe.target)&&$(!1)};return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[W]);const Ft=y.useCallback(se=>{$(!1),te(Pe=>Pe===se?Pe:(fL(se).then(()=>{se==="paraformer"&&de("Paraformer selected — the streaming engine is starting (first use downloads ~1 GB).")}).catch(()=>{te(Pe),de("Could not switch the speech engine — is the server reachable?")}),se))},[de]);y.useEffect(()=>{if(!M){H(-1);return}F.current.length=T.length;function se(He){D.current&&!D.current.contains(He.target)&&I(!1)}function Pe(He){if(He.key==="Escape"){I(!1);return}He.key!=="ArrowDown"&&He.key!=="ArrowUp"&&He.key!=="Home"&&He.key!=="End"||(He.preventDefault(),H(wt=>{const Re=F.current.length;if(!Re)return wt;const Ke=typeof wt=="number"?wt:-1;let bt=Ke;return He.key==="ArrowDown"?bt=Ke<Re-1?Ke+1:0:He.key==="ArrowUp"?bt=Ke>0?Ke-1:Re-1:He.key==="Home"?bt=0:He.key==="End"&&(bt=Re-1),F.current[bt]&&F.current[bt].focus(),bt}))}return document.addEventListener("mousedown",se),document.addEventListener("keydown",Pe),()=>{document.removeEventListener("mousedown",se),document.removeEventListener("keydown",Pe)}},[M,T.length]),y.useEffect(()=>{const se=xe.current;se&&(se.style.height="auto",se.style.height=Math.min(se.scrollHeight,200)+"px")},[x]),y.useEffect(()=>{ae.current=k},[k]),y.useEffect(()=>{var se;(se=xe.current)==null||se.focus()},[]),y.useImperativeHandle(g,()=>({focus:()=>{var se;(se=xe.current)==null||se.focus()},setText:se=>{v(typeof se=="string"?se:""),requestAnimationFrame(()=>{var Pe;return(Pe=xe.current)==null?void 0:Pe.focus()})}}),[]);const Fe=async()=>{const se=x.trim();var Pe=k.filter(function(Ke){return cg(Ke.type)}),He=k.filter(function(Ke){return!cg(Ke.type)});const wt=$z(se);if(wt&&typeof u=="function"){const Ke=mt.current;try{await u(wt.name,wt.args,{imageAttachments:Pe.length>0?Pe:void 0,fileAttachments:He.length>0?He:void 0})}catch{return}if(v(""),Oe(!1),ot(""),De(null),Ht(0),Ke)try{localStorage.removeItem($s+Ke)}catch{}k.forEach(function(bt){bt.preview&&URL.revokeObjectURL(bt.preview)}),_([]),xe.current&&(xe.current.style.height="auto");return}if(!se&&Pe.length===0&&He.length===0&&d.length===0)return;const Re=mt.current;try{await t(se,Pe.length>0?Pe:void 0,E?"plan":void 0,He.length>0?He:void 0)}catch{return}if(v(""),Oe(!1),ot(""),De(null),Ht(0),Re)try{localStorage.removeItem($s+Re)}catch{}k.forEach(function(Ke){Ke.preview&&URL.revokeObjectURL(Ke.preview)}),_([]),xe.current&&(xe.current.style.height="auto")};Ze.current=Fe;const it=se=>{if(qe){const Pe=ft();if(se.key==="ArrowDown"){Pe>0&&(se.preventDefault(),Ht(He=>(He+1)%Pe));return}if(se.key==="ArrowUp"){Pe>0&&(se.preventDefault(),Ht(He=>(He-1+Pe)%Pe));return}if(se.key==="Enter"||se.key==="Tab"){if(Pe>0){se.preventDefault();const He=ge[Xt];He&&(He.type==="command"?vt(He.skill,He.name):He.type==="builtin"?vt("__builtin__",He.name):vt(He.skill,null));return}if(se.key==="Tab"){Oe(!1),ot(""),De(null),Ht(0);return}}if(se.key==="Escape"){se.preventDefault(),Oe(!1),ot(""),De(null),Ht(0);return}if(se.key==="Backspace"&&We){const He=x.slice(1),wt=We+" ";if(He===wt||He===We){se.preventDefault(),pt();return}}}se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),Fe())},ve=se=>{if(!a){var Pe=se.clipboardData&&se.clipboardData.items;if(Pe){for(var He=[],wt=0;wt<Pe.length;wt++){var Re=(Pe[wt].type||"").toLowerCase();if(Jf.indexOf(Re)!==-1){var Ke=Pe[wt].getAsFile();Ke&&He.push(Ke)}}if(He.length!==0){for(var bt=!1,bn=0;bn<Pe.length;bn++)if(Pe[bn].type&&Pe[bn].type.startsWith("text/")){bt=!0;break}bt||se.preventDefault();var dr=He.map(function(Ot){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Ot,name:Ot.name||"pasted-image.png",size:Ot.size,type:Ot.type,preview:null}});_(function(Ot){var hn=Df-Ot.length;if(hn<=0)return Ot;for(var Br=dr.slice(0,hn),ye=0;ye<Br.length;ye++)Br[ye].preview=URL.createObjectURL(Br[ye].file);return Ot.concat(Br)})}}}},Me=se=>{const Pe=Array.from(se.target.files||[]);if(Pe.length===0)return;const He=Pe.filter(Re=>b5.indexOf(Re.type)!==-1);if(He.length===0){se.target.value="";return}const wt=He.map(Re=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Re,name:Re.name,size:Re.size,type:Re.type,preview:null}));_(Re=>{var Ke=Df-Re.length;if(Ke<=0)return Re;for(var bt=wt.slice(0,Ke),bn=0;bn<bt.length;bn++)bt[bn].preview=cg(bt[bn].file.type)?URL.createObjectURL(bt[bn].file):null;return[...Re,...bt]}),se.target.value=""},Ye=se=>{_(Pe=>{const He=Pe.find(wt=>wt.id===se);return He!=null&&He.preview&&URL.revokeObjectURL(He.preview),Pe.filter(wt=>wt.id!==se)})},yt=se=>se<1024?se+" B":se<1024*1024?(se/1024).toFixed(1)+" KB":(se/(1024*1024)).toFixed(1)+" MB";return y.useEffect(()=>()=>{ae.current.forEach(se=>{se.preview&&URL.revokeObjectURL(se.preview)})},[]),i.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:i.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[E&&i.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:[i.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),i.jsx(qz,{quotes:d,onRemove:f,onClearAll:p}),k.length>0&&i.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:k.map(se=>i.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:[se.preview?i.jsx("img",{src:se.preview,alt:se.name,className:"w-10 h-10 rounded object-cover"}):i.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:se.name}),i.jsx("p",{className:"text-xs text-gray-400",children:yt(se.size)})]}),i.jsx("button",{onClick:()=>Ye(se.id),"aria-label":`Remove attachment ${se.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:i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},se.id))}),i.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:[i.jsx(zz,{skills:At,builtins:Ue,filter:rt,onSelect:vt,visible:qe,selectedIndex:Xt,activeSkill:We,onBack:pt}),i.jsxs("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:[i.jsx("button",{onClick:()=>{var se;return(se=Ie.current)==null?void 0:se.click()},disabled:a||r,className:"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:m("chat.attach_file"),"aria-label":m("chat.attach_file"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})})}),i.jsx("input",{ref:Ie,type:"file",multiple:!0,accept:Sz,onChange:Me,className:"hidden"}),i.jsx("button",{onClick:kt==="recording"?Dn:kt==="paused"?ie:kt==="loading"?Le:Je,disabled:kt==="draining"||(a||r)&&kt!=="recording"&&kt!=="loading"&&kt!=="paused",className:"shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(kt==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":kt==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":kt==="loading"||kt==="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:kt==="recording"?m("voice.stop_recording")||"Stop recording":kt==="paused"?m("voice.resume_recording")||"Resume recording":kt==="loading"?m("voice.loading_model"):kt==="draining"?m("voice.processing")||"Processing remaining audio":m("voice.start_recording"),"aria-label":kt==="recording"?m("voice.stop_recording")||"Stop recording":kt==="paused"?m("voice.resume_recording")||"Resume recording":kt==="loading"?m("voice.loading_model"):kt==="draining"?m("voice.processing")||"Processing remaining audio":m("voice.start_recording"),children:kt==="draining"?i.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):kt==="loading"?i.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):kt==="recording"?i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}):kt==="paused"?i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:i.jsx("circle",{cx:"12",cy:"12",r:"6"})}):i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})})}),kt==="loading"&&i.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-sm whitespace-nowrap flex items-center gap-2",children:[i.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${$t}%`}})}),i.jsx("span",{children:tn?`${tn} ${$t}%`:`${$t}%`})]}),q==="whisper"&&i.jsxs("div",{className:"relative shrink-0",ref:U,children:[i.jsxs("button",{onClick:()=>B(se=>!se),disabled:kt==="recording"||kt==="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":le,children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})}),i.jsx("span",{className:"max-w-[80px] truncate",children:(K.find(se=>se.code===V)||K[0]).label}),i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),le&&i.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:K.map(se=>i.jsx("button",{role:"menuitemradio","aria-checked":se.code===V,onClick:()=>{Z(se.code),B(!1),se.code==="yue"&&de("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 "+(se.code===V?"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:se.label},se.code))})]}),i.jsxs("div",{className:"relative shrink-0",ref:fe,children:[i.jsxs("button",{onClick:()=>$(se=>!se),disabled:kt==="recording"||kt==="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":W,children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})}),i.jsx("span",{className:"max-w-[90px] truncate",children:(Y.find(se=>se.code===q)||Y[0]).label}),i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),W&&i.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:Y.map(se=>i.jsxs("button",{role:"menuitemradio","aria-checked":se.code===q,onClick:()=>Ft(se.code),className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(se.code===q?"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:[i.jsx("div",{children:se.label}),i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:se.code==="whisper"?"Batch · all languages (default)":"Live streaming · 中文/粵語/English"})]},se.code))})]}),q==="whisper"&&T.length>1&&i.jsxs("div",{className:"relative shrink-0",ref:D,children:[i.jsxs("button",{onClick:()=>I(se=>!se),disabled:kt==="recording"||kt==="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:m("voice.select_asr_model"),"aria-label":m("voice.select_asr_model"),"aria-haspopup":"menu","aria-expanded":M,children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})}),i.jsx("span",{className:"max-w-[80px] truncate",children:(T.find(se=>se.name===C)||T[0]).label}),i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),M&&i.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":m("voice.select_asr_model"),children:T.map((se,Pe)=>i.jsxs("button",{ref:He=>{F.current[Pe]=He},role:"menuitemradio","aria-checked":se.name===C,tabIndex:ee===Pe?0:-1,onClick:()=>{O(se.name),I(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(se.name===C?"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:[se.label,se.type!=="openai"&&i.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",se.type,")"]})]},`${se.name}-${Pe}`))})]}),i.jsxs("button",{onClick:()=>S(se=>!se),disabled:a||r,className:"shrink-0 h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium "+(E?"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:E?"Plan mode active (read-only) — click to switch to build":"Switch to plan mode (read-only)","aria-label":E?"Disable plan mode":"Enable plan mode","aria-pressed":E,children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})}),E?"Plan":""]})]}),i.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[i.jsx("textarea",{ref:xe,value:x,onChange:se=>ht(se.target.value),onKeyDown:it,onPaste:ve,placeholder:m("chat.send_placeholder"),disabled:a,rows:1,role:qe?"combobox":void 0,"aria-controls":qe?"slash-command-listbox":void 0,"aria-activedescendant":qe&&ft()>0?"slash-item-"+Xt:void 0,"aria-expanded":qe||void 0,className:"flex-1 bg-transparent resize-none outline-hidden 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]"}),r&&i.jsx("button",{onClick:n,className:"shrink-0 w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-colors",title:m("chat.stop_generating"),"aria-label":m("chat.stop_generating"),children:i.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),i.jsxs("button",{onClick:Fe,disabled:!x.trim()&&k.length===0||a,className:"relative 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:r?"Queue message (will send when current finishes)":m("chat.send_button"),"aria-label":r?"Queue message":m("chat.send_button"),"aria-disabled":!x.trim()&&k.length===0||a?"true":void 0,children:[i.jsx("svg",{className:"w-4 h-4 text-gray-900",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M12 5l7 7-7 7"})}),l>0&&i.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})]})]})]}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:m("chat.send_hint")}),N&&i.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:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.jsx("span",{children:N}),i.jsx("button",{onClick:()=>A(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":m("voice.dismiss_error"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})});function Vz({darkMode:e,onToggleTheme:t}){const{t:n}=rn(),r=(k,_)=>{const E=n(k);return E===k?_:E},[a,o]=y.useState(""),[l,u]=y.useState(""),[d,f]=y.useState(!1),[p,g]=y.useState(null),[m,x]=y.useState({google:!1,password:!1});y.useEffect(()=>{const k=new URLSearchParams(window.location.search).get("auth_error");k&&(g(decodeURIComponent(k)),window.history.replaceState({},"",window.location.pathname))},[]),y.useEffect(()=>{fetch(xr("/auth/status")).then(k=>k.json()).then(k=>x({google:!!(k.providers&&k.providers.google),password:!!(k.providers&&k.providers.password)})).catch(()=>{})},[]);const v=async k=>{k.preventDefault(),g(null),f(!0);try{const _=await fetch(xr("/auth/membership/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a,password:l})}),E=await _.json().catch(()=>({}));if(!_.ok){g(E.error||"Login failed"),f(!1);return}window.location.reload()}catch(_){g("Connection error: "+_.message),f(!1)}};return i.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[i.jsx("div",{className:"flex justify-end p-4",children:i.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:n(e?"theme.light":"theme.dark"),"aria-label":n(e?"theme.light":"theme.dark"),children:e?i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}):i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})})}),i.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:i.jsxs("div",{className:"w-full max-w-sm",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:i.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),i.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:n("login.pave_subtitle")})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-950 rounded-xl border border-gray-200 dark:border-gray-800 p-6 shadow-xs ring-1 ring-accent-400/20",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:n("login.sign_in")}),p&&i.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:p}),m.google&&i.jsxs("button",{type:"button",onClick:()=>{window.location.href=xr("/auth/google/start")},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",children:[i.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24","aria-hidden":"true",children:[i.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.27-4.74 3.27-8.1z"}),i.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.99.66-2.26 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A11 11 0 0 0 12 23z"}),i.jsx("path",{fill:"#FBBC05",d:"M5.84 14.1a6.6 6.6 0 0 1 0-4.2V7.06H2.18a11 11 0 0 0 0 9.88l3.66-2.84z"}),i.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38z"})]}),r("login.sign_in_with_google","Sign in with Google")]}),m.google&&m.password&&i.jsxs("div",{className:"flex items-center gap-3 my-4",children:[i.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("login.or","or")}),i.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),m.password&&i.jsxs("form",{onSubmit:v,className:"space-y-3 mb-4",children:[i.jsx("input",{type:"email",placeholder:r("login.email_placeholder","Email"),value:a,onChange:k=>o(k.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-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),i.jsx("input",{type:"password",placeholder:r("login.password_placeholder","Password"),value:l,onChange:k=>u(k.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-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),i.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?r("login.signing_in","Signing in..."):n("login.sign_in")})]}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:n("login.terms")})]})]})})]})}function Gz({user:e,onLogout:t,onSkillManagement:n,onPricingSettings:r,onDlpSettings:a,onSettings:o,onBoard:l,onCapabilities:u}){const{t:d}=rn(),[f,p]=y.useState(!1),g=y.useRef(null);if(y.useEffect(()=>{if(!f)return;function x(v){g.current&&!g.current.contains(v.target)&&p(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[f]),!e)return null;const m=(e.name||e.email||"?").split(" ").map(x=>x[0]).join("").slice(0,2).toUpperCase();return i.jsxs("div",{className:"relative",ref:g,children:[i.jsxs("button",{onClick:()=>p(!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?i.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):i.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs font-semibold",children:m})}),i.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),i.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&i.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:[i.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),n&&i.jsxs("button",{type:"button",onClick:()=>{p(!1),n()},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:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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")]}),r&&i.jsxs("button",{onClick:()=>{p(!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:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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")]}),a&&i.jsxs("button",{onClick:()=>{p(!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:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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")]}),l&&i.jsxs("button",{type:"button",onClick:()=>{p(!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:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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")]}),u&&i.jsxs("button",{type:"button",onClick:()=>{p(!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:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),d("user_menu.capabilities")]}),o&&i.jsxs("button",{onClick:()=>{p(!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:[i.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.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"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),d("user_menu.settings")]}),t&&i.jsx("button",{onClick:()=>{p(!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 Kz({toolParts:e}){const{t}=rn();return!e||e.length===0?i.jsxs("div",{className:"p-4",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):i.jsxs("div",{className:"p-4",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),i.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(n=>i.jsx(Yz,{part:n},n.id))})]})}function Yz({part:e}){var a,o;const t=((a=e.state)==null?void 0:a.status)||"running",n=((o=e.state)==null?void 0:o.input)||{},r=Qz(e.tool,n);return i.jsxs("div",{className:"flex items-center gap-2 py-1",children:[i.jsxs("div",{className:"shrink-0",children:[t==="running"&&i.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&i.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&i.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&i.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:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),i.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:r})]})}function Qz(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+uf(t.filePath);case"Write":return"Writing "+uf(t.filePath);case"Edit":return"Editing "+uf(t.filePath);case"Bash":{const n=t.command||"";return w2(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+Nv(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+Nv(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return Xz(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+uf(t.filePath):t.command?w2(t.command):"Running "+e.toLowerCase()}}function uf(e){if(!e)return"file";const t=e.split("/"),n=t[t.length-1]||"file";return t.length<=2?n:t[t.length-2]+"/"+n}function w2(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 n=t.split(/\s+/)[0];return"Running "+Nv(n,20)}function Xz(e,t){const n=(e||"").toLowerCase();return n.includes("gmail")||n.includes("email")?"Checking email":n.includes("gdrive")||n.includes("drive")?"Accessing Google Drive":n.includes("gcal")||n.includes("calendar")?"Checking calendar":n.includes("gtasks")||n.includes("tasks")?"Managing tasks":n.includes("discord")?"Using Discord":n.includes("whatsapp")?"Using WhatsApp":n.includes("wrike")?"Checking Wrike":n.includes("dropbox")?"Accessing Dropbox":n.includes("pandadoc")?"Working with PandaDoc":n.includes("freshbooks")?"Checking FreshBooks":n.includes("mailchimp")?"Using Mailchimp":n.includes("bamboohr")?"Checking BambooHR":e?"Using "+e:"Running skill"}function Nv(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const Cv=10,jv=24,E2=2,Zz=14,v5="pave-terminal-font-size";function Jz(){try{const e=localStorage.getItem(v5);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=Cv&&t<=jv)return t}}catch{}return Zz}function eq({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:a}=rn();const o=y.useRef(null),l=y.useRef(null),u=y.useRef(null),[d,f]=y.useState(Jz),p=y.useCallback(()=>{f(k=>Math.max(Cv,k-E2))},[]),g=y.useCallback(()=>{f(k=>Math.min(jv,k+E2))},[]);y.useEffect(()=>{try{localStorage.setItem(v5,String(d))}catch{}},[d]);const m=r?{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"},x=`px-1.5 py-0.5 text-xs font-mono rounded ${r?"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`;y.useEffect(()=>{o.current&&!t&&(o.current.scrollTop=o.current.scrollHeight)},[e,t]);const v=y.useCallback(()=>{const k=l.current;if(!k)return;const _=k.getContext("2d");if(!_)return;const E=()=>{const O=k.parentElement;if(O&&O.clientWidth>0&&O.clientHeight>0){k.width=O.clientWidth,k.height=O.clientHeight;return}const M=k.getBoundingClientRect();if(M.width>0&&M.height>0){k.width=M.width,k.height=M.height;return}k.width=0,k.height=0};E();const S=d;let N=Math.floor(k.width/S),A=new Array(N).fill(1);const T="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",R=()=>{_.fillStyle="rgba(0, 0, 0, 0.05)",_.fillRect(0,0,k.width,k.height),_.fillStyle="#0F0",_.font=S+"px monospace";for(let O=0;O<A.length;O++){const M=T.charAt(Math.floor(Math.random()*T.length));_.fillText(M,O*S,A[O]*S),A[O]*S>k.height&&Math.random()>.975&&(A[O]=0),A[O]++}u.current=requestAnimationFrame(R)},C=()=>{E(),N=Math.floor(k.width/S);const O=new Array(N).fill(0);for(let M=0;M<Math.min(A.length,O.length);M++)O[M]=A[M];A=O};return window.addEventListener("resize",C),u.current=requestAnimationFrame(R),()=>{window.removeEventListener("resize",C),u.current&&cancelAnimationFrame(u.current)}},[d]);return y.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"}),i.jsxs("div",{className:`flex flex-col h-full ${m.bg} font-mono`,style:{fontSize:d+"px"},children:[i.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${m.headerBg} border-b ${m.headerBorder} shrink-0`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:n,title:""}),i.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),i.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),i.jsx("span",{className:`${m.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:p,disabled:d<=Cv,className:x,"aria-label":a("terminal.decrease_font"),title:a("terminal.decrease_font"),children:"A-"}),i.jsx("button",{type:"button",onClick:g,disabled:d>=jv,className:x,"aria-label":a("terminal.increase_font"),title:a("terminal.increase_font"),children:"A+"})]})]}),i.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?i.jsxs(i.Fragment,{children:[i.jsx("canvas",{ref:l,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&i.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=>i.jsx(nq,{part:k},k.id))})]}):i.jsx("div",{ref:o,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?i.jsxs("div",{children:[i.jsxs("div",{className:m.promptColor,children:["$ ",i.jsx("span",{className:"terminal-cursor",children:"█"})]}),i.jsx("p",{className:`${m.waitingText} mt-2`,children:"Awaiting commands..."})]}):i.jsxs(i.Fragment,{children:[e.map(k=>i.jsx(tq,{part:k,theme:m},k.id)),i.jsxs("div",{className:m.promptColor,children:["$ ",i.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function tq({part:e,theme:t}){var{t:n}=rn();const{tool:r,state:a}=e;if(!a)return null;const o=a.status||"running",u=Zf(r||a.title,a.input)||r||a.title||"unknown",d=a.output?qo(typeof a.output=="string"?a.output:JSON.stringify(a.output,null,2)):null;return i.jsxs("div",{className:"mb-2",children:[i.jsxs("div",{className:`${t.commandColor} break-all`,children:[i.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),u]}),o==="running"&&i.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),o==="completed"&&d&&i.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:d}),o==="completed"&&!d&&i.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),o==="error"&&i.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",a.error?qo(typeof a.error=="string"?a.error:a.error.message||n("common.error")):n("common.unknown_error")]}),o==="pending_confirmation"&&i.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function nq({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",o=Zf(t||n.title,n.input)||t||n.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 i.jsxs("div",{className:"text-xs font-mono truncate",children:[i.jsxs("span",{className:l[r]||"text-gray-400",children:["[",u[r]||r,"]"]}),i.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",o]})]})}function _k(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 hg,S2;function rq(){if(S2)return hg;S2=1;function e(){this.__data__=[],this.size=0}return hg=e,hg}var gg,N2;function Yl(){if(N2)return gg;N2=1;function e(t,n){return t===n||t!==t&&n!==n}return gg=e,gg}var mg,C2;function ep(){if(C2)return mg;C2=1;var e=Yl();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return mg=t,mg}var xg,j2;function iq(){if(j2)return xg;j2=1;var e=ep(),t=Array.prototype,n=t.splice;function r(a){var o=this.__data__,l=e(o,a);if(l<0)return!1;var u=o.length-1;return l==u?o.pop():n.call(o,l,1),--this.size,!0}return xg=r,xg}var yg,T2;function aq(){if(T2)return yg;T2=1;var e=ep();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return yg=t,yg}var bg,R2;function sq(){if(R2)return bg;R2=1;var e=ep();function t(n){return e(this.__data__,n)>-1}return bg=t,bg}var vg,A2;function oq(){if(A2)return vg;A2=1;var e=ep();function t(n,r){var a=this.__data__,o=e(a,n);return o<0?(++this.size,a.push([n,r])):a[o][1]=r,this}return vg=t,vg}var kg,I2;function tp(){if(I2)return kg;I2=1;var e=rq(),t=iq(),n=aq(),r=sq(),a=oq();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=n,o.prototype.has=r,o.prototype.set=a,kg=o,kg}var _g,M2;function lq(){if(M2)return _g;M2=1;var e=tp();function t(){this.__data__=new e,this.size=0}return _g=t,_g}var wg,L2;function cq(){if(L2)return wg;L2=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return wg=e,wg}var Eg,O2;function uq(){if(O2)return Eg;O2=1;function e(t){return this.__data__.get(t)}return Eg=e,Eg}var Sg,D2;function dq(){if(D2)return Sg;D2=1;function e(t){return this.__data__.has(t)}return Sg=e,Sg}var Ng,P2;function k5(){if(P2)return Ng;P2=1;var e=typeof Vd=="object"&&Vd&&Vd.Object===Object&&Vd;return Ng=e,Ng}var Cg,F2;function Ca(){if(F2)return Cg;F2=1;var e=k5(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Cg=n,Cg}var jg,B2;function Ql(){if(B2)return jg;B2=1;var e=Ca(),t=e.Symbol;return jg=t,jg}var Tg,z2;function fq(){if(z2)return Tg;z2=1;var e=Ql(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function o(l){var u=n.call(l,a),d=l[a];try{l[a]=void 0;var f=!0}catch{}var p=r.call(l);return f&&(u?l[a]=d:delete l[a]),p}return Tg=o,Tg}var Rg,q2;function pq(){if(q2)return Rg;q2=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Rg=n,Rg}var Ag,U2;function Yo(){if(U2)return Ag;U2=1;var e=Ql(),t=fq(),n=pq(),r="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?a:r:o&&o in Object(u)?t(u):n(u)}return Ag=l,Ag}var Ig,H2;function aa(){if(H2)return Ig;H2=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Ig=e,Ig}var Mg,$2;function Bu(){if($2)return Mg;$2=1;var e=Yo(),t=aa(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==a||d==n||d==o}return Mg=l,Mg}var Lg,W2;function hq(){if(W2)return Lg;W2=1;var e=Ca(),t=e["__core-js_shared__"];return Lg=t,Lg}var Og,V2;function gq(){if(V2)return Og;V2=1;var e=hq(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Og=n,Og}var Dg,G2;function _5(){if(G2)return Dg;G2=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Dg=n,Dg}var Pg,K2;function mq(){if(K2)return Pg;K2=1;var e=Bu(),t=gq(),n=aa(),r=_5(),a=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,p=RegExp("^"+d.call(f).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(m){if(!n(m)||t(m))return!1;var x=e(m)?p:o;return x.test(r(m))}return Pg=g,Pg}var Fg,Y2;function xq(){if(Y2)return Fg;Y2=1;function e(t,n){return t==null?void 0:t[n]}return Fg=e,Fg}var Bg,Q2;function Qo(){if(Q2)return Bg;Q2=1;var e=mq(),t=xq();function n(r,a){var o=t(r,a);return e(o)?o:void 0}return Bg=n,Bg}var zg,X2;function wk(){if(X2)return zg;X2=1;var e=Qo(),t=Ca(),n=e(t,"Map");return zg=n,zg}var qg,Z2;function np(){if(Z2)return qg;Z2=1;var e=Qo(),t=e(Object,"create");return qg=t,qg}var Ug,J2;function yq(){if(J2)return Ug;J2=1;var e=np();function t(){this.__data__=e?e(null):{},this.size=0}return Ug=t,Ug}var Hg,eE;function bq(){if(eE)return Hg;eE=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Hg=e,Hg}var $g,tE;function vq(){if(tE)return $g;tE=1;var e=np(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(o){var l=this.__data__;if(e){var u=l[o];return u===t?void 0:u}return r.call(l,o)?l[o]:void 0}return $g=a,$g}var Wg,nE;function kq(){if(nE)return Wg;nE=1;var e=np(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var o=this.__data__;return e?o[a]!==void 0:n.call(o,a)}return Wg=r,Wg}var Vg,rE;function _q(){if(rE)return Vg;rE=1;var e=np(),t="__lodash_hash_undefined__";function n(r,a){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&a===void 0?t:a,this}return Vg=n,Vg}var Gg,iE;function wq(){if(iE)return Gg;iE=1;var e=yq(),t=bq(),n=vq(),r=kq(),a=_q();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=n,o.prototype.has=r,o.prototype.set=a,Gg=o,Gg}var Kg,aE;function Eq(){if(aE)return Kg;aE=1;var e=wq(),t=tp(),n=wk();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Kg=r,Kg}var Yg,sE;function Sq(){if(sE)return Yg;sE=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Yg=e,Yg}var Qg,oE;function rp(){if(oE)return Qg;oE=1;var e=Sq();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return Qg=t,Qg}var Xg,lE;function Nq(){if(lE)return Xg;lE=1;var e=rp();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Xg=t,Xg}var Zg,cE;function Cq(){if(cE)return Zg;cE=1;var e=rp();function t(n){return e(this,n).get(n)}return Zg=t,Zg}var Jg,uE;function jq(){if(uE)return Jg;uE=1;var e=rp();function t(n){return e(this,n).has(n)}return Jg=t,Jg}var em,dE;function Tq(){if(dE)return em;dE=1;var e=rp();function t(n,r){var a=e(this,n),o=a.size;return a.set(n,r),this.size+=a.size==o?0:1,this}return em=t,em}var tm,fE;function Ek(){if(fE)return tm;fE=1;var e=Eq(),t=Nq(),n=Cq(),r=jq(),a=Tq();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=n,o.prototype.has=r,o.prototype.set=a,tm=o,tm}var nm,pE;function Rq(){if(pE)return nm;pE=1;var e=tp(),t=wk(),n=Ek(),r=200;function a(o,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<r-1)return d.push([o,l]),this.size=++u.size,this;u=this.__data__=new n(d)}return u.set(o,l),this.size=u.size,this}return nm=a,nm}var rm,hE;function ip(){if(hE)return rm;hE=1;var e=tp(),t=lq(),n=cq(),r=uq(),a=dq(),o=Rq();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,rm=l,rm}var im,gE;function Sk(){if(gE)return im;gE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return im=e,im}var am,mE;function w5(){if(mE)return am;mE=1;var e=Qo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return am=t,am}var sm,xE;function ap(){if(xE)return sm;xE=1;var e=w5();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return sm=t,sm}var om,yE;function sp(){if(yE)return om;yE=1;var e=ap(),t=Yl(),n=Object.prototype,r=n.hasOwnProperty;function a(o,l,u){var d=o[l];(!(r.call(o,l)&&t(d,u))||u===void 0&&!(l in o))&&e(o,l,u)}return om=a,om}var lm,bE;function zu(){if(bE)return lm;bE=1;var e=sp(),t=ap();function n(r,a,o,l){var u=!o;o||(o={});for(var d=-1,f=a.length;++d<f;){var p=a[d],g=l?l(o[p],r[p],p,o,r):void 0;g===void 0&&(g=r[p]),u?t(o,p,g):e(o,p,g)}return o}return lm=n,lm}var cm,vE;function Aq(){if(vE)return cm;vE=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return cm=e,cm}var um,kE;function Ya(){if(kE)return um;kE=1;function e(t){return t!=null&&typeof t=="object"}return um=e,um}var dm,_E;function Iq(){if(_E)return dm;_E=1;var e=Yo(),t=Ya(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return dm=r,dm}var fm,wE;function qu(){if(wE)return fm;wE=1;var e=Iq(),t=Ya(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!a.call(l,"callee")};return fm=o,fm}var pm,EE;function Cr(){if(EE)return pm;EE=1;var e=Array.isArray;return pm=e,pm}var cu={exports:{}},hm,SE;function Mq(){if(SE)return hm;SE=1;function e(){return!1}return hm=e,hm}cu.exports;var NE;function Xl(){return NE||(NE=1,(function(e,t){var n=Ca(),r=Mq(),a=t&&!t.nodeType&&t,o=a&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===a,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||r;e.exports=f})(cu,cu.exports)),cu.exports}var gm,CE;function op(){if(CE)return gm;CE=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var o=typeof r;return a=a??e,!!a&&(o=="number"||o!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return gm=n,gm}var mm,jE;function Nk(){if(jE)return mm;jE=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return mm=t,mm}var xm,TE;function Lq(){if(TE)return xm;TE=1;var e=Yo(),t=Nk(),n=Ya(),r="[object Arguments]",a="[object Array]",o="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",p="[object Number]",g="[object Object]",m="[object RegExp]",x="[object Set]",v="[object String]",k="[object WeakMap]",_="[object ArrayBuffer]",E="[object DataView]",S="[object Float32Array]",N="[object Float64Array]",A="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",C="[object Uint8Array]",O="[object Uint8ClampedArray]",M="[object Uint16Array]",I="[object Uint32Array]",D={};D[S]=D[N]=D[A]=D[T]=D[R]=D[C]=D[O]=D[M]=D[I]=!0,D[r]=D[a]=D[_]=D[o]=D[E]=D[l]=D[u]=D[d]=D[f]=D[p]=D[g]=D[m]=D[x]=D[v]=D[k]=!1;function F(ee){return n(ee)&&t(ee.length)&&!!D[e(ee)]}return xm=F,xm}var ym,RE;function lp(){if(RE)return ym;RE=1;function e(t){return function(n){return t(n)}}return ym=e,ym}var uu={exports:{}};uu.exports;var AE;function Ck(){return AE||(AE=1,(function(e,t){var n=k5(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===r,l=o&&n.process,u=(function(){try{var d=a&&a.require&&a.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(uu,uu.exports)),uu.exports}var bm,IE;function Uu(){if(IE)return bm;IE=1;var e=Lq(),t=lp(),n=Ck(),r=n&&n.isTypedArray,a=r?t(r):e;return bm=a,bm}var vm,ME;function E5(){if(ME)return vm;ME=1;var e=Aq(),t=qu(),n=Cr(),r=Xl(),a=op(),o=Uu(),l=Object.prototype,u=l.hasOwnProperty;function d(f,p){var g=n(f),m=!g&&t(f),x=!g&&!m&&r(f),v=!g&&!m&&!x&&o(f),k=g||m||x||v,_=k?e(f.length,String):[],E=_.length;for(var S in f)(p||u.call(f,S))&&!(k&&(S=="length"||x&&(S=="offset"||S=="parent")||v&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,E)))&&_.push(S);return _}return vm=d,vm}var km,LE;function cp(){if(LE)return km;LE=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return km=t,km}var _m,OE;function S5(){if(OE)return _m;OE=1;function e(t,n){return function(r){return t(n(r))}}return _m=e,_m}var wm,DE;function Oq(){if(DE)return wm;DE=1;var e=S5(),t=e(Object.keys,Object);return wm=t,wm}var Em,PE;function jk(){if(PE)return Em;PE=1;var e=cp(),t=Oq(),n=Object.prototype,r=n.hasOwnProperty;function a(o){if(!e(o))return t(o);var l=[];for(var u in Object(o))r.call(o,u)&&u!="constructor"&&l.push(u);return l}return Em=a,Em}var Sm,FE;function fs(){if(FE)return Sm;FE=1;var e=Bu(),t=Nk();function n(r){return r!=null&&t(r.length)&&!e(r)}return Sm=n,Sm}var Nm,BE;function Xs(){if(BE)return Nm;BE=1;var e=E5(),t=jk(),n=fs();function r(a){return n(a)?e(a):t(a)}return Nm=r,Nm}var Cm,zE;function Dq(){if(zE)return Cm;zE=1;var e=zu(),t=Xs();function n(r,a){return r&&e(a,t(a),r)}return Cm=n,Cm}var jm,qE;function Pq(){if(qE)return jm;qE=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return jm=e,jm}var Tm,UE;function Fq(){if(UE)return Tm;UE=1;var e=aa(),t=cp(),n=Pq(),r=Object.prototype,a=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!a.call(l,f))||d.push(f);return d}return Tm=o,Tm}var Rm,HE;function Xo(){if(HE)return Rm;HE=1;var e=E5(),t=Fq(),n=fs();function r(a){return n(a)?e(a,!0):t(a)}return Rm=r,Rm}var Am,$E;function Bq(){if($E)return Am;$E=1;var e=zu(),t=Xo();function n(r,a){return r&&e(a,t(a),r)}return Am=n,Am}var du={exports:{}};du.exports;var WE;function N5(){return WE||(WE=1,(function(e,t){var n=Ca(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===r,l=o?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,p){if(p)return f.slice();var g=f.length,m=u?u(g):new f.constructor(g);return f.copy(m),m}e.exports=d})(du,du.exports)),du.exports}var Im,VE;function C5(){if(VE)return Im;VE=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return Im=e,Im}var Mm,GE;function j5(){if(GE)return Mm;GE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,o=0,l=[];++r<a;){var u=t[r];n(u,r,t)&&(l[o++]=u)}return l}return Mm=e,Mm}var Lm,KE;function T5(){if(KE)return Lm;KE=1;function e(){return[]}return Lm=e,Lm}var Om,YE;function Tk(){if(YE)return Om;YE=1;var e=j5(),t=T5(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(l){return l==null?[]:(l=Object(l),e(a(l),function(u){return r.call(l,u)}))}:t;return Om=o,Om}var Dm,QE;function zq(){if(QE)return Dm;QE=1;var e=zu(),t=Tk();function n(r,a){return e(r,t(r),a)}return Dm=n,Dm}var Pm,XE;function Rk(){if(XE)return Pm;XE=1;function e(t,n){for(var r=-1,a=n.length,o=t.length;++r<a;)t[o+r]=n[r];return t}return Pm=e,Pm}var Fm,ZE;function up(){if(ZE)return Fm;ZE=1;var e=S5(),t=e(Object.getPrototypeOf,Object);return Fm=t,Fm}var Bm,JE;function R5(){if(JE)return Bm;JE=1;var e=Rk(),t=up(),n=Tk(),r=T5(),a=Object.getOwnPropertySymbols,o=a?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:r;return Bm=o,Bm}var zm,eS;function qq(){if(eS)return zm;eS=1;var e=zu(),t=R5();function n(r,a){return e(r,t(r),a)}return zm=n,zm}var qm,tS;function A5(){if(tS)return qm;tS=1;var e=Rk(),t=Cr();function n(r,a,o){var l=a(r);return t(r)?l:e(l,o(r))}return qm=n,qm}var Um,nS;function I5(){if(nS)return Um;nS=1;var e=A5(),t=Tk(),n=Xs();function r(a){return e(a,n,t)}return Um=r,Um}var Hm,rS;function Uq(){if(rS)return Hm;rS=1;var e=A5(),t=R5(),n=Xo();function r(a){return e(a,n,t)}return Hm=r,Hm}var $m,iS;function Hq(){if(iS)return $m;iS=1;var e=Qo(),t=Ca(),n=e(t,"DataView");return $m=n,$m}var Wm,aS;function $q(){if(aS)return Wm;aS=1;var e=Qo(),t=Ca(),n=e(t,"Promise");return Wm=n,Wm}var Vm,sS;function M5(){if(sS)return Vm;sS=1;var e=Qo(),t=Ca(),n=e(t,"Set");return Vm=n,Vm}var Gm,oS;function Wq(){if(oS)return Gm;oS=1;var e=Qo(),t=Ca(),n=e(t,"WeakMap");return Gm=n,Gm}var Km,lS;function Zl(){if(lS)return Km;lS=1;var e=Hq(),t=wk(),n=$q(),r=M5(),a=Wq(),o=Yo(),l=_5(),u="[object Map]",d="[object Object]",f="[object Promise]",p="[object Set]",g="[object WeakMap]",m="[object DataView]",x=l(e),v=l(t),k=l(n),_=l(r),E=l(a),S=o;return(e&&S(new e(new ArrayBuffer(1)))!=m||t&&S(new t)!=u||n&&S(n.resolve())!=f||r&&S(new r)!=p||a&&S(new a)!=g)&&(S=function(N){var A=o(N),T=A==d?N.constructor:void 0,R=T?l(T):"";if(R)switch(R){case x:return m;case v:return u;case k:return f;case _:return p;case E:return g}return A}),Km=S,Km}var Ym,cS;function Vq(){if(cS)return Ym;cS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,o=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(o.index=r.index,o.input=r.input),o}return Ym=n,Ym}var Qm,uS;function L5(){if(uS)return Qm;uS=1;var e=Ca(),t=e.Uint8Array;return Qm=t,Qm}var Xm,dS;function Ak(){if(dS)return Xm;dS=1;var e=L5();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return Xm=t,Xm}var Zm,fS;function Gq(){if(fS)return Zm;fS=1;var e=Ak();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Zm=t,Zm}var Jm,pS;function Kq(){if(pS)return Jm;pS=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return Jm=t,Jm}var e0,hS;function Yq(){if(hS)return e0;hS=1;var e=Ql(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return e0=r,e0}var t0,gS;function O5(){if(gS)return t0;gS=1;var e=Ak();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return t0=t,t0}var n0,mS;function Qq(){if(mS)return n0;mS=1;var e=Ak(),t=Gq(),n=Kq(),r=Yq(),a=O5(),o="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",p="[object Set]",g="[object String]",m="[object Symbol]",x="[object ArrayBuffer]",v="[object DataView]",k="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",C="[object Uint32Array]";function O(M,I,D){var F=M.constructor;switch(I){case x:return e(M);case o:case l:return new F(+M);case v:return t(M,D);case k:case _:case E:case S:case N:case A:case T:case R:case C:return a(M,D);case u:return new F;case d:case g:return new F(M);case f:return n(M);case p:return new F;case m:return r(M)}}return n0=O,n0}var r0,xS;function D5(){if(xS)return r0;xS=1;var e=aa(),t=Object.create,n=(function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var o=new r;return r.prototype=void 0,o}})();return r0=n,r0}var i0,yS;function P5(){if(yS)return i0;yS=1;var e=D5(),t=up(),n=cp();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return i0=r,i0}var a0,bS;function Xq(){if(bS)return a0;bS=1;var e=Zl(),t=Ya(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return a0=r,a0}var s0,vS;function Zq(){if(vS)return s0;vS=1;var e=Xq(),t=lp(),n=Ck(),r=n&&n.isMap,a=r?t(r):e;return s0=a,s0}var o0,kS;function Jq(){if(kS)return o0;kS=1;var e=Zl(),t=Ya(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return o0=r,o0}var l0,_S;function eU(){if(_S)return l0;_S=1;var e=Jq(),t=lp(),n=Ck(),r=n&&n.isSet,a=r?t(r):e;return l0=a,l0}var c0,wS;function F5(){if(wS)return c0;wS=1;var e=ip(),t=Sk(),n=sp(),r=Dq(),a=Bq(),o=N5(),l=C5(),u=zq(),d=qq(),f=I5(),p=Uq(),g=Zl(),m=Vq(),x=Qq(),v=P5(),k=Cr(),_=Xl(),E=Zq(),S=aa(),N=eU(),A=Xs(),T=Xo(),R=1,C=2,O=4,M="[object Arguments]",I="[object Array]",D="[object Boolean]",F="[object Date]",ee="[object Error]",H="[object Function]",P="[object GeneratorFunction]",K="[object Map]",V="[object Number]",Z="[object Object]",le="[object RegExp]",B="[object Set]",U="[object String]",Y="[object Symbol]",q="[object WeakMap]",te="[object ArrayBuffer]",W="[object DataView]",$="[object Float32Array]",fe="[object Float64Array]",ae="[object Int8Array]",xe="[object Int16Array]",Ie="[object Int32Array]",ze="[object Uint8Array]",mt="[object Uint8ClampedArray]",ut="[object Uint16Array]",$e="[object Uint32Array]",qe={};qe[M]=qe[I]=qe[te]=qe[W]=qe[D]=qe[F]=qe[$]=qe[fe]=qe[ae]=qe[xe]=qe[Ie]=qe[K]=qe[V]=qe[Z]=qe[le]=qe[B]=qe[U]=qe[Y]=qe[ze]=qe[mt]=qe[ut]=qe[$e]=!0,qe[ee]=qe[H]=qe[q]=!1;function Oe(rt,ot,At,sn,Xt,Ht){var We,De=ot&R,et=ot&C,nt=ot&O;if(At&&(We=Xt?At(rt,sn,Xt,Ht):At(rt)),We!==void 0)return We;if(!S(rt))return rt;var de=k(rt);if(de){if(We=m(rt),!De)return l(rt,We)}else{var _e=g(rt),Ue=_e==H||_e==P;if(_(rt))return o(rt,De);if(_e==Z||_e==M||Ue&&!Xt){if(We=et||Ue?{}:v(rt),!De)return et?d(rt,a(We,rt)):u(rt,r(We,rt))}else{if(!qe[_e])return Xt?rt:{};We=x(rt,_e,De)}}Ht||(Ht=new e);var ge=Ht.get(rt);if(ge)return ge;Ht.set(rt,We),N(rt)?rt.forEach(function(vt){We.add(Oe(vt,ot,At,vt,rt,Ht))}):E(rt)&&rt.forEach(function(vt,pt){We.set(pt,Oe(vt,ot,At,pt,rt,Ht))});var ft=nt?et?p:f:et?T:A,ht=de?void 0:ft(rt);return t(ht||rt,function(vt,pt){ht&&(pt=vt,vt=rt[pt]),n(We,pt,Oe(vt,ot,At,pt,rt,Ht))}),We}return c0=Oe,c0}var u0,ES;function tU(){if(ES)return u0;ES=1;var e=F5(),t=4;function n(r){return e(r,t)}return u0=n,u0}var d0,SS;function Ik(){if(SS)return d0;SS=1;function e(t){return function(){return t}}return d0=e,d0}var f0,NS;function nU(){if(NS)return f0;NS=1;function e(t){return function(n,r,a){for(var o=-1,l=Object(n),u=a(n),d=u.length;d--;){var f=u[t?d:++o];if(r(l[f],f,l)===!1)break}return n}}return f0=e,f0}var p0,CS;function Mk(){if(CS)return p0;CS=1;var e=nU(),t=e();return p0=t,p0}var h0,jS;function Lk(){if(jS)return h0;jS=1;var e=Mk(),t=Xs();function n(r,a){return r&&e(r,a,t)}return h0=n,h0}var g0,TS;function rU(){if(TS)return g0;TS=1;var e=fs();function t(n,r){return function(a,o){if(a==null)return a;if(!e(a))return n(a,o);for(var l=a.length,u=r?l:-1,d=Object(a);(r?u--:++u<l)&&o(d[u],u,d)!==!1;);return a}}return g0=t,g0}var m0,RS;function dp(){if(RS)return m0;RS=1;var e=Lk(),t=rU(),n=t(e);return m0=n,m0}var x0,AS;function Zo(){if(AS)return x0;AS=1;function e(t){return t}return x0=e,x0}var y0,IS;function B5(){if(IS)return y0;IS=1;var e=Zo();function t(n){return typeof n=="function"?n:e}return y0=t,y0}var b0,MS;function z5(){if(MS)return b0;MS=1;var e=Sk(),t=dp(),n=B5(),r=Cr();function a(o,l){var u=r(o)?e:t;return u(o,n(l))}return b0=a,b0}var v0,LS;function q5(){return LS||(LS=1,v0=z5()),v0}var k0,OS;function iU(){if(OS)return k0;OS=1;var e=dp();function t(n,r){var a=[];return e(n,function(o,l,u){r(o,l,u)&&a.push(o)}),a}return k0=t,k0}var _0,DS;function aU(){if(DS)return _0;DS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return _0=t,_0}var w0,PS;function sU(){if(PS)return w0;PS=1;function e(t){return this.__data__.has(t)}return w0=e,w0}var E0,FS;function U5(){if(FS)return E0;FS=1;var e=Ek(),t=aU(),n=sU();function r(a){var o=-1,l=a==null?0:a.length;for(this.__data__=new e;++o<l;)this.add(a[o])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,E0=r,E0}var S0,BS;function oU(){if(BS)return S0;BS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return S0=e,S0}var N0,zS;function H5(){if(zS)return N0;zS=1;function e(t,n){return t.has(n)}return N0=e,N0}var C0,qS;function $5(){if(qS)return C0;qS=1;var e=U5(),t=oU(),n=H5(),r=1,a=2;function o(l,u,d,f,p,g){var m=d&r,x=l.length,v=u.length;if(x!=v&&!(m&&v>x))return!1;var k=g.get(l),_=g.get(u);if(k&&_)return k==u&&_==l;var E=-1,S=!0,N=d&a?new e:void 0;for(g.set(l,u),g.set(u,l);++E<x;){var A=l[E],T=u[E];if(f)var R=m?f(T,A,E,u,l,g):f(A,T,E,l,u,g);if(R!==void 0){if(R)continue;S=!1;break}if(N){if(!t(u,function(C,O){if(!n(N,O)&&(A===C||p(A,C,d,f,g)))return N.push(O)})){S=!1;break}}else if(!(A===T||p(A,T,d,f,g))){S=!1;break}}return g.delete(l),g.delete(u),S}return C0=o,C0}var j0,US;function lU(){if(US)return j0;US=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,o){r[++n]=[o,a]}),r}return j0=e,j0}var T0,HS;function Ok(){if(HS)return T0;HS=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return T0=e,T0}var R0,$S;function cU(){if($S)return R0;$S=1;var e=Ql(),t=L5(),n=Yl(),r=$5(),a=lU(),o=Ok(),l=1,u=2,d="[object Boolean]",f="[object Date]",p="[object Error]",g="[object Map]",m="[object Number]",x="[object RegExp]",v="[object Set]",k="[object String]",_="[object Symbol]",E="[object ArrayBuffer]",S="[object DataView]",N=e?e.prototype:void 0,A=N?N.valueOf:void 0;function T(R,C,O,M,I,D,F){switch(O){case S:if(R.byteLength!=C.byteLength||R.byteOffset!=C.byteOffset)return!1;R=R.buffer,C=C.buffer;case E:return!(R.byteLength!=C.byteLength||!D(new t(R),new t(C)));case d:case f:case m:return n(+R,+C);case p:return R.name==C.name&&R.message==C.message;case x:case k:return R==C+"";case g:var ee=a;case v:var H=M&l;if(ee||(ee=o),R.size!=C.size&&!H)return!1;var P=F.get(R);if(P)return P==C;M|=u,F.set(R,C);var K=r(ee(R),ee(C),M,I,D,F);return F.delete(R),K;case _:if(A)return A.call(R)==A.call(C)}return!1}return R0=T,R0}var A0,WS;function uU(){if(WS)return A0;WS=1;var e=I5(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(o,l,u,d,f,p){var g=u&t,m=e(o),x=m.length,v=e(l),k=v.length;if(x!=k&&!g)return!1;for(var _=x;_--;){var E=m[_];if(!(g?E in l:r.call(l,E)))return!1}var S=p.get(o),N=p.get(l);if(S&&N)return S==l&&N==o;var A=!0;p.set(o,l),p.set(l,o);for(var T=g;++_<x;){E=m[_];var R=o[E],C=l[E];if(d)var O=g?d(C,R,E,l,o,p):d(R,C,E,o,l,p);if(!(O===void 0?R===C||f(R,C,u,d,p):O)){A=!1;break}T||(T=E=="constructor")}if(A&&!T){var M=o.constructor,I=l.constructor;M!=I&&"constructor"in o&&"constructor"in l&&!(typeof M=="function"&&M instanceof M&&typeof I=="function"&&I instanceof I)&&(A=!1)}return p.delete(o),p.delete(l),A}return A0=a,A0}var I0,VS;function dU(){if(VS)return I0;VS=1;var e=ip(),t=$5(),n=cU(),r=uU(),a=Zl(),o=Cr(),l=Xl(),u=Uu(),d=1,f="[object Arguments]",p="[object Array]",g="[object Object]",m=Object.prototype,x=m.hasOwnProperty;function v(k,_,E,S,N,A){var T=o(k),R=o(_),C=T?p:a(k),O=R?p:a(_);C=C==f?g:C,O=O==f?g:O;var M=C==g,I=O==g,D=C==O;if(D&&l(k)){if(!l(_))return!1;T=!0,M=!1}if(D&&!M)return A||(A=new e),T||u(k)?t(k,_,E,S,N,A):n(k,_,C,E,S,N,A);if(!(E&d)){var F=M&&x.call(k,"__wrapped__"),ee=I&&x.call(_,"__wrapped__");if(F||ee){var H=F?k.value():k,P=ee?_.value():_;return A||(A=new e),N(H,P,E,S,A)}}return D?(A||(A=new e),r(k,_,E,S,N,A)):!1}return I0=v,I0}var M0,GS;function W5(){if(GS)return M0;GS=1;var e=dU(),t=Ya();function n(r,a,o,l,u){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,o,l,n,u)}return M0=n,M0}var L0,KS;function fU(){if(KS)return L0;KS=1;var e=ip(),t=W5(),n=1,r=2;function a(o,l,u,d){var f=u.length,p=f,g=!d;if(o==null)return!p;for(o=Object(o);f--;){var m=u[f];if(g&&m[2]?m[1]!==o[m[0]]:!(m[0]in o))return!1}for(;++f<p;){m=u[f];var x=m[0],v=o[x],k=m[1];if(g&&m[2]){if(v===void 0&&!(x in o))return!1}else{var _=new e;if(d)var E=d(v,k,x,o,l,_);if(!(E===void 0?t(k,v,n|r,d,_):E))return!1}}return!0}return L0=a,L0}var O0,YS;function V5(){if(YS)return O0;YS=1;var e=aa();function t(n){return n===n&&!e(n)}return O0=t,O0}var D0,QS;function pU(){if(QS)return D0;QS=1;var e=V5(),t=Xs();function n(r){for(var a=t(r),o=a.length;o--;){var l=a[o],u=r[l];a[o]=[l,u,e(u)]}return a}return D0=n,D0}var P0,XS;function G5(){if(XS)return P0;XS=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return P0=e,P0}var F0,ZS;function hU(){if(ZS)return F0;ZS=1;var e=fU(),t=pU(),n=G5();function r(a){var o=t(a);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(l){return l===a||e(l,a,o)}}return F0=r,F0}var B0,JS;function Jl(){if(JS)return B0;JS=1;var e=Yo(),t=Ya(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return B0=r,B0}var z0,eN;function Dk(){if(eN)return z0;eN=1;var e=Cr(),t=Jl(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(o,l){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||l!=null&&o in Object(l)}return z0=a,z0}var q0,tN;function gU(){if(tN)return q0;tN=1;var e=Ek(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var o=function(){var l=arguments,u=a?a.apply(this,l):l[0],d=o.cache;if(d.has(u))return d.get(u);var f=r.apply(this,l);return o.cache=d.set(u,f)||d,f};return o.cache=new(n.Cache||e),o}return n.Cache=e,q0=n,q0}var U0,nN;function mU(){if(nN)return U0;nN=1;var e=gU(),t=500;function n(r){var a=e(r,function(l){return o.size===t&&o.clear(),l}),o=a.cache;return a}return U0=n,U0}var H0,rN;function xU(){if(rN)return H0;rN=1;var e=mU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var o=[];return a.charCodeAt(0)===46&&o.push(""),a.replace(t,function(l,u,d,f){o.push(d?f.replace(n,"$1"):u||l)}),o});return H0=r,H0}var $0,iN;function fp(){if(iN)return $0;iN=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,o=Array(a);++r<a;)o[r]=n(t[r],r,t);return o}return $0=e,$0}var W0,aN;function yU(){if(aN)return W0;aN=1;var e=Ql(),t=fp(),n=Cr(),r=Jl(),a=e?e.prototype:void 0,o=a?a.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(r(u))return o?o.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return W0=l,W0}var V0,sN;function K5(){if(sN)return V0;sN=1;var e=yU();function t(n){return n==null?"":e(n)}return V0=t,V0}var G0,oN;function pp(){if(oN)return G0;oN=1;var e=Cr(),t=Dk(),n=xU(),r=K5();function a(o,l){return e(o)?o:t(o,l)?[o]:n(r(o))}return G0=a,G0}var K0,lN;function Hu(){if(lN)return K0;lN=1;var e=Jl();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return K0=t,K0}var Y0,cN;function hp(){if(cN)return Y0;cN=1;var e=pp(),t=Hu();function n(r,a){a=e(a,r);for(var o=0,l=a.length;r!=null&&o<l;)r=r[t(a[o++])];return o&&o==l?r:void 0}return Y0=n,Y0}var Q0,uN;function bU(){if(uN)return Q0;uN=1;var e=hp();function t(n,r,a){var o=n==null?void 0:e(n,r);return o===void 0?a:o}return Q0=t,Q0}var X0,dN;function vU(){if(dN)return X0;dN=1;function e(t,n){return t!=null&&n in Object(t)}return X0=e,X0}var Z0,fN;function Y5(){if(fN)return Z0;fN=1;var e=pp(),t=qu(),n=Cr(),r=op(),a=Nk(),o=Hu();function l(u,d,f){d=e(d,u);for(var p=-1,g=d.length,m=!1;++p<g;){var x=o(d[p]);if(!(m=u!=null&&f(u,x)))break;u=u[x]}return m||++p!=g?m:(g=u==null?0:u.length,!!g&&a(g)&&r(x,g)&&(n(u)||t(u)))}return Z0=l,Z0}var J0,pN;function Q5(){if(pN)return J0;pN=1;var e=vU(),t=Y5();function n(r,a){return r!=null&&t(r,a,e)}return J0=n,J0}var ex,hN;function kU(){if(hN)return ex;hN=1;var e=W5(),t=bU(),n=Q5(),r=Dk(),a=V5(),o=G5(),l=Hu(),u=1,d=2;function f(p,g){return r(p)&&a(g)?o(l(p),g):function(m){var x=t(m,p);return x===void 0&&x===g?n(m,p):e(g,x,u|d)}}return ex=f,ex}var tx,gN;function X5(){if(gN)return tx;gN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return tx=e,tx}var nx,mN;function _U(){if(mN)return nx;mN=1;var e=hp();function t(n){return function(r){return e(r,n)}}return nx=t,nx}var rx,xN;function wU(){if(xN)return rx;xN=1;var e=X5(),t=_U(),n=Dk(),r=Hu();function a(o){return n(o)?e(r(o)):t(o)}return rx=a,rx}var ix,yN;function ps(){if(yN)return ix;yN=1;var e=hU(),t=kU(),n=Zo(),r=Cr(),a=wU();function o(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):a(l)}return ix=o,ix}var ax,bN;function Z5(){if(bN)return ax;bN=1;var e=j5(),t=iU(),n=ps(),r=Cr();function a(o,l){var u=r(o)?e:t;return u(o,n(l,3))}return ax=a,ax}var sx,vN;function EU(){if(vN)return sx;vN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return sx=n,sx}var ox,kN;function J5(){if(kN)return ox;kN=1;var e=EU(),t=Y5();function n(r,a){return r!=null&&t(r,a,e)}return ox=n,ox}var lx,_N;function SU(){if(_N)return lx;_N=1;var e=jk(),t=Zl(),n=qu(),r=Cr(),a=fs(),o=Xl(),l=cp(),u=Uu(),d="[object Map]",f="[object Set]",p=Object.prototype,g=p.hasOwnProperty;function m(x){if(x==null)return!0;if(a(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||o(x)||u(x)||n(x)))return!x.length;var v=t(x);if(v==d||v==f)return!x.size;if(l(x))return!e(x).length;for(var k in x)if(g.call(x,k))return!1;return!0}return lx=m,lx}var cx,wN;function eA(){if(wN)return cx;wN=1;function e(t){return t===void 0}return cx=e,cx}var ux,EN;function tA(){if(EN)return ux;EN=1;var e=dp(),t=fs();function n(r,a){var o=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,f){l[++o]=a(u,d,f)}),l}return ux=n,ux}var dx,SN;function nA(){if(SN)return dx;SN=1;var e=fp(),t=ps(),n=tA(),r=Cr();function a(o,l){var u=r(o)?e:n;return u(o,t(l,3))}return dx=a,dx}var fx,NN;function NU(){if(NN)return fx;NN=1;function e(t,n,r,a){var o=-1,l=t==null?0:t.length;for(a&&l&&(r=t[++o]);++o<l;)r=n(r,t[o],o,t);return r}return fx=e,fx}var px,CN;function CU(){if(CN)return px;CN=1;function e(t,n,r,a,o){return o(t,function(l,u,d){r=a?(a=!1,l):n(r,l,u,d)}),r}return px=e,px}var hx,jN;function rA(){if(jN)return hx;jN=1;var e=NU(),t=dp(),n=ps(),r=CU(),a=Cr();function o(l,u,d){var f=a(l)?e:r,p=arguments.length<3;return f(l,n(u,4),d,p,t)}return hx=o,hx}var gx,TN;function jU(){if(TN)return gx;TN=1;var e=Yo(),t=Cr(),n=Ya(),r="[object String]";function a(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return gx=a,gx}var mx,RN;function TU(){if(RN)return mx;RN=1;var e=X5(),t=e("length");return mx=t,mx}var xx,AN;function RU(){if(AN)return xx;AN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+a+o+"]");function d(f){return u.test(f)}return xx=d,xx}var yx,IN;function AU(){if(IN)return yx;IN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+a+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",p="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",v=f+"?",k="["+o+"]?",_="(?:"+x+"(?:"+[p,g,m].join("|")+")"+k+v+")*",E=k+v+_,S="(?:"+[p+u+"?",u,g,m,l].join("|")+")",N=RegExp(d+"(?="+d+")|"+S+E,"g");function A(T){for(var R=N.lastIndex=0;N.test(T);)++R;return R}return yx=A,yx}var bx,MN;function IU(){if(MN)return bx;MN=1;var e=TU(),t=RU(),n=AU();function r(a){return t(a)?n(a):e(a)}return bx=r,bx}var vx,LN;function MU(){if(LN)return vx;LN=1;var e=jk(),t=Zl(),n=fs(),r=jU(),a=IU(),o="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return r(d)?a(d):d.length;var f=t(d);return f==o||f==l?d.size:e(d).length}return vx=u,vx}var kx,ON;function LU(){if(ON)return kx;ON=1;var e=Sk(),t=D5(),n=Lk(),r=ps(),a=up(),o=Cr(),l=Xl(),u=Bu(),d=aa(),f=Uu();function p(g,m,x){var v=o(g),k=v||l(g)||f(g);if(m=r(m,4),x==null){var _=g&&g.constructor;k?x=v?new _:[]:d(g)?x=u(_)?t(a(g)):{}:x={}}return(k?e:n)(g,function(E,S,N){return m(x,E,S,N)}),x}return kx=p,kx}var _x,DN;function OU(){if(DN)return _x;DN=1;var e=Ql(),t=qu(),n=Cr(),r=e?e.isConcatSpreadable:void 0;function a(o){return n(o)||t(o)||!!(r&&o&&o[r])}return _x=a,_x}var wx,PN;function Pk(){if(PN)return wx;PN=1;var e=Rk(),t=OU();function n(r,a,o,l,u){var d=-1,f=r.length;for(o||(o=t),u||(u=[]);++d<f;){var p=r[d];a>0&&o(p)?a>1?n(p,a-1,o,l,u):e(u,p):l||(u[u.length]=p)}return u}return wx=n,wx}var Ex,FN;function DU(){if(FN)return Ex;FN=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return Ex=e,Ex}var Sx,BN;function iA(){if(BN)return Sx;BN=1;var e=DU(),t=Math.max;function n(r,a,o){return a=t(a===void 0?r.length-1:a,0),function(){for(var l=arguments,u=-1,d=t(l.length-a,0),f=Array(d);++u<d;)f[u]=l[a+u];u=-1;for(var p=Array(a+1);++u<a;)p[u]=l[u];return p[a]=o(f),e(r,this,p)}}return Sx=n,Sx}var Nx,zN;function PU(){if(zN)return Nx;zN=1;var e=Ik(),t=w5(),n=Zo(),r=t?function(a,o){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return Nx=r,Nx}var Cx,qN;function FU(){if(qN)return Cx;qN=1;var e=800,t=16,n=Date.now;function r(a){var o=0,l=0;return function(){var u=n(),d=t-(u-l);if(l=u,d>0){if(++o>=e)return arguments[0]}else o=0;return a.apply(void 0,arguments)}}return Cx=r,Cx}var jx,UN;function aA(){if(UN)return jx;UN=1;var e=PU(),t=FU(),n=t(e);return jx=n,jx}var Tx,HN;function gp(){if(HN)return Tx;HN=1;var e=Zo(),t=iA(),n=aA();function r(a,o){return n(t(a,o,e),a+"")}return Tx=r,Tx}var Rx,$N;function sA(){if($N)return Rx;$N=1;function e(t,n,r,a){for(var o=t.length,l=r+(a?1:-1);a?l--:++l<o;)if(n(t[l],l,t))return l;return-1}return Rx=e,Rx}var Ax,WN;function BU(){if(WN)return Ax;WN=1;function e(t){return t!==t}return Ax=e,Ax}var Ix,VN;function zU(){if(VN)return Ix;VN=1;function e(t,n,r){for(var a=r-1,o=t.length;++a<o;)if(t[a]===n)return a;return-1}return Ix=e,Ix}var Mx,GN;function qU(){if(GN)return Mx;GN=1;var e=sA(),t=BU(),n=zU();function r(a,o,l){return o===o?n(a,o,l):e(a,t,l)}return Mx=r,Mx}var Lx,KN;function UU(){if(KN)return Lx;KN=1;var e=qU();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return Lx=t,Lx}var Ox,YN;function HU(){if(YN)return Ox;YN=1;function e(t,n,r){for(var a=-1,o=t==null?0:t.length;++a<o;)if(r(n,t[a]))return!0;return!1}return Ox=e,Ox}var Dx,QN;function $U(){if(QN)return Dx;QN=1;function e(){}return Dx=e,Dx}var Px,XN;function WU(){if(XN)return Px;XN=1;var e=M5(),t=$U(),n=Ok(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return Px=a,Px}var Fx,ZN;function VU(){if(ZN)return Fx;ZN=1;var e=U5(),t=UU(),n=HU(),r=H5(),a=WU(),o=Ok(),l=200;function u(d,f,p){var g=-1,m=t,x=d.length,v=!0,k=[],_=k;if(p)v=!1,m=n;else if(x>=l){var E=f?null:a(d);if(E)return o(E);v=!1,m=r,_=new e}else _=f?[]:k;e:for(;++g<x;){var S=d[g],N=f?f(S):S;if(S=p||S!==0?S:0,v&&N===N){for(var A=_.length;A--;)if(_[A]===N)continue e;f&&_.push(N),k.push(S)}else m(_,N,p)||(_!==k&&_.push(N),k.push(S))}return k}return Fx=u,Fx}var Bx,JN;function oA(){if(JN)return Bx;JN=1;var e=fs(),t=Ya();function n(r){return t(r)&&e(r)}return Bx=n,Bx}var zx,eC;function GU(){if(eC)return zx;eC=1;var e=Pk(),t=gp(),n=VU(),r=oA(),a=t(function(o){return n(e(o,1,r,!0))});return zx=a,zx}var qx,tC;function KU(){if(tC)return qx;tC=1;var e=fp();function t(n,r){return e(r,function(a){return n[a]})}return qx=t,qx}var Ux,nC;function lA(){if(nC)return Ux;nC=1;var e=KU(),t=Xs();function n(r){return r==null?[]:e(r,t(r))}return Ux=n,Ux}var Hx,rC;function sa(){if(rC)return Hx;rC=1;var e;if(typeof _k=="function")try{e={clone:tU(),constant:Ik(),each:q5(),filter:Z5(),has:J5(),isArray:Cr(),isEmpty:SU(),isFunction:Bu(),isUndefined:eA(),keys:Xs(),map:nA(),reduce:rA(),size:MU(),transform:LU(),union:GU(),values:lA()}}catch{}return e||(e=window._),Hx=e,Hx}var $x,iC;function Fk(){if(iC)return $x;iC=1;var e=sa();$x=a;var t="\0",n="\0",r="";function a(p){this._isDirected=e.has(p,"directed")?p.directed:!0,this._isMultigraph=e.has(p,"multigraph")?p.multigraph:!1,this._isCompound=e.has(p,"compound")?p.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[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(p){return this._label=p,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(g){return e.isEmpty(p._in[g])})},a.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(g){return e.isEmpty(p._out[g])})},a.prototype.setNodes=function(p,g){var m=arguments,x=this;return e.each(p,function(v){m.length>1?x.setNode(v,g):x.setNode(v)}),this},a.prototype.setNode=function(p,g){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=g),this):(this._nodes[p]=arguments.length>1?g:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=n,this._children[p]={},this._children[n][p]=!0),this._in[p]={},this._preds[p]={},this._out[p]={},this._sucs[p]={},++this._nodeCount,this)},a.prototype.node=function(p){return this._nodes[p]},a.prototype.hasNode=function(p){return e.has(this._nodes,p)},a.prototype.removeNode=function(p){var g=this;if(e.has(this._nodes,p)){var m=function(x){g.removeEdge(g._edgeObjs[x])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(x){g.setParent(x)}),delete this._children[p]),e.each(e.keys(this._in[p]),m),delete this._in[p],delete this._preds[p],e.each(e.keys(this._out[p]),m),delete this._out[p],delete this._sucs[p],--this._nodeCount}return this},a.prototype.setParent=function(p,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var m=g;!e.isUndefined(m);m=this.parent(m))if(m===p)throw new Error("Setting "+g+" as parent of "+p+" would create a cycle");this.setNode(g)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=g,this._children[g][p]=!0,this},a.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},a.prototype.parent=function(p){if(this._isCompound){var g=this._parent[p];if(g!==n)return g}},a.prototype.children=function(p){if(e.isUndefined(p)&&(p=n),this._isCompound){var g=this._children[p];if(g)return e.keys(g)}else{if(p===n)return this.nodes();if(this.hasNode(p))return[]}},a.prototype.predecessors=function(p){var g=this._preds[p];if(g)return e.keys(g)},a.prototype.successors=function(p){var g=this._sucs[p];if(g)return e.keys(g)},a.prototype.neighbors=function(p){var g=this.predecessors(p);if(g)return e.union(g,this.successors(p))},a.prototype.isLeaf=function(p){var g;return this.isDirected()?g=this.successors(p):g=this.neighbors(p),g.length===0},a.prototype.filterNodes=function(p){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var m=this;e.each(this._nodes,function(k,_){p(_)&&g.setNode(_,k)}),e.each(this._edgeObjs,function(k){g.hasNode(k.v)&&g.hasNode(k.w)&&g.setEdge(k,m.edge(k))});var x={};function v(k){var _=m.parent(k);return _===void 0||g.hasNode(_)?(x[k]=_,_):_ in x?x[_]:v(_)}return this._isCompound&&e.each(g.nodes(),function(k){g.setParent(k,v(k))}),g},a.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(p,g){var m=this,x=arguments;return e.reduce(p,function(v,k){return x.length>1?m.setEdge(v,k,g):m.setEdge(v,k),k}),this},a.prototype.setEdge=function(){var p,g,m,x,v=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(p=k.v,g=k.w,m=k.name,arguments.length===2&&(x=arguments[1],v=!0)):(p=k,g=arguments[1],m=arguments[3],arguments.length>2&&(x=arguments[2],v=!0)),p=""+p,g=""+g,e.isUndefined(m)||(m=""+m);var _=u(this._isDirected,p,g,m);if(e.has(this._edgeLabels,_))return v&&(this._edgeLabels[_]=x),this;if(!e.isUndefined(m)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(p),this.setNode(g),this._edgeLabels[_]=v?x:this._defaultEdgeLabelFn(p,g,m);var E=d(this._isDirected,p,g,m);return p=E.v,g=E.w,Object.freeze(E),this._edgeObjs[_]=E,o(this._preds[g],p),o(this._sucs[p],g),this._in[g][_]=E,this._out[p][_]=E,this._edgeCount++,this},a.prototype.edge=function(p,g,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,g,m);return this._edgeLabels[x]},a.prototype.hasEdge=function(p,g,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,g,m);return e.has(this._edgeLabels,x)},a.prototype.removeEdge=function(p,g,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,g,m),v=this._edgeObjs[x];return v&&(p=v.v,g=v.w,delete this._edgeLabels[x],delete this._edgeObjs[x],l(this._preds[g],p),l(this._sucs[p],g),delete this._in[g][x],delete this._out[p][x],this._edgeCount--),this},a.prototype.inEdges=function(p,g){var m=this._in[p];if(m){var x=e.values(m);return g?e.filter(x,function(v){return v.v===g}):x}},a.prototype.outEdges=function(p,g){var m=this._out[p];if(m){var x=e.values(m);return g?e.filter(x,function(v){return v.w===g}):x}},a.prototype.nodeEdges=function(p,g){var m=this.inEdges(p,g);if(m)return m.concat(this.outEdges(p,g))};function o(p,g){p[g]?p[g]++:p[g]=1}function l(p,g){--p[g]||delete p[g]}function u(p,g,m,x){var v=""+g,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}return v+r+k+r+(e.isUndefined(x)?t:x)}function d(p,g,m,x){var v=""+g,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}var E={v,w:k};return x&&(E.name=x),E}function f(p,g){return u(p,g.v,g.w,g.name)}return $x}var Wx,aC;function YU(){return aC||(aC=1,Wx="2.1.8"),Wx}var Vx,sC;function QU(){return sC||(sC=1,Vx={Graph:Fk(),version:YU()}),Vx}var Gx,oC;function XU(){if(oC)return Gx;oC=1;var e=sa(),t=Fk();Gx={write:n,read:o};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:r(l),edges:a(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function r(l){return e.map(l.nodes(),function(u){var d=l.node(u),f=l.parent(u),p={v:u};return e.isUndefined(d)||(p.value=d),e.isUndefined(f)||(p.parent=f),p})}function a(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 Gx}var Kx,lC;function ZU(){if(lC)return Kx;lC=1;var e=sa();Kx=t;function t(n){var r={},a=[],o;function l(u){e.has(r,u)||(r[u]=!0,o.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){o=[],l(u),o.length&&a.push(o)}),a}return Kx}var Yx,cC;function cA(){if(cC)return Yx;cC=1;var e=sa();Yx=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(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var o=this._arr,l=o.length;return a[n]=l,o.push({key:n,priority:r}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,o=a+1,l=n;a<r.length&&(l=r[a].priority<r[l].priority?a:l,o<r.length&&(l=r[o].priority<r[l].priority?o:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<a));)this._swap(n,o),n=o},t.prototype._swap=function(n,r){var a=this._arr,o=this._keyIndices,l=a[n],u=a[r];a[n]=u,a[r]=l,o[u.key]=n,o[l.key]=r},Yx}var Qx,uC;function uA(){if(uC)return Qx;uC=1;var e=sa(),t=cA();Qx=r;var n=e.constant(1);function r(o,l,u,d){return a(o,String(l),u||n,d||function(f){return o.outEdges(f)})}function a(o,l,u,d){var f={},p=new t,g,m,x=function(v){var k=v.v!==g?v.v:v.w,_=f[k],E=u(v),S=m.distance+E;if(E<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+E);S<_.distance&&(_.distance=S,_.predecessor=g,p.decrease(k,S))};for(o.nodes().forEach(function(v){var k=v===l?0:Number.POSITIVE_INFINITY;f[v]={distance:k},p.add(v,k)});p.size()>0&&(g=p.removeMin(),m=f[g],m.distance!==Number.POSITIVE_INFINITY);)d(g).forEach(x);return f}return Qx}var Xx,dC;function JU(){if(dC)return Xx;dC=1;var e=uA(),t=sa();Xx=n;function n(r,a,o){return t.transform(r.nodes(),function(l,u){l[u]=e(r,u,a,o)},{})}return Xx}var Zx,fC;function dA(){if(fC)return Zx;fC=1;var e=sa();Zx=t;function t(n){var r=0,a=[],o={},l=[];function u(d){var f=o[d]={onStack:!0,lowlink:r,index:r++};if(a.push(d),n.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 p=[],g;do g=a.pop(),o[g].onStack=!1,p.push(g);while(d!==g);l.push(p)}}return n.nodes().forEach(function(d){e.has(o,d)||u(d)}),l}return Zx}var Jx,pC;function eH(){if(pC)return Jx;pC=1;var e=sa(),t=dA();Jx=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return Jx}var ey,hC;function tH(){if(hC)return ey;hC=1;var e=sa();ey=n;var t=e.constant(1);function n(a,o,l){return r(a,o||t,l||function(u){return a.outEdges(u)})}function r(a,o,l){var u={},d=a.nodes();return d.forEach(function(f){u[f]={},u[f][f]={distance:0},d.forEach(function(p){f!==p&&(u[f][p]={distance:Number.POSITIVE_INFINITY})}),l(f).forEach(function(p){var g=p.v===f?p.w:p.v,m=o(p);u[f][g]={distance:m,predecessor:f}})}),d.forEach(function(f){var p=u[f];d.forEach(function(g){var m=u[g];d.forEach(function(x){var v=m[f],k=p[x],_=m[x],E=v.distance+k.distance;E<_.distance&&(_.distance=E,_.predecessor=k.predecessor)})})}),u}return ey}var ty,gC;function fA(){if(gC)return ty;gC=1;var e=sa();ty=t,t.CycleException=n;function t(r){var a={},o={},l=[];function u(d){if(e.has(o,d))throw new n;e.has(a,d)||(o[d]=!0,a[d]=!0,e.each(r.predecessors(d),u),delete o[d],l.push(d))}if(e.each(r.sinks(),u),e.size(a)!==r.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,ty}var ny,mC;function nH(){if(mC)return ny;mC=1;var e=fA();ny=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return ny}var ry,xC;function pA(){if(xC)return ry;xC=1;var e=sa();ry=t;function t(r,a,o){e.isArray(a)||(a=[a]);var l=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],d={};return e.each(a,function(f){if(!r.hasNode(f))throw new Error("Graph does not have node: "+f);n(r,f,o==="post",d,l,u)}),u}function n(r,a,o,l,u,d){e.has(l,a)||(l[a]=!0,o||d.push(a),e.each(u(a),function(f){n(r,f,o,l,u,d)}),o&&d.push(a))}return ry}var iy,yC;function rH(){if(yC)return iy;yC=1;var e=pA();iy=t;function t(n,r){return e(n,r,"post")}return iy}var ay,bC;function iH(){if(bC)return ay;bC=1;var e=pA();ay=t;function t(n,r){return e(n,r,"pre")}return ay}var sy,vC;function aH(){if(vC)return sy;vC=1;var e=sa(),t=Fk(),n=cA();sy=r;function r(a,o){var l=new t,u={},d=new n,f;function p(m){var x=m.v===f?m.w:m.v,v=d.priority(x);if(v!==void 0){var k=o(m);k<v&&(u[x]=f,d.decrease(x,k))}}if(a.nodeCount()===0)return l;e.each(a.nodes(),function(m){d.add(m,Number.POSITIVE_INFINITY),l.setNode(m)}),d.decrease(a.nodes()[0],0);for(var g=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(f).forEach(p)}return l}return sy}var oy,kC;function sH(){return kC||(kC=1,oy={components:ZU(),dijkstra:uA(),dijkstraAll:JU(),findCycles:eH(),floydWarshall:tH(),isAcyclic:nH(),postorder:rH(),preorder:iH(),prim:aH(),tarjan:dA(),topsort:fA()}),oy}var ly,_C;function oH(){if(_C)return ly;_C=1;var e=QU();return ly={Graph:e.Graph,json:XU(),alg:sH(),version:e.version},ly}var cy,wC;function Na(){if(wC)return cy;wC=1;var e;if(typeof _k=="function")try{e=oH()}catch{}return e||(e=window.graphlib),cy=e,cy}var uy,EC;function lH(){if(EC)return uy;EC=1;var e=F5(),t=1,n=4;function r(a){return e(a,t|n)}return uy=r,uy}var dy,SC;function mp(){if(SC)return dy;SC=1;var e=Yl(),t=fs(),n=op(),r=aa();function a(o,l,u){if(!r(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],o):!1}return dy=a,dy}var fy,NC;function cH(){if(NC)return fy;NC=1;var e=gp(),t=Yl(),n=mp(),r=Xo(),a=Object.prototype,o=a.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,p=d.length,g=p>2?d[2]:void 0;for(g&&n(d[0],d[1],g)&&(p=1);++f<p;)for(var m=d[f],x=r(m),v=-1,k=x.length;++v<k;){var _=x[v],E=u[_];(E===void 0||t(E,a[_])&&!o.call(u,_))&&(u[_]=m[_])}return u});return fy=l,fy}var py,CC;function uH(){if(CC)return py;CC=1;var e=ps(),t=fs(),n=Xs();function r(a){return function(o,l,u){var d=Object(o);if(!t(o)){var f=e(l,3);o=n(o),l=function(g){return f(d[g],g,d)}}var p=a(o,l,u);return p>-1?d[f?o[p]:p]:void 0}}return py=r,py}var hy,jC;function dH(){if(jC)return hy;jC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return hy=t,hy}var gy,TC;function fH(){if(TC)return gy;TC=1;var e=dH(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return gy=n,gy}var my,RC;function pH(){if(RC)return my;RC=1;var e=fH(),t=aa(),n=Jl(),r=NaN,a=/^[-+]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(n(f))return r;if(t(f)){var p=typeof f.valueOf=="function"?f.valueOf():f;f=t(p)?p+"":p}if(typeof f!="string")return f===0?f:+f;f=e(f);var g=o.test(f);return g||l.test(f)?u(f.slice(2),g?2:8):a.test(f)?r:+f}return my=d,my}var xy,AC;function hA(){if(AC)return xy;AC=1;var e=pH(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var o=a<0?-1:1;return o*n}return a===a?a:0}return xy=r,xy}var yy,IC;function hH(){if(IC)return yy;IC=1;var e=hA();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return yy=t,yy}var by,MC;function gH(){if(MC)return by;MC=1;var e=sA(),t=ps(),n=hH(),r=Math.max;function a(o,l,u){var d=o==null?0:o.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=r(d+f,0)),e(o,t(l,3),f)}return by=a,by}var vy,LC;function mH(){if(LC)return vy;LC=1;var e=uH(),t=gH(),n=e(t);return vy=n,vy}var ky,OC;function gA(){if(OC)return ky;OC=1;var e=Pk();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return ky=t,ky}var _y,DC;function xH(){if(DC)return _y;DC=1;var e=Mk(),t=B5(),n=Xo();function r(a,o){return a==null?a:e(a,t(o),n)}return _y=r,_y}var wy,PC;function yH(){if(PC)return wy;PC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return wy=e,wy}var Ey,FC;function bH(){if(FC)return Ey;FC=1;var e=ap(),t=Lk(),n=ps();function r(a,o){var l={};return o=n(o,3),t(a,function(u,d,f){e(l,d,o(u,d,f))}),l}return Ey=r,Ey}var Sy,BC;function Bk(){if(BC)return Sy;BC=1;var e=Jl();function t(n,r,a){for(var o=-1,l=n.length;++o<l;){var u=n[o],d=r(u);if(d!=null&&(f===void 0?d===d&&!e(d):a(d,f)))var f=d,p=u}return p}return Sy=t,Sy}var Ny,zC;function vH(){if(zC)return Ny;zC=1;function e(t,n){return t>n}return Ny=e,Ny}var Cy,qC;function kH(){if(qC)return Cy;qC=1;var e=Bk(),t=vH(),n=Zo();function r(a){return a&&a.length?e(a,n,t):void 0}return Cy=r,Cy}var jy,UC;function mA(){if(UC)return jy;UC=1;var e=ap(),t=Yl();function n(r,a,o){(o!==void 0&&!t(r[a],o)||o===void 0&&!(a in r))&&e(r,a,o)}return jy=n,jy}var Ty,HC;function _H(){if(HC)return Ty;HC=1;var e=Yo(),t=up(),n=Ya(),r="[object Object]",a=Function.prototype,o=Object.prototype,l=a.toString,u=o.hasOwnProperty,d=l.call(Object);function f(p){if(!n(p)||e(p)!=r)return!1;var g=t(p);if(g===null)return!0;var m=u.call(g,"constructor")&&g.constructor;return typeof m=="function"&&m instanceof m&&l.call(m)==d}return Ty=f,Ty}var Ry,$C;function xA(){if($C)return Ry;$C=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Ry=e,Ry}var Ay,WC;function wH(){if(WC)return Ay;WC=1;var e=zu(),t=Xo();function n(r){return e(r,t(r))}return Ay=n,Ay}var Iy,VC;function EH(){if(VC)return Iy;VC=1;var e=mA(),t=N5(),n=O5(),r=C5(),a=P5(),o=qu(),l=Cr(),u=oA(),d=Xl(),f=Bu(),p=aa(),g=_H(),m=Uu(),x=xA(),v=wH();function k(_,E,S,N,A,T,R){var C=x(_,S),O=x(E,S),M=R.get(O);if(M){e(_,S,M);return}var I=T?T(C,O,S+"",_,E,R):void 0,D=I===void 0;if(D){var F=l(O),ee=!F&&d(O),H=!F&&!ee&&m(O);I=O,F||ee||H?l(C)?I=C:u(C)?I=r(C):ee?(D=!1,I=t(O,!0)):H?(D=!1,I=n(O,!0)):I=[]:g(O)||o(O)?(I=C,o(C)?I=v(C):(!p(C)||f(C))&&(I=a(O))):D=!1}D&&(R.set(O,I),A(I,O,N,T,R),R.delete(O)),e(_,S,I)}return Iy=k,Iy}var My,GC;function SH(){if(GC)return My;GC=1;var e=ip(),t=mA(),n=Mk(),r=EH(),a=aa(),o=Xo(),l=xA();function u(d,f,p,g,m){d!==f&&n(f,function(x,v){if(m||(m=new e),a(x))r(d,f,v,p,u,g,m);else{var k=g?g(l(d,v),x,v+"",d,f,m):void 0;k===void 0&&(k=x),t(d,v,k)}},o)}return My=u,My}var Ly,KC;function NH(){if(KC)return Ly;KC=1;var e=gp(),t=mp();function n(r){return e(function(a,o){var l=-1,u=o.length,d=u>1?o[u-1]:void 0,f=u>2?o[2]:void 0;for(d=r.length>3&&typeof d=="function"?(u--,d):void 0,f&&t(o[0],o[1],f)&&(d=u<3?void 0:d,u=1),a=Object(a);++l<u;){var p=o[l];p&&r(a,p,l,d)}return a})}return Ly=n,Ly}var Oy,YC;function CH(){if(YC)return Oy;YC=1;var e=SH(),t=NH(),n=t(function(r,a,o){e(r,a,o)});return Oy=n,Oy}var Dy,QC;function yA(){if(QC)return Dy;QC=1;function e(t,n){return t<n}return Dy=e,Dy}var Py,XC;function jH(){if(XC)return Py;XC=1;var e=Bk(),t=yA(),n=Zo();function r(a){return a&&a.length?e(a,n,t):void 0}return Py=r,Py}var Fy,ZC;function TH(){if(ZC)return Fy;ZC=1;var e=Bk(),t=ps(),n=yA();function r(a,o){return a&&a.length?e(a,t(o,2),n):void 0}return Fy=r,Fy}var By,JC;function RH(){if(JC)return By;JC=1;var e=Ca(),t=function(){return e.Date.now()};return By=t,By}var zy,ej;function AH(){if(ej)return zy;ej=1;var e=sp(),t=pp(),n=op(),r=aa(),a=Hu();function o(l,u,d,f){if(!r(l))return l;u=t(u,l);for(var p=-1,g=u.length,m=g-1,x=l;x!=null&&++p<g;){var v=a(u[p]),k=d;if(v==="__proto__"||v==="constructor"||v==="prototype")return l;if(p!=m){var _=x[v];k=f?f(_,v,x):void 0,k===void 0&&(k=r(_)?_:n(u[p+1])?[]:{})}e(x,v,k),x=x[v]}return l}return zy=o,zy}var qy,tj;function IH(){if(tj)return qy;tj=1;var e=hp(),t=AH(),n=pp();function r(a,o,l){for(var u=-1,d=o.length,f={};++u<d;){var p=o[u],g=e(a,p);l(g,p)&&t(f,n(p,a),g)}return f}return qy=r,qy}var Uy,nj;function MH(){if(nj)return Uy;nj=1;var e=IH(),t=Q5();function n(r,a){return e(r,a,function(o,l){return t(r,l)})}return Uy=n,Uy}var Hy,rj;function LH(){if(rj)return Hy;rj=1;var e=gA(),t=iA(),n=aA();function r(a){return n(t(a,void 0,e),a+"")}return Hy=r,Hy}var $y,ij;function OH(){if(ij)return $y;ij=1;var e=MH(),t=LH(),n=t(function(r,a){return r==null?{}:e(r,a)});return $y=n,$y}var Wy,aj;function DH(){if(aj)return Wy;aj=1;var e=Math.ceil,t=Math.max;function n(r,a,o,l){for(var u=-1,d=t(e((a-r)/(o||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=o;return f}return Wy=n,Wy}var Vy,sj;function PH(){if(sj)return Vy;sj=1;var e=DH(),t=mp(),n=hA();function r(a){return function(o,l,u){return u&&typeof u!="number"&&t(o,l,u)&&(l=u=void 0),o=n(o),l===void 0?(l=o,o=0):l=n(l),u=u===void 0?o<l?1:-1:n(u),e(o,l,u,a)}}return Vy=r,Vy}var Gy,oj;function FH(){if(oj)return Gy;oj=1;var e=PH(),t=e();return Gy=t,Gy}var Ky,lj;function BH(){if(lj)return Ky;lj=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Ky=e,Ky}var Yy,cj;function zH(){if(cj)return Yy;cj=1;var e=Jl();function t(n,r){if(n!==r){var a=n!==void 0,o=n===null,l=n===n,u=e(n),d=r!==void 0,f=r===null,p=r===r,g=e(r);if(!f&&!g&&!u&&n>r||u&&d&&p&&!f&&!g||o&&d&&p||!a&&p||!l)return 1;if(!o&&!u&&!g&&n<r||g&&a&&l&&!o&&!u||f&&a&&l||!d&&l||!p)return-1}return 0}return Yy=t,Yy}var Qy,uj;function qH(){if(uj)return Qy;uj=1;var e=zH();function t(n,r,a){for(var o=-1,l=n.criteria,u=r.criteria,d=l.length,f=a.length;++o<d;){var p=e(l[o],u[o]);if(p){if(o>=f)return p;var g=a[o];return p*(g=="desc"?-1:1)}}return n.index-r.index}return Qy=t,Qy}var Xy,dj;function UH(){if(dj)return Xy;dj=1;var e=fp(),t=hp(),n=ps(),r=tA(),a=BH(),o=lp(),l=qH(),u=Zo(),d=Cr();function f(p,g,m){g.length?g=e(g,function(k){return d(k)?function(_){return t(_,k.length===1?k[0]:k)}:k}):g=[u];var x=-1;g=e(g,o(n));var v=r(p,function(k,_,E){var S=e(g,function(N){return N(k)});return{criteria:S,index:++x,value:k}});return a(v,function(k,_){return l(k,_,m)})}return Xy=f,Xy}var Zy,fj;function HH(){if(fj)return Zy;fj=1;var e=Pk(),t=UH(),n=gp(),r=mp(),a=n(function(o,l){if(o==null)return[];var u=l.length;return u>1&&r(o,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(o,e(l,1),[])});return Zy=a,Zy}var Jy,pj;function $H(){if(pj)return Jy;pj=1;var e=K5(),t=0;function n(r){var a=++t;return e(r)+a}return Jy=n,Jy}var eb,hj;function WH(){if(hj)return eb;hj=1;function e(t,n,r){for(var a=-1,o=t.length,l=n.length,u={};++a<o;){var d=a<l?n[a]:void 0;r(u,t[a],d)}return u}return eb=e,eb}var tb,gj;function VH(){if(gj)return tb;gj=1;var e=sp(),t=WH();function n(r,a){return t(r||[],a||[],e)}return tb=n,tb}var nb,mj;function rr(){if(mj)return nb;mj=1;var e;if(typeof _k=="function")try{e={cloneDeep:lH(),constant:Ik(),defaults:cH(),each:q5(),filter:Z5(),find:mH(),flatten:gA(),forEach:z5(),forIn:xH(),has:J5(),isUndefined:eA(),last:yH(),map:nA(),mapValues:bH(),max:kH(),merge:CH(),min:jH(),minBy:TH(),now:RH(),pick:OH(),range:FH(),reduce:rA(),sortBy:HH(),uniqueId:$H(),values:lA(),zipObject:VH()}}catch{}return e||(e=window._),nb=e,nb}var rb,xj;function GH(){if(xj)return rb;xj=1,rb=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,a=r._prev;if(a!==r)return t(a),a},e.prototype.enqueue=function(r){var a=this._sentinel;r._prev&&r._next&&t(r),r._next=a._next,a._next._prev=r,a._next=r,r._prev=a},e.prototype.toString=function(){for(var r=[],a=this._sentinel,o=a._prev;o!==a;)r.push(JSON.stringify(o,n)),o=o._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,a){if(r!=="_next"&&r!=="_prev")return a}return rb}var ib,yj;function KH(){if(yj)return ib;yj=1;var e=rr(),t=Na().Graph,n=GH();ib=a;var r=e.constant(1);function a(f,p){if(f.nodeCount()<=1)return[];var g=u(f,p||r),m=o(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(m,function(x){return f.outEdges(x.v,x.w)}),!0)}function o(f,p,g){for(var m=[],x=p[p.length-1],v=p[0],k;f.nodeCount();){for(;k=v.dequeue();)l(f,p,g,k);for(;k=x.dequeue();)l(f,p,g,k);if(f.nodeCount()){for(var _=p.length-2;_>0;--_)if(k=p[_].dequeue(),k){m=m.concat(l(f,p,g,k,!0));break}}}return m}function l(f,p,g,m,x){var v=x?[]:void 0;return e.forEach(f.inEdges(m.v),function(k){var _=f.edge(k),E=f.node(k.v);x&&v.push({v:k.v,w:k.w}),E.out-=_,d(p,g,E)}),e.forEach(f.outEdges(m.v),function(k){var _=f.edge(k),E=k.w,S=f.node(E);S.in-=_,d(p,g,S)}),f.removeNode(m.v),v}function u(f,p){var g=new t,m=0,x=0;e.forEach(f.nodes(),function(_){g.setNode(_,{v:_,in:0,out:0})}),e.forEach(f.edges(),function(_){var E=g.edge(_.v,_.w)||0,S=p(_),N=E+S;g.setEdge(_.v,_.w,N),x=Math.max(x,g.node(_.v).out+=S),m=Math.max(m,g.node(_.w).in+=S)});var v=e.range(x+m+3).map(function(){return new n}),k=m+1;return e.forEach(g.nodes(),function(_){d(v,k,g.node(_))}),{graph:g,buckets:v,zeroIdx:k}}function d(f,p,g){g.out?g.in?f[g.out-g.in+p].enqueue(g):f[f.length-1].enqueue(g):f[0].enqueue(g)}return ib}var ab,bj;function YH(){if(bj)return ab;bj=1;var e=rr(),t=KH();ab={run:n,undo:a};function n(o){var l=o.graph().acyclicer==="greedy"?t(o,u(o)):r(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 r(o){var l=[],u={},d={};function f(p){e.has(d,p)||(d[p]=!0,u[p]=!0,e.forEach(o.outEdges(p),function(g){e.has(u,g.w)?l.push(g):f(g.w)}),delete u[p])}return e.forEach(o.nodes(),f),l}function a(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 ab}var sb,vj;function Ri(){if(vj)return sb;vj=1;var e=rr(),t=Na().Graph;sb={addDummyNode:n,simplify:r,asNonCompoundGraph:a,successorWeights:o,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:p,addBorderNode:g,maxRank:m,partition:x,time:v,notime:k};function n(_,E,S,N){var A;do A=e.uniqueId(N);while(_.hasNode(A));return S.dummy=E,_.setNode(A,S),A}function r(_){var E=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(S){E.setNode(S,_.node(S))}),e.forEach(_.edges(),function(S){var N=E.edge(S.v,S.w)||{weight:0,minlen:1},A=_.edge(S);E.setEdge(S.v,S.w,{weight:N.weight+A.weight,minlen:Math.max(N.minlen,A.minlen)})}),E}function a(_){var E=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(S){_.children(S).length||E.setNode(S,_.node(S))}),e.forEach(_.edges(),function(S){E.setEdge(S,_.edge(S))}),E}function o(_){var E=e.map(_.nodes(),function(S){var N={};return e.forEach(_.outEdges(S),function(A){N[A.w]=(N[A.w]||0)+_.edge(A).weight}),N});return e.zipObject(_.nodes(),E)}function l(_){var E=e.map(_.nodes(),function(S){var N={};return e.forEach(_.inEdges(S),function(A){N[A.v]=(N[A.v]||0)+_.edge(A).weight}),N});return e.zipObject(_.nodes(),E)}function u(_,E){var S=_.x,N=_.y,A=E.x-S,T=E.y-N,R=_.width/2,C=_.height/2;if(!A&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var O,M;return Math.abs(T)*R>Math.abs(A)*C?(T<0&&(C=-C),O=C*A/T,M=C):(A<0&&(R=-R),O=R,M=R*T/A),{x:S+O,y:N+M}}function d(_){var E=e.map(e.range(m(_)+1),function(){return[]});return e.forEach(_.nodes(),function(S){var N=_.node(S),A=N.rank;e.isUndefined(A)||(E[A][N.order]=S)}),E}function f(_){var E=e.min(e.map(_.nodes(),function(S){return _.node(S).rank}));e.forEach(_.nodes(),function(S){var N=_.node(S);e.has(N,"rank")&&(N.rank-=E)})}function p(_){var E=e.min(e.map(_.nodes(),function(T){return _.node(T).rank})),S=[];e.forEach(_.nodes(),function(T){var R=_.node(T).rank-E;S[R]||(S[R]=[]),S[R].push(T)});var N=0,A=_.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%A!==0?--N:N&&e.forEach(T,function(C){_.node(C).rank+=N})})}function g(_,E,S,N){var A={width:0,height:0};return arguments.length>=4&&(A.rank=S,A.order=N),n(_,"border",A,E)}function m(_){return e.max(e.map(_.nodes(),function(E){var S=_.node(E).rank;if(!e.isUndefined(S))return S}))}function x(_,E){var S={lhs:[],rhs:[]};return e.forEach(_,function(N){E(N)?S.lhs.push(N):S.rhs.push(N)}),S}function v(_,E){var S=e.now();try{return E()}finally{console.log(_+" time: "+(e.now()-S)+"ms")}}function k(_,E){return E()}return sb}var ob,kj;function QH(){if(kj)return ob;kj=1;var e=rr(),t=Ri();ob={run:n,undo:a};function n(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(l){r(o,l)})}function r(o,l){var u=l.v,d=o.node(u).rank,f=l.w,p=o.node(f).rank,g=l.name,m=o.edge(l),x=m.labelRank;if(p!==d+1){o.removeEdge(l);var v,k,_;for(_=0,++d;d<p;++_,++d)m.points=[],k={width:0,height:0,edgeLabel:m,edgeObj:l,rank:d},v=t.addDummyNode(o,"edge",k,"_d"),d===x&&(k.width=m.width,k.height=m.height,k.dummy="edge-label",k.labelpos=m.labelpos),o.setEdge(u,v,{weight:m.weight},g),_===0&&o.graph().dummyChains.push(v),u=v;o.setEdge(u,f,{weight:m.weight},g)}}function a(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 ob}var lb,_j;function Pf(){if(_j)return lb;_j=1;var e=rr();lb={longestPath:t,slack:n};function t(r){var a={};function o(l){var u=r.node(l);if(e.has(a,l))return u.rank;a[l]=!0;var d=e.min(e.map(r.outEdges(l),function(f){return o(f.w)-r.edge(f).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(r.sources(),o)}function n(r,a){return r.node(a.w).rank-r.node(a.v).rank-r.edge(a).minlen}return lb}var cb,wj;function bA(){if(wj)return cb;wj=1;var e=rr(),t=Na().Graph,n=Pf().slack;cb=r;function r(u){var d=new t({directed:!1}),f=u.nodes()[0],p=u.nodeCount();d.setNode(f,{});for(var g,m;a(d,u)<p;)g=o(d,u),m=d.hasNode(g.v)?n(u,g):-n(u,g),l(d,u,m);return d}function a(u,d){function f(p){e.forEach(d.nodeEdges(p),function(g){var m=g.v,x=p===m?g.w:m;!u.hasNode(x)&&!n(d,g)&&(u.setNode(x,{}),u.setEdge(p,x,{}),f(x))})}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 n(d,f)})}function l(u,d,f){e.forEach(u.nodes(),function(p){d.node(p).rank+=f})}return cb}var ub,Ej;function XH(){if(Ej)return ub;Ej=1;var e=rr(),t=bA(),n=Pf().slack,r=Pf().longestPath,a=Na().alg.preorder,o=Na().alg.postorder,l=Ri().simplify;ub=u,u.initLowLimValues=g,u.initCutValues=d,u.calcCutValue=p,u.leaveEdge=x,u.enterEdge=v,u.exchangeEdges=k;function u(N){N=l(N),r(N);var A=t(N);g(A),d(A,N);for(var T,R;T=x(A);)R=v(A,N,T),k(A,N,T,R)}function d(N,A){var T=o(N,N.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){f(N,A,R)})}function f(N,A,T){var R=N.node(T),C=R.parent;N.edge(T,C).cutvalue=p(N,A,T)}function p(N,A,T){var R=N.node(T),C=R.parent,O=!0,M=A.edge(T,C),I=0;return M||(O=!1,M=A.edge(C,T)),I=M.weight,e.forEach(A.nodeEdges(T),function(D){var F=D.v===T,ee=F?D.w:D.v;if(ee!==C){var H=F===O,P=A.edge(D).weight;if(I+=H?P:-P,E(N,T,ee)){var K=N.edge(T,ee).cutvalue;I+=H?-K:K}}}),I}function g(N,A){arguments.length<2&&(A=N.nodes()[0]),m(N,{},1,A)}function m(N,A,T,R,C){var O=T,M=N.node(R);return A[R]=!0,e.forEach(N.neighbors(R),function(I){e.has(A,I)||(T=m(N,A,T,I,R))}),M.low=O,M.lim=T++,C?M.parent=C:delete M.parent,T}function x(N){return e.find(N.edges(),function(A){return N.edge(A).cutvalue<0})}function v(N,A,T){var R=T.v,C=T.w;A.hasEdge(R,C)||(R=T.w,C=T.v);var O=N.node(R),M=N.node(C),I=O,D=!1;O.lim>M.lim&&(I=M,D=!0);var F=e.filter(A.edges(),function(ee){return D===S(N,N.node(ee.v),I)&&D!==S(N,N.node(ee.w),I)});return e.minBy(F,function(ee){return n(A,ee)})}function k(N,A,T,R){var C=T.v,O=T.w;N.removeEdge(C,O),N.setEdge(R.v,R.w,{}),g(N),d(N,A),_(N,A)}function _(N,A){var T=e.find(N.nodes(),function(C){return!A.node(C).parent}),R=a(N,T);R=R.slice(1),e.forEach(R,function(C){var O=N.node(C).parent,M=A.edge(C,O),I=!1;M||(M=A.edge(O,C),I=!0),A.node(C).rank=A.node(O).rank+(I?M.minlen:-M.minlen)})}function E(N,A,T){return N.hasEdge(A,T)}function S(N,A,T){return T.low<=A.lim&&A.lim<=T.lim}return ub}var db,Sj;function ZH(){if(Sj)return db;Sj=1;var e=Pf(),t=e.longestPath,n=bA(),r=XH();db=a;function a(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),n(d)}function u(d){r(d)}return db}var fb,Nj;function JH(){if(Nj)return fb;Nj=1;var e=rr();fb=t;function t(a){var o=r(a);e.forEach(a.graph().dummyChains,function(l){for(var u=a.node(l),d=u.edgeObj,f=n(a,o,d.v,d.w),p=f.path,g=f.lca,m=0,x=p[m],v=!0;l!==d.w;){if(u=a.node(l),v){for(;(x=p[m])!==g&&a.node(x).maxRank<u.rank;)m++;x===g&&(v=!1)}if(!v){for(;m<p.length-1&&a.node(x=p[m+1]).minRank<=u.rank;)m++;x=p[m]}a.setParent(l,x),l=a.successors(l)[0]}})}function n(a,o,l,u){var d=[],f=[],p=Math.min(o[l].low,o[u].low),g=Math.max(o[l].lim,o[u].lim),m,x;m=l;do m=a.parent(m),d.push(m);while(m&&(o[m].low>p||g>o[m].lim));for(x=m,m=u;(m=a.parent(m))!==x;)f.push(m);return{path:d.concat(f.reverse()),lca:x}}function r(a){var o={},l=0;function u(d){var f=l;e.forEach(a.children(d),u),o[d]={low:f,lim:l++}}return e.forEach(a.children(),u),o}return fb}var pb,Cj;function e$(){if(Cj)return pb;Cj=1;var e=rr(),t=Ri();pb={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),f=a(u),p=e.max(e.values(f))-1,g=2*p+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(x){u.edge(x).minlen*=g});var m=o(u)+1;e.forEach(u.children(),function(x){r(u,d,g,m,p,f,x)}),u.graph().nodeRankFactor=g}function r(u,d,f,p,g,m,x){var v=u.children(x);if(!v.length){x!==d&&u.setEdge(d,x,{weight:0,minlen:f});return}var k=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),E=u.node(x);u.setParent(k,x),E.borderTop=k,u.setParent(_,x),E.borderBottom=_,e.forEach(v,function(S){r(u,d,f,p,g,m,S);var N=u.node(S),A=N.borderTop?N.borderTop:S,T=N.borderBottom?N.borderBottom:S,R=N.borderTop?p:2*p,C=A!==T?1:g-m[x]+1;u.setEdge(k,A,{weight:R,minlen:C,nestingEdge:!0}),u.setEdge(T,_,{weight:R,minlen:C,nestingEdge:!0})}),u.parent(x)||u.setEdge(d,k,{weight:0,minlen:g+m[x]})}function a(u){var d={};function f(p,g){var m=u.children(p);m&&m.length&&e.forEach(m,function(x){f(x,g+1)}),d[p]=g}return e.forEach(u.children(),function(p){f(p,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 p=u.edge(f);p.nestingEdge&&u.removeEdge(f)})}return pb}var hb,jj;function t$(){if(jj)return hb;jj=1;var e=rr(),t=Ri();hb=n;function n(a){function o(l){var u=a.children(l),d=a.node(l);if(u.length&&e.forEach(u,o),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,p=d.maxRank+1;f<p;++f)r(a,"borderLeft","_bl",l,d,f),r(a,"borderRight","_br",l,d,f)}}e.forEach(a.children(),o)}function r(a,o,l,u,d,f){var p={width:0,height:0,rank:f,borderType:o},g=d[o][f-1],m=t.addDummyNode(a,"border",p,l);d[o][f]=m,a.setParent(m,u),g&&a.setEdge(g,m,{weight:1})}return hb}var gb,Tj;function n$(){if(Tj)return gb;Tj=1;var e=rr();gb={adjust:t,undo:n};function t(f){var p=f.graph().rankdir.toLowerCase();(p==="lr"||p==="rl")&&r(f)}function n(f){var p=f.graph().rankdir.toLowerCase();(p==="bt"||p==="rl")&&o(f),(p==="lr"||p==="rl")&&(u(f),r(f))}function r(f){e.forEach(f.nodes(),function(p){a(f.node(p))}),e.forEach(f.edges(),function(p){a(f.edge(p))})}function a(f){var p=f.width;f.width=f.height,f.height=p}function o(f){e.forEach(f.nodes(),function(p){l(f.node(p))}),e.forEach(f.edges(),function(p){var g=f.edge(p);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(f){f.y=-f.y}function u(f){e.forEach(f.nodes(),function(p){d(f.node(p))}),e.forEach(f.edges(),function(p){var g=f.edge(p);e.forEach(g.points,d),e.has(g,"x")&&d(g)})}function d(f){var p=f.x;f.x=f.y,f.y=p}return gb}var mb,Rj;function r$(){if(Rj)return mb;Rj=1;var e=rr();mb=t;function t(n){var r={},a=e.filter(n.nodes(),function(f){return!n.children(f).length}),o=e.max(e.map(a,function(f){return n.node(f).rank})),l=e.map(e.range(o+1),function(){return[]});function u(f){if(!e.has(r,f)){r[f]=!0;var p=n.node(f);l[p.rank].push(f),e.forEach(n.successors(f),u)}}var d=e.sortBy(a,function(f){return n.node(f).rank});return e.forEach(d,u),l}return mb}var xb,Aj;function i$(){if(Aj)return xb;Aj=1;var e=rr();xb=t;function t(r,a){for(var o=0,l=1;l<a.length;++l)o+=n(r,a[l-1],a[l]);return o}function n(r,a,o){for(var l=e.zipObject(o,e.map(o,function(m,x){return x})),u=e.flatten(e.map(a,function(m){return e.sortBy(e.map(r.outEdges(m),function(x){return{pos:l[x.w],weight:r.edge(x).weight}}),"pos")}),!0),d=1;d<o.length;)d<<=1;var f=2*d-1;d-=1;var p=e.map(new Array(f),function(){return 0}),g=0;return e.forEach(u.forEach(function(m){var x=m.pos+d;p[x]+=m.weight;for(var v=0;x>0;)x%2&&(v+=p[x+1]),x=x-1>>1,p[x]+=m.weight;g+=m.weight*v})),g}return xb}var yb,Ij;function a$(){if(Ij)return yb;Ij=1;var e=rr();yb=t;function t(n,r){return e.map(r,function(a){var o=n.inEdges(a);if(o.length){var l=e.reduce(o,function(u,d){var f=n.edge(d),p=n.node(d.v);return{sum:u.sum+f.weight*p.order,weight:u.weight+f.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return yb}var bb,Mj;function s$(){if(Mj)return bb;Mj=1;var e=rr();bb=t;function t(a,o){var l={};e.forEach(a,function(d,f){var p=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:f};e.isUndefined(d.barycenter)||(p.barycenter=d.barycenter,p.weight=d.weight)}),e.forEach(o.edges(),function(d){var f=l[d.v],p=l[d.w];!e.isUndefined(f)&&!e.isUndefined(p)&&(p.indegree++,f.out.push(l[d.w]))});var u=e.filter(l,function(d){return!d.indegree});return n(u)}function n(a){var o=[];function l(f){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(f.barycenter)||p.barycenter>=f.barycenter)&&r(f,p)}}function u(f){return function(p){p.in.push(f),--p.indegree===0&&a.push(p)}}for(;a.length;){var d=a.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 r(a,o){var l=0,u=0;a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),a.vs=o.vs.concat(a.vs),a.barycenter=l/u,a.weight=u,a.i=Math.min(o.i,a.i),o.merged=!0}return bb}var vb,Lj;function o$(){if(Lj)return vb;Lj=1;var e=rr(),t=Ri();vb=n;function n(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}),p=[],g=0,m=0,x=0;d.sort(a(!!l)),x=r(p,f,x),e.forEach(d,function(k){x+=k.vs.length,p.push(k.vs),g+=k.barycenter*k.weight,m+=k.weight,x=r(p,f,x)});var v={vs:e.flatten(p,!0)};return m&&(v.barycenter=g/m,v.weight=m),v}function r(o,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),o.push(d.vs),u++;return u}function a(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 vb}var kb,Oj;function l$(){if(Oj)return kb;Oj=1;var e=rr(),t=a$(),n=s$(),r=o$();kb=a;function a(u,d,f,p){var g=u.children(d),m=u.node(d),x=m?m.borderLeft:void 0,v=m?m.borderRight:void 0,k={};x&&(g=e.filter(g,function(T){return T!==x&&T!==v}));var _=t(u,g);e.forEach(_,function(T){if(u.children(T.v).length){var R=a(u,T.v,f,p);k[T.v]=R,e.has(R,"barycenter")&&l(T,R)}});var E=n(_,f);o(E,k);var S=r(E,p);if(x&&(S.vs=e.flatten([x,S.vs,v],!0),u.predecessors(x).length)){var N=u.node(u.predecessors(x)[0]),A=u.node(u.predecessors(v)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+N.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(p){return d[p]?d[p].vs:p}),!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 kb}var _b,Dj;function c$(){if(Dj)return _b;Dj=1;var e=rr(),t=Na().Graph;_b=n;function n(a,o,l){var u=r(a),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return a.node(f)});return e.forEach(a.nodes(),function(f){var p=a.node(f),g=a.parent(f);(p.rank===o||p.minRank<=o&&o<=p.maxRank)&&(d.setNode(f),d.setParent(f,g||u),e.forEach(a[l](f),function(m){var x=m.v===f?m.w:m.v,v=d.edge(x,f),k=e.isUndefined(v)?0:v.weight;d.setEdge(x,f,{weight:a.edge(m).weight+k})}),e.has(p,"minRank")&&d.setNode(f,{borderLeft:p.borderLeft[o],borderRight:p.borderRight[o]}))}),d}function r(a){for(var o;a.hasNode(o=e.uniqueId("_root")););return o}return _b}var wb,Pj;function u$(){if(Pj)return wb;Pj=1;var e=rr();wb=t;function t(n,r,a){var o={},l;e.forEach(a,function(u){for(var d=n.parent(u),f,p;d;){if(f=n.parent(d),f?(p=o[f],o[f]=d):(p=l,l=d),p&&p!==d){r.setEdge(p,d);return}d=f}})}return wb}var Eb,Fj;function d$(){if(Fj)return Eb;Fj=1;var e=rr(),t=r$(),n=i$(),r=l$(),a=c$(),o=u$(),l=Na().Graph,u=Ri();Eb=d;function d(m){var x=u.maxRank(m),v=f(m,e.range(1,x+1),"inEdges"),k=f(m,e.range(x-1,-1,-1),"outEdges"),_=t(m);g(m,_);for(var E=Number.POSITIVE_INFINITY,S,N=0,A=0;A<4;++N,++A){p(N%2?v:k,N%4>=2),_=u.buildLayerMatrix(m);var T=n(m,_);T<E&&(A=0,S=e.cloneDeep(_),E=T)}g(m,S)}function f(m,x,v){return e.map(x,function(k){return a(m,k,v)})}function p(m,x){var v=new l;e.forEach(m,function(k){var _=k.graph().root,E=r(k,_,v,x);e.forEach(E.vs,function(S,N){k.node(S).order=N}),o(k,v,E.vs)})}function g(m,x){e.forEach(x,function(v){e.forEach(v,function(k,_){m.node(k).order=_})})}return Eb}var Sb,Bj;function f$(){if(Bj)return Sb;Bj=1;var e=rr(),t=Na().Graph,n=Ri();Sb={positionX:v,findType1Conflicts:r,findType2Conflicts:a,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:m,findSmallestWidthAlignment:g,balance:x};function r(E,S){var N={};function A(T,R){var C=0,O=0,M=T.length,I=e.last(R);return e.forEach(R,function(D,F){var ee=o(E,D),H=ee?E.node(ee).order:M;(ee||D===I)&&(e.forEach(R.slice(O,F+1),function(P){e.forEach(E.predecessors(P),function(K){var V=E.node(K),Z=V.order;(Z<C||H<Z)&&!(V.dummy&&E.node(P).dummy)&&l(N,K,P)})}),O=F+1,C=H)}),R}return e.reduce(S,A),N}function a(E,S){var N={};function A(R,C,O,M,I){var D;e.forEach(e.range(C,O),function(F){D=R[F],E.node(D).dummy&&e.forEach(E.predecessors(D),function(ee){var H=E.node(ee);H.dummy&&(H.order<M||H.order>I)&&l(N,ee,D)})})}function T(R,C){var O=-1,M,I=0;return e.forEach(C,function(D,F){if(E.node(D).dummy==="border"){var ee=E.predecessors(D);ee.length&&(M=E.node(ee[0]).order,A(C,I,F,O,M),I=F,O=M)}A(C,I,C.length,M,R.length)}),C}return e.reduce(S,T),N}function o(E,S){if(E.node(S).dummy)return e.find(E.predecessors(S),function(N){return E.node(N).dummy})}function l(E,S,N){if(S>N){var A=S;S=N,N=A}var T=E[S];T||(E[S]=T={}),T[N]=!0}function u(E,S,N){if(S>N){var A=S;S=N,N=A}return e.has(E[S],N)}function d(E,S,N,A){var T={},R={},C={};return e.forEach(S,function(O){e.forEach(O,function(M,I){T[M]=M,R[M]=M,C[M]=I})}),e.forEach(S,function(O){var M=-1;e.forEach(O,function(I){var D=A(I);if(D.length){D=e.sortBy(D,function(K){return C[K]});for(var F=(D.length-1)/2,ee=Math.floor(F),H=Math.ceil(F);ee<=H;++ee){var P=D[ee];R[I]===I&&M<C[P]&&!u(N,I,P)&&(R[P]=I,R[I]=T[I]=T[P],M=C[P])}}})}),{root:T,align:R}}function f(E,S,N,A,T){var R={},C=p(E,S,N,T),O=T?"borderLeft":"borderRight";function M(F,ee){for(var H=C.nodes(),P=H.pop(),K={};P;)K[P]?F(P):(K[P]=!0,H.push(P),H=H.concat(ee(P))),P=H.pop()}function I(F){R[F]=C.inEdges(F).reduce(function(ee,H){return Math.max(ee,R[H.v]+C.edge(H))},0)}function D(F){var ee=C.outEdges(F).reduce(function(P,K){return Math.min(P,R[K.w]-C.edge(K))},Number.POSITIVE_INFINITY),H=E.node(F);ee!==Number.POSITIVE_INFINITY&&H.borderType!==O&&(R[F]=Math.max(R[F],ee))}return M(I,C.predecessors.bind(C)),M(D,C.successors.bind(C)),e.forEach(A,function(F){R[F]=R[N[F]]}),R}function p(E,S,N,A){var T=new t,R=E.graph(),C=k(R.nodesep,R.edgesep,A);return e.forEach(S,function(O){var M;e.forEach(O,function(I){var D=N[I];if(T.setNode(D),M){var F=N[M],ee=T.edge(F,D);T.setEdge(F,D,Math.max(C(E,I,M),ee||0))}M=I})}),T}function g(E,S){return e.minBy(e.values(S),function(N){var A=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(N,function(R,C){var O=_(E,C)/2;A=Math.max(R+O,A),T=Math.min(R-O,T)}),A-T})}function m(E,S){var N=e.values(S),A=e.min(N),T=e.max(N);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(C){var O=R+C,M=E[O],I;if(M!==S){var D=e.values(M);I=C==="l"?A-e.min(D):T-e.max(D),I&&(E[O]=e.mapValues(M,function(F){return F+I}))}})})}function x(E,S){return e.mapValues(E.ul,function(N,A){if(S)return E[S.toLowerCase()][A];var T=e.sortBy(e.map(E,A));return(T[1]+T[2])/2})}function v(E){var S=n.buildLayerMatrix(E),N=e.merge(r(E,S),a(E,S)),A={},T;e.forEach(["u","d"],function(C){T=C==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(O){O==="r"&&(T=e.map(T,function(F){return e.values(F).reverse()}));var M=(C==="u"?E.predecessors:E.successors).bind(E),I=d(E,T,N,M),D=f(E,T,I.root,I.align,O==="r");O==="r"&&(D=e.mapValues(D,function(F){return-F})),A[C+O]=D})});var R=g(E,A);return m(A,R),x(A,E.graph().align)}function k(E,S,N){return function(A,T,R){var C=A.node(T),O=A.node(R),M=0,I;if(M+=C.width/2,e.has(C,"labelpos"))switch(C.labelpos.toLowerCase()){case"l":I=-C.width/2;break;case"r":I=C.width/2;break}if(I&&(M+=N?I:-I),I=0,M+=(C.dummy?S:E)/2,M+=(O.dummy?S:E)/2,M+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":I=O.width/2;break;case"r":I=-O.width/2;break}return I&&(M+=N?I:-I),I=0,M}}function _(E,S){return E.node(S).width}return Sb}var Nb,zj;function p$(){if(zj)return Nb;zj=1;var e=rr(),t=Ri(),n=f$().positionX;Nb=r;function r(o){o=t.asNonCompoundGraph(o),a(o),e.forEach(n(o),function(l,u){o.node(u).x=l})}function a(o){var l=t.buildLayerMatrix(o),u=o.graph().ranksep,d=0;e.forEach(l,function(f){var p=e.max(e.map(f,function(g){return o.node(g).height}));e.forEach(f,function(g){o.node(g).y=d+p/2}),d+=p+u})}return Nb}var Cb,qj;function h$(){if(qj)return Cb;qj=1;var e=rr(),t=YH(),n=QH(),r=ZH(),a=Ri().normalizeRanks,o=JH(),l=Ri().removeEmptyRanks,u=e$(),d=t$(),f=n$(),p=d$(),g=p$(),m=Ri(),x=Na().Graph;Cb=v;function v(te,W){var $=W&&W.debugTiming?m.time:m.notime;$("layout",function(){var fe=$(" buildLayoutGraph",function(){return M(te)});$(" runLayout",function(){k(fe,$)}),$(" updateInputGraph",function(){_(te,fe)})})}function k(te,W){W(" makeSpaceForEdgeLabels",function(){I(te)}),W(" removeSelfEdges",function(){le(te)}),W(" acyclic",function(){t.run(te)}),W(" nestingGraph.run",function(){u.run(te)}),W(" rank",function(){r(m.asNonCompoundGraph(te))}),W(" injectEdgeLabelProxies",function(){D(te)}),W(" removeEmptyRanks",function(){l(te)}),W(" nestingGraph.cleanup",function(){u.cleanup(te)}),W(" normalizeRanks",function(){a(te)}),W(" assignRankMinMax",function(){F(te)}),W(" removeEdgeLabelProxies",function(){ee(te)}),W(" normalize.run",function(){n.run(te)}),W(" parentDummyChains",function(){o(te)}),W(" addBorderSegments",function(){d(te)}),W(" order",function(){p(te)}),W(" insertSelfEdges",function(){B(te)}),W(" adjustCoordinateSystem",function(){f.adjust(te)}),W(" position",function(){g(te)}),W(" positionSelfEdges",function(){U(te)}),W(" removeBorderNodes",function(){Z(te)}),W(" normalize.undo",function(){n.undo(te)}),W(" fixupEdgeLabelCoords",function(){K(te)}),W(" undoCoordinateSystem",function(){f.undo(te)}),W(" translateGraph",function(){H(te)}),W(" assignNodeIntersects",function(){P(te)}),W(" reversePoints",function(){V(te)}),W(" acyclic.undo",function(){t.undo(te)})}function _(te,W){e.forEach(te.nodes(),function($){var fe=te.node($),ae=W.node($);fe&&(fe.x=ae.x,fe.y=ae.y,W.children($).length&&(fe.width=ae.width,fe.height=ae.height))}),e.forEach(te.edges(),function($){var fe=te.edge($),ae=W.edge($);fe.points=ae.points,e.has(ae,"x")&&(fe.x=ae.x,fe.y=ae.y)}),te.graph().width=W.graph().width,te.graph().height=W.graph().height}var E=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],A=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],C={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},O=["labelpos"];function M(te){var W=new x({multigraph:!0,compound:!0}),$=q(te.graph());return W.setGraph(e.merge({},S,Y($,E),e.pick($,N))),e.forEach(te.nodes(),function(fe){var ae=q(te.node(fe));W.setNode(fe,e.defaults(Y(ae,A),T)),W.setParent(fe,te.parent(fe))}),e.forEach(te.edges(),function(fe){var ae=q(te.edge(fe));W.setEdge(fe,e.merge({},C,Y(ae,R),e.pick(ae,O)))}),W}function I(te){var W=te.graph();W.ranksep/=2,e.forEach(te.edges(),function($){var fe=te.edge($);fe.minlen*=2,fe.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?fe.width+=fe.labeloffset:fe.height+=fe.labeloffset)})}function D(te){e.forEach(te.edges(),function(W){var $=te.edge(W);if($.width&&$.height){var fe=te.node(W.v),ae=te.node(W.w),xe={rank:(ae.rank-fe.rank)/2+fe.rank,e:W};m.addDummyNode(te,"edge-proxy",xe,"_ep")}})}function F(te){var W=0;e.forEach(te.nodes(),function($){var fe=te.node($);fe.borderTop&&(fe.minRank=te.node(fe.borderTop).rank,fe.maxRank=te.node(fe.borderBottom).rank,W=e.max(W,fe.maxRank))}),te.graph().maxRank=W}function ee(te){e.forEach(te.nodes(),function(W){var $=te.node(W);$.dummy==="edge-proxy"&&(te.edge($.e).labelRank=$.rank,te.removeNode(W))})}function H(te){var W=Number.POSITIVE_INFINITY,$=0,fe=Number.POSITIVE_INFINITY,ae=0,xe=te.graph(),Ie=xe.marginx||0,ze=xe.marginy||0;function mt(ut){var $e=ut.x,qe=ut.y,Oe=ut.width,rt=ut.height;W=Math.min(W,$e-Oe/2),$=Math.max($,$e+Oe/2),fe=Math.min(fe,qe-rt/2),ae=Math.max(ae,qe+rt/2)}e.forEach(te.nodes(),function(ut){mt(te.node(ut))}),e.forEach(te.edges(),function(ut){var $e=te.edge(ut);e.has($e,"x")&&mt($e)}),W-=Ie,fe-=ze,e.forEach(te.nodes(),function(ut){var $e=te.node(ut);$e.x-=W,$e.y-=fe}),e.forEach(te.edges(),function(ut){var $e=te.edge(ut);e.forEach($e.points,function(qe){qe.x-=W,qe.y-=fe}),e.has($e,"x")&&($e.x-=W),e.has($e,"y")&&($e.y-=fe)}),xe.width=$-W+Ie,xe.height=ae-fe+ze}function P(te){e.forEach(te.edges(),function(W){var $=te.edge(W),fe=te.node(W.v),ae=te.node(W.w),xe,Ie;$.points?(xe=$.points[0],Ie=$.points[$.points.length-1]):($.points=[],xe=ae,Ie=fe),$.points.unshift(m.intersectRect(fe,xe)),$.points.push(m.intersectRect(ae,Ie))})}function K(te){e.forEach(te.edges(),function(W){var $=te.edge(W);if(e.has($,"x"))switch(($.labelpos==="l"||$.labelpos==="r")&&($.width-=$.labeloffset),$.labelpos){case"l":$.x-=$.width/2+$.labeloffset;break;case"r":$.x+=$.width/2+$.labeloffset;break}})}function V(te){e.forEach(te.edges(),function(W){var $=te.edge(W);$.reversed&&$.points.reverse()})}function Z(te){e.forEach(te.nodes(),function(W){if(te.children(W).length){var $=te.node(W),fe=te.node($.borderTop),ae=te.node($.borderBottom),xe=te.node(e.last($.borderLeft)),Ie=te.node(e.last($.borderRight));$.width=Math.abs(Ie.x-xe.x),$.height=Math.abs(ae.y-fe.y),$.x=xe.x+$.width/2,$.y=fe.y+$.height/2}}),e.forEach(te.nodes(),function(W){te.node(W).dummy==="border"&&te.removeNode(W)})}function le(te){e.forEach(te.edges(),function(W){if(W.v===W.w){var $=te.node(W.v);$.selfEdges||($.selfEdges=[]),$.selfEdges.push({e:W,label:te.edge(W)}),te.removeEdge(W)}})}function B(te){var W=m.buildLayerMatrix(te);e.forEach(W,function($){var fe=0;e.forEach($,function(ae,xe){var Ie=te.node(ae);Ie.order=xe+fe,e.forEach(Ie.selfEdges,function(ze){m.addDummyNode(te,"selfedge",{width:ze.label.width,height:ze.label.height,rank:Ie.rank,order:xe+ ++fe,e:ze.e,label:ze.label},"_se")}),delete Ie.selfEdges})})}function U(te){e.forEach(te.nodes(),function(W){var $=te.node(W);if($.dummy==="selfedge"){var fe=te.node($.e.v),ae=fe.x+fe.width/2,xe=fe.y,Ie=$.x-ae,ze=fe.height/2;te.setEdge($.e,$.label),te.removeNode(W),$.label.points=[{x:ae+2*Ie/3,y:xe-ze},{x:ae+5*Ie/6,y:xe-ze},{x:ae+Ie,y:xe},{x:ae+5*Ie/6,y:xe+ze},{x:ae+2*Ie/3,y:xe+ze}],$.label.x=$.x,$.label.y=$.y}})}function Y(te,W){return e.mapValues(e.pick(te,W),Number)}function q(te){var W={};return e.forEach(te,function($,fe){W[fe.toLowerCase()]=$}),W}return Cb}var jb,Uj;function g$(){if(Uj)return jb;Uj=1;var e=rr(),t=Ri(),n=Na().Graph;jb={debugOrdering:r};function r(a){var o=t.buildLayerMatrix(a),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.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(p,g){return l.setEdge(p,g,{style:"invis"}),g})}),l}return jb}var Tb,Hj;function m$(){return Hj||(Hj=1,Tb="0.8.5"),Tb}var Rb,$j;function x$(){return $j||($j=1,Rb={graphlib:Na(),layout:h$(),debug:g$(),util:{time:Ri().time,notime:Ri().notime},version:m$()}),Rb}var y$=x$();const Ff=$o(y$),b$={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"}},v$={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 k$(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function Wj(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function _$({todos:e,darkMode:t}){const n=Array.isArray(e)?e:[],[r,a]=y.useState(null),o=y.useRef(null),l=y.useRef(null),[u,d]=y.useState(400),[f,p]=y.useState(function(){if(typeof window<"u"){const F=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(F)&&F>.1)return F}return 1});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-zoom",String(f))},[f]);const[g,m]=y.useState(function(){return typeof window<"u"?localStorage.getItem("pave-map-show-completed")!=="false":!0});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-show-completed",g?"true":"false")},[g]);const[x,v]=y.useState(function(){if(typeof window<"u"){const F=localStorage.getItem("pave-map-rankdir");if(F==="LR"||F==="TB")return F}return"TB"});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-rankdir",x)},[x]);const k=y.useMemo(function(){if(g)return n;const F=n.filter(function(H){return H.status!=="completed"}),ee={};return F.forEach(function(H){ee[H.id]=!0}),F.map(function(H){if(!H.blockedBy||!H.blockedBy.length)return H;const P=H.blockedBy.filter(function(K){return ee[K]});return P.length===H.blockedBy.length?H:Object.assign({},H,{blockedBy:P})})},[n,g]);y.useEffect(function(){if(!o.current)return;function F(){o.current&&d(o.current.clientWidth||400)}F();const ee=new ResizeObserver(F);return ee.observe(o.current),function(){ee.disconnect()}},[]);const _=y.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const F=new Ff.graphlib.Graph;F.setGraph({rankdir:x,nodesep:24,ranksep:36,marginx:16,marginy:16}),F.setDefaultEdgeLabel(function(){return{}});const ee=180,H=56;k.forEach(function(V){F.setNode(String(V.id),{width:ee,height:H,todo:V})}),k.forEach(function(V){(V.blockedBy||[]).forEach(function(le){F.hasNode(String(le))&&F.setEdge(String(le),String(V.id))})}),Ff.layout(F);const P=F.nodes().map(function(V){const Z=F.node(V);return{id:V,x:Z.x-ee/2,y:Z.y-H/2,w:ee,h:H,todo:Z.todo}}),K=F.edges().map(function(V){const Z=F.edge(V);return{from:V.v,to:V.w,points:Z.points}});return{nodes:P,edges:K,width:F.graph().width||ee+32,height:F.graph().height||H+32}},[k,x]),E=t?v$:b$;if(!k.length){const F=n.length-k.length;return i.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[i.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:i.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})})}),F>0?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),i.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[F," completed ",F===1?"todo is":"todos are"," hidden."]}),i.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"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),i.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 ",i.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(F){if(!F||F.length<2)return"";let ee="M "+F[0].x+" "+F[0].y;for(let H=1;H<F.length;H++)ee+=" L "+F[H].x+" "+F[H].y;return ee}const N=n.reduce(function(F,ee){const H=Wj(ee);return F[H]=(F[H]||0)+1,F},{}),A=N.completed||0,T=Math.max(_.width,100),R=Math.max(_.height,100),O=(T>u-24?1:(u-24)/T)*f,M=T*O,I=R*O;function D(F){(F.ctrlKey||F.metaKey)&&(F.preventDefault(),p(function(ee){const H=F.deltaY<0?ee*1.1:ee/1.1;return Math.max(.25,Math.min(4,H))}))}return i.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[i.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{children:[n.length," total"]}),N.in_progress?i.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[N.in_progress," active"]}):null,A?i.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[A," done"]}):null,N.blocked?i.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[N.blocked," blocked"]}):null,i.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[i.jsx("button",{type:"button",onClick:function(){v(function(F){return F==="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:x==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:x==="TB"?"↓":"→"}),i.jsx("button",{type:"button",onClick:function(){p(function(F){return Math.max(.25,F/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:"−"}),i.jsxs("button",{type:"button",onClick:function(){p(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),"%"]}),i.jsx("button",{type:"button",onClick:function(){p(function(F){return Math.min(4,F*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?i.jsx("button",{type:"button",onClick:function(){m(function(F){return!F})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(g?"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:g?"Hide completed todos":"Show completed todos",children:g?"hide done":"show done"}):null]})]}),i.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:D,children:i.jsxs("svg",{viewBox:"0 0 "+T+" "+R,width:M,height:I,style:{display:"block"},children:[i.jsx("defs",{children:i.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),_.edges.map(function(F,ee){return i.jsx("path",{d:S(F.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+ee)}),_.nodes.map(function(F){const ee=Wj(F.todo),H=E[ee],P=ee==="in_progress",K=r===F.id;return i.jsxs("g",{transform:"translate("+F.x+","+F.y+")",onMouseEnter:function(){a(F.id)},onMouseLeave:function(){a(null)},style:{cursor:"pointer"},children:[i.jsx("rect",{width:F.w,height:F.h,rx:6,ry:6,fill:H.fill,stroke:H.stroke,strokeWidth:P||K?2:1.25,children:P?i.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),P?i.jsx("circle",{cx:10,cy:10,r:3.5,fill:H.stroke,children:i.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,i.jsx("text",{x:F.w/2,y:F.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:H.label,children:"#"+F.todo.id}),i.jsx("text",{x:F.w/2,y:F.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:k$(F.todo.text,26)}),K&&F.todo.text&&F.todo.text.length>26?i.jsx("title",{children:F.todo.text}):null]},F.id)})]})})]})}const w$={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"}},E$={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},S$={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},N$={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"}},C$={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},j$={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},T$={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},R$={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},zs={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function A$(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function I$(e,t){return e.kind==="thought"?t?R$:T$:e.status==="error"?t?j$:S$:(t?N$:w$)[e.tool]||(t?C$:E$)}function M$({graph:e,darkMode:t,onNodeClick:n}){const r=e&&Array.isArray(e.nodes)?e.nodes:[],a=e&&Array.isArray(e.edges)?e.edges:[],o=y.useRef(null),l=y.useRef(null),[u,d]=y.useState(null),[f,p]=y.useState(400),[g,m]=y.useState(function(){if(typeof window<"u"){const P=parseFloat(localStorage.getItem("pave-toolmap-zoom")||"");if(Number.isFinite(P)&&P>.1)return P}return 1});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-zoom",String(g))},[g]);const[x,v]=y.useState(function(){if(typeof window<"u"){const P=localStorage.getItem("pave-toolmap-rankdir");if(P==="LR"||P==="TB")return P}return"TB"});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-rankdir",x)},[x]);const[k,_]=y.useState(function(){return typeof window<"u"?localStorage.getItem("pave-toolmap-show-hidden")==="true":!1});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-hidden",k?"true":"false")},[k]);const[E,S]=y.useState(function(){return!(typeof window<"u"&&localStorage.getItem("pave-toolmap-show-thoughts")==="false")});y.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-thoughts",E?"true":"false")},[E]);const N=y.useMemo(function(){let P=r;return k||(P=P.filter(function(K){return!K.hidden})),E||(P=P.filter(function(K){return K.kind!=="thought"})),P},[r,k,E]),A=y.useMemo(function(){const P={};return N.forEach(function(K){P[K.id]=!0}),a.filter(function(K){return P[K.from]&&P[K.to]})},[a,N]),T=y.useMemo(function(){if(!N.length)return{nodes:[],edges:[],width:0,height:0};const P=new Ff.graphlib.Graph;P.setGraph({rankdir:x,nodesep:18,ranksep:32,marginx:14,marginy:14}),P.setDefaultEdgeLabel(function(){return{}});const K=168,V=44,Z=240,le=60;N.forEach(function(Y){Y.kind==="thought"?P.setNode(Y.id,{width:Z,height:le,node:Y}):P.setNode(Y.id,{width:K,height:V,node:Y})}),A.forEach(function(Y){P.hasNode(Y.from)&&P.hasNode(Y.to)&&P.setEdge(Y.from,Y.to,{kind:Y.kind})}),Ff.layout(P);const B=P.nodes().map(function(Y){const q=P.node(Y);return{id:Y,x:q.x-q.width/2,y:q.y-q.height/2,w:q.width,h:q.height,node:q.node}}),U=P.edges().map(function(Y){const q=P.edge(Y);return{from:Y.v,to:Y.w,points:q.points||[],kind:q.kind||"seq"}});return{nodes:B,edges:U,width:P.graph().width||K+28,height:P.graph().height||V+28}},[N,A,x]);y.useEffect(function(){if(!o.current)return;function P(){o.current&&p(o.current.clientWidth||400)}P();const K=new ResizeObserver(P);return K.observe(o.current),function(){K.disconnect()}},[]);const R=y.useMemo(function(){const P={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return r.forEach(function(K){if(K.kind==="thought"){P.thoughts++;return}P.total++,K.hidden&&P.hidden++,K.status==="error"?P.error++:K.status==="running"?P.running++:P.ok++}),P},[r]);if(!N.length)return i.jsxs("div",{ref:o,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[i.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:i.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})})}),i.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),i.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."}),R.hidden>0&&!k?i.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 ",R.hidden," hidden"]}):null]});function C(P){if(!P||P.length<2)return"";let K="M "+P[0].x+" "+P[0].y;for(let V=1;V<P.length;V++)K+=" L "+P[V].x+" "+P[V].y;return K}const O=Math.max(T.width,100),M=Math.max(T.height,100),D=(O>f-24?1:(f-24)/O)*g,F=O*D,ee=M*D;function H(P){(P.ctrlKey||P.metaKey)&&(P.preventDefault(),m(function(K){const V=P.deltaY<0?K*1.1:K/1.1;return Math.max(.25,Math.min(4,V))}))}return i.jsxs("div",{ref:o,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[i.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{children:[R.total," tools"]}),R.running?i.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[R.running," live"]}):null,R.error?i.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[R.error," err"]}):null,i.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[i.jsx("button",{type:"button",onClick:function(){v(function(P){return P==="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:x==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:x==="TB"?"↓":"→"}),i.jsx("button",{type:"button",onClick:function(){m(function(P){return Math.max(.25,P/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:"−"}),i.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(g*100),"%"]}),i.jsx("button",{type:"button",onClick:function(){m(function(P){return Math.min(4,P*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:"+"})]}),R.hidden>0?i.jsx("button",{type:"button",onClick:function(){_(function(P){return!P})},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,R.thoughts>0?i.jsx("button",{type:"button",onClick:function(){S(function(P){return!P})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(E?"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:E?"Hide reasoning bubbles":"Show reasoning bubbles ("+R.thoughts+" thoughts)",children:E?"💭 "+R.thoughts:"💭 off"}):null]})]}),i.jsx("div",{ref:l,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:H,children:i.jsxs("svg",{viewBox:"0 0 "+O+" "+M,width:F,height:ee,style:{display:"block"},children:[i.jsxs("defs",{children:[i.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?zs.data.dark:zs.data.light})}),i.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?zs.file.dark:zs.file.light})}),i.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?zs.seq.dark:zs.seq.light})})]}),T.edges.map(function(P,K){const V=t?zs[P.kind].dark:zs[P.kind].light;return i.jsx("path",{d:C(P.points),fill:"none",stroke:V,strokeWidth:P.kind==="data"?1.75:P.kind==="file"?1.25:1,strokeDasharray:P.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+P.kind+")"},"e"+K)}),T.nodes.map(function(P){const K=P.node,V=I$(K,t),Z=K.status==="running",le=u===P.id;if(K.kind==="thought"){const U=K.label||"",Y=32,q=3,te=U.split(/\s+/),W=[];let $="";for(const fe of te){if(W.length===q-1&&($+" "+fe).length>Y){W.push($);const ae=te.slice(te.indexOf(fe)).join(" ");W.push(ae.length>Y?ae.slice(0,Y-1)+"…":ae),$="";break}if(!$){$=fe;continue}if(($+" "+fe).length<=Y?$=$+" "+fe:(W.push($),$=fe),W.length>=q)break}return $&&W.length<q&&W.push($),i.jsxs("g",{transform:"translate("+P.x+","+P.y+")",onMouseEnter:function(){d(P.id)},onMouseLeave:function(){d(null)},onClick:function(){n&&n(K)},style:{cursor:n?"pointer":"default"},children:[i.jsx("rect",{width:P.w,height:P.h,rx:P.h/2,ry:P.h/2,fill:V.fill,stroke:V.stroke,strokeWidth:le?1.75:1,strokeDasharray:K.source==="reasoning"?void 0:"4,2"}),i.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:V.label,children:W.map(function(fe,ae){return i.jsx("tspan",{x:14,dy:ae===0?14:11,children:(ae===0?"💭 ":"")+fe},"ln"+ae)})}),i.jsx("title",{children:(K.source==="reasoning"?"[reasoning] ":"[thought] ")+(K.fullText||K.label)})]},P.id)}return i.jsxs("g",{transform:"translate("+P.x+","+P.y+")",onMouseEnter:function(){d(P.id)},onMouseLeave:function(){d(null)},onClick:function(){n&&n(K)},style:{cursor:n?"pointer":"default"},children:[i.jsx("rect",{width:P.w,height:P.h,rx:5,ry:5,fill:V.fill,stroke:V.stroke,strokeWidth:Z||le?2:1.25,opacity:K.hidden?.55:1,children:Z?i.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),i.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:V.label,children:K.tool}),i.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:A$(K.label,22)}),i.jsx("title",{children:K.tool+" · "+K.label+(K.status==="error"?" · ERROR":K.status==="running"?" · RUNNING":"")}),Z?i.jsxs("g",{transform:"translate("+(P.w-9)+",9)",children:[i.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:V.stroke,strokeWidth:.75}),i.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[i.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),i.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},P.id)})]})})]})}/*! @license DOMPurify 3.4.16 | (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.16/LICENSE */function Vj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function L$(e){if(Array.isArray(e))return e}function O$(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,o,l,u=[],d=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(d=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(p){f=!0,a=p}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw a}}return u}}function D$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
118
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function P$(e,t){return L$(e)||O$(e,t)||F$(e,t)||D$()}function F$(e,t){if(e){if(typeof e=="string")return Vj(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vj(e,t):void 0}}const vA=Object.entries,Gj=Object.setPrototypeOf,B$=Object.isFrozen,z$=Object.getPrototypeOf,q$=Object.getOwnPropertyDescriptor;let Fr=Object.freeze,Wr=Object.seal,Dl=Object.create,kA=typeof Reflect<"u"&&Reflect,Tv=kA.apply,Rv=kA.construct;Fr||(Fr=function(t){return t});Wr||(Wr=function(t){return t});Tv||(Tv=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];return t.apply(n,a)});Rv||(Rv=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const Oo=Nr(Array.prototype.forEach),U$=Nr(Array.prototype.lastIndexOf),Kj=Nr(Array.prototype.pop),nu=Nr(Array.prototype.push),H$=Nr(Array.prototype.splice),Ul=Array.isArray,fu=Nr(String.prototype.toLowerCase),Ab=Nr(String.prototype.toString),Yj=Nr(String.prototype.match),ru=Nr(String.prototype.replace),Qj=Nr(String.prototype.indexOf),$$=Nr(String.prototype.trim),W$=Nr(Number.prototype.toString),V$=Nr(Boolean.prototype.toString),Xj=typeof BigInt>"u"?null:Nr(BigInt.prototype.toString),Zj=typeof Symbol>"u"?null:Nr(Symbol.prototype.toString),Ti=Nr(Object.prototype.hasOwnProperty),iu=Nr(Object.prototype.toString),oi=Nr(RegExp.prototype.test),qs=G$(TypeError);function Nr(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return Tv(e,t,r)}}function G$(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Rv(e,n)}}function An(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fu;if(Gj&&Gj(e,null),!Ul(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const o=n(a);o!==a&&(B$(t)||(t[r]=o),a=o)}e[a]=!0}return e}function K$(e){for(let t=0;t<e.length;t++)Ti(e,t)||(e[t]=null);return e}function Ui(e){const t=Dl(null);for(const r of vA(e)){var n=P$(r,2);const a=n[0],o=n[1];Ti(e,a)&&(Ul(o)?t[a]=K$(o):o&&typeof o=="object"&&o.constructor===Object?t[a]=Ui(o):t[a]=o)}return t}function Y$(e){switch(typeof e){case"string":return e;case"number":return W$(e);case"boolean":return V$(e);case"bigint":return Xj?Xj(e):"0";case"symbol":return Zj?Zj(e):"Symbol()";case"undefined":return iu(e);case"function":case"object":{if(e===null)return iu(e);const t=e,n=ta(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:iu(r)}return iu(e)}default:return iu(e)}}function ta(e,t){for(;e!==null;){const r=q$(e,t);if(r){if(r.get)return Nr(r.get);if(typeof r.value=="function")return Nr(r.value)}e=z$(e)}function n(){return null}return n}function Q$(e){try{return oi(e,""),!0}catch{return!1}}const Jj=Fr(["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"]),Ib=Fr(["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"]),Mb=Fr(["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"]),X$=Fr(["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"]),Lb=Fr(["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"]),Z$=Fr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),eT=Fr(["#text"]),tT=Fr(["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"]),Ob=Fr(["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"]),nT=Fr(["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"]),df=Fr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),J$=Wr(/{{[\w\W]*|^[\w\W]*}}/g),eW=Wr(/<%[\w\W]*|^[\w\W]*%>/g),tW=Wr(/\${[\w\W]*/g),nW=Wr(/^data-[\-\w.\u00B7-\uFFFF]+$/),rW=Wr(/^aria-[\-\w]+$/),rT=Wr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iW=Wr(/^(?:\w+script|data):/i),aW=Wr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sW=Wr(/^html$/i),oW=Wr(/^[a-z][.\w]*(-[.\w]+)+$/i),iT=Wr(/<[/\w!]/g),aT=Wr(/<[/\w]/g),lW=Wr(/<\/no(script|embed|frames)/i),cW=Wr(/\/>/i),Bi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},_A=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],uW=Fr(An({},_A)),dW=(function(){const e={};return Oo(_A,t=>{e[t]=Wr(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),Fr(e)})(),fW=function(){return typeof window>"u"?null:window},pW=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const o="dompurify"+(r?"#"+r:"");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}},sT=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Us=function(t,n,r,a){return Ti(t,n)&&Ul(t[n])?An(a.base?Ui(a.base):{},t[n],a.transform):r},Db=function(t,n,r){const a=Ti(t,n)?t[n]:void 0;return a&&typeof a=="object"?Ui(a):r()};function wA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fW();const t=Ve=>wA(Ve);if(t.version="3.4.16",t.removed=[],!e||!e.document||e.document.nodeType!==Bi.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const o=e.HTMLTemplateElement,l=e.Node,u=e.Element,d=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const f=e.DOMParser,p=e.trustedTypes,g=u.prototype,m=ta(g,"cloneNode"),x=ta(g,"remove"),v=ta(g,"removeAttributeNode"),k=ta(g,"nextSibling"),_=ta(g,"childNodes"),E=ta(g,"parentNode"),S=ta(g,"shadowRoot"),N=ta(g,"attributes"),A=l&&l.prototype?ta(l.prototype,"nodeType"):null,T=l&&l.prototype?ta(l.prototype,"nodeName"):null,R=l&&l.prototype?ta(l.prototype,"ownerDocument"):null,C=function(G){return A?A(G):G.nodeType},O=function(G){return T?T(G):G.nodeName};if(typeof o=="function"){const Ve=n.createElement("template");Ve.content&&Ve.content.ownerDocument&&(n=Ve.content.ownerDocument)}let M,I="",D,F=!1,ee=0;const H=function(){if(ee>0)throw qs('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.')},P=function(G){H(),ee++;try{return M.createHTML(G)}finally{ee--}},K=function(G){H(),ee++;try{return M.createScriptURL(G)}finally{ee--}},V=function(){return F||(D=pW(p,a),F=!0),D},Z=n,le=Z.implementation,B=Z.createNodeIterator,U=Z.createDocumentFragment,Y=Z.getElementsByTagName,q=r.importNode;let te=sT();t.isSupported=typeof vA=="function"&&typeof E=="function"&&le&&le.createHTMLDocument!==void 0;const W=J$,$=eW,fe=tW,ae=nW,xe=rW,Ie=iW,ze=aW,mt=oW;let ut=rT,$e=null;const qe=An({},[...Jj,...Ib,...Mb,...Lb,...eT]);let Oe=null;const rt=An({},[...tT,...Ob,...nT,...df]);let ot=Object.seal(Dl(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}})),At=null,sn=null;const Xt=Object.seal(Dl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ht=!0,We=!0,De=!1,et=!0,nt=!1,de=!0,_e=!1,Ue=!1,ge=null,ft=null,ht=!1,vt=!1,pt=!1,Vt=!1,Gt=!0,Ze=!1;const qt="user-content-";let kt=!0,$t=!1,tn={},on=null;const Dn=An({},["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 ie=null;const Le=An({},["audio","video","img","source","image","track"]);let Je=null;const Ft=An({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fe="http://www.w3.org/1998/Math/MathML",it="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml";let Me=ve,Ye=!1,yt=null;const se=An({},[Fe,it,ve],Ab),Pe=Fr(["mi","mo","mn","ms","mtext"]);let He=An({},Pe);const wt=Fr(["annotation-xml"]);let Re=An({},wt);const Ke=An({},["title","style","font","a","script"]);let bt=null;const bn=["application/xhtml+xml","text/html"],dr="text/html";let Ot=null,hn=null;const Br=n.createElement("form"),ye=function(G){return G instanceof RegExp||G instanceof Function},tr=function(){let G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(hn&&hn===G)return;(!G||typeof G!="object")&&(G={}),G=Ui(G),bt=bn.indexOf(G.PARSER_MEDIA_TYPE)===-1?dr:G.PARSER_MEDIA_TYPE,Ot=bt==="application/xhtml+xml"?Ab:fu,$e=Us(G,"ALLOWED_TAGS",qe,{transform:Ot}),Oe=Us(G,"ALLOWED_ATTR",rt,{transform:Ot}),yt=Us(G,"ALLOWED_NAMESPACES",se,{transform:Ab}),Je=Us(G,"ADD_URI_SAFE_ATTR",Ft,{transform:Ot,base:Ft}),ie=Us(G,"ADD_DATA_URI_TAGS",Le,{transform:Ot,base:Le}),on=Us(G,"FORBID_CONTENTS",Dn,{transform:Ot}),At=Us(G,"FORBID_TAGS",Ui({}),{transform:Ot}),sn=Us(G,"FORBID_ATTR",Ui({}),{transform:Ot}),tn=Ti(G,"USE_PROFILES")?G.USE_PROFILES&&typeof G.USE_PROFILES=="object"?Ui(G.USE_PROFILES):G.USE_PROFILES:!1,Ht=G.ALLOW_ARIA_ATTR!==!1,We=G.ALLOW_DATA_ATTR!==!1,De=G.ALLOW_UNKNOWN_PROTOCOLS||!1,et=G.ALLOW_SELF_CLOSE_IN_ATTR!==!1,nt=G.SAFE_FOR_TEMPLATES||!1,de=G.SAFE_FOR_XML!==!1,_e=G.WHOLE_DOCUMENT||!1,vt=G.RETURN_DOM||!1,pt=G.RETURN_DOM_FRAGMENT||!1,Vt=G.RETURN_TRUSTED_TYPE||!1,ht=G.FORCE_BODY||!1,Gt=G.SANITIZE_DOM!==!1,Ze=G.SANITIZE_NAMED_PROPS||!1,kt=G.KEEP_CONTENT!==!1,$t=G.IN_PLACE||!1,ut=Q$(G.ALLOWED_URI_REGEXP)?G.ALLOWED_URI_REGEXP:rT,Me=typeof G.NAMESPACE=="string"?G.NAMESPACE:ve,He=Db(G,"MATHML_TEXT_INTEGRATION_POINTS",()=>An({},Pe)),Re=Db(G,"HTML_INTEGRATION_POINTS",()=>An({},wt));const ne=Db(G,"CUSTOM_ELEMENT_HANDLING",()=>Dl(null));if(ot=Dl(null),Ti(ne,"tagNameCheck")&&ye(ne.tagNameCheck)&&(ot.tagNameCheck=ne.tagNameCheck),Ti(ne,"attributeNameCheck")&&ye(ne.attributeNameCheck)&&(ot.attributeNameCheck=ne.attributeNameCheck),Ti(ne,"allowCustomizedBuiltInElements")&&typeof ne.allowCustomizedBuiltInElements=="boolean"&&(ot.allowCustomizedBuiltInElements=ne.allowCustomizedBuiltInElements),Wr(ot),nt&&(We=!1),pt&&(vt=!0),tn&&($e=An({},eT),Oe=Dl(null),tn.html===!0&&(An($e,Jj),An(Oe,tT)),tn.svg===!0&&(An($e,Ib),An(Oe,Ob),An(Oe,df)),tn.svgFilters===!0&&(An($e,Mb),An(Oe,Ob),An(Oe,df)),tn.mathMl===!0&&(An($e,Lb),An(Oe,nT),An(Oe,df))),Xt.tagCheck=null,Xt.attributeCheck=null,Ti(G,"ADD_TAGS")&&(typeof G.ADD_TAGS=="function"?Xt.tagCheck=G.ADD_TAGS:Ul(G.ADD_TAGS)&&($e===qe&&($e=Ui($e)),An($e,G.ADD_TAGS,Ot))),Ti(G,"ADD_ATTR")&&(typeof G.ADD_ATTR=="function"?Xt.attributeCheck=G.ADD_ATTR:Ul(G.ADD_ATTR)&&(Oe===rt&&(Oe=Ui(Oe)),An(Oe,G.ADD_ATTR,Ot))),Ti(G,"ADD_FORBID_CONTENTS")&&Ul(G.ADD_FORBID_CONTENTS)&&(on===Dn&&(on=Ui(on)),An(on,G.ADD_FORBID_CONTENTS,Ot)),kt&&($e["#text"]=!0),_e&&An($e,["html","head","body"]),$e.table&&(An($e,["tbody"]),delete At.tbody),G.TRUSTED_TYPES_POLICY){if(typeof G.TRUSTED_TYPES_POLICY.createHTML!="function")throw qs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof G.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const me=M;M=G.TRUSTED_TYPES_POLICY;try{I=P("")}catch(Ae){throw M=me,Ae}}else G.TRUSTED_TYPES_POLICY===null?(M=void 0,I=""):(M===void 0&&(M=V()),M&&typeof I=="string"&&(I=P("")));Fr&&Fr(G),hn=G},jr=An({},[...Ib,...Mb,...X$]),vi=An({},[...Lb,...Z$]),ja=function(G,ne,me){return ne.namespaceURI===ve?G==="svg":ne.namespaceURI===Fe?G==="svg"&&(me==="annotation-xml"||He[me]):!!jr[G]},Hn=function(G,ne,me){return ne.namespaceURI===ve?G==="math":ne.namespaceURI===it?G==="math"&&Re[me]:!!vi[G]},Zs=function(G,ne,me){return ne.namespaceURI===it&&!Re[me]||ne.namespaceURI===Fe&&!He[me]?!1:!vi[G]&&(Ke[G]||!jr[G])},fi=function(G){let ne=E(G);(!ne||!ne.tagName)&&(ne={namespaceURI:Me,tagName:"template"});const me=fu(G.tagName),Ae=fu(ne.tagName);return yt[G.namespaceURI]?G.namespaceURI===it?ja(me,ne,Ae):G.namespaceURI===Fe?Hn(me,ne,Ae):G.namespaceURI===ve?Zs(me,ne,Ae):!!(bt==="application/xhtml+xml"&&yt[G.namespaceURI]):!1},Tr=function(G){nu(t.removed,{element:G});try{E(G).removeChild(G)}catch{if(x(G),!E(G))throw qs("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},oa=function(G,ne,me){try{v(G,ne)}catch{try{G.removeAttribute(me)}catch{}}},je=function(G){cn(G);const ne=_(G);if(ne){const Ae=[];Oo(ne,at=>{nu(Ae,at)}),Oo(Ae,at=>{try{x(at)}catch{}})}const me=N(G);if(me)for(let Ae=me.length-1;Ae>=0;--Ae){const at=me[Ae],St=at&&at.name;typeof St=="string"&&oa(G,at,St)}},gt=function(G,ne,me){if(!me)try{me=ne.getAttributeNode(G)}catch{me=null}nu(t.removed,{attribute:me||null,from:ne});try{me?v(ne,me):ne.removeAttribute(G)}catch{try{ne.removeAttribute(G)}catch{}}if(G==="is")if(vt||pt)try{Tr(ne)}catch{}else try{ne.setAttribute(G,"")}catch{}},Mt=function(G){const ne=N(G);if(ne)for(let me=ne.length-1;me>=0;--me){const Ae=ne[me],at=Ae&&Ae.name;typeof at!="string"||Oe[Ot(at)]||oa(G,Ae,at)}},cn=function(G){const ne=[G];for(;ne.length>0;){const me=ne.pop();C(me)===Bi.element&&Mt(me);const Ae=_(me);if(Ae)for(let at=Ae.length-1;at>=0;--at)ne.push(Ae[at])}},Fn=function(G,ne){return de?G==="patchsrc"?!0:G==="for"&&ne!=="label"&&ne!=="output":!1},zn=function(G){if(!de)return;const ne=[G];for(;ne.length>0;){const me=ne.pop(),Ae=C(me);if(Ae===Bi.processingInstruction||Ae===Bi.comment&&oi(aT,me.data)){try{x(me)}catch{}continue}if(Ae===Bi.element){const St=me,Dt=Ot(O(me));try{St.hasAttribute&&St.hasAttribute("patchsrc")&&St.removeAttribute("patchsrc"),St.hasAttribute&&St.hasAttribute("for")&&Fn("for",Dt)&&St.removeAttribute("for")}catch{}}const at=_(me);if(at)for(let St=at.length-1;St>=0;--St)ne.push(at[St])}},Rr=function(G){let ne=null,me=null;if(ht)G="<remove></remove>"+G;else{const St=Yj(G,/^[\r\n\t ]+/);me=St&&St[0]}bt==="application/xhtml+xml"&&Me===ve&&(G='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+G+"</body></html>");const Ae=M?P(G):G;if(Me===ve)try{ne=new f().parseFromString(Ae,bt)}catch{}if(!ne||!ne.documentElement){ne=le.createDocument(Me,"template",null);try{ne.documentElement.innerHTML=Ye?I:Ae}catch{}}const at=ne.body||ne.documentElement;return G&&me&&at.insertBefore(n.createTextNode(me),at.childNodes[0]||null),Me===ve?Y.call(ne,_e?"html":"body")[0]:_e?ne.documentElement:at},Vi=function(G){const ne=R?R(G):G.ownerDocument;return B.call(ne||G,G,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Kn=function(G){return G=ru(G,W," "),G=ru(G,$," "),G=ru(G,fe," "),G},lr=function(G){var ne;G.normalize();const me=R?R(G):G.ownerDocument,Ae=B.call(me||G,G,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let at=Ae.nextNode();for(;at;)at.data=Kn(at.data),at=Ae.nextNode();const St=(ne=G.querySelectorAll)===null||ne===void 0?void 0:ne.call(G,"template");St&&Oo(St,Dt=>{fr(Dt.content)&&lr(Dt.content)})},Vr=function(G){const ne=T?T(G):null;return typeof ne!="string"||Ot(ne)!=="form"?!1:typeof G.nodeName!="string"||typeof G.textContent!="string"||typeof G.removeChild!="function"||G.attributes!==N(G)||typeof G.removeAttribute!="function"||typeof G.removeAttributeNode!="function"||typeof G.getAttributeNode!="function"||typeof G.setAttribute!="function"||typeof G.namespaceURI!="string"||typeof G.insertBefore!="function"||typeof G.hasChildNodes!="function"||G.nodeType!==A(G)||G.childNodes!==_(G)},fr=function(G){if(!A||typeof G!="object"||G===null)return!1;try{return A(G)===Bi.documentFragment}catch{return!1}},yr=function(G){if(!A||typeof G!="object"||G===null)return!1;try{return typeof A(G)=="number"}catch{return!1}};function br(Ve,G,ne){Ve.length!==0&&Oo(Ve,me=>{me.call(t,G,ne,hn)})}const Gi=function(G,ne){return!!(de&&G.hasChildNodes()&&!yr(G.firstElementChild)&&oi(iT,G.textContent)&&oi(iT,G.innerHTML)||de&&G.namespaceURI===ve&&uW[ne]&&(yr(G.firstElementChild)||typeof G.textContent=="string"&&oi(dW[ne],G.textContent))||G.nodeType===Bi.processingInstruction||de&&G.nodeType===Bi.comment&&oi(aT,G.data))},Ii=function(G,ne){if(G instanceof RegExp)return oi(G,ne);if(G instanceof Function){for(var me=arguments.length,Ae=new Array(me>2?me-2:0),at=2;at<me;at++)Ae[at-2]=arguments[at];return!!G(ne,...Ae)}return!1},la=function(G,ne,me){if(!At[ne]&&Wt(ne)&&Ii(ot.tagNameCheck,ne))return!1;if(kt&&!on[ne]){const Ae=E(G),at=_(G);if(at&&Ae){const St=at.length;for(let Dt=St-1;Dt>=0;--Dt){const Nn=G===me?m(at[Dt],!0):at[Dt];Ae.insertBefore(Nn,k(G))}}}return Tr(G),!0},pi=function(G,ne,me,Ae){return G.length===0?ne:ne===me||ne===Ae?Ui(ne):ne},vr=function(G,ne){return G===ne||E(G)!==null?!1:($t&&cn(G),!0)},zr=function(G,ne){if(br(te.beforeSanitizeElements,G,null),vr(G,ne))return!0;if(Vr(G))return Tr(G),!0;const me=Ot(O(G));if($e=pi(te.uponSanitizeElement,$e,qe,ge),br(te.uponSanitizeElement,G,{tagName:me,allowedTags:$e}),vr(G,ne))return!0;if(Gi(G,me))return Tr(G),!0;if(At[me]||!(Xt.tagCheck instanceof Function&&Xt.tagCheck(me))&&!$e[me]){const Ae=la(G,me,ne);return Ae===!1&&(br(te.afterSanitizeElements,G,null),vr(G,ne))?!0:Ae}if(C(G)===Bi.element&&!fi(G)||(me==="noscript"||me==="noembed"||me==="noframes")&&oi(lW,G.innerHTML))return Tr(G),!0;if(nt&&G.nodeType===Bi.text){const Ae=Kn(G.textContent);G.textContent!==Ae&&(nu(t.removed,{element:G.cloneNode()}),G.textContent=Ae)}return br(te.afterSanitizeElements,G,null),vr(G,ne)},ei=function(G,ne,me){if(sn[ne]||Fn(ne,G)||Gt&&(ne==="id"||ne==="name")&&(me in n||me in Br))return!1;const Ae=Oe[ne]||Xt.attributeCheck instanceof Function&&Xt.attributeCheck(ne,G);return We&&oi(ae,ne)||Ht&&oi(xe,ne)?!0:Ae?Je[ne]||oi(ut,ru(me,ze,""))||(ne==="src"||ne==="xlink:href"||ne==="href")&&G!=="script"&&Qj(me,"data:")===0&&ie[G]||De&&!oi(Ie,ru(me,ze,""))?!0:!me:Wt(G)&&Ii(ot.tagNameCheck,G)&&Ii(ot.attributeNameCheck,ne,G)||ne==="is"&&ot.allowCustomizedBuiltInElements&&Ii(ot.tagNameCheck,me)},un=An({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Wt=function(G){return!un[fu(G)]&&oi(mt,G)},Ar=function(G,ne,me,Ae){if(M&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!me)switch(p.getAttributeType(G,ne)){case"TrustedHTML":return P(Ae);case"TrustedScriptURL":return K(Ae)}return Ae},Qn=function(G,ne,me,Ae){try{return me?G.setAttributeNS(me,ne,Ae):G.setAttribute(ne,Ae),Vr(G)?(Tr(G),!1):!0}catch{return gt(ne,G),!1}},xn=function(G,ne){if(br(te.beforeSanitizeAttributes,G,null),vr(G,ne))return;const me=G.attributes;if(!me||Vr(G))return;Oe=pi(te.uponSanitizeAttribute,Oe,rt,ft);const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Oe,forceKeepAttr:void 0};let at=me.length;const St=Ot(G.nodeName);for(;at--;){const Dt=me[at],Nn=Dt.name,Ir=Dt.namespaceURI,ir=Dt.value,Ta=Ot(Nn),ca=ir;let cr=Nn==="value"?ca:$$(ca),hs=!1;if(Ae.attrName=Ta,Ae.attrValue=cr,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,br(te.uponSanitizeAttribute,G,Ae),cr=Ae.attrValue,Ze&&(Ta==="id"||Ta==="name")&&Qj(cr,qt)!==0&&(gt(Nn,G,Dt),cr=qt+cr,hs=!0),de&&oi(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,cr)){gt(Nn,G,Dt);continue}if(Ta==="attributename"&&Yj(cr,"href")){gt(Nn,G,Dt);continue}if(!Ae.forceKeepAttr){if(!Ae.keepAttr){gt(Nn,G,Dt);continue}if(!et&&oi(cW,cr)){gt(Nn,G,Dt);continue}if(nt&&(cr=Kn(cr)),!ei(St,Ta,cr)){gt(Nn,G,Dt);continue}cr=Ar(St,Ta,Ir,cr),cr!==ca&&Qn(G,Nn,Ir,cr)&&hs&&Kj(t.removed)}}br(te.afterSanitizeAttributes,G,null),vr(G,ne)},Gr=function(G){let ne=null;const me=Vi(G);for(br(te.beforeSanitizeShadowDOM,G,null);ne=me.nextNode();)if(br(te.uponSanitizeShadowNode,ne,null),zr(ne,G),xn(ne,G),fr(ne.content)&&Gr(ne.content),C(ne)===Bi.element){const Ae=S(ne);fr(Ae)&&(Kr(Ae),Gr(Ae))}br(te.afterSanitizeShadowDOM,G,null)},Kr=function(G){const ne=[{node:G,shadow:null}];for(;ne.length>0;){const me=ne.pop();if(me.shadow){Gr(me.shadow);continue}const Ae=me.node,at=C(Ae)===Bi.element,St=_(Ae);if(St)for(let Dt=St.length-1;Dt>=0;--Dt)ne.push({node:St[Dt],shadow:null});if(at){const Dt=T?T(Ae):null;if(typeof Dt=="string"&&Ot(Dt)==="template"){const Nn=Ae.content;fr(Nn)&&ne.push({node:Nn,shadow:null})}}if(at){const Dt=S(Ae);fr(Dt)&&ne.push({node:null,shadow:Dt},{node:Dt,shadow:null})}}};return t.sanitize=function(Ve){let G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne=null,me=null,Ae=null,at=null;if(Ye=!Ve,Ye&&(Ve="<!-->"),typeof Ve!="string"&&!yr(Ve)&&(Ve=Y$(Ve),typeof Ve!="string"))throw qs("dirty is not a string, aborting");if(!t.isSupported)return Ve;Ue?($e=ge,Oe=ft):tr(G),(te.uponSanitizeElement.length>0||te.uponSanitizeAttribute.length>0)&&($e=Ui($e)),te.uponSanitizeAttribute.length>0&&(Oe=Ui(Oe)),t.removed=[];const St=$t&&typeof Ve!="string"&&yr(Ve);if(St){zn(Ve);const Ir=O(Ve);if(typeof Ir=="string"){const ir=Ot(Ir);if(!$e[ir]||At[ir])throw je(Ve),qs("root node is forbidden and cannot be sanitized in-place")}if(Vr(Ve))throw je(Ve),qs("root node is clobbered and cannot be sanitized in-place");try{Kr(Ve)}catch(ir){throw je(Ve),ir}}else if(yr(Ve))ne=Rr("<!---->"),me=ne.ownerDocument.importNode(Ve,!0),me.nodeType===Bi.element&&me.nodeName==="BODY"||me.nodeName==="HTML"?ne=me:ne.appendChild(me),Kr(ne);else{if(!vt&&!nt&&!_e&&Ve.indexOf("<")===-1)return M&&Vt?P(Ve):Ve;if(ne=Rr(Ve),!ne)return vt?null:Vt?I:""}ne&&ht&&Tr(ne.firstChild);const Dt=St?Ve:ne;try{const Ir=Vi(Dt);for(;Ae=Ir.nextNode();)zr(Ae,Dt),xn(Ae,Dt),fr(Ae.content)&&Gr(Ae.content)}catch(Ir){throw St&&(je(Ve),Oo(t.removed,ir=>{ir.element&&cn(ir.element)})),Ir}if(St){let Ir=!1;if(Oo(t.removed,ir=>{ir.element&&(ir.element===Ve&&(Ir=!0),cn(ir.element))}),Ir)throw qs("a node selected for removal could not be safely returned; refusing to sanitize in place");return nt&&lr(Ve),Ve}if(vt){if(nt&&lr(ne),pt)for(at=U.call(ne.ownerDocument);ne.firstChild;)at.appendChild(ne.firstChild);else at=ne;return(Oe.shadowroot||Oe.shadowrootmode)&&(at=q.call(r,at,!0)),at}let Nn=_e?ne.outerHTML:ne.innerHTML;return _e&&$e["!doctype"]&&ne.ownerDocument&&ne.ownerDocument.doctype&&ne.ownerDocument.doctype.name&&oi(sW,ne.ownerDocument.doctype.name)&&(Nn="<!DOCTYPE "+ne.ownerDocument.doctype.name+`>
|
|
119
|
-
`+Nn),nt&&(Nn=Kn(Nn)),M&&Vt?P(Nn):Nn},t.setConfig=function(){let Ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tr(Ve),Ue=!0,ge=$e,ft=Oe},t.clearConfig=function(){hn=null,Ue=!1,ge=null,ft=null,M=D,I=""},t.isValidAttribute=function(Ve,G,ne){hn||tr({});const me=Ot(Ve),Ae=Ot(G);return ei(me,Ae,ne)},t.addHook=function(Ve,G){typeof G=="function"&&Ti(te,Ve)&&nu(te[Ve],G)},t.removeHook=function(Ve,G){if(Ti(te,Ve)){if(G!==void 0){const ne=U$(te[Ve],G);return ne===-1?void 0:H$(te[Ve],ne,1)[0]}return Kj(te[Ve])}},t.removeHooks=function(Ve){Ti(te,Ve)&&(te[Ve]=[])},t.removeAllHooks=function(){te=sT()},t}var hW=wA();let Pb=null;function gW(){return Pb||(Pb=YT(()=>import("./mermaid.core-BTzzDYtC.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})),Pb}function oT(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let lT=0;function mW(){return lT+=1,"pave-canvas-"+lT}function xW({source:e}){const t=y.useRef(null),n=y.useRef(mW()),[r,a]=y.useState(null),[o,l]=y.useState(oT());return y.useEffect(function(){if(typeof window>"u")return;const u=new MutationObserver(function(){const d=oT();l(function(f){return f!==d?d:f})});return u.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),function(){u.disconnect()}},[]),y.useEffect(function(){let u=!1;return a(null),gW().then(function(d){u||(d.initialize({startOnLoad:!1,securityLevel:"strict",theme:o?"dark":"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),d.render(n.current,e).then(function(f){if(!u&&t.current){let p=f.svg;p=p.replace(/<svg([^>]*)\sstyle="[^"]*max-width:[^";]*;?[^"]*"/i,"<svg$1"),p=p.replace(/(<svg[^>]*)\swidth="[^"]*"/i,"$1"),p=p.replace(/(<svg[^>]*)\sheight="[^"]*"/i,"$1"),p=p.replace(/<svg\b/i,'<svg width="100%" height="100%" preserveAspectRatio="xMidYMid meet"'),t.current.innerHTML=p}}).catch(function(f){u||a(f&&f.message||String(f))}))}).catch(function(d){u||a("Failed to load mermaid: "+(d&&d.message||String(d)))}),function(){u=!0}},[e,o]),r?i.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[i.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),i.jsx("pre",{className:"whitespace-pre-wrap",children:r}),i.jsxs("details",{className:"mt-2",children:[i.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),i.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):i.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 yW({source:e}){const t=y.useMemo(function(){return hW.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return i.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function bW({source:e}){return i.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function vW({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=i.jsx(xW,{source:e.source}):e.type==="svg"?t=i.jsx(yW,{source:e.source}):e.type==="katex"?t=i.jsx(bW,{source:e.source}):t=i.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function cT({canvases:e,onClear:t}){const n=Array.isArray(e)?e:[],[r,a]=y.useState(Math.max(0,n.length-1)),[o,l]=y.useState(1),[u,d]=y.useState(!1);y.useEffect(function(){a(function(_){return _>=n.length-2?Math.max(0,n.length-1):Math.min(_,Math.max(0,n.length-1))})},[n.length]),y.useEffect(function(){l(1)},[r]),y.useEffect(function(){if(!u)return;const _=E=>{E.key==="Escape"&&d(!1)};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[u]);const f=y.useCallback(()=>l(_=>Math.min(4,+(_+.25).toFixed(2))),[]),p=y.useCallback(()=>l(_=>Math.max(.5,+(_-.25).toFixed(2))),[]),g=y.useCallback(()=>l(1),[]);if(n.length===0)return i.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[i.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:i.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"})}),i.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 ",i.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,r),n.length-1),x=n[m],v=i.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:[n.length>1?i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:()=>a(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:"←"}),i.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[m+1,"/",n.length]}),i.jsx("button",{type:"button",onClick:()=>a(Math.min(n.length-1,m+1)),disabled:m===n.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:"→"})]}):i.jsx("div",{}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:p,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:"−"}),i.jsxs("button",{type:"button",onClick:g,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),"%"]}),i.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:"+"}),i.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?i.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=i.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[x.title?i.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:x.title}):null,i.jsx("div",{style:{transform:`scale(${o})`,transformOrigin:"top left",width:o===1?"100%":`${100/o}%`},children:i.jsx(vW,{canvas:x})}),x.caption?i.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:x.caption}):null]});return u?i.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[v,k]}):i.jsxs("div",{className:"h-full flex flex-col",children:[v,k]})}function kW(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function _W(e,t){const n=kW(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}function wW(e){const{serverContextLimit:t,registryLimitMap:n={},limitModelID:r,effectiveActiveModel:a,modelLimits:o={},defaultLimit:l}=e||{};return t||n[r]||n[a]||o[r]||l}function uT(e,t,n,r){if(typeof t!="string"||!t)return;const a=t.includes("/")?t.split("/").pop():t,o=a&&a!==t?[t,a]:[t];for(let l=0;l<o.length;l+=1)(r||!Object.prototype.hasOwnProperty.call(e,o[l]))&&(e[o[l]]=n)}function EW(e){const t={};if(!Array.isArray(e))return t;for(let n=0;n<e.length;n+=1){const r=e[n],a=r&&r.limit?r.limit.context:null;typeof a!="number"||a<=0||(uT(t,r.key,a,!0),uT(t,r.target,a,!1))}return t}const SW={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function NW(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function CW(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}function jW({isBusy:e,isCompacting:t}={}){return e?t?"compacting":"generating":"idle"}const TW=3,dT=4,RW=4,AW=1024;function IW(e){if(typeof e!="string"||e.length===0)return 0;let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=57343?(t+=4,n++):t+=3}return t}function fT(e){if(typeof e=="string")return e;if(e==null)return"";try{return JSON.stringify(e)}catch{return""}}function au(e){return Math.ceil(IW(e)/TW)}function MW(e){if(!Array.isArray(e))return 0;let t=0;for(const n of e){if(!n)continue;const r=Array.isArray(n.parts)?n.parts:[];let a=0,o=!1;for(const l of r){if(!l)continue;const u=l.type;if(u==="text"||u==="error"||u==="file"){const d=typeof l.text=="string"?l.text:typeof l.content=="string"?l.content:"";d&&(a+=au(d),o=!0)}else if(u==="reasoning"){const d=typeof l.text=="string"?l.text:typeof l.content=="string"?l.content:"";d&&(a+=au(d),o=!0)}else if(u==="image_url"||l.image_url)a+=AW,o=!0;else if(u==="tool"){const d=l.state||{},f=typeof l.tool=="string"?l.tool:"";a+=RW+dT,f&&(a+=au(f)),d.input!=null&&(a+=au(fT(d.input))),d.output!=null&&(a+=au(fT(d.output))),o=!0}}o&&(t+=a+dT)}return t}const LW={"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},OW=128e3;function ff(e){const[t,n]=y.useState(e),r=y.useRef(e),a=y.useRef(0),o=y.useRef(0);return y.useEffect(()=>{if(e===r.current)return;a.current=0,r.current=t;const l=400,u=t,d=e,f=p=>{a.current||(a.current=p);const g=p-a.current,m=Math.min(g/l,1),x=1-(1-m)**3;n(Math.round(u+(d-u)*x)),m<1?o.current=requestAnimationFrame(f):n(d)};return o.current=requestAnimationFrame(f),()=>cancelAnimationFrame(o.current)},[e]),t}function DW({messages:e,isBusy:t,isCompacting:n,activeModel:r,sessionModel:a,isPrivateMode:o,registryEntries:l}){var q,te;var{t:u}=rn();const d=e.filter(W=>{var $;return(($=W.info)==null?void 0:$.role)==="user"}).length,f=e.filter(W=>{var $;return(($=W.info)==null?void 0:$.role)==="assistant"}).length,p=y.useMemo(()=>MW(e),[e]);let g=0,m=0,x=0,v=null,k=null;for(let W=e.length-1;W>=0;W--){const $=e[W];if(((q=$.info)==null?void 0:q.role)==="assistant"&&((te=$.info)==null?void 0:te.mode)!=="compaction"){const fe=$.info.tokens;if(fe&&(fe.input||fe.output)){!v&&$.info.modelID&&(v=$.info.modelID),g=fe.lastInput??fe.input??0,m=fe.lastOutput??fe.output??0,x=fe.lastReasoning??fe.reasoning??0,$.info.contextLimit&&(k=$.info.contextLimit);break}}}const _=ff(p),E=ff(g),S=ff(m),N=ff(x),A=E+S+N,T=p>0||g+m+x>0;let R=r;typeof a=="string"&&a?R=a:a&&a.providerID&&a.modelID&&(R=a.providerID+"/"+a.modelID);let{modelID:C,activeModelID:O}=_W(R,v),M=null;if(o){C="privacy",O="privacy";let W=null;typeof a=="string"&&a?W=a.includes("/")?a.split("/").pop():a:a&&a.modelID&&(W=a.modelID),M=W||(r?String(r).split("/").pop():null)}else v&&O&&v!==O&&(M=v);const I=y.useMemo(()=>EW(l),[l]),F=wW({serverContextLimit:k,registryLimitMap:I,limitModelID:v||C,effectiveActiveModel:R,modelLimits:LW,defaultLimit:OW}),ee=Math.min(100,Math.round(_/F*100));let H="bg-green-500";ee>=90?H="bg-red-500":ee>=75?H="bg-orange-500":ee>=50&&(H="bg-yellow-500");const P="border-gray-200 dark:border-gray-800",K="text-gray-500 dark:text-gray-400",V="text-gray-500 dark:text-gray-400",Z="text-gray-700 dark:text-gray-300",le="border-gray-100 dark:border-gray-800";return i.jsxs("div",{className:`p-4 border-t ${P}`,children:[i.jsx("p",{className:`text-xs ${K} uppercase tracking-wide font-medium mb-3`,children:u("token_usage.session_info")}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${V}`,children:u("token_usage.messages")}),i.jsx("span",{className:`text-xs font-medium ${Z}`,children:d+f})]}),C&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${V}`,children:u("token_usage.model")}),i.jsx("span",{className:`text-xs font-medium ${Z} truncate ml-2 max-w-[140px]`,children:pT(C)})]}),M&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${V}`,children:u("token_usage.originally")}),i.jsx("span",{className:`text-xs ${V} truncate ml-2 max-w-[140px]`,children:pT(M)})]}),(()=>{const W=jW({isBusy:t,isCompacting:n}),$=W==="compacting"?"bg-amber-400 animate-pulse":W==="generating"?"bg-accent-400 animate-pulse":"bg-green-500",fe=u(W==="compacting"?"token_usage.compacting":W==="generating"?"token_usage.generating":"token_usage.idle");return i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${V}`,children:u("token_usage.status")}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${$}`}),i.jsx("span",{className:`text-xs font-medium ${Z}`,children:fe})]})]})})(),T?i.jsx(i.Fragment,{children:i.jsxs("div",{className:`border-t ${le} pt-2 mt-2`,children:[i.jsxs("div",{className:"mb-2",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsxs("span",{className:`text-xs ${V}`,title:"Conversation text measured in the browser (bytes ÷ 3 + per-entry envelopes). Excludes the system prompt and tool schemas, so it reads below the true wire.",children:["Context ",i.jsx("span",{className:"opacity-70",children:"est"})]}),i.jsxs("span",{className:`text-xs ${V}`,children:[ee,"% of ",(F/1e3).toFixed(0),"k"]})]}),i.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full ${H} transition-all duration-300`,style:{width:`${ee}%`}})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${V}`,children:"Input"}),i.jsx("span",{className:`text-xs font-medium ${Z} tabular-nums`,children:E.toLocaleString()})]}),i.jsxs("div",{className:"flex items-center justify-between mt-1",children:[i.jsx("span",{className:`text-xs ${V}`,children:"Output"}),i.jsx("span",{className:`text-xs font-medium ${Z} tabular-nums`,children:S.toLocaleString()})]}),x>0&&i.jsxs("div",{className:"flex items-center justify-between mt-1",children:[i.jsx("span",{className:`text-xs ${V}`,children:"Reasoning"}),i.jsx("span",{className:`text-xs font-medium ${Z} tabular-nums`,children:N.toLocaleString()})]}),i.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${le}`,children:[i.jsxs("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",title:"Measured prompt_tokens recorded for the PREVIOUS request — a lower bound, not the current window size.",children:["Total ",i.jsx("span",{className:"opacity-70",children:"measured"})]}),i.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:A.toLocaleString()})]})]})}):i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:`text-xs ${V}`,children:"Tokens"}),i.jsx("span",{className:`text-xs ${V}`,children:"--"})]})]})]})}function pT(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 PW({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:a,lockedReason:o}){const{t:l}=rn(),[u,d]=y.useState(!1),f=y.useRef(null),[p,g]=y.useState(-1),m=y.useRef([]);y.useEffect(()=>{if(!u)return;function S(N){f.current&&!f.current.contains(N.target)&&d(!1)}return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[u]),y.useEffect(()=>{if(!u)return;function S(N){if(N.key==="Escape"){d(!1);return}N.key!=="ArrowDown"&&N.key!=="ArrowUp"&&N.key!=="Home"&&N.key!=="End"||(N.preventDefault(),g(A=>{const T=m.current.length;if(!T)return A;const R=typeof A=="number"?A:-1;let C=R;return N.key==="ArrowDown"?C=R<T-1?R+1:0:N.key==="ArrowUp"?C=R>0?R-1:T-1:N.key==="Home"?C=0:N.key==="End"&&(C=T-1),m.current[C]&&m.current[C].focus(),C}))}return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[u]);const x=typeof e=="string"&&e.trim()?e.trim():null,v=x!=null,k=Array.isArray(n)?n:[],_=FW(x,t,k,l),E=y.useCallback(S=>{r(S===t||x&&x===S?null:S),d(!1)},[x,t,r]);return m.current.length=k.length,i.jsxs("div",{className:"relative",ref:f,children:[i.jsxs("button",{type:"button",onClick:()=>d(S=>!S),disabled:a,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")+(a?" 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?i.jsxs("svg",{className:"w-3.5 h-3.5 shrink-0 text-emerald-600 dark:text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.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"}),i.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):i.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.jsx("span",{className:"max-w-[120px] truncate",children:_}),i.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),u&&i.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&&i.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,N)=>{const A=x===S.key,T=!!t&&(S.key===t||S.target===t||S.url===t),R=S.builtin?S.key:S.displayName||S.key;return i.jsxs("button",{type:"button",ref:C=>{m.current[N]=C},tabIndex:p===N?0:-1,role:"menuitemradio","aria-checked":A||!v&&T,onClick:()=>E(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:[i.jsx("span",{className:"font-medium",children:R}),T&&i.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",l("model_selector.default_label"),")"]})]},S.key)})]})]})}function FW(e,t,n,r){return e?hT(e,n):t?hT(t,n):r("model_selector.default_label")}function BW(e,t){if(!e||!Array.isArray(t))return null;for(let n=0;n<t.length;n++){const r=t[n];if(r&&(r.key===e||r.target===e||r.url===e))return r}return null}function hT(e,t){if(!e)return"";const n=BW(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function zW(e){e.sessionId;var t=e.disabledSkills,n=e.onToggle,r=e.onResetToDefaults,a=e.t,o=e.disabled,l=y.useState(!1),u=l[0],d=l[1],f=y.useState([]),p=f[0],g=f[1],m=y.useState(!1),x=m[0],v=m[1],k=y.useRef(null),_=t instanceof Array?new Set(t):new Set,E=y.useCallback(async function(){v(!0);try{var T=await Dv();g(T||[])}catch{}finally{v(!1)}},[]);y.useEffect(function(){E()},[E]),y.useEffect(function(){if(!u)return;function T(R){k.current&&!k.current.contains(R.target)&&d(!1)}return document.addEventListener("mousedown",T),function(){document.removeEventListener("mousedown",T)}},[u]);var S=p.filter(function(T){return _.has(T.name)}).length,N=Math.max(0,p.length-S),A=S;return i.jsxs("div",{className:"relative",ref:k,children:[i.jsxs("button",{onClick:function(){d(!u)},disabled:o,className:"p-1.5 rounded-lg transition-colors "+(A>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:a("skills.toggle_title"),"aria-label":a("skills.toggle_title"),children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),N>0&&i.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:N})]}),u&&i.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:[i.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[i.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:a("skills.toggle_header")}),i.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:a("skills.toggle_hint")})]}),x?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):p.length===0?i.jsx("div",{className:"px-3 py-4 text-center",children:i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("skills.no_skills")})}):i.jsx("div",{className:"py-1",children:p.map(function(T){var R=_.has(T.name);return i.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:T.name}),i.jsx("button",{onClick:function(){n(T.name,R)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 "+(R?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!R,children:i.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(R?"translate-x-1":"translate-x-5")})})]},T.name)})}),r&&i.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:i.jsx("button",{onClick:r,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:a("skills.reset_to_defaults")})})]})]})}function qW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.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 UW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 HW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 $W({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 WW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 VW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 GW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 KW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function YW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 QW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.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 XW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:i.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 ZW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:i.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 JW({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:i.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 eV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.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 tV({className:e,...t}){return i.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:i.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 gT={gmail:UW,gdrive:HW,discord:$W,whatsapp:WW,wrike:VW,gtasks:GW,mailchimp:KW,bamboohr:YW,pandadoc:QW,exa:XW,dropbox:ZW,freshbooks:JW,gcal:eV,docx2md:tV};function nV(e){return Object.prototype.hasOwnProperty.call(gT,e)?gT[e]:qW}const mT={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"},rV=new Set(["current","available","error","unsupported"]);function iV(e){const t=e||{},n=rV.has(t.status)?t.status:t.error?"error":t.hasUpdate?"available":"current";return{status:n,hasUpdate:n==="available",latestVersion:t.latestVersion||null,currentVersion:t.currentVersion||null,error:t.error||null,repository:t.repository||null}}function aV(e){const t=Object.create(null);return(e||[]).forEach(n=>{!n||!n.name||(t[n.name]=iV(n))}),t}function sV(e){const t={available:0,current:0,error:0,unsupported:0};return Object.values(e||{}).forEach(n=>{n&&Object.prototype.hasOwnProperty.call(t,n.status)&&t[n.status]++}),t}function oV({installed:e,configured:t,t:n}){return e?t?i.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:[i.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:i.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"})}),n("skills.configured")]}):i.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:[i.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:i.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"})}),n("skills.needs_setup")]}):i.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:n("skills.not_installed")})}function lV({skill:e,onClose:t,onSaved:n}){var{t:r}=rn(),a=Au(),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[g,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(null);y.useEffect(function(){var M=!1;async function I(){try{var D=await VM(e.name);if(M)return;_(D);for(var F=Object.create(null),ee=Object.keys(D.tokens||{}),H=0;H<ee.length;H++){var P=ee[H],K=D.tokens[P]||{},V=K.env||P;F[V]=""}l(F),d(!1)}catch(Z){M||(m(Z.message),d(!1))}}return I(),function(){M=!0}},[e.name]);var E=y.useMemo(function(){if(!k||!k.tokens)return null;if(k.oauth&&k.oauth.broker){var M=!!k.oauth.connected,I=k.oauth.provider||"";return{provider:I?I.charAt(0).toUpperCase()+I.slice(1):"OAuth",brokered:!0,canConnect:!M,refreshConfigured:M,clientIdConfigured:!0,clientSecretConfigured:!0}}for(var D=Object.keys(k.tokens),F=0;F<D.length;F++){var ee=k.tokens[D[F]]||{};if(ee.description&&ee.description.includes("OAuth")){for(var H=null,P=null,K=null,V=Object.entries(k.tokens),Z=0;Z<V.length;Z++){var le=V[Z][0];le.includes("REFRESH_TOKEN")&&(H=le),(le.includes("CLIENT_ID")||le.includes("APP_KEY"))&&(P=le),(le.includes("CLIENT_SECRET")||le.includes("APP_SECRET"))&&(K=le)}if(H&&P){var B=k.tokens[H]&&k.tokens[H].configured,U=k.tokens[P]&&k.tokens[P].configured,Y=K&&k.tokens[K]&&k.tokens[K].configured,q="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?q="Google":e.name==="dropbox"?q="Dropbox":e.name==="freshbooks"&&(q="FreshBooks"),{provider:q,canConnect:U&&Y&&!B,refreshConfigured:B,clientIdConfigured:U,clientSecretConfigured:Y}}}}return null},[k,e.name]),S=y.useCallback(async function(){m(null),v(!0);try{if(E&&E.brokered){let W=function(){O.current&&(clearInterval(O.current),O.current=null)};var M=await tL(e.name),I=600,D=700,F=(window.screen.width-I)/2,ee=(window.screen.height-D)/2,H=window.open(M.authorizeUrl,"oauth_popup","width="+I+",height="+D+",left="+F+",top="+ee+",scrollbars=yes");if(!H){m("Popup blocked. Please allow popups or visit: "+M.authorizeUrl),v(!1);return}var P=M.flowId,K=0,V=0;O.current=setInterval(async function(){K+=1500;try{var $=await nL(e.name,P);if($&&$.connected){W();try{H.close()}catch{}v(!1),n();return}}catch(fe){W(),m(fe.message),v(!1);return}if(H.closed&&(V||(V=K),K-V>9e3)){W(),v(!1),n();return}K>3e5&&(W(),v(!1),m("Connection timed out. Please try again."))},1500);return}var Z=await eL(e.name),le=600,B=700,U=(window.screen.width-le)/2,Y=(window.screen.height-B)/2,q=window.open(Z.authorizeUrl,"oauth_popup","width="+le+",height="+B+",left="+U+",top="+Y+",scrollbars=yes");if(q)var te=setInterval(function(){q.closed&&(clearInterval(te),v(!1),n())},500);else m("Popup blocked. Please allow popups or visit: "+Z.authorizeUrl),v(!1)}catch(W){m(W.message),v(!1)}},[e.name,n,E]),N=y.useCallback(async function(){m(null),p(!0);try{for(var M=Object.create(null),I=Object.keys(o),D=0;D<I.length;D++){var F=I[D];o[F]&&o[F].trim()&&(M[F]=o[F].trim())}if(Object.keys(M).length===0){m(r("skills.enter_token")),p(!1);return}await QM(e.name,M),n()}catch(ee){m(ee.message)}finally{p(!1)}},[o,e.name,n,r]),A=y.useCallback(async function(){if(await a({title:r("skills.clear_title"),message:r("skills.clear_confirm",{skill:e.name}),destructive:!0})){m(null),p(!0);try{await XM(e.name),n()}catch(M){m(M.message)}finally{p(!1)}}},[e.name,n,a,r]),T=y.useCallback(function(M,I){l(function(D){var F=Object.assign(Object.create(null),D);return F[M]=I,F})},[]),R=k&&!(k.oauth&&k.oauth.broker)?Object.entries(k.tokens||{}).map(function(M){var I=M[0],D=M[1],F=D&&D.env||I;return{name:I,env:F,description:D.description,configured:D.configured,maskedValue:D.maskedValue}}):[],C=y.useRef(null);y.useEffect(function(){function M(I){I.key==="Escape"&&t()}return document.addEventListener("keydown",M),C.current&&C.current.focus(),function(){document.removeEventListener("keydown",M)}},[t]);var O=y.useRef(null);return y.useEffect(function(){return function(){O.current&&(clearInterval(O.current),O.current=null)}},[]),i.jsx("div",{ref:C,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":r("skills.configure_skill",{skill:e.name}),children:i.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(M){M.stopPropagation()},children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r("skills.configure_skill",{skill:e.name})}),i.jsx("button",{onClick:t,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":r("skills.close_credential_editor"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),u&&i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!u&&R.length>0&&i.jsx("div",{className:"space-y-3 mb-4",children:R.map(function(M){return i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[M.env,M.configured&&i.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:M.maskedValue}),")"]})]}),M.description&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:M.description}),i.jsx("input",{type:"password",placeholder:M.configured?r("skills.leave_blank"):r("skills.enter_value"),value:o[M.env]||"",onChange:function(I){T(M.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"})]},M.env)})}),!u&&E&&i.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:E.canConnect?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:r("skills.oauth_connect_hint",{provider:E.provider})}),i.jsx("button",{onClick:S,disabled:x||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:x?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r("skills.oauth_connecting")]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),r("skills.oauth_connect",{provider:E.provider})]})})]}):E.refreshConfigured?i.jsxs("div",{className:"space-y-3",children:[i.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:i.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.oauth_connected",{provider:E.provider})]}),i.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:r("skills.oauth_disconnect",{provider:E.provider})})]}):i.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:r("skills.oauth_needs_credentials",{provider:E.provider})})}),!u&&!g&&R.length===0&&!E&&i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:r("skills.no_credentials_needed")}),g&&i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:g}),!u&&R.length>0&&i.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[i.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:r("skills.clear_all")}),i.jsxs("div",{className:"flex gap-2",children:[i.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:r("skills.cancel")}),i.jsx("button",{onClick:N,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:r(f?"skills.saving":"skills.save")})]})]})]})})}function cV({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:a,onInstall:o,onUpdate:l,onUninstall:u,skillDefaultEnabled:d,onToggleDefault:f,t:p}){var g=nV(e.name),m=Object.prototype.hasOwnProperty.call(mT,e.name)?mT[e.name]:"#6B7280",[x,v]=y.useState(!1),k=r===e.name,_=n&&n.status==="available",E=y.useCallback(async function(){v(!0);try{await o(e)}finally{v(!1)}},[e,o]),S=y.useCallback(function(){l&&l(e.name)},[e.name,l]);return i.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:[i.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:m}}),i.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:m+"15"},children:i.jsx(g,{className:"w-5 h-5",style:{color:m}})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),i.jsx(oV,{installed:t,configured:t&&e.allTokensConfigured,t:p}),t&&_&&i.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:[i.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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",n.latestVersion]}),t&&n&&n.status==="current"&&i.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:p("skills.up_to_date")}),t&&n&&n.status==="error"&&i.jsx("span",{title:n.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:p("skills.update_check_failed")}),t&&n&&n.status==="unsupported"&&i.jsx("span",{title:n.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:p("skills.update_unsupported")})]}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||p("skills.no_description")}),e.version&&i.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),i.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:function(){a(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:p("skills.configure")}),f&&i.jsxs("button",{onClick:function(){f(e.name,!d)},title:p("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:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d?i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),p("skills.default")]}),_&&i.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?i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),p("skills.updating")]}):p("skills.update")}),u&&i.jsx("button",{onClick:function(){u(e)},title:p("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":p("skills.uninstall"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})})]}):i.jsx("button",{onClick:E,disabled:x,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:x?i.jsxs("span",{className:"flex items-center justify-center gap-1",children:[i.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),p("skills.installing")]}):p("skills.install")})})]})}function uV({onBack:e}){var{t}=rn(),[n,r]=y.useState([]),[a,o]=y.useState([]),[l,u]=y.useState(!0),[d,f]=y.useState(null),[p,g]=y.useState(null),[m,x]=y.useState("all"),[v,k]=y.useState(""),[_,E]=y.useState(!1),[S,N]=y.useState(Object.create(null)),[A,T]=y.useState(null),[R,C]=y.useState(!1),[O,M]=y.useState(Object.create(null)),I=Au(),D=y.useCallback(async function(){u(!0),f(null),C(!1);try{var W=await Promise.allSettled([Dv(),WM(),r4()]),$=W[0].status==="fulfilled"?W[0].value:[],fe=W[1].status==="fulfilled"?W[1].value:[],ae=W[2].status==="fulfilled"?W[2].value.skillDefaults||{}:{};r($),o(fe),M(ae);var xe=[];W[0].status==="rejected"&&xe.push(t("skills.load_installed_failed",{error:W[0].reason.message})),W[1].status==="rejected"&&xe.push(t("skills.load_marketplace_failed",{error:W[1].reason.message})),xe.length>0&&f(xe.join("; "))}catch(Ie){f(Ie.message)}finally{u(!1)}},[t]);y.useEffect(function(){D()},[D]);var F=[],ee=new Set(n.map(function(W){return W.name}));n.forEach(function(W){F.push(Object.assign({},W,{_installed:!0}))}),a.forEach(function(W){ee.has(W.name)||F.push(Object.assign({},W,{_installed:!1,allTokensConfigured:!1}))});var H=F;if(m==="installed"?H=F.filter(function(W){return W._installed}):m==="available"&&(H=F.filter(function(W){return!W._installed})),v){var P=v.toLowerCase();H=H.filter(function(W){return W.name&&W.name.toLowerCase().indexOf(P)!==-1||W.description&&W.description.toLowerCase().indexOf(P)!==-1||W.category&&W.category.toLowerCase().indexOf(P)!==-1})}var K=y.useCallback(async function(W){try{await GM(W.name),D()}catch($){f(t("skills.install_failed",{error:$.message}))}},[D,t]),V=y.useCallback(function(W){g(W)},[]),Z=y.useCallback(async function(W){if(await I({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:W.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await ZM(W.name),D()}catch($){f(t("skills.uninstall_failed",{error:$.message}))}},[D,I,t]),le=y.useCallback(function(){g(null),D()},[D]),B=y.useCallback(async function(W,$){M(function(ae){var xe=Object.assign({},ae);return $?xe[W]=!0:delete xe[W],xe});try{var fe={};fe[W]=$,await JM(fe)}catch(ae){M(function(xe){var Ie=Object.assign({},xe);return $?delete Ie[W]:Ie[W]=!0,Ie}),f(ae.message)}},[]),U=y.useCallback(async function(){E(!0),f(null);try{var W=await YM();N(aV(W.skills)),C(!0)}catch($){f($.message)}finally{E(!1)}},[]),Y=y.useCallback(async function(W){T(W),f(null);try{var $=await KM(W);$.updated&&(N(function(fe){var ae=Object.assign(Object.create(null),fe);return ae[W]={status:"current",hasUpdate:!1,latestVersion:fe[W]?fe[W].latestVersion:null,currentVersion:fe[W]?fe[W].latestVersion:null,error:null},ae}),D())}catch(fe){f(t("skills.update_failed")+": "+fe.message)}finally{T(null)}},[D,t]),q=sV(S),te=q.available;return i.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[i.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.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:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:n.length,available:a.filter(function(W){return!ee.has(W.name)}).length})})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.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:_?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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")]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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")]})}),te>0&&i.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:te})}),R&&q.error>0&&!_&&i.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:q.error})}),R&&q.unsupported>0&&!_&&i.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:q.unsupported})}),R&&te===0&&q.error===0&&q.unsupported===0&&!_&&i.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")}),i.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(W){return i.jsx("button",{onClick:function(){x(W)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(m===W?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:t("skills.tab_"+W)},W)})})]})]}),i.jsx("div",{className:"shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:i.jsxs("div",{className:"relative",children:[i.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:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),i.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:v,onChange:function(W){k(W.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-hidden focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500"})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[l&&i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),d&&i.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:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:d})}),!l&&H.length===0&&i.jsx("div",{className:"text-center py-12",children:i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(v?"skills.no_match":"skills.no_skills")})}),!l&&H.length>0&&i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:H.map(function(W){return i.jsx(cV,{skill:W,installed:W._installed,updateInfo:S[W.name],updatingSkill:A,onConfigure:V,onInstall:K,onUpdate:Y,onUninstall:W._installed?Z:null,skillDefaultEnabled:!!O[W.name],onToggleDefault:W._installed?B:null,t},W.name)})})]}),p&&i.jsx(lV,{skill:p,onClose:function(){g(null)},onSaved:le})]})}var Av=20;function zk(e){if(!e)return"";try{var t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()}catch{return String(e)}}function dV(e){var t={},n=[],r={};return(e||[]).forEach(function(a){a.parentId&&!r[a.parentId]?n.push(a):a.parentId?(t[a.parentId]=t[a.parentId]||[]).push(a):n.push(a),r[a.id]=!0}),{topLevel:n,childrenByParent:t}}function EA({post:e,childrenByParent:t,depth:n,onDelete:r,t:a}){var o=t[e.id]||[];return i.jsxs("div",{className:n>0?"ml-4 pl-3 border-l border-gray-200 dark:border-gray-700":"",children:[i.jsxs("div",{className:"py-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.author}),i.jsx("span",{children:zk(e.createdAt)}),!e.deleted&&r&&i.jsx("button",{type:"button",onClick:function(){r(e.id)},className:"ml-auto text-gray-400 hover:text-red-500 transition-colors",title:a("board.delete_post"),"aria-label":a("board.delete_post"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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?i.jsx("p",{className:"mt-1 text-sm text-gray-400 dark:text-gray-500 italic",children:a("board.post_deleted")}):i.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 i.jsx(EA,{post:l,childrenByParent:t,depth:n+1,onDelete:r,t:a},l.id)})]})}function fV({detail:e,searchQuery:t,onSearchQueryChange:n,onSearch:r,onClearSearch:a,hasSearchResults:o,onDeleteTopic:l,onBack:u,onCloseTopic:d,t:f}){return i.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.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:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e?e.topic.title:f("board.title")}),i.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&&i.jsxs("form",{onSubmit:r,className:"flex items-center gap-2",children:[i.jsx("input",{type:"text",value:t,onChange:function(p){n(p.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-hidden focus:ring-2 focus:ring-primary-500"}),i.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&&i.jsx("button",{type:"button",onClick:a,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&&i.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:[i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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 pV({detail:e,onDeletePost:t,t:n}){var r=dV(e.posts);return i.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[i.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:[i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.topic.author}),i.jsx("span",{children:zk(e.topic.createdAt)}),e.topic.category&&i.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})]}),r.topLevel.length===0?i.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:n("board.no_posts")}):r.topLevel.map(function(a){return i.jsx(EA,{post:a,childrenByParent:r.childrenByParent,depth:0,onDelete:t,t:n},a.id)})]})}function hV({searchResults:e,onOpenTopic:t,t:n}){return i.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:n("board.search_results",{count:e.total})}),(e.matches||[]).length===0?i.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:n("board.no_matches")}):e.matches.map(function(r,a){return i.jsxs("button",{type:"button",onClick:function(){t(r.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:[i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:r.topicTitle}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:r.snippet})]},(r.postId||r.topicId)+":"+a)})]})}function gV({topics:e,offset:t,total:n,onOpenTopic:r,onPage:a,t:o}){var l=t-Av,u=t+Av,d=t>0,f=u<n;return i.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[e.length===0?i.jsx("p",{className:"py-8 text-sm text-gray-400 dark:text-gray-500 text-center",children:o("board.no_topics")}):e.map(function(p){return i.jsxs("button",{type:"button",onClick:function(){r(p.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:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:p.title}),p.category&&i.jsx("span",{className:"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:p.category})]}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:[p.author," · ",zk(p.createdAt)," ·"," ",o("board.post_count",{count:p.postCount})]})]},p.id)}),(d||f)&&i.jsxs("div",{className:"flex items-center justify-between mt-4",children:[i.jsx("button",{type:"button",disabled:!d,onClick:function(){a(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")}),i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("board.page_info",{from:t+1,to:Math.min(u,n),total:n})}),i.jsx("button",{type:"button",disabled:!f,onClick:function(){a(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 mV({onBack:e}){var{t}=rn(),[n,r]=y.useState([]),[a,o]=y.useState(0),[l,u]=y.useState(0),[d,f]=y.useState(!0),[p,g]=y.useState(null),[m,x]=y.useState(null),[v,k]=y.useState(""),[_,E]=y.useState(null),S=y.useCallback(async function(I){f(!0),g(null);try{var D=await vL({limit:Av,offset:I});r(D.topics||[]),o(D.total||0)}catch(F){g(F.message)}finally{f(!1)}},[]);y.useEffect(function(){S(0)},[S]);var N=y.useCallback(async function(I){f(!0),g(null),E(null);try{var D=await F_(I);x(D)}catch(F){g(F.message)}finally{f(!1)}},[]),A=y.useCallback(function(){x(null),S(l)},[S,l]),T=y.useCallback(async function(I){g(null);try{await _L(I),x(null),S(l)}catch(D){g(D.message)}},[S,l]),R=y.useCallback(async function(I){if(m){g(null);try{await wL(m.topic.id,I);var D=await F_(m.topic.id);x(D)}catch(F){g(F.message)}}},[m]),C=y.useCallback(async function(I){I.preventDefault();var D=v.trim();if(!D){E(null);return}f(!0),g(null);try{var F=await kL(D);E(F)}catch(ee){g(ee.message)}finally{f(!1)}},[v]),O=y.useCallback(function(){k(""),E(null)},[]),M=y.useCallback(function(I){u(I),S(I)},[S]);return i.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[i.jsx(fV,{detail:m,searchQuery:v,onSearchQueryChange:k,onSearch:C,onClearSearch:O,hasSearchResults:!!_,onDeleteTopic:T,onBack:e,onCloseTopic:A,t}),i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[p&&i.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:p}),d?i.jsx("div",{className:"flex items-center justify-center py-16",children:i.jsx("svg",{className:"w-6 h-6 animate-spin text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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?i.jsx(pV,{detail:m,onDeletePost:R,t}):_?i.jsx(hV,{searchResults:_,onOpenTopic:N,t}):i.jsx(gV,{topics:n,offset:l,total:a,onOpenTopic:N,onPage:M,t})]})]})}var xT={available:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",installed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300","update-available":"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300",pending_oauth:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300","needs-review":"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-300",degraded:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-300",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"};function SA({status:e}){var t=xT[e]||xT.available;return i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium "+t,children:e})}function NA({kind:e}){var t=e==="skill";return i.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium "+(t?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300":"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-300"),children:e})}function xV({capability:e,onOpen:t}){return i.jsxs("button",{type:"button",onClick:()=>t(e),className:"text-left w-full p-4 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-xs transition-all bg-white dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(NA,{kind:e.kind}),i.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name})]}),i.jsx(SA,{status:e.status})]}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||""}),i.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.version&&i.jsxs("span",{children:["v",e.version]}),e.installedVersion&&e.installedVersion!==e.version&&i.jsxs("span",{children:["(installed v",e.installedVersion,")"]}),e.author&&i.jsx("span",{className:"truncate",children:e.author})]})]})}var Bo={LOADING:"loading",READY:"ready",MISSING:"missing"};function yV({capability:e,docs:t,docsState:n}){var{t:r}=rn();return e.kind!=="skill"?null:i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:r("capabilities.docs")}),n===Bo.MISSING&&i.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:r("capabilities.docs_missing")}),n===Bo.READY&&i.jsx("pre",{className:"text-xs whitespace-pre-wrap bg-gray-50 dark:bg-gray-800 rounded-lg p-3 max-h-96 overflow-y-auto text-gray-700 dark:text-gray-300",children:t.content}),n===Bo.LOADING&&i.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:"…"})]})}function su({label:e,value:t}){return t?i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"text-gray-500 dark:text-gray-400",children:e}),i.jsx("dd",{className:"text-gray-900 dark:text-gray-100 break-all",children:t})]}):null}function bV({capability:e}){return i.jsxs("dl",{className:"grid grid-cols-2 gap-2 text-sm mb-4",children:[i.jsx(su,{label:"Version",value:e.version}),i.jsx(su,{label:"Author",value:e.author}),e.kind==="mcp"&&i.jsxs(i.Fragment,{children:[i.jsx(su,{label:"URL",value:e.url}),i.jsx(su,{label:"Auth",value:e.auth&&e.auth.type||"none"})]}),e.requiresMcps&&e.requiresMcps.length>0&&i.jsx(i.Fragment,{children:i.jsx(su,{label:"Requires MCPs",value:e.requiresMcps.join(", ")})})]})}var Yn={IDLE:"idle",BUSY:"busy",ERROR:"error",DONE:"done"};function vV({capability:e,onInstalled:t}){var{t:n}=rn(),r=String(e.id||"").replace(/^mcp:/,""),[a,o]=y.useState(null),[l,u]=y.useState(Yn.IDLE),[d,f]=y.useState(null),[p,g]=y.useState(""),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=e.auth&&e.auth.type||"none",E=y.useCallback(function(){LM(r).then(function(P){o(P)}).catch(function(){o(null)})},[r]);y.useEffect(function(){E()},[E]);function S(P){u(Yn.BUSY),f(null),P().then(function(K){f(K&&K.message?K.message:n("capabilities.done")),u(Yn.DONE),E(),t&&t()}).catch(function(K){f(K&&K.message||"request failed"),u(Yn.ERROR)})}var N=a&&a.needsReview,A=N&&N.changedTools||[],T=a||e.status==="installed",R=_==="bearer",C=_==="oauth2",O=!!(a&&a.hasToken),M=y.useRef(null),[I,D]=y.useState(!1),F=!!(a&&(a.needsReconsent||a.refreshRejected||a.reconsentRequired));y.useEffect(function(){return function(){M.current&&(clearTimeout(M.current),M.current=null)}},[]);function ee(){u(Yn.BUSY),f(null),UM(r).then(function(P){u(Yn.IDLE),D(!0),f(n("capabilities.oauth_pending")),E(),typeof window<"u"&&window.open&&window.open(P.authorizeUrl,"_blank","noopener");var K=0,V=function(){K+=1,HM(r,P.state).then(function(Z){if(Z&&Z.pending){if(K>150){D(!1),u(Yn.ERROR),f(n("capabilities.oauth_pending"));return}M.current=setTimeout(V,2e3);return}D(!1),Z&&Z.connected?(u(Yn.DONE),f(n("capabilities.oauth_connected"))):Z&&Z.needsReconsent?(u(Yn.ERROR),f(n("capabilities.oauth_reconsent"))):(u(Yn.ERROR),f(Z&&Z.lastError||n("capabilities.oauth_reconsent"))),E(),t&&t()}).catch(function(){D(!1),u(Yn.ERROR),f(n("capabilities.oauth_reconsent"))})};M.current=setTimeout(V,2e3)}).catch(function(P){u(Yn.ERROR),f(P&&P.message||"request failed")})}var H="px-3 py-1.5 rounded text-sm font-medium transition-colors ";return i.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"mcp-runtime",children:[N&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-orange-50 dark:bg-orange-950 border border-orange-200 dark:border-orange-900",children:[i.jsx("p",{className:"text-sm font-medium text-orange-800 dark:text-orange-300 mb-1",children:n("capabilities.needs_review")}),N.reason&&i.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-2",children:N.reason}),A.length>0&&i.jsxs("div",{className:"mb-2",children:[i.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-1",children:n("capabilities.changed_tools")}),i.jsx("ul",{className:"text-xs font-mono text-orange-800 dark:text-orange-300 list-disc list-inside",children:A.map(function(P){return i.jsxs("li",{children:[P.name," (",P.change,")"]},P.name)})})]}),i.jsx("button",{type:"button",disabled:l===Yn.BUSY,onClick:function(){S(function(){return BM(r)})},className:H+"bg-orange-600 hover:bg-orange-700 text-white disabled:opacity-50",children:n("capabilities.reapprove")})]}),C&&a&&(a.status==="pending_oauth"||F)&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-yellow-50 dark:bg-yellow-950 border border-yellow-200 dark:border-yellow-900","data-testid":"mcp-oauth-consent",children:[i.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1",children:n(F?"capabilities.oauth_reconsent":"capabilities.oauth_connect")}),(a.refreshRejected||a.reconsentRequired)&&i.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 mb-2",children:a.refreshRejected?a.refreshRejected.error:a.reconsentRequired.reason}),i.jsx("button",{type:"button",disabled:l===Yn.BUSY||I,onClick:ee,className:H+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-oauth-connect",children:n("capabilities.oauth_connect")}),I&&i.jsx("span",{className:"ml-2 text-xs text-gray-500 dark:text-gray-400",children:n("capabilities.oauth_pending")})]}),a&&a.status==="error"&&a.lastError&&i.jsxs("p",{className:"mb-3 text-sm text-red-700 dark:text-red-300","data-testid":"mcp-error",children:[n("capabilities.mcp_error"),": ",a.lastError]}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[!T&&i.jsx("button",{type:"button",disabled:l===Yn.BUSY,onClick:function(){S(function(){return MM(r)})},className:H+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-install",children:n("capabilities.install")}),T&&i.jsx("button",{type:"button",disabled:l===Yn.BUSY,onClick:function(){S(function(){return OM(r)})},className:H+"border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-50","data-testid":"mcp-update",children:n("capabilities.update")}),T&&!v&&i.jsx("button",{type:"button",disabled:l===Yn.BUSY,onClick:function(){k(!0)},className:H+"border border-red-300 dark:border-red-900 text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950 disabled:opacity-50","data-testid":"mcp-uninstall",children:n("capabilities.uninstall")}),T&&v&&i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",disabled:l===Yn.BUSY,onClick:function(){S(function(){return DM(r)}),k(!1)},className:H+"bg-red-600 hover:bg-red-700 text-white disabled:opacity-50",children:n("capabilities.uninstall_confirm")}),i.jsx("button",{type:"button",onClick:function(){k(!1)},className:H+"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",children:n("capabilities.cancel")})]})]}),R&&i.jsxs("div",{className:"mt-3","data-testid":"mcp-token",children:[i.jsxs("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:[e.auth&&e.auth.tokenLabel?e.auth.tokenLabel:n("capabilities.token_label"),O?" — "+n("capabilities.token_stored"):""]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"password",value:p,onChange:function(P){g(P.target.value),x(null)},placeholder:n("capabilities.token_placeholder"),className:"flex-1 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-hidden focus:ring-1 focus:ring-blue-500 font-mono"}),i.jsx("button",{type:"button",disabled:l===Yn.BUSY||!p.trim(),onClick:function(){S(function(){return PM(r,p.trim()).then(function(){g("")})})},className:H+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50",children:n("capabilities.token_save")}),O&&i.jsx("button",{type:"button",disabled:l===Yn.BUSY,onClick:function(){S(function(){return FM(r)})},className:H+"border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-50",children:n("capabilities.token_clear")})]}),m&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:m}),i.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:n("capabilities.token_note")})]}),a&&a.bridgedTools&&a.bridgedTools.length>0&&i.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:[n("capabilities.bridged"),": ",a.bridgedTools.length,a.deferredTools&&a.deferredTools.length>0?" · "+n("capabilities.deferred")+": "+a.deferredTools.length:""]}),d&&i.jsx("p",{className:"mt-2 text-xs "+(l===Yn.ERROR?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),children:d})]})}var kV={installed:"text-green-700 dark:text-green-400",pending_oauth:"text-yellow-700 dark:text-yellow-400",error:"text-red-700 dark:text-red-400",missing:"text-red-700 dark:text-red-400"};function _V({capability:e,onInstalled:t}){var{t:n}=rn(),r=String(e.id||"").replace(/^skill:/,""),[a,o]=y.useState(Yn.IDLE),[l,u]=y.useState(null),d=e.deps||[],f=e.requiresMcps||[],p=e.status==="installed"||e.status==="degraded"||e.status==="update-available",g=a===Yn.BUSY;function m(x){o(Yn.BUSY),u(null),x().then(function(v){u(v),o(Yn.DONE),t&&t()}).catch(function(v){u({error:v&&v.message||"request failed"}),o(Yn.ERROR)})}return!f.length&&!p?null:i.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"skill-composite",children:[f.length>0&&i.jsxs("div",{className:"mb-2",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:n("capabilities.requires_mcps")}),i.jsx("ul",{className:"text-xs font-mono list-inside","data-testid":"skill-composite-deps",children:(d.length?d:f.map(function(x){return{id:"mcp:"+x,status:null}})).map(function(x){return i.jsxs("li",{className:x.status?kV[x.status]||"":"text-gray-500 dark:text-gray-400",children:[x.id,x.status?" — "+x.status:""]},x.id)})})]}),l&&!l.error&&l.deps&&l.deps.length>0&&i.jsxs("div",{className:"mb-2 p-2 rounded bg-green-50 dark:bg-green-950 border border-green-200 dark:border-green-900","data-testid":"skill-composite-result",children:[i.jsx("p",{className:"text-xs font-medium text-green-800 dark:text-green-300",children:n("capabilities.composite_installed",{name:l.name})}),i.jsx("ul",{className:"text-xs font-mono text-gray-700 dark:text-gray-300 list-disc list-inside",children:l.deps.map(function(x){return i.jsxs("li",{children:[x.id," [",x.status,"]"]},x.id)})})]}),l&&l.error&&i.jsx("p",{className:"mb-2 text-xs text-red-600 dark:text-red-400","data-testid":"skill-composite-error",children:l.error}),i.jsxs("div",{className:"flex items-center gap-2",children:[!p&&i.jsx("button",{type:"button",disabled:g,onClick:function(){m(function(){return zM(r)})},className:yT(),"data-testid":"skill-install",children:n("capabilities.install")}),p&&i.jsx("button",{type:"button",disabled:g,onClick:function(){m(function(){return qM(r)})},className:yT(),"data-testid":"skill-uninstall",children:n("capabilities.uninstall")})]})]})}function yT(){return"px-3 py-1.5 rounded text-sm font-medium transition-colors bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50"}function wV({capability:e,onClose:t,onInstalled:n}){var{t:r}=rn(),[a,o]=y.useState(null),[l,u]=y.useState(Bo.LOADING);if(y.useEffect(function(){if(o(null),u(Bo.LOADING),!(!e||e.kind!=="skill")){var f=!1;return IM(e.id).then(function(p){f||(o(p),u(Bo.READY))}).catch(function(){f||u(Bo.MISSING)}),function(){f=!0}}},[e]),!e)return null;var d=e.kind==="collision";return i.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/30",onClick:t,children:i.jsxs("div",{className:"w-full max-w-xl h-full bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 overflow-y-auto p-6",onClick:function(f){f.stopPropagation()},children:[i.jsxs("div",{className:"flex items-start justify-between gap-2 mb-4",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[!d&&i.jsx(NA,{kind:e.kind}),i.jsx(SA,{status:e.status})]}),i.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 font-mono",children:e.id})]}),i.jsx("button",{type:"button",onClick:t,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400","aria-label":r("capabilities.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),d&&i.jsx("p",{className:"mb-4 text-sm text-red-700 dark:text-red-300",children:e.error}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-4",children:e.description||r("capabilities.no_description")}),i.jsx(bV,{capability:e}),!d&&e.kind==="mcp"&&i.jsx(vV,{capability:e,onInstalled:n}),!d&&e.kind==="skill"&&i.jsx(_V,{capability:e,onInstalled:n}),i.jsx(yV,{capability:e,docs:a,docsState:l})]})})}function EV(e,t,n){return e.filter(function(r){if(n!=="all"&&r.kind!==n)return!1;if(!t)return!0;var a=t.toLowerCase();return(r.name||"").toLowerCase().indexOf(a)!==-1||(r.displayName||"").toLowerCase().indexOf(a)!==-1||(r.description||"").toLowerCase().indexOf(a)!==-1})}function SV({warnings:e}){return e.length===0?null:i.jsx("div",{className:"px-4 py-2 bg-yellow-50 dark:bg-yellow-950 border-b border-yellow-200 dark:border-yellow-900",children:e.map(function(t,n){return i.jsx("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:t},n)})})}function NV({loading:e,error:t,filtered:n,onRetry:r,onOpen:a,t:o}){return e?i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"…"}):t?i.jsxs("div",{className:"text-sm text-red-600 dark:text-red-400",children:[i.jsx("p",{children:t}),i.jsx("button",{type:"button",onClick:r,className:"mt-2 px-3 py-1 rounded border border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300",children:o("capabilities.retry")})]}):n.length===0?i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:o("capabilities.no_capabilities")}):i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:n.map(function(l){return i.jsx(xV,{capability:l,onOpen:a},l.id)})})}function CV({onBack:e}){var{t}=rn(),[n,r]=y.useState(null),[a,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState(""),[p,g]=y.useState("all"),[m,x]=y.useState(null),v=y.useCallback(function(){u(!0),AM().then(function(S){r(S),o(null),u(!1)}).catch(function(S){o(S&&S.message||"failed to load"),u(!1)})},[]);y.useEffect(function(){v()},[v]);var k=n&&n.capabilities||[],_=n&&n.warnings||[],E=EV(k,d,p);return i.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-950",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:[i.jsx("button",{type:"button",onClick:e,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400","aria-label":t("capabilities.back_to_chat"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),i.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("capabilities.title")}),i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",children:"experimental"})]}),i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:[i.jsx("input",{type:"text",value:d,onChange:function(S){f(S.target.value)},placeholder:t("capabilities.search_placeholder"),className:"flex-1 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-hidden focus:ring-1 focus:ring-blue-500"}),i.jsx("div",{className:"flex rounded-lg border border-gray-300 dark:border-gray-700 overflow-hidden",children:["all","skill","mcp"].map(function(S){return i.jsx("button",{type:"button",onClick:function(){g(S)},className:"px-3 py-1.5 text-sm "+(p===S?"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-gray-100 font-medium":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),children:t("capabilities.filter_"+S)},S)})})]}),i.jsx(SV,{warnings:_}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i.jsx(NV,{loading:l,error:a,filtered:E,onRetry:v,onOpen:x,t})}),i.jsx(wV,{capability:m,onClose:function(){x(null)},onInstalled:v})]})}var jV=["__proto__","constructor","prototype"],TV="Session expired. Please log in again.";function ou(e){return e&&e.status===401?TV:e.message}function Fb(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},cost:{input:0,output:0}}}function RV(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 CA(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function bT(e){var t={limit:e.limit,cost:e.cost};e.displayName&&String(e.displayName).trim()!==""&&(t.displayName=String(e.displayName).trim());var n=e.spec?String(e.spec).trim():"";if(n){var r=CA(n);t[r]=n}return t}function vT(e){var t=e.name,n=e.config,r=e.setName,a=e.setConfig,o=e.onSave,l=e.onCancel,u=e.saving,d=e.isNew,f=e.t;function p(_){a(function(E){return Object.assign({},E,_)})}function g(_){a(function(E){return Object.assign({},E,{limit:Object.assign({},E.limit||{},_)})})}function m(_){a(function(E){return Object.assign({},E,{cost:Object.assign({},E.cost||{},_)})})}var x="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=CA(n.spec);return i.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:[i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:v,children:f("settings.model_registry.name")}),i.jsx("input",{type:"text",value:t,onChange:function(_){r(_.target.value)},className:x+" font-mono",placeholder:f("settings.model_registry.name_placeholder"),autoFocus:d})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsxs("label",{className:v,children:[f("settings.model_registry.spec"),k&&i.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")})]}),i.jsx("input",{type:"text",value:n.spec||"",onChange:function(_){p({spec:_.target.value})},className:x+" font-mono",placeholder:f("settings.model_registry.spec_placeholder")}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:f("settings.model_registry.spec_hint")})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:v,children:f("settings.model_registry.displayName")}),i.jsx("input",{type:"text",value:n.displayName||"",onChange:function(_){p({displayName:_.target.value})},className:x,placeholder:f("settings.model_registry.displayName_placeholder")})]}),i.jsxs("details",{className:"col-span-2",children:[i.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-600 dark:text-gray-300 select-none",children:f("settings.model_registry.advanced")}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.limit_context")}),i.jsx("input",{type:"number",value:n.limit?n.limit.context:128e3,onChange:function(_){g({context:parseInt(_.target.value,10)||128e3})},className:x})]}),i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.limit_output")}),i.jsx("input",{type:"number",value:n.limit?n.limit.output:8192,onChange:function(_){g({output:parseInt(_.target.value,10)||8192})},className:x})]}),i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.cost_input")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:n.cost?n.cost.input:0,onChange:function(_){m({input:parseFloat(_.target.value)||0})},className:x})]}),i.jsxs("div",{children:[i.jsx("label",{className:v,children:f("settings.model_registry.cost_output")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:n.cost?n.cost.output:0,onChange:function(_){m({output:parseFloat(_.target.value)||0})},className:x})]})]})]})]}),i.jsxs("div",{className:"flex gap-2 pt-1",children:[i.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")}),i.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 AV({value:e,onChange:t,t:n}){const[r,a]=y.useState(null),[o,l]=y.useState(!0),[u,d]=y.useState(null),[f,p]=y.useState(!1),[g,m]=y.useState(""),[x,v]=y.useState(Fb()),[k,_]=y.useState(null),[E,S]=y.useState(!1),[N,A]=y.useState(null);y.useEffect(function(){var H=!1;return l(!0),Jb().then(function(P){H||(a(P),l(!1))}).catch(function(P){H||(d(ou(P)),l(!1))}),function(){H=!0}},[]);var T=y.useCallback(function(){l(!0),d(null),Jb().then(function(H){a(H),l(!1)}).catch(function(H){d(ou(H)),l(!1)})},[]);function R(H,P,K){var V=(H||"").trim();return V?jV.indexOf(V)!==-1?n("settings.model_registry.error_name_reserved",{name:V}):V!==K&&P.indexOf(V)!==-1?n("settings.model_registry.error_name_exists",{name:V}):null:n("settings.model_registry.error_name_required")}var C=y.useCallback(async function(){if(r){var H=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),P=R(g,H,null);if(P){A(P);return}S(!0),A(null);try{await B_(g.trim(),bT(x)),p(!1),m(""),v(Fb()),T(),t&&t(e)}catch(K){A(ou(K))}finally{S(!1)}}},[g,x,r,t,e,T]),O=y.useCallback(async function(H){S(!0),A(null);try{await z_(H),T(),t&&t(e)}catch(P){A(ou(P))}finally{S(!1)}},[t,e,T]),M=y.useCallback(async function(){if(!(!k||!r)){var H=Object.keys(r.user||{}).concat(Object.keys(r.builtin||{})),P=R(k.name,H,k.originalName);if(P){A(P);return}S(!0),A(null);try{var K=k.name.trim(),V=bT(k.config);if(await B_(K,V),K!==k.originalName)try{await z_(k.originalName)}catch(Z){A(n("settings.model_registry.error_rename_cleanup",{error:Z.message}))}_(null),T(),t&&t(e)}catch(Z){A(ou(Z))}finally{S(!1)}}},[k,r,t,e,T]);if(o)return i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 py-2",children:[i.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary-600"}),n("settings.model_registry.loading")]});if(u)return i.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 py-2",children:n("settings.model_registry.load_error",{error:u})});var I=r&&r.user?r.user:{},D=r&&r.builtin?r.builtin:{},F=Object.keys(I),ee=Object.keys(D);return i.jsxs("div",{className:"space-y-3",children:[N&&i.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:N}),ee.length>0&&i.jsxs("div",{children:[i.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2",children:n("settings.model_registry.builtin")}),i.jsx("div",{className:"space-y-1",children:ee.map(function(H){var P=D[H];return i.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:[i.jsx("span",{className:"font-mono font-medium text-gray-900 dark:text-gray-100",children:H}),P.provider&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:P.provider}),P.limit&&P.limit.context&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:P.limit.context/1e3})}),P.tier&&i.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:P.tier})]},H)})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("settings.model_registry.user")}),!f&&!k&&i.jsx("button",{type:"button",onClick:function(){p(!0),m(""),v(Fb()),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:n("settings.model_registry.add_model")})]}),F.length===0&&!f&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:n("settings.model_registry.no_user_models")}),i.jsxs("div",{className:"space-y-2",children:[F.map(function(H){var P=I[H];return k&&k.originalName===H?i.jsx(vT,{name:k.name,config:k.config,setName:function(K){_(function(V){return V&&Object.assign({},V,{name:K})})},setConfig:function(K){_(function(V){if(!V)return V;var Z=typeof K=="function"?K(V.config):K;return Object.assign({},V,{config:Z})})},onSave:M,onCancel:function(){_(null),A(null)},saving:E,isNew:!1,t:n},H):i.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:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"font-mono text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:H}),P.displayName&&P.displayName!==H&&i.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",P.displayName,")"]}),P.url&&i.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",P.url]}),!P.url&&P.target&&i.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",P.target]}),P.limit&&P.limit.context&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:P.limit.context/1e3})})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx("button",{type:"button",onClick:function(){_({originalName:H,name:H,config:RV(P)}),p(!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:n("settings.model_registry.edit"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),i.jsx("button",{type:"button",onClick:function(){window.confirm(n("settings.model_registry.delete_confirm",{name:H}))&&O(H)},disabled:E,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:n("settings.model_registry.delete"),children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})})]})]},H)}),f&&i.jsx(vT,{name:g,config:x,setName:m,setConfig:function(H){v(function(P){return typeof H=="function"?H(P):H})},onSave:C,onCancel:function(){p(!1),A(null)},saving:E,isNew:!0,t:n})]})]})]})}function IV({setting:e,value:t,onChange:n,error:r,models:a,t:o}){const[l,u]=y.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 "+(r?"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",p=e.type==="model-select"&&a&&a.length>0&&t&&!a.find(function(m){return m.id===t});if(y.useEffect(function(){e.type!=="model-select"||!a||a.length===0||t&&a.find(function(m){return m.id===t})&&u(!1)},[t,a,e.type]),e.type==="model-select"){if(!a||a.length===0)return i.jsxs("div",{children:[i.jsx("input",{type:"text",value:t,onChange:function(v){n(v.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.custom_model_placeholder"),className:f}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const m=l||p,x=CW(a);return i.jsxs("div",{children:[i.jsxs("select",{value:m?"__custom__":t,onChange:function(v){v.target.value==="__custom__"?u(!0):(u(!1),n(v.target.value))},disabled:d,className:f,children:[Object.entries(x).map(function(v){var k=v[0],_=v[1];return i.jsx("optgroup",{label:SW[k]||k,children:_.map(function(E){return i.jsxs("option",{value:E.id,children:[E.name,NW(E.tier)]},E.id)})},k)}),i.jsx("option",{value:"__custom__",children:o("settings.custom_model")})]}),m&&i.jsx("input",{type:"text",value:t,onChange:function(v){n(v.target.value)},disabled:d,placeholder:o("settings.custom_model_placeholder"),className:f+" mt-2 font-mono"}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="boolean"){const m=typeof t=="string"?t.toLowerCase():String(t),x=m==="true"||m==="1";return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"button",role:"switch","aria-checked":x,"aria-label":e.label,disabled:d,onClick:function(){n(x?"false":"true")},className:"relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(x?"bg-primary-600":"bg-gray-200 dark:bg-gray-600")+(d?" opacity-50 cursor-not-allowed":""),children:i.jsx("span",{"aria-hidden":"true",className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out "+(x?"translate-x-5":"translate-x-0")})}),i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(x?"settings.enabled":"settings.disabled")})]}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="select")return i.jsxs("div",{children:[i.jsx("select",{value:t,onChange:function(m){n(m.target.value)},disabled:d,className:f,children:(e.options||[]).map(function(m){var x=e.optionLabels&&e.optionLabels[m]||m;return i.jsx("option",{value:m,children:x},m)})}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="number")return i.jsxs("div",{children:[i.jsx("input",{type:"number",value:t,onChange:function(m){n(m.target.value)},disabled:d,min:e.min,max:e.max,placeholder:e.defaultValue||o("settings.not_set"),className:f}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="textarea")return i.jsxs("div",{children:[i.jsx("textarea",{value:t,onChange:function(m){n(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f+" resize-y min-h-[80px]",rows:4}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="object")return i.jsxs("div",{children:[i.jsx(AV,{value:t,onChange:n,t:o}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const g=e.type==="password"?"password":"text";return i.jsxs("div",{children:[i.jsx("input",{type:g,value:t,onChange:function(m){n(m.target.value)},disabled:d,placeholder:e.defaultValue||o("settings.not_set"),className:f,autoComplete:e.type==="password"?"off":void 0}),r&&i.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}let ka=null;function jA(){if(ka&&ka.state==="closed"&&(ka=null),!ka){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{ka=new e}catch(t){throw ka=null,t}}return ka.state==="suspended"&&ka.resume().catch(()=>{}),ka}if(typeof document<"u"){const e=async()=>{let t;try{t=jA()}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"&&(ka=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function MV(){let e;try{e=jA()}catch{return}if(e)try{const t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.value=800,r.gain.setValueAtTime(.3,t),r.gain.exponentialRampToValueAtTime(.01,t+.1),n.connect(r),r.connect(e.destination),n.start(t),n.stop(t+.1);const a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.value=1e3,o.gain.setValueAtTime(.3,t+.1),o.gain.exponentialRampToValueAtTime(.01,t+.2),a.connect(o),o.connect(e.destination),a.start(t+.1),a.stop(t+.2)}catch{e&&e.state!=="closed"&&e.close().catch(()=>{}),ka=null}}function LV(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function OV(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const TA="pave-native-notifications";function $u(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function DV(){return $u()?Notification.permission:"unsupported"}function qk(){if(!$u()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(TA)==="true"}catch{return!1}}function PV(e){try{localStorage.setItem(TA,e?"true":"false")}catch{}}async function FV(){if(!$u())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function BV({title:e,body:t,tag:n,icon:r,onClick:a}){if(!$u()||Notification.permission!=="granted"||!qk())return null;try{const o=new Notification(e,{body:t||"",tag:n||"pave-"+Date.now(),icon:r||xr("/pave-logo-light.png"),silent:!1});return typeof a=="function"&&(o.onclick=function(){a(),o.close()}),setTimeout(()=>{try{o.close()}catch{}},8e3),o}catch{return null}}const RA="pave-push-notifications",zV="/sw.js";function xp(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function qV(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function UV(){try{return localStorage.getItem(RA)==="true"}catch{return!1}}function Bf(e){try{localStorage.setItem(RA,e?"true":"false")}catch{}}function Bb(){return typeof Notification>"u"?"unsupported":Notification.permission}async function HV(){if(!xp())return null;try{return await navigator.serviceWorker.register(xr(zV),{scope:xr("/")})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function $V(){if(!xp())return console.warn("[web-push] Not supported in this browser"),!1;const e=await HV();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 r=await fetch(xr("/api/push/vapid-public-key"),{credentials:"include"});if(!r.ok)throw new Error("Failed to get VAPID key");const a=await r.json();t=QV(a.publicKey)}catch(r){return console.error("[web-push] Failed to get VAPID key:",r.message),!1}let n=await e.pushManager.getSubscription();if(n){let r=!0;if(n.options&&n.options.applicationServerKey){const a=new Uint8Array(n.options.applicationServerKey);r=YV(a,t)}if(r)return await kT(n),Bf(!0),!0;console.log("[web-push] VAPID key changed, re-subscribing...");try{await n.unsubscribe()}catch{}}try{n=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t})}catch(r){return console.error("[web-push] Push subscription failed:",r.message),!1}return await kT(n),Bf(!0),console.log("[web-push] Subscribed successfully:",n.endpoint),!0}async function WV(){if(!xp())return!1;try{const e=await navigator.serviceWorker.getRegistration();if(e){const t=await e.pushManager.getSubscription();t&&(await fetch(xr("/api/push/unsubscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({endpoint:t.endpoint})}).catch(()=>{}),await t.unsubscribe())}return Bf(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),Bf(!1),!1}}async function kT(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:_T(e.getKey("p256dh")),auth:_T(e.getKey("auth"))}},await fetch(xr("/api/push/subscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function VV(){const e=await fetch(xr("/api/push/test"),{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function GV(e){if(typeof document>"u"||typeof window>"u")return;function t(n){const r=typeof e=="function"?e():null,a=JSON.stringify({visible:n,activeSessionId:r});try{if(navigator.sendBeacon){const o=new Blob([a],{type:"application/json"});navigator.sendBeacon(xr("/api/visibility"),o);return}fetch(xr("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:a}).catch(()=>{})}catch{}}document.addEventListener("visibilitychange",()=>{t(document.visibilityState==="visible")}),window.addEventListener("blur",()=>{t(!1)}),window.addEventListener("focus",()=>{t(!0)}),t(document.visibilityState==="visible")}function KV(e,t){if(typeof document>"u")return;const n=JSON.stringify({visible:e,activeSessionId:t});try{if(navigator.sendBeacon){const r=new Blob([n],{type:"application/json"});navigator.sendBeacon(xr("/api/visibility"),r);return}fetch(xr("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:n}).catch(()=>{})}catch{}}function YV(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function QV(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4),r=atob(t+n),a=new Uint8Array(r.length);for(let o=0;o<r.length;o++)a[o]=r.charCodeAt(o);return a}function _T(e){if(!e)return"";const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const Wu="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900";function Uk({t:e}){return i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:e("settings.auto_saved")})}function yp({id:e,label:t,description:n,hints:r,checked:a,onToggle:o,disabled:l,supported:u=!0,unsupportedText:d="",divided:f=!1}){return i.jsxs("div",{className:"flex items-center justify-between"+(f?" mt-4 pt-4 border-t border-gray-200 dark:border-gray-700":""),children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:n}),r]}),u?i.jsx("button",{id:e,type:"button",role:"switch","aria-checked":a,onClick:o,disabled:l,className:"relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:opacity-50 "+(a?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:i.jsx("span",{className:"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out "+(a?"translate-x-5":"translate-x-0")})}):i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:d})]})}function XV(){const{t:e,locale:t,setLocale:n,availableLocales:r}=rn();return i.jsxs("div",{className:Wu,children:[i.jsx("label",{htmlFor:"settings-language",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:e("settings.language")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:e("settings.language_description")}),i.jsx("select",{id:"settings-language",value:t,onChange:function(a){n(a.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:r.map(function(a){return i.jsxs("option",{value:a.code,children:[a.nativeName," (",a.name,")"]},a.code)})}),i.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:e("settings.language_auto_applied")})]})}function ZV(){const{t:e}=rn(),[t,n]=y.useState(()=>LV()),r=y.useCallback(function(){const a=!t;n(a),OV(a),a&&MV()},[t]);return i.jsxs("div",{className:Wu,children:[i.jsx(yp,{id:"settings-notification-sound",label:e("settings.notification_sound"),description:e("settings.notification_sound_desc"),hints:i.jsx(Uk,{t:e}),checked:t,onToggle:r}),i.jsx(JV,{}),i.jsx(eG,{})]})}function JV(){const{t:e}=rn(),[t]=y.useState(()=>$u()),[n,r]=y.useState(()=>DV()),[a,o]=y.useState(()=>qk()),l=y.useCallback(async function(){if(!t)return;if(!a&&Notification.permission!=="granted"){const d=await FV();if(r(d),d!=="granted")return}const u=!a;o(u),PV(u)},[a,t]);return i.jsx(yp,{id:"settings-native-notifications",divided:!0,label:e("settings.native_notifications"),description:e("settings.native_notifications_desc"),hints:i.jsxs(i.Fragment,{children:[n==="denied"&&i.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:e("settings.native_notifications_blocked")}),n==="default"&&i.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:e("settings.native_notifications_permission")}),i.jsx(Uk,{t:e})]}),checked:a,onToggle:l,supported:t,unsupportedText:e("settings.native_notifications_unsupported")})}function eG(){const[e]=y.useState(()=>xp()),[t,n]=y.useState(()=>UV()),[r,a]=y.useState(()=>Bb()),[o,l]=y.useState(!1),u=y.useCallback(async function(){if(!(!e||o)){l(!0);try{t?(await WV(),n(!1)):(await $V()&&n(!0),a(Bb()))}catch(f){console.error("[settings] Web push toggle failed:",f.message)}finally{l(!1)}}},[t,e,o]),d=y.useCallback(async function(){if(!o){l(!0);try{const f=await VV();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 i.jsx(yp,{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:i.jsxs(i.Fragment,{children:[e&&!qV()&&i.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."}),r==="denied"&&i.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&&i.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 tG({mobileFrameless:e,onMobileFramelessChange:t}){const{t:n}=rn();return i.jsx("div",{className:Wu,children:i.jsx(yp,{id:"settings-mobile-frameless",label:n("settings.mobile_frameless"),description:n("settings.mobile_frameless_desc"),hints:i.jsx(Uk,{t:n}),checked:e,onToggle:()=>t(!e)})})}function nG({activeSessionId:e}){const{t}=rn(),[n,r]=y.useState(()=>Bl()||""),[a,o]=y.useState(()=>Bl()||""),[l,u]=y.useState(""),[d,f]=y.useState(null),[p,g]=y.useState(!1),[m,x]=y.useState(null);y.useEffect(function(){ev().then(function(E){u(E.home||"")}).catch(function(){})},[]);const v=y.useCallback(function(E){r(E),f(null),x(null)},[]),k=y.useCallback(async function(){const E=n.trim();if(!E){if(Ah(null),o(""),r(""),f(null),x({type:"success",message:t("settings.working_dir_reset")}),e)try{await qi(e,{directory:null})}catch(N){console.warn("[settings] failed to clear session directory:",N.message)}return}g(!0),f(null);const S=Bl();try{Ah(E);const N=await ev();if(o(E),r(E),x({type:"success",message:t("settings.working_dir_updated",{path:N.cwd})}),e)try{await qi(e,{directory:E})}catch(A){console.warn("[settings] failed to update session directory:",A.message)}}catch(N){Ah(S),r(a),f(t("settings.working_dir_invalid",{error:N.message}))}finally{g(!1)}},[n,a,e,t]),_=n!==a;return i.jsxs("div",{className:Wu,children:[i.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")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("settings.working_dir_desc")}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{id:"settings-working-dir",type:"text",value:n,onChange:function(E){v(E.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"}),i.jsx("button",{onClick:k,disabled:p||!_,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors whitespace-nowrap "+(_&&!p?"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(p?"settings.validating":"settings.apply")})]}),d&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:d}),m&&i.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}),a&&i.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:t("settings.currently_set_to",{path:a})})]})}function rG(){const{t:e}=rn(),[t,n]=y.useState("checking"),[r,a]=y.useState(null),[o,l]=y.useState(null),[u,d]=y.useState(null),f=y.useCallback(function(m){a(m.currentVersion),l(m.latestVersion),m.error?(d(m.error),n("check-error")):m.updateAvailable?n("update-available"):n("no-updates")},[]),p=y.useCallback(async function(){n("checking"),d(null);try{const m=await Oh();f(m)}catch(m){d(m.message),n("check-error")}},[f]),g=y.useCallback(async function(){n("updating"),d(null);try{await jL(),n("success");try{const m=await Oh();a(m.currentVersion),l(m.latestVersion)}catch{}}catch(m){d(m.message),n("error")}},[]);return y.useEffect(function(){var m=!1;return n("checking"),(async function(){try{const v=await Oh();m||f(v)}catch(v){m||(d(v&&v.message?v.message:String(v)),n("check-error"))}})(),function(){m=!0}},[f]),i.jsx("div",{className:Wu,children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.current_version")}),i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r||"--"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.latest_version")}),i.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:t==="checking"?e("settings.checking_updates"):o||"--"})]}),i.jsx(iG,{t:e,updateStatus:t,updateError:u,latestVersion:o}),i.jsx(aG,{t:e,updateStatus:t,onCheckUpdates:p,onPerformUpdate:g})]})})}function iG({t:e,updateStatus:t,updateError:n,latestVersion:r}){return i.jsxs(i.Fragment,{children:[t==="update-available"&&i.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[e("settings.update_available")," (",r,")"]}),t==="no-updates"&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e("settings.no_updates")}),t==="success"&&i.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:e("settings.update_success")}),t==="check-error"&&n&&i.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.check_updates_failed"),": ",n]}),t==="error"&&n&&i.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.update_failed"),": ",n]})]})}function aG({t:e,updateStatus:t,onCheckUpdates:n,onPerformUpdate:r}){const a=t==="idle"||t==="no-updates"||t==="error"||t==="check-error"||t==="success";return i.jsxs("div",{className:"flex gap-2 pt-1",children:[a&&i.jsx("button",{onClick:n,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"&&i.jsx("button",{onClick:r,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"&&i.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"&&i.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 Iv(e){const t={};for(let n=0;n<e.length;n++)t[e[n].key]=e[n].value;return t}function sG(e,t){const n={};for(let r=0;r<e.length;r++){const a=e[r];a.source!=="env"&&t[a.key]!==a.value&&(n[a.key]=t[a.key])}return n}function oG(e,t,n){const r=Iv(e);for(let a=0;a<n.length;a++)t[n[a]]!==void 0&&(r[n[a]]=t[n[a]]);return r}function lG(e){const t={};for(let n=0;n<e.length;n++){const r=e[n].category;t[r]||(t[r]=[]),t[r].push(e[n])}return t}function cG(e,t){const n=[];for(let a=0;a<t.length;a++)e[t[a]]&&n.push(t[a]);const r=Object.keys(e);for(let a=0;a<r.length;a++)n.indexOf(r[a])<0&&n.push(r[a]);return n}const uG=["AI Model & Provider","Prefill Fallback","Models","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Session Banner","Marketplace","System Prompts","WhatsApp","Experimental Features","Developer"],zf={"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 dG(){const{t:e}=rn(),[t,n]=y.useState([]),[r,a]=y.useState({}),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[g,m]=y.useState(null),[x,v]=y.useState(null),k=y.useCallback(async()=>{try{d(!0),v(null);const R=(await tv()).settings||[];n(R),a(Iv(R)),l({}),m(null)}catch(T){v(T.message)}finally{d(!1)}},[]),_=y.useCallback((T,R)=>{a(C=>{const O={...C};return O[T]=R,O}),l(C=>{if(!C[T])return C;const{[T]:O,...M}=C;return M}),m(null)},[]),E=sG(t,r),S=Object.keys(E).length,N=y.useCallback(async()=>{p(!0),m(null);try{if(S===0){m({type:"info",message:e("settings.no_changes")});return}const T=await lL(E),R=Object.keys(T.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(E)}}))}catch{}if(R.length>0?(l(T.errors),m({type:"warning",message:e("settings.partial_save")})):(l({}),m({type:"success",message:e("settings.saved")})),T.settings){const C=T.settings;n(C),a(O=>oG(C,O,R))}}catch(T){if(T&&T.status===401){m({type:"error",message:"Session expired. Please log in again."});return}m({type:"error",message:e("settings.save_failed",{error:T.message})})}finally{p(!1)}},[E,S,e]),A=y.useCallback(()=>{a(Iv(t)),l({}),m(null)},[t]);return{settings:t,formValues:r,errors:o,loading:u,saving:f,saveResult:g,setSaveResult:m,loadError:x,updates:E,changedCount:S,loadSettings:k,handleChange:_,handleSave:N,handleReset:A}}function fG(){return i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})})}function pG({t:e,loadError:t,onRetry:n}){return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[i.jsx("p",{className:"text-red-600 dark:text-red-400",children:e("settings.failed_to_load",{error:t})}),i.jsx("button",{onClick:n,className:"px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700",children:e("common.retry")})]})}const AA="__dlp__",IA="__pricing__",MA="__chat_language__",LA="__chat_notifications__",OA="__chat_appearance__",DA="__chat_workspace__",PA="__chat_version__",wT={[MA]:XV,[LA]:ZV,[OA]:tG,[DA]:nG,[PA]:rG};function hG(e,t){return t?e.filter(function(n){return(n.key||"").toLowerCase().indexOf(t)>=0||(n.label||"").toLowerCase().indexOf(t)>=0||(n.description||"").toLowerCase().indexOf(t)>=0}):null}function gG(e){const t={};if(!e)return t;for(let n=0;n<e.length;n++){const r=e[n].category;t[r]=(t[r]||0)+1}return t}function mG({t:e,search:t,onSearchChange:n,onBack:r,groups:a,activeGroup:o,matchCounts:l,searching:u,onSelect:d}){return i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[i.jsx("button",{onClick:r,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:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e("settings.title")}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:e("settings.v2.badge")})]}),i.jsx("select",{value:o,onChange:function(f){d(f.target.value)},"aria-label":e("settings.v2.groups_aria"),className:"md:hidden shrink-0 max-w-[9rem] truncate border text-sm py-1.5 pl-2 pr-6 bg-[#ffffff] dark:bg-[#111827] border-[#d1d5db] dark:border-[#4b5563] text-[#111827] dark:text-[#f3f4f6]",children:a.map(function(f){const p=u?l[f.id]:null;return i.jsx("option",{value:f.id,children:p?f.label+" ("+p+")":f.label},f.id)})}),i.jsxs("div",{className:"flex-1 max-w-md ml-auto relative",children:[i.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:i.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"})}),i.jsx("input",{id:"settings-v2-search",type:"text",value:t,onChange:function(f){n(f.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-hidden focus:ring-2 focus:ring-primary-500 focus:border-primary-500"}),t&&i.jsx("button",{type:"button",onClick:function(){n("")},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:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function xG({t:e,groups:t,activeGroup:n,matchCounts:r,searching:a,onSelect:o}){return i.jsx("nav",{className:"hidden md:block w-52 shrink-0 border-r border-gray-200 dark:border-gray-700 overflow-y-auto py-2","aria-label":e("settings.v2.groups_aria"),"data-testid":"settings-v2-groups",children:t.map(function(l){const u=!a&&l.id===n,d=a?r[l.id]:l.kind==="registry"?l.count:null,f=!a||r[l.id];return i.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:[i.jsx("span",{className:"truncate",children:l.label}),f&&d!=null&&i.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums shrink-0",children:d})]},l.id)})})}function yG({setting:e,formValue:t,error:n,models:r,t:a,onChange:o}){const l=e.source==="env";return i.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:[i.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[i.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.label}),l&&i.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:a("settings.env_override",{envVar:e.envVar}),children:a("settings.source_env")})]}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 break-words",children:[e.description,e.requiresRestart&&i.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:a("settings.requires_restart")}),e.source==="env"&&i.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:a("settings.env_override",{envVar:e.envVar})}),i.jsx("span",{className:"block mt-0.5 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:e.key})]}),i.jsx(IV,{setting:e,value:t!==void 0?t:"",onChange:o,error:n,models:r,t:a}),e.source!=="default"&&e.defaultValue!==void 0&&e.type!=="object"&&i.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:a("settings.default_prefix",{value:e.defaultValue===""?a("settings.default_empty"):String(e.defaultValue)})})]})}function ET({title:e,description:t,actionLabel:n,onOpen:r}){return i.jsxs("div",{className:"p-6 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:e}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:t}),i.jsx("button",{type:"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:n})]})}function bG({t:e,changedCount:t,saving:n,saveResult:r,onSave:a,onReset:o}){const l=r?r.type==="success"?"text-green-600 dark:text-green-400":r.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400":"";return i.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:[i.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}):""}),r&&i.jsx("span",{className:"text-xs "+l,children:r.message}),i.jsxs("div",{className:"ml-auto flex gap-2",children:[i.jsx("button",{type:"button",onClick:o,disabled:t===0||n,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")}),i.jsx("button",{type:"button",onClick:a,disabled:t===0||n,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(n?"settings.saving":"settings.save")})]})]})}function vG({t:e}){return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[i.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:i.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"})}),i.jsx("p",{className:"text-sm",children:e("settings.v2.no_matches")})]})}function kG(e){const{q:t,matches:n,orderedCategories:r,grouped:a,renderRegistryRow:o,activeGroup:l,t:u,onOpenDlpSettings:d,onOpenPricingSettings:f,activeSessionId:p,mobileFrameless:g,onMobileFramelessChange:m}=e;let x;if(t&&(!n||n.length===0))x=i.jsx(vG,{t:u});else if(t)x=i.jsxs("div",{className:"space-y-6",children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u("settings.v2.search_results",{count:n.length})}),r.map(function(v){const k=n.filter(function(_){return _.category===v});return k.length===0?null:i.jsxs("section",{children:[i.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:zf[v]?u(zf[v]):v}),i.jsx("div",{className:"space-y-3",children:k.map(o)})]},"search-"+v)})]});else if(l===AA)x=i.jsx(ET,{title:u("dlp.title"),description:"Configure Data Loss Prevention rules, detectors, and audit policies.",actionLabel:u("settings.v2.open"),onOpen:d});else if(l===IA)x=i.jsx(ET,{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(wT[l]){const v=wT[l];x=i.jsx("div",{className:"space-y-3",children:i.jsx(v,{activeSessionId:p,mobileFrameless:g,onMobileFramelessChange:m})})}else x=i.jsx("div",{className:"space-y-3",children:(a[l]||[]).map(o)});return x}function _G({onBack:e,onOpenDlpSettings:t,onOpenPricingSettings:n,activeSessionId:r,mobileFrameless:a,onMobileFramelessChange:o}){const{t:l}=rn(),{settings:u,formValues:d,errors:f,loading:p,saving:g,saveResult:m,loadError:x,changedCount:v,loadSettings:k,handleChange:_,handleSave:E,handleReset:S}=dG(),N=u.filter(function(le){return!le.hidden}),[A,T]=y.useState([]),[R,C]=y.useState(""),[O,M]=y.useState(null);y.useEffect(()=>{k()},[k]),y.useEffect(()=>{M(function(le){return le||u[0]&&u[0].category||null})},[u]),y.useEffect(()=>{let le=!1;return TL().then(function(B){le||T(Array.isArray(B)?B:B&&B.models||[])}).catch(function(){le||T([])}),function(){le=!0}},[]);const I=lG(N),D=cG(I,uG),F=D.map(function(le){return{id:le,kind:"registry",label:zf[le]?l(zf[le]):le,count:I[le].length}}).concat([{id:MA,kind:"chat",label:l("settings.category.language")},{id:LA,kind:"chat",label:l("settings.notifications")},{id:OA,kind:"chat",label:l("settings.appearance")},{id:DA,kind:"chat",label:l("settings.workspace")},{id:PA,kind:"chat",label:l("settings.version_title")},{id:AA,kind:"launcher",label:l("dlp.title")},{id:IA,kind:"launcher",label:l("pricing.title")}]),ee=R.trim().toLowerCase(),H=hG(N,ee),P=gG(H),K=y.useCallback(function(le){C(""),M(le)},[]),V=function(le){return i.jsx(yG,{setting:le,formValue:d[le.key],error:f[le.key],models:A,t:l,onChange:function(B){_(le.key,B)}},le.key)};if(p)return i.jsx(fG,{});if(x)return i.jsx(pG,{t:l,loadError:x,onRetry:k});const Z=kG({q:ee,matches:H,orderedCategories:D,grouped:I,renderRegistryRow:V,activeGroup:O,t:l,onOpenDlpSettings:t,onOpenPricingSettings:n,activeSessionId:r,mobileFrameless:a,onMobileFramelessChange:o});return i.jsxs("div",{className:"h-full flex flex-col","data-page":"settings-v2",children:[i.jsx(mG,{t:l,search:R,onSearchChange:C,onBack:e,groups:F,activeGroup:O,matchCounts:P,searching:!!ee,onSelect:K}),i.jsxs("div",{className:"flex-1 flex min-h-0",children:[i.jsx(xG,{t:l,groups:F,activeGroup:O,matchCounts:P,searching:!!ee,onSelect:K}),i.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[i.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:Z}),i.jsx(bG,{t:l,changedCount:v,saving:g,saveResult:m,onSave:E,onReset:S})]})]})]})}function wG({modelName:e,rates:t,onChange:n,onDelete:r,isDefault:a,t:o}){return i.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`text-sm font-medium truncate ${a?"text-primary-600 dark:text-primary-400":"text-gray-900 dark:text-gray-100"}`,children:e}),a&&i.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")})]})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_input")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:t.input,onChange:l=>n(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")})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_output")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:t.output,onChange:l=>n(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")})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_cache")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:t.cached,onChange:l=>n(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")})]}),!a&&i.jsx("button",{onClick:()=>r(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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),a&&i.jsx("div",{className:"w-6"})]})]})}function EG({onAdd:e,existingModels:t,t:n}){const[r,a]=y.useState(""),[o,l]=y.useState(5),[u,d]=y.useState(15),[f,p]=y.useState(2.5),[g,m]=y.useState(""),x=v=>{v.preventDefault(),m("");const k=r.trim().toLowerCase();if(!k){m(n("pricing.model_required"));return}if(t.includes(k)){m(n("pricing.model_exists"));return}if(k==="default"){m(n("pricing.default_exists"));return}e(k,{input:o,output:u,cached:f}),a(""),l(5),d(15),p(2.5)};return i.jsxs("form",{onSubmit:x,className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[i.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("pricing.add_new_model")}),i.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[i.jsx("div",{className:"flex-1 min-w-[120px]",children:i.jsx("input",{type:"text",placeholder:n("pricing.add_model_placeholder"),value:r,onChange:v=>a(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"})}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_input")}),i.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"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_output")}),i.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"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_cache")}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:f,onChange:v=>p(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"})]}),i.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:n("pricing.add")})]}),g&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:g})]})}function SG({onClose:e}){const{t}=rn(),n=Au(),[r,a]=y.useState(null),[o,l]=y.useState(!0),[u,d]=y.useState(!1),[f,p]=y.useState(null),[g,m]=y.useState(!1),x=y.useRef(null);y.useEffect(()=>{let T=!1;async function R(){try{const C=await EL();T||(a(C),l(!1))}catch(C){T||(p(C.message),l(!1))}}return R(),()=>{T=!0}},[]),y.useEffect(()=>{async function T(R){R.key==="Escape"&&(g?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",T),x.current&&x.current.focus(),()=>document.removeEventListener("keydown",T)},[e,g,n,t]);const v=y.useCallback((T,R,C)=>{a(O=>!O||!O.models?O:{...O,models:{...O.models,[T]:{...O.models[T],[R]:C}}}),m(!0)},[]),k=y.useCallback(async T=>{await n({title:t("pricing.remove_title"),message:t("pricing.remove_confirm",{model:T}),destructive:!0,confirmLabel:t("pricing.remove_model")})&&(a(R=>{if(!R||!R.models)return R;const C={...R.models};return delete C[T],{...R,models:C}}),m(!0))},[n,t]),_=y.useCallback((T,R)=>{a(C=>C?{...C,models:{...C.models,[T]:R}}:{models:{[T]:R}}),m(!0)},[]),E=y.useCallback(async()=>{p(null),d(!0);try{await SL(r),m(!1),e()}catch(T){p(T.message)}finally{d(!1)}},[r,e]),S=y.useCallback(async()=>{if(await n({title:t("pricing.reset_title"),message:t("pricing.reset_confirm"),destructive:!0,confirmLabel:t("pricing.reset")})){p(null),d(!0);try{const T=await NL();a(T.pricing),m(!1)}catch(T){p(T.message)}finally{d(!1)}}},[n,t]),N=y.useCallback(async()=>{g?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[g,e,n,t]),A=r!=null&&r.models?Object.entries(r.models).sort(([T],[R])=>T==="default"?1:R==="default"?-1:T.localeCompare(R)):[];return i.jsx("div",{ref:x,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:N,role:"dialog","aria-modal":"true","aria-label":t("pricing.title"),children:i.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:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),i.jsx("button",{onClick:N,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("pricing.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o&&i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),f&&i.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:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),!o&&r&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[i.jsx("span",{children:t("pricing.configured_count",{count:A.length})}),i.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),i.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[i.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:[i.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),i.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),i.jsx("div",{className:"w-6"})]}),i.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:A.map(([T,R])=>i.jsx(wG,{modelName:T,rates:R,onChange:v,onDelete:k,isDefault:T==="default",t},T))})]}),i.jsx(EG,{onAdd:_,existingModels:A.map(([T])=>T),t})]})]}),i.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:[i.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")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:N,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")}),i.jsxs("button",{onClick:E,disabled:u||!g,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&&i.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t("pricing.save_changes")]})]})]})]})})}const NG=[{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"}],CG=["low","medium","high"];function jG({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 i.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t[e]||t.medium}`,children:e})}function ST({name:e,regex:t,severity:n,enabled:r,builtin:a,onToggle:o,onRemove:l,t:u}){return i.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:[i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer shrink-0",children:[i.jsx("input",{type:"checkbox",checked:r,onChange:()=>o(e),className:"sr-only peer",disabled:!1}),i.jsx("div",{className:"w-8 h-4 bg-gray-200 peer-focus:outline-hidden 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"})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e}),a&&i.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"})]}),i.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})]}),i.jsx(jG,{severity:n}),!a&&i.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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function TG({onAdd:e,existingNames:t,t:n}){const[r,a]=y.useState(""),[o,l]=y.useState(""),[u,d]=y.useState("medium"),[f,p]=y.useState(""),g=x=>{if(t.includes(x.name)){p(n("dlp.pattern_exists",{name:x.name}));return}a(x.name),l(x.regex),d(x.severity),p("")},m=x=>{if(x.preventDefault(),p(""),!r.trim()){p(n("dlp.name_required"));return}if(!o.trim()){p(n("dlp.regex_required"));return}if(t.includes(r.trim())){p(n("dlp.pattern_exists",{name:r.trim()}));return}try{new RegExp(o)}catch{p(n("dlp.invalid_regex"));return}e(r.trim(),o.trim(),u),a(""),l(""),d("medium")};return i.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[i.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("dlp.add_pattern")}),i.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:NG.map(x=>i.jsx("button",{onClick:()=>g(x),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:x.label},x.id))}),i.jsxs("form",{onSubmit:m,className:"flex items-end gap-2 flex-wrap",children:[i.jsxs("div",{className:"flex-1 min-w-[140px]",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.pattern_name")}),i.jsx("input",{type:"text",placeholder:"e.g. hk_passport",value:r,onChange:x=>a(x.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"})]}),i.jsxs("div",{className:"flex-[2] min-w-[200px]",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.regex_pattern")}),i.jsx("input",{type:"text",placeholder:"e.g. \\b[A-Z]\\d{7}\\b",value:o,onChange:x=>l(x.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"})]}),i.jsxs("div",{className:"w-24",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.severity")}),i.jsx("select",{value:u,onChange:x=>d(x.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:CG.map(x=>i.jsx("option",{value:x,children:x},x))})]}),i.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:n("dlp.add")})]}),f&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:f})]})}function RG({onClose:e}){const{t}=rn(),n=Au(),[r,a]=y.useState(null),[o,l]=y.useState([]),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[g,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(!0),[E,S]=y.useState("ask"),[N,A]=y.useState([]),[T,R]=y.useState({}),[C,O]=y.useState("epm/privacy"),M=y.useRef(null);y.useEffect(()=>{let K=!1;async function V(){var Z;try{const le=await hL();K||(l(le.builtins||[]),_(le.enabled!==!1),S(le.defaultAction||"ask"),A(le.disabledBuiltins||[]),R(le.patterns||{}),O(((Z=le.privateMode)==null?void 0:Z.rerouteModel)||"epm/privacy"),a(le),d(!1))}catch(le){K||(m(le.message),d(!1))}}return V(),()=>{K=!0}},[]),y.useEffect(()=>{async function K(V){V.key==="Escape"&&(x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",K),M.current&&M.current.focus(),()=>document.removeEventListener("keydown",K)},[e,x,n,t]);const I=y.useCallback(K=>{A(V=>V.includes(K)?V.filter(Z=>Z!==K):[...V,K]),v(!0)},[]),D=y.useCallback((K,V,Z)=>{R(le=>({...le,[K]:{regex:V,severity:Z}})),v(!0)},[]),F=y.useCallback(K=>{R(V=>{const Z={...V};return delete Z[K],Z}),v(!0)},[]),ee=y.useCallback(async()=>{m(null),p(!0);try{const V=await gL({enabled:k,defaultAction:E,disabledBuiltins:N,privateMode:{rerouteModel:C},patterns:T});v(!1),a(V.policy),e()}catch(K){m(K.message)}finally{p(!1)}},[k,E,N,T,C,e]),H=y.useCallback(async()=>{x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[x,e,n,t]),P=[...o.map(K=>K.name),...Object.keys(T)];return i.jsx("div",{ref:M,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:H,role:"dialog","aria-modal":"true","aria-label":t("dlp.title"),children:i.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:K=>K.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("dlp.heading")}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("dlp.subtitle")})]}),i.jsx("button",{onClick:H,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("dlp.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[u&&i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),g&&i.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:i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:g})}),!u&&i.jsxs(i.Fragment,{children:[i.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:[i.jsxs("div",{children:[i.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t("dlp.enable_label")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("dlp.enable_desc")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:k,onChange:K=>{_(K.target.checked),v(!0)},className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-hidden 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"})]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.default_action_label")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.default_action_desc")}),i.jsxs("select",{value:E,onChange:K=>{S(K.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:[i.jsx("option",{value:"ask",children:"Ask (show modal)"}),i.jsx("option",{value:"reroute",children:"Always reroute to private"}),i.jsx("option",{value:"warn",children:"Warn only (proceed on cloud)"})]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.reroute_model_label")}),i.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.reroute_model_desc")}),i.jsx("input",{type:"text",value:C,onChange:K=>{O(K.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"})]}),i.jsxs("div",{className:"mb-4 mt-6",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.builtin_patterns")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.builtin_desc")}),i.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(K=>i.jsx(ST,{name:K.name,regex:K.regex,severity:K.severity,enabled:!N.includes(K.name),builtin:!0,onToggle:I,onRemove:()=>{},t},K.name))})]}),i.jsxs("div",{className:"mb-4 mt-4",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.user_patterns")}),i.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?i.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")}):i.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(([K,V])=>i.jsx(ST,{name:K,regex:V.regex,severity:V.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:F,t},K))})]}),i.jsx(TG,{onAdd:D,existingNames:P,t})]})]}),!u&&i.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-800",children:[i.jsx("button",{onClick:H,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")}),i.jsx("button",{onClick:ee,disabled:f||!x,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 AG(e,t){var n={grant:"permission.action_grant",revoke:"permission.action_revoke",clear:"permission.action_clear_all"},r={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 a=n[e.action]?t(n[e.action]):e.action,o=r[e.type]?t(r[e.type]):e.type;return t("permission.request_desc",{action:a,type:o,target:e.target||"*"})}function IG({request:e,onDismiss:t}){const{t:n}=rn(),[r,a]=y.useState(null),[o,l]=y.useState(null),u=y.useRef(!0),d=y.useRef(null);y.useEffect(()=>()=>{u.current=!1,d.current&&clearTimeout(d.current)},[]);const f=y.useCallback(v=>{v.includes("not found")||v.includes("expired")?l("Request expired"):v.includes("already")?l("Request already processed"):l(v),a("dismissing"),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u.current&&t(e.id)},2e3)},[e.id,t]),p=y.useCallback(async()=>{a("allow"),l(null);try{const v=await NM(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]),g=y.useCallback(async()=>{a("deny"),l(null);try{const v=await CM(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",x=e.action==="revoke";return i.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:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 ${m?"bg-red-100 dark:bg-red-900/30":x?"bg-amber-100 dark:bg-amber-900/30":"bg-blue-100 dark:bg-blue-900/30"}`,children:i.jsx("svg",{className:`w-4 h-4 ${m?"text-red-600 dark:text-red-400":x?"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:i.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"})})}),i.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:n("permission.title")})]}),i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:AG(e,n)}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:[n("permission.reason_prefix")," ",typeof e.reason=="string"&&e.reason.trim()?e.reason:n("permission.no_reason")]}),o&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-2",children:o}),i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx("button",{onClick:g,disabled:r!==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:n(r==="deny"?"permission.denying":"permission.deny")}),i.jsx("button",{onClick:p,disabled:r!==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":x?"bg-amber-600 hover:bg-amber-700":"bg-blue-600 hover:bg-blue-700"}`,children:n(r==="allow"?"permission.allowing":"permission.allow")})]})]})}function MG({requests:e,onDismiss:t}){return!e||e.length===0?null:i.jsx(i.Fragment,{children:e.map(n=>i.jsx(IG,{request:n,onDismiss:t},n.id))})}var LG="https://account.openpave.ai/dashboard";function OG({open:e,onClose:t,upgradeUrl:n}){var{t:r}=rn(),a=y.useRef(null),o=y.useRef(null),l=y.useRef(t),u=LG;if(typeof n=="string"&&n.length>0)try{var d=new URL(n),f=["account.openpave.ai"];d.protocol==="https:"&&f.indexOf(d.hostname)!==-1&&(u=d.href)}catch{}return y.useEffect(function(){l.current=t},[t]),y.useEffect(function(){e&&o.current&&o.current.focus()},[e]),y.useEffect(function(){if(!e)return;function p(g){g.key==="Escape"&&(typeof g.preventDefault=="function"&&g.preventDefault(),typeof g.stopImmediatePropagation=="function"?g.stopImmediatePropagation():typeof g.stopPropagation=="function"&&g.stopPropagation(),l.current())}return document.addEventListener("keydown",p,!0),function(){document.removeEventListener("keydown",p,!0)}},[e]),y.useEffect(function(){if(!e||!a.current)return;function p(g){if(g.key==="Tab"){var m=a.current.querySelectorAll("button:not([disabled]), a:not([disabled])");if(m.length!==0){var x=m[0],v=m[m.length-1];g.shiftKey?document.activeElement===x&&(g.preventDefault(),v.focus()):document.activeElement===v&&(g.preventDefault(),x.focus())}}}return document.addEventListener("keydown",p),function(){document.removeEventListener("keydown",p)}},[e]),e?i.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-xs transition-opacity duration-150",onClick:function(p){p.target===p.currentTarget&&t()},children:i.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":r("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-hidden transition-all duration-150",children:[i.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center gap-3",children:[i.jsx("span",{className:"text-2xl",role:"img","aria-hidden":"true",children:"🪙"}),i.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("credits.limit_reached")})]}),i.jsx("div",{className:"px-5 py-4",children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("credits.limit_message")})}),i.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[i.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-hidden focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:r("credits.dismiss")}),i.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-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 inline-flex items-center gap-1.5",children:[r("credits.add_credits"),i.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:[i.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"}),i.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 DG(e){if(e==null)return"";const t=Date.now()-e;if(t<=0)return"just now";const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const a=Math.floor(r/60);if(a<24)return`${a}h ago`;const o=Math.floor(a/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function zb(e,t){if(!e||!t)return!e;const n=String(e).toLowerCase(),r=String(t).toLowerCase();let a=0;for(let o=0;o<r.length&&a<n.length;o+=1)r[o]===n[a]&&(a+=1);return a===n.length}function PG(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function FG({isOpen:e,onClose:t,onSelectSession:n,onNewChat:r,activeSessionId:a,sessions:o,busySessions:l={}}){const{t:u}=rn(),[d,f]=y.useState(""),[p,g]=y.useState(0),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=y.useRef(null),E=y.useRef(null),S=y.useRef(null),N=d?d.trim():"";y.useEffect(()=>{if(e){f(""),g(0),x(null),k(!1);const M=requestAnimationFrame(()=>{_.current&&_.current.focus()});return()=>cancelAnimationFrame(M)}},[e]),y.useEffect(()=>{let M=!1;const I=d?d.trim():"";if(S.current&&(clearTimeout(S.current),S.current=null),!e){x(null),k(!1);return}if(I.length<2){x(null),k(!1);return}return x(null),k(!0),S.current=setTimeout(()=>{Pl({q:I,limit:20}).then(D=>{if(M)return;const F=Array.isArray(D)?D:D.sessions||[];x(F),k(!1)}).catch(()=>{M||k(!1)})},300),()=>{M=!0,S.current&&(clearTimeout(S.current),S.current=null)}},[d,e]);const A=y.useCallback(M=>{if(!a)return M;const I=M.findIndex(ee=>ee.id===a);if(I<=0)return M;const D=M.slice(),[F]=D.splice(I,1);return D.unshift(F),D},[a]),T=y.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:u("spotlight.new_chat")}),[u]),R=y.useMemo(()=>{const M=o||[],I=!N||zb(N,"new chat")||zb(N,u("spotlight.new_chat")),D=H=>I&&r?a&&H.length>0&&H[0].id===a?[H[0],T,...H.slice(1)]:[T,...H]:H;if(!N)return D(A(M.slice(0,10)));const F=M.filter(H=>zb(N,H.title||""));let ee;if(m){const H=new Set(F.map(K=>K.id)),P=m.filter(K=>!H.has(K.id));ee=F.concat(P).slice(0,20)}else ee=F.slice(0,20);return D(A(ee))},[N,o,m,A,T,r,u,a]);y.useEffect(()=>{g(0)},[N]),y.useEffect(()=>{g(M=>R.length===0?0:M>=R.length?R.length-1:M)},[R.length]),y.useEffect(()=>{if(!E.current)return;const M=E.current.querySelectorAll('[role="option"]');M[p]&&M[p].scrollIntoView({block:"nearest"})},[p,R.length]);const C=y.useCallback(M=>{if(M&&M.isAction&&M.actionType==="new-chat"){r&&r(),t();return}const I=typeof M=="string"?M:M==null?void 0:M.id;I&&n(I),t()},[n,r,t]),O=y.useCallback(M=>{M.key==="ArrowDown"?(M.preventDefault(),g(I=>R.length===0?0:(I+1)%R.length)):M.key==="ArrowUp"?(M.preventDefault(),g(I=>R.length===0?0:(I-1+R.length)%R.length)):M.key==="Enter"?(M.preventDefault(),R[p]&&C(R[p])):M.key==="Escape"&&(M.preventDefault(),t())},[R,p,C,t]);return e?i.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50",onClick:t,role:"presentation",children:i.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:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":u("spotlight.title"),children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[i.jsx("svg",{className:"w-5 h-5 text-gray-400 dark:text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),i.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-hidden",placeholder:u("spotlight.placeholder"),value:d,onChange:M=>f(M.target.value),onKeyDown:O,"aria-label":u("spotlight.placeholder"),"aria-controls":"spotlight-results","aria-activedescendant":R[p]?"spotlight-item-"+p:void 0,autoComplete:"off",spellCheck:"false"}),i.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"})]}),i.jsxs("div",{id:"spotlight-results",ref:E,role:"listbox","aria-label":u("spotlight.results"),className:"max-h-80 overflow-y-auto",children:[!N&&R.length>0&&i.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")}),R.map((M,I)=>{var D;return M.isAction&&M.actionType==="new-chat"?i.jsxs("div",{id:"spotlight-item-"+I,role:"option","aria-selected":I===p,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===p?"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:()=>C(M),children:[i.jsx("svg",{className:"w-4 h-4 shrink-0 text-blue-500 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("div",{className:"text-sm font-medium truncate",children:M.title})})]},M.id):i.jsxs("div",{id:"spotlight-item-"+I,role:"option","aria-selected":I===p,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${I===p?"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:()=>C(M),children:[i.jsx("svg",{className:"w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("div",{className:"text-sm font-medium truncate",children:M.title||u("spotlight.untitled")})}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l[M.id]&&i.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")}),M.id===a&&i.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")}),i.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:PG(M)}),i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:DG((D=M.time)==null?void 0:D.updated)})]})]},M.id)}),N&&R.length===0&&!v&&i.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.no_results")}),v&&R.length===0&&i.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.searching")})]}),i.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:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.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:"↑"}),i.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")]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.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")]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.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}function BG(e){return typeof e=="string"&&e?e:e&&typeof e=="object"&&e.providerID&&e.modelID?e.providerID+"/"+e.modelID:""}function zG(e){var{t}=rn(),n=e.session,r=e.directory,[a,o]=y.useState(""),[l,u]=y.useState(null);function d(v,k){try{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(k).then(function(){o(v)},function(){})}catch{}}function f(){if(!(!n||!n.soul)){if(l&&l.content!==void 0){u(null);return}u({loading:!0}),aM(n.id).then(function(v){v&&typeof v.content=="string"?u(v):u({error:t("chat.session_info_soul_error")})},function(v){u({error:v&&v.message||t("chat.session_info_soul_error")})})}}if(!n&&!r)return null;var p=n?BG(n.model):"",g=n?n.idleInjection:null,m=g&&g.enabled?g:null,x=n&&n.scheduledInjections?n.scheduledInjections.length:0;return i.jsxs("div",{className:"mt-4 pt-3 border-t border-gray-700",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-gray-400 mb-2",children:t("chat.session_info_title")}),n&&i.jsxs("div",{children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_soul")}),n.soul?i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("button",{type:"button",onClick:function(){d("soul",n.soul)},className:"flex-1 min-w-0 text-left text-sm text-gray-200 font-mono bg-gray-900 px-2 py-1 rounded truncate hover:bg-gray-700 transition-colors",title:a==="soul"?t("chat.session_info_copied"):n.soul,children:n.soul}),i.jsx("button",{type:"button",onClick:f,className:"shrink-0 text-xs text-gray-400 hover:text-gray-200 px-1",children:t("chat.session_info_view_soul")})]}):i.jsx("div",{className:"text-sm text-gray-500",children:t("chat.session_info_soul_default")}),l&&l.loading&&i.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t("chat.session_info_soul_loading")}),l&&l.error&&i.jsx("div",{className:"text-xs text-gray-500 mt-1 font-mono",children:t("chat.session_info_soul_error")+": "+l.error}),l&&l.content!==void 0&&i.jsxs("div",{className:"mt-1",children:[i.jsx("div",{className:"text-xs text-gray-500 font-mono mb-0.5 truncate",title:l.path,children:l.path+" · "+l.size+" B"}),i.jsx("pre",{className:"max-h-40 overflow-y-auto bg-gray-900 rounded p-2 font-mono text-xs text-gray-300 whitespace-pre-wrap break-words",children:l.content})]})]}),n&&p&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_model")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:p}),n.modelUrl&&i.jsx("div",{className:"text-xs text-gray-500 font-mono mt-0.5 truncate",title:n.modelUrl,children:n.modelUrl})]}),n&&n.reasoning_effort&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_reasoning")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:n.reasoning_effort})]}),m&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_idle_injection")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:t("chat.session_info_idle_on")+(m.intervalMs?" · "+t("chat.session_info_idle_every",{s:Math.round(m.intervalMs/1e3)}):"")})]}),x>0&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_scheduled")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono",children:x})]}),r&&i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_directory")}),i.jsx("div",{className:"text-sm text-gray-200 font-mono truncate",title:r,children:r})]})]})}const Hk="pave_recent_directories",qG=10;function NT(e,t){if(!e)return"";const n=e.replace(/\\/g,"/"),r=t?t.replace(/\\/g,"/"):"";if(r&&n.startsWith(r))return"~"+n.slice(r.length);const a=n.split("/").filter(Boolean);return a.length>4?".../"+a.slice(-2).join("/"):n}function $k(){try{const e=localStorage.getItem(Hk);return e?JSON.parse(e):[]}catch{return[]}}function UG(e){try{let t=$k();return t=t.filter(n=>n!==e),t.unshift(e),t=t.slice(0,qG),localStorage.setItem(Hk,JSON.stringify(t)),t}catch{return[e]}}function HG(e){try{let t=$k();return t=t.filter(n=>n!==e),localStorage.setItem(Hk,JSON.stringify(t)),t}catch{return[]}}function FA({className:e}){return i.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:i.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 $G({isOpen:e,onClose:t,sessionId:n,session:r,currentDirectory:a,homeDir:o,onDirectoryChange:l}){var{t:u}=rn(),d=y.useRef(null),f=y.useRef(null),[p,g]=y.useState(a||""),[m,x]=y.useState("idle"),[v,k]=y.useState(null),[_,E]=y.useState([]),[S,N]=y.useState(!1),[A,T]=y.useState(!1),[R,C]=y.useState(null),O=y.useRef(null),M=y.useRef(0);y.useEffect(function(){e&&(E($k()),g(a||""),x("idle"),k(null),C(null))},[e,a]),y.useEffect(function(){e&&d.current&&setTimeout(function(){d.current.focus(),d.current.select()},50)},[e]);var I=y.useCallback(function(Z){if(!Z||Z.trim()===""){x("idle"),k(null);return}O.current&&clearTimeout(O.current),x("checking"),M.current+=1;var le=M.current;O.current=setTimeout(async function(){try{const B=await L_(Z.trim());if(le!==M.current)return;k(B),B.exists&&B.isDirectory?x("valid"):B.exists?(x("error"),k({...B,error:u("chat.working_directory_invalid")})):x("not_found")}catch(B){if(le!==M.current)return;x("error"),k({error:B.message})}},300)},[u]),D=y.useCallback(function(Z){var le=Z.target.value;g(le),C(null),I(le)},[I]),F=y.useCallback(function(Z){g(Z),C(null),I(Z)},[I]),ee=y.useCallback(function(Z,le){Z.stopPropagation(),E(HG(le))},[]),H=y.useCallback(async function(){if(p.trim()){N(!0),C(null);try{const Z=await oL(p.trim());if(Z.success)try{const le=await L_(Z.path);x("valid"),k(le)}catch{x("valid"),k({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:Z.path})}}catch(Z){C(u("chat.working_directory_create_failed",{error:Z.message}))}finally{N(!1)}}},[p,u]),P=y.useCallback(async function(){if(!(!p.trim()||m!=="valid")){T(!0),C(null);try{const Z=(v==null?void 0:v.path)||p.trim();await qi(n,{directory:Z}),E(UG(Z)),l&&l(Z),t()}catch(Z){C(Z.message)}finally{T(!1)}}},[p,m,v,n,l,t]);y.useEffect(function(){if(!e)return;function Z(le){le.key==="Escape"&&(le.preventDefault(),le.stopPropagation(),t())}return document.addEventListener("keydown",Z,!0),function(){document.removeEventListener("keydown",Z,!0)}},[e,t]),y.useEffect(function(){if(!e)return;function Z(le){le.key==="Enter"&&m==="valid"&&!A&&(le.preventDefault(),P())}return document.addEventListener("keydown",Z),function(){document.removeEventListener("keydown",Z)}},[e,m,A,P]),y.useEffect(function(){return function(){O.current&&clearTimeout(O.current)}},[]);var K=y.useMemo(function(){return NT(a,o)},[a,o]);if(!e)return null;var V=null;return m==="checking"?V=i.jsxs("p",{className:"text-xs text-gray-400 mt-1 flex items-center",children:[i.jsx("span",{className:"inline-block w-3 h-3 border-2 border-gray-400 border-t-transparent rounded-full animate-spin mr-2"}),u("chat.working_directory_checking")]}):m==="valid"&&v?V=i.jsx("p",{className:"text-xs text-green-500 mt-1",children:v.hasAgentsMd?"✓ "+u("chat.working_directory_has_agents_md"):"✓ "+u("chat.working_directory_no_agents_md")}):m==="not_found"?V=i.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",u("chat.working_directory_not_found")]}):m==="error"&&(v!=null&&v.error)&&(V=i.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",v.error]})),i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(Z){Z.target===Z.currentTarget&&t()},children:i.jsxs("div",{ref:f,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:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(FA,{className:"w-5 h-5 text-gray-400"}),i.jsx("h2",{id:"directory-modal-title",className:"text-lg font-semibold text-gray-100",children:u("chat.working_directory")})]}),i.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":u("common.close"),children:i.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_current")}),i.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:a,children:K||a||u("chat.working_directory_not_set")})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"directory-input",className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_new_path")}),i.jsx("input",{ref:d,id:"directory-input",type:"text",value:p,onChange:D,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-hidden focus:border-blue-500",placeholder:u("chat.working_directory_placeholder"),autoComplete:"off",spellCheck:"false"}),V]}),R&&i.jsx("p",{className:"text-sm text-red-500",children:R}),_.length>0&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:u("chat.working_directory_recent")}),i.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:_.map(function(Z){return i.jsxs("div",{onClick:function(){F(Z)},className:"flex items-center justify-between px-3 py-2 bg-gray-900 rounded cursor-pointer hover:bg-gray-700 transition-colors group",children:[i.jsx("span",{className:"text-sm text-gray-200 font-mono truncate flex-1",title:Z,children:NT(Z,o)}),i.jsx("button",{onClick:function(le){ee(le,Z)},className:"text-gray-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity ml-2",title:u("chat.working_directory_remove_recent"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},Z)})})]}),i.jsx(zG,{session:r,directory:K||a||""})]}),i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-700 bg-gray-800/50",children:[i.jsx("div",{children:m==="not_found"&&i.jsx("button",{onClick:H,disabled:S,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:S?"...":u("chat.working_directory_create")})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-300 hover:text-gray-100 transition-colors",children:u("chat.working_directory_cancel")}),i.jsx("button",{onClick:P,disabled:m!=="valid"||A,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:A?"...":u("chat.working_directory_change")})]})]})]})})}var or={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 WG(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function pf(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function hf(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function Al(e){var t=e.children;return i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-snug",children:t})}function VG(e){var t=e.isOpen,n=e.onClose,r=e.sessionId,a=rn().t,o=y.useRef(null),l=y.useState(null);l[0];var u=l[1],d=y.useState(!0),f=d[0],p=d[1],g=y.useState(!1),m=g[0],x=g[1],v=y.useState(null),k=v[0],_=v[1],E=y.useState(null),S=E[0],N=E[1],A=y.useState(or.enabled),T=A[0],R=A[1],C=y.useState(or.message),O=C[0],M=C[1],I=y.useState(String(or.intervalMs)),D=I[0],F=I[1],ee=y.useState(String(or.maxInjections)),H=ee[0],P=ee[1],K=y.useState(or.timeout.enabled),V=K[0],Z=K[1],le=y.useState(String(or.timeout.thresholdMs)),B=le[0],U=le[1],Y=y.useState(String(or.timeout.cooldownMs)),q=Y[0],te=Y[1],W=y.useState(or.mode),$=W[0],fe=W[1],ae=y.useState(String(or.waitMs)),xe=ae[0],Ie=ae[1],ze=y.useRef(null),mt=y.useState([]),ut=mt[0],$e=mt[1],qe=y.useState(!1),Oe=qe[0],rt=qe[1],ot=y.useState(!1),At=ot[0],sn=ot[1],Xt=y.useState("9"),Ht=Xt[0],We=Xt[1],De=y.useState("0"),et=De[0],nt=De[1],de=y.useState("AM"),_e=de[0],Ue=de[1],ge=y.useState("weekdays"),ft=ge[0],ht=ge[1],vt=y.useState([1,2,3,4,5]),pt=vt[0],Vt=vt[1],Gt=y.useState(""),Ze=Gt[0],qt=Gt[1],kt="";try{kt=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}y.useEffect(function(){return function(){ze.current&&clearTimeout(ze.current)}},[]);var $t=y.useCallback(function(){r&&(p(!0),_(null),n4(r).then(function(Re){var Ke=Re&&Re.config?Re.config:or;u(Ke),R(Ke.enabled||!1),M(Ke.message||or.message),F(pf(Ke.intervalMs!=null?Ke.intervalMs:or.intervalMs)),P(WG(Ke.maxInjections!=null?Ke.maxInjections:or.maxInjections)),Z(Ke.timeout?Ke.timeout.enabled:or.timeout.enabled),U(pf(Ke.timeout&&Ke.timeout.thresholdMs!=null?Ke.timeout.thresholdMs:or.timeout.thresholdMs)),te(pf(Ke.timeout&&Ke.timeout.cooldownMs!=null?Ke.timeout.cooldownMs:or.timeout.cooldownMs)),fe(Ke.mode||or.mode),Ie(pf(Ke.waitMs!=null?Ke.waitMs:or.waitMs))}).catch(function(Re){_(Re.message||"Failed to load config")}).finally(function(){p(!1)}))},[r]);y.useEffect(function(){t&&$t()},[t,$t]);var tn=y.useCallback(function(){r&&yM(r).then(function(Re){$e(Re&&Re.schedules?Re.schedules:[])}).catch(function(){$e([])})},[r]);y.useEffect(function(){t&&tn()},[t,tn]),y.useEffect(function(){if(!t)return;function Re(Ke){Ke.key==="Escape"&&n()}return document.addEventListener("keydown",Re),function(){document.removeEventListener("keydown",Re)}},[t,n]);function on(){if(r){x(!0),_(null),N(null);var Re={enabled:T,message:O.trim()||or.message,intervalMs:hf(D)||or.intervalMs,maxInjections:parseInt(H,10)||0,mode:$||or.mode,waitMs:hf(xe),timeout:{enabled:V,thresholdMs:hf(B)||or.timeout.thresholdMs,cooldownMs:hf(q)||or.timeout.cooldownMs}};mM(r,Re).then(function(){u(Re),N(a("chat.idle_injection_saved")),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(function(){N(null)},3e3)}).catch(function(Ke){_(Ke.message||"Failed to save")}).finally(function(){x(!1)})}}function Dn(){r&&(x(!0),_(null),N(null),xM(r).then(function(){R(!1),u(null)}).catch(function(Re){_(Re.message||"Failed to disable")}).finally(function(){x(!1)}))}function ie(Re,Ke){var bt=parseInt(Re,10);return Ke==="PM"&&bt!==12&&(bt+=12),Ke==="AM"&&bt===12&&(bt=0),bt}function Le(Re){return Re===0?{h:12,ap:"AM"}:Re<12?{h:Re,ap:"AM"}:Re===12?{h:12,ap:"PM"}:{h:Re-12,ap:"PM"}}function Je(Re,Ke){return Re==="every_day"?[0,1,2,3,4,5,6]:Re==="weekdays"?[1,2,3,4,5]:Re==="weekends"?[0,6]:Ke.slice().sort()}function Ft(Re){var Ke=Le(Re.hour),bt=String(Re.minute).padStart(2,"0");return Ke.h+":"+bt+" "+Ke.ap}function Fe(Re){var Ke=Re.daysOfWeek||[],bt="";if(Ke.length===7)bt=a("scheduled_injection.repeat_every_day");else if(Ke.length===5&&Ke.indexOf(1)!==-1&&Ke.indexOf(5)!==-1)bt=a("scheduled_injection.repeat_weekdays");else if(Ke.length===2&&Ke.indexOf(0)!==-1&&Ke.indexOf(6)!==-1)bt=a("scheduled_injection.repeat_weekends");else{for(var bn=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],dr=[],Ot=0;Ot<7;Ot++)Ke.indexOf(Ot)!==-1&&dr.push(a("scheduled_injection."+bn[Ot]));bt=dr.join(", ")}return Re.timezone&&(bt+=" ("+Re.timezone+")"),bt}function it(){if(r){sn(!0),_(null);var Re={hour:ie(Ht,_e),minute:parseInt(et,10),daysOfWeek:Je(ft,pt),timezone:kt||null,message:Ze.trim(),enabled:!0};bM(r,Re).then(function(){rt(!1),qt(""),tn()}).catch(function(Ke){_(Ke.message||a("scheduled_injection.error_generic"))}).finally(function(){sn(!1)})}}function ve(Re,Ke){r&&vM(r,Re,{enabled:!Ke}).then(function(){tn()}).catch(function(bt){_(bt.message||"Failed to toggle schedule")})}function Me(Re){r&&kM(r,Re).then(function(){tn()}).catch(function(Ke){_(Ke.message||"Failed to delete schedule")})}function Ye(Re){var Ke=pt.indexOf(Re);Vt(Ke===-1?pt.concat([Re]):pt.filter(function(bt){return bt!==Re}))}if(!t)return null;var yt="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",se="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-hidden focus:ring-2 focus:ring-primary-500 focus:border-transparent",Pe="space-y-3",He=function(Re){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(Re?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},wt=function(Re){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(Re?"translate-x-6":"translate-x-1")};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n,"aria-hidden":"true"}),i.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":a("chat.idle_injection_title"),children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a("chat.idle_injection_title")}),i.jsx("button",{onClick:n,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":a("common.close"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:f?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):i.jsxs(i.Fragment,{children:[k&&i.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&&i.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}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("chat.idle_injection_toggle")}),i.jsx("button",{type:"button",onClick:function(){R(!T)},className:He(T),"aria-pressed":T,"aria-label":a("chat.idle_injection_toggle"),children:i.jsx("span",{className:wt(T)})})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:yt,htmlFor:"ii-message",children:a("chat.idle_injection_message")}),i.jsx("textarea",{id:"ii-message",value:O,onChange:function(Re){M(Re.target.value)},className:se+" resize-none",rows:3,placeholder:a("chat.idle_injection_message_placeholder"),disabled:!T})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:yt,htmlFor:"ii-interval",children:a("chat.idle_injection_interval")}),i.jsx("input",{id:"ii-interval",type:"number",value:D,onChange:function(Re){F(Re.target.value)},className:se,min:.5,step:.5,disabled:!T}),i.jsx(Al,{children:a("chat.idle_injection_interval_desc")})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:yt,htmlFor:"ii-max",children:a("chat.idle_injection_max")}),i.jsx("input",{id:"ii-max",type:"number",value:H,onChange:function(Re){P(Re.target.value)},className:se,min:0,disabled:!T}),i.jsx(Al,{children:a("chat.idle_injection_max_desc")})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:yt,htmlFor:"ii-mode",children:a("chat.idle_injection_mode")}),i.jsxs("select",{id:"ii-mode",value:$,onChange:function(Re){fe(Re.target.value)},className:se,disabled:!T,children:[i.jsx("option",{value:"urgent",children:a("chat.idle_injection_mode_urgent")}),i.jsx("option",{value:"normal",children:a("chat.idle_injection_mode_normal")}),i.jsx("option",{value:"idle",children:a("chat.idle_injection_mode_idle")})]}),i.jsx(Al,{children:a("chat.idle_injection_mode_desc")})]}),$==="idle"&&i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:yt,htmlFor:"ii-wait",children:a("chat.idle_injection_wait_ms")}),i.jsx("input",{id:"ii-wait",type:"number",value:xe,onChange:function(Re){Ie(Re.target.value)},className:se,min:0,step:.5,disabled:!T}),i.jsx(Al,{children:a("chat.idle_injection_wait_ms_desc")})]}),i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:a("chat.idle_injection_timeout_toggle")}),i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:a("chat.idle_injection_timeout_toggle_desc")})]}),i.jsx("button",{type:"button",onClick:function(){Z(!V)},className:He(V),"aria-pressed":V,"aria-label":a("chat.idle_injection_timeout_toggle"),disabled:!T,children:i.jsx("span",{className:wt(V)})})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:yt,htmlFor:"ii-threshold",children:a("chat.idle_injection_timeout_threshold")}),i.jsx("input",{id:"ii-threshold",type:"number",value:B,onChange:function(Re){U(Re.target.value)},className:se,min:1,step:.5,disabled:!T||!V}),i.jsx(Al,{children:a("chat.idle_injection_timeout_threshold_desc")})]}),i.jsxs("div",{className:Pe,children:[i.jsx("label",{className:yt,htmlFor:"ii-cooldown",children:a("chat.idle_injection_timeout_cooldown")}),i.jsx("input",{id:"ii-cooldown",type:"number",value:q,onChange:function(Re){te(Re.target.value)},className:se,min:.5,step:.5,disabled:!T||!V}),i.jsx(Al,{children:a("chat.idle_injection_timeout_cooldown_desc")})]}),i.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),i.jsxs("div",{className:Pe,children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a("scheduled_injection.title")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:a("scheduled_injection.subtitle")})]}),ut.length===0&&!Oe&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:a("scheduled_injection.empty")}),ut.map(function(Re){return i.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(Re.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:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:Ft(Re)}),i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:Fe(Re)})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:function(){ve(Re.id,Re.enabled)},className:He(Re.enabled),"aria-pressed":Re.enabled,"aria-label":a("scheduled_injection.enabled"),children:i.jsx("span",{className:wt(Re.enabled)})}),i.jsx("button",{type:"button",onClick:function(){Me(Re.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":a("scheduled_injection.delete"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})})]})]}),Re.message&&i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',Re.message,'"']})]},Re.id)}),Oe?i.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:[i.jsxs("div",{children:[i.jsx("label",{className:yt,children:a("scheduled_injection.time")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("select",{value:Ht,onChange:function(Re){We(Re.target.value)},className:se+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(Re){return i.jsx("option",{value:String(Re),children:Re},Re)})}),i.jsx("span",{className:"text-gray-500",children:":"}),i.jsxs("select",{value:et,onChange:function(Re){nt(Re.target.value)},className:se+" w-20",children:[i.jsx("option",{value:"0",children:"00"}),i.jsx("option",{value:"15",children:"15"}),i.jsx("option",{value:"30",children:"30"}),i.jsx("option",{value:"45",children:"45"})]}),i.jsxs("select",{value:_e,onChange:function(Re){Ue(Re.target.value)},className:se+" w-20",children:[i.jsx("option",{value:"AM",children:"AM"}),i.jsx("option",{value:"PM",children:"PM"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:yt,children:a("scheduled_injection.repeat")}),i.jsxs("select",{value:ft,onChange:function(Re){ht(Re.target.value)},className:se,children:[i.jsx("option",{value:"every_day",children:a("scheduled_injection.repeat_every_day")}),i.jsx("option",{value:"weekdays",children:a("scheduled_injection.repeat_weekdays")}),i.jsx("option",{value:"weekends",children:a("scheduled_injection.repeat_weekends")}),i.jsx("option",{value:"custom",children:a("scheduled_injection.repeat_custom")})]})]}),ft==="custom"&&i.jsx("div",{children:i.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(Re){var Ke=pt.indexOf(Re.d)!==-1;return i.jsx("button",{type:"button",onClick:function(){Ye(Re.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(Ke?"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:a("scheduled_injection."+Re.k)},Re.d)})})}),kt&&i.jsxs("div",{children:[i.jsx("label",{className:yt,children:a("scheduled_injection.timezone")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:kt})]}),i.jsxs("div",{children:[i.jsx("label",{className:yt,children:a("scheduled_injection.message")}),i.jsx("textarea",{value:Ze,onChange:function(Re){qt(Re.target.value)},className:se+" resize-none",rows:2,placeholder:a("scheduled_injection.message_placeholder")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:it,disabled:At||ft==="custom"&&pt.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:a(At?"scheduled_injection.saving":"scheduled_injection.save")}),i.jsx("button",{type:"button",onClick:function(){rt(!1)},disabled:At,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:a("common.close")})]})]}):i.jsxs("button",{type:"button",onClick:function(){rt(!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:["+ ",a("scheduled_injection.add")]})]})]})}),!f&&i.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsx("button",{onClick:on,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:a(m?"chat.idle_injection_saving":"chat.idle_injection_save")}),i.jsx("button",{onClick:Dn,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:a(m?"chat.idle_injection_disabling":"chat.idle_injection_disable")})]})]})]})}function GG({items:e,sessionId:t,isReadOnly:n,onReorder:r,onCancelItem:a,onEditItem:o,t:l}){var[u,d]=y.useState(null),[f,p]=y.useState(null),g=y.useRef(0),m=y.useCallback(function(S,N){if(e[N]&&e[N].status==="dispatching"){S.preventDefault();return}d(N),S.dataTransfer.effectAllowed="move";try{S.dataTransfer.setData("text/plain",String(N))}catch{}},[e]),x=y.useCallback(function(S,N){S.preventDefault(),g.current++,e[N]&&e[N].status!=="dispatching"&&p(N)},[e]),v=y.useCallback(function(S,N){S.preventDefault(),S.dataTransfer.dropEffect="move"},[]),k=y.useCallback(function(){g.current--,g.current<=0&&(g.current=0,p(null))},[]),_=y.useCallback(function(S,N){if(S.preventDefault(),g.current=0,p(null),u===null||u===N){d(null);return}var A=e.slice(),T=A.splice(u,1)[0];A.splice(N,0,T),d(null);var R=A.filter(function(C){return C.status!=="dispatching"}).map(function(C){return C.id});r(R)},[u,e,r]),E=y.useCallback(function(){d(null),p(null),g.current=0},[]);return!e||e.length===0?null:i.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:[i.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,N){var A=S.status==="dispatching",T=u===N,R=f===N&&u!==N,C=!A&&!n;return i.jsxs("div",{draggable:C,onDragStart:C?function(O){m(O,N)}:void 0,onDragEnter:C?function(O){x(O,N)}:void 0,onDragOver:C?function(O){v(O,N)}:void 0,onDragLeave:C?k:void 0,onDrop:C?function(O){_(O,N)}:void 0,onDragEnd:C?E: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 ":"")+(R?"border-solid border-accent-400 dark:border-accent-500 bg-accent-50 dark:bg-accent-900/20 ":"")+(C?"cursor-grab active:cursor-grabbing ":""),children:[C&&i.jsx("svg",{className:"w-3 h-3 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:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8h16M4 16h16"})}),i.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(O){(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),o(S))},title:l("chat.edit_queued"),"aria-label":l("chat.edit_queued"),children:[i.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"&&i.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"}),i.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&&!n&&i.jsx("svg",{className:"w-3 h-3 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:i.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&&!n&&i.jsx("button",{type:"button",onClick:function(O){O.stopPropagation(),a(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)})]})}const CT="flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded-lg bg-gray-900 text-white shadow-lg hover:bg-gray-700 focus:outline-hidden focus:ring-2 focus:ring-primary-500";function KG({rect:e,onQuote:t,onCopy:n,onDismiss:r,label:a,copyLabel:o}){if(y.useEffect(function(){if(!(!e||!r)){var f=function(p){p.key==="Escape"&&r()};return document.addEventListener("keydown",f),function(){document.removeEventListener("keydown",f)}}},[e,r]),!e)return null;var l=Math.max((e.top||0)-40,4),u=typeof window<"u"&&window.innerWidth<420,d=u?{position:"fixed",top:l,left:8,right:8,zIndex:60}:{position:"fixed",top:l,left:Math.max(e.left||0,8),zIndex:60};return Lv.createPortal(i.jsxs("div",{style:d,className:"flex items-center gap-1",children:[i.jsxs("button",{type:"button","data-testid":"quote-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:t,"aria-label":a,title:a,className:CT,children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})}),a]}),i.jsxs("button",{type:"button","data-testid":"copy-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:n,"aria-label":o,title:o,className:CT,children:[i.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[i.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),o]})]}),document.body)}function YG(e){if(!e||typeof e!="string")return[];const t=[],n=e.split(`
|
|
120
|
-
`);for(let r=0;r<n.length;r++){const a=n[r].trim();if(a)try{t.push(JSON.parse(a))}catch{}}return t.sort((r,a)=>(r.seq||0)-(a.seq||0)),t}function Ru(e){return!!e&&typeof e=="object"&&typeof e.$ref=="string"}function Hl(e){if(!Ru(e))return null;const t=/(\d+)/.exec(e.$ref);return t?Number(t[1]):null}function QG(e){const t=[],n=new Map;let r=null,a=null;for(const u of e)switch(u.type){case"context":r=u;break;case"store_snapshot":a=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};r&&(r.reqSeq==null||r.reqSeq===u.seq)&&(d.context=r,r=null),a&&(a.reqSeq==null||a.reqSeq===u.seq)&&(d.store=a,a=null),t.push(d),n.set(u.seq,d);break}case"chunk":{const d=n.get(u.reqSeq);d&&d.chunks.push(u);break}case"response_end":{const d=n.get(u.reqSeq);d&&(d.response=u);break}case"bubble_map":{const d=n.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=n.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=XG(u)}return t}function XG(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 ZG(e){const t=[];let n=null,r=null;for(const a of e)(n===null||r==="stop"||r==="error")&&(n={index:t.length,requests:[]},t.push(n)),n.requests.push(a),r=a.finishReason;return t}function JG(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 eK(e){return e.filter(t=>t.type==="compaction")}function tK(e){return e.filter(t=>t.type==="message_drop")}function nK(e,t){const n=f=>{const p=Array.isArray(f)?f.slice():[];return p.length&&p[0]&&p[0].role==="system"?p.slice(1):p},r=n(e),a=n(t),o=f=>{const p={};for(const g of f){const m=g&&g.role||"?";p[m]=(p[m]||0)+1}return p},l=o(r),u=o(a),d=[];for(const f of new Set([...Object.keys(l),...Object.keys(u)])){const p=l[f]||0,g=u[f]||0;p!==g&&d.push({role:f,before:p,after:g,delta:p-g})}return d.sort((f,p)=>p.delta-f.delta),{prevLen:r.length,currLen:a.length,roles:d}}function rK(e){const t=e&&e.raw;if(t==="[DONE]")return{parts:[{type:"done",piece:""}]};let n;try{n=JSON.parse(t)}catch{return{parts:[{type:"other",piece:""}]}}const r=[],a=n&&n.choices&&n.choices[0]&&n.choices[0].delta;if(a){const o=a.reasoning_content??a.reasoning??a.thinking;if(o!=null&&o!==""&&r.push({type:"reasoning",piece:o}),a.content!=null&&a.content!==""&&r.push({type:"text",piece:a.content}),a.tool_calls&&a.tool_calls.length){const u=(a.tool_calls[0]||{}).function||{};r.push({type:"tool",piece:(u.name?u.name+" ":"")+(u.arguments!=null?u.arguments:"")})}}return n&&n.usage&&r.push({type:"usage",piece:JSON.stringify(n.usage)}),r.length===0&&r.push({type:"other",piece:""}),{parts:r}}function jT(e){try{return JSON.stringify(e)}catch{return String(e)}}function TT(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 iK(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[],a=r.length&&r[0]&&r[0].role==="system"?r.slice(1):r.slice(),o=Math.max(n.length,a.length),l=[];let u=-1,d=1;for(let f=0;f<o;f++){const p=f<n.length?n[f]:void 0,g=f<a.length?a[f]:void 0,m=p===void 0?void 0:jT(p),x=g===void 0?void 0:jT(g),v=m===void 0?null:m.length,k=x===void 0?null:x.length;v!=null&&(d=Math.max(d,v)),k!=null&&(d=Math.max(d,k));const _=m!==x;let E="unchanged";if(p===void 0)E="added";else if(g===void 0)E="dropped";else if(_){const S=p.role||g.role;k<v?S==="tool"?E="tool output stubbed":TT(p)&&!TT(g)?E="reasoning stripped":E="text capped":E="changed"}_&&u<0&&(u=f),l.push({i:f,role:(p||g||{}).role||"?",beforeBytes:v,afterBytes:k,changed:_,tag:E})}return{rows:l,firstChanged:u,maxBytes:d}}function aK(e){const t=typeof e=="string"?YG(e):Array.isArray(e)?e:[],n=QG(t),r=ZG(n),a=JG(n),o=eK(t),l=tK(t);return{events:t,requests:n,turns:r,timeline:a,compactions:o,messageDrops:l}}function Nf(e,t){if(e==null)return"(none)";if(e&&typeof e=="object"&&typeof e.$ref=="string"){const n=Hl(e);if(t&&n!=null&&t.has(n)){const r=t.get(n);try{return typeof r=="string"?r:JSON.stringify(r,null,2)}catch{return String(r)}}return`(large — spilled to ${e.$ref}, not fetched)`}try{return typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return String(e)}}function sK(e){return e?Object.keys(e).map(t=>`${t}=${typeof e[t]=="object"?JSON.stringify(e[t]):e[t]}`).join(" "):""}function BA(e,t){const n=[];n.push(`--- Request #${e.seq} [${e.purpose}] ${e.provider||"?"}/${e.model||"?"} ---`),e.url&&n.push(`url: ${e.url}`);const r=sK(e.params);if(r&&n.push(`params: ${r}`),n.push(`sent est: ${e.sentEstTokens??"?"} sent actual (prompt_tokens): ${e.sentActualTokens??"?"} store: ${e.storeTokens??"?"}`),n.push(`status: ${e.status??"?"} finishReason: ${e.finishReason??"?"} ttft: ${e.ttftMs??"?"}ms total: ${e.totalMs??"?"}ms`),e.paveContext&&n.push(`resolvedModel: ${e.paveContext.resolvedModel??"?"} contextFloor: ${e.paveContext.contextFloor??"?"}`),e.bubbleMessageID&&n.push(`bubble messageID: ${e.bubbleMessageID}`),n.push("REQUEST HEADERS (redacted):"),n.push(Nf(e.headers,t)),n.push("REQUEST BODY (exact bytes sent):"),n.push(Nf(e.body,t)),e.response){const a=e.response.assembled;n.push("RESPONSE (assembled):"),a&&typeof a=="object"&&a.$ref?n.push(Nf(a,t)):a&&(a.reasoning&&n.push(`reasoning: ${a.reasoning}`),n.push(`text: ${a.text||""}`),a.tool_calls&&a.tool_calls.length&&n.push(`tool_calls: ${JSON.stringify(a.tool_calls)}`))}if(e.context){const a=e.context;n.push(`CONTEXT: limit=${a.limit} usable=${a.usable} margin=${a.margin} threshold=${a.threshold} tokReal=${a.tokReal} needsCompaction=${a.needsCompaction} source=${a.source??""} windowSource=${a.windowSource??a.epmWindowSignal??""}`)}if(e.compaction){const a=e.compaction,o=[`COMPACTION [${a.trigger}]`];a.deletedMessages!=null&&o.push(`deleted=${a.deletedMessages}`),a.summaryTokens!=null&&o.push(`summaryTok=${a.summaryTokens}`),a.before!=null&&o.push(`before=${a.before}`),a.after!=null&&o.push(`after=${a.after}`),typeof a.handoffFresh=="boolean"&&o.push(`handoffFresh=${a.handoffFresh}`),n.push(o.join(" "))}if(e.messageDrop){const a=e.messageDrop;n.push(`⚠ MESSAGE DROP wire ${a.wireBefore}→${a.wireAfter} (vs req #${a.prevSeq}, no compaction`+(a.storeMessages!=null?`, store intact=${a.storeMessages}`:"")+")")}return n.join(`
|
|
121
|
-
`)}function zA(e){const t=[`--- Chunks for request #${e.seq} (${e.chunkCount}) ---`],n=e.ts;for(let r=0;r<e.chunks.length;r++){const a=e.chunks[r],o=r===0?n!=null?a.ts-n:0:a.ts-e.chunks[r-1].ts;t.push(`[+${o}ms]${a.kind?" ("+a.kind+")":""} ${a.raw}`)}return t.join(`
|
|
122
|
-
`)}function oK(e,t){if(!e.response)return`(no response captured for request #${e.seq})`;const n=e.response.assembled,r=[`--- Response for request #${e.seq} (status ${e.status}, ${e.finishReason}) ---`];return n&&typeof n=="object"&&n.$ref?r.push(Nf(n,t)):n&&(n.reasoning&&r.push(`reasoning:
|
|
123
|
-
${n.reasoning}`),r.push(`text:
|
|
124
|
-
${n.text||""}`),n.tool_calls&&n.tool_calls.length&&r.push(`tool_calls:
|
|
125
|
-
${JSON.stringify(n.tool_calls,null,2)}`)),e.response.usage&&r.push(`usage: ${JSON.stringify(e.response.usage)}`),r.join(`
|
|
126
|
-
`)}function RT(e,t,n){const{requests:r,timeline:a,compactions:o,messageDrops:l}=e,u=[];u.push(`=== PAVE Inspector session ${t||""} ===`);const d=(l||[]).length;u.push(`requests: ${r.length} compactions: ${o.length}`+(d?` ⚠ message-drops: ${d}`:""));const f=r.find(p=>p.context);f&&f.context&&u.push(`context window: limit ${f.context.limit} / usable ${f.context.usable} / threshold ${f.context.threshold}`),u.push("");for(const p of r)u.push(BA(p,n)),p.chunkCount&&(u.push(`CHUNKS (${p.chunkCount}):`),u.push(zA(p))),u.push("");u.push("TIMELINE:"),u.push("seq store sent_est sent_actual threshold compaction");for(const p of a)u.push(`${p.seq} ${p.storeTokens??""} ${p.sentEst??""} ${p.sentActual??""} ${p.threshold??""} ${p.compactionMarker?"YES":""}`);return u.join(`
|
|
127
|
-
`)}function lK(e){const t=new Set;for(const n of e.requests||[])for(const r of[n.body,n.response&&n.response.assembled])if(r&&typeof r=="object"&&typeof r.$ref=="string"){const a=Hl(r);a!=null&&t.add(a)}return Array.from(t)}function Hs(e){return e==null?"—":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e)}const gf=[{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."}],AT=[{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 cK({timeline:e,selectedSeq:t,onSelectSeq:n,height:r=240}){const[a,o]=y.useState(null),[l,u]=y.useState("data"),[d,f]=y.useState(!1),p=y.useRef(null),[g,m]=y.useState(720);y.useEffect(()=>{const C=p.current;if(!C||typeof ResizeObserver>"u")return;const O=new ResizeObserver(M=>{const I=M[0]&&M[0].contentRect&&M[0].contentRect.width;I&&I>0&&m(Math.round(I))});return O.observe(C),()=>O.disconnect()},[]);const x={top:16,right:116,bottom:34,left:56},v=Math.max(1,g-x.left-x.right),k=Math.max(1,r-x.top-x.bottom),_=Array.isArray(e)?e:[],E=y.useMemo(()=>{if(_.length===0)return 1;let C=0;for(const O of _){for(const M of gf)O[M.key]!=null&&(C=Math.max(C,O[M.key]));O.threshold!=null&&(C=Math.max(C,O.threshold)),l==="window"&&(O.usable!=null&&(C=Math.max(C,O.usable)),O.limit!=null&&(C=Math.max(C,O.limit)))}return Math.max(1,Math.ceil(C*1.12))},[_,l]);if(_.length===0)return i.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=C=>x.left+(_.length===1?v/2:C/(_.length-1)*v),N=C=>x.top+k-Math.min(C,E)/E*k,A=C=>{const O=[];let M=!1;return _.forEach((I,D)=>{if(I[C]==null){M=!1;return}O.push(`${M?"L":"M"} ${S(D).toFixed(1)} ${N(I[C]).toFixed(1)}`),M=!0}),O.join(" ")},T=()=>{const C=[];let O=[];const M=()=>{if(O.length){const I=O.map(F=>`${S(F).toFixed(1)} ${N(_[F].storeTokens).toFixed(1)}`),D=O.slice().reverse().map(F=>`${S(F).toFixed(1)} ${N(_[F].sentActual).toFixed(1)}`);C.push("M "+I.join(" L ")+" L "+D.join(" L ")+" Z")}O=[]};return _.forEach((I,D)=>{I.storeTokens!=null&&I.sentActual!=null&&I.storeTokens>I.sentActual?O.push(D):M()}),M(),C.join(" ")},R=[0,.25,.5,.75,1].map(C=>Math.round(E*C));return i.jsxs("div",{ref:p,className:"relative",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1 px-1",children:[i.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Context timeline — store vs sent"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:()=>f(C=>!C),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"}),i.jsxs("button",{type:"button",onClick:()=>u(C=>C==="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&&i.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:[i.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: ",i.jsx("b",{children:"store"})," = the full persisted history (grows every response, drops at compaction). ",i.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.)"]}),gf.map(C=>i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 h-0.5 mt-1.5 shrink-0",style:{background:C.stroke}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:C.label})," ",i.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",C.desc]})]})]},C.key)),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 h-2 mt-0.5 rounded-xs shrink-0",style:{background:"#10b981",opacity:.25}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"trimmed"})," ",i.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."})]})]}),AT.map(C=>i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:C.stroke}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:C.label})," ",i.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",C.desc]})]})]},C.key)),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:"#d946ef"}}),i.jsxs("span",{children:[i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"compact"})," ",i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— a compaction ran at this request (vertical marker)."})]})]})]}),i.jsxs("svg",{width:"100%",height:r,viewBox:`0 0 ${g} ${r}`,preserveAspectRatio:"xMidYMid meet",className:"overflow-visible select-none block",onMouseLeave:()=>o(null),children:[R.map((C,O)=>{const M=N(C);return i.jsxs("g",{children:[i.jsx("line",{x1:x.left,y1:M,x2:g-x.right,y2:M,stroke:"currentColor",strokeOpacity:.08,className:"text-gray-500"}),i.jsx("text",{x:x.left-6,y:M,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Hs(C)})]},"yt"+O)}),i.jsx("path",{d:T(),fill:"#10b981",fillOpacity:.1,stroke:"none",pointerEvents:"none"}),AT.map(C=>{const O=_[_.length-1],M=O&&O[C.key];if(M==null||M>E)return null;const I=N(M);return i.jsxs("g",{children:[i.jsx("line",{x1:x.left,y1:I,x2:g-x.right,y2:I,stroke:C.stroke,strokeOpacity:.5,strokeDasharray:"2 4"}),i.jsxs("text",{x:g-x.right+4,y:I,dominantBaseline:"middle",className:"text-[9px]",fill:C.stroke,fillOpacity:.9,children:[C.label," ",Hs(M)]})]},"ref"+C.key)}),_.map((C,O)=>C.compactionMarker?i.jsxs("g",{children:[i.jsx("line",{x1:S(O),y1:x.top,x2:S(O),y2:x.top+k,stroke:"#d946ef",strokeOpacity:.7,strokeDasharray:"3 3",strokeWidth:1.5}),i.jsx("text",{x:S(O),y:x.top-4,textAnchor:"middle",className:"text-[8px] font-semibold",fill:"#d946ef",children:"compact"})]},"cm"+O):null),gf.map(C=>i.jsx("path",{d:A(C.key),fill:"none",stroke:C.stroke,strokeWidth:2,strokeDasharray:C.dash||void 0,strokeLinejoin:"round",strokeLinecap:"round"},C.key)),_.map((C,O)=>{const M=S(O),I=t!=null&&C.seq===t;return i.jsxs("g",{children:[gf.map(D=>C[D.key]!=null?i.jsx("circle",{cx:M,cy:N(C[D.key]),r:I?3.5:2.5,fill:D.stroke,stroke:"white",strokeWidth:I?1:.5,className:"dark:stroke-gray-950"},D.key):null),i.jsx("rect",{x:M-Math.max(6,v/_.length/2),y:x.top,width:Math.max(12,v/_.length),height:k,fill:I?"#0ea5e9":"transparent",fillOpacity:I?.06:0,className:"cursor-pointer",onMouseEnter:()=>o(O),onClick:()=>n&&n(C.seq)}),i.jsxs("text",{x:M,y:r-8,textAnchor:"middle",className:"text-[8px] fill-gray-400 dark:fill-gray-500",children:["#",C.seq]})]},"pt"+O)}),a!=null&&_[a]&&(()=>{const C=_[a],O=S(a),M=158,I=106,D=Math.min(Math.max(O-M/2,x.left),g-x.right-M),F=x.top+4;return i.jsxs("g",{className:"pointer-events-none",children:[i.jsx("rect",{x:D,y:F,width:M,height:I,rx:4,className:"fill-gray-900/95 dark:fill-gray-800/95"}),i.jsxs("text",{x:D+8,y:F+14,className:"text-[9px] font-semibold fill-white",children:["request #",C.seq,C.compactionMarker?" · compaction":""]}),i.jsxs("text",{x:D+8,y:F+28,className:"text-[9px] fill-emerald-300",children:["store: ",Hs(C.storeTokens)]}),i.jsxs("text",{x:D+8,y:F+40,className:"text-[9px] fill-amber-300",children:["sent est: ",Hs(C.sentEst)]}),i.jsxs("text",{x:D+8,y:F+52,className:"text-[9px] fill-sky-300",children:["sent actual: ",Hs(C.sentActual)]}),i.jsxs("text",{x:D+8,y:F+64,className:"text-[9px] fill-rose-300",children:["tokReal: ",Hs(C.tokReal)]}),i.jsxs("text",{x:D+8,y:F+76,className:"text-[9px] fill-yellow-300",children:["threshold: ",Hs(C.threshold)]}),i.jsxs("text",{x:D+8,y:F+90,className:"text-[9px] fill-emerald-200/80",children:["trimmed: ",Hs(C.trimmed)]})]})})()]})]})}const IT={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 qb(e){return e==null?"—":e.toLocaleString()}function uK({turns:e,selectedSeq:t,onSelect:n}){const[r,a]=y.useState(()=>new Set),o=y.useCallback(u=>{a(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),l=y.useMemo(()=>{const u=[];return(e||[]).forEach(d=>{u.push({kind:"group",turnIndex:d.index,count:d.requests.length}),r.has(d.index)||d.requests.forEach(f=>u.push({kind:"req",rec:f}))}),u},[e,r]);return!e||e.length===0?i.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"No requests."}):i.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[i.jsxs("div",{className:"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:[i.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."]}),i.jsx("div",{className:"flex-1 min-h-0",children:i.jsx(D4,{style:{height:"100%"},data:l,itemContent:(u,d)=>{if(d.kind==="group"){const g=r.has(d.turnIndex);return i.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:[i.jsx("svg",{className:"w-3 h-3 transition-transform "+(g?"-rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),"Turn ",d.turnIndex+1,i.jsxs("span",{className:"font-normal text-gray-400 dark:text-gray-500",children:["· ",d.count," req"]})]})}const f=d.rec,p=t!=null&&f.seq===t;return i.jsxs("button",{type:"button",onClick:()=>n(f.seq),className:"w-full text-left px-3 py-2 border-b border-gray-100 dark:border-gray-800/60 transition-colors "+(p?"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:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 w-8 shrink-0",children:["#",f.seq]}),i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded shrink-0 "+(IT[f.purpose]||IT.assistant),children:f.purpose}),i.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300 truncate min-w-0 flex-1",children:f.model}),f.compaction&&i.jsx("span",{className:"text-[9px] px-1 rounded bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-900/40 dark:text-fuchsia-300 shrink-0",title:"A compaction followed this request",children:"⤵ compact"}),f.messageDrop&&i.jsx("span",{className:"text-[9px] px-1 rounded bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300 shrink-0 font-semibold",title:"Unexpected wire message drop (#1858 regression canary)",children:"⚠ drop"}),f.status!=null&&i.jsx("span",{className:"text-[10px] font-mono shrink-0 "+(f.status>=400?"text-red-500":"text-green-600 dark:text-green-400"),children:f.status})]}),i.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:[i.jsxs("span",{title:"actual prompt_tokens sent this request",children:["sent ",qb(f.sentActualTokens)," tokens"]}),i.jsxs("span",{title:"growing part-store size",children:["store ",qb(f.storeTokens)," tokens"]}),f.sentActualDelta!=null&&i.jsxs("span",{className:f.sentActualDelta>=0?"text-amber-500":"text-emerald-500",title:"Δ sent actual vs previous request",children:[f.sentActualDelta>=0?"+":"",qb(f.sentActualDelta)," vs prev"]}),f.ttftMs!=null&&i.jsxs("span",{title:"time to first token",children:["ttft ",f.ttftMs," ms"]})]})]})}})})]})}function bu({text:e,getText:t,label:n="Copy",className:r="",title:a}){const[o,l]=y.useState(!1),[u,d]=y.useState(!1),f=y.useRef(null);y.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const p=y.useCallback(async g=>{g.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(x){console.error("Copy failed:",x),l(!1),d(!0),f.current=setTimeout(()=>d(!1),1800)}},[e,t]);return i.jsx("button",{type:"button",onMouseDown:function(g){g.preventDefault()},onClick:p,title:a||n,"aria-label":a||n,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 ")+r,children:u?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"copy failed"]}):o?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"copied"]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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]})})}function dK(e,t){return e==="all"?!0:e==="none"?!1:t<1}function MT({name:e}){return e==null?null:typeof e=="number"?i.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:["[",e,"]"]}):i.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:JSON.stringify(e)})}function fK({value:e}){const[t,n]=y.useState(!1),r=JSON.stringify(e);return r.length<=200?i.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:r}):i.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:[t?r:r.slice(0,200)+"…",i.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),n(o=>!o)},className:"ml-1 text-[10px] text-primary-500 dark:text-primary-400 hover:underline align-baseline",children:t?"less":`+${(r.length-200).toLocaleString()} more`})]})}function pK({value:e}){return e===null?i.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"null"}):typeof e=="string"?i.jsx(fK,{value:e}):typeof e=="number"?i.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:String(e)}):typeof e=="boolean"?i.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:String(e)}):i.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:String(e)})}function qA({data:e,name:t,depth:n=0,openMode:r="auto"}){const a=Array.isArray(e),o=e&&typeof e=="object"&&!a,[l,u]=y.useState(()=>dK(r,n)),d={paddingLeft:n*12+"px"};if(!o&&!a)return i.jsxs("div",{style:d,className:"leading-5 break-all",children:[i.jsx("span",{className:"inline-block w-3"}),i.jsx(MT,{name:t}),t!=null&&i.jsx("span",{className:"text-gray-400",children:": "}),i.jsx(pK,{value:e})]});const f=a?e.map((m,x)=>[x,m]):Object.entries(e),[p,g]=a?["[","]"]:["{","}"];return i.jsxs("div",{children:[i.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:[i.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 select-none",children:f.length?l?"▾":"▸":" "}),i.jsx(MT,{name:t}),t!=null&&i.jsx("span",{className:"text-gray-400",children:": "}),i.jsxs("span",{className:"text-gray-400",children:[p,l?"":f.length?` … ${g}`:g]}),!l&&f.length>0&&i.jsxs("span",{className:"ml-1 text-[10px] text-gray-400 dark:text-gray-500",children:[f.length," ",a?"items":"keys"]})]}),l&&f.map(([m,x])=>i.jsx(qA,{data:x,name:m,depth:n+1,openMode:r},m)),l&&f.length>0&&i.jsxs("div",{style:d,className:"leading-5 text-gray-400",children:[i.jsx("span",{className:"inline-block w-3"}),g]})]})}function Do({value:e,bytes:t,onResolveRef:n,label:r="JSON"}){const[a,o]=y.useState(null),[l,u]=y.useState(!1),[d,f]=y.useState(null),[p,g]=y.useState("all"),[m,x]=y.useState(0),[v,k]=y.useState(!1);y.useEffect(()=>{o(null),u(!1),f(null)},[e]);const _=a??e,E=Ru(_),S=y.useCallback(async()=>{if(n){u(!0),f(null);try{const T=Hl(_),R=await n(T);o(R)}catch(T){f(T&&T.message?T.message:"Failed to fetch")}finally{u(!1)}}},[_,n]);if(_==null)return i.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"(none)"});if(E)return i.jsxs("div",{className:"text-xs",children:[i.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&&i.jsx("div",{className:"mt-1 text-red-500 dark:text-red-400",children:d})]});const N=typeof _=="string"?_:JSON.stringify(_,null,2),A=_&&typeof _=="object";return i.jsxs("div",{className:"relative group",children:[i.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&&i.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&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>{g("all"),x(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"}),i.jsx("button",{type:"button",onClick:()=>{g("none"),x(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"})]}),i.jsx(bu,{getText:()=>N,label:"copy",title:`Copy ${r}`})]}),A&&!v?i.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:i.jsx(qA,{data:_,openMode:p},`${p}-${m}`)}):i.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:N})]})}const LT={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 mf(e){return e==null?"—":e>=1024?(e/1024).toFixed(1)+"KB":e+"B"}function hK({rec:e,onResolveRef:t}){const[n,r]=y.useState("idle"),[a,o]=y.useState(null),[l,u]=y.useState(null),d=e.store&&e.store.messages,f=e.body,p=d===void 0,g=y.useCallback(async()=>{r("loading"),o(null);try{const N=Ru(d)?await t(Hl(d)):d,A=Ru(f)?await t(Hl(f)):f,T=Array.isArray(N)?N:N&&N.messages||[],R=A&&A.messages||[];u(iK(T,R)),r("ready")}catch(N){o(N&&N.message?N.message:"failed to load"),r("error")}},[d,f,t]);if(p)return i.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(n!=="ready")return i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:g,disabled:n==="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:n==="loading"?"computing…":"Compute per-message trim diff"}),a&&i.jsx("div",{className:"text-[11px] text-red-500 mt-1",children:a})]});const{rows:m,firstChanged:x,maxBytes:v}=l,k=x>=0,_=k?m[x]:null,E=k?x:m.length,S=k?m.length-x:0;return i.jsxs("div",{className:"space-y-2",children:[i.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?i.jsxs(i.Fragment,{children:[i.jsxs("b",{className:"text-amber-700 dark:text-amber-300",children:["Cache prefix breaks at message #",x]})," (",_.role," · ",_.tag,"). The first ",E," message",E===1?"":"s"," are byte-identical to the store (cache-eligible); the ",S," from #",x," on differ, so they're re-prefilled."]}):i.jsxs(i.Fragment,{children:[i.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."]})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[10px] text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-gray-300 dark:bg-gray-600"})," store (pre-trim)"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-sky-500"})," sent (post-trim)"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-fuchsia-400/50"})," trimmed off"]}),i.jsx("span",{className:"ml-auto",children:"oldest → newest (top → bottom)"})]}),i.jsxs("div",{className:"space-y-0.5",children:[m.slice(0,300).map(N=>{const A=k&&N.i===x,T=Math.round((N.beforeBytes||0)/v*100),R=Math.round((N.afterBytes||0)/v*100);return i.jsxs("div",{children:[A&&i.jsxs("div",{className:"flex items-center gap-2 my-1","aria-label":"cache prefix break",children:[i.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"}),i.jsx("span",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-400 whitespace-nowrap",children:"cache prefix breaks here ↓"}),i.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"})]}),i.jsxs("div",{className:"flex items-center gap-2 rounded pl-1 "+(N.changed?"bg-fuchsia-50/60 dark:bg-fuchsia-900/10":k&&N.i<x?"bg-emerald-50/50 dark:bg-emerald-900/10":""),children:[i.jsxs("span",{className:"w-7 text-right text-[10px] text-gray-400 dark:text-gray-500 shrink-0",children:["#",N.i]}),i.jsx("span",{className:"text-[9px] px-1 rounded shrink-0 w-14 text-center "+(LT[N.role]||LT.system),children:N.role}),i.jsxs("div",{className:"flex-1 min-w-0 h-3 rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative",title:`store ${mf(N.beforeBytes)} → sent ${mf(N.afterBytes)}`,children:[i.jsx("div",{className:"absolute inset-y-0 left-0 bg-gray-300 dark:bg-gray-600",style:{width:T+"%"}}),N.changed&&N.afterBytes!=null&&N.beforeBytes!=null&&N.afterBytes<N.beforeBytes&&i.jsx("div",{className:"absolute inset-y-0 bg-fuchsia-400/50",style:{left:R+"%",width:Math.max(0,T-R)+"%"}}),i.jsx("div",{className:"absolute inset-y-0 left-0 bg-sky-500",style:{width:R+"%"}})]}),i.jsx("span",{className:"w-24 text-right text-[9px] font-mono text-gray-500 dark:text-gray-400 shrink-0",children:N.changed?`${mf(N.beforeBytes)}→${mf(N.afterBytes)}`:"cached"}),i.jsx("span",{className:"hidden sm:block w-28 text-[9px] text-gray-400 dark:text-gray-500 shrink-0 truncate",title:N.tag,children:N.changed?N.tag:""})]})]},N.i)}),m.length>300&&i.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 pl-1 pt-1",children:["… ",m.length-300," more messages"]})]}),i.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 OT=4,gK=2.8,Ub=e=>e==null?"—":e.toLocaleString();function Hb({chars:e,ratio:t,ratioNote:n,tokens:r}){if(e==null)return null;const a=Math.ceil(e/t),o=r!=null?r-a:0;return i.jsxs("span",{className:"block text-[10px] font-mono text-gray-400 dark:text-gray-500 leading-tight mt-px",children:["= ⌈",Ub(e)," chars ÷ ",t,"⌉",o?i.jsxs(i.Fragment,{children:[" + ",Ub(o)]}):null," = ",i.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/80",children:Ub(r)})," tok",i.jsxs("span",{className:"text-gray-300 dark:text-gray-600",children:[" · ",n,o?" + structure/attachments":""]})]})}function $b({label:e,tokens:t,sub:n,calc:r,expanded:a,isOpen:o,onToggle:l}){return i.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[i.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:[i.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 mt-px",children:o?"▾":"▸"}),i.jsxs("span",{className:"flex-1 min-w-0",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] font-medium text-gray-700 dark:text-gray-200 flex-1",children:e}),i.jsxs("span",{className:"text-[11px] font-mono text-amber-600 dark:text-amber-400",children:[t==null?"—":t.toLocaleString()," tok"]}),n?i.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["· ",n]}):null]}),r]})]}),o&&i.jsx("div",{className:"pb-2 pl-1",children:a})]})}function mK({rec:e,onResolveRef:t,overheadSystem:n,overheadTools:r,toolCount:a,newMessageTokens:o,overheadSystemChars:l,overheadToolsChars:u,newMessageChars:d}){const f=Ru(e.body),[p,g]=y.useState(()=>f?null:e.body),[m,x]=y.useState(()=>f?"idle":"ready"),[v,k]=y.useState(null),[_,E]=y.useState(null),S=y.useCallback(async()=>{if(!f){g(e.body),x("ready");return}x("loading"),k(null);try{const D=await t(Hl(e.body));g(D),x("ready")}catch(D){k(D&&D.message?D.message:"failed to load"),x("error")}},[f,e.body,t]),N=D=>{E(F=>F===D?null:D),m==="idle"&&S()},A=m==="ready",T=A&&p&&Array.isArray(p.messages)?p.messages:[],R=T.find(D=>D&&D.role==="system"),C=R?R.content:null,O=A&&p?p.tools:null,M=T.length?T[T.length-1]:null,I=(D,F)=>m==="loading"?i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"loading…"}):m==="error"?i.jsxs("div",{className:"text-[10px] text-red-500",children:[v||"failed to load"," —"," ",i.jsx("button",{type:"button",onClick:S,className:"underline hover:no-underline",children:"retry"})]}):D==null?i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"(not present in this request body)"}):i.jsx(Do,{value:D,onResolveRef:t,label:F});return i.jsxs("div",{className:"pt-1",children:[i.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:"}),i.jsx($b,{label:"system prompt",tokens:n,calc:i.jsx(Hb,{chars:l,ratio:OT,ratioNote:"natural language",tokens:n}),expanded:I(C,"system prompt"),isOpen:_==="system",onToggle:()=>N("system")}),i.jsx($b,{label:"tool schemas",tokens:r,sub:a?`${a} tools`:"",calc:i.jsx(Hb,{chars:u,ratio:gK,ratioNote:"JSON",tokens:r}),expanded:I(O,"tool schemas"),isOpen:_==="tools",onToggle:()=>N("tools")}),i.jsx($b,{label:"new message",tokens:o,calc:i.jsx(Hb,{chars:d,ratio:OT,ratioNote:"natural language",tokens:o}),expanded:I(M,"new message"),isOpen:_==="new",onToggle:()=>N("new")})]})}function xK({rec:e,prevRec:t,onSelectSeq:n}){const r=e&&e.messageDrop;if(!r)return null;const a=t&&t.body&&t.body.messages,o=e.body&&e.body.messages,u=Array.isArray(a)&&Array.isArray(o)?nK(a,o):null,d=t?i.jsxs("button",{type:"button",className:"underline underline-offset-2 hover:text-red-900 dark:hover:text-red-100",onClick:()=>n&&n(r.prevSeq),title:"Jump to the previous request",children:["request #",r.prevSeq]}):i.jsxs("span",{title:"That request is no longer in the capture",children:["request #",r.prevSeq]});return i.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:[i.jsxs("div",{className:"px-3 py-2 border-b border-red-200 dark:border-red-900",children:[i.jsxs("div",{className:"text-[12px] font-semibold text-red-700 dark:text-red-300 flex items-center gap-1",children:["⚠ Unexpected message drop",i.jsx("span",{className:"font-normal text-red-500 dark:text-red-400",children:"— possible #1858 regression"})]}),i.jsxs("div",{className:"mt-0.5 text-[11px] text-red-700/90 dark:text-red-300/90",children:["The wire dropped ",i.jsxs("b",{children:[r.wireBefore," → ",r.wireAfter]})," conversation messages between"," ",d," and this one (#",e.seq,") with ",i.jsx("b",{children:"no compaction"}),r.storeMessages!=null&&i.jsxs(i.Fragment,{children:[" — store intact = ",i.jsx("b",{children:r.storeMessages})]}),". Trimming never drops whole messages, so this is a wrongful drop, not a designed trim."]}),i.jsxs("div",{className:"mt-1 text-[10px] text-red-600/80 dark:text-red-400/80",children:["Compare the raw wire arrays:"," ",t?i.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(r.prevSeq),children:["raw request #",r.prevSeq]}):i.jsxs("span",{children:["request #",r.prevSeq," (evicted)"]})," · ",i.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(e.seq),children:["raw request #",e.seq]})]})]}),u&&u.roles.length>0?i.jsxs("div",{className:"px-3 py-1.5",children:[i.jsxs("div",{className:"text-[10px] uppercase tracking-wide text-red-500 dark:text-red-400 mb-1",children:["Messages by role (#",r.prevSeq," → #",e.seq,")"]}),u.roles.map(f=>i.jsxs("div",{className:"text-[11px] font-mono text-red-800 dark:text-red-200 flex items-center gap-2 py-0.5",children:[i.jsxs("span",{className:"inline-block w-20",children:["[",f.role,"]"]}),i.jsxs("span",{children:[f.before," → ",f.after]}),f.delta>0&&i.jsxs("span",{className:"text-red-600 dark:text-red-300 font-semibold",children:["−",f.delta," dropped"]})]},f.role)),i.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)."})]}):i.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 yK=["Request","Response","Chunks","Context","Lifecycle","Est vs actual"];function fn(e){return e==null?"—":typeof e=="number"?e.toLocaleString():String(e)}function En({label:e,children:t,highlight:n}){return i.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:e}),i.jsx("span",{className:"text-xs font-mono "+(n?"text-red-500 dark:text-red-400 font-semibold":"text-gray-700 dark:text-gray-200"),children:t==null||t===""?"—":t})]})}const qf={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"},DT={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 bK({raw:e,parts:t}){const n="break-all whitespace-pre-wrap min-w-0 flex-1",r=[];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&&r.push({start:d,end:d+u.length,type:l.type})}if(!r.length)return i.jsx("span",{className:n+" text-gray-600 dark:text-gray-400",children:e});r.sort((l,u)=>l.start-u.start);const a=[];let o=0;return r.forEach((l,u)=>{l.start<o||(l.start>o&&a.push(i.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o,l.start)},"g"+u)),a.push(i.jsx("span",{className:"font-semibold "+(qf[l.type]||qf.other),children:e.slice(l.start,l.end)},"m"+u)),o=l.end)}),o<e.length&&a.push(i.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o)},"tail")),i.jsx("span",{className:n,children:a})}function xf({n:e,name:t,sub:n,pct:r,trimmedPct:a,fill:o,dashed:l}){return i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"w-4 shrink-0 text-[10px] text-gray-400 dark:text-gray-500 text-right leading-4",children:e}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-[11px] text-gray-700 dark:text-gray-200",children:t}),n&&i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:n}),r!=null&&i.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:[a!=null&&i.jsx("div",{className:"absolute inset-y-0 left-0 bg-fuchsia-400/25",style:{width:Math.min(100,a)+"%"}}),i.jsx("div",{className:"absolute inset-y-0 left-0 "+(o||"bg-gray-400"),style:{width:Math.min(100,r)+"%"}})]})]})]})}function Wb({label:e}){return i.jsxs("div",{className:"pl-6 py-0.5 text-[10px] text-gray-400 dark:text-gray-500 flex items-center gap-1",children:[i.jsx("span",{"aria-hidden":!0,children:"↓"}),i.jsx("span",{children:e})]})}function vK({rec:e,prevRec:t,onSelectSeq:n,onResolveRef:r,onJumpToMessage:a,tab:o,onTabChange:l,showRaw:u,onShowRawChange:d}){if(!e)return i.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,p=f?f.assembled:null,g=e.context,m=g&&g.limit!=null&&g.usable!=null?g.limit-g.usable:null,x=g&&g.threshold!=null&&g.tokReal!=null?g.threshold-g.tokReal:null,v=g?g.source==="estimate":!1,k=g&&(g.historicalEstimate!=null||g.lastPromptTokens!=null)&&g.newMessageTokens!=null,_=g?g.source==="actual"?g.lastPromptTokens:g.historicalEstimate:null,E=g&&g.historicalEstimate!=null&&g.staticOverhead!=null?g.historicalEstimate-g.staticOverhead:null;return i.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:["#",e.seq," · ",e.provider,"/",e.model,i.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})]}),i.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 truncate",children:e.url})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx(bu,{getText:()=>BA(e),label:"request",title:"Copy this request (body + response + context)"}),f&&i.jsx(bu,{getText:()=>oK(e),label:"response",title:"Copy the assembled response"}),e.chunkCount>0&&i.jsx(bu,{getText:()=>zA(e),label:"chunks",title:"Copy all raw chunks"})]})]}),i.jsx(xK,{rec:e,prevRec:t,onSelectSeq:n}),i.jsx("div",{className:"flex items-center gap-1 px-3 pt-2 shrink-0 border-b border-gray-200 dark:border-gray-800",children:yK.map(S=>i.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))}),i.jsxs("div",{className:"flex-1 overflow-auto p-3 min-h-0",children:[o==="Request"&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx(En,{label:"fingerprint",children:e.fingerprint}),i.jsx(En,{label:"bodyBytes",children:e.bodyBytes!=null?e.bodyBytes.toLocaleString():null}),e.shrink&&i.jsxs(En,{label:"shrink rungs",children:[(e.shrink.rungsFired||[]).join(", ")||"(none)",e.shrink.fitted!=null?` fitted=${e.shrink.fitted}`:""]}),e.bubbleMessageID&&i.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:"bubble msgID"}),a?i.jsx("button",{type:"button",onClick:()=>a(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}):i.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-gray-200",children:e.bubbleMessageID})]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Params"}),i.jsx(Do,{value:e.params,label:"params"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Headers (redacted)"}),i.jsx(Do,{value:e.headers,label:"headers"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Request body (exact bytes sent)"}),i.jsx(Do,{value:e.body,bytes:e.bodyBytes,onResolveRef:r,label:"body"})]})]}),o==="Response"&&i.jsx("div",{className:"space-y-3",children:f?i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"HTTP response (status line)"}),i.jsx(En,{label:"HTTP status",highlight:e.status!=null&&e.status>=400,children:e.status})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Response headers (from EPM)"}),e.paveContext&&i.jsx(En,{label:"x-pave-resolved-model",children:e.paveContext.resolvedModel}),e.paveContext&&i.jsx(En,{label:"x-pave-context-floor",children:e.paveContext.contextFloor}),f.headers?i.jsxs("div",{className:"mt-1",children:[i.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"full header set (redacted):"}),i.jsx(Do,{value:f.headers,label:"response headers"})]}):i.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."})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"From the SSE body"}),i.jsx(En,{label:"finishReason",highlight:e.finishReason==="length",children:e.finishReason}),f.usage&&i.jsx(En,{label:"prompt_tokens",children:fn(f.usage.prompt_tokens)}),f.usage&&i.jsx(En,{label:"completion_tokens",children:fn(f.usage.completion_tokens)}),f.usage&&f.usage.total_tokens!=null&&i.jsx(En,{label:"total_tokens",children:fn(f.usage.total_tokens)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Assembled response (from the SSE body)"}),i.jsx(Do,{value:p,onResolveRef:r,label:"assembled"})]})]}):i.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No response captured (in-flight or aborted)."})}),o==="Chunks"&&i.jsxs("div",{className:"space-y-2",children:[i.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-sm 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:[i.jsxs("span",{children:["TTFT: ",i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.ttftMs!=null?e.ttftMs+"ms":"—"})]}),i.jsxs("span",{children:["total: ",i.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.totalMs!=null?e.totalMs+"ms":"—"})]}),i.jsxs("span",{children:["chunks: ",i.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&&i.jsxs("span",{children:["throughput: ",i.jsxs("b",{className:"text-gray-700 dark:text-gray-200",children:[(e.response.usage.completion_tokens/(e.totalMs/1e3)).toFixed(1)," tok/s"]})]}),i.jsxs("label",{className:"ml-auto flex items-center gap-1 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:u,onChange:S=>d(S.target.checked),className:"accent-primary-500"}),"raw frames"]})]}),e.chunks.length===0?i.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No chunks captured."}):i.jsx("div",{className:"space-y-1",children:e.chunks.map((S,N)=>{const A=N===0?e.ts!=null?S.ts-e.ts:0:S.ts-e.chunks[N-1].ts,T=rK(S).parts,R=T.filter(C=>C.piece!=="");return i.jsxs("div",{className:"flex items-start gap-2 text-[11px] font-mono",children:[i.jsxs("span",{className:"text-gray-400 dark:text-gray-600 w-12 shrink-0 text-right",children:["+",A,"ms"]}),i.jsx("span",{className:"w-[72px] shrink-0 flex flex-col items-start gap-0.5",children:T.map((C,O)=>i.jsx("span",{className:"px-1 rounded "+(DT[C.type]||DT.other),children:C.type},O))}),u?i.jsx(bK,{raw:S.raw,parts:T}):i.jsx("span",{className:"break-all whitespace-pre-wrap min-w-0 flex-1",title:S.raw,children:R.length?R.map((C,O)=>i.jsx("span",{className:(O?"ml-1 ":"")+(qf[C.type]||qf.other),children:C.piece},O)):i.jsx("span",{className:"italic opacity-60 text-gray-500",children:S.raw})})]},S.seq)})}),!u&&e.chunks.length>0&&i.jsxs("div",{className:"pt-1 text-[10px] text-gray-400 dark:text-gray-500",children:["Coloured by the assembled part each chunk feeds: ",i.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"reasoning"})," · ",i.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:"text"})," · ",i.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:"tool"})," · ",i.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"usage"}),". Toggle “raw frames” for the exact SSE."]})]}),o==="Context"&&i.jsxs("div",{className:"space-y-3",children:[g?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"rounded-lg border p-2.5 "+(g.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:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"Compaction decision"}),i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(g.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:g.needsCompaction?"TRIGGERED":"not triggered"}),i.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["evaluated ",i.jsx("b",{children:"before"})," the request is sent · once per turn"]})]}),i.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[i.jsxs("div",{children:["compact when ",i.jsx("b",{children:"tokReal > threshold"})," →"," ",i.jsxs("span",{className:g.needsCompaction?"text-fuchsia-600 dark:text-fuchsia-400 font-semibold":"text-emerald-600 dark:text-emerald-400 font-semibold",children:[fn(g.tokReal)," ",g.needsCompaction?">":"≤"," ",fn(g.threshold)]})]}),i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["headroom = threshold − tokReal = ",fn(g.threshold)," − ",fn(g.tokReal)," = ",i.jsx("b",{className:x!=null&&x<0?"text-fuchsia-600 dark:text-fuchsia-400":"",children:fn(x)})]}),i.jsxs("div",{className:"pt-1 text-gray-500 dark:text-gray-400",children:["threshold = ⌊usable × margin⌋ = ⌊",fn(g.usable)," × ",g.margin??"?","⌋ = ",fn(g.threshold)]}),i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["usable = limit − reserve = ",fn(g.limit)," − ",fn(m)," = ",fn(g.usable)]})]})]}),k&&i.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"How tokReal is computed"}),i.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"})]}),i.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[i.jsxs("div",{children:["tokReal = ",v?"historical estimate":"last prompt_tokens"," + new message = ",i.jsx("b",{children:fn(_)})," + ",i.jsx("b",{children:fn(g.newMessageTokens)})," = ",i.jsx("b",{children:fn(g.tokReal)})]}),v?i.jsxs(i.Fragment,{children:[E!=null&&i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["historical estimate = conversation estimate + system+tools overhead = ",fn(E)," + ",fn(g.staticOverhead)," = ",fn(g.historicalEstimate)]}),(g.overheadSystem!=null||g.overheadTools!=null)&&i.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["system+tools overhead = system prompt ",fn(g.overheadSystem)," + tool schemas ",fn(g.overheadTools),g.toolCount?` (${g.toolCount} tools)`:""," = ",fn(g.staticOverhead)]}),i.jsxs("div",{className:"text-[10px] text-amber-600 dark:text-amber-400 pt-0.5",children:["ESTIMATE — no measured ",i.jsx("code",{children:"prompt_tokens"})," was available yet, so this is openpave's own estimate. The system prompt + tool schemas (",fn(g.staticOverhead),") dominate, which is why tokReal ≫ the store."]})]}):i.jsxs("div",{className:"text-[10px] text-gray-500 dark:text-gray-400 pt-0.5",children:["MEASURED — the previous response's ",i.jsx("code",{children:"prompt_tokens"})," (",fn(g.lastPromptTokens),"), which already counts system prompt + tools + conversation."]}),i.jsx("div",{className:"font-sans",children:i.jsx(mK,{rec:e,onResolveRef:r,overheadSystem:g.overheadSystem,overheadTools:g.overheadTools,toolCount:g.toolCount,newMessageTokens:g.newMessageTokens,overheadSystemChars:g.overheadSystemChars,overheadToolsChars:g.overheadToolsChars,newMessageChars:g.newMessageChars})})]})]}),i.jsxs("div",{children:[i.jsx(En,{label:"limit (window)",children:fn(g.limit)}),i.jsx(En,{label:"reserve (output)",children:fn(m)}),i.jsx(En,{label:"usable",children:fn(g.usable)}),i.jsx(En,{label:"margin",children:g.margin}),i.jsx(En,{label:"threshold",children:fn(g.threshold)}),i.jsx(En,{label:"tokReal",children:fn(g.tokReal)}),i.jsx(En,{label:"needsCompaction",highlight:!!g.needsCompaction,children:String(g.needsCompaction)}),i.jsx(En,{label:"source",children:g.source}),i.jsx(En,{label:"windowSource",children:g.windowSource||g.epmWindowSignal})]})]}):i.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 ",i.jsx("b",{children:"once per turn"})," (at the turn's first request); tool-iteration follow-ups and compaction turns reuse it.",e.contextFrom!=null&&i.jsxs(i.Fragment,{children:[" The most recent decision was evaluated at ",i.jsxs("b",{children:["request #",e.contextFrom]}),"."]})]}),e.store&&i.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[i.jsx(En,{label:"storeTokens",children:fn(e.storeTokens)}),i.jsx(En,{label:"storeMessages",children:e.storeMessages}),e.store.messages!==void 0&&i.jsxs("div",{className:"mt-2",children:[i.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"}),i.jsx(Do,{value:e.store.messages,onResolveRef:r,label:"store messages"})]})]}),e.compaction&&i.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fuchsia-500 mb-1",children:"Compaction (followed this request)"}),i.jsx(En,{label:"trigger",children:e.compaction.trigger}),i.jsx(En,{label:"deleted",children:fn(e.compaction.deletedMessages)}),i.jsx(En,{label:"summary tok",children:fn(e.compaction.summaryTokens)}),i.jsx(En,{label:"before",children:fn(e.compaction.before)}),i.jsx(En,{label:"after",children:fn(e.compaction.after)}),i.jsx(En,{label:"handoffFresh",highlight:e.compaction.handoffFresh===!1,children:typeof e.compaction.handoffFresh=="boolean"?String(e.compaction.handoffFresh):"—"})]})]}),o==="Est vs actual"&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Estimator (",i.jsx("code",{children:"estimateWireTokens"}),") vs the provider's actual ",i.jsx("code",{children:"prompt_tokens"})," — exposes tokenizer drift."]}),i.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:[i.jsx("b",{children:"sent est"})," counts the whole ",i.jsx("b",{children:"messages array"})," — the system prompt included (it's a ",i.jsx("code",{children:'role:"system"'})," message) — with a coarse byte-length ÷ 3 heuristic plus fixed per-message/tool envelopes, but ",i.jsx("b",{children:"excludes the tool schemas"})," (a top-level ",i.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 ",i.jsx("b",{children:"sent actual"}),". ",i.jsx("b",{children:"sent actual"})," (",i.jsx("code",{children:"prompt_tokens"}),") is the provider's real tokenizer over the ",i.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."]}),i.jsx(En,{label:"sent est",children:fn(e.sentEstTokens)}),i.jsx(En,{label:"sent actual",children:fn(e.sentActualTokens)}),e.sentEstTokens!=null&&e.sentActualTokens!=null&&i.jsxs(i.Fragment,{children:[i.jsx(En,{label:"delta (est−actual)",highlight:Math.abs(e.sentEstTokens-e.sentActualTokens)>e.sentActualTokens*.15,children:(e.sentEstTokens-e.sentActualTokens).toLocaleString()}),i.jsx(En,{label:"drift %",children:e.sentActualTokens?((e.sentEstTokens-e.sentActualTokens)/e.sentActualTokens*100).toFixed(1)+"%":"—"})]}),i.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[i.jsx(En,{label:"store tokens",children:fn(e.storeTokens)}),i.jsx(En,{label:"Δ vs prev actual",children:e.sentActualDelta!=null?(e.sentActualDelta>=0?"+":"")+e.sentActualDelta.toLocaleString():null}),e.response&&e.response.usage&&i.jsxs(i.Fragment,{children:[i.jsx(En,{label:"completion_tokens",children:e.response.usage.completion_tokens}),i.jsx(En,{label:"total_tokens",children:e.response.usage.total_tokens}),e.response.usage.reasoning_tokens!=null&&i.jsx(En,{label:"reasoning_tokens",children:e.response.usage.reasoning_tokens})]})]})]}),o==="Lifecycle"&&(()=>{const S=e.trimmed,N=S!=null&&S>0,A=e.finishReason==="length",T=g?g.needsCompaction:null,R=e.storeTokens,C=e.sentActualTokens,O=Math.max(R||0,C||0,e.sentEstTokens||0,1),M=I=>Math.round((I||0)/O*100);return i.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-gray-600 dark:text-gray-300",children:[i.jsxs("div",{children:[i.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"}),i.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:[i.jsx(xf,{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)."}),i.jsx(Wb,{label:"render — internal parts → API message shape; DROP compactedOut, KEEP summary"}),i.jsx(xf,{n:"2",name:"LLM context = formattedMessages (the inspector's ‘store’)",sub:`${fn(R)} tok · ${e.storeMessages!=null?e.storeMessages+" msgs":"—"}`,pct:M(R),fill:"bg-emerald-500"}),i.jsx(Wb,{label:"slice — shallow copy so trimming can't touch the original render"}),i.jsx(xf,{n:"3",name:"Wire copy = conversationMessages",sub:"identical to layer 2 until trimmed",pct:M(R),fill:"bg-emerald-500/40",dashed:!0}),i.jsx(Wb,{label:N?`trim — fit to budget (−${fn(S)} tok net)`:"trim — nothing net-trimmed this request"}),i.jsx(xf,{n:"4",name:"Sent = [system] + trimmed wire + tools",sub:`${fn(C)} tok actual · est ${fn(e.sentEstTokens)}`,pct:M(C),trimmedPct:N?M(R):null,fill:"bg-sky-500"})]}),N&&i.jsxs("div",{className:"mt-0.5 pl-6 text-[10px] text-gray-400 dark:text-gray-500",children:[i.jsx("span",{className:"inline-block w-2.5 h-2 rounded-xs bg-fuchsia-400/25 align-middle mr-1"}),"shaded = trimmed off this request (store − sent)",A?" · finishReason=length: model hit the output limit":""]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"…the four steps, in words"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px] text-gray-600 dark:text-gray-300",children:[i.jsxs("li",{children:[i.jsx("b",{children:"Compaction"})," (upstream, only near the limit): summarise old messages in the durable store — flag them ",i.jsx("code",{children:"compactedOut"})," + add a summary."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Render"}),": translate the store’s internal “parts” into the API’s message shape, dropping ",i.jsx("code",{children:"compactedOut"})," and including the summary → layer 2."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Slice"}),": shallow-copy layer 2 → layer 3, so trimming mutates the copy, not the original render."]}),i.jsxs("li",{children:[i.jsx("b",{children:"Trim"}),": shrink the copy to fit the budget (the ladder below), then assemble ",i.jsx("code",{children:"[system + trimmed wire + tools]"})," and send → layer 4."]})]}),i.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["So compaction is ",i.jsx("b",{children:"pre-emptive"})," — before trimming (step 1). There's also a ",i.jsx("b",{children:"reactive"})," path: if the sent request 413s (our budget was an estimate), it trims ",i.jsx("i",{children:"harder"})," and, only if that still won't fit, compacts and resends. Trimming sits between the two."]})]}),i.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:[i.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 ",i.jsx("b",{children:"rewrites older messages"})," (stubs tool outputs, strips reasoning, caps old text) — and the recency-weighted ladder trims the ",i.jsx("b",{children:"oldest first"}),", i.e. the cache prefix. So a trimmed request usually ",i.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."]}),i.jsxs("div",{children:[i.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"}),i.jsx(hK,{rec:e,onResolveRef:r})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Compaction (this request)"}),e.compaction?i.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 ",fn(e.compaction.before)," → ",fn(e.compaction.after)," tok. The on-disk history was permanently summarised."]}):i.jsxs("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:["No compaction on this request.",T!=null&&i.jsxs(i.Fragment,{children:[" Decision at build time: ",i.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)."]})]}),i.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["Compaction drops old messages from the ",i.jsx("b",{children:"LLM context"})," (a summary replaces them) — it does ",i.jsx("b",{children:"not"})," delete them: they stay on disk flagged ",i.jsx("code",{children:"compactedOut"})," and the web UI still shows every bubble. So the inspector's ",i.jsx("b",{children:"store"})," line = the LLM context (it drops at compaction), not the visible conversation."]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Trimming vs compaction"}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[i.jsx("th",{className:"py-1 pr-2 font-medium",children:" "}),i.jsx("th",{className:"py-1 pr-2 font-semibold text-sky-700 dark:text-sky-300",children:"Trimming"}),i.jsx("th",{className:"py-1 font-semibold text-fuchsia-700 dark:text-fuchsia-300",children:"Compaction"})]})}),i.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,D,F])=>i.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[i.jsx("td",{className:"py-1 pr-2 text-gray-500 dark:text-gray-400 whitespace-nowrap",children:I}),i.jsx("td",{className:"py-1 pr-2 text-gray-700 dark:text-gray-200",children:D}),i.jsx("td",{className:"py-1 text-gray-700 dark:text-gray-200",children:F})]},I))})]})})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The trimming ladder (fitWireToBudget)"}),i.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."}),i.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px]",children:[i.jsxs("li",{children:[i.jsx("b",{className:"text-amber-600 dark:text-amber-400",children:"Strip historical reasoning_content"})," — blank out old “thinking” blocks."]}),i.jsxs("li",{children:[i.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool outputs"})," — replace big tool results with a size marker."]}),i.jsxs("li",{children:[i.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool-call arguments"})," — replace large args with a shape placeholder."]}),i.jsxs("li",{children:[i.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."]})]}),i.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 kK(e){return e==null?"":e>=1048576?(e/1048576).toFixed(1)+" MB":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}const vu=(e,t,n)=>Math.min(n,Math.max(t,e)),PT=0,FT=560,BT=220,zT=200,qT=640,UT=300,Uf=520;function Vb(e,t,n,r){try{const a=parseInt(window.localStorage.getItem(e),10);if(Number.isFinite(a))return vu(a,n,r)}catch{}return t}function HT(){try{return Math.max(Uf,window.innerWidth)}catch{return 1600}}function $T(){try{return vu(Math.round(window.innerWidth*.9),Uf,1600)}catch{return 1200}}function _K({open:e,onClose:t,activeSessionId:n,activeSessionTitle:r,onJumpToMessage:a}){const[o,l]=y.useState([]),[u,d]=y.useState(null),[f,p]=y.useState(""),[g,m]=y.useState(!1),[x,v]=y.useState(null),[k,_]=y.useState(null),[E,S]=y.useState(()=>Vb("inspectorTimelineHeight",BT,PT,FT)),[N,A]=y.useState(()=>Vb("inspectorLedgerWidth",UT,zT,qT)),[T,R]=y.useState(()=>Vb("inspectorDrawerWidth",$T(),Uf,HT())),[C,O]=y.useState(!1),[M,I]=y.useState(0),[D,F]=y.useState("Request"),[ee,H]=y.useState(!1),P=y.useMemo(()=>f?aK(f):null,[f]);y.useEffect(()=>{try{window.localStorage.setItem("inspectorTimelineHeight",String(E))}catch{}},[E]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorLedgerWidth",String(N))}catch{}},[N]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorDrawerWidth",String(T))}catch{}},[T]);const K=y.useCallback($=>{$.preventDefault();const fe=$.clientY,ae=E,xe=ze=>S(vu(ae+(ze.clientY-fe),PT,FT)),Ie=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",Ie),window.removeEventListener("pointercancel",Ie),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",xe),window.addEventListener("pointerup",Ie),window.addEventListener("pointercancel",Ie)},[E]),V=y.useCallback($=>{$.preventDefault();const fe=$.clientX,ae=N,xe=ze=>A(vu(ae+(ze.clientX-fe),zT,qT)),Ie=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",Ie),window.removeEventListener("pointercancel",Ie),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",xe),window.addEventListener("pointerup",Ie),window.addEventListener("pointercancel",Ie)},[N]),Z=y.useCallback($=>{$.preventDefault();const fe=$.clientX,ae=T,xe=ze=>R(vu(ae+(fe-ze.clientX),Uf,HT())),Ie=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",Ie),window.removeEventListener("pointercancel",Ie),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",xe),window.addEventListener("pointerup",Ie),window.addEventListener("pointercancel",Ie)},[T]),le=y.useCallback(async()=>{if(P){O(!0);try{const $=new Map;await Promise.all(lK(P).map(async ze=>{try{$.set(ze,await M_(u,ze))}catch{}}));const fe=RT(P,u,$),ae=new Blob([fe],{type:"text/plain;charset=utf-8"}),xe=URL.createObjectURL(ae),Ie=document.createElement("a");Ie.href=xe,Ie.download=`inspector-${u||"session"}.txt`,document.body.appendChild(Ie),Ie.click(),Ie.remove(),setTimeout(()=>URL.revokeObjectURL(xe),2e3)}catch($){v($&&$.message?$.message:"Download failed")}finally{O(!1)}}},[P,u]),B=y.useCallback(async()=>{try{const $=await rL();l(Array.isArray($)?$:[])}catch($){v($&&$.message?$.message:"Failed to list sessions")}},[]);y.useEffect(()=>{e&&B()},[e,n,B]),y.useEffect(()=>{e&&d($=>n||($&&o.some(fe=>fe.id===$)?$:o.length?o[0].id:null))},[e,n,o]),y.useEffect(()=>{if(!e||!u){p("");return}let $=!1;return m(!0),v(null),_(null),p(""),iL(u).then(fe=>{$||p(fe||"")}).catch(fe=>{$||(fe&&fe.status===404?p(""):v(fe&&fe.message?fe.message:"Failed to load events"))}).finally(()=>{$||m(!1)}),()=>{$=!0}},[e,u,M]);const U=y.useCallback(()=>{B(),I($=>$+1)},[B]);y.useEffect(()=>{if(P&&P.requests.length&&k==null){const $=P.requests.find(fe=>fe.messageDrop);_(($||P.requests[0]).seq)}},[P,k]),y.useEffect(()=>{if(!e)return;const $=fe=>{fe.key==="Escape"&&t()};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[e,t]);const Y=y.useCallback($=>M_(u,$),[u]),q=y.useCallback(async()=>{if(u&&window.confirm(`Purge inspector capture for session ${u}? This deletes the on-disk NDJSON and cannot be undone.`))try{await aL(u),p(""),d(null),await B()}catch($){v($&&$.message?$.message:"Failed to purge")}},[u,n,B]),te=y.useMemo(()=>P&&P.requests.find($=>$.seq===k)||null,[P,k]),W=y.useMemo(()=>P&&te&&te.messageDrop&&P.requests.find($=>$.seq===te.messageDrop.prevSeq)||null,[P,te]);return e?i.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[i.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:t,"aria-hidden":"true"}),i.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:[i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector width",title:"Drag to resize the inspector · double-click to reset",onPointerDown:Z,onDoubleClick:()=>R($T()),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:i.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"})}),i.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 h-12 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"text-base shrink-0",children:"🦋"}),i.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 shrink-0",children:"Inspector"}),i.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 shrink-0",children:"debug"}),u&&i.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===n&&r?`${r} · ${u}`:u,children:[u===n&&r?r:u,u===n&&i.jsx("span",{className:"ml-1 text-emerald-500",title:"the chat you're currently in",children:"●"})]})]}),i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsxs("select",{value:u||"",onChange:$=>d($.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&&!n&&i.jsx("option",{value:"",children:"(no captures)"}),n&&!o.some($=>$.id===n)&&i.jsxs("option",{value:n,children:["● ",n.slice(0,12),"… · (current chat — no capture yet)"]}),o.map($=>i.jsxs("option",{value:$.id,children:[$.id===n?"● ":"",$.id.slice(0,12),"… · ",$.events," ev · ",kK($.bytes)]},$.id))]}),i.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 shrink-0",title:"Reload — capture is replay, so re-fetch after sending a prompt","aria-label":"Reload capture",children:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20 9A8 8 0 006 5.3M4 15a8 8 0 0014 3.7"})})}),P&&i.jsx(bu,{getText:()=>RT(P,u),label:"copy session",title:"Copy the whole replay as one LLM-friendly text blob (spilled bodies shown as refs)"}),P&&i.jsx("button",{type:"button",onClick:le,disabled:C,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:C?"preparing…":"download"}),i.jsx("button",{type:"button",onClick:q,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"}),i.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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]}),i.jsxs("div",{className:"px-4 pt-2 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[g?i.jsx("div",{style:{height:E},className:"flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Loading capture…"}):x?i.jsx("div",{style:{height:E},className:"flex items-center justify-center text-sm text-red-500 dark:text-red-400",children:x}):P?i.jsx(cK,{timeline:P.timeline,selectedSeq:k,onSelectSeq:_,height:E}):i.jsx("div",{style:{height:E},className:"flex items-center justify-center text-center px-4 text-sm text-gray-400 dark:text-gray-500",children:u?u===n?"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."}),i.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize timeline",title:"Drag to resize the timeline · double-click to reset",onPointerDown:K,onDoubleClick:()=>S(BT),className:"group h-2.5 flex items-center justify-center cursor-row-resize",children:i.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"})})]}),i.jsxs("div",{className:"flex-1 flex min-h-0",children:[i.jsx("div",{style:{width:N},className:"shrink-0 border-r border-gray-200 dark:border-gray-800 min-h-0 overflow-hidden",children:P?i.jsx(uK,{turns:P.turns,selectedSeq:k,onSelect:_}):i.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"—"})}),i.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:V,onDoubleClick:()=>A(UT),className:"group w-1.5 shrink-0 cursor-col-resize flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:i.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"})}),i.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:i.jsx(vK,{rec:te,prevRec:W,onSelectSeq:_,onResolveRef:Y,onJumpToMessage:a,tab:D,onTabChange:F,showRaw:ee,onShowRawChange:H},te?te.seq:"none")})]})]}),i.jsx("style",{children:"@keyframes slideIn { from { transform: translateX(24px); opacity: .6 } to { transform: translateX(0); opacity: 1 } }"})]}):null}const wK=8,EK=32;function SK({width:e,min:t,max:n,edge:r,onCommit:a,getPaneEl:o,ariaLabel:l,className:u}){const d=y.useRef(null),f=y.useRef(null),p=y.useRef(null),g=y.useRef(e);g.current=e,y.useEffect(()=>()=>{p.current&&p.current()},[]);const m=v=>{if(v.pointerType==="mouse"&&v.button!==0)return;v.preventDefault();const k=v.currentTarget,_=o?o():null,E=v.clientX,S=g.current;try{k.setPointerCapture(v.pointerId)}catch{}d.current=v.pointerId;const N=document.body.style.cursor,A=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let T=!1;const R=I=>{if(d.current!==null&&I.pointerId!==d.current)return;const D=r==="left"?E-I.clientX:I.clientX-E,F=__(S+D,t,n);_&&(_.style.width=F+"px"),f.current=F},C=I=>{if(T)return;T=!0,window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",O),window.removeEventListener("lostpointercapture",O),document.body.style.cursor=N,document.body.style.userSelect=A;const D=d.current;if(d.current=null,D!==null)try{k.releasePointerCapture(D)}catch{}I&&f.current!==null?a(f.current):_&&(_.style.width=g.current+"px"),f.current=null,p.current=null},O=()=>C(!1),M=()=>C(!0);window.addEventListener("pointermove",R),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",O),window.addEventListener("lostpointercapture",O),p.current=()=>C(!1)},x=v=>{const k=v.shiftKey?EK:wK;let _=null;v.key==="ArrowLeft"?_=e+(r==="left"?k:-k):v.key==="ArrowRight"?_=e+(r==="right"?k:-k):v.key==="Home"?_=t:v.key==="End"&&(_=n),_!==null&&(v.preventDefault(),a(__(_,t,n)))};return i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":l,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,tabIndex:0,onPointerDown:m,onKeyDown:x,className:`absolute top-0 bottom-0 w-1 cursor-ew-resize z-10 touch-none ${r==="left"?"left-0":"right-0"}${u?" "+u:""}`})}const WT={oryzo:"oryzo",apple:"apple",flip7:"flip7",questui:"questui",skylearn:"skylearn",editorial:"editorial",blok:"blok",signal:"signal",lens:"lens"};function NK(e,t){const n=typeof e=="string"?e.toLowerCase():"";return Object.prototype.hasOwnProperty.call(WT,n)?WT[n]:t?"oryzo":"default"}class CK{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 n=[];t&&n.push("sessionID="+encodeURIComponent(t)),this.lastEventId&&n.push("lastEventId="+encodeURIComponent(this.lastEventId));const r=xr("/global/event")+(n.length>0?"?"+n.join("&"):"");this.eventSource=new EventSource(r);const a=this.eventSource;a.onopen=()=>{this.eventSource===a&&(this.reconnectDelay=1e3,this._markActivity(),this._emit("connected",{}))},a.onmessage=o=>{if(this.eventSource===a){this._markActivity(),o.lastEventId&&(this.lastEventId=o.lastEventId);try{const l=JSON.parse(o.data);l.type&&this._emit(l.type,l)}catch{}}},a.onerror=()=>{this.eventSource===a&&(this._emit("error",{}),a.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,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&r.delete(n)}_emit(t,n){const r=this.listeners.get(t);if(r)for(const a of r)try{a(n)}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 pn=new CK;function jK(){const[e,t]=y.useState(()=>{if(typeof window<"u"){const D=localStorage.getItem("pave-theme");return D?D==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),[n,r]=y.useState(!1),[a,o]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(!1),[p,g]=y.useState(!1),[m,x]=y.useState(!1),[v,k]=y.useState(!1),[_,E]=y.useState(!1),[S,N]=y.useState(!1),A=e||n;y.useEffect(()=>{const D=document.documentElement;D.classList.toggle("dark",A),D.classList.toggle("theme-oryzo",n),D.classList.toggle("theme-apple",a),D.classList.toggle("theme-flip7",l),D.classList.toggle("theme-questui",d),D.classList.toggle("theme-skylearn",p),D.classList.toggle("theme-editorial",m),D.classList.toggle("theme-blok",v),D.classList.toggle("theme-signal",_),D.classList.toggle("theme-lens",S),D.style.colorScheme=A?"dark":"light",localStorage.setItem("pave-theme",e?"dark":"light"),localStorage.setItem("pave-oryzo",n?"true":"false"),localStorage.setItem("pave-apple",a?"true":"false"),localStorage.setItem("pave-flip7",l?"true":"false"),localStorage.setItem("pave-questui",d?"true":"false"),localStorage.setItem("pave-skylearn",p?"true":"false"),localStorage.setItem("pave-editorial",m?"true":"false"),localStorage.setItem("pave-blok",v?"true":"false"),localStorage.setItem("pave-signal",_?"true":"false"),localStorage.setItem("pave-lens",S?"true":"false")},[A,e,n,a,l,d,p,S,m,v,_]);const[T,R]=y.useState(()=>typeof window<"u"?localStorage.getItem("pave-hacker")==="true":!1);y.useEffect(()=>{localStorage.setItem("pave-hacker",T?"true":"false")},[T]);const[C,O]=y.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1);y.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",C?"true":"false")},[C]);const[M,I]=y.useState(!1);return{darkMode:A,setDarkMode:t,oryzoMode:n,setOryzoMode:r,appleMode:a,setAppleMode:o,flip7Mode:l,setFlip7Mode:u,questuiMode:d,setQuestuiMode:f,skylearnMode:p,setSkylearnMode:g,editorialMode:m,setEditorialMode:x,blokMode:v,setBlokMode:k,signalMode:_,setSignalMode:E,lensMode:S,setLensMode:N,hackerMode:T,setHackerMode:R,matrixMode:M,setMatrixMode:I,mobileFrameless:C,setMobileFrameless:O}}const UA=200,HA=600,TK=288;function RK(){const[e,t]=y.useState(()=>{if(typeof window<"u"){const r=localStorage.getItem("pave-terminal-width");if(r){const a=parseInt(r,10);if(!isNaN(a)&&a>=UA&&a<=HA)return a}}return TK}),n=y.useRef(e);return n.current=e,y.useEffect(()=>{const r=setTimeout(()=>{localStorage.setItem("pave-terminal-width",String(e))},200);return()=>clearTimeout(r)},[e]),y.useEffect(()=>{const r=()=>{localStorage.setItem("pave-terminal-width",String(n.current))};return window.addEventListener("beforeunload",r),()=>{r(),window.removeEventListener("beforeunload",r)}},[]),{terminalWidth:e,setTerminalWidth:t}}const Gb="pave-sidebar-width";function AK(){const[e,t]=y.useState(()=>typeof window>"u"?ku:HI(localStorage.getItem(Gb))),n=y.useRef(e);return n.current=e,y.useEffect(()=>{const r=setTimeout(()=>{localStorage.setItem(Gb,String(e))},200);return()=>clearTimeout(r)},[e]),y.useEffect(()=>{const r=()=>{localStorage.setItem(Gb,String(n.current))};return window.addEventListener("beforeunload",r),()=>{r(),window.removeEventListener("beforeunload",r)}},[]),{sidebarWidth:e,setSidebarWidth:t}}function IK(e){const[t,n]=y.useState(()=>{if(typeof window<"u"){const u=localStorage.getItem("pave-right-pane-visible");return u===null?!0:u==="true"}return!0}),[r,a]=y.useState(""),o=y.useRef(t);o.current=t;const l=y.useCallback(()=>{const u=!o.current;n(u),a(e(u?"app.right_pane_shown":"app.right_pane_hidden"))},[e]);return y.useEffect(()=>{localStorage.setItem("pave-right-pane-visible",t?"true":"false")},[t]),{rightPaneVisible:t,toggleRightPane:l,rightPaneAnnouncement:r}}const $A="pave-banner-hidden";function MK(e){return e?e.getItem($A)==="true":!1}function LK(e){return!e}function OK(e,t){if(!e)return!1;try{return e.setItem($A,String(t)),!0}catch{return!1}}function DK(){const e=()=>typeof window<"u"?window.localStorage:null,[t,n]=y.useState(()=>MK(e())),r=y.useCallback(()=>{n(a=>{const o=LK(a);return OK(e(),o),o})},[]);return{bannerHidden:t,toggleBanner:r}}function PK(){const[e,t]=y.useState(()=>typeof window<"u"&&localStorage.getItem("pave-activity-view")||"map");return y.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-activity-view",e)},[e]),{activityView:e,setActivityView:t}}const FK=150;function BK(e){return e?e.nodeType===1?e:e.parentElement||null:null}function zK(e){const t=BK(e.anchorNode);return!t||!t.closest?null:t.closest("[data-message-id]")}function qK({enabled:e=!0,onQuoteAdd:t}={}){const[n,r]=y.useState(null),a=y.useRef(t);a.current=t;const o=y.useCallback(()=>{if(r(null),typeof window>"u"||!window.getSelection)return;const l=window.getSelection();l&&l.removeAllRanges&&l.removeAllRanges()},[]);return y.useEffect(()=>{if(!e||typeof window>"u"||!window.getSelection)return;let l=null;const u=()=>{const p=window.getSelection();if(!p||p.isCollapsed||p.rangeCount===0){r(null);return}const g=p.toString();if(!g||!g.trim()){r(null);return}const m=zK(p);if(!m){r(null);return}const x=p.getRangeAt(0).getBoundingClientRect();r({text:g,rect:{top:x.top,left:x.left,bottom:x.bottom,right:x.right,width:x.width,height:x.height},sourceMessageID:m.getAttribute("data-message-id"),sourceRole:m.getAttribute("data-message-role")||"assistant",sourceTime:m.getAttribute("data-message-time")||"",fromCode:QB(p)})},d=()=>{l&&clearTimeout(l),l=setTimeout(()=>{l=null,u()},FK)},f=()=>r(null);return document.addEventListener("selectionchange",d),document.addEventListener("mouseup",d),document.addEventListener("touchend",d),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{l&&clearTimeout(l),document.removeEventListener("selectionchange",d),document.removeEventListener("mouseup",d),document.removeEventListener("touchend",d),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[e]),{selection:n,clearSelection:o}}const UK=["web","agent"],HK=["tui","acp"];function Kb(e){return e?e.client?UK.indexOf(e.client)!==-1:HK.indexOf(e.source)===-1:!1}function $K(e){return!!(e&&(e.status||e.response&&e.response.status)===404)}function Yb(e,t){return e.filter(n=>n&&n.id!==t)}function WK(e){return"Failed to load messages: "+(e&&e.message?e.message:String(e))}function VK(e,t,n){const r={...e};return n.length===0?delete r[t]:r[t]=n,r}function GK(e){return!!(e&&e.status===409)}function VT(e,t){return!!(e&&e.length>0||t&&t.length>0)}const GT=40;function KK(){var bl,Rc,md;const{t:e}=rn(),{darkMode:t,setDarkMode:n,oryzoMode:r,setOryzoMode:a,appleMode:o,setAppleMode:l,flip7Mode:u,setFlip7Mode:d,questuiMode:f,setQuestuiMode:p,skylearnMode:g,setSkylearnMode:m,editorialMode:x,setEditorialMode:v,blokMode:k,setBlokMode:_,signalMode:E,setSignalMode:S,lensMode:N,setLensMode:A,hackerMode:T,setHackerMode:R,matrixMode:C,setMatrixMode:O,mobileFrameless:M,setMobileFrameless:I}=jK(),{activityView:D,setActivityView:F}=PK(),{terminalWidth:ee,setTerminalWidth:H}=RK(),{sidebarWidth:P,setSidebarWidth:K}=AK(),{rightPaneVisible:V,toggleRightPane:Z,rightPaneAnnouncement:le}=IK(e),{bannerHidden:B,toggleBanner:U}=DK(),Y="pave-active-session";function q(){try{return localStorage.getItem(Y)||null}catch{return null}}function te(L){try{L?localStorage.setItem(Y,L):localStorage.removeItem(Y)}catch{}}function W(){try{localStorage.removeItem(Y)}catch{}}const[,$]=y.useState(0),[fe,ae]=y.useState(!1),xe=y.useRef(null),Ie=y.useRef(new Map),[ze,mt]=y.useState(()=>new Set),[ut,$e]=y.useState(()=>new Set),qe=y.useRef(null),Oe=y.useRef("chat"),rt=y.useRef(null),ot=y.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]);y.useEffect(()=>{const L=J=>{if(!(J instanceof HTMLElement))return!1;const oe=J.tagName;return!!(oe==="INPUT"||oe==="TEXTAREA"||J.isContentEditable)},X=J=>{if(J.repeat)return;const oe=typeof J.key=="string"?J.key.toLowerCase():"";if((ot?J.metaKey:J.ctrlKey)&&!J.altKey&&!J.shiftKey&&oe==="k"){J.preventDefault(),ae(_n=>!_n);return}if((ot?J.metaKey:J.ctrlKey)&&!J.altKey&&!J.shiftKey&&oe==="b"){J.preventDefault(),He(_n=>!_n);return}const Ce=(ot?J.metaKey:J.ctrlKey)&&!J.altKey&&!J.shiftKey&&oe==="j",_t=window.matchMedia("(min-width: 1024px)").matches,Kt=Oe.current==="chat";if(Ce&&qe.current&&_t&&Kt){J.preventDefault(),Z();return}if(L(J.target))return;const kn=J.ctrlKey&&!J.altKey&&!J.metaKey&&oe==="h",Cn=J.ctrlKey&&J.shiftKey&&!J.altKey&&!J.metaKey&&oe==="m";(kn||Cn)&&(J.preventDefault(),R(_n=>!_n))};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[e,ot,Z,R]);const[At,sn]=y.useState(!0),[Xt,Ht]=y.useState(!1),[We,De]=y.useState(null),[et,nt]=y.useState(null),[de,_e]=y.useState("chat");Oe.current=de;const[Ue,ge]=y.useState(!1),[ft,ht]=y.useState(!1),[vt,pt]=y.useState(!1),[Vt,Gt]=y.useState(!1),[Ze,qt]=y.useState([]),[kt,$t]=y.useState({}),tn=y.useRef(!1);y.useEffect(()=>{wM().then(async L=>{if(Ht(L.enabled),L.authenticated&&L.user){tn.current=!0;try{sessionStorage.removeItem("pave-restore-reloads")}catch{}De(L.user)}else L.enabled&&await Ov()}).catch(L=>{console.error("Failed to check auth status:",L)}).finally(()=>sn(!1))},[]),y.useEffect(()=>(N_(({recovered:L,user:X})=>{if(L){let J=-1;try{J=parseInt(sessionStorage.getItem("pave-restore-reloads")||"0",10)}catch{J=-1}if(J>=0&&J<1){let oe=!1;try{sessionStorage.setItem("pave-restore-reloads",String(J+1)),oe=!0}catch{oe=!1}if(oe){window.location.reload();return}}if(X){tn.current=!0,De(X);return}}tn.current&&Ct("Session expired. Please log in again."),De(null)}),()=>N_(null)),[]),y.useEffect(()=>{Xt&&!We&&pn.disconnect()},[We,Xt]),y.useEffect(()=>{if(!We)return;let L=!1;return CL().then(X=>{!L&&X&&X.currentVersion&&nt(X.currentVersion)}).catch(()=>{}),()=>{L=!0}},[We]),y.useEffect(()=>{GV(()=>qe.current)},[]);const on=y.useCallback(async()=>{try{await EM()}catch(L){console.error("Logout failed:",L);return}De(null),window.location.reload()},[]),[Dn,ie]=y.useState(null),[Le,Je]=y.useState(!1),[Ft,Fe]=y.useState([]),[it,ve]=y.useState([]),[Me,Ye]=y.useState({}),yt=y.useRef(Me);y.useEffect(()=>{yt.current=Me},[Me]);const se=y.useRef({}),[Pe,He]=y.useState(!0),[wt,Re]=y.useState(!1),Ke=y.useRef(!1),bt=y.useRef(null),bn=y.useRef(0);y.useEffect(function(){return function(){bn.current&&cancelAnimationFrame(bn.current)}},[]);const dr=y.useCallback(function(){bn.current&&cancelAnimationFrame(bn.current),bn.current=requestAnimationFrame(function(){bn.current=0,bt.current&&bt.current.scrollToBottom()})},[]),[Ot,hn]=y.useState([]),Br=y.useRef([]);Br.current=Ot;const[ye,tr]=y.useState(null);qe.current=ye,y.useEffect(()=>{te(ye)},[ye]),y.useEffect(()=>{ye&&KV(typeof document<"u"&&document.visibilityState==="visible",ye)},[ye]);const[jr,vi]=y.useState([]),ja=y.useCallback(function(L){L&&vi(function(X){return qB(X,L.text)?X.concat([{qid:BB(),text:vk(L.text),sourceMessageID:L.sourceMessageID||null,sourceRole:L.sourceRole==="user"?"user":"assistant",sourceTime:L.sourceTime||"",fromCode:L.fromCode===!0}]):X})},[]),Hn=y.useCallback(function(L){vi(function(X){return X.filter(function(J){return J.qid!==L})})},[]),Zs=y.useCallback(function(){vi([])},[]),{selection:fi,clearSelection:Tr}=qK({onQuoteAdd:ja}),oa=y.useCallback(function(){fi&&f5(fi.text)},[fi]);y.useEffect(function(){vi([])},[ye]);const je=y.useMemo(()=>ye&&Ot.find(L=>L.id===ye)||null,[ye,Ot]),[gt,Mt]=y.useState([]),[cn,Fn]=y.useState(0),[zn,Rr]=y.useState(!1),[Vi,Kn]=y.useState(null),[lr,Vr]=y.useState(!1),fr=y.useRef(!1),[yr,br]=y.useState(!1),[Gi,Ii]=y.useState({}),la=y.useRef(Gi);la.current=Gi;const[pi,vr]=y.useState({}),[zr,ei]=y.useState(null),[un,Wt]=y.useState(null),Ar=y.useRef(null);y.useEffect(function(){return function(){Ar.current&&clearTimeout(Ar.current),ne.current&&clearTimeout(ne.current)}},[]);const[Qn,xn]=y.useState(null),[Gr,Kr]=y.useState(null),[Ve,G]=y.useState(null),ne=y.useRef(null),me=y.useCallback((L,X)=>{if(L){const J=!X&&!!la.current[L];J&&L===Rt.current&&(Wt(null),Ar.current&&(clearTimeout(Ar.current),Ar.current=null)),Ii(oe=>{const pe={...oe},Te=!!oe[L];if(X?pe[L]=!0:delete pe[L],Te&&!X&&Yr.current&&Yr.current[L]&&!Ma.current.has(L)){const Ce=Yr.current[L];if(Ce.length>0){const _t=Ce.shift();L===Rt.current&&ws(Ce.length),Promise.resolve().then(()=>{try{L===Rt.current&&bt.current&&bt.current.resetAutoScroll(),jc.current&&jc.current(L,_t.content,_t.imageAttachments,_t.agent,_t.displayContent,_t.queuedTempId,_t.fileAttachments),L===Rt.current&&bt.current&&(bt.current.resetAutoScroll(),dr())}catch(Kt){console.error("[Queue] Drain dispatch failed:",Kt)}})}}return pe}),J&&(Ma.current.delete(L),Mh(L).then(oe=>{const pe=Array.isArray(oe&&oe.items)?oe.items:[];vr(Te=>{const Ce={...Te};if(pe.length===0)if(Ce[L])delete Ce[L];else return Te;else Ce[L]=pe;return Ce})}).catch(()=>{}))}L===Rt.current&&br(X)},[dr]),Ae=y.useCallback(L=>{const X={};Object.keys(L).forEach(oe=>{L[oe]&&L[oe].type==="busy"&&(X[oe]=!0)}),Ii(oe=>{const pe={...oe};return Object.keys(X).forEach(Te=>{pe[Te]=!0}),Object.keys(L).forEach(Te=>{L[Te]&&L[Te].type!=="busy"&&delete pe[Te]}),pe});const J=L[Rt.current];br(!!(J&&J.type==="busy"))},[]),[at,St]=y.useState({}),Dt=y.useRef(null),Nn=y.useRef(null),[Ir,ir]=y.useState({}),[Ta,ca]=y.useState({});y.useEffect(()=>{D==="map"&&ye&&Lh(ye).then(L=>{L&&Array.isArray(L.todos)&&ca(X=>({...X,[ye]:L.todos}))}).catch(()=>{})},[D,ye]);const[cr,hs]=y.useState({});y.useEffect(()=>{D==="tools"&&ye&&P_(ye).then(L=>{L&&hs(X=>({...X,[ye]:L}))}).catch(()=>{})},[D,ye]);const[Js,Qa]=y.useState(null),[eo,Mi]=y.useState(null),[to,Ct]=y.useState(null),[bp,Jo]=y.useState(!1),[el,ec]=y.useState(null),tc=50,[Ra,no]=y.useState(!1),[tl,nl]=y.useState(0),Aa=y.useRef(0),[rl,il]=y.useState(0),[ti,gs]=y.useState(()=>{try{return localStorage.getItem("pave-show-other-apps")!=="false"}catch{return!0}}),ro=y.useRef(ti),[io,vp]=y.useState(""),Xa=y.useRef(""),[nc,Ia]=y.useState(!0),[ms,al]=y.useState(!1),[sl,ol]=y.useState(""),[ao,Ki]=y.useState(0),[Li,ll]=y.useState(0),[xs,ys]=y.useState(!1),rc=y.useRef(null),ic=y.useRef(null),[Oi,Vu]=y.useState(!1),[ua,kp]=y.useState(""),[ac,sc]=y.useState(!1),[_p,wp]=y.useState(""),[Gu,Ku]=y.useState(!1),[cl,Yu]=y.useState(null),[Ep,ul]=y.useState(!1),[oc,Qu]=y.useState({}),so=y.useRef({}),[Za,Xu]=y.useState({}),dl=y.useRef({}),[Zu,Ju]=y.useState({}),lc=y.useRef({}),oo=y.useRef(new Set),Di=y.useRef(null);y.useEffect(()=>{so.current=oc},[oc]),y.useEffect(()=>{dl.current=Za},[Za]),y.useEffect(()=>{if(!ye)return;const L=Ot.find(X=>X.id===ye);L&&(L.moe_top_k!=null&&so.current[ye]===void 0&&Qu(X=>X[ye]===void 0?{...X,[ye]:L.moe_top_k}:X),L.reasoning_effort&&dl.current[ye]===void 0&&Xu(X=>X[ye]===void 0?{...X,[ye]:L.reasoning_effort}:X))},[ye,Ot]);const ed=oc[ye]??null,Sp=Za[ye]??"max",td=Zu[ye]??null,bs=y.useCallback((L,X)=>{Yu({text:L,type:X||"info"}),Di.current&&clearTimeout(Di.current),Di.current=setTimeout(()=>{Yu(null),Di.current=null},3e3)},[]);function fl(L,X){return(Array.isArray(L==null?void 0:L.settings)?L.settings:[]).find(oe=>oe&&oe.key===X)||null}y.useEffect(()=>{const L=()=>{tv().then(X=>{const J=fl(X,"PAVE_WHATSAPP_CHAT_ID"),oe=J&&J.value||"";kp(oe)}).catch(X=>{console.error("[WhatsApp] Failed to load default chatId from settings:",X.message)})};return L(),window.addEventListener("pave:settings-updated",L),()=>window.removeEventListener("pave:settings-updated",L)},[]);const[da,lo]=y.useState(!1),[cc,pl]=y.useState(!1),[uc,nd]=y.useState(!1),[co,dc]=y.useState(!1),[wn,rd]=y.useState("default"),uo=wn==="oryzo",[kr,Np]=y.useState(!1);y.useEffect(()=>{const L=()=>{tv().then(X=>{const J=Ce=>{const _t=fl(X,Ce),Kt=String(_t&&_t.value||"").toLowerCase();return Kt==="true"||Kt==="1"};lo(J("PAVE_EXPERIMENTAL_WHATSAPP")),pl(J("PAVE_EXPERIMENTAL_SESSION_BANNER")),nd(J("PAVE_EXPERIMENTAL_AGENT_BOARD")),dc(J("PAVE_CAPABILITIES_EXPERIMENTAL"));const oe=fl(X,"PAVE_EXPERIMENTAL_THEME"),pe=oe&&String(oe.value||"").toLowerCase(),Te=NK(pe,J("PAVE_EXPERIMENTAL_ORYZO_THEME"));rd(Te),Np(!0)}).catch(X=>{console.error("[Experimental] Failed to load feature flags:",X.message)})};return L(),window.addEventListener("pave:settings-updated",L),()=>window.removeEventListener("pave:settings-updated",L)},[de]),y.useEffect(()=>{!uc&&de==="board"&&_e("chat"),!co&&de==="capabilities"&&_e("chat")},[uc,co,de]),y.useEffect(()=>{!uo&&r&&a(!1)},[uo,r,a]),y.useEffect(()=>{wn!=="apple"&&o&&l(!1)},[wn,o,l]),y.useEffect(()=>{wn!=="flip7"&&u&&d(!1)},[wn,u,d]),y.useEffect(()=>{wn!=="questui"&&f&&p(!1)},[wn,f,p]),y.useEffect(()=>{wn!=="skylearn"&&g&&m(!1)},[wn,g,m]),y.useEffect(()=>{wn!=="editorial"&&x&&v(!1)},[wn,x,v]),y.useEffect(()=>{wn!=="blok"&&k&&_(!1)},[wn,k,_]),y.useEffect(()=>{wn!=="signal"&&E&&S(!1)},[wn,E,S]),y.useEffect(()=>{wn!=="lens"&&N&&A(!1)},[wn,N,A]);const id=y.useRef(!1);y.useEffect(()=>{kr&&uo&&!id.current&&(id.current=!0,a(!0))},[kr,uo]);const ad=y.useRef(!1);y.useEffect(()=>{kr&&wn==="apple"&&!ad.current&&(ad.current=!0,l(!0))},[kr,wn,l]);const sd=y.useRef(!1);y.useEffect(()=>{kr&&wn==="flip7"&&!sd.current&&(sd.current=!0,d(!0))},[kr,wn,d]);const ki=y.useRef(!1);y.useEffect(()=>{kr&&wn==="questui"&&!ki.current&&(ki.current=!0,p(!0))},[kr,wn,p]);const vs=y.useRef(!1);y.useEffect(()=>{kr&&wn==="skylearn"&&!vs.current&&(vs.current=!0,m(!0))},[kr,wn,m]);const fc=y.useRef(!1);y.useEffect(()=>{kr&&wn==="editorial"&&!fc.current&&(fc.current=!0,v(!0))},[kr,wn,v]);const pc=y.useRef(!1);y.useEffect(()=>{kr&&wn==="blok"&&!pc.current&&(pc.current=!0,_(!0))},[kr,wn,_]);const hc=y.useRef(!1);y.useEffect(()=>{kr&&wn==="signal"&&!hc.current&&(hc.current=!0,S(!0))},[kr,wn,S]);const gc=y.useRef(!1);y.useEffect(()=>{kr&&wn==="lens"&&!gc.current&&(gc.current=!0,A(!0))},[kr,wn,A]),y.useEffect(()=>{const L=()=>{I_().then(X=>{pt(!!(X&&X.inspector))}).catch(X=>{console.error("[Inspector] Failed to fetch config:",X.message)})};return window.addEventListener("pave:settings-updated",L),()=>window.removeEventListener("pave:settings-updated",L)},[]);const ks=y.useRef(Oi),Cp=y.useRef(ua);y.useEffect(()=>{ks.current=Oi,Cp.current=ua},[Oi,ua]);const mc=y.useRef({});y.useEffect(()=>{da&&mL({enabled:Oi,sessionId:ye,chatId:ua}).catch(L=>{console.error("[WhatsApp routing] Failed to update:",L.message)})},[da,Oi,ye,ua]),y.useEffect(()=>{!da&&Oi&&Vu(!1)},[da,Oi]),y.useEffect(()=>{xs&&rc.current&&rc.current.focus()},[xs]),y.useEffect(()=>{const L=window.matchMedia("(min-width: 1024px)"),X=J=>{J.matches&&ys(!1)};return L.addEventListener("change",X),()=>L.removeEventListener("change",X)},[]);function Ja(){const L=Ta[ye]||[],X=[];for(const Ce of gt||[])for(const _t of Ce.parts||[]){if(_t.type!=="tool")continue;const Kt=_t.state&&_t.state.output;if(!Kt)continue;let kn=Kt;if(typeof Kt=="string")try{kn=JSON.parse(Kt)}catch{continue}kn&&kn.canvas&&kn.canvas.type&&kn.canvas.source&&X.push(kn.canvas)}const J=ye?`pave-canvas-cleared:${ye}`:null;let oe=new Set;if(J&&typeof window<"u")try{const Ce=localStorage.getItem(J);Ce&&(oe=new Set(JSON.parse(Ce)))}catch{}const pe=X.filter(Ce=>!oe.has(Ce.type+":"+Ce.source)),Te=()=>{if(!J||typeof window>"u")return;const Ce=X.map(_t=>_t.type+":"+_t.source);try{localStorage.setItem(J,JSON.stringify(Ce))}catch{}$(_t=>_t+1)};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:T?i.jsxs(i.Fragment,{children:[i.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:[i.jsx("button",{type:"button",onClick:()=>F("map"),className:`px-2 py-0.5 rounded ${D==="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"}),i.jsx("button",{type:"button",onClick:()=>F("tools"),className:`px-2 py-0.5 rounded ${D==="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"}),i.jsxs("button",{type:"button",onClick:()=>F("canvas"),className:`px-2 py-0.5 rounded relative ${D==="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",pe.length>0?i.jsxs("span",{className:"ml-1 opacity-70",children:["(",pe.length,")"]}):null]}),i.jsx("button",{type:"button",onClick:()=>F("terminal"),className:`px-2 py-0.5 rounded ${D==="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"})]}),i.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:D==="map"?i.jsx(_$,{todos:L,darkMode:t}):D==="tools"?i.jsx(M$,{graph:cr[ye]||null,darkMode:t}):D==="canvas"?i.jsx(cT,{canvases:pe,onClear:pe.length?Te:null}):i.jsx(eq,{toolParts:qr,matrixMode:C,onToggleMatrix:()=>O(Ce=>!Ce),darkMode:t})})]}):pe.length>0?i.jsx(cT,{canvases:pe,onClear:pe.length?Te:null}):i.jsx(Kz,{toolParts:Pa})}),i.jsx(DW,{messages:gt,isBusy:yr,isCompacting:zr!=null,activeModel:Dn,sessionModel:Me[ye]||null,isPrivateMode:ut.has(ye),registryEntries:it})]})}y.useEffect(()=>{al(!1),ol(""),Ki(0),ll(0),ys(!1)},[ye]),y.useEffect(()=>{if(!ye)return;let L=!1;return pL(ye).then(X=>{if(L||!X)return;const J=ye;X.privateMode&&$e(oe=>{if(oe.has(J))return oe;const pe=new Set(oe);return pe.add(J),pe}),Array.isArray(X.messageIds)&&X.messageIds.length&&mt(oe=>{let pe=!1;const Te=new Set(oe);for(const Ce of X.messageIds)Te.has(Ce)||(Te.add(Ce),pe=!0);return pe?Te:oe})}).catch(()=>{}),()=>{L=!0}},[ye]),y.useEffect(()=>{if(!ye){ul(!1);return}let L=!1;return n4(ye).then(X=>{if(L)return;const J=X&&X.config?X.config:{};ul(!!J.enabled)}).catch(()=>{}),()=>{L=!0}},[ye]),y.useEffect(()=>{if(!ye){Je(!1);return}const L=yt.current[ye]||Dn;if(!L){Je(!1);return}let X=!1;return sL(L).then(J=>{X||Je(!!(J&&J.adaptiveQuality))}).catch(()=>{X||Je(!1)}),()=>{X=!0}},[ye,Dn,Me]),y.useEffect(()=>{Li>0&&ao>=Li?Ki(Li-1):Li===0&&ao!==0&&Ki(0)},[Li,ao]);const Rt=y.useRef(ye);y.useEffect(()=>{Rt.current=ye;const L=Yr.current[ye];ws(L?L.length:0)},[ye]),y.useEffect(()=>{if(!ye)return;let L=!1;return Mh(ye).then(X=>{if(L)return;const J=Array.isArray(X&&X.items)?X.items:[],oe=ye;vr(pe=>{const Te={...pe};if(J.length===0)if(Te[oe])delete Te[oe];else return pe;else Te[oe]=J;return Te})}).catch(X=>{console.warn("[queue] hydrate failed for",ye,X&&X.message)}),()=>{L=!0}},[ye]);const _s=y.useRef(D);y.useEffect(()=>{_s.current=D},[D]);const Yr=y.useRef({}),[od,ws]=y.useState(0),Ma=y.useRef(new Set),La=y.useCallback(L=>{if(L===Rt.current){const X=Yr.current[L];ws(X?X.length:0)}},[]),ld=y.useCallback(L=>{if(!L)return;const X=Rt.current;if(!X)return;const J=Yr.current[X];Array.isArray(J)&&J.length>0&&(Yr.current[X]=J.filter(oe=>oe.queuedTempId!==L)),Mt(oe=>oe.filter(pe=>pe.info.id!==L)),La(X)},[La]),Pi=!Xt||!!We;y.useEffect(()=>{!At&&Pi&&(_i(),Yi(),O_().then(L=>{Ae(L)}).catch(L=>{console.error("Failed to fetch session status:",L)}))},[At,Pi]),y.useEffect(()=>{!At&&Pi&&(I_().then(L=>{L&&L.model&&ie(L.model),pt(!!(L&&L.inspector))}).catch(L=>{console.error("Failed to fetch config:",L)}),_M().then(L=>{L&&Array.isArray(L.providers)&&Fe(L.providers)}).catch(L=>{console.error("Failed to fetch providers:",L)}),Jb().then(L=>{L&&Array.isArray(L.entries)&&ve(L.entries)}).catch(L=>{console.error("Failed to fetch model registry:",L)}),ev().then(L=>{L&&L.home&&wp(L.home)}).catch(L=>{console.error("Failed to fetch path info:",L)}))},[At,Pi]);const hl=y.useCallback(()=>{SM().then(L=>{const X=Array.isArray(L&&L.pending)?L.pending:[];qt(X)}).catch(L=>{console.error("Failed to fetch pending permissions:",L)})},[]);y.useEffect(()=>{!At&&Pi&&hl()},[At,Pi,hl]),y.useEffect(()=>{const J=setInterval(()=>{qt(oe=>{const pe=Date.now(),Te=oe.filter(Ce=>pe-(Ce.timestamp||0)<3e5);return Te.length===oe.length?oe:Te})},3e4);return()=>clearInterval(J)},[]);const _i=y.useCallback(async L=>{try{const X=L&&L.includeArchived||Ke.current,J=Aa.current||0,oe=Math.max(tc,J),pe=L&&typeof L.q=="string"?L.q:Xa.current,Te=!!(pe&&pe.trim()),Ce=Date.now(),_t=await Pl({limit:oe,offset:0,includeArchived:Te?!0:X,includeOtherApps:!1,q:pe});if(_t&&_t.sessions){const Kt=Array.isArray(_t.sessions)?_t.sessions:[];hn(S_({fetched:Kt,current:Br.current,prependsSince:Ce})),no(!!_t.hasMore),il(typeof _t.total=="number"?_t.total:Kt.length),nl(Kt.length),Aa.current=Kt.length}else{const Kt=Array.isArray(_t)?_t:[];hn(S_({fetched:Kt,current:Br.current,prependsSince:Ce})),no(!1),il(Kt.length),nl(Kt.length),Aa.current=Kt.length}}catch(X){return console.error("Failed to load sessions:",X),!1}return!0},[]);function fo(L,X){var J=X&&X.time&&X.time.updated||0,oe=L&&L.time&&L.time.updated||0;return J-oe}const po=200,ho=y.useRef(po),[cd,fa]=y.useState(!1),[Es,Oa]=y.useState([]),jp=200,[xc,pa]=y.useState([]),Tp=y.useMemo(()=>{if(!(Es.length||xc.length))return Ot;const X=Object.create(null),J=[],oe=Ot.concat(Es,xc);for(let pe=0;pe<oe.length;pe++){const Te=oe[pe];!Te||!Te.id||X[Te.id]||(X[Te.id]=!0,J.push(Te))}return J.sort(fo)},[Ot,Es,xc]),gl=y.useCallback(async()=>{const L=Xa.current,X=!!(L&&L.trim());if(!Ke.current&&!X){pa([]);return}try{const J=await Pl({limit:jp,offset:0,onlyArchived:!0,q:L}),oe=J&&J.sessions?Array.isArray(J.sessions)?J.sessions:[]:Array.isArray(J)?J:[];pa(oe)}catch(J){console.error("Failed to load archived sessions:",J)}},[]),Yi=y.useCallback(async()=>{const L=Xa.current,X=!!(L&&L.trim());if(!ro.current&&!X){Oa([]);return}try{const J=await Pl({limit:ho.current,offset:0,onlyOtherApps:!0,includeArchived:X?!0:Ke.current,q:L}),oe=J&&J.sessions?Array.isArray(J.sessions)?J.sessions:[]:Array.isArray(J)?J:[];Oa(oe),fa(!!(J&&J.hasMore))}catch(J){console.warn("Failed to load other-app sessions:",J),Oa([]),fa(!1)}},[]),$n=y.useCallback(async()=>{ho.current+=po,await Yi()},[Yi]);y.useEffect(()=>{function L(){ye&&uM(ye).then(function(X){X&&X.sessionID&&(Rt.current=X.sessionID,tr(X.sessionID),_i())}).catch(function(X){console.error("Failed to create archive session:",X);const J=(()=>{if(!X)return!1;if(X.status===404||X.response&&X.response.status===404)return!0;if(typeof X.message=="string"){const oe=X.message.match(/^(\d{3})\s*:/);if(oe&&parseInt(oe[1],10)===404)return!0}return!1})();Ct(e(J?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",L),()=>document.removeEventListener("navigateToArchiveSession",L)},[ye,_i,e,Ct]);const yc=async()=>{try{const L=Xa.current,X=!!(L&&L.trim()),J=await Pl({limit:tc,offset:tl,includeArchived:X?!0:Ke.current,includeOtherApps:!1,q:L});if(J&&J.sessions){const oe=Array.isArray(J.sessions)?J.sessions:[];hn(pe=>{for(var Te={},Ce=0;Ce<pe.length;Ce++)Te[pe[Ce].id]=!0;for(var _t=[],Kt=0;Kt<oe.length;Kt++)Te[oe[Kt].id]||_t.push(oe[Kt]);return pe.concat(_t)}),no(!!J.hasMore),typeof J.total=="number"&&il(J.total),nl(pe=>{var Te=pe+oe.length;return Aa.current=Te,Te})}}catch(L){console.error("Failed to load more sessions:",L)}},ni=async(L,X)=>{try{const J=(X?X.fresh!==!1:!0)&&!fr.current,oe=await T_(L,J,J?{limit:GT}:void 0),pe=oe&&!Array.isArray(oe)&&Array.isArray(oe.messages),Te=pe?oe.messages:oe,Ce=pe&&typeof oe.compactedOutCount=="number"?oe.compactedOutCount:0;return Rt.current!==L?null:Array.isArray(Te)?(Fn(J?Ce:0),J&&pe?(Rr(oe.hasMore===!0),Kn(typeof oe.nextCursor=="string"?oe.nextCursor:null)):(Rr(!1),Kn(null)),Mt(_t=>{const Kt=Te.some(Se=>Se.info.mode==="compaction"),kn=Array.isArray(_t)&&_t.some(Se=>Se.info&&Se.info.mode==="compaction");if(Kt&&!kn)return Te;const Cn=new Set(Te.map(Se=>Se.info.id)),_n=Te.reduce(function(Se,Be){return Be&&Be.info&&Be.info.mode==="compaction"&&Be.info.time&&typeof Be.info.time.created=="number"?Math.max(Se,Be.info.time.created):Se},-1/0),be=_t.filter(Se=>Se.info.sessionID===L&&!Cn.has(Se.info.id)&&!String(Se.info.id).startsWith("temp-")&&!(_n!==-1/0&&Se.info.time&&typeof Se.info.time.created=="number"&&Se.info.time.created<_n));if(be.length===0)return Te;const Q=[];let ce=0,ke=0;for(;ce<Te.length||ke<be.length;){const Se=Te[ce],Be=be[ke],xt=Se&&Se.info.time&&typeof Se.info.time.created=="number"?Se.info.time.created:1/0,Ut=Be&&Be.info.time&&typeof Be.info.time.created=="number"?Be.info.time.created:1/0;ce<Te.length&&(ke>=be.length||xt<=Ut)?(Q.push(Se),ce++):(Q.push(Be),ke++)}return Q}),Te):(Mt([]),null)}catch(J){return console.error("Failed to load messages:",J),Rt.current===L&&($K(J)?(Rt.current=null,tr(null),hn(oe=>Yb(oe,L)),Oa(oe=>Yb(oe,L)),pa(oe=>Yb(oe,L))):Ct(WK(J))),null}},go=y.useCallback(async L=>Rt.current!==L?null:(fr.current=!0,ni(L,{fresh:!1})),[ni]),ud=async L=>{if(lr||!zn||!Vi||fr.current||Rt.current!==L)return null;Vr(!0);try{const X=await T_(L,!0,{limit:GT,before:Vi});if(Rt.current!==L)return null;if(!X||Array.isArray(X)||!Array.isArray(X.messages))throw new Error("Invalid paged message response");return Fn(typeof X.compactedOutCount=="number"?X.compactedOutCount:0),Rr(X.hasMore===!0),Kn(typeof X.nextCursor=="string"?X.nextCursor:null),Mt(J=>{const oe=new Map;for(const pe of X.messages.concat(J))pe&&pe.info&&pe.info.id&&oe.set(pe.info.id,pe);return Array.from(oe.values()).sort((pe,Te)=>{const Ce=pe.info.time.created-Te.info.time.created;return Ce!==0?Ce:pe.info.id<Te.info.id?-1:pe.info.id>Te.info.id?1:0})}),X.messages}catch(X){return Rt.current===L&&Ct("Failed to load earlier messages: "+(X&&X.message?X.message:String(X))),null}finally{Rt.current===L&&Vr(!1)}};y.useEffect(()=>{if(!ye){Mt([]),Fn(0),Rr(!1),Kn(null),Vr(!1),fr.current=!1,St({}),Mi(null),Ia(!0);return}Mt([]),Fn(0),Rr(!1),Kn(null),Vr(!1),fr.current=!1,Mi(null),Ia(!1),Qa(null),ye&&(D_(ye).then(be=>{be&&Array.isArray(be.banners)&&ir(Q=>({...Q,[ye]:be.banners}))}).catch(()=>{}),Lh(ye).then(be=>{be&&Array.isArray(be.todos)&&ca(Q=>({...Q,[ye]:be.todos}))}).catch(()=>{})),pn.connect(ye);let L=!1,X=!1,J=!1,oe=!1;const pe=ye,Te=be=>{if(Rt.current!==pe)return;const Q=new Map;if(Array.isArray(be))for(const ce of be){if(!ce||!ce.info||!ce.info.id||!Array.isArray(ce.parts))continue;const ke=new Set;for(const Se of ce.parts)Se&&(Se.type==="text"||Se.type==="reasoning")&&ke.add(Se.type);ke.size>0&&Q.set(ce.info.id,ke)}St(ce=>{const ke=ce[pe];if(!ke||Object.keys(ke).length===0)return ce;const Se={};let Be=!1;for(const xt of Object.keys(ke)){const Ut=ke[xt],Bt={};let gn=!1;const Wn=Q.get(xt);for(const Xn of Object.keys(Ut)){const hr=Ut[Xn];if(hr._fromSnapshot){Bt[Xn]=hr,gn=!0;continue}const jn=hr.type;if(Wn&&Wn.has(jn)){Be=!0;continue}Bt[Xn]=Ut[Xn],gn=!0}gn?Se[xt]=Bt:Be=!0}if(!Be)return ce;if(Object.keys(Se).length===0){const xt={...ce};return delete xt[pe],xt}return{...ce,[pe]:Se}})},Ce=setTimeout(()=>{!L&&!X&&(X=!0,ni(pe).then(be=>{J=!0,Te(be),oe&&Rt.current===pe&&ni(pe).then(Q=>{Te(Q)})}))},3e3),_t=80;function Kt(){Nn.current!=null&&(clearTimeout(Nn.current),Nn.current=null);const be=Dt.current;be&&(Dt.current=null,St(Q=>{let ce=Q;for(const ke of Object.keys(be)){const Se=be[ke],Be={...ce[ke]||{}};for(const xt of Object.keys(Se)){const Ut=Se[xt],Bt={...Be[xt]||{}};for(const gn of Object.keys(Ut)){const Wn=Ut[gn],Xn=Bt[gn];Wn.type==="text"||Wn.type==="reasoning"?Bt[gn]={...Wn,text:((Xn==null?void 0:Xn.text)||"")+(Wn.delta||"")}:Bt[gn]={...Xn,...Wn}}Be[xt]=Bt}ce={...ce,[ke]:Be}}return ce}))}function kn(){Nn.current==null&&(Nn.current=setTimeout(Kt,_t))}function Cn(be,Q,ce){Dt.current||(Dt.current={});const ke=Dt.current;ke[Q]||(ke[Q]={});const Se=ke[Q];Se[ce]||(Se[ce]={});const Be=Se[ce],xt=Be[be.id];be.type==="text"||be.type==="reasoning"?Be[be.id]={...be,delta:(xt&&xt.delta||"")+(be.delta||"")}:Be[be.id]={...xt,...be}}const _n=[pn.on("connected",()=>{L=!0,clearTimeout(Ce),Ia(!0),hl(),O_().then(be=>{Ae(be)}).catch(()=>{}),Mh(pe).then(be=>{const Q=Array.isArray(be&&be.items)?be.items:[];vr(ce=>{const ke={...ce};if(Q.length===0)if(ke[pe])delete ke[pe];else return ce;else ke[pe]=Q;return ke})}).catch(()=>{}),ni(pe).then(be=>{J=!0,Te(be),oe&&Rt.current===pe&&ni(pe).then(Q=>{Te(Q)})})}),pn.on("error",()=>{Ia(!1),!L&&!X&&(clearTimeout(Ce),X=!0,ni(pe).then(be=>{J=!0,Te(be),oe&&Rt.current===pe&&ni(pe).then(Q=>{Te(Q)})}))}),pn.on("session.status",be=>{var ke;const Q=be.properties||be,ce=((ke=Q.status)==null?void 0:ke.type)==="busy";me(Q.sessionID,ce)}),pn.on("message.part.delta",be=>{const Q=(be.properties||be).part;if(!Q||!Q.sessionID)return;Ie.current.has(Q.sessionID)&&Ie.current.delete(Q.sessionID);const{sessionID:ce,messageID:ke}=Q;if(Cn(Q,ce,ke),kn(),Q.type==="text"&&Q.delta){const Se=mc.current;Se[ce]||(Se[ce]={}),Se[ce][ke]=(Se[ce][ke]||"")+Q.delta,ks.current&&console.log("[WhatsApp] Accumulating text delta:",Q.delta.length,"chars, total:",Se[ce][ke].length)}}),pn.on("streaming.snapshot",be=>{const Q=be.properties||be,ce=Q.sessionID,ke=Q.parts;!ce||!Array.isArray(ke)||St(Se=>{const Be={...Se[ce]||{}};for(const xt of ke){const Ut={...Be[xt.messageID]||{}};Ut[xt.id]={id:xt.id,type:xt.type,text:xt.text,sessionID:ce,messageID:xt.messageID,_fromSnapshot:!0},Be[xt.messageID]=Ut}return{...Se,[ce]:Be}})}),pn.on("message.progress",be=>{const Q=be.properties||be;Q.sessionID===Rt.current&&Mi({chunks:Q.chunks||0,textLength:Q.textLength||0,toolCalls:Q.toolCalls||0,toolArgBytes:Q.toolArgBytes||0,toolNames:Q.toolNames||[]})}),pn.on("message.part.updated",be=>{const Q=(be.properties||be).part;if(Q){if(Kt(),Q.type==="text"||Q.type==="reasoning"){const ce=Q.sessionID;St(ke=>{const Se=ke[ce];if(!Se)return ke;const Be=Se[Q.messageID];if(!Be)return ke;const xt={};var Ut=!1;for(const Bt of Object.keys(Be))Be[Bt].type!==Q.type&&(xt[Bt]=Be[Bt],Ut=!0);if(!Ut){const Bt={...Se};if(delete Bt[Q.messageID],Object.keys(Bt).length===0){const gn={...ke};return delete gn[ce],gn}return{...ke,[ce]:Bt}}return{...ke,[ce]:{...Se,[Q.messageID]:xt}}})}if(Q.sessionID===Rt.current){if(!J){Q.sessionID===pe&&(oe=!0);return}(Q.type==="tool"||Q.type==="tool-use")&&_s.current==="tools"&&P_(Q.sessionID).then(ce=>{ce&&hs(ke=>({...ke,[Q.sessionID]:ce}))}).catch(()=>{}),Mt(ce=>ce.map(ke=>{if(ke.info.id!==Q.messageID)return ke;const Se=ke.parts.findIndex(Ut=>Ut.id===Q.id);if(Se>=0)return{...ke,parts:ke.parts.map((Ut,Bt)=>Bt===Se?Q:Ut)};const Be=ke.parts.slice();let xt=Be.length;for(let Ut=Be.length-1;Ut>=0;Ut--){if(Be[Ut].id<=Q.id){xt=Ut+1;break}Ut===0&&(xt=0)}return Be.splice(xt,0,Q),{...ke,parts:Be}}))}}}),pn.on("message.updated",be=>{const Q=(be.properties||be).info;if(!(!Q||Q.sessionID!==Rt.current)){if(Kt(),!J){Q.sessionID===pe&&(oe=!0);return}if(Mt(ce=>{const ke=ce.findIndex(Bt=>Bt.info.id===Q.id);if(ke>=0)return ce.map((Bt,gn)=>gn===ke?{...Bt,info:Q}:Bt);if(Q.role==="user"){const Bt=ce.findIndex(gn=>gn.info.id&&gn.info.id.startsWith("temp-")&&gn.info.role==="user");if(Bt>=0)return ce.map((gn,Wn)=>Wn===Bt?{info:Q,parts:[]}:gn)}const Se={info:Q,parts:[]};if(!Q.time||typeof Q.time.created!="number")return[...ce,Se];const Be=Q.time.created;let xt=ce.length;for(let Bt=ce.length-1;Bt>=0;Bt--){const gn=ce[Bt].info.time;if(gn&&typeof gn.created=="number"&&gn.created<=Be){xt=Bt+1;break}Bt===0&&(xt=0)}const Ut=ce.slice();return Ut.splice(xt,0,Se),Ut}),Q.compactedOut!==!0&&Q.finish){const ce=Q.sessionID;if(Q.role==="assistant"&&ks.current&&ce===Rt.current){const ke=mc.current[ce];ke&&ke[Q.id]&&(delete ke[Q.id],Object.keys(ke).length===0&&delete mc.current[ce]),xL(ce).then(Se=>{if(Se&&Se.message)return console.log(`[WhatsApp] Processing queued message (${Se.remaining} remaining)`),Yd(ce,Se.message.text,null,yt.current[ce]||void 0)}).catch(Se=>{console.error("[WhatsApp] Failed to process queue:",Se)})}St(ke=>{const Se=ke[ce];if(!Se||!Se[Q.id])return ke;const Be={...Se};if(delete Be[Q.id],Object.keys(Be).length===0){const xt={...ke};return delete xt[ce],xt}return{...ke,[ce]:Be}}),Mi(null),Q.finish!=="compacted"&&me(ce,!1),ni(Rt.current)}}}),pn.on("message.deleted",be=>{const Q=be.properties||be,ce=Q.sessionID,ke=Q.messageID;!ce||!ke||ce===Rt.current&&(Mt(Se=>Se.filter(Be=>Be.info.id!==ke)),St(Se=>{if(!Se[ce])return Se;const Be=Se[ce];if(!Be[ke])return Se;const xt={...Se},Ut={...Be};return delete Ut[ke],xt[ce]=Ut,xt}))}),pn.on("session.updated",be=>{const Q=be.properties||be,ce=Q.info||Q,ke=ce&&(ce.id||ce.sessionID)||Q.sessionID||Q.id;if(!ke){_i(),Yi();return}const Se=ce&&ce.time&&typeof ce.time.updated=="number",Be=xt=>{const Bt=!Br.current.some(Wn=>Wn&&Wn.id===ke)&&Kb(xt),gn=Bt?{...xt,prependedAt:Date.now()}:xt;Bt&&(Br.current=[gn].concat(Br.current)),hn(Wn=>{var Xn=!1,hr=Wn.map(jn=>jn.id===ke?(Xn=!0,{...xt,ui:{...xt.ui,...jn.ui}}):jn);return!Xn&&Kb(xt)&&(hr=[gn].concat(hr)),hr.sort(fo),hr}),pa(Wn=>{var Xn=!1,hr=Wn.map(jn=>jn.id!==ke?jn:(Xn=!0,{...xt,ui:{...xt.ui,...jn.ui}}));return Xn?(hr=hr.filter(jn=>jn.archived),hr.sort(fo),hr):Wn}),Kb(xt)||Oa(Wn=>{var Xn=!1,hr=Wn.map(jn=>jn.id!==ke?jn:(Xn=!0,{...xt,ui:{...xt.ui,...jn.ui}}));return Xn?(hr.sort(fo),hr):Wn})};Se?(Be(ce),Ye(xt=>{let Ut=xt;const Bt=ce.model;return typeof Bt=="string"&&Bt||Bt&&typeof Bt=="object"&&Bt.providerID&&Bt.modelID?Ut={...xt,[ke]:Bt}:xt[ke]&&(Ut={...xt},delete Ut[ke]),yt.current=Ut,Ut})):Ih(ke).then(xt=>{Be(xt),Ye(Ut=>{let Bt=Ut;const gn=xt&&xt.model;return typeof gn=="string"&&gn||gn&&typeof gn=="object"&&gn.providerID&&gn.modelID?Bt={...Ut,[ke]:gn}:Ut[ke]&&(Bt={...Ut},delete Bt[ke]),yt.current=Bt,Bt})}).catch(xt=>{console.error("Failed to fetch updated session, falling back to full reload:",xt),_i()})}),pn.on("session.deleted",be=>{const Q=be.properties||be,ce=Q.info||Q,ke=ce&&(ce.id||ce.sessionID)||Q.sessionID||Q.id;ke&&(hn(Se=>Se.filter(Be=>Be.id!==ke)),Oa(Se=>Se.filter(Be=>Be.id!==ke)),pa(Se=>Se.filter(Be=>Be.id!==ke)),tr(Se=>Se===ke?null:Se))}),pn.on("permission.request",be=>{const Q=be.properties||be;Q.requestId&&qt(ce=>ce.some(ke=>ke.id===Q.requestId)?ce:[...ce,{id:Q.requestId,action:Q.action,type:Q.type,target:Q.target,reason:Q.reason,description:Q.description,timestamp:Date.now()}])}),pn.on("permission.confirmed",be=>{const Q=be.properties||be;Q.requestId&&qt(ce=>ce.filter(ke=>ke.id!==Q.requestId))}),pn.on("permission.denied",be=>{const Q=be.properties||be;Q.requestId&&qt(ce=>ce.filter(ke=>ke.id!==Q.requestId))}),pn.on("question.asked",be=>{const Q=be.properties||be;if(!Q.id)return;const ce=Q.tool&&Q.tool.callID?Q.tool.callID:null;if(ce&&$t(ke=>({...ke,[ce]:Q.id})),qk()){const ke=Q.questions&&Q.questions[0],Se=ke?ke.text:"A question needs your input.",Be=Q.sessionID||null;BV({title:"PAVE — Question",body:Se.length>200?Se.slice(0,200)+"…":Se,tag:"pave-question-"+Q.id,onClick:Be?function(){Qr(Be),window.focus()}:function(){window.focus()}})}}),pn.on("question.replied",be=>{const Q=be.properties||be;Q.requestId&&$t(ce=>{var ke={};for(var Se in ce)ce[Se]!==Q.requestId&&(ke[Se]=ce[Se]);return ke})}),pn.on("question.rejected",be=>{const Q=be.properties||be;Q.requestId&&$t(ce=>{var ke={};for(var Se in ce)ce[Se]!==Q.requestId&&(ke[Se]=ce[Se]);return ke})}),pn.on("quality.hint",be=>{const Q=be.properties||be;if(!Q.preset)return;const ce=Q.sessionID;ce&&(Ju(ke=>({...ke,[ce]:Q})),lc.current[ce]=Q)}),pn.on("dlp.cancelled",be=>{const ce=(be.properties||be).sessionID;if(!ce)return;const ke=Ie.current.get(ce);ke&&(ke.tempId&&Mt(Se=>Se.filter(Be=>Be.info.id!==ke.tempId)),ce===Rt.current&&xe.current&&typeof xe.current.setText=="function"&&xe.current.setText(ke.text||""),Ie.current.delete(ce)),me(ce,!1)}),pn.on("dlp.private_message",be=>{const Q=be.properties||be,ce=Q.sessionID,ke=Q.messageID;!ce||!ke||(mt(Se=>{if(Se.has(ke))return Se;const Be=new Set(Se);return Be.add(ke),Be}),$e(Se=>{if(Se.has(ce))return Se;const Be=new Set(Se);return Be.add(ce),Be}))}),pn.on("dlp.exited_private",be=>{const ce=(be.properties||be).sessionID;ce&&$e(ke=>{if(!ke.has(ce))return ke;const Se=new Set(ke);return Se.delete(ce),Se})}),pn.on("session.error",be=>{const Q=be.properties||be;if(Q.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",Q.source||""),Ct("Session expired. Please log in again."),De(null),Q.sessionID&&me(Q.sessionID,!1);return}Q.sessionID&&me(Q.sessionID,!1),Q.sessionID===Rt.current&&(Q.code==="insufficient_credits"?(Ct(null),ec(Q.upgradeUrl||null),Jo(!0)):Ct(Q.error||"An error occurred"))}),pn.on("session.retry",be=>{const Q=be.properties||be;Q.reason==="rate_limit"&&Q.sessionID===Rt.current&&(Wt({attempt:Q.attempt,maxRetries:Q.maxRetries,delayMs:Q.delayMs,elapsedMs:Q.elapsedMs||0,maxDurationMs:Q.maxDurationMs||0}),Ar.current&&clearTimeout(Ar.current),Ar.current=setTimeout(()=>Wt(null),1e4))}),pn.on("session.compacting",be=>{const Q=be.properties||be;Q.sessionID===Rt.current&&ei(ce=>({...ce,currentTokens:Q.currentTokens??(ce==null?void 0:ce.currentTokens),threshold:Q.threshold??(ce==null?void 0:ce.threshold),reason:Q.reason??(ce==null?void 0:ce.reason),stage:Q.stage??(ce==null?void 0:ce.stage),elapsedMs:Q.elapsedMs??(ce==null?void 0:ce.elapsedMs),messageCount:Q.messageCount??(ce==null?void 0:ce.messageCount),chunks:Q.chunks??(ce==null?void 0:ce.chunks),textLength:Q.textLength??(ce==null?void 0:ce.textLength)}))}),pn.on("session.compacted",be=>{const Q=be.properties||be,ce=Rt.current;if(Q.sessionID===ce){if(ei(null),xn(null),Q.newSessionID&&Q.newSessionID!==ce&&!Q.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${ce} → ${Q.newSessionID}`),Q.newSession){Ss(Q.newSession);const Be=Q.newSession.model;(typeof Be=="string"&&Be||Be&&typeof Be=="object"&&Be.providerID&&Be.modelID)&&Ye(Ut=>{const Bt={...Ut,[Q.newSessionID]:Be};return yt.current=Bt,Bt})}Rt.current=Q.newSessionID,tr(Q.newSessionID),br(!0);return}if(Q.source==="server"){const Be=Q.summary?Q.summary.substring(0,200)+(Q.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${Q.deletedMessages} messages replaced, ${Q.summaryTokens||"?"} summary tokens`),Be&&console.log("[SERVER-COMPACT] Summary: "+Be),xn({source:"server",deletedMessages:Q.deletedMessages||0,summaryTokens:Q.summaryTokens||0,summary:Be})}const ke=Q.inPlace===!0,Se=!!la.current[ce];ke&&Se?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(Mt([]),St(Be=>{if(!Be[ce])return Be;const xt={...Be};return delete xt[ce],xt}),Mi(null),ni(ce).then(()=>{requestAnimationFrame(()=>{bt.current&&Rt.current===ce&&bt.current.scrollToBottom()})}))}}),pn.on("banner.updated",be=>{const Q=be.properties||be;!Q||!Q.sessionID||(ir(ce=>{const ke=ce[Q.sessionID]||[];if(ke.some(Be=>Be.timestamp===Q.timestamp))return ce;const Se=[{url:Q.url,timestamp:Q.timestamp,prompt:Q.prompt,createdAt:new Date(Q.timestamp).toISOString()},...ke];return{...ce,[Q.sessionID]:Se}}),Q.sessionID===Rt.current&&Qa(null))}),pn.on("banner.progress",be=>{const Q=be.properties||be;if(!Q||Q.sessionID!==Rt.current)return;const ce=Q.stage||"working";let ke=ce;ce==="queued"?ke="Banner queued":ce==="summarizing"?ke="Banner: summarizing…":ce==="rendering"?ke=Q.line?"Banner: "+Q.line.substring(0,80):"Banner: rendering…":ce==="saved"?ke="Banner saved":ce==="error"?ke="Banner error: "+(Q.message||"unknown"):ce==="skipped"&&(ke="Banner skipped: "+(Q.reason||"")),Qa({stage:ce,label:ke,ts:Date.now()}),ce==="saved"&&Q.sessionID&&D_(Q.sessionID).then(Se=>{Se&&Array.isArray(Se.banners)&&ir(Be=>({...Be,[Q.sessionID]:Se.banners}))}).catch(()=>{})}),pn.on("todo.updated",be=>{const Q=be.properties||be;!Q||!Q.sessionID||(Array.isArray(Q.todos)?ca(ce=>({...ce,[Q.sessionID]:Q.todos})):Lh(Q.sessionID).then(ce=>{ce&&Array.isArray(ce.todos)&&ca(ke=>({...ke,[Q.sessionID]:ce.todos}))}).catch(()=>{}))}),pn.on("whatsapp.message",be=>{var ce;const Q=be.properties||be;Q.sessionId===Rt.current&&ks.current&&(console.log("[WhatsApp] Injecting message:",(ce=Q.text)==null?void 0:ce.substring(0,50)),Yd(Q.sessionId,Q.text,null,yt.current[Q.sessionId]||void 0).catch(ke=>console.error("[WhatsApp] Failed to inject message:",ke)))}),pn.on("whatsapp.queued",be=>{const Q=be.properties||be;Q.sessionId===Rt.current&&console.log(`[WhatsApp] Message queued from ${Q.sender} (queue size: ${Q.queueSize})`)}),pn.on("queue.updated",be=>{const Q=be.properties||be;if(!Q||!Q.sessionID)return;const ce=Array.isArray(Q.items)?Q.items:[];vr(ke=>VK(ke,Q.sessionID,ce)),Q.change&&Q.change.kind==="drain"&&Q.sessionID===Rt.current&&bt.current&&(bt.current.resetAutoScroll(),dr())}),pn.on("idle-injection.enabled",be=>{const Q=be.properties||be;!Q||Q.sessionID!==pe||(ul(!0),bs(e("chat.idle_injection_enabled_toast"),"success"))}),pn.on("idle-injection.disabled",be=>{const Q=be.properties||be;!Q||Q.sessionID!==pe||(ul(!1),bs(e("chat.idle_injection_disabled_toast"),"info"))}),pn.on("idle-injection.fired",be=>{const Q=be.properties||be;!Q||Q.sessionID!==pe||bs(e("chat.idle_injection_fired_toast"),"success")}),pn.on("idle-injection.timeout",be=>{const Q=be.properties||be;!Q||Q.sessionID!==pe||bs(e("chat.idle_injection_timeout_toast"),"warning")}),pn.on("scheduled-injection.fired",be=>{const Q=be.properties||be;!Q||Q.sessionID!==pe||bs(e("scheduled_injection.fired_toast"),"success")}),pn.on("scheduled-injection.added",()=>{}),pn.on("scheduled-injection.removed",()=>{}),pn.on("prefill.fallback",be=>{const Q=be.properties||be;!Q||Q.sessionID!==pe||(G({originalModel:Q.originalModel,fallbackModel:Q.fallbackModel,reason:Q.reason||"prefill_too_large"}),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{G(null),ne.current=null},15e3))}),pn.on("auth.device_code",be=>{const Q=be.properties||be;Q.user_code&&Q.verification_uri&&Kr({verification_uri:Q.verification_uri,user_code:Q.user_code,expires_in:Q.expires_in||300})})];return()=>{clearTimeout(Ce),Nn.current!=null&&(clearTimeout(Nn.current),Nn.current=null),Kt(),Dt.current=null,Di.current&&clearTimeout(Di.current),ne.current&&(clearTimeout(ne.current),ne.current=null),G(null),_n.forEach(be=>be()),pn.disconnect()}},[ye]),y.useEffect(()=>{if(!ye)return;const L=setTimeout(()=>{var X;(X=xe.current)==null||X.focus()},50);return()=>{clearTimeout(L)}},[ye]);function Ss(L){hn(X=>{for(var J=0;J<X.length;J++)if(X[J].id===L.id)return X.map(oe=>oe.id===L.id?L:oe);return[L,...X]})}const es=y.useCallback(async()=>{try{const L=await j_();Ss(L),Rt.current=L.id,tr(L.id)}catch(L){Ct("Failed to create session: "+L.message)}},[]);rt.current=es;const Qr=y.useCallback(async L=>{var X;if(L!==Rt.current){Rt.current=L,tr(L),Ct(null),br(!!la.current[L]),ei(null);try{const J=await Ih(L);if(Rt.current!==L)return;((X=J==null?void 0:J.status)==null?void 0:X.type)==="busy"&&br(!0),hn(oe=>{var Kt;if(!J)return oe;const pe=oe.findIndex(kn=>kn.id===L),Te=((Kt=J.time)==null?void 0:Kt.updated)||0;if(pe>=0){const kn=oe[pe],Cn=oe.filter(Q=>Q.id!==L),_n={...J,ui:{...J.ui,...kn.ui}},be=Cn.findIndex(Q=>{var ce;return(((ce=Q.time)==null?void 0:ce.updated)||0)<=Te});return Cn.splice(be<0?Cn.length:be,0,_n),Cn}const Ce=oe.findIndex(kn=>{var Cn;return(((Cn=kn.time)==null?void 0:Cn.updated)||0)<=Te}),_t=[...oe];return _t.splice(Ce<0?_t.length:Ce,0,J),_t}),Ye(oe=>{if(J&&J.model)return{...oe,[L]:J.model};if(oe[L]){const pe={...oe};return delete pe[L],pe}return oe})}catch(J){console.error("Failed to fetch session status for session",L,J)}}},[]),Ns=y.useCallback(async L=>{try{await cM(L),eM(L),hn(X=>X.filter(J=>J.id!==L)),ye===L&&(Rt.current=null,tr(null))}catch(X){Ct("Failed to delete: "+X.message)}},[ye]),dd=y.useCallback(async()=>{try{await dM(),await _i(),await Yi(),Rt.current=null,tr(L=>L&&null)}catch(L){Ct("Failed to delete sessions: "+L.message)}},[_i]),Rp=y.useCallback(async(L,X)=>{try{await qi(L,{title:X}),hn(J=>J.map(oe=>oe.id===L?{...oe,title:X}:oe))}catch(J){Ct("Failed to rename: "+J.message)}},[]),Ap=y.useCallback(async L=>{try{const X=await sM(L);X&&X.title&&hn(J=>J.map(oe=>oe.id===L?{...oe,title:X.title}:oe))}catch(X){Ct("Failed to regenerate title: "+X.message)}},[]),[bc,mo]=y.useState(null),ml=y.useCallback(L=>{mo(L)},[]),vc=y.useCallback(async(L,X)=>{try{await qi(L,{pinned:X}),hn(J=>J.map(oe=>oe.id===L?{...oe,pinned:X}:oe))}catch(J){Ct("Failed to pin: "+J.message)}},[]),kc=y.useCallback(async L=>{const X=Ot.find(oe=>oe.id===L);if(!X||!X.parentSessionID)return;const J=X.parentSessionID;try{await hM(L),hn(oe=>oe.map(pe=>pe.id===L?{...pe,compactionPinned:!1}:pe)),Rt.current=J,tr(J)}catch(oe){Ct("Failed to unpin: "+oe.message)}},[Ot]),_c=y.useCallback(async(L,X)=>{try{await qi(L,{archived:X}),!Ke.current&&X?(hn(J=>J.filter(oe=>oe.id!==L)),ye===L&&(Rt.current=null,tr(null))):hn(J=>J.map(oe=>oe.id===L?{...oe,archived:X}:oe))}catch(J){Ct("Failed to archive: "+J.message)}},[ye]),wc=y.useCallback(async({readOnly:L=!1}={})=>{if(!ye)return;let X,J,oe;if(hn(pe=>{var Ce;const Te=pe.find(_t=>_t.id===ye);return X=((Ce=Te==null?void 0:Te.ui)==null?void 0:Ce.hideThinking)??!1,J=!X,oe=Te==null?void 0:Te.ui,pe.map(_t=>_t.id===ye?{..._t,ui:{..._t.ui,hideThinking:J}}:_t)}),!L)try{await qi(ye,{ui:{...oe,hideThinking:J}})}catch(pe){console.error("Failed to persist hideThinking:",pe),hn(Te=>Te.map(Ce=>Ce.id===ye?{...Ce,ui:{...Ce.ui,hideThinking:X}}:Ce)),Ct("Failed to save thinking visibility preference"+(pe!=null&&pe.message?": "+pe.message:""))}},[ye]),Ip=y.useCallback(async()=>{if(!ye)return;let L,X;hn(J=>{var pe;const oe=J.find(Te=>Te.id===ye);return L=((pe=oe==null?void 0:oe.ui)==null?void 0:pe.chatInput)==="hidden",X=oe==null?void 0:oe.ui,J.map(Te=>Te.id===ye?{...Te,ui:{...Te.ui,chatInput:L?void 0:"hidden"}}:Te)});try{const J={...X};L?delete J.chatInput:J.chatInput="hidden",await qi(ye,{ui:J})}catch(J){console.error("Failed to persist chatInput:",J),hn(oe=>oe.map(pe=>pe.id===ye?{...pe,ui:{...pe.ui,chatInput:L?"hidden":void 0}}:pe)),Ct("Failed to save chat input visibility"+(J!=null&&J.message?": "+J.message:""))}},[ye]),Ec=y.useCallback(async L=>{try{await cL(L)}catch(X){Ct("Export failed: "+X.message)}},[]),Sc=y.useCallback(async L=>{try{const X=await uL(L);X&&X.id&&(await _i(),Qr(X.id))}catch(X){Ct("Import failed: "+X.message)}},[_i,Qr]),fd=y.useRef(!1);y.useEffect(()=>{if(!fd.current&&!(!Pi||Ot.length===0)){fd.current=!0;var L=null,X=!1;try{var J=new URLSearchParams(window.location.search);L=J.get("session"),X=!!L}catch{}if(L||(L=q()),!!L){if(Ot.some(function(oe){return oe.id===L})){Qr(L);return}Ih(L).then(function(oe){oe&&oe.id?Qr(L):X||W()}).catch(function(){X||W()})}}},[Pi,Ot,Qr]),y.useEffect(()=>{function L(X){var J=X.data;!J||J.type!=="navigate-session"||J.sessionId&&Qr(J.sessionId)}return window.addEventListener("message",L),function(){window.removeEventListener("message",L)}},[Qr]),y.useEffect(()=>{function L(){try{var J=indexedDB.open("pave-sw",1);J.onupgradeneeded=function(){J.result.createObjectStore("pave-pending-nav")},J.onsuccess=function(){var oe=J.result;if(!oe.objectStoreNames.contains("pave-pending-nav")){oe.close();return}var pe=oe.transaction("pave-pending-nav","readwrite"),Te=pe.objectStore("pave-pending-nav"),Ce=Te.get("sessionId");Ce.onsuccess=function(){var _t=Ce.result;Te.delete("sessionId"),_t&&_t!==Rt.current&&Qr(_t)},pe.oncomplete=function(){oe.close()},pe.onerror=function(){oe.close()}},J.onerror=function(){}}catch{}}function X(){document.visibilityState==="visible"&&(L(),setTimeout(L,500),setTimeout(L,1500))}return document.addEventListener("visibilitychange",X),function(){document.removeEventListener("visibilitychange",X)}},[Qr]);const Nc=y.useCallback(async L=>{if(!ye)return;const X=se.current,J=(X[ye]||0)+1;X[ye]=J;const oe=yt.current[ye];Ye(pe=>{const Te={...pe};return L?Te[ye]=L:delete Te[ye],yt.current=Te,Te});try{const pe=await qi(ye,{model:L||null});if(X[ye]!==J)return;pe&&(typeof pe.model=="string"&&pe.model||pe.model&&typeof pe.model=="object"&&pe.model.providerID&&pe.model.modelID)?Ye(Te=>{const Ce={...Te,[ye]:pe.model};return yt.current=Ce,Ce}):L||Ye(Te=>{const Ce={...Te};return delete Ce[ye],yt.current=Ce,Ce})}catch(pe){if(X[ye]!==J)return;Ye(Te=>{const Ce={...Te};return oe!==void 0?Ce[ye]=oe:delete Ce[ye],yt.current=Ce,Ce}),console.error("[ModelChange] PATCH failed for session",ye,pe),Ct("Failed to update session model: "+pe.message)}},[ye]),Da=y.useCallback(async function(L,X){if(ye){var J=je&&je.disabledSkills||[],oe;X?oe=J.filter(function(pe){return pe!==L}):oe=J.concat([L]),hn(function(pe){return pe.map(function(Te){return Te.id===ye?{...Te,disabledSkills:oe}:Te})});try{await qi(ye,{disabledSkills:oe})}catch(pe){hn(function(Te){return Te.map(function(Ce){return Ce.id===ye?{...Ce,disabledSkills:J}:Ce})}),console.error("[SkillToggle] PATCH failed:",pe)}}},[ye,je]),pd=y.useCallback(async function(){if(ye)try{var L=await r4(),X=L.skillDefaults||{},J=await Dv(),oe=[];(J||[]).forEach(function(pe){X[pe.name]||oe.push(pe.name)}),hn(function(pe){return pe.map(function(Te){return Te.id===ye?{...Te,disabledSkills:oe}:Te})}),await qi(ye,{disabledSkills:oe})}catch(pe){console.error("[SkillToggle] Reset to defaults failed:",pe)}},[ye]),Cs=y.useCallback(L=>{hn(X=>X.map(J=>J.id===ye?{...J,directory:L}:J)),sc(!1)},[ye]),Qi=y.useCallback(async()=>{const L=!ro.current;ro.current=L,ho.current=po,gs(L);try{localStorage.setItem("pave-show-other-apps",L?"true":"false")}catch{}await Yi()},[]),ha=y.useRef(null),ga=y.useCallback(L=>{const X=typeof L=="string"?L:"";vp(X),Xa.current=X,ha.current&&clearTimeout(ha.current),ha.current=setTimeout(()=>{Aa.current=0,ho.current=po,_i({q:X}),Yi(),gl()},250)},[]);y.useEffect(()=>()=>{ha.current&&clearTimeout(ha.current)},[]);const Cc=y.useCallback(async()=>{const L=!Ke.current;Ke.current=L,await _i({includeArchived:L})?(Re(L),await Promise.all([gl(),Yi()])):Ke.current=!L},[gl,Yi]),xo=y.useCallback(async(L,X,J,oe,pe,Te,Ce)=>{const _t=L===Rt.current;Te&&_t&&Mt(Tn=>Tn.filter(wi=>wi.info.id!==Te));var Kt=(J?J.length:0)+(Ce?Ce.length:0);if(Kt>Df)throw Ct("Too many attachments. Maximum "+Df+" per message."),new Error("Too many attachments");var kn=[],Cn=0;if(J&&J.length>0){for(var _n=0;_n<J.length;_n++){var be=(J[_n].file.type||"").toLowerCase();if(Jf.indexOf(be)===-1)throw Ct('Unsupported image type: "'+J[_n].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(J[_n].file.size>f2){var Q=Math.round(J[_n].file.size/1024/1024*10)/10,ce=Math.round(f2/1024/1024*10)/10;throw Ct('Image "'+J[_n].name+'" ('+Q+"MB) exceeds the "+ce+"MB size limit."),new Error("Image too large")}Cn+=J[_n].file.size}if(Cn>g2){var ke=Math.round(Cn/1024/1024*10)/10,Se=Math.round(g2/1024/1024*10)/10;throw Ct("Combined image size ("+ke+"MB) exceeds the "+Se+"MB total image limit."),new Error("Combined image size too large")}try{kn=await Promise.all(J.map(function(Tn){return new Promise(function(wi,wr){var Mr=new FileReader;Mr.onload=function(){if(typeof Mr.result!="string"){wr(new Error("FileReader did not produce a data URL for: "+Tn.name));return}wi({type:"image_url",image_url:{url:Mr.result}})},Mr.onerror=function(){wr(new Error("Failed to read file: "+Tn.name))},Mr.readAsDataURL(Tn.file)})}))}catch(Tn){throw Ct("Failed to read image: "+Tn.message),Tn}}var Be=[],xt=0;if(Ce&&Ce.length>0){for(var Ut=0;Ut<Ce.length;Ut++){var Bt=(Ce[Ut].file.type||"").toLowerCase();if(y5.indexOf(Bt)===-1)throw Ct('Unsupported file type: "'+Ce[Ut].name+'" ('+(Bt||"unknown")+")."),new Error("Unsupported file type");if(Ce[Ut].file.size>p2){var gn=Math.round(Ce[Ut].file.size/1024/1024*10)/10,Wn=Math.round(p2/1024/1024*10)/10;throw Ct('File "'+Ce[Ut].name+'" ('+gn+"MB) exceeds the "+Wn+"MB size limit."),new Error("File too large")}xt+=Ce[Ut].file.size}if(Cn+xt>h2){var Xn=Math.round((Cn+xt)/1024/1024*10)/10,hr=Math.round(h2/1024/1024*10)/10;throw Ct("Combined attachment size ("+Xn+"MB) exceeds the "+hr+"MB total limit."),new Error("Combined attachment size too large")}try{Be=await Promise.all(Ce.map(function(Tn){return new Promise(function(wi,wr){var Mr=new FileReader;Mr.onload=function(){if(typeof Mr.result!="string"){wr(new Error("FileReader did not produce a data URL for: "+Tn.name));return}wi({type:"file",mime:Tn.file.type,filename:Tn.name,url:Mr.result})},Mr.onerror=function(){wr(new Error("Failed to read file: "+Tn.name))},Mr.readAsDataURL(Tn.file)})}))}catch(Tn){throw Ct("Failed to read file: "+Tn.message),Tn}}const jn="temp-"+Date.now();for(var ko=[{id:jn+"-text",type:"text",text:pe}],vl=0;vl<kn.length;vl++)ko.push({id:jn+"-img-"+vl,type:"image_url",image_url:kn[vl].image_url});for(var ma=0;ma<Be.length;ma++)ko.push({id:jn+"-file-"+ma,type:"file",mime:Be[ma].mime,filename:Be[ma].filename});const kl={info:{id:jn,sessionID:L,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:ko};Mt(Tn=>_t?[...Tn,kl]:Tn),_t&&bt.current&&(bt.current.resetAutoScroll(),dr()),me(L,!0),Ie.current.set(L,{text:pe,tempId:jn});const Ac=so.current[L]??null,Ic=dl.current[L]??"max",Ba=Ac===null&&!oo.current.has(L),Mc=lc.current[L],_o=Ba&&Mc?Mc.moe_topk||null:Ac;try{var wo=null;(kn.length>0||Be.length>0)&&(wo=Be.concat(kn)),await Yd(L,X,wo,yt.current[L]||void 0,oe,{moeTopK:_o,reasoningEffort:Ic,adaptiveQuality:Ba})}catch(Tn){if(GK(Tn))if(VT(kn,Be)){const wr=jn;Yr.current[L]||(Yr.current[L]=[]),Yr.current[L].push({content:X,imageAttachments:J,fileAttachments:Ce,agent:oe,displayContent:pe,queuedTempId:wr}),La(L),me(L,!1);return}else try{await R_(L,X,{displayContent:pe,agent:oe||void 0,model:yt.current[L]||void 0,moeTopK:_o,reasoningEffort:Ic,adaptiveQuality:Ba}),Mt(wr=>wr.filter(Mr=>Mr.info.id!==jn)),me(L,!1);return}catch(wr){throw Ct("Failed to queue message: "+wr.message),me(L,!1),Mt(Mr=>Mr.filter(Lc=>Lc.info.id!==jn)),wr}if(Tn&&Tn.reauthRequired){Ct("Session expired. Please log in again."),De(null),me(L,!1),Mt(wi=>wi.filter(wr=>wr.info.id!==jn));return}throw Ct("Failed to send: "+Tn.message),me(L,!1),Mt(wi=>wi.filter(wr=>wr.info.id!==jn)),Tn}},[La,dr]),jc=y.useRef(xo);y.useEffect(()=>{jc.current=xo},[xo]);const Xr=y.useCallback(async(L,X,J,oe)=>{Ct(null),jr.length>0&&(L=WB(jr,L));const pe=L,Te=L.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(Te){const _n=Te[1],be=Te[2],Q=Te[3]||"",ce=Q||_n+" "+be,ke=(_n+"_"+be).replace(/-/g,"_").slice(0,128);L="[SKILL_HINT: User explicitly requested "+_n+"."+be+(Q?" with args: "+Q:"")+". Call the "+ke+` tool with these parameters.]
|
|
128
|
-
|
|
129
|
-
`+ce}let Ce=Rt.current;if(!Ce)try{const _n=await j_();Ss(_n),Rt.current=_n.id,tr(_n.id),Ce=_n.id,await new Promise(be=>setTimeout(be,200))}catch(_n){throw Ct("Failed to create session: "+_n.message),_n}if(!!Gi[Ce]){if(!VT(X,oe)){try{await R_(Ce,L,{displayContent:pe,agent:J||void 0,model:yt.current[Ce]||void 0})}catch(ke){Ct("Failed to queue message: "+ke.message)}return}const be="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),Q=[{id:be+"-text",type:"text",text:pe}];if(X&&X.length>0)for(var Kt=0;Kt<X.length;Kt++){var kn=X[Kt].preview||"";Q.push({id:be+"-img-"+Kt,type:"image_url",image_url:{url:kn}})}if(oe&&oe.length>0)for(var Cn=0;Cn<oe.length;Cn++)Q.push({id:be+"-file-"+Cn,type:"file",mime:oe[Cn].file.type,filename:oe[Cn].name});const ce={info:{id:be,sessionID:Ce,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:Q};Mt(ke=>[...ke,ce]),Ce===Rt.current&&bt.current&&(bt.current.resetAutoScroll(),dr()),Yr.current[Ce]||(Yr.current[Ce]=[]),Yr.current[Ce].push({content:L,imageAttachments:X,agent:J,displayContent:pe,queuedTempId:be,fileAttachments:oe}),La(Ce),vi([]);return}await xo(Ce,L,X,J,pe,null,oe),vi([])},[Gi,xo,La,dr,jr]);y.useEffect(()=>{const L=()=>{Xr(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",L),()=>window.removeEventListener("pave:plan-execute",L)},[Xr,e]);const yo=y.useCallback(async()=>{if(ye)try{const L=ye;Ma.current.add(L),await gM(L),me(L,!1),Mi(null)}catch(L){console.error("Abort failed:",L),Ct("Failed to stop: "+(L&&L.message?L.message:String(L)))}},[ye,me]),js=y.useCallback(async(L,X,J)=>{if(Ct(null),L==="btw"){const oe=Rt.current;if(!oe){Ct("No active session to fork.");return}let pe;try{pe=await lM(oe)}catch(Ce){throw Ct("Fork failed: "+(Ce&&Ce.message?Ce.message:String(Ce))),Ce}if(!pe||!pe.id)throw Ct("Fork failed: server returned no session id."),new Error("Fork returned no session");Ss(pe),Rt.current=pe.id,tr(pe.id),await new Promise(Ce=>setTimeout(Ce,200));const Te=(X||"").trim();if(Te)try{await Xr(Te,J&&J.imageAttachments?J.imageAttachments:void 0,void 0,J&&J.fileAttachments?J.fileAttachments:void 0)}catch{}return}if(L==="compact"){const oe=Rt.current;if(!oe){Ct("No active session to compact.");return}Ct(null),ei({reason:"manual",stage:"starting"}),xn(null),pM(oe).then(pe=>{if(!pe||!pe.success){ei(null),Ct("Compaction failed: "+(pe&&pe.error||"unknown error"));return}ni(oe),ei(null),xn(null)}).catch(pe=>{ei(null),pe&&pe.status===409?Ct("Cannot compact while the session is busy. Wait for the current response to finish."):Ct("Compaction failed: "+(pe&&pe.message?pe.message:String(pe)))});return}Ct("Unknown built-in command: /"+L)},[Xr]),xl=y.useCallback(L=>{qt(X=>X.filter(J=>J.id!==L))},[]),Tc=y.useCallback(async()=>{for(var L=gt.length-1;L>=0;L--)if(gt[L].info.role==="user"){var X=gt[L].parts||[],J=bk(X,null),oe=X.filter(function(Ce){return Ce.type==="image_url"&&Ce.image_url});if(J.trim()||oe.length>0)if(oe.length>0){var pe=ye;if(!pe)break;me(pe,!0),Ct(null);try{var Te=oe.map(function(Ce){return{type:"image_url",image_url:Ce.image_url}});await Yd(pe,J.trim(),Te,yt.current[pe]||void 0)}catch(Ce){Ct("Failed to retry: "+Ce.message),me(pe,!1)}}else try{await Xr(J.trim())}catch(Ce){Ct("Failed to retry: "+Ce.message),me(ye,!1)}break}},[gt,Xr,ye]),Ts=y.useCallback(async function(L){if(L&&L.trim()){Ct(null),bt.current&&bt.current.resetAutoScroll();try{await Xr(L.trim()),dr()}catch(X){Ct("Failed to resend: "+X.message),me(ye,!1)}}},[Xr,dr]),_r=y.useMemo(()=>je?je.source==="archive"||je._readOnly===!0:!1,[je]),Bn=y.useMemo(()=>je?je._readOnly===!0&&je.source!=="tui"&&je.source!=="archive":!1,[je]),Pn=y.useMemo(()=>{if(!Bn||!je||!Ot)return null;for(const L of Ot)if(L.parentSessionID===je.id)return L.id;return null},[Bn,je,Ot]),Pa=y.useMemo(()=>{var J;let L=null;for(let oe=gt.length-1;oe>=0;oe--)if(((J=gt[oe].info)==null?void 0:J.role)==="assistant"){L=gt[oe];break}if(!L)return[];const X=(L.parts||[]).filter(oe=>oe.type==="tool");return X.length===0?[]:!yr&&X.every(pe=>{var Te,Ce;return((Te=pe.state)==null?void 0:Te.status)==="completed"||((Ce=pe.state)==null?void 0:Ce.status)==="error"})?[]:X},[gt,yr]),qr=y.useMemo(()=>{var X;const L=[];for(const J of gt)if(((X=J.info)==null?void 0:X.role)==="assistant"){const oe=(J.parts||[]).filter(pe=>pe.type==="tool");L.push(...oe)}return L},[gt]),pr=y.useRef(0),[ts,Fa]=y.useState(!1),ri=y.useCallback(L=>{if(L.preventDefault(),L.stopPropagation(),pr.current++,pr.current===1){const X=L.dataTransfer;let J=!1;X&&X.items&&X.items.length>0&&(J=Array.from(X.items).some(oe=>oe.kind==="file")),J&&Fa(!0)}},[]),yl=y.useCallback(L=>{L.preventDefault(),L.stopPropagation(),pr.current=Math.max(0,pr.current-1),pr.current===0&&Fa(!1)},[]),hd=y.useCallback(L=>{L.preventDefault(),L.stopPropagation()},[]),gd=y.useCallback(L=>{L.preventDefault(),L.stopPropagation(),pr.current=0,Fa(!1);const X=L.dataTransfer&&L.dataTransfer.files;if(!X||X.length===0)return;const J=X[0],oe=J.name.toLowerCase();if(!oe.endsWith(".yaml")&&!oe.endsWith(".yml")){Ct(e("import.invalid_file_type"));return}const pe=10*1024*1024;if(J.size>pe){Ct(e("import.file_too_large"));return}const Te=new FileReader;Te.onload=Ce=>{const _t=Ce&&Ce.target?Ce.target.result:null;if(typeof _t!="string"){Ct(e("import.read_error"));return}Sc(_t)},Te.onerror=()=>{Ct(e("import.read_error"))},Te.readAsText(J)},[Sc,Ct,e]);if(At)return i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950",children:i.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})});if(!We)return i.jsx(Vz,{darkMode:t,onToggleTheme:()=>n(!t)});const bo=je==null?void 0:je.title,vo=typeof bo=="string"?bo.trim():"",hi=((bl=je==null?void 0:je.ui)==null?void 0:bl.hideThinking)??!1,ns=((Rc=je==null?void 0:je.ui)==null?void 0:Rc.chatInput)==="hidden";return i.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:ri,onDragLeave:yl,onDragOver:hd,onDrop:gd,children:[ts&&i.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:i.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:i.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),i.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 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:xr(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-8"}),i.jsx("h1",{className:"sr-only",children:"PAVE"}),et&&i.jsxs("span",{className:"hidden sm:inline text-xs text-gray-400 dark:text-gray-500 select-none",title:e("app.version"),children:["v",et]})]}),de==="chat"&&ye&&i.jsx("span",{className:"sm:hidden min-w-0 truncate text-sm font-medium text-gray-600 dark:text-gray-300",title:je&&je.title||e("sidebar.untitled"),children:je&&je.title||e("sidebar.untitled")}),i.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[i.jsx("button",{onClick:()=>_e("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${de==="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")}),i.jsx("button",{onClick:()=>_e("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${de==="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")}),i.jsx("button",{onClick:()=>_e("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${de==="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")})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[vt&&i.jsx("button",{onClick:()=>Gt(L=>!L),className:`p-1.5 rounded-lg transition-colors ${Vt?"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":Vt,children:i.jsx("span",{className:"text-sm leading-none",children:"🦋"})}),i.jsx("button",{onClick:()=>R(!T),className:`p-1.5 rounded-lg transition-colors ${T?"bg-green-600 text-black":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:e(T?"app.hacker_mode_exit":"app.hacker_mode_enter"),"aria-label":e(T?"app.hacker_mode_exit":"app.hacker_mode_enter"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),ye&&de==="chat"&&i.jsx("button",{onClick:Z,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${V?"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:ot?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:ot?"Cmd+J":"Ctrl+J"}),"aria-pressed":V,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),i.jsx(FI,{darkMode:t,onToggle:()=>n(!t)}),We&&i.jsx(Gz,{user:We,onLogout:on,onSkillManagement:()=>_e("skills"),onPricingSettings:()=>ge(!0),onDlpSettings:()=>ht(!0),onSettings:()=>_e("settings"),onBoard:uc?()=>_e("board"):void 0,onCapabilities:co?()=>_e("capabilities"):void 0})]})]}),de==="skills"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(uV,{onBack:()=>_e("chat")})}):de==="board"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(mV,{onBack:()=>_e("chat")})}):de==="capabilities"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(CV,{onBack:()=>_e("chat")})}):de==="settings"?i.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:i.jsx(_G,{onBack:()=>_e("chat"),onOpenDlpSettings:()=>ht(!0),onOpenPricingSettings:()=>ge(!0),activeSessionId:ye,mobileFrameless:M,onMobileFramelessChange:I})}):i.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[i.jsx(ZI,{sessions:Tp,activeSessionId:ye,busySessions:Gi,onSelectSession:L=>{Qr(L),window.innerWidth<768&&He(!1)},onNewChat:es,onDeleteSession:Ns,onDeleteAllSessions:dd,onRenameSession:Rp,onRegenerateTitle:Ap,onPinSession:vc,onArchiveSession:_c,onExportSession:Ec,onSendToSession:ml,onImportSession:Sc,onImportError:L=>Ct(L),showArchived:wt,onToggleShowArchived:Cc,isOpen:Pe,onClose:()=>He(!1),onToggle:()=>He(L=>!L),hasMoreSessions:Ra,onLoadMoreSessions:yc,showOtherApps:ti,onToggleShowOtherApps:Qi,hasMoreOtherApps:cd,onLoadMoreOtherApps:$n,otherAppsCount:Es.length,search:io,onSearchChange:ga,loadedCount:Ot.length,totalCount:rl,sidebarWidth:P,onSidebarWidthChange:K}),i.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:ye?i.jsxs(i.Fragment,{children:[i.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 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(PW,{sessionModel:ut.has(ye)?"epm/privacy":Me[ye]||null,activeModel:Dn,registryEntries:it,onModelChange:Nc,disabled:yr||ut.has(ye),lockedReason:ut.has(ye)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},ye),vo?i.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:vo,children:vo}):null,i.jsx("button",{onClick:()=>sc(!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:_r,children:i.jsx(FA,{className:"w-4 h-4"})}),i.jsx(zW,{sessionId:ye,disabledSkills:je?je.disabledSkills:[],onToggle:Da,onResetToDefaults:pd,t:e,disabled:_r}),i.jsx("button",{onClick:()=>Ku(!0),className:`p-1.5 rounded-lg transition-colors ${Ep?"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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),Le&&i.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(L=>{const X=ed===null&&td&&!oo.current.has(ye)&&td.moe_topk===L.val,J=ed===L.val;return i.jsx("button",{onClick:()=>{L.val===null?oo.current.delete(ye):oo.current.add(ye),Qu(oe=>({...oe,[ye]:L.val})),qi(ye,{moe_top_k:L.val}).catch(()=>{})},disabled:_r,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${J?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":X?"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:L.label},L.label)})}),i.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(L=>i.jsx("button",{onClick:()=>{Xu(X=>({...X,[ye]:L.val})),qi(ye,{reasoning_effort:L.val}).catch(()=>{})},disabled:_r,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${Sp===L.val?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:L.label},L.val))})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:()=>wc({readOnly:_r}),className:`p-1.5 rounded-lg transition-colors ${hi?"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(hi?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(hi?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!hi,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),i.jsx("button",{onClick:()=>Ip(),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_chat_input":"chat.hide_chat_input"),"aria-label":e(ns?"chat.show_chat_input":"chat.hide_chat_input"),"aria-pressed":!ns,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),cc&&i.jsx("button",{onClick:async()=>{if(ye)try{await yL(ye),Ct("Banner generation queued (~2 min)"),setTimeout(()=>Ct(null),4e3)}catch(L){Ct(`Banner: ${L.message||L}`)}},disabled:!ye,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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),cc&&i.jsx("button",{onClick:U,className:`p-1.5 rounded-lg transition-colors ${B?"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:B?"Show banner":"Hide banner","aria-label":B?"Show banner":"Hide banner","aria-pressed":!B,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:B?i.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"}):i.jsxs(i.Fragment,{children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),i.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"})]})})}),Js?i.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${Js.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":Js.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:Js.label,children:Js.label}):null,da&&i.jsx("button",{"data-testid":"whatsapp-toggle",onClick:()=>{if(!ua){alert(e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.");return}Vu(L=>!L)},disabled:!ua,className:`p-1.5 rounded-lg transition-colors ${ua?Oi?"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(Oi?"chat.whatsapp_enabled":"chat.whatsapp_disabled"):e("chat.whatsapp_no_chatid")||"Set PAVE_WHATSAPP_CHAT_ID in Settings first.","aria-label":e(Oi?"chat.whatsapp_enabled":"chat.whatsapp_disabled"),"aria-pressed":Oi,children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),i.jsx("button",{onClick:()=>ys(L=>!L),className:`p-1.5 rounded-lg transition-colors lg:hidden ${xs?"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":xs,"aria-haspopup":"dialog","aria-controls":"activities-panel-dialog",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),i.jsx("button",{onClick:()=>Ec(ye),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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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"})})}),i.jsx("button",{onClick:()=>{al(L=>!L),ms&&(ol(""),Ki(0),ll(0))},className:`p-1.5 rounded-lg transition-colors ${ms?"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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})]}),ms&&i.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 shrink-0",children:[i.jsx("svg",{className:"w-4 h-4 text-gray-400 dark:text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),i.jsx("input",{type:"text",placeholder:e("app.search_placeholder"),value:sl,onChange:L=>{ol(L.target.value),Ki(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-hidden"}),sl&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 shrink-0 tabular-nums",children:Li>0?e("app.match_count",{current:ao+1,total:Li}):e("app.no_matches")}),sl&&Li>0&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Ki(L=>(L-1+Li)%Li),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:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),i.jsx("button",{onClick:()=>Ki(L=>(L+1)%Li),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:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),i.jsx("button",{onClick:()=>{al(!1),ol(""),Ki(0),ll(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:i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!nc&&i.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:[i.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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.jsx("span",{children:e("app.reconnecting")})]}),to&&i.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:[i.jsx("span",{children:to}),i.jsx("button",{onClick:()=>Ct(null),className:"ml-2 text-red-400 hover:text-red-600","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),cl&&i.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${cl.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":cl.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:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),i.jsx("span",{children:cl.text})]}),Gr&&i.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:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold",children:e("auth.device_code_title")}),i.jsxs("div",{className:"mt-1",children:[i.jsx("a",{href:Gr.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:Gr.verification_uri})," ","— ",i.jsx("span",{className:"font-mono font-bold text-base select-all",children:Gr.user_code})]}),i.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),i.jsx("button",{onClick:()=>Kr(null),className:"ml-2 text-blue-400 hover:text-blue-600 shrink-0","aria-label":"Dismiss",title:"Dismiss",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),un&&i.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:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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 ",un.attempt,"/",un.maxRetries,un.maxDurationMs>0&&un.elapsedMs>0&&i.jsxs(i.Fragment,{children:[" (",Math.round(un.elapsedMs/1e3),"s / ",Math.round(un.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(un.delayMs/1e3),"s. Click Stop to cancel."]}),i.jsx("button",{onClick:()=>{Wt(null),Ar.current&&(clearTimeout(Ar.current),Ar.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Ve&&i.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:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.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: ",Ve.fallbackModel," (local model unavailable)"]}),i.jsx("button",{onClick:()=>{G(null),ne.current&&(clearTimeout(ne.current),ne.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsx(xz,{ref:bt,messages:gt,unloadedCompactedCount:cn,onExpandCompactedHistory:ye?()=>go(ye):void 0,hasOlderMessages:zn,loadingOlderMessages:lr,onLoadOlderMessages:ye?()=>ud(ye):void 0,streamingParts:at[ye]||{},streamingProgress:eo,isBusy:yr,compactingInfo:zr,compactionResult:Qn,onSwitchToCompactedSession:L=>{Rt.current=L,tr(L),xn(null)},onDismissCompactionResult:()=>xn(null),parentSessionID:je&&je.parentSessionID,compactionPinned:je&&je.compactionPinned,onUnpinCompaction:kc,onViewParentSession:L=>{Rt.current=L,tr(L),hn(function(X){return X.map(function(J){return J.id===L?{...J,_readOnly:!0}:J})})},user:We,searchQuery:sl,activeMatchIndex:ao,onTotalMatchesChange:ll,onRetry:_r?void 0:Tc,onEditAndResend:_r?void 0:Ts,onCancelQueued:_r?void 0:ld,hackerMode:T,mobileFrameless:M,hideThinking:hi,sessionID:ye,banners:(cc?Ir[ye]:null)||[],bannerHidden:B,onToggleBanner:U,privateMessageIds:ze,questionIdMap:kt,onQuoteAdd:ja}),i.jsx(KG,{rect:fi&&fi.rect,label:e("chat.quote_selection"),copyLabel:e("chat.copy_selection"),onCopy:function(){oa()},onQuote:function(){fi&&ja(fi),Tr()},onDismiss:Tr}),(pi[ye]||[]).length>0&&i.jsx(GG,{items:pi[ye]||[],sessionId:ye,isReadOnly:_r,onReorder:function(L){fM(ye,L).catch(function(X){Ct("Failed to reorder: "+X.message)})},onCancelItem:function(L){A_(ye,L).catch(function(X){Ct("Failed to cancel: "+X.message)})},onEditItem:function(L){if(!(L.status==="dispatching"||_r)){A_(ye,L.id).catch(function(){});var X=L.displayContent||L.text||"";X&&xe.current&&typeof xe.current.setText=="function"&&xe.current.setText(X)}},t:e}),_r?i.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:Bn?i.jsxs(i.Fragment,{children:[i.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:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})}),Pn?i.jsx("button",{onClick:()=>{Rt.current=Pn,tr(Pn)},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"}):i.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e("chat.compacted_switch_to_new")||"Compacted — switch to new session"})]}):i.jsxs(i.Fragment,{children:[i.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:je&&je.source==="archive"?i.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"}):i.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"})}),i.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:je&&je.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal")})]})}):((md=je==null?void 0:je.ui)==null?void 0:md.chatInput)==="hidden"?i.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:i.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e("chat.monitor_only")})}):i.jsx(Wz,{ref:xe,sessionId:ye,onSend:Xr,onBuiltinCommand:js,onAbort:yo,isBusy:yr,pendingQuotes:jr,onRemoveQuote:Hn,onClearQuotes:Zs,queuedCount:od+(pi[ye]||[]).length})]}):i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[i.jsx("img",{src:xr(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-16 mb-4"}),i.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),i.jsx("button",{onClick:es,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")})]})}),ye&&i.jsxs("aside",{ref:ic,style:{width:ee},className:`border-l hidden ${V?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 ${T?t?"border-gray-800":"border-gray-300":"border-gray-200 dark:border-gray-800"}`,children:[i.jsx(SK,{width:ee,min:UA,max:HA,edge:"left",onCommit:H,getPaneEl:()=>ic.current,ariaLabel:e("app.resize_terminal"),className:T?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"}),!xs&&Ja()]}),xs&&ye&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>ys(!1)}),i.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:L=>{(L.key==="Escape"||L.key==="Esc")&&(L.stopPropagation(),ys(!1))},ref:rc,children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[i.jsx("h2",{id:"activities-panel-heading",className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:e("app.activities_panel")}),i.jsx("button",{onClick:()=>ys(!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:i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Ja()]})]})]}),Ue&&i.jsx(SG,{onClose:()=>ge(!1)}),ft&&i.jsx(RG,{onClose:()=>ht(!1)}),vt&&i.jsx(_K,{open:Vt,onClose:()=>Gt(!1),activeSessionId:ye,activeSessionTitle:vo}),i.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:i.jsx(MG,{requests:Ze,onDismiss:xl})}),i.jsx(OG,{open:bp,onClose:()=>Jo(!1),upgradeUrl:el}),i.jsx(AL,{open:bc!==null,onClose:()=>mo(null),senderSessionID:bc}),i.jsx($G,{isOpen:ac,onClose:()=>sc(!1),sessionId:ye,currentDirectory:(je==null?void 0:je.directory)||"",homeDir:_p,onDirectoryChange:Cs,session:je}),i.jsx(VG,{isOpen:Gu,onClose:()=>Ku(!1),sessionId:ye}),i.jsx(FG,{isOpen:fe,onClose:()=>{ae(!1),setTimeout(()=>{var L;return(L=xe.current)==null?void 0:L.focus()},0)},onSelectSession:L=>{Qr(L)},onNewChat:()=>{typeof rt.current=="function"&&rt.current()},activeSessionId:ye,sessions:Ot,busySessions:Gi}),i.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:le})]})}const YK=PI();II.createRoot(document.getElementById("root")).render(i.jsx(Lt.StrictMode,{children:i.jsx(DI,{initialLocale:YK,children:i.jsx(qI,{children:i.jsx(KK,{})})})}));export{YT as _,$o as g,hW as p};
|