@cnrai/pave 0.11.123 → 0.11.125
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/auth/auth.js +1 -1
- package/sandbox/auth/broker.js +1 -1
- package/sandbox/auth/proxy-fetch-3420.js +1 -1
- package/sandbox/auth/request-stamp.js +1 -0
- package/sandbox/tools/cross-session.js +1 -1
- package/sandbox/tools/session-rename.js +1 -1
- package/sandbox/tools/session-tools.js +1 -1
- package/sandbox/utils/request-origin.js +1 -0
- package/sandbox/utils/secure-fs.js +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-BBfTJPVA.js → abnfDiagram-VCTEODGH-Dw1JXKB0.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-DzKZ5dWH.js → architectureDiagram-5GKGNRK7-nykuu6kD.js} +1 -1
- package/web/assets/{blockDiagram-I7D4REHJ-CDmz6uQQ.js → blockDiagram-I7D4REHJ-BC8nPRtH.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-DTx5R1y6.js → c4Diagram-7LVT6UL2-DaLRI5Fn.js} +1 -1
- package/web/assets/channel-DAVZdW0z.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-DHZDcOmG.js → chunk-2Q5K7J3B-DOk1yJc8.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-QBXdFNj2.js → chunk-5VM5RSS4-Z1uolwqt.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-BvwmZZcB.js → chunk-F27PBJKO-CwpomFTE.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-CW0aMLs8.js → chunk-IMKFNOWR-MqW9Ciow.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-Dxg8xLH8.js → chunk-JWPE2WC7-C7480itu.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-CVyjxR-j.js → chunk-POPQ4Y6H-Dh2MynIg.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-BWMUiWWF.js → chunk-SVP7TREG-DbLHMsQP.js} +1 -1
- package/web/assets/{chunk-TICWLB2K-b5OcSUuo.js → chunk-TICWLB2K-DW_4BdOV.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-8xS0dxFb.js → chunk-XXDRQBXY-mLmi9-2Y.js} +1 -1
- package/web/assets/classDiagram-ZZMXUADV-CoOrb-Rp.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-CoOrb-Rp.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-BbfptGPS.js → cose-bilkent-JH36ORCC-Br6HG_O6.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-BII_7NLu.js → cynefin-OW5HDTMX-Cf7GhJQs.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-DvN_8b5B.js → cynefinDiagram-5FMLGOSQ-D6Jg8Fm0.js} +1 -1
- package/web/assets/{dagre-GXQ25YYZ-Dl6IguiC.js → dagre-GXQ25YYZ-QouvnnCz.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-DxdRhL4C.js → diagram-S7CK7UJ4-Dg1Klo6p.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-BYHpOfBw.js → diagram-UQ7AKVKN-DMseolod.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-BscbZ8pS.js → diagram-VSXAHHWV-BZodNcQI.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-Dtjx55Iv.js → diagram-VX7I27RA-B9oBk8V_.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-Bq2EjJTt.js → diagram-Z3DM3KII-aoOElnIh.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-cEdO94i3.js → ebnfDiagram-PWID7BFC-BcXiLuyO.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-B4oan-fG.js → erDiagram-RLTQ6QDP-Bq-gljSx.js} +1 -1
- package/web/assets/{flowDiagram-HODETNUW-DvznPUER.js → flowDiagram-HODETNUW-Chr19tN7.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-D4t5yt8Q.js → ganttDiagram-EL5Y4UJY-C--XHM8K.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-C47oN5yg.js → gitGraphDiagram-WWUBYQGX-DSbMqTiR.js} +1 -1
- package/web/assets/index-BYpdtrFS.css +10 -0
- package/web/assets/index-C9A8x6Gd.js +132 -0
- package/web/assets/{infoDiagram-27XIBGKW-BmQaVeNb.js → infoDiagram-27XIBGKW-CklT1VtS.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-EZSIhuZY.js → ishikawaDiagram-5VMMS53U-CC2r_ENg.js} +1 -1
- package/web/assets/{journeyDiagram-3NMN7TZE-r-1yeRyh.js → journeyDiagram-3NMN7TZE-BsagPQAu.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-l-cPbiaF.js → kanban-definition-UXKFOSKX-DuNfHaFy.js} +1 -1
- package/web/assets/{layout-yhS64J_g.js → layout-DJvQxZjr.js} +1 -1
- package/web/assets/{mermaid.core-Dia974Tc.js → mermaid.core-D71QvPWj.js} +5 -5
- package/web/assets/{mindmap-definition-YA3MSWOX-O1eHmh3D.js → mindmap-definition-YA3MSWOX-DB0OrZ-O.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-BI1YSoEd.js → pegDiagram-XKGWAZYB-DgLfThRp.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-0YWXhlQE.js → pieDiagram-E7YTZNPT-CMy6DAQr.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-DEZH9aug.js → quadrantDiagram-AXDQQJYC-DEl0NuNw.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-ywksjYpc.js → railroadDiagram-O6MQD6OU-9zFbTygi.js} +1 -1
- package/web/assets/{requirementDiagram-BXWQKSXE-nSqYHfIk.js → requirementDiagram-BXWQKSXE-DPKrP3wJ.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-BBER6TpP.js → sankeyDiagram-P5KCCOFB-DrXPms_h.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-GvWxmFa1.js → sequenceDiagram-WJ2MYXX4-B_M9IxAL.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-B1Xsf8WY.js → sizeCapture-INFHLROL-DtmNqlky.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-BnZqChrl.js → stateDiagram-D77RDMKH-DQpiZ1TE.js} +1 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-CLSdo41N.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-BSYWxSds.js → swimlanes-42K2YHIH-DyccrvFW.js} +1 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-C0W3hqW3.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-CViIjN-3.js → timeline-definition-24CTP7MA-CcxdevDC.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-BV2SQG6C.js → vennDiagram-4TSXK5OY-C70L0bG2.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-Cqczg_Oc.js → wardleyDiagram-VM6X3IG4-D6q6sD8O.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-hzcY75kh.js → xychartDiagram-S5SC5T6Z-DtsgbWqA.js} +1 -1
- package/web/assets/zh-TW-CSQwPgyX.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/channel-BJpYngYN.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-B8Q80mnV.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-B8Q80mnV.js +0 -1
- package/web/assets/index-Bdeb282X.css +0 -10
- package/web/assets/index-C0q_QjjY.js +0 -132
- package/web/assets/stateDiagram-v2-MP3YSRHH-C5k6A98o.js +0 -1
- package/web/assets/swimlanesDiagram-VR7AAH4N-0WIto4a2.js +0 -8
- package/web/assets/zh-TW-CqjxkWpy.js +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var sf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rg={exports:{}},Zc={},ig={exports:{}},En={};/**
|
|
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 sw;function lL(){if(sw)return En;sw=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;function m(W){return W===null||typeof W!="object"?null:(W=h&&W[h]||W["@@iterator"],typeof W=="function"?W:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,k={};function _(W,ee,F){this.props=W,this.context=ee,this.refs=k,this.updater=F||x}_.prototype.isReactComponent={},_.prototype.setState=function(W,ee){if(typeof W!="object"&&typeof W!="function"&&W!=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,W,ee,"setState")},_.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};function S(){}S.prototype=_.prototype;function w(W,ee,F){this.props=W,this.context=ee,this.refs=k,this.updater=F||x}var N=w.prototype=new S;N.constructor=w,v(N,_.prototype),N.isPureReactComponent=!0;var R=Array.isArray,T=Object.prototype.hasOwnProperty,C={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function I(W,ee,F){var J,q={},Y=null,oe=null;if(ee!=null)for(J in ee.ref!==void 0&&(oe=ee.ref),ee.key!==void 0&&(Y=""+ee.key),ee)T.call(ee,J)&&!M.hasOwnProperty(J)&&(q[J]=ee[J]);var _e=arguments.length-2;if(_e===1)q.children=F;else if(1<_e){for(var ae=Array(_e),ye=0;ye<_e;ye++)ae[ye]=arguments[ye+2];q.children=ae}if(W&&W.defaultProps)for(J in _e=W.defaultProps,_e)q[J]===void 0&&(q[J]=_e[J]);return{$$typeof:e,type:W,key:Y,ref:oe,props:q,_owner:C.current}}function A(W,ee){return{$$typeof:e,type:W.type,key:ee,ref:W.ref,props:W.props,_owner:W._owner}}function L(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function D(W){var ee={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(F){return ee[F]})}var $=/\/+/g;function te(W,ee){return typeof W=="object"&&W!==null&&W.key!=null?D(""+W.key):ee.toString(36)}function V(W,ee,F,J,q){var Y=typeof W;(Y==="undefined"||Y==="boolean")&&(W=null);var oe=!1;if(W===null)oe=!0;else switch(Y){case"string":case"number":oe=!0;break;case"object":switch(W.$$typeof){case e:case t:oe=!0}}if(oe)return oe=W,q=q(oe),W=J===""?"."+te(oe,0):J,R(q)?(F="",W!=null&&(F=W.replace($,"$&/")+"/"),V(q,ee,F,"",function(ye){return ye})):q!=null&&(L(q)&&(q=A(q,F+(!q.key||oe&&oe.key===q.key?"":(""+q.key).replace($,"$&/")+"/")+W)),ee.push(q)),1;if(oe=0,J=J===""?".":J+":",R(W))for(var _e=0;_e<W.length;_e++){Y=W[_e];var ae=J+te(Y,_e);oe+=V(Y,ee,F,ae,q)}else if(ae=m(W),typeof ae=="function")for(W=ae.call(W),_e=0;!(Y=W.next()).done;)Y=Y.value,ae=J+te(Y,_e++),oe+=V(Y,ee,F,ae,q);else if(Y==="object")throw ee=String(W),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.");return oe}function z(W,ee,F){if(W==null)return W;var J=[],q=0;return V(W,J,"","",function(Y){return ee.call(F,Y,q++)}),J}function G(W){if(W._status===-1){var ee=W._result;ee=ee(),ee.then(function(F){(W._status===0||W._status===-1)&&(W._status=1,W._result=F)},function(F){(W._status===0||W._status===-1)&&(W._status=2,W._result=F)}),W._status===-1&&(W._status=0,W._result=ee)}if(W._status===1)return W._result.default;throw W._result}var K={current:null},H={transition:null},se={ReactCurrentDispatcher:K,ReactCurrentBatchConfig:H,ReactCurrentOwner:C};function P(){throw Error("act(...) is not supported in production builds of React.")}return En.Children={map:z,forEach:function(W,ee,F){z(W,function(){ee.apply(this,arguments)},F)},count:function(W){var ee=0;return z(W,function(){ee++}),ee},toArray:function(W){return z(W,function(ee){return ee})||[]},only:function(W){if(!L(W))throw Error("React.Children.only expected to receive a single React element child.");return W}},En.Component=_,En.Fragment=n,En.Profiler=i,En.PureComponent=w,En.StrictMode=r,En.Suspense=d,En.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=se,En.act=P,En.cloneElement=function(W,ee,F){if(W==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+W+".");var J=v({},W.props),q=W.key,Y=W.ref,oe=W._owner;if(ee!=null){if(ee.ref!==void 0&&(Y=ee.ref,oe=C.current),ee.key!==void 0&&(q=""+ee.key),W.type&&W.type.defaultProps)var _e=W.type.defaultProps;for(ae in ee)T.call(ee,ae)&&!M.hasOwnProperty(ae)&&(J[ae]=ee[ae]===void 0&&_e!==void 0?_e[ae]:ee[ae])}var ae=arguments.length-2;if(ae===1)J.children=F;else if(1<ae){_e=Array(ae);for(var ye=0;ye<ae;ye++)_e[ye]=arguments[ye+2];J.children=_e}return{$$typeof:e,type:W.type,key:q,ref:Y,props:J,_owner:oe}},En.createContext=function(W){return W={$$typeof:l,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},W.Provider={$$typeof:o,_context:W},W.Consumer=W},En.createElement=I,En.createFactory=function(W){var ee=I.bind(null,W);return ee.type=W,ee},En.createRef=function(){return{current:null}},En.forwardRef=function(W){return{$$typeof:u,render:W}},En.isValidElement=L,En.lazy=function(W){return{$$typeof:p,_payload:{_status:-1,_result:W},_init:G}},En.memo=function(W,ee){return{$$typeof:f,type:W,compare:ee===void 0?null:ee}},En.startTransition=function(W){var ee=H.transition;H.transition={};try{W()}finally{H.transition=ee}},En.unstable_act=P,En.useCallback=function(W,ee){return K.current.useCallback(W,ee)},En.useContext=function(W){return K.current.useContext(W)},En.useDebugValue=function(){},En.useDeferredValue=function(W){return K.current.useDeferredValue(W)},En.useEffect=function(W,ee){return K.current.useEffect(W,ee)},En.useId=function(){return K.current.useId()},En.useImperativeHandle=function(W,ee,F){return K.current.useImperativeHandle(W,ee,F)},En.useInsertionEffect=function(W,ee){return K.current.useInsertionEffect(W,ee)},En.useLayoutEffect=function(W,ee){return K.current.useLayoutEffect(W,ee)},En.useMemo=function(W,ee){return K.current.useMemo(W,ee)},En.useReducer=function(W,ee,F){return K.current.useReducer(W,ee,F)},En.useRef=function(W){return K.current.useRef(W)},En.useState=function(W){return K.current.useState(W)},En.useSyncExternalStore=function(W,ee,F){return K.current.useSyncExternalStore(W,ee,F)},En.useTransition=function(){return K.current.useTransition()},En.version="18.3.1",En}var ow;function Ck(){return ow||(ow=1,ig.exports=lL()),ig.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 lw;function cL(){if(lw)return Zc;lw=1;var e=Ck(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,f){var p,h={},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)&&(h[p]=d[p]);if(u&&u.defaultProps)for(p in d=u.defaultProps,d)h[p]===void 0&&(h[p]=d[p]);return{$$typeof:t,type:u,key:m,ref:x,props:h,_owner:i.current}}return Zc.Fragment=n,Zc.jsx=l,Zc.jsxs=l,Zc}var cw;function uL(){return cw||(cw=1,rg.exports=cL()),rg.exports}var a=uL(),y=Ck();const Tt=tc(y);var of={},ag={exports:{}},Di={},sg={exports:{}},og={};/**
|
|
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 uw;function dL(){return uw||(uw=1,(function(e){function t(H,se){var P=H.length;H.push(se);e:for(;0<P;){var W=P-1>>>1,ee=H[W];if(0<i(ee,se))H[W]=se,H[P]=ee,P=W;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var se=H[0],P=H.pop();if(P!==se){H[0]=P;e:for(var W=0,ee=H.length,F=ee>>>1;W<F;){var J=2*(W+1)-1,q=H[J],Y=J+1,oe=H[Y];if(0>i(q,P))Y<ee&&0>i(oe,q)?(H[W]=oe,H[Y]=P,W=Y):(H[W]=q,H[J]=P,W=J);else if(Y<ee&&0>i(oe,P))H[W]=oe,H[Y]=P,W=Y;else break e}}return se}function i(H,se){var P=H.sortIndex-se.sortIndex;return P!==0?P:H.id-se.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,h=null,m=3,x=!1,v=!1,k=!1,_=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,w=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(H){for(var se=n(f);se!==null;){if(se.callback===null)r(f);else if(se.startTime<=H)r(f),se.sortIndex=se.expirationTime,t(d,se);else break;se=n(f)}}function R(H){if(k=!1,N(H),!v)if(n(d)!==null)v=!0,G(T);else{var se=n(f);se!==null&&K(R,se.startTime-H)}}function T(H,se){v=!1,k&&(k=!1,S(I),I=-1),x=!0;var P=m;try{for(N(se),h=n(d);h!==null&&(!(h.expirationTime>se)||H&&!D());){var W=h.callback;if(typeof W=="function"){h.callback=null,m=h.priorityLevel;var ee=W(h.expirationTime<=se);se=e.unstable_now(),typeof ee=="function"?h.callback=ee:h===n(d)&&r(d),N(se)}else r(d);h=n(d)}if(h!==null)var F=!0;else{var J=n(f);J!==null&&K(R,J.startTime-se),F=!1}return F}finally{h=null,m=P,x=!1}}var C=!1,M=null,I=-1,A=5,L=-1;function D(){return!(e.unstable_now()-L<A)}function $(){if(M!==null){var H=e.unstable_now();L=H;var se=!0;try{se=M(!0,H)}finally{se?te():(C=!1,M=null)}}else C=!1}var te;if(typeof w=="function")te=function(){w($)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,z=V.port2;V.port1.onmessage=$,te=function(){z.postMessage(null)}}else te=function(){_($,0)};function G(H){M=H,C||(C=!0,te())}function K(H,se){I=_(function(){H(e.unstable_now())},se)}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(H){H.callback=null},e.unstable_continueExecution=function(){v||x||(v=!0,G(T))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(H){switch(m){case 1:case 2:case 3:var se=3;break;default:se=m}var P=m;m=se;try{return H()}finally{m=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,se){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var P=m;m=H;try{return se()}finally{m=P}},e.unstable_scheduleCallback=function(H,se,P){var W=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?W+P:W):P=W,H){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=P+ee,H={id:p++,callback:se,priorityLevel:H,startTime:P,expirationTime:ee,sortIndex:-1},P>W?(H.sortIndex=P,t(f,H),n(d)===null&&H===n(f)&&(k?(S(I),I=-1):k=!0,K(R,P-W))):(H.sortIndex=ee,t(d,H),v||x||(v=!0,G(T))),H},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(H){var se=m;return function(){var P=m;m=se;try{return H.apply(this,arguments)}finally{m=P}}}})(og)),og}var dw;function fL(){return dw||(dw=1,sg.exports=dL()),sg.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 fw;function pL(){if(fw)return Di;fw=1;var e=Ck(),t=fL();function n(s){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+s,g=1;g<arguments.length;g++)c+="&args[]="+encodeURIComponent(arguments[g]);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,i={};function o(s,c){l(s,c),l(s+"Capture",c)}function l(s,c){for(i[s]=c,s=0;s<c.length;s++)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={},h={};function m(s){return d.call(h,s)?!0:d.call(p,s)?!1:f.test(s)?h[s]=!0:(p[s]=!0,!1)}function x(s,c,g,b){if(g!==null&&g.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return b?!1:g!==null?!g.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function v(s,c,g,b){if(c===null||typeof c>"u"||x(s,c,g,b))return!0;if(b)return!1;if(g!==null)switch(g.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,g,b,E,j,B){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=b,this.attributeNamespace=E,this.mustUseProperty=g,this.propertyName=s,this.type=c,this.sanitizeURL=j,this.removeEmptyString=B}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 S=/[\-:]([a-z])/g;function w(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(S,w);_[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(S,w);_[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(S,w);_[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,g,b){var E=_.hasOwnProperty(c)?_[c]:null;(E!==null?E.type!==0:b||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,g,E,b)&&(g=null),b||E===null?m(c)&&(g===null?s.removeAttribute(c):s.setAttribute(c,""+g)):E.mustUseProperty?s[E.propertyName]=g===null?E.type===3?!1:"":g:(c=E.attributeName,b=E.attributeNamespace,g===null?s.removeAttribute(c):(E=E.type,g=E===3||E===4&&g===!0?"":""+g,b?s.setAttributeNS(b,c,g):s.setAttribute(c,g))))}var R=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),C=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),D=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),H=Symbol.iterator;function se(s){return s===null||typeof s!="object"?null:(s=H&&s[H]||s["@@iterator"],typeof s=="function"?s:null)}var P=Object.assign,W;function ee(s){if(W===void 0)try{throw Error()}catch(g){var c=g.stack.trim().match(/\n( *(at )?)/);W=c&&c[1]||""}return`
|
|
34
|
+
`+W+s}var F=!1;function J(s,c){if(!s||F)return"";F=!0;var g=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(je){var b=je}Reflect.construct(s,[],c)}else{try{c.call()}catch(je){b=je}s.call(c.prototype)}else{try{throw Error()}catch(je){b=je}s()}}catch(je){if(je&&b&&typeof je.stack=="string"){for(var E=je.stack.split(`
|
|
35
|
+
`),j=b.stack.split(`
|
|
36
|
+
`),B=E.length-1,re=j.length-1;1<=B&&0<=re&&E[B]!==j[re];)re--;for(;1<=B&&0<=re;B--,re--)if(E[B]!==j[re]){if(B!==1||re!==1)do if(B--,re--,0>re||E[B]!==j[re]){var pe=`
|
|
37
|
+
`+E[B].replace(" at new "," at ");return s.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",s.displayName)),pe}while(1<=B&&0<=re);break}}}finally{F=!1,Error.prepareStackTrace=g}return(s=s?s.displayName||s.name:"")?ee(s):""}function q(s){switch(s.tag){case 5:return ee(s.type);case 16:return ee("Lazy");case 13:return ee("Suspense");case 19:return ee("SuspenseList");case 0:case 2:case 15:return s=J(s.type,!1),s;case 11:return s=J(s.type.render,!1),s;case 1:return s=J(s.type,!0),s;default:return""}}function Y(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 M:return"Fragment";case C:return"Portal";case A:return"Profiler";case I:return"StrictMode";case te:return"Suspense";case V:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case D:return(s.displayName||"Context")+".Consumer";case L:return(s._context.displayName||"Context")+".Provider";case $:var c=s.render;return s=s.displayName,s||(s=c.displayName||c.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case z:return c=s.displayName||null,c!==null?c:Y(s.type)||"Memo";case G:c=s._payload,s=s._init;try{return Y(s(c))}catch{}}return null}function oe(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 Y(c);case 8:return c===I?"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 _e(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ae(s){var c=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function ye(s){var c=ae(s)?"checked":"value",g=Object.getOwnPropertyDescriptor(s.constructor.prototype,c),b=""+s[c];if(!s.hasOwnProperty(c)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var E=g.get,j=g.set;return Object.defineProperty(s,c,{configurable:!0,get:function(){return E.call(this)},set:function(B){b=""+B,j.call(this,B)}}),Object.defineProperty(s,c,{enumerable:g.enumerable}),{getValue:function(){return b},setValue:function(B){b=""+B},stopTracking:function(){s._valueTracker=null,delete s[c]}}}}function Fe(s){s._valueTracker||(s._valueTracker=ye(s))}function ct(s){if(!s)return!1;var c=s._valueTracker;if(!c)return!0;var g=c.getValue(),b="";return s&&(b=ae(s)?s.checked?"true":"false":s.value),s=b,s!==g?(c.setValue(s),!0):!1}function ht(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 pt(s,c){var g=c.checked;return P({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??s._wrapperState.initialChecked})}function et(s,c){var g=c.defaultValue==null?"":c.defaultValue,b=c.checked!=null?c.checked:c.defaultChecked;g=_e(c.value!=null?c.value:g),s._wrapperState={initialChecked:b,initialValue:g,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function ze(s,c){c=c.checked,c!=null&&N(s,"checked",c,!1)}function Be(s,c){ze(s,c);var g=_e(c.value),b=c.type;if(g!=null)b==="number"?(g===0&&s.value===""||s.value!=g)&&(s.value=""+g):s.value!==""+g&&(s.value=""+g);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}c.hasOwnProperty("value")?lt(s,c.type,g):c.hasOwnProperty("defaultValue")&<(s,c.type,_e(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(s.defaultChecked=!!c.defaultChecked)}function At(s,c,g){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,g||c===s.value||(s.value=c),s.defaultValue=c}g=s.name,g!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,g!==""&&(s.name=g)}function lt(s,c,g){(c!=="number"||ht(s.ownerDocument)!==s)&&(g==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+g&&(s.defaultValue=""+g))}var on=Array.isArray;function _t(s,c,g,b){if(s=s.options,c){c={};for(var E=0;E<g.length;E++)c["$"+g[E]]=!0;for(g=0;g<s.length;g++)E=c.hasOwnProperty("$"+s[g].value),s[g].selected!==E&&(s[g].selected=E),E&&b&&(s[g].defaultSelected=!0)}else{for(g=""+_e(g),c=null,E=0;E<s.length;E++){if(s[E].value===g){s[E].selected=!0,b&&(s[E].defaultSelected=!0);return}c!==null||s[E].disabled||(c=s[E])}c!==null&&(c.selected=!0)}}function gn(s,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return P({},c,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Ht(s,c){var g=c.value;if(g==null){if(g=c.children,c=c.defaultValue,g!=null){if(c!=null)throw Error(n(92));if(on(g)){if(1<g.length)throw Error(n(93));g=g[0]}c=g}c==null&&(c=""),g=c}s._wrapperState={initialValue:_e(g)}}function Kt(s,c){var g=_e(c.value),b=_e(c.defaultValue);g!=null&&(g=""+g,g!==s.value&&(s.value=g),c.defaultValue==null&&s.defaultValue!==g&&(s.defaultValue=g)),b!=null&&(s.defaultValue=""+b)}function ut(s){var c=s.textContent;c===s._wrapperState.initialValue&&c!==""&&c!==null&&(s.value=c)}function Pe(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 le(s,c){return s==null||s==="http://www.w3.org/1999/xhtml"?Pe(c):s==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var be,fe=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,g,b,E){MSApp.execUnsafeLocalFunction(function(){return s(c,g,b,E)})}:s})(function(s,c){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=c;else{for(be=be||document.createElement("div"),be.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=be.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}});function Oe(s,c){if(c){var g=s.firstChild;if(g&&g===s.lastChild&&g.nodeType===3){g.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},gt=["Webkit","ms","Moz","O"];Object.keys(ft).forEach(function(s){gt.forEach(function(c){c=c+s.charAt(0).toUpperCase()+s.substring(1),ft[c]=ft[s]})});function dt(s,c,g){return c==null||typeof c=="boolean"||c===""?"":g||typeof c!="number"||c===0||ft.hasOwnProperty(s)&&ft[s]?(""+c).trim():c+"px"}function Lt(s,c){s=s.style;for(var g in c)if(c.hasOwnProperty(g)){var b=g.indexOf("--")===0,E=dt(g,c[g],b);g==="float"&&(g="cssFloat"),b?s.setProperty(g,E):s[g]=E}}var Wt=P({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 rt(s,c){if(c){if(Wt[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 wt(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 Yt=null;function an(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var kt=null,xe=null,De=null;function Ke(s){if(s=Ss(s)){if(typeof kt!="function")throw Error(n(280));var c=s.stateNode;c&&(c=Cl(c),kt(s.stateNode,s.type,c))}}function X(s){xe?De?De.push(s):De=[s]:xe=s}function Ee(){if(xe){var s=xe,c=De;if(De=xe=null,Ke(s),c)for(s=0;s<c.length;s++)Ke(c[s])}}function Te(s,c){return s(c)}function mt(){}var Ut=!1;function Rt(s,c,g){if(Ut)return s(c,g);Ut=!0;try{return Te(s,c,g)}finally{Ut=!1,(xe!==null||De!==null)&&(mt(),Ee())}}function st(s,c){var g=s.stateNode;if(g===null)return null;var b=Cl(g);if(b===null)return null;g=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(g&&typeof g!="function")throw Error(n(231,c,typeof g));return g}var ve=!1;if(u)try{var Re={};Object.defineProperty(Re,"passive",{get:function(){ve=!0}}),window.addEventListener("test",Re,Re),window.removeEventListener("test",Re,Re)}catch{ve=!1}function Xe(s,c,g,b,E,j,B,re,pe){var je=Array.prototype.slice.call(arguments,3);try{c.apply(g,je)}catch(We){this.onError(We)}}var Ie=!1,ie=null,Ct=!1,mn=null,Me={onError:function(s){Ie=!0,ie=s}};function Et(s,c,g,b,E,j,B,re,pe){Ie=!1,ie=null,Xe.apply(Me,arguments)}function kn(s,c,g,b,E,j,B,re,pe){if(Et.apply(this,arguments),Ie){if(Ie){var je=ie;Ie=!1,ie=null}else throw Error(n(198));Ct||(Ct=!0,mn=je)}}function Wn(s){var c=s,g=s;if(s.alternate)for(;c.return;)c=c.return;else{s=c;do c=s,(c.flags&4098)!==0&&(g=c.return),s=c.return;while(s)}return c.tag===3?g:null}function ki(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 kr(s){if(Wn(s)!==s)throw Error(n(188))}function dr(s){var c=s.alternate;if(!c){if(c=Wn(s),c===null)throw Error(n(188));return c!==s?null:s}for(var g=s,b=c;;){var E=g.return;if(E===null)break;var j=E.alternate;if(j===null){if(b=E.return,b!==null){g=b;continue}break}if(E.child===j.child){for(j=E.child;j;){if(j===g)return kr(E),s;if(j===b)return kr(E),c;j=j.sibling}throw Error(n(188))}if(g.return!==b.return)g=E,b=j;else{for(var B=!1,re=E.child;re;){if(re===g){B=!0,g=E,b=j;break}if(re===b){B=!0,b=E,g=j;break}re=re.sibling}if(!B){for(re=j.child;re;){if(re===g){B=!0,g=j,b=E;break}if(re===b){B=!0,b=j,g=E;break}re=re.sibling}if(!B)throw Error(n(189))}}if(g.alternate!==b)throw Error(n(190))}if(g.tag!==3)throw Error(n(188));return g.stateNode.current===g?s:c}function wa(s){return s=dr(s),s!==null?Bs(s):null}function Bs(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var c=Bs(s);if(c!==null)return c;s=s.sibling}return null}var $t=t.unstable_scheduleCallback,Kn=t.unstable_cancelCallback,Ui=t.unstable_shouldYield,fr=t.unstable_requestPaint,tn=t.unstable_now,ia=t.unstable_getCurrentPriorityLevel,aa=t.unstable_ImmediatePriority,qi=t.unstable_UserBlockingPriority,Hi=t.unstable_NormalPriority,Ye=t.unstable_LowPriority,Nt=t.unstable_IdlePriority,ln=null,vn=null;function Cn(s){if(vn&&typeof vn.onCommitFiberRoot=="function")try{vn.onCommitFiberRoot(ln,s,void 0,(s.current.flags&128)===128)}catch{}}var dn=Math.clz32?Math.clz32:_r,ri=Math.log,Nr=Math.LN2;function _r(s){return s>>>=0,s===0?32:31-(ri(s)/Nr|0)|0}var pr=64,Qr=4194304;function $r(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 _i(s,c){var g=s.pendingLanes;if(g===0)return 0;var b=0,E=s.suspendedLanes,j=s.pingedLanes,B=g&268435455;if(B!==0){var re=B&~E;re!==0?b=$r(re):(j&=B,j!==0&&(b=$r(j)))}else B=g&~E,B!==0?b=$r(B):j!==0&&(b=$r(j));if(b===0)return 0;if(c!==0&&c!==b&&(c&E)===0&&(E=b&-b,j=c&-c,E>=j||E===16&&(j&4194240)!==0))return c;if((b&4)!==0&&(b|=g&16),c=s.entangledLanes,c!==0)for(s=s.entanglements,c&=b;0<c;)g=31-dn(c),E=1<<g,b|=s[g],c&=~E;return b}function sa(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 wi(s,c){for(var g=s.suspendedLanes,b=s.pingedLanes,E=s.expirationTimes,j=s.pendingLanes;0<j;){var B=31-dn(j),re=1<<B,pe=E[B];pe===-1?((re&g)===0||(re&b)!==0)&&(E[B]=sa(re,c)):pe<=c&&(s.expiredLanes|=re),j&=~re}}function Si(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function $i(){var s=pr;return pr<<=1,(pr&4194240)===0&&(pr=64),s}function Or(s){for(var c=[],g=0;31>g;g++)c.push(s);return c}function Ei(s,c,g){s.pendingLanes|=c,c!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,c=31-dn(c),s[c]=g}function Dr(s,c){var g=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<g;){var E=31-dn(g),j=1<<E;c[E]=0,b[E]=-1,s[E]=-1,g&=~j}}function Sa(s,c){var g=s.entangledLanes|=c;for(s=s.entanglements;g;){var b=31-dn(g),E=1<<b;E&c|s[b]&c&&(s[b]|=c),g&=~E}}var _n=0;function Zt(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var ii,On,jn,or,Xr,Wr=!1,gi=[],ot=null,bt=null,qt=null,Qt=new Map,xn=new Map,Vn=[],Ea="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 lr(s,c){switch(s){case"focusin":case"focusout":ot=null;break;case"dragenter":case"dragleave":bt=null;break;case"mouseover":case"mouseout":qt=null;break;case"pointerover":case"pointerout":Qt.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":xn.delete(c.pointerId)}}function Ni(s,c,g,b,E,j){return s===null||s.nativeEvent!==j?(s={blockedOn:c,domEventName:g,eventSystemFlags:b,nativeEvent:j,targetContainers:[E]},c!==null&&(c=Ss(c),c!==null&&On(c)),s):(s.eventSystemFlags|=b,c=s.targetContainers,E!==null&&c.indexOf(E)===-1&&c.push(E),s)}function oa(s,c,g,b,E){switch(c){case"focusin":return ot=Ni(ot,s,c,g,b,E),!0;case"dragenter":return bt=Ni(bt,s,c,g,b,E),!0;case"mouseover":return qt=Ni(qt,s,c,g,b,E),!0;case"pointerover":var j=E.pointerId;return Qt.set(j,Ni(Qt.get(j)||null,s,c,g,b,E)),!0;case"gotpointercapture":return j=E.pointerId,xn.set(j,Ni(xn.get(j)||null,s,c,g,b,E)),!0}return!1}function us(s){var c=Ki(s.target);if(c!==null){var g=Wn(c);if(g!==null){if(c=g.tag,c===13){if(c=ki(g),c!==null){s.blockedOn=c,Xr(s.priority,function(){jn(g)});return}}else if(c===3&&g.stateNode.current.memoizedState.isDehydrated){s.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Ya(s){if(s.blockedOn!==null)return!1;for(var c=s.targetContainers;0<c.length;){var g=ps(s.domEventName,s.eventSystemFlags,c[0],s.nativeEvent);if(g===null){g=s.nativeEvent;var b=new g.constructor(g.type,g);Yt=b,g.target.dispatchEvent(b),Yt=null}else return c=Ss(g),c!==null&&On(c),s.blockedOn=g,!1;c.shift()}return!0}function Co(s,c,g){Ya(s)&&g.delete(c)}function la(){Wr=!1,ot!==null&&Ya(ot)&&(ot=null),bt!==null&&Ya(bt)&&(bt=null),qt!==null&&Ya(qt)&&(qt=null),Qt.forEach(Co),xn.forEach(Co)}function ds(s,c){s.blockedOn===c&&(s.blockedOn=null,Wr||(Wr=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,la)))}function Na(s){function c(E){return ds(E,s)}if(0<gi.length){ds(gi[0],s);for(var g=1;g<gi.length;g++){var b=gi[g];b.blockedOn===s&&(b.blockedOn=null)}}for(ot!==null&&ds(ot,s),bt!==null&&ds(bt,s),qt!==null&&ds(qt,s),Qt.forEach(c),xn.forEach(c),g=0;g<Vn.length;g++)b=Vn[g],b.blockedOn===s&&(b.blockedOn=null);for(;0<Vn.length&&(g=Vn[0],g.blockedOn===null);)us(g),g.blockedOn===null&&Vn.shift()}var Ci=R.ReactCurrentBatchConfig,Ca=!0;function fc(s,c,g,b){var E=_n,j=Ci.transition;Ci.transition=null;try{_n=1,fs(s,c,g,b)}finally{_n=E,Ci.transition=j}}function Qa(s,c,g,b){var E=_n,j=Ci.transition;Ci.transition=null;try{_n=4,fs(s,c,g,b)}finally{_n=E,Ci.transition=j}}function fs(s,c,g,b){if(Ca){var E=ps(s,c,g,b);if(E===null)Ks(s,c,b,yt,g),lr(s,b);else if(oa(E,s,c,g,b))b.stopPropagation();else if(lr(s,b),c&4&&-1<Ea.indexOf(s)){for(;E!==null;){var j=Ss(E);if(j!==null&&ii(j),j=ps(s,c,g,b),j===null&&Ks(s,c,b,yt,g),j===E)break;E=j}E!==null&&b.stopPropagation()}else Ks(s,c,b,null,g)}}var yt=null;function ps(s,c,g,b){if(yt=null,s=an(b),s=Ki(s),s!==null)if(c=Wn(s),c===null)s=null;else if(g=c.tag,g===13){if(s=ki(c),s!==null)return s;s=null}else if(g===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;s=null}else c!==s&&(s=null);return yt=s,null}function hs(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(ia()){case aa:return 1;case qi:return 4;case Hi:case Ye:return 16;case Nt:return 536870912;default:return 16}default:return 16}}var ji=null,jo=null,Ze=null;function U(){if(Ze)return Ze;var s,c=jo,g=c.length,b,E="value"in ji?ji.value:ji.textContent,j=E.length;for(s=0;s<g&&c[s]===E[s];s++);var B=g-s;for(b=1;b<=B&&c[g-b]===E[j-b];b++);return Ze=E.slice(s,1<b?1-b:void 0)}function he(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 Ce(){return!0}function Le(){return!1}function tt(s){function c(g,b,E,j,B){this._reactName=g,this._targetInst=E,this.type=b,this.nativeEvent=j,this.target=B,this.currentTarget=null;for(var re in s)s.hasOwnProperty(re)&&(g=s[re],this[re]=g?g(j):j[re]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?Ce:Le,this.isPropagationStopped=Le,this}return P(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=Ce)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=Ce)},persist:function(){},isPersistent:Ce}),c}var It={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dt=tt(It),Rn=P({},It,{view:0,detail:0}),Wi=tt(Rn),Cr,ai,Vr,zn=P({},Rn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:da,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!==Vr&&(Vr&&s.type==="mousemove"?(Cr=s.screenX-Vr.screenX,ai=s.screenY-Vr.screenY):ai=Cr=0,Vr=s),Cr)},movementY:function(s){return"movementY"in s?s.movementY:ai}}),ca=tt(zn),fl=P({},zn,{dataTransfer:0}),pl=tt(fl),To=P({},Rn,{relatedTarget:0}),ua=tt(To),Vi=P({},It,{animationName:0,elapsedTime:0,pseudoElement:0}),hl=tt(Vi),zs=P({},It,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Us=tt(zs),pc=P({},It,{data:0}),hc=tt(pc),Kp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gc={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"},Yp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qp(s){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(s):(s=Yp[s])?!!c[s]:!1}function da(){return Qp}var gl=P({},Rn,{key:function(s){if(s.key){var c=Kp[s.key]||s.key;if(c!=="Unidentified")return c}return s.type==="keypress"?(s=he(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?gc[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:da,charCode:function(s){return s.type==="keypress"?he(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?he(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Xp=tt(gl),ld=P({},zn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ro=tt(ld),cd=P({},Rn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:da}),Zp=tt(cd),ml=P({},It,{propertyName:0,elapsedTime:0,pseudoElement:0}),mc=tt(ml),ud=P({},zn,{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}),xc=tt(ud),yc=[9,13,27,32],xl=u&&"CompositionEvent"in window,gs=null;u&&"documentMode"in document&&(gs=document.documentMode);var Jp=u&&"TextEvent"in window&&!gs,dd=u&&(!xl||gs&&8<gs&&11>=gs),bc=" ",Ao=!1;function ms(s,c){switch(s){case"keyup":return yc.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vc(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var qs=!1;function fd(s,c){switch(s){case"compositionend":return vc(c);case"keypress":return c.which!==32?null:(Ao=!0,bc);case"textInput":return s=c.data,s===bc&&Ao?null:s;default:return null}}function xs(s,c){if(qs)return s==="compositionend"||!xl&&ms(s,c)?(s=U(),Ze=jo=ji=null,qs=!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 dd&&c.locale!=="ko"?null:c.data;default:return null}}var pd={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 kc(s){var c=s&&s.nodeName&&s.nodeName.toLowerCase();return c==="input"?!!pd[s.type]:c==="textarea"}function yl(s,c,g,b){X(b),c=Tr(c,"onChange"),0<c.length&&(g=new Dt("onChange","change",null,g,b),s.push({event:g,listeners:c}))}var Io=null,ys=null;function eh(s){Ra(s,0)}function Hs(s){var c=oi(s);if(ct(c))return s}function th(s,c){if(s==="change")return c}var bl=!1;if(u){var _c;if(u){var wc="oninput"in document;if(!wc){var hd=document.createElement("div");hd.setAttribute("oninput","return;"),wc=typeof hd.oninput=="function"}_c=wc}else _c=!1;bl=_c&&(!document.documentMode||9<document.documentMode)}function Sc(){Io&&(Io.detachEvent("onpropertychange",gd),ys=Io=null)}function gd(s){if(s.propertyName==="value"&&Hs(ys)){var c=[];yl(c,ys,s,an(s)),Rt(eh,c)}}function An(s,c,g){s==="focusin"?(Sc(),Io=c,ys=g,Io.attachEvent("onpropertychange",gd)):s==="focusout"&&Sc()}function nh(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Hs(ys)}function vl(s,c){if(s==="click")return Hs(c)}function jr(s,c){if(s==="input"||s==="change")return Hs(c)}function rh(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var Ti=typeof Object.is=="function"?Object.is:rh;function $s(s,c){if(Ti(s,c))return!0;if(typeof s!="object"||s===null||typeof c!="object"||c===null)return!1;var g=Object.keys(s),b=Object.keys(c);if(g.length!==b.length)return!1;for(b=0;b<g.length;b++){var E=g[b];if(!d.call(c,E)||!Ti(s[E],c[E]))return!1}return!0}function Ec(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Nc(s,c){var g=Ec(s);s=0;for(var b;g;){if(g.nodeType===3){if(b=s+g.textContent.length,s<=c&&b>=c)return{node:g,offset:c-s};s=b}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=Ec(g)}}function Cc(s,c){return s&&c?s===c?!0:s&&s.nodeType===3?!1:c&&c.nodeType===3?Cc(s,c.parentNode):"contains"in s?s.contains(c):s.compareDocumentPosition?!!(s.compareDocumentPosition(c)&16):!1:!1}function jc(){for(var s=window,c=ht();c instanceof s.HTMLIFrameElement;){try{var g=typeof c.contentWindow.location.href=="string"}catch{g=!1}if(g)s=c.contentWindow;else break;c=ht(s.document)}return c}function kl(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 md(s){var c=jc(),g=s.focusedElem,b=s.selectionRange;if(c!==g&&g&&g.ownerDocument&&Cc(g.ownerDocument.documentElement,g)){if(b!==null&&kl(g)){if(c=b.start,s=b.end,s===void 0&&(s=c),"selectionStart"in g)g.selectionStart=c,g.selectionEnd=Math.min(s,g.value.length);else if(s=(c=g.ownerDocument||document)&&c.defaultView||window,s.getSelection){s=s.getSelection();var E=g.textContent.length,j=Math.min(b.start,E);b=b.end===void 0?j:Math.min(b.end,E),!s.extend&&j>b&&(E=b,b=j,j=E),E=Nc(g,j);var B=Nc(g,b);E&&B&&(s.rangeCount!==1||s.anchorNode!==E.node||s.anchorOffset!==E.offset||s.focusNode!==B.node||s.focusOffset!==B.offset)&&(c=c.createRange(),c.setStart(E.node,E.offset),s.removeAllRanges(),j>b?(s.addRange(c),s.extend(B.node,B.offset)):(c.setEnd(B.node,B.offset),s.addRange(c)))}}for(c=[],s=g;s=s.parentNode;)s.nodeType===1&&c.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<c.length;g++)s=c[g],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var xd=u&&"documentMode"in document&&11>=document.documentMode,bs=null,Pt=null,Ws=null,Zr=!1;function yd(s,c,g){var b=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;Zr||bs==null||bs!==ht(b)||(b=bs,"selectionStart"in b&&kl(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}),Ws&&$s(Ws,b)||(Ws=b,b=Tr(Pt,"onSelect"),0<b.length&&(c=new Dt("onSelect","select",null,c,g),s.push({event:c,listeners:b}),c.target=bs)))}function Vs(s,c){var g={};return g[s.toLowerCase()]=c.toLowerCase(),g["Webkit"+s]="webkit"+c,g["Moz"+s]="moz"+c,g}var Xa={animationend:Vs("Animation","AnimationEnd"),animationiteration:Vs("Animation","AnimationIteration"),animationstart:Vs("Animation","AnimationStart"),transitionend:Vs("Transition","TransitionEnd")},Za={},bd={};u&&(bd=document.createElement("div").style,"AnimationEvent"in window||(delete Xa.animationend.animation,delete Xa.animationiteration.animation,delete Xa.animationstart.animation),"TransitionEvent"in window||delete Xa.transitionend.transition);function Gi(s){if(Za[s])return Za[s];if(!Xa[s])return s;var c=Xa[s],g;for(g in c)if(c.hasOwnProperty(g)&&g in bd)return Za[s]=c[g];return s}var _l=Gi("animationend"),Ri=Gi("animationiteration"),Mo=Gi("animationstart"),wl=Gi("transitionend"),Sl=new Map,vd="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 ja(s,c){Sl.set(s,c),o(c,[s])}for(var Gs=0;Gs<vd.length;Gs++){var vs=vd[Gs],ih=vs.toLowerCase(),Tc=vs[0].toUpperCase()+vs.slice(1);ja(ih,"on"+Tc)}ja(_l,"onAnimationEnd"),ja(Ri,"onAnimationIteration"),ja(Mo,"onAnimationStart"),ja("dblclick","onDoubleClick"),ja("focusin","onFocus"),ja("focusout","onBlur"),ja(wl,"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 Ta="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(" "),ah=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ta));function El(s,c,g){var b=s.type||"unknown-event";s.currentTarget=g,kn(b,c,void 0,s),s.currentTarget=null}function Ra(s,c){c=(c&4)!==0;for(var g=0;g<s.length;g++){var b=s[g],E=b.event;b=b.listeners;e:{var j=void 0;if(c)for(var B=b.length-1;0<=B;B--){var re=b[B],pe=re.instance,je=re.currentTarget;if(re=re.listener,pe!==j&&E.isPropagationStopped())break e;El(E,re,je),j=pe}else for(B=0;B<b.length;B++){if(re=b[B],pe=re.instance,je=re.currentTarget,re=re.listener,pe!==j&&E.isPropagationStopped())break e;El(E,re,je),j=pe}}}if(Ct)throw s=mn,Ct=!1,mn=null,s}function Yn(s,c){var g=c[ws];g===void 0&&(g=c[ws]=new Set);var b=s+"__bubble";g.has(b)||(kd(c,s,2,!1),g.add(b))}function Rc(s,c,g){var b=0;c&&(b|=4),kd(g,s,b,c)}var si="_reactListening"+Math.random().toString(36).slice(2);function ks(s){if(!s[si]){s[si]=!0,r.forEach(function(g){g!=="selectionchange"&&(ah.has(g)||Rc(g,!1,s),Rc(g,!0,s))});var c=s.nodeType===9?s:s.ownerDocument;c===null||c[si]||(c[si]=!0,Rc("selectionchange",!1,c))}}function kd(s,c,g,b){switch(hs(c)){case 1:var E=fc;break;case 4:E=Qa;break;default:E=fs}g=E.bind(null,c,g,s),E=void 0,!ve||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(E=!0),b?E!==void 0?s.addEventListener(c,g,{capture:!0,passive:E}):s.addEventListener(c,g,!0):E!==void 0?s.addEventListener(c,g,{passive:E}):s.addEventListener(c,g,!1)}function Ks(s,c,g,b,E){var j=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var B=b.tag;if(B===3||B===4){var re=b.stateNode.containerInfo;if(re===E||re.nodeType===8&&re.parentNode===E)break;if(B===4)for(B=b.return;B!==null;){var pe=B.tag;if((pe===3||pe===4)&&(pe=B.stateNode.containerInfo,pe===E||pe.nodeType===8&&pe.parentNode===E))return;B=B.return}for(;re!==null;){if(B=Ki(re),B===null)return;if(pe=B.tag,pe===5||pe===6){b=j=B;continue e}re=re.parentNode}}b=b.return}Rt(function(){var je=j,We=an(g),Qe=[];e:{var $e=Sl.get(s);if($e!==void 0){var St=Dt,Mt=s;switch(s){case"keypress":if(he(g)===0)break e;case"keydown":case"keyup":St=Xp;break;case"focusin":Mt="focus",St=ua;break;case"focusout":Mt="blur",St=ua;break;case"beforeblur":case"afterblur":St=ua;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":St=ca;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":St=pl;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":St=Zp;break;case _l:case Ri:case Mo:St=hl;break;case wl:St=mc;break;case"scroll":St=Wi;break;case"wheel":St=xc;break;case"copy":case"cut":case"paste":St=Us;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":St=Ro}var Ot=(c&4)!==0,wr=!Ot&&s==="scroll",ke=Ot?$e!==null?$e+"Capture":null:$e;Ot=[];for(var ge=je,Se;ge!==null;){Se=ge;var at=Se.stateNode;if(Se.tag===5&&at!==null&&(Se=at,ke!==null&&(at=st(ge,ke),at!=null&&Ot.push(_s(ge,at,Se)))),wr)break;ge=ge.return}0<Ot.length&&($e=new St($e,Mt,null,g,We),Qe.push({event:$e,listeners:Ot}))}}if((c&7)===0){e:{if($e=s==="mouseover"||s==="pointerover",St=s==="mouseout"||s==="pointerout",$e&&g!==Yt&&(Mt=g.relatedTarget||g.fromElement)&&(Ki(Mt)||Mt[Ia]))break e;if((St||$e)&&($e=We.window===We?We:($e=We.ownerDocument)?$e.defaultView||$e.parentWindow:window,St?(Mt=g.relatedTarget||g.toElement,St=je,Mt=Mt?Ki(Mt):null,Mt!==null&&(wr=Wn(Mt),Mt!==wr||Mt.tag!==5&&Mt.tag!==6)&&(Mt=null)):(St=null,Mt=je),St!==Mt)){if(Ot=ca,at="onMouseLeave",ke="onMouseEnter",ge="mouse",(s==="pointerout"||s==="pointerover")&&(Ot=Ro,at="onPointerLeave",ke="onPointerEnter",ge="pointer"),wr=St==null?$e:oi(St),Se=Mt==null?$e:oi(Mt),$e=new Ot(at,ge+"leave",St,g,We),$e.target=wr,$e.relatedTarget=Se,at=null,Ki(We)===je&&(Ot=new Ot(ke,ge+"enter",Mt,g,We),Ot.target=Se,Ot.relatedTarget=wr,at=Ot),wr=at,St&&Mt)t:{for(Ot=St,ke=Mt,ge=0,Se=Ot;Se;Se=Ys(Se))ge++;for(Se=0,at=ke;at;at=Ys(at))Se++;for(;0<ge-Se;)Ot=Ys(Ot),ge--;for(;0<Se-ge;)ke=Ys(ke),Se--;for(;ge--;){if(Ot===ke||ke!==null&&Ot===ke.alternate)break t;Ot=Ys(Ot),ke=Ys(ke)}Ot=null}else Ot=null;St!==null&&_d(Qe,$e,St,Ot,!1),Mt!==null&&wr!==null&&_d(Qe,wr,Mt,Ot,!0)}}e:{if($e=je?oi(je):window,St=$e.nodeName&&$e.nodeName.toLowerCase(),St==="select"||St==="input"&&$e.type==="file")var Bt=th;else if(kc($e))if(bl)Bt=jr;else{Bt=nh;var Jt=An}else(St=$e.nodeName)&&St.toLowerCase()==="input"&&($e.type==="checkbox"||$e.type==="radio")&&(Bt=vl);if(Bt&&(Bt=Bt(s,je))){yl(Qe,Bt,g,We);break e}Jt&&Jt(s,$e,je),s==="focusout"&&(Jt=$e._wrapperState)&&Jt.controlled&&$e.type==="number"&<($e,"number",$e.value)}switch(Jt=je?oi(je):window,s){case"focusin":(kc(Jt)||Jt.contentEditable==="true")&&(bs=Jt,Pt=je,Ws=null);break;case"focusout":Ws=Pt=bs=null;break;case"mousedown":Zr=!0;break;case"contextmenu":case"mouseup":case"dragend":Zr=!1,yd(Qe,g,We);break;case"selectionchange":if(xd)break;case"keydown":case"keyup":yd(Qe,g,We)}var en;if(xl)e:{switch(s){case"compositionstart":var sn="onCompositionStart";break e;case"compositionend":sn="onCompositionEnd";break e;case"compositionupdate":sn="onCompositionUpdate";break e}sn=void 0}else qs?ms(s,g)&&(sn="onCompositionEnd"):s==="keydown"&&g.keyCode===229&&(sn="onCompositionStart");sn&&(dd&&g.locale!=="ko"&&(qs||sn!=="onCompositionStart"?sn==="onCompositionEnd"&&qs&&(en=U()):(ji=We,jo="value"in ji?ji.value:ji.textContent,qs=!0)),Jt=Tr(je,sn),0<Jt.length&&(sn=new hc(sn,s,null,g,We),Qe.push({event:sn,listeners:Jt}),en?sn.data=en:(en=vc(g),en!==null&&(sn.data=en)))),(en=Jp?fd(s,g):xs(s,g))&&(je=Tr(je,"onBeforeInput"),0<je.length&&(We=new hc("onBeforeInput","beforeinput",null,g,We),Qe.push({event:We,listeners:je}),We.data=en))}Ra(Qe,c)})}function _s(s,c,g){return{instance:s,listener:c,currentTarget:g}}function Tr(s,c){for(var g=c+"Capture",b=[];s!==null;){var E=s,j=E.stateNode;E.tag===5&&j!==null&&(E=j,j=st(s,g),j!=null&&b.unshift(_s(s,j,E)),j=st(s,c),j!=null&&b.push(_s(s,j,E))),s=s.return}return b}function Ys(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function _d(s,c,g,b,E){for(var j=c._reactName,B=[];g!==null&&g!==b;){var re=g,pe=re.alternate,je=re.stateNode;if(pe!==null&&pe===b)break;re.tag===5&&je!==null&&(re=je,E?(pe=st(g,j),pe!=null&&B.unshift(_s(g,pe,re))):E||(pe=st(g,j),pe!=null&&B.push(_s(g,pe,re)))),g=g.return}B.length!==0&&s.push({event:c,listeners:B})}var sh=/\r\n?/g,oh=/\u0000|\uFFFD/g;function Ac(s){return(typeof s=="string"?s:""+s).replace(sh,`
|
|
38
|
+
`).replace(oh,"")}function Lo(s,c,g){if(c=Ac(c),Ac(s)!==c&&g)throw Error(n(425))}function Nl(){}var fa=null,Ic=null;function Mc(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 Lc=typeof setTimeout=="function"?setTimeout:void 0,lh=typeof clearTimeout=="function"?clearTimeout:void 0,wd=typeof Promise=="function"?Promise:void 0,ch=typeof queueMicrotask=="function"?queueMicrotask:typeof wd<"u"?function(s){return wd.resolve(null).then(s).catch(Sd)}:Lc;function Sd(s){setTimeout(function(){throw s})}function Qs(s,c){var g=c,b=0;do{var E=g.nextSibling;if(s.removeChild(g),E&&E.nodeType===8)if(g=E.data,g==="/$"){if(b===0){s.removeChild(E),Na(c);return}b--}else g!=="$"&&g!=="$?"&&g!=="$!"||b++;g=E}while(g);Na(c)}function Aa(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 Oc(s){s=s.previousSibling;for(var c=0;s;){if(s.nodeType===8){var g=s.data;if(g==="$"||g==="$!"||g==="$?"){if(c===0)return s;c--}else g==="/$"&&c++}s=s.previousSibling}return null}var Xs=Math.random().toString(36).slice(2),pa="__reactFiber$"+Xs,Oo="__reactProps$"+Xs,Ia="__reactContainer$"+Xs,ws="__reactEvents$"+Xs,uh="__reactListeners$"+Xs,dh="__reactHandles$"+Xs;function Ki(s){var c=s[pa];if(c)return c;for(var g=s.parentNode;g;){if(c=g[Ia]||g[pa]){if(g=c.alternate,c.child!==null||g!==null&&g.child!==null)for(s=Oc(s);s!==null;){if(g=s[pa])return g;s=Oc(s)}return c}s=g,g=s.parentNode}return null}function Ss(s){return s=s[pa]||s[Ia],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function oi(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function Cl(s){return s[Oo]||null}var Dc=[],Zs=-1;function Ja(s){return{current:s}}function Qn(s){0>Zs||(s.current=Dc[Zs],Dc[Zs]=null,Zs--)}function Sn(s,c){Zs++,Dc[Zs]=s.current,s.current=c}var Ai={},Rr=Ja(Ai),li=Ja(!1),Es=Ai;function Yi(s,c){var g=s.type.contextTypes;if(!g)return Ai;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===c)return b.__reactInternalMemoizedMaskedChildContext;var E={},j;for(j in g)E[j]=c[j];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=c,s.__reactInternalMemoizedMaskedChildContext=E),E}function ci(s){return s=s.childContextTypes,s!=null}function Js(){Qn(li),Qn(Rr)}function Ed(s,c,g){if(Rr.current!==Ai)throw Error(n(168));Sn(Rr,c),Sn(li,g)}function Nd(s,c,g){var b=s.stateNode;if(c=c.childContextTypes,typeof b.getChildContext!="function")return g;b=b.getChildContext();for(var E in b)if(!(E in c))throw Error(n(108,oe(s)||"Unknown",E));return P({},g,b)}function jl(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Ai,Es=Rr.current,Sn(Rr,s),Sn(li,li.current),!0}function Cd(s,c,g){var b=s.stateNode;if(!b)throw Error(n(169));g?(s=Nd(s,c,Es),b.__reactInternalMemoizedMergedChildContext=s,Qn(li),Qn(Rr),Sn(Rr,s)):Qn(li),Sn(li,g)}var ha=null,Ns=!1,Cs=!1;function Do(s){ha===null?ha=[s]:ha.push(s)}function jd(s){Ns=!0,Do(s)}function Ma(){if(!Cs&&ha!==null){Cs=!0;var s=0,c=_n;try{var g=ha;for(_n=1;s<g.length;s++){var b=g[s];do b=b(!0);while(b!==null)}ha=null,Ns=!1}catch(E){throw ha!==null&&(ha=ha.slice(s+1)),$t(aa,Ma),E}finally{_n=c,Cs=!1}}return null}var js=[],O=0,Q=null,ne=0,ce=[],de=0,Ae=null,we=1,xt="";function Ue(s,c){js[O++]=ne,js[O++]=Q,Q=s,ne=c}function Un(s,c,g){ce[de++]=we,ce[de++]=xt,ce[de++]=Ae,Ae=s;var b=we;s=xt;var E=32-dn(b)-1;b&=~(1<<E),g+=1;var j=32-dn(c)+E;if(30<j){var B=E-E%5;j=(b&(1<<B)-1).toString(32),b>>=B,E-=B,we=1<<32-dn(c)+E|g<<E|b,xt=j+s}else we=1<<j|g<<E|b,xt=s}function In(s){s.return!==null&&(Ue(s,1),Un(s,1,0))}function cr(s){for(;s===Q;)Q=js[--O],js[O]=null,ne=js[--O],js[O]=null;for(;s===Ae;)Ae=ce[--de],ce[de]=null,xt=ce[--de],ce[de]=null,we=ce[--de],ce[de]=null}var me=null,Z=null,ue=!1,Ne=null;function Ge(s,c){var g=ya(5,null,null,0);g.elementType="DELETED",g.stateNode=c,g.return=s,c=s.deletions,c===null?(s.deletions=[g],s.flags|=16):c.push(g)}function He(s,c){switch(s.tag){case 5:var g=s.type;return c=c.nodeType!==1||g.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(s.stateNode=c,me=s,Z=Aa(c.firstChild),!0):!1;case 6:return c=s.pendingProps===""||c.nodeType!==3?null:c,c!==null?(s.stateNode=c,me=s,Z=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(g=Ae!==null?{id:we,overflow:xt}:null,s.memoizedState={dehydrated:c,treeContext:g,retryLane:1073741824},g=ya(18,null,null,0),g.stateNode=c,g.return=s,s.child=g,me=s,Z=null,!0):!1;default:return!1}}function it(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Vt(s){if(ue){var c=Z;if(c){var g=c;if(!He(s,c)){if(it(s))throw Error(n(418));c=Aa(g.nextSibling);var b=me;c&&He(s,c)?Ge(b,g):(s.flags=s.flags&-4097|2,ue=!1,me=s)}}else{if(it(s))throw Error(n(418));s.flags=s.flags&-4097|2,ue=!1,me=s}}}function zt(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;me=s}function fn(s){if(s!==me)return!1;if(!ue)return zt(s),ue=!0,!1;var c;if((c=s.tag!==3)&&!(c=s.tag!==5)&&(c=s.type,c=c!=="head"&&c!=="body"&&!Mc(s.type,s.memoizedProps)),c&&(c=Z)){if(it(s))throw qn(),Error(n(418));for(;c;)Ge(s,c),c=Aa(c.nextSibling)}if(zt(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 g=s.data;if(g==="/$"){if(c===0){Z=Aa(s.nextSibling);break e}c--}else g!=="$"&&g!=="$!"&&g!=="$?"||c++}s=s.nextSibling}Z=null}}else Z=me?Aa(s.stateNode.nextSibling):null;return!0}function qn(){for(var s=Z;s;)s=Aa(s.nextSibling)}function Hn(){Z=me=null,ue=!1}function hr(s){Ne===null?Ne=[s]:Ne.push(s)}var Pr=R.ReactCurrentBatchConfig;function eo(s,c,g){if(s=g.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(g._owner){if(g=g._owner,g){if(g.tag!==1)throw Error(n(309));var b=g.stateNode}if(!b)throw Error(n(147,s));var E=b,j=""+s;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===j?c.ref:(c=function(B){var re=E.refs;B===null?delete re[j]:re[j]=B},c._stringRef=j,c)}if(typeof s!="string")throw Error(n(284));if(!g._owner)throw Error(n(290,s))}return s}function Ii(s,c){throw s=Object.prototype.toString.call(c),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":s))}function Pc(s){var c=s._init;return c(s._payload)}function Tl(s){function c(ke,ge){if(s){var Se=ke.deletions;Se===null?(ke.deletions=[ge],ke.flags|=16):Se.push(ge)}}function g(ke,ge){if(!s)return null;for(;ge!==null;)c(ke,ge),ge=ge.sibling;return null}function b(ke,ge){for(ke=new Map;ge!==null;)ge.key!==null?ke.set(ge.key,ge):ke.set(ge.index,ge),ge=ge.sibling;return ke}function E(ke,ge){return ke=lo(ke,ge),ke.index=0,ke.sibling=null,ke}function j(ke,ge,Se){return ke.index=Se,s?(Se=ke.alternate,Se!==null?(Se=Se.index,Se<ge?(ke.flags|=2,ge):Se):(ke.flags|=2,ge)):(ke.flags|=1048576,ge)}function B(ke){return s&&ke.alternate===null&&(ke.flags|=2),ke}function re(ke,ge,Se,at){return ge===null||ge.tag!==6?(ge=Xh(Se,ke.mode,at),ge.return=ke,ge):(ge=E(ge,Se),ge.return=ke,ge)}function pe(ke,ge,Se,at){var Bt=Se.type;return Bt===M?We(ke,ge,Se.props.children,at,Se.key):ge!==null&&(ge.elementType===Bt||typeof Bt=="object"&&Bt!==null&&Bt.$$typeof===G&&Pc(Bt)===ge.type)?(at=E(ge,Se.props),at.ref=eo(ke,ge,Se),at.return=ke,at):(at=Xd(Se.type,Se.key,Se.props,null,ke.mode,at),at.ref=eo(ke,ge,Se),at.return=ke,at)}function je(ke,ge,Se,at){return ge===null||ge.tag!==4||ge.stateNode.containerInfo!==Se.containerInfo||ge.stateNode.implementation!==Se.implementation?(ge=Zh(Se,ke.mode,at),ge.return=ke,ge):(ge=E(ge,Se.children||[]),ge.return=ke,ge)}function We(ke,ge,Se,at,Bt){return ge===null||ge.tag!==7?(ge=Wo(Se,ke.mode,at,Bt),ge.return=ke,ge):(ge=E(ge,Se),ge.return=ke,ge)}function Qe(ke,ge,Se){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return ge=Xh(""+ge,ke.mode,Se),ge.return=ke,ge;if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case T:return Se=Xd(ge.type,ge.key,ge.props,null,ke.mode,Se),Se.ref=eo(ke,null,ge),Se.return=ke,Se;case C:return ge=Zh(ge,ke.mode,Se),ge.return=ke,ge;case G:var at=ge._init;return Qe(ke,at(ge._payload),Se)}if(on(ge)||se(ge))return ge=Wo(ge,ke.mode,Se,null),ge.return=ke,ge;Ii(ke,ge)}return null}function $e(ke,ge,Se,at){var Bt=ge!==null?ge.key:null;if(typeof Se=="string"&&Se!==""||typeof Se=="number")return Bt!==null?null:re(ke,ge,""+Se,at);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case T:return Se.key===Bt?pe(ke,ge,Se,at):null;case C:return Se.key===Bt?je(ke,ge,Se,at):null;case G:return Bt=Se._init,$e(ke,ge,Bt(Se._payload),at)}if(on(Se)||se(Se))return Bt!==null?null:We(ke,ge,Se,at,null);Ii(ke,Se)}return null}function St(ke,ge,Se,at,Bt){if(typeof at=="string"&&at!==""||typeof at=="number")return ke=ke.get(Se)||null,re(ge,ke,""+at,Bt);if(typeof at=="object"&&at!==null){switch(at.$$typeof){case T:return ke=ke.get(at.key===null?Se:at.key)||null,pe(ge,ke,at,Bt);case C:return ke=ke.get(at.key===null?Se:at.key)||null,je(ge,ke,at,Bt);case G:var Jt=at._init;return St(ke,ge,Se,Jt(at._payload),Bt)}if(on(at)||se(at))return ke=ke.get(Se)||null,We(ge,ke,at,Bt,null);Ii(ge,at)}return null}function Mt(ke,ge,Se,at){for(var Bt=null,Jt=null,en=ge,sn=ge=0,Yr=null;en!==null&&sn<Se.length;sn++){en.index>sn?(Yr=en,en=null):Yr=en.sibling;var Dn=$e(ke,en,Se[sn],at);if(Dn===null){en===null&&(en=Yr);break}s&&en&&Dn.alternate===null&&c(ke,en),ge=j(Dn,ge,sn),Jt===null?Bt=Dn:Jt.sibling=Dn,Jt=Dn,en=Yr}if(sn===Se.length)return g(ke,en),ue&&Ue(ke,sn),Bt;if(en===null){for(;sn<Se.length;sn++)en=Qe(ke,Se[sn],at),en!==null&&(ge=j(en,ge,sn),Jt===null?Bt=en:Jt.sibling=en,Jt=en);return ue&&Ue(ke,sn),Bt}for(en=b(ke,en);sn<Se.length;sn++)Yr=St(en,ke,sn,Se[sn],at),Yr!==null&&(s&&Yr.alternate!==null&&en.delete(Yr.key===null?sn:Yr.key),ge=j(Yr,ge,sn),Jt===null?Bt=Yr:Jt.sibling=Yr,Jt=Yr);return s&&en.forEach(function(co){return c(ke,co)}),ue&&Ue(ke,sn),Bt}function Ot(ke,ge,Se,at){var Bt=se(Se);if(typeof Bt!="function")throw Error(n(150));if(Se=Bt.call(Se),Se==null)throw Error(n(151));for(var Jt=Bt=null,en=ge,sn=ge=0,Yr=null,Dn=Se.next();en!==null&&!Dn.done;sn++,Dn=Se.next()){en.index>sn?(Yr=en,en=null):Yr=en.sibling;var co=$e(ke,en,Dn.value,at);if(co===null){en===null&&(en=Yr);break}s&&en&&co.alternate===null&&c(ke,en),ge=j(co,ge,sn),Jt===null?Bt=co:Jt.sibling=co,Jt=co,en=Yr}if(Dn.done)return g(ke,en),ue&&Ue(ke,sn),Bt;if(en===null){for(;!Dn.done;sn++,Dn=Se.next())Dn=Qe(ke,Dn.value,at),Dn!==null&&(ge=j(Dn,ge,sn),Jt===null?Bt=Dn:Jt.sibling=Dn,Jt=Dn);return ue&&Ue(ke,sn),Bt}for(en=b(ke,en);!Dn.done;sn++,Dn=Se.next())Dn=St(en,ke,sn,Dn.value,at),Dn!==null&&(s&&Dn.alternate!==null&&en.delete(Dn.key===null?sn:Dn.key),ge=j(Dn,ge,sn),Jt===null?Bt=Dn:Jt.sibling=Dn,Jt=Dn);return s&&en.forEach(function(oL){return c(ke,oL)}),ue&&Ue(ke,sn),Bt}function wr(ke,ge,Se,at){if(typeof Se=="object"&&Se!==null&&Se.type===M&&Se.key===null&&(Se=Se.props.children),typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case T:e:{for(var Bt=Se.key,Jt=ge;Jt!==null;){if(Jt.key===Bt){if(Bt=Se.type,Bt===M){if(Jt.tag===7){g(ke,Jt.sibling),ge=E(Jt,Se.props.children),ge.return=ke,ke=ge;break e}}else if(Jt.elementType===Bt||typeof Bt=="object"&&Bt!==null&&Bt.$$typeof===G&&Pc(Bt)===Jt.type){g(ke,Jt.sibling),ge=E(Jt,Se.props),ge.ref=eo(ke,Jt,Se),ge.return=ke,ke=ge;break e}g(ke,Jt);break}else c(ke,Jt);Jt=Jt.sibling}Se.type===M?(ge=Wo(Se.props.children,ke.mode,at,Se.key),ge.return=ke,ke=ge):(at=Xd(Se.type,Se.key,Se.props,null,ke.mode,at),at.ref=eo(ke,ge,Se),at.return=ke,ke=at)}return B(ke);case C:e:{for(Jt=Se.key;ge!==null;){if(ge.key===Jt)if(ge.tag===4&&ge.stateNode.containerInfo===Se.containerInfo&&ge.stateNode.implementation===Se.implementation){g(ke,ge.sibling),ge=E(ge,Se.children||[]),ge.return=ke,ke=ge;break e}else{g(ke,ge);break}else c(ke,ge);ge=ge.sibling}ge=Zh(Se,ke.mode,at),ge.return=ke,ke=ge}return B(ke);case G:return Jt=Se._init,wr(ke,ge,Jt(Se._payload),at)}if(on(Se))return Mt(ke,ge,Se,at);if(se(Se))return Ot(ke,ge,Se,at);Ii(ke,Se)}return typeof Se=="string"&&Se!==""||typeof Se=="number"?(Se=""+Se,ge!==null&&ge.tag===6?(g(ke,ge.sibling),ge=E(ge,Se),ge.return=ke,ke=ge):(g(ke,ge),ge=Xh(Se,ke.mode,at),ge.return=ke,ke=ge),B(ke)):g(ke,ge)}return wr}var ga=Tl(!0),Td=Tl(!1),Po=Ja(null),Fo=null,es=null,Rl=null;function Al(){Rl=es=Fo=null}function Il(s){var c=Po.current;Qn(Po),s._currentValue=c}function Fr(s,c,g){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===g)break;s=s.return}}function Qi(s,c){Fo=s,Rl=es=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&c)!==0&&(Mi=!0),s.firstContext=null)}function gr(s){var c=s._currentValue;if(Rl!==s)if(s={context:s,memoizedValue:c,next:null},es===null){if(Fo===null)throw Error(n(308));es=s,Fo.dependencies={lanes:0,firstContext:s}}else es=es.next=s;return c}var La=null;function Fc(s){La===null?La=[s]:La.push(s)}function z1(s,c,g,b){var E=c.interleaved;return E===null?(g.next=g,Fc(c)):(g.next=E.next,E.next=g),c.interleaved=g,Ts(s,b)}function Ts(s,c){s.lanes|=c;var g=s.alternate;for(g!==null&&(g.lanes|=c),g=s,s=s.return;s!==null;)s.childLanes|=c,g=s.alternate,g!==null&&(g.childLanes|=c),g=s,s=s.return;return g.tag===3?g.stateNode:null}var to=!1;function fh(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function U1(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 Rs(s,c){return{eventTime:s,lane:c,tag:0,payload:null,callback:null,next:null}}function no(s,c,g){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(Mn&2)!==0){var E=b.pending;return E===null?c.next=c:(c.next=E.next,E.next=c),b.pending=c,Ts(s,g)}return E=b.interleaved,E===null?(c.next=c,Fc(b)):(c.next=E.next,E.next=c),b.interleaved=c,Ts(s,g)}function Rd(s,c,g){if(c=c.updateQueue,c!==null&&(c=c.shared,(g&4194240)!==0)){var b=c.lanes;b&=s.pendingLanes,g|=b,c.lanes=g,Sa(s,g)}}function q1(s,c){var g=s.updateQueue,b=s.alternate;if(b!==null&&(b=b.updateQueue,g===b)){var E=null,j=null;if(g=g.firstBaseUpdate,g!==null){do{var B={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};j===null?E=j=B:j=j.next=B,g=g.next}while(g!==null);j===null?E=j=c:j=j.next=c}else E=j=c;g={baseState:b.baseState,firstBaseUpdate:E,lastBaseUpdate:j,shared:b.shared,effects:b.effects},s.updateQueue=g;return}s=g.lastBaseUpdate,s===null?g.firstBaseUpdate=c:s.next=c,g.lastBaseUpdate=c}function Ad(s,c,g,b){var E=s.updateQueue;to=!1;var j=E.firstBaseUpdate,B=E.lastBaseUpdate,re=E.shared.pending;if(re!==null){E.shared.pending=null;var pe=re,je=pe.next;pe.next=null,B===null?j=je:B.next=je,B=pe;var We=s.alternate;We!==null&&(We=We.updateQueue,re=We.lastBaseUpdate,re!==B&&(re===null?We.firstBaseUpdate=je:re.next=je,We.lastBaseUpdate=pe))}if(j!==null){var Qe=E.baseState;B=0,We=je=pe=null,re=j;do{var $e=re.lane,St=re.eventTime;if((b&$e)===$e){We!==null&&(We=We.next={eventTime:St,lane:0,tag:re.tag,payload:re.payload,callback:re.callback,next:null});e:{var Mt=s,Ot=re;switch($e=c,St=g,Ot.tag){case 1:if(Mt=Ot.payload,typeof Mt=="function"){Qe=Mt.call(St,Qe,$e);break e}Qe=Mt;break e;case 3:Mt.flags=Mt.flags&-65537|128;case 0:if(Mt=Ot.payload,$e=typeof Mt=="function"?Mt.call(St,Qe,$e):Mt,$e==null)break e;Qe=P({},Qe,$e);break e;case 2:to=!0}}re.callback!==null&&re.lane!==0&&(s.flags|=64,$e=E.effects,$e===null?E.effects=[re]:$e.push(re))}else St={eventTime:St,lane:$e,tag:re.tag,payload:re.payload,callback:re.callback,next:null},We===null?(je=We=St,pe=Qe):We=We.next=St,B|=$e;if(re=re.next,re===null){if(re=E.shared.pending,re===null)break;$e=re,re=$e.next,$e.next=null,E.lastBaseUpdate=$e,E.shared.pending=null}}while(!0);if(We===null&&(pe=Qe),E.baseState=pe,E.firstBaseUpdate=je,E.lastBaseUpdate=We,c=E.shared.interleaved,c!==null){E=c;do B|=E.lane,E=E.next;while(E!==c)}else j===null&&(E.shared.lanes=0);Uo|=B,s.lanes=B,s.memoizedState=Qe}}function H1(s,c,g){if(s=c.effects,c.effects=null,s!==null)for(c=0;c<s.length;c++){var b=s[c],E=b.callback;if(E!==null){if(b.callback=null,b=g,typeof E!="function")throw Error(n(191,E));E.call(b)}}}var Bc={},ts=Ja(Bc),zc=Ja(Bc),Uc=Ja(Bc);function Bo(s){if(s===Bc)throw Error(n(174));return s}function ph(s,c){switch(Sn(Uc,c),Sn(zc,s),Sn(ts,Bc),s=c.nodeType,s){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:le(null,"");break;default:s=s===8?c.parentNode:c,c=s.namespaceURI||null,s=s.tagName,c=le(c,s)}Qn(ts),Sn(ts,c)}function Ml(){Qn(ts),Qn(zc),Qn(Uc)}function $1(s){Bo(Uc.current);var c=Bo(ts.current),g=le(c,s.type);c!==g&&(Sn(zc,s),Sn(ts,g))}function hh(s){zc.current===s&&(Qn(ts),Qn(zc))}var mr=Ja(0);function Id(s){for(var c=s;c!==null;){if(c.tag===13){var g=c.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||g.data==="$?"||g.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 gh=[];function mh(){for(var s=0;s<gh.length;s++)gh[s]._workInProgressVersionPrimary=null;gh.length=0}var Md=R.ReactCurrentDispatcher,xh=R.ReactCurrentBatchConfig,zo=0,xr=null,Br=null,Gr=null,Ld=!1,qc=!1,Hc=0,TM=0;function ui(){throw Error(n(321))}function yh(s,c){if(c===null)return!1;for(var g=0;g<c.length&&g<s.length;g++)if(!Ti(s[g],c[g]))return!1;return!0}function bh(s,c,g,b,E,j){if(zo=j,xr=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Md.current=s===null||s.memoizedState===null?MM:LM,s=g(b,E),qc){j=0;do{if(qc=!1,Hc=0,25<=j)throw Error(n(301));j+=1,Gr=Br=null,c.updateQueue=null,Md.current=OM,s=g(b,E)}while(qc)}if(Md.current=Pd,c=Br!==null&&Br.next!==null,zo=0,Gr=Br=xr=null,Ld=!1,c)throw Error(n(300));return s}function vh(){var s=Hc!==0;return Hc=0,s}function ns(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gr===null?xr.memoizedState=Gr=s:Gr=Gr.next=s,Gr}function ma(){if(Br===null){var s=xr.alternate;s=s!==null?s.memoizedState:null}else s=Br.next;var c=Gr===null?xr.memoizedState:Gr.next;if(c!==null)Gr=c,Br=s;else{if(s===null)throw Error(n(310));Br=s,s={memoizedState:Br.memoizedState,baseState:Br.baseState,baseQueue:Br.baseQueue,queue:Br.queue,next:null},Gr===null?xr.memoizedState=Gr=s:Gr=Gr.next=s}return Gr}function $c(s,c){return typeof c=="function"?c(s):c}function kh(s){var c=ma(),g=c.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=s;var b=Br,E=b.baseQueue,j=g.pending;if(j!==null){if(E!==null){var B=E.next;E.next=j.next,j.next=B}b.baseQueue=E=j,g.pending=null}if(E!==null){j=E.next,b=b.baseState;var re=B=null,pe=null,je=j;do{var We=je.lane;if((zo&We)===We)pe!==null&&(pe=pe.next={lane:0,action:je.action,hasEagerState:je.hasEagerState,eagerState:je.eagerState,next:null}),b=je.hasEagerState?je.eagerState:s(b,je.action);else{var Qe={lane:We,action:je.action,hasEagerState:je.hasEagerState,eagerState:je.eagerState,next:null};pe===null?(re=pe=Qe,B=b):pe=pe.next=Qe,xr.lanes|=We,Uo|=We}je=je.next}while(je!==null&&je!==j);pe===null?B=b:pe.next=re,Ti(b,c.memoizedState)||(Mi=!0),c.memoizedState=b,c.baseState=B,c.baseQueue=pe,g.lastRenderedState=b}if(s=g.interleaved,s!==null){E=s;do j=E.lane,xr.lanes|=j,Uo|=j,E=E.next;while(E!==s)}else E===null&&(g.lanes=0);return[c.memoizedState,g.dispatch]}function _h(s){var c=ma(),g=c.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=s;var b=g.dispatch,E=g.pending,j=c.memoizedState;if(E!==null){g.pending=null;var B=E=E.next;do j=s(j,B.action),B=B.next;while(B!==E);Ti(j,c.memoizedState)||(Mi=!0),c.memoizedState=j,c.baseQueue===null&&(c.baseState=j),g.lastRenderedState=j}return[j,b]}function W1(){}function V1(s,c){var g=xr,b=ma(),E=c(),j=!Ti(b.memoizedState,E);if(j&&(b.memoizedState=E,Mi=!0),b=b.queue,wh(Y1.bind(null,g,b,s),[s]),b.getSnapshot!==c||j||Gr!==null&&Gr.memoizedState.tag&1){if(g.flags|=2048,Wc(9,K1.bind(null,g,b,E,c),void 0,null),Kr===null)throw Error(n(349));(zo&30)!==0||G1(g,c,E)}return E}function G1(s,c,g){s.flags|=16384,s={getSnapshot:c,value:g},c=xr.updateQueue,c===null?(c={lastEffect:null,stores:null},xr.updateQueue=c,c.stores=[s]):(g=c.stores,g===null?c.stores=[s]:g.push(s))}function K1(s,c,g,b){c.value=g,c.getSnapshot=b,Q1(c)&&X1(s)}function Y1(s,c,g){return g(function(){Q1(c)&&X1(s)})}function Q1(s){var c=s.getSnapshot;s=s.value;try{var g=c();return!Ti(s,g)}catch{return!0}}function X1(s){var c=Ts(s,1);c!==null&&Fa(c,s,1,-1)}function Z1(s){var c=ns();return typeof s=="function"&&(s=s()),c.memoizedState=c.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$c,lastRenderedState:s},c.queue=s,s=s.dispatch=IM.bind(null,xr,s),[c.memoizedState,s]}function Wc(s,c,g,b){return s={tag:s,create:c,destroy:g,deps:b,next:null},c=xr.updateQueue,c===null?(c={lastEffect:null,stores:null},xr.updateQueue=c,c.lastEffect=s.next=s):(g=c.lastEffect,g===null?c.lastEffect=s.next=s:(b=g.next,g.next=s,s.next=b,c.lastEffect=s)),s}function J1(){return ma().memoizedState}function Od(s,c,g,b){var E=ns();xr.flags|=s,E.memoizedState=Wc(1|c,g,void 0,b===void 0?null:b)}function Dd(s,c,g,b){var E=ma();b=b===void 0?null:b;var j=void 0;if(Br!==null){var B=Br.memoizedState;if(j=B.destroy,b!==null&&yh(b,B.deps)){E.memoizedState=Wc(c,g,j,b);return}}xr.flags|=s,E.memoizedState=Wc(1|c,g,j,b)}function e_(s,c){return Od(8390656,8,s,c)}function wh(s,c){return Dd(2048,8,s,c)}function t_(s,c){return Dd(4,2,s,c)}function n_(s,c){return Dd(4,4,s,c)}function r_(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 i_(s,c,g){return g=g!=null?g.concat([s]):null,Dd(4,4,r_.bind(null,c,s),g)}function Sh(){}function a_(s,c){var g=ma();c=c===void 0?null:c;var b=g.memoizedState;return b!==null&&c!==null&&yh(c,b[1])?b[0]:(g.memoizedState=[s,c],s)}function s_(s,c){var g=ma();c=c===void 0?null:c;var b=g.memoizedState;return b!==null&&c!==null&&yh(c,b[1])?b[0]:(s=s(),g.memoizedState=[s,c],s)}function o_(s,c,g){return(zo&21)===0?(s.baseState&&(s.baseState=!1,Mi=!0),s.memoizedState=g):(Ti(g,c)||(g=$i(),xr.lanes|=g,Uo|=g,s.baseState=!0),c)}function RM(s,c){var g=_n;_n=g!==0&&4>g?g:4,s(!0);var b=xh.transition;xh.transition={};try{s(!1),c()}finally{_n=g,xh.transition=b}}function l_(){return ma().memoizedState}function AM(s,c,g){var b=so(s);if(g={lane:b,action:g,hasEagerState:!1,eagerState:null,next:null},c_(s))u_(c,g);else if(g=z1(s,c,g,b),g!==null){var E=xi();Fa(g,s,b,E),d_(g,c,b)}}function IM(s,c,g){var b=so(s),E={lane:b,action:g,hasEagerState:!1,eagerState:null,next:null};if(c_(s))u_(c,E);else{var j=s.alternate;if(s.lanes===0&&(j===null||j.lanes===0)&&(j=c.lastRenderedReducer,j!==null))try{var B=c.lastRenderedState,re=j(B,g);if(E.hasEagerState=!0,E.eagerState=re,Ti(re,B)){var pe=c.interleaved;pe===null?(E.next=E,Fc(c)):(E.next=pe.next,pe.next=E),c.interleaved=E;return}}catch{}finally{}g=z1(s,c,E,b),g!==null&&(E=xi(),Fa(g,s,b,E),d_(g,c,b))}}function c_(s){var c=s.alternate;return s===xr||c!==null&&c===xr}function u_(s,c){qc=Ld=!0;var g=s.pending;g===null?c.next=c:(c.next=g.next,g.next=c),s.pending=c}function d_(s,c,g){if((g&4194240)!==0){var b=c.lanes;b&=s.pendingLanes,g|=b,c.lanes=g,Sa(s,g)}}var Pd={readContext:gr,useCallback:ui,useContext:ui,useEffect:ui,useImperativeHandle:ui,useInsertionEffect:ui,useLayoutEffect:ui,useMemo:ui,useReducer:ui,useRef:ui,useState:ui,useDebugValue:ui,useDeferredValue:ui,useTransition:ui,useMutableSource:ui,useSyncExternalStore:ui,useId:ui,unstable_isNewReconciler:!1},MM={readContext:gr,useCallback:function(s,c){return ns().memoizedState=[s,c===void 0?null:c],s},useContext:gr,useEffect:e_,useImperativeHandle:function(s,c,g){return g=g!=null?g.concat([s]):null,Od(4194308,4,r_.bind(null,c,s),g)},useLayoutEffect:function(s,c){return Od(4194308,4,s,c)},useInsertionEffect:function(s,c){return Od(4,2,s,c)},useMemo:function(s,c){var g=ns();return c=c===void 0?null:c,s=s(),g.memoizedState=[s,c],s},useReducer:function(s,c,g){var b=ns();return c=g!==void 0?g(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=AM.bind(null,xr,s),[b.memoizedState,s]},useRef:function(s){var c=ns();return s={current:s},c.memoizedState=s},useState:Z1,useDebugValue:Sh,useDeferredValue:function(s){return ns().memoizedState=s},useTransition:function(){var s=Z1(!1),c=s[0];return s=RM.bind(null,s[1]),ns().memoizedState=s,[c,s]},useMutableSource:function(){},useSyncExternalStore:function(s,c,g){var b=xr,E=ns();if(ue){if(g===void 0)throw Error(n(407));g=g()}else{if(g=c(),Kr===null)throw Error(n(349));(zo&30)!==0||G1(b,c,g)}E.memoizedState=g;var j={value:g,getSnapshot:c};return E.queue=j,e_(Y1.bind(null,b,j,s),[s]),b.flags|=2048,Wc(9,K1.bind(null,b,j,g,c),void 0,null),g},useId:function(){var s=ns(),c=Kr.identifierPrefix;if(ue){var g=xt,b=we;g=(b&~(1<<32-dn(b)-1)).toString(32)+g,c=":"+c+"R"+g,g=Hc++,0<g&&(c+="H"+g.toString(32)),c+=":"}else g=TM++,c=":"+c+"r"+g.toString(32)+":";return s.memoizedState=c},unstable_isNewReconciler:!1},LM={readContext:gr,useCallback:a_,useContext:gr,useEffect:wh,useImperativeHandle:i_,useInsertionEffect:t_,useLayoutEffect:n_,useMemo:s_,useReducer:kh,useRef:J1,useState:function(){return kh($c)},useDebugValue:Sh,useDeferredValue:function(s){var c=ma();return o_(c,Br.memoizedState,s)},useTransition:function(){var s=kh($c)[0],c=ma().memoizedState;return[s,c]},useMutableSource:W1,useSyncExternalStore:V1,useId:l_,unstable_isNewReconciler:!1},OM={readContext:gr,useCallback:a_,useContext:gr,useEffect:wh,useImperativeHandle:i_,useInsertionEffect:t_,useLayoutEffect:n_,useMemo:s_,useReducer:_h,useRef:J1,useState:function(){return _h($c)},useDebugValue:Sh,useDeferredValue:function(s){var c=ma();return Br===null?c.memoizedState=s:o_(c,Br.memoizedState,s)},useTransition:function(){var s=_h($c)[0],c=ma().memoizedState;return[s,c]},useMutableSource:W1,useSyncExternalStore:V1,useId:l_,unstable_isNewReconciler:!1};function Oa(s,c){if(s&&s.defaultProps){c=P({},c),s=s.defaultProps;for(var g in s)c[g]===void 0&&(c[g]=s[g]);return c}return c}function Eh(s,c,g,b){c=s.memoizedState,g=g(b,c),g=g==null?c:P({},c,g),s.memoizedState=g,s.lanes===0&&(s.updateQueue.baseState=g)}var Fd={isMounted:function(s){return(s=s._reactInternals)?Wn(s)===s:!1},enqueueSetState:function(s,c,g){s=s._reactInternals;var b=xi(),E=so(s),j=Rs(b,E);j.payload=c,g!=null&&(j.callback=g),c=no(s,j,E),c!==null&&(Fa(c,s,E,b),Rd(c,s,E))},enqueueReplaceState:function(s,c,g){s=s._reactInternals;var b=xi(),E=so(s),j=Rs(b,E);j.tag=1,j.payload=c,g!=null&&(j.callback=g),c=no(s,j,E),c!==null&&(Fa(c,s,E,b),Rd(c,s,E))},enqueueForceUpdate:function(s,c){s=s._reactInternals;var g=xi(),b=so(s),E=Rs(g,b);E.tag=2,c!=null&&(E.callback=c),c=no(s,E,b),c!==null&&(Fa(c,s,b,g),Rd(c,s,b))}};function f_(s,c,g,b,E,j,B){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,j,B):c.prototype&&c.prototype.isPureReactComponent?!$s(g,b)||!$s(E,j):!0}function p_(s,c,g){var b=!1,E=Ai,j=c.contextType;return typeof j=="object"&&j!==null?j=gr(j):(E=ci(c)?Es:Rr.current,b=c.contextTypes,j=(b=b!=null)?Yi(s,E):Ai),c=new c(g,j),s.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Fd,s.stateNode=c,c._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=E,s.__reactInternalMemoizedMaskedChildContext=j),c}function h_(s,c,g,b){s=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(g,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(g,b),c.state!==s&&Fd.enqueueReplaceState(c,c.state,null)}function Nh(s,c,g,b){var E=s.stateNode;E.props=g,E.state=s.memoizedState,E.refs={},fh(s);var j=c.contextType;typeof j=="object"&&j!==null?E.context=gr(j):(j=ci(c)?Es:Rr.current,E.context=Yi(s,j)),E.state=s.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(Eh(s,c,j,g),E.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(c=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),c!==E.state&&Fd.enqueueReplaceState(E,E.state,null),Ad(s,g,E,b),E.state=s.memoizedState),typeof E.componentDidMount=="function"&&(s.flags|=4194308)}function Ll(s,c){try{var g="",b=c;do g+=q(b),b=b.return;while(b);var E=g}catch(j){E=`
|
|
39
|
+
Error generating stack: `+j.message+`
|
|
40
|
+
`+j.stack}return{value:s,source:c,stack:E,digest:null}}function Ch(s,c,g){return{value:s,source:null,stack:g??null,digest:c??null}}function jh(s,c){try{console.error(c.value)}catch(g){setTimeout(function(){throw g})}}var DM=typeof WeakMap=="function"?WeakMap:Map;function g_(s,c,g){g=Rs(-1,g),g.tag=3,g.payload={element:null};var b=c.value;return g.callback=function(){Wd||(Wd=!0,Hh=b),jh(s,c)},g}function m_(s,c,g){g=Rs(-1,g),g.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var E=c.value;g.payload=function(){return b(E)},g.callback=function(){jh(s,c)}}var j=s.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(g.callback=function(){jh(s,c),typeof b!="function"&&(io===null?io=new Set([this]):io.add(this));var B=c.stack;this.componentDidCatch(c.value,{componentStack:B!==null?B:""})}),g}function x_(s,c,g){var b=s.pingCache;if(b===null){b=s.pingCache=new DM;var E=new Set;b.set(c,E)}else E=b.get(c),E===void 0&&(E=new Set,b.set(c,E));E.has(g)||(E.add(g),s=QM.bind(null,s,c,g),c.then(s,s))}function y_(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 b_(s,c,g,b,E){return(s.mode&1)===0?(s===c?s.flags|=65536:(s.flags|=128,g.flags|=131072,g.flags&=-52805,g.tag===1&&(g.alternate===null?g.tag=17:(c=Rs(-1,1),c.tag=2,no(g,c,1))),g.lanes|=1),s):(s.flags|=65536,s.lanes=E,s)}var PM=R.ReactCurrentOwner,Mi=!1;function mi(s,c,g,b){c.child=s===null?Td(c,null,g,b):ga(c,s.child,g,b)}function v_(s,c,g,b,E){g=g.render;var j=c.ref;return Qi(c,E),b=bh(s,c,g,b,j,E),g=vh(),s!==null&&!Mi?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~E,As(s,c,E)):(ue&&g&&In(c),c.flags|=1,mi(s,c,b,E),c.child)}function k_(s,c,g,b,E){if(s===null){var j=g.type;return typeof j=="function"&&!Qh(j)&&j.defaultProps===void 0&&g.compare===null&&g.defaultProps===void 0?(c.tag=15,c.type=j,__(s,c,j,b,E)):(s=Xd(g.type,null,b,c,c.mode,E),s.ref=c.ref,s.return=c,c.child=s)}if(j=s.child,(s.lanes&E)===0){var B=j.memoizedProps;if(g=g.compare,g=g!==null?g:$s,g(B,b)&&s.ref===c.ref)return As(s,c,E)}return c.flags|=1,s=lo(j,b),s.ref=c.ref,s.return=c,c.child=s}function __(s,c,g,b,E){if(s!==null){var j=s.memoizedProps;if($s(j,b)&&s.ref===c.ref)if(Mi=!1,c.pendingProps=b=j,(s.lanes&E)!==0)(s.flags&131072)!==0&&(Mi=!0);else return c.lanes=s.lanes,As(s,c,E)}return Th(s,c,g,b,E)}function w_(s,c,g){var b=c.pendingProps,E=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},Sn(Dl,Xi),Xi|=g;else{if((g&1073741824)===0)return s=j!==null?j.baseLanes|g:g,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:s,cachePool:null,transitions:null},c.updateQueue=null,Sn(Dl,Xi),Xi|=s,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=j!==null?j.baseLanes:g,Sn(Dl,Xi),Xi|=b}else j!==null?(b=j.baseLanes|g,c.memoizedState=null):b=g,Sn(Dl,Xi),Xi|=b;return mi(s,c,E,g),c.child}function S_(s,c){var g=c.ref;(s===null&&g!==null||s!==null&&s.ref!==g)&&(c.flags|=512,c.flags|=2097152)}function Th(s,c,g,b,E){var j=ci(g)?Es:Rr.current;return j=Yi(c,j),Qi(c,E),g=bh(s,c,g,b,j,E),b=vh(),s!==null&&!Mi?(c.updateQueue=s.updateQueue,c.flags&=-2053,s.lanes&=~E,As(s,c,E)):(ue&&b&&In(c),c.flags|=1,mi(s,c,g,E),c.child)}function E_(s,c,g,b,E){if(ci(g)){var j=!0;jl(c)}else j=!1;if(Qi(c,E),c.stateNode===null)zd(s,c),p_(c,g,b),Nh(c,g,b,E),b=!0;else if(s===null){var B=c.stateNode,re=c.memoizedProps;B.props=re;var pe=B.context,je=g.contextType;typeof je=="object"&&je!==null?je=gr(je):(je=ci(g)?Es:Rr.current,je=Yi(c,je));var We=g.getDerivedStateFromProps,Qe=typeof We=="function"||typeof B.getSnapshotBeforeUpdate=="function";Qe||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(re!==b||pe!==je)&&h_(c,B,b,je),to=!1;var $e=c.memoizedState;B.state=$e,Ad(c,b,B,E),pe=c.memoizedState,re!==b||$e!==pe||li.current||to?(typeof We=="function"&&(Eh(c,g,We,b),pe=c.memoizedState),(re=to||f_(c,g,re,b,$e,pe,je))?(Qe||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount()),typeof B.componentDidMount=="function"&&(c.flags|=4194308)):(typeof B.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=pe),B.props=b,B.state=pe,B.context=je,b=re):(typeof B.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{B=c.stateNode,U1(s,c),re=c.memoizedProps,je=c.type===c.elementType?re:Oa(c.type,re),B.props=je,Qe=c.pendingProps,$e=B.context,pe=g.contextType,typeof pe=="object"&&pe!==null?pe=gr(pe):(pe=ci(g)?Es:Rr.current,pe=Yi(c,pe));var St=g.getDerivedStateFromProps;(We=typeof St=="function"||typeof B.getSnapshotBeforeUpdate=="function")||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(re!==Qe||$e!==pe)&&h_(c,B,b,pe),to=!1,$e=c.memoizedState,B.state=$e,Ad(c,b,B,E);var Mt=c.memoizedState;re!==Qe||$e!==Mt||li.current||to?(typeof St=="function"&&(Eh(c,g,St,b),Mt=c.memoizedState),(je=to||f_(c,g,je,b,$e,Mt,pe)||!1)?(We||typeof B.UNSAFE_componentWillUpdate!="function"&&typeof B.componentWillUpdate!="function"||(typeof B.componentWillUpdate=="function"&&B.componentWillUpdate(b,Mt,pe),typeof B.UNSAFE_componentWillUpdate=="function"&&B.UNSAFE_componentWillUpdate(b,Mt,pe)),typeof B.componentDidUpdate=="function"&&(c.flags|=4),typeof B.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof B.componentDidUpdate!="function"||re===s.memoizedProps&&$e===s.memoizedState||(c.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||re===s.memoizedProps&&$e===s.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=Mt),B.props=b,B.state=Mt,B.context=pe,b=je):(typeof B.componentDidUpdate!="function"||re===s.memoizedProps&&$e===s.memoizedState||(c.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||re===s.memoizedProps&&$e===s.memoizedState||(c.flags|=1024),b=!1)}return Rh(s,c,g,b,j,E)}function Rh(s,c,g,b,E,j){S_(s,c);var B=(c.flags&128)!==0;if(!b&&!B)return E&&Cd(c,g,!1),As(s,c,j);b=c.stateNode,PM.current=c;var re=B&&typeof g.getDerivedStateFromError!="function"?null:b.render();return c.flags|=1,s!==null&&B?(c.child=ga(c,s.child,null,j),c.child=ga(c,null,re,j)):mi(s,c,re,j),c.memoizedState=b.state,E&&Cd(c,g,!0),c.child}function N_(s){var c=s.stateNode;c.pendingContext?Ed(s,c.pendingContext,c.pendingContext!==c.context):c.context&&Ed(s,c.context,!1),ph(s,c.containerInfo)}function C_(s,c,g,b,E){return Hn(),hr(E),c.flags|=256,mi(s,c,g,b),c.child}var Ah={dehydrated:null,treeContext:null,retryLane:0};function Ih(s){return{baseLanes:s,cachePool:null,transitions:null}}function j_(s,c,g){var b=c.pendingProps,E=mr.current,j=!1,B=(c.flags&128)!==0,re;if((re=B)||(re=s!==null&&s.memoizedState===null?!1:(E&2)!==0),re?(j=!0,c.flags&=-129):(s===null||s.memoizedState!==null)&&(E|=1),Sn(mr,E&1),s===null)return Vt(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):(B=b.children,s=b.fallback,j?(b=c.mode,j=c.child,B={mode:"hidden",children:B},(b&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=B):j=Zd(B,b,0,null),s=Wo(s,b,g,null),j.return=c,s.return=c,j.sibling=s,c.child=j,c.child.memoizedState=Ih(g),c.memoizedState=Ah,s):Mh(c,B));if(E=s.memoizedState,E!==null&&(re=E.dehydrated,re!==null))return FM(s,c,B,b,re,E,g);if(j){j=b.fallback,B=c.mode,E=s.child,re=E.sibling;var pe={mode:"hidden",children:b.children};return(B&1)===0&&c.child!==E?(b=c.child,b.childLanes=0,b.pendingProps=pe,c.deletions=null):(b=lo(E,pe),b.subtreeFlags=E.subtreeFlags&14680064),re!==null?j=lo(re,j):(j=Wo(j,B,g,null),j.flags|=2),j.return=c,b.return=c,b.sibling=j,c.child=b,b=j,j=c.child,B=s.child.memoizedState,B=B===null?Ih(g):{baseLanes:B.baseLanes|g,cachePool:null,transitions:B.transitions},j.memoizedState=B,j.childLanes=s.childLanes&~g,c.memoizedState=Ah,b}return j=s.child,s=j.sibling,b=lo(j,{mode:"visible",children:b.children}),(c.mode&1)===0&&(b.lanes=g),b.return=c,b.sibling=null,s!==null&&(g=c.deletions,g===null?(c.deletions=[s],c.flags|=16):g.push(s)),c.child=b,c.memoizedState=null,b}function Mh(s,c){return c=Zd({mode:"visible",children:c},s.mode,0,null),c.return=s,s.child=c}function Bd(s,c,g,b){return b!==null&&hr(b),ga(c,s.child,null,g),s=Mh(c,c.pendingProps.children),s.flags|=2,c.memoizedState=null,s}function FM(s,c,g,b,E,j,B){if(g)return c.flags&256?(c.flags&=-257,b=Ch(Error(n(422))),Bd(s,c,B,b)):c.memoizedState!==null?(c.child=s.child,c.flags|=128,null):(j=b.fallback,E=c.mode,b=Zd({mode:"visible",children:b.children},E,0,null),j=Wo(j,E,B,null),j.flags|=2,b.return=c,j.return=c,b.sibling=j,c.child=b,(c.mode&1)!==0&&ga(c,s.child,null,B),c.child.memoizedState=Ih(B),c.memoizedState=Ah,j);if((c.mode&1)===0)return Bd(s,c,B,null);if(E.data==="$!"){if(b=E.nextSibling&&E.nextSibling.dataset,b)var re=b.dgst;return b=re,j=Error(n(419)),b=Ch(j,b,void 0),Bd(s,c,B,b)}if(re=(B&s.childLanes)!==0,Mi||re){if(b=Kr,b!==null){switch(B&-B){case 4:E=2;break;case 16:E=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:E=32;break;case 536870912:E=268435456;break;default:E=0}E=(E&(b.suspendedLanes|B))!==0?0:E,E!==0&&E!==j.retryLane&&(j.retryLane=E,Ts(s,E),Fa(b,s,E,-1))}return Yh(),b=Ch(Error(n(421))),Bd(s,c,B,b)}return E.data==="$?"?(c.flags|=128,c.child=s.child,c=XM.bind(null,s),E._reactRetry=c,null):(s=j.treeContext,Z=Aa(E.nextSibling),me=c,ue=!0,Ne=null,s!==null&&(ce[de++]=we,ce[de++]=xt,ce[de++]=Ae,we=s.id,xt=s.overflow,Ae=c),c=Mh(c,b.children),c.flags|=4096,c)}function T_(s,c,g){s.lanes|=c;var b=s.alternate;b!==null&&(b.lanes|=c),Fr(s.return,c,g)}function Lh(s,c,g,b,E){var j=s.memoizedState;j===null?s.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:g,tailMode:E}:(j.isBackwards=c,j.rendering=null,j.renderingStartTime=0,j.last=b,j.tail=g,j.tailMode=E)}function R_(s,c,g){var b=c.pendingProps,E=b.revealOrder,j=b.tail;if(mi(s,c,b.children,g),b=mr.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&&T_(s,g,c);else if(s.tag===19)T_(s,g,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(Sn(mr,b),(c.mode&1)===0)c.memoizedState=null;else switch(E){case"forwards":for(g=c.child,E=null;g!==null;)s=g.alternate,s!==null&&Id(s)===null&&(E=g),g=g.sibling;g=E,g===null?(E=c.child,c.child=null):(E=g.sibling,g.sibling=null),Lh(c,!1,E,g,j);break;case"backwards":for(g=null,E=c.child,c.child=null;E!==null;){if(s=E.alternate,s!==null&&Id(s)===null){c.child=E;break}s=E.sibling,E.sibling=g,g=E,E=s}Lh(c,!0,g,null,j);break;case"together":Lh(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function zd(s,c){(c.mode&1)===0&&s!==null&&(s.alternate=null,c.alternate=null,c.flags|=2)}function As(s,c,g){if(s!==null&&(c.dependencies=s.dependencies),Uo|=c.lanes,(g&c.childLanes)===0)return null;if(s!==null&&c.child!==s.child)throw Error(n(153));if(c.child!==null){for(s=c.child,g=lo(s,s.pendingProps),c.child=g,g.return=c;s.sibling!==null;)s=s.sibling,g=g.sibling=lo(s,s.pendingProps),g.return=c;g.sibling=null}return c.child}function BM(s,c,g){switch(c.tag){case 3:N_(c),Hn();break;case 5:$1(c);break;case 1:ci(c.type)&&jl(c);break;case 4:ph(c,c.stateNode.containerInfo);break;case 10:var b=c.type._context,E=c.memoizedProps.value;Sn(Po,b._currentValue),b._currentValue=E;break;case 13:if(b=c.memoizedState,b!==null)return b.dehydrated!==null?(Sn(mr,mr.current&1),c.flags|=128,null):(g&c.child.childLanes)!==0?j_(s,c,g):(Sn(mr,mr.current&1),s=As(s,c,g),s!==null?s.sibling:null);Sn(mr,mr.current&1);break;case 19:if(b=(g&c.childLanes)!==0,(s.flags&128)!==0){if(b)return R_(s,c,g);c.flags|=128}if(E=c.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),Sn(mr,mr.current),b)break;return null;case 22:case 23:return c.lanes=0,w_(s,c,g)}return As(s,c,g)}var A_,Oh,I_,M_;A_=function(s,c){for(var g=c.child;g!==null;){if(g.tag===5||g.tag===6)s.appendChild(g.stateNode);else if(g.tag!==4&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===c)break;for(;g.sibling===null;){if(g.return===null||g.return===c)return;g=g.return}g.sibling.return=g.return,g=g.sibling}},Oh=function(){},I_=function(s,c,g,b){var E=s.memoizedProps;if(E!==b){s=c.stateNode,Bo(ts.current);var j=null;switch(g){case"input":E=pt(s,E),b=pt(s,b),j=[];break;case"select":E=P({},E,{value:void 0}),b=P({},b,{value:void 0}),j=[];break;case"textarea":E=gn(s,E),b=gn(s,b),j=[];break;default:typeof E.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=Nl)}rt(g,b);var B;g=null;for(je in E)if(!b.hasOwnProperty(je)&&E.hasOwnProperty(je)&&E[je]!=null)if(je==="style"){var re=E[je];for(B in re)re.hasOwnProperty(B)&&(g||(g={}),g[B]="")}else je!=="dangerouslySetInnerHTML"&&je!=="children"&&je!=="suppressContentEditableWarning"&&je!=="suppressHydrationWarning"&&je!=="autoFocus"&&(i.hasOwnProperty(je)?j||(j=[]):(j=j||[]).push(je,null));for(je in b){var pe=b[je];if(re=E!=null?E[je]:void 0,b.hasOwnProperty(je)&&pe!==re&&(pe!=null||re!=null))if(je==="style")if(re){for(B in re)!re.hasOwnProperty(B)||pe&&pe.hasOwnProperty(B)||(g||(g={}),g[B]="");for(B in pe)pe.hasOwnProperty(B)&&re[B]!==pe[B]&&(g||(g={}),g[B]=pe[B])}else g||(j||(j=[]),j.push(je,g)),g=pe;else je==="dangerouslySetInnerHTML"?(pe=pe?pe.__html:void 0,re=re?re.__html:void 0,pe!=null&&re!==pe&&(j=j||[]).push(je,pe)):je==="children"?typeof pe!="string"&&typeof pe!="number"||(j=j||[]).push(je,""+pe):je!=="suppressContentEditableWarning"&&je!=="suppressHydrationWarning"&&(i.hasOwnProperty(je)?(pe!=null&&je==="onScroll"&&Yn("scroll",s),j||re===pe||(j=[])):(j=j||[]).push(je,pe))}g&&(j=j||[]).push("style",g);var je=j;(c.updateQueue=je)&&(c.flags|=4)}},M_=function(s,c,g,b){g!==b&&(c.flags|=4)};function Vc(s,c){if(!ue)switch(s.tailMode){case"hidden":c=s.tail;for(var g=null;c!==null;)c.alternate!==null&&(g=c),c=c.sibling;g===null?s.tail=null:g.sibling=null;break;case"collapsed":g=s.tail;for(var b=null;g!==null;)g.alternate!==null&&(b=g),g=g.sibling;b===null?c||s.tail===null?s.tail=null:s.tail.sibling=null:b.sibling=null}}function di(s){var c=s.alternate!==null&&s.alternate.child===s.child,g=0,b=0;if(c)for(var E=s.child;E!==null;)g|=E.lanes|E.childLanes,b|=E.subtreeFlags&14680064,b|=E.flags&14680064,E.return=s,E=E.sibling;else for(E=s.child;E!==null;)g|=E.lanes|E.childLanes,b|=E.subtreeFlags,b|=E.flags,E.return=s,E=E.sibling;return s.subtreeFlags|=b,s.childLanes=g,c}function zM(s,c,g){var b=c.pendingProps;switch(cr(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return di(c),null;case 1:return ci(c.type)&&Js(),di(c),null;case 3:return b=c.stateNode,Ml(),Qn(li),Qn(Rr),mh(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(fn(c)?c.flags|=4:s===null||s.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Ne!==null&&(Vh(Ne),Ne=null))),Oh(s,c),di(c),null;case 5:hh(c);var E=Bo(Uc.current);if(g=c.type,s!==null&&c.stateNode!=null)I_(s,c,g,b,E),s.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!b){if(c.stateNode===null)throw Error(n(166));return di(c),null}if(s=Bo(ts.current),fn(c)){b=c.stateNode,g=c.type;var j=c.memoizedProps;switch(b[pa]=c,b[Oo]=j,s=(c.mode&1)!==0,g){case"dialog":Yn("cancel",b),Yn("close",b);break;case"iframe":case"object":case"embed":Yn("load",b);break;case"video":case"audio":for(E=0;E<Ta.length;E++)Yn(Ta[E],b);break;case"source":Yn("error",b);break;case"img":case"image":case"link":Yn("error",b),Yn("load",b);break;case"details":Yn("toggle",b);break;case"input":et(b,j),Yn("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!j.multiple},Yn("invalid",b);break;case"textarea":Ht(b,j),Yn("invalid",b)}rt(g,j),E=null;for(var B in j)if(j.hasOwnProperty(B)){var re=j[B];B==="children"?typeof re=="string"?b.textContent!==re&&(j.suppressHydrationWarning!==!0&&Lo(b.textContent,re,s),E=["children",re]):typeof re=="number"&&b.textContent!==""+re&&(j.suppressHydrationWarning!==!0&&Lo(b.textContent,re,s),E=["children",""+re]):i.hasOwnProperty(B)&&re!=null&&B==="onScroll"&&Yn("scroll",b)}switch(g){case"input":Fe(b),At(b,j,!0);break;case"textarea":Fe(b),ut(b);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(b.onclick=Nl)}b=E,c.updateQueue=b,b!==null&&(c.flags|=4)}else{B=E.nodeType===9?E:E.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=Pe(g)),s==="http://www.w3.org/1999/xhtml"?g==="script"?(s=B.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=B.createElement(g,{is:b.is}):(s=B.createElement(g),g==="select"&&(B=s,b.multiple?B.multiple=!0:b.size&&(B.size=b.size))):s=B.createElementNS(s,g),s[pa]=c,s[Oo]=b,A_(s,c,!1,!1),c.stateNode=s;e:{switch(B=wt(g,b),g){case"dialog":Yn("cancel",s),Yn("close",s),E=b;break;case"iframe":case"object":case"embed":Yn("load",s),E=b;break;case"video":case"audio":for(E=0;E<Ta.length;E++)Yn(Ta[E],s);E=b;break;case"source":Yn("error",s),E=b;break;case"img":case"image":case"link":Yn("error",s),Yn("load",s),E=b;break;case"details":Yn("toggle",s),E=b;break;case"input":et(s,b),E=pt(s,b),Yn("invalid",s);break;case"option":E=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},E=P({},b,{value:void 0}),Yn("invalid",s);break;case"textarea":Ht(s,b),E=gn(s,b),Yn("invalid",s);break;default:E=b}rt(g,E),re=E;for(j in re)if(re.hasOwnProperty(j)){var pe=re[j];j==="style"?Lt(s,pe):j==="dangerouslySetInnerHTML"?(pe=pe?pe.__html:void 0,pe!=null&&fe(s,pe)):j==="children"?typeof pe=="string"?(g!=="textarea"||pe!=="")&&Oe(s,pe):typeof pe=="number"&&Oe(s,""+pe):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(i.hasOwnProperty(j)?pe!=null&&j==="onScroll"&&Yn("scroll",s):pe!=null&&N(s,j,pe,B))}switch(g){case"input":Fe(s),At(s,b,!1);break;case"textarea":Fe(s),ut(s);break;case"option":b.value!=null&&s.setAttribute("value",""+_e(b.value));break;case"select":s.multiple=!!b.multiple,j=b.value,j!=null?_t(s,!!b.multiple,j,!1):b.defaultValue!=null&&_t(s,!!b.multiple,b.defaultValue,!0);break;default:typeof E.onClick=="function"&&(s.onclick=Nl)}switch(g){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 di(c),null;case 6:if(s&&c.stateNode!=null)M_(s,c,s.memoizedProps,b);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(g=Bo(Uc.current),Bo(ts.current),fn(c)){if(b=c.stateNode,g=c.memoizedProps,b[pa]=c,(j=b.nodeValue!==g)&&(s=me,s!==null))switch(s.tag){case 3:Lo(b.nodeValue,g,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&Lo(b.nodeValue,g,(s.mode&1)!==0)}j&&(c.flags|=4)}else b=(g.nodeType===9?g:g.ownerDocument).createTextNode(b),b[pa]=c,c.stateNode=b}return di(c),null;case 13:if(Qn(mr),b=c.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(ue&&Z!==null&&(c.mode&1)!==0&&(c.flags&128)===0)qn(),Hn(),c.flags|=98560,j=!1;else if(j=fn(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[pa]=c}else Hn(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;di(c),j=!1}else Ne!==null&&(Vh(Ne),Ne=null),j=!0;if(!j)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=g,c):(b=b!==null,b!==(s!==null&&s.memoizedState!==null)&&b&&(c.child.flags|=8192,(c.mode&1)!==0&&(s===null||(mr.current&1)!==0?zr===0&&(zr=3):Yh())),c.updateQueue!==null&&(c.flags|=4),di(c),null);case 4:return Ml(),Oh(s,c),s===null&&ks(c.stateNode.containerInfo),di(c),null;case 10:return Il(c.type._context),di(c),null;case 17:return ci(c.type)&&Js(),di(c),null;case 19:if(Qn(mr),j=c.memoizedState,j===null)return di(c),null;if(b=(c.flags&128)!==0,B=j.rendering,B===null)if(b)Vc(j,!1);else{if(zr!==0||s!==null&&(s.flags&128)!==0)for(s=c.child;s!==null;){if(B=Id(s),B!==null){for(c.flags|=128,Vc(j,!1),b=B.updateQueue,b!==null&&(c.updateQueue=b,c.flags|=4),c.subtreeFlags=0,b=g,g=c.child;g!==null;)j=g,s=b,j.flags&=14680066,B=j.alternate,B===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=B.childLanes,j.lanes=B.lanes,j.child=B.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=B.memoizedProps,j.memoizedState=B.memoizedState,j.updateQueue=B.updateQueue,j.type=B.type,s=B.dependencies,j.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),g=g.sibling;return Sn(mr,mr.current&1|2),c.child}s=s.sibling}j.tail!==null&&tn()>Pl&&(c.flags|=128,b=!0,Vc(j,!1),c.lanes=4194304)}else{if(!b)if(s=Id(B),s!==null){if(c.flags|=128,b=!0,g=s.updateQueue,g!==null&&(c.updateQueue=g,c.flags|=4),Vc(j,!0),j.tail===null&&j.tailMode==="hidden"&&!B.alternate&&!ue)return di(c),null}else 2*tn()-j.renderingStartTime>Pl&&g!==1073741824&&(c.flags|=128,b=!0,Vc(j,!1),c.lanes=4194304);j.isBackwards?(B.sibling=c.child,c.child=B):(g=j.last,g!==null?g.sibling=B:c.child=B,j.last=B)}return j.tail!==null?(c=j.tail,j.rendering=c,j.tail=c.sibling,j.renderingStartTime=tn(),c.sibling=null,g=mr.current,Sn(mr,b?g&1|2:g&1),c):(di(c),null);case 22:case 23:return Kh(),b=c.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(c.flags|=8192),b&&(c.mode&1)!==0?(Xi&1073741824)!==0&&(di(c),c.subtreeFlags&6&&(c.flags|=8192)):di(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function UM(s,c){switch(cr(c),c.tag){case 1:return ci(c.type)&&Js(),s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 3:return Ml(),Qn(li),Qn(Rr),mh(),s=c.flags,(s&65536)!==0&&(s&128)===0?(c.flags=s&-65537|128,c):null;case 5:return hh(c),null;case 13:if(Qn(mr),s=c.memoizedState,s!==null&&s.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Hn()}return s=c.flags,s&65536?(c.flags=s&-65537|128,c):null;case 19:return Qn(mr),null;case 4:return Ml(),null;case 10:return Il(c.type._context),null;case 22:case 23:return Kh(),null;case 24:return null;default:return null}}var Ud=!1,fi=!1,qM=typeof WeakSet=="function"?WeakSet:Set,jt=null;function Ol(s,c){var g=s.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(b){vr(s,c,b)}else g.current=null}function Dh(s,c,g){try{g()}catch(b){vr(s,c,b)}}var L_=!1;function HM(s,c){if(fa=Ca,s=jc(),kl(s)){if("selectionStart"in s)var g={start:s.selectionStart,end:s.selectionEnd};else e:{g=(g=s.ownerDocument)&&g.defaultView||window;var b=g.getSelection&&g.getSelection();if(b&&b.rangeCount!==0){g=b.anchorNode;var E=b.anchorOffset,j=b.focusNode;b=b.focusOffset;try{g.nodeType,j.nodeType}catch{g=null;break e}var B=0,re=-1,pe=-1,je=0,We=0,Qe=s,$e=null;t:for(;;){for(var St;Qe!==g||E!==0&&Qe.nodeType!==3||(re=B+E),Qe!==j||b!==0&&Qe.nodeType!==3||(pe=B+b),Qe.nodeType===3&&(B+=Qe.nodeValue.length),(St=Qe.firstChild)!==null;)$e=Qe,Qe=St;for(;;){if(Qe===s)break t;if($e===g&&++je===E&&(re=B),$e===j&&++We===b&&(pe=B),(St=Qe.nextSibling)!==null)break;Qe=$e,$e=Qe.parentNode}Qe=St}g=re===-1||pe===-1?null:{start:re,end:pe}}else g=null}g=g||{start:0,end:0}}else g=null;for(Ic={focusedElem:s,selectionRange:g},Ca=!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 Mt=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Mt!==null){var Ot=Mt.memoizedProps,wr=Mt.memoizedState,ke=c.stateNode,ge=ke.getSnapshotBeforeUpdate(c.elementType===c.type?Ot:Oa(c.type,Ot),wr);ke.__reactInternalSnapshotBeforeUpdate=ge}break;case 3:var Se=c.stateNode.containerInfo;Se.nodeType===1?Se.textContent="":Se.nodeType===9&&Se.documentElement&&Se.removeChild(Se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(at){vr(c,c.return,at)}if(s=c.sibling,s!==null){s.return=c.return,jt=s;break}jt=c.return}return Mt=L_,L_=!1,Mt}function Gc(s,c,g){var b=c.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var E=b=b.next;do{if((E.tag&s)===s){var j=E.destroy;E.destroy=void 0,j!==void 0&&Dh(c,g,j)}E=E.next}while(E!==b)}}function qd(s,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var g=c=c.next;do{if((g.tag&s)===s){var b=g.create;g.destroy=b()}g=g.next}while(g!==c)}}function Ph(s){var c=s.ref;if(c!==null){var g=s.stateNode;switch(s.tag){case 5:s=g;break;default:s=g}typeof c=="function"?c(s):c.current=s}}function O_(s){var c=s.alternate;c!==null&&(s.alternate=null,O_(c)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(c=s.stateNode,c!==null&&(delete c[pa],delete c[Oo],delete c[ws],delete c[uh],delete c[dh])),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 D_(s){return s.tag===5||s.tag===3||s.tag===4}function P_(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||D_(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 Fh(s,c,g){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?g.nodeType===8?g.parentNode.insertBefore(s,c):g.insertBefore(s,c):(g.nodeType===8?(c=g.parentNode,c.insertBefore(s,g)):(c=g,c.appendChild(s)),g=g._reactRootContainer,g!=null||c.onclick!==null||(c.onclick=Nl));else if(b!==4&&(s=s.child,s!==null))for(Fh(s,c,g),s=s.sibling;s!==null;)Fh(s,c,g),s=s.sibling}function Bh(s,c,g){var b=s.tag;if(b===5||b===6)s=s.stateNode,c?g.insertBefore(s,c):g.appendChild(s);else if(b!==4&&(s=s.child,s!==null))for(Bh(s,c,g),s=s.sibling;s!==null;)Bh(s,c,g),s=s.sibling}var Jr=null,Da=!1;function ro(s,c,g){for(g=g.child;g!==null;)F_(s,c,g),g=g.sibling}function F_(s,c,g){if(vn&&typeof vn.onCommitFiberUnmount=="function")try{vn.onCommitFiberUnmount(ln,g)}catch{}switch(g.tag){case 5:fi||Ol(g,c);case 6:var b=Jr,E=Da;Jr=null,ro(s,c,g),Jr=b,Da=E,Jr!==null&&(Da?(s=Jr,g=g.stateNode,s.nodeType===8?s.parentNode.removeChild(g):s.removeChild(g)):Jr.removeChild(g.stateNode));break;case 18:Jr!==null&&(Da?(s=Jr,g=g.stateNode,s.nodeType===8?Qs(s.parentNode,g):s.nodeType===1&&Qs(s,g),Na(s)):Qs(Jr,g.stateNode));break;case 4:b=Jr,E=Da,Jr=g.stateNode.containerInfo,Da=!0,ro(s,c,g),Jr=b,Da=E;break;case 0:case 11:case 14:case 15:if(!fi&&(b=g.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){E=b=b.next;do{var j=E,B=j.destroy;j=j.tag,B!==void 0&&((j&2)!==0||(j&4)!==0)&&Dh(g,c,B),E=E.next}while(E!==b)}ro(s,c,g);break;case 1:if(!fi&&(Ol(g,c),b=g.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=g.memoizedProps,b.state=g.memoizedState,b.componentWillUnmount()}catch(re){vr(g,c,re)}ro(s,c,g);break;case 21:ro(s,c,g);break;case 22:g.mode&1?(fi=(b=fi)||g.memoizedState!==null,ro(s,c,g),fi=b):ro(s,c,g);break;default:ro(s,c,g)}}function B_(s){var c=s.updateQueue;if(c!==null){s.updateQueue=null;var g=s.stateNode;g===null&&(g=s.stateNode=new qM),c.forEach(function(b){var E=ZM.bind(null,s,b);g.has(b)||(g.add(b),b.then(E,E))})}}function Pa(s,c){var g=c.deletions;if(g!==null)for(var b=0;b<g.length;b++){var E=g[b];try{var j=s,B=c,re=B;e:for(;re!==null;){switch(re.tag){case 5:Jr=re.stateNode,Da=!1;break e;case 3:Jr=re.stateNode.containerInfo,Da=!0;break e;case 4:Jr=re.stateNode.containerInfo,Da=!0;break e}re=re.return}if(Jr===null)throw Error(n(160));F_(j,B,E),Jr=null,Da=!1;var pe=E.alternate;pe!==null&&(pe.return=null),E.return=null}catch(je){vr(E,c,je)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)z_(c,s),c=c.sibling}function z_(s,c){var g=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Pa(c,s),rs(s),b&4){try{Gc(3,s,s.return),qd(3,s)}catch(Ot){vr(s,s.return,Ot)}try{Gc(5,s,s.return)}catch(Ot){vr(s,s.return,Ot)}}break;case 1:Pa(c,s),rs(s),b&512&&g!==null&&Ol(g,g.return);break;case 5:if(Pa(c,s),rs(s),b&512&&g!==null&&Ol(g,g.return),s.flags&32){var E=s.stateNode;try{Oe(E,"")}catch(Ot){vr(s,s.return,Ot)}}if(b&4&&(E=s.stateNode,E!=null)){var j=s.memoizedProps,B=g!==null?g.memoizedProps:j,re=s.type,pe=s.updateQueue;if(s.updateQueue=null,pe!==null)try{re==="input"&&j.type==="radio"&&j.name!=null&&ze(E,j),wt(re,B);var je=wt(re,j);for(B=0;B<pe.length;B+=2){var We=pe[B],Qe=pe[B+1];We==="style"?Lt(E,Qe):We==="dangerouslySetInnerHTML"?fe(E,Qe):We==="children"?Oe(E,Qe):N(E,We,Qe,je)}switch(re){case"input":Be(E,j);break;case"textarea":Kt(E,j);break;case"select":var $e=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!j.multiple;var St=j.value;St!=null?_t(E,!!j.multiple,St,!1):$e!==!!j.multiple&&(j.defaultValue!=null?_t(E,!!j.multiple,j.defaultValue,!0):_t(E,!!j.multiple,j.multiple?[]:"",!1))}E[Oo]=j}catch(Ot){vr(s,s.return,Ot)}}break;case 6:if(Pa(c,s),rs(s),b&4){if(s.stateNode===null)throw Error(n(162));E=s.stateNode,j=s.memoizedProps;try{E.nodeValue=j}catch(Ot){vr(s,s.return,Ot)}}break;case 3:if(Pa(c,s),rs(s),b&4&&g!==null&&g.memoizedState.isDehydrated)try{Na(c.containerInfo)}catch(Ot){vr(s,s.return,Ot)}break;case 4:Pa(c,s),rs(s);break;case 13:Pa(c,s),rs(s),E=s.child,E.flags&8192&&(j=E.memoizedState!==null,E.stateNode.isHidden=j,!j||E.alternate!==null&&E.alternate.memoizedState!==null||(qh=tn())),b&4&&B_(s);break;case 22:if(We=g!==null&&g.memoizedState!==null,s.mode&1?(fi=(je=fi)||We,Pa(c,s),fi=je):Pa(c,s),rs(s),b&8192){if(je=s.memoizedState!==null,(s.stateNode.isHidden=je)&&!We&&(s.mode&1)!==0)for(jt=s,We=s.child;We!==null;){for(Qe=jt=We;jt!==null;){switch($e=jt,St=$e.child,$e.tag){case 0:case 11:case 14:case 15:Gc(4,$e,$e.return);break;case 1:Ol($e,$e.return);var Mt=$e.stateNode;if(typeof Mt.componentWillUnmount=="function"){b=$e,g=$e.return;try{c=b,Mt.props=c.memoizedProps,Mt.state=c.memoizedState,Mt.componentWillUnmount()}catch(Ot){vr(b,g,Ot)}}break;case 5:Ol($e,$e.return);break;case 22:if($e.memoizedState!==null){H_(Qe);continue}}St!==null?(St.return=$e,jt=St):H_(Qe)}We=We.sibling}e:for(We=null,Qe=s;;){if(Qe.tag===5){if(We===null){We=Qe;try{E=Qe.stateNode,je?(j=E.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(re=Qe.stateNode,pe=Qe.memoizedProps.style,B=pe!=null&&pe.hasOwnProperty("display")?pe.display:null,re.style.display=dt("display",B))}catch(Ot){vr(s,s.return,Ot)}}}else if(Qe.tag===6){if(We===null)try{Qe.stateNode.nodeValue=je?"":Qe.memoizedProps}catch(Ot){vr(s,s.return,Ot)}}else if((Qe.tag!==22&&Qe.tag!==23||Qe.memoizedState===null||Qe===s)&&Qe.child!==null){Qe.child.return=Qe,Qe=Qe.child;continue}if(Qe===s)break e;for(;Qe.sibling===null;){if(Qe.return===null||Qe.return===s)break e;We===Qe&&(We=null),Qe=Qe.return}We===Qe&&(We=null),Qe.sibling.return=Qe.return,Qe=Qe.sibling}}break;case 19:Pa(c,s),rs(s),b&4&&B_(s);break;case 21:break;default:Pa(c,s),rs(s)}}function rs(s){var c=s.flags;if(c&2){try{e:{for(var g=s.return;g!==null;){if(D_(g)){var b=g;break e}g=g.return}throw Error(n(160))}switch(b.tag){case 5:var E=b.stateNode;b.flags&32&&(Oe(E,""),b.flags&=-33);var j=P_(s);Bh(s,j,E);break;case 3:case 4:var B=b.stateNode.containerInfo,re=P_(s);Fh(s,re,B);break;default:throw Error(n(161))}}catch(pe){vr(s,s.return,pe)}s.flags&=-3}c&4096&&(s.flags&=-4097)}function $M(s,c,g){jt=s,U_(s)}function U_(s,c,g){for(var b=(s.mode&1)!==0;jt!==null;){var E=jt,j=E.child;if(E.tag===22&&b){var B=E.memoizedState!==null||Ud;if(!B){var re=E.alternate,pe=re!==null&&re.memoizedState!==null||fi;re=Ud;var je=fi;if(Ud=B,(fi=pe)&&!je)for(jt=E;jt!==null;)B=jt,pe=B.child,B.tag===22&&B.memoizedState!==null?$_(E):pe!==null?(pe.return=B,jt=pe):$_(E);for(;j!==null;)jt=j,U_(j),j=j.sibling;jt=E,Ud=re,fi=je}q_(s)}else(E.subtreeFlags&8772)!==0&&j!==null?(j.return=E,jt=j):q_(s)}}function q_(s){for(;jt!==null;){var c=jt;if((c.flags&8772)!==0){var g=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:fi||qd(5,c);break;case 1:var b=c.stateNode;if(c.flags&4&&!fi)if(g===null)b.componentDidMount();else{var E=c.elementType===c.type?g.memoizedProps:Oa(c.type,g.memoizedProps);b.componentDidUpdate(E,g.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var j=c.updateQueue;j!==null&&H1(c,j,b);break;case 3:var B=c.updateQueue;if(B!==null){if(g=null,c.child!==null)switch(c.child.tag){case 5:g=c.child.stateNode;break;case 1:g=c.child.stateNode}H1(c,B,g)}break;case 5:var re=c.stateNode;if(g===null&&c.flags&4){g=re;var pe=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":pe.autoFocus&&g.focus();break;case"img":pe.src&&(g.src=pe.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var je=c.alternate;if(je!==null){var We=je.memoizedState;if(We!==null){var Qe=We.dehydrated;Qe!==null&&Na(Qe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}fi||c.flags&512&&Ph(c)}catch($e){vr(c,c.return,$e)}}if(c===s){jt=null;break}if(g=c.sibling,g!==null){g.return=c.return,jt=g;break}jt=c.return}}function H_(s){for(;jt!==null;){var c=jt;if(c===s){jt=null;break}var g=c.sibling;if(g!==null){g.return=c.return,jt=g;break}jt=c.return}}function $_(s){for(;jt!==null;){var c=jt;try{switch(c.tag){case 0:case 11:case 15:var g=c.return;try{qd(4,c)}catch(pe){vr(c,g,pe)}break;case 1:var b=c.stateNode;if(typeof b.componentDidMount=="function"){var E=c.return;try{b.componentDidMount()}catch(pe){vr(c,E,pe)}}var j=c.return;try{Ph(c)}catch(pe){vr(c,j,pe)}break;case 5:var B=c.return;try{Ph(c)}catch(pe){vr(c,B,pe)}}}catch(pe){vr(c,c.return,pe)}if(c===s){jt=null;break}var re=c.sibling;if(re!==null){re.return=c.return,jt=re;break}jt=c.return}}var WM=Math.ceil,Hd=R.ReactCurrentDispatcher,zh=R.ReactCurrentOwner,xa=R.ReactCurrentBatchConfig,Mn=0,Kr=null,Ar=null,ei=0,Xi=0,Dl=Ja(0),zr=0,Kc=null,Uo=0,$d=0,Uh=0,Yc=null,Li=null,qh=0,Pl=1/0,Is=null,Wd=!1,Hh=null,io=null,Vd=!1,ao=null,Gd=0,Qc=0,$h=null,Kd=-1,Yd=0;function xi(){return(Mn&6)!==0?tn():Kd!==-1?Kd:Kd=tn()}function so(s){return(s.mode&1)===0?1:(Mn&2)!==0&&ei!==0?ei&-ei:Pr.transition!==null?(Yd===0&&(Yd=$i()),Yd):(s=_n,s!==0||(s=window.event,s=s===void 0?16:hs(s.type)),s)}function Fa(s,c,g,b){if(50<Qc)throw Qc=0,$h=null,Error(n(185));Ei(s,g,b),((Mn&2)===0||s!==Kr)&&(s===Kr&&((Mn&2)===0&&($d|=g),zr===4&&oo(s,ei)),Oi(s,b),g===1&&Mn===0&&(c.mode&1)===0&&(Pl=tn()+500,Ns&&Ma()))}function Oi(s,c){var g=s.callbackNode;wi(s,c);var b=_i(s,s===Kr?ei:0);if(b===0)g!==null&&Kn(g),s.callbackNode=null,s.callbackPriority=0;else if(c=b&-b,s.callbackPriority!==c){if(g!=null&&Kn(g),c===1)s.tag===0?jd(V_.bind(null,s)):Do(V_.bind(null,s)),ch(function(){(Mn&6)===0&&Ma()}),g=null;else{switch(Zt(b)){case 1:g=aa;break;case 4:g=qi;break;case 16:g=Hi;break;case 536870912:g=Nt;break;default:g=Hi}g=ew(g,W_.bind(null,s))}s.callbackPriority=c,s.callbackNode=g}}function W_(s,c){if(Kd=-1,Yd=0,(Mn&6)!==0)throw Error(n(327));var g=s.callbackNode;if(Fl()&&s.callbackNode!==g)return null;var b=_i(s,s===Kr?ei:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||c)c=Qd(s,b);else{c=b;var E=Mn;Mn|=2;var j=K_();(Kr!==s||ei!==c)&&(Is=null,Pl=tn()+500,Ho(s,c));do try{KM();break}catch(re){G_(s,re)}while(!0);Al(),Hd.current=j,Mn=E,Ar!==null?c=0:(Kr=null,ei=0,c=zr)}if(c!==0){if(c===2&&(E=Si(s),E!==0&&(b=E,c=Wh(s,E))),c===1)throw g=Kc,Ho(s,0),oo(s,b),Oi(s,tn()),g;if(c===6)oo(s,b);else{if(E=s.current.alternate,(b&30)===0&&!VM(E)&&(c=Qd(s,b),c===2&&(j=Si(s),j!==0&&(b=j,c=Wh(s,j))),c===1))throw g=Kc,Ho(s,0),oo(s,b),Oi(s,tn()),g;switch(s.finishedWork=E,s.finishedLanes=b,c){case 0:case 1:throw Error(n(345));case 2:$o(s,Li,Is);break;case 3:if(oo(s,b),(b&130023424)===b&&(c=qh+500-tn(),10<c)){if(_i(s,0)!==0)break;if(E=s.suspendedLanes,(E&b)!==b){xi(),s.pingedLanes|=s.suspendedLanes&E;break}s.timeoutHandle=Lc($o.bind(null,s,Li,Is),c);break}$o(s,Li,Is);break;case 4:if(oo(s,b),(b&4194240)===b)break;for(c=s.eventTimes,E=-1;0<b;){var B=31-dn(b);j=1<<B,B=c[B],B>E&&(E=B),b&=~j}if(b=E,b=tn()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*WM(b/1960))-b,10<b){s.timeoutHandle=Lc($o.bind(null,s,Li,Is),b);break}$o(s,Li,Is);break;case 5:$o(s,Li,Is);break;default:throw Error(n(329))}}}return Oi(s,tn()),s.callbackNode===g?W_.bind(null,s):null}function Wh(s,c){var g=Yc;return s.current.memoizedState.isDehydrated&&(Ho(s,c).flags|=256),s=Qd(s,c),s!==2&&(c=Li,Li=g,c!==null&&Vh(c)),s}function Vh(s){Li===null?Li=s:Li.push.apply(Li,s)}function VM(s){for(var c=s;;){if(c.flags&16384){var g=c.updateQueue;if(g!==null&&(g=g.stores,g!==null))for(var b=0;b<g.length;b++){var E=g[b],j=E.getSnapshot;E=E.value;try{if(!Ti(j(),E))return!1}catch{return!1}}}if(g=c.child,c.subtreeFlags&16384&&g!==null)g.return=c,c=g;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 oo(s,c){for(c&=~Uh,c&=~$d,s.suspendedLanes|=c,s.pingedLanes&=~c,s=s.expirationTimes;0<c;){var g=31-dn(c),b=1<<g;s[g]=-1,c&=~b}}function V_(s){if((Mn&6)!==0)throw Error(n(327));Fl();var c=_i(s,0);if((c&1)===0)return Oi(s,tn()),null;var g=Qd(s,c);if(s.tag!==0&&g===2){var b=Si(s);b!==0&&(c=b,g=Wh(s,b))}if(g===1)throw g=Kc,Ho(s,0),oo(s,c),Oi(s,tn()),g;if(g===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=c,$o(s,Li,Is),Oi(s,tn()),null}function Gh(s,c){var g=Mn;Mn|=1;try{return s(c)}finally{Mn=g,Mn===0&&(Pl=tn()+500,Ns&&Ma())}}function qo(s){ao!==null&&ao.tag===0&&(Mn&6)===0&&Fl();var c=Mn;Mn|=1;var g=xa.transition,b=_n;try{if(xa.transition=null,_n=1,s)return s()}finally{_n=b,xa.transition=g,Mn=c,(Mn&6)===0&&Ma()}}function Kh(){Xi=Dl.current,Qn(Dl)}function Ho(s,c){s.finishedWork=null,s.finishedLanes=0;var g=s.timeoutHandle;if(g!==-1&&(s.timeoutHandle=-1,lh(g)),Ar!==null)for(g=Ar.return;g!==null;){var b=g;switch(cr(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&Js();break;case 3:Ml(),Qn(li),Qn(Rr),mh();break;case 5:hh(b);break;case 4:Ml();break;case 13:Qn(mr);break;case 19:Qn(mr);break;case 10:Il(b.type._context);break;case 22:case 23:Kh()}g=g.return}if(Kr=s,Ar=s=lo(s.current,null),ei=Xi=c,zr=0,Kc=null,Uh=$d=Uo=0,Li=Yc=null,La!==null){for(c=0;c<La.length;c++)if(g=La[c],b=g.interleaved,b!==null){g.interleaved=null;var E=b.next,j=g.pending;if(j!==null){var B=j.next;j.next=E,b.next=B}g.pending=b}La=null}return s}function G_(s,c){do{var g=Ar;try{if(Al(),Md.current=Pd,Ld){for(var b=xr.memoizedState;b!==null;){var E=b.queue;E!==null&&(E.pending=null),b=b.next}Ld=!1}if(zo=0,Gr=Br=xr=null,qc=!1,Hc=0,zh.current=null,g===null||g.return===null){zr=1,Kc=c,Ar=null;break}e:{var j=s,B=g.return,re=g,pe=c;if(c=ei,re.flags|=32768,pe!==null&&typeof pe=="object"&&typeof pe.then=="function"){var je=pe,We=re,Qe=We.tag;if((We.mode&1)===0&&(Qe===0||Qe===11||Qe===15)){var $e=We.alternate;$e?(We.updateQueue=$e.updateQueue,We.memoizedState=$e.memoizedState,We.lanes=$e.lanes):(We.updateQueue=null,We.memoizedState=null)}var St=y_(B);if(St!==null){St.flags&=-257,b_(St,B,re,j,c),St.mode&1&&x_(j,je,c),c=St,pe=je;var Mt=c.updateQueue;if(Mt===null){var Ot=new Set;Ot.add(pe),c.updateQueue=Ot}else Mt.add(pe);break e}else{if((c&1)===0){x_(j,je,c),Yh();break e}pe=Error(n(426))}}else if(ue&&re.mode&1){var wr=y_(B);if(wr!==null){(wr.flags&65536)===0&&(wr.flags|=256),b_(wr,B,re,j,c),hr(Ll(pe,re));break e}}j=pe=Ll(pe,re),zr!==4&&(zr=2),Yc===null?Yc=[j]:Yc.push(j),j=B;do{switch(j.tag){case 3:j.flags|=65536,c&=-c,j.lanes|=c;var ke=g_(j,pe,c);q1(j,ke);break e;case 1:re=pe;var ge=j.type,Se=j.stateNode;if((j.flags&128)===0&&(typeof ge.getDerivedStateFromError=="function"||Se!==null&&typeof Se.componentDidCatch=="function"&&(io===null||!io.has(Se)))){j.flags|=65536,c&=-c,j.lanes|=c;var at=m_(j,re,c);q1(j,at);break e}}j=j.return}while(j!==null)}Q_(g)}catch(Bt){c=Bt,Ar===g&&g!==null&&(Ar=g=g.return);continue}break}while(!0)}function K_(){var s=Hd.current;return Hd.current=Pd,s===null?Pd:s}function Yh(){(zr===0||zr===3||zr===2)&&(zr=4),Kr===null||(Uo&268435455)===0&&($d&268435455)===0||oo(Kr,ei)}function Qd(s,c){var g=Mn;Mn|=2;var b=K_();(Kr!==s||ei!==c)&&(Is=null,Ho(s,c));do try{GM();break}catch(E){G_(s,E)}while(!0);if(Al(),Mn=g,Hd.current=b,Ar!==null)throw Error(n(261));return Kr=null,ei=0,zr}function GM(){for(;Ar!==null;)Y_(Ar)}function KM(){for(;Ar!==null&&!Ui();)Y_(Ar)}function Y_(s){var c=J_(s.alternate,s,Xi);s.memoizedProps=s.pendingProps,c===null?Q_(s):Ar=c,zh.current=null}function Q_(s){var c=s;do{var g=c.alternate;if(s=c.return,(c.flags&32768)===0){if(g=zM(g,c,Xi),g!==null){Ar=g;return}}else{if(g=UM(g,c),g!==null){g.flags&=32767,Ar=g;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{zr=6,Ar=null;return}}if(c=c.sibling,c!==null){Ar=c;return}Ar=c=s}while(c!==null);zr===0&&(zr=5)}function $o(s,c,g){var b=_n,E=xa.transition;try{xa.transition=null,_n=1,YM(s,c,g,b)}finally{xa.transition=E,_n=b}return null}function YM(s,c,g,b){do Fl();while(ao!==null);if((Mn&6)!==0)throw Error(n(327));g=s.finishedWork;var E=s.finishedLanes;if(g===null)return null;if(s.finishedWork=null,s.finishedLanes=0,g===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var j=g.lanes|g.childLanes;if(Dr(s,j),s===Kr&&(Ar=Kr=null,ei=0),(g.subtreeFlags&2064)===0&&(g.flags&2064)===0||Vd||(Vd=!0,ew(Hi,function(){return Fl(),null})),j=(g.flags&15990)!==0,(g.subtreeFlags&15990)!==0||j){j=xa.transition,xa.transition=null;var B=_n;_n=1;var re=Mn;Mn|=4,zh.current=null,HM(s,g),z_(g,s),md(Ic),Ca=!!fa,Ic=fa=null,s.current=g,$M(g),fr(),Mn=re,_n=B,xa.transition=j}else s.current=g;if(Vd&&(Vd=!1,ao=s,Gd=E),j=s.pendingLanes,j===0&&(io=null),Cn(g.stateNode),Oi(s,tn()),c!==null)for(b=s.onRecoverableError,g=0;g<c.length;g++)E=c[g],b(E.value,{componentStack:E.stack,digest:E.digest});if(Wd)throw Wd=!1,s=Hh,Hh=null,s;return(Gd&1)!==0&&s.tag!==0&&Fl(),j=s.pendingLanes,(j&1)!==0?s===$h?Qc++:(Qc=0,$h=s):Qc=0,Ma(),null}function Fl(){if(ao!==null){var s=Zt(Gd),c=xa.transition,g=_n;try{if(xa.transition=null,_n=16>s?16:s,ao===null)var b=!1;else{if(s=ao,ao=null,Gd=0,(Mn&6)!==0)throw Error(n(331));var E=Mn;for(Mn|=4,jt=s.current;jt!==null;){var j=jt,B=j.child;if((jt.flags&16)!==0){var re=j.deletions;if(re!==null){for(var pe=0;pe<re.length;pe++){var je=re[pe];for(jt=je;jt!==null;){var We=jt;switch(We.tag){case 0:case 11:case 15:Gc(8,We,j)}var Qe=We.child;if(Qe!==null)Qe.return=We,jt=Qe;else for(;jt!==null;){We=jt;var $e=We.sibling,St=We.return;if(O_(We),We===je){jt=null;break}if($e!==null){$e.return=St,jt=$e;break}jt=St}}}var Mt=j.alternate;if(Mt!==null){var Ot=Mt.child;if(Ot!==null){Mt.child=null;do{var wr=Ot.sibling;Ot.sibling=null,Ot=wr}while(Ot!==null)}}jt=j}}if((j.subtreeFlags&2064)!==0&&B!==null)B.return=j,jt=B;else e:for(;jt!==null;){if(j=jt,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:Gc(9,j,j.return)}var ke=j.sibling;if(ke!==null){ke.return=j.return,jt=ke;break e}jt=j.return}}var ge=s.current;for(jt=ge;jt!==null;){B=jt;var Se=B.child;if((B.subtreeFlags&2064)!==0&&Se!==null)Se.return=B,jt=Se;else e:for(B=ge;jt!==null;){if(re=jt,(re.flags&2048)!==0)try{switch(re.tag){case 0:case 11:case 15:qd(9,re)}}catch(Bt){vr(re,re.return,Bt)}if(re===B){jt=null;break e}var at=re.sibling;if(at!==null){at.return=re.return,jt=at;break e}jt=re.return}}if(Mn=E,Ma(),vn&&typeof vn.onPostCommitFiberRoot=="function")try{vn.onPostCommitFiberRoot(ln,s)}catch{}b=!0}return b}finally{_n=g,xa.transition=c}}return!1}function X_(s,c,g){c=Ll(g,c),c=g_(s,c,1),s=no(s,c,1),c=xi(),s!==null&&(Ei(s,1,c),Oi(s,c))}function vr(s,c,g){if(s.tag===3)X_(s,s,g);else for(;c!==null;){if(c.tag===3){X_(c,s,g);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(io===null||!io.has(b))){s=Ll(g,s),s=m_(c,s,1),c=no(c,s,1),s=xi(),c!==null&&(Ei(c,1,s),Oi(c,s));break}}c=c.return}}function QM(s,c,g){var b=s.pingCache;b!==null&&b.delete(c),c=xi(),s.pingedLanes|=s.suspendedLanes&g,Kr===s&&(ei&g)===g&&(zr===4||zr===3&&(ei&130023424)===ei&&500>tn()-qh?Ho(s,0):Uh|=g),Oi(s,c)}function Z_(s,c){c===0&&((s.mode&1)===0?c=1:(c=Qr,Qr<<=1,(Qr&130023424)===0&&(Qr=4194304)));var g=xi();s=Ts(s,c),s!==null&&(Ei(s,c,g),Oi(s,g))}function XM(s){var c=s.memoizedState,g=0;c!==null&&(g=c.retryLane),Z_(s,g)}function ZM(s,c){var g=0;switch(s.tag){case 13:var b=s.stateNode,E=s.memoizedState;E!==null&&(g=E.retryLane);break;case 19:b=s.stateNode;break;default:throw Error(n(314))}b!==null&&b.delete(c),Z_(s,g)}var J_;J_=function(s,c,g){if(s!==null)if(s.memoizedProps!==c.pendingProps||li.current)Mi=!0;else{if((s.lanes&g)===0&&(c.flags&128)===0)return Mi=!1,BM(s,c,g);Mi=(s.flags&131072)!==0}else Mi=!1,ue&&(c.flags&1048576)!==0&&Un(c,ne,c.index);switch(c.lanes=0,c.tag){case 2:var b=c.type;zd(s,c),s=c.pendingProps;var E=Yi(c,Rr.current);Qi(c,g),E=bh(null,c,b,s,E,g);var j=vh();return c.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,ci(b)?(j=!0,jl(c)):j=!1,c.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,fh(c),E.updater=Fd,c.stateNode=E,E._reactInternals=c,Nh(c,b,s,g),c=Rh(null,c,b,!0,j,g)):(c.tag=0,ue&&j&&In(c),mi(null,c,E,g),c=c.child),c;case 16:b=c.elementType;e:{switch(zd(s,c),s=c.pendingProps,E=b._init,b=E(b._payload),c.type=b,E=c.tag=eL(b),s=Oa(b,s),E){case 0:c=Th(null,c,b,s,g);break e;case 1:c=E_(null,c,b,s,g);break e;case 11:c=v_(null,c,b,s,g);break e;case 14:c=k_(null,c,b,Oa(b.type,s),g);break e}throw Error(n(306,b,""))}return c;case 0:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:Oa(b,E),Th(s,c,b,E,g);case 1:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:Oa(b,E),E_(s,c,b,E,g);case 3:e:{if(N_(c),s===null)throw Error(n(387));b=c.pendingProps,j=c.memoizedState,E=j.element,U1(s,c),Ad(c,b,null,g);var B=c.memoizedState;if(b=B.element,j.isDehydrated)if(j={element:b,isDehydrated:!1,cache:B.cache,pendingSuspenseBoundaries:B.pendingSuspenseBoundaries,transitions:B.transitions},c.updateQueue.baseState=j,c.memoizedState=j,c.flags&256){E=Ll(Error(n(423)),c),c=C_(s,c,b,g,E);break e}else if(b!==E){E=Ll(Error(n(424)),c),c=C_(s,c,b,g,E);break e}else for(Z=Aa(c.stateNode.containerInfo.firstChild),me=c,ue=!0,Ne=null,g=Td(c,null,b,g),c.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(Hn(),b===E){c=As(s,c,g);break e}mi(s,c,b,g)}c=c.child}return c;case 5:return $1(c),s===null&&Vt(c),b=c.type,E=c.pendingProps,j=s!==null?s.memoizedProps:null,B=E.children,Mc(b,E)?B=null:j!==null&&Mc(b,j)&&(c.flags|=32),S_(s,c),mi(s,c,B,g),c.child;case 6:return s===null&&Vt(c),null;case 13:return j_(s,c,g);case 4:return ph(c,c.stateNode.containerInfo),b=c.pendingProps,s===null?c.child=ga(c,null,b,g):mi(s,c,b,g),c.child;case 11:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:Oa(b,E),v_(s,c,b,E,g);case 7:return mi(s,c,c.pendingProps,g),c.child;case 8:return mi(s,c,c.pendingProps.children,g),c.child;case 12:return mi(s,c,c.pendingProps.children,g),c.child;case 10:e:{if(b=c.type._context,E=c.pendingProps,j=c.memoizedProps,B=E.value,Sn(Po,b._currentValue),b._currentValue=B,j!==null)if(Ti(j.value,B)){if(j.children===E.children&&!li.current){c=As(s,c,g);break e}}else for(j=c.child,j!==null&&(j.return=c);j!==null;){var re=j.dependencies;if(re!==null){B=j.child;for(var pe=re.firstContext;pe!==null;){if(pe.context===b){if(j.tag===1){pe=Rs(-1,g&-g),pe.tag=2;var je=j.updateQueue;if(je!==null){je=je.shared;var We=je.pending;We===null?pe.next=pe:(pe.next=We.next,We.next=pe),je.pending=pe}}j.lanes|=g,pe=j.alternate,pe!==null&&(pe.lanes|=g),Fr(j.return,g,c),re.lanes|=g;break}pe=pe.next}}else if(j.tag===10)B=j.type===c.type?null:j.child;else if(j.tag===18){if(B=j.return,B===null)throw Error(n(341));B.lanes|=g,re=B.alternate,re!==null&&(re.lanes|=g),Fr(B,g,c),B=j.sibling}else B=j.child;if(B!==null)B.return=j;else for(B=j;B!==null;){if(B===c){B=null;break}if(j=B.sibling,j!==null){j.return=B.return,B=j;break}B=B.return}j=B}mi(s,c,E.children,g),c=c.child}return c;case 9:return E=c.type,b=c.pendingProps.children,Qi(c,g),E=gr(E),b=b(E),c.flags|=1,mi(s,c,b,g),c.child;case 14:return b=c.type,E=Oa(b,c.pendingProps),E=Oa(b.type,E),k_(s,c,b,E,g);case 15:return __(s,c,c.type,c.pendingProps,g);case 17:return b=c.type,E=c.pendingProps,E=c.elementType===b?E:Oa(b,E),zd(s,c),c.tag=1,ci(b)?(s=!0,jl(c)):s=!1,Qi(c,g),p_(c,b,E),Nh(c,b,E,g),Rh(null,c,b,!0,s,g);case 19:return R_(s,c,g);case 22:return w_(s,c,g)}throw Error(n(156,c.tag))};function ew(s,c){return $t(s,c)}function JM(s,c,g,b){this.tag=s,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ya(s,c,g,b){return new JM(s,c,g,b)}function Qh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function eL(s){if(typeof s=="function")return Qh(s)?1:0;if(s!=null){if(s=s.$$typeof,s===$)return 11;if(s===z)return 14}return 2}function lo(s,c){var g=s.alternate;return g===null?(g=ya(s.tag,c,s.key,s.mode),g.elementType=s.elementType,g.type=s.type,g.stateNode=s.stateNode,g.alternate=s,s.alternate=g):(g.pendingProps=c,g.type=s.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=s.flags&14680064,g.childLanes=s.childLanes,g.lanes=s.lanes,g.child=s.child,g.memoizedProps=s.memoizedProps,g.memoizedState=s.memoizedState,g.updateQueue=s.updateQueue,c=s.dependencies,g.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},g.sibling=s.sibling,g.index=s.index,g.ref=s.ref,g}function Xd(s,c,g,b,E,j){var B=2;if(b=s,typeof s=="function")Qh(s)&&(B=1);else if(typeof s=="string")B=5;else e:switch(s){case M:return Wo(g.children,E,j,c);case I:B=8,E|=8;break;case A:return s=ya(12,g,c,E|2),s.elementType=A,s.lanes=j,s;case te:return s=ya(13,g,c,E),s.elementType=te,s.lanes=j,s;case V:return s=ya(19,g,c,E),s.elementType=V,s.lanes=j,s;case K:return Zd(g,E,j,c);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case L:B=10;break e;case D:B=9;break e;case $:B=11;break e;case z:B=14;break e;case G:B=16,b=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return c=ya(B,g,c,E),c.elementType=s,c.type=b,c.lanes=j,c}function Wo(s,c,g,b){return s=ya(7,s,b,c),s.lanes=g,s}function Zd(s,c,g,b){return s=ya(22,s,b,c),s.elementType=K,s.lanes=g,s.stateNode={isHidden:!1},s}function Xh(s,c,g){return s=ya(6,s,null,c),s.lanes=g,s}function Zh(s,c,g){return c=ya(4,s.children!==null?s.children:[],s.key,c),c.lanes=g,c.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},c}function tL(s,c,g,b,E){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=Or(0),this.expirationTimes=Or(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Or(0),this.identifierPrefix=b,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Jh(s,c,g,b,E,j,B,re,pe){return s=new tL(s,c,g,re,pe),c===1?(c=1,j===!0&&(c|=8)):c=0,j=ya(3,null,null,c),s.current=j,j.stateNode=s,j.memoizedState={element:b,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},fh(j),s}function nL(s,c,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:C,key:b==null?null:""+b,children:s,containerInfo:c,implementation:g}}function tw(s){if(!s)return Ai;s=s._reactInternals;e:{if(Wn(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(ci(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(s.tag===1){var g=s.type;if(ci(g))return Nd(s,g,c)}return c}function nw(s,c,g,b,E,j,B,re,pe){return s=Jh(g,b,!0,s,E,j,B,re,pe),s.context=tw(null),g=s.current,b=xi(),E=so(g),j=Rs(b,E),j.callback=c??null,no(g,j,E),s.current.lanes=E,Ei(s,E,b),Oi(s,b),s}function Jd(s,c,g,b){var E=c.current,j=xi(),B=so(E);return g=tw(g),c.context===null?c.context=g:c.pendingContext=g,c=Rs(j,B),c.payload={element:s},b=b===void 0?null:b,b!==null&&(c.callback=b),s=no(E,c,B),s!==null&&(Fa(s,E,B,j),Rd(s,E,B)),B}function ef(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 rw(s,c){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var g=s.retryLane;s.retryLane=g!==0&&g<c?g:c}}function eg(s,c){rw(s,c),(s=s.alternate)&&rw(s,c)}function rL(){return null}var iw=typeof reportError=="function"?reportError:function(s){console.error(s)};function tg(s){this._internalRoot=s}tf.prototype.render=tg.prototype.render=function(s){var c=this._internalRoot;if(c===null)throw Error(n(409));Jd(s,c,null,null)},tf.prototype.unmount=tg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var c=s.containerInfo;qo(function(){Jd(null,s,null,null)}),c[Ia]=null}};function tf(s){this._internalRoot=s}tf.prototype.unstable_scheduleHydration=function(s){if(s){var c=or();s={blockedOn:null,target:s,priority:c};for(var g=0;g<Vn.length&&c!==0&&c<Vn[g].priority;g++);Vn.splice(g,0,s),g===0&&us(s)}};function ng(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function nf(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function aw(){}function iL(s,c,g,b,E){if(E){if(typeof b=="function"){var j=b;b=function(){var je=ef(B);j.call(je)}}var B=nw(c,b,s,0,null,!1,!1,"",aw);return s._reactRootContainer=B,s[Ia]=B.current,ks(s.nodeType===8?s.parentNode:s),qo(),B}for(;E=s.lastChild;)s.removeChild(E);if(typeof b=="function"){var re=b;b=function(){var je=ef(pe);re.call(je)}}var pe=Jh(s,0,!1,null,null,!1,!1,"",aw);return s._reactRootContainer=pe,s[Ia]=pe.current,ks(s.nodeType===8?s.parentNode:s),qo(function(){Jd(c,pe,g,b)}),pe}function rf(s,c,g,b,E){var j=g._reactRootContainer;if(j){var B=j;if(typeof E=="function"){var re=E;E=function(){var pe=ef(B);re.call(pe)}}Jd(c,B,s,E)}else B=iL(g,c,s,E,b);return ef(B)}ii=function(s){switch(s.tag){case 3:var c=s.stateNode;if(c.current.memoizedState.isDehydrated){var g=$r(c.pendingLanes);g!==0&&(Sa(c,g|1),Oi(c,tn()),(Mn&6)===0&&(Pl=tn()+500,Ma()))}break;case 13:qo(function(){var b=Ts(s,1);if(b!==null){var E=xi();Fa(b,s,1,E)}}),eg(s,1)}},On=function(s){if(s.tag===13){var c=Ts(s,134217728);if(c!==null){var g=xi();Fa(c,s,134217728,g)}eg(s,134217728)}},jn=function(s){if(s.tag===13){var c=so(s),g=Ts(s,c);if(g!==null){var b=xi();Fa(g,s,c,b)}eg(s,c)}},or=function(){return _n},Xr=function(s,c){var g=_n;try{return _n=s,c()}finally{_n=g}},kt=function(s,c,g){switch(c){case"input":if(Be(s,g),c=g.name,g.type==="radio"&&c!=null){for(g=s;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<g.length;c++){var b=g[c];if(b!==s&&b.form===s.form){var E=Cl(b);if(!E)throw Error(n(90));ct(b),Be(b,E)}}}break;case"textarea":Kt(s,g);break;case"select":c=g.value,c!=null&&_t(s,!!g.multiple,c,!1)}},Te=Gh,mt=qo;var aL={usingClientEntryPoint:!1,Events:[Ss,oi,Cl,X,Ee,Gh]},Xc={findFiberByHostInstance:Ki,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},sL={bundleType:Xc.bundleType,version:Xc.version,rendererPackageName:Xc.rendererPackageName,rendererConfig:Xc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:R.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=wa(s),s===null?null:s.stateNode},findFiberByHostInstance:Xc.findFiberByHostInstance||rL,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 af=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!af.isDisabled&&af.supportsFiber)try{ln=af.inject(sL),vn=af}catch{}}return Di.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aL,Di.createPortal=function(s,c){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ng(c))throw Error(n(200));return nL(s,c,null,g)},Di.createRoot=function(s,c){if(!ng(s))throw Error(n(299));var g=!1,b="",E=iw;return c!=null&&(c.unstable_strictMode===!0&&(g=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onRecoverableError!==void 0&&(E=c.onRecoverableError)),c=Jh(s,1,!1,null,null,g,!1,b,E),s[Ia]=c.current,ks(s.nodeType===8?s.parentNode:s),new tg(c)},Di.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=wa(c),s=s===null?null:s.stateNode,s},Di.flushSync=function(s){return qo(s)},Di.hydrate=function(s,c,g){if(!nf(c))throw Error(n(200));return rf(null,s,c,!0,g)},Di.hydrateRoot=function(s,c,g){if(!ng(s))throw Error(n(405));var b=g!=null&&g.hydratedSources||null,E=!1,j="",B=iw;if(g!=null&&(g.unstable_strictMode===!0&&(E=!0),g.identifierPrefix!==void 0&&(j=g.identifierPrefix),g.onRecoverableError!==void 0&&(B=g.onRecoverableError)),c=nw(c,null,s,1,g??null,E,!1,j,B),s[Ia]=c.current,ks(s),b)for(s=0;s<b.length;s++)g=b[s],E=g._getVersion,E=E(g._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[g,E]:c.mutableSourceEagerHydrationData.push(g,E);return new tf(c)},Di.render=function(s,c,g){if(!nf(c))throw Error(n(200));return rf(null,s,c,!1,g)},Di.unmountComponentAtNode=function(s){if(!nf(s))throw Error(n(40));return s._reactRootContainer?(qo(function(){rf(null,null,s,!1,function(){s._reactRootContainer=null,s[Ia]=null})}),!0):!1},Di.unstable_batchedUpdates=Gh,Di.unstable_renderSubtreeIntoContainer=function(s,c,g,b){if(!nf(g))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return rf(s,c,g,!1,b)},Di.version="18.3.1-next-f1338f8080-20240426",Di}var pw;function cA(){if(pw)return ag.exports;pw=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(),ag.exports=pL(),ag.exports}var hw;function hL(){if(hw)return of;hw=1;var e=cA();return of.createRoot=e.createRoot,of.hydrateRoot=e.hydrateRoot,of}var gL=hL();const mL=tc(gL),xL="modulepreload",yL=function(e){return"/"+e},gw={},uA=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=l(n.map(f=>{if(f=yL(f),f in gw)return;gw[f]=!0;const p=f.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const m=document.createElement("link");if(m.rel=p?"stylesheet":xL,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 i.then(l=>{for(const u of l||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})},Os={"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.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 — input hidden","chat.thinking":"Thinking","chat.error_badge":"Error","chat.assistant_typing":"Assistant is typing","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.stopped_notice":"Stopped by user","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","chat.shortcut_pills_label":"Shortcut pills","chat.shortcut_pill_delete":"Delete shortcut","chat.shortcut_pill_drag_hint":"Drag to reorder shortcuts","chat.shortcut_save_error":"Failed to save shortcuts","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.auth_error.code_detail":"Error code: {code}","login.auth_error.exchange_failed":"Sign-in could not be completed. Try again.","login.auth_error.flow_registration_failed":"Sign-in could not start. Try again.","login.auth_error.generic":"Sign-in failed. Try again.","login.auth_error.login_failed":"Sign-in failed. Try again.","login.auth_error.not_pinned":"This instance is pinned to another member. Ask the owner for access.","login.auth_error.state_mismatch":"This sign-in link expired or was already used. Start again.","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.sign_in_with_cloudflare":"Sign in with Cloudflare Access","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.requester":"From: {session}","permission.summary_multi":"{count} requests across {sessions} sessions","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.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.voice":"Voice","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.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.notifications_merged_note":"The push toggle at the top is the server-side default for newly created sessions and saves with the Save bar. The toggles below it apply to this browser only and save immediately.","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.experimental.blurb":"Settings in this group are experimental. They can change or disappear in a future release.","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. epm/xxx, or pave(s):// URL","settings.model_registry.spec_hint":"epm/xxx alias, or pave(s):// URL","settings.model_registry.kind_alias":"Alias","settings.model_registry.advanced":"Advanced (limits)","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.apikey_label":"API Key","settings.model_registry.apikey_placeholder":"Leave blank to keep current key","settings.model_registry.apikey_placeholder_new":"Paste the API key","settings.model_registry.apikey_show":"Show","settings.model_registry.apikey_hide":"Hide","settings.model_registry.apikey_stored":"STORED: {profile}","settings.model_registry.apikey_remove":"Remove key","settings.model_registry.apikey_removing":"The stored key will be removed when you save.","settings.model_registry.apikey_hint":"Stored as auth profile `{profile}` — never part of the URL.","settings.model_registry.apikey_badge_set":"KEY SET","settings.model_registry.apikey_badge_none":"NO KEY","settings.model_registry.apikey_delete_note":"The API key profile `{profile}` will also be removed from settings. Profiles you created by hand are never touched.","settings.model_registry.apikey_help_title":"Accepted model specs","settings.model_registry.apikey_help_close":"Close","settings.model_registry.apikey_help_alias":"Alias shorthand: epm/xxx","settings.model_registry.apikey_help_url":"PAVE URL syntax: pave://, paves://, https://","settings.model_registry.apikey_help_keys":"Keys: key=$ENV_VAR or env:VAR only. Literal keys are rejected. Use auth=<profile> for a stored profile.","settings.model_registry.apikey_help_registry":"Registry key: auth=registry-<name>","settings.model_registry.apikey_help_deprecated":"deprecated, no longer accepted","settings.model_registry.apikey_help_docs":"See docs/pave-connection-string.md","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.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","pwa.install_title":"Install PAVE","pwa.install_description":"Add PAVE to your home screen for the full-screen app.","pwa.install_button":"Install","pwa.install_dismiss":"Not now","pwa.install_got_it":"Got it","pwa.ios_howto":"On iOS: tap Share, then choose Add to Home Screen.","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.","import.directory_missing":"The session was saved in a directory that does not exist here: {directory}","import.directory_create":"Create the directory","import.directory_use_default":"Use the default directory","import.directory_choose":"Choose another directory","import.directory_invalid":"That directory cannot be used: {message}","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.mcp_toggle_header":"MCP servers","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.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","voice.engine":"Speech recognition engine","voice.engine_description":"Whisper is the default engine. Paraformer streams live.","voice.engine_whisper_hint":"Batch - all languages (default)","voice.engine_paraformer_hint":"Live streaming - Chinese / Cantonese / English","voice.engine_switch_failed":"Could not switch the speech engine","voice.paraformer_starting":"Paraformer is starting. First use downloads about 1 GB.","voice.language":"Speech recognition language","voice.language_description":"Force a language instead of relying on auto-detection.","voice.model":"Speech recognition model","voice.model_description":"The model Whisper transcribes with.","voice.whisper_only":"Applies to Whisper only.","voice.cantonese_note":"Cantonese needs whisper-small or a larger model.","voice.next_recording_note":"A change applies to the next recording.","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.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.","app.triggers_tab":"Triggers","triggers.title":"Triggers","triggers.back_to_chat":"Back to chat","triggers.create":"New trigger","triggers.edit":"Edit","triggers.delete":"Delete","triggers.copy":"Copy","triggers.copy_failed":"Could not copy the webhook URL.","triggers.reveal":"Reveal","triggers.hide":"Hide","triggers.empty":"No triggers yet.","triggers.loading":"Loading triggers…","triggers.dismiss":"Dismiss","triggers.cancel":"Cancel","triggers.save":"Save","triggers.name":"Name","triggers.type":"Type","triggers.target_mode":"Target","triggers.target_existing":"Existing session","triggers.target_spawn":"New session","triggers.session_id":"Session ID","triggers.soul":"Soul","triggers.model":"Model","triggers.template":"Message template","triggers.payload_format":"Body format","triggers.payload_format_help":"How the inbound body is delivered when no template is set. YAML is easier to read; JSON is the default.","triggers.experimental_tag":"experimental","triggers.request_failed":"The request failed."},xo={en:Os},bL={"zh-TW":()=>uA(()=>import("./zh-TW-CSQwPgyX.js"),[])},Vl=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function mw(e){if(xo[e])return xo[e];const t=bL[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),Os;try{const n=await t();return xo[e]=n.default||n,xo[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),Os}}function dA(e,t,n){let r=e[t];return r===void 0&&e!==Os&&(r=Os[t]),r===void 0?t:n&&typeof n=="object"?r.replace(/\{(\w+)\}/g,(i,o)=>{const l=n[o];return l!==void 0?String(l):i}):r}const fA=y.createContext(null);function vL({initialLocale:e="en",children:t}){const r=Vl.map(m=>m.code).includes(e)?e:"en",[i,o]=y.useState(r),[l,u]=y.useState(xo[r]||Os),d=y.useRef(0);y.useEffect(()=>{let m=!1;if(r!=="en"&&!xo[r]){const x=++d.current;mw(r).then(v=>{if(m||d.current!==x)return;const k=v===Os&&r!=="en"?"en":r;xo[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 mw(m);if(d.current!==x)return;const k=v===Os&&m!=="en"?"en":m;xo[k]=v,u(v),o(k);try{localStorage.setItem("pave-locale",k)}catch{}},[]),p=y.useCallback((m,x)=>dA(l,m,x),[l]),h=y.useMemo(()=>({t:p,locale:i,setLocale:f,availableLocales:Vl}),[p,i,f]);return a.jsx(fA.Provider,{value:h,children:t})}function Gt(){const e=y.useContext(fA);return e||{t:(t,n)=>dA(Os,t,n),locale:"en",setLocale:()=>{},availableLocales:Vl}}function kL(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&Vl.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=Vl.find(i=>i.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=Vl.find(i=>i.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function _L({darkMode:e,onToggle:t}){const{t:n}=Gt();return a.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?a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}):a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 jk=cA();const wL=tc(jk);function SL({open:e,onClose:t,onConfirm:n,title:r,message:i,confirmLabel:o,cancelLabel:l,destructive:u}){var{t:d}=Gt(),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 S=_[0],w=_[_.length-1];k.shiftKey?document.activeElement===S&&(k.preventDefault(),w.focus()):document.activeElement===w&&(k.preventDefault(),S.focus())}}}return document.addEventListener("keydown",v),function(){document.removeEventListener("keydown",v)}},[e]),!e)return null;var h=o||d("confirm_dialog.confirm"),m=l||d("confirm_dialog.cancel"),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 a.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:a.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:[a.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r})}),a.jsx("div",{className:"px-5 py-4",children:a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i})}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[a.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}),a.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:h})]})]})})}const pA=y.createContext(null);function EL({children:e}){var{t}=Gt(),n=y.useRef(null),r={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},i=y.useState(r),o=i[0],l=i[1],u=y.useCallback(function(p){n.current&&(n.current(!1),n.current=null);var h=p||{};return new Promise(function(m){n.current=m,l({open:!0,title:h.title||t("confirm_dialog.confirm"),message:h.message||"",confirmLabel:h.confirmLabel||"",cancelLabel:h.cancelLabel||"",destructive:h.destructive||!1})})},[t]),d=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 a.jsxs(pA.Provider,{value:u,children:[e,a.jsx(SL,{open:o.open,onClose:d,onConfirm:f,title:o.title,message:o.message,confirmLabel:o.confirmLabel,cancelLabel:o.cancelLabel,destructive:o.destructive})]})}function nc(){var e=y.useContext(pA);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const cp=180,Ou=256,hA=480,NL=360;function gA(e){const n=(Number.isFinite(e)?e:1280)-NL;return Math.min(hA,Math.max(cp,n))}function Fv(e,t){const n=gA(t),r=Number.isFinite(e)?e:Ou;return Math.min(n,Math.max(cp,Math.round(r)))}function CL(e){if(e==null||e==="")return Ou;const t=parseInt(e,10);return!Number.isFinite(t)||t<cp||t>hA?Ou:t}function xw(e,t,n){const r=Number.isFinite(e)?e:t;return Math.min(n,Math.max(t,Math.round(r)))}const jL=8,TL=32;function RL({effectiveWidth:e,effectiveMaxWidth:t,minWidth:n=cp,onCommit:r,getPaneEl:i}){const{t:o}=Gt(),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=i?i():null,k=m.clientX,_=f.current;try{x.setPointerCapture(m.pointerId)}catch{}l.current=m.pointerId;const S=document.body.style.cursor,w=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let N=!1;const R=I=>{if(l.current!==null&&I.pointerId!==l.current)return;const A=Fv(_+(I.clientX-k),window.innerWidth);v&&v.style.setProperty("--pave-sidebar-w",A+"px"),u.current=A},T=I=>{if(N)return;N=!0,window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",C),window.removeEventListener("lostpointercapture",C),document.body.style.cursor=S,document.body.style.userSelect=w;const A=l.current;if(l.current=null,A!==null)try{x.releasePointerCapture(A)}catch{}I&&u.current!==null?r(u.current):v&&v.style.setProperty("--pave-sidebar-w",f.current+"px"),u.current=null,d.current=null},C=()=>T(!1),M=()=>T(!0);window.addEventListener("pointermove",R),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",C),window.addEventListener("lostpointercapture",C),d.current=()=>T(!1)},h=m=>{const x=m.shiftKey?TL:jL;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(Fv(v,window.innerWidth)))};return a.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:h,className:"hidden md:block absolute right-0 top-0 bottom-0 w-2 z-10 cursor-ew-resize touch-none select-none group",children:a.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 AL(e){const t=new Date,n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(n>=r)return"today";const i=new Date(r);if(i.setDate(i.getDate()-1),n>=i)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 IL(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=AL(u.time&&u.time.updated?u.time.updated:0);n[d].push(u)}const i=["today","yesterday","thisWeek","thisMonth","older"],o=[];for(let l=0;l<i.length;l++){const u=i[l];n[u].length>0&&o.push({key:u,label:r[u],sessions:n[u]})}return o}function ML(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 i=Math.floor(r/60);if(i<24)return t("sidebar.age_hours",{n:i});const o=Math.floor(i/24);return o<7?t("sidebar.age_days",{n:o}):t("sidebar.age_weeks",{n:Math.floor(o/7)})}function yw(e){return e.source==="archive"||e._readOnly}const LL={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 Vo({name:e,className:t}){return a.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:LL[e]})})}function bw({className:e,filled:t}){return a.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:a.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 lg=216,lf=8,OL=500,vw=10,kw=750;function DL({anchor:e,items:t,label:n,onClose:r}){const i=y.useRef(null),[o,l]=y.useState(null);y.useEffect(()=>{const d=i.current;if(!d)return;const f=d.offsetHeight;let p=e.align==="right"?e.x-lg:e.x;p=Math.max(lf,Math.min(p,window.innerWidth-lg-lf));let h=e.y;h+f>window.innerHeight-lf&&(h=Math.max(lf,e.flipY-f)),l({left:p,top:h})},[e]),y.useEffect(()=>{if(!o||!i.current)return;const d=i.current.querySelector("[data-menuitem]");d&&d.focus()},[o]),y.useEffect(()=>{function d(p){i.current&&!i.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(i.current.querySelectorAll("[data-menuitem]"));if(f.length===0)return;const p=f.indexOf(document.activeElement),h=d.key==="ArrowDown"?(p+1)%f.length:(p-1+f.length)%f.length;f[h].focus()};return jk.createPortal(a.jsx("div",{ref:i,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:lg,left:o?o.left:0,top:o?o.top:0,visibility:o?"visible":"hidden"},children:t.map(d=>d.separator?a.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},d.key):a.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:[a.jsx("span",{className:"shrink-0 opacity-70",children:d.icon}),a.jsx("span",{className:"flex-1 truncate",children:d.label}),d.hint&&a.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:d.hint})]},d.key))}),document.body)}function PL({sessions:e,activeSessionId:t,busySessions:n={},onSelectSession:r,onNewChat:i,onDeleteSession:o,onDeleteAllSessions:l,onRenameSession:u,onRegenerateTitle:d,onPinSession:f,onArchiveSession:p,onExportSession:h,onSendToSession:m,onImportSession:x,onImportError:v,showArchived:k,onToggleShowArchived:_,isOpen:S,onClose:w,onToggle:N,hasMoreSessions:R,onLoadMoreSessions:T,hasMoreOtherApps:C,onLoadMoreOtherApps:M,otherAppsCount:I,search:A,onSearchChange:L,loadedCount:D,totalCount:$,sidebarWidth:te=Ou,onSidebarWidthChange:V}){const{t:z}=Gt(),G=nc(),[K,H]=y.useState(A||"");y.useEffect(()=>{typeof A=="string"&&A!==K&&H(A)},[A]);const se=fe=>{H(fe),L&&L(fe)},[P,W]=y.useState(null),[ee,F]=y.useState(""),[J,q]=y.useState(null),Y=y.useRef(null),oe=y.useRef({timer:null,firedAt:0,x:0,y:0});y.useEffect(()=>()=>{oe.current.timer&&clearTimeout(oe.current.timer)},[]);const _e=y.useRef(null),[ae,ye]=y.useState(()=>typeof window<"u"?window.innerWidth:1280);y.useEffect(()=>{let fe=0;const Oe=()=>{fe||(fe=requestAnimationFrame(()=>{fe=0,ye(window.innerWidth)}))};return window.addEventListener("resize",Oe),()=>{window.removeEventListener("resize",Oe),fe&&cancelAnimationFrame(fe)}},[]);const Fe=Fv(te,ae),ct=gA(ae);y.useLayoutEffect(()=>{_e.current&&_e.current.style.setProperty("--pave-sidebar-w",Fe+"px")},[Fe]);const ht=y.useCallback(()=>_e.current,[]),pt=y.useCallback(()=>{const fe=Y.current;Y.current=null,q(null),fe&&fe.isConnected&&fe.focus()},[]),et=(fe,Oe,ft)=>{Y.current=ft||null,q({id:fe.id,anchor:Oe})},ze=K?e.filter(function(fe){return(fe.title||z("sidebar.untitled")).toLowerCase().includes(K.toLowerCase())}):e,{pinnedSessions:Be,regularSessions:At,archivedSessions:lt}=y.useMemo(()=>{const fe=[],Oe=[],ft=[];for(let gt=0;gt<ze.length;gt++){const dt=ze[gt];dt.archived?ft.push(dt):dt.pinned?fe.push(dt):Oe.push(dt)}return{pinnedSessions:fe,regularSessions:Oe,archivedSessions:ft}},[ze]),on=y.useMemo(()=>IL(At,z),[At,z]),_t=fe=>{W(fe.id),F(fe.title||"")},gn=fe=>{ee.trim()&&u(fe,ee.trim()),W(null),F("")},Ht=async fe=>{!fe.archived&&!await G({title:z("sidebar.archive"),message:z("sidebar.confirmArchive"),confirmLabel:z("sidebar.archive")})||p(fe.id,!fe.archived)},Kt=async fe=>{await G({title:z("sidebar.delete_title"),message:z("sidebar.delete_confirm"),destructive:!0,confirmLabel:z("sidebar.delete")})&&o(fe.id)},ut=fe=>{if(yw(fe))return[];const Oe=[{key:"rename",label:z("sidebar.rename"),hint:"F2",icon:a.jsx(Vo,{name:"rename",className:"w-4 h-4"}),onSelect:()=>_t(fe)}];d&&Oe.push({key:"regenerate",label:z("sidebar.regenerate_title"),icon:a.jsx(Vo,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>d(fe.id)}),h&&Oe.push({key:"export",label:z("sidebar.export"),icon:a.jsx(Vo,{name:"export",className:"w-4 h-4"}),onSelect:()=>h(fe.id)}),m&&Oe.push({key:"send-to-session",label:z("sidebar.send_to_session"),icon:a.jsx(Vo,{name:"send",className:"w-4 h-4"}),onSelect:()=>m(fe.id)});const ft=[];return f&&(!fe.archived||fe.pinned)&&ft.push({key:"pin",label:fe.pinned?z("sidebar.unpin"):z("sidebar.pin"),icon:a.jsx(bw,{className:"w-4 h-4",filled:fe.pinned}),onSelect:()=>f(fe.id,!fe.pinned)}),p&&ft.push({key:"archive",label:fe.archived?z("sidebar.unarchive"):z("sidebar.archive"),icon:a.jsx(Vo,{name:fe.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>Ht(fe)}),ft.length>0&&(Oe.push({key:"sep-state",separator:!0}),Oe.push(...ft)),Oe.push({key:"sep-danger",separator:!0}),Oe.push({key:"delete",label:z("sidebar.delete"),hint:"Del",danger:!0,icon:a.jsx(Vo,{name:"delete",className:"w-4 h-4"}),onSelect:()=>Kt(fe)}),Oe},Pe=y.useMemo(()=>J&&e.find(fe=>fe.id===J.id)||null,[J,e]);y.useEffect(()=>{J&&!Pe&&pt()},[J,Pe,pt]);const le=(fe,Oe)=>{const ft=Oe&&Oe.dimmed,gt=yw(fe),dt=!!(J&&J.id===fe.id),Lt=!gt,Wt=(rt,wt)=>et(fe,rt,wt);return a.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer select-none text-sm mb-0.5 transition-colors ${fe.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":ft?"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:()=>{if(oe.current.firedAt&&Date.now()-oe.current.firedAt<kw){oe.current.firedAt=0;return}r(fe.id)},onContextMenu:rt=>{!Lt||P===fe.id||(rt.preventDefault(),!(oe.current.firedAt&&Date.now()-oe.current.firedAt<kw)&&Wt({x:rt.clientX,y:rt.clientY,flipY:rt.clientY,align:"left"},rt.currentTarget))},onTouchStart:rt=>{if(!Lt||P===fe.id||rt.touches.length!==1)return;const wt=rt.touches[0],Yt=rt.currentTarget;oe.current.x=wt.clientX,oe.current.y=wt.clientY,oe.current.timer=setTimeout(()=>{oe.current.timer=null,oe.current.firedAt=Date.now(),Wt({x:wt.clientX,y:wt.clientY,flipY:wt.clientY,align:"left"},Yt)},OL)},onTouchMove:rt=>{if(!oe.current.timer)return;const wt=rt.touches[0],Yt=wt.clientX-oe.current.x,an=wt.clientY-oe.current.y;Yt*Yt+an*an>vw*vw&&(clearTimeout(oe.current.timer),oe.current.timer=null)},onTouchEnd:()=>{oe.current.timer&&(clearTimeout(oe.current.timer),oe.current.timer=null)},onTouchCancel:()=>{oe.current.timer&&(clearTimeout(oe.current.timer),oe.current.timer=null)},onKeyDown:rt=>{if(rt.currentTarget===rt.target){if(rt.key==="Enter"||rt.key===" "){rt.preventDefault(),r(fe.id);return}if(Lt){if(rt.key==="F2")rt.preventDefault(),_t(fe);else if(rt.key==="Delete")rt.preventDefault(),Kt(fe);else if(rt.key==="ContextMenu"){rt.preventDefault();const wt=rt.currentTarget.getBoundingClientRect();Wt({x:wt.right,y:wt.bottom,flipY:wt.top,align:"right"},rt.currentTarget)}}}},children:P===fe.id?a.jsx("input",{autoFocus:!0,value:ee,onChange:rt=>F(rt.target.value),onBlur:()=>gn(fe.id),onKeyDown:rt=>{rt.key==="Enter"?(rt.preventDefault(),rt.stopPropagation(),rt.currentTarget.blur()):rt.key==="Escape"?(rt.stopPropagation(),W(null)):rt.key===" "&&rt.stopPropagation()},onClick:rt=>rt.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-hidden"}):a.jsxs(a.Fragment,{children:[fe.pinned&&a.jsx("svg",{className:"w-3 h-3 shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",role:"img",title:z("sidebar.icon_pinned"),"aria-label":z("sidebar.icon_pinned"),children:a.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"})}),fe.source==="archive"&&a.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:z("sidebar.icon_archive"),"aria-label":z("sidebar.icon_archive"),children:a.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"})}),fe.compactedAt&&fe.source!=="archive"&&a.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:z("sidebar.icon_compacted"),"aria-label":z("sidebar.icon_compacted"),children:a.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[fe.id]&&a.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse shrink-0",role:"status",title:z("sidebar.session_processing"),"aria-label":z("sidebar.session_processing")}),a.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${ft?"italic":""}`,"data-menu-open":dt?"true":"false",children:[a.jsx("span",{className:"truncate min-w-0",children:fe.title||z("sidebar.untitled")}),fe.archived&&a.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 shrink-0",children:["(",z("sidebar.archived"),")"]})]}),a.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[a.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${dt?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:ML(fe.time&&fe.time.updated,z)}),a.jsxs("div",{className:`items-center gap-0.5 ${dt?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[f&&(!fe.archived||fe.pinned)&&a.jsx("button",{onClick:rt=>{rt.stopPropagation(),f(fe.id,!fe.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:fe.pinned?z("sidebar.unpin"):z("sidebar.pin"),"aria-label":fe.pinned?z("sidebar.unpin"):z("sidebar.pin"),children:a.jsx(bw,{className:`w-4 h-4 ${fe.pinned?"text-amber-500":""}`,filled:fe.pinned})}),Lt&&a.jsx("button",{onClick:rt=>{rt.stopPropagation();const wt=rt.currentTarget.getBoundingClientRect();Wt({x:wt.right,y:wt.bottom+4,flipY:wt.top-4,align:"right"},rt.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${dt?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":z("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":dt,children:a.jsx(Vo,{name:"more",className:"w-4 h-4"})})]})]})]})},fe.id)},be=fe=>a.jsx("div",{className:"px-2 pt-3 pb-1",children:a.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:fe})});return a.jsxs(a.Fragment,{children:[S&&a.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:w}),!S&&a.jsx("div",{className:"shrink-0 w-10 hidden md:flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:a.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:z("sidebar.show"),"aria-label":z("sidebar.show"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),a.jsxs("aside",{ref:_e,className:`
|
|
41
|
+
${S?"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
|
+
${S?"md:flex":"md:hidden"}
|
|
48
|
+
`,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-1",children:[a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium",children:z("sidebar.conversations")}),a.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:z("sidebar.hide"),"aria-label":z("sidebar.hide"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"})})})]}),a.jsxs("div",{className:"px-3 py-2 flex gap-2",children:[a.jsx("button",{onClick:i,className:"flex-1 py-2 px-4 rounded-lg bg-accent-400 hover:bg-accent-500 text-gray-900 font-medium text-sm transition-colors",children:z("app.new_chat")}),x&&a.jsx("button",{onClick:()=>{const fe=document.createElement("input");fe.type="file",fe.accept=".yaml,.yml",fe.onchange=Oe=>{const ft=Oe&&Oe.target&&Oe.target.files,gt=ft&&ft[0];if(gt){const dt=gt.name.toLowerCase();if(!dt.endsWith(".yaml")&&!dt.endsWith(".yml")){v&&v(z("import.invalid_file_type"));return}const Lt=10*1024*1024;if(gt.size>Lt){v&&v(z("import.file_too_large"));return}const Wt=new FileReader;Wt.onload=rt=>{const wt=rt&&rt.target?rt.target.result:null;if(typeof wt!="string"){v&&v(z("import.read_error"));return}x(wt)},Wt.onerror=()=>{v&&v(z("import.read_error"))},Wt.readAsText(gt)}},fe.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:z("sidebar.import"),"aria-label":z("sidebar.import"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]}),a.jsx("div",{className:"px-3 pb-2",children:a.jsx("input",{type:"text",placeholder:z("sidebar.search_placeholder"),value:K,onChange:fe=>se(fe.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"})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-2",children:[Be.length===0&&on.every(fe=>fe.sessions.length===0)&&(!k||lt.length===0)&&a.jsx("p",{className:"px-2 py-4 text-xs text-gray-400 dark:text-gray-500 text-center",children:z(K?"sidebar.no_matches":"sidebar.no_conversations")}),Be.length>0&&a.jsxs(a.Fragment,{children:[be(z("sidebar.pinned")),Be.map(fe=>le(fe))]}),on.map(fe=>a.jsxs("div",{children:[(Be.length>0||on.length>1)&&be(fe.label),fe.sessions.map(Oe=>le(Oe))]},fe.key)),k&<.length>0&&a.jsxs(a.Fragment,{children:[be(z("sidebar.archived")),lt.map(fe=>le(fe,{dimmed:!0}))]}),(R||C)&&(T||M)&&a.jsx("div",{className:"pt-2 pb-1 px-1",children:a.jsxs("button",{onClick:()=>{R&&T&&T(),C&&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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),typeof $=="number"&&$>0&&typeof D=="number"?z("sidebar.load_more_count",{loaded:D+(I||0),total:$+(I||0)}):z("sidebar.load_more")]})}),!R&&!C&&typeof $=="number"&&$>0&&a.jsx("div",{className:"pt-2 pb-1 px-1 text-center text-[11px] text-gray-400 dark:text-gray-500 tabular-nums",children:K?z("sidebar.search_result_count",{total:$+(I||0)}):z("sidebar.all_loaded_count",{total:$+(I||0)})}),_&&a.jsx("div",{className:"pt-2 pb-1 px-1",children:a.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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:k?a.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"}):a.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"})}),z(k?"sidebar.hide_archived":"sidebar.show_archived")]})}),ze.some(function(fe){return fe.source!=="legacy"&&!fe._readOnly})&&l&&a.jsx("div",{className:"pt-3 pb-2 px-1",children:a.jsxs("button",{onClick:async()=>{await G({title:z("sidebar.delete_all_title"),message:z("sidebar.delete_all_confirm"),destructive:!0,confirmLabel:z("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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),z("sidebar.delete_all")]})})]}),V&&a.jsx(RL,{effectiveWidth:Fe,effectiveMaxWidth:ct,onCommit:V,getPaneEl:ht})]}),J&&Pe&&a.jsx(DL,{anchor:J.anchor,items:ut(Pe),label:z("sidebar.more_actions"),onClose:pt})]})}const go="pave-draft-";function FL(e){return go+e}function BL(e){if(e)try{localStorage.removeItem(FL(e))}catch{}}function zL(e){const t=new Set;return e.forEach(n=>{n&&n.id&&t.add(n.id)}),t}function UL(e,t,n){return!e||!e.id||t.has(e.id)?!1:Number.isFinite(e.prependedAt)&&e.prependedAt>=n}function _w({fetched:e,current:t,prependsSince:n}={}){const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[],o=typeof n=="number"?n:1/0,l=zL(r),u=i.filter(d=>UL(d,l,o));return u.length===0?r:u.concat(r)}function Bv(e){const t={};for(let n=0;n<e.length;n++)t[e[n].key]=e[n].value;return t}function qL(e,t){const n={};for(let r=0;r<e.length;r++){const i=e[r];i.source!=="env"&&t[i.key]!==i.value&&(n[i.key]=t[i.key])}return n}function HL(e,t,n){const r=Bv(e);for(let i=0;i<n.length;i++)t[n[i]]!==void 0&&(r[n[i]]=t[n[i]]);return r}function $L(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 WL(e,t){const n=[];for(let i=0;i<t.length;i++)e[t[i]]&&n.push(t[i]);const r=Object.keys(e);for(let i=0;i<r.length;i++)n.indexOf(r[i])<0&&n.push(r[i]);return n}const VL=["AI Model & Provider","Prefill Fallback","Models","Compaction","Tool Execution","Rate Limiting","Session Behavior","Display","Notification","Session Banner","Marketplace","System Prompts","Experimental Features","Developer"],qf={"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",Notification:"settings.notifications","Session Banner":"settings.category.sessionBanner",Marketplace:"settings.category.marketplace","System Prompts":"settings.category.systemPrompts","Experimental Features":"settings.category.experimental",Developer:"settings.category.developer"},mA="Notification";let xA=!1;function GL(e){xA=e===!0}function cg(){return xA}let yA=!1;function KL(e){yA=e===!0}function bA(){return yA}function YL(){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 ar(e){const t=YL(),n=typeof e=="string"?e:"";return t?n?t+(n.charAt(0)==="/"?n:"/"+n):t:n}const ww="/.pave/files/",QL=200,XL=/^[a-z][a-z0-9+.-]*:/i,ZL=["txt","md","markdown","log","tsv","js","mjs","cjs","jsx","ts","tsx","css","scss","xml","yml","yaml","toml","ini","conf","sh","bash","zsh","py","rb","go","rs","java","kt","c","h","cc","cpp","swift","sql","diff","patch","env","csv","tsv","json"],JL=["png","jpg","jpeg","gif","webp","avif","bmp","ico","apng"],eO=["json","csv","tsv"],tO=["html","htm","svg","xhtml","js","mjs","cjs","jsx"];function nO(e){return e.split(/[\\/]/)}function rO(e){const t=e.split(/[\\/]/).pop()||"",n=t.lastIndexOf(".");return n<=0||n===t.length-1?"":t.slice(n+1).toLowerCase()}function vA(e){const t={candidate:!1,reason:"not-a-path",rel:null,name:"",type:"other",viewable:!1};try{if(typeof e!="string")return{...t,reason:"not-a-string"};const n=e.trim();if(!n)return{...t,reason:"empty"};if(n.charAt(0)==="#")return{...t,reason:"fragment"};if(XL.test(n))return{...t,reason:"scheme"};let r;try{r=decodeURIComponent(n)}catch{return{...t,reason:"malformed-escape"}}let i=r;const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o));const l=i.indexOf("?");if(l!==-1&&(i=i.slice(0,l)),!i.trim())return{...t,reason:"empty"};let u=i;const d=u.lastIndexOf(ww);if(d!==-1?u=u.slice(d+ww.length):u.startsWith("~/.pave/files/")&&(u=u.slice(14)),u.charAt(0)==="/"||u.charAt(0)==="~")return{...t,reason:"absolute"};if(/^[a-z]:[\\/]/i.test(u))return{...t,reason:"absolute"};const f=nO(u);if(f.indexOf("..")!==-1)return{...t,reason:"escape"};if(u=f.filter(x=>x!=="."&&x!=="").join("/"),!u)return{...t,reason:"empty"};const p=rO(u);let h="other";JL.indexOf(p)!==-1?h="image":eO.indexOf(p)!==-1?h="data":ZL.indexOf(p)!==-1&&(h="text");const m=h!=="other"&&tO.indexOf(p)===-1;return{candidate:!0,reason:"relative-path",rel:u,name:u.split("/").pop(),type:h,viewable:m}}catch{return{...t,reason:"error"}}}function kA(e,t){return!!(e&&e.candidate===!0&&t===!0)}function iO(e,t){const n=Math.floor(t),r=new Set,i=[];let o=[];for(const l of Array.isArray(e)?e:[])typeof l!="string"||!l||r.has(l)||(r.add(l),o.push(l),o.length===n&&(i.push(o),o=[]));return o.length&&i.push(o),i}function _A(e){if(typeof e!="number"||!Number.isFinite(e)||e<0)return"";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10?Math.round(n):Math.round(n*10)/10} ${t[r]}`}const ra=ar(""),zv="pave-working-directory";function Gl(){if(typeof window>"u")return null;try{return localStorage.getItem(zv)||null}catch{return null}}function ug(e){if(!(typeof window>"u"))try{e===null||e===""?localStorage.removeItem(zv):localStorage.setItem(zv,e)}catch{}}const wA="web";let Uv=null;function Sw(e){Uv=e}let Jc=null,Ew=0;function Tk(){return Jc||(Date.now()<Ew?Promise.resolve(!1):(Jc=(async()=>{let e=!1,t=null;try{const n=await fetch(`${ra}/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{Ew=Date.now()+5e3,Jc=null}try{Uv&&Uv({recovered:e,user:t})}catch{}return e})(),Jc))}function Nw(e){return typeof e=="string"&&e.indexOf("/auth/")===0}let hu=null,eu=null;async function SA(){return hu||(eu||(eu=fetch(`${ra}/api/csrf-token`).then(e=>e.ok?e.json():null).then(e=>(eu=null,hu=e&&typeof e.token=="string"?e.token:null,hu)).catch(()=>(eu=null,null))),eu)}async function Ve(e,t={}){const n=Gl(),r={"Content-Type":"application/json","X-PAVE-Client":wA,...t.headers};n&&(r["x-opencode-directory"]=n);const{headers:i,...o}=t,l=(o.method||"GET").toUpperCase(),u=o.csrf===!0;if(delete o.csrf,(l!=="GET"||u)&&!Nw(e)){const f=await SA();f&&(r["X-CSRF-Token"]=f)}const d=await fetch(`${ra}${e}`,{...o,headers:r});if(!d.ok){d.status===401&&!Nw(e)&&(hu=null,Tk());let f=null;try{const h=await d.text();try{f=JSON.parse(h)}catch{f=null}if(!f){const m=new Error(`${d.status}: ${h||d.statusText}`);throw m.status=d.status,m}}catch(h){if(h.message)throw h.status===void 0&&(h.status=d.status),h;const m=new Error(`${d.status}: ${d.statusText}`);throw m.status=d.status,m}const p=new Error(`${d.status}: ${f.error||f.message||JSON.stringify(f)}`);throw p.status=d.status,p.body=f,d.status===403&&typeof f.error=="string"&&f.error.indexOf("direct local access")!==-1&&(p.message=`${d.status}: Start OAuth from a direct local session.`),f.reauthRequired&&(p.reauthRequired=!0),p}return d.json()}function Wl(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?`/api/session?${n}`:"/api/session";return Ve(r)}function Cw(e){return Ve("/api/session",{method:"POST",body:JSON.stringify({title:void 0})})}function dg(e){return Ve(`/api/session/${e}`)}function aO(e){return Ve(`/api/session/${e}/soul`)}function yi(e,t){return Ve(`/api/session/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function sO(e){return Ve(`/api/session/${e}/regenerate-title`,{method:"POST"})}function oO(e,{senderSessionID:t,text:n}){return Ve(`/api/session/${e}/mailbox`,{method:"POST",body:JSON.stringify({senderSessionID:t,text:n})})}function lO(e){return Ve(`/api/session/${e}/fork`,{method:"POST"})}function cO(e){return Ve(`/api/session/${e}`,{method:"DELETE"})}function uO(e){return Ve(`/api/session/${e}/archive/session`,{method:"POST"})}function dO(){return Ve("/api/session",{method:"DELETE"})}function jw(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 i=r.toString();return Ve(`/api/session/${e}/message${i?"?"+i:""}`)}function Tw(e,t,n,r,i,o){const l={content:t,async:!0};return n&&n.length>0&&(l.parts=n),r&&(l.model=r),i&&(l.agent=i),o&&o.enqueue&&(l.enqueue=!0,o.priority&&(l.priority=o.priority),o.displayContent&&(l.displayContent=o.displayContent)),o&&o.moeTopK&&(l.moe_top_k=o.moeTopK),o&&o.reasoningEffort&&(l.reasoning_effort=o.reasoningEffort),o&&o.adaptiveQuality&&(l.adaptive_quality=!0),Ve(`/api/session/${e}/message`,{method:"POST",body:JSON.stringify(l)})}function fg(e){return Ve(`/api/session/${e}/queue`)}function Rw(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),Ve(`/api/session/${e}/queue`,{method:"POST",body:JSON.stringify(r)})}function Aw(e,t){return Ve(`/api/session/${e}/queue/${t}`,{method:"DELETE"})}function fO(e,t){return Ve(`/api/session/${e}/queue/reorder`,{method:"PATCH",body:JSON.stringify({itemIds:t})})}function pO(e){return Ve(`/api/sessions/${e}/compaction/compact`,{method:"POST",body:JSON.stringify({auto:!1,force:!1})})}function hO(e){return Ve(`/api/session/${e}`,{method:"PATCH",body:JSON.stringify({compactionPinned:!1})})}function gO(e){return Ve(`/api/session/${e}/abort`,{method:"POST"})}function EA(e){return Ve(`/api/session/${e}/idle-injection`)}function mO(e,t){return Ve(`/api/session/${e}/idle-injection`,{method:"PUT",body:JSON.stringify(t)})}function xO(e){return Ve(`/api/session/${e}/idle-injection`,{method:"DELETE"})}function yO(e){return Ve(`/api/session/${e}/scheduled-injections`)}function bO(e,t){return Ve(`/api/session/${e}/scheduled-injections`,{method:"POST",body:JSON.stringify(t)})}function vO(e,t,n){return Ve(`/api/session/${e}/scheduled-injections/${t}`,{method:"PATCH",body:JSON.stringify(n)})}function kO(e,t){return Ve(`/api/session/${e}/scheduled-injections/${t}`,{method:"DELETE"})}function _O(){return Ve("/api/config/providers")}function qv(){return Ve("/api/models/registry")}function wO(){return Ve("/auth/status")}function SO(){return Ve("/auth/logout",{method:"POST"})}function EO(){return Ve("/api/permissions/pending")}function NO(e){return Ve(`/api/permissions/confirm/${e}`,{method:"POST"})}function CO(e){return Ve(`/api/permissions/deny/${e}`,{method:"POST"})}function jO(){return Ve("/api/questions/pending")}function TO(e,t){return Ve(`/api/questions/${e}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})}function RO(e){return Ve(`/api/questions/${e}/reject`,{method:"POST"})}function Rk(){return Ve("/skills")}function NA(){return Ve("/capabilities")}function AO(){return NA().then(e=>(e&&e.capabilities||[]).filter(n=>n.kind==="mcp"&&n.status==="installed").map(n=>({id:n.name,displayName:n.displayName||n.name})))}function IO(e){return Ve(`/capabilities/${encodeURIComponent(e)}/docs`)}function MO(e){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/install`,{method:"POST"})}function LO(e){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/status`)}function OO(e){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/update`,{method:"POST"})}function DO(e,t){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}`,{method:"DELETE"})}function PO(e,t,n){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify({access:t,refresh:void 0})})}function FO(e){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function BO(e){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/review`,{method:"POST"})}function zO(e){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/refresh`,{method:"POST"})}function UO(e){return Ve("/capabilities/mcp/custom/add",{method:"POST",body:JSON.stringify({url:e})})}function qO(e){return Ve(`/capabilities/skill/${encodeURIComponent(e)}/install`,{method:"POST"})}function HO(e){return Ve(`/capabilities/skill/${encodeURIComponent(e)}`,{method:"DELETE"})}function $O(e){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function WO(e,t){return Ve(`/capabilities/mcp/${encodeURIComponent(e)}/oauth/result${t?`?state=${encodeURIComponent(t)}`:""}`,{csrf:!0})}function VO(){return Ve("/skills/commands")}function GO(){return Ve("/skills/registry")}function KO(e){return Ve(`/skills/${encodeURIComponent(e)}`)}function YO(e){return Ve(`/skills/${encodeURIComponent(e)}/install`,{method:"POST"})}function QO(e){return Ve(`/skills/${encodeURIComponent(e)}/update`,{method:"POST"})}function XO(){return Ve("/skills/check-updates")}function ZO(e,t){return Ve(`/skills/${encodeURIComponent(e)}/tokens`,{method:"PUT",body:JSON.stringify(t)})}function JO(e){return Ve(`/skills/${encodeURIComponent(e)}/tokens`,{method:"DELETE"})}function e3(e){return Ve(`/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function CA(){return Ve("/api/skill-defaults")}function t3(e){return Ve("/api/skill-defaults",{method:"PUT",body:JSON.stringify(e)})}function n3(e){return Ve(`/skills/${encodeURIComponent(e)}/oauth/start`,{method:"POST"})}function r3(e){return Ve(`/skills/${encodeURIComponent(e)}/oauth/broker/start`,{method:"POST"})}function i3(e,t){return Ve(`/skills/${encodeURIComponent(e)}/oauth/broker/result?flow_id=${encodeURIComponent(t)}`)}function Iw(){return Ve("/api/config")}function a3(){return Ve("/inspector/sessions")}async function s3(e){const t=Gl(),n={"X-PAVE-Client":wA};t&&(n["x-opencode-directory"]=t);const r=await fetch(`${ra}/inspector/session/${encodeURIComponent(e)}/events`,{headers:n});if(!r.ok){const i=new Error(`${r.status}: ${r.statusText}`);throw i.status=r.status,i}return r.text()}function Mw(e,t){return Ve(`/inspector/session/${encodeURIComponent(e)}/body/${encodeURIComponent(t)}`)}function o3(e){return Ve(`/inspector/session/${encodeURIComponent(e)}`,{method:"DELETE"})}function l3(e){const t=e?"?model="+encodeURIComponent(e):"";return Ve("/api/config/adaptive-quality"+t)}function Hv(){return Ve("/path")}function Lw(e){return Ve("/api/directory/validate",{method:"POST",body:JSON.stringify({path:e})})}function c3(e){return Ve("/api/directory/create",{method:"POST",body:JSON.stringify({path:e})})}function jA(){return Ve("/settings")}function u3(e){return Ve("/settings",{method:"PUT",body:JSON.stringify(e)})}function d3(){return Ve("/shortcuts")}function f3(e,t){const n=t==null?{shortcuts:e}:{shortcuts:e,rev:t};return Ve("/shortcuts",{method:"PUT",body:JSON.stringify(n)})}async function p3(e){const t=await fetch(ra+"/api/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",i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=r,document.body.appendChild(o),o.click(),setTimeout(()=>{URL.revokeObjectURL(i),o.parentNode&&o.parentNode.removeChild(o)},0)}function h3(e,t){return t?Ve("/api/session/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,resolution:t})}):Ve("/api/session/import",{method:"POST",headers:{"Content-Type":"text/yaml"},body:e})}async function g3(e,t,n,r){const i=Gl(),o={};i&&(o["x-opencode-directory"]=i),e.type?o["Content-Type"]=e.type:o["Content-Type"]="audio/webm";let l=ra+"/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 h=null;if(p)try{h=JSON.parse(p)}catch{}if(!f.ok){const m=new Error(h&&h.error||"Transcription failed (HTTP "+f.status+")");throw m.status=f.status,m.code=h&&h.code,m.fallback=h&&h.fallback,m}if(!h){const m=new Error("Invalid response from transcription endpoint");throw m.code="invalid_response",m.fallback=!0,m}return h}let Ul=null,gu=0;function Hf(){const e=Date.now();return Ul&&e<gu||(Ul=Ve("/api/transcribe/config").then(t=>(gu=Date.now()+5e3,t)).catch(t=>{throw Ul=null,gu=0,t}),gu=1/0),Ul}function m3(e){return Ul=null,gu=0,Ve("/api/asr/engine",{method:"POST",body:JSON.stringify({engine:e})})}function Ow(){return Ve("/api/session/status")}function x3(e){return Ve(`/api/session/${encodeURIComponent(e)}/dlp/status`)}function y3(){return Ve("/api/dlp/policy")}function b3(e){return Ve("/api/dlp/policy",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Dw(e){const t=await fetch(`${ra}/api/session/${e}/banners`,{credentials:"include"});return t.ok?t.json():{banners:[]}}async function v3(e){return(await fetch(`${ra}/api/session/${e}/banner/regenerate`,{method:"POST"})).json()}async function pg(e){try{const t=await fetch(`${ra}/api/session/${e}/todos`,{credentials:"include"});return t.ok?t.json():{todos:[]}}catch{return{todos:[]}}}async function k3(e){const t=await fetch(`${ra}/api/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 Pw(e){try{const t=await fetch(`${ra}/api/session/${e}/tool-graph`,{credentials:"include"});return t.ok?t.json():{nodes:[],edges:[]}}catch{return{nodes:[],edges:[]}}}function _3(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 Ve(`/api/board/topics${n?`?${n}`:""}`)}function Fw(e){return Ve(`/api/board/topic/${encodeURIComponent(e)}`)}function w3(e){return Ve(`/api/board/search?q=${encodeURIComponent(e)}`)}function S3(e){return Ve(`/api/board/topic/${encodeURIComponent(e)}`,{method:"DELETE"})}function E3(e,t){return Ve(`/api/board/topic/${encodeURIComponent(e)}/post/${encodeURIComponent(t)}`,{method:"DELETE"})}const vo=ar("");async function ko(e,t={}){const n=await fetch(e,{credentials:"include",...t});return n.status===401&&await Tk()?fetch(e,{credentials:"include",...t}):n}function Vu(e,t){const n=new Error(t);return n.status=e.status,n}async function N3(){const e=await ko(vo+"/api/pricing");if(!e.ok)throw Vu(e,"Failed to fetch pricing: "+e.statusText);return e.json()}async function C3(e){const t=await ko(vo+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw Vu(t,n.error||"Failed to update pricing")}return t.json()}async function j3(){const e=await ko(vo+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw Vu(e,t.error||"Failed to reset pricing")}return e.json()}async function hg(){const e=await ko(vo+"/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 T3(){const e=await ko(vo+"/api/system/update-config");if(!e.ok)throw new Error("Failed to get update config");return e.json()}async function R3(){const e=await ko(vo+"/api/system/update",{method:"POST"});if(!e.ok){const n="Failed to perform update",r=await e.json().catch(()=>({})),i=r.error||r.message||r.output||e.statusText;throw i?i.indexOf(n)===0||i===n?new Error(i):new Error(n+": "+i):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 Bw(e,t){return Ve("/api/models/registry",{method:"PUT",body:JSON.stringify({name:e,...t})})}async function A3(e){const t=await ko(vo+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw Vu(t,n.error||"Failed to delete model: "+t.statusText)}return t.json()}async function I3(e,t,n){const r={from:e,to:t};return n!==void 0&&(r.apiKey=n),Ve("/api/models/registry/rename",{method:"POST",body:JSON.stringify(r)})}async function M3(){const e=await ko(vo+"/api/models");if(!e.ok)throw Vu(e,"Failed to fetch models: "+e.statusText);return e.json()}function L3(){return Ve("/api/trigger")}function O3(e){return Ve("/api/trigger",{method:"POST",body:JSON.stringify(e)})}function D3(e,t){return Ve(`/api/trigger/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}function P3(e){return Ve(`/api/trigger/${encodeURIComponent(e)}`,{method:"DELETE"})}function F3(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),setTimeout(()=>{URL.revokeObjectURL(n),r.parentNode&&r.parentNode.removeChild(r)},0)}async function TA(e){const t={},n=iO(e,QL);for(const r of n)for(const i of r)t[i]={exists:!1,size:0};for(const r of n){let i=null;try{i=await Ve("/api/files/stat",{method:"POST",body:JSON.stringify({paths:r})})}catch{continue}const o=i&&Array.isArray(i.files)?i.files:[];for(const l of o)!l||typeof l.path!="string"||Object.prototype.hasOwnProperty.call(t,l.path)&&(t[l.path]={exists:l.exists===!0,size:typeof l.size=="number"&&Number.isFinite(l.size)?l.size:0})}return t}async function RA(e){if(typeof e!="string"||!e){const r=new Error("400: no path to download");throw r.status=400,r}const t=await fetch(`${ra}/api/files/file?path=${encodeURIComponent(e)}`,{credentials:"include"});if(t.status!==200){const r=await t.json().catch(()=>({})),i=t.status===202,o=r&&(r.error||r.message),l=new Error(`${t.status}: ${o||(i?"The download needs your answer first.":"Download failed")}`);throw l.status=t.status,l.body=r,l.dlpQuestion=i,l}const n=await t.blob();return{blob:n,filename:e.split("/").pop()||e,size:typeof n.size=="number"?n.size:0}}const B3=["image/png","image/jpeg","image/gif","image/webp"];function z3(e){const t=String(e||"").toLowerCase();return t==="image/jpg"?"image/jpeg":B3.indexOf(t)!==-1?t:"application/octet-stream"}async function U3(e,t){const n=await SA(),r=await fetch(`${ra}/api/files/upload?name=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":z3(t),"X-CSRF-Token":n||""},credentials:"include",body:e});if(r.status!==201){const i=await r.json().catch(()=>({})),o=i&&(i.error||i.message),l=new Error(`${r.status}: ${o||"Upload failed"}`);throw l.status=r.status,l.body=i,l}return r.json()}async function AA(e,t){const n=await RA(e);return F3(n.blob,t||n.filename),{size:n.size}}function q3(e){var t=e&&(e.client||e.source)||"";return t==="web"?"Web":t==="agent"?"Agent":t==="tui"?"TUI":t==="acp"?"Studio":t||"Unknown"}function H3({open:e,onClose:t,senderSessionID:n}){var{t:r}=Gt(),i=y.useRef(null),o=y.useRef(null),l=y.useState([]),u=l[0],d=l[1],f=y.useState(""),p=f[0],h=f[1],m=y.useState(""),x=m[0],v=m[1],k=y.useState(!1),_=k[0],S=k[1],w=y.useState(""),N=w[0],R=w[1],T=y.useState(!1),C=T[0],M=T[1];y.useEffect(function(){if(e){var L=!1;return R(""),M(!1),v(""),Wl({includeOtherApps:!0,limit:100}).then(function(D){if(!L){var $=Array.isArray(D)?D:D&&D.sessions||[],te=$.filter(function(V){return V&&V.id!==n});d(te),h(te.length?te[0].id:"")}}).catch(function(D){L||R(D&&D.message?D.message:String(D))}),function(){L=!0}}},[e,n]),y.useEffect(function(){e&&o.current&&o.current.focus()},[e]),y.useEffect(function(){if(!e)return;function L(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",L,!0),function(){document.removeEventListener("keydown",L,!0)}},[e,t]);var I=y.useCallback(function(){!p||!x.trim()||_||(S(!0),R(""),oO(p,{senderSessionID:n,text:x}).then(function(){S(!1),M(!0)}).catch(function(L){S(!1),R(L&&L.message?L.message:String(L))}))},[p,x,_,n]);if(!e)return null;var A=!!p&&!!x.trim()&&!_;return a.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(L){L.target===L.currentTarget&&t()},children:a.jsxs("div",{ref:i,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:[a.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("send_to_session.title")})}),a.jsxs("div",{className:"px-5 py-4 space-y-3",children:[C?a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("send_to_session.queued")}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.target_label"),a.jsx("select",{value:p,onChange:function(L){h(L.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(L){return a.jsx("option",{value:L.id,children:(L.title||L.id)+" — "+q3(L)},L.id)})})]}),u.length===0?a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r("send_to_session.no_targets")}):null,a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[r("send_to_session.message_label"),a.jsx("textarea",{ref:o,value:x,onChange:function(L){v(L.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"})]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r("send_to_session.delivery_note")})]}),N?a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",role:"alert",children:N}):null]}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[a.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(C?"send_to_session.close":"send_to_session.cancel")}),C?null:a.jsx("button",{type:"button",onClick:I,disabled:!A,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 up=0,_o=1,rc=2,IA=4;function zw(e){return()=>e}function $3(e){e()}function MA(e,t){return n=>e(t(n))}function Uw(e,t){return()=>e(t)}function W3(e,t){return n=>e(t,n)}function Ak(e){return e!==void 0}function V3(...e){return()=>{e.map($3)}}function ic(){}function dp(e,t){return t(e),e}function G3(e,t){return t(e)}function sr(...e){return e}function Bn(e,t){return e(_o,t)}function hn(e,t){e(up,t)}function Ik(e){e(rc)}function Jn(e){return e(IA)}function Ft(e,t){return Bn(e,W3(t,up))}function Ha(e,t){const n=e(_o,r=>{n(),t(r)});return n}function qw(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function LA(e,t){return e===t}function ir(e=LA){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Xt(e){return t=>n=>{e(n)&&t(n)}}function vt(e){return t=>MA(t,e)}function ea(e){return t=>()=>{t(e)}}function qe(e,...t){const n=K3(...t);return((r,i)=>{switch(r){case rc:Ik(e);return;case _o:return Bn(e,n(i))}})}function qa(e,t){return n=>r=>{n(t=e(t,r))}}function rl(e){return t=>n=>{e>0?e--:t(n)}}function Ls(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function bn(...e){const t=Array.from({length:e.length});let n=0,r=null;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Bn(o,d=>{const f=n;n|=u,t[l]=d,f!==i&&n===i&&r&&(r(),r=null)})}),o=>l=>{const u=()=>{o([l].concat(t))};n===i?u():r=u}}function K3(...e){return t=>e.reduceRight(G3,t)}function Y3(e){let t,n;const r=()=>t==null?void 0:t();return function(i,o){switch(i){case _o:return o?n===o?void 0:(r(),n=o,t=Bn(e,o),t):(r(),ic);case rc:r(),n=null;return}}}function nt(e){let t=e;const n=Nn();return((r,i)=>{switch(r){case up:t=i;break;case _o:{i(t);break}case IA:return t}return n(r,i)})}function qr(e,t){return dp(nt(t),n=>Ft(e,n))}function Nn(){const e=[];return((t,n)=>{switch(t){case up:e.slice().forEach(r=>{r(n)});return;case rc:e.splice(0);return;case _o:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function na(e){return dp(Nn(),t=>Ft(e,t))}const Q3={singleton:!0};function Fn(e,t=[],n=Q3){const{singleton:r}=n;return{constructor:e,dependencies:t,id:X3(),singleton:r}}const X3=()=>Symbol("id");function Z3(e){const t=new Map,n=({constructor:r,dependencies:i,id:o,singleton:l})=>{if(l&&t.has(o))return t.get(o);const u=r(i.map(d=>n(d)));return l&&t.set(o,u),u};return n(e)}function Er(...e){const t=Nn(),n=Array.from({length:e.length});let r=0;const i=2**e.length-1;return e.forEach((o,l)=>{const u=2**l;Bn(o,d=>{n[l]=d,r|=u,r===i&&hn(t,n)})}),function(o,l){switch(o){case rc:{Ik(t);return}case _o:return r===i&&l(n),Bn(t,l)}}}function rn(e,t=LA){return qe(e,ir(t))}function $f(...e){return function(t,n){switch(t){case rc:return;case _o:return V3(...e.map(r=>Bn(r,n)))}}}const Hr={DEBUG:0,INFO:1,WARN:2,ERROR:3},J3={[Hr.DEBUG]:"debug",[Hr.ERROR]:"error",[Hr.INFO]:"log",[Hr.WARN]:"warn"},eD=()=>typeof globalThis>"u"?window:globalThis,wo=Fn(()=>{const e=nt(Hr.ERROR);return{log:nt((t,n,r=Hr.INFO)=>{const i=eD().VIRTUOSO_LOG_LEVEL??Jn(e);r>=i&&console[J3[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function tD(e){return"self"in e?e.document.documentElement:e}function OA(e){const t=tD(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction==="rtl"}function Xo(e,t){return OA(e)?-t:t}function Hw(e,t){return OA(e)?-t:t}function al(e,t,n){return Mk(e,t,n).callbackRef}function Mk(e,t,n){const r=Tt.useRef(null);let i=l=>{};const o=Tt.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 i=l=>{l&&t?(o==null||o.observe(l),r.current=l):(r.current&&(o==null||o.unobserve(r.current)),r.current=null)},{callbackRef:i,ref:r}}function nD(e,t,n,r,i,o,l,u,d){const f=Tt.useCallback(p=>{var w;const h=rD(p.children,t,u?"offsetWidth":"offsetHeight",i);let m=p.parentElement;for(;m.dataset.virtuosoScroller===void 0;)m=m.parentElement;const x=((w=m.lastElementChild)==null?void 0:w.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,S=l?u?Xo(l,l.scrollLeft):l.scrollTop:x?u?Xo(v,v.scrollX||v.document.documentElement.scrollLeft):v.scrollY||v.document.documentElement.scrollTop:u?Xo(m,m.scrollLeft):m.scrollTop;r({scrollHeight:k,scrollTop:Math.max(S,0),viewportHeight:_}),o==null||o(u?$w("column-gap",getComputedStyle(p).columnGap,i):$w("row-gap",getComputedStyle(p).rowGap,i)),h!==null&&e(h)},[e,t,i,o,l,r,u]);return Mk(f,n,d)}function rD(e,t,n,r){const i=e.length;if(i===0)return null;const o=[];for(let l=0;l<i;l++){const u=e.item(l);if(u.dataset.index===void 0)continue;const d=parseInt(u.dataset.index,10),f=parseFloat(u.dataset.knownSize),p=t(u,n);if(p===0&&r("Zero-sized element, this should not happen",{child:u},Hr.ERROR),p===f)continue;const h=o[o.length-1];o.length===0||h.size!==p||h.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,Hr.WARN),t==="normal"?0:parseInt(t??"0",10)}const fp=typeof document>"u"?Tt.useEffect:Tt.useLayoutEffect;function $v(e){return(e==null?void 0:e.currentCSSZoom)??1}function Ua(e,t){return t===1?e:Math.round(e*t*64)/64}function Du(e,t,n=e.parentElement){return Ua(e.getBoundingClientRect()[t],1/$v(n))}function yo(e,t,n=e.parentElement){return Math.round(Du(e,t,n))}function DA(e,t,n){const r=Tt.useRef(null),i=Tt.useRef(t);fp(()=>{i.current=t},[t]);const o=Tt.useCallback(f=>{if(!(f!=null&&f.offsetParent))return;const p=f.getBoundingClientRect(),h=$v(f);let m,x,v;const k=i.current;if(k){const _=k.getBoundingClientRect(),S=p.top-_.top;x=$v(k),v=Ua(_.height-Math.max(0,S),1/h),m=Ua(S,1/x)+k.scrollTop}else{const _=u.current.ownerDocument.defaultView;x=1,v=Ua(_.innerHeight-Math.max(0,p.top),1/h),m=p.top+_.scrollY}r.current={listHeight:Ua(p.height,1/h),offsetTop:m,visibleHeight:v,visibleWidth:Ua(p.width,1/h),zoomRatio:x/h},e(r.current)},[e,t]),{callbackRef:l,ref:u}=Mk(o,!0,n),d=Tt.useCallback(()=>{o(u.current)},[o,u]);return Tt.useEffect(()=>{var p;if(t){t.addEventListener("scroll",d);const h=new ResizeObserver(()=>{requestAnimationFrame(d)});return h.observe(t),()=>{t.removeEventListener("scroll",d),h.disconnect()}}const f=(p=u.current)==null?void 0:p.ownerDocument.defaultView;return f==null||f.addEventListener("scroll",d),f==null||f.addEventListener("resize",d),()=>{f==null||f.removeEventListener("scroll",d),f==null||f.removeEventListener("resize",d)}},[d,t,u]),l}const vi=Fn(()=>{const e=Nn(),t=Nn(),n=nt(0),r=Nn(),i=Nn(),o=nt(0),l=Nn(),u=Nn(),d=nt(0),f=nt(0),p=nt(0),h=nt(0),m=Nn(),x=Nn(),v=nt(!1),k=nt(!1),_=nt(!1);return Ft(qe(e,vt(({scrollTop:S})=>S)),t),Ft(qe(e,vt(({scrollHeight:S})=>S)),u),Ft(t,o),{deviation:n,deviationCommitted:r,fixedFooterHeight:p,fixedHeaderHeight:f,footerHeight:h,headerHeight:d,horizontalDirection:k,scrollBy:x,scrollContainerState:e,scrollHeight:u,scrollingInProgress:v,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:_,smoothScrollTargetReached:i,statefulScrollTop:o,viewportHeight:l}},[],{singleton:!0}),Pu={lvl:0};function PA(e,t){const n=e.length;if(n===0)return[];let{index:r,value:i}=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:i}),r=u,i=d}return o.push({end:1/0,start:r,value:i}),o}function $n(e){return e===Pu}function Fu(e,t){if(!$n(e))return t===e.k?e.v:t<e.k?Fu(e.l,t):Fu(e.r,t)}function Va(e,t,n="k"){if($n(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Va(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Va(e.l,t,n)}function Fi(e,t,n){return $n(e)?zA(t,n,1):t===e.k?Ur(e,{k:t,v:n}):t<e.k?Ww(Ur(e,{l:Fi(e.l,t,n)})):Ww(Ur(e,{r:Fi(e.r,t,n)}))}function Zo(){return Pu}function Kl(e,t,n){if($n(e))return[];const r=Va(e,t)[0];return iD(Vv(e,r,n))}function Wv(e,t){if($n(e))return Pu;const{k:n,l:r,r:i}=e;if(t===n){if($n(r))return i;if($n(i))return r;const[o,l]=BA(r);return Lf(Ur(e,{k:o,l:FA(r),v:l}))}return t<n?Lf(Ur(e,{l:Wv(r,t)})):Lf(Ur(e,{r:Wv(i,t)}))}function Jo(e){return $n(e)?[]:[...Jo(e.l),{k:e.k,v:e.v},...Jo(e.r)]}function Vv(e,t,n){if($n(e))return[];const{k:r,l:i,r:o,v:l}=e;let u=[];return r>t&&(u=u.concat(Vv(i,t,n))),r>=t&&r<=n&&u.push({k:r,v:l}),r<=n&&(u=u.concat(Vv(o,t,n))),u}function Lf(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(gg(t))return UA(Ur(e,{lvl:n-1}));if(!$n(t)&&!$n(t.r))return Ur(t.r,{l:Ur(t,{r:t.r.l}),lvl:n,r:Ur(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(gg(e))return Gv(Ur(e,{lvl:n-1}));if(!$n(r)&&!$n(r.l)){const i=r.l,o=gg(i)?r.lvl-1:r.lvl;return Ur(i,{l:Ur(e,{lvl:n-1,r:i.l}),lvl:i.lvl+1,r:Gv(Ur(r,{l:i.r,lvl:o}))})}throw new Error("Unexpected empty nodes")}function Ur(e,t){return zA(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 FA(e){return $n(e.r)?e.l:Lf(Ur(e,{r:FA(e.r)}))}function gg(e){return $n(e)||e.lvl>e.r.lvl}function BA(e){return $n(e.r)?[e.k,e.v]:BA(e.r)}function zA(e,t,n,r=Pu,i=Pu){return{k:e,l:r,lvl:n,r:i,v:t}}function Ww(e){return Gv(UA(e))}function UA(e){const{l:t}=e;return!$n(t)&&t.lvl===e.lvl?Ur(t,{r:Ur(e,{l:t.r})}):e}function Gv(e){const{lvl:t,r:n}=e;return!$n(n)&&!$n(n.r)&&n.lvl===t&&n.r.lvl===t?Ur(n,{l:Ur(e,{r:n.l}),lvl:t+1}):e}function iD(e){return PA(e,({k:t,v:n})=>({index:t,value:n}))}function qA(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Jl(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Lk=Fn(()=>({recalcInProgress:nt(!1)}),[],{singleton:!0});function HA(e,t,n){return e[Wf(e,t,n)]}function Wf(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const o=Math.floor((r+i)/2),l=e[o],u=n(l,t);if(u===0)return o;if(u===-1){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function aD(e,t,n,r){const i=Wf(e,t,r),o=Wf(e,n,r,i);return e.slice(i,o+1)}function pp(e){return!$n(e.groupOffsetTree)}function Ok({index:e},t){return t===e?0:t<e?-1:1}function Vw(){return{groupIndices:[],groupOffsetTree:Zo(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Zo()}}function sD(e,t){let n=$n(e)?0:1/0;for(const r of t){const{endIndex:i,size:o,startIndex:l}=r;if(n=Math.min(n,l),$n(e)){e=Fi(e,0,o);continue}const u=Kl(e,l-1,i+1);if(u.some(pD(r)))continue;let d=!1,f=!1;for(const{end:p,start:h,value:m}of u)d?(i>=h||o===m)&&(e=Wv(e,h)):(f=m!==o,d=!0),p>i&&i>=h&&m!==o&&(e=Fi(e,i+1,m));f&&(e=Fi(e,l,o))}return[e,n]}function oD(e){return e.groupIndex!==void 0}function lD({offset:e},t){return t===e?0:t<e?-1:1}function Bu(e,t,n){if(t.length===0)return 0;const{index:r,offset:i,size:o}=HA(t,e,Ok);return i+(e-r)*(o+n)}function $A(e,t){if(!pp(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function WA(e,t,n){if(oD(e))return t.groupIndices[e.groupIndex]+1;const r=e.index==="LAST"?n:e.index;let i=$A(r,t);return i=Math.max(0,Math.min(n,i)),i}function cD(e,t,n,r=0){return r>0&&(t=Math.max(t,HA(e,r,Ok).offset)),PA(aD(e,t,n,lD),fD)}function uD(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,Hr.DEBUG);const o=e.sizeTree;let l=o,u=0;if(n.length>0&&$n(o)&&t.length===2){const m=t[0].size,x=t[1].size;l=n.reduce((v,k)=>Fi(Fi(v,k,m),k+1,x),l)}else[l,u]=sD(l,t);if(l===o)return e;const{lastIndex:d,lastOffset:f,lastSize:p,offsetTree:h}=Kv(e.offsetTree,u,l,i);return{groupIndices:n,groupOffsetTree:n.reduce((m,x)=>Fi(m,x,Bu(x,h,i)),Zo()),lastIndex:d,lastOffset:f,lastSize:p,offsetTree:h,sizeTree:l}}function dD(e){return Jo(e).map(({k:t,v:n},r,i)=>{const o=i[r+1];return{endIndex:o===void 0?1/0:o.k-1,size:n,startIndex:t}})}function Gw(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 Kv(e,t,n,r){let i=e,o=0,l=0,u=0,d=0;if(t===0)i=[];else{d=Wf(i,t-1,Ok),u=i[d].offset;const f=Va(n,t-1);o=f[0],l=f[1],i.length&&i[d].size===Va(n,t)[1]&&(d-=1),i=i.slice(0,d+1)}for(const{start:f,value:p}of Kl(n,t,1/0)){const h=f-o,m=h*l+u+h*r;i.push({index:f,offset:m,size:p}),o=f,u=m,l=p}return{lastIndex:o,lastOffset:u,lastSize:l,offsetTree:i}}function fD(e){return{index:e.index,value:e}}function pD(e){const{endIndex:t,size:n,startIndex:r}=e;return i=>i.start===r&&(i.end===t||i.end===1/0)&&i.value===n}const hD={offsetHeight:"height",offsetWidth:"width"},os=Fn(([{log:e},{recalcInProgress:t}])=>{const n=Nn(),r=Nn(),i=qr(r,0),o=Nn(),l=Nn(),u=nt(0),d=nt([]),f=nt(void 0),p=nt(void 0),h=nt(void 0),m=nt(void 0),x=nt((I,A)=>yo(I,hD[A])),v=nt(void 0),k=nt(0),_=Vw(),S=Nn(),w=qr(qe($f(n,S),bn(d,e,k),qa((I,[A,...L])=>{if(A===null){const[D]=L;return{...Vw(),groupIndices:D,groupOffsetTree:D.reduce(($,te,V)=>Fi($,te,V),Zo())}}return uD(I,[A,...L])},_),ir()),_),N=qr(qe(d,ir(),qa((I,A)=>({current:A,prev:I.current}),{current:[],prev:[]}),vt(({prev:I})=>I)),[]);Ft(qe(d,Xt(I=>I.length>0),bn(w,k),vt(([I,A,L])=>{const D=I.reduce(($,te,V)=>Fi($,te,Bu(te,A.offsetTree,L)||V),Zo());return{...A,groupIndices:I,groupOffsetTree:D}})),w),Ft(qe(r,bn(w),Xt(([I,{lastIndex:A}])=>I<A),vt(([I,{lastIndex:A,lastSize:L}])=>[{endIndex:A,size:L,startIndex:I}])),n),Ft(f,p);const R=qr(qe(f,vt(I=>I===void 0)),!0);Ft(qe(p,Xt(I=>I!==void 0&&$n(Jn(w).sizeTree)),vt(I=>{const A=Jn(h),L=Jn(d).length>0;return A!==void 0&&A!==0?L?[{endIndex:0,size:A,startIndex:0},{endIndex:1,size:I,startIndex:1}]:[]:[{endIndex:0,size:I,startIndex:0}]})),n),Ft(qe(m,Xt(I=>I!==void 0&&I.length>0&&$n(Jn(w).sizeTree)),vt(I=>{const A=[];let L=I[0],D=0;for(let $=1;$<I.length;$++){const te=I[$];te!==L&&(A.push({endIndex:$-1,size:L,startIndex:D}),L=te,D=$)}return A.push({endIndex:I.length-1,size:L,startIndex:D}),A})),n),Ft(qe(d,bn(h,p),Xt(([,I,A])=>I!==void 0&&A!==void 0),vt(([I,A,L])=>{const D=[];for(let $=0;$<I.length;$++){const te=I[$],V=I[$+1];D.push({startIndex:te,endIndex:te,size:A}),V!==void 0&&D.push({startIndex:te+1,endIndex:V-1,size:L})}return D})),n);const T=na(qe(n,bn(w),qa(({sizes:I},[A,L])=>({changed:L!==I,sizes:L}),{changed:!1,sizes:_}),vt(I=>I.changed)));Bn(qe(u,qa((I,A)=>({diff:I.prev-A,prev:A}),{diff:0,prev:0}),vt(I=>I.diff)),I=>{const{groupIndices:A}=Jn(w);if(I>0)hn(t,!0),hn(o,I+Gw(I,A));else if(I<0){const L=Jn(N);L.length>0&&(I-=Gw(-I,L)),hn(l,I)}}),Bn(qe(u,bn(e)),([I,A])=>{I<0&&A("`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},Hr.ERROR)});const C=na(o);Ft(qe(o,bn(w),vt(([I,A])=>{const L=A.groupIndices.length>0,D=[],$=A.lastSize;if(L){const te=Fu(A.sizeTree,0);let V=0,z=0;for(;V<I;){const K=A.groupIndices[z],H=A.groupIndices.length===z+1?1/0:A.groupIndices[z+1]-K-1;D.push({endIndex:K,size:te,startIndex:K}),D.push({endIndex:K+1+H-1,size:$,startIndex:K+1}),z++,V+=H+1}const G=Jo(A.sizeTree);return V!==I&&G.shift(),G.reduce((K,{k:H,v:se})=>{let P=K.ranges;return K.prevSize!==0&&(P=[...K.ranges,{endIndex:H+I-1,size:K.prevSize,startIndex:K.prevIndex}]),{prevIndex:H+I,prevSize:se,ranges:P}},{prevIndex:I,prevSize:0,ranges:D}).ranges}return Jo(A.sizeTree).reduce((te,{k:V,v:z})=>({prevIndex:V+I,prevSize:z,ranges:[...te.ranges,{endIndex:V+I-1,size:te.prevSize,startIndex:te.prevIndex}]}),{prevIndex:0,prevSize:$,ranges:[]}).ranges})),n);const M=na(qe(l,bn(w,k),vt(([I,{offsetTree:A},L])=>{const D=-I;return Bu(D,A,L)})));return Ft(qe(l,bn(w,k),vt(([I,A,L])=>{if(A.groupIndices.length>0){if($n(A.sizeTree))return A;let $=Zo();const te=Jn(N);let V=0,z=0,G=0;for(;V<-I;){G=te[z];const K=te[z+1]-G-1;z++,V+=K+1}if($=Jo(A.sizeTree).reduce((K,{k:H,v:se})=>Fi(K,Math.max(0,H+I),se),$),V!==-I){const K=Fu(A.sizeTree,G);$=Fi($,0,K);const H=Va(A.sizeTree,-I+1)[1];$=Fi($,1,H)}return{...A,sizeTree:$,...Kv(A.offsetTree,0,$,L)}}const D=Jo(A.sizeTree).reduce(($,{k:te,v:V})=>Fi($,Math.max(0,te+I),V),Zo());return{...A,sizeTree:D,...Kv(A.offsetTree,0,D,L)}})),w),{beforeUnshiftWith:C,data:v,defaultItemSize:p,firstItemIndex:u,fixedItemSize:f,fixedGroupSize:h,gap:k,groupIndices:d,heightEstimates:m,itemSize:x,listRefresh:T,resetSizes:S,shiftWith:l,shiftWithOffset:M,sizeRanges:n,sizes:w,statefulTotalCount:i,totalCount:r,trackItemSizes:R,unshiftWith:o}},sr(wo,Lk),{singleton:!0});function gD(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const VA=Fn(([{groupIndices:e,resetSizes:t,sizeRanges:n,sizes:r,statefulTotalCount:i,totalCount:o,trackItemSizes:l},{headerHeight:u,scrollTop:d}])=>{const f=Nn(),p=Nn(),h=na(qe(f,vt(gD))),m=qr(qe(n,bn(i,e),Xt(([,x,v])=>x>v.length),ea(!0)),!1);return Ft(qe(h,qa(([,x],v)=>[x,v],[{groupIndices:[],totalCount:0},{groupIndices:[],totalCount:0}]),bn(r,l,m),Xt(([[x,v],{sizeTree:k},_,S])=>{const w=x.groupIndices.length>0&&x.totalCount===x.groupIndices.length,N=v.totalCount>v.groupIndices.length;return _&&!S&&w&&N&&!$n(k)}),ea(null)),t),Ft(qe(h,vt(x=>x.totalCount)),o),Ft(qe(h,vt(x=>x.groupIndices)),e),Ft(qe(Er(d,r,u),Xt(([x,v])=>pp(v)),vt(([x,v,k])=>Va(v.groupOffsetTree,Math.max(x-k,0),"v")[0]),ir(),vt(x=>[x])),p),{groupCounts:f,topItemsIndexes:p}},sr(os,vi)),So=Fn(([{log:e}])=>{const t=nt(!1),n=na(qe(t,Xt(r=>r),ir()));return Bn(t,r=>{r&&Jn(e)("props updated",{},Hr.DEBUG)}),{didMount:n,propsReady:t}},sr(wo),{singleton:!0}),mD=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function GA(e){const t=typeof e=="number"?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!mD)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const Gu=Fn(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:l,headerHeight:u,scrollingInProgress:d,scrollTo:f,smoothScrollTargetReached:p,viewportHeight:h},{log:m}])=>{const x=Nn(),v=Nn(),k=nt(0);let _=null,S=null,w=null;function N(){_!==null&&(_(),_=null),w!==null&&(w(),w=null),S&&(clearTimeout(S),S=null),hn(d,!1)}return Ft(qe(x,bn(n,h,r,k,u,l,m),bn(e,o,i),vt(([[R,T,C,M,I,A,L,D],$,te,V])=>{const z=GA(R),{align:G,behavior:K,offset:H}=z,se=M-1,P=WA(z,T,se);let W=Bu(P,T.offsetTree,$)+A;G==="end"?(W+=te+Va(T.sizeTree,P)[1]-C+V,P===se&&(W+=L)):G==="center"?W+=(te+Va(T.sizeTree,P)[1]-C+V)/2:W-=I,H!==void 0&&H!==0&&(W+=H);const ee=F=>{N(),F?(D("retrying to scroll to",{location:R},Hr.DEBUG),hn(x,R)):(hn(v,!0),D("list did not change, scroll successful",{},Hr.DEBUG))};if(N(),K==="smooth"){let F=!1;w=Bn(t,J=>{F=F||J}),_=Ha(p,()=>{ee(F)})}else _=Ha(qe(t,xD(150)),ee);return S=setTimeout(()=>{N()},1200),hn(d,!0),D("scrolling from index to",{behavior:K,index:P,top:W},Hr.DEBUG),{behavior:K,top:W}})),f),{scrollTargetReached:v,scrollToIndex:x,topListHeight:k}},sr(os,vi,wo),{singleton:!0});function xD(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function Dk(e,t){e===0?t():requestAnimationFrame(()=>{Dk(e-1,t)})}function Pk(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 Yv(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 Ku=Fn(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:l}])=>{const u=nt(!0),d=nt(0),f=nt(!0);return Ft(qe(l,bn(d),Xt(([p,h])=>!Yv(h)),ea(!1)),u),Ft(qe(l,bn(d),Xt(([p,h])=>!Yv(h)),ea(!1)),f),Bn(qe(Er(t,l),bn(u,n,e,f),Xt(([[,p],h,{sizeTree:m},x,v])=>p&&(!$n(m)||Ak(x))&&!h&&!v),bn(d)),([,p])=>{if(p===void 0){hn(u,!0),hn(f,!0);return}Ha(i,()=>{hn(f,!0)}),Dk(4,()=>{Ha(r,()=>{hn(u,!0)}),hn(o,p)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:d,scrolledToInitialItem:u}},sr(os,vi,Gu,So),{singleton:!0});function KA(e,t){return Math.abs(e-t)<1.01}const zu="up",Eu="down",yD="none",bD={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},vD=0,Yu=Fn(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const l=nt(!1),u=nt(!0),d=Nn(),f=Nn(),p=nt(4),h=nt(vD),m=qr(qe($f(qe(rn(i),rl(1),ea(!0)),qe(rn(i),rl(1),ea(!1),qw(100))),ir()),!1),x=qr(qe($f(qe(n,ea(!0)),qe(n,ea(!1),qw(200))),ir()),!1);Ft(qe(Er(rn(i),rn(h)),vt(([w,N])=>w<=N),ir()),u),Ft(qe(u,Ls(50)),f);const v=na(qe(Er(r,rn(o),rn(t),rn(e),rn(p)),qa((w,[{scrollHeight:N,scrollTop:R},T,C,M,I])=>{const A=R+T-N>-I,L={scrollHeight:N,scrollTop:R,viewportHeight:T};if(A){let $,te;return R>w.state.scrollTop?($="SCROLLED_DOWN",te=w.state.scrollTop-R):($="SIZE_DECREASED",te=w.state.scrollTop-R||w.scrollTopDelta),{atBottom:!0,atBottomBecause:$,scrollTopDelta:te,state:L}}let D;return L.scrollHeight>w.state.scrollHeight?D="SIZE_INCREASED":T<w.state.viewportHeight?D="VIEWPORT_HEIGHT_DECREASING":R<w.state.scrollTop?D="SCROLLING_UPWARDS":D="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:D,state:L}},bD),ir((w,N)=>w!==void 0&&w.atBottom===N.atBottom))),k=qr(qe(r,qa((w,{scrollHeight:N,scrollTop:R,viewportHeight:T})=>{if(!KA(w.scrollHeight,N)){const C=N-(R+T)<1;return w.scrollTop!==R&&C?{changed:!0,jump:w.scrollTop-R,scrollHeight:N,scrollTop:R}:{changed:!0,jump:0,scrollHeight:N,scrollTop:R}}return{changed:!1,jump:0,scrollHeight:N,scrollTop:R}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Xt(w=>w.changed),vt(({jump:w})=>({jump:w}))),{jump:0});Ft(qe(v,vt(w=>w.atBottom)),l),Ft(qe(l,Ls(50)),d);const _=nt(Eu);Ft(qe(r,vt(({scrollTop:w})=>w),ir(),qa((w,N)=>Jn(x)?{direction:w.direction,prevScrollTop:N}:{direction:N<w.prevScrollTop?zu:Eu,prevScrollTop:N},{direction:Eu,prevScrollTop:0}),vt(w=>w.direction)),_),Ft(qe(r,Ls(50),ea(yD)),_);const S=nt(0);return Ft(qe(m,Xt(w=>!w),ea(0)),S),Ft(qe(i,Ls(100),bn(m),Xt(([w,N])=>N),qa(([w,N],[R])=>[N,R],[0,0]),vt(([w,N])=>N-w)),S),{atBottomState:v,atBottomStateChange:d,atBottomThreshold:p,atTopStateChange:f,atTopThreshold:h,isAtBottom:l,isAtTop:u,isScrolling:m,lastJumpDueToItemResize:k,scrollDirection:_,scrollVelocity:S}},sr(vi)),Uu="top",qu="bottom",Kw="none";function Yw(e,t,n){return typeof e=="number"?n===zu&&t===Uu||n===Eu&&t===qu?e:0:n===zu?t===Uu?e.main:e.reverse:t===qu?e.main:e.reverse}function Qw(e,t){return typeof e=="number"?e:e[t]??0}const Fk=Fn(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=Nn(),l=nt(0),u=nt(0),d=nt(0),f=qr(qe(Er(rn(r),rn(i),rn(n),rn(o,Jl),rn(d),rn(l),rn(t),rn(e),rn(u)),vt(([p,h,m,[x,v],k,_,S,w,N])=>{const R=p-w,T=_+S,C=Math.max(m-R,0);let M=Kw;const I=Qw(N,Uu),A=Qw(N,qu);return x-=w,x+=m+S,v+=m+S,v-=w,x>p+T-I&&(M=zu),v<p-C+h+A&&(M=Eu),M!==Kw?[Math.max(R-m-Yw(k,Uu,M)-I,0),R-C-S+h+Yw(k,qu,M)+A]:null}),Xt(p=>p!==null),ir(Jl)),[0,0]);return{increaseViewportBy:u,listBoundary:o,overscan:d,topListHeight:l,visibleRange:f}},sr(vi),{singleton:!0});function kD(e,t,n,r){if(pp(t)){const i=r-t.groupIndices.length;if(i<=0)return[{index:t.groupIndices[0],offset:0,size:0}];const o=$A(Math.min(e,i-1),t);return[{index:Va(t.groupOffsetTree,o)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:o,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const mg={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Of(e,t,n,r,i,o){const{lastIndex:l,lastOffset:u,lastSize:d}=i;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 h=n-l,m=u+h*d+(h-1)*r,x=f,v=m-p;return{bottom:p,firstItemIndex:o,items:Xw(e,i,o),offsetBottom:v,offsetTop:f,top:x,topItems:Xw(t,i,o),topListHeight:t.reduce((k,_)=>_.size+k,0),totalCount:n}}function YA(e,t,n,r,i,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=Pk(t,d?f:u),h=d?Math.max(0,Math.min(u,f-p)):u,m=Array.from({length:h}).map((x,v)=>({data:o==null?void 0:o[v+p],index:v+p,offset:0,size:0}));return Of(m,[],h,i,n,r)}function Xw(e,t,n){if(e.length===0)return[];if(!pp(t))return e.map(f=>({...f,index:f.index+n,originalIndex:f.index}));const r=e[0].index,i=e[e.length-1].index,o=[],l=Kl(t.groupOffsetTree,r,i);let u,d=0;for(const f of e){(!u||u.end<f.index)&&(u=l.shift(),d=t.groupIndices.indexOf(u.start));let 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 Zw(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const sl=Fn(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:l,topListHeight:u,visibleRange:d},{initialTopMostItemIndex:f,scrolledToInitialItem:p},{topListHeight:h},m,{didMount:x},{recalcInProgress:v}])=>{const k=nt([]),_=nt(0),S=qr(qe(r,Xt(({sizeTree:I})=>!$n(I)),ea(!0)),!1),w=Nn(),N=nt(0);Ft(o.topItemsIndexes,k);const R=qr(qe(Er(x,v,rn(d,Jl),rn(i),rn(r),rn(f),p,rn(k),rn(t),rn(n),rn(N),e,rn(_)),Xt(([I,A,,L,,,,,,,,D])=>{const $=D!==void 0&&D.length!==L;return I&&!A&&!$}),vt(([,,[I,A],L,D,$,te,V,z,G,K,H,se])=>{var ye,Fe;const P=D,{offsetTree:W,sizeTree:ee}=P;if(L===0)return{...mg,totalCount:L};if(I===0&&A===0)return se===0?{...mg,totalCount:L}:YA(se,$,D,z,G,H);if($n(ee))return se>0&&!Jn(S)?null:Of(kD(Pk($,L),P,H,L),[],L,G,P,z);const F=[];if(V.length>0){const ct=V[0],ht=V[V.length-1];let pt=0;for(const et of Kl(ee,ct,ht)){const ze=et.value,Be=Math.max(et.start,ct),At=Math.min(et.end,ht);for(let lt=Be;lt<=At;lt++)F.push({data:H==null?void 0:H[lt],index:lt,offset:pt,size:ze}),pt+=ze}}if(!te)return Of([],F,L,G,P,z);const J=V.length>0?V[V.length-1]+1:0,q=cD(W,I,A,J);if(q.length===0)return null;const Y=L-1,oe=dp([],ct=>{for(const ht of q){const pt=ht.value;let et=pt.offset,ze=ht.start;const Be=pt.size;if(pt.offset<I){ze+=Math.floor((I-pt.offset+G)/(Be+G));const lt=ze-ht.start;et+=lt*Be+lt*G}ze<J&&(et+=(J-ze)*Be,ze=J);const At=Math.min(ht.end,Y);for(let lt=ze;lt<=At&&!(et>=A);lt++)ct.push({data:H==null?void 0:H[lt],index:lt,offset:et,size:Be}),et+=Be+G}}),_e=Zw(K,Uu),ae=Zw(K,qu);if(oe.length>0&&(_e>0||ae>0)){const ct=oe[0],ht=oe[oe.length-1];if(_e>0&&ct.index>J){const pt=Math.min(_e,ct.index-J),et=[];let ze=ct.offset;for(let Be=ct.index-1;Be>=ct.index-pt;Be--){const At=((ye=Kl(ee,Be,Be)[0])==null?void 0:ye.value)??ct.size;ze-=At+G,et.unshift({data:H==null?void 0:H[Be],index:Be,offset:ze,size:At})}oe.unshift(...et)}if(ae>0&&ht.index<Y){const pt=Math.min(ae,Y-ht.index);let et=ht.offset+ht.size+G;for(let ze=ht.index+1;ze<=ht.index+pt;ze++){const Be=((Fe=Kl(ee,ze,ze)[0])==null?void 0:Fe.value)??ht.size;oe.push({data:H==null?void 0:H[ze],index:ze,offset:et,size:Be}),et+=Be+G}}}return Of(oe,F,L,G,P,z)}),Xt(I=>I!==null),ir()),mg);Ft(qe(e,Xt(Ak),vt(I=>I==null?void 0:I.length)),i),Ft(qe(R,vt(I=>I.topListHeight)),h),Ft(h,u),Ft(qe(R,vt(I=>[I.top,I.bottom])),l),Ft(qe(R,vt(I=>I.items)),w);const T=na(qe(R,Xt(({items:I})=>I.length>0),bn(i,e),Xt(([{items:I},A])=>I[I.length-1].originalIndex===A-1),vt(([{items:I},A,L])=>{const D=I[I.length-1],$=D.type==="group"?D.index+1:(D.groupIndex??-1)+1;return[A-1-$,L]}),ir(Jl),Xt(([I])=>I>=0),vt(([I])=>I))),C=na(qe(R,Ls(200),Xt(({items:I,topItems:A})=>I.length>0&&I[0].originalIndex===A.length),vt(({items:I})=>I[0].index),ir())),M=na(qe(R,Xt(({items:I})=>I.length>0),vt(({items:I})=>{let A=0,L=I.length-1;for(;I[A].type==="group"&&A<L;)A++;for(;I[L].type==="group"&&L>A;)L--;return{endIndex:I[L].index,startIndex:I[A].index}}),ir(qA)));return{endReached:T,initialItemCount:_,itemsRendered:w,listState:R,minOverscanItemCount:N,rangeChanged:M,startReached:C,topItemsIndexes:k,...m}},sr(os,VA,Fk,Ku,Gu,Yu,So,Lk),{singleton:!0}),QA=Fn(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=Nn(),l=qr(qe(Er(n,e,r,t,i),vt(([u,d,f,p,h])=>u+d+f+p+h.offsetBottom+h.bottom)),0);return Ft(rn(l),o),{totalListHeight:l,totalListHeightChanged:o}},sr(vi,sl),{singleton:!0}),_D=Fn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=nt(!1),r=qr(qe(Er(n,e,t),Xt(([i])=>i),vt(([,i,o])=>Math.max(0,i-o)),Ls(0),ir()),0);return{alignToBottom:n,paddingTopAddition:r}},sr(vi,QA),{singleton:!0}),XA=Fn(()=>({context:nt(null)})),wD=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:l})=>t<l?{...i,align:n??"start",...r===void 0?{}:{behavior:r}}:e>o?{...i,align:n??"end",...r===void 0?{}:{behavior:r}}:null,ZA=Fn(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:l,scrollTop:u,viewportHeight:d},{scrollToIndex:f}])=>{const p=Nn();return Ft(qe(p,bn(t,d,n,o,i,r,u),bn(e),vt(([[h,m,x,v,k,_,S,w],N])=>{const{calculateViewLocation:R=wD,done:T,...C}=h,M=WA(h,m,v-1),I=Bu(M,m.offsetTree,N)+k+_,A=I+Va(m.sizeTree,M)[1],L=w+_,D=w+x-S,$=R({itemBottom:A,itemTop:I,locationParams:C,viewportBottom:D,viewportTop:L});return $===null?T==null||T():T&&Ha(qe(l,Xt(te=>!te),rl(Jn(l)?1:2)),T),$}),Xt(h=>h!==null)),f),{scrollIntoView:p}},sr(os,vi,Gu,sl,wo),{singleton:!0});function Jw(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const SD=(e,t)=>typeof e=="function"?Jw(e(t)):t&&Jw(e),ED=Fn(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:o},{scrollToIndex:l},{scrolledToInitialItem:u},{didMount:d,propsReady:f},{log:p},{scrollingInProgress:h},{context:m},{scrollIntoView:x}])=>{const v=nt(!1),k=Nn();let _=null;function S(T){hn(l,{align:"end",behavior:T,index:"LAST"})}Bn(qe(Er(qe(rn(t),rl(1)),d),bn(rn(v),o,u,h),vt(([[T,C],M,I,A,L])=>{let D=C&&A,$="auto";return D&&($=SD(M,I||L),D=D&&$!==!1),{followOutputBehavior:$,shouldFollow:D,totalCount:T}}),Xt(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:C})=>{_!==null&&(_(),_=null),Jn(n)===void 0?_=Ha(e,()=>{Jn(p)("following output to ",{totalCount:C},Hr.DEBUG),S(T),_=null}):requestAnimationFrame(()=>{Jn(p)("following output to ",{totalCount:C},Hr.DEBUG),S(T)})});function w(T){const C=Ha(i,M=>{T&&!M.atBottom&&M.notAtBottomBecause==="SIZE_INCREASED"&&_===null&&(Jn(p)("scrolling to bottom due to increased size",{},Hr.DEBUG),S("auto"))});setTimeout(C,100)}Bn(qe(Er(rn(v),t,f),Xt(([T,,C])=>T!==!1&&C),qa(({value:T},[,C])=>({refreshed:T===C,value:C}),{refreshed:!1,value:0}),Xt(({refreshed:T})=>T),bn(v,t)),([,T])=>{Jn(u)&&w(T!==!1)}),Bn(k,()=>{w(Jn(v)!==!1)}),Bn(Er(rn(v),i),([T,C])=>{T!==!1&&!C.atBottom&&C.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&S("auto")});const N=nt(null),R=Nn();return Ft($f(qe(rn(r),vt(T=>(T==null?void 0:T.length)??0)),qe(rn(t))),R),Bn(qe(Er(qe(R,rl(1)),d),bn(rn(N),u,h,m),vt(([[T,C],M,I,A,L])=>C&&I&&(M==null?void 0:M({context:L,totalCount:T,scrollingInProgress:A}))),Xt(T=>!!T),Ls(0)),T=>{_!==null&&(_(),_=null),Jn(n)===void 0?_=Ha(e,()=>{Jn(p)("scrolling into view",{}),hn(x,T),_=null}):requestAnimationFrame(()=>{Jn(p)("scrolling into view",{}),hn(x,T)})}),{autoscrollToBottom:k,followOutput:v,scrollIntoViewOnChange:N}},sr(os,Yu,Gu,Ku,So,wo,vi,XA,ZA)),ND=Fn(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:l},{didMount:u}])=>(Ft(qe(u,bn(o),Xt(([,d])=>d!==0),bn(i,r,t,n,e),vt(([[,d],f,p,h,m,x])=>YA(d,f,p,h,m,x))),l),{}),sr(os,Ku,sl,So),{singleton:!0}),CD=Fn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=nt(0);return Bn(qe(e,bn(r),Xt(([,i])=>i!==0),vt(([,i])=>({top:i}))),i=>{Ha(qe(n,rl(1),Xt(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{hn(t,i)})})}),{initialScrollTop:r}},sr(So,vi,sl),{singleton:!0}),JA=Fn(([{scrollVelocity:e}])=>{const t=nt(!1),n=Nn(),r=nt(!1);return Ft(qe(e,bn(r,t,n),Xt(([i,o])=>o!==!1&&o!==void 0),vt(([i,o,l,u])=>{const{enter:d,exit:f}=o;if(l){if(f(i,u))return!1}else if(d(i,u))return!0;return l}),ir()),t),Bn(qe(Er(t,e,n),bn(r)),([[i,o,l],u])=>{i&&u!==!1&&u!==void 0&&u.change&&u.change(o,l)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},sr(Yu),{singleton:!0}),Bk=Fn(([{scrollBy:e,scrollContainerState:t,scrollTo:n}])=>{const r=Nn(),i=Nn(),o=Nn(),l=Nn(),u=nt(!1),d=nt(void 0),f=qr(qe(i,vt(({zoomRatio:p})=>p??1)),1);return Ft(qe(Er(r,i),vt(([{scrollTop:p,viewportHeight:h},{listHeight:m,offsetTop:x,zoomRatio:v=1}])=>({scrollHeight:m,scrollTop:Math.max(0,Ua(p-x,v)),viewportHeight:Ua(h,v)}))),t),Ft(qe(n,bn(i),vt(([p,{offsetTop:h,zoomRatio:m=1}])=>({...p,top:Ua(p.top,1/m)+h}))),o),Ft(qe(e,bn(f),vt(([p,h])=>p.top===void 0?p:{...p,top:Ua(p.top,1/h)})),l),{customScrollParent:d,useWindowScroll:u,windowScrollContainerState:r,windowScrollBy:l,windowScrollTo:o,windowViewportRect:i}},sr(vi)),jD=Fn(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:l,windowScrollContainerState:u,windowViewportRect:d}])=>{const f=Nn(),p=nt(void 0),h=nt(null),m=nt(null);return Ft(u,h),Ft(d,m),Bn(qe(f,bn(t,r,l,h,m,n)),([x,v,k,_,S,w,N])=>{const R=dD(v.sizeTree);_&&S!==null&&w!==null&&(k=Ua(S.scrollTop-w.offsetTop,w.zoomRatio??1)),k-=N,x({ranges:R,scrollTop:k})}),Ft(qe(p,Xt(Ak),vt(TD)),i),Ft(qe(o,bn(p),Xt(([,x])=>x!==void 0),ir(),vt(([,x])=>x.ranges)),e),{getState:f,restoreStateFrom:p}},sr(os,vi,Ku,So,Bk));function TD(e){return{align:"start",index:0,offset:e.scrollTop}}const RD=Fn(([{topItemsIndexes:e}])=>{const t=nt(0);return Ft(qe(t,Xt(n=>n>=0),vt(n=>Array.from({length:n}).map((r,i)=>i))),e),{topItemCount:t}},sr(sl));function e4(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const AD=e4(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),ID=Fn(([{deviation:e,deviationCommitted:t,scrollBy:n,scrollingInProgress:r,scrollTop:i},{isAtBottom:o,isScrolling:l,lastJumpDueToItemResize:u,scrollDirection:d},{listState:f},{beforeUnshiftWith:p,gap:h,shiftWithOffset:m,sizes:x},{log:v},{recalcInProgress:k}])=>{const _=na(qe(f,bn(u),qa(([,R,T,C,M],[{bottom:I,items:A,offsetBottom:L,totalCount:D},$])=>{const te=I+L;let V=0,z=M;return T===D&&R.length>0&&A.length>0&&(A[0].originalIndex===0&&R[0].originalIndex===0||(V=te-C,V!==0&&$!==z&&(V+=$.jump,z=$))),[V,A,D,te,z]},[0,[],0,0,void 0]),Xt(([R])=>R!==0),bn(i,d,r,o,v,k),Xt(([,R,T,C,,,M])=>!M&&!C&&R!==0&&T===zu),vt(([[R],,,,,T])=>(T("Upward scrolling compensation",{amount:R},Hr.DEBUG),R))));function S(R){R>0?(hn(n,{behavior:"auto",top:-R}),hn(e,0)):(hn(e,0),hn(n,{behavior:"auto",top:-R}))}Bn(qe(_,bn(e,l)),([R,T,C])=>{C&&AD()?hn(e,T-R):S(-R)}),Bn(qe(Er(qr(l,!1),e,k),Xt(([R,T,C])=>!R&&!C&&T!==0),vt(([R,T])=>T),Ls(1)),S),Ft(qe(m,vt(R=>({top:-R}))),n);let w=null;function N(){if(w===null)return;const{offset:R}=w;w=null,hn(n,{top:R}),requestAnimationFrame(()=>{hn(e,0),hn(k,!1)})}return Bn(t,R=>{w===null||!w.acknowledgeable||R===w.offset&&N()}),Bn(qe(p,bn(x,h),vt(([R,{groupIndices:T,lastSize:C,sizeTree:M},I])=>{function A(V){return V*(C+I)}if(T.length===0)return A(R);let L=0;const D=Fu(M,0);let $=0,te=0;for(;$<R;){$++,L+=D;let V=T.length===te+1?1/0:T[te+1]-T[te]-1;$+V>R&&(L-=D,V=R-$+1),$+=V,L+=A(V),te++}return L})),R=>{w={acknowledgeable:Jn(e)!==R,offset:R},hn(e,R),requestAnimationFrame(N)}),{deviation:e}},sr(vi,Yu,sl,os,wo,Lk)),MD=Fn(([e,t,n,r,i,o,l,u,d,f,p])=>({...e,...t,...n,...r,...i,...o,...l,...u,...d,...f,...p}),sr(Fk,ND,So,JA,QA,CD,_D,Bk,ZA,wo,XA)),t4=Fn(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:o,groupIndices:l,heightEstimates:u,itemSize:d,sizeRanges:f,sizes:p,statefulTotalCount:h,totalCount:m,trackItemSizes:x},{initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_},S,w,N,R,{scrollToIndex:T},C,{topItemCount:M},{groupCounts:I},A])=>{const{listState:L,minOverscanItemCount:D,topItemsIndexes:$,rangeChanged:te,...V}=R;return Ft(te,A.scrollSeekRangeChanged),Ft(qe(Er(A.windowViewportRect,S.headerHeight,S.fixedHeaderHeight),vt(([z,G,K])=>Math.max(G+K+1,z.visibleHeight))),S.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:o,groupCounts:I,heightEstimates:u,initialItemFinalLocationReached:v,initialTopMostItemIndex:k,scrolledToInitialItem:_,sizeRanges:f,topItemCount:M,topItemsIndexes:$,totalCount:m,...N,groupIndices:l,itemSize:d,listState:L,minOverscanItemCount:D,scrollToIndex:T,statefulTotalCount:h,trackItemSizes:x,rangeChanged:te,...V,...A,...S,sizes:p,...w}},sr(os,Ku,vi,jD,ED,sl,Gu,ID,RD,VA,MD));function LD(e,t){const n={},r={};let i=0;const o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(const l in t)Object.hasOwn(r,l)||(n[l]=t[l]);return n}const cf=typeof document>"u"?Tt.useEffect:Tt.useLayoutEffect;function n4(e,t,n){const r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),u=Tt.createContext({});function d(_,S){_.propsReady!==void 0&&hn(_.propsReady,!1);for(const w of r){const N=_[t.required[w]];hn(N,S[w])}for(const w of i)if(w in S){const N=_[t.optional[w]];hn(N,S[w])}_.propsReady!==void 0&&hn(_.propsReady,!0)}function f(_){return o.reduce((S,w)=>(S[w]=N=>{const R=_[t.methods[w]];hn(R,N)},S),{})}function p(_){return l.reduce((S,w)=>(S[w]=Y3(_[t.events[w]]),S),{})}const h=Tt.forwardRef(function(_,S){const{children:w,...N}=_,[R]=Tt.useState(()=>dp(Z3(e),M=>{d(M,N)})),[T]=Tt.useState(Uw(p,R));cf(()=>{for(const M of l)M in N&&Bn(T[M],N[M]);return()=>{Object.values(T).map(Ik)}},[N,T,R]),cf(()=>{d(R,N)}),Tt.useImperativeHandle(S,zw(f(R)));const C=n;return a.jsx(u.Provider,{value:R,children:n===void 0?w:a.jsx(C,{...LD([...r,...i,...l],N),children:w})})}),m=_=>{const S=Tt.useContext(u);return Tt.useCallback(w=>{hn(S[_],w)},[S,_])},x=_=>{const S=Tt.useContext(u)[_],w=Tt.useCallback(N=>Bn(S,N),[S]);return Tt.useSyncExternalStore(w,()=>Jn(S),()=>Jn(S))},v=_=>{const S=Tt.useContext(u)[_],[w,N]=Tt.useState(Uw(Jn,S));return cf(()=>Bn(S,R=>{R!==w&&N(zw(R))}),[S,w]),w},k=parseInt(Tt.version,10)>=18?x:v;return{Component:h,useEmitter:(_,S)=>{const w=Tt.useContext(u)[_];cf(()=>Bn(w,S),[S,w])},useEmitterValue:k,usePublisher:m}}const zk=Tt.createContext(void 0),r4=Tt.createContext(void 0),xg="-webkit-sticky",e2="sticky",Uk=e4(()=>{if(typeof document>"u")return e2;const e=document.createElement("div");return e.style.position=xg,e.style.position===xg?xg:e2});function yg(e){return"self"in e}function OD(e){return"body"in e}function i4(e,t,n,r=ic,i,o){const l=Tt.useRef(null),u=Tt.useRef(null),d=Tt.useRef(null),f=Tt.useCallback(h=>{let m,x,v;const k=h.target;if(OD(k)||yg(k)){const S=yg(k)?k:k.defaultView;v=o===!0?Xo(S,S.scrollX):S.scrollY,m=o===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight,x=o===!0?S.innerWidth:S.innerHeight}else v=o===!0?Xo(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})};h.suppressFlushSync===!0?_():wL.flushSync(_),u.current!==null&&(Math.abs(v-u.current)<1||v<=0||v===m-x)&&(u.current=null,t(!0),d.current&&(clearTimeout(d.current),d.current=null))},[e,t,o]);Tt.useEffect(()=>{const h=i??l.current;return r(i??l.current),f({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",f,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",f)}},[l,f,n,r,i]);function p(h){const m=l.current;if(!m||(o===!0?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const x=h.behavior==="smooth";let v,k,_;yg(m)?(k=Math.max(yo(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?Xo(m,m.scrollX):m.scrollY):(k=m[o===!0?"scrollWidth":"scrollHeight"],v=yo(m,o===!0?"width":"height",m),_=o===!0?Xo(m,m.scrollLeft):m.scrollTop);const S=k-v;if(h.top===void 0){m.scrollTo(h);return}const w=Math.ceil(Math.max(Math.min(S,h.top),0));if(h.top=w,KA(v,k)||w===_){e({scrollHeight:k,scrollTop:_,viewportHeight:v}),x&&t(!0);return}x?(u.current=w,d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,u.current=null,t(!0)},1e3)):u.current=null,o===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},left:Hw(m,w)}),m.scrollTo(h)}return{scrollByCallback:Tt.useCallback(h=>{o===!0&&(h={...h.behavior===void 0?{}:{behavior:h.behavior},...h.top===void 0?{}:{left:Hw(l.current,h.top)}}),l.current.scrollBy(h)},[o]),scrollerRef:l,scrollToCallback:p}}function qk(e){return e}const DD=Fn(()=>{const e=nt(u=>`Item ${u}`),t=nt(u=>`Group ${u}`),n=nt({}),r=nt(qk),i=nt("div"),o=nt(ic),l=(u,d=null)=>qr(qe(n,vt(f=>f[u]),ir()),d);return{components:n,computeItemKey:r,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:t,HeaderComponent:l("Header"),HeaderFooterTag:i,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),PD=Fn(([e,t])=>({...e,...t}),sr(t4,DD)),FD=({height:e})=>a.jsx("div",{style:{height:e}}),BD={overflowAnchor:"none",position:Uk(),zIndex:1},a4={overflowAnchor:"none"},zD={...a4,display:"inline-block",height:"100%"},t2=Tt.memo(function({showTopList:e=!1}){const t=cn("listState"),n=ta("sizeRanges"),r=cn("useWindowScroll"),i=cn("customScrollParent"),o=ta("windowScrollContainerState"),l=ta("scrollContainerState"),u=i||r?o:l,d=cn("itemContent"),f=cn("context"),p=cn("groupContent"),h=cn("trackItemSizes"),m=cn("itemSize"),x=cn("log"),v=ta("gap"),k=cn("horizontalDirection"),{callbackRef:_}=nD(n,m,h,e?ic:u,x,v,i,k,cn("skipAnimationFrameInResizeObserver")),[S,w]=Tt.useState(0);$k("deviation",z=>{S!==z&&w(z)});const N=ta("deviationCommitted");fp(()=>{N(S)},[S,N]);const R=cn("EmptyPlaceholder"),T=cn("ScrollSeekPlaceholder")??FD,C=cn("ListComponent"),M=cn("ItemComponent"),I=cn("GroupComponent"),A=cn("computeItemKey"),L=cn("isSeeking"),D=cn("groupIndices").length>0,$=cn("alignToBottom"),te=cn("initialItemFinalLocationReached"),V=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginInlineStart:S===0?$?"auto":0:S,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:"nowrap"}:{marginTop:S===0?$?"auto":0:S,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...te?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&R!==null&&R!==void 0?a.jsx(R,{...hi(R,f)}):a.jsx(C,{...hi(C,f),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:_,style:V,children:(e?t.topItems:t.items).map(z=>{const G=z.originalIndex,K=A(G+t.firstItemIndex,z.data,f);return L?y.createElement(T,{...hi(T,f),height:z.size,index:z.index,key:K,type:z.type||"item",...z.type==="group"?{}:{groupIndex:z.groupIndex}}):z.type==="group"?y.createElement(I,{...hi(I,f),"data-index":G,"data-item-index":z.index,"data-known-size":z.size,key:K,style:BD},p(z.index,f)):y.createElement(M,{...hi(M,f),...$D(M,z.data),"data-index":G,"data-item-group-index":z.groupIndex,"data-item-index":z.index,"data-known-size":z.size,key:K,style:k?zD:a4},D?d(z.index,z.groupIndex,z.data,f):d(z.index,z.data,f))})})}),UD={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},qD={outline:"none",overflowX:"auto",position:"relative"},Hk=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),s4=(e,t,n=0)=>({...Hk(e),position:t?"relative":"absolute",top:t?-n:0}),HD={position:Uk(),top:0,width:"100%",zIndex:1};function hi(e,t){if(typeof e!="string")return{context:t}}function $D(e,t){return{item:typeof e=="string"?void 0:t}}const WD=Tt.memo(function(){const e=cn("HeaderComponent"),t=ta("headerHeight"),n=cn("HeaderFooterTag"),r=al(Tt.useMemo(()=>o=>{t(yo(o,"height"))},[t]),!0,cn("skipAnimationFrameInResizeObserver")),i=cn("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...hi(e,i)})}):null}),VD=Tt.memo(function(){const e=cn("FooterComponent"),t=ta("footerHeight"),n=cn("HeaderFooterTag"),r=al(Tt.useMemo(()=>o=>{t(yo(o,"height"))},[t]),!0,cn("skipAnimationFrameInResizeObserver")),i=cn("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...hi(e,i)})}):null});function o4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Tt.memo(function({children:r,style:i,context:o,...l}){const u=n("scrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("scrollerRef"),h=t("horizontalDirection")||!1,{scrollByCallback:m,scrollerRef:x,scrollToCallback:v}=i4(u,f,d,p,void 0,h),k=Tt.useContext(zk),_=Tt.useRef(0),S=Tt.useCallback(N=>{_.current=N},[]);e("totalListHeight",S);const w=Tt.useCallback(N=>{if(!k||N.top===void 0)return;const R=Math.max(_.current,k.viewportHeight),T=Math.ceil(Math.max(Math.min(R-k.viewportHeight,N.top),0));u({scrollHeight:R,scrollTop:T,viewportHeight:k.viewportHeight}),N.behavior==="smooth"&&f(!0)},[k,u,f]);return e("scrollTo",k?w:v),e("scrollBy",m),a.jsx(d,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...h?qD:UD,...i},tabIndex:0,...l,...hi(d,o),children:r})})}function l4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return Tt.memo(function({children:r,style:i,context:o,...l}){const u=n("windowScrollContainerState"),d=t("ScrollerComponent"),f=n("smoothScrollTargetReached"),p=t("totalListHeight"),h=t("deviation"),m=t("customScrollParent"),x=Tt.useRef(null),v=t("scrollerRef"),{scrollByCallback:k,scrollerRef:_,scrollToCallback:S}=i4(u,f,d,v,m);return fp(()=>{var w;return _.current=m??((w=x.current)==null?void 0:w.ownerDocument.defaultView),()=>{_.current=null}},[_,m]),e("windowScrollTo",S),e("windowScrollBy",k),a.jsx(d,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...p===0?void 0:{height:p+h}},...l,...hi(d,o),children:r})})}const GD=({children:e})=>{const t=Tt.useContext(zk),n=ta("viewportHeight"),r=ta("fixedItemHeight"),i=cn("alignToBottom"),o=cn("horizontalDirection"),l=Tt.useMemo(()=>MA(n,d=>yo(d,o?"width":"height")),[n,o]),u=al(l,!0,cn("skipAnimationFrameInResizeObserver"));return Tt.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),a.jsx("div",{"data-viewport-type":"element",ref:u,style:Hk(i),children:e})},KD=({children:e})=>{const t=Tt.useContext(zk),n=ta("windowViewportRect"),r=ta("fixedItemHeight"),i=cn("customScrollParent"),o=cn("useWindowScroll"),l=cn("topListHeight"),u=DA(n,i,cn("skipAnimationFrameInResizeObserver")),d=cn("alignToBottom");return Tt.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),a.jsx("div",{"data-viewport-type":"window",ref:u,style:s4(d,o,l),children:e})},YD=({children:e})=>{const t=cn("TopItemListComponent")??"div",n=cn("headerHeight"),r={...HD,marginTop:`${n}px`},i=cn("context");return a.jsx(t,{style:r,...hi(t,i),children:e})},QD=Tt.memo(function(e){const t=cn("useWindowScroll"),n=cn("topItemsIndexes").length>0,r=cn("customScrollParent"),i=cn("context");return a.jsxs(r||t?JD:ZD,{...e,context:i,children:[n&&a.jsx(YD,{children:a.jsx(t2,{showTopList:!0})}),a.jsxs(r||t?KD:GD,{children:[a.jsx(WD,{}),a.jsx(t2,{}),a.jsx(VD,{})]})]})}),{Component:XD,useEmitter:$k,useEmitterValue:cn,usePublisher:ta}=n4(PD,{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"}},QD),ZD=o4({useEmitter:$k,useEmitterValue:cn,usePublisher:ta}),JD=l4({useEmitter:$k,useEmitterValue:cn,usePublisher:ta}),c4=XD,eP=Fn(()=>{const e=nt(f=>a.jsxs("td",{children:["Item $",f]})),t=nt(null),n=nt(f=>a.jsxs("td",{colSpan:1e3,children:["Group ",f]})),r=nt(null),i=nt(null),o=nt({}),l=nt(qk),u=nt(ic),d=(f,p=null)=>qr(qe(o,vt(h=>h[f]),ir()),p);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:d("EmptyPlaceholder"),FillerRow:d("FillerRow"),fixedFooterContent:i,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")}});sr(t4,eP);Uk();const n2={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},tP={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:r2,floor:Vf,max:Nu,min:bg,round:i2}=Math;function a2(e,t,n){return Array.from({length:t-e+1}).map((r,i)=>({data:n===null?null:n[i+e],index:i+e}))}function nP(e){return{...tP,items:e}}function uf(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function rP(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const iP=Fn(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:l,scrollContainerState:u,scrollTo:d,scrollTop:f,smoothScrollTargetReached:p,viewportHeight:h},m,x,{didMount:v,propsReady:k},{customScrollParent:_,useWindowScroll:S,windowScrollBy:w,windowScrollContainerState:N,windowScrollTo:R,windowViewportRect:T},C])=>{const M=nt(0),I=nt(0),A=nt(n2),L=nt({height:0,width:0}),D=nt({height:0,width:0}),$=Nn(),te=Nn(),V=nt(0),z=nt(null),G=nt({column:0,row:0}),K=Nn(),H=Nn(),se=nt(!1),P=nt(0),W=nt(!0),ee=nt(!1),F=nt(!1);Bn(qe(v,bn(P),Xt(([ae,ye])=>!Yv(ye))),()=>{hn(W,!1)}),Bn(qe(Er(v,W,D,L,P,ee),Xt(([ae,ye,Fe,ct,,ht])=>ae&&!ye&&Fe.height!==0&&ct.height!==0&&!ht)),([,,,,ae])=>{if(ae===void 0){hn(W,!0);return}hn(ee,!0),Dk(1,()=>{hn($,ae)}),Ha(qe(f),()=>{hn(t,[0,0]),hn(W,!0)})}),Ft(qe(H,Xt(ae=>ae!=null&&ae.scrollTop>0),ea(0)),I),Bn(qe(v,bn(H),Xt(([,ae])=>ae!=null)),([,ae])=>{ae&&(hn(L,ae.viewport),hn(D,ae.item),hn(G,ae.gap),ae.scrollTop>0&&(hn(se,!0),Ha(qe(f,rl(1)),ye=>{hn(se,!1)}),hn(d,{top:ae.scrollTop})))}),Ft(qe(L,vt(({height:ae})=>ae)),h),Ft(qe(Er(rn(L,uf),rn(D,uf),rn(G,(ae,ye)=>ae!==void 0&&ae.column===ye.column&&ae.row===ye.row),rn(f)),vt(([ae,ye,Fe,ct])=>({gap:Fe,item:ye,scrollTop:ct,viewport:ae}))),K),Ft(qe(Er(rn(M),r,rn(G,rP),rn(D,uf),rn(L,uf),rn(z),rn(I),rn(se),rn(W),rn(P)),Xt(([,,,,,,,ae])=>!ae),vt(([ae,[ye,Fe],ct,ht,pt,et,ze,,Be,At])=>{const{column:lt,row:on}=ct,{height:_t,width:gn}=ht,{width:Ht}=pt;if(ze===0&&(ae===0||Ht===0))return n2;if(gn===0){const gt=Pk(At,ae),dt=gt+Math.max(ze-1,0);return nP(a2(gt,dt,et))}const Kt=u4(Ht,gn,lt);let ut,Pe;Be?ye===0&&Fe===0&&ze>0?(ut=0,Pe=ze-1):(ut=Kt*Vf((ye+on)/(_t+on)),Pe=Kt*r2((Fe+on)/(_t+on))-1,Pe=bg(ae-1,Nu(Pe,Kt-1)),ut=bg(Pe,Nu(0,ut))):(ut=0,Pe=-1);const le=a2(ut,Pe,et),{bottom:be,top:fe}=s2(pt,ct,ht,le),Oe=r2(ae/Kt),ft=Oe*_t+(Oe-1)*on-be;return{bottom:be,itemHeight:_t,items:le,itemWidth:gn,offsetBottom:ft,offsetTop:fe,top:fe}})),A),Ft(qe(z,Xt(ae=>ae!==null),vt(ae=>ae.length)),M),Ft(qe(Er(L,D,A,G),Xt(([ae,ye,{items:Fe}])=>Fe.length>0&&ye.height!==0&&ae.height!==0),vt(([ae,ye,{items:Fe},ct])=>{const{bottom:ht,top:pt}=s2(ae,ct,ye,Fe);return[pt,ht]}),ir(Jl)),t);const J=nt(!1);Ft(qe(f,bn(J),vt(([ae,ye])=>ye||ae!==0)),J);const q=na(qe(Er(A,M),Xt(([{items:ae},ye])=>{const Fe=Jn(z);return ae.length>0&&(Fe===null||Fe.length===ye)}),bn(J),Xt(([[ae,ye],Fe])=>{const ct=ae.items[ae.items.length-1].index===ye-1;return(Fe||ae.bottom>0&&ae.itemHeight>0&&ae.offsetBottom===0&&ae.items.length===ye)&&ct}),vt(([[,ae]])=>[ae-1,Jn(z)]),ir(Jl),vt(([ae])=>ae))),Y=na(qe(rn(A),Xt(({items:ae})=>ae.length>0&&ae[0].index===0),ea(0),ir())),oe=na(qe(rn(A),bn(se),Xt(([{items:ae},ye])=>ae.length>0&&!ye),vt(([{items:ae}])=>({endIndex:ae[ae.length-1].index,startIndex:ae[0].index})),ir(qA),Ls(0)));Ft(oe,x.scrollSeekRangeChanged),Ft(qe($,bn(L,D,M,G),vt(([ae,ye,Fe,ct,ht])=>{const pt=GA(ae),{align:et,behavior:ze,offset:Be}=pt;let At=pt.index;At==="LAST"&&(At=ct-1),At=Nu(0,bg(ct-1,At));let lt=Qv(ye,ht,Fe,At);return et==="end"?lt=i2(lt-ye.height+Fe.height):et==="center"&&(lt=i2(lt-ye.height/2+Fe.height/2)),Be!==void 0&&Be!==0&&(lt+=Be),{behavior:ze,top:lt}})),d);const _e=qr(qe(A,vt(ae=>ae.offsetBottom+ae.bottom)),0);return Ft(qe(T,vt(ae=>({height:ae.visibleHeight,width:ae.visibleWidth}))),L),{customScrollParent:_,data:z,deviation:V,footerHeight:i,gap:G,headerHeight:o,increaseViewportBy:e,initialItemCount:I,itemDimensions:D,overscan:n,restoreStateFrom:H,scrollBy:l,scrollContainerState:u,scrollHeight:te,scrollTo:d,scrollToIndex:$,scrollTop:f,smoothScrollTargetReached:p,totalCount:M,useWindowScroll:S,viewportDimensions:L,windowScrollBy:w,windowScrollContainerState:N,windowScrollTo:R,windowViewportRect:T,...x,gridState:A,horizontalDirection:F,initialTopMostItemIndex:P,totalListHeight:_e,...m,endReached:q,propsReady:k,rangeChanged:oe,startReached:Y,stateChanged:K,stateRestoreInProgress:se,...C}},sr(Fk,vi,Yu,JA,So,Bk,wo));function u4(e,t,n){return Nu(1,Vf((e+n)/(Vf(t)+n)))}function s2(e,t,n,r){const{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};const o=Qv(e,t,n,r[0].index);return{bottom:Qv(e,t,n,r[r.length-1].index)+i,top:o}}function Qv(e,t,n,r){const i=u4(e.width,n.width,t.column),o=Vf(r/i),l=o*n.height+Nu(0,o-1)*t.row;return l>0?l+t.row:l}const aP=Fn(()=>{const e=nt(h=>`Item ${h}`),t=nt({}),n=nt(null),r=nt("virtuoso-grid-item"),i=nt("virtuoso-grid-list"),o=nt(qk),l=nt("div"),u=nt(ic),d=(h,m=null)=>qr(qe(t,vt(x=>x[h]),ir()),m),f=nt(!1),p=nt(!1);return Ft(rn(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:i,ListComponent:d("List","div"),readyStateChanged:f,reportReadyState:p,ScrollerComponent:d("Scroller","div"),scrollerRef:u,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder","div")}}),sP=Fn(([e,t])=>({...e,...t}),sr(iP,aP)),oP=Tt.memo(function(){const e=rr("gridState"),t=rr("listClassName"),n=rr("itemClassName"),r=rr("itemContent"),i=rr("computeItemKey"),o=rr("isSeeking"),l=va("scrollHeight"),u=rr("ItemComponent"),d=rr("ListComponent"),f=rr("ScrollSeekPlaceholder"),p=rr("context"),h=va("itemDimensions"),m=va("gap"),x=rr("log"),v=rr("stateRestoreInProgress"),k=va("reportReadyState"),_=al(Tt.useMemo(()=>S=>{const w=S.parentElement.parentElement.scrollHeight;l(w);const N=S.firstChild;N!==null&&h({height:Du(N,"height"),width:Du(N,"width")}),m({column:o2("column-gap",getComputedStyle(S).columnGap,x),row:o2("row-gap",getComputedStyle(S).rowGap,x)})},[l,h,m,x]),!0,!1);return fp(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),v?null:a.jsx(d,{className:t,ref:_,...hi(d,p),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(S=>{const w=i(S.index,S.data,p);return o?a.jsx(f,{...hi(f,p),height:e.itemHeight,index:S.index,width:e.itemWidth},w):y.createElement(u,{...hi(u,p),className:n,"data-index":S.index,key:w},r(S.index,S.data,p))})})}),lP=Tt.memo(function(){const e=rr("HeaderComponent"),t=va("headerHeight"),n=rr("headerFooterTag"),r=al(Tt.useMemo(()=>o=>{t(yo(o,"height"))},[t]),!0,!1),i=rr("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...hi(e,i)})}):null}),cP=Tt.memo(function(){const e=rr("FooterComponent"),t=va("footerHeight"),n=rr("headerFooterTag"),r=al(Tt.useMemo(()=>o=>{t(yo(o,"height"))},[t]),!0,!1),i=rr("context");return e!=null?a.jsx(n,{ref:r,children:a.jsx(e,{...hi(e,i)})}):null}),uP=({children:e})=>{const t=Tt.useContext(r4),n=va("itemDimensions"),r=va("viewportDimensions"),i=al(Tt.useMemo(()=>o=>{r({height:Du(o,"height"),width:Du(o,"width")})},[r]),!0,!1);return Tt.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),a.jsx("div",{ref:i,style:Hk(!1),children:e})},dP=({children:e})=>{const t=Tt.useContext(r4),n=va("windowViewportRect"),r=va("itemDimensions"),i=rr("customScrollParent"),o=rr("useWindowScroll"),l=DA(n,i,!1);return Tt.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),a.jsx("div",{ref:l,style:s4(!1,o),children:e})},fP=Tt.memo(function({...e}){const t=rr("useWindowScroll"),n=rr("customScrollParent"),r=n||t?hP:pP,i=n||t?dP:uP,o=rr("context");return a.jsx(r,{...e,...hi(r,o),children:a.jsxs(i,{children:[a.jsx(lP,{}),a.jsx(oP,{}),a.jsx(cP,{})]})})}),{useEmitter:d4,useEmitterValue:rr,usePublisher:va}=n4(sP,{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"}},fP),pP=o4({useEmitter:d4,useEmitterValue:rr,usePublisher:va}),hP=l4({useEmitter:d4,useEmitterValue:rr,usePublisher:va});function o2(e,t,n){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Hr.WARN),t==="normal"?0:parseInt(t??"0",10)}function gP(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const mP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yP={};function l2(e,t){return(yP.jsx?xP:mP).test(e)}const bP=/[ \t\n\f\r]/g;function vP(e){return typeof e=="object"?e.type==="text"?c2(e.value):!1:c2(e)}function c2(e){return e.replace(bP,"")===""}class Qu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Qu.prototype.normal={};Qu.prototype.property={};Qu.prototype.space=void 0;function f4(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Qu(n,r,t)}function Xv(e){return e.toLowerCase()}class zi{constructor(t,n){this.attribute=n,this.property=t}}zi.prototype.attribute="";zi.prototype.booleanish=!1;zi.prototype.boolean=!1;zi.prototype.commaOrSpaceSeparated=!1;zi.prototype.commaSeparated=!1;zi.prototype.defined=!1;zi.prototype.mustUseProperty=!1;zi.prototype.number=!1;zi.prototype.overloadedBoolean=!1;zi.prototype.property="";zi.prototype.spaceSeparated=!1;zi.prototype.space=void 0;let kP=0;const un=ol(),Ir=ol(),Zv=ol(),Je=ol(),Zn=ol(),tl=ol(),Zi=ol();function ol(){return 2**++kP}const Jv=Object.freeze(Object.defineProperty({__proto__:null,boolean:un,booleanish:Ir,commaOrSpaceSeparated:Zi,commaSeparated:tl,number:Je,overloadedBoolean:Zv,spaceSeparated:Zn},Symbol.toStringTag,{value:"Module"})),vg=Object.keys(Jv);class Wk extends zi{constructor(t,n,r,i){let o=-1;if(super(t,n),u2(this,"space",i),typeof r=="number")for(;++o<vg.length;){const l=vg[o];u2(this,vg[o],(r&Jv[l])===Jv[l])}}}Wk.prototype.defined=!0;function u2(e,t,n){n&&(e[t]=n)}function ac(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Wk(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Xv(r)]=r,n[Xv(o.attribute)]=r}return new Qu(t,n,e.space)}const p4=ac({properties:{ariaActiveDescendant:null,ariaAtomic:Ir,ariaAutoComplete:null,ariaBusy:Ir,ariaChecked:Ir,ariaColCount:Je,ariaColIndex:Je,ariaColSpan:Je,ariaControls:Zn,ariaCurrent:null,ariaDescribedBy:Zn,ariaDetails:null,ariaDisabled:Ir,ariaDropEffect:Zn,ariaErrorMessage:null,ariaExpanded:Ir,ariaFlowTo:Zn,ariaGrabbed:Ir,ariaHasPopup:null,ariaHidden:Ir,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Zn,ariaLevel:Je,ariaLive:null,ariaModal:Ir,ariaMultiLine:Ir,ariaMultiSelectable:Ir,ariaOrientation:null,ariaOwns:Zn,ariaPlaceholder:null,ariaPosInSet:Je,ariaPressed:Ir,ariaReadOnly:Ir,ariaRelevant:null,ariaRequired:Ir,ariaRoleDescription:Zn,ariaRowCount:Je,ariaRowIndex:Je,ariaRowSpan:Je,ariaSelected:Ir,ariaSetSize:Je,ariaSort:null,ariaValueMax:Je,ariaValueMin:Je,ariaValueNow:Je,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function h4(e,t){return t in e?e[t]:t}function g4(e,t){return h4(e,t.toLowerCase())}const _P=ac({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tl,acceptCharset:Zn,accessKey:Zn,action:null,allow:null,allowFullScreen:un,allowPaymentRequest:un,allowUserMedia:un,alpha:un,alt:null,as:null,async:un,autoCapitalize:null,autoComplete:Zn,autoFocus:un,autoPlay:un,blocking:Zn,capture:null,charSet:null,checked:un,cite:null,className:Zn,closedBy:null,colorSpace:null,cols:Je,colSpan:Je,command:null,commandFor:null,content:null,contentEditable:Ir,controls:un,controlsList:Zn,coords:Je|tl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:un,defer:un,dir:null,dirName:null,disabled:un,download:Zv,draggable:Ir,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:un,formTarget:null,headers:Zn,height:Je,hidden:Zv,high:Je,href:null,hrefLang:null,htmlFor:Zn,httpEquiv:Zn,id:null,imageSizes:null,imageSrcSet:null,inert:un,inputMode:null,integrity:null,is:null,isMap:un,itemId:null,itemProp:Zn,itemRef:Zn,itemScope:un,itemType:Zn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:un,low:Je,manifest:null,max:null,maxLength:Je,media:null,method:null,min:null,minLength:Je,multiple:un,muted:un,name:null,nonce:null,noModule:un,noValidate:un,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:un,optimum:Je,pattern:null,ping:Zn,placeholder:null,playsInline:un,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:un,referrerPolicy:null,rel:Zn,required:un,reversed:un,rows:Je,rowSpan:Je,sandbox:Zn,scope:null,scoped:un,seamless:un,selected:un,shadowRootClonable:un,shadowRootCustomElementRegistry:un,shadowRootDelegatesFocus:un,shadowRootMode:null,shadowRootSerializable:un,shape:null,size:Je,sizes:null,slot:null,span:Je,spellCheck:Ir,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Je,step:null,style:null,tabIndex:Je,target:null,title:null,translate:null,type:null,typeMustMatch:un,useMap:null,value:Ir,width:Je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Zn,axis:null,background:null,bgColor:null,border:Je,borderColor:null,bottomMargin:Je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:un,declare:un,event:null,face:null,frame:null,frameBorder:null,hSpace:Je,leftMargin:Je,link:null,longDesc:null,lowSrc:null,marginHeight:Je,marginWidth:Je,noResize:un,noHref:un,noShade:un,noWrap:un,object:null,profile:null,prompt:null,rev:null,rightMargin:Je,rules:null,scheme:null,scrolling:Ir,standby:null,summary:null,text:null,topMargin:Je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Je,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:un,disablePictureInPicture:un,disableRemotePlayback:un,exportParts:tl,part:Zn,prefix:null,property:null,results:Je,security:null,unselectable:null},space:"html",transform:g4}),wP=ac({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:Je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Je,amplitude:Je,arabicForm:null,ascent:Je,attributeName:null,attributeType:null,azimuth:Je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Je,by:null,calcMode:null,capHeight:Je,className:Zn,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:Je,diffuseConstant:Je,direction:null,display:null,dur:null,divisor:Je,dominantBaseline:null,download:un,dx:null,dy:null,edgeMode:null,editable:null,elevation:Je,enableBackground:null,end:null,event:null,exponent:Je,externalResourcesRequired:null,fill:null,fillOpacity:Je,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:tl,g2:tl,glyphName:tl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Je,horizOriginX:Je,horizOriginY:Je,id:null,ideographic:Je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Je,k:Je,k1:Je,k2:Je,k3:Je,k4:Je,kernelMatrix:Zi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Je,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:Je,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:Je,overlineThickness:Je,paintOrder:null,panose1:null,path:null,pathLength:Je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Zn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Je,pointsAtY:Je,pointsAtZ:Je,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:Je,specularExponent:Je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Je,strikethroughThickness:Je,string:null,stroke:null,strokeDashArray:Zi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Je,strokeOpacity:Je,strokeWidth:null,style:null,surfaceScale:Je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zi,tabIndex:Je,tableValues:null,target:null,targetX:Je,targetY:Je,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:Je,underlineThickness:Je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Je,values:null,vAlphabetic:Je,vMathematical:Je,vectorEffect:null,vHanging:Je,vIdeographic:Je,version:null,vertAdvY:Je,vertOriginX:Je,vertOriginY:Je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:h4}),m4=ac({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()}}),x4=ac({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:g4}),y4=ac({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),SP={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"},EP=/[A-Z]/g,d2=/-[a-z]/g,NP=/^data[-\w.:]+$/i;function CP(e,t){const n=Xv(t);let r=t,i=zi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&NP.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(d2,TP);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!d2.test(o)){let l=o.replace(EP,jP);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Wk}return new i(r,t)}function jP(e){return"-"+e.toLowerCase()}function TP(e){return e.charAt(1).toUpperCase()}const RP=f4([p4,_P,m4,x4,y4],"html"),Vk=f4([p4,wP,m4,x4,y4],"svg");function AP(e){return e.join(" ").trim()}var f2=/\/\*(?:[^*]|\*(?!\/))*\*\//g,IP=/\n/g,MP=/^\s*/,LP=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,OP=/^:\s*/,DP=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,PP=/^[;\s]*/,FP=`
|
|
49
|
+
`,p2="/",h2="*",tu="",BP="comment",zP="declaration";function UP(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(v){var k=v.match(IP);k&&(n+=k.length);var _=v.lastIndexOf(FP);r=~_?v.length-_:r+v.length}function o(){var v={line:n,column:r};return function(k){return k.position=new l(v),f(),k}}function l(v){this.start=v,this.end={line:n,column:r},this.source=t.source}l.prototype.content=e;function u(v){var k=new Error(t.source+":"+n+":"+r+": "+v);if(k.reason=v,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function d(v){var k=v.exec(e);if(k){var _=k[0];return i(_),e=e.slice(_.length),k}}function f(){d(MP)}function p(v){for(var k;k=h();)v.push(k);return v}function h(){var v=o();if(!(p2!=e.charAt(0)||h2!=e.charAt(1))){for(var k=2;tu!=e.charAt(k)&&(h2!=e.charAt(k)||p2!=e.charAt(k+1));)++k;if(k+=2,tu===e.charAt(k-1))return u("End of comment missing");var _=e.slice(2,k-2);return r+=2,i(_),e=e.slice(k),r+=2,v({type:BP,comment:_})}}function m(){var v=o(),k=d(LP);if(k){if(h(),!d(OP))return u("property missing ':'");var _=d(DP),S=v({type:zP,property:k[0].replace(f2,tu).trim(),value:_?_[0].replace(f2,tu).trim():tu});return d(PP),S}}function x(){var v=[];p(v);for(var k;k=m();)v.push(k),p(v);return v}return f(),x()}function qP(e,t){let n=null;if(!e||typeof e!="string")return n;const r=UP(e),i=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:l,value:u}=o;i?t(l,u,o):u&&(n=n??{},n[l]=u)}),n}const b4=v4("end"),Gk=v4("start");function v4(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 HP(e){const t=Gk(e),n=b4(e);if(t&&n)return{start:t,end:n}}function Cu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?g2(e.position):"start"in e||"end"in e?g2(e):"line"in e||"column"in e?ek(e):""}function ek(e){return m2(e&&e.line)+":"+m2(e&&e.column)}function g2(e){return ek(e&&e.start)+"-"+ek(e&&e.end)}function m2(e){return e&&typeof e=="number"?e:1}class hp extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",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"?i=t:!o.cause&&t&&(l=!0,i=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){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Cu(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}}Object.defineProperties(hp.prototype,{file:{configurable:!0,enumerable:!0,value:"",writable:!0},name:{configurable:!0,enumerable:!0,value:"",writable:!0},reason:{configurable:!0,enumerable:!0,value:"",writable:!0},message:{configurable:!0,enumerable:!0,value:"",writable:!0},stack:{configurable:!0,enumerable:!0,value:"",writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});const Kk={}.hasOwnProperty,$P=new Map,WP=/[A-Z]/g,VP=/-([a-z])/g,GP=new Set(["table","tbody","thead","tfoot","tr"]),KP=new Set(["td","th"]),k4="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function YP(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=r6(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=n6(n,t.jsx,t.jsxs)}const i={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"?Vk:RP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=_4(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function _4(e,t,n){if(t.type==="element")return QP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return XP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return JP(e,t,n);if(t.type==="mdxjsEsm")return ZP(e,t);if(t.type==="root")return e6(e,t,n);if(t.type==="text")return t6(e,t)}function QP(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Vk,e.schema=i),e.ancestors.push(t);const o=S4(e,t.tagName,!1),l=i6(e,t);let u=Qk(e,t);return GP.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!vP(d):!0})),w4(e,l,o,t),Yk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function XP(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)}Hu(e,t.position)}function ZP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hu(e,t.position)}function JP(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Vk,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:S4(e,t.name,!0),l=a6(e,t),u=Qk(e,t);return w4(e,l,o,t),Yk(l,u),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function e6(e,t,n){const r={};return Yk(r,Qk(e,t)),e.create(t,e.Fragment,r,n)}function t6(e,t){return t.value}function w4(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Yk(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function n6(e,t,n){return r;function r(i,o,l,u){const f=Array.isArray(l.children)?n:t;return u?f(o,l,u):f(o,l)}}function r6(e,t){return n;function n(r,i,o,l){const u=Array.isArray(o.children),d=Gk(r);return t(i,o,l,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function i6(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Kk.call(t.properties,i)){const o=s6(e,i,t.properties[i]);if(o){const[l,u]=o;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&KP.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 a6(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 Hu(e,t.position);else{const{name:i}=r;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 Hu(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Qk(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:$P;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=i.get(d)||0;l=d+"-"+f,i.set(d,f+1)}}const u=_4(e,o,l);u!==void 0&&n.push(u)}return n}function s6(e,t,n){if(n==null||typeof n=="number"&&Number.isNaN(n))return;const r=CP(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?gP(n):AP(n)),r.property==="style"?["style",typeof n=="object"?e.stylePropertyNameCase==="dom"?n:l6(n):o6(e,String(n))]:[e.elementAttributeNameCase==="react"&&r.space?SP[r.property]||r.property:r.attribute,n]}function o6(e,t){const n={};try{qP(t,function(r,i){if(r&&i){let o=r;o.slice(0,2)!=="--"&&(o=o.toLowerCase(),e.stylePropertyNameCase==="dom"&&(o.slice(0,4)==="-ms-"&&(o=o.slice(1)),o=o.replace(VP,d6))),n[o]=i}})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,o=new hp("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=k4+"#cannot-parse-style-attribute",o}return n}function S4(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,l;for(;++o<i.length;){const u=l2(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(o&&u.type==="Literal"),optional:!1}:u}r=l}else r=l2(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Kk.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hu(e)}function Hu(e,t){const n=new hp("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 l6(e){const t={};let n;for(n in e)Kk.call(e,n)&&(t[c6(n)]=e[n]);return t}function c6(e){if(e.slice(0,2)==="--")return e;let t=e.replace(WP,u6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function u6(e){return"-"+e.toLowerCase()}function d6(e,t){return t.toUpperCase()}const kg={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"]},f6={};function gp(e,t){const n=f6,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return E4(e,r,i)}function E4(e,t,n){if(p6(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 x2(e.children,t,n)}return Array.isArray(e)?x2(e,t,n):""}function x2(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=E4(e[i],t,n);return r.join("")}function p6(e){return!!(e&&typeof e=="object")}const y2=document.createElement("i");function Xk(e){const t="&"+e+";";y2.innerHTML=t;const n=y2.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $a(e,t,n,r){const i=e.length;let o=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i: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 ba(e,t){return e.length>0?($a(e,e.length,0,t),e):t}const b2={}.hasOwnProperty;function N4(e){const t={};let n=-1;for(;++n<e.length;)h6(t,e[n]);return t}function h6(e,t){let n;for(n in t){const i=(b2.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let l;if(o)for(l in o){b2.call(i,l)||(i[l]=[]);const u=o[l];g6(i[l],Array.isArray(u)?u:u?[u]:[])}}}function g6(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);$a(e,0,0,r)}function C4(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 Wa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ti=Eo(/[A-Za-z]/),ni=Eo(/[\dA-Za-z]/),m6=Eo(/[#-'*+\--9=?A-Z^-~]/);function Gf(e){return e!==null&&(e<32||e===127)}const tk=Eo(/\d/),x6=Eo(/[\dA-Fa-f]/),j4=Eo(/[!-/:-@[-`{-~]/);function nn(e){return e!==null&&e<-2}function er(e){return e!==null&&(e<0||e===32)}function wn(e){return e===-2||e===-1||e===32}const Xu=Eo(new RegExp("\\p{P}|\\p{S}","u")),il=Eo(/\s/);function Eo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function sc(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&ni(e.charCodeAt(n+1))&&ni(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const u=e.charCodeAt(n+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Pn(e,t,n,r){const i=r?r-1:1/0;let o=0;return l;function l(d){return wn(d)?(e.enter(n),u(d)):t(d)}function u(d){return wn(d)&&o++<i?(e.consume(d),u):(e.exit(n),t(d))}}function T4(e,t,n,r,i,o){let l=0;return u;function u(p){return wn(p)?(e.enter(r),d(p)):f(p)}function d(p){return wn(p)&&l<o?(e.consume(p),l++,d):(e.exit(r),f(p))}function f(p){return l>=i?t(p):n(p)}}const y6={tokenize:b6};function b6(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Pn(e,t,"linePrefix")}function i(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 nn(u)?(e.consume(u),e.exit("chunkText"),o):(e.consume(u),l)}}let Kf=class{constructor(){this.index=new Map,this.map=[]}add(t,n,r){v2(this,t,n,r,!1)}addBefore(t,n,r){v2(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 i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0,this.index.clear()}};function v2(e,t,n,r,i){if(n===0&&r.length===0)return;const o=e.index.get(t);if(o){o[1]+=n,i?(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 v6={tokenize:k6},k2={tokenize:_6};function k6(e){const t=this,n=[];let r=0,i,o,l;return u;function u(N){if(r<n.length){const R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,d,f)(N)}return f(N)}function d(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&w();const R=t.events.length;let T=R,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}S(r);let M=R;for(;M<t.events.length;)t.events[M][1].end={...C},M++;const I=new Kf;return I.add(T+1,0,t.events.slice(R)),I.add(R,M-R,[]),I.consume(t.events),f(N)}return u(N)}function f(N){if(r===n.length){if(!i)return m(N);if(i.currentConstruct&&i.currentConstruct.concrete)return v(N);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(k2,p,h)(N)}function p(N){return i&&w(),S(r),m(N)}function h(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(k2,x,v)(N)}function x(N){return r++,n.push([t.currentConstruct,t.containerState]),m(N)}function v(N){if(N===null){i&&w(),S(0),e.consume(N);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),k(N)}function k(N){if(N===null){_(e.exit("chunkFlow"),!0),S(0),e.consume(N);return}return nn(N)?(e.consume(N),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(N),k)}function _(N,R){const T=t.sliceStream(N);if(R&&T.push(null),N.previous=o,o&&(o.next=N),o=N,i.defineSkip(N.start),i.write(T),t.parser.lazy[N.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<l&&(!i.events[C][1].end||i.events[C][1].end.offset>l))return;const M=t.events.length;let I=M,A,L;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(A){L=t.events[I][1].end;break}A=!0}for(S(r),C=M;C<t.events.length;)t.events[C][1].end={...L},C++;const D=new Kf;D.add(I+1,0,t.events.slice(M)),D.add(M,C-M,[]),D.consume(t.events)}}function S(N){let R=n.length;for(;R-- >N;){const T=n[R];t.containerState=T[1],T[0].exit.call(t,e)}n.length=N}function w(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function _6(e,t,n){return Pn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bo(e){if(e===null||er(e)||il(e))return 1;if(Xu(e))return 2}function mp(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const nk={name:"attention",resolveAll:w6,tokenize:S6};function w6(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 i=n;for(;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const o=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,l={...e[i][1].end},u={...e[n][1].start};_2(l,-o),_2(u,o);const d={type:o>1?"strongSequence":"emphasisSequence",start:l,end:{...e[i][1].end}},f={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:u},p={type:o>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},h={type:o>1?"strong":"emphasis",start:{...d.start},end:{...f.end}};e[i][1].end={...d.start},e[n][1].start={...f.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=ba(r,[["enter",e[i][1],t],["exit",e[i][1],t]])),r=ba(r,[["enter",h,t],["enter",d,t],["exit",d,t],["enter",p,t]]),r=ba(r,mp(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=ba(r,[["exit",p,t],["enter",f,t],["exit",f,t],["exit",h,t]]);let m=0;e[n][1].end.offset-e[n][1].start.offset&&(m=2,r=ba(r,[["enter",e[n][1],t],["exit",e[n][1],t]])),$a(e,i-1,n-i+3,r),n=i+r.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function S6(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=bo(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=bo(d),h=!p||p===2&&i||n.includes(d)&&d!==42&&d!==95,m=!i||i===2&&p||n.includes(r)&&r!==42&&r!==95;return f._open=!!(o===42?h:h&&(i||!m)),f._close=!!(o===42?m:m&&(p||!h)),t(d)}}function _2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const E6={name:"autolink",tokenize:N6};function N6(e,t,n){let r=0;return i;function i(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return ti(x)?(e.consume(x),l):x===64?n(x):f(x)}function l(x){return x===43||x===45||x===46||ni(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||ni(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||Gf(x)?n(x):(e.consume(x),d)}function f(x){return x===64?(e.consume(x),p):m6(x)?(e.consume(x),f):n(x)}function p(x){return ni(x)?h(x):n(x)}function h(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||ni(x))&&r++<63){const v=x===45?m:h;return e.consume(x),v}return n(x)}}const Zu={partial:!0,tokenize:C6};function C6(e,t,n){return r;function r(o){return wn(o)?Pn(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||nn(o)?t(o):n(o)}}const R4={continuation:{tokenize:T6},exit:R6,name:"blockQuote",tokenize:j6};function j6(e,t,n){const r=this;return i;function i(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 wn(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function T6(e,t,n){const r=this;return i;function i(l){return wn(l)?Pn(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(R4,t,n)(l)}}function R6(e){e.exit("blockQuote")}const A4={name:"characterEscape",tokenize:A6};function A6(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return j4(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const I4={name:"characterReference",tokenize:I6};function I6(e,t,n){const r=this;let i=0,o,l;return u;function u(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),d}function d(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,l=ni,p(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=x6,p):(e.enter("characterReferenceValue"),o=7,l=tk,p(h))}function p(h){if(h===59&&i){const m=e.exit("characterReferenceValue");return l===ni&&!Xk(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(h)&&i++<o?(e.consume(h),p):n(h)}}const rk={partial:!0,tokenize:M6};function M6(e,t,n){const r=this;return i;function i(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 w2={concrete:!0,name:"codeFenced",tokenize:L6};function L6(e,t,n){const r=this,i={partial:!0,tokenize:T};let o=0,l=0,u;return d;function d(C){return f(C)}function f(C){const M=r.events[r.events.length-1];return o=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,u=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(C)}function p(C){return C===u?(l++,e.consume(C),p):l<3?n(C):(e.exit("codeFencedFenceSequence"),wn(C)?Pn(e,h,"whitespace")(C):h(C))}function h(C){return C===null||nn(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(rk,k,R)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||nn(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):wn(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Pn(e,x,"whitespace")(C)):C===96&&C===u?n(C):(e.consume(C),m)}function x(C){return C===null||nn(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===null||nn(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===u?n(C):(e.consume(C),v)}function k(C){return e.attempt(i,R,_)(C)}function _(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),S}function S(C){return o>0&&wn(C)?Pn(e,w,"linePrefix",o+1)(C):w(C)}function w(C){return C===null||nn(C)?e.check(rk,k,R)(C):(e.enter("codeFlowValue"),N(C))}function N(C){return C===null||nn(C)?(e.exit("codeFlowValue"),w(C)):(e.consume(C),N)}function R(C){return e.exit("codeFenced"),t(C)}function T(C,M,I){let A=0;return L;function L(z){return C.enter("lineEnding"),C.consume(z),C.exit("lineEnding"),D}function D(z){return C.enter("codeFencedFence"),wn(z)?Pn(C,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):$(z)}function $(z){return z===u?(C.enter("codeFencedFenceSequence"),te(z)):I(z)}function te(z){return z===u?(A++,C.consume(z),te):A>=l?(C.exit("codeFencedFenceSequence"),wn(z)?Pn(C,V,"whitespace")(z):V(z)):I(z)}function V(z){return z===null||nn(z)?(C.exit("codeFencedFence"),M(z)):I(z)}}}const _g={name:"codeIndented",tokenize:D6},O6={partial:!0,tokenize:P6};function D6(e,t,n){return r;function r(u){return e.enter("codeIndented"),T4(e,i,n,"linePrefix",4,4)(u)}function i(u){return u===null?l(u):nn(u)?e.attempt(O6,i,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||nn(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function P6(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):nn(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):T4(e,t,o,"linePrefix",4,4)(l)}function o(l){return nn(l)?i(l):n(l)}}const F6={name:"codeText",previous:z6,resolve:B6,tokenize:U6};function B6(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function z6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function U6(e,t,n){let r=0,i,o;return l;function l(h){return e.enter("codeText"),e.enter("codeTextSequence"),u(h)}function u(h){return h===96?(e.consume(h),r++,u):(e.exit("codeTextSequence"),d(h))}function d(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),d):h===96?(o=e.enter("codeTextSequence"),i=0,p(h)):nn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||nn(h)?(e.exit("codeTextData"),d(h)):(e.consume(h),f)}function p(h){return h===96?(e.consume(h),i++,p):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(o.type="codeTextData",f(h))}}class q6{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 i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&nu(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),nu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),nu(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);nu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);nu(this.left,n.reverse())}}}function nu(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 M4(e){const t={};let n=-1,r,i,o,l,u,d,f;const p=new q6(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,H6(p,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(l=p.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},u=p.slice(i,n),u.unshift(r),p.splice(i,n-i+1,u))}}return $a(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function H6(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=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,h,m=-1,x=n,v=0,k=0;const _=[k];for(;x;){for(;e.get(++i)[1]!==x;);o.push(i),x._tokenizer||(p=r.sliceStream(x),x.next||p.push(null),h&&l.defineSkip(x.start),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),h=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 S=u.slice(_[m],_[m+1]),w=o.pop();d.push([w,w+S.length-1]),e.splice(w,2,S)}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 $6={resolve:V6,tokenize:G6},W6={partial:!0,tokenize:K6};function V6(e){return M4(e),e}function G6(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?o(u):nn(u)?e.check(W6,l,o)(u):(e.consume(u),i)}function o(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function K6(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Pn(e,o,"linePrefix")}function o(l){if(l===null||nn(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 L4(e,t,n,r,i,o,l,u,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return h;function h(S){return S===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(S),e.exit(o),m):S===null||S===32||S===41||Gf(S)?n(S):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),k(S))}function m(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),x(S))}function x(S){return S===62?(e.exit("chunkString"),e.exit(u),m(S)):S===null||S===60||nn(S)?n(S):(e.consume(S),S===92?v:x)}function v(S){return S===60||S===62||S===92?(e.consume(S),x):x(S)}function k(S){return!p&&(S===null||S===41||er(S))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(S)):p<f&&S===40?(e.consume(S),p++,k):S===41?(e.consume(S),p--,k):S===null||S===32||S===40||Gf(S)?n(S):(e.consume(S),S===92?_:k)}function _(S){return S===40||S===41||S===92?(e.consume(S),k):k(S)}}function O4(e,t,n,r,i,o){const l=this;let u=0,d;return f;function f(x){return e.enter(r),e.enter(i),e.consume(x),e.exit(i),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(i),e.consume(x),e.exit(i),e.exit(r),t):nn(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===null||x===91||x===93||nn(x)||u++>999?(e.exit("chunkString"),p(x)):(e.consume(x),d||(d=!wn(x)),x===92?m:h)}function m(x){return x===91||x===92||x===93?(e.consume(x),u++,h):h(x)}}function D4(e,t,n,r,i,o){let l;return u;function u(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),l=m===40?41:m,d):n(m)}function d(m){return m===l?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):(e.enter(o),f(m))}function f(m){return m===l?(e.exit(o),d(l)):m===null?n(m):nn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Pn(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===l||m===null||nn(m)?(e.exit("chunkString"),f(m)):(e.consume(m),m===92?h:p)}function h(m){return m===l||m===92?(e.consume(m),p):p(m)}}function ju(e,t){let n;return r;function r(i){return nn(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):wn(i)?Pn(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Y6={name:"definition",tokenize:X6},Q6={partial:!0,tokenize:Z6};function X6(e,t,n){const r=this;let i;return o;function o(x){return e.enter("definition"),l(x)}function l(x){return O4.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function u(x){return i=Wa(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 er(x)?ju(e,f)(x):f(x)}function f(x){return L4(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(Q6,h,h)(x)}function h(x){return wn(x)?Pn(e,m,"whitespace")(x):m(x)}function m(x){return x===null||nn(x)?(e.exit("definition"),r.parser.defined.push(i),t(x)):n(x)}}function Z6(e,t,n){return r;function r(u){return er(u)?ju(e,i)(u):n(u)}function i(u){return D4(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return wn(u)?Pn(e,l,"whitespace")(u):l(u)}function l(u){return u===null||nn(u)?t(u):n(u)}}const J6={name:"hardBreakEscape",tokenize:e7};function e7(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return nn(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const t7={name:"headingAtx",resolve:n7,tokenize:r7};function n7(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 i={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"};$a(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])}return e}function r7(e,t,n){let r=0;return i;function i(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||er(p)?(e.exit("atxHeadingSequence"),u(p)):n(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||nn(p)?(e.exit("atxHeading"),t(p)):wn(p)?Pn(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||er(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),f)}}const P4=["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"],ik=["pre","script","style","textarea"],i7={concrete:!0,name:"htmlFlow",resolveTo:s7,tokenize:o7},a7={partial:!0,tokenize:l7};function s7(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 o7(e,t,n){const r=this;let i,o,l,u,d;return f;function f(F){return p(F)}function p(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),h}function h(F){return F===33?(e.consume(F),m):F===47?(e.consume(F),o=!0,k):F===63?(e.consume(F),i=3,r.interrupt?t:P):ti(F)?(e.consume(F),l=String.fromCharCode(F),_):n(F)}function m(F){return F===45?(e.consume(F),i=2,x):F===91?(e.consume(F),i=5,u=0,v):ti(F)?(e.consume(F),i=4,r.interrupt?t:P):n(F)}function x(F){return F===45?(e.consume(F),r.interrupt?t:P):n(F)}function v(F){const J="CDATA[";return F===J.charCodeAt(u++)?(e.consume(F),u===J.length?r.interrupt?t:$:v):n(F)}function k(F){return ti(F)?(e.consume(F),l=String.fromCharCode(F),_):n(F)}function _(F){if(F===null||F===47||F===62||er(F)){const J=F===47,q=l.toLowerCase();return!J&&!o&&ik.includes(q)?(i=1,r.interrupt?t(F):$(F)):P4.includes(l.toLowerCase())?(i=6,J?(e.consume(F),S):r.interrupt?t(F):$(F)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):o?w(F):N(F))}return F===45||ni(F)?(e.consume(F),l+=String.fromCharCode(F),_):n(F)}function S(F){return F===62?(e.consume(F),r.interrupt?t:$):n(F)}function w(F){return wn(F)?(e.consume(F),w):L(F)}function N(F){return F===47?(e.consume(F),L):F===58||F===95||ti(F)?(e.consume(F),R):wn(F)?(e.consume(F),N):L(F)}function R(F){return F===45||F===46||F===58||F===95||ni(F)?(e.consume(F),R):T(F)}function T(F){return F===61?(e.consume(F),C):wn(F)?(e.consume(F),T):N(F)}function C(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),d=F,M):wn(F)?(e.consume(F),C):I(F)}function M(F){return F===d?(e.consume(F),d=null,A):F===null||nn(F)?n(F):(e.consume(F),M)}function I(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||er(F)?T(F):(e.consume(F),I)}function A(F){return F===47||F===62||wn(F)?N(F):n(F)}function L(F){return F===62?(e.consume(F),D):n(F)}function D(F){return F===null||nn(F)?$(F):wn(F)?(e.consume(F),D):n(F)}function $(F){return F===45&&i===2?(e.consume(F),G):F===60&&i===1?(e.consume(F),K):F===62&&i===4?(e.consume(F),W):F===63&&i===3?(e.consume(F),P):F===93&&i===5?(e.consume(F),se):nn(F)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(a7,ee,te)(F)):F===null||nn(F)?(e.exit("htmlFlowData"),te(F)):(e.consume(F),$)}function te(F){return e.check(rk,V,ee)(F)}function V(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),z}function z(F){return F===null||nn(F)?te(F):(e.enter("htmlFlowData"),$(F))}function G(F){return F===45?(e.consume(F),P):$(F)}function K(F){return F===47?(e.consume(F),l="",H):$(F)}function H(F){if(F===62){const J=l.toLowerCase();return ik.includes(J)?(e.consume(F),W):$(F)}return ti(F)&&l.length<8?(e.consume(F),l+=String.fromCharCode(F),H):$(F)}function se(F){return F===93?(e.consume(F),P):$(F)}function P(F){return F===62?(e.consume(F),W):F===45&&i===2?(e.consume(F),P):$(F)}function W(F){return F===null||nn(F)?(e.exit("htmlFlowData"),ee(F)):(e.consume(F),W)}function ee(F){return e.exit("htmlFlow"),t(F)}}function l7(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Zu,t,n)}}const c7={name:"htmlText",tokenize:u7};function u7(e,t,n){const r=this;let i,o,l;return u;function u(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),d}function d(P){return P===33?(e.consume(P),f):P===47?(e.consume(P),T):P===63?(e.consume(P),N):ti(P)?(e.consume(P),I):n(P)}function f(P){return P===45?(e.consume(P),p):P===91?(e.consume(P),o=0,v):ti(P)?(e.consume(P),w):n(P)}function p(P){return P===45?(e.consume(P),x):n(P)}function h(P){return P===null?n(P):P===45?(e.consume(P),m):nn(P)?(l=h,K(P)):(e.consume(P),h)}function m(P){return P===45?(e.consume(P),x):h(P)}function x(P){return P===62?G(P):P===45?m(P):h(P)}function v(P){const W="CDATA[";return P===W.charCodeAt(o++)?(e.consume(P),o===W.length?k:v):n(P)}function k(P){return P===null?n(P):P===93?(e.consume(P),_):nn(P)?(l=k,K(P)):(e.consume(P),k)}function _(P){return P===93?(e.consume(P),S):k(P)}function S(P){return P===62?G(P):P===93?(e.consume(P),S):k(P)}function w(P){return P===null||P===62?G(P):nn(P)?(l=w,K(P)):(e.consume(P),w)}function N(P){return P===null?n(P):P===63?(e.consume(P),R):nn(P)?(l=N,K(P)):(e.consume(P),N)}function R(P){return P===62?G(P):N(P)}function T(P){return ti(P)?(e.consume(P),C):n(P)}function C(P){return P===45||ni(P)?(e.consume(P),C):M(P)}function M(P){return nn(P)?(l=M,K(P)):wn(P)?(e.consume(P),M):G(P)}function I(P){return P===45||ni(P)?(e.consume(P),I):P===47||P===62||er(P)?A(P):n(P)}function A(P){return P===47?(e.consume(P),G):P===58||P===95||ti(P)?(e.consume(P),L):nn(P)?(l=A,K(P)):wn(P)?(e.consume(P),A):G(P)}function L(P){return P===45||P===46||P===58||P===95||ni(P)?(e.consume(P),L):D(P)}function D(P){return P===61?(e.consume(P),$):nn(P)?(l=D,K(P)):wn(P)?(e.consume(P),D):A(P)}function $(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),i=P,te):nn(P)?(l=$,K(P)):wn(P)?(e.consume(P),$):(e.consume(P),V)}function te(P){return P===i?(e.consume(P),i=void 0,z):P===null?n(P):nn(P)?(l=te,K(P)):(e.consume(P),te)}function V(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||er(P)?A(P):(e.consume(P),V)}function z(P){return P===47||P===62||er(P)?A(P):n(P)}function G(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function K(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),H}function H(P){return wn(P)?Pn(e,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):se(P)}function se(P){return e.enter("htmlTextData"),l(P)}}const Zk={name:"labelEnd",resolveAll:h7,resolveTo:g7,tokenize:m7},d7={tokenize:x7},f7={tokenize:y7},p7={tokenize:b7};function h7(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&$a(e,0,e.length,n),e}function g7(e,t){let n=e.length,r=0,i,o,l;for(;n--;){const p=e[n][1];if(i){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&&(i=n,p.type!=="labelLink")){r=2;break}}else p.type==="labelEnd"&&(o=n)}const u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},f={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,t],["enter",d,t]],l=ba(l,e.slice(i+1,i+r+3)),l=ba(l,[["enter",f,t]]),l=ba(l,mp(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=ba(l,[["exit",f,t],e[o-2],e[o-1],["exit",d,t]]),l=ba(l,e.slice(o+1)),l=ba(l,[["exit",u,t]]),$a(e,i,e.length,l),e}function m7(e,t,n){const r=this,i=r._labelStarts;let o,l;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();o=i[i.length-1]}return u;function u(m){return o?o._inactive?h(m):(l=r.parser.defined.includes(Wa(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(d7,p,l?p:h)(m):m===91?e.attempt(f7,p,l?f:h)(m):l?p(m):h(m)}function f(m){return e.attempt(p7,p,h)(m)}function p(m){return i.pop(),t(m)}function h(m){return o._balanced=!0,n(m)}}function x7(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return er(h)?ju(e,o)(h):o(h)}function o(h){return h===41?p(h):L4(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function l(h){return er(h)?ju(e,d)(h):p(h)}function u(h){return n(h)}function d(h){return h===34||h===39||h===40?D4(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return er(h)?ju(e,p)(h):p(h)}function p(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function y7(e,t,n){const r=this;return i;function i(u){return O4.call(r,e,o,l,"reference","referenceMarker","referenceString")(u)}function o(u){return r.parser.defined.includes(Wa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function b7(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const v7={name:"labelStartImage",resolveAll:Zk.resolveAll,tokenize:k7};function k7(e,t,n){const r=this;let i;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"),i=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(i),t(d))}}const _7={name:"labelStartLink",resolveAll:Zk.resolveAll,tokenize:w7};function w7(e,t,n){const r=this;let i;return o;function o(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),i=e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(u))}}const wg={name:"lineEnding",tokenize:S7};function S7(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Pn(e,t,"linePrefix")}}const Df={name:"thematicBreak",tokenize:E7};function E7(e,t,n){let r=0,i;return o;function o(f){return e.enter("thematicBreak"),l(f)}function l(f){return i=f,u(f)}function u(f){return f===i?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||nn(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===i?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),wn(f)?Pn(e,u,"whitespace")(f):u(f))}}const Pi={continuation:{tokenize:T7},exit:A7,name:"list",tokenize:j7},N7={partial:!0,tokenize:I7},C7={partial:!0,tokenize:R7};function j7(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[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:tk(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(Df,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 tk(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(Zu,r.interrupt?n:p,e.attempt(N7,m,h))}function p(x){return r.containerState.initialBlankLine=!0,o++,m(x)}function h(x){return wn(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 T7(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Zu,i,o);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Pn(e,t,"listItemIndent",r.containerState.size+1)(u)}function o(u){return r.containerState.furtherBlankLines||!wn(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(C7,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Pn(e,e.attempt(Pi,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function R7(e,t,n){const r=this;return Pn(e,i,"listItemIndent",r.containerState.size+1);function i(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 A7(e){e.exit(this.containerState.type)}function I7(e,t,n){const r=this;return Pn(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!wn(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const S2={name:"setextUnderline",resolveTo:M7,tokenize:L7};function M7(e,t){const n=new Kf;let r=e.length,i,o,l;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=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[i][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[i][1],t]]),e[i][1].end={...e[l][1].end}):e[i][1]=u,n.add(e.length,0,[["exit",u,t]]),n.consume(e),e}function L7(e,t,n){const r=this;let i;return o;function o(f){let p=r.events.length,h;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){h=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===i?(e.consume(f),u):(e.exit("setextHeadingLineSequence"),wn(f)?Pn(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||nn(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const O7={tokenize:D7};function D7(e){const t=this,n=e.attempt(Zu,r,e.attempt(this.parser.constructs.flowInitial,i,Pn(e,e.attempt(this.parser.constructs.flow,i,e.attempt($6,i)),"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 i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const P7={resolveAll:B4()},F7=F4("string"),B7=F4("text");function F4(e){return{resolveAll:B4(e==="text"?z7:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,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 h=i[p];let m=-1;if(h)for(;++m<h.length;){const x=h[m];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function B4(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function z7(e,t){const n=new Kf;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],o=t.sliceStream(i);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:i.start._bufferIndex+u,_index:i.start._index+l,line:i.end.line,column:i.end.column-d,offset:i.end.offset-d},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):n.add(r,0,[["enter",p,t],["exit",p,t]])}r++}return n.consume(e),e}const U7={42:Pi,43:Pi,45:Pi,48:Pi,49:Pi,50:Pi,51:Pi,52:Pi,53:Pi,54:Pi,55:Pi,56:Pi,57:Pi,62:R4},q7={91:Y6},H7={[-2]:_g,[-1]:_g,32:_g},$7={35:t7,42:Df,45:[S2,Df],60:i7,61:S2,95:Df,96:w2,126:w2},W7={38:I4,92:A4},V7={[-5]:wg,[-4]:wg,[-3]:wg,33:v7,38:I4,42:nk,60:[E6,c7],91:_7,92:[J6,A4],93:Zk,95:nk,96:F6},G7={null:[nk,P7]},K7={null:[42,95]},Y7={null:[]},Q7=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:K7,contentInitial:q7,disable:Y7,document:U7,flow:$7,flowInitial:H7,insideSpan:G7,string:W7,text:V7},Symbol.toStringTag,{value:"Module"}));function X7(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 i={},o=[];let l=[],u=[];const d={attempt:M(T),check:M(C),consume:w,enter:N,exit:R,interrupt:M(C,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:v,parser:e,previous:null,sliceSerialize:m,sliceStream:x,write:h};let p=t.tokenize.call(f,d);return t.resolveAll&&o.push(t),f;function h(D){return l=ba(l,D),_(),l[l.length-1]!==null?[]:(I(t,0),f.events=mp(o,f.events,f),f.events)}function m(D,$){return J7(x(D),$)}function x(D){return Z7(l,D)}function v(){const{_bufferIndex:D,_index:$,line:te,column:V,offset:z}=r;return{_bufferIndex:D,_index:$,line:te,column:V,offset:z}}function k(D){i[D.line]=D.column,L()}function _(){for(;r._index<l.length;){const D=l[r._index];if(typeof D=="string"){const $=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<D.length;)S(D.charCodeAt(r._bufferIndex))}else S(D)}}function S(D){p=p(D)}function w(D){nn(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,L()):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,$){const te=$||{};return te.type=D,te.start=v(),f.events.push(["enter",te,f]),u.push(te),te}function R(D){const $=u.pop();return $.end=v(),f.events.push(["exit",$,f]),$}function T(D,$){I(D,$.from)}function C(D,$){$.restore()}function M(D,$){return te;function te(V,z,G){let K,H,se,P;return Array.isArray(V)?ee(V):"tokenize"in V?ee([V]):W(V);function W(Y){return oe;function oe(_e){const ae=_e!==null&&Y[_e],ye=_e!==null&&Y.null,Fe=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return ee(Fe)(_e)}}function ee(Y){return K=Y,H=0,Y.length===0?G:F(Y[H])}function F(Y){return oe;function oe(_e){return P=A(),se=Y,Y.partial||(f.currentConstruct=Y),Y.name&&f.parser.constructs.disable.null.includes(Y.name)?q():Y.tokenize.call($?Object.assign(Object.create(f),$):f,d,J,q)(_e)}}function J(Y){return D(se,P),z}function q(Y){return P.restore(),++H<K.length?F(K[H]):G}}}function I(D,$){D.resolveAll&&!o.includes(D)&&o.push(D),D.resolve&&$a(f.events,$,f.events.length-$,D.resolve(f.events.slice($),f)),D.resolveTo&&(f.events=D.resolveTo(f.events,f))}function A(){const D=v(),$=f.previous,te=f.currentConstruct,V=f.events.length,z=Array.from(u);return{from:V,restore:G};function G(){r=D,f.previous=$,f.currentConstruct=te,f.events.length=V,u=z,L()}}function L(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Z7(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,o)];else{if(l=e.slice(n,i),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function J7(e,t){let n=-1;const r=[];let i;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&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,r.push(l)}return r.join("")}function e8(e){const r={constructs:N4([Q7,...(e||{}).extensions||[]]),content:i(y6),defined:[],document:i(v6),flow:i(O7),lazy:{},string:i(F7),text:i(B7)};return r;function i(o){return l;function l(u){return X7(r,o,u)}}}function t8(e){for(;!M4(e););return e}const E2=/[\0\t\n\r]/g;function n8(){let e=1,t="",n=!0,r;return i;function i(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;){E2.lastIndex=f;const p=E2.exec(o),h=p&&p.index!==void 0?p.index:o.length,m=o.charCodeAt(h);if(!p){t=o.slice(f);break}if(m===10&&f===h&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),f<h&&(d.push(o.slice(f,h)),e+=h-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=h+1}return u&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const r8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function i8(e){return e.replace(r8,a8)}function a8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return C4(n.slice(o?2:1),o?16:10)}return Xk(n)||e}const z4={}.hasOwnProperty;function s8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),o8(n)(t8(e8(n).document().write(n8()(e,t,!0))))}function o8(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(on),autolinkProtocol:L,autolinkEmail:L,atxHeading:l(ze),blockQuote:l(Fe),characterEscape:L,characterReference:L,codeFenced:l(ct),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(ct,u),codeText:l(ht,u),codeTextData:L,data:L,codeFlowValue:L,definition:l(pt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(et),hardBreakEscape:l(Be),hardBreakTrailing:l(Be),htmlFlow:l(At,u),htmlFlowData:L,htmlText:l(At,u),htmlTextData:L,image:l(lt),label:u,link:l(on),listItem:l(gn),listItemValue:x,listOrdered:l(_t,m),listUnordered:l(_t),paragraph:l(Ht),reference:J,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(ze),strong:l(Kt),thematicBreak:l(Pe)},exit:{atxHeading:f(),atxHeadingSequence:C,autolink:f(),autolinkEmail:ye,autolinkProtocol:ae,blockQuote:f(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Y,characterReferenceMarkerNumeric:Y,characterReferenceValue:oe,characterReference:_e,codeFenced:f(S),codeFencedFence:_,codeFencedFenceInfo:v,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:f(w),codeText:f(G),codeTextData:D,data:D,definition:f(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:R,emphasis:f(),hardBreakEscape:f(te),hardBreakTrailing:f(te),htmlFlow:f(V),htmlFlowData:D,htmlText:f(z),htmlTextData:D,image:f(H),label:P,labelText:se,lineEnding:$,link:f(K),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:q,resourceDestinationString:W,resourceTitleString:ee,resource:F,setextHeading:f(A),setextHeadingLineSequence:I,setextHeadingText:M,strong:f(),thematicBreak:f()}};U4(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(le){let be={type:"root",children:[],position:void 0};const fe={stack:[be],tokenStack:[],config:t,enter:d,exit:p,buffer:u,resume:h,data:n},Oe=[],ft=[];let gt=-1;for(;++gt<le.length;)if(ft.push(le[gt]),le[gt][1].type==="listOrdered"||le[gt][1].type==="listUnordered")if(le[gt][0]==="enter")Oe.push(ft.length-1);else{const dt=Oe.pop();o(ft,dt)}for(le=ft,gt=-1;++gt<le.length;){const dt=t[le[gt][0]];le[gt][0]==="enter"&&t.beforeEnter.length>0&&i(t.beforeEnter,{...fe,sliceSerialize:le[gt][2].sliceSerialize},le[gt][1]),z4.call(dt,le[gt][1].type)&&dt[le[gt][1].type].call({...fe,sliceSerialize:le[gt][2].sliceSerialize},le[gt][1]),le[gt][0]==="exit"&&t.afterExit.length>0&&i(t.afterExit,{...fe,sliceSerialize:le[gt][2].sliceSerialize},le[gt][1])}if(fe.tokenStack.length>0){const dt=fe.tokenStack[fe.tokenStack.length-1];(dt[1]||N2).call(fe,void 0,dt[0])}for(be.position={start:uo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:uo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},gt=-1;++gt<t.transforms.length;)be=t.transforms[gt](be)||be;return be}function i(le,be,fe){let Oe=-1;for(;++Oe<le.length;)le[Oe].call(be,fe)}function o(le,be){const fe=le.length-1;let Oe=be-1,ft=-1,gt=!1,dt,Lt,Wt,rt;const wt=[];for(;++Oe<=fe;){const kt=le[Oe];switch(kt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{kt[0]==="enter"?ft++:ft--,rt=void 0;break}case"lineEndingBlank":{kt[0]==="enter"&&(dt&&!rt&&!ft&&!Wt&&(Wt=Oe),rt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:rt=void 0}if(!ft&&kt[0]==="enter"&&kt[1].type==="listItemPrefix"||ft===-1&&kt[0]==="exit"&&(kt[1].type==="listUnordered"||kt[1].type==="listOrdered")){if(dt){let xe=Oe;for(Lt=void 0;xe--;){const De=le[xe];if(De[1].type==="lineEnding"||De[1].type==="lineEndingBlank"){if(De[0]==="exit")continue;Lt&&(le[Lt][1].type="lineEndingBlank",gt=!0),De[1].type="lineEnding",Lt=xe}else if(!(De[1].type==="linePrefix"||De[1].type==="blockQuotePrefix"||De[1].type==="blockQuotePrefixWhitespace"||De[1].type==="blockQuoteMarker"||De[1].type==="listItemIndent"))break}Wt&&(!Lt||Wt<Lt)&&(dt._spread=!0),dt.end=Object.assign({},Lt?le[Lt][1].start:kt[1].end),wt.push({at:Lt||Oe,event:["exit",dt,kt[2]]})}if(kt[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},kt[1].start),end:void 0};dt=xe,wt.push({at:Oe,event:["enter",xe,kt[2]]}),Wt=void 0,rt=!0}}}const Yt=le.splice(be);let an=0;for(Oe=-1;++Oe<Yt.length;){for(;an<wt.length&&wt[an].at===be+Oe;)le.push(wt[an++].event);le.push(Yt[Oe])}le[be][1]._spread=gt}function l(le,be){return fe;function fe(Oe){d.call(this,le(Oe),Oe),be&&be.call(this,Oe)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(le,be,fe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([be,fe||void 0]),le.position={start:uo(be.start),end:void 0}}function f(le){return be;function be(fe){le&&le.call(this,fe),p.call(this,fe)}}function p(le,be){const fe=this.stack.pop(),Oe=this.tokenStack.pop();if(!Oe)throw new Error("Cannot close `"+le.type+"` ("+Cu({start:le.start,end:le.end})+"): it’s not open");Oe[0].type!==le.type&&(be?be.call(this,le,Oe[0]):(Oe[1]||N2).call(this,le,Oe[0])),fe.position.end=uo(le.end)}function h(){return gp(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(le){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function v(){const le=this.resume(),be=this.stack[this.stack.length-1];be.lang=le}function k(){const le=this.resume(),be=this.stack[this.stack.length-1];be.meta=le}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/(\r?\n|\r)$/g,"")}function N(le){const be=this.resume(),fe=this.stack[this.stack.length-1];fe.label=be,fe.identifier=Wa(this.sliceSerialize(le)).toLowerCase()}function R(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function T(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function C(le){const be=this.stack[this.stack.length-1];if(!be.depth){const fe=this.sliceSerialize(le).length;be.depth=fe}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function I(le){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function L(le){const fe=this.stack[this.stack.length-1].children;let Oe=fe[fe.length-1];(!Oe||Oe.type!=="text")&&(Oe=ut(),Oe.position={start:uo(le.start),end:void 0},fe.push(Oe)),this.stack.push(Oe)}function D(le){const be=this.stack.pop();be.value+=this.sliceSerialize(le),be.position.end=uo(le.end)}function $(le){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=be.children[be.children.length-1];fe.position.end=uo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(L.call(this,le),D.call(this,le))}function te(){this.data.atHardBreak=!0}function V(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function z(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function G(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function K(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function H(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function se(le){const be=this.sliceSerialize(le),fe=this.stack[this.stack.length-2];fe.label=i8(be),fe.identifier=Wa(be).toLowerCase()}function P(){const le=this.stack[this.stack.length-1],be=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const Oe=le.children;fe.children=Oe}else fe.alt=be}function W(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function ee(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function F(){this.data.inReference=void 0}function J(){this.data.referenceType="collapsed"}function q(le){const be=this.resume(),fe=this.stack[this.stack.length-1];fe.label=be,fe.identifier=Wa(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function Y(le){this.data.characterReferenceType=le.type}function oe(le){const be=this.sliceSerialize(le),fe=this.data.characterReferenceType;let Oe;fe?(Oe=C4(be,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Oe=Xk(be);const ft=this.stack[this.stack.length-1];ft.value+=Oe}function _e(le){const be=this.stack.pop();be.position.end=uo(le.end)}function ae(le){D.call(this,le);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(le)}function ye(le){D.call(this,le);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(le)}function Fe(){return{type:"blockquote",children:[],position:void 0}}function ct(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function ht(){return{type:"inlineCode",value:"",position:void 0}}function pt(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function et(){return{type:"emphasis",children:[],position:void 0}}function ze(){return{type:"heading",depth:0,children:[],position:void 0}}function Be(){return{type:"break",position:void 0}}function At(){return{type:"html",value:"",position:void 0}}function lt(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function on(){return{type:"link",title:null,url:"",children:[],position:void 0}}function _t(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[],position:void 0}}function gn(le){return{type:"listItem",spread:le._spread,checked:null,children:[],position:void 0}}function Ht(){return{type:"paragraph",children:[],position:void 0}}function Kt(){return{type:"strong",children:[],position:void 0}}function ut(){return{type:"text",value:"",position:void 0}}function Pe(){return{type:"thematicBreak",position:void 0}}}function uo(e){return{line:e.line,column:e.column,offset:e.offset}}function U4(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?U4(e,r):l8(e,r)}}function l8(e,t){let n;for(n in t)if(z4.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 N2(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Cu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Cu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Cu({start:t.start,end:t.end})+") is still open")}function c8(e){const t=this;t.parser=n;function n(r){return s8(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function u8(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 d8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
52
|
+
`}]}function f8(e,t){const n=t.value?t.value+`
|
|
53
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[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 p8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function h8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function g8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=sc(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-"+i,id:n+"fnref-"+i+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function m8(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 x8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function q4(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 i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function y8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return q4(e,t);const i={src:sc(r.url||"")};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function b8(e,t){const n={src:sc(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 v8(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 k8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return q4(e,t);const i={href:sc(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function _8(e,t){const n={href:sc(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 w8(e,t,n){const r=e.all(t),i=n?S8(n):H4(t),o={},l=[];if(typeof t.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const p=r[u];(i||u!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
|
|
54
|
+
`}),p.type==="element"&&p.tagName==="p"&&!i?l.push(...p.children):l.push(p)}const d=r[r.length-1];d&&(i||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
55
|
+
`});const f={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,f),e.applyData(t,f)}function S8(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const{children:n}=e;let r=-1;for(;!t&&++r<n.length;)t=H4(n[r])}return t}function H4(e){const{spread:t}=e;return t??e.children.length>1}function E8(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];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 N8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function C8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function j8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function T8(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Gk(t.children[1]),d=b4(t.children[t.children.length-1]);u&&d&&(l.position={start:u,end:d}),i.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function R8(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 h=t.children[d],m={},x=l?l[d]:void 0;x&&(m.align=x);let v={type:"element",tagName:o,properties:m,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,v)),f.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function A8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const C2=9,j2=32;function I8(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(T2(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(T2(t.slice(i),i>0,!1)),o.join("")}function T2(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===C2||o===j2;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===C2||o===j2;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function M8(e,t){const n={type:"text",value:I8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function L8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const O8={blockquote:u8,break:d8,code:f8,delete:p8,emphasis:h8,footnoteReference:g8,heading:m8,html:x8,imageReference:y8,image:b8,inlineCode:v8,linkReference:k8,link:_8,listItem:w8,list:E8,paragraph:N8,root:C8,strong:j8,table:T8,tableCell:A8,tableRow:R8,text:M8,thematicBreak:L8,toml:df,yaml:df,definition:df,footnoteDefinition:df};function df(){}const $4=-1,xp=0,Tu=1,Yf=2,Jk=3,e1=4,t1=5,n1=6,W4=7,V4=8,{defineProperty:D8}=Object,G4=typeof self=="object"?self:globalThis,R2=(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 G4[e](t)},P8=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,l]=t[i];switch(o){case xp:case $4:return n(l,i);case Tu:{const u=n([],i);for(const d of l)u.push(r(d));return u}case Yf:{const u=n({},i);for(const[d,f]of l){const p=r(d),h=r(f);p==="__proto__"?D8(u,p,{value:h,configurable:!0,enumerable:!0,writable:!0}):u[p]=h}return u}case Jk:return n(new Date(l),i);case e1:{const{source:u,flags:d}=l;return n(new RegExp(u,d),i)}case t1:{const u=n(new Map,i);for(const[d,f]of l)u.set(r(d),r(f));return u}case n1:{const u=n(new Set,i);for(const d of l)u.add(r(d));return u}case W4:{const{name:u,message:d}=l;return n(typeof G4[u]=="function"?R2(u,d):new Error(d),i)}case V4:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);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(R2(o,l),i)};return r},A2=e=>P8(new Map,e)(0),Ko="",{toString:F8}={},{keys:B8,is:z8}=Object,ru=e=>{const t=typeof e;if(t!=="object"||!e)return[xp,t];const n=F8.call(e).slice(8,-1);switch(n){case"Array":return[Tu,Ko];case"Object":return[Yf,Ko];case"Date":return[Jk,Ko];case"RegExp":return[e1,Ko];case"Map":return[t1,Ko];case"Set":return[n1,Ko];case"DataView":return[Tu,n]}return n.includes("Array")?[Tu,n]:e instanceof Error?[W4,e.name||"Error"]:[Yf,n]},ff=([e,t])=>e===xp&&(t==="function"||t==="symbol"),U8=(e,t,n,r)=>{const i=(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]=ru(l);switch(u){case xp:{let p=l;switch(d){case"bigint":u=V4,p=l.toString();break;case"number":if(!l&&z8(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 i([$4],l)}return i([u,p],l)}case Tu:{if(d){let m=l;return d==="DataView"?m=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(m=new Uint8Array(l)),i([d,[...m]],l)}const p=[],h=i([u,p],l);for(const m of l)p.push(o(m));return h}case Yf:{if(d)switch(d){case"BigInt":return i([d,l.toString()],l);case"Boolean":case"Number":case"String":return i([d,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const p=[],h=i([u,p],l);for(const m of B8(l))(e||!ff(ru(l[m])))&&p.push([o(m),o(l[m])]);return h}case Jk:return i([u,isNaN(l.getTime())?Ko:l.toISOString()],l);case e1:{const{source:p,flags:h}=l;return i([u,{source:p,flags:h}],l)}case t1:{const p=[],h=i([u,p],l);for(const[m,x]of l)(e||!(ff(ru(m))||ff(ru(x))))&&p.push([o(m),o(x)]);return h}case n1:{const p=[],h=i([u,p],l);for(const m of l)(e||!ff(ru(m)))&&p.push(o(m));return h}}const{message:f}=l;return i([u,{name:d,message:f}],l)};return o},I2=(e,{json:t,lossy:n}={})=>{const r=[];return U8(!(t||n),!!t,new Map,r)(e),r},Qf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?A2(I2(e,t)):structuredClone(e):(e,t)=>A2(I2(e,t));function q8(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 H8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function $8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||q8,r=e.options.footnoteBackLabel||H8,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[],d=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);p&&(u[f]=e.all(p))}for(f=-1;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const h=u[f],m=String(p.identifier).toUpperCase(),x=sc(m.toLowerCase());let v=0;const k=[],_=e.footnoteCounts.get(m);for(;_!==void 0&&++v<=_;){k.length>0&&k.push({type:"text",value:" "});let N=typeof n=="string"?n:n(f,v);typeof N=="string"&&(N={type:"text",value:N}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,v),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=h[h.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...k)}else h.push(...k);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(h,!0)};e.patch(p,w),d.push(w)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Qf(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
56
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
57
|
+
`}]}}const yp=(function(e){if(e==null)return K8;if(typeof e=="function")return bp(e);if(typeof e=="object")return Array.isArray(e)?W8(e):V8(e);if(typeof e=="string")return G8(e);throw new Error("Expected function, string, or object as test")});function W8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=yp(e[n]);return bp(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function V8(e){const t=e;return bp(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function G8(e){return bp(t);function t(n){return n&&n.type===e}}function bp(e){return t;function t(n,r,i){return!!(Y8(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function K8(){return!0}function Y8(e){return e!==null&&typeof e=="object"&&"type"in e}const K4=[],Q8=!0,Ru=!1,ak="skip";function sk(e,t,n,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,o,l,u,d;if(typeof n=="function"||n&&typeof n=="object"?(o=t,l=n,r&&(i=!1)):(l=t,n&&(i=!1)),typeof l=="function")u=l;else if(l&&typeof l=="object"){if(!(l.enter===null||l.enter===void 0))if(typeof l.enter=="function")u=l.enter;else throw new Error("Unexpected value `"+l.enter+"` for `visitors.enter`, expected optional visitor");if(typeof l.exit=="function")d=l.exit;else throw new Error("Unexpected value `"+l.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+l+"` for `enter` or `visitors`, expected visitor or object with visitors");const f=yp(o),p=i?1:-1;h(e,void 0,[])();function h(m,x,v){const k=m&&typeof m=="object"?m:{};if(typeof k.type=="string"){const S=typeof k.tagName=="string"?k.tagName:typeof k.name=="string"?k.name:void 0;Object.defineProperty(_,"name",{value:"node ("+(m.type+(S?"<"+S+">":""))+")"})}return _;function _(){const S=!o||f(m,x,v[v.length-1]||void 0);let w=K4;if(u&&S&&(w=M2(u(m,v,x)),w[0]===Ru))return w;if("children"in m&&m.children){const N=m;if(N.children&&w[0]!==ak){let R=(i?-1:N.children.length)+p;const T=[...v,N];for(;R>-1&&R<N.children.length;){const C=N.children[R],M=h(C,R,T)();if(M[0]===Ru)return M;R=typeof M[1]=="number"?M[1]:R+p}}}if(d&&S){const N=M2(d(m,v,x));if(N[0]===ak)throw new Error("Unexpected value `"+N[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(N[0]===Ru||typeof N[1]=="number")return N}return w}}}function M2(e){return Array.isArray(e)?e:typeof e=="number"?[Q8,e]:e==null?K4:[e]}function Ju(e,t,n,r){let i,o,l;typeof n=="function"||n&&typeof n=="object"?(i=t,o=n,l=r):(o=t,l=n),typeof o=="function"?sk(e,i,ok(o),l):sk(e,i,X8(o),l)}function X8(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?ok(e.enter):e.enter,exit:typeof e.exit=="function"?ok(e.exit):e.exit}}function ok(e){return t;function t(n,r,i){return e(n,i,r[r.length-1])}}const lk={}.hasOwnProperty,Z8={};function J8(e,t){const n=t||Z8,r=new Map,i=new Map,o=new Map,l={...O8,...n.handlers},u={all:f,applyData:t9,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:l,one:d,options:n,patch:e9,wrap:r9};return Ju(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=String(p.identifier).toUpperCase();p.type==="definition"?r.has(h)||r.set(h,p):i.has(h)||i.set(h,p)}}),u;function d(p,h){const{type:m}=p,x=u.handlers[m];if(lk.call(u.handlers,m)&&x)return x(u,p,h);if(u.options.passThrough&&u.options.passThrough.includes(m)){if("children"in p){const{children:k,..._}=p;return{...Qf(_),children:u.all(p)}}return Qf(p)}return(u.options.unknownHandler||n9)(u,p,h)}function f(p){const h=[];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=L2(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=L2(k.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function e9(e,t){e.position&&(t.position=HP(e))}function t9(e,t){let n=t;if(e&&e.data){const{hChildren:r,hName:i,hProperties:o}=e.data;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const l="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,Qf(o)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function n9(e,t){const n=t.data||{},r="value"in t&&!(lk.call(n,"hProperties")||lk.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 r9(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 L2(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function O2(e,t){const n=J8(e,t),r=n.one(e,void 0),i=$8(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
|
|
61
|
+
`},i),o}function i9(e,t){return e&&"run"in e?async function(n,r){const i=O2(n,{file:r,...t});await e.run(i,r)}:function(n,r){return O2(n,{file:r,...e||t})}}function D2(e){if(e)throw e}var Sg,P2;function a9(){if(P2)return Sg;P2=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!h)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 Sg=function d(){var f,p,h,m,x,v,k=arguments[0],_=1,S=arguments.length,w=!1;for(typeof k=="boolean"&&(w=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_<S;++_)if(f=arguments[_],f!=null)for(p in f)h=u(k,p),m=u(f,p),k!==m&&(w&&m&&(o(m)||(x=i(m)))?(x?(x=!1,v=h&&i(h)?h:[]):v=h&&o(h)?h:{},l(k,{name:p,newValue:d(w,v,m)})):typeof m<"u"&&l(k,{name:p,newValue:m}));return k},Sg}var s9=a9();const Eg=tc(s9);function ck(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 o9(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...i);function u(d,...f){const p=e[++o];let h=-1;if(d){l(d);return}for(;++h<i.length;)(f[h]===null||f[h]===void 0)&&(f[h]=i[h]);i=f,p?l9(p,u)(...f):l(null,...f)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function l9(e,t){let n;return r;function r(...l){const u=e.length>l.length;let d;u&&l.push(i);try{d=e.apply(this,l)}catch(f){const p=f;if(u&&n)throw p;return i(p)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,i):d instanceof Error?i(d):o(d))}function i(l,...u){n||(n=!0,t(l,...u))}function o(l){i(null,l)}}const ss={basename:c9,dirname:u9,extname:d9,join:f9,sep:"/"};function c9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ed(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else l<0&&(o=!0,l=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function u9(e){if(ed(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 d9(e){ed(e);let t=e.length,n=-1,r=0,i=-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?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function f9(...e){let t=-1,n;for(;++t<e.length;)ed(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":p9(n)}function p9(e){ed(e);const t=e.codePointAt(0)===47;let n=h9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function h9(e,t){let n="",r=0,i=-1,o=0,l=-1,u,d;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(i===l-1||o===1))if(i!==l-1&&o===2){if(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("/")),i=l,o=0;continue}}else if(n.length>0){n="",r=0,i=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,o=0}else u===46&&o>-1?o++:o=-1}return n}function ed(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const g9={cwd:m9};function m9(){return"/"}function uk(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function x9(e){if(typeof e=="string")e=new URL(e);else if(!uk(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 y9(e)}function y9(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Ng=["history","path","basename","stem","extname","dirname"];class Y4{constructor(t){let n;t?uk(t)?n={path:t}:typeof t=="string"||b9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":g9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ng.length;){const o=Ng[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)Ng.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ss.basename(this.path):void 0}set basename(t){jg(t,"basename"),Cg(t,"basename"),this.path=ss.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ss.dirname(this.path):void 0}set dirname(t){F2(this.basename,"dirname"),this.path=ss.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ss.extname(this.path):void 0}set extname(t){if(Cg(t,"extname"),F2(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=ss.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){uk(t)&&(t=x9(t)),jg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ss.basename(this.path,this.extname):void 0}set stem(t){jg(t,"stem"),Cg(t,"stem"),this.path=ss.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new hp(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Cg(e,t){if(e&&e.includes(ss.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ss.sep+"`")}function jg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function F2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function b9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const v9=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),k9={}.hasOwnProperty;class r1 extends v9{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=o9()}copy(){const t=new r1;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Eg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ag("data",this.frozen),this.namespace[t]=n,this):k9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ag("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 i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=pf(t),r=this.parser||this.Parser;return Tg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Tg("process",this.parser||this.Parser),Rg("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,l){const u=pf(t),d=r.parse(u);r.run(d,u,function(p,h,m){if(p||!h||!m)return f(p);const x=h,v=r.stringify(x,m);S9(v)?m.value=v:m.result=v,f(p,m)});function f(p,h){p||!h?l(p):o?o(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Tg("processSync",this.parser||this.Parser),Rg("processSync",this.compiler||this.Compiler),this.process(t,i),z2("processSync","process",n),r;function i(o,l){n=!0,D2(o),r=l}}run(t,n,r){B2(t),this.freeze();const i=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=pf(n);i.run(t,d,f);function f(p,h,m){const x=h||t;p?u(p):l?l(x):r(void 0,x,m)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),z2("runSync","run",r),i;function o(l,u){D2(l),i=u,r=!0}}stringify(t,n){this.freeze();const r=pf(n),i=this.compiler||this.Compiler;return Rg("stringify",i),B2(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Ag("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,...h]=f;d(p,h)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(f.plugins),f.settings&&(i.settings=Eg(!0,i.settings,f.settings))}function u(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const h=f[p];o(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===f){m=h;break}if(m===-1)r.push([f,...p]);else if(p.length>0){let[x,...v]=p;const k=r[m][1];ck(k)&&ck(x)&&(x=Eg(!0,k,x)),r[m]=[f,x,...v]}}}}const _9=new r1().freeze();function Tg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Rg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ag(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 B2(e){if(!ck(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function z2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function pf(e){return w9(e)?e:new Y4(e)}function w9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function S9(e){return typeof e=="string"||E9(e)}function E9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const N9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",U2=[],q2={allowDangerousHtml:!0},C9=/^(https?|ircs?|mailto|xmpp)$/i,j9=[{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 mu(e){const t=T9(e),n=R9(e);return A9(t.runSync(t.parse(n),n),e)}function T9(e){const t=e.rehypePlugins||U2,n=e.remarkPlugins||U2,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...q2}:q2;return _9().use(c8).use(n).use(i9,r).use(t)}function R9(e){const t=e.children||"",n=new Y4;return typeof t=="string"&&(n.value=t),n}function A9(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||I9;for(const p of j9)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+N9+p.id,void 0);return Ju(e,f),YP(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function f(p,h,m){if(p.type==="raw"&&m&&typeof h=="number")return l?m.children.splice(h,1):m.children[h]={type:"text",value:p.value},h;if(p.type==="element"){let x;for(x in kg)if(Object.hasOwn(kg,x)&&Object.hasOwn(p.properties,x)){const v=p.properties[x],k=kg[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 h=="number"&&(x=!r(p,h,m)),x&&m&&typeof h=="number")return u&&p.children?m.children.splice(h,1,...p.children):m.children.splice(h,1),h}}}function I9(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||C9.test(e.slice(0,t))?e:""}function H2(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function M9(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function L9(e,t,n){const i=yp((n||{}).ignore||[]),o=O9(t);let l=-1;for(;++l<o.length;)sk(e,u);function u(f,p,h){if(f.type==="text"&&typeof h=="number")return d(f,p,h);if(i(f,h,p[p.length-1]))return ak}function d(f,p,h){const m=p[p.length-1],x=o[l][0],v=o[l][1];let k=0,_=!1,S=[];x.lastIndex=0;let w=x.exec(f.value);for(;w;){const R=w.index,T={index:w.index,input:w.input,stack:[...p,f]};let C=v(...w,T);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C!==!1){if(k!==R&&N({type:"text",value:f.value.slice(k,R)}),Array.isArray(C))for(const M of C)N(M);else C&&N(C);k=R+w[0].length,_=!0}if(C===!1||w[0].length===0){const M=f.value.codePointAt(R)||0;x.lastIndex=R+(/[uv]/.test(x.flags)&&M>65535?2:1)}if(!x.global)break;w=x.exec(f.value)}return _?(k<f.value.length&&N({type:"text",value:f.value.slice(k)}),m.children.splice(h,1,...S)):S=[f],h+S.length;function N(R){const T=S[S.length-1];T&&T.type==="text"&&R.type==="text"?T.value+=R.value:S.push(R)}}}function O9(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 i=n[r];t.push([D9(i[0]),P9(i[1])])}return t}function D9(e){return typeof e=="string"?new RegExp(M9(e),"g"):e}function P9(e){return typeof e=="function"?e:function(){return e}}const Ig="phrasing",Mg=["autolink","link","image","label"];function F9(){return{transforms:[W9],enter:{literalAutolink:z9,literalAutolinkEmail:Lg,literalAutolinkHttp:Lg,literalAutolinkWww:Lg},exit:{literalAutolink:$9,literalAutolinkEmail:H9,literalAutolinkHttp:U9,literalAutolinkWww:q9}}}function B9(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ig,notInConstruct:Mg},{character:".",before:"[Ww]{3}",inConstruct:Ig,notInConstruct:Mg},{character:":",before:"[PSps]",after:"\\/",inConstruct:Ig,notInConstruct:Mg}]}}function z9(e){this.enter({type:"link",title:null,url:"",children:[],position:void 0},e)}function Lg(e){this.config.enter.autolinkProtocol.call(this,e)}function U9(e){this.config.exit.autolinkProtocol.call(this,e)}function q9(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 H9(e){this.config.exit.autolinkEmail.call(this,e)}function $9(e){this.exit(e)}function W9(e){L9(e,[[new RegExp("(?<![\\da-z])(https?:\\/\\/|www(?=\\.))([\\w-]*\\.[\\w\\-.]*)([^\\t\\n\\r ]*)","gi"),V9],[new RegExp("(?<![\\w+\\-.@])xmpp:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)(\\/(?:[\\w\\-/]|\\.(?=[\\dA-Za-z]))*)?","g"),Y9],[new RegExp("(?<![\\w+\\-.@])mailto:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),K9],[new RegExp("(?<![\\w+\\-.]|(?:^|[^\\d@A-Za-z])(?:mailto|xmpp):)([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),G9]],{ignore:["link","linkReference"]})}function V9(e,t,n,r,i){if(!Z9(i))return!1;let o="";if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),Xu(n.charCodeAt(0))||!Q9(n))return!1;const l=X9(n+r),u={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0],position:void 0}],position:void 0};return l[1]?[u,{type:"text",value:l[1],position:void 0}]:u}function G9(e,t,n){return/[\d\-_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n,position:void 0}],position:void 0}}function K9(e,t,n){if(/[\d\-_]$/.test(n))return!1;const r="mailto:"+t+"@"+n;return{type:"link",title:null,url:r,children:[{type:"text",value:r,position:void 0}],position:void 0}}function Y9(e,t,n,r,i){if(/[\d\-_]$/.test(n)||r&&(!/[A-Za-z]$/.test(r)||i.input.charAt(i.index+e.length)==="@"))return!1;const o="xmpp:"+t+"@"+n+(r||"");return{type:"link",title:null,url:o,children:[{type:"text",value:o,position:void 0}],position:void 0}}function Q9(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[\dA-Za-z]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[\dA-Za-z]/.test(t[t.length-2])))}function X9(e){let t=e.length;for(;t>0;){const l=e.charCodeAt(t-1);if(l===33||l===34||l===38||l===39||l===41||l===44||l===46||l===58||l===59||l===60||l===62||l===63||l===93||l===125)t--;else break}if(t===e.length)return[e,void 0];let n=e.slice(t);e=e.slice(0,t);let r=n.indexOf(")");const i=H2(e,"(");let o=H2(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Z9(e){const t=e.input.charCodeAt(e.index-1);return e.index===0||il(t)||Xu(t)}Q4.peek=oF;function J9(){this.buffer()}function eF(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function tF(){this.buffer()}function nF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function rF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iF(e){this.exit(e)}function aF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function sF(e){this.exit(e)}function oF(){return"["}function Q4(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),u(),l(),o+=i.move("]"),o}function lF(){return{enter:{gfmFootnoteCallString:J9,gfmFootnoteCall:eF,gfmFootnoteDefinitionLabelString:tF,gfmFootnoteDefinition:nF},exit:{gfmFootnoteCallString:rF,gfmFootnoteCall:iF,gfmFootnoteDefinitionLabelString:aF,gfmFootnoteDefinition:sF}}}function cF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Q4},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,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?X4:uF))),f(),d}}function uF(e,t,n){return t===0?e:X4(e,t,n)}function X4(e,t,n){return(n?"":" ")+e}const dF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];i1.attention=mF;i1.peek=xF;function fF(){return{canContainEols:["delete"],enter:{strikethrough:hF},exit:{strikethrough:gF}}}function pF(){return{handlers:{delete:i1},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:dF}]}}function hF(e){this.enter({type:"delete",children:[],position:void 0},e)}function gF(e){this.exit(e)}function i1(e,t,n,r){const i=n.createTracker(r),o=n.stack.includes("strikethrough")?"~":"~~",l=n.enter("strikethrough");let u=i.move(o);return u+=n.containerPhrasing(e,{...i.current(),before:u,after:"~"}),u+=i.move(o),l(),u}function mF(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function xF(){return"~"}function yF(e){return e.length}function bF(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||yF,o=[],l=[],u=[],d=[];let f=0,p=-1;for(;++p<e.length;){const k=[],_=[];let S=-1;for(e[p].length>f&&(f=e[p].length);++S<e[p].length;){const w=vF(e[p][S]);if(n.alignDelimiters!==!1){const N=i(w);_[S]=N,(d[S]===void 0||N>d[S])&&(d[S]=N)}k.push(w)}l[p]=k,u[p]=_}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<f;)o[h]=$2(r[h]);else{const k=$2(r);for(;++h<f;)o[h]=k}h=-1;const m=[],x=[];for(;++h<f;){const k=o[h];let _="",S="";k===99?(_=":",S=":"):k===108?_=":":k===114&&(S=":");let w=n.alignDelimiters===!1?1:Math.max(1,d[h]-_.length-S.length);const N=_+"-".repeat(w)+S;n.alignDelimiters!==!1&&(w=_.length+w+S.length,w>d[h]&&(d[h]=w),x[h]=w),m[h]=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],S=n.fillRows===!1?Math.max(1,l[p===1?0:p].length):f;h=-1;const w=[];for(;++h<S;){const N=k[h]||"";let R="",T="";if(n.alignDelimiters!==!1){const C=d[h]-(_[h]||0),M=o[h];if(M===114)R=" ".repeat(C);else if(M===99){const I=C/2;C%2?(R=" ".repeat(I+.5),T=" ".repeat(I-.5)):(R=" ".repeat(I),T=R)}else T=" ".repeat(C)}n.delimiterStart!==!1&&!h&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||h)&&w.push(" "),n.alignDelimiters!==!1&&w.push(R),w.push(N),n.alignDelimiters!==!1&&w.push(T),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||h!==S-1)&&w.push("|")}v.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return v.join(`
|
|
63
|
+
`)}function vF(e){return e==null?"":String(e)}function $2(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 kF=yp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _F(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),wF);return i(),l}function wF(e,t,n){return">"+(n?"":" ")+e}function SF(e,t){return W2(e,t.inConstruct,!0)&&!W2(e,t.notInConstruct,!1)}function W2(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 V2(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){const o=n.unsafe[i];if(o.character===`
|
|
64
|
+
`&&!o.before&&!o.after&&SF(n.stack,o))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
65
|
+
`}function EF(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>l&&(l=o):o=1,i=r+t.length,r=n.indexOf(t,i);return l}function NF(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 CF(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 jF(e,t,n,r){const i=CF(n),o=e.value||"";if(NF(e,n)){const h=n.enter("codeIndented"),m=n.indentLines(o,TF);return h(),m}const l=n.createTracker(r),u=i.repeat(Math.max(EF(o,i)+1,3)),d=n.enter("codeFenced"),f=i==="`"?"GraveAccent":"Tilde";let p=l.move(u);if(e.lang){const h=n.enter(`codeFencedLang${f}`);p+=l.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...l.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${f}`);p+=l.move(" "),p+=l.move(n.safe(e.meta,{before:p,after:`
|
|
66
|
+
`,encode:["`"],...l.current()})),h()}return p+=l.move(`
|
|
67
|
+
`),o&&(p+=l.move(o+`
|
|
68
|
+
`)),p+=l.move(u),d(),p}function TF(e,t,n){return(n?"":" ")+e}function a1(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 RF(e,t,n,r){const i=a1(n),o=i==='"'?"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(" "+i),f+=d.move(n.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),l(),f}function AF(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Xf(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Yl(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function Z4(e){return"&#x"+e.toString(16).toUpperCase()+";"}function G2(e,t,n){const r=bo(e),i=bo(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function IF(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const u=e.charCodeAt(2);return u===45?2:u===91?5:ti(u)?4:void 0}if(t===63)return 3;const n=t===47,r=n?2:1;let i=r,o=e.charCodeAt(i);if(!ti(o))return;for(;o===45||ni(o);)o=e.charCodeAt(++i);const l=e.slice(r,i).toLowerCase();return!n&&o!==47&&ik.includes(l)?1:P4.includes(l)?6:7}const J4=new Map([["*",!1],["_",!0]]);function MF(e,t,n){const r=new Set;for(const o of e){const l=n.get(o);if(l&&o.attention&&t.some(u=>u.attention===o.attention))for(const u of l.tokens)r.add(u.attention)}const i=[];for(const o of e)o.attention&&r.delete(o.attention)&&i.push(o.attention);return i.reverse(),i}function e5(e,t,n){const r=[],i=new Map,o=new Map;let l=0;for(;l<e.length;){if(!e[l].attention){l++;continue}const u=e[l].value.charAt(0),d=J4.get(u);let f=l+1;for(;f<e.length&&e[f].attention&&e[f].value.charAt(0)===u;)f++;const p=l?e[l-1].value:t,h=bo(p.charCodeAt(p.length-1)),m=bo((f<e.length?e[f].value:n).charCodeAt(0)),x=!m||m===2&&!!h,v=!h||h===2&&!!m,k={tokens:e.slice(l,f),markers:[],start:0,end:0,open:d?x&&(!!h||!v):x,close:d?v&&(!!m||!x):v,split:d!==void 0};for(const _ of k.tokens){i.set(_,[...k.tokens]),o.set(_,k);let S=_.value.length;for(;S--;)k.markers.push(_)}k.end=k.markers.length,r.push(k),l=f}for(OF(r,i),l=-1;++l<e.length;){const u=i.get(e[l]);if(u)return{attention:MF(e,u,o),index:l}}}function hf(e,t){const n=e[t?0:e.length-1];if(!n||n.attention)return;const r=t?Xf(n.value):Yl(n.value),i=Z4(r.codePointAt(0));if(t)n.value=i+n.value.slice(r.length);else{let o=n.value.slice(0,n.value.length-r.length),l=0;for(;o.charCodeAt(o.length-1-l)===92;)l++;l%2&&(o+="\\"),n.value=o+i}}function LF(e,t,n,r,i){for(const o of n.attention){const l=t.get(o)||o.sequences[0];for(const u of o.sequences){if(u===l)continue;const d=new Map(t);d.set(o,u);const f=vp(e,d,r,i),p=e5(f,r,i);if(!p||p.index>n.index)return{chosen:d,mistake:p,tokens:f}}}}function OF(e,t){const n=new Map;for(const r of e){const i=r.tokens[0].value.charAt(0);let o=n.get(i);o||(o=[],n.set(i,o));let l=r.close?o.length:0;for(;l--&&r.start<r.end;){const u=o[l],d=u.end-u.start,f=r.end-r.start;if(r.split?(u.close||r.open)&&f%3&&!((d+f)%3):d!==u.markers.length||d!==f)continue;const p=r.split?d>1&&f>1?2:1:f,h=u.markers.slice(u.end-p,u.end),m=r.markers.slice(r.start,r.start+p),x=h[0],v=m[0];if(x===h[p-1]&&x.value.length===p&&v===m[p-1]&&v.value.length===p&&x.attention===v.attention)t.delete(x),t.delete(v);else{const k=[...new Set([...h,...m])];for(const _ of k){const S=t.get(_);S&&S.push(...k)}}u.end-=p,r.start+=p,u.start===u.end&&o.splice(l,1),l=o.length}r.open&&r.start<r.end&&o.push(r)}}function DF(e,t,n){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const i of n)if(!Number.isSafeInteger(i)||i<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as size, expected positive integer");const r=[];for(const i of t){if(i.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected a single ascii character");if(!j4(i.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected ascii punctuation");for(const o of n)r.push(i.repeat(o))}return r}function PF(e,t,n){const r=t.indexStack,i=e.children||[],o=[];let l=-1,u=n.before;r.push(-1);let d=t.createTracker(n);for(;++l<i.length;){const f=i[l];let p;if(r[r.length-1]=l,l+1<i.length){let x=t.handle.handlers[i[l+1].type];x&&x.peek&&(x=x.peek),p=x?Xf(x(i[l+1],e,t,{before:"",after:"",...d.current()})):""}else p=n.after;const h=o[o.length-1];typeof h=="string"&&(u==="\r"||u===`
|
|
70
|
+
`)&&f.type==="html"&&IF(f.value)!==7&&(o[o.length-1]=h.replace(/(\r?\n|\r)$/," "),u=" ",d=t.createTracker(n),d.move(kp(o,n.before,n.after)));const m=t.handle.handlers[f.type];if(m&&m.attention){const x=s1(f,m.attention,t,d);if(!x)continue;o.push(x),u=Yl(x.sequences[0])}else{const x=t.handle(f,e,t,{...d.current(),after:p,before:u});if(!x)continue;d.move(x),o.push(x),u=Yl(x)}}return r.pop(),o}function s1(e,t,n,r){const{construct:i,markers:o,sizes:l}=t(e,n),u=DF(e.type,o,l),d=u[0],f=n.enter(i),p=n.createTracker(r.current());p.move(d);const h=PF(e,n,{...p.current(),before:d,after:d});if(f(),h.length!==0)return r.move(d),r.move(kp(h,d,d)),r.move(d),{children:h,sequences:u}}function K2(e,t,n,r){let i=vp(e,t,n,r),o=e5(i,n,r);for(;o;){const l=LF(e,t,o,n,r);if(!l)return;t=l.chosen,i=l.tokens,o=l.mistake}return i}function t5(e,t,n,r){let i=n,o=-1;for(;++o<e.length;){const l=e[o];if(typeof l=="string"){i="";continue}const u=o===e.length-1?r:"",d=l.sequences.find(function(f){const p=f.charAt(0);return p!==i.charAt(0)&&p!==u.charAt(0)||e.length===1&&J4.has(p)&&f.length>n.length})||l.sequences[0];d!==l.sequences[0]&&t.set(l,d),t5(l.children,t,d,d),i=d}}function vp(e,t,n,r){const i=[];let o,l=Yl(n),u=-1;for(;++u<e.length;){const d=e[u];if(typeof d=="string"){const N={value:d,attention:void 0};o&&o===Xf(d)&&hf([N],!0),o=void 0,i.push(N),N.value&&(l=Yl(N.value));continue}const f=t.get(d)||d.sequences[0],p=f.charAt(0),h=e[u+1],m=l,x=Xf(h===void 0?r:typeof h=="string"?h:t.get(h)||h.sequences[0]),v=vp(d.children,t,f,f),k=v[0].value,_=G2(m.charCodeAt(m.length-1),k.charCodeAt(0),p);_.inside&&hf(v,!0);const S=Yl(v[v.length-1].value),w=G2(x.charCodeAt(0),S.charCodeAt(S.length-1),p);w.inside&&hf(v,!1),_.outside&&m!==`
|
|
71
|
+
`&&m!=="\r"&&hf(i,!1),w.outside&&(o=x),i.push({value:f,attention:d},...v,{value:f,attention:d}),l=f.charAt(f.length-1)}return i}function kp(e,t,n){const r=new Map;t5(e,r,t,n);const i=(r.size>0?K2(e,r,t,n):void 0)||K2(e,new Map,t,n)||vp(e,new Map,t,n);let o="";for(const l of i)o+=l.value;return o}o1.attention=n5;o1.peek=FF;function o1(e,t,n,r){const i=n.enter("phrasing"),o=s1(e,n5,n,n.createTracker(r)),l=o?kp([o],r.before,r.after):"";return i(),l}function n5(e,t){return{construct:"emphasis",markers:AF(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function FF(e,t,n){return n.options.emphasis||"*"}function BF(e,t){let n=!1;return Ju(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ru}),!!((!e.depth||e.depth<3)&&gp(e)&&(t.options.setext||n))}function zF(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(BF(e,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
|
|
72
|
+
`,after:`
|
|
73
|
+
`});return m(),h(),x+`
|
|
74
|
+
`+(i===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
75
|
+
`))+1))}const l="#".repeat(i),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(l+" ");let f=n.containerPhrasing(e,{before:"# ",after:`
|
|
76
|
+
`,...o.current()});const p=f.charCodeAt(0);return(p===9||p===32)&&(f=Z4(p)+f.slice(1)),f=f?l+" "+f:l,n.options.closeAtx&&(f+=" "+l),d(),u(),f}r5.peek=UF;function r5(e){return e.value||""}function UF(){return"<"}i5.peek=qF;function i5(e,t,n,r){const i=a1(n),o=i==='"'?"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(" "+i),f+=d.move(n.safe(e.title,{before:f,after:i,...d.current()})),f+=d.move(i),u()),f+=d.move(")"),l(),f}function qF(){return"!"}a5.peek=HF;function a5(e,t,n,r){const i=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 h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function HF(){return"!"}s5.peek=$F;function s5(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";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 i+r+i}function $F(){return"`"}function o5(e,t){const n=gp(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))}l5.peek=WF;function l5(e,t,n,r){const i=a1(n),o=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);if(o5(e,n)){const v=n.stack;n.stack=v.filter(function(S){return S!=="phrasing"});const k=n.enter("autolink");let _=l.move("<");return _+=l.move(n.containerPhrasing(e,{before:_,after:">",...l.current()})),_+=l.move(">"),k(),n.stack=v,_}const u=n.enter("link");let d=n.enter("label"),f=l.move("[");const p=n.containerPhrasing(e,{before:f,after:"](",...l.current()});f+=l.move(p),d(),f+=l.move("](");const h=/^<|[\0- \u007F]/.test(e.url),m=r.before.charAt(r.before.length-1);let x=e.title||void 0;if(!x&&!h&&(m===`
|
|
77
|
+
`||m==="\r")){let v=0;for(;v<p.length&&p.charCodeAt(v)!==93;)v+=p.charCodeAt(v)===92?2:1;p.charCodeAt(v+1)===58&&(x="")}return!e.url&&typeof x=="string"||h?(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:typeof x=="string"?" ":")",...l.current()}))),d(),typeof x=="string"&&(d=n.enter(`title${o}`),f+=l.move(" "+i),f+=l.move(n.safe(x,{before:f,after:i,...l.current()})),f+=l.move(i),d()),f+=l.move(")"),u(),f}function WF(e,t,n){return o5(e,n)?"<":"["}c5.peek=VF;function c5(e,t,n,r){const i=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 h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return l(),n.stack=p,o(),i==="full"||!f||f!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function VF(){return"["}function l1(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 GF(e){const t=l1(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 KF(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 u5(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 YF(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?KF(n):l1(n);const u=e.ordered?l==="."?")":".":GF(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),u5(n)===l&&p){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(l=u),n.bulletCurrent=l;const f=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=o,i(),f}function QF(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 XF(e,t,n,r){const i=QF(n);let o=n.bulletCurrent||l1(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;(i==="tab"||i==="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(h,m,x){return m?(x?"":" ".repeat(l))+h:(x?o:o+" ".repeat(l-o.length))+h}}function ZF(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),i(),l}function JF(e,t,n,r){if(!e.children.some(function(u){return kF(u)}))return n.containerFlow(e,r);const o=n.enter("phrasing"),l=n.containerPhrasing(e,r);return o(),l}function eB(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}c1.attention=d5;c1.peek=tB;function c1(e,t,n,r){const i=n.enter("phrasing"),o=s1(e,d5,n,n.createTracker(r)),l=o?kp([o],r.before,r.after):"";return i(),l}function d5(e,t){return{construct:"strong",markers:eB(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function tB(e,t,n){return n.options.strong||"*"}function nB(e,t,n,r){const i=t?t.children:[],o=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...r,afterNode:i[o+1],beforeNode:i[o-1]})}function rB(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 iB(e,t,n){const r=(u5(n)+(n.options.ruleSpaces?" ":"")).repeat(rB(n));return n.options.ruleSpaces?r.slice(0,-1):r}const dk={blockquote:_F,break:V2,code:jF,definition:RF,emphasis:o1,hardBreak:V2,heading:zF,html:r5,image:i5,imageReference:a5,inlineCode:s5,link:l5,linkReference:c5,list:YF,listItem:XF,paragraph:ZF,root:JF,strong:c1,text:nB,thematicBreak:iB};function aB(){return{enter:{table:sB,tableData:Y2,tableHeader:Y2,tableRow:lB},exit:{codeText:cB,table:oB,tableData:Og,tableHeader:Og,tableRow:Og}}}function sB(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[],position:void 0},e),this.data.inTable=!0}function oB(e){this.exit(e),this.data.inTable=void 0}function lB(e){this.enter({type:"tableRow",children:[],position:void 0},e)}function Og(e){this.exit(e)}function Y2(e){this.enter({type:"tableCell",children:[],position:void 0},e)}function cB(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,uB));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function uB(e,t){return t==="|"?t:e}function dB(e){const t=e||{},{tableCellPadding:n,tablePipeAlign:r,stringLength:i}=t,o=n?" ":"|";return{handlers:{inlineCode:m,table:l,tableCell:d,tableRow:u},join:[fB],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
78
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}]};function l(x,v,k,_){const S=p(x,k,_),w=S[0];if(w){let N=x.align?x.align.length:0,R=-1;if(!N)for(;++R<S.length;)S[R].length>N&&(N=S[R].length);for(;w.length<N;)w.push("")}return f(S,x.align)}function u(x,v,k,_){const S=h(x,k,_),w=f([S]);return w.slice(0,w.indexOf(`
|
|
79
|
+
`))}function d(x,v,k,_){const S=k.enter("tableCell"),w=k.enter("phrasing"),N=k.containerPhrasing(x,{..._,before:o,after:o});return w(),S(),N}function f(x,v){return bF(x,{align:v,alignDelimiters:r,fillRows:!1,padding:n,stringLength:i})}function p(x,v,k){const{children:_}=x;let S=-1;const w=[],N=v.enter("table");for(;++S<_.length;)w[S]=h(_[S],v,k);return N(),w}function h(x,v,k){const{children:_}=x;let S=-1;const w=[],N=v.enter("tableRow");for(;++S<_.length;)w[S]=d(_[S],x,v,k);return N(),w}function m(x,v,k){const _=dk.inlineCode(x,v,k);if(!k.stack.includes("tableCell"))return _;const S=[];let w=0,N=_.indexOf("|");for(;N!==-1;){let R=N;for(;R>w&&_.charCodeAt(R-1)===92;)R--;S.push(_.slice(w,N)),(N-R)%2===0&&S.push("\\"),w=N,N=_.indexOf("|",N+1)}return S.push(_.slice(w)),S.join("")}}function fB(e,t,n,r){if(e.type==="table"&&n.type==="listItem"&&n.spread===!1&&(t.type==="definition"||t.type==="heading"&&pB(t,r)||t.type==="paragraph"||t.type==="table"))return 1}function pB(e,t){let n=!1;return Ju(e,function(r){if(r.type==="break"||"value"in r&&/\r?\n|\r/.test(r.value))return n=!0,Ru}),!!((!e.depth||e.depth<3)&&gp(e)&&(t.options.setext||n))}function hB(){return{exit:{taskListCheckValueChecked:Q2,taskListCheckValueUnchecked:Q2,paragraph:mB}}}function gB(){return{handlers:{paragraph:xB},join:[yB]}}function Q2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function mB(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 i=t.children;let o=-1,l;for(;++o<i.length;){const u=i[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={...r.position.start}))}}this.exit(e)}function xB(e,t,n,r){if(!t||t.type!=="listItem"||f5(t)!==e)return dk.paragraph(e,t,n,r);const i="["+(t.checked?"x":" ")+"] ",o=n.createTracker(r);o.move(i);const l=dk.paragraph(e.children.length>0?e:{type:"paragraph",children:[{type:"text",value:" "}]},t,n,{...r,...o.current()});return i+l}function yB(e,t,n){if(!(e.type==="definition"&&n.type==="listItem"))return;const r=f5(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function f5(e){if(typeof e.checked=="boolean")for(const t of e.children){if(t.type==="paragraph")return t;if(t.type!=="definition")return}}function bB(){return[F9(),lF(),fF(),aB(),hB()]}function vB(e){return{extensions:[B9(),cF(e),pF(),dB(e),gB()]}}const kB={tokenize:CB,partial:!0},p5={tokenize:jB,partial:!0},h5={tokenize:TB,partial:!0},g5={tokenize:RB,partial:!0},_B={tokenize:AB,partial:!0},m5={name:"wwwAutolink",tokenize:EB,previous:y5},x5={name:"protocolAutolink",tokenize:NB,previous:b5},Ds={name:"emailAutolink",tokenize:SB,previous:v5},ls={};function wB(){return{text:ls}}let Go=48;for(;Go<123;)ls[Go]=Ds,Go++,Go===58?Go=65:Go===91&&(Go=97);ls[43]=Ds;ls[45]=Ds;ls[46]=Ds;ls[95]=Ds;ls[72]=[Ds,x5];ls[104]=[Ds,x5];ls[87]=[Ds,m5];ls[119]=[Ds,m5];function SB(e,t,n){const r=this;let i,o;return l;function l(h){return!fk(h)||!v5.call(r,r.previous)||u1(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return fk(h)?(e.consume(h),u):h===64?(e.consume(h),d):n(h)}function d(h){return h===46?e.check(_B,p,f)(h):h===45||h===95||ni(h)?(o=!0,e.consume(h),d):p(h)}function f(h){return e.consume(h),i=!0,d}function p(h){return o&&i&&ti(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function EB(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!y5.call(r,r.previous)||u1(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(kB,e.attempt(p5,e.attempt(h5,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function NB(e,t,n){const r=this;let i="",o=!1;return l;function l(h){return(h===72||h===104)&&b5.call(r,r.previous)&&!u1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ti(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(h),d}return n(h)}function d(h){return h===47?(e.consume(h),o?f:(o=!0,d)):n(h)}function f(h){return h===null||Gf(h)||er(h)||il(h)||Xu(h)?n(h):e.attempt(p5,e.attempt(h5,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function CB(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function jB(e,t,n){let r,i,o;return l;function l(f){return f===46||f===95?e.check(g5,d,u)(f):f===null||er(f)||il(f)||f!==45&&Xu(f)?d(f):(o=!0,e.consume(f),l)}function u(f){return f===95?r=!0:(i=r,r=void 0),e.consume(f),l}function d(f){return i||r||!o?n(f):t(f)}}function TB(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):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(g5,t,o)(l):l===null||er(l)||il(l)?t(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function RB(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),i):u===60||u===null||er(u)||il(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||er(u)||il(u)?t(u):r(u)}function o(u){return ti(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):ti(u)?(e.consume(u),l):n(u)}}function AB(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return ni(o)?n(o):t(o)}}function y5(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||er(e)}function b5(e){return!ti(e)}function v5(e){return!(e===47||fk(e))}function fk(e){return e===43||e===45||e===46||e===95||ni(e)}function u1(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 IB={tokenize:zB,partial:!0};function MB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:PB,continuation:{tokenize:FB},exit:BB}},text:{91:{name:"gfmFootnoteCall",tokenize:DB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:LB,resolveTo:OB}}}}function LB(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const d=r.events[i][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return u;function u(d){if(!l||!l._balanced)return n(d);const f=Wa(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 OB(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function DB(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),d}function d(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(h){if(o>999||h===93&&!l||h===null||h===91||er(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(Wa(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return er(h)||(l=!0),o++,e.consume(h),h===92?p:f}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,f):f(h)}}function PB(e,t,n){const r=this,i=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||er(v))return n(v);if(v===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=Wa(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return er(v)||(u=!0),l++,e.consume(v),v===92?h:p}function h(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"),i.includes(o)||i.push(o),Pn(e,x,"gfmFootnoteDefinitionWhitespace")):n(v)}function x(v){return t(v)}}function FB(e,t,n){return e.check(Zu,t,e.attempt(IB,t,n))}function BB(e){e.exit("gfmFootnoteDefinition")}function zB(e,t,n){const r=this;return Pn(e,i,"gfmFootnoteDefinitionIndent",5);function i(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 UB(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,u){let d=-1;for(;++d<l.length;)if(l[d][0]==="enter"&&l[d][1].type==="strikethroughSequenceTemporary"&&l[d][1]._close){let f=d;for(;f--;)if(l[f][0]==="exit"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._open&&l[d][1].end.offset-l[d][1].start.offset===l[f][1].end.offset-l[f][1].start.offset){l[d][1].type="strikethroughSequence",l[f][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},l[f][1].start),end:Object.assign({},l[d][1].end)},h={type:"strikethroughText",start:Object.assign({},l[f][1].end),end:Object.assign({},l[d][1].start)},m=[["enter",p,u],["enter",l[f][1],u],["exit",l[f][1],u],["enter",h,u]],x=u.parser.constructs.insideSpan.null;x&&$a(m,m.length,0,mp(x,l.slice(f+1,d),u)),$a(m,m.length,0,[["exit",h,u],["enter",l[d][1],u],["exit",l[d][1],u],["exit",p,u]]),$a(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 h=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=bo(f);if(v===126)return h>1?d(v):(l.consume(v),h++,x);if(h<2&&!n)return d(v);const _=l.exit("strikethroughSequenceTemporary"),S=bo(v);return _._open=!S||S===2&&!!k,_._close=!k||k===2&&!!S,u(v)}}}class qB{constructor(){this.map=[],this.index=new Map}add(t,n,r){HB(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 i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0,this.index.clear()}}function HB(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const o=[t,n,r];e.map.push(o),e.index.set(t,o)}function $B(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function WB(){return{flow:{null:{name:"table",tokenize:VB,resolveAll:GB}}}}function VB(e,t,n){const r=this;let i=0,o=0,l;return u;function u(L){let D=r.events.length-1;for(;D>-1;){const{type:V}=r.events[D][1];if(V==="lineEnding"||V==="linePrefix")D--;else break}const $=D>-1?r.events[D][1].type:null,te=$==="tableHead"||$==="tableRow"?C:d;return te===C&&r.parser.lazy[r.now().line]?n(L):te(L)}function d(L){return e.enter("tableHead"),e.enter("tableRow"),f(L)}function f(L){return L===124||(l=!0,o+=1),p(L)}function p(L){return L===null?n(L):nn(L)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),x):n(L):wn(L)?Pn(e,p,"whitespace")(L):(o+=1,l&&(l=!1,i+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),l=!0,p):(e.enter("data"),h(L)))}function h(L){return L===null||L===124||er(L)?(e.exit("data"),p(L)):(e.consume(L),L===92?m:h)}function m(L){return L===92||L===124?(e.consume(L),h):h(L)}function x(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(e.enter("tableDelimiterRow"),l=!1,wn(L)?Pn(e,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):v(L))}function v(L){return L===45||L===58?_(L):L===124?(l=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),k):T(L)}function k(L){return wn(L)?Pn(e,_,"whitespace")(L):_(L)}function _(L){return L===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),S):L===45?(o+=1,S(L)):L===null||nn(L)?R(L):T(L)}function S(L){return L===45?(e.enter("tableDelimiterFiller"),w(L)):T(L)}function w(L){return L===45?(e.consume(L),w):L===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(L))}function N(L){return wn(L)?Pn(e,R,"whitespace")(L):R(L)}function R(L){return L===124?v(L):L===null||nn(L)?!l||i!==o?T(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):T(L)}function T(L){return n(L)}function C(L){return e.enter("tableRow"),M(L)}function M(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),M):L===null||nn(L)?(e.exit("tableRow"),t(L)):wn(L)?Pn(e,M,"whitespace")(L):(e.enter("data"),I(L))}function I(L){return L===null||L===124||er(L)?(e.exit("data"),M(L)):(e.consume(L),L===92?A:I)}function A(L){return L===92||L===124?(e.consume(L),I):I(L)}}function GB(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],u=!1,d=0,f,p,h;const m=new qB;for(;++n<e.length;){const x=e[n],v=x[1];x[0]==="enter"?v.type==="tableHead"?(u=!1,d!==0&&(X2(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,h=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]])),i=v.type==="tableDelimiterRow"?2:p?3:1):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],h=gf(m,t,o,i,void 0,h),o=[0,0,0,0]),l[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],h=gf(m,t,o,i,void 0,h)),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],h=gf(m,t,o,i,n,h)):l[1]!==0&&(h=gf(m,t,l,i,n,h)),i=0):i&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(l[3]=n)}for(d!==0&&X2(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=$B(t.events,n))}return e}function gf(e,t,n,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},ql(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const d=ql(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=ql(t.events,n[2]),p=ql(t.events,n[3]),h={type:u,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,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",h,t]])}return i!==void 0&&(o.end=Object.assign({},ql(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function X2(e,t,n,r,i){const o=[],l=ql(t.events,n);i&&(i.end=Object.assign({},l),o.push(["exit",i,t])),r.end=Object.assign({},l),o.push(["exit",r,t]),e.add(n+1,0,o)}function ql(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const KB={name:"tasklistCheck",tokenize:QB};function YB(){return{text:{91:KB}}}function QB(e,t,n){const r=this;return i;function i(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 er(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 nn(d)?t(d):wn(d)?e.check({tokenize:XB},t,n)(d):n(d)}}function XB(e,t,n){return Pn(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function ZB(e){return N4([wB(),MB(),UB(e),WB(),YB()])}const JB={};function xu(e){const t=this,n=e||JB,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(ZB(n)),o.push(bB()),l.push(vB(n))}const Z2={value:`
|
|
80
|
+
`},ez={value:" "},J2=/\n/g,tz=/[\t ]+/g,nz=/^[\t ]/,rz=/[\t ]$/,iz=/^[\t ]+|[\t ]+$/g,az=/^[\t\n\f\r ]+$/,pk=new Set(["caption","col","colgroup","tbody","td","tfoot","th","thead","tr"]),sz=new Set(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title"]),k5=new Set(["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 oz(e,t){const n=t||{},r="children"in e?e.children:[],i=e.type==="element"&&e.tagName!=="p"&&e.tagName!=="table"&&!k5.has(e.tagName)&&!pk.has(e.tagName);let o=!1;e.type==="element"&&(o=e.tagName==="table"||_p(e));const l=S5(e,{whitespace:n.whitespace||"normal"}),u=[];(e.type==="text"||e.type==="comment")&&gk(u,w5(e));let d=-1;for(;++d<r.length;)gk(u,_5(r[d],d,e,{rowAfter:o?E5(e,d,void 0):void 0,whitespace:l}));let f=!1;const p=[];let h=i?-1:void 0;for(d=-1;++d<u.length;){const m=u[d];if(typeof m=="number")h!==void 0&&m>h&&(h=m);else if(m){const x=f;f=typeof m=="object",h!==void 0&&h>(f||x?0:-1)&&(p.length>0||h===0)&&p.push(`
|
|
81
|
+
`.repeat(h)||" "),h=-1,p.push(typeof m=="object"?m.value:m)}}return i&&h===0&&!f&&p.push(" "),p.join("")}function _5(e,t,n,r){if(e.type==="element")return lz(e,t,n,r);if(e.type==="text"){if(az.test(e.value)&&n.type==="element"&&(n.tagName==="table"||n.tagName==="tr"||_p(n))){const i=n.children[t-1],o=n.children[t+1];if((!i||i.type==="element"&&pk.has(i.tagName))&&(!o||o.type==="element"&&pk.has(o.tagName)))return[]}return r.whitespace==="normal"?w5(e):cz(e)}return[]}function lz(e,t,n,r){var h,m;const i=S5(e,r),o=e.children||[],l=e.tagName==="table"||_p(e);let u=-1;const d=[];if(sz.has(e.tagName)||(h=e.properties)!=null&&h.hidden||e.tagName==="dialog"&&!((m=e.properties)!=null&&m.open))return d;let f,p;for(e.tagName==="br"||Zf(e)&&(r.rowAfter||hk(n,t,Zf))?p=Z2:e.tagName==="p"?(f=2,p=2):k5.has(e.tagName)&&(f=1,p=1);++u<o.length;)gk(d,_5(o[u],u,e,{rowAfter:l?E5(e,u,r.rowAfter):void 0,whitespace:i}));return eS(e)&&hk(n,t,eS)&&d.push(ez),f&&d.unshift(f),p&&d.push(p),d}function w5(e){const t=String(e.value).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),n=[],r=[];let i=0;for(nz.test(t)&&r.push(0);i<=t.length;){J2.lastIndex=i;const u=J2.exec(t),d=u&&"index"in u?u.index:t.length;n.push(uz(t.slice(i,d))),i=d+1}let o=-1,l;for(;++o<n.length;)n[o].charCodeAt(n[o].length-1)===8203||o<n.length-1&&n[o+1].charCodeAt(0)===8203?(r.push(n[o]),l=void 0):n[o]?(typeof l=="number"&&r.push(l),r.push(n[o]),l=0):(o===0||o===n.length-1)&&r.push(0);return rz.test(t)&&r.push(0),r}function cz(e){return[String(e.value)]}function uz(e){return e.replace(iz,"").replace(tz," ")}function S5(e,t){var n,r;if(e.type==="element")switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return(n=e.properties)!=null&&n.wrap?"pre-wrap":"pre";case"td":case"th":return(r=e.properties)!=null&&r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}return t.whitespace}function E5(e,t,n){return e.type==="element"&&e.tagName==="table"?hk(e,t,dz):n}function hk(e,t,n){for(;++t<e.children.length;){const r=e.children[t];if(r.type==="element"&&n(r))return!0}return!1}function gk(e,t){let n=-1;for(;++n<t.length;)e.push(t[n])}function eS(e){return e.tagName==="td"||e.tagName==="th"}function _p(e){return e.tagName==="tbody"||e.tagName==="tfoot"||e.tagName==="thead"}function dz(e){if(Zf(e))return!0;if(_p(e)){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n.type==="element"&&Zf(n))return!0}}return!1}function Zf(e){return e.tagName==="tr"}function fz(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},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},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},x=t.optional(i)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["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"],R={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},C=[T,h,u,n,e.C_BLOCK_COMMENT_MODE,p,f],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:C.concat([{begin:/\(/,end:/\)/,keywords:R,contains:C.concat(["self"]),relevance:0}]),relevance:0},I={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:R,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:R,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(M,I,T,C,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:R,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function pz(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=fz(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 hz(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 i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},u={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(u);const d={match:/\\"/},f={className:"string",begin:/'/,end:/'/},p={match:/\\'/},h={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"],S={match:/(\/[a-z._-]+)+/},w=["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"],R=["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:[...w,...N,"set","shopt",...R,...T]},contains:[x,e.SHEBANG(),v,h,o,l,S,u,d,f,p,n]}}function gz(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},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},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},x=t.optional(i)+e.IDENT_RE+"\\s*\\(",_={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},S=[h,u,n,e.C_BLOCK_COMMENT_MODE,p,f],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:S.concat([{begin:/\(/,end:/\)/,keywords:_,contains:S.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,h]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"</",contains:[].concat(w,N,S,[h,{begin:e.IDENT_RE+"::",keywords:_},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:h,strings:f,keywords:_}}}function mz(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",l="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",u={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},f={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},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},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(f,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},x=t.optional(i)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["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"],R={type:k,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},T={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:t.concat(/\b/,`(?!${v.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},C=[T,h,u,n,e.C_BLOCK_COMMENT_MODE,p,f],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:C.concat([{begin:/\(/,end:/\)/,keywords:R,contains:C.concat(["self"]),relevance:0}]),relevance:0},I={className:"function",begin:"("+l+"[\\*&\\s]+)+"+x,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:R,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:R,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,f,p,u,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,f,p,u]}]},u,n,e.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(M,I,T,C,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:R,contains:["self",u]},{begin:e.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function xz(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"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],l={keyword:i.concat(o),built_in:t,literal: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:'""'}]},h=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,h,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const S={variants:[f,k,v,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},u]},N=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",R={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"}},S,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},u,w,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,w,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,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,relevance:0,contains:[S,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},R]}}const yz=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_-]*/}}),bz=["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"],vz=["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"],kz=[...bz,...vz],_z=["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(),wz=["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(),Sz=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Ez=["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 Nz(e){const t=e.regex,n=yz(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",u=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[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:":("+wz.join("|")+")"},{begin:":(:)?("+Sz.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Ez.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:i,attribute:_z.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...u,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+kz.join("|")+")\\b"}]}}function Cz(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 jz(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 Tz(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 Rz(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 i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},u={begin:/\[/,end:/\]/,contains:[r,o,i,l,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,f=/"(\\"|[^"])*"/,p=/'[^']*'/,h=t.either(d,f,p),m=t.concat(h,"(\\s*\\.\\s*",h,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[r,u,o,i,l,n]}}]}}var Hl="[0-9](_*[0-9])*",mf=`\\.(${Hl})`,xf="[0-9a-fA-F](_*[0-9a-fA-F])*",tS={className:"number",variants:[{begin:`(\\b(${Hl})((${mf})|\\.)?|(${mf}))[eE][+-]?(${Hl})[fFdD]?\\b`},{begin:`\\b(${Hl})((${mf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${mf})[fFdD]?\\b`},{begin:`\\b(${Hl})[fFdD]\\b`},{begin:`\\b0[xX]((${xf})\\.?|(${xf})?\\.(${xf}))[pP][+-]?(${Hl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${xf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function N5(e,t,n){return n===-1?"":e.replace(t,r=>N5(e,t,n-1))}function Az(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+N5("(?:<"+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,tS,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},tS,f]}}const nS="[A-Za-z$_][0-9A-Za-z$_]*",Iz=["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"],Mz=["true","false","null","undefined","NaN","Infinity"],C5=["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"],j5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],T5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Lz=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Oz=[].concat(T5,C5,j5);function Dz(e){const t=e.regex,n=(H,{after:se})=>{const P="</"+H[0].slice(1);return H.input.indexOf(P,se)!==-1},r=nS,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,se)=>{const P=H[0].length+H.index,W=H.input[P];if(W==="<"||W===","){se.ignoreMatch();return}W===">"&&(n(H,{after:P})||se.ignoreMatch());let ee;const F=H.input.substring(P);if(ee=F.match(/^\s*=/)){se.ignoreMatch();return}if((ee=F.match(/^\s+extends\s+/))&&ee.index===0){se.ignoreMatch();return}}},u={$pattern:nS,keyword:Iz,literal:Mz,built_in:Oz,"variable.language":Lz},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={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]},w={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+/},h];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const R=[].concat(w,m.contains),T=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(R)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},M={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"}}]},I={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:{_:[...C5,...j5]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},L={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(H){return t.concat("(?!",H.join("|"),")")}const te={match:t.concat(/\b/,$([...T5,"super","import","await"].map(H=>`${H}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},z={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},G="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(G)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:I},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,w,{match:/\$\d+/},h,I,{scope:"attr",match:r+t.lookahead(":"),relevance:0},K,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:G,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},L,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},te,D,M,z,{match:/\$[(.]/}]}}const Pz="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",Fz={scope:"number",match:Pz,relevance:0};function Bz(e){const t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={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,i,Fz,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var $l="[0-9](_*[0-9])*",yf=`\\.(${$l})`,bf="[0-9a-fA-F](_*[0-9a-fA-F])*",zz={className:"number",variants:[{begin:`(\\b(${$l})((${yf})|\\.)?|(${yf}))[eE][+-]?(${$l})[fFdD]?\\b`},{begin:`\\b(${$l})((${yf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${yf})[fFdD]?\\b`},{begin:`\\b(${$l})[fFdD]\\b`},{begin:`\\b0[xX]((${bf})\\.?|(${bf})?\\.(${bf}))[pP][+-]?(${$l})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${bf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Uz(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+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},l={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(l);const u={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},d={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(l,{className:"string"}),"self"]}]},f=zz,p=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),h={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=h;return m.variants[1].contains=[h],h.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,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:[h,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:`
|
|
82
|
+
`},f]}}const qz=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_-]*/}}),Hz=["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"],$z=["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"],Wz=[...Hz,...$z],Vz=["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(),R5=["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(),A5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Gz=["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(),Kz=R5.concat(A5).sort().reverse();function Yz(e){const t=qz(e),n=Kz,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",l=[],u=[],d=function(N){return{className:"string",begin:"~?"+N+".*?"+N}},f=function(N,R,T){return{className:N,begin:R,relevance:T}},p={$pattern:/[a-z-]+/,keyword:r,attribute:Vz.join(" ")},h={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,h,f("variable","@@?"+i,10),f("variable","@\\{"+i+"\\}"),f("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const m=u.concat({begin:/\{/,end:/\}/,contains:l}),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("+Gz.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:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:m}},S={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","@\\{"+i+"\\}"),{begin:"\\b("+Wz.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:":("+R5.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+A5.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},w={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[S]};return l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,k,_,w,v,S,x,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:l}}function Qz(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[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:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Xz(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]},i={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},l={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,i,o,l]}}function Zz(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},l={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},u=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,u,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},p={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=e.inherit(f,{contains:[]}),m=e.inherit(p,{contains:[]});f.contains.push(m),p.contains.push(h);let x=[n,d];return[f,p,h,m].forEach(S=>{S.contains=S.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:"$"},i,r,d,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Jz(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 eU(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}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},l={begin:/->\{/,end:/\}/},u={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[u]},f={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},p=[e.BACKSLASH_ESCAPE,o,d],h=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(k,_,S="\\1")=>{const w=S==="\\1"?S:t.concat(S,_);return t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,S,r)},x=(k,_,S)=>t.concat(t.concat("(?:",k,")"),_,/(?:\\.|[^\\\/])*?/,S,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(...h,{capture:!0}))},{begin:m("s|tr|y","\\(","\\)")},{begin:m("s|tr|y","\\[","\\]")},{begin:m("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:x("(?:m|qr)?",/\//,/\//)},{begin:x("m|qr",t.either(...h,{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:i,contains:v}}function tU(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),i=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)}),h={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(V,z)=>{z.data._beginMatch=V[1]||V[2]},"on:end":(V,z)=>{z.data._beginMatch!==V[1]&&z.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),x=`[
|
|
83
|
+
]`,v={scope:"string",variants:[p,f,h,m]},k={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},_=["false","null","true"],S=["__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"],w=["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"],R={keyword:S,literal:(V=>{const z=[];return V.forEach(G=>{z.push(G),G.toLowerCase()===G?z.push(G.toUpperCase()):z.push(G.toLowerCase())}),z})(_),built_in:w},T=V=>V.map(z=>z.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,t.concat(x,"+"),t.concat("(?!",T(w).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},M=t.concat(r,"\\b(?!\\()"),I={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),M],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),M],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},A={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},L={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[A,l,I,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,C]},D={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",T(S).join("\\b|"),"|",T(w).join("\\b|"),"\\b)"),r,t.concat(x,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[L]};L.contains.push(D);const $=[A,I,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,v,k,C],te={begin:t.concat(/#\[\s*\\?/,t.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]},contains:["self",...$]},...$,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:R,contains:[te,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,I,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},C,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:R,contains:["self",te,l,I,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 nU(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 rU(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function iU(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},h={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,d,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}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:["self",d,k,h,e.HASH_COMMENT_MODE]}]};return f.contains=[h,k,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:u,illegal:/(<\/|\?)|=>/,contains:[d,k,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[S]},{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,S,h]}]}}function aU(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function sU(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]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,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:[i,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:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function oU(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]+/),i=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},h={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}]},C=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:l},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match: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:[h,{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=C,k.contains=C;const L=[{begin:/^\s*=>/,starts:{end:"$",contains:C}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:C}}];return f.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:l,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(L).concat(f).concat(C)}}function lU(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},l="([ui](8|16|32|64|128|size)|f(32|64))?",u=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],f=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],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 cU=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_-]*/}}),uU=["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"],dU=["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"],fU=[...uU,...dU],pU=["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(),hU=["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(),gU=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),mU=["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 xU(e){const t=cU(e),n=gU,r=hU,i="@[a-z-]+",o="and or not only",u={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+fU.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("+mU.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,u,t.HEXCOLOR,t.CSS_NUMBER_MODE,t.UNICODE_RANGE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:pU.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},u,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function yU(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function bU(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],l=["double precision","large object","with timezone","without timezone"],u=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],f=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],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"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],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},S={match:t.concat(/\b/,t.either(...x),/\s*\(/),relevance:0,keywords:{built_in:x}};function w(T){return t.concat(/\b/,t.either(...T.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}const N={scope:"keyword",match:w(m),relevance:0};function R(T,{exceptions:C,when:M}={}){const I=M;return C=C||[],T.map(A=>A.match(/\|\d+$/)||C.includes(A)?A:I(A)?`${A}|0`:A)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:R(v,{when:T=>T.length<3}),literal:o,type:u,built_in:h},contains:[{scope:"type",match:w(l)},N,S,k,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,_]}}function I5(e){return e?typeof e=="string"?e:e.source:null}function iu(e){return Gn("(?=",e,")")}function Gn(...e){return e.map(n=>I5(n)).join("")}function vU(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function bi(...e){return"("+(vU(e).capture?"":"?:")+e.map(r=>I5(r)).join("|")+")"}const d1=e=>Gn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),kU=["Protocol","Type"].map(d1),rS=["init","self"].map(d1),_U=["Any","Self"],Dg=["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"],iS=["false","nil","true"],wU=["assignment","associativity","higherThan","left","lowerThan","none","right"],SU=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],aS=["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"],M5=bi(/[/=\-+!*%<>&|^~?]/,/[\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]/),L5=bi(M5,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Pg=Gn(M5,L5,"*"),O5=bi(/[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]/),Jf=bi(O5,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),as=Gn(O5,Jf,"*"),vf=Gn(/[A-Z]/,Jf,"*"),EU=["attached","autoclosure",Gn(/convention\(/,bi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Gn(/objc\(/,as,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],NU=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function CU(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,bi(...kU,...rS)],className:{2:"keyword"}},o={match:Gn(/\./,bi(...Dg)),relevance:0},l=Dg.filter(ze=>typeof ze=="string").concat(["_|0"]),u=Dg.filter(ze=>typeof ze!="string").concat(_U).map(d1),d={variants:[{className:"keyword",match:bi(...u,...rS)}]},f={$pattern:bi(/\b\w+/,/#\w+/),keyword:l.concat(SU),literal:iS},p=[i,o,d],h={match:Gn(/\./,bi(...aS)),relevance:0},m={className:"built_in",match:Gn(/\b/,bi(...aS),/(?=\()/)},x=[h,m],v={match:/->/,relevance:0},k={className:"operator",relevance:0,variants:[{match:Pg},{match:`\\.(\\.|${L5})+`}]},_=[v,k],S="([0-9]_*)+",w="([0-9a-fA-F]_*)+",N={className:"number",relevance:0,variants:[{match:`\\b(${S})(\\.(${S}))?([eE][+-]?(${S}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${S}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},R=(ze="")=>({className:"subst",variants:[{match:Gn(/\\/,ze,/[0\\tnr"']/)},{match:Gn(/\\/,ze,/u\{[0-9a-fA-F]{1,8}\}/)}]}),T=(ze="")=>({className:"subst",match:Gn(/\\/,ze,/[\t ]*(?:[\r\n]|\r\n)/)}),C=(ze="")=>({className:"subst",label:"interpol",begin:Gn(/\\/,ze,/\(/),end:/\)/}),M=(ze="")=>({begin:Gn(ze,/"""/),end:Gn(/"""/,ze),contains:[R(ze),T(ze),C(ze)]}),I=(ze="")=>({begin:Gn(ze,/"/),end:Gn(/"/,ze),contains:[R(ze),C(ze)]}),A={className:"string",variants:[M(),M("#"),M("##"),M("###"),I(),I("#"),I("##"),I("###")]},L=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],D={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:L},$=ze=>{const Be=Gn(ze,/\//),At=Gn(/\//,ze);return{begin:Be,end:At,contains:[...L,{scope:"comment",begin:`#(?!.*${At})`,end:/$/}]}},te={scope:"regexp",variants:[$("###"),$("##"),$("#"),D]},V={match:Gn(/`/,as,/`/)},z={className:"variable",match:/\$\d+/},G={className:"variable",match:`\\$${Jf}+`},K=[V,z,G],H={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:NU,contains:[..._,N,A]}]}},se={scope:"keyword",match:Gn(/@/,bi(...EU),iu(bi(/\(/,/\s+/)))},P={scope:"meta",match:Gn(/@/,as)},W=[H,se,P],ee={match:iu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Gn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Jf,"+")},{className:"type",match:vf,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Gn(/\s+&\s+/,iu(vf)),relevance:0}]},F={begin:/</,end:/>/,keywords:f,contains:[...r,...p,...W,v,ee]};ee.contains.push(F);const J={match:Gn(as,/\s*:/),keywords:"_|0",relevance:0},q={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",J,...r,te,...p,...x,..._,N,A,...K,...W,ee]},Y={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,ee]},oe={begin:bi(iu(Gn(as,/\s*:/)),iu(Gn(as,/\s+/,as,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:as}]},_e={begin:/\(/,end:/\)/,keywords:f,contains:[oe,...r,...p,..._,N,A,...W,ee,q],endsParent:!0,illegal:/["']/},ae={match:[/(func|macro)/,/\s+/,bi(V.match,as,Pg)],className:{1:"keyword",3:"title.function"},contains:[Y,_e,t],illegal:[/\[/,/%/]},ye={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Y,_e,t],illegal:/\[|%/},Fe={match:[/operator/,/\s+/,Pg],className:{1:"keyword",3:"title"}},ct={begin:[/precedencegroup/,/\s+/,vf],className:{1:"keyword",3:"title"},contains:[ee],keywords:[...wU,...iS],end:/}/},ht={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},pt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},et={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,as,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[Y,...p,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:vf},...p],relevance:0}]};for(const ze of A.variants){const Be=ze.contains.find(lt=>lt.label==="interpol");Be.keywords=f;const At=[...p,...x,..._,N,A,...K];Be.contains=[...At,{begin:/\(/,end:/\)/,contains:["self",...At]}]}return{name:"Swift",keywords:f,contains:[...r,ae,ye,ht,pt,et,Fe,ct,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},te,...p,...x,..._,N,A,...K,...W,ee,q]}}const ep="[A-Za-z$_][0-9A-Za-z$_]*",D5=["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"],P5=["true","false","null","undefined","NaN","Infinity"],F5=["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"],B5=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],z5=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],U5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],q5=[].concat(z5,F5,B5);function jU(e){const t=e.regex,n=(H,{after:se})=>{const P="</"+H[0].slice(1);return H.input.indexOf(P,se)!==-1},r=ep,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,se)=>{const P=H[0].length+H.index,W=H.input[P];if(W==="<"||W===","){se.ignoreMatch();return}W===">"&&(n(H,{after:P})||se.ignoreMatch());let ee;const F=H.input.substring(P);if(ee=F.match(/^\s*=/)){se.ignoreMatch();return}if((ee=F.match(/^\s+extends\s+/))&&ee.index===0){se.ignoreMatch();return}}},u={$pattern:ep,keyword:D5,literal:P5,built_in:q5,"variable.language":U5},d="[0-9](_?[0-9])*",f=`\\.(${d})`,p="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={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]},w={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+/},h];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:u,contains:["self"].concat(N)});const R=[].concat(w,m.contains),T=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:u,contains:["self"].concat(R)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T},M={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"}}]},I={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:{_:[...F5,...B5]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},L={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $(H){return t.concat("(?!",H.join("|"),")")}const te={match:t.concat(/\b/,$([...z5,"super","import","await"].map(H=>`${H}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},z={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},G="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(G)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:u,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:I},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,v,k,_,w,{match:/\$\d+/},h,I,{scope:"attr",match:r+t.lookahead(":"),relevance:0},K,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:G,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.end,skip:!0,contains:["self"]}]}]},L,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},te,D,M,z,{match:/\$[(.]/}]}}function TU(e){const t=e.regex,n=jU(e),r=ep,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[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:ep,keyword:D5.concat(d),literal:P5,built_in:q5.concat(i),"variable.language":U5},p={className:"meta",begin:"@"+r},h=(k,_,S)=>{const w=k.contains.findIndex(N=>N.label===_);if(w===-1)throw new Error("can not find mode to replace");k.contains.splice(w,1,S)};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]),h(n,"shebang",e.SHEBANG()),h(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 RU(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,l=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,u=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:t.concat(/# */,t.either(o,i),/ *#/)},{begin:t.concat(/# */,u,/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,t.either(o,i),/ +/,t.either(l,u),/ *#/)}]},f={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},p={className:"label",begin:/^\w+:/},h=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,d,f,p,h,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function AU(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"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},l={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},u={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},f={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,l,i,e.QUOTE_STRING_MODE,d,f,u]}}function IU(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,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=e.inherit(o,{begin:/\(/,end:/\)/}),u=e.inherit(e.APOS_STRING_MODE,{className:"string"}),d=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),f={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,d,u,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,l,d,u]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[f],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[f],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(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 MU(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]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},u=e.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},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],S=[..._];return S.pop(),S.push(u),x.contains=S,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:_}}const LU={arduino:pz,bash:hz,c:gz,cpp:mz,csharp:xz,css:Nz,diff:Cz,go:jz,graphql:Tz,ini:Rz,java:Az,javascript:Dz,json:Bz,kotlin:Uz,less:Yz,lua:Qz,makefile:Xz,markdown:Zz,objectivec:Jz,perl:eU,php:tU,"php-template":nU,plaintext:rU,python:iU,"python-repl":aU,r:sU,ruby:oU,rust:lU,scss:xU,shell:yU,sql:bU,swift:CU,typescript:TU,vbnet:RU,wasm:AU,xml:IU,yaml:MU};var Fg,sS;function OU(){if(sS)return Fg;sS=1;function e(X){return X instanceof Map?X.clear=X.delete=X.set=function(){throw new Error("map is read-only")}:X instanceof Set&&(X.add=X.clear=X.delete=function(){throw new Error("set is read-only")}),Object.freeze(X),Object.getOwnPropertyNames(X).forEach(Ee=>{const Te=X[Ee],mt=typeof Te;(mt==="object"||mt==="function")&&!Object.isFrozen(Te)&&e(Te)}),X}class t{constructor(Ee){Ee.data===void 0&&(Ee.data={}),this.data=Ee.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(X){return X.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(X,...Ee){const Te=Object.create(null);for(const mt in X)Te[mt]=X[mt];return Ee.forEach(function(mt){for(const Ut in mt)Te[Ut]=mt[Ut]}),Te}const i="</span>",o=X=>!!X.scope,l=(X,{prefix:Ee})=>{if(X.startsWith("language:"))return X.replace("language:","language-");if(X.includes(".")){const Te=X.split(".");return[`${Ee}${Te.shift()}`,...Te.map((mt,Ut)=>`${mt}${"_".repeat(Ut+1)}`)].join(" ")}return`${Ee}${X}`};class u{constructor(Ee,Te){this.buffer="",this.classPrefix=Te.classPrefix,Ee.walk(this)}addText(Ee){this.buffer+=n(Ee)}openNode(Ee){if(!o(Ee))return;const Te=l(Ee.scope,{prefix:this.classPrefix});this.span(Te)}closeNode(Ee){o(Ee)&&(this.buffer+=i)}value(){return this.buffer}span(Ee){this.buffer+=`<span class="${Ee}">`}}const d=(X={})=>{const Ee={children:[]};return Object.assign(Ee,X),Ee};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(Ee){this.top.children.push(Ee)}openNode(Ee){const Te=d({scope:Ee});this.add(Te),this.stack.push(Te)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Ee){return this.constructor._walk(Ee,this.rootNode)}static _walk(Ee,Te){return typeof Te=="string"?Ee.addText(Te):Te.children&&(Ee.openNode(Te),Te.children.forEach(mt=>this._walk(Ee,mt)),Ee.closeNode(Te)),Ee}static _collapse(Ee){typeof Ee!="string"&&Ee.children&&(Ee.children.every(Te=>typeof Te=="string")?Ee.children=[Ee.children.join("")]:Ee.children.forEach(Te=>{f._collapse(Te)}))}}class p extends f{constructor(Ee){super(),this.options=Ee}addText(Ee){Ee!==""&&this.add(Ee)}startScope(Ee){this.openNode(Ee)}endScope(){this.closeNode()}__addSublanguage(Ee,Te){const mt=Ee.root;Te&&(mt.scope=`language:${Te}`),this.add(mt)}toHTML(){return new u(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function h(X){return X?typeof X=="string"?X:X.source:null}function m(X){return k("(?=",X,")")}function x(X){return k("(?:",X,")*")}function v(X){return k("(?:",X,")?")}function k(...X){return X.map(Te=>h(Te)).join("")}function _(X){const Ee=X[X.length-1];return typeof Ee=="object"&&Ee.constructor===Object?(X.splice(X.length-1,1),Ee):{}}function S(...X){return"("+(_(X).capture?"":"?:")+X.map(mt=>h(mt)).join("|")+")"}function w(X){return new RegExp(X.toString()+"|").exec("").length-1}function N(X,Ee){const Te=X&&X.exec(Ee);return Te&&Te.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function T(X,{joinWith:Ee}){let Te=0;return X.map(mt=>{Te+=1;const Ut=Te;let Rt=h(mt),st="";for(;Rt.length>0;){const ve=R.exec(Rt);if(!ve){st+=Rt;break}st+=Rt.substring(0,ve.index),Rt=Rt.substring(ve.index+ve[0].length),ve[0][0]==="\\"&&ve[1]?st+="\\"+String(Number(ve[1])+Ut):(st+=ve[0],ve[0]==="("&&Te++)}return st}).map(mt=>`(${mt})`).join(Ee)}const C=/\b\B/,M="[a-zA-Z]\\w*",I="[a-zA-Z_]\\w*",A="\\b\\d+(\\.\\d+)?",L="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",D="\\b(0b[01]+)",$="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",te=(X={})=>{const Ee=/^#![ ]*\//;return X.binary&&(X.begin=k(Ee,/.*\b/,X.binary,/\b.*/)),r({scope:"meta",begin:Ee,end:/$/,relevance:0,"on:begin":(Te,mt)=>{Te.index!==0&&mt.ignoreMatch()}},X)},V={begin:"\\\\[\\s\\S]",relevance:0},z={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[V]},G={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[V]},K={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/},H=function(X,Ee,Te={}){const mt=r({scope:"comment",begin:X,end:Ee,contains:[]},Te);mt.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 Ut=S("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 mt.contains.push({begin:k(/[ ]+/,"(",Ut,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),mt},se=H("//","$"),P=H("/\\*","\\*/"),W=H("#","$"),ee={scope:"number",begin:A,relevance:0},F={scope:"number",begin:L,relevance:0},J={scope:"number",begin:D,relevance:0},q={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[V,{begin:/\[/,end:/\]/,relevance:0,contains:[V]}]},Y={scope:"title",begin:M,relevance:0},oe={scope:"title",begin:I,relevance:0},_e={begin:"\\.\\s*"+I,relevance:0};var ye=Object.freeze({__proto__:null,APOS_STRING_MODE:z,BACKSLASH_ESCAPE:V,BINARY_NUMBER_MODE:J,BINARY_NUMBER_RE:D,COMMENT:H,C_BLOCK_COMMENT_MODE:P,C_LINE_COMMENT_MODE:se,C_NUMBER_MODE:F,C_NUMBER_RE:L,END_SAME_AS_BEGIN:function(X){return Object.assign(X,{"on:begin":(Ee,Te)=>{Te.data._beginMatch=Ee[1]},"on:end":(Ee,Te)=>{Te.data._beginMatch!==Ee[1]&&Te.ignoreMatch()}})},HASH_COMMENT_MODE:W,IDENT_RE:M,MATCH_NOTHING_RE:C,METHOD_GUARD:_e,NUMBER_MODE:ee,NUMBER_RE:A,PHRASAL_WORDS_MODE:K,QUOTE_STRING_MODE:G,REGEXP_MODE:q,RE_STARTERS_RE:$,SHEBANG:te,TITLE_MODE:Y,UNDERSCORE_IDENT_RE:I,UNDERSCORE_TITLE_MODE:oe});function Fe(X,Ee){X.input[X.index-1]==="."&&Ee.ignoreMatch()}function ct(X,Ee){X.className!==void 0&&(X.scope=X.className,delete X.className)}function ht(X,Ee){Ee&&X.beginKeywords&&(X.begin="\\b("+X.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",X.__beforeBegin=Fe,X.keywords=X.keywords||X.beginKeywords,delete X.beginKeywords,X.relevance===void 0&&(X.relevance=0))}function pt(X,Ee){Array.isArray(X.illegal)&&(X.illegal=S(...X.illegal))}function et(X,Ee){if(X.match){if(X.begin||X.end)throw new Error("begin & end are not supported with match");X.begin=X.match,delete X.match}}function ze(X,Ee){X.relevance===void 0&&(X.relevance=1)}const Be=(X,Ee)=>{if(!X.beforeMatch)return;if(X.starts)throw new Error("beforeMatch cannot be used with starts");const Te=Object.assign({},X);Object.keys(X).forEach(mt=>{delete X[mt]}),X.keywords=Te.keywords,X.begin=k(Te.beforeMatch,m(Te.begin)),X.starts={relevance:0,contains:[Object.assign(Te,{endsParent:!0})]},X.relevance=0,delete Te.beforeMatch},At=["of","and","for","in","not","or","if","then","parent","list","value"],lt="keyword";function on(X,Ee,Te=lt){const mt=Object.create(null);return typeof X=="string"?Ut(Te,X.split(" ")):Array.isArray(X)?Ut(Te,X):Object.keys(X).forEach(function(Rt){Object.assign(mt,on(X[Rt],Ee,Rt))}),mt;function Ut(Rt,st){Ee&&(st=st.map(ve=>ve.toLowerCase())),st.forEach(function(ve){const Re=ve.split("|");mt[Re[0]]=[Rt,_t(Re[0],Re[1])]})}}function _t(X,Ee){return Ee?Number(Ee):gn(X)?0:1}function gn(X){return At.includes(X.toLowerCase())}const Ht={},Kt=X=>{console.error(X)},ut=(X,...Ee)=>{console.log(`WARN: ${X}`,...Ee)},Pe=(X,Ee)=>{Ht[`${X}/${Ee}`]||(console.log(`Deprecated as of ${X}. ${Ee}`),Ht[`${X}/${Ee}`]=!0)},le=new Error;function be(X,Ee,{key:Te}){let mt=0;const Ut=X[Te],Rt={},st={};for(let ve=1;ve<=Ee.length;ve++)st[ve+mt]=Ut[ve],Rt[ve+mt]=!0,mt+=w(Ee[ve-1]);X[Te]=st,X[Te]._emit=Rt,X[Te]._multi=!0}function fe(X){if(Array.isArray(X.begin)){if(X.skip||X.excludeBegin||X.returnBegin)throw Kt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),le;if(typeof X.beginScope!="object"||X.beginScope===null)throw Kt("beginScope must be object"),le;be(X,X.begin,{key:"beginScope"}),X.begin=T(X.begin,{joinWith:""})}}function Oe(X){if(Array.isArray(X.end)){if(X.skip||X.excludeEnd||X.returnEnd)throw Kt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),le;if(typeof X.endScope!="object"||X.endScope===null)throw Kt("endScope must be object"),le;be(X,X.end,{key:"endScope"}),X.end=T(X.end,{joinWith:""})}}function ft(X){X.scope&&typeof X.scope=="object"&&X.scope!==null&&(X.beginScope=X.scope,delete X.scope)}function gt(X){ft(X),typeof X.beginScope=="string"&&(X.beginScope={_wrap:X.beginScope}),typeof X.endScope=="string"&&(X.endScope={_wrap:X.endScope}),fe(X),Oe(X)}function dt(X){function Ee(st,ve){return new RegExp(h(st),"m"+(X.case_insensitive?"i":"")+(X.unicodeRegex?"u":"")+(ve?"g":""))}class Te{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ve,Re){Re.position=this.position++,this.matchIndexes[this.matchAt]=Re,this.regexes.push([Re,ve]),this.matchAt+=w(ve)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ve=this.regexes.map(Re=>Re[1]);this.matcherRe=Ee(T(ve,{joinWith:"|"}),!0),this.lastIndex=0}exec(ve){this.matcherRe.lastIndex=this.lastIndex;const Re=this.matcherRe.exec(ve);if(!Re)return null;const Xe=Re.findIndex((ie,Ct)=>Ct>0&&ie!==void 0),Ie=this.matchIndexes[Xe];return Re.splice(0,Xe),Object.assign(Re,Ie)}}class mt{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ve){if(this.multiRegexes[ve])return this.multiRegexes[ve];const Re=new Te;return this.rules.slice(ve).forEach(([Xe,Ie])=>Re.addRule(Xe,Ie)),Re.compile(),this.multiRegexes[ve]=Re,Re}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ve,Re){this.rules.push([ve,Re]),Re.type==="begin"&&this.count++}exec(ve){const Re=this.getMatcher(this.regexIndex);Re.lastIndex=this.lastIndex;let Xe=Re.exec(ve);if(this.resumingScanAtSamePosition()&&!(Xe&&Xe.index===this.lastIndex)){const Ie=this.getMatcher(0);Ie.lastIndex=this.lastIndex+1,Xe=Ie.exec(ve)}return Xe&&(this.regexIndex+=Xe.position+1,this.regexIndex===this.count&&this.considerAll()),Xe}}function Ut(st){const ve=new mt;return st.contains.forEach(Re=>ve.addRule(Re.begin,{rule:Re,type:"begin"})),st.terminatorEnd&&ve.addRule(st.terminatorEnd,{type:"end"}),st.illegal&&ve.addRule(st.illegal,{type:"illegal"}),ve}function Rt(st,ve){const Re=st;if(st.isCompiled)return Re;[ct,et,gt,Be].forEach(Ie=>Ie(st,ve)),X.compilerExtensions.forEach(Ie=>Ie(st,ve)),st.__beforeBegin=null,[ht,pt,ze].forEach(Ie=>Ie(st,ve)),st.isCompiled=!0;let Xe=null;return typeof st.keywords=="object"&&st.keywords.$pattern&&(st.keywords=Object.assign({},st.keywords),Xe=st.keywords.$pattern,delete st.keywords.$pattern),Xe=Xe||/\w+/,st.keywords&&(st.keywords=on(st.keywords,X.case_insensitive)),Re.keywordPatternRe=Ee(Xe,!0),ve&&(st.begin||(st.begin=/\B|\b/),Re.beginRe=Ee(Re.begin),!st.end&&!st.endsWithParent&&(st.end=/\B|\b/),st.end&&(Re.endRe=Ee(Re.end)),Re.terminatorEnd=h(Re.end)||"",st.endsWithParent&&ve.terminatorEnd&&(Re.terminatorEnd+=(st.end?"|":"")+ve.terminatorEnd)),st.illegal&&(Re.illegalRe=Ee(st.illegal)),st.contains||(st.contains=[]),st.contains=[].concat(...st.contains.map(function(Ie){return Wt(Ie==="self"?st:Ie)})),st.contains.forEach(function(Ie){Rt(Ie,Re)}),st.starts&&Rt(st.starts,ve),Re.matcher=Ut(Re),Re}if(X.compilerExtensions||(X.compilerExtensions=[]),X.contains&&X.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return X.classNameAliases=r(X.classNameAliases||{}),Rt(X)}function Lt(X){return X?X.endsWithParent||Lt(X.starts):!1}function Wt(X){return X.variants&&!X.cachedVariants&&(X.cachedVariants=X.variants.map(function(Ee){return r(X,{variants:null},Ee)})),X.cachedVariants?X.cachedVariants:Lt(X)?r(X,{starts:X.starts?r(X.starts):null}):Object.isFrozen(X)?r(X):X}var rt="11.11.2";class wt extends Error{constructor(Ee,Te){super(Ee),this.name="HTMLInjectionError",this.html=Te}}const Yt=n,an=r,kt=Symbol("nomatch"),xe=7,De=function(X){const Ee=Object.create(null),Te=Object.create(null),mt=[];let Ut=!0;const Rt="Could not find the language '{}', did you forget to load/include a language module?",st={disableAutodetect:!0,name:"Plain text",contains:[]};let ve={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function Re(Ye){return ve.noHighlightRe.test(Ye)}function Xe(Ye){let Nt=Ye.className+" ";Nt+=Ye.parentNode?Ye.parentNode.className:"";const ln=ve.languageDetectRe.exec(Nt);if(ln){const vn=Kn(ln[1]);return vn||(ut(Rt.replace("{}",ln[1])),ut("Falling back to no-highlight mode for this block.",Ye)),vn?ln[1]:"no-highlight"}return Nt.split(/\s+/).find(vn=>Re(vn)||Kn(vn))}function Ie(Ye,Nt,ln){let vn="",Cn="";typeof Nt=="object"?(vn=Ye,ln=Nt.ignoreIllegals,Cn=Nt.language):(Pe("10.7.0","highlight(lang, code, ...args) has been deprecated."),Pe("10.7.0",`Please use highlight(code, options) instead.
|
|
84
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Cn=Ye,vn=Nt),ln===void 0&&(ln=!0);const dn={code:vn,language:Cn};qi("before:highlight",dn);const ri=dn.result?dn.result:ie(dn.language,dn.code,ln);return ri.code=dn.code,qi("after:highlight",ri),ri}function ie(Ye,Nt,ln,vn){const Cn=Object.create(null);function dn(ot,bt){return ot.keywords[bt]}function ri(){if(!Zt.keywords){On.addText(jn);return}let ot=0;Zt.keywordPatternRe.lastIndex=0;let bt=Zt.keywordPatternRe.exec(jn),qt="";for(;bt;){qt+=jn.substring(ot,bt.index);const Qt=Dr.case_insensitive?bt[0].toLowerCase():bt[0],xn=dn(Zt,Qt);if(xn){const[Vn,Ea]=xn;if(On.addText(qt),qt="",Cn[Qt]=(Cn[Qt]||0)+1,Cn[Qt]<=xe&&(or+=Ea),Vn.startsWith("_"))qt+=bt[0];else{const lr=Dr.classNameAliases[Vn]||Vn;pr(bt[0],lr)}}else qt+=bt[0];ot=Zt.keywordPatternRe.lastIndex,bt=Zt.keywordPatternRe.exec(jn)}qt+=jn.substring(ot),On.addText(qt)}function Nr(){if(jn==="")return;let ot=null;if(typeof Zt.subLanguage=="string"){if(!Ee[Zt.subLanguage]){On.addText(jn);return}ot=ie(Zt.subLanguage,jn,!0,ii[Zt.subLanguage]),ii[Zt.subLanguage]=ot._top}else ot=mn(jn,Zt.subLanguage.length?Zt.subLanguage:null);Zt.relevance>0&&(or+=ot.relevance),On.__addSublanguage(ot._emitter,ot.language)}function _r(){Zt.subLanguage!=null?Nr():ri(),jn=""}function pr(ot,bt){ot!==""&&(On.startScope(bt),On.addText(ot),On.endScope())}function Qr(ot,bt){let qt=1;const Qt=bt.length-1;for(;qt<=Qt;){if(!ot._emit[qt]){qt++;continue}const xn=Dr.classNameAliases[ot[qt]]||ot[qt],Vn=bt[qt];xn?pr(Vn,xn):(jn=Vn,ri(),jn=""),qt++}}function $r(ot,bt){return ot.scope&&typeof ot.scope=="string"&&On.openNode(Dr.classNameAliases[ot.scope]||ot.scope),ot.beginScope&&(ot.beginScope._wrap?(pr(jn,Dr.classNameAliases[ot.beginScope._wrap]||ot.beginScope._wrap),jn=""):ot.beginScope._multi&&(Qr(ot.beginScope,bt),jn="")),Zt=Object.create(ot,{parent:{value:Zt}}),Zt}function _i(ot,bt,qt){let Qt=N(ot.endRe,qt);if(Qt){if(ot["on:end"]){const xn=new t(ot);ot["on:end"](bt,xn),xn.isMatchIgnored&&(Qt=!1)}if(Qt){for(;ot.endsParent&&ot.parent;)ot=ot.parent;return ot}}if(ot.endsWithParent)return _i(ot.parent,bt,qt)}function sa(ot){return Zt.matcher.regexIndex===0?(jn+=ot[0],1):(gi=!0,0)}function wi(ot){const bt=ot[0],qt=ot.rule,Qt=new t(qt),xn=[qt.__beforeBegin,qt["on:begin"]];for(const Vn of xn)if(Vn&&(Vn(ot,Qt),Qt.isMatchIgnored))return sa(bt);return qt.skip?jn+=bt:(qt.excludeBegin&&(jn+=bt),_r(),!qt.returnBegin&&!qt.excludeBegin&&(jn=bt)),$r(qt,ot),qt.returnBegin?0:bt.length}function Si(ot){const bt=ot[0],qt=Nt.substring(ot.index),Qt=_i(Zt,ot,qt);if(!Qt)return kt;const xn=Zt;Zt.endScope&&Zt.endScope._wrap?(_r(),pr(bt,Zt.endScope._wrap)):Zt.endScope&&Zt.endScope._multi?(_r(),Qr(Zt.endScope,ot)):xn.skip?jn+=bt:(xn.returnEnd||xn.excludeEnd||(jn+=bt),_r(),xn.excludeEnd&&(jn=bt));do Zt.scope&&On.closeNode(),!Zt.skip&&!Zt.subLanguage&&(or+=Zt.relevance),Zt=Zt.parent;while(Zt!==Qt.parent);return Qt.starts&&$r(Qt.starts,ot),xn.returnEnd?0:bt.length}function $i(){const ot=[];for(let bt=Zt;bt!==Dr;bt=bt.parent)bt.scope&&ot.unshift(bt.scope);ot.forEach(bt=>On.openNode(bt))}let Or={};function Ei(ot,bt){const qt=bt&&bt[0];if(jn+=ot,qt==null)return _r(),0;if(Or.type==="begin"&&bt.type==="end"&&Or.index===bt.index&&qt===""){if(jn+=Nt.slice(bt.index,bt.index+1),!Ut){const Qt=new Error(`0 width match regex (${Ye})`);throw Qt.languageName=Ye,Qt.badRule=Or.rule,Qt}return 1}if(Or=bt,bt.type==="begin")return wi(bt);if(bt.type==="illegal"&&!ln){const Qt=new Error('Illegal lexeme "'+qt+'" for mode "'+(Zt.scope||"<unnamed>")+'"');throw Qt.mode=Zt,Qt}else if(bt.type==="end"){const Qt=Si(bt);if(Qt!==kt)return Qt}if(bt.type==="illegal"&&qt==="")return bt.index===Nt.length||(jn+=`
|
|
85
|
+
`),1;if(Wr>1e5&&Wr>bt.index*3)throw new Error("potential infinite loop, way more iterations than matches");return jn+=qt,qt.length}const Dr=Kn(Ye);if(!Dr)throw Kt(Rt.replace("{}",Ye)),new Error('Unknown language: "'+Ye+'"');const Sa=dt(Dr);let _n="",Zt=vn||Sa;const ii={},On=new ve.__emitter(ve);$i();let jn="",or=0,Xr=0,Wr=0,gi=!1;try{if(Dr.__emitTokens)Dr.__emitTokens(Nt,On);else{for(Zt.matcher.considerAll();;){Wr++,gi?gi=!1:Zt.matcher.considerAll(),Zt.matcher.lastIndex=Xr;const ot=Zt.matcher.exec(Nt);if(!ot)break;const bt=Nt.substring(Xr,ot.index),qt=Ei(bt,ot);Xr=ot.index+qt}Ei(Nt.substring(Xr))}return On.finalize(),_n=On.toHTML(),{language:Ye,value:_n,relevance:or,illegal:!1,_emitter:On,_top:Zt}}catch(ot){if(ot.message&&ot.message.includes("Illegal"))return{language:Ye,value:Yt(Nt),illegal:!0,relevance:0,_illegalBy:{message:ot.message,index:Xr,context:Nt.slice(Xr-100,Xr+100),mode:ot.mode,resultSoFar:_n},_emitter:On};if(Ut)return{language:Ye,value:Yt(Nt),illegal:!1,relevance:0,errorRaised:ot,_emitter:On,_top:Zt};throw ot}}function Ct(Ye){const Nt={value:Yt(Ye),illegal:!1,relevance:0,_top:st,_emitter:new ve.__emitter(ve)};return Nt._emitter.addText(Ye),Nt}function mn(Ye,Nt){Nt=Nt||ve.languages||Object.keys(Ee);const ln=Ct(Ye),vn=Nt.filter(Kn).filter(fr).map(_r=>ie(_r,Ye,!1));vn.unshift(ln);const Cn=vn.sort((_r,pr)=>{if(_r.relevance!==pr.relevance)return pr.relevance-_r.relevance;if(_r.language&&pr.language){if(Kn(_r.language).supersetOf===pr.language)return 1;if(Kn(pr.language).supersetOf===_r.language)return-1}return 0}),[dn,ri]=Cn,Nr=dn;return Nr.secondBest=ri,Nr}function Me(Ye,Nt,ln){const vn=Nt&&Te[Nt]||ln;Ye.classList.add("hljs"),Ye.classList.add(`language-${vn}`)}function Et(Ye){let Nt=null;const ln=Xe(Ye);if(Re(ln))return;if(qi("before:highlightElement",{el:Ye,language:ln}),Ye.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Ye);return}if(Ye.children.length>0&&(ve.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(Ye)),ve.throwUnescapedHTML))throw new wt("One of your code blocks includes unescaped HTML.",Ye.innerHTML);Nt=Ye;const vn=Nt.textContent,Cn=ln?Ie(vn,{language:ln,ignoreIllegals:!0}):mn(vn);Ye.innerHTML=Cn.value,Ye.dataset.highlighted="yes",Me(Ye,ln,Cn.language),Ye.result={language:Cn.language,re:Cn.relevance,relevance:Cn.relevance},Cn.secondBest&&(Ye.secondBest={language:Cn.secondBest.language,relevance:Cn.secondBest.relevance}),qi("after:highlightElement",{el:Ye,result:Cn,text:vn})}function kn(Ye){ve=an(ve,Ye)}const Wn=()=>{dr(),Pe("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ki(){dr(),Pe("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let kr=!1;function dr(){function Ye(){dr()}if(document.readyState==="loading"){kr||window.addEventListener("DOMContentLoaded",Ye,!1),kr=!0;return}document.querySelectorAll(ve.cssSelector).forEach(Et)}function wa(Ye,Nt){let ln=null;try{ln=Nt(X)}catch(vn){if(Kt("Language definition for '{}' could not be registered.".replace("{}",Ye)),Ut)Kt(vn);else throw vn;ln=st}ln.name||(ln.name=Ye),Ee[Ye]=ln,ln.rawDefinition=Nt.bind(null,X),ln.aliases&&Ui(ln.aliases,{languageName:Ye})}function Bs(Ye){delete Ee[Ye];for(const Nt of Object.keys(Te))Te[Nt]===Ye&&delete Te[Nt]}function $t(){return Object.keys(Ee)}function Kn(Ye){return Ye=(Ye||"").toLowerCase(),Ee[Ye]||Ee[Te[Ye]]}function Ui(Ye,{languageName:Nt}){typeof Ye=="string"&&(Ye=[Ye]),Ye.forEach(ln=>{Te[ln.toLowerCase()]=Nt})}function fr(Ye){const Nt=Kn(Ye);return Nt&&!Nt.disableAutodetect}function tn(Ye){Ye["before:highlightBlock"]&&!Ye["before:highlightElement"]&&(Ye["before:highlightElement"]=Nt=>{Ye["before:highlightBlock"](Object.assign({block:Nt.el},Nt))}),Ye["after:highlightBlock"]&&!Ye["after:highlightElement"]&&(Ye["after:highlightElement"]=Nt=>{Ye["after:highlightBlock"](Object.assign({block:Nt.el},Nt))})}function ia(Ye){tn(Ye),mt.push(Ye)}function aa(Ye){const Nt=mt.indexOf(Ye);Nt!==-1&&mt.splice(Nt,1)}function qi(Ye,Nt){const ln=Ye;mt.forEach(function(vn){vn[ln]&&vn[ln](Nt)})}function Hi(Ye){return Pe("10.7.0","highlightBlock will be removed entirely in v12.0"),Pe("10.7.0","Please use highlightElement now."),Et(Ye)}Object.assign(X,{highlight:Ie,highlightAuto:mn,highlightAll:dr,highlightElement:Et,highlightBlock:Hi,configure:kn,initHighlighting:Wn,initHighlightingOnLoad:ki,registerLanguage:wa,unregisterLanguage:Bs,listLanguages:$t,getLanguage:Kn,registerAliases:Ui,autoDetection:fr,inherit:an,addPlugin:ia,removePlugin:aa}),X.debugMode=function(){Ut=!1},X.safeMode=function(){Ut=!0},X.versionString=rt,X.regex={concat:k,lookahead:m,either:S,optional:v,anyNumberOfTimes:x};for(const Ye in ye)typeof ye[Ye]=="object"&&e(ye[Ye]);return Object.assign(X,ye),X},Ke=De({});return Ke.newInstance=()=>De({}),Fg=Ke,Ke.HighlightJS=Ke,Ke.default=Ke,Fg}var DU=OU();const PU=tc(DU),oS={},FU="hljs-";function BU(e){const t=PU.newInstance();return e&&o(e),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:l,registered:u};function n(d,f,p){const h=p||oS,m=typeof h.prefix=="string"?h.prefix:FU;if(!t.getLanguage(d))throw new Error("Unknown language: `"+d+"` is not registered");t.configure({__emitter:zU,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 h=(f||oS).subset||i();let m=-1,x=0,v;for(;++m<h.length;){const k=h[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 i(){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 h=d[p];t.registerAliases(typeof h=="string"?h:[...h],{languageName:p})}}}function u(d){return!!t.getLanguage(d)}}class zU{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],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(l,u){return u?l+"_".repeat(u):n.options.classPrefix+l}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const UU={};function kf(e){const t=e||UU,n=t.aliases,r=t.detect||!1,i=t.languages||LU,o=t.plainText,l=t.prefix,u=t.subset;let d="hljs";const f=BU(i);if(n&&f.registerAlias(n),l){const p=l.indexOf("-");d=p===-1?l:l.slice(0,p)}return function(p,h){Ju(p,"element",function(m,x,v){if(m.tagName!=="code"||!v||v.type!=="element"||v.tagName!=="pre")return;const k=qU(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 _=oz(m,{whitespace:"pre"});let S;try{S=k?f.highlight(k,_,{prefix:l}):f.highlightAuto(_,{prefix:l,subset:u})}catch(w){const N=w;if(k&&/Unknown language/.test(N.message)){h.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&&S.data&&S.data.language&&m.properties.className.push("language-"+S.data.language),S.children.length>0&&(m.children=S.children)})}}function qU(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const i=String(t[n]);if(i==="no-highlight"||i==="nohighlight")return!1;!r&&i.slice(0,5)==="lang-"&&(r=i.slice(5)),!r&&i.slice(0,9)==="language-"&&(r=i.slice(9))}return r}function yu(){function e(t){const n=new Set(["strong","emphasis","delete"]);function r(i){if(i.children)for(let o=0;o<i.children.length;o++){const l=i.children[o];if(n.has(l.type)){if(o>0){const f=i.children[o-1];f.type==="text"?f.value&&/[a-zA-Z0-9]$/.test(f.value)&&!f.value.endsWith(" ")&&!f.value.endsWith(`
|
|
86
|
+
`)&&(f.value+=" "):(i.children.splice(o,0,{type:"text",value:" "}),o++)}const u=o+1,d=u<i.children.length?i.children[u]:null;d&&(d.type==="text"?d.value&&/^[a-zA-Z0-9]/.test(d.value)&&!d.value.startsWith(" ")&&!d.value.startsWith(`
|
|
87
|
+
`)&&(d.value=" "+d.value):n.has(d.type)&&i.children.splice(u,0,{type:"text",value:" "}))}r(l)}}return r(t),t}return e}function bu(){const e=/<!--[\s\S]*?-->/g;function t(r){if(!(!r||typeof r!="object"||!Array.isArray(r.children))&&!(r.type==="code"||r.type==="inlineCode"))for(let i=r.children.length-1;i>=0;i--){const o=r.children[i];if(!(!o||typeof o!="object")){if(o.type==="html"&&typeof o.value=="string"){const l=o.value.replace(e,"");l.trim()===""?r.children.splice(i,1):o.value=l;continue}t(o)}}}function n(r){return t(r),r}return n}function Pf({children:e,language:t,className:n,frameless:r,...i}){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?a.jsxs("div",{className:"relative group rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800/50 my-3",children:[a.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?a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:a.jsx("code",{className:d||void 0,children:e})})]}):a.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:[a.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:[a.jsx("span",{children:t||"code"}),a.jsx("button",{onMouseDown:function(p){p.preventDefault()},onClick:f,className:"flex items-center gap-1 hover:text-gray-200 transition-colors",children:o?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied"]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"]})})]}),a.jsx("pre",{className:"p-4 overflow-x-auto text-sm",...i,children:a.jsx("code",{className:d||void 0,children:e})})]})}function wp(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[i,o]of Object.entries(n))if(!(o==null||o===""))if(typeof o=="boolean")o&&r.push(`--${i}`);else if(Array.isArray(o)){const u=o.some(f=>typeof f=="object"&&f!==null)?JSON.stringify(o):o.map(f=>String(f)).join(", "),d=u.length>60?u.slice(0,60)+"...":u;r.push(`--${i} "${d}"`)}else{const l=typeof o=="object"&&o!==null?JSON.stringify(o):String(o),u=l.length>60?l.slice(0,60)+"...":l;r.push(`--${i} "${u}"`)}return r.length>0?`${e} ${r.join(" ")}`:e||""}}catch{return""}}function nl(e){return typeof e!="string"?e:e.replace(/\x1b\[[0-9;]*[@-~]|\x1b\].*?(?:\x07|\x1b\\)|\x1b[()][AB012]|\x1b[=>]/g,"")}function HU(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 $U(e,t){if(!e||!t)return null;const n=String(e).toLowerCase();if(n!=="write"&&n!=="edit")return null;const r=t.filePath;return typeof r!="string"||!r.trim()?null:r}function WU({filePath:e}){const[t,n]=y.useState(null),[r,i]=y.useState(""),[o,l]=y.useState(!1),u=y.useMemo(()=>vA(e),[e]);if(y.useEffect(()=>{if(!u.candidate)return;let p=!0;return TA([u.rel]).then(h=>{p&&n(h[u.rel]||{exists:!1,size:0})}).catch(()=>{p&&n({exists:!1,size:0})}),()=>{p=!1}},[u]),!kA(u,!!(t&&t.exists)))return null;const d=()=>{l(!0),i(""),AA(u.rel,u.name).catch(p=>{i(p&&p.dlpQuestion&&p.body&&(p.body.question||p.body.error)||p&&p.message||"Download failed.")}).finally(()=>l(!1))},f=_A(t.size);return a.jsxs("div",{className:"mt-2 flex items-center gap-2 flex-wrap text-xs opacity-80",children:[a.jsxs("button",{type:"button",onClick:d,disabled:o,className:"inline-flex items-center gap-1 cursor-pointer hover:opacity-100 font-mono select-none",children:[a.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M7 10l5 5 5-5M12 15V3"})}),a.jsxs("span",{children:["Download ",u.name,f?` · ${f}`:""]})]}),r&&a.jsx("span",{className:"opacity-80 break-words",children:r})]})}function VU({part:e}){const{t}=Gt(),{tool:n,state:r}=e,[i,o]=y.useState(!1);if(!r)return null;const l=r.status||"running",u=r.title||n||t("tool.tool"),d=wp(n||u,r.input),f=r.input&&r.input._purpose?r.input._purpose:null,p=l==="completed"?HU(r.output):null,h=l==="completed"?$U(n,r.input):null,m=!f||i,x={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"},v={running:a.jsxs("svg",{className:"w-4 h-4 text-yellow-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),completed:a.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),error:a.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),pending_confirmation:a.jsx("svg",{className:"w-4 h-4 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 a.jsxs("div",{className:`rounded-lg border-l-4 p-2 xs:p-3 text-xs sm:text-sm ${x[l]||x.running}`,children:[a.jsxs("div",{className:`flex items-center gap-2 ${f?"cursor-pointer select-none":""}`,onClick:f?()=>o(!i):void 0,children:[v[l]||v.running,f?a.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200 flex-1",children:f}):a.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:u}),f&&a.jsx("svg",{className:`w-4 h-4 text-gray-400 shrink-0 transition-transform ${i?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m&&d&&!p&&a.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:[a.jsx("span",{className:"text-green-400 select-none",children:"$ "}),a.jsx("span",{className:"text-gray-100",children:d})]}),h?a.jsx(WU,{filePath:h}):null,p?a.jsxs("div",{className:"mt-2 text-xs text-blue-700 dark:text-blue-300 flex items-center gap-1.5",children:[a.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12l3 3 5-6"})]}),a.jsxs("span",{children:[p.type==="mermaid"?"Mermaid diagram":p.type==="svg"?"SVG illustration":"Math",p.title?a.jsxs(a.Fragment,{children:[": ",a.jsx("span",{className:"font-medium",children:p.title})]}):null," rendered → see ",a.jsx("span",{className:"font-medium",children:"canvas"})," pane"]})]}):r.output&&l==="completed"&&m&&a.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:nl((typeof r.output=="string"?r.output:JSON.stringify(r.output,null,2)).slice(0,600)).slice(0,500)}),r.error&&m&&a.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:nl(typeof r.error=="string"?r.error:r.error.message||"Error")})]})}function GU({part:e}){const{tool:t,state:n}=e,[r,i]=y.useState(!1);if(!n)return null;const o=n.status||"running",l=n.title||t||"Tool",u=wp(t||l,n.input),d=n.input&&n.input._purpose?n.input._purpose:null,f=!d||r;return a.jsxs("div",{className:"py-1",children:[a.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${d?"cursor-pointer select-none":""}`,onClick:d?()=>i(!r):void 0,children:[o==="running"&&a.jsxs("svg",{className:"w-3 h-3 text-gray-400 animate-spin shrink-0",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o==="completed"&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o==="error"&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),o==="pending_confirmation"&&a.jsx("svg",{className:"w-3 h-3 text-blue-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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?a.jsx("span",{className:"font-medium truncate flex-1",children:d}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-medium truncate",children:l}),u&&a.jsx("span",{className:"font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u})]}),d&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),f&&u&&a.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-400 dark:text-gray-500 truncate",children:u}),n.output&&o==="completed"&&f&&a.jsx("div",{className:"mt-1 font-mono text-[11px] text-gray-500 dark:text-gray-400 break-all whitespace-pre-wrap truncate",children:nl(typeof n.output=="string"?n.output:JSON.stringify(n.output,null,2)).slice(0,500)}),n.error&&f&&a.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:nl(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)}),n.error&&!f&&a.jsx("div",{className:"mt-1 text-[11px] text-red-500 dark:text-red-400 truncate",children:nl(typeof n.error=="string"?n.error:n.error.message||"Error").slice(0,120)})]})}function KU({text:e,isStreaming:t}){const{t:n}=Gt(),[r,i]=y.useState(!1),o=e&&e.trim().length>0,l=t&&!r?(e||"").slice(-400).replace(/\s+/g," ").trim():"";return a.jsxs("div",{className:"py-1",children:[a.jsxs("div",{className:`flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 ${o?"cursor-pointer select-none":""}`,onClick:o?()=>i(!r):void 0,children:[t?a.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:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),a.jsx("span",{className:`font-medium shrink-0 ${l?"":"flex-1"}`,children:n("chat.thinking")}),l&&a.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&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),r&&o&&a.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:a.jsx(mu,{remarkPlugins:[xu,yu,bu],children:e})})]})}function YU(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 Bg=2500,_f=5,au=new Map;function QU(e){return typeof e=="string"?e:e&&typeof e=="object"&&(e.text||e.label)||String(e)}function XU({part:e,questionId:t,questions:n}){const{t:r}=Gt(),{state:i}=e,o=i&&i.status||"running",l=i&&i.input||{},u=Array.isArray(n)&&n.length>0?n:Array.isArray(l.questions)&&l.questions.length>0?l.questions:[{text:"(no question)",options:void 0}],d=o==="completed",f=o==="error",p=i&&i.output||"",[h,m]=y.useState({}),[x,v]=y.useState({}),[k,_]=y.useState(null),[S,w]=y.useState(null),[N,R]=y.useState(t),[T,C]=y.useState(0),[M,I]=y.useState(()=>{const W=e.callID||e.id,ee=W&&au.get(W);return!!(ee&&ee.attempts>=_f)}),A=y.useRef(!0),L=y.useRef(null),D=y.useRef(null);y.useEffect(()=>{t&&R(t)},[t]);const $=e.callID||e.id||null;y.useEffect(()=>{if(!i||d||f||N||!$)return;let W=au.get($);W||(W={attempts:0,lastAt:0},au.set($,W)),D.current=W;let ee=!1,F=null;const J=()=>{if(!(ee||!A.current)){if(W.attempts>=_f){I(!0);return}F=setTimeout(q,Bg)}},q=()=>{ee||!A.current||W.attempts>=_f||(W.attempts+=1,W.lastAt=Date.now(),jO().then(Y=>{if(ee||!A.current)return;const oe=Array.isArray(Y&&Y.pending)?Y.pending:[];for(var _e=0;_e<oe.length;_e++){var ae=oe[_e],ye=ae.tool&&ae.tool.callID?ae.tool.callID:null;if(ye===$&&ae.id){au.delete($),I(!1),R(ae.id);return}}J()}).catch(()=>{J()}))};if(W.attempts<_f){const Y=Date.now()-W.lastAt;W.attempts===0||Y>=Bg?q():F=setTimeout(q,Bg-Y)}return()=>{ee=!0,F&&clearTimeout(F)}},[i,d,f,N,$,T]);const te=y.useCallback(()=>{$&&au.delete($),I(!1),C(W=>W+1)},[$]);y.useEffect(()=>()=>{A.current=!1},[]),y.useEffect(()=>{!d&&L.current&&(L.current.focus(),L.current.scrollIntoView({behavior:"smooth",block:"center"}))},[d]);const V=W=>{var ee,F;return(((ee=h[W])==null?void 0:ee.length)??0)>0||(((F=x[W])==null?void 0:F.trim().length)??0)>0},z=u.every((W,ee)=>V(ee)),G=(W,ee,F)=>{m(J=>{const q=J[W]??[];return F?{...J,[W]:q.includes(ee)?q.filter(Y=>Y!==ee):[...q,ee]}:{...J,[W]:q.includes(ee)?[]:[ee]}})},K=y.useCallback(async()=>{if(!z||!N)return;const W=u.map((ee,F)=>{var Y;const J=h[F]??[],q=(Y=x[F])==null?void 0:Y.trim();return q?[...J,q]:J});_("reply"),w(null);try{const ee=await TO(N,W);if(!A.current)return;ee&&ee.success===!1&&(w(ee.error||"Failed to reply"),_(null))}catch(ee){if(!A.current)return;w(ee.message||"Failed to reply"),_(null)}},[N,u,h,x,z]),H=y.useCallback(async()=>{if(N){_("reject"),w(null);try{const W=await RO(N);if(!A.current)return;W&&W.success===!1&&(w(W.error||"Failed to dismiss"),_(null))}catch(W){if(!A.current)return;w(W.message||"Failed to dismiss"),_(null)}}},[N]);if(!i)return null;const se=W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),K())};if(d)return a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.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:a.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"})}),a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")}),a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),u.map((W,ee)=>a.jsxs("div",{className:ee>0?"pt-2 mt-2 border-t border-gray-200 dark:border-gray-700":"",children:[a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1 whitespace-pre-wrap",children:W.text}),p&&a.jsx("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:ZU(p,ee,u.length)})]},ee))]});if(f)return null;let P=!1;return a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.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:a.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"})}),a.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400",children:r("question.title")})]}),u.map((W,ee)=>{const F=Array.isArray(W.options)?W.options:[],J=F.length>0,q=W.multiple===!0,Y=W.custom!==!1,oe=h[ee]??[],_e=Y&&!P;return _e&&(P=!0),a.jsxs("div",{className:ee>0?"pt-3 mt-3 border-t border-gray-200 dark:border-gray-700":"",children:[(W.header||q)&&a.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[W.header&&a.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:W.header}),q&&a.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-gray-400 dark:text-gray-500",children:r("question.select_all")})]}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2 whitespace-pre-wrap",children:W.text}),J&&a.jsx("div",{className:"flex flex-col gap-1.5 mb-2",children:F.map((ae,ye)=>{const Fe=QU(ae),ct=oe.includes(Fe);return a.jsx("button",{onClick:()=>G(ee,Fe,q),disabled:k!==null,className:`text-left px-3 py-2 text-sm rounded-md border transition-colors ${ct?"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":ct,children:Fe},ye)})}),Y&&a.jsx("input",{ref:_e?L:void 0,type:"text",value:x[ee]??"",onChange:ae=>v(ye=>({...ye,[ee]:ae.target.value})),onKeyDown:se,disabled:k!==null,placeholder:r(J?"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"})]},ee)}),S&&a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3 mb-2",children:S}),!N&&!d&&!M&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-2",children:r("question.reconnecting")||"Reconnecting…"}),!N&&!d&&M&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:r("question.resolve_failed")||"Could not reach the question service."}),a.jsx("button",{onClick:te,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:r("question.retry_connection")||"Retry"})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[a.jsx("button",{onClick:H,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:r(k==="reject"?"question.dismissing":"question.dismiss")}),a.jsx("button",{onClick:K,disabled:k!==null||!z||!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"?r("question.submitting"):u.length>1?r("question.submit_n",{count:u.length}):r("question.submit")})]})]})}function ZU(e,t,n){if(n===1){const o="User's answer: ";return e.startsWith(o)?e.slice(o.length):e}const r=e.split(`
|
|
88
|
+
`),i=`[${t+1}] `;for(const o of r)if(o.startsWith(i))return o.slice(i.length);return e}function JU({sessionId:e}){const{t}=Gt(),[n,r]=y.useState(null),[i,o]=y.useState(!1),[l,u]=y.useState(null),[d,f]=y.useState(!1),[p,h]=y.useState(null),m=y.useRef(null),x=n!==null;y.useEffect(()=>{if(!i)return;const w=N=>{N.key==="Escape"&&(N.stopPropagation(),o(!1))};return window.addEventListener("keydown",w),m.current&&m.current.focus(),()=>window.removeEventListener("keydown",w)},[i]);const v=async()=>{if(!(x||!e)){o(!0),f(!0),h(null);try{const{content:w}=await k3(e);u(typeof w=="string"?w:"")}catch(w){console.error("Failed to load PLAN.md:",w),h(t("planCard.loadError"))}finally{f(!1)}}},k=()=>{x||(r("executed"),window.dispatchEvent(new CustomEvent("pave:plan-execute")))},_=()=>{x||r("dismissed")},S="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 a.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:[a.jsx("div",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:t("planCard.heading")}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("button",{type:"button",onClick:v,disabled:x||d||!e,className:S+" 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")}),a.jsx("button",{type:"button",onClick:k,disabled:x,className:S+" 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")}),a.jsx("button",{type:"button",onClick:_,disabled:x,className:S+" 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&&a.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400","aria-live":"polite",children:t(n==="executed"?"planCard.executedStatus":"planCard.dismissedStatus")}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>o(!1),children:a.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:w=>w.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 dark:border-gray-700 px-4 py-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"PLAN.md"}),a.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?a.jsx("div",{className:"px-4 py-6 text-xs text-gray-500 dark:text-gray-400",children:t("planCard.loading")}):p?a.jsx("div",{className:"px-4 py-6 text-xs text-red-600 dark:text-red-400",children:p}):a.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 eq="plan.md";function tq(e){const t=String(e).split(/[\\/]/);return t[t.length-1]||""}function nq(e){return typeof e!="string"||!e?!1:tq(e).toLowerCase()===eq}function rq(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||{};nq(r.filePath)&&(t={content:typeof r.content=="string"?r.content:null})}return t}function f1(e,t,n=!1){if(t){const r=Object.values(t).filter(i=>i.type==="reasoning"&&n?!1:i.type==="text"||i.type==="reasoning"||i.type==="error").map(i=>i.text||i.delta||"").join(`
|
|
89
|
+
|
|
90
|
+
`);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(`
|
|
91
|
+
|
|
92
|
+
`)}function iq(e,t,n){const r=f1(e,t,n);if(!e||e.length===0)return r;const i=[];for(let o=0;o<e.length;o++){const l=e[o];if(l.type!=="tool")continue;const u=l.tool||l.state&&l.state.title||"",d=l.state||{},f=d.input||{},p=[];u&&p.push(u),f._purpose&&p.push(f._purpose);const h=Object.keys(f).filter(m=>m!=="_purpose");if(h.length>0){const m={};for(let x=0;x<h.length;x++)m[h[x]]=f[h[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&&!(l.tool==="question"&&d.status==="error")){const m=typeof d.error=="string"?d.error:d.error.message||String(d.error);p.push(m)}p.length>0&&i.push(p.join(`
|
|
93
|
+
`))}return i.length===0?r:r+`
|
|
94
|
+
|
|
95
|
+
`+i.join(`
|
|
96
|
+
|
|
97
|
+
`)}function aq(e){let t=e;return t=t.replace(/```[\s\S]*?```/g,`
|
|
98
|
+
`),t=t.replace(/(^|\n)\n((?:(?: {4}|\t).+\n?)+)/g,`$1
|
|
99
|
+
`),t=t.replace(/^((?:(?: {4}|\t).+\n?)+)/,`
|
|
100
|
+
`),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=t.replace(/<!--[\s\S]*?-->/g," "),t}const sq=5,oq=2e3,lq=6e3,mk="… [truncated]",cq=/^\*\*Quoted from (assistant|you)(?:, (.+?))?:\*\*$/,H5="```text",$5="```";let lS=0;function uq(){return lS+=1,"q-"+Date.now()+"-"+lS}function p1(e,t=oq){if(typeof e!="string")return"";const n=e.replace(/\r\n?/g,`
|
|
101
|
+
`).replace(/^\n+/,"").replace(/\s+$/,"");return n.length<=t?n:n.slice(0,t)+mk}function dq(e){return e.reduce((t,n)=>n&&typeof n.text=="string"?t+n.text.length:t,0)}function fq(e,t){const n=Array.isArray(e)?e:[];if(n.length>=sq)return!1;const r=p1(t);return r?dq(n)+r.length<=lq:!1}function pq(e,t){const n=e==="assistant"?"Quoted from assistant":"Quoted from you",r=typeof t=="string"?t.trim():"";return r?n+", "+r+":":n+":"}function hq(e){return e?"> "+e:">"}function cS(e,t){for(const n of t.split(`
|
|
102
|
+
`))e.push(hq(n))}function gq(e){const t=e||{},n=["> **"+pq(t.sourceRole,t.sourceTime)+"**"],r=p1(t.text);return t.fromCode===!0?(n.push("> "+H5),cS(n,r),n.push("> "+$5)):cS(n,r),n.join(`
|
|
103
|
+
`)}function mq(e,t){if(!Array.isArray(e)||e.length===0)return t;const n=String(t||"").trim(),r=e.map(i=>gq(i)).join(`
|
|
104
|
+
|
|
105
|
+
`);return n?r+`
|
|
106
|
+
|
|
107
|
+
`+n:r}function h1(e){return typeof e!="string"||e.charAt(0)!==">"?null:e.charAt(1)===" "?e.slice(2):e.slice(1)}function W5(e){if(e===null)return null;const t=cq.exec(e.trim());return t?t[0].slice(2,-2):null}function xq(e,t){const n=[];let r=t;for(;r<e.length;){const u=h1(e[r]);if(u===null)break;n.push(u),r+=1}const i=n[n.length-1],o=n.length>=2&&n[0]===H5&&i===$5;return{body:(o?n.slice(1,-1):n).join(`
|
|
108
|
+
`),fromCode:o,next:r}}function yq(e){const t=[];let n=0,r=0;for(;n<e.length;){const i=W5(h1(e[n]));if(i===null)break;const o=xq(e,n+1);t.push({header:i,body:o.body,fromCode:o.fromCode}),n=o.next,r=n,e[n]===""&&(n+=1)}return{quotes:t,end:r}}function bq(e,t){return t>=e.length?"":e.slice(t).join(`
|
|
109
|
+
`).replace(/^\n+/,"")}function vq(e){if(typeof e!="string"||e==="")return{quotes:[],rest:""};const t=e.split(`
|
|
110
|
+
`);if(W5(h1(t[0]))===null)return{quotes:[],rest:e};const n=yq(t);return{quotes:n.quotes,rest:bq(t,n.end)}}function kq(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 _q(e){return typeof e=="string"&&e.trim()!==""}function wq(){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 Sq(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 Eq(e){let t=null;try{t=wq()}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,i=!1;try{document.body.appendChild(n),i=!0,n.select(),typeof document.execCommand=="function"&&(r=document.execCommand("copy")===!0)}catch{r=!1}try{i&&document.body.removeChild(n)}catch{}return Sq(t),r}async function Sp(e){if(!_q(e))return!1;try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(e),!0}catch{}try{return Eq(e)}catch{return!1}}const V5=e=>e&&e.type==="element"&&(e.tagName==="td"||e.tagName==="th");function G5(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++)G5(n[r],t)}function Nq(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 i=e.charAt(0)==="`"||e.charAt(e.length-1)==="`"?" ":"";return r+i+e+i+r}function K5(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+=K5(t[r]);return n}function xk(e,t){return e.properties&&e.properties[t]||""}function Cq(e,t){const n=xk(e,"href");return n?`[${t}](${n})`:t}function jq(e){const t=xk(e,"src"),n=xk(e,"alt");return t?``:""}const Tq={strong:["**","**"],em:["*","*"],del:["~~","~~"]};function Rq(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=Y5(e);if(t==="code")return Nq(K5(e));if(t==="a")return Cq(e,n);if(t==="img")return jq(e);const r=Tq[t];return r?`${r[0]}${n}${r[1]}`:n}function Y5(e){const t=e.children||[];let n="";for(let r=0;r<t.length;r++)n+=Rq(t[r]);return n}function Aq(e){return Y5(e).replace(/\|/g,"\\|").replace(/[\r\n]+/g," ").trim()}function Iq(e,t){const n=(e.children||[]).filter(V5),r=[];for(let i=0;i<t;i++){const o=n[i]&&n[i].properties&&n[i].properties.align;r.push(o==="center"?":---:":o==="right"?"---:":o==="left"?":---":"---")}return`| ${r.join(" | ")} |`}function Mq(e){if(!e||e.type!=="element"||e.tagName!=="table")return"";const t=[];if(G5(e,t),t.length===0)return"";const n=t.map(o=>(o.children||[]).filter(V5).map(Aq));let r=0;for(let o=0;o<n.length;o++)n[o].length>r&&(r=n[o].length);if(r===0)return"";const i=n.map(o=>{const l=o.slice();for(;l.length<r;)l.push("");return`| ${l.join(" | ")} |`});return i.splice(1,0,Iq(t[0],r)),i.join(`
|
|
111
|
+
`)}const Lq="bg-primary-500 text-white rounded-2xl rounded-br-md px-4 py-2.5",Oq="previewUrl";function zg(e){if(!e||typeof e!="object")return null;var t=e[Oq];if(typeof t!="string"||t.indexOf("data:image/")!==0)return null;var n=t.indexOf(";"),r=n>5?t.substring(5,n).toLowerCase():"";return["image/png","image/jpeg","image/jpg","image/gif","image/webp"].indexOf(r)!==-1?t:null}function Q5(e){if(!e)return null;var t=e.nodeType===1?e:e.parentElement;return!t||!t.closest?null:t.closest("[data-message-id]")}function Dq(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()&&Q5(t.anchorNode)===e?n:""}function Pq({node:e}){var[t,n]=y.useState(!1),r=y.useRef(null),i=y.useRef(!0);y.useEffect(function(){return i.current=!0,function(){i.current=!1,r.current&&clearTimeout(r.current)}},[]);var o=function(){Sp(Mq(e)).then(function(l){!l||!i.current||(n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(function(){i.current&&n(!1)},2e3))})};return a.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 Fq({descriptor:e,plain:t}){const n=e,[r,i]=y.useState(null),[o,l]=y.useState(null),[u,d]=y.useState(""),[f,p]=y.useState(!1);y.useEffect(()=>{if(!n.candidate)return;let _=!0;return TA([n.rel]).then(S=>{_&&i(S[n.rel]||{exists:!1,size:0})}).catch(()=>{_&&i({exists:!1,size:0})}),()=>{_=!1}},[n]),y.useEffect(()=>{if(!o||!o.url)return;const _=o.url;return()=>{URL.revokeObjectURL(_)}},[o]);const h=_=>{if(_&&_.dlpQuestion){const S=_.body&&(_.body.question||_.body.error);d(S||"The download needs your answer before the file exists.")}else d(_&&_.message||"Download failed.")},m=_=>{_.preventDefault(),p(!0),d(""),AA(n.rel,n.name).catch(h).finally(()=>p(!1))},x=async _=>{if(_.preventDefault(),o){l(null);return}p(!0),d("");try{const S=await RA(n.rel);if(n.type==="image")l({kind:"image",url:URL.createObjectURL(S.blob)});else{const w=await S.blob.text();l({kind:"text",text:w.slice(0,2e5)})}}catch(S){h(S)}finally{p(!1)}};if(!kA(n,!!(r&&r.exists)))return t;const v=_A(r.size),k=y.cloneElement(t,{href:ar("/api/files/file?path="+encodeURIComponent(n.rel)),onClick:m});return a.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1 align-baseline",children:[k,a.jsxs("button",{type:"button",onClick:m,disabled:f,className:"inline-flex items-center gap-1 align-baseline cursor-pointer opacity-70 hover:opacity-100 font-mono text-xs select-none",children:[a.jsx("svg",{className:"w-3 h-3 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M7 10l5 5 5-5M12 15V3"})}),a.jsxs("span",{children:["Download",v?` · ${v}`:""]})]}),n.viewable&&a.jsx("button",{type:"button",onClick:x,disabled:f,className:"inline-flex items-center align-baseline cursor-pointer opacity-70 hover:opacity-100 font-mono text-xs select-none",children:o?"Hide preview":"Preview"}),u&&a.jsx("span",{className:"w-full text-xs opacity-70 break-words",children:u}),o&&o.kind==="image"&&a.jsx("span",{className:"w-full block my-1 max-w-full",children:a.jsx("img",{src:o.url,alt:n.name,className:"block max-w-full max-h-64 object-contain"})}),o&&o.kind==="text"&&a.jsx("span",{className:"w-full block my-1 max-w-full font-mono text-xs whitespace-pre-wrap break-words overflow-y-auto max-h-64",children:o.text})]})}function uS(e){return{pre:function({node:t,children:n,...r}){if(y.isValidElement(n)){var i=n.type;if(i==="code"||typeof i=="string"&&i.toLowerCase()==="code"){var o=n.props||{},l=o.className||"",u=l.match(/language-(\S+)/),d=u?u[1]:"",f=Au(o.children);return a.jsx(Pf,{language:d,className:l,frameless:e,children:f})}}var p=Au(n);return p?a.jsx(Pf,{language:"",className:"",frameless:e,children:p}):a.jsx("pre",{...r,children:n})},code:function({node:t,className:n,children:r,...i}){if(n&&n.indexOf("language-")!==-1){var o=n.match(/language-(\S+)/),l=o?o[1]:"";return a.jsx(Pf,{language:l,className:n,frameless:e,children:Au(r)})}return a.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",...i,children:r})},a:function({node:t,children:n,href:r,...i}){const o=a.jsx("a",{href:r,...i,target:"_blank",rel:"noopener noreferrer",children:n}),l=vA(r);return l.candidate?a.jsx(Fq,{descriptor:l,plain:o}):o},table:function({node:t,children:n,...r}){return a.jsxs("div",{className:e?"my-3":"",children:[a.jsx("div",{className:"overflow-x-auto",children:a.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})}),a.jsx("div",{className:"flex justify-end mt-1",children:a.jsx(Pq,{node:t})})]})},th:function({node:t,children:n,...r}){return a.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 a.jsx("td",{className:e?"px-3 py-1.5 border-b border-gray-100 dark:border-gray-800":"",...r,children:n})}}}function Bq({message:e,parts:t,streamingParts:n,user:r,searchQuery:i,matchOffset:o,matchCount:l,activeMatchIndex:u,registerMatchRef:d,onRetry:f,onEditAndResend:p,onCancelQueued:h,hideToolBubbles:m,mobileFrameless:x,hideThinking:v,isPrivate:k,isLast:_,isBusy:S,sessionID:w,questionIdMap:N,isCompactedOut:R,onQuoteAdd:T}){var{t:C}=Gt(),M=e.role==="user",I=!M&&_&&!S?rq(t)!==null:!1,[A,L]=y.useState(!1);y.useEffect(function(){I&&cg()&&L(!0)},[I,cg()]);var D=I&&(A||cg()),$=M&&e._queued===!0,te=r!=null&&r.name?r.name.charAt(0).toUpperCase():"U",[V,z]=y.useState(!1),[G,K]=y.useState(!1),[H,se]=y.useState(""),[P,W]=y.useState(!1),ee=y.useRef(null),F=y.useRef(!0),J=y.useRef(null);y.useEffect(function(){var Ie=J.current;!Ie||!G||(Ie.style.height="auto",Ie.style.height=Math.min(Ie.scrollHeight,300)+"px")},[H,G]),y.useEffect(function(){return F.current=!0,function(){F.current=!1,ee.current&&clearTimeout(ee.current)}},[]);var q=f1(t,n,v),Y=(t||[]).filter(function(Ie){return Ie.type==="tool"}),oe=(t||[]).filter(function(Ie){return Ie.type==="file"&&Ie.filename&&!zg(Ie)}),_e=(t||[]).filter(function(Ie){if(Ie.type!=="image_url"||!Ie.image_url)return!1;var ie=Ie.image_url.url||Ie.image_url;if(typeof ie!="string")return!1;if(ie.startsWith("data:image/")){var Ct=ie.indexOf(";"),mn=Ct>5?ie.substring(5,Ct).toLowerCase():"",Me=["image/png","image/jpeg","image/jpg","image/gif","image/webp"];return Me.indexOf(mn)!==-1}if(ie.startsWith("https://"))try{var Et=new URL(ie),kn=Et.pathname.toLowerCase();return!kn.endsWith(".svg")&&!kn.endsWith(".svgz")}catch{return!1}return!1}),ae=(t||[]).filter(function(Ie){return Ie.type==="file"&&!!zg(Ie)}).map(function(Ie){return{id:Ie.id,image_url:{url:zg(Ie)}}});ae.length>0&&(_e=_e.concat(ae));var ye=x&&!M,Fe=y.useRef({current:0});Fe.current={current:0};var ct=y.useRef(null);ct.current={searchQuery:i,matchCount:l,matchOffset:o,activeMatchIndex:u,registerMatchRef:d};var ht=y.useMemo(function(){return uS(ye)},[ye]),pt=y.useMemo(function(){if(!i)return null;var Ie=ht,ie=uS(ye),Ct=function(mn){return function({children:Me,node:Et,...kn}){var Wn=ct.current;return Wn.matchCount>0?a.jsx(mn,{...kn,children:yk(Me,Wn.searchQuery,Wn.matchOffset,Fe.current,Wn.activeMatchIndex,Wn.registerMatchRef)}):a.jsx(mn,{...kn,children:Me})}};return ie.td=Ct(Ie.td),ie.th=Ct(Ie.th),ie.p=Ct("p"),ie.li=Ct("li"),ie.h1=Ct("h1"),ie.h2=Ct("h2"),ie.h3=Ct("h3"),ie.h4=Ct("h4"),ie.h5=Ct("h5"),ie.h6=Ct("h6"),ie.blockquote=Ct("blockquote"),ie},[ye,i,ht,Fe,ct]);if(!M){var et=!!q,ze=_e.length>0,Be=Y.length>0,At=Y.some(function(Ie){if((Ie.tool||Ie.state&&Ie.state.title||"")==="question")return!0;var ie=Ie.callID||Ie.id||"";return!!(ie&&N&&N[ie])}),lt=!m||At,on=(t||[]).some(function(Ie){return Ie.type==="reasoning"&&Ie.text}),_t=!1;if(n)for(var gn=Object.keys(n),Ht=0;Ht<gn.length;Ht++){var Kt=n[gn[Ht]];if(Kt&&Kt.type==="reasoning"&&(Kt.text||Kt.delta)){_t=!0;break}}var ut=on||_t,Pe=(t||[]).some(function(Ie){return Ie.type==="error"&&Ie.text});if(!YU({hasText:et,hasImages:ze,hasTools:Be,toolsVisibleHere:lt,hasReasoning:ut,hasError:Pe,isFrameless:x,hideThinking:v,finish:e.finish}))return null}var le=Uq(e.time,C),be=e.isAutoInjected===!0,fe=e.isCompaction===!0,Oe=e.isContinuation===!0,ft=fe&&!Oe,gt=M&&be&&!fe,dt=null,Lt="",Wt="";if(gt){var rt=String(q||""),wt=rt.split(`
|
|
112
|
+
`)[0]||"",Yt=wt.indexOf("[session-mail from ")===0,an=Yt?rt.split(`
|
|
113
|
+
`).slice(1).join(`
|
|
114
|
+
`):rt;if(e.mailbox&&e.mailbox.senderSessionID)dt="mail",Lt=e.mailbox.senderSessionTitle||String(e.mailbox.senderSessionID).slice(0,10);else if(Yt){var kt=wt.slice(19),xe=kt.indexOf(' — "'),De=kt,Ke="";xe!==-1&&(De=kt.slice(0,xe),Ke=kt.slice(xe+4).replace('"]',"")),dt="mail",Lt=Ke||De.replace(/\]$/,"").slice(0,10)}else e.injectedVia==="idle-injection"?dt="idle":e.injectedVia==="scheduled-injection"?dt="scheduled":dt="auto";Wt=an.replace(/\s+/g," ").trim(),Wt.length>140&&(Wt=Wt.slice(0,139)+"…")}var X=function(){var Ie=q||"";navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(Ie).then(function(){F.current&&(z(!0),ee.current&&clearTimeout(ee.current),ee.current=setTimeout(function(){F.current&&z(!1)},2e3))}).catch(function(){F.current&&Ee(Ie)}):Ee(Ie)},Ee=function(Ie){var ie=document.createElement("textarea");ie.value=Ie,ie.style.position="fixed",ie.style.opacity="0",document.body.appendChild(ie),ie.select();try{document.execCommand("copy")}catch{}finally{document.body.removeChild(ie)}F.current&&(z(!0),ee.current&&clearTimeout(ee.current),ee.current=setTimeout(function(){F.current&&z(!1)},2e3))},Te=function(){se(q||""),K(!0)},mt=function(){K(!1),se("")},Ut=function(){H.trim()&&($&&h&&h(e.id),p&&p(H.trim())),K(!1),se("")},Rt=function(Ie){if(T){var ie=Q5(Ie?Ie.currentTarget:null),Ct=ie?Dq(ie):"";T({text:Ct||q||"",sourceMessageID:e.id,sourceRole:M?"user":"assistant",sourceTime:le||"",fromCode:!1})}};if(dt&&!P)return a.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":M?"user":"assistant","data-message-time":le||void 0,"data-injected-collapsed":"true",onClick:function(){W(!0)},children:[a.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:[a.jsx("span",{"aria-hidden":"true",children:dt==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),dt==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),dt==="mail"&&Lt?a.jsx("span",{className:"shrink-0 max-w-[160px] truncate text-[11px] text-gray-500 dark:text-gray-400",children:Lt}):null,a.jsx("span",{className:"flex-1 min-w-0 truncate text-xs text-gray-600 dark:text-gray-300",children:Wt||"…"}),a.jsx("button",{onMouseDown:function(Ie){Ie.preventDefault()},onClick:function(Ie){Ie.stopPropagation(),X()},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":C(V?"chat.copied":"chat.copy_message"),title:C(V?"chat.copied":"chat.copy_message"),children:V?a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.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 st=null;if(M){var ve=Oe?C("compaction.continuation_message_label")||"Compaction done. Please continue.":fe?C("compaction.user_message_label")||"Summarizing our conversation to keep things efficient.":q;if(i&&l>0&&!fe&&!Oe)st=qq(q||"",i,o,u,d);else{var Re=vq(q||"");if(Re.quotes.length>0&&!fe&&!Oe){var Xe=Re.rest;st=a.jsxs(y.Fragment,{children:[Re.quotes.map(function(Ie,ie){return a.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:[a.jsx("div",{className:"font-medium",children:Ie.header}),a.jsx("div",{children:Ie.body})]},"quote-"+ie)}),Xe?a.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:Xe}):null]})}else st=a.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:ve})}}return a.jsxs("div",{className:`group flex gap-3 ${M?"justify-end":"justify-start"} ${$?"opacity-60 italic":""}${R&&!ft?" opacity-60":""}`,"data-message-id":e.id,"data-message-role":M?"user":"assistant","data-message-time":le||void 0,"data-compacted-out":R?"true":void 0,children:[!M&&!ye&&a.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?a.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,children:a.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"})}):a.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),a.jsxs("div",{className:`flex flex-col min-w-0 ${ye?"w-full":"max-w-[70%] 3xs:max-w-[75%] xs:max-w-[80%] sm:max-w-[85%]"}`,children:[a.jsx("div",{className:`min-w-0 overflow-hidden ${M?`${Lq}${$&&!G?" cursor-pointer ring-2 ring-dashed ring-white/30 hover:ring-white/50 transition-shadow":""}`:ye?"":`${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`}`,...$&&!G&&p&&h?{onClick:Te,title:C("chat.edit_resend"),role:"button",tabIndex:0,onKeyDown:function(Ie){(Ie.key==="Enter"||Ie.key===" ")&&(Ie.preventDefault(),Te())}}:{},children:M?G?a.jsxs("div",{className:"space-y-2",children:[a.jsx("textarea",{ref:J,value:H,onChange:function(Ie){se(Ie.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}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx("button",{onClick:mt,className:"px-3 py-1 text-xs rounded-lg bg-white/20 hover:bg-white/30 transition-colors",children:"Cancel"}),a.jsx("button",{onClick:Ut,className:"px-3 py-1 text-xs rounded-lg bg-white/30 hover:bg-white/40 font-medium transition-colors",children:"Send"})]})]}):a.jsxs("div",{className:"text-sm whitespace-pre-wrap break-words",children:[dt?a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5 text-[11px] text-white/85",children:[a.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:[a.jsx("span",{"aria-hidden":"true",children:dt==="mail"?"✉":e.injectedVia==="idle-injection"?"⏰":e.injectedVia==="scheduled-injection"?"📅":"⏱"}),dt==="mail"?"session-mail":e.injectedVia==="idle-injection"?"wake":e.injectedVia==="scheduled-injection"?"schedule":"auto"]}),dt==="mail"&&Lt?a.jsx("span",{className:"max-w-[160px] truncate opacity-80",children:Lt}):null,a.jsx("button",{onClick:function(){W(!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:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})})]}):null,st,oe.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:oe.map(function(Ie,ie){return a.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:Ie.mime||"",children:[a.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:a.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"})}),a.jsx("span",{className:"truncate",children:Ie.filename})]},Ie.id||"file-"+ie)})}),_e.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:_e.map(function(Ie,ie){var Ct=Ie.image_url.url||Ie.image_url;return a.jsx("a",{href:Ct,target:"_blank",rel:"noopener noreferrer",children:a.jsx("img",{src:Ct,alt:C("chat.attachment_with_index",{index:ie+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},Ie.id||"img-"+ie)})})]}):zq(t,n,_e,oe,ht,pt,m,v,C,ye,N,_,S,e.finish)}),D&&a.jsx(JU,{sessionId:w}),a.jsxs("div",{className:`flex items-center gap-1.5 mt-1 px-1 ${M?"justify-end":"justify-start"}`,children:[le&&a.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:le}),be&&a.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:C("chat.idle_injection_auto_badge")}),(!S||!_)&&(e.finish==="aborted"||e.finish==="interrupted")&&a.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"?C("chat.stopped_badge")||"Stopped":C("chat.interrupted_badge")||"Interrupted"}),e.finish==="error"&&a.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:C("chat.error_badge")||"Error"}),e.moeTopK&&e.moeTopK>0&&a.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"}),a.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:[q&&a.jsx("button",{onMouseDown:function(Ie){Ie.preventDefault()},onClick:X,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":C(V?"chat.copied":"chat.copy_message"),title:C(V?"chat.copied":"chat.copy_message"),children:V?a.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&!fe&&!Oe&&a.jsx("button",{onClick:Rt,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":C("chat.quote_selection"),title:C("chat.quote_selection"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})})}),M&&!$&&!G&&p&&a.jsx("button",{onClick:Te,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":C("chat.edit_resend"),title:C("chat.edit_resend"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),M&&$&&!G&&p&&h&&a.jsx("button",{onClick:Te,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":C("chat.edit_resend"),title:C("chat.edit_resend"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),M&&$&&h&&a.jsx("button",{onClick:function(){h(e.id)},className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 dark:text-gray-500 hover:text-red-500 dark:hover:text-red-400 transition-colors focus:outline-hidden focus:ring-1 focus:ring-primary-500","aria-label":C("chat.cancel_queued"),title:C("chat.cancel_queued"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),!M&&f&&a.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":C("chat.regenerate"),title:C("chat.regenerate"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:a.jsx("span",{className:"text-gray-700 dark:text-gray-200 font-bold text-xs",children:te})})]})}function zq(e,t,n,r,i,o,l,u,d,f,p,h,m,x){var v=(e||[]).slice();if(t){for(var k={},_=0;_<v.length;_++)k[v[_].id]=!0;for(var S=Object.keys(t),w=0;w<S.length;w++){var N=t[S[w]];(N.type==="text"||N.type==="reasoning")&&!k[N.id]&&v.push({id:N.id,type:N.type,text:N.text||N.delta||"",live:!0})}}var R=[],T="",C="",M=!1,I=0,A=0;function L(){T&&(R.push({type:"text",text:T,key:"text-"+I}),I+=1,T="")}function D(){C&&(R.push({type:"reasoning",text:C,key:"reasoning-"+A,live:M}),A+=1,C="",M=!1)}for(var $=0;$<v.length;$++){var te=v[$];if(te.type==="text"){D();var V=te.text||"";T&&V&&!T.endsWith(`
|
|
115
|
+
`)&&(T+=`
|
|
116
|
+
`),T+=V}else if(te.type==="reasoning"){L(),te.live&&(M=!0);var z=te.text||"";C&&z&&!C.endsWith(`
|
|
117
|
+
`)&&(C+=`
|
|
118
|
+
`),C+=z}else te.type==="error"?(D(),L(),R.push({type:"error",text:te.text||"",key:"error-"+(te.id||$)})):te.type==="tool"&&(D(),L(),R.push({type:"tool",part:te,key:"tool-"+(te.id||$)}))}if(D(),L(),r.length>0&&R.push({type:"files",parts:r,key:"files"}),n.length>0&&R.push({type:"images",parts:n,key:"images"}),R.length===0)return null;var G=[],K=[],H="";function se(){K.length>0&&(G.push(a.jsx("div",{className:"mb-2 pl-2 border-l-2 border-gray-200 dark:border-gray-700",children:K},"accent-"+H)),K=[])}for(var P=-1,W=R.length-1;W>=0;W--)if(R[W].type==="reasoning"){P=W;break}for(var ee=0;ee<R.length;ee++){var F=R[ee];if(F.type==="text"){se();var J=o||i;G.push(a.jsx("div",{className:"mb-2 prose prose-sm dark:prose-invert max-w-none break-words",children:a.jsx(mu,{remarkPlugins:[xu,yu,bu],rehypePlugins:[kf],components:J,children:F.text})},F.key))}else if(F.type==="reasoning")if(f){if(se(),u)continue;K.length===0&&(H=F.key),K.push(a.jsx(KU,{text:F.text,isStreaming:F.live&&ee===P&&h&&m},F.key))}else{if(se(),u)continue;G.push(a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 text-xs font-medium uppercase tracking-wide",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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")]}),a.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:a.jsx(mu,{remarkPlugins:[xu,yu,bu],rehypePlugins:[kf],components:i,children:F.text})})]},F.key))}else if(F.type==="error")se(),x==="aborted"?G.push(a.jsxs("div",{className:"my-2 p-3 rounded-lg bg-orange-100 dark:bg-orange-900/40 border-l-4 border-orange-200 dark:border-orange-900",children:[a.jsxs("div",{className:"flex items-center gap-2 text-orange-600 dark:text-orange-400 text-xs font-medium uppercase tracking-wide",children:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 10a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"})]}),d("chat.stopped_notice")||"Stopped by user"]}),a.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-orange-600 dark:text-orange-400",children:a.jsx(mu,{remarkPlugins:[xu,yu,bu],rehypePlugins:[kf],components:i,children:F.text})})]},F.key)):G.push(a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 text-xs font-medium uppercase tracking-wide",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a.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"]}),a.jsx("div",{className:"mt-2 prose prose-sm dark:prose-invert max-w-none break-words text-red-600 dark:text-red-300",children:a.jsx(mu,{remarkPlugins:[xu,yu,bu],rehypePlugins:[kf],components:i,children:F.text})})]},F.key));else if(F.type==="tool"){var q=F.part.tool||F.part.state&&F.part.state.title||"",Y=F.part.callID||F.part.id||"",oe=p&&Y&&p[Y]?p[Y]:null,_e=q==="question"||!!oe;if(_e){se();var ae=oe?oe.id:null;G.push(a.jsx("div",{className:"my-2",children:a.jsx(XU,{part:F.part,questionId:ae,questions:oe?oe.questions:null})},F.key))}else f&&!l?(K.length===0&&(H=F.key),K.push(a.jsx(GU,{part:F.part},F.key))):(se(),G.push(a.jsx("div",{className:`my-2 ${l?"hidden":""}`,children:a.jsx(VU,{part:F.part})},F.key)))}else F.type==="files"?(se(),G.push(a.jsx("div",{className:G.length>0?"mt-2":"",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:F.parts.map(function(ye,Fe){return a.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:ye.mime||"",children:[a.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:a.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"})}),a.jsx("span",{className:"truncate text-xs text-gray-700 dark:text-gray-300",children:ye.filename})]},ye.id||"file-"+Fe)})})},F.key))):F.type==="images"&&G.push(a.jsx("div",{className:G.length>0?"mt-2":"",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:F.parts.map(function(ye,Fe){var ct=ye.image_url.url||ye.image_url;return a.jsx("a",{href:ct,target:"_blank",rel:"noopener noreferrer",children:a.jsx("img",{src:ct,alt:d("chat.attachment_with_index",{index:Fe+1}),className:"max-w-[200px] max-h-[200px] rounded-lg object-cover cursor-pointer hover:opacity-90 transition-opacity"})},ye.id||"img-"+Fe)})})},F.key))}return se(),G}function Au(e){return e==null?"":typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(Au).join(""):y.isValidElement(e)?Au(e.props.children):""}function Uq(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 i=new Date,o=r.toDateString()===i.toDateString(),l=new Date(i);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 h=d+":"+(f<10?"0":"")+f+" "+p;if(o)return h;if(u)return t?t("chat.yesterday_time",{time:h}):"Yesterday "+h;var m=r.getMonth()+1,x=r.getDate();return m+"/"+x+" "+h}function qq(e,t,n,r,i){if(!t||!e)return a.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 h=n+f,m=h===r;u.push(a.jsx("mark",{ref:function(x){i(h,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)),a.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:u})}function yk(e,t,n,r,i,o){if(!e)return e;if(Array.isArray(e))return e.map(function(k,_){return a.jsx(y.Fragment,{children:yk(k,t,n,r,i,o)},_)});if(typeof e=="string"){for(var l=e,u=l.toLowerCase(),d=t.toLowerCase(),f=[],p=0;;){var h=u.indexOf(d,p);if(h===-1)break;h>p&&f.push(l.substring(p,h));var m=n+r.current,x=m===i;f.push(a.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(h,h+t.length)},"m-"+r.current)),r.current++,p=h+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===Pf)return e;if(e.props&&e.props.children!==void 0){var v=yk(e.props.children,t,n,r,i,o);return y.cloneElement(e,void 0,v)}}return e}const Hq=y.memo(Bq);function $q({sessionID:e,banners:t,hidden:n,onToggle:r}){var[i,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 a.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[i]||t[0],f=function(){o(function(h){return Math.min(t.length-1,h+1)})},p=function(){o(function(h){return Math.max(0,h-1)})};return a.jsxs(a.Fragment,{children:[a.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:a.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:[a.jsx("img",{src:d.url,alt:d.prompt||"Session banner",className:"w-full h-full object-cover",loading:"lazy",draggable:!1}),d.prompt?a.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:a.jsx("div",{className:"line-clamp-2",children:d.prompt})}):null,t.length>1?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),f()},disabled:i>=t.length-1,className:"absolute left-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Older banner",children:"‹"}),a.jsx("button",{type:"button",onClick:function(h){h.stopPropagation(),p()},disabled:i<=0,className:"absolute right-1 top-1/2 -translate-y-1/2 bg-black/40 hover:bg-black/60 text-white rounded-full w-7 h-7 flex items-center justify-center disabled:opacity-30 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Newer banner",children:"›"}),a.jsx("div",{className:"absolute top-1 right-2 bg-black/40 text-white text-[10px] px-1.5 py-0.5 rounded opacity-0 group-hover:opacity-100 transition-opacity",children:i+1+" / "+t.length})]}):null]})}),l?a.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:[a.jsxs("div",{className:"max-w-5xl w-full",onClick:function(h){h.stopPropagation()},children:[a.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?a.jsx("div",{className:"text-white text-sm mt-3 px-2",children:d.prompt}):null,a.jsxs("div",{className:"text-white/60 text-xs mt-1 px-2",children:[new Date(d.timestamp).toLocaleString(),t.length>1?" · "+(i+1)+" of "+t.length:""]})]}),a.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]})}var Wq={perMessage:{},total:0,_nextCache:{}};const Vq=y.forwardRef(function({messages:t,unloadedCompactedCount:n,onExpandCompactedHistory:r,hasOlderMessages:i,loadingOlderMessages:o,onLoadOlderMessages:l,streamingParts:u,streamingProgress:d,isBusy:f,compactingInfo:p,compactionResult:h,onSwitchToCompactedSession:m,onDismissCompactionResult:x,user:v,searchQuery:k,activeMatchIndex:_,onTotalMatchesChange:S,onRetry:w,onEditAndResend:N,onCancelQueued:R,hideToolBubbles:T,mobileFrameless:C,hideThinking:M,sessionID:I,banners:A,bannerHidden:L,onToggleBanner:D,privateMessageIds:$,parentSessionID:te,onViewParentSession:V,compactionPinned:z,onUnpinCompaction:G,questionIdMap:K,onQuoteAdd:H},se){const{t:P}=Gt();var W=y.useRef(null),ee=y.useRef(!0),F=y.useRef({}),J=y.useRef(null),q=y.useRef(null),[Y,oe]=y.useState(!1),_e=y.useRef(-1),ae=y.useRef(0),ye=y.useRef(null),Fe=y.useRef(null),ct=y.useRef(t.length);ct.current=t.length;var ht=y.useRef(u);ht.current=u;var[pt,et]=y.useState(!1),ze=y.useRef({startIndex:0,endIndex:0}),Be=y.useRef(null),At=y.useRef(!1),lt=y.useRef(0),on=y.useRef(null);y.useEffect(function(){et(!1),on.current=null},[I]);var _t=y.useCallback(function(){ee.current=!0,q.current?q.current.scrollTop=q.current.scrollHeight:W.current&&W.current.scrollToIndex({index:"LAST",behavior:"smooth",align:"end"})},[]);y.useImperativeHandle(se,function(){return{scrollToBottom:_t,resetAutoScroll:function(){ee.current=!0}}},[_t]);var gn=y.useCallback(function(ve,Re){Re?F.current[ve]=Re:delete F.current[ve]},[]),Ht=y.useRef({}),Kt=y.useMemo(function(){if(!k)return Wq;for(var ve=k.toLowerCase(),Re=0,Xe={},Ie={},ie=Ht.current,Ct=0;Ct<t.length;Ct++){var mn=t[Ct],Me=iq(mn.parts,u[mn.info.id],M),Et=mn.info.role==="assistant",kn=Et?aq(Me):Me,Wn=kn.toLowerCase(),ki=mn.info.id,kr=ie[ki],dr;kr&&kr.text===Wn&&kr.query===ve?dr=kr.count:dr=Gq(Wn,ve),Ie[ki]={text:Wn,query:ve,count:dr},dr>0&&(Xe[mn.info.id]={offset:Re,count:dr,messageIndex:Ct}),Re+=dr}return{perMessage:Xe,total:Re,_nextCache:Ie}},[t,u,k,M]);y.useEffect(function(){Ht.current=Kt._nextCache},[Kt]);var ut=y.useMemo(function(){return{perMessage:Kt.perMessage,total:Kt.total}},[Kt]);y.useEffect(function(){S&&S(ut.total)},[ut.total,S]);var Pe=y.useMemo(function(){for(var ve=0,Re=0;Re<t.length;Re++)t[Re].info.compactedOut===!0&&ve++;return ve},[t]),le=bA(),be=pt||le,fe=y.useMemo(function(){return be||Pe===0?t:t.filter(function(ve){return ve.info.compactedOut!==!0})},[t,be,Pe]),Oe=y.useRef(fe.length);Oe.current=fe.length,y.useEffect(function(){if(!(!k||ut.total===0||pt||Pe===0)){var ve=ut.perMessage;for(var Re in ve)if(ve.hasOwnProperty(Re)&&ve[Re].messageIndex<Pe){et(!0);break}}},[k,ut,pt,Pe]),y.useLayoutEffect(function(){if(Be.current!=null&&W.current){var ve=Be.current;if(Be.current=null,ve<0||ve>=fe.length)return;var Re=requestAnimationFrame(function(){W.current&&W.current.scrollToIndex({index:ve,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(Re)}}},[fe]),y.useLayoutEffect(function(){var ve=on.current;if(!(!ve||fe.length<=ve.count||!W.current)){on.current=null;var Re=ve.index+(fe.length-ve.count),Xe=requestAnimationFrame(function(){W.current&&W.current.scrollToIndex({index:Re,align:"start",behavior:"auto"})});return function(){cancelAnimationFrame(Xe)}}},[fe]);var ft=y.useCallback(function(){!l||o||(At.current=!0,on.current={index:ze.current.startIndex,count:fe.length},Promise.resolve(l()).then(function(ve){setTimeout(function(){var Re=on.current;(!ve||ve.length===0||Re&&Oe.current<=Re.count)&&(on.current=null)},0)},function(){on.current=null}))},[l,o,fe.length]),gt=y.useCallback(function(){if(At.current=!0,pt){Be.current=0,et(!1);return}Pe>0?(Be.current=ze.current.startIndex+Pe,et(!0)):n>0&&r&&(Be.current=ze.current.startIndex+n,et(!0),r())},[pt,Pe,n,r]);y.useEffect(function(){var ve=fe.length>lt.current;if(lt.current=fe.length,!ve||!ee.current||At.current){At.current=!1;return}var Re=setTimeout(function(){ee.current&&q.current&&(q.current.scrollTop=q.current.scrollHeight)},150);return function(){clearTimeout(Re)}},[fe.length]),y.useEffect(function(){!ee.current||k||q.current&&(q.current.scrollTop=q.current.scrollHeight)},[u,t,k]),y.useEffect(function(){var ve=ye.current!==I;ye.current=I,ve&&(ee.current=!0,_e.current=-1,lt.current=0,ae.current=Date.now()+600,oe(!1));function Re(){ee.current&&q.current&&(q.current.scrollTop=q.current.scrollHeight)}var Xe=requestAnimationFrame(Re),Ie=setTimeout(Re,150),ie=setTimeout(Re,450);return function(){cancelAnimationFrame(Xe),clearTimeout(Ie),clearTimeout(ie)}},[I,t]);var dt=y.useCallback(function(){var ve=q.current;if(ve){var Re=ve.scrollTop,Xe=Re+ve.clientHeight>=ve.scrollHeight-4;Xe?ee.current=!0:_e.current>=0&&Re<_e.current-8&&Date.now()>ae.current&&(ee.current=!1),_e.current=Re,oe(!Xe&&!ee.current&&ct.current>0)}},[]),Lt=y.useCallback(function(ve){!ve||Fe.current===ve||(Fe.current&&Fe.current.removeEventListener("scroll",dt),Fe.current=ve,ve.addEventListener("scroll",dt,{passive:!0}))},[dt]);y.useEffect(function(){return function(){Fe.current&&Fe.current.removeEventListener("scroll",dt)}},[dt]);var Wt=y.useMemo(function(){if(!k||ut.total===0)return[];var ve=[],Re=ut.perMessage;for(var Xe in Re)Re.hasOwnProperty(Xe)&&ve.push(Re[Xe]);return ve.sort(function(Ie,ie){return Ie.messageIndex-ie.messageIndex}),ve},[k,ut]);y.useEffect(function(){if(!(!k||ut.total===0||_<0)){for(var ve=-1,Re=0;Re<Wt.length;Re++){var Xe=Wt[Re];if(_>=Xe.offset&&_<Xe.offset+Xe.count){ve=Xe.messageIndex;break}}if(!(ve<0)){var Ie=pt||Pe===0?0:Pe,ie=ve-Ie;if(!(ie<0)){W.current&&W.current.scrollToIndex({index:ie,align:"center",behavior:"smooth"});var Ct=requestAnimationFrame(function(){var mn=setTimeout(function(){var Me=F.current[_];Me&&Me.scrollIntoView&&Me.scrollIntoView({behavior:"smooth",block:"center"})},200);J.current=mn});return function(){cancelAnimationFrame(Ct),J.current&&(clearTimeout(J.current),J.current=null)}}}}},[_,k,ut.total,Wt,pt,Pe]),y.useEffect(function(){F.current={}},[k]);for(var rt=-1,wt=fe.length-1;wt>=0;wt--)if(fe[wt].info.role==="assistant"){rt=wt;break}var Yt=y.useCallback(function(ve){return k?!1:ve?f?"auto":"smooth":!1},[k,f]),an=y.useCallback(function(ve){ve&&(ee.current=!0),oe(!ve&&!ee.current&&ct.current>0)},[]),kt=y.useMemo(function(){return pt&&Pe>0?{top:3e3,bottom:600}:{top:600,bottom:600}},[pt,Pe]),xe=y.useCallback(function(ve,Re){var Xe=ut.perMessage[Re.info.id]||null,Ie=ve===rt,ie=Re.info.role==="user",Ct=Re.info.compactedOut===!0,mn=be&&ve>0&&t[ve-1].info.compactedOut===!0&&!Ct,Me=le&&Re.info.mode==="compaction";return a.jsxs("div",{className:"px-2 sm:px-4 py-3 max-w-full sm:max-w-3xl mx-auto",children:[mn?a.jsxs("div",{"data-testid":"compaction-boundary",className:"flex items-center gap-3 select-none mb-6",children:[a.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:P&&P("compaction.boundary")||"Context compacted — messages above are no longer in the model’s context"}),a.jsx("div",{className:"flex-1 border-t border-dashed border-gray-300 dark:border-gray-700"})]}):null,!Me&&a.jsx(Hq,{isCompactedOut:Ct,message:Re.info,parts:Re.parts,streamingParts:ht.current[Re.info.id],user:v,searchQuery:k,matchOffset:Xe?Xe.offset:-1,matchCount:Xe?Xe.count:0,activeMatchIndex:_,registerMatchRef:gn,isLast:Ie,isBusy:f,sessionID:I,onRetry:Ie&&!f&&!Ct?w:void 0,onEditAndResend:ie&&!f&&!Ct&&!Yq(Re.parts)?N:void 0,onCancelQueued:Ct?void 0:R,hideToolBubbles:T,mobileFrameless:C,hideThinking:M,isPrivate:$&&$.has(Re.info.id),questionIdMap:K,onQuoteAdd:H})]})},[ut,rt,t,v,k,_,gn,f,I,w,N,R,T,C,M,$,K,H,be,le,P]),De=y.useMemo(function(){return a.jsxs(a.Fragment,{children:[f&&(C?!0:!Kq(t,u,T,M))&&(C?a.jsx("div",{className:"flex justify-start py-2 px-2 sm:px-4 max-w-full sm:max-w-3xl mx-auto",children:a.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":P("chat.assistant_typing")||"Assistant is typing",children:a.jsx("path",{d:"M12 2l2.4 7.6L22 12l-7.6 2.4L12 22l-2.4-7.6L2 12l7.6-2.4L12 2z"})})}):a.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:[a.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-primary-500 flex items-center justify-center mt-1",children:a.jsx("span",{className:"text-white font-bold text-xs",children:"P"})}),a.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-md px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"0ms"}}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 dark:bg-gray-500 animate-bounce",style:{animationDelay:"300ms"}})]})})]})),f&&!C&&d&&d.toolCalls>0&&a.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:[a.jsx("div",{className:"shrink-0 w-7 h-7 rounded-lg bg-accent-500 flex items-center justify-center mt-1",children:a.jsxs("svg",{className:"w-4 h-4 text-white animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.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"})]})}),a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[a.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:Qq(d.toolNames,P)}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2 tabular-nums",children:Xq(d.toolArgBytes)})]}),a.jsx("div",{className:"h-1 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-accent-500 rounded-full animate-progress-indeterminate",style:{width:"40%",animation:"progress-indeterminate 1.5s ease-in-out infinite"}})})]})]})]})},[f,C,t,u,d,T,M,P]),Ke=y.useMemo(function(){return function(){return a.jsxs(a.Fragment,{children:[a.jsx($q,{sessionID:I,banners:A,hidden:L,onToggle:D}),a.jsx(Jq,{sessionID:I,parentSessionID:te,onViewParentSession:V,compactionPinned:z,onUnpinCompaction:G,t:P}),i?a.jsx("div",{className:"flex justify-center py-1.5",children:a.jsx("button",{type:"button",onClick:ft,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?P&&P("messages.loading_earlier")||"Loading earlier messages...":P&&P("messages.load_earlier")||"Load earlier messages"})}):null,Pe>0||n>0?!le&&a.jsx("div",{className:"sticky top-0 z-10 flex justify-center py-1.5 pointer-events-none",children:a.jsx("button",{type:"button",onClick:gt,"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:pt&&Pe>0?P&&P("compaction.hide_history")||"Hide messages before compaction":P&&P("compaction.show_history",{count:Pe>0?Pe:n})||"Conversation summarized — "+(Pe>0?Pe:n)+" earlier messages collapsed; summary below"})}):null]})}},[I,A,L,D,te,V,z,G,P,i,o,ft,Pe,n,pt,gt,le]),X=y.useRef(De);X.current=De;var Ee=y.useRef(null);Ee.current||(Ee.current={version:0,listeners:new Set});var Te=Ee.current;y.useEffect(function(){Te.version+=1,Te.listeners.forEach(function(ve){ve()})},[De,Te]);var mt=y.useMemo(function(){return function(){return y.useSyncExternalStore(function(Re){return Te.listeners.add(Re),function(){Te.listeners.delete(Re)}},function(){return Te.version}),X.current}},[]),Ut=y.useMemo(function(){return{Header:Ke,Footer:mt}},[Ke,mt]),Rt=fe.length===0&&(Pe>0||n>0),st=Pe>0?Pe:n;return Rt?a.jsx("div",{className:"flex-1 relative overflow-hidden",children:a.jsx(Zq,{count:st,onExpand:gt,t:P})}):a.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[a.jsx(c4,{ref:W,scrollerRef:function(ve){q.current=ve,ve&&Lt(ve)},data:fe,itemContent:xe,followOutput:Yt,atBottomStateChange:an,rangeChanged:function(ve){ze.current=ve},increaseViewportBy:kt,defaultItemHeight:120,computeItemKey:function(ve,Re){return Re.info.id},components:Ut,className:"h-full",style:{overflowY:"auto",overflowX:"hidden"}}),Y&&a.jsx("button",{onClick:_t,"aria-label":P("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:P("chat.scroll_to_bottom"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})});function Gq(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 Kq(e,t,n,r){var i=!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}),h=(f.parts||[]).some(function(m){return m.type==="tool"});return p||i&&h}if(f.info.role==="user")break}return!1}function Yq(e){return!e||!Array.isArray(e)?!1:e.some(function(t){return t.type==="image_url"||t.type==="file"})}function Qq(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],i=n[r]||(t?t("chat.tool_preparing_name",{name:r}):"Preparing "+r);return e.length>1&&(i+=" +"+(e.length-1)),i}function Xq(e){return e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function Zq({count:e,onExpand:t,t:n}){return a.jsx("div",{"data-testid":"compaction-empty-state",className:"h-full flex flex-col items-center justify-center text-center px-6 py-10",children:a.jsxs("div",{className:"max-w-sm mx-auto flex flex-col items-center",children:[a.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:a.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:a.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"})})}),a.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"}),a.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."}),a.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 Jq({sessionID:e,parentSessionID:t,onViewParentSession:n,compactionPinned:r,onUnpinCompaction:i,t:o}){var l="pave:compactionBannerDismissed:"+e,u=function(){try{return localStorage.getItem(l)==="1"}catch{return!1}},d=function(){try{localStorage.setItem(l,"1")}catch{}x(!0)},f=function(){n&&t&&n(t)},p=u(),h=y.useState(!p),m=h[0],x=h[1];return!t||m?null:a.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:a.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto flex items-center gap-2",children:[a.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:a.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"})}),a.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."}),a.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?a.jsx("button",{type:"button",onClick:function(){i&&i(e)},className:"text-xs font-medium text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 hover:underline focus:outline-hidden focus:underline transition-colors whitespace-nowrap shrink-0",children:o&&o("chat.unpin_compacted")||"Unpin — go back to original"}):null,a.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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})})}const Ep=["image/png","image/jpeg","image/jpg","image/gif","image/webp"],X5=["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"],Z5=[...Ep,...X5],Qo=10,dS=10*1024*1024,fS=50*1024*1024,pS=32768,eH="Attachment: ",hS=typeof TextEncoder<"u"?new TextEncoder:null;function gS(e){return hS?hS.encode(e).length:String(e).length}function tH(e,t){let n=gS(typeof e=="string"?e:"");const r=t||[];for(let i=0;i<r.length;i++)n+=gS(eH+r[i])+1;return n}const nH=Z5.join(",");function Ff(e){return e?Ep.indexOf(e.toLowerCase())!==-1:!1}var Ug,mS;function rH(){if(mS)return Ug;mS=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 i=(this._start+this._length)%this._capacity,o=Math.min(r,this._capacity-i);this._buffer.set(n.subarray(0,o),i),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 i=Math.min(r,this._length-n),o=new Float32Array(i),l=(this._start+n)%this._capacity,u=Math.min(i,this._capacity-l);return o.set(this._buffer.subarray(l,l+u),0),u<i&&o.set(this._buffer.subarray(0,i-u),u),o}trimBefore(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 iH=rH(),qg,xS;function aH(){if(xS)return qg;xS=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 i=this._slotIndex===0?this._minChunkSamples:this._chunkSamples;return this._pendingNewSamples<i?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 i=this._slotIndex===0,o=n.totalAppended-n.length,l=i?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 h="";this._prevText.length>0&&(h=this._prevText.length>this._maxInitialPrompt?this._prevText.slice(-this._maxInitialPrompt):this._prevText);const m={audio:p,overlapSamples:l,slotIndex:this._slotIndex,initialPrompt:h,chunkId:"slot-"+this._slotIndex};return this._lastSlotEndTotalAppended+=u,this._slotIndex++,this._inflight=!0,this._pendingNewSamples=0,m}}return qg={TranscriptionScheduler:e},qg}var sH=aH(),Hg,yS;function oH(){if(yS)return Hg;yS=1;function e(n,r){const i=n.length,o=r.length;if(i===0)return o;if(o===0)return i;let l=new Array(o+1),u=new Array(o+1);for(let d=0;d<=o;d++)l[d]=d;for(let d=1;d<=i;d++){u[0]=d;for(let p=1;p<=o;p++){const h=n[d-1]===r[p-1]?0:1;u[p]=Math.min(u[p-1]+1,l[p]+1,l[p-1]+h)}const f=l;l=u,u=f}return l[o]}function t(n,r,i){if(!n)return r||"";if(!r)return"";const o=i&&i.maxOverlapChars||50,l=i&&typeof i.maxEditRatio=="number"?i.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 Hg={dedupOverlap:t,levenshtein:e},Hg}var lH=oH(),$g,bS;function cH(){if(bS)return $g;bS=1;function e(n){return!!n&&n.isLocalWhisper===!0&&n.whisperUrlValid===!0}function t(n){const r=n||{},i=r.mode||"auto";return r.streaming&&r.streaming.wsUrl?{kind:"streaming",whisperUrlDefault:!1,backend:!1,local:!1,eagerWorker:!1,reportWorkerCrash:!1}:i==="local-only"?{kind:"local",whisperUrlDefault:!1,backend:!1,local:!0,eagerWorker:!0,reportWorkerCrash:!0}:i==="backend-only"?{kind:"backend",whisperUrlDefault:!1,backend:!0,local:!1,eagerWorker:!1,reportWorkerCrash:!1}:e(r)?{kind:"whisper-url",whisperUrlDefault:!0,backend:!0,local:!0,eagerWorker:!1,reportWorkerCrash:!1}:r.backendAvailable?{kind:"backend",whisperUrlDefault:!1,backend:!0,local:!0,eagerWorker:!1,reportWorkerCrash:!1}:{kind:"local",whisperUrlDefault:!1,backend:!1,local:!0,eagerWorker:!0,reportWorkerCrash:!0}}return $g={selectTranscriptionPath:t},$g}var vS=cH();const Bl=16e3;function wf(e,t,n,r){try{const i=localStorage.getItem(e);if(i==null||i==="")return t;const o=Number(i);return Number.isFinite(o)?Math.min(r,Math.max(n,o)):t}catch{return t}}const uH=2,dH=.6,fH=1,pH=200,kS=3,Wg=2,hH=1e3,_S=.01,wS=800;function SS(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 gH(e,t){const n=e.sampleRate,r=e.getChannelData(0);if(n===t)return new Float32Array(r);const i=n/t,o=Math.round(r.length/i),l=new Float32Array(o);for(let u=0;u<o;u+=1){const d=u*i,f=Math.floor(d),p=Math.min(f+1,r.length-1),h=d-f;l[u]=r[f]*(1-h)+r[p]*h}return l}function mH(e,t){const i=t*1*2,o=1*(16/8),l=e.length*o,u=new ArrayBuffer(44+l),d=new DataView(u);let f=0;for(let 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,i,!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 h=Math.max(-1,Math.min(1,e[p]));d.setInt16(f,h<0?h*32768:h*32767,!0),f+=2}return new Blob([u],{type:"audio/wav"})}function xH({onTranscript:e,onError:t,onAutoSubmit:n,language:r,model:i}){const[o,l]=y.useState("idle"),[u,d]=y.useState(0),[f,p]=y.useState(null),[h,m]=y.useState(null),[x,v]=y.useState(""),k=y.useRef(null),_=y.useRef(null),S=y.useRef(null),w=y.useRef(null),N=y.useRef(!1),R=y.useRef(null),T=y.useRef(null),C=y.useRef(null),M=y.useRef(null),I=y.useRef(null),A=y.useRef(null),L=y.useRef(0),D=y.useRef(!1),$=y.useRef(""),te=y.useRef(!1),V=y.useRef(null),z=y.useRef(wS),G=y.useRef(null),K=y.useRef(!1),H=y.useRef(""),se=y.useRef(""),P=y.useRef("idle"),W=y.useCallback(ut=>{P.current=ut,l(ut)},[]),ee=y.useRef(e),F=y.useRef(t),J=y.useRef(n),q=y.useRef({language:r,model:i}),Y=y.useRef({language:r,model:i}),oe=y.useRef(null),_e=y.useRef(null);y.useEffect(()=>{ee.current=e},[e]),y.useEffect(()=>{F.current=t},[t]),y.useEffect(()=>{J.current=n},[n]),y.useEffect(()=>{q.current={language:r,model:i}},[r,i]),y.useEffect(()=>{M.current&&(P.current==="recording"||P.current==="paused")&&M.current.clearPrevText()},[r]);const ae=y.useCallback(()=>I.current?Promise.resolve(I.current):(A.current||(A.current=Hf().then(ut=>(I.current=ut,ut)).catch(()=>{const ut={mode:"auto",backendAvailable:!1};return I.current=ut,ut})),A.current),[]);y.useEffect(()=>{ae()},[ae]);const ye=y.useCallback(()=>{if(R.current&&(R.current.getTracks().forEach(ut=>ut.stop()),R.current=null),G.current){try{G.current.readyState===WebSocket.OPEN&&G.current.send("Done"),G.current.close()}catch{}G.current=null}K.current=!1},[]),Fe=y.useCallback(()=>{k.current&&(k.current.terminate(),k.current=null)},[]),ct=y.useCallback(()=>{const ut=S.current,Pe=_.current,le=w.current;if(ut){try{ut.disconnect()}catch{}ut.onaudioprocess=null,S.current=null}if(Pe){try{Pe.disconnect()}catch{}_.current=null}if(le){try{le.disconnect()}catch{}w.current=null}N.current=!1,ye(),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),Fe(),C.current&&C.current.clear(),M.current&&M.current.reset(),L.current=0},[ye,Fe]),ht=y.useRef(null),pt=y.useRef(null),et=y.useRef(null),ze=y.useRef(null),Be=y.useRef(null),At=y.useRef(null);ht.current=function(Pe){const le=Pe&&Pe.text||"";Pe&&Pe.chunkId;const be=M.current,fe=Pe&&Pe._silent;be&&be.reportResult(le);const Oe=lH.dedupOverlap($.current,le);if(Oe){const ft=$.current+Oe;$.current=ft,v(ft),ee.current&&ee.current(Oe)}if(L.current=0,(fe||le.trim()==="")&&$.current.trim()&&J.current&&J.current(),P.current==="draining"&&be&&!be.inflight){const ft=C.current,gt=be.drain(ft);gt?ze.current(gt):At.current();return}et.current()},pt.current=function(Pe){const le=M.current;if(le&&le.reportResult(""),L.current+=1,console.warn("[useContinuousVoiceInput] Chunk transcription error:",Pe,"("+L.current+"/"+kS+")"),L.current>=kS){ct(),W("idle"),F.current&&F.current("Voice transcription failed repeatedly. Please try again.");return}if(P.current==="draining"&&le&&!le.inflight){At.current();return}et.current()},et.current=function(){const Pe=M.current,le=C.current;if(!Pe||!le)return;const be=P.current;if(be!=="recording"&&be!=="paused"&&be!=="draining")return;const fe=Pe.appendAndSchedule(le);if(fe){ze.current(fe);return}if((be==="paused"||be==="draining")&&!Pe.inflight){const Oe=Pe.drain(le);Oe?ze.current(Oe):be==="draining"&&At.current()}},ze.current=async function(Pe){const le=SS(Pe.audio);if(le<_S){console.debug("[useContinuousVoiceInput] Skipping silent chunk (RMS="+le.toFixed(6)+")"),ht.current({text:"",chunkId:Pe.chunkId,_silent:!0});return}const be=I.current||{mode:"auto",backendAvailable:!1},fe=vS.selectTranscriptionPath(be);oe.current=fe;const Oe=(be.backendAvailable||fe.whisperUrlDefault)&&be.mode!=="local-only",ft=be.mode!=="backend-only",gt=Y.current.language,dt=Y.current.model;if(Oe&&!D.current){const rt=mH(Pe.audio,Bl),wt={};Pe.initialPrompt&&(wt.initialPrompt=Pe.initialPrompt);let Yt=null;for(let an=0;an<=Wg;an++)try{const kt=await g3(rt,gt,dt,wt);if(typeof kt.text=="string"){m("backend"),ht.current({text:kt.text,chunkId:Pe.chunkId});return}}catch(kt){_e.current=kt&&kt.message?kt.message:String(kt),Yt=kt;const xe=kt.status;if((xe===429||xe===503)&&an<Wg){const De=hH*2**an;console.warn("[useContinuousVoiceInput] Backend "+xe+", retrying in "+De+"ms (attempt "+(an+1)+"/"+Wg+")"),await new Promise(Ke=>{setTimeout(Ke,De)});continue}(xe===429||xe===503)&&(D.current=!0,console.warn("[useContinuousVoiceInput] Backend throttled (429/503), falling back to local for rest of recording"));break}if(!ft){pt.current(Yt?Yt.message:"Backend transcription failed");return}console.warn("[useContinuousVoiceInput] Backend chunk failed, trying local:",Yt?Yt.message:"unknown")}if(!ft){pt.current("Backend transcription is not available and local mode is disabled.");return}const Lt=Be.current();m("local");const Wt={type:"transcribe",audio:Pe.audio};gt&&(Wt.language=gt),Pe.initialPrompt&&(Wt.initialPrompt=Pe.initialPrompt),Pe.chunkId&&(Wt.chunkId=Pe.chunkId),Lt.postMessage(Wt,[Pe.audio.buffer])},Be.current=function(){if(k.current)return k.current;const Pe=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});return Pe.onmessage=le=>{const be=le.data;if(be)switch(be.type){case"loading":d(be.progress||0),p(be.file?be.file.split("/").pop():null);break;case"ready":P.current==="loading"&&W("recording"),d(100),p(null);break;case"result":ht.current(be);break;case"error":pt.current(be.error||"Transcription failed");break}},Pe.onerror=()=>{const le=M.current;le&&le.reportResult(""),L.current+=1,Fe();const be=new Worker(new URL("/assets/whisper-worker-g42TWo_4.js",import.meta.url),{type:"module"});be.onmessage=fe=>{const Oe=fe.data;if(Oe)switch(Oe.type){case"loading":d(Oe.progress||0),p(Oe.file?Oe.file.split("/").pop():null);break;case"ready":P.current==="loading"&&W("recording"),d(100),p(null),et.current();break;case"result":ht.current(Oe);break;case"error":pt.current(Oe.error||"Transcription failed");break}},be.onerror=()=>{if(be.terminate(),k.current=null,ct(),W("idle"),$.current="",v(""),F.current){const fe=oe.current;fe&&fe.reportWorkerCrash===!1&&_e.current?F.current("Voice transcription failed: "+_e.current+"; local transcription worker also crashed."):F.current("Voice transcription worker crashed.")}},k.current=be},k.current=Pe,Pe},At.current=function(){const Pe=k.current;Pe&&Pe.postMessage({type:"unload"}),T.current&&T.current.state!=="closed"&&(T.current.close().catch(()=>{}),T.current=null),M.current&&M.current.reset(),C.current&&C.current.clear(),W("idle")};const lt=y.useCallback(async()=>{if(P.current==="idle"){if(Y.current={...q.current},!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){F.current&&F.current("Microphone access is not supported in this browser.");return}if(typeof AudioContext>"u"&&typeof webkitAudioContext>"u"){F.current&&F.current("Audio recording is not supported in this browser.");return}try{const ut=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:Bl,echoCancellation:!0,noiseSuppression:!0}});R.current=ut,I.current=null,A.current=null;const Pe=await ae(),le=vS.selectTranscriptionPath(Pe);oe.current=le;const be=!!(Pe.streaming&&Pe.streaming.wsUrl),fe=!be&&(Pe.mode==="local-only"||!Pe.backendAvailable&&!le.whisperUrlDefault&&Pe.mode!=="backend-only"),Oe=window.AudioContext||window.webkitAudioContext;(!T.current||T.current.state==="closed")&&(T.current=new Oe);const ft=T.current;if(C.current=new iH.AudioRingBuffer({maxDuration:30,sampleRate:Bl}),M.current=new sH.TranscriptionScheduler({chunkDuration:wf("pave.asr.chunkDuration",uH,.5,30),overlapDuration:wf("pave.asr.overlapDuration",dH,0,10),minChunkDuration:wf("pave.asr.minChunkDuration",fH,.3,15),sampleRate:Bl,maxInitialPrompt:pH}),$.current="",v(""),L.current=0,D.current=!1,te.current=!1,V.current=null,z.current=wf("pave.asr.vadSilenceMs",wS,200,5e3),H.current="",se.current="",K.current=be,be){const rt=(wt,Yt)=>{if(!wt)return Yt;if(!Yt)return wt;const an=/^[\u3000-\u303F\u4E00-\u9FFF\uFF00-\uFFEF]/.test(Yt),kt=/\s$/.test(wt)||an?"":" ";return wt+kt+Yt};try{const wt=new WebSocket(Pe.streaming.wsUrl);wt.binaryType="arraybuffer",G.current=wt,wt.onmessage=Yt=>{let an="";try{an=typeof Yt.data=="string"?Yt.data:new TextDecoder().decode(Yt.data)}catch{return}if(an==="Done!")return;let kt="",xe=!1;try{const Ke=JSON.parse(an);kt=Ke&&typeof Ke.text=="string"?Ke.text:"",xe=!!(Ke&&Ke.is_final)}catch{kt=an}kt=(kt||"").trim();const De=rt(H.current,kt);De&&De!==se.current&&(se.current=De,$.current=De,v(De),m("streaming"),ee.current&&ee.current(De,{mode:"snapshot",engine:Pe.streaming&&Pe.streaming.engine||"paraformer"})),xe&&kt&&(J.current?(H.current="",se.current="",$.current="",v(""),J.current()):H.current=rt(H.current,kt))},wt.onerror=()=>{console.warn("[useContinuousVoiceInput] streaming WS error — falling back unavailable mid-session")}}catch(wt){console.warn("[useContinuousVoiceInput] streaming connect failed:",wt),K.current=!1}}const gt=ft.createMediaStreamSource(ut),Lt=ft.createScriptProcessor(4096,1,1),Wt=ft.createGain();Wt.gain.value=0,gt.connect(Lt),Lt.connect(Wt),Wt.connect(ft.destination),_.current=gt,S.current=Lt,w.current=Wt,N.current=!1,Lt.onaudioprocess=rt=>{if(N.current)return;const wt=rt.inputBuffer,Yt=wt.sampleRate,an=wt.getChannelData(0);let kt;if(Yt===Bl?kt=new Float32Array(an):kt=gH({sampleRate:Yt,getChannelData:()=>an},Bl),kt.length===0)return;if(K.current&&G.current&&G.current.readyState===WebSocket.OPEN){const X=new Float32Array(kt.length);X.set(kt),G.current.send(X.buffer);return}const xe=C.current;xe&&xe.append(kt);const De=SS(kt),Ke=performance.now();if(De>=_S)te.current=!0,V.current=null;else if(te.current){if(!V.current)V.current=Ke;else if(Ke-V.current>=z.current){te.current=!1,V.current=null;const X=M.current;if(X&&!X.inflight&&xe){const Ee=X.drain(xe);Ee&&ze.current(Ee)}}}et.current()},fe?(W("loading"),d(0),Be.current().postMessage({type:"load"})):(W("recording"),d(100))}catch(ut){ye(),W("idle");const Pe=ut.name==="NotAllowedError"?"Microphone permission was denied. Please allow microphone access.":"Could not access microphone: "+(ut.message||String(ut));F.current&&F.current(Pe)}}},[ae,ye]),on=y.useCallback(()=>{const ut=P.current;if(ut==="loading"){ct(),Fe(),W("idle");return}if(ut!=="recording"&&ut!=="paused")return;const Pe=S.current,le=_.current,be=w.current;if(Pe){try{Pe.disconnect()}catch{}Pe.onaudioprocess=null,S.current=null}if(le){try{le.disconnect()}catch{}_.current=null}if(be){try{be.disconnect()}catch{}w.current=null}ye(),W("draining"),setTimeout(()=>{const fe=M.current,Oe=C.current;if(!fe||!Oe){At.current();return}if(!fe.inflight){const ft=fe.drain(Oe);ft?ze.current(ft):At.current()}},0)},[ye,ct,Fe]),_t=y.useCallback(()=>{P.current==="recording"&&(N.current=!0,W("paused"),et.current())},[]),gn=y.useCallback(()=>{P.current==="paused"&&(N.current=!1,W("recording"))},[]),Ht=y.useCallback(()=>{P.current!=="idle"&&(ct(),Fe(),$.current="",v(""),W("idle"))},[ct,Fe]),Kt=y.useCallback(()=>{if(P.current!=="idle"){F.current&&F.current("Cannot clear cache while recording.");return}W("loading"),d(0),Fe(),Be.current().postMessage({type:"clearCache"})},[Fe]);return y.useEffect(()=>()=>{ct(),Fe()},[ct,Fe]),{state:o,progress:u,downloadingFile:f,transcriptionSource:h,transcriptText:x,startRecording:lt,stopRecording:on,pauseRecording:_t,resumeRecording:gn,cancelRecording:Ht,clearModelCache:Kt}}function yH({skills:e,builtins:t,filter:n,onSelect:r,visible:i,selectedIndex:o,activeSkill:l,onBack:u}){const{t:d}=Gt(),f=y.useRef(null),p=y.useRef(null);if(y.useEffect(()=>{f.current&&f.current.scrollIntoView({block:"nearest"})},[o,l,n,e.length]),!i)return null;const h=(n||"").trim().toLowerCase();let m=[],x=!1;if(l){x=!0;const v=e.find(_=>_.skill===l);m=(v&&v.commands||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"command",skill:l,name:_.name,description:_.description}))}else{const v=(t||[]).filter(_=>h?(_.name||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h):!0).map(_=>({type:"builtin",name:_.name,description:_.description})),k=e.filter(_=>h?(_.skill||"").toLowerCase().includes(h)||(_.description||"").toLowerCase().includes(h)||(_.commands||[]).some(S=>(S.name||"").toLowerCase().includes(h)||(S.description||"").toLowerCase().includes(h)):!0).map(_=>({type:"skill",skill:_.skill,description:_.description,commandCount:(_.commands||[]).length,configured:_.configured}));m=v.concat(k)}return a.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:[a.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&&a.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:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),d("slashCommand.skills")]}),a.jsx("span",{className:"flex-1 text-right",children:x?l+" "+d("slashCommand.commands"):d("slashCommand.title")})]}),a.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?a.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,S="slash-item-"+k;return a.jsx("div",{id:S,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"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"font-medium",children:["/",v.name]}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"built-in"})]}),v.description&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]}):v.type==="skill"?a.jsxs(a.Fragment,{children:[a.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()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium truncate",children:v.skill}),!v.configured&&a.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:d("slashCommand.notConfigured")})]}),v.description&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]}),a.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")]}),a.jsx("svg",{className:"w-4 h-4 text-gray-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"shrink-0 w-6 h-6 rounded bg-accent-100 dark:bg-accent-900/40 flex items-center justify-center",children:a.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:a.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"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"font-medium",children:["/",l," ",v.name]}),v.description&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:v.description})]})]})},v.type+"-"+(v.skill||"_")+"-"+(v.name||""))})}),a.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:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"↑↓"})," ",d("slashCommand.navigate")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Enter"})," ",d("slashCommand.select")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded text-xs",children:"Esc"})," ",d("slashCommand.close")]})]})]})}function bH({quotes:e,onRemove:t,onClearAll:n}){var{t:r}=Gt();function i(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-mk.length)===mk}return!Array.isArray(e)||e.length===0?null:a.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:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r("chat.quote_selection")}),a.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 a.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:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[11px] font-medium text-gray-500 dark:text-gray-400 truncate",children:i(u)}),a.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)})]}),a.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:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},u.qid)})]})}class vH{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=ar("/global/event")+(n.length>0?"?"+n.join("&"):"");this.eventSource=new EventSource(r);const i=this.eventSource;i.onopen=()=>{this.eventSource===i&&(this.reconnectDelay=1e3,this._markActivity(),this._emit("connected",{}))},i.onmessage=o=>{if(this.eventSource===i){this._markActivity(),o.lastEventId&&(this.lastEventId=o.lastEventId);try{const l=JSON.parse(o.data);l.type&&this._emit(l.type,l)}catch{}}},i.onerror=()=>{this.eventSource===i&&(this._emit("error",{}),i.close(),this.eventSource=null,this._scheduleReconnect())},this._startWatchdog()}disconnect(){this._stopWatchdog(),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null)}on(t,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 i of r)try{i(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 vH;function kH({onSend:e}){var{t}=Gt(),[n,r]=y.useState([]),[i,o]=y.useState(null),[l,u]=y.useState(null),[d,f]=y.useState(null),[p,h]=y.useState(null),[m,x]=y.useState(null),v=y.useRef(null),k=y.useRef(!1),_=y.useRef(null);y.useEffect(function(){k.current||(k.current=!0,d3().then(function(I){r(I&&Array.isArray(I.shortcuts)?I.shortcuts:[]),I&&Number.isInteger(I.rev)&&(_.current=I.rev)}).catch(function(){o(t("chat.shortcut_save_error"))}))},[t]),y.useEffect(function(){function I(L){var D=L&&L.properties||{};Array.isArray(D.shortcuts)&&r(D.shortcuts)}var A=pn.on("shortcuts.changed",I);return function(){typeof A=="function"&&A()}},[]);function S(I){return f3(I,_.current).then(function(A){r(A&&Array.isArray(A.shortcuts)?A.shortcuts:I),A&&Number.isInteger(A.rev)&&(_.current=A.rev),o(null)}).catch(function(A){A&&A.status===409&&A.body&&Array.isArray(A.body.shortcuts)&&(r(A.body.shortcuts),Number.isInteger(A.body.rev)&&(_.current=A.body.rev)),o(t("chat.shortcut_save_error"))})}function w(I){var A=n.slice();return A.splice(I,1),u(null),f(null),S(A)}function N(I,A){if(v.current=A,I.dataTransfer){I.dataTransfer.effectAllowed="move";try{I.dataTransfer.setData("text/plain",String(A))}catch{}}}function R(I,A){I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="move"),v.current!==null&&v.current!==A&&x(A)}function T(I,A){I.preventDefault();var L=v.current;if(v.current=null,x(null),!(L===null||L===A)){var D=n.slice(),$=D.splice(L,1)[0];return D.splice(A,0,$),S(D)}}function C(){v.current=null,x(null)}function M(){h(null)}return(!Array.isArray(n)||n.length===0)&&!i?null:a.jsxs("div",{role:"group","aria-label":t("chat.shortcut_pills_label"),className:"flex items-center gap-2 px-4 pt-2 pb-1 overflow-x-auto [mask-image:linear-gradient(to_right,#000_calc(100%_-_28px),transparent)] [-webkit-mask-image:linear-gradient(to_right,#000_calc(100%_-_28px),transparent)]",children:[n.map(function(I,A){var L=l===A||d===A,D=p===A;return a.jsxs("div",{draggable:!0,onDragStart:function($){N($,A)},onDragOver:function($){R($,A)},onDrop:function($){T($,A)},onDragEnd:C,onMouseEnter:function(){u(A)},onMouseLeave:function(){u(null),M()},onFocus:function(){f(A)},onBlur:function(){f(null)},title:t("chat.shortcut_pill_drag_hint"),className:"group relative shrink-0 "+(m===A?"opacity-60 ":""),children:[a.jsx("button",{type:"button","data-pressed":D?"true":"false",onClick:function(){h(A),typeof e=="function"&&e(I.prompt)},onMouseUp:M,onMouseLeave:M,onKeyUp:M,onBlur:M,className:"max-w-[220px] truncate rounded-full border px-3 py-1 text-xs transition-colors "+(D?"border-accent-400 bg-accent-100 text-accent-700 ":"border-gray-200 bg-gray-50 text-gray-600 hover:border-gray-300 group-hover:text-accent-600 ")+"dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:border-gray-600 dark:group-hover:text-accent-400",children:I.label}),a.jsx("button",{type:"button","aria-label":t("chat.shortcut_pill_delete"),onClick:function(){w(A)},className:"absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-gray-200 text-[10px] leading-none text-gray-600 hover:bg-red-100 hover:text-red-700 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-red-950 dark:hover:text-red-200 "+(L?"":"hidden"),children:"×"})]},I.id!=null?I.id:A)}),i&&a.jsx("span",{role:"alert",className:"shrink-0 whitespace-nowrap text-xs text-red-500",children:i})]})}const Bf=[{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 _H(){return Bf.slice()}function wH(e){if(!e)return null;const t=String(e).toLowerCase();for(let n=0;n<Bf.length;n++)if(Bf[n].name===t)return Bf[n];return null}function SH(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(),i=wH(r);if(!i)return null;const o=(n[2]||"").trim();return{name:r,args:o,builtin:i}}const EH=y.forwardRef(function({onSend:t,onAbort:n,isBusy:r,disabled:i,sessionId:o,queuedCount:l=0,onBuiltinCommand:u,pendingQuotes:d=[],onRemoveQuote:f,onClearQuotes:p,planModeEnabled:h=!1},m){const{t:x}=Gt(),[v,k]=y.useState(""),[_,S]=y.useState([]),[w,N]=y.useState(!1);y.useEffect(()=>{const xe=()=>N(!1);return window.addEventListener("pave:plan-execute",xe),()=>window.removeEventListener("pave:plan-execute",xe)},[]),y.useEffect(()=>{h||N(!1)},[h]);const[R,T]=y.useState(null),[C,M]=y.useState(null),I=y.useRef(null),A="pave-asr-language",L="pave-asr-model",D=(xe,De)=>{try{return localStorage.getItem(xe)||De}catch{return De}},[$]=y.useState(()=>D(A,"auto")),[te,V]=y.useState(()=>D(L,"")),z=y.useRef(_),G=y.useRef(null),K=y.useRef(null),H=y.useRef(null),se=y.useRef(o),P=y.useRef(v),W=y.useRef(null),[ee,F]=y.useState(!1),[J,q]=y.useState(""),[Y,oe]=y.useState([]),[_e,ae]=y.useState(0),[ye,Fe]=y.useState(null),ct=y.useRef({data:null,time:0}),ht=6e4,pt=y.useCallback(xe=>{T(xe),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>T(null),5e3)},[]),et=y.useCallback(xe=>(M("Too many attachments. Maximum "+Qo+" per message. The extra files were not added."),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>M(null),5e3),xe),[]);y.useEffect(()=>()=>{W.current&&clearTimeout(W.current),I.current&&clearTimeout(I.current)},[]),y.useLayoutEffect(()=>{P.current=v},[v]),y.useLayoutEffect(()=>{se.current=o,H.current&&(clearTimeout(H.current),H.current=null);let xe="";if(o)try{xe=localStorage.getItem(go+o)||""}catch{}return k(xe),P.current=xe,S(De=>(De.forEach(Ke=>{Ke.preview&&URL.revokeObjectURL(Ke.preview)}),[])),()=>{H.current&&(clearTimeout(H.current),H.current=null);const De=se.current;if(De)try{P.current?localStorage.setItem(go+De,P.current):localStorage.removeItem(go+De)}catch{}}},[o]),y.useEffect(()=>{se.current&&(H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{try{v?localStorage.setItem(go+se.current,v):localStorage.removeItem(go+se.current)}catch{}},300))},[v]);const ze=y.useCallback(async()=>{const xe=ct.current;if(xe.data&&Date.now()-xe.time<ht){oe(xe.data);return}try{const De=await VO(),Ke=Array.isArray(De)?De:[];ct.current={data:Ke,time:Date.now()},oe(Ke)}catch{oe([])}},[]),Be=y.useMemo(()=>_H(),[]),At=y.useMemo(()=>{const xe=(J||"").trim().toLowerCase();if(ye){const X=Y.find(Te=>Te.skill===ye);return(X&&X.commands||[]).filter(Te=>xe?(Te.name||"").toLowerCase().includes(xe)||(Te.description||"").toLowerCase().includes(xe):!0).map(Te=>({type:"command",skill:ye,name:Te.name}))}const De=Be.filter(X=>xe?(X.name||"").toLowerCase().includes(xe)||(X.description||"").toLowerCase().includes(xe):!0).map(X=>({type:"builtin",name:X.name})),Ke=Y.filter(X=>xe?(X.skill||"").toLowerCase().includes(xe)||(X.description||"").toLowerCase().includes(xe)||(X.commands||[]).some(Ee=>(Ee.name||"").toLowerCase().includes(xe)||(Ee.description||"").toLowerCase().includes(xe)):!0).map(X=>({type:"skill",skill:X.skill}));return De.concat(Ke)},[J,ye,Y,Be]),lt=y.useCallback(()=>At.length,[At]),on=y.useCallback(xe=>{if(k(xe),P.current=xe,xe.startsWith("/")){const De=xe.slice(1),Ke=De.split(/\s/)[0]||"";if(!Ke.includes("/")&&!Ke.includes(".")){if(ye){const X=ye+" ";De.startsWith(X)?(q(De.slice(X.length)),ae(0)):(Fe(null),q(De),ae(0))}else q(De),ae(0);ee||(ze(),F(!0),ae(0))}else F(!1),q(""),Fe(null),ae(0)}else F(!1),q(""),Fe(null),ae(0)},[ee,ye,ze]),_t=y.useCallback((xe,De)=>{var Ke,X,Ee;if(xe==="__builtin__"&&De){k("/"+De+" "),F(!1),q(""),Fe(null),ae(0),(Ke=G.current)==null||Ke.focus();return}if(!De)Fe(xe),q(""),ae(0),k("/"+xe+" "),(X=G.current)==null||X.focus();else{const Te="/"+xe+" "+De+" ";k(Te),F(!1),q(""),Fe(null),ae(0),(Ee=G.current)==null||Ee.focus()}},[]),gn=y.useCallback(()=>{var xe;Fe(null),q(""),ae(0),k("/"),(xe=G.current)==null||xe.focus()},[]),Ht=y.useRef(""),Kt=y.useCallback((xe,De)=>{if(De&&De.mode==="snapshot"){const Ke=Ht.current||"",X=Ke&&!Ke.endsWith(" ")&&!Ke.endsWith(`
|
|
119
|
+
`)?" ":"";k(Ke+X+(xe||""));return}k(Ke=>{const X=Ke&&!Ke.endsWith(" ")&&!Ke.endsWith(`
|
|
120
|
+
`)?" ":"";return Ke+X+xe})},[]),ut=y.useRef(null),Pe=y.useCallback(()=>{Ht.current="",setTimeout(()=>{ut.current&&ut.current()},50)},[]),{state:le,progress:be,downloadingFile:fe,startRecording:Oe,stopRecording:ft,resumeRecording:gt,cancelRecording:dt}=xH({onTranscript:Kt,onError:pt,onAutoSubmit:Pe,model:te||void 0,language:$&&$!=="auto"?$:void 0}),Lt=y.useCallback(()=>(k(xe=>(Ht.current=xe||"",xe)),Oe()),[Oe]);y.useEffect(()=>{try{te&&localStorage.setItem(L,te)}catch{}},[te]),y.useEffect(()=>{let xe=!1;return Hf().then(De=>{xe||De&&Array.isArray(De.models)&&De.models.length>0&&V(Ke=>Ke||De.models[0].name)}).catch(()=>{}),()=>{xe=!0}},[Hf]),y.useEffect(()=>{const xe=G.current;xe&&(xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px")},[v]),y.useEffect(()=>{z.current=_},[_]),y.useEffect(()=>{var xe;(xe=G.current)==null||xe.focus()},[]),y.useImperativeHandle(m,()=>({focus:()=>{var xe;(xe=G.current)==null||xe.focus()},setText:xe=>{k(typeof xe=="string"?xe:""),requestAnimationFrame(()=>{var De;return(De=G.current)==null?void 0:De.focus()})}}),[]);const Wt=async()=>{const xe=v.trim();var De=_.filter(function(Te){return Ff(Te.type)}),Ke=_.filter(function(Te){return!Ff(Te.type)});const X=SH(xe);if(X&&typeof u=="function"){const Te=se.current;try{await u(X.name,X.args,{imageAttachments:De.length>0?De:void 0,fileAttachments:Ke.length>0?Ke:void 0})}catch{return}if(k(""),F(!1),q(""),Fe(null),ae(0),Te)try{localStorage.removeItem(go+Te)}catch{}_.forEach(function(mt){mt.preview&&URL.revokeObjectURL(mt.preview)}),S([]),G.current&&(G.current.style.height="auto");return}if(!xe&&De.length===0&&Ke.length===0&&d.length===0)return;const Ee=se.current;try{await t(xe,De.length>0?De:void 0,w&&h?"plan":void 0,Ke.length>0?Ke:void 0)}catch{return}if(k(""),F(!1),q(""),Fe(null),ae(0),Ee)try{localStorage.removeItem(go+Ee)}catch{}_.forEach(function(Te){Te.preview&&URL.revokeObjectURL(Te.preview)}),S([]),G.current&&(G.current.style.height="auto")};ut.current=Wt;const rt=xe=>{if(ee){const De=lt();if(xe.key==="ArrowDown"){De>0&&(xe.preventDefault(),ae(Ke=>(Ke+1)%De));return}if(xe.key==="ArrowUp"){De>0&&(xe.preventDefault(),ae(Ke=>(Ke-1+De)%De));return}if(xe.key==="Enter"||xe.key==="Tab"){if(De>0){xe.preventDefault();const Ke=At[_e];Ke&&(Ke.type==="command"?_t(Ke.skill,Ke.name):Ke.type==="builtin"?_t("__builtin__",Ke.name):_t(Ke.skill,null));return}if(xe.key==="Tab"){F(!1),q(""),Fe(null),ae(0);return}}if(xe.key==="Escape"){xe.preventDefault(),F(!1),q(""),Fe(null),ae(0);return}if(xe.key==="Backspace"&&ye){const Ke=v.slice(1),X=ye+" ";if(Ke===X||Ke===ye){xe.preventDefault(),gn();return}}}xe.key==="Enter"&&!xe.shiftKey&&(xe.preventDefault(),Wt())},wt=xe=>{if(!i){var De=xe.clipboardData&&xe.clipboardData.items;if(De){for(var Ke=[],X=0;X<De.length;X++){var Ee=(De[X].type||"").toLowerCase();if(Ep.indexOf(Ee)!==-1){var Te=De[X].getAsFile();Te&&Ke.push(Te)}}if(Ke.length!==0){for(var mt=!1,Ut=0;Ut<De.length;Ut++)if(De[Ut].type&&De[Ut].type.startsWith("text/")){mt=!0;break}mt||xe.preventDefault();var Rt=Ke.map(function(ve){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:ve,name:ve.name||"pasted-image.png",size:ve.size,type:ve.type,preview:null}}),st=Rt.length-(Qo-_.length);st>0&&et(st),S(function(ve){var Re=Qo-ve.length;if(Re<=0)return ve;for(var Xe=Rt.slice(0,Re),Ie=0;Ie<Xe.length;Ie++)Xe[Ie].preview=URL.createObjectURL(Xe[Ie].file);return ve.concat(Xe)})}}}},Yt=xe=>{const De=Array.from(xe.target.files||[]);if(De.length===0)return;const Ke=De.filter(Te=>Z5.indexOf(Te.type)!==-1);if(Ke.length===0){xe.target.value="";return}const X=Ke.map(Te=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Te,name:Te.name,size:Te.size,type:Te.type,preview:null}));var Ee=X.length-(Qo-_.length);Ee>0&&et(Ee),S(Te=>{var mt=Qo-Te.length;if(mt<=0)return Te;for(var Ut=X.slice(0,mt),Rt=0;Rt<Ut.length;Rt++)Ut[Rt].preview=Ff(Ut[Rt].file.type)?URL.createObjectURL(Ut[Rt].file):null;return[...Te,...Ut]}),xe.target.value=""},an=xe=>{S(De=>{const Ke=De.find(X=>X.id===xe);return Ke!=null&&Ke.preview&&URL.revokeObjectURL(Ke.preview),De.filter(X=>X.id!==xe)})},kt=xe=>xe<1024?xe+" B":xe<1024*1024?(xe/1024).toFixed(1)+" KB":(xe/(1024*1024)).toFixed(1)+" MB";return y.useEffect(()=>()=>{z.current.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview)})},[]),a.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:a.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[h&&w&&a.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:[a.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),a.jsx(bH,{quotes:d,onRemove:f,onClearAll:p}),_.length>0&&a.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:_.map(xe=>a.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:[xe.preview?a.jsx("img",{src:xe.preview,alt:xe.name,className:"w-10 h-10 rounded object-cover"}):a.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:xe.name}),a.jsx("p",{className:"text-xs text-gray-400",children:kt(xe.size)})]}),a.jsx("button",{onClick:()=>an(xe.id),"aria-label":`Remove attachment ${xe.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:a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},xe.id))}),a.jsx(kH,{onSend:t}),a.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:[a.jsx(yH,{skills:Y,builtins:Be,filter:J,onSelect:_t,visible:ee,selectedIndex:_e,activeSkill:ye,onBack:gn}),a.jsx("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:h&&a.jsxs("button",{onClick:()=>N(xe=>!xe),disabled:i||r,className:"shrink-0 h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium "+(w?"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:w?"Plan mode active (read-only) — click to switch to build":"Switch to plan mode (read-only)","aria-label":w?"Disable plan mode":"Enable plan mode","aria-pressed":w,children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})}),w?"Plan":""]})}),a.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[a.jsx("button",{onClick:()=>{var xe;return(xe=K.current)==null?void 0:xe.click()},disabled:i||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:x("chat.attach_file"),"aria-label":x("chat.attach_file"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})})}),a.jsx("input",{ref:K,type:"file",multiple:!0,accept:nH,onChange:Yt,className:"hidden"}),a.jsx("textarea",{ref:G,value:v,onChange:xe=>on(xe.target.value),onKeyDown:rt,onPaste:wt,placeholder:x("chat.send_placeholder"),disabled:i,rows:1,role:ee?"combobox":void 0,"aria-controls":ee?"slash-command-listbox":void 0,"aria-activedescendant":ee&<()>0?"slash-item-"+_e:void 0,"aria-expanded":ee||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]"}),a.jsxs("div",{className:"relative shrink-0 flex items-center",children:[a.jsx("button",{onClick:le==="recording"?ft:le==="paused"?gt:le==="loading"?dt:Lt,disabled:le==="draining"||(i||r)&&le!=="recording"&&le!=="loading"&&le!=="paused",className:"shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(le==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":le==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":le==="loading"||le==="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:le==="recording"?x("voice.stop_recording")||"Stop recording":le==="paused"?x("voice.resume_recording")||"Resume recording":le==="loading"?x("voice.loading_model"):le==="draining"?x("voice.processing")||"Processing remaining audio":x("voice.start_recording"),"aria-label":le==="recording"?x("voice.stop_recording")||"Stop recording":le==="paused"?x("voice.resume_recording")||"Resume recording":le==="loading"?x("voice.loading_model"):le==="draining"?x("voice.processing")||"Processing remaining audio":x("voice.start_recording"),children:le==="draining"?a.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):le==="loading"?a.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):le==="recording"?a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:a.jsx("circle",{cx:"12",cy:"12",r:"6"})}):le==="paused"?a.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"7.25",y:"6",width:"3.5",height:"12",rx:"1"}),a.jsx("rect",{x:"13.25",y:"6",width:"3.5",height:"12",rx:"1"})]}):a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})})}),le==="loading"&&a.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:[a.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${be}%`}})}),a.jsx("span",{children:fe?`${fe} ${be}%`:`${be}%`})]})]}),r&&a.jsxs("button",{onClick:n,className:"relative shrink-0 w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-colors",title:x("chat.stop_generating"),"aria-label":x("chat.stop_generating"),children:[a.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),l>0&&a.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})]})]})]}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:x("chat.send_hint")}),R&&a.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:[a.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{children:R}),a.jsx("button",{onClick:()=>T(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":x("voice.dismiss_error"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),C&&a.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:[a.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{children:C}),a.jsx("button",{onClick:()=>M(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":"Dismiss",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})}),NH="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",CH="text-sm text-gray-500 dark:text-gray-400",jH="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200 hover:underline transition-colors",Vg="w-4 h-4 text-gray-400 dark:text-gray-500",TH="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4",RH="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8",AH="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";function ES({variant:e,label:t,childSessionId:n,onSwitchToChild:r}){let i=null,o=a.jsx("span",{className:CH,children:t});return e==="compacted"?(i=a.jsx("svg",{className:Vg,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:TH})}),n&&(o=a.jsx("button",{onClick:r,className:jH,children:t}))):e==="archive"?i=a.jsx("svg",{className:Vg,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:RH})}):e==="terminal"&&(i=a.jsx("svg",{className:Vg,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:AH})})),a.jsxs("div",{className:NH,children:[i,o]})}function IH(e){e.cfaccess&&(window.location.href="/cdn-cgi/access/login/"+window.location.host)}function MH({enabled:e,tf:t}){return e?a.jsxs("button",{type:"button",onClick:()=>{window.location.href="/cdn-cgi/access/login/"+window.location.host},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:[a.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24","aria-hidden":"true",fill:"#F6821F",children:[a.jsx("path",{d:"16.52 17.28c.17-.55.02-1.1-.4-1.48a1.8 1.8 0 0 0-1.28-.52l-7.7-.02a.32.32 0 0 1-.27-.15.3.3 0 0 1-.04-.28c.06-.13.18-.22.32-.23l7.86-.02c1.64-.07 3.1-1.35 3.4-3 .35-1.82-.72-3.46-2.42-3.83-.1 0-.2-.02-.3-.02h-.62c-.17 0-.3-.13-.33-.3a.33.33 0 0 1 .22-.36c.1-.04.2-.06.3-.06.2 0 .42-.02.63-.02 2.57 0 4.66 1.96 4.66 4.37 0 2.26-1.76 4.06-4.05 4.06z"}),a.jsx("path",{d:"M4.8 16.5a.4.4 0 0 1-.2-.24A3.62 3.62 0 0 1 6.4 12a.44.44 0 0 1 .24-.06h11.5c.13 0 .24.1.26.23.02.13-.06.25-.18.3l-.08.02H6.72c-1.1.07-1.94 1.06-1.92 2.25v.03c-.6-.15-1.02-.63-1.02-1.2 0-.2.05-.4.14-.58-.5.5-.76 1.18-.7 1.86.05.67.43 1.27 1.02 1.64h.56z"})]}),t("login.sign_in_with_cloudflare","Sign in with Cloudflare Access")]}):null}const LH=["flow_registration_failed","state_mismatch","exchange_failed","not_pinned","login_failed"],OH={flow_registration_failed:"login.auth_error.flow_registration_failed",state_mismatch:"login.auth_error.state_mismatch",exchange_failed:"login.auth_error.exchange_failed",not_pinned:"login.auth_error.not_pinned",login_failed:"login.auth_error.login_failed"},DH=e=>(LH.includes(e)?OH[e]:void 0)||"login.auth_error.generic";function PH({darkMode:e,onToggleTheme:t}){const{t:n}=Gt(),r=(w,N)=>{const R=n(w);return R===w?N:R},i=(w,N,R)=>{const T=n(w,R);return T===w?N:T},[o,l]=y.useState(""),[u,d]=y.useState(""),[f,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(null),[k,_]=y.useState({google:!1,password:!1,cfaccess:!1});y.useEffect(()=>{const w=new URLSearchParams(window.location.search).get("auth_error");if(w){const N=decodeURIComponent(w);m(r(DH(N),r("login.auth_error.generic","Sign-in failed. Try again."))),v(N),window.history.replaceState({},"",window.location.pathname)}},[]),y.useEffect(()=>{fetch(ar("/auth/status")).then(w=>w.json()).then(w=>{const N={google:!!(w.providers&&w.providers.google),password:!!(w.providers&&w.providers.password),cfaccess:!!(w.providers&&w.providers.cfaccess)};_(N),IH(N)}).catch(()=>{})},[]);const S=async w=>{w.preventDefault(),m(null),v(null),p(!0);try{const N=await fetch(ar("/auth/membership/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o,password:u})}),R=await N.json().catch(()=>({}));if(!N.ok){m(R.error||"Login failed"),p(!1);return}window.location.reload()}catch(N){m("Connection error: "+N.message),p(!1)}};return a.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[a.jsx("div",{className:"flex justify-end p-4",children:a.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?a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}):a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})}),a.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:a.jsxs("div",{className:"w-full max-w-sm",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:a.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:n("login.pave_subtitle")})]}),a.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:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:n("login.sign_in")}),h&&a.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:h}),x&&a.jsx("div",{className:"-mt-3 mb-4 px-3 text-xs text-gray-400 dark:text-gray-500",children:i("login.auth_error.code_detail","Error code: {code}",{code:x})}),k.google&&a.jsxs("button",{type:"button",onClick:()=>{window.location.href=ar("/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:[a.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.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"}),a.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"}),a.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"}),a.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")]}),a.jsx(MH,{enabled:k.cfaccess,tf:r}),k.google&&k.password&&a.jsxs("div",{className:"flex items-center gap-3 my-4",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("login.or","or")}),a.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),k.password&&a.jsxs("form",{onSubmit:S,className:"space-y-3 mb-4",children:[a.jsx("input",{type:"email",placeholder:r("login.email_placeholder","Email"),value:o,onChange:w=>l(w.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"}),a.jsx("input",{type:"password",placeholder:r("login.password_placeholder","Password"),value:u,onChange:w=>d(w.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"}),a.jsx("button",{type:"submit",disabled:f,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:f?r("login.signing_in","Signing in..."):n("login.sign_in")})]}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:n("login.terms")})]})]})})]})}function FH({user:e,onLogout:t,onSkillManagement:n,onPricingSettings:r,onDlpSettings:i,onSettings:o,onBoard:l,onCapabilities:u}){const{t:d}=Gt(),[f,p]=y.useState(!1),h=y.useRef(null);if(y.useEffect(()=>{if(!f)return;function x(v){h.current&&!h.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 a.jsxs("div",{className:"relative",ref:h,children:[a.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?a.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):a.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-xs font-semibold",children:m})}),a.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),a.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&a.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:[a.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),n&&a.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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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")]}),l&&a.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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:[a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),d("user_menu.settings")]}),t&&a.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 BH({toolParts:e}){const{t}=Gt();return!e||e.length===0?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):a.jsxs("div",{className:"p-4",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),a.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(n=>a.jsx(zH,{part:n},n.id))})]})}function zH({part:e}){var i,o;const t=((i=e.state)==null?void 0:i.status)||"running",n=((o=e.state)==null?void 0:o.input)||{},r=UH(e.tool,n);return a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[a.jsxs("div",{className:"shrink-0",children:[t==="running"&&a.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&a.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&a.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),a.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 UH(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+Sf(t.filePath);case"Write":return"Writing "+Sf(t.filePath);case"Edit":return"Editing "+Sf(t.filePath);case"Bash":{const n=t.command||"";return NS(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+bk(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+bk(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return qH(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+Sf(t.filePath):t.command?NS(t.command):"Running "+e.toLowerCase()}}function Sf(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 NS(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 "+bk(n,20)}function qH(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 bk(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const vk=10,kk=24,CS=2,HH=14,J5="pave-terminal-font-size";function $H(){try{const e=localStorage.getItem(J5);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=vk&&t<=kk)return t}}catch{}return HH}function WH({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:i}=Gt();const o=y.useRef(null),l=y.useRef(null),u=y.useRef(null),[d,f]=y.useState($H),p=y.useCallback(()=>{f(k=>Math.max(vk,k-CS))},[]),h=y.useCallback(()=>{f(k=>Math.min(kk,k+CS))},[]);y.useEffect(()=>{try{localStorage.setItem(J5,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 S=()=>{const I=k.parentElement;if(I&&I.clientWidth>0&&I.clientHeight>0){k.width=I.clientWidth,k.height=I.clientHeight;return}const A=k.getBoundingClientRect();if(A.width>0&&A.height>0){k.width=A.width,k.height=A.height;return}k.width=0,k.height=0};S();const w=d;let N=Math.floor(k.width/w),R=new Array(N).fill(1);const T="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",C=()=>{_.fillStyle="rgba(0, 0, 0, 0.05)",_.fillRect(0,0,k.width,k.height),_.fillStyle="#0F0",_.font=w+"px monospace";for(let I=0;I<R.length;I++){const A=T.charAt(Math.floor(Math.random()*T.length));_.fillText(A,I*w,R[I]*w),R[I]*w>k.height&&Math.random()>.975&&(R[I]=0),R[I]++}u.current=requestAnimationFrame(C)},M=()=>{S(),N=Math.floor(k.width/w);const I=new Array(N).fill(0);for(let A=0;A<Math.min(R.length,I.length);A++)I[A]=R[A];R=I};return window.addEventListener("resize",M),u.current=requestAnimationFrame(C),()=>{window.removeEventListener("resize",M),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"}),a.jsxs("div",{className:`flex flex-col h-full ${m.bg} font-mono`,style:{fontSize:d+"px"},children:[a.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${m.headerBg} border-b ${m.headerBorder} shrink-0`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:n,title:""}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),a.jsx("span",{className:`${m.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:p,disabled:d<=vk,className:x,"aria-label":i("terminal.decrease_font"),title:i("terminal.decrease_font"),children:"A-"}),a.jsx("button",{type:"button",onClick:h,disabled:d>=kk,className:x,"aria-label":i("terminal.increase_font"),title:i("terminal.increase_font"),children:"A+"})]})]}),a.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?a.jsxs(a.Fragment,{children:[a.jsx("canvas",{ref:l,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&a.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=>a.jsx(GH,{part:k},k.id))})]}):a.jsx("div",{ref:o,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?a.jsxs("div",{children:[a.jsxs("div",{className:m.promptColor,children:["$ ",a.jsx("span",{className:"terminal-cursor",children:"█"})]}),a.jsx("p",{className:`${m.waitingText} mt-2`,children:"Awaiting commands..."})]}):a.jsxs(a.Fragment,{children:[e.map(k=>a.jsx(VH,{part:k,theme:m},k.id)),a.jsxs("div",{className:m.promptColor,children:["$ ",a.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function VH({part:e,theme:t}){var{t:n}=Gt();const{tool:r,state:i}=e;if(!i)return null;const o=i.status||"running";if(r==="question"&&o==="error")return null;const u=wp(r||i.title,i.input)||r||i.title||"unknown",d=i.output?nl(typeof i.output=="string"?i.output:JSON.stringify(i.output,null,2)):null;return a.jsxs("div",{className:"mb-2",children:[a.jsxs("div",{className:`${t.commandColor} break-all`,children:[a.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),u]}),o==="running"&&a.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),o==="completed"&&d&&a.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:d}),o==="completed"&&!d&&a.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),o==="error"&&a.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",i.error?nl(typeof i.error=="string"?i.error:i.error.message||n("common.error")):n("common.unknown_error")]}),o==="pending_confirmation"&&a.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function GH({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",o=wp(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 a.jsxs("div",{className:"text-xs font-mono truncate",children:[a.jsxs("span",{className:l[r]||"text-gray-400",children:["[",u[r]||r,"]"]}),a.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",o]})]})}function g1(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 Gg,jS;function KH(){if(jS)return Gg;jS=1;function e(){this.__data__=[],this.size=0}return Gg=e,Gg}var Kg,TS;function oc(){if(TS)return Kg;TS=1;function e(t,n){return t===n||t!==t&&n!==n}return Kg=e,Kg}var Yg,RS;function Np(){if(RS)return Yg;RS=1;var e=oc();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return Yg=t,Yg}var Qg,AS;function YH(){if(AS)return Qg;AS=1;var e=Np(),t=Array.prototype,n=t.splice;function r(i){var o=this.__data__,l=e(o,i);if(l<0)return!1;var u=o.length-1;return l==u?o.pop():n.call(o,l,1),--this.size,!0}return Qg=r,Qg}var Xg,IS;function QH(){if(IS)return Xg;IS=1;var e=Np();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return Xg=t,Xg}var Zg,MS;function XH(){if(MS)return Zg;MS=1;var e=Np();function t(n){return e(this.__data__,n)>-1}return Zg=t,Zg}var Jg,LS;function ZH(){if(LS)return Jg;LS=1;var e=Np();function t(n,r){var i=this.__data__,o=e(i,n);return o<0?(++this.size,i.push([n,r])):i[o][1]=r,this}return Jg=t,Jg}var em,OS;function Cp(){if(OS)return em;OS=1;var e=KH(),t=YH(),n=QH(),r=XH(),i=ZH();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=i,em=o,em}var tm,DS;function JH(){if(DS)return tm;DS=1;var e=Cp();function t(){this.__data__=new e,this.size=0}return tm=t,tm}var nm,PS;function e$(){if(PS)return nm;PS=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return nm=e,nm}var rm,FS;function t$(){if(FS)return rm;FS=1;function e(t){return this.__data__.get(t)}return rm=e,rm}var im,BS;function n$(){if(BS)return im;BS=1;function e(t){return this.__data__.has(t)}return im=e,im}var am,zS;function eI(){if(zS)return am;zS=1;var e=typeof sf=="object"&&sf&&sf.Object===Object&&sf;return am=e,am}var sm,US;function Ka(){if(US)return sm;US=1;var e=eI(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return sm=n,sm}var om,qS;function lc(){if(qS)return om;qS=1;var e=Ka(),t=e.Symbol;return om=t,om}var lm,HS;function r$(){if(HS)return lm;HS=1;var e=lc(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function o(l){var u=n.call(l,i),d=l[i];try{l[i]=void 0;var f=!0}catch{}var p=r.call(l);return f&&(u?l[i]=d:delete l[i]),p}return lm=o,lm}var cm,$S;function i$(){if($S)return cm;$S=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return cm=n,cm}var um,WS;function ll(){if(WS)return um;WS=1;var e=lc(),t=r$(),n=i$(),r="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:r:o&&o in Object(u)?t(u):n(u)}return um=l,um}var dm,VS;function ka(){if(VS)return dm;VS=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return dm=e,dm}var fm,GS;function td(){if(GS)return fm;GS=1;var e=ll(),t=ka(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==i||d==n||d==o}return fm=l,fm}var pm,KS;function a$(){if(KS)return pm;KS=1;var e=Ka(),t=e["__core-js_shared__"];return pm=t,pm}var hm,YS;function s$(){if(YS)return hm;YS=1;var e=a$(),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 hm=n,hm}var gm,QS;function tI(){if(QS)return gm;QS=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 gm=n,gm}var mm,XS;function o$(){if(XS)return mm;XS=1;var e=td(),t=s$(),n=ka(),r=tI(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,p=RegExp("^"+d.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(m){if(!n(m)||t(m))return!1;var x=e(m)?p:o;return x.test(r(m))}return mm=h,mm}var xm,ZS;function l$(){if(ZS)return xm;ZS=1;function e(t,n){return t==null?void 0:t[n]}return xm=e,xm}var ym,JS;function cl(){if(JS)return ym;JS=1;var e=o$(),t=l$();function n(r,i){var o=t(r,i);return e(o)?o:void 0}return ym=n,ym}var bm,eE;function m1(){if(eE)return bm;eE=1;var e=cl(),t=Ka(),n=e(t,"Map");return bm=n,bm}var vm,tE;function jp(){if(tE)return vm;tE=1;var e=cl(),t=e(Object,"create");return vm=t,vm}var km,nE;function c$(){if(nE)return km;nE=1;var e=jp();function t(){this.__data__=e?e(null):{},this.size=0}return km=t,km}var _m,rE;function u$(){if(rE)return _m;rE=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return _m=e,_m}var wm,iE;function d$(){if(iE)return wm;iE=1;var e=jp(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(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 wm=i,wm}var Sm,aE;function f$(){if(aE)return Sm;aE=1;var e=jp(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var o=this.__data__;return e?o[i]!==void 0:n.call(o,i)}return Sm=r,Sm}var Em,sE;function p$(){if(sE)return Em;sE=1;var e=jp(),t="__lodash_hash_undefined__";function n(r,i){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&i===void 0?t:i,this}return Em=n,Em}var Nm,oE;function h$(){if(oE)return Nm;oE=1;var e=c$(),t=u$(),n=d$(),r=f$(),i=p$();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=i,Nm=o,Nm}var Cm,lE;function g$(){if(lE)return Cm;lE=1;var e=h$(),t=Cp(),n=m1();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Cm=r,Cm}var jm,cE;function m$(){if(cE)return jm;cE=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return jm=e,jm}var Tm,uE;function Tp(){if(uE)return Tm;uE=1;var e=m$();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return Tm=t,Tm}var Rm,dE;function x$(){if(dE)return Rm;dE=1;var e=Tp();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Rm=t,Rm}var Am,fE;function y$(){if(fE)return Am;fE=1;var e=Tp();function t(n){return e(this,n).get(n)}return Am=t,Am}var Im,pE;function b$(){if(pE)return Im;pE=1;var e=Tp();function t(n){return e(this,n).has(n)}return Im=t,Im}var Mm,hE;function v$(){if(hE)return Mm;hE=1;var e=Tp();function t(n,r){var i=e(this,n),o=i.size;return i.set(n,r),this.size+=i.size==o?0:1,this}return Mm=t,Mm}var Lm,gE;function x1(){if(gE)return Lm;gE=1;var e=g$(),t=x$(),n=y$(),r=b$(),i=v$();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=i,Lm=o,Lm}var Om,mE;function k$(){if(mE)return Om;mE=1;var e=Cp(),t=m1(),n=x1(),r=200;function i(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 Om=i,Om}var Dm,xE;function Rp(){if(xE)return Dm;xE=1;var e=Cp(),t=JH(),n=e$(),r=t$(),i=n$(),o=k$();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=i,l.prototype.set=o,Dm=l,Dm}var Pm,yE;function y1(){if(yE)return Pm;yE=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i&&n(t[r],r,t)!==!1;);return t}return Pm=e,Pm}var Fm,bE;function nI(){if(bE)return Fm;bE=1;var e=cl(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Fm=t,Fm}var Bm,vE;function Ap(){if(vE)return Bm;vE=1;var e=nI();function t(n,r,i){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[r]=i}return Bm=t,Bm}var zm,kE;function Ip(){if(kE)return zm;kE=1;var e=Ap(),t=oc(),n=Object.prototype,r=n.hasOwnProperty;function i(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 zm=i,zm}var Um,_E;function nd(){if(_E)return Um;_E=1;var e=Ip(),t=Ap();function n(r,i,o,l){var u=!o;o||(o={});for(var d=-1,f=i.length;++d<f;){var p=i[d],h=l?l(o[p],r[p],p,o,r):void 0;h===void 0&&(h=r[p]),u?t(o,p,h):e(o,p,h)}return o}return Um=n,Um}var qm,wE;function _$(){if(wE)return qm;wE=1;function e(t,n){for(var r=-1,i=Array(t);++r<t;)i[r]=n(r);return i}return qm=e,qm}var Hm,SE;function cs(){if(SE)return Hm;SE=1;function e(t){return t!=null&&typeof t=="object"}return Hm=e,Hm}var $m,EE;function w$(){if(EE)return $m;EE=1;var e=ll(),t=cs(),n="[object Arguments]";function r(i){return t(i)&&e(i)==n}return $m=r,$m}var Wm,NE;function rd(){if(NE)return Wm;NE=1;var e=w$(),t=cs(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!i.call(l,"callee")};return Wm=o,Wm}var Vm,CE;function Lr(){if(CE)return Vm;CE=1;var e=Array.isArray;return Vm=e,Vm}var vu={exports:{}},Gm,jE;function S$(){if(jE)return Gm;jE=1;function e(){return!1}return Gm=e,Gm}vu.exports;var TE;function cc(){return TE||(TE=1,(function(e,t){var n=Ka(),r=S$(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||r;e.exports=f})(vu,vu.exports)),vu.exports}var Km,RE;function Mp(){if(RE)return Km;RE=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,i){var o=typeof r;return i=i??e,!!i&&(o=="number"||o!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return Km=n,Km}var Ym,AE;function b1(){if(AE)return Ym;AE=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Ym=t,Ym}var Qm,IE;function E$(){if(IE)return Qm;IE=1;var e=ll(),t=b1(),n=cs(),r="[object Arguments]",i="[object Array]",o="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",p="[object Number]",h="[object Object]",m="[object RegExp]",x="[object Set]",v="[object String]",k="[object WeakMap]",_="[object ArrayBuffer]",S="[object DataView]",w="[object Float32Array]",N="[object Float64Array]",R="[object Int8Array]",T="[object Int16Array]",C="[object Int32Array]",M="[object Uint8Array]",I="[object Uint8ClampedArray]",A="[object Uint16Array]",L="[object Uint32Array]",D={};D[w]=D[N]=D[R]=D[T]=D[C]=D[M]=D[I]=D[A]=D[L]=!0,D[r]=D[i]=D[_]=D[o]=D[S]=D[l]=D[u]=D[d]=D[f]=D[p]=D[h]=D[m]=D[x]=D[v]=D[k]=!1;function $(te){return n(te)&&t(te.length)&&!!D[e(te)]}return Qm=$,Qm}var Xm,ME;function Lp(){if(ME)return Xm;ME=1;function e(t){return function(n){return t(n)}}return Xm=e,Xm}var ku={exports:{}};ku.exports;var LE;function v1(){return LE||(LE=1,(function(e,t){var n=eI(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,l=o&&n.process,u=(function(){try{var d=i&&i.require&&i.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(ku,ku.exports)),ku.exports}var Zm,OE;function id(){if(OE)return Zm;OE=1;var e=E$(),t=Lp(),n=v1(),r=n&&n.isTypedArray,i=r?t(r):e;return Zm=i,Zm}var Jm,DE;function rI(){if(DE)return Jm;DE=1;var e=_$(),t=rd(),n=Lr(),r=cc(),i=Mp(),o=id(),l=Object.prototype,u=l.hasOwnProperty;function d(f,p){var h=n(f),m=!h&&t(f),x=!h&&!m&&r(f),v=!h&&!m&&!x&&o(f),k=h||m||x||v,_=k?e(f.length,String):[],S=_.length;for(var w in f)(p||u.call(f,w))&&!(k&&(w=="length"||x&&(w=="offset"||w=="parent")||v&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||i(w,S)))&&_.push(w);return _}return Jm=d,Jm}var e0,PE;function Op(){if(PE)return e0;PE=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return e0=t,e0}var t0,FE;function iI(){if(FE)return t0;FE=1;function e(t,n){return function(r){return t(n(r))}}return t0=e,t0}var n0,BE;function N$(){if(BE)return n0;BE=1;var e=iI(),t=e(Object.keys,Object);return n0=t,n0}var r0,zE;function k1(){if(zE)return r0;zE=1;var e=Op(),t=N$(),n=Object.prototype,r=n.hasOwnProperty;function i(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 r0=i,r0}var i0,UE;function Ps(){if(UE)return i0;UE=1;var e=td(),t=b1();function n(r){return r!=null&&t(r.length)&&!e(r)}return i0=n,i0}var a0,qE;function No(){if(qE)return a0;qE=1;var e=rI(),t=k1(),n=Ps();function r(i){return n(i)?e(i):t(i)}return a0=r,a0}var s0,HE;function C$(){if(HE)return s0;HE=1;var e=nd(),t=No();function n(r,i){return r&&e(i,t(i),r)}return s0=n,s0}var o0,$E;function j$(){if($E)return o0;$E=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return o0=e,o0}var l0,WE;function T$(){if(WE)return l0;WE=1;var e=ka(),t=Op(),n=j$(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!i.call(l,f))||d.push(f);return d}return l0=o,l0}var c0,VE;function ul(){if(VE)return c0;VE=1;var e=rI(),t=T$(),n=Ps();function r(i){return n(i)?e(i,!0):t(i)}return c0=r,c0}var u0,GE;function R$(){if(GE)return u0;GE=1;var e=nd(),t=ul();function n(r,i){return r&&e(i,t(i),r)}return u0=n,u0}var _u={exports:{}};_u.exports;var KE;function aI(){return KE||(KE=1,(function(e,t){var n=Ka(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,l=o?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,p){if(p)return f.slice();var h=f.length,m=u?u(h):new f.constructor(h);return f.copy(m),m}e.exports=d})(_u,_u.exports)),_u.exports}var d0,YE;function sI(){if(YE)return d0;YE=1;function e(t,n){var r=-1,i=t.length;for(n||(n=Array(i));++r<i;)n[r]=t[r];return n}return d0=e,d0}var f0,QE;function oI(){if(QE)return f0;QE=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=0,l=[];++r<i;){var u=t[r];n(u,r,t)&&(l[o++]=u)}return l}return f0=e,f0}var p0,XE;function lI(){if(XE)return p0;XE=1;function e(){return[]}return p0=e,p0}var h0,ZE;function _1(){if(ZE)return h0;ZE=1;var e=oI(),t=lI(),n=Object.prototype,r=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,o=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return r.call(l,u)}))}:t;return h0=o,h0}var g0,JE;function A$(){if(JE)return g0;JE=1;var e=nd(),t=_1();function n(r,i){return e(r,t(r),i)}return g0=n,g0}var m0,eN;function w1(){if(eN)return m0;eN=1;function e(t,n){for(var r=-1,i=n.length,o=t.length;++r<i;)t[o+r]=n[r];return t}return m0=e,m0}var x0,tN;function Dp(){if(tN)return x0;tN=1;var e=iI(),t=e(Object.getPrototypeOf,Object);return x0=t,x0}var y0,nN;function cI(){if(nN)return y0;nN=1;var e=w1(),t=Dp(),n=_1(),r=lI(),i=Object.getOwnPropertySymbols,o=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:r;return y0=o,y0}var b0,rN;function I$(){if(rN)return b0;rN=1;var e=nd(),t=cI();function n(r,i){return e(r,t(r),i)}return b0=n,b0}var v0,iN;function uI(){if(iN)return v0;iN=1;var e=w1(),t=Lr();function n(r,i,o){var l=i(r);return t(r)?l:e(l,o(r))}return v0=n,v0}var k0,aN;function dI(){if(aN)return k0;aN=1;var e=uI(),t=_1(),n=No();function r(i){return e(i,n,t)}return k0=r,k0}var _0,sN;function M$(){if(sN)return _0;sN=1;var e=uI(),t=cI(),n=ul();function r(i){return e(i,n,t)}return _0=r,_0}var w0,oN;function L$(){if(oN)return w0;oN=1;var e=cl(),t=Ka(),n=e(t,"DataView");return w0=n,w0}var S0,lN;function O$(){if(lN)return S0;lN=1;var e=cl(),t=Ka(),n=e(t,"Promise");return S0=n,S0}var E0,cN;function fI(){if(cN)return E0;cN=1;var e=cl(),t=Ka(),n=e(t,"Set");return E0=n,E0}var N0,uN;function D$(){if(uN)return N0;uN=1;var e=cl(),t=Ka(),n=e(t,"WeakMap");return N0=n,N0}var C0,dN;function uc(){if(dN)return C0;dN=1;var e=L$(),t=m1(),n=O$(),r=fI(),i=D$(),o=ll(),l=tI(),u="[object Map]",d="[object Object]",f="[object Promise]",p="[object Set]",h="[object WeakMap]",m="[object DataView]",x=l(e),v=l(t),k=l(n),_=l(r),S=l(i),w=o;return(e&&w(new e(new ArrayBuffer(1)))!=m||t&&w(new t)!=u||n&&w(n.resolve())!=f||r&&w(new r)!=p||i&&w(new i)!=h)&&(w=function(N){var R=o(N),T=R==d?N.constructor:void 0,C=T?l(T):"";if(C)switch(C){case x:return m;case v:return u;case k:return f;case _:return p;case S:return h}return R}),C0=w,C0}var j0,fN;function P$(){if(fN)return j0;fN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var i=r.length,o=new r.constructor(i);return i&&typeof r[0]=="string"&&t.call(r,"index")&&(o.index=r.index,o.input=r.input),o}return j0=n,j0}var T0,pN;function pI(){if(pN)return T0;pN=1;var e=Ka(),t=e.Uint8Array;return T0=t,T0}var R0,hN;function S1(){if(hN)return R0;hN=1;var e=pI();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return R0=t,R0}var A0,gN;function F$(){if(gN)return A0;gN=1;var e=S1();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return A0=t,A0}var I0,mN;function B$(){if(mN)return I0;mN=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return I0=t,I0}var M0,xN;function z$(){if(xN)return M0;xN=1;var e=lc(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(i){return n?Object(n.call(i)):{}}return M0=r,M0}var L0,yN;function hI(){if(yN)return L0;yN=1;var e=S1();function t(n,r){var i=r?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return L0=t,L0}var O0,bN;function U$(){if(bN)return O0;bN=1;var e=S1(),t=F$(),n=B$(),r=z$(),i=hI(),o="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",p="[object Set]",h="[object String]",m="[object Symbol]",x="[object ArrayBuffer]",v="[object DataView]",k="[object Float32Array]",_="[object Float64Array]",S="[object Int8Array]",w="[object Int16Array]",N="[object Int32Array]",R="[object Uint8Array]",T="[object Uint8ClampedArray]",C="[object Uint16Array]",M="[object Uint32Array]";function I(A,L,D){var $=A.constructor;switch(L){case x:return e(A);case o:case l:return new $(+A);case v:return t(A,D);case k:case _:case S:case w:case N:case R:case T:case C:case M:return i(A,D);case u:return new $;case d:case h:return new $(A);case f:return n(A);case p:return new $;case m:return r(A)}}return O0=I,O0}var D0,vN;function gI(){if(vN)return D0;vN=1;var e=ka(),t=Object.create,n=(function(){function r(){}return function(i){if(!e(i))return{};if(t)return t(i);r.prototype=i;var o=new r;return r.prototype=void 0,o}})();return D0=n,D0}var P0,kN;function mI(){if(kN)return P0;kN=1;var e=gI(),t=Dp(),n=Op();function r(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return P0=r,P0}var F0,_N;function q$(){if(_N)return F0;_N=1;var e=uc(),t=cs(),n="[object Map]";function r(i){return t(i)&&e(i)==n}return F0=r,F0}var B0,wN;function H$(){if(wN)return B0;wN=1;var e=q$(),t=Lp(),n=v1(),r=n&&n.isMap,i=r?t(r):e;return B0=i,B0}var z0,SN;function $$(){if(SN)return z0;SN=1;var e=uc(),t=cs(),n="[object Set]";function r(i){return t(i)&&e(i)==n}return z0=r,z0}var U0,EN;function W$(){if(EN)return U0;EN=1;var e=$$(),t=Lp(),n=v1(),r=n&&n.isSet,i=r?t(r):e;return U0=i,U0}var q0,NN;function xI(){if(NN)return q0;NN=1;var e=Rp(),t=y1(),n=Ip(),r=C$(),i=R$(),o=aI(),l=sI(),u=A$(),d=I$(),f=dI(),p=M$(),h=uc(),m=P$(),x=U$(),v=mI(),k=Lr(),_=cc(),S=H$(),w=ka(),N=W$(),R=No(),T=ul(),C=1,M=2,I=4,A="[object Arguments]",L="[object Array]",D="[object Boolean]",$="[object Date]",te="[object Error]",V="[object Function]",z="[object GeneratorFunction]",G="[object Map]",K="[object Number]",H="[object Object]",se="[object RegExp]",P="[object Set]",W="[object String]",ee="[object Symbol]",F="[object WeakMap]",J="[object ArrayBuffer]",q="[object DataView]",Y="[object Float32Array]",oe="[object Float64Array]",_e="[object Int8Array]",ae="[object Int16Array]",ye="[object Int32Array]",Fe="[object Uint8Array]",ct="[object Uint8ClampedArray]",ht="[object Uint16Array]",pt="[object Uint32Array]",et={};et[A]=et[L]=et[J]=et[q]=et[D]=et[$]=et[Y]=et[oe]=et[_e]=et[ae]=et[ye]=et[G]=et[K]=et[H]=et[se]=et[P]=et[W]=et[ee]=et[Fe]=et[ct]=et[ht]=et[pt]=!0,et[te]=et[V]=et[F]=!1;function ze(Be,At,lt,on,_t,gn){var Ht,Kt=At&C,ut=At&M,Pe=At&I;if(lt&&(Ht=_t?lt(Be,on,_t,gn):lt(Be)),Ht!==void 0)return Ht;if(!w(Be))return Be;var le=k(Be);if(le){if(Ht=m(Be),!Kt)return l(Be,Ht)}else{var be=h(Be),fe=be==V||be==z;if(_(Be))return o(Be,Kt);if(be==H||be==A||fe&&!_t){if(Ht=ut||fe?{}:v(Be),!Kt)return ut?d(Be,i(Ht,Be)):u(Be,r(Ht,Be))}else{if(!et[be])return _t?Be:{};Ht=x(Be,be,Kt)}}gn||(gn=new e);var Oe=gn.get(Be);if(Oe)return Oe;gn.set(Be,Ht),N(Be)?Be.forEach(function(dt){Ht.add(ze(dt,At,lt,dt,Be,gn))}):S(Be)&&Be.forEach(function(dt,Lt){Ht.set(Lt,ze(dt,At,lt,Lt,Be,gn))});var ft=Pe?ut?p:f:ut?T:R,gt=le?void 0:ft(Be);return t(gt||Be,function(dt,Lt){gt&&(Lt=dt,dt=Be[Lt]),n(Ht,Lt,ze(dt,At,lt,Lt,Be,gn))}),Ht}return q0=ze,q0}var H0,CN;function V$(){if(CN)return H0;CN=1;var e=xI(),t=4;function n(r){return e(r,t)}return H0=n,H0}var $0,jN;function E1(){if(jN)return $0;jN=1;function e(t){return function(){return t}}return $0=e,$0}var W0,TN;function G$(){if(TN)return W0;TN=1;function e(t){return function(n,r,i){for(var o=-1,l=Object(n),u=i(n),d=u.length;d--;){var f=u[t?d:++o];if(r(l[f],f,l)===!1)break}return n}}return W0=e,W0}var V0,RN;function N1(){if(RN)return V0;RN=1;var e=G$(),t=e();return V0=t,V0}var G0,AN;function C1(){if(AN)return G0;AN=1;var e=N1(),t=No();function n(r,i){return r&&e(r,i,t)}return G0=n,G0}var K0,IN;function K$(){if(IN)return K0;IN=1;var e=Ps();function t(n,r){return function(i,o){if(i==null)return i;if(!e(i))return n(i,o);for(var l=i.length,u=r?l:-1,d=Object(i);(r?u--:++u<l)&&o(d[u],u,d)!==!1;);return i}}return K0=t,K0}var Y0,MN;function Pp(){if(MN)return Y0;MN=1;var e=C1(),t=K$(),n=t(e);return Y0=n,Y0}var Q0,LN;function dl(){if(LN)return Q0;LN=1;function e(t){return t}return Q0=e,Q0}var X0,ON;function yI(){if(ON)return X0;ON=1;var e=dl();function t(n){return typeof n=="function"?n:e}return X0=t,X0}var Z0,DN;function bI(){if(DN)return Z0;DN=1;var e=y1(),t=Pp(),n=yI(),r=Lr();function i(o,l){var u=r(o)?e:t;return u(o,n(l))}return Z0=i,Z0}var J0,PN;function vI(){return PN||(PN=1,J0=bI()),J0}var ex,FN;function Y$(){if(FN)return ex;FN=1;var e=Pp();function t(n,r){var i=[];return e(n,function(o,l,u){r(o,l,u)&&i.push(o)}),i}return ex=t,ex}var tx,BN;function Q$(){if(BN)return tx;BN=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return tx=t,tx}var nx,zN;function X$(){if(zN)return nx;zN=1;function e(t){return this.__data__.has(t)}return nx=e,nx}var rx,UN;function kI(){if(UN)return rx;UN=1;var e=x1(),t=Q$(),n=X$();function r(i){var o=-1,l=i==null?0:i.length;for(this.__data__=new e;++o<l;)this.add(i[o])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,rx=r,rx}var ix,qN;function Z$(){if(qN)return ix;qN=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(t[r],r,t))return!0;return!1}return ix=e,ix}var ax,HN;function _I(){if(HN)return ax;HN=1;function e(t,n){return t.has(n)}return ax=e,ax}var sx,$N;function wI(){if($N)return sx;$N=1;var e=kI(),t=Z$(),n=_I(),r=1,i=2;function o(l,u,d,f,p,h){var m=d&r,x=l.length,v=u.length;if(x!=v&&!(m&&v>x))return!1;var k=h.get(l),_=h.get(u);if(k&&_)return k==u&&_==l;var S=-1,w=!0,N=d&i?new e:void 0;for(h.set(l,u),h.set(u,l);++S<x;){var R=l[S],T=u[S];if(f)var C=m?f(T,R,S,u,l,h):f(R,T,S,l,u,h);if(C!==void 0){if(C)continue;w=!1;break}if(N){if(!t(u,function(M,I){if(!n(N,I)&&(R===M||p(R,M,d,f,h)))return N.push(I)})){w=!1;break}}else if(!(R===T||p(R,T,d,f,h))){w=!1;break}}return h.delete(l),h.delete(u),w}return sx=o,sx}var ox,WN;function J$(){if(WN)return ox;WN=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i,o){r[++n]=[o,i]}),r}return ox=e,ox}var lx,VN;function j1(){if(VN)return lx;VN=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i){r[++n]=i}),r}return lx=e,lx}var cx,GN;function eW(){if(GN)return cx;GN=1;var e=lc(),t=pI(),n=oc(),r=wI(),i=J$(),o=j1(),l=1,u=2,d="[object Boolean]",f="[object Date]",p="[object Error]",h="[object Map]",m="[object Number]",x="[object RegExp]",v="[object Set]",k="[object String]",_="[object Symbol]",S="[object ArrayBuffer]",w="[object DataView]",N=e?e.prototype:void 0,R=N?N.valueOf:void 0;function T(C,M,I,A,L,D,$){switch(I){case w:if(C.byteLength!=M.byteLength||C.byteOffset!=M.byteOffset)return!1;C=C.buffer,M=M.buffer;case S:return!(C.byteLength!=M.byteLength||!D(new t(C),new t(M)));case d:case f:case m:return n(+C,+M);case p:return C.name==M.name&&C.message==M.message;case x:case k:return C==M+"";case h:var te=i;case v:var V=A&l;if(te||(te=o),C.size!=M.size&&!V)return!1;var z=$.get(C);if(z)return z==M;A|=u,$.set(C,M);var G=r(te(C),te(M),A,L,D,$);return $.delete(C),G;case _:if(R)return R.call(C)==R.call(M)}return!1}return cx=T,cx}var ux,KN;function tW(){if(KN)return ux;KN=1;var e=dI(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(o,l,u,d,f,p){var h=u&t,m=e(o),x=m.length,v=e(l),k=v.length;if(x!=k&&!h)return!1;for(var _=x;_--;){var S=m[_];if(!(h?S in l:r.call(l,S)))return!1}var w=p.get(o),N=p.get(l);if(w&&N)return w==l&&N==o;var R=!0;p.set(o,l),p.set(l,o);for(var T=h;++_<x;){S=m[_];var C=o[S],M=l[S];if(d)var I=h?d(M,C,S,l,o,p):d(C,M,S,o,l,p);if(!(I===void 0?C===M||f(C,M,u,d,p):I)){R=!1;break}T||(T=S=="constructor")}if(R&&!T){var A=o.constructor,L=l.constructor;A!=L&&"constructor"in o&&"constructor"in l&&!(typeof A=="function"&&A instanceof A&&typeof L=="function"&&L instanceof L)&&(R=!1)}return p.delete(o),p.delete(l),R}return ux=i,ux}var dx,YN;function nW(){if(YN)return dx;YN=1;var e=Rp(),t=wI(),n=eW(),r=tW(),i=uc(),o=Lr(),l=cc(),u=id(),d=1,f="[object Arguments]",p="[object Array]",h="[object Object]",m=Object.prototype,x=m.hasOwnProperty;function v(k,_,S,w,N,R){var T=o(k),C=o(_),M=T?p:i(k),I=C?p:i(_);M=M==f?h:M,I=I==f?h:I;var A=M==h,L=I==h,D=M==I;if(D&&l(k)){if(!l(_))return!1;T=!0,A=!1}if(D&&!A)return R||(R=new e),T||u(k)?t(k,_,S,w,N,R):n(k,_,M,S,w,N,R);if(!(S&d)){var $=A&&x.call(k,"__wrapped__"),te=L&&x.call(_,"__wrapped__");if($||te){var V=$?k.value():k,z=te?_.value():_;return R||(R=new e),N(V,z,S,w,R)}}return D?(R||(R=new e),r(k,_,S,w,N,R)):!1}return dx=v,dx}var fx,QN;function SI(){if(QN)return fx;QN=1;var e=nW(),t=cs();function n(r,i,o,l,u){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,o,l,n,u)}return fx=n,fx}var px,XN;function rW(){if(XN)return px;XN=1;var e=Rp(),t=SI(),n=1,r=2;function i(o,l,u,d){var f=u.length,p=f,h=!d;if(o==null)return!p;for(o=Object(o);f--;){var m=u[f];if(h&&m[2]?m[1]!==o[m[0]]:!(m[0]in o))return!1}for(;++f<p;){m=u[f];var x=m[0],v=o[x],k=m[1];if(h&&m[2]){if(v===void 0&&!(x in o))return!1}else{var _=new e;if(d)var S=d(v,k,x,o,l,_);if(!(S===void 0?t(k,v,n|r,d,_):S))return!1}}return!0}return px=i,px}var hx,ZN;function EI(){if(ZN)return hx;ZN=1;var e=ka();function t(n){return n===n&&!e(n)}return hx=t,hx}var gx,JN;function iW(){if(JN)return gx;JN=1;var e=EI(),t=No();function n(r){for(var i=t(r),o=i.length;o--;){var l=i[o],u=r[l];i[o]=[l,u,e(u)]}return i}return gx=n,gx}var mx,eC;function NI(){if(eC)return mx;eC=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return mx=e,mx}var xx,tC;function aW(){if(tC)return xx;tC=1;var e=rW(),t=iW(),n=NI();function r(i){var o=t(i);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(l){return l===i||e(l,i,o)}}return xx=r,xx}var yx,nC;function dc(){if(nC)return yx;nC=1;var e=ll(),t=cs(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return yx=r,yx}var bx,rC;function T1(){if(rC)return bx;rC=1;var e=Lr(),t=dc(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(o,l){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||l!=null&&o in Object(l)}return bx=i,bx}var vx,iC;function sW(){if(iC)return vx;iC=1;var e=x1(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var l=arguments,u=i?i.apply(this,l):l[0],d=o.cache;if(d.has(u))return d.get(u);var f=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,vx=n,vx}var kx,aC;function oW(){if(aC)return kx;aC=1;var e=sW(),t=500;function n(r){var i=e(r,function(l){return o.size===t&&o.clear(),l}),o=i.cache;return i}return kx=n,kx}var _x,sC;function lW(){if(sC)return _x;sC=1;var e=oW(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(l,u,d,f){o.push(d?f.replace(n,"$1"):u||l)}),o});return _x=r,_x}var wx,oC;function Fp(){if(oC)return wx;oC=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,o=Array(i);++r<i;)o[r]=n(t[r],r,t);return o}return wx=e,wx}var Sx,lC;function cW(){if(lC)return Sx;lC=1;var e=lc(),t=Fp(),n=Lr(),r=dc(),i=e?e.prototype:void 0,o=i?i.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 Sx=l,Sx}var Ex,cC;function CI(){if(cC)return Ex;cC=1;var e=cW();function t(n){return n==null?"":e(n)}return Ex=t,Ex}var Nx,uC;function Bp(){if(uC)return Nx;uC=1;var e=Lr(),t=T1(),n=lW(),r=CI();function i(o,l){return e(o)?o:t(o,l)?[o]:n(r(o))}return Nx=i,Nx}var Cx,dC;function ad(){if(dC)return Cx;dC=1;var e=dc();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Cx=t,Cx}var jx,fC;function zp(){if(fC)return jx;fC=1;var e=Bp(),t=ad();function n(r,i){i=e(i,r);for(var o=0,l=i.length;r!=null&&o<l;)r=r[t(i[o++])];return o&&o==l?r:void 0}return jx=n,jx}var Tx,pC;function uW(){if(pC)return Tx;pC=1;var e=zp();function t(n,r,i){var o=n==null?void 0:e(n,r);return o===void 0?i:o}return Tx=t,Tx}var Rx,hC;function dW(){if(hC)return Rx;hC=1;function e(t,n){return t!=null&&n in Object(t)}return Rx=e,Rx}var Ax,gC;function jI(){if(gC)return Ax;gC=1;var e=Bp(),t=rd(),n=Lr(),r=Mp(),i=b1(),o=ad();function l(u,d,f){d=e(d,u);for(var p=-1,h=d.length,m=!1;++p<h;){var x=o(d[p]);if(!(m=u!=null&&f(u,x)))break;u=u[x]}return m||++p!=h?m:(h=u==null?0:u.length,!!h&&i(h)&&r(x,h)&&(n(u)||t(u)))}return Ax=l,Ax}var Ix,mC;function TI(){if(mC)return Ix;mC=1;var e=dW(),t=jI();function n(r,i){return r!=null&&t(r,i,e)}return Ix=n,Ix}var Mx,xC;function fW(){if(xC)return Mx;xC=1;var e=SI(),t=uW(),n=TI(),r=T1(),i=EI(),o=NI(),l=ad(),u=1,d=2;function f(p,h){return r(p)&&i(h)?o(l(p),h):function(m){var x=t(m,p);return x===void 0&&x===h?n(m,p):e(h,x,u|d)}}return Mx=f,Mx}var Lx,yC;function RI(){if(yC)return Lx;yC=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Lx=e,Lx}var Ox,bC;function pW(){if(bC)return Ox;bC=1;var e=zp();function t(n){return function(r){return e(r,n)}}return Ox=t,Ox}var Dx,vC;function hW(){if(vC)return Dx;vC=1;var e=RI(),t=pW(),n=T1(),r=ad();function i(o){return n(o)?e(r(o)):t(o)}return Dx=i,Dx}var Px,kC;function Fs(){if(kC)return Px;kC=1;var e=aW(),t=fW(),n=dl(),r=Lr(),i=hW();function o(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):i(l)}return Px=o,Px}var Fx,_C;function AI(){if(_C)return Fx;_C=1;var e=oI(),t=Y$(),n=Fs(),r=Lr();function i(o,l){var u=r(o)?e:t;return u(o,n(l,3))}return Fx=i,Fx}var Bx,wC;function gW(){if(wC)return Bx;wC=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,i){return r!=null&&t.call(r,i)}return Bx=n,Bx}var zx,SC;function II(){if(SC)return zx;SC=1;var e=gW(),t=jI();function n(r,i){return r!=null&&t(r,i,e)}return zx=n,zx}var Ux,EC;function mW(){if(EC)return Ux;EC=1;var e=k1(),t=uc(),n=rd(),r=Lr(),i=Ps(),o=cc(),l=Op(),u=id(),d="[object Map]",f="[object Set]",p=Object.prototype,h=p.hasOwnProperty;function m(x){if(x==null)return!0;if(i(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(h.call(x,k))return!1;return!0}return Ux=m,Ux}var qx,NC;function MI(){if(NC)return qx;NC=1;function e(t){return t===void 0}return qx=e,qx}var Hx,CC;function LI(){if(CC)return Hx;CC=1;var e=Pp(),t=Ps();function n(r,i){var o=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,f){l[++o]=i(u,d,f)}),l}return Hx=n,Hx}var $x,jC;function OI(){if(jC)return $x;jC=1;var e=Fp(),t=Fs(),n=LI(),r=Lr();function i(o,l){var u=r(o)?e:n;return u(o,t(l,3))}return $x=i,$x}var Wx,TC;function xW(){if(TC)return Wx;TC=1;function e(t,n,r,i){var o=-1,l=t==null?0:t.length;for(i&&l&&(r=t[++o]);++o<l;)r=n(r,t[o],o,t);return r}return Wx=e,Wx}var Vx,RC;function yW(){if(RC)return Vx;RC=1;function e(t,n,r,i,o){return o(t,function(l,u,d){r=i?(i=!1,l):n(r,l,u,d)}),r}return Vx=e,Vx}var Gx,AC;function DI(){if(AC)return Gx;AC=1;var e=xW(),t=Pp(),n=Fs(),r=yW(),i=Lr();function o(l,u,d){var f=i(l)?e:r,p=arguments.length<3;return f(l,n(u,4),d,p,t)}return Gx=o,Gx}var Kx,IC;function bW(){if(IC)return Kx;IC=1;var e=ll(),t=Lr(),n=cs(),r="[object String]";function i(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return Kx=i,Kx}var Yx,MC;function vW(){if(MC)return Yx;MC=1;var e=RI(),t=e("length");return Yx=t,Yx}var Qx,LC;function kW(){if(LC)return Qx;LC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+o+"]");function d(f){return u.test(f)}return Qx=d,Qx}var Xx,OC;function _W(){if(OC)return Xx;OC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",p="[^"+e+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",v=f+"?",k="["+o+"]?",_="(?:"+x+"(?:"+[p,h,m].join("|")+")"+k+v+")*",S=k+v+_,w="(?:"+[p+u+"?",u,h,m,l].join("|")+")",N=RegExp(d+"(?="+d+")|"+w+S,"g");function R(T){for(var C=N.lastIndex=0;N.test(T);)++C;return C}return Xx=R,Xx}var Zx,DC;function wW(){if(DC)return Zx;DC=1;var e=vW(),t=kW(),n=_W();function r(i){return t(i)?n(i):e(i)}return Zx=r,Zx}var Jx,PC;function SW(){if(PC)return Jx;PC=1;var e=k1(),t=uc(),n=Ps(),r=bW(),i=wW(),o="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return r(d)?i(d):d.length;var f=t(d);return f==o||f==l?d.size:e(d).length}return Jx=u,Jx}var ey,FC;function EW(){if(FC)return ey;FC=1;var e=y1(),t=gI(),n=C1(),r=Fs(),i=Dp(),o=Lr(),l=cc(),u=td(),d=ka(),f=id();function p(h,m,x){var v=o(h),k=v||l(h)||f(h);if(m=r(m,4),x==null){var _=h&&h.constructor;k?x=v?new _:[]:d(h)?x=u(_)?t(i(h)):{}:x={}}return(k?e:n)(h,function(S,w,N){return m(x,S,w,N)}),x}return ey=p,ey}var ty,BC;function NW(){if(BC)return ty;BC=1;var e=lc(),t=rd(),n=Lr(),r=e?e.isConcatSpreadable:void 0;function i(o){return n(o)||t(o)||!!(r&&o&&o[r])}return ty=i,ty}var ny,zC;function R1(){if(zC)return ny;zC=1;var e=w1(),t=NW();function n(r,i,o,l,u){var d=-1,f=r.length;for(o||(o=t),u||(u=[]);++d<f;){var p=r[d];i>0&&o(p)?i>1?n(p,i-1,o,l,u):e(u,p):l||(u[u.length]=p)}return u}return ny=n,ny}var ry,UC;function CW(){if(UC)return ry;UC=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 ry=e,ry}var iy,qC;function PI(){if(qC)return iy;qC=1;var e=CW(),t=Math.max;function n(r,i,o){return i=t(i===void 0?r.length-1:i,0),function(){for(var l=arguments,u=-1,d=t(l.length-i,0),f=Array(d);++u<d;)f[u]=l[i+u];u=-1;for(var p=Array(i+1);++u<i;)p[u]=l[u];return p[i]=o(f),e(r,this,p)}}return iy=n,iy}var ay,HC;function jW(){if(HC)return ay;HC=1;var e=E1(),t=nI(),n=dl(),r=t?function(i,o){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return ay=r,ay}var sy,$C;function TW(){if($C)return sy;$C=1;var e=800,t=16,n=Date.now;function r(i){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 i.apply(void 0,arguments)}}return sy=r,sy}var oy,WC;function FI(){if(WC)return oy;WC=1;var e=jW(),t=TW(),n=t(e);return oy=n,oy}var ly,VC;function Up(){if(VC)return ly;VC=1;var e=dl(),t=PI(),n=FI();function r(i,o){return n(t(i,o,e),i+"")}return ly=r,ly}var cy,GC;function BI(){if(GC)return cy;GC=1;function e(t,n,r,i){for(var o=t.length,l=r+(i?1:-1);i?l--:++l<o;)if(n(t[l],l,t))return l;return-1}return cy=e,cy}var uy,KC;function RW(){if(KC)return uy;KC=1;function e(t){return t!==t}return uy=e,uy}var dy,YC;function AW(){if(YC)return dy;YC=1;function e(t,n,r){for(var i=r-1,o=t.length;++i<o;)if(t[i]===n)return i;return-1}return dy=e,dy}var fy,QC;function IW(){if(QC)return fy;QC=1;var e=BI(),t=RW(),n=AW();function r(i,o,l){return o===o?n(i,o,l):e(i,t,l)}return fy=r,fy}var py,XC;function MW(){if(XC)return py;XC=1;var e=IW();function t(n,r){var i=n==null?0:n.length;return!!i&&e(n,r,0)>-1}return py=t,py}var hy,ZC;function LW(){if(ZC)return hy;ZC=1;function e(t,n,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(n,t[i]))return!0;return!1}return hy=e,hy}var gy,JC;function OW(){if(JC)return gy;JC=1;function e(){}return gy=e,gy}var my,ej;function DW(){if(ej)return my;ej=1;var e=fI(),t=OW(),n=j1(),r=1/0,i=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return my=i,my}var xy,tj;function PW(){if(tj)return xy;tj=1;var e=kI(),t=MW(),n=LW(),r=_I(),i=DW(),o=j1(),l=200;function u(d,f,p){var h=-1,m=t,x=d.length,v=!0,k=[],_=k;if(p)v=!1,m=n;else if(x>=l){var S=f?null:i(d);if(S)return o(S);v=!1,m=r,_=new e}else _=f?[]:k;e:for(;++h<x;){var w=d[h],N=f?f(w):w;if(w=p||w!==0?w:0,v&&N===N){for(var R=_.length;R--;)if(_[R]===N)continue e;f&&_.push(N),k.push(w)}else m(_,N,p)||(_!==k&&_.push(N),k.push(w))}return k}return xy=u,xy}var yy,nj;function zI(){if(nj)return yy;nj=1;var e=Ps(),t=cs();function n(r){return t(r)&&e(r)}return yy=n,yy}var by,rj;function FW(){if(rj)return by;rj=1;var e=R1(),t=Up(),n=PW(),r=zI(),i=t(function(o){return n(e(o,1,r,!0))});return by=i,by}var vy,ij;function BW(){if(ij)return vy;ij=1;var e=Fp();function t(n,r){return e(r,function(i){return n[i]})}return vy=t,vy}var ky,aj;function UI(){if(aj)return ky;aj=1;var e=BW(),t=No();function n(r){return r==null?[]:e(r,t(r))}return ky=n,ky}var _y,sj;function _a(){if(sj)return _y;sj=1;var e;if(typeof g1=="function")try{e={clone:V$(),constant:E1(),each:vI(),filter:AI(),has:II(),isArray:Lr(),isEmpty:mW(),isFunction:td(),isUndefined:MI(),keys:No(),map:OI(),reduce:DI(),size:SW(),transform:EW(),union:FW(),values:UI()}}catch{}return e||(e=window._),_y=e,_y}var wy,oj;function A1(){if(oj)return wy;oj=1;var e=_a();wy=i;var t="\0",n="\0",r="";function i(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={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(p){return this._label=p,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(h){return e.isEmpty(p._in[h])})},i.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(h){return e.isEmpty(p._out[h])})},i.prototype.setNodes=function(p,h){var m=arguments,x=this;return e.each(p,function(v){m.length>1?x.setNode(v,h):x.setNode(v)}),this},i.prototype.setNode=function(p,h){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=h),this):(this._nodes[p]=arguments.length>1?h: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)},i.prototype.node=function(p){return this._nodes[p]},i.prototype.hasNode=function(p){return e.has(this._nodes,p)},i.prototype.removeNode=function(p){var h=this;if(e.has(this._nodes,p)){var m=function(x){h.removeEdge(h._edgeObjs[x])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(x){h.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},i.prototype.setParent=function(p,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(h))h=n;else{h+="";for(var m=h;!e.isUndefined(m);m=this.parent(m))if(m===p)throw new Error("Setting "+h+" as parent of "+p+" would create a cycle");this.setNode(h)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=h,this._children[h][p]=!0,this},i.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},i.prototype.parent=function(p){if(this._isCompound){var h=this._parent[p];if(h!==n)return h}},i.prototype.children=function(p){if(e.isUndefined(p)&&(p=n),this._isCompound){var h=this._children[p];if(h)return e.keys(h)}else{if(p===n)return this.nodes();if(this.hasNode(p))return[]}},i.prototype.predecessors=function(p){var h=this._preds[p];if(h)return e.keys(h)},i.prototype.successors=function(p){var h=this._sucs[p];if(h)return e.keys(h)},i.prototype.neighbors=function(p){var h=this.predecessors(p);if(h)return e.union(h,this.successors(p))},i.prototype.isLeaf=function(p){var h;return this.isDirected()?h=this.successors(p):h=this.neighbors(p),h.length===0},i.prototype.filterNodes=function(p){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var m=this;e.each(this._nodes,function(k,_){p(_)&&h.setNode(_,k)}),e.each(this._edgeObjs,function(k){h.hasNode(k.v)&&h.hasNode(k.w)&&h.setEdge(k,m.edge(k))});var x={};function v(k){var _=m.parent(k);return _===void 0||h.hasNode(_)?(x[k]=_,_):_ in x?x[_]:v(_)}return this._isCompound&&e.each(h.nodes(),function(k){h.setParent(k,v(k))}),h},i.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(p,h){var m=this,x=arguments;return e.reduce(p,function(v,k){return x.length>1?m.setEdge(v,k,h):m.setEdge(v,k),k}),this},i.prototype.setEdge=function(){var p,h,m,x,v=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(p=k.v,h=k.w,m=k.name,arguments.length===2&&(x=arguments[1],v=!0)):(p=k,h=arguments[1],m=arguments[3],arguments.length>2&&(x=arguments[2],v=!0)),p=""+p,h=""+h,e.isUndefined(m)||(m=""+m);var _=u(this._isDirected,p,h,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(h),this._edgeLabels[_]=v?x:this._defaultEdgeLabelFn(p,h,m);var S=d(this._isDirected,p,h,m);return p=S.v,h=S.w,Object.freeze(S),this._edgeObjs[_]=S,o(this._preds[h],p),o(this._sucs[p],h),this._in[h][_]=S,this._out[p][_]=S,this._edgeCount++,this},i.prototype.edge=function(p,h,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m);return this._edgeLabels[x]},i.prototype.hasEdge=function(p,h,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m);return e.has(this._edgeLabels,x)},i.prototype.removeEdge=function(p,h,m){var x=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,h,m),v=this._edgeObjs[x];return v&&(p=v.v,h=v.w,delete this._edgeLabels[x],delete this._edgeObjs[x],l(this._preds[h],p),l(this._sucs[p],h),delete this._in[h][x],delete this._out[p][x],this._edgeCount--),this},i.prototype.inEdges=function(p,h){var m=this._in[p];if(m){var x=e.values(m);return h?e.filter(x,function(v){return v.v===h}):x}},i.prototype.outEdges=function(p,h){var m=this._out[p];if(m){var x=e.values(m);return h?e.filter(x,function(v){return v.w===h}):x}},i.prototype.nodeEdges=function(p,h){var m=this.inEdges(p,h);if(m)return m.concat(this.outEdges(p,h))};function o(p,h){p[h]?p[h]++:p[h]=1}function l(p,h){--p[h]||delete p[h]}function u(p,h,m,x){var v=""+h,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}return v+r+k+r+(e.isUndefined(x)?t:x)}function d(p,h,m,x){var v=""+h,k=""+m;if(!p&&v>k){var _=v;v=k,k=_}var S={v,w:k};return x&&(S.name=x),S}function f(p,h){return u(p,h.v,h.w,h.name)}return wy}var Sy,lj;function zW(){return lj||(lj=1,Sy="2.1.8"),Sy}var Ey,cj;function UW(){return cj||(cj=1,Ey={Graph:A1(),version:zW()}),Ey}var Ny,uj;function qW(){if(uj)return Ny;uj=1;var e=_a(),t=A1();Ny={write:n,read:o};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:r(l),edges:i(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 i(l){return e.map(l.edges(),function(u){var d=l.edge(u),f={v:u.v,w:u.w};return e.isUndefined(u.name)||(f.name=u.name),e.isUndefined(d)||(f.value=d),f})}function o(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(d){u.setNode(d.v,d.value),d.parent&&u.setParent(d.v,d.parent)}),e.each(l.edges,function(d){u.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),u}return Ny}var Cy,dj;function HW(){if(dj)return Cy;dj=1;var e=_a();Cy=t;function t(n){var r={},i=[],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&&i.push(o)}),i}return Cy}var jy,fj;function qI(){if(fj)return jy;fj=1;var e=_a();jy=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 i=this._keyIndices;if(n=String(n),!e.has(i,n)){var o=this._arr,l=o.length;return i[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 i=this._keyIndices[n];if(r>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+r);this._arr[i].priority=r,this._decrease(i)},t.prototype._heapify=function(n){var r=this._arr,i=2*n,o=i+1,l=n;i<r.length&&(l=r[i].priority<r[l].priority?i: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,i=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<i));)this._swap(n,o),n=o},t.prototype._swap=function(n,r){var i=this._arr,o=this._keyIndices,l=i[n],u=i[r];i[n]=u,i[r]=l,o[u.key]=n,o[l.key]=r},jy}var Ty,pj;function HI(){if(pj)return Ty;pj=1;var e=_a(),t=qI();Ty=r;var n=e.constant(1);function r(o,l,u,d){return i(o,String(l),u||n,d||function(f){return o.outEdges(f)})}function i(o,l,u,d){var f={},p=new t,h,m,x=function(v){var k=v.v!==h?v.v:v.w,_=f[k],S=u(v),w=m.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+S);w<_.distance&&(_.distance=w,_.predecessor=h,p.decrease(k,w))};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&&(h=p.removeMin(),m=f[h],m.distance!==Number.POSITIVE_INFINITY);)d(h).forEach(x);return f}return Ty}var Ry,hj;function $W(){if(hj)return Ry;hj=1;var e=HI(),t=_a();Ry=n;function n(r,i,o){return t.transform(r.nodes(),function(l,u){l[u]=e(r,u,i,o)},{})}return Ry}var Ay,gj;function $I(){if(gj)return Ay;gj=1;var e=_a();Ay=t;function t(n){var r=0,i=[],o={},l=[];function u(d){var f=o[d]={onStack:!0,lowlink:r,index:r++};if(i.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=[],h;do h=i.pop(),o[h].onStack=!1,p.push(h);while(d!==h);l.push(p)}}return n.nodes().forEach(function(d){e.has(o,d)||u(d)}),l}return Ay}var Iy,mj;function WW(){if(mj)return Iy;mj=1;var e=_a(),t=$I();Iy=n;function n(r){return e.filter(t(r),function(i){return i.length>1||i.length===1&&r.hasEdge(i[0],i[0])})}return Iy}var My,xj;function VW(){if(xj)return My;xj=1;var e=_a();My=n;var t=e.constant(1);function n(i,o,l){return r(i,o||t,l||function(u){return i.outEdges(u)})}function r(i,o,l){var u={},d=i.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 h=p.v===f?p.w:p.v,m=o(p);u[f][h]={distance:m,predecessor:f}})}),d.forEach(function(f){var p=u[f];d.forEach(function(h){var m=u[h];d.forEach(function(x){var v=m[f],k=p[x],_=m[x],S=v.distance+k.distance;S<_.distance&&(_.distance=S,_.predecessor=k.predecessor)})})}),u}return My}var Ly,yj;function WI(){if(yj)return Ly;yj=1;var e=_a();Ly=t,t.CycleException=n;function t(r){var i={},o={},l=[];function u(d){if(e.has(o,d))throw new n;e.has(i,d)||(o[d]=!0,i[d]=!0,e.each(r.predecessors(d),u),delete o[d],l.push(d))}if(e.each(r.sinks(),u),e.size(i)!==r.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,Ly}var Oy,bj;function GW(){if(bj)return Oy;bj=1;var e=WI();Oy=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Oy}var Dy,vj;function VI(){if(vj)return Dy;vj=1;var e=_a();Dy=t;function t(r,i,o){e.isArray(i)||(i=[i]);var l=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],d={};return e.each(i,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,i,o,l,u,d){e.has(l,i)||(l[i]=!0,o||d.push(i),e.each(u(i),function(f){n(r,f,o,l,u,d)}),o&&d.push(i))}return Dy}var Py,kj;function KW(){if(kj)return Py;kj=1;var e=VI();Py=t;function t(n,r){return e(n,r,"post")}return Py}var Fy,_j;function YW(){if(_j)return Fy;_j=1;var e=VI();Fy=t;function t(n,r){return e(n,r,"pre")}return Fy}var By,wj;function QW(){if(wj)return By;wj=1;var e=_a(),t=A1(),n=qI();By=r;function r(i,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(i.nodeCount()===0)return l;e.each(i.nodes(),function(m){d.add(m,Number.POSITIVE_INFINITY),l.setNode(m)}),d.decrease(i.nodes()[0],0);for(var h=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(f).forEach(p)}return l}return By}var zy,Sj;function XW(){return Sj||(Sj=1,zy={components:HW(),dijkstra:HI(),dijkstraAll:$W(),findCycles:WW(),floydWarshall:VW(),isAcyclic:GW(),postorder:KW(),preorder:YW(),prim:QW(),tarjan:$I(),topsort:WI()}),zy}var Uy,Ej;function ZW(){if(Ej)return Uy;Ej=1;var e=UW();return Uy={Graph:e.Graph,json:qW(),alg:XW(),version:e.version},Uy}var qy,Nj;function Ga(){if(Nj)return qy;Nj=1;var e;if(typeof g1=="function")try{e=ZW()}catch{}return e||(e=window.graphlib),qy=e,qy}var Hy,Cj;function JW(){if(Cj)return Hy;Cj=1;var e=xI(),t=1,n=4;function r(i){return e(i,t|n)}return Hy=r,Hy}var $y,jj;function qp(){if(jj)return $y;jj=1;var e=oc(),t=Ps(),n=Mp(),r=ka();function i(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 $y=i,$y}var Wy,Tj;function eV(){if(Tj)return Wy;Tj=1;var e=Up(),t=oc(),n=qp(),r=ul(),i=Object.prototype,o=i.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,p=d.length,h=p>2?d[2]:void 0;for(h&&n(d[0],d[1],h)&&(p=1);++f<p;)for(var m=d[f],x=r(m),v=-1,k=x.length;++v<k;){var _=x[v],S=u[_];(S===void 0||t(S,i[_])&&!o.call(u,_))&&(u[_]=m[_])}return u});return Wy=l,Wy}var Vy,Rj;function tV(){if(Rj)return Vy;Rj=1;var e=Fs(),t=Ps(),n=No();function r(i){return function(o,l,u){var d=Object(o);if(!t(o)){var f=e(l,3);o=n(o),l=function(h){return f(d[h],h,d)}}var p=i(o,l,u);return p>-1?d[f?o[p]:p]:void 0}}return Vy=r,Vy}var Gy,Aj;function nV(){if(Aj)return Gy;Aj=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Gy=t,Gy}var Ky,Ij;function rV(){if(Ij)return Ky;Ij=1;var e=nV(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Ky=n,Ky}var Yy,Mj;function iV(){if(Mj)return Yy;Mj=1;var e=rV(),t=ka(),n=dc(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(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 h=o.test(f);return h||l.test(f)?u(f.slice(2),h?2:8):i.test(f)?r:+f}return Yy=d,Yy}var Qy,Lj;function GI(){if(Lj)return Qy;Lj=1;var e=iV(),t=1/0,n=17976931348623157e292;function r(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var o=i<0?-1:1;return o*n}return i===i?i:0}return Qy=r,Qy}var Xy,Oj;function aV(){if(Oj)return Xy;Oj=1;var e=GI();function t(n){var r=e(n),i=r%1;return r===r?i?r-i:r:0}return Xy=t,Xy}var Zy,Dj;function sV(){if(Dj)return Zy;Dj=1;var e=BI(),t=Fs(),n=aV(),r=Math.max;function i(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 Zy=i,Zy}var Jy,Pj;function oV(){if(Pj)return Jy;Pj=1;var e=tV(),t=sV(),n=e(t);return Jy=n,Jy}var eb,Fj;function KI(){if(Fj)return eb;Fj=1;var e=R1();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return eb=t,eb}var tb,Bj;function lV(){if(Bj)return tb;Bj=1;var e=N1(),t=yI(),n=ul();function r(i,o){return i==null?i:e(i,t(o),n)}return tb=r,tb}var nb,zj;function cV(){if(zj)return nb;zj=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return nb=e,nb}var rb,Uj;function uV(){if(Uj)return rb;Uj=1;var e=Ap(),t=C1(),n=Fs();function r(i,o){var l={};return o=n(o,3),t(i,function(u,d,f){e(l,d,o(u,d,f))}),l}return rb=r,rb}var ib,qj;function I1(){if(qj)return ib;qj=1;var e=dc();function t(n,r,i){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):i(d,f)))var f=d,p=u}return p}return ib=t,ib}var ab,Hj;function dV(){if(Hj)return ab;Hj=1;function e(t,n){return t>n}return ab=e,ab}var sb,$j;function fV(){if($j)return sb;$j=1;var e=I1(),t=dV(),n=dl();function r(i){return i&&i.length?e(i,n,t):void 0}return sb=r,sb}var ob,Wj;function YI(){if(Wj)return ob;Wj=1;var e=Ap(),t=oc();function n(r,i,o){(o!==void 0&&!t(r[i],o)||o===void 0&&!(i in r))&&e(r,i,o)}return ob=n,ob}var lb,Vj;function pV(){if(Vj)return lb;Vj=1;var e=ll(),t=Dp(),n=cs(),r="[object Object]",i=Function.prototype,o=Object.prototype,l=i.toString,u=o.hasOwnProperty,d=l.call(Object);function f(p){if(!n(p)||e(p)!=r)return!1;var h=t(p);if(h===null)return!0;var m=u.call(h,"constructor")&&h.constructor;return typeof m=="function"&&m instanceof m&&l.call(m)==d}return lb=f,lb}var cb,Gj;function QI(){if(Gj)return cb;Gj=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return cb=e,cb}var ub,Kj;function hV(){if(Kj)return ub;Kj=1;var e=nd(),t=ul();function n(r){return e(r,t(r))}return ub=n,ub}var db,Yj;function gV(){if(Yj)return db;Yj=1;var e=YI(),t=aI(),n=hI(),r=sI(),i=mI(),o=rd(),l=Lr(),u=zI(),d=cc(),f=td(),p=ka(),h=pV(),m=id(),x=QI(),v=hV();function k(_,S,w,N,R,T,C){var M=x(_,w),I=x(S,w),A=C.get(I);if(A){e(_,w,A);return}var L=T?T(M,I,w+"",_,S,C):void 0,D=L===void 0;if(D){var $=l(I),te=!$&&d(I),V=!$&&!te&&m(I);L=I,$||te||V?l(M)?L=M:u(M)?L=r(M):te?(D=!1,L=t(I,!0)):V?(D=!1,L=n(I,!0)):L=[]:h(I)||o(I)?(L=M,o(M)?L=v(M):(!p(M)||f(M))&&(L=i(I))):D=!1}D&&(C.set(I,L),R(L,I,N,T,C),C.delete(I)),e(_,w,L)}return db=k,db}var fb,Qj;function mV(){if(Qj)return fb;Qj=1;var e=Rp(),t=YI(),n=N1(),r=gV(),i=ka(),o=ul(),l=QI();function u(d,f,p,h,m){d!==f&&n(f,function(x,v){if(m||(m=new e),i(x))r(d,f,v,p,u,h,m);else{var k=h?h(l(d,v),x,v+"",d,f,m):void 0;k===void 0&&(k=x),t(d,v,k)}},o)}return fb=u,fb}var pb,Xj;function xV(){if(Xj)return pb;Xj=1;var e=Up(),t=qp();function n(r){return e(function(i,o){var l=-1,u=o.length,d=u>1?o[u-1]:void 0,f=u>2?o[2]:void 0;for(d=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),i=Object(i);++l<u;){var p=o[l];p&&r(i,p,l,d)}return i})}return pb=n,pb}var hb,Zj;function yV(){if(Zj)return hb;Zj=1;var e=mV(),t=xV(),n=t(function(r,i,o){e(r,i,o)});return hb=n,hb}var gb,Jj;function XI(){if(Jj)return gb;Jj=1;function e(t,n){return t<n}return gb=e,gb}var mb,eT;function bV(){if(eT)return mb;eT=1;var e=I1(),t=XI(),n=dl();function r(i){return i&&i.length?e(i,n,t):void 0}return mb=r,mb}var xb,tT;function vV(){if(tT)return xb;tT=1;var e=I1(),t=Fs(),n=XI();function r(i,o){return i&&i.length?e(i,t(o,2),n):void 0}return xb=r,xb}var yb,nT;function kV(){if(nT)return yb;nT=1;var e=Ka(),t=function(){return e.Date.now()};return yb=t,yb}var bb,rT;function _V(){if(rT)return bb;rT=1;var e=Ip(),t=Bp(),n=Mp(),r=ka(),i=ad();function o(l,u,d,f){if(!r(l))return l;u=t(u,l);for(var p=-1,h=u.length,m=h-1,x=l;x!=null&&++p<h;){var v=i(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 bb=o,bb}var vb,iT;function wV(){if(iT)return vb;iT=1;var e=zp(),t=_V(),n=Bp();function r(i,o,l){for(var u=-1,d=o.length,f={};++u<d;){var p=o[u],h=e(i,p);l(h,p)&&t(f,n(p,i),h)}return f}return vb=r,vb}var kb,aT;function SV(){if(aT)return kb;aT=1;var e=wV(),t=TI();function n(r,i){return e(r,i,function(o,l){return t(r,l)})}return kb=n,kb}var _b,sT;function EV(){if(sT)return _b;sT=1;var e=KI(),t=PI(),n=FI();function r(i){return n(t(i,void 0,e),i+"")}return _b=r,_b}var wb,oT;function NV(){if(oT)return wb;oT=1;var e=SV(),t=EV(),n=t(function(r,i){return r==null?{}:e(r,i)});return wb=n,wb}var Sb,lT;function CV(){if(lT)return Sb;lT=1;var e=Math.ceil,t=Math.max;function n(r,i,o,l){for(var u=-1,d=t(e((i-r)/(o||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=o;return f}return Sb=n,Sb}var Eb,cT;function jV(){if(cT)return Eb;cT=1;var e=CV(),t=qp(),n=GI();function r(i){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,i)}}return Eb=r,Eb}var Nb,uT;function TV(){if(uT)return Nb;uT=1;var e=jV(),t=e();return Nb=t,Nb}var Cb,dT;function RV(){if(dT)return Cb;dT=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Cb=e,Cb}var jb,fT;function AV(){if(fT)return jb;fT=1;var e=dc();function t(n,r){if(n!==r){var i=n!==void 0,o=n===null,l=n===n,u=e(n),d=r!==void 0,f=r===null,p=r===r,h=e(r);if(!f&&!h&&!u&&n>r||u&&d&&p&&!f&&!h||o&&d&&p||!i&&p||!l)return 1;if(!o&&!u&&!h&&n<r||h&&i&&l&&!o&&!u||f&&i&&l||!d&&l||!p)return-1}return 0}return jb=t,jb}var Tb,pT;function IV(){if(pT)return Tb;pT=1;var e=AV();function t(n,r,i){for(var o=-1,l=n.criteria,u=r.criteria,d=l.length,f=i.length;++o<d;){var p=e(l[o],u[o]);if(p){if(o>=f)return p;var h=i[o];return p*(h=="desc"?-1:1)}}return n.index-r.index}return Tb=t,Tb}var Rb,hT;function MV(){if(hT)return Rb;hT=1;var e=Fp(),t=zp(),n=Fs(),r=LI(),i=RV(),o=Lp(),l=IV(),u=dl(),d=Lr();function f(p,h,m){h.length?h=e(h,function(k){return d(k)?function(_){return t(_,k.length===1?k[0]:k)}:k}):h=[u];var x=-1;h=e(h,o(n));var v=r(p,function(k,_,S){var w=e(h,function(N){return N(k)});return{criteria:w,index:++x,value:k}});return i(v,function(k,_){return l(k,_,m)})}return Rb=f,Rb}var Ab,gT;function LV(){if(gT)return Ab;gT=1;var e=R1(),t=MV(),n=Up(),r=qp(),i=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 Ab=i,Ab}var Ib,mT;function OV(){if(mT)return Ib;mT=1;var e=CI(),t=0;function n(r){var i=++t;return e(r)+i}return Ib=n,Ib}var Mb,xT;function DV(){if(xT)return Mb;xT=1;function e(t,n,r){for(var i=-1,o=t.length,l=n.length,u={};++i<o;){var d=i<l?n[i]:void 0;r(u,t[i],d)}return u}return Mb=e,Mb}var Lb,yT;function PV(){if(yT)return Lb;yT=1;var e=Ip(),t=DV();function n(r,i){return t(r||[],i||[],e)}return Lb=n,Lb}var Ob,bT;function ur(){if(bT)return Ob;bT=1;var e;if(typeof g1=="function")try{e={cloneDeep:JW(),constant:E1(),defaults:eV(),each:vI(),filter:AI(),find:oV(),flatten:KI(),forEach:bI(),forIn:lV(),has:II(),isUndefined:MI(),last:cV(),map:OI(),mapValues:uV(),max:fV(),merge:yV(),min:bV(),minBy:vV(),now:kV(),pick:NV(),range:TV(),reduce:DI(),sortBy:LV(),uniqueId:OV(),values:UI(),zipObject:PV()}}catch{}return e||(e=window._),Ob=e,Ob}var Db,vT;function FV(){if(vT)return Db;vT=1,Db=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,i=r._prev;if(i!==r)return t(i),i},e.prototype.enqueue=function(r){var i=this._sentinel;r._prev&&r._next&&t(r),r._next=i._next,i._next._prev=r,i._next=r,r._prev=i},e.prototype.toString=function(){for(var r=[],i=this._sentinel,o=i._prev;o!==i;)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,i){if(r!=="_next"&&r!=="_prev")return i}return Db}var Pb,kT;function BV(){if(kT)return Pb;kT=1;var e=ur(),t=Ga().Graph,n=FV();Pb=i;var r=e.constant(1);function i(f,p){if(f.nodeCount()<=1)return[];var h=u(f,p||r),m=o(h.graph,h.buckets,h.zeroIdx);return e.flatten(e.map(m,function(x){return f.outEdges(x.v,x.w)}),!0)}function o(f,p,h){for(var m=[],x=p[p.length-1],v=p[0],k;f.nodeCount();){for(;k=v.dequeue();)l(f,p,h,k);for(;k=x.dequeue();)l(f,p,h,k);if(f.nodeCount()){for(var _=p.length-2;_>0;--_)if(k=p[_].dequeue(),k){m=m.concat(l(f,p,h,k,!0));break}}}return m}function l(f,p,h,m,x){var v=x?[]:void 0;return e.forEach(f.inEdges(m.v),function(k){var _=f.edge(k),S=f.node(k.v);x&&v.push({v:k.v,w:k.w}),S.out-=_,d(p,h,S)}),e.forEach(f.outEdges(m.v),function(k){var _=f.edge(k),S=k.w,w=f.node(S);w.in-=_,d(p,h,w)}),f.removeNode(m.v),v}function u(f,p){var h=new t,m=0,x=0;e.forEach(f.nodes(),function(_){h.setNode(_,{v:_,in:0,out:0})}),e.forEach(f.edges(),function(_){var S=h.edge(_.v,_.w)||0,w=p(_),N=S+w;h.setEdge(_.v,_.w,N),x=Math.max(x,h.node(_.v).out+=w),m=Math.max(m,h.node(_.w).in+=w)});var v=e.range(x+m+3).map(function(){return new n}),k=m+1;return e.forEach(h.nodes(),function(_){d(v,k,h.node(_))}),{graph:h,buckets:v,zeroIdx:k}}function d(f,p,h){h.out?h.in?f[h.out-h.in+p].enqueue(h):f[f.length-1].enqueue(h):f[0].enqueue(h)}return Pb}var Fb,_T;function zV(){if(_T)return Fb;_T=1;var e=ur(),t=BV();Fb={run:n,undo:i};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(h){e.has(u,h.w)?l.push(h):f(h.w)}),delete u[p])}return e.forEach(o.nodes(),f),l}function i(o){e.forEach(o.edges(),function(l){var u=o.edge(l);if(u.reversed){o.removeEdge(l);var d=u.forwardName;delete u.reversed,delete u.forwardName,o.setEdge(l.w,l.v,u,d)}})}return Fb}var Bb,wT;function Bi(){if(wT)return Bb;wT=1;var e=ur(),t=Ga().Graph;Bb={addDummyNode:n,simplify:r,asNonCompoundGraph:i,successorWeights:o,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:p,addBorderNode:h,maxRank:m,partition:x,time:v,notime:k};function n(_,S,w,N){var R;do R=e.uniqueId(N);while(_.hasNode(R));return w.dummy=S,_.setNode(R,w),R}function r(_){var S=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(w){S.setNode(w,_.node(w))}),e.forEach(_.edges(),function(w){var N=S.edge(w.v,w.w)||{weight:0,minlen:1},R=_.edge(w);S.setEdge(w.v,w.w,{weight:N.weight+R.weight,minlen:Math.max(N.minlen,R.minlen)})}),S}function i(_){var S=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(w){_.children(w).length||S.setNode(w,_.node(w))}),e.forEach(_.edges(),function(w){S.setEdge(w,_.edge(w))}),S}function o(_){var S=e.map(_.nodes(),function(w){var N={};return e.forEach(_.outEdges(w),function(R){N[R.w]=(N[R.w]||0)+_.edge(R).weight}),N});return e.zipObject(_.nodes(),S)}function l(_){var S=e.map(_.nodes(),function(w){var N={};return e.forEach(_.inEdges(w),function(R){N[R.v]=(N[R.v]||0)+_.edge(R).weight}),N});return e.zipObject(_.nodes(),S)}function u(_,S){var w=_.x,N=_.y,R=S.x-w,T=S.y-N,C=_.width/2,M=_.height/2;if(!R&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var I,A;return Math.abs(T)*C>Math.abs(R)*M?(T<0&&(M=-M),I=M*R/T,A=M):(R<0&&(C=-C),I=C,A=C*T/R),{x:w+I,y:N+A}}function d(_){var S=e.map(e.range(m(_)+1),function(){return[]});return e.forEach(_.nodes(),function(w){var N=_.node(w),R=N.rank;e.isUndefined(R)||(S[R][N.order]=w)}),S}function f(_){var S=e.min(e.map(_.nodes(),function(w){return _.node(w).rank}));e.forEach(_.nodes(),function(w){var N=_.node(w);e.has(N,"rank")&&(N.rank-=S)})}function p(_){var S=e.min(e.map(_.nodes(),function(T){return _.node(T).rank})),w=[];e.forEach(_.nodes(),function(T){var C=_.node(T).rank-S;w[C]||(w[C]=[]),w[C].push(T)});var N=0,R=_.graph().nodeRankFactor;e.forEach(w,function(T,C){e.isUndefined(T)&&C%R!==0?--N:N&&e.forEach(T,function(M){_.node(M).rank+=N})})}function h(_,S,w,N){var R={width:0,height:0};return arguments.length>=4&&(R.rank=w,R.order=N),n(_,"border",R,S)}function m(_){return e.max(e.map(_.nodes(),function(S){var w=_.node(S).rank;if(!e.isUndefined(w))return w}))}function x(_,S){var w={lhs:[],rhs:[]};return e.forEach(_,function(N){S(N)?w.lhs.push(N):w.rhs.push(N)}),w}function v(_,S){var w=e.now();try{return S()}finally{console.log(_+" time: "+(e.now()-w)+"ms")}}function k(_,S){return S()}return Bb}var zb,ST;function UV(){if(ST)return zb;ST=1;var e=ur(),t=Bi();zb={run:n,undo:i};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,h=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},h),_===0&&o.graph().dummyChains.push(v),u=v;o.setEdge(u,f,{weight:m.weight},h)}}function i(o){e.forEach(o.graph().dummyChains,function(l){var u=o.node(l),d=u.edgeLabel,f;for(o.setEdge(u.edgeObj,d);u.dummy;)f=o.successors(l)[0],o.removeNode(l),d.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(d.x=u.x,d.y=u.y,d.width=u.width,d.height=u.height),l=f,u=o.node(l)})}return zb}var Ub,ET;function tp(){if(ET)return Ub;ET=1;var e=ur();Ub={longestPath:t,slack:n};function t(r){var i={};function o(l){var u=r.node(l);if(e.has(i,l))return u.rank;i[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,i){return r.node(i.w).rank-r.node(i.v).rank-r.edge(i).minlen}return Ub}var qb,NT;function ZI(){if(NT)return qb;NT=1;var e=ur(),t=Ga().Graph,n=tp().slack;qb=r;function r(u){var d=new t({directed:!1}),f=u.nodes()[0],p=u.nodeCount();d.setNode(f,{});for(var h,m;i(d,u)<p;)h=o(d,u),m=d.hasNode(h.v)?n(u,h):-n(u,h),l(d,u,m);return d}function i(u,d){function f(p){e.forEach(d.nodeEdges(p),function(h){var m=h.v,x=p===m?h.w:m;!u.hasNode(x)&&!n(d,h)&&(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 qb}var Hb,CT;function qV(){if(CT)return Hb;CT=1;var e=ur(),t=ZI(),n=tp().slack,r=tp().longestPath,i=Ga().alg.preorder,o=Ga().alg.postorder,l=Bi().simplify;Hb=u,u.initLowLimValues=h,u.initCutValues=d,u.calcCutValue=p,u.leaveEdge=x,u.enterEdge=v,u.exchangeEdges=k;function u(N){N=l(N),r(N);var R=t(N);h(R),d(R,N);for(var T,C;T=x(R);)C=v(R,N,T),k(R,N,T,C)}function d(N,R){var T=o(N,N.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(C){f(N,R,C)})}function f(N,R,T){var C=N.node(T),M=C.parent;N.edge(T,M).cutvalue=p(N,R,T)}function p(N,R,T){var C=N.node(T),M=C.parent,I=!0,A=R.edge(T,M),L=0;return A||(I=!1,A=R.edge(M,T)),L=A.weight,e.forEach(R.nodeEdges(T),function(D){var $=D.v===T,te=$?D.w:D.v;if(te!==M){var V=$===I,z=R.edge(D).weight;if(L+=V?z:-z,S(N,T,te)){var G=N.edge(T,te).cutvalue;L+=V?-G:G}}}),L}function h(N,R){arguments.length<2&&(R=N.nodes()[0]),m(N,{},1,R)}function m(N,R,T,C,M){var I=T,A=N.node(C);return R[C]=!0,e.forEach(N.neighbors(C),function(L){e.has(R,L)||(T=m(N,R,T,L,C))}),A.low=I,A.lim=T++,M?A.parent=M:delete A.parent,T}function x(N){return e.find(N.edges(),function(R){return N.edge(R).cutvalue<0})}function v(N,R,T){var C=T.v,M=T.w;R.hasEdge(C,M)||(C=T.w,M=T.v);var I=N.node(C),A=N.node(M),L=I,D=!1;I.lim>A.lim&&(L=A,D=!0);var $=e.filter(R.edges(),function(te){return D===w(N,N.node(te.v),L)&&D!==w(N,N.node(te.w),L)});return e.minBy($,function(te){return n(R,te)})}function k(N,R,T,C){var M=T.v,I=T.w;N.removeEdge(M,I),N.setEdge(C.v,C.w,{}),h(N),d(N,R),_(N,R)}function _(N,R){var T=e.find(N.nodes(),function(M){return!R.node(M).parent}),C=i(N,T);C=C.slice(1),e.forEach(C,function(M){var I=N.node(M).parent,A=R.edge(M,I),L=!1;A||(A=R.edge(I,M),L=!0),R.node(M).rank=R.node(I).rank+(L?A.minlen:-A.minlen)})}function S(N,R,T){return N.hasEdge(R,T)}function w(N,R,T){return T.low<=R.lim&&R.lim<=T.lim}return Hb}var $b,jT;function HV(){if(jT)return $b;jT=1;var e=tp(),t=e.longestPath,n=ZI(),r=qV();$b=i;function i(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":o(d);break;default:u(d)}}var o=t;function l(d){t(d),n(d)}function u(d){r(d)}return $b}var Wb,TT;function $V(){if(TT)return Wb;TT=1;var e=ur();Wb=t;function t(i){var o=r(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),d=u.edgeObj,f=n(i,o,d.v,d.w),p=f.path,h=f.lca,m=0,x=p[m],v=!0;l!==d.w;){if(u=i.node(l),v){for(;(x=p[m])!==h&&i.node(x).maxRank<u.rank;)m++;x===h&&(v=!1)}if(!v){for(;m<p.length-1&&i.node(x=p[m+1]).minRank<=u.rank;)m++;x=p[m]}i.setParent(l,x),l=i.successors(l)[0]}})}function n(i,o,l,u){var d=[],f=[],p=Math.min(o[l].low,o[u].low),h=Math.max(o[l].lim,o[u].lim),m,x;m=l;do m=i.parent(m),d.push(m);while(m&&(o[m].low>p||h>o[m].lim));for(x=m,m=u;(m=i.parent(m))!==x;)f.push(m);return{path:d.concat(f.reverse()),lca:x}}function r(i){var o={},l=0;function u(d){var f=l;e.forEach(i.children(d),u),o[d]={low:f,lim:l++}}return e.forEach(i.children(),u),o}return Wb}var Vb,RT;function WV(){if(RT)return Vb;RT=1;var e=ur(),t=Bi();Vb={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),f=i(u),p=e.max(e.values(f))-1,h=2*p+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(x){u.edge(x).minlen*=h});var m=o(u)+1;e.forEach(u.children(),function(x){r(u,d,h,m,p,f,x)}),u.graph().nodeRankFactor=h}function r(u,d,f,p,h,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"),S=u.node(x);u.setParent(k,x),S.borderTop=k,u.setParent(_,x),S.borderBottom=_,e.forEach(v,function(w){r(u,d,f,p,h,m,w);var N=u.node(w),R=N.borderTop?N.borderTop:w,T=N.borderBottom?N.borderBottom:w,C=N.borderTop?p:2*p,M=R!==T?1:h-m[x]+1;u.setEdge(k,R,{weight:C,minlen:M,nestingEdge:!0}),u.setEdge(T,_,{weight:C,minlen:M,nestingEdge:!0})}),u.parent(x)||u.setEdge(d,k,{weight:0,minlen:h+m[x]})}function i(u){var d={};function f(p,h){var m=u.children(p);m&&m.length&&e.forEach(m,function(x){f(x,h+1)}),d[p]=h}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 Vb}var Gb,AT;function VV(){if(AT)return Gb;AT=1;var e=ur(),t=Bi();Gb=n;function n(i){function o(l){var u=i.children(l),d=i.node(l);if(u.length&&e.forEach(u,o),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,p=d.maxRank+1;f<p;++f)r(i,"borderLeft","_bl",l,d,f),r(i,"borderRight","_br",l,d,f)}}e.forEach(i.children(),o)}function r(i,o,l,u,d,f){var p={width:0,height:0,rank:f,borderType:o},h=d[o][f-1],m=t.addDummyNode(i,"border",p,l);d[o][f]=m,i.setParent(m,u),h&&i.setEdge(h,m,{weight:1})}return Gb}var Kb,IT;function GV(){if(IT)return Kb;IT=1;var e=ur();Kb={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){i(f.node(p))}),e.forEach(f.edges(),function(p){i(f.edge(p))})}function i(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 h=f.edge(p);e.forEach(h.points,l),e.has(h,"y")&&l(h)})}function l(f){f.y=-f.y}function u(f){e.forEach(f.nodes(),function(p){d(f.node(p))}),e.forEach(f.edges(),function(p){var h=f.edge(p);e.forEach(h.points,d),e.has(h,"x")&&d(h)})}function d(f){var p=f.x;f.x=f.y,f.y=p}return Kb}var Yb,MT;function KV(){if(MT)return Yb;MT=1;var e=ur();Yb=t;function t(n){var r={},i=e.filter(n.nodes(),function(f){return!n.children(f).length}),o=e.max(e.map(i,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(i,function(f){return n.node(f).rank});return e.forEach(d,u),l}return Yb}var Qb,LT;function YV(){if(LT)return Qb;LT=1;var e=ur();Qb=t;function t(r,i){for(var o=0,l=1;l<i.length;++l)o+=n(r,i[l-1],i[l]);return o}function n(r,i,o){for(var l=e.zipObject(o,e.map(o,function(m,x){return x})),u=e.flatten(e.map(i,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}),h=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;h+=m.weight*v})),h}return Qb}var Xb,OT;function QV(){if(OT)return Xb;OT=1;var e=ur();Xb=t;function t(n,r){return e.map(r,function(i){var o=n.inEdges(i);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:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return Xb}var Zb,DT;function XV(){if(DT)return Zb;DT=1;var e=ur();Zb=t;function t(i,o){var l={};e.forEach(i,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(i){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&&i.push(p)}}for(;i.length;){var d=i.pop();o.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,u(d))}return e.map(e.filter(o,function(f){return!f.merged}),function(f){return e.pick(f,["vs","i","barycenter","weight"])})}function r(i,o){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(o.i,i.i),o.merged=!0}return Zb}var Jb,PT;function ZV(){if(PT)return Jb;PT=1;var e=ur(),t=Bi();Jb=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=[],h=0,m=0,x=0;d.sort(i(!!l)),x=r(p,f,x),e.forEach(d,function(k){x+=k.vs.length,p.push(k.vs),h+=k.barycenter*k.weight,m+=k.weight,x=r(p,f,x)});var v={vs:e.flatten(p,!0)};return m&&(v.barycenter=h/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 i(o){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:o?u.i-l.i:l.i-u.i}}return Jb}var ev,FT;function JV(){if(FT)return ev;FT=1;var e=ur(),t=QV(),n=XV(),r=ZV();ev=i;function i(u,d,f,p){var h=u.children(d),m=u.node(d),x=m?m.borderLeft:void 0,v=m?m.borderRight:void 0,k={};x&&(h=e.filter(h,function(T){return T!==x&&T!==v}));var _=t(u,h);e.forEach(_,function(T){if(u.children(T.v).length){var C=i(u,T.v,f,p);k[T.v]=C,e.has(C,"barycenter")&&l(T,C)}});var S=n(_,f);o(S,k);var w=r(S,p);if(x&&(w.vs=e.flatten([x,w.vs,v],!0),u.predecessors(x).length)){var N=u.node(u.predecessors(x)[0]),R=u.node(u.predecessors(v)[0]);e.has(w,"barycenter")||(w.barycenter=0,w.weight=0),w.barycenter=(w.barycenter*w.weight+N.order+R.order)/(w.weight+2),w.weight+=2}return w}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 ev}var tv,BT;function eG(){if(BT)return tv;BT=1;var e=ur(),t=Ga().Graph;tv=n;function n(i,o,l){var u=r(i),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return i.node(f)});return e.forEach(i.nodes(),function(f){var p=i.node(f),h=i.parent(f);(p.rank===o||p.minRank<=o&&o<=p.maxRank)&&(d.setNode(f),d.setParent(f,h||u),e.forEach(i[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:i.edge(m).weight+k})}),e.has(p,"minRank")&&d.setNode(f,{borderLeft:p.borderLeft[o],borderRight:p.borderRight[o]}))}),d}function r(i){for(var o;i.hasNode(o=e.uniqueId("_root")););return o}return tv}var nv,zT;function tG(){if(zT)return nv;zT=1;var e=ur();nv=t;function t(n,r,i){var o={},l;e.forEach(i,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 nv}var rv,UT;function nG(){if(UT)return rv;UT=1;var e=ur(),t=KV(),n=YV(),r=JV(),i=eG(),o=tG(),l=Ga().Graph,u=Bi();rv=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);h(m,_);for(var S=Number.POSITIVE_INFINITY,w,N=0,R=0;R<4;++N,++R){p(N%2?v:k,N%4>=2),_=u.buildLayerMatrix(m);var T=n(m,_);T<S&&(R=0,w=e.cloneDeep(_),S=T)}h(m,w)}function f(m,x,v){return e.map(x,function(k){return i(m,k,v)})}function p(m,x){var v=new l;e.forEach(m,function(k){var _=k.graph().root,S=r(k,_,v,x);e.forEach(S.vs,function(w,N){k.node(w).order=N}),o(k,v,S.vs)})}function h(m,x){e.forEach(x,function(v){e.forEach(v,function(k,_){m.node(k).order=_})})}return rv}var iv,qT;function rG(){if(qT)return iv;qT=1;var e=ur(),t=Ga().Graph,n=Bi();iv={positionX:v,findType1Conflicts:r,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:m,findSmallestWidthAlignment:h,balance:x};function r(S,w){var N={};function R(T,C){var M=0,I=0,A=T.length,L=e.last(C);return e.forEach(C,function(D,$){var te=o(S,D),V=te?S.node(te).order:A;(te||D===L)&&(e.forEach(C.slice(I,$+1),function(z){e.forEach(S.predecessors(z),function(G){var K=S.node(G),H=K.order;(H<M||V<H)&&!(K.dummy&&S.node(z).dummy)&&l(N,G,z)})}),I=$+1,M=V)}),C}return e.reduce(w,R),N}function i(S,w){var N={};function R(C,M,I,A,L){var D;e.forEach(e.range(M,I),function($){D=C[$],S.node(D).dummy&&e.forEach(S.predecessors(D),function(te){var V=S.node(te);V.dummy&&(V.order<A||V.order>L)&&l(N,te,D)})})}function T(C,M){var I=-1,A,L=0;return e.forEach(M,function(D,$){if(S.node(D).dummy==="border"){var te=S.predecessors(D);te.length&&(A=S.node(te[0]).order,R(M,L,$,I,A),L=$,I=A)}R(M,L,M.length,A,C.length)}),M}return e.reduce(w,T),N}function o(S,w){if(S.node(w).dummy)return e.find(S.predecessors(w),function(N){return S.node(N).dummy})}function l(S,w,N){if(w>N){var R=w;w=N,N=R}var T=S[w];T||(S[w]=T={}),T[N]=!0}function u(S,w,N){if(w>N){var R=w;w=N,N=R}return e.has(S[w],N)}function d(S,w,N,R){var T={},C={},M={};return e.forEach(w,function(I){e.forEach(I,function(A,L){T[A]=A,C[A]=A,M[A]=L})}),e.forEach(w,function(I){var A=-1;e.forEach(I,function(L){var D=R(L);if(D.length){D=e.sortBy(D,function(G){return M[G]});for(var $=(D.length-1)/2,te=Math.floor($),V=Math.ceil($);te<=V;++te){var z=D[te];C[L]===L&&A<M[z]&&!u(N,L,z)&&(C[z]=L,C[L]=T[L]=T[z],A=M[z])}}})}),{root:T,align:C}}function f(S,w,N,R,T){var C={},M=p(S,w,N,T),I=T?"borderLeft":"borderRight";function A($,te){for(var V=M.nodes(),z=V.pop(),G={};z;)G[z]?$(z):(G[z]=!0,V.push(z),V=V.concat(te(z))),z=V.pop()}function L($){C[$]=M.inEdges($).reduce(function(te,V){return Math.max(te,C[V.v]+M.edge(V))},0)}function D($){var te=M.outEdges($).reduce(function(z,G){return Math.min(z,C[G.w]-M.edge(G))},Number.POSITIVE_INFINITY),V=S.node($);te!==Number.POSITIVE_INFINITY&&V.borderType!==I&&(C[$]=Math.max(C[$],te))}return A(L,M.predecessors.bind(M)),A(D,M.successors.bind(M)),e.forEach(R,function($){C[$]=C[N[$]]}),C}function p(S,w,N,R){var T=new t,C=S.graph(),M=k(C.nodesep,C.edgesep,R);return e.forEach(w,function(I){var A;e.forEach(I,function(L){var D=N[L];if(T.setNode(D),A){var $=N[A],te=T.edge($,D);T.setEdge($,D,Math.max(M(S,L,A),te||0))}A=L})}),T}function h(S,w){return e.minBy(e.values(w),function(N){var R=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(N,function(C,M){var I=_(S,M)/2;R=Math.max(C+I,R),T=Math.min(C-I,T)}),R-T})}function m(S,w){var N=e.values(w),R=e.min(N),T=e.max(N);e.forEach(["u","d"],function(C){e.forEach(["l","r"],function(M){var I=C+M,A=S[I],L;if(A!==w){var D=e.values(A);L=M==="l"?R-e.min(D):T-e.max(D),L&&(S[I]=e.mapValues(A,function($){return $+L}))}})})}function x(S,w){return e.mapValues(S.ul,function(N,R){if(w)return S[w.toLowerCase()][R];var T=e.sortBy(e.map(S,R));return(T[1]+T[2])/2})}function v(S){var w=n.buildLayerMatrix(S),N=e.merge(r(S,w),i(S,w)),R={},T;e.forEach(["u","d"],function(M){T=M==="u"?w:e.values(w).reverse(),e.forEach(["l","r"],function(I){I==="r"&&(T=e.map(T,function($){return e.values($).reverse()}));var A=(M==="u"?S.predecessors:S.successors).bind(S),L=d(S,T,N,A),D=f(S,T,L.root,L.align,I==="r");I==="r"&&(D=e.mapValues(D,function($){return-$})),R[M+I]=D})});var C=h(S,R);return m(R,C),x(R,S.graph().align)}function k(S,w,N){return function(R,T,C){var M=R.node(T),I=R.node(C),A=0,L;if(A+=M.width/2,e.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":L=-M.width/2;break;case"r":L=M.width/2;break}if(L&&(A+=N?L:-L),L=0,A+=(M.dummy?w:S)/2,A+=(I.dummy?w:S)/2,A+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":L=I.width/2;break;case"r":L=-I.width/2;break}return L&&(A+=N?L:-L),L=0,A}}function _(S,w){return S.node(w).width}return iv}var av,HT;function iG(){if(HT)return av;HT=1;var e=ur(),t=Bi(),n=rG().positionX;av=r;function r(o){o=t.asNonCompoundGraph(o),i(o),e.forEach(n(o),function(l,u){o.node(u).x=l})}function i(o){var l=t.buildLayerMatrix(o),u=o.graph().ranksep,d=0;e.forEach(l,function(f){var p=e.max(e.map(f,function(h){return o.node(h).height}));e.forEach(f,function(h){o.node(h).y=d+p/2}),d+=p+u})}return av}var sv,$T;function aG(){if($T)return sv;$T=1;var e=ur(),t=zV(),n=UV(),r=HV(),i=Bi().normalizeRanks,o=$V(),l=Bi().removeEmptyRanks,u=WV(),d=VV(),f=GV(),p=nG(),h=iG(),m=Bi(),x=Ga().Graph;sv=v;function v(J,q){var Y=q&&q.debugTiming?m.time:m.notime;Y("layout",function(){var oe=Y(" buildLayoutGraph",function(){return A(J)});Y(" runLayout",function(){k(oe,Y)}),Y(" updateInputGraph",function(){_(J,oe)})})}function k(J,q){q(" makeSpaceForEdgeLabels",function(){L(J)}),q(" removeSelfEdges",function(){se(J)}),q(" acyclic",function(){t.run(J)}),q(" nestingGraph.run",function(){u.run(J)}),q(" rank",function(){r(m.asNonCompoundGraph(J))}),q(" injectEdgeLabelProxies",function(){D(J)}),q(" removeEmptyRanks",function(){l(J)}),q(" nestingGraph.cleanup",function(){u.cleanup(J)}),q(" normalizeRanks",function(){i(J)}),q(" assignRankMinMax",function(){$(J)}),q(" removeEdgeLabelProxies",function(){te(J)}),q(" normalize.run",function(){n.run(J)}),q(" parentDummyChains",function(){o(J)}),q(" addBorderSegments",function(){d(J)}),q(" order",function(){p(J)}),q(" insertSelfEdges",function(){P(J)}),q(" adjustCoordinateSystem",function(){f.adjust(J)}),q(" position",function(){h(J)}),q(" positionSelfEdges",function(){W(J)}),q(" removeBorderNodes",function(){H(J)}),q(" normalize.undo",function(){n.undo(J)}),q(" fixupEdgeLabelCoords",function(){G(J)}),q(" undoCoordinateSystem",function(){f.undo(J)}),q(" translateGraph",function(){V(J)}),q(" assignNodeIntersects",function(){z(J)}),q(" reversePoints",function(){K(J)}),q(" acyclic.undo",function(){t.undo(J)})}function _(J,q){e.forEach(J.nodes(),function(Y){var oe=J.node(Y),_e=q.node(Y);oe&&(oe.x=_e.x,oe.y=_e.y,q.children(Y).length&&(oe.width=_e.width,oe.height=_e.height))}),e.forEach(J.edges(),function(Y){var oe=J.edge(Y),_e=q.edge(Y);oe.points=_e.points,e.has(_e,"x")&&(oe.x=_e.x,oe.y=_e.y)}),J.graph().width=q.graph().width,J.graph().height=q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],w={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],R=["width","height"],T={width:0,height:0},C=["minlen","weight","width","height","labeloffset"],M={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function A(J){var q=new x({multigraph:!0,compound:!0}),Y=F(J.graph());return q.setGraph(e.merge({},w,ee(Y,S),e.pick(Y,N))),e.forEach(J.nodes(),function(oe){var _e=F(J.node(oe));q.setNode(oe,e.defaults(ee(_e,R),T)),q.setParent(oe,J.parent(oe))}),e.forEach(J.edges(),function(oe){var _e=F(J.edge(oe));q.setEdge(oe,e.merge({},M,ee(_e,C),e.pick(_e,I)))}),q}function L(J){var q=J.graph();q.ranksep/=2,e.forEach(J.edges(),function(Y){var oe=J.edge(Y);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(q.rankdir==="TB"||q.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function D(J){e.forEach(J.edges(),function(q){var Y=J.edge(q);if(Y.width&&Y.height){var oe=J.node(q.v),_e=J.node(q.w),ae={rank:(_e.rank-oe.rank)/2+oe.rank,e:q};m.addDummyNode(J,"edge-proxy",ae,"_ep")}})}function $(J){var q=0;e.forEach(J.nodes(),function(Y){var oe=J.node(Y);oe.borderTop&&(oe.minRank=J.node(oe.borderTop).rank,oe.maxRank=J.node(oe.borderBottom).rank,q=e.max(q,oe.maxRank))}),J.graph().maxRank=q}function te(J){e.forEach(J.nodes(),function(q){var Y=J.node(q);Y.dummy==="edge-proxy"&&(J.edge(Y.e).labelRank=Y.rank,J.removeNode(q))})}function V(J){var q=Number.POSITIVE_INFINITY,Y=0,oe=Number.POSITIVE_INFINITY,_e=0,ae=J.graph(),ye=ae.marginx||0,Fe=ae.marginy||0;function ct(ht){var pt=ht.x,et=ht.y,ze=ht.width,Be=ht.height;q=Math.min(q,pt-ze/2),Y=Math.max(Y,pt+ze/2),oe=Math.min(oe,et-Be/2),_e=Math.max(_e,et+Be/2)}e.forEach(J.nodes(),function(ht){ct(J.node(ht))}),e.forEach(J.edges(),function(ht){var pt=J.edge(ht);e.has(pt,"x")&&ct(pt)}),q-=ye,oe-=Fe,e.forEach(J.nodes(),function(ht){var pt=J.node(ht);pt.x-=q,pt.y-=oe}),e.forEach(J.edges(),function(ht){var pt=J.edge(ht);e.forEach(pt.points,function(et){et.x-=q,et.y-=oe}),e.has(pt,"x")&&(pt.x-=q),e.has(pt,"y")&&(pt.y-=oe)}),ae.width=Y-q+ye,ae.height=_e-oe+Fe}function z(J){e.forEach(J.edges(),function(q){var Y=J.edge(q),oe=J.node(q.v),_e=J.node(q.w),ae,ye;Y.points?(ae=Y.points[0],ye=Y.points[Y.points.length-1]):(Y.points=[],ae=_e,ye=oe),Y.points.unshift(m.intersectRect(oe,ae)),Y.points.push(m.intersectRect(_e,ye))})}function G(J){e.forEach(J.edges(),function(q){var Y=J.edge(q);if(e.has(Y,"x"))switch((Y.labelpos==="l"||Y.labelpos==="r")&&(Y.width-=Y.labeloffset),Y.labelpos){case"l":Y.x-=Y.width/2+Y.labeloffset;break;case"r":Y.x+=Y.width/2+Y.labeloffset;break}})}function K(J){e.forEach(J.edges(),function(q){var Y=J.edge(q);Y.reversed&&Y.points.reverse()})}function H(J){e.forEach(J.nodes(),function(q){if(J.children(q).length){var Y=J.node(q),oe=J.node(Y.borderTop),_e=J.node(Y.borderBottom),ae=J.node(e.last(Y.borderLeft)),ye=J.node(e.last(Y.borderRight));Y.width=Math.abs(ye.x-ae.x),Y.height=Math.abs(_e.y-oe.y),Y.x=ae.x+Y.width/2,Y.y=oe.y+Y.height/2}}),e.forEach(J.nodes(),function(q){J.node(q).dummy==="border"&&J.removeNode(q)})}function se(J){e.forEach(J.edges(),function(q){if(q.v===q.w){var Y=J.node(q.v);Y.selfEdges||(Y.selfEdges=[]),Y.selfEdges.push({e:q,label:J.edge(q)}),J.removeEdge(q)}})}function P(J){var q=m.buildLayerMatrix(J);e.forEach(q,function(Y){var oe=0;e.forEach(Y,function(_e,ae){var ye=J.node(_e);ye.order=ae+oe,e.forEach(ye.selfEdges,function(Fe){m.addDummyNode(J,"selfedge",{width:Fe.label.width,height:Fe.label.height,rank:ye.rank,order:ae+ ++oe,e:Fe.e,label:Fe.label},"_se")}),delete ye.selfEdges})})}function W(J){e.forEach(J.nodes(),function(q){var Y=J.node(q);if(Y.dummy==="selfedge"){var oe=J.node(Y.e.v),_e=oe.x+oe.width/2,ae=oe.y,ye=Y.x-_e,Fe=oe.height/2;J.setEdge(Y.e,Y.label),J.removeNode(q),Y.label.points=[{x:_e+2*ye/3,y:ae-Fe},{x:_e+5*ye/6,y:ae-Fe},{x:_e+ye,y:ae},{x:_e+5*ye/6,y:ae+Fe},{x:_e+2*ye/3,y:ae+Fe}],Y.label.x=Y.x,Y.label.y=Y.y}})}function ee(J,q){return e.mapValues(e.pick(J,q),Number)}function F(J){var q={};return e.forEach(J,function(Y,oe){q[oe.toLowerCase()]=Y}),q}return sv}var ov,WT;function sG(){if(WT)return ov;WT=1;var e=ur(),t=Bi(),n=Ga().Graph;ov={debugOrdering:r};function r(i){var o=t.buildLayerMatrix(i),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(o,function(u,d){var f="layer"+d;l.setNode(f,{rank:"same"}),e.reduce(u,function(p,h){return l.setEdge(p,h,{style:"invis"}),h})}),l}return ov}var lv,VT;function oG(){return VT||(VT=1,lv="0.8.5"),lv}var cv,GT;function lG(){return GT||(GT=1,cv={graphlib:Ga(),layout:aG(),debug:sG(),util:{time:Bi().time,notime:Bi().notime},version:oG()}),cv}var cG=lG();const np=tc(cG),uG={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"}},dG={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 fG(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function KT(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function pG({todos:e,darkMode:t,displayLayout:n,setLayoutField:r}){const i=Array.isArray(e)?e:[],[o,l]=y.useState(null),u=y.useRef(null),d=y.useRef(null),[f,p]=y.useState(400),[h,m]=y.useState(function(){const V=Number(n&&n.mapZoom);return Number.isFinite(V)&&V>.1?V:1});y.useEffect(function(){r&&(n&&n.mapZoom===h||r("mapZoom",h))},[h,n,r]);const[x,v]=y.useState(function(){return!(n&&n.mapShowCompleted===!1)});y.useEffect(function(){r&&(n&&n.mapShowCompleted===x||r("mapShowCompleted",x))},[x,n,r]);const[k,_]=y.useState(function(){return(n&&n.mapRankdir)==="LR"?"LR":"TB"});y.useEffect(function(){r&&(n&&n.mapRankdir===k||r("mapRankdir",k))},[k,n,r]);const S=y.useMemo(function(){if(x)return i;const V=i.filter(function(G){return G.status!=="completed"}),z={};return V.forEach(function(G){z[G.id]=!0}),V.map(function(G){if(!G.blockedBy||!G.blockedBy.length)return G;const K=G.blockedBy.filter(function(H){return z[H]});return K.length===G.blockedBy.length?G:Object.assign({},G,{blockedBy:K})})},[i,x]);y.useEffect(function(){if(!u.current)return;function V(){u.current&&p(u.current.clientWidth||400)}V();const z=new ResizeObserver(V);return z.observe(u.current),function(){z.disconnect()}},[]);const w=y.useMemo(function(){if(!S.length)return{nodes:[],edges:[],width:0,height:0};const V=new np.graphlib.Graph;V.setGraph({rankdir:k,nodesep:24,ranksep:36,marginx:16,marginy:16}),V.setDefaultEdgeLabel(function(){return{}});const z=180,G=56;S.forEach(function(se){V.setNode(String(se.id),{width:z,height:G,todo:se})}),S.forEach(function(se){(se.blockedBy||[]).forEach(function(W){V.hasNode(String(W))&&V.setEdge(String(W),String(se.id))})}),np.layout(V);const K=V.nodes().map(function(se){const P=V.node(se);return{id:se,x:P.x-z/2,y:P.y-G/2,w:z,h:G,todo:P.todo}}),H=V.edges().map(function(se){const P=V.edge(se);return{from:se.v,to:se.w,points:P.points}});return{nodes:K,edges:H,width:V.graph().width||z+32,height:V.graph().height||G+32}},[S,k]),N=t?dG:uG;if(!S.length){const V=i.length-S.length;return a.jsxs("div",{ref:u,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[a.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:a.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})})}),V>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[V," completed ",V===1?"todo is":"todos are"," hidden."]}),a.jsx("button",{type:"button",onClick:function(){v(!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"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),a.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 ",a.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"todo"})," tool will appear here as a live DAG."]})]})]})}function R(V){if(!V||V.length<2)return"";let z="M "+V[0].x+" "+V[0].y;for(let G=1;G<V.length;G++)z+=" L "+V[G].x+" "+V[G].y;return z}const T=i.reduce(function(V,z){const G=KT(z);return V[G]=(V[G]||0)+1,V},{}),C=T.completed||0,M=Math.max(w.width,100),I=Math.max(w.height,100),L=(M>f-24?1:(f-24)/M)*h,D=M*L,$=I*L;function te(V){(V.ctrlKey||V.metaKey)&&(V.preventDefault(),m(function(z){const G=V.deltaY<0?z*1.1:z/1.1;return Math.max(.25,Math.min(4,G))}))}return a.jsxs("div",{ref:u,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[a.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[a.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[a.jsxs("span",{children:[i.length," total"]}),T.in_progress?a.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[T.in_progress," active"]}):null,C?a.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[C," done"]}):null,T.blocked?a.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[T.blocked," blocked"]}):null,a.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[a.jsx("button",{type:"button",onClick:function(){_(function(V){return V==="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:k==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:k==="TB"?"↓":"→"}),a.jsx("button",{type:"button",onClick:function(){m(function(V){return Math.max(.25,V/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:"−"}),a.jsxs("button",{type:"button",onClick:function(){m(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(h*100),"%"]}),a.jsx("button",{type:"button",onClick:function(){m(function(V){return Math.min(4,V*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),C>0?a.jsx("button",{type:"button",onClick:function(){v(function(V){return!V})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(x?"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:x?"Hide completed todos":"Show completed todos",children:x?"hide done":"show done"}):null]})]}),a.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:te,children:a.jsxs("svg",{viewBox:"0 0 "+M+" "+I,width:D,height:$,style:{display:"block"},children:[a.jsx("defs",{children:a.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),w.edges.map(function(V,z){return a.jsx("path",{d:R(V.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+z)}),w.nodes.map(function(V){const z=KT(V.todo),G=N[z],K=z==="in_progress",H=o===V.id;return a.jsxs("g",{transform:"translate("+V.x+","+V.y+")",onMouseEnter:function(){l(V.id)},onMouseLeave:function(){l(null)},style:{cursor:"pointer"},children:[a.jsx("rect",{width:V.w,height:V.h,rx:6,ry:6,fill:G.fill,stroke:G.stroke,strokeWidth:K||H?2:1.25,children:K?a.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),K?a.jsx("circle",{cx:10,cy:10,r:3.5,fill:G.stroke,children:a.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,a.jsx("text",{x:V.w/2,y:V.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:G.label,children:"#"+V.todo.id}),a.jsx("text",{x:V.w/2,y:V.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:fG(V.todo.text,26)}),H&&V.todo.text&&V.todo.text.length>26?a.jsx("title",{children:V.todo.text}):null]},V.id)})]})})]})}const hG={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"}},gG={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},mG={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},xG={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"}},yG={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},bG={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},vG={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},kG={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},fo={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function _G(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function wG(e,t){return e.kind==="thought"?t?kG:vG:e.status==="error"?t?bG:mG:(t?xG:hG)[e.tool]||(t?yG:gG)}function SG({graph:e,darkMode:t,onNodeClick:n,displayLayout:r,setLayoutField:i}){const o=e&&Array.isArray(e.nodes)?e.nodes:[],l=e&&Array.isArray(e.edges)?e.edges:[],u=y.useRef(null),d=y.useRef(null),[f,p]=y.useState(null),[h,m]=y.useState(400),[x,v]=y.useState(function(){const K=Number(r&&r.toolmapZoom);return Number.isFinite(K)&&K>.1?K:1});y.useEffect(function(){i&&(r&&r.toolmapZoom===x||i("toolmapZoom",x))},[x,r,i]);const[k,_]=y.useState(function(){return(r&&r.toolmapRankdir)==="LR"?"LR":"TB"});y.useEffect(function(){i&&(r&&r.toolmapRankdir===k||i("toolmapRankdir",k))},[k,r,i]);const[S,w]=y.useState(function(){return!!(r&&r.toolmapShowHidden)});y.useEffect(function(){i&&(r&&r.toolmapShowHidden===S||i("toolmapShowHidden",S))},[S,r,i]);const[N,R]=y.useState(function(){return!!(r&&r.toolmapShowThoughts)});y.useEffect(function(){i&&(r&&r.toolmapShowThoughts===N||i("toolmapShowThoughts",N))},[N,r,i]);const T=y.useMemo(function(){let K=o;return S||(K=K.filter(function(H){return!H.hidden})),N||(K=K.filter(function(H){return H.kind!=="thought"})),K},[o,S,N]),C=y.useMemo(function(){const K={};return T.forEach(function(H){K[H.id]=!0}),l.filter(function(H){return K[H.from]&&K[H.to]})},[l,T]),M=y.useMemo(function(){if(!T.length)return{nodes:[],edges:[],width:0,height:0};const K=new np.graphlib.Graph;K.setGraph({rankdir:k,nodesep:18,ranksep:32,marginx:14,marginy:14}),K.setDefaultEdgeLabel(function(){return{}});const H=168,se=44,P=240,W=60;T.forEach(function(J){J.kind==="thought"?K.setNode(J.id,{width:P,height:W,node:J}):K.setNode(J.id,{width:H,height:se,node:J})}),C.forEach(function(J){K.hasNode(J.from)&&K.hasNode(J.to)&&K.setEdge(J.from,J.to,{kind:J.kind})}),np.layout(K);const ee=K.nodes().map(function(J){const q=K.node(J);return{id:J,x:q.x-q.width/2,y:q.y-q.height/2,w:q.width,h:q.height,node:q.node}}),F=K.edges().map(function(J){const q=K.edge(J);return{from:J.v,to:J.w,points:q.points||[],kind:q.kind||"seq"}});return{nodes:ee,edges:F,width:K.graph().width||H+28,height:K.graph().height||se+28}},[T,C,k]);y.useEffect(function(){if(!u.current)return;function K(){u.current&&m(u.current.clientWidth||400)}K();const H=new ResizeObserver(K);return H.observe(u.current),function(){H.disconnect()}},[]);const I=y.useMemo(function(){const K={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return o.forEach(function(H){if(H.kind==="thought"){K.thoughts++;return}K.total++,H.hidden&&K.hidden++,H.status==="error"?K.error++:H.status==="running"?K.running++:K.ok++}),K},[o]);if(!T.length)return a.jsxs("div",{ref:u,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[a.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:a.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),a.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),a.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."}),I.hidden>0&&!S?a.jsxs("button",{type:"button",onClick:function(){w(!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 ",I.hidden," hidden"]}):null]});function A(K){if(!K||K.length<2)return"";let H="M "+K[0].x+" "+K[0].y;for(let se=1;se<K.length;se++)H+=" L "+K[se].x+" "+K[se].y;return H}const L=Math.max(M.width,100),D=Math.max(M.height,100),te=(L>h-24?1:(h-24)/L)*x,V=L*te,z=D*te;function G(K){(K.ctrlKey||K.metaKey)&&(K.preventDefault(),v(function(H){const se=K.deltaY<0?H*1.1:H/1.1;return Math.max(.25,Math.min(4,se))}))}return a.jsxs("div",{ref:u,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[a.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs shrink-0",children:[a.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),a.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[a.jsxs("span",{children:[I.total," tools"]}),I.running?a.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[I.running," live"]}):null,I.error?a.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[I.error," err"]}):null,a.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[a.jsx("button",{type:"button",onClick:function(){_(function(K){return K==="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:k==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:k==="TB"?"↓":"→"}),a.jsx("button",{type:"button",onClick:function(){v(function(K){return Math.max(.25,K/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:"−"}),a.jsxs("button",{type:"button",onClick:function(){v(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(x*100),"%"]}),a.jsx("button",{type:"button",onClick:function(){v(function(K){return Math.min(4,K*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:"+"})]}),I.hidden>0?a.jsx("button",{type:"button",onClick:function(){w(function(K){return!K})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(S?"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:S?"Hide bookkeeping tools":"Show bookkeeping tools (todo, permission, etc.)",children:S?"hide bk":"show bk"}):null,I.thoughts>0?a.jsx("button",{type:"button",onClick:function(){R(function(K){return!K})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(N?"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:N?"Hide reasoning bubbles":"Show reasoning bubbles ("+I.thoughts+" thoughts)",children:N?"💭 "+I.thoughts:"💭 off"}):null]})]}),a.jsx("div",{ref:d,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:G,children:a.jsxs("svg",{viewBox:"0 0 "+L+" "+D,width:V,height:z,style:{display:"block"},children:[a.jsxs("defs",{children:[a.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?fo.data.dark:fo.data.light})}),a.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?fo.file.dark:fo.file.light})}),a.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?fo.seq.dark:fo.seq.light})})]}),M.edges.map(function(K,H){const se=t?fo[K.kind].dark:fo[K.kind].light;return a.jsx("path",{d:A(K.points),fill:"none",stroke:se,strokeWidth:K.kind==="data"?1.75:K.kind==="file"?1.25:1,strokeDasharray:K.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+K.kind+")"},"e"+H)}),M.nodes.map(function(K){const H=K.node,se=wG(H,t),P=H.status==="running",W=f===K.id;if(H.kind==="thought"){const F=H.label||"",J=32,q=3,Y=F.split(/\s+/),oe=[];let _e="";for(const ae of Y){if(oe.length===q-1&&(_e+" "+ae).length>J){oe.push(_e);const ye=Y.slice(Y.indexOf(ae)).join(" ");oe.push(ye.length>J?ye.slice(0,J-1)+"…":ye),_e="";break}if(!_e){_e=ae;continue}if((_e+" "+ae).length<=J?_e=_e+" "+ae:(oe.push(_e),_e=ae),oe.length>=q)break}return _e&&oe.length<q&&oe.push(_e),a.jsxs("g",{transform:"translate("+K.x+","+K.y+")",onMouseEnter:function(){p(K.id)},onMouseLeave:function(){p(null)},onClick:function(){n&&n(H)},style:{cursor:n?"pointer":"default"},children:[a.jsx("rect",{width:K.w,height:K.h,rx:K.h/2,ry:K.h/2,fill:se.fill,stroke:se.stroke,strokeWidth:W?1.75:1,strokeDasharray:H.source==="reasoning"?void 0:"4,2"}),a.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:se.label,children:oe.map(function(ae,ye){return a.jsx("tspan",{x:14,dy:ye===0?14:11,children:(ye===0?"💭 ":"")+ae},"ln"+ye)})}),a.jsx("title",{children:(H.source==="reasoning"?"[reasoning] ":"[thought] ")+(H.fullText||H.label)})]},K.id)}return a.jsxs("g",{transform:"translate("+K.x+","+K.y+")",onMouseEnter:function(){p(K.id)},onMouseLeave:function(){p(null)},onClick:function(){n&&n(H)},style:{cursor:n?"pointer":"default"},children:[a.jsx("rect",{width:K.w,height:K.h,rx:5,ry:5,fill:se.fill,stroke:se.stroke,strokeWidth:P||W?2:1.25,opacity:H.hidden?.55:1,children:P?a.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),a.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:se.label,children:H.tool}),a.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:_G(H.label,22)}),a.jsx("title",{children:H.tool+" · "+H.label+(H.status==="error"?" · ERROR":H.status==="running"?" · RUNNING":"")}),P?a.jsxs("g",{transform:"translate("+(K.w-9)+",9)",children:[a.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:se.stroke,strokeWidth:.75}),a.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[a.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),a.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},K.id)})]})})]})}/*! @license DOMPurify 3.5.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.5.0/LICENSE */function YT(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 EG(e){if(Array.isArray(e))return e}function NG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,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,i=p}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw i}}return u}}function CG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
121
|
+
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 jG(e,t){return EG(e)||NG(e,t)||TG(e,t)||CG()}function TG(e,t){if(e){if(typeof e=="string")return YT(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)?YT(e,t):void 0}}const JI=Object.entries,RG=Object.keys,QT=Object.setPrototypeOf,AG=Object.isFrozen,eM=Object.getPrototypeOf,tM=Object.getOwnPropertyDescriptor;let Mr=Object.freeze,br=Object.seal,mo=Object.create,nM=typeof Reflect<"u"&&Reflect,rp=nM.apply,_k=nM.construct;Mr||(Mr=function(t){return t});br||(br=function(t){return t});rp||(rp=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];return t.apply(n,i)});_k||(_k=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new t(...r)});const Ba=tr(Array.prototype.forEach),IG=tr(Array.prototype.lastIndexOf),XT=tr(Array.prototype.pop),su=tr(Array.prototype.push),ZT=tr(Array.prototype.slice),MG=tr(Array.prototype.splice),Ql=Array.isArray,uv=M1(Set),dv=tr(Set.prototype.add),ou=tr(Set.prototype.has),LG=tr(Set.prototype.delete),OG=M1(Map),JT=tr(Map.prototype.get),eR=tr(Map.prototype.set),Ms=tr(String.prototype.toLowerCase),fv=tr(String.prototype.toString),DG=tr(String.prototype.match),lu=tr(String.prototype.replace),pv=tr(String.prototype.indexOf),PG=tr(String.prototype.trim),FG=tr(Number.prototype.toString),BG=tr(Boolean.prototype.toString),tR=typeof BigInt>"u"?null:tr(BigInt.prototype.toString),nR=typeof Symbol>"u"?null:tr(Symbol.prototype.toString),pi=tr(Object.prototype.hasOwnProperty),cu=tr(Object.prototype.toString),zG=RegExp.prototype.test,Sr=function(t,n){return t instanceof RegExp&&(t.lastIndex=0),rp(zG,t,[n])},is=M1(TypeError);function tr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return rp(e,t,r)}}function M1(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return _k(e,n)}}function Ln(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ms;if(QT&&QT(e,null),!Ql(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const o=n(i);o!==i&&(AG(t)||(t[r]=o),i=o)}e[i]=!0}return e}function UG(e){for(let t=0;t<e.length;t++)pi(e,t)||(e[t]=null);return e}function ip(e){const t=mo(null);for(const r of JI(e)){var n=jG(r,2);const i=n[0],o=n[1];pi(e,i)&&(Ql(o)?t[i]=UG(o):o&&typeof o=="object"&&o.constructor===Object?t[i]=ip(o):t[i]=o)}return t}function wu(e){const t=mo(null),n=RG(e);let r=n.length;for(;r--;)t[n[r]]=e[n[r]];return t}function qG(e){switch(typeof e){case"string":return e;case"number":return FG(e);case"boolean":return BG(e);case"bigint":return tR?tR(e):"0";case"symbol":return nR?nR(e):"Symbol()";case"undefined":return cu(e);case"function":case"object":{if(e===null)return cu(e);const t=e,n=Ji(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:cu(r)}return cu(e)}default:return cu(e)}}function Ji(e,t){for(;e!==null;){const r=tM(e,t);if(r){if(r.get)return tr(r.get);if(typeof r.value=="function")return tr(r.value)}e=eM(e)}function n(){return null}return n}function HG(e,t){for(;e!==null;){const n=tM(e,t);if(n)return n.get?tr(n.get):null;e=eM(e)}return null}function $G(e){if(!e)return!1;try{return Sr(e,""),!0}catch{return!1}}const rR=Mr(["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"]),hv=Mr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),gv=Mr(["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"]),WG=Mr(["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"]),mv=Mr(["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"]),VG=Mr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),iR=Mr(["#text"]),aR=Mr(["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"]),xv=Mr(["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"]),sR=Mr(["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"]),Ef=Mr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),GG=br(/{{[\w\W]*|^[\w\W]*}}/g),KG=br(/<%[\w\W]*|^[\w\W]*%>/g),YG=br(/\${[\w\W]*/g),oR=br(/{{|}}|\${|<%|%>/),QG=br(/[^\t\n\f\r ]/),lR=br(/\u0000/g),XG=br(/^data-[\-\w.\u00B7-\uFFFF]+$/),ZG=br(/^aria-[\-\w]+$/),cR=br(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),JG=br(/^(?:\w+script|data):/i),eK=br(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tK=br(/^html$/i),nK=br(/^[a-z][.\w]*(-[.\w]+)+$/i),yv=br(/<[/\w!]/g),rK=br(/<[/\w]/g),iK=br(/<[/\w]|^-?>|--!?>|<!-$/g),aK=br(/<\/no(script|embed|frames)/i),uR=br(/\/>/i),sK=br(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),oK=br(/^[\r\n\t ]+/),nr={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},lK=Mr(Ln({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),cK=Mr(Ln({},["textarea","title"])),uK=Mr(Ln({},["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","meta","param","source","track","wbr"])),dK=function(){return typeof window>"u"?null:window},fK=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));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}},dR=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},po=function(t,n,r,i){return pi(t,n)&&Ql(t[n])?Ln(i.base?wu(i.base):{},t[n],i.transform):r},bv=function(t,n,r){const i=pi(t,n)?t[n]:void 0;return i&&typeof i=="object"?ip(i):r};function rM(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dK();const t=Ze=>rM(Ze);if(t.version="3.5.0",t.removed=[],!e||!e.document||e.document.nodeType!==nr.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,i=r.currentScript,o=e.HTMLTemplateElement,l=e.Node,u=e.Element,d=e.NodeFilter,f=e.DOMParser,p=e.trustedTypes,h=u.prototype,m=Ji(h,"cloneNode"),x=Ji(h,"remove"),v=Ji(h,"removeChild"),k=Ji(h,"removeAttributeNode"),_=Ji(h,"nextSibling"),S=Ji(h,"childNodes"),w=Ji(h,"parentNode"),N=Ji(h,"shadowRoot"),R=Ji(h,"attributes"),T=l&&l.prototype?Ji(l.prototype,"nodeType"):null,C=l&&l.prototype?Ji(l.prototype,"nodeName"):null,M=l&&l.prototype?Ji(l.prototype,"ownerDocument"):null,I=function(U){return T?T(U):U.nodeType},A=function(U){return C?C(U):U.nodeName},L=HG(h,"namespaceURI"),D=function(U){return L?L(U):U.namespaceURI},$=function(U){return I(U)===nr.element?R(U):null};if(typeof o=="function"){const Ze=n.createElement("template");Ze.content&&Ze.content.ownerDocument&&(n=Ze.content.ownerDocument)}let te,V="",z,G=!1,K=0;const H=function(){if(K>0)throw is('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.')},se=function(U){H(),K++;try{return te.createHTML(U)}finally{K--}},P=function(U){return te&&kt?se(U):U},W=function(U){H(),K++;try{return te.createScriptURL(U)}finally{K--}},ee=function(){return G||(z=fK(p,i),G=!0),z},F=n,J=F.implementation,q=F.createNodeIterator,Y=F.createDocumentFragment,oe=F.getElementsByTagName,_e=r.importNode;let ae=dR();t.isSupported=typeof JI=="function"&&typeof w=="function"&&J&&J.createHTMLDocument!==void 0;const ye=GG,Fe=KG,ct=YG,ht=XG,pt=ZG,et=JG,ze=eK,Be=nK;let At=cR,lt=null;const on=Ln({},[...rR,...hv,...gv,...mv,...iR]);let _t=null;const gn=Ln({},[...aR,...xv,...sR,...Ef]);let Ht=null,Kt=null,ut=null;const Pe=Object.seal(mo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,be=!0,fe=!1,Oe=!0,ft=!1,gt=!0,dt=!1,Lt=!1,Wt=null,rt=null,wt=!1,Yt=!1,an=!1,kt=!1,xe=!0,De=!1;const Ke="user-content-";let X=!0,Ee=!1,Te=null,mt=null,Ut=!1,Rt=null;const st=Ln({},["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 ve=null;const Re=Ln({},["audio","video","img","source","image","track"]);let Xe=null;const Ie=Ln({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ie="http://www.w3.org/1998/Math/MathML",Ct="http://www.w3.org/2000/svg",mn="http://www.w3.org/1999/xhtml";let Me=mn,Et=!1,kn=null;const Wn=Ln({},[ie,Ct,mn],fv),ki=Mr(Ln({},["mi","mo","mn","ms","mtext"]));let kr=null;const dr=Mr(Ln({},["annotation-xml"]));let wa=null;const Bs=Mr(mo(null)),$t=Ln({},["title","style","font","a","script"]);let Kn=null;const Ui=["application/xhtml+xml","text/html"],fr="text/html";let tn=null,ia=null,aa=null;const qi=n.createElement("form"),Hi=function(U){return U instanceof RegExp||U instanceof Function},Ye=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(!U||typeof U!="object")&&(U={}),U=ip(U),Kn=Ui.indexOf(U.PARSER_MEDIA_TYPE)===-1?fr:U.PARSER_MEDIA_TYPE,tn=Kn==="application/xhtml+xml"?fv:Ms,lt=po(U,"ALLOWED_TAGS",on,{transform:tn}),_t=po(U,"ALLOWED_ATTR",gn,{transform:tn}),kn=po(U,"ALLOWED_NAMESPACES",Wn,{transform:fv}),Xe=po(U,"ADD_URI_SAFE_ATTR",Ie,{transform:tn,base:Ie}),ve=po(U,"ADD_DATA_URI_TAGS",Re,{transform:tn,base:Re}),Rt=po(U,"FORBID_CONTENTS",st,{transform:tn}),Kt=po(U,"FORBID_TAGS",mo(null),{transform:tn}),ut=po(U,"FORBID_ATTR",mo(null),{transform:tn}),Ut=pi(U,"USE_PROFILES")?U.USE_PROFILES&&typeof U.USE_PROFILES=="object"?ip(U.USE_PROFILES):U.USE_PROFILES:!1,le=U.ALLOW_ARIA_ATTR!==!1,be=U.ALLOW_DATA_ATTR!==!1,fe=U.ALLOW_UNKNOWN_PROTOCOLS||!1,Oe=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ft=U.SAFE_FOR_TEMPLATES||!1,gt=U.SAFE_FOR_XML!==!1,dt=U.WHOLE_DOCUMENT||!1,Yt=U.RETURN_DOM||!1,an=U.RETURN_DOM_FRAGMENT||!1,kt=U.RETURN_TRUSTED_TYPE||!1,wt=U.FORCE_BODY||!1,xe=U.SANITIZE_DOM!==!1,De=U.SANITIZE_NAMED_PROPS||!1,X=U.KEEP_CONTENT!==!1,Ee=U.IN_PLACE||!1,At=$G(U.ALLOWED_URI_REGEXP)?U.ALLOWED_URI_REGEXP:cR,Me=typeof U.NAMESPACE=="string"?U.NAMESPACE:mn,kr=bv(U,"MATHML_TEXT_INTEGRATION_POINTS",ki),wa=bv(U,"HTML_INTEGRATION_POINTS",dr);const he=bv(U,"CUSTOM_ELEMENT_HANDLING",Bs);if(Ht=mo(null),pi(he,"tagNameCheck")&&Hi(he.tagNameCheck)&&(Ht.tagNameCheck=he.tagNameCheck),pi(he,"attributeNameCheck")&&Hi(he.attributeNameCheck)&&(Ht.attributeNameCheck=he.attributeNameCheck),pi(he,"allowCustomizedBuiltInElements")&&typeof he.allowCustomizedBuiltInElements=="boolean"&&(Ht.allowCustomizedBuiltInElements=he.allowCustomizedBuiltInElements),br(Ht),ft&&(be=!1),an&&(Yt=!0),Ut&&((pi(U,"ALLOWED_TAGS")||pi(U,"ALLOWED_ATTR"))&&typeof console<"u"&&typeof console.warn=="function"&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),lt=Ln({},iR),_t=mo(null),Ut.html===!0&&(Ln(lt,rR),Ln(_t,aR)),Ut.svg===!0&&(Ln(lt,hv),Ln(_t,xv),Ln(_t,Ef)),Ut.svgFilters===!0&&(Ln(lt,gv),Ln(_t,xv),Ln(_t,Ef)),Ut.mathMl===!0&&(Ln(lt,mv),Ln(_t,sR),Ln(_t,Ef))),Pe.tagCheck=null,Pe.attributeCheck=null,pi(U,"ADD_TAGS")&&(typeof U.ADD_TAGS=="function"?Pe.tagCheck=U.ADD_TAGS:Ql(U.ADD_TAGS)&&(lt===on&&(lt=wu(lt)),Ln(lt,U.ADD_TAGS,tn))),pi(U,"ADD_ATTR")&&(typeof U.ADD_ATTR=="function"?Pe.attributeCheck=U.ADD_ATTR:Ql(U.ADD_ATTR)&&(_t===gn&&(_t=wu(_t)),Ln(_t,U.ADD_ATTR,tn))),pi(U,"ADD_FORBID_CONTENTS")&&Ql(U.ADD_FORBID_CONTENTS)&&(Rt===st&&(Rt=wu(Rt)),Ln(Rt,U.ADD_FORBID_CONTENTS,tn)),X&&(lt["#text"]=!0),dt&&Ln(lt,["html","head","body"]),lt.table&&(lt.tbody=!0,delete Kt.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw is('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw is('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Ce=te;te=U.TRUSTED_TYPES_POLICY;try{V=se("")}catch(Le){throw te=Ce,Le}}else U.TRUSTED_TYPES_POLICY===null?(te=void 0,V=""):(te===void 0&&(te=ee()),te&&typeof V=="string"&&(V=se("")));ia=Mr(U)},Nt=Ln({},[...hv,...gv,...WG]),ln=Ln({},[...mv,...VG]),vn=function(U,he,Ce){return he===mn?U==="svg":he===ie?U==="svg"&&(Ce==="annotation-xml"||kr[Ce]):!!Nt[U]},Cn=function(U,he,Ce){return he===mn?U==="math":he===Ct?U==="math"&&wa[Ce]:!!ln[U]},dn=function(U,he,Ce){return he===Ct&&!wa[Ce]||he===ie&&!kr[Ce]?!1:!ln[U]&&($t[U]||!Nt[U])},ri=function(U){const he=D(U),Ce=Ms(A(U)),Le=w(U);let tt=Me,It="template";return Le&&I(Le)===nr.element&&(tt=D(Le),It=Ms(A(Le))),kn[he]?he===Ct?vn(Ce,tt,It):he===ie?Cn(Ce,tt,It):he===mn?dn(Ce,tt,It):Kn==="application/xhtml+xml":!1},Nr=function(U){su(t.removed,{element:U}),Zt(U);try{w(U).removeChild(U)}catch{if(x(U),!w(U))throw is("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},_r=function(U,he,Ce){try{k(U,he)}catch{try{U.removeAttribute(Ce)}catch{}}},pr=function(U){sa(U);const he=S(U);he&&Ba(ZT(he),Ce=>{try{v(U,Ce)}catch{}}),I(U)===nr.element&&$r(U,!1)},Qr=function(U,he,Ce){if(!Ce)try{Ce=he.getAttributeNode(U)}catch{Ce=null}if(su(t.removed,{attribute:Ce||null,from:he}),Ce)_r(he,Ce,U);else try{he.removeAttribute(U)}catch{}if(U==="is")if(Yt||an)try{Nr(he)}catch{}else try{he.setAttribute(U,"")}catch{}},$r=function(U,he){const Ce=R(U);if(Ce)for(let Le=Ce.length-1;Le>=0;--Le){const tt=Ce[Le],It=tt&&tt.name;typeof It=="string"&&!(he&&_t[tn(It)])&&_r(U,tt,It)}},_i=function(U,he){let Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const Le=[U];for(;Le.length>0;){const tt=Le.pop();if(he(tt)===!1)continue;if(Ce&&I(tt)===nr.element){const Dt=N(tt);Vn(Dt)&&Le.push(Dt)}const It=S(tt);if(It)for(let Dt=It.length-1;Dt>=0;--Dt)Le.push(It[Dt])}},sa=function(U){_i(U,he=>{I(he)===nr.element&&$r(he,!0)})},wi=function(U){const he=[];return _i(U,Ce=>{he.push(Ce)},!0),he},Si=function(U,he){const Ce=uv();Ba(wi(U),Le=>{I(Le)===nr.element&&dv(Ce,Le)}),Ba(he,Le=>{I(Le)===nr.element&&!ou(Ce,Le)&&$r(Le,!0)})},$i=function(U,he){let Ce=!1;return Ba(t.removed,Le=>{Le.element&&(Ce=Ce||Le.element===U,sa(Le.element))}),Si(U,he),Ce},Or=function(U,he){pr(U),$i(U,he)},Ei=8,Dr=function(U,he){const Ce=Te;let Le=null;const tt=()=>(Le||(Le=uv(),Ba(he,It=>{dv(Le,It)})),Le);for(let It=0;;It++){const Dt=wi(U),Rn=[U];let Wi=!1;if(Ba(Dt,Cr=>{I(Cr)===nr.documentFragment?su(Rn,Cr):!Wi&&!ou(Ce,Cr)&&(Wi=ou(tt(),Cr))}),!Wi)return;if(It>=Ei)throw is("the tree kept changing during in-place sanitization; refusing to return it");Ba(Rn,(Cr,ai)=>{Sa(Cr,ai>0,U,tt())})}},Sa=function(U,he,Ce,Le){const tt=or(U);let It;for(;It=tt.nextNode();)!ou(Le,It)||ou(Te,It)||(he&&lr(ae.uponSanitizeShadowNode,It,null),ps(It,Ce))},_n=function(U){if(!Te)return;dv(Te,U);const he=JT(mt,U);if(he!==void 0){if(he>=Ei)throw is("the tree kept changing during in-place sanitization; refusing to return it");eR(mt,U,he+1)}},Zt=function(U){Te&&(LG(Te,U),JT(mt,U)===void 0&&eR(mt,U,0))},ii=function(U,he){return gt?U==="patchsrc"?!0:U==="for"&&he!=="label"&&he!=="output":!1},On=function(U){gt&&_i(U,he=>{const Ce=I(he);if(Ce===nr.processingInstruction||Ce===nr.comment&&Sr(rK,he.data)){try{x(he)}catch{}return!1}if(Ce===nr.element){const Le=he,tt=tn(A(he));try{Le.hasAttribute&&Le.hasAttribute("patchsrc")&&Le.removeAttribute("patchsrc"),Le.hasAttribute&&Le.hasAttribute("for")&&ii("for",tt)&&Le.removeAttribute("for")}catch{}}return!0})},jn=function(U){let he=null,Ce=null;if(wt)U="<remove></remove>"+U;else{const It=DG(U,oK);Ce=It&&It[0]}Kn==="application/xhtml+xml"&&Me===mn&&(U='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+U+"</body></html>");const Le=te?se(U):U;if(Me===mn)try{he=new f().parseFromString(Le,Kn)}catch{}if(!he||!he.documentElement){he=J.createDocument(Me,"template",null);try{he.documentElement.innerHTML=Et?V:Le}catch{}}const tt=he.body||he.documentElement;return U&&Ce&&tt.insertBefore(n.createTextNode(Ce),tt.childNodes[0]||null),Me===mn?oe.call(he,dt?"html":"body")[0]:dt?he.documentElement:tt},or=function(U){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const Ce=M?M(U):U.ownerDocument;return q.call(Ce||U,U,(he?0:d.SHOW_ELEMENT)|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Xr=function(U){return U=lu(U,ye," "),U=lu(U,Fe," "),U=lu(U,ct," "),U},Wr=function(U){var he;qt(U);const Ce=(he=U.querySelectorAll)===null||he===void 0?void 0:he.call(U,"template");Ce&&Ba(Ce,Le=>{Vn(Le.content)&&Wr(Le.content)})},gi="table,tbody,thead,tfoot,tr,colgroup",ot=Ln({},["caption","colgroup","col","thead","tbody","tfoot","tr","td","th","style","script","template"]),bt=function(U){var he;if(Kn==="application/xhtml+xml")return;const Ce=(he=U.querySelectorAll)===null||he===void 0?void 0:he.call(U,gi);!Ce||Ce.length===0||Ba(Ce,Le=>{Ba(ZT(S(Le)),tt=>{const It=I(tt);if(!(It===nr.text?Sr(QG,tt.data):It===nr.element&&!ot[Ms(A(tt))]))return;let Dt=Le;for(;Dt&&Ms(A(Dt))!=="table";)Dt=Dt===U?null:w(Dt);const Rn=Dt&&Dt!==U?w(Dt):null;if(Rn)try{Rn.insertBefore(tt,Dt)}catch{}})})},qt=function(U){bt(U),U.normalize();const he=or(U,!0);let Ce=null,Le=he.nextNode();for(;Le;){let tt=Le.data;if(Sr(lR,tt)&&(tt=lu(tt,lR,""),Le.data=tt),Sr(oR,tt)&&(tt=Xr(tt),Le.data=tt),tt&&I(Le)===nr.text){if(Ce){const It=Ce.data,Dt=It[It.length-1]+tt[0];Sr(oR,Dt)&&(Ce.data=Xr(It+tt[0]))}Ce=Le}Le=he.nextNode()}},Qt=function(U){const he=C?C(U):null;return typeof he!="string"||tn(he)!=="form"?!1:typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||U.attributes!==R(U)||typeof U.removeAttribute!="function"||typeof U.removeAttributeNode!="function"||typeof U.getAttributeNode!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function"||U.nodeType!==T(U)||U.childNodes!==S(U)},xn=function(U){if(!T||typeof U!="object"||U===null)return null;try{const he=T(U);return typeof he=="number"?he:null}catch{return null}},Vn=function(U){return xn(U)===nr.documentFragment},Ea=function(U){return xn(U)!==null};function lr(Ze,U,he){Ze.length!==0&&Ba(Ze,Ce=>{Ce.call(t,U,he,ia)})}const Ni=function(U,he){const Ce=!!uK[he],Le=!!lK[he];return!Ce&&!Le&&!cK[he]||D(U)!==mn?!1:Ce?U.hasChildNodes():Ea(U.firstElementChild)?!0:Le&&typeof U.textContent=="string"&&Sr(yv,U.textContent)},oa=function(U,he,Ce){return!!(gt&&Ce===nr.element&&U.hasChildNodes()&&!Ea(U.firstElementChild)&&Sr(yv,U.textContent)&&Sr(yv,U.innerHTML)||gt&&Ce===nr.element&&Ni(U,he)||Ce===nr.processingInstruction||gt&&Ce===nr.comment&&Sr(iK,U.data))},us=function(U,he){if(U instanceof RegExp)return Sr(U,he);if(U instanceof Function){for(var Ce=arguments.length,Le=new Array(Ce>2?Ce-2:0),tt=2;tt<Ce;tt++)Le[tt-2]=arguments[tt];return!!U(he,...Le)}return!1},Ya=function(U,he,Ce){if(!Kt[he]&&Ca(he)&&us(Ht.tagNameCheck,he))return!1;if(X&&!Rt[he]&&!Rt[Ms(he)]){const Le=w(U),tt=S(U);if(tt&&Le){const It=tt.length;for(let Dt=It-1;Dt>=0;--Dt){const Rn=U===Ce?m(tt[Dt],!0):tt[Dt];Le.insertBefore(Rn,_(U))}}}return Nr(U),!0},Co=function(U,he,Ce,Le){return U.length===0?he:he===Ce||he===Le?wu(he):he},la=function(U,he){return U===he||w(U)!==null?!1:(Ee&&sa(U),Zt(U),!0)},ds=function(U,he){if(_n(U),lr(ae.beforeSanitizeElements,U,null),la(U,he))return!0;if(Qt(U))return Nr(U),!0;const Ce=tn(A(U)),Le=I(U);if(lt=Co(ae.uponSanitizeElement,lt,on,Wt),lr(ae.uponSanitizeElement,U,{tagName:Ce,allowedTags:lt}),la(U,he))return!0;if(oa(U,Ce,Le))return Nr(U),!0;if((Kt[Ce]||!(Pe.tagCheck instanceof Function&&Pe.tagCheck(Ce))&&!lt[Ce])&&Ya(U,Ce,he))return!0;if(Le===nr.element&&!ri(U)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&Sr(aK,U.innerHTML))return Nr(U),!0;if(ft&&Le===nr.text){const tt=U.textContent,It=Xr(tt);tt!==It&&(su(t.removed,{element:U.cloneNode()}),U.textContent=It)}return lr(ae.afterSanitizeElements,U,null),la(U,he)},Na=function(U,he,Ce){if(ut[he]||ii(he,U)||xe&&(he==="id"||he==="name")&&(Ce in n||Ce in qi))return!1;const Le=_t[he]||Pe.attributeCheck instanceof Function&&Pe.attributeCheck(he,U);if(be&&Sr(ht,he)||le&&Sr(pt,he))return!0;if(!Le)return Ca(U)&&us(Ht.tagNameCheck,U)&&us(Ht.attributeNameCheck,he,U)||he==="is"&&Ht.allowCustomizedBuiltInElements&&us(Ht.tagNameCheck,Ce);if(Xe[he])return!0;const tt=lu(Ce,ze,"");return Sr(At,tt)||(he==="src"||he==="xlink:href"||he==="href")&&U!=="script"&&pv(Ce,"data:")===0&&ve[U]||fe&&!Sr(et,tt)?!0:!Ce},Ci=Ln({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ca=function(U){return!Ci[Ms(U)]&&Sr(Be,U)},fc=function(U,he,Ce,Le){if(te&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Ce)switch(p.getAttributeType(U,he)){case"TrustedHTML":return se(Le);case"TrustedScriptURL":return W(Le)}return Le},Qa=function(U,he,Ce,Le){try{return Ce?U.setAttributeNS(Ce,he,Le):U.setAttribute(he,Le),Qt(U)?(Nr(U),!1):!0}catch{return Qr(he,U),!1}},fs=function(U,he){return gt&&Sr(sK,he)?!0:Ms(U)==="attributename"&&pv(he,"href")!==-1},yt=function(U,he){if(lr(ae.beforeSanitizeAttributes,U,null),la(U,he))return;const Ce=$(U);if(!Ce||Qt(U))return;_t=Co(ae.uponSanitizeAttribute,_t,gn,rt);const Le={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_t,forceKeepAttr:void 0};let tt=Ce.length;const It=tn(A(U));for(;tt--;){const Dt=Ce[tt];if(!Dt)continue;const Rn=Dt.name,Wi=Dt.namespaceURI,Cr=Dt.value,ai=tn(Rn),Vr=Cr;let zn=Rn==="value"?Vr:PG(Vr),ca=!1;if(Le.attrName=ai,Le.attrValue=zn,Le.keepAttr=!0,Le.forceKeepAttr=void 0,lr(ae.uponSanitizeAttribute,U,Le),zn=Le.attrValue,De&&(ai==="id"||ai==="name")&&pv(zn,Ke)!==0&&(Qr(Rn,U,Dt),zn=Ke+zn,ca=!0),fs(Rn,zn)){Qr(Rn,U,Dt);continue}if(!Le.forceKeepAttr){if(!Le.keepAttr){Qr(Rn,U,Dt);continue}if(!Oe&&Sr(uR,zn)){Qr(Rn,U,Dt);continue}if(ft&&(zn=Xr(zn)),!Na(It,ai,zn)){Qr(Rn,U,Dt);continue}zn=fc(It,ai,Wi,zn),zn!==Vr&&Qa(U,Rn,Wi,zn)&&ca&&XT(t.removed)}}lr(ae.afterSanitizeAttributes,U,null),la(U,he)},ps=function(U,he){ds(U,he),yt(U,he),Vn(U.content)&&hs(U.content)},hs=function(U){let he=null;const Ce=or(U);for(lr(ae.beforeSanitizeShadowDOM,U,null);he=Ce.nextNode();)if(lr(ae.uponSanitizeShadowNode,he,null),ps(he,U),I(he)===nr.element){const Le=N(he);Vn(Le)&&(ji(Le),hs(Le))}ft&&qt(U),lr(ae.afterSanitizeShadowDOM,U,null)},ji=function(U){const he=[{node:U,shadow:null}];for(;he.length>0;){const Ce=he.pop();if(Ce.shadow){hs(Ce.shadow);continue}const Le=Ce.node,tt=I(Le)===nr.element,It=S(Le);if(It)for(let Dt=It.length-1;Dt>=0;--Dt)he.push({node:It[Dt],shadow:null});if(tt){const Dt=C?C(Le):null;if(typeof Dt=="string"&&tn(Dt)==="template"){const Rn=Le.content;Vn(Rn)&&he.push({node:Rn,shadow:null})}}if(tt){const Dt=N(Le);Vn(Dt)&&he.push({node:null,shadow:Dt},{node:Dt,shadow:null})}}},jo=function(U){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ce=null,Le=null,tt=null,It=null;if(Et=!U,Et&&(U="<!-->"),typeof U!="string"&&!Ea(U)&&(U=qG(U),typeof U!="string"))throw is("dirty is not a string, aborting");if(!t.isSupported)return U;Lt?(lt=Wt,_t=rt):Ye(he),aa=ia,t.removed=[];const Dt=Ee&&typeof U!="string"&&Ea(U);let Rn=[];const Wi=Te,Cr=mt;if(Dt){On(U),Rn=wi(U);const zn=A(U);if(typeof zn=="string"){const ca=tn(zn);if(!lt[ca]||Kt[ca])throw Or(U,Rn),is("root node is forbidden and cannot be sanitized in-place")}if(Qt(U))throw Or(U,Rn),is("root node is clobbered and cannot be sanitized in-place");Te=uv(),mt=OG()}else if(Ea(U))Ce=jn("<!---->"),Le=Ce.ownerDocument.importNode(U,!0),Le.nodeType===nr.element&&Le.nodeName==="BODY"||Le.nodeName==="HTML"?Ce=Le:Ce.appendChild(Le),ji(Ce);else{if(!Yt&&!ft&&!dt&&U.indexOf("<")===-1)return P(U);if(Ce=jn(U),!Ce)return Yt?null:kt?V:""}Ce&&wt&&Nr(Ce.firstChild);const ai=Dt?U:Ce;try{Dt&&ji(U);const zn=or(ai);for(;tt=zn.nextNode();)ps(tt,ai);Dt&&Dr(U,Rn)}catch(zn){throw Dt&&Or(U,Rn),zn}finally{Te=Wi,mt=Cr}if(Dt){if($i(U,Rn))throw is("a node selected for removal could not be safely returned; refusing to sanitize in place");return ft&&Wr(U),U}if(Yt){if(ft&&Wr(Ce),an)for(It=Y.call(Ce.ownerDocument);Ce.firstChild;)It.appendChild(Ce.firstChild);else It=Ce;return(_t.shadowroot||_t.shadowrootmode)&&(It=_e.call(r,It,!0)),It}ft&&qt(Ce);let Vr=dt?Ce.outerHTML:Ce.innerHTML;return dt&<["!doctype"]&&Ce.ownerDocument&&Ce.ownerDocument.doctype&&Ce.ownerDocument.doctype.name&&Sr(tK,Ce.ownerDocument.doctype.name)&&(Vr="<!DOCTYPE "+Ce.ownerDocument.doctype.name+`>
|
|
122
|
+
`+Vr),P(Vr)};return t.sanitize=function(Ze){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const he=aa,Ce=lt,Le=_t,tt=t.removed;aa=null;try{return jo(Ze,U)}finally{aa=he,he&&(Lt||Ye(he),lt=Ce,_t=Le,t.removed=tt)}},t.setConfig=function(){let Ze=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(Ze),Lt=!0,Wt=lt,rt=_t},t.clearConfig=function(){ia=null,Lt=!1,Wt=null,rt=null,te=z,V=""},t.isValidAttribute=function(Ze,U,he){ia||Ye({});const Ce=tn(Ze),Le=tn(U);return typeof he=="string"&&(fs(U,he)||!Oe&&Sr(uR,he))?!1:Na(Ce,Le,he)},t.addHook=function(Ze,U){typeof U=="function"&&pi(ae,Ze)&&su(ae[Ze],U)},t.removeHook=function(Ze,U){if(pi(ae,Ze)){if(U!==void 0){const he=IG(ae[Ze],U);return he===-1?void 0:MG(ae[Ze],he,1)[0]}return XT(ae[Ze])}},t.removeHooks=function(Ze){pi(ae,Ze)&&(ae[Ze]=[])},t.removeAllHooks=function(){ae=dR()},t}var pK=rM();let vv=null;function hK(){return vv||(vv=uA(()=>import("./mermaid.core-D71QvPWj.js").then(e=>e.bN),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),vv}function fR(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let pR=0;function gK(){return pR+=1,"pave-canvas-"+pR}function mK({source:e}){const t=y.useRef(null),n=y.useRef(gK()),[r,i]=y.useState(null),[o,l]=y.useState(fR());return y.useEffect(function(){if(typeof window>"u")return;const u=new MutationObserver(function(){const d=fR();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 i(null),hK().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||i(f&&f.message||String(f))}))}).catch(function(d){u||i("Failed to load mermaid: "+(d&&d.message||String(d)))}),function(){u=!0}},[e,o]),r?a.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[a.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),a.jsx("pre",{className:"whitespace-pre-wrap",children:r}),a.jsxs("details",{className:"mt-2",children:[a.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),a.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):a.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 xK({source:e}){const t=y.useMemo(function(){return pK.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return a.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function yK({source:e}){return a.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function bK({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=a.jsx(mK,{source:e.source}):e.type==="svg"?t=a.jsx(xK,{source:e.source}):e.type==="katex"?t=a.jsx(yK,{source:e.source}):t=a.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),a.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function vK({canvases:e,onClear:t}){const n=Array.isArray(e)?e:[],[r,i]=y.useState(Math.max(0,n.length-1)),[o,l]=y.useState(1),[u,d]=y.useState(!1);y.useEffect(function(){i(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 _=S=>{S.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))),[]),h=y.useCallback(()=>l(1),[]);if(n.length===0)return a.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[a.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:a.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"})}),a.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 ",a.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=a.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?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>i(Math.max(0,m-1)),disabled:m===0,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Previous canvas",children:"←"}),a.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[m+1,"/",n.length]}),a.jsx("button",{type:"button",onClick:()=>i(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:"→"})]}):a.jsx("div",{}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.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:"−"}),a.jsxs("button",{type:"button",onClick:h,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 tabular-nums min-w-[3rem]",title:"Reset zoom",children:[Math.round(o*100),"%"]}),a.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:"+"}),a.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?a.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=a.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[x.title?a.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:x.title}):null,a.jsx("div",{style:{transform:`scale(${o})`,transformOrigin:"top left",width:o===1?"100%":`${100/o}%`},children:a.jsx(bK,{canvas:x})}),x.caption?a.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:x.caption}):null]});return u?a.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[v,k]}):a.jsxs("div",{className:"h-full flex flex-col",children:[v,k]})}function kK(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function _K(e,t){const n=kK(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}function wK(e){const{serverContextLimit:t,registryLimitMap:n={},limitModelID:r,effectiveActiveModel:i,modelLimits:o={},defaultLimit:l}=e||{};return t||n[r]||n[i]||o[r]||l}function hR(e,t,n,r){if(typeof t!="string"||!t)return;const i=t.includes("/")?t.split("/").pop():t,o=i&&i!==t?[t,i]:[t];for(let l=0;l<o.length;l+=1)(r||!Object.prototype.hasOwnProperty.call(e,o[l]))&&(e[o[l]]=n)}function SK(e){const t={};if(!Array.isArray(e))return t;for(let n=0;n<e.length;n+=1){const r=e[n],i=r&&r.limit?r.limit.context:null;typeof i!="number"||i<=0||(hR(t,r.key,i,!0),hR(t,r.target,i,!1))}return t}const EK={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function NK(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function CK(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}function jK({isBusy:e,isCompacting:t}={}){return e?t?"compacting":"generating":"idle"}const TK=3,gR=4,RK=4,AK=1024;function IK(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 mR(e){if(typeof e=="string")return e;if(e==null)return"";try{return JSON.stringify(e)}catch{return""}}function uu(e){return Math.ceil(IK(e)/TK)}function MK(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 i=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&&(i+=uu(d),o=!0)}else if(u==="reasoning"){const d=typeof l.text=="string"?l.text:typeof l.content=="string"?l.content:"";d&&(i+=uu(d),o=!0)}else if(u==="image_url"||l.image_url)i+=AK,o=!0;else if(u==="tool"){const d=l.state||{},f=typeof l.tool=="string"?l.tool:"";i+=RK+gR,f&&(i+=uu(f)),d.input!=null&&(i+=uu(mR(d.input))),d.output!=null&&(i+=uu(mR(d.output))),o=!0}}o&&(t+=i+gR)}return t}const LK={"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},OK=128e3;function Nf(e){const[t,n]=y.useState(e),r=y.useRef(e),i=y.useRef(0),o=y.useRef(0);return y.useEffect(()=>{if(e===r.current)return;i.current=0,r.current=t;const l=400,u=t,d=e,f=p=>{i.current||(i.current=p);const h=p-i.current,m=Math.min(h/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 DK({messages:e,isBusy:t,isCompacting:n,activeModel:r,sessionModel:i,isPrivateMode:o,registryEntries:l}){var F,J;var{t:u}=Gt();const d=e.filter(q=>{var Y;return((Y=q.info)==null?void 0:Y.role)==="user"}).length,f=e.filter(q=>{var Y;return((Y=q.info)==null?void 0:Y.role)==="assistant"}).length,p=y.useMemo(()=>MK(e),[e]);let h=0,m=0,x=0,v=null,k=null;for(let q=e.length-1;q>=0;q--){const Y=e[q];if(((F=Y.info)==null?void 0:F.role)==="assistant"&&((J=Y.info)==null?void 0:J.mode)!=="compaction"){const oe=Y.info.tokens;if(oe&&(oe.input||oe.output)){!v&&Y.info.modelID&&(v=Y.info.modelID),h=oe.lastInput??oe.input??0,m=oe.lastOutput??oe.output??0,x=oe.lastReasoning??oe.reasoning??0,Y.info.contextLimit&&(k=Y.info.contextLimit);break}}}const _=Nf(p),S=Nf(h),w=Nf(m),N=Nf(x),R=S+w+N,T=p>0||h+m+x>0;let C=r;typeof i=="string"&&i?C=i:i&&i.providerID&&i.modelID&&(C=i.providerID+"/"+i.modelID);let{modelID:M,activeModelID:I}=_K(C,v),A=null;if(o){M="privacy",I="privacy";let q=null;typeof i=="string"&&i?q=i.includes("/")?i.split("/").pop():i:i&&i.modelID&&(q=i.modelID),A=q||(r?String(r).split("/").pop():null)}else v&&I&&v!==I&&(A=v);const L=y.useMemo(()=>SK(l),[l]),$=wK({serverContextLimit:k,registryLimitMap:L,limitModelID:v||M,effectiveActiveModel:C,modelLimits:LK,defaultLimit:OK}),te=Math.min(100,Math.round(_/$*100));let V="bg-green-500";te>=90?V="bg-red-500":te>=75?V="bg-orange-500":te>=50&&(V="bg-yellow-500");const z="border-gray-200 dark:border-gray-800",G="text-gray-500 dark:text-gray-400",K="text-gray-500 dark:text-gray-400",H="text-gray-700 dark:text-gray-300",se="border-gray-100 dark:border-gray-800";return a.jsxs("div",{className:`p-4 border-t ${z}`,children:[a.jsx("p",{className:`text-xs ${G} uppercase tracking-wide font-medium mb-3`,children:u("token_usage.session_info")}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${K}`,children:u("token_usage.messages")}),a.jsx("span",{className:`text-xs font-medium ${H}`,children:d+f})]}),M&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${K}`,children:u("token_usage.model")}),a.jsx("span",{className:`text-xs font-medium ${H} truncate ml-2 max-w-[140px]`,children:xR(M)})]}),A&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${K}`,children:u("token_usage.originally")}),a.jsx("span",{className:`text-xs ${K} truncate ml-2 max-w-[140px]`,children:xR(A)})]}),(()=>{const q=jK({isBusy:t,isCompacting:n}),Y=q==="compacting"?"bg-amber-400 animate-pulse":q==="generating"?"bg-accent-400 animate-pulse":"bg-green-500",oe=u(q==="compacting"?"token_usage.compacting":q==="generating"?"token_usage.generating":"token_usage.idle");return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${K}`,children:u("token_usage.status")}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${Y}`}),a.jsx("span",{className:`text-xs font-medium ${H}`,children:oe})]})]})})(),T?a.jsx(a.Fragment,{children:a.jsxs("div",{className:`border-t ${se} pt-2 mt-2`,children:[a.jsxs("div",{className:"mb-2",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:`text-xs ${K}`,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 ",a.jsx("span",{className:"opacity-70",children:"est"})]}),a.jsxs("span",{className:`text-xs ${K}`,children:[te,"% of ",($/1e3).toFixed(0),"k"]})]}),a.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full ${V} transition-all duration-300`,style:{width:`${te}%`}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${K}`,children:"Input"}),a.jsx("span",{className:`text-xs font-medium ${H} tabular-nums`,children:S.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center justify-between mt-1",children:[a.jsx("span",{className:`text-xs ${K}`,children:"Output"}),a.jsx("span",{className:`text-xs font-medium ${H} tabular-nums`,children:w.toLocaleString()})]}),x>0&&a.jsxs("div",{className:"flex items-center justify-between mt-1",children:[a.jsx("span",{className:`text-xs ${K}`,children:"Reasoning"}),a.jsx("span",{className:`text-xs font-medium ${H} tabular-nums`,children:N.toLocaleString()})]}),a.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${se}`,children:[a.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 ",a.jsx("span",{className:"opacity-70",children:"measured"})]}),a.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:R.toLocaleString()})]})]})}):a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:`text-xs ${K}`,children:"Tokens"}),a.jsx("span",{className:`text-xs ${K}`,children:"--"})]})]})]})}function xR(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 PK({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:i,lockedReason:o}){const{t:l}=Gt(),[u,d]=y.useState(!1),f=y.useRef(null),[p,h]=y.useState(-1),m=y.useRef([]);y.useEffect(()=>{if(!u)return;function w(N){f.current&&!f.current.contains(N.target)&&d(!1)}return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]),y.useEffect(()=>{if(!u)return;function w(N){if(N.key==="Escape"){d(!1);return}N.key!=="ArrowDown"&&N.key!=="ArrowUp"&&N.key!=="Home"&&N.key!=="End"||(N.preventDefault(),h(R=>{const T=m.current.length;if(!T)return R;const C=typeof R=="number"?R:-1;let M=C;return N.key==="ArrowDown"?M=C<T-1?C+1:0:N.key==="ArrowUp"?M=C>0?C-1:T-1:N.key==="Home"?M=0:N.key==="End"&&(M=T-1),m.current[M]&&m.current[M].focus(),M}))}return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[u]);const x=typeof e=="string"&&e.trim()?e.trim():null,v=x!=null,k=Array.isArray(n)?n:[],_=FK(x,t,k,l),S=y.useCallback(w=>{r(w===t||x&&x===w?null:w),d(!1)},[x,t,r]);return m.current.length=k.length,a.jsxs("div",{className:"relative",ref:f,children:[a.jsxs("button",{type:"button",onClick:()=>d(w=>!w),disabled:i,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-md transition-colors "+(v||_?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800")+(i?" opacity-50 cursor-not-allowed":" cursor-pointer"),title:o||l("model_selector.title"),"aria-label":o||l("model_selector.title"),"aria-haspopup":"menu","aria-expanded":u,children:[o?a.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:[a.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"}),a.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):a.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),a.jsx("span",{className:"max-w-[120px] truncate",children:_}),a.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),u&&a.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&&a.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:l("model_selector.no_models")}),k.map((w,N)=>{const R=x===w.key,T=!!t&&(w.key===t||w.target===t||w.url===t),C=w.builtin?w.key:w.displayName||w.key;return a.jsxs("button",{type:"button",ref:M=>{m.current[N]=M},tabIndex:p===N?0:-1,role:"menuitemradio","aria-checked":R||!v&&T,onClick:()=>S(w.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(R||!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:[a.jsx("span",{className:"font-medium",children:C}),T&&a.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",l("model_selector.default_label"),")"]})]},w.key)})]})]})}function FK(e,t,n,r){return e?yR(e,n):t?yR(t,n):r("model_selector.default_label")}function BK(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 yR(e,t){if(!e)return"";const n=BK(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function zK(e){e.sessionId;var t=e.disabledSkills,n=e.onToggle,r=e.onResetToDefaults,i=e.t,o=e.disabled,l=y.useState(!1),u=l[0],d=l[1],f=y.useState([]),p=f[0],h=f[1],m=y.useState(!1),x=m[0],v=m[1],k=y.useState([]),_=k[0],S=k[1],w=y.useRef(null),N=t instanceof Array?new Set(t):new Set,R=y.useCallback(async function(){v(!0);try{var A=await Rk();h(A||[])}catch{}finally{v(!1)}},[]),T=y.useCallback(async function(){try{var A=await AO();S(A||[])}catch{S([])}},[]);y.useEffect(function(){R(),T()},[R,T]),y.useEffect(function(){if(!u)return;function A(L){w.current&&!w.current.contains(L.target)&&d(!1)}return document.addEventListener("mousedown",A),function(){document.removeEventListener("mousedown",A)}},[u]);var C=p.filter(function(A){return N.has(A.name)}).length,M=Math.max(0,p.length-C),I=C;return a.jsxs("div",{className:"relative",ref:w,children:[a.jsxs("button",{onClick:function(){d(!u)},disabled:o,className:"p-1.5 rounded-lg transition-colors "+(I>0?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800")+(o?" opacity-50 cursor-not-allowed":""),title:i("skills.toggle_title"),"aria-label":i("skills.toggle_title"),children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),M>0&&a.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:M})]}),u&&a.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:[a.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[a.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:i("skills.toggle_header")}),a.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:i("skills.toggle_hint")})]}),x?a.jsx("div",{className:"flex items-center justify-center py-4",children:a.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):p.length===0?a.jsx("div",{className:"px-3 py-4 text-center",children:a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:i("skills.no_skills")})}):a.jsx("div",{className:"py-1",children:p.map(function(A){var L=N.has(A.name);return a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[a.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:A.name}),a.jsx("button",{onClick:function(){n(A.name,L)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 "+(L?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!L,children:a.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(L?"translate-x-1":"translate-x-5")})})]},A.name)})}),_.length>0&&a.jsxs("div",{className:"py-1 border-t border-gray-100 dark:border-gray-800",children:[a.jsx("p",{className:"px-3 pb-1 text-xs font-semibold text-gray-700 dark:text-gray-300",children:i("skills.mcp_toggle_header")}),_.map(function(A){var L="mcp:"+A.id,D=N.has(L);return a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[a.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:A.displayName||A.id}),a.jsx("button",{onClick:function(){n("mcp:"+A.id,D)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 "+(D?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!D,children:a.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(D?"translate-x-1":"translate-x-5")})})]},L)})]}),r&&a.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:a.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:i("skills.reset_to_defaults")})})]})]})}function UK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 qK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 HK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 $K({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 WK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 VK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 GK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 KK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function YK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 QK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 XK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:a.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 ZK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:a.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 JK({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:a.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 eY({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 tY({className:e,...t}){return a.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:a.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 bR={gmail:qK,gdrive:HK,discord:$K,whatsapp:WK,wrike:VK,gtasks:GK,mailchimp:KK,bamboohr:YK,pandadoc:QK,exa:XK,dropbox:ZK,freshbooks:JK,gcal:eY,docx2md:tY};function nY(e){return Object.prototype.hasOwnProperty.call(bR,e)?bR[e]:UK}const vR={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"},rY=new Set(["current","available","error","unsupported"]);function iY(e){const t=e||{},n=rY.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 aY(e){const t=Object.create(null);return(e||[]).forEach(n=>{!n||!n.name||(t[n.name]=iY(n))}),t}function sY(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 oY({installed:e,configured:t,t:n}){return e?t?a.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:[a.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:a.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")]}):a.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:[a.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:a.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")]}):a.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 lY({skill:e,onClose:t,onSaved:n}){var{t:r}=Gt(),i=nc(),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(null);y.useEffect(function(){var A=!1;async function L(){try{var D=await KO(e.name);if(A)return;_(D);for(var $=Object.create(null),te=Object.keys(D.tokens||{}),V=0;V<te.length;V++){var z=te[V],G=D.tokens[z]||{},K=G.env||z;$[K]=""}l($),d(!1)}catch(H){A||(m(H.message),d(!1))}}return L(),function(){A=!0}},[e.name]);var S=y.useMemo(function(){if(!k||!k.tokens)return null;if(k.oauth&&k.oauth.broker){var A=!!k.oauth.connected,L=k.oauth.provider||"";return{provider:L?L.charAt(0).toUpperCase()+L.slice(1):"OAuth",brokered:!0,canConnect:!A,refreshConfigured:A,clientIdConfigured:!0,clientSecretConfigured:!0}}for(var D=Object.keys(k.tokens),$=0;$<D.length;$++){var te=k.tokens[D[$]]||{};if(te.description&&te.description.includes("OAuth")){for(var V=null,z=null,G=null,K=Object.entries(k.tokens),H=0;H<K.length;H++){var se=K[H][0];se.includes("REFRESH_TOKEN")&&(V=se),(se.includes("CLIENT_ID")||se.includes("APP_KEY"))&&(z=se),(se.includes("CLIENT_SECRET")||se.includes("APP_SECRET"))&&(G=se)}if(V&&z){var P=k.tokens[V]&&k.tokens[V].configured,W=k.tokens[z]&&k.tokens[z].configured,ee=G&&k.tokens[G]&&k.tokens[G].configured,F="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?F="Google":e.name==="dropbox"?F="Dropbox":e.name==="freshbooks"&&(F="FreshBooks"),{provider:F,canConnect:W&&ee&&!P,refreshConfigured:P,clientIdConfigured:W,clientSecretConfigured:ee}}}}return null},[k,e.name]),w=y.useCallback(async function(){m(null),v(!0);try{if(S&&S.brokered){let q=function(){I.current&&(clearInterval(I.current),I.current=null)};var A=await r3(e.name),L=600,D=700,$=(window.screen.width-L)/2,te=(window.screen.height-D)/2,V=window.open(A.authorizeUrl,"oauth_popup","width="+L+",height="+D+",left="+$+",top="+te+",scrollbars=yes");if(!V){m("Popup blocked. Please allow popups or visit: "+A.authorizeUrl),v(!1);return}var z=A.flowId,G=0,K=0;I.current=setInterval(async function(){G+=1500;try{var Y=await i3(e.name,z);if(Y&&Y.connected){q();try{V.close()}catch{}v(!1),n();return}}catch(oe){q(),m(oe.message),v(!1);return}if(V.closed&&(K||(K=G),G-K>9e3)){q(),v(!1),n();return}G>3e5&&(q(),v(!1),m("Connection timed out. Please try again."))},1500);return}var H=await n3(e.name),se=600,P=700,W=(window.screen.width-se)/2,ee=(window.screen.height-P)/2,F=window.open(H.authorizeUrl,"oauth_popup","width="+se+",height="+P+",left="+W+",top="+ee+",scrollbars=yes");if(F)var J=setInterval(function(){F.closed&&(clearInterval(J),v(!1),n())},500);else m("Popup blocked. Please allow popups or visit: "+H.authorizeUrl),v(!1)}catch(q){m(q.message),v(!1)}},[e.name,n,S]),N=y.useCallback(async function(){m(null),p(!0);try{for(var A=Object.create(null),L=Object.keys(o),D=0;D<L.length;D++){var $=L[D];o[$]&&o[$].trim()&&(A[$]=o[$].trim())}if(Object.keys(A).length===0){m(r("skills.enter_token")),p(!1);return}await ZO(e.name,A),n()}catch(te){m(te.message)}finally{p(!1)}},[o,e.name,n,r]),R=y.useCallback(async function(){if(await i({title:r("skills.clear_title"),message:r("skills.clear_confirm",{skill:e.name}),destructive:!0})){m(null),p(!0);try{await JO(e.name),n()}catch(A){m(A.message)}finally{p(!1)}}},[e.name,n,i,r]),T=y.useCallback(function(A,L){l(function(D){var $=Object.assign(Object.create(null),D);return $[A]=L,$})},[]),C=k&&!(k.oauth&&k.oauth.broker)?Object.entries(k.tokens||{}).map(function(A){var L=A[0],D=A[1],$=D&&D.env||L;return{name:L,env:$,description:D.description,configured:D.configured,maskedValue:D.maskedValue}}):[],M=y.useRef(null);y.useEffect(function(){function A(L){L.key==="Escape"&&t()}return document.addEventListener("keydown",A),M.current&&M.current.focus(),function(){document.removeEventListener("keydown",A)}},[t]);var I=y.useRef(null);return y.useEffect(function(){return function(){I.current&&(clearInterval(I.current),I.current=null)}},[]),a.jsx("div",{ref:M,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:a.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(A){A.stopPropagation()},children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r("skills.configure_skill",{skill:e.name})}),a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),u&&a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!u&&C.length>0&&a.jsx("div",{className:"space-y-3 mb-4",children:C.map(function(A){return a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[A.env,A.configured&&a.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:A.maskedValue}),")"]})]}),A.description&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:A.description}),a.jsx("input",{type:"password",placeholder:A.configured?r("skills.leave_blank"):r("skills.enter_value"),value:o[A.env]||"",onChange:function(L){T(A.env,L.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"})]},A.env)})}),!u&&S&&a.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:S.canConnect?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:r("skills.oauth_connect_hint",{provider:S.provider})}),a.jsx("button",{onClick:w,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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r("skills.oauth_connecting")]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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:S.provider})]})})]}):S.refreshConfigured?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:a.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:S.provider})]}),a.jsx("button",{onClick:R,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:S.provider})})]}):a.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:r("skills.oauth_needs_credentials",{provider:S.provider})})}),!u&&!h&&C.length===0&&!S&&a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:r("skills.no_credentials_needed")}),h&&a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:h}),!u&&C.length>0&&a.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[a.jsx("button",{onClick:R,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")}),a.jsxs("div",{className:"flex gap-2",children:[a.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")}),a.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 cY({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:i,onInstall:o,onUpdate:l,onUninstall:u,skillDefaultEnabled:d,onToggleDefault:f,t:p}){var h=nY(e.name),m=Object.prototype.hasOwnProperty.call(vR,e.name)?vR[e.name]:"#6B7280",[x,v]=y.useState(!1),k=r===e.name,_=n&&n.status==="available",S=y.useCallback(async function(){v(!0);try{await o(e)}finally{v(!1)}},[e,o]),w=y.useCallback(function(){l&&l(e.name)},[e.name,l]);return a.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:[a.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:m}}),a.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:m+"15"},children:a.jsx(h,{className:"w-5 h-5",style:{color:m}})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),a.jsx(oY,{installed:t,configured:t&&e.allTokensConfigured,t:p}),t&&_&&a.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:[a.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"&&a.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"&&a.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"&&a.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")})]}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||p("skills.no_description")}),e.version&&a.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),a.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:function(){i(e)},className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:p("skills.configure")}),f&&a.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:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d?a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),p("skills.default")]}),_&&a.jsx("button",{onClick:w,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?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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&&a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]}):a.jsx("button",{onClick:S,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?a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 uY({onBack:e}){var{t}=Gt(),[n,r]=y.useState([]),[i,o]=y.useState([]),[l,u]=y.useState(!0),[d,f]=y.useState(null),[p,h]=y.useState(null),[m,x]=y.useState("all"),[v,k]=y.useState(""),[_,S]=y.useState(!1),[w,N]=y.useState(Object.create(null)),[R,T]=y.useState(null),[C,M]=y.useState(!1),[I,A]=y.useState(Object.create(null)),L=nc(),D=y.useCallback(async function(){u(!0),f(null),M(!1);try{var q=await Promise.allSettled([Rk(),GO(),CA()]),Y=q[0].status==="fulfilled"?q[0].value:[],oe=q[1].status==="fulfilled"?q[1].value:[],_e=q[2].status==="fulfilled"?q[2].value.skillDefaults||{}:{};r(Y),o(oe),A(_e);var ae=[];q[0].status==="rejected"&&ae.push(t("skills.load_installed_failed",{error:q[0].reason.message})),q[1].status==="rejected"&&ae.push(t("skills.load_marketplace_failed",{error:q[1].reason.message})),ae.length>0&&f(ae.join("; "))}catch(ye){f(ye.message)}finally{u(!1)}},[t]);y.useEffect(function(){D()},[D]);var $=[],te=new Set(n.map(function(q){return q.name}));n.forEach(function(q){$.push(Object.assign({},q,{_installed:!0}))}),i.forEach(function(q){te.has(q.name)||$.push(Object.assign({},q,{_installed:!1,allTokensConfigured:!1}))});var V=$;if(m==="installed"?V=$.filter(function(q){return q._installed}):m==="available"&&(V=$.filter(function(q){return!q._installed})),v){var z=v.toLowerCase();V=V.filter(function(q){return q.name&&q.name.toLowerCase().indexOf(z)!==-1||q.description&&q.description.toLowerCase().indexOf(z)!==-1||q.category&&q.category.toLowerCase().indexOf(z)!==-1})}var G=y.useCallback(async function(q){try{await YO(q.name),D()}catch(Y){f(t("skills.install_failed",{error:Y.message}))}},[D,t]),K=y.useCallback(function(q){h(q)},[]),H=y.useCallback(async function(q){if(await L({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:q.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await e3(q.name),D()}catch(Y){f(t("skills.uninstall_failed",{error:Y.message}))}},[D,L,t]),se=y.useCallback(function(){h(null),D()},[D]),P=y.useCallback(async function(q,Y){A(function(_e){var ae=Object.assign({},_e);return Y?ae[q]=!0:delete ae[q],ae});try{var oe={};oe[q]=Y,await t3(oe)}catch(_e){A(function(ae){var ye=Object.assign({},ae);return Y?delete ye[q]:ye[q]=!0,ye}),f(_e.message)}},[]),W=y.useCallback(async function(){S(!0),f(null);try{var q=await XO();N(aY(q.skills)),M(!0)}catch(Y){f(Y.message)}finally{S(!1)}},[]),ee=y.useCallback(async function(q){T(q),f(null);try{var Y=await QO(q);Y.updated&&(N(function(oe){var _e=Object.assign(Object.create(null),oe);return _e[q]={status:"current",hasUpdate:!1,latestVersion:oe[q]?oe[q].latestVersion:null,currentVersion:oe[q]?oe[q].latestVersion:null,error:null},_e}),D())}catch(oe){f(t("skills.update_failed")+": "+oe.message)}finally{T(null)}},[D,t]),F=sY(w),J=F.available;return a.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:n.length,available:i.filter(function(q){return!te.has(q.name)}).length})})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:W,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:_?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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")]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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")]})}),J>0&&a.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:J})}),C&&F.error>0&&!_&&a.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:F.error})}),C&&F.unsupported>0&&!_&&a.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:F.unsupported})}),C&&J===0&&F.error===0&&F.unsupported===0&&!_&&a.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")}),a.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(q){return a.jsx("button",{onClick:function(){x(q)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(m===q?"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_"+q)},q)})})]})]}),a.jsx("div",{className:"shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:a.jsxs("div",{className:"relative",children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:v,onChange:function(q){k(q.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"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[l&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),d&&a.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:a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:d})}),!l&&V.length===0&&a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(v?"skills.no_match":"skills.no_skills")})}),!l&&V.length>0&&a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:V.map(function(q){return a.jsx(cY,{skill:q,installed:q._installed,updateInfo:w[q.name],updatingSkill:R,onConfigure:K,onInstall:G,onUpdate:ee,onUninstall:q._installed?H:null,skillDefaultEnabled:!!I[q.name],onToggleDefault:q._installed?P:null,t},q.name)})})]}),p&&a.jsx(lY,{skill:p,onClose:function(){h(null)},onSaved:se})]})}var wk=20;function L1(e){if(!e)return"";try{var t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()}catch{return String(e)}}function dY(e){var t={},n=[],r={};return(e||[]).forEach(function(i){i.parentId&&!r[i.parentId]?n.push(i):i.parentId?(t[i.parentId]=t[i.parentId]||[]).push(i):n.push(i),r[i.id]=!0}),{topLevel:n,childrenByParent:t}}function iM({post:e,childrenByParent:t,depth:n,onDelete:r,t:i}){var o=t[e.id]||[];return a.jsxs("div",{className:n>0?"ml-4 pl-3 border-l border-gray-200 dark:border-gray-700":"",children:[a.jsxs("div",{className:"py-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.author}),a.jsx("span",{children:L1(e.createdAt)}),!e.deleted&&r&&a.jsx("button",{type:"button",onClick:function(){r(e.id)},className:"ml-auto text-gray-400 hover:text-red-500 transition-colors",title:i("board.delete_post"),"aria-label":i("board.delete_post"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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?a.jsx("p",{className:"mt-1 text-sm text-gray-400 dark:text-gray-500 italic",children:i("board.post_deleted")}):a.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 a.jsx(iM,{post:l,childrenByParent:t,depth:n+1,onDelete:r,t:i},l.id)})]})}function fY({detail:e,searchQuery:t,onSearchQueryChange:n,onSearch:r,onClearSearch:i,hasSearchResults:o,onDeleteTopic:l,onBack:u,onCloseTopic:d,t:f}){return a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e?e.topic.title:f("board.title")}),a.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&&a.jsxs("form",{onSubmit:r,className:"flex items-center gap-2",children:[a.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"}),a.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&&a.jsx("button",{type:"button",onClick:i,className:"px-3 py-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors",children:f("board.clear_search")})]}),e&&a.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:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 pY({detail:e,onDeletePost:t,t:n}){var r=dY(e.posts);return a.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[a.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:[a.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:e.topic.author}),a.jsx("span",{children:L1(e.topic.createdAt)}),e.topic.category&&a.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?a.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(i){return a.jsx(iM,{post:i,childrenByParent:r.childrenByParent,depth:0,onDelete:t,t:n},i.id)})]})}function hY({searchResults:e,onOpenTopic:t,t:n}){return a.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[a.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?a.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,i){return a.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:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:r.topicTitle}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:r.snippet})]},(r.postId||r.topicId)+":"+i)})]})}function gY({topics:e,offset:t,total:n,onOpenTopic:r,onPage:i,t:o}){var l=t-wk,u=t+wk,d=t>0,f=u<n;return a.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-4",children:[e.length===0?a.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 a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:p.title}),p.category&&a.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})]}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:[p.author," · ",L1(p.createdAt)," ·"," ",o("board.post_count",{count:p.postCount})]})]},p.id)}),(d||f)&&a.jsxs("div",{className:"flex items-center justify-between mt-4",children:[a.jsx("button",{type:"button",disabled:!d,onClick:function(){i(l)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.prev_page")}),a.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})}),a.jsx("button",{type:"button",disabled:!f,onClick:function(){i(u)},className:"px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:o("board.next_page")})]})]})}function mY({onBack:e}){var{t}=Gt(),[n,r]=y.useState([]),[i,o]=y.useState(0),[l,u]=y.useState(0),[d,f]=y.useState(!0),[p,h]=y.useState(null),[m,x]=y.useState(null),[v,k]=y.useState(""),[_,S]=y.useState(null),w=y.useCallback(async function(L){f(!0),h(null);try{var D=await _3({limit:wk,offset:L});r(D.topics||[]),o(D.total||0)}catch($){h($.message)}finally{f(!1)}},[]);y.useEffect(function(){w(0)},[w]);var N=y.useCallback(async function(L){f(!0),h(null),S(null);try{var D=await Fw(L);x(D)}catch($){h($.message)}finally{f(!1)}},[]),R=y.useCallback(function(){x(null),w(l)},[w,l]),T=y.useCallback(async function(L){h(null);try{await S3(L),x(null),w(l)}catch(D){h(D.message)}},[w,l]),C=y.useCallback(async function(L){if(m){h(null);try{await E3(m.topic.id,L);var D=await Fw(m.topic.id);x(D)}catch($){h($.message)}}},[m]),M=y.useCallback(async function(L){L.preventDefault();var D=v.trim();if(!D){S(null);return}f(!0),h(null);try{var $=await w3(D);S($)}catch(te){h(te.message)}finally{f(!1)}},[v]),I=y.useCallback(function(){k(""),S(null)},[]),A=y.useCallback(function(L){u(L),w(L)},[w]);return a.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[a.jsx(fY,{detail:m,searchQuery:v,onSearchQueryChange:k,onSearch:M,onClearSearch:I,hasSearchResults:!!_,onDeleteTopic:T,onBack:e,onCloseTopic:R,t}),a.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[p&&a.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?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("svg",{className:"w-6 h-6 animate-spin text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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?a.jsx(pY,{detail:m,onDeletePost:C,t}):_?a.jsx(hY,{searchResults:_,onOpenTopic:N,t}):a.jsx(gY,{topics:n,offset:l,total:i,onOpenTopic:N,onPage:A,t})]})]})}var kR={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 aM({status:e}){var t=kR[e]||kR.available;return a.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium "+t,children:e})}function sM({kind:e}){var t=e==="skill";return a.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 xY({capability:e,onOpen:t}){return a.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:[a.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(sM,{kind:e.kind}),a.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name})]}),a.jsx(aM,{status:e.status})]}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||""}),a.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.version&&a.jsxs("span",{children:["v",e.version]}),e.installedVersion&&e.installedVersion!==e.version&&a.jsxs("span",{children:["(installed v",e.installedVersion,")"]}),e.author&&a.jsx("span",{className:"truncate",children:e.author})]})]})}var el={LOADING:"loading",READY:"ready",MISSING:"missing"};function yY({capability:e,docs:t,docsState:n}){var{t:r}=Gt();return e.kind!=="skill"?null:a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:r("capabilities.docs")}),n===el.MISSING&&a.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:r("capabilities.docs_missing")}),n===el.READY&&a.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===el.LOADING&&a.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:"…"})]})}function du({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("dt",{className:"text-gray-500 dark:text-gray-400",children:e}),a.jsx("dd",{className:"text-gray-900 dark:text-gray-100 break-all",children:t})]}):null}function bY({capability:e}){return a.jsxs("dl",{className:"grid grid-cols-2 gap-2 text-sm mb-4",children:[a.jsx(du,{label:"Version",value:e.version}),a.jsx(du,{label:"Author",value:e.author}),e.kind==="mcp"&&a.jsxs(a.Fragment,{children:[a.jsx(du,{label:"URL",value:e.url}),a.jsx(du,{label:"Auth",value:e.auth&&e.auth.type||"none"})]}),e.requiresMcps&&e.requiresMcps.length>0&&a.jsx(a.Fragment,{children:a.jsx(du,{label:"Requires MCPs",value:e.requiresMcps.join(", ")})})]})}var Xn={IDLE:"idle",BUSY:"busy",ERROR:"error",DONE:"done"};function vY({capability:e,onInstalled:t}){var{t:n}=Gt(),r=String(e.id||"").replace(/^mcp:/,""),[i,o]=y.useState(null),[l,u]=y.useState(Xn.IDLE),[d,f]=y.useState(null),[p,h]=y.useState(""),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=e.auth&&e.auth.type||"none",S=y.useCallback(function(){LO(r).then(function(z){o(z)}).catch(function(){o(null)})},[r]);y.useEffect(function(){S()},[S]);function w(z){u(Xn.BUSY),f(null),z().then(function(G){f(G&&G.message?G.message:n("capabilities.done")),u(Xn.DONE),S(),t&&t()}).catch(function(G){f(G&&G.message||"request failed"),u(Xn.ERROR)})}var N=i&&i.needsReview,R=N&&N.changedTools||[],T=i||e.status==="installed",C=_==="bearer",M=_==="oauth2",I=!!(i&&i.hasToken),A=y.useRef(null),[L,D]=y.useState(!1),$=!!(i&&(i.needsReconsent||i.refreshRejected||i.reconsentRequired));y.useEffect(function(){return function(){A.current&&(clearTimeout(A.current),A.current=null)}},[]);function te(){u(Xn.BUSY),f(null),$O(r).then(function(z){u(Xn.IDLE),D(!0),f(n("capabilities.oauth_pending")),S(),typeof window<"u"&&window.open&&window.open(z.authorizeUrl,"_blank","noopener");var G=0,K=function(){G+=1,WO(r,z.state).then(function(H){if(H&&H.pending){if(G>150){D(!1),u(Xn.ERROR),f(n("capabilities.oauth_pending"));return}A.current=setTimeout(K,2e3);return}D(!1),H&&H.connected?(u(Xn.DONE),f(n("capabilities.oauth_connected"))):H&&H.needsReconsent?(u(Xn.ERROR),f(n("capabilities.oauth_reconsent"))):(u(Xn.ERROR),f(H&&H.lastError||n("capabilities.oauth_reconsent"))),S(),t&&t()}).catch(function(){D(!1),u(Xn.ERROR),f(n("capabilities.oauth_reconsent"))})};A.current=setTimeout(K,2e3)}).catch(function(z){u(Xn.ERROR),f(z&&z.message||"request failed")})}var V="px-3 py-1.5 rounded text-sm font-medium transition-colors ";return a.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"mcp-runtime",children:[N&&a.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:[a.jsx("p",{className:"text-sm font-medium text-orange-800 dark:text-orange-300 mb-1",children:n("capabilities.needs_review")}),N.reason&&a.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-2",children:N.reason}),R.length>0&&a.jsxs("div",{className:"mb-2",children:[a.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-400 mb-1",children:n("capabilities.changed_tools")}),a.jsx("ul",{className:"text-xs font-mono text-orange-800 dark:text-orange-300 list-disc list-inside",children:R.map(function(z){return a.jsxs("li",{children:[z.name," (",z.change,")"]},z.name)})})]}),a.jsx("button",{type:"button",disabled:l===Xn.BUSY,onClick:function(){w(function(){return BO(r)})},className:V+"bg-orange-600 hover:bg-orange-700 text-white disabled:opacity-50",children:n("capabilities.reapprove")})]}),M&&i&&(i.status==="pending_oauth"||$)&&a.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:[a.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1",children:n($?"capabilities.oauth_reconsent":"capabilities.oauth_connect")}),(i.refreshRejected||i.reconsentRequired)&&a.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 mb-2",children:i.refreshRejected?i.refreshRejected.error:i.reconsentRequired.reason}),a.jsx("button",{type:"button",disabled:l===Xn.BUSY||L,onClick:te,className:V+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-oauth-connect",children:n("capabilities.oauth_connect")}),L&&a.jsx("span",{className:"ml-2 text-xs text-gray-500 dark:text-gray-400",children:n("capabilities.oauth_pending")})]}),i&&i.status==="error"&&i.lastError&&a.jsxs("div",{className:"mb-3 p-3 rounded-lg bg-red-50 dark:bg-red-950 border border-red-200 dark:border-red-900","data-testid":"mcp-error",children:[a.jsxs("p",{className:"text-sm text-red-700 dark:text-red-300",children:[n("capabilities.mcp_error"),": ",i.lastError]}),a.jsx("button",{type:"button",disabled:l===Xn.BUSY,onClick:function(){w(function(){return zO(r)})},className:V+"bg-red-600 hover:bg-red-700 text-white disabled:opacity-50","data-testid":"mcp-refresh",children:n("capabilities.retry")})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[!T&&a.jsx("button",{type:"button",disabled:l===Xn.BUSY,onClick:function(){w(function(){return MO(r)})},className:V+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"mcp-install",children:n("capabilities.install")}),T&&a.jsx("button",{type:"button",disabled:l===Xn.BUSY,onClick:function(){w(function(){return OO(r)})},className:V+"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&&a.jsx("button",{type:"button",disabled:l===Xn.BUSY,onClick:function(){k(!0)},className:V+"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&&a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",disabled:l===Xn.BUSY,onClick:function(){w(function(){return DO(r)}),k(!1)},className:V+"bg-red-600 hover:bg-red-700 text-white disabled:opacity-50",children:n("capabilities.uninstall_confirm")}),a.jsx("button",{type:"button",onClick:function(){k(!1)},className:V+"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",children:n("capabilities.cancel")})]})]}),C&&a.jsxs("div",{className:"mt-3","data-testid":"mcp-token",children:[a.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"),I?" — "+n("capabilities.token_stored"):""]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"password",value:p,onChange:function(z){h(z.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"}),a.jsx("button",{type:"button",disabled:l===Xn.BUSY||!p.trim(),onClick:function(){w(function(){return PO(r,p.trim()).then(function(){h("")})})},className:V+"bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50",children:n("capabilities.token_save")}),I&&a.jsx("button",{type:"button",disabled:l===Xn.BUSY,onClick:function(){w(function(){return FO(r)})},className:V+"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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:m}),a.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:n("capabilities.token_note")})]}),i&&i.bridgedTools&&i.bridgedTools.length>0&&a.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:[n("capabilities.bridged"),": ",i.bridgedTools.length,i.deferredTools&&i.deferredTools.length>0?" · "+n("capabilities.deferred")+": "+i.deferredTools.length:""]}),d&&a.jsx("p",{className:"mt-2 text-xs "+(l===Xn.ERROR?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400"),children:d})]})}var kY={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 _Y({capability:e,onInstalled:t}){var{t:n}=Gt(),r=String(e.id||"").replace(/^skill:/,""),[i,o]=y.useState(Xn.IDLE),[l,u]=y.useState(null),d=e.deps||[],f=e.requiresMcps||[],p=e.status==="installed"||e.status==="degraded"||e.status==="update-available",h=i===Xn.BUSY;function m(x){o(Xn.BUSY),u(null),x().then(function(v){u(v),o(Xn.DONE),t&&t()}).catch(function(v){u({error:v&&v.message||"request failed"}),o(Xn.ERROR)})}return!f.length&&!p?null:a.jsxs("div",{className:"mt-4 border-t border-gray-200 dark:border-gray-700 pt-4","data-testid":"skill-composite",children:[f.length>0&&a.jsxs("div",{className:"mb-2",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:n("capabilities.requires_mcps")}),a.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 a.jsxs("li",{className:x.status?kY[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&&a.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:[a.jsx("p",{className:"text-xs font-medium text-green-800 dark:text-green-300",children:n("capabilities.composite_installed",{name:l.name})}),a.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 a.jsxs("li",{children:[x.id," [",x.status,"]"]},x.id)})})]}),l&&l.error&&a.jsx("p",{className:"mb-2 text-xs text-red-600 dark:text-red-400","data-testid":"skill-composite-error",children:l.error}),a.jsxs("div",{className:"flex items-center gap-2",children:[!p&&a.jsx("button",{type:"button",disabled:h,onClick:function(){m(function(){return qO(r)})},className:_R(),"data-testid":"skill-install",children:n("capabilities.install")}),p&&a.jsx("button",{type:"button",disabled:h,onClick:function(){m(function(){return HO(r)})},className:_R(),"data-testid":"skill-uninstall",children:n("capabilities.uninstall")})]})]})}function _R(){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 wY({capability:e,onClose:t,onInstalled:n}){var{t:r}=Gt(),[i,o]=y.useState(null),[l,u]=y.useState(el.LOADING);if(y.useEffect(function(){if(o(null),u(el.LOADING),!(!e||e.kind!=="skill")){var f=!1;return IO(e.id).then(function(p){f||(o(p),u(el.READY))}).catch(function(){f||u(el.MISSING)}),function(){f=!0}}},[e]),!e)return null;var d=e.kind==="collision";return a.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/30",onClick:t,children:a.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:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[!d&&a.jsx(sM,{kind:e.kind}),a.jsx(aM,{status:e.status})]}),a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.displayName||e.name}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 font-mono",children:e.id})]}),a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),d&&a.jsx("p",{className:"mb-4 text-sm text-red-700 dark:text-red-300",children:e.error}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-4",children:e.description||r("capabilities.no_description")}),a.jsx(bY,{capability:e}),!d&&e.kind==="mcp"&&a.jsx(vY,{capability:e,onInstalled:n}),!d&&e.kind==="skill"&&a.jsx(_Y,{capability:e,onInstalled:n}),a.jsx(yY,{capability:e,docs:i,docsState:l})]})})}function SY(e,t,n){return e.filter(function(r){if(n!=="all"&&r.kind!==n)return!1;if(!t)return!0;var i=t.toLowerCase();return(r.name||"").toLowerCase().indexOf(i)!==-1||(r.displayName||"").toLowerCase().indexOf(i)!==-1||(r.description||"").toLowerCase().indexOf(i)!==-1})}function EY({onAdded:e}){var{t}=Gt(),[n,r]=y.useState(""),[i,o]=y.useState(!1),[l,u]=y.useState(null);function d(){var f=n.trim();!f||i||(o(!0),u(null),UO(f).then(function(p){o(!1),r("");var h="added "+(p&&p.id||"")+" — status "+(p&&p.status||"installed");p&&p.status==="pending_oauth"&&(h+=" — OAuth required: open the Capabilities page and press Connect to authorize"),u({ok:!0,text:h}),e()}).catch(function(p){o(!1),u({ok:!1,text:p&&p.message||"request failed"})}))}return a.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","data-testid":"custom-mcp-add",children:[a.jsx("input",{type:"url",value:n,onChange:function(f){r(f.target.value),u(null)},onKeyDown:function(f){f.key==="Enter"&&d()},placeholder:"https://mcp.example.com/mcp",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","data-testid":"custom-mcp-url"}),a.jsx("button",{type:"button",disabled:i||n.trim()==="",onClick:d,className:"px-3 py-1.5 rounded text-sm font-medium bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50","data-testid":"custom-mcp-add-submit",children:t("capabilities.install")}),l&&a.jsx("span",{className:(l.ok?"text-green-700 dark:text-green-300 ":"text-red-700 dark:text-red-300 ")+"text-xs","data-testid":"custom-mcp-add-result",children:l.text})]})}function NY({warnings:e}){return e.length===0?null:a.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 a.jsx("p",{className:"text-xs text-yellow-800 dark:text-yellow-300",children:t},n)})})}function CY({loading:e,error:t,filtered:n,onRetry:r,onOpen:i,t:o}){return e?a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"…"}):t?a.jsxs("div",{className:"text-sm text-red-600 dark:text-red-400",children:[a.jsx("p",{children:t}),a.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?a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:o("capabilities.no_capabilities")}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:n.map(function(l){return a.jsx(xY,{capability:l,onOpen:i},l.id)})})}function jY({onBack:e}){var{t}=Gt(),[n,r]=y.useState(null),[i,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState(""),[p,h]=y.useState("all"),[m,x]=y.useState(null),v=y.useCallback(function(){u(!0),NA().then(function(w){r(w),o(null),u(!1)}).catch(function(w){o(w&&w.message||"failed to load"),u(!1)})},[]);y.useEffect(function(){v()},[v]);var k=n&&n.capabilities||[],_=n&&n.warnings||[],S=SY(k,d,p);return a.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-950",children:[a.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:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),a.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("capabilities.title")}),a.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"})]}),a.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:[a.jsx("input",{type:"text",value:d,onChange:function(w){f(w.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"}),a.jsx("div",{className:"flex rounded-lg border border-gray-300 dark:border-gray-700 overflow-hidden",children:["all","skill","mcp"].map(function(w){return a.jsx("button",{type:"button",onClick:function(){h(w)},className:"px-3 py-1.5 text-sm "+(p===w?"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_"+w)},w)})})]}),a.jsx(NY,{warnings:_}),a.jsx(EY,{onAdded:v}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a.jsx(CY,{loading:l,error:i,filtered:S,onRetry:v,onOpen:x,t})}),a.jsx(wY,{capability:m,onClose:function(){x(null)},onInstalled:v})]})}const oM=["webhook"],lM=["existing","spawn"],cM=["json","yaml"],Iu="••••••••";function uM(e){if(!e||typeof e!="object")return"trigger form is missing";if(oM.indexOf(e.type)===-1)return'type must be "webhook" in Phase 1';if(lM.indexOf(e.targetMode)===-1)return'targetMode must be "existing" or "spawn"';const t=e.payloadFormat===void 0?"json":e.payloadFormat;return cM.indexOf(t)===-1?'payloadFormat must be "json" or "yaml"':e.targetMode==="existing"?TY(e):RY(e)}function TY(e){return e.sessionId?null:'targetMode "existing" needs a sessionId to deliver into'}function RY(e){return e.soul?e.model?null:'targetMode "spawn" needs a model to spawn with':'targetMode "spawn" needs a soul to spawn with'}function wR(e){return typeof e!="string"||e.length<=4?Iu:e.slice(0,4)+Iu}function AY(e){var t=String(e||"");if(!t)return"";var n=t.lastIndexOf("/");return n===-1?Iu:t.slice(0,n+1)+Iu}function SR(e){return Sp(e)}function IY(){return{name:"",type:"webhook",targetMode:"existing",sessionId:"",soul:"",model:"",template:"",payloadFormat:"json"}}function MY({message:e,onDismiss:t,t:n}){return e?a.jsxs("div",{"data-testid":"trigger-error",className:"px-4 py-2 bg-red-50 dark:bg-red-950 border-b border-red-200 dark:border-red-900 flex items-start justify-between gap-3",children:[a.jsx("p",{className:"text-xs text-red-700 dark:text-red-300 break-all",children:e}),a.jsx("button",{type:"button",onClick:t,className:"text-xs text-red-600 dark:text-red-400 underline shrink-0",children:n("triggers.dismiss")})]}):null}function LY({trigger:e,revealed:t,onCopy:n,onReveal:r,t:i}){var o=t?e.webhookPath:AY(e.webhookPath);return a.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[a.jsx("code",{"data-testid":"trigger-webhook-url",className:"text-xs font-mono truncate text-gray-600 dark:text-gray-400",children:o}),a.jsx("button",{type:"button","data-testid":"trigger-copy",onClick:function(){n(e)},className:"px-2 py-0.5 rounded text-xs border border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400",children:i("triggers.copy")}),a.jsx("button",{type:"button","data-testid":"trigger-reveal",onClick:function(){r(e.id)},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400",children:i(t?"triggers.hide":"triggers.reveal")})]})}function OY({trigger:e,revealedPath:t,revealedApp:n,revealedVt:r,onCopy:i,onReveal:o,onEdit:l,onDelete:u,t:d}){return a.jsxs("div",{"data-testid":"trigger-row",className:"p-3 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name||e.id}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("button",{type:"button","data-testid":"trigger-edit",onClick:function(){l(e)},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400",children:d("triggers.edit")}),a.jsx("button",{type:"button","data-testid":"trigger-delete",onClick:function(){u(e)},className:"px-2 py-0.5 rounded text-xs text-red-600 dark:text-red-400",children:d("triggers.delete")})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[a.jsx("span",{"data-testid":"trigger-type",children:e.type}),a.jsx("span",{"data-testid":"trigger-target-mode",children:e.targetMode}),a.jsx("span",{className:"truncate",children:e.targetMode==="spawn"?e.soul:e.sessionId})]}),a.jsx(LY,{trigger:e,revealed:t,onCopy:i,onReveal:o,t:d}),a.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[a.jsx("code",{className:"text-xs font-mono shrink-0 text-gray-500 dark:text-gray-400",children:"appSecret"}),a.jsx("code",{"data-testid":"trigger-appsecret",className:"text-xs font-mono truncate text-gray-600 dark:text-gray-400",children:e.appSecret?n?e.appSecret:wR(e.appSecret):"—"}),a.jsx("button",{type:"button","data-testid":"trigger-appsecret-copy",disabled:!e.appSecret,onClick:function(){SR(e.appSecret)},className:"px-2 py-0.5 rounded text-xs border border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d("triggers.copy")}),a.jsx("button",{type:"button","data-testid":"trigger-appsecret-reveal",disabled:!e.appSecret,onClick:function(){o(e.id+":app")},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d(n?"triggers.hide":"triggers.reveal")})]}),a.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[a.jsx("code",{className:"text-xs font-mono shrink-0 text-gray-500 dark:text-gray-400",children:"verifyToken"}),a.jsx("code",{"data-testid":"trigger-verifytoken",className:"text-xs font-mono truncate text-gray-600 dark:text-gray-400",children:e.verifyToken?r?e.verifyToken:wR(e.verifyToken):"—"}),a.jsx("button",{type:"button","data-testid":"trigger-verifytoken-copy",disabled:!e.verifyToken,onClick:function(){SR(e.verifyToken)},className:"px-2 py-0.5 rounded text-xs border border-gray-300 dark:border-gray-700 text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d("triggers.copy")}),a.jsx("button",{type:"button","data-testid":"trigger-verifytoken-reveal",disabled:!e.verifyToken,onClick:function(){o(e.id+":vt")},className:"px-2 py-0.5 rounded text-xs text-gray-600 dark:text-gray-400 disabled:opacity-50",children:d(r?"triggers.hide":"triggers.reveal")})]})]})}function Cf({label:e,value:t,onChange:n,placeholder:r}){return a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:e}),a.jsx("input",{type:"text",value:t,onChange:function(i){n(i.target.value)},placeholder:r||"",className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100"})]})}function DY({draft:e,error:t,onChange:n,onCancel:r,onSave:i,onDelete:o,t:l}){var u=uM(e),d=e.targetMode==="spawn";return a.jsxs("div",{"data-testid":"trigger-form",className:"w-full sm:w-80 shrink-0 p-3 border-l border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 overflow-y-auto space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:e.id?l("triggers.edit"):l("triggers.create")}),a.jsx("button",{type:"button",onClick:r,className:"text-xs text-gray-500 dark:text-gray-400 underline",children:l("triggers.cancel")})]}),t&&a.jsx("p",{"data-testid":"trigger-form-error",className:"text-xs text-red-600 dark:text-red-400 break-all",children:t}),a.jsx(Cf,{label:l("triggers.name"),value:e.name,onChange:function(f){n({...e,name:f})}}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.type")}),a.jsx("select",{"data-testid":"trigger-type-select",value:e.type,onChange:function(f){n({...e,type:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100",children:oM.map(function(f){return a.jsx("option",{value:f,children:f},f)})})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.target_mode")}),a.jsx("select",{"data-testid":"trigger-mode-select",value:e.targetMode,onChange:function(f){n({...e,targetMode:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100",children:lM.map(function(f){return a.jsx("option",{value:f,children:l("triggers.target_"+f)},f)})})]}),d?a.jsxs("div",{className:"space-y-2",children:[a.jsx(Cf,{label:l("triggers.soul"),value:e.soul,onChange:function(f){n({...e,soul:f})}}),a.jsx(Cf,{label:l("triggers.model"),value:e.model,onChange:function(f){n({...e,model:f})}})]}):a.jsx(Cf,{label:l("triggers.session_id"),value:e.sessionId,onChange:function(f){n({...e,sessionId:f})}}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.template")}),a.jsx("textarea",{"data-testid":"trigger-template",rows:4,placeholder:"{{from}} says {{text}}",value:e.template,onChange:function(f){n({...e,template:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 resize-y font-mono"})]}),e.template?null:a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.payload_format")}),a.jsx("select",{"data-testid":"trigger-format-select",value:e.payloadFormat,onChange:function(f){n({...e,payloadFormat:f.target.value})},className:"w-full px-2 py-1.5 text-sm rounded border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100",children:cM.map(function(f){return a.jsx("option",{value:f,children:f},f)})}),a.jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:l("triggers.payload_format_help")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button","data-testid":"trigger-save",disabled:!!u,onClick:i,className:"px-3 py-1.5 text-sm rounded bg-primary-600 text-white disabled:opacity-50",children:l("triggers.save")}),e.id&&a.jsx("button",{type:"button","data-testid":"trigger-form-delete",onClick:function(){o(e)},className:"px-3 py-1.5 text-sm rounded text-red-600 dark:text-red-400",children:l("triggers.delete")})]})]})}function PY({onBack:e}){var{t}=Gt(),[n,r]=y.useState([]),[i,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState({}),[p,h]=y.useState(null),m=y.useCallback(function(){u(!0),L3().then(function(w){r(w&&w.triggers||[]),o(null),u(!1)}).catch(function(w){r([]),o(w&&w.message||t("triggers.request_failed")),u(!1)})},[t]);y.useEffect(function(){m()},[m]);function x(w){Sp(w.webhookPath).then(function(N){N||o(t("triggers.copy_failed"))})}function v(w){f(function(N){var R={...N};return R[w]=!N[w],R})}function k(w){o(null),h(w)}function _(){var w=uM(p);if(w){o(w);return}var N={name:p.name,type:p.type,targetMode:p.targetMode,template:p.template||""};N.payloadFormat=p.payloadFormat||"json",p.targetMode==="existing"&&(N.sessionId=p.sessionId),p.targetMode==="spawn"&&(N.soul=p.soul,N.model=p.model);var R=p.id?D3(p.id,N):O3(N);R.then(function(){o(null),h(null),m()}).catch(function(T){o(T&&T.message||t("triggers.request_failed"))})}function S(w){P3(w.id).then(function(){o(null),p&&p.id===w.id&&h(null),m()}).catch(function(N){o(N&&N.message||t("triggers.request_failed"))})}return a.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-950",children:[a.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:[a.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("triggers.back_to_chat"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),a.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("triggers.title")}),a.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:t("triggers.experimental_tag")})]}),a.jsx(MY,{message:i,onDismiss:function(){o(null)},t}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-w-0",children:[l&&a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("triggers.loading")}),!l&&n.length===0&&a.jsx("p",{"data-testid":"trigger-empty",className:"text-sm text-gray-500 dark:text-gray-400",children:t("triggers.empty")}),!l&&n.map(function(w){return a.jsx(OY,{trigger:w,revealedPath:!!d[w.id],revealedApp:!!d[w.id+":app"],revealedVt:!!d[w.id+":vt"],onCopy:x,onReveal:v,onEdit:k,onDelete:S,t},w.id)})]}),p&&a.jsx(DY,{draft:p,error:i,onChange:function(w){h(w),o(null)},onCancel:function(){h(null)},onSave:_,onDelete:S,t})]}),a.jsx("div",{className:"px-4 py-2 border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 flex items-center justify-between",children:a.jsx("button",{type:"button","data-testid":"trigger-create",onClick:function(){k(IY())},className:"px-3 py-1.5 text-sm rounded bg-primary-600 text-white",children:t("triggers.create")})})]})}var FY=["__proto__","constructor","prototype"],BY="Session expired. Please log in again.";function fu(e){return e&&e.status===401?BY:e.message}function kv(){return{displayName:"",spec:"",limit:{context:128e3,output:8192},apiKey:"",keyCleared:!1,hasApiKey:!1}}function zY(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},apiKey:"",keyCleared:!1,hasApiKey:!!e.hasApiKey}}function dM(e){if(!e)return null;var t=String(e).trim();return/^paves?:\/\//i.test(t)||/^https?:\/\//i.test(t)?"url":"target"}function ER(e){var t={limit:e.limit};e.displayName&&String(e.displayName).trim()!==""&&(t.displayName=String(e.displayName).trim());var n=e.spec?String(e.spec).trim():"";if(n){var r=dM(n);t[r]=n}return e.keyCleared?t.apiKey="":e.apiKey&&String(e.apiKey).trim()!==""&&(t.apiKey=String(e.apiKey).trim()),t}function NR(e){var t=e.name,n=e.config,r=e.setName,i=e.setConfig,o=e.onSave,l=e.onCancel,u=e.saving,d=e.isNew,f=e.t;function p(C){i(function(M){return Object.assign({},M,C)})}function h(C){i(function(M){return Object.assign({},M,{limit:Object.assign({},M.limit||{},C)})})}var m=y.useState(!1),x=m[0],v=m[1],k=y.useState(!1),_=k[0],S=k[1],w="registry-"+String(t||"").trim(),N="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",R="text-xs text-gray-500 dark:text-gray-400 block mb-0.5",T=dM(n.spec);return a.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:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:R,children:f("settings.model_registry.name")}),a.jsx("input",{type:"text",value:t,onChange:function(C){r(C.target.value)},className:N+" font-mono",placeholder:f("settings.model_registry.name_placeholder"),autoFocus:d})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsxs("label",{className:R,children:[f("settings.model_registry.spec"),T&&a.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:T==="url"?"URL":f("settings.model_registry.kind_alias")}),a.jsx("button",{type:"button",onClick:function(){S(function(C){return!C})},className:"ml-2 w-4 h-4 inline-flex items-center justify-center rounded-full border border-gray-400 dark:border-gray-500 text-[10px] leading-none text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:f("settings.model_registry.apikey_help_title"),"aria-label":f("settings.model_registry.apikey_help_title"),children:"?"})]}),a.jsx("input",{type:"text",value:n.spec||"",onChange:function(C){p({spec:C.target.value})},className:N+" font-mono",placeholder:f("settings.model_registry.spec_placeholder")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:f("settings.model_registry.spec_hint")}),_&&a.jsxs("div",{className:"mt-1 p-2 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-xs text-gray-600 dark:text-gray-300 space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-semibold text-gray-800 dark:text-gray-100",children:f("settings.model_registry.apikey_help_title")}),a.jsx("button",{type:"button",onClick:function(){S(!1)},className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:f("settings.model_registry.apikey_help_close")})]}),a.jsx("p",{children:f("settings.model_registry.apikey_help_alias")}),a.jsx("p",{children:f("settings.model_registry.apikey_help_url")}),a.jsx("p",{children:f("settings.model_registry.apikey_help_keys")}),a.jsx("p",{className:"font-mono",children:f("settings.model_registry.apikey_help_registry")}),a.jsxs("p",{className:"text-red-600 dark:text-red-400",children:[a.jsx("span",{className:"line-through",children:"provider/model-id"})," ",f("settings.model_registry.apikey_help_deprecated")]}),a.jsx("p",{className:"text-gray-400 dark:text-gray-500",children:f("settings.model_registry.apikey_help_docs")})]})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:R,children:f("settings.model_registry.displayName")}),a.jsx("input",{type:"text",value:n.displayName||"",onChange:function(C){p({displayName:C.target.value})},className:N,placeholder:f("settings.model_registry.displayName_placeholder")})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsxs("label",{className:R,children:[f("settings.model_registry.apikey_label"),n.hasApiKey&&a.jsx("span",{className:"ml-2 text-[10px] px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 font-mono",children:f("settings.model_registry.apikey_stored",{profile:w})})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("input",{type:x?"text":"password",value:n.apiKey||"",onChange:function(C){p({apiKey:C.target.value,keyCleared:!1})},className:N+" font-mono",placeholder:n.hasApiKey?f("settings.model_registry.apikey_placeholder"):f("settings.model_registry.apikey_placeholder_new"),autoComplete:"new-password",spellCheck:!1}),a.jsx("button",{type:"button",onClick:function(){v(function(C){return!C})},className:"shrink-0 px-2 py-1 text-xs rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:f(x?"settings.model_registry.apikey_hide":"settings.model_registry.apikey_show")})]}),n.keyCleared&&a.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-0.5",children:f("settings.model_registry.apikey_removing")}),!n.keyCleared&&(n.hasApiKey||String(n.apiKey||"").trim()!=="")&&a.jsx("button",{type:"button",onClick:function(){p({apiKey:"",keyCleared:!0})},className:"text-xs text-red-600 dark:text-red-400 hover:underline mt-0.5",children:f("settings.model_registry.apikey_remove")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:f("settings.model_registry.apikey_hint",{profile:w})})]}),a.jsxs("details",{className:"col-span-2",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-600 dark:text-gray-300 select-none",children:f("settings.model_registry.advanced")}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:R,children:f("settings.model_registry.limit_context")}),a.jsx("input",{type:"number",value:n.limit?n.limit.context:128e3,onChange:function(C){h({context:parseInt(C.target.value,10)||128e3})},className:N})]}),a.jsxs("div",{children:[a.jsx("label",{className:R,children:f("settings.model_registry.limit_output")}),a.jsx("input",{type:"number",value:n.limit?n.limit.output:8192,onChange:function(C){h({output:parseInt(C.target.value,10)||8192})},className:N})]})]})]})]}),a.jsxs("div",{className:"flex gap-2 pt-1",children:[a.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")}),a.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 UY({value:e,onChange:t,t:n}){const r=nc(),[i,o]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState(null),[p,h]=y.useState(!1),[m,x]=y.useState(""),[v,k]=y.useState(kv()),[_,S]=y.useState(null),[w,N]=y.useState(!1),[R,T]=y.useState(null);y.useEffect(function(){var z=!1;return u(!0),qv().then(function(G){z||(o(G),u(!1))}).catch(function(G){z||(f(fu(G)),u(!1))}),function(){z=!0}},[]);var C=y.useCallback(function(){u(!0),f(null),qv().then(function(z){o(z),u(!1)}).catch(function(z){f(fu(z)),u(!1)})},[]);function M(z,G,K){var H=(z||"").trim();return H?FY.indexOf(H)!==-1?n("settings.model_registry.error_name_reserved",{name:H}):H!==K&&G.indexOf(H)!==-1?n("settings.model_registry.error_name_exists",{name:H}):null:n("settings.model_registry.error_name_required")}var I=y.useCallback(async function(){if(i){var z=Object.keys(i.user||{}).concat(Object.keys(i.builtin||{})),G=M(m,z,null);if(G){T(G);return}N(!0),T(null);try{await Bw(m.trim(),ER(v)),h(!1),x(""),k(kv()),C(),t&&t(e)}catch(K){T(fu(K))}finally{N(!1)}}},[m,v,i,t,e,C]),A=y.useCallback(async function(z){N(!0),T(null);try{await A3(z),C(),t&&t(e)}catch(G){T(fu(G))}finally{N(!1)}},[t,e,C]),L=y.useCallback(async function(){if(!(!_||!i)){var z=Object.keys(i.user||{}).concat(Object.keys(i.builtin||{})),G=M(_.name,z,_.originalName);if(G){T(G);return}N(!0),T(null);try{var K=_.name.trim(),H=ER(_.config);K!==_.originalName?await I3(_.originalName,K,H.apiKey):await Bw(K,H),S(null),C(),t&&t(e)}catch(se){T(fu(se))}finally{N(!1)}}},[_,i,t,e,C]);if(l)return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 py-2",children:[a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary-600"}),n("settings.model_registry.loading")]});if(d)return a.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 py-2",children:n("settings.model_registry.load_error",{error:d})});var D=i&&i.user?i.user:{},$=i&&i.builtin?i.builtin:{},te=Object.keys(D),V=Object.keys($);return a.jsxs("div",{className:"space-y-3",children:[R&&a.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:R}),V.length>0&&a.jsxs("div",{children:[a.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")}),a.jsx("div",{className:"space-y-1",children:V.map(function(z){var G=$[z];return a.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:[a.jsx("span",{className:"font-mono font-medium text-gray-900 dark:text-gray-100",children:z}),G.provider&&a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:G.provider}),G.limit&&G.limit.context&&a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:G.limit.context/1e3})}),G.tier&&a.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:G.tier})]},z)})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("settings.model_registry.user")}),!p&&!_&&a.jsx("button",{type:"button",onClick:function(){h(!0),x(""),k(kv()),T(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")})]}),te.length===0&&!p&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:n("settings.model_registry.no_user_models")}),a.jsxs("div",{className:"space-y-2",children:[te.map(function(z){var G=D[z];return _&&_.originalName===z?a.jsx(NR,{name:_.name,config:_.config,setName:function(K){S(function(H){return H&&Object.assign({},H,{name:K})})},setConfig:function(K){S(function(H){if(!H)return H;var se=typeof K=="function"?K(H.config):K;return Object.assign({},H,{config:se})})},onSave:L,onCancel:function(){S(null),T(null)},saving:w,isNew:!1,t:n},z):a.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:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:z}),G.displayName&&G.displayName!==z&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",G.displayName,")"]}),G.url&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono truncate",children:["→ ",G.url]}),!G.url&&G.target&&a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:["→ ",G.target]}),G.limit&&G.limit.context&&a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:n("settings.model_registry.context_k",{value:G.limit.context/1e3})}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-mono shrink-0 "+(G.hasApiKey?"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300":"bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400"),children:G.hasApiKey?n("settings.model_registry.apikey_badge_set"):n("settings.model_registry.apikey_badge_none")})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("button",{type:"button",onClick:function(){S({originalName:z,name:z,config:zY(G)}),h(!1),T(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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{type:"button",onClick:function(){r({title:n("settings.model_registry.delete"),message:a.jsxs(a.Fragment,{children:[n("settings.model_registry.delete_confirm",{name:z}),a.jsx("span",{className:"block mt-2 text-red-600 dark:text-red-400",children:n("settings.model_registry.apikey_delete_note",{profile:"registry-"+z})})]}),destructive:!0}).then(function(K){K&&A(z)})},disabled:w,className:"p-1 rounded hover:bg-red-100 dark:hover:bg-red-900/30 text-gray-400 hover:text-red-600 dark:hover:text-red-400 transition-colors",title:n("settings.model_registry.delete"),children:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]})]},z)}),p&&a.jsx(NR,{name:m,config:v,setName:x,setConfig:function(z){k(function(G){return typeof z=="function"?z(G):z})},onSave:I,onCancel:function(){h(!1),T(null)},saving:w,isNew:!0,t:n})]})]})]})}function qY({setting:e,value:t,onChange:n,error:r,models:i,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"&&i&&i.length>0&&t&&!i.find(function(m){return m.id===t});if(y.useEffect(function(){e.type!=="model-select"||!i||i.length===0||t&&i.find(function(m){return m.id===t})&&u(!1)},[t,i,e.type]),e.type==="model-select"){if(!i||i.length===0)return a.jsxs("div",{children:[a.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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const m=l||p,x=CK(i);return a.jsxs("div",{children:[a.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 a.jsx("optgroup",{label:EK[k]||k,children:_.map(function(S){return a.jsxs("option",{value:S.id,children:[S.name,NK(S.tier)]},S.id)})},k)}),a.jsx("option",{value:"__custom__",children:o("settings.custom_model")})]}),m&&a.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&&a.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 a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.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:a.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")})}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(x?"settings.enabled":"settings.disabled")})]}),r&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}if(e.type==="select")return a.jsxs("div",{children:[a.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 a.jsx("option",{value:m,children:x},m)})}),r&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="number")return a.jsxs("div",{children:[a.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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="textarea")return a.jsxs("div",{children:[a.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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});if(e.type==="object")return a.jsxs("div",{children:[a.jsx(UY,{value:t,onChange:n,t:o}),r&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]});const h=e.type==="password"?"password":"text";return a.jsxs("div",{children:[a.jsx("input",{type:h,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&&a.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:r})]})}let za=null;function fM(){if(za&&za.state==="closed"&&(za=null),!za){const e=window.AudioContext||window.webkitAudioContext;if(!e)return null;try{za=new e}catch(t){throw za=null,t}}return za.state==="suspended"&&za.resume().catch(()=>{}),za}if(typeof document<"u"){const e=async()=>{let t;try{t=fM()}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"&&(za=null)};document.addEventListener("click",e),document.addEventListener("keydown",e)}function HY(){let e;try{e=fM()}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 i=e.createOscillator(),o=e.createGain();i.type="sine",i.frequency.value=1e3,o.gain.setValueAtTime(.3,t+.1),o.gain.exponentialRampToValueAtTime(.01,t+.2),i.connect(o),o.connect(e.destination),i.start(t+.1),i.stop(t+.2)}catch{e&&e.state!=="closed"&&e.close().catch(()=>{}),za=null}}function $Y(){try{return localStorage.getItem("pave-notification-sound")!=="false"}catch{return!0}}function WY(e){try{localStorage.setItem("pave-notification-sound",e?"true":"false")}catch{}}const pM="pave-native-notifications";function sd(){return typeof Notification<"u"&&typeof Notification.requestPermission=="function"}function VY(){return sd()?Notification.permission:"unsupported"}function O1(){if(!sd()||Notification.permission!=="granted")return!1;try{return localStorage.getItem(pM)==="true"}catch{return!1}}function GY(e){try{localStorage.setItem(pM,e?"true":"false")}catch{}}async function KY(){if(!sd())return"unsupported";try{return await Notification.requestPermission()}catch{return"denied"}}function YY({title:e,body:t,tag:n,icon:r,onClick:i}){if(!sd()||Notification.permission!=="granted"||!O1())return null;try{const o=new Notification(e,{body:t||"",tag:n||"pave-"+Date.now(),icon:r||ar("/pave-logo-light.png"),silent:!1});return typeof i=="function"&&(o.onclick=function(){i(),o.close()}),setTimeout(()=>{try{o.close()}catch{}},8e3),o}catch{return null}}const hM="pave-push-notifications",QY="/sw.js";function Hp(){return typeof navigator<"u"&&typeof navigator.serviceWorker<"u"&&typeof window<"u"&&typeof PushManager<"u"}function gM(){try{return window.matchMedia("(display-mode: standalone)").matches||typeof navigator.standalone=="boolean"&&navigator.standalone}catch{return!1}}function XY(){try{return localStorage.getItem(hM)==="true"}catch{return!1}}function ap(e){try{localStorage.setItem(hM,e?"true":"false")}catch{}}function _v(){return typeof Notification>"u"?"unsupported":Notification.permission}async function mM(){if(!Hp())return null;try{return await navigator.serviceWorker.register(ar(QY),{scope:ar("/")})}catch(e){return console.error("[web-push] SW registration failed:",e.message),null}}async function ZY(){if(!Hp())return console.warn("[web-push] Not supported in this browser"),!1;const e=await mM();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(ar("/api/push/vapid-public-key"),{credentials:"include"});if(!r.ok)throw new Error("Failed to get VAPID key");const i=await r.json();t=iQ(i.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 i=new Uint8Array(n.options.applicationServerKey);r=rQ(i,t)}if(r)return await CR(n),ap(!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 CR(n),ap(!0),console.log("[web-push] Subscribed successfully:",n.endpoint),!0}async function JY(){if(!Hp())return!1;try{const e=await navigator.serviceWorker.getRegistration();if(e){const t=await e.pushManager.getSubscription();t&&(await fetch(ar("/api/push/unsubscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({endpoint:t.endpoint})}).catch(()=>{}),await t.unsubscribe())}return ap(!1),console.log("[web-push] Unsubscribed"),!0}catch(e){return console.error("[web-push] Unsubscribe failed:",e.message),ap(!1),!1}}async function CR(e){let t;typeof e.toJSON=="function"?t=e.toJSON():t={endpoint:e.endpoint,keys:{p256dh:jR(e.getKey("p256dh")),auth:jR(e.getKey("auth"))}},await fetch(ar("/api/push/subscribe"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}async function eQ(){const e=await fetch(ar("/api/push/test"),{method:"POST",credentials:"include"});if(!e.ok)throw new Error("Test push failed");return e.json()}function tQ(e){if(typeof document>"u"||typeof window>"u")return;function t(n){const r=typeof e=="function"?e():null,i=JSON.stringify({visible:n,activeSessionId:r});try{if(navigator.sendBeacon){const o=new Blob([i],{type:"application/json"});navigator.sendBeacon(ar("/api/visibility"),o);return}fetch(ar("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:i}).catch(()=>{})}catch{}}document.addEventListener("visibilitychange",()=>{t(document.visibilityState==="visible")}),window.addEventListener("blur",()=>{t(!1)}),window.addEventListener("focus",()=>{t(!0)}),t(document.visibilityState==="visible")}function nQ(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(ar("/api/visibility"),r);return}fetch(ar("/api/visibility"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:n}).catch(()=>{})}catch{}}function rQ(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 iQ(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4),r=atob(t+n),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}function jR(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 od="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900";function D1({t:e}){return a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5",children:e("settings.auto_saved")})}function $p({id:e,label:t,description:n,hints:r,checked:i,onToggle:o,disabled:l,supported:u=!0,unsupportedText:d="",divided:f=!1}){return a.jsxs("div",{className:"flex items-center justify-between"+(f?" mt-4 pt-4 border-t border-gray-200 dark:border-gray-700":""),children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:n}),r]}),u?a.jsx("button",{id:e,type:"button",role:"switch","aria-checked":i,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 "+(i?"bg-primary-600":"bg-gray-200 dark:bg-gray-700"),children:a.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 "+(i?"translate-x-5":"translate-x-0")})}):a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:d})]})}function aQ(){const{t:e,locale:t,setLocale:n,availableLocales:r}=Gt();return a.jsxs("div",{className:od,children:[a.jsx("label",{htmlFor:"settings-language",className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:e("settings.language")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:e("settings.language_description")}),a.jsx("select",{id:"settings-language",value:t,onChange:function(i){n(i.target.value)},className:"block w-full rounded-md border px-3 py-2 text-sm transition-colors bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-600 focus:ring-primary-500 focus:border-primary-500 text-gray-900 dark:text-gray-100",children:r.map(function(i){return a.jsxs("option",{value:i.code,children:[i.nativeName," (",i.name,")"]},i.code)})}),a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:e("settings.language_auto_applied")})]})}function sQ(){const{t:e}=Gt(),[t,n]=y.useState(()=>$Y()),r=y.useCallback(function(){const i=!t;n(i),WY(i),i&&HY()},[t]);return a.jsxs("div",{className:od,children:[a.jsx($p,{id:"settings-notification-sound",label:e("settings.notification_sound"),description:e("settings.notification_sound_desc"),hints:a.jsx(D1,{t:e}),checked:t,onToggle:r}),a.jsx(oQ,{}),a.jsx(lQ,{})]})}function oQ(){const{t:e}=Gt(),[t]=y.useState(()=>sd()),[n,r]=y.useState(()=>VY()),[i,o]=y.useState(()=>O1()),l=y.useCallback(async function(){if(!t)return;if(!i&&Notification.permission!=="granted"){const d=await KY();if(r(d),d!=="granted")return}const u=!i;o(u),GY(u)},[i,t]);return a.jsx($p,{id:"settings-native-notifications",divided:!0,label:e("settings.native_notifications"),description:e("settings.native_notifications_desc"),hints:a.jsxs(a.Fragment,{children:[n==="denied"&&a.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 mt-0.5",children:e("settings.native_notifications_blocked")}),n==="default"&&a.jsx("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-0.5",children:e("settings.native_notifications_permission")}),a.jsx(D1,{t:e})]}),checked:i,onToggle:l,supported:t,unsupportedText:e("settings.native_notifications_unsupported")})}function lQ(){const[e]=y.useState(()=>Hp()),[t,n]=y.useState(()=>XY()),[r,i]=y.useState(()=>_v()),[o,l]=y.useState(!1),u=y.useCallback(async function(){if(!(!e||o)){l(!0);try{t?(await JY(),n(!1)):(await ZY()&&n(!0),i(_v()))}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 eQ();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 a.jsx($p,{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:a.jsxs(a.Fragment,{children:[e&&!gM()&&a.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"&&a.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&&a.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 cQ({mobileFrameless:e,onMobileFramelessChange:t}){const{t:n}=Gt();return a.jsx("div",{className:od,children:a.jsx($p,{id:"settings-mobile-frameless",label:n("settings.mobile_frameless"),description:n("settings.mobile_frameless_desc"),hints:a.jsx(D1,{t:n}),checked:e,onToggle:()=>t(!e)})})}function uQ({activeSessionId:e}){const{t}=Gt(),[n,r]=y.useState(()=>Gl()||""),[i,o]=y.useState(()=>Gl()||""),[l,u]=y.useState(""),[d,f]=y.useState(null),[p,h]=y.useState(!1),[m,x]=y.useState(null);y.useEffect(function(){Hv().then(function(S){u(S.home||"")}).catch(function(){})},[]);const v=y.useCallback(function(S){r(S),f(null),x(null)},[]),k=y.useCallback(async function(){const S=n.trim();if(!S){if(ug(null),o(""),r(""),f(null),x({type:"success",message:t("settings.working_dir_reset")}),e)try{await yi(e,{directory:null})}catch(N){console.warn("[settings] failed to clear session directory:",N.message)}return}h(!0),f(null);const w=Gl();try{ug(S);const N=await Hv();if(o(S),r(S),x({type:"success",message:t("settings.working_dir_updated",{path:N.cwd})}),e)try{await yi(e,{directory:S})}catch(R){console.warn("[settings] failed to update session directory:",R.message)}}catch(N){ug(w),r(i),f(t("settings.working_dir_invalid",{error:N.message}))}finally{h(!1)}},[n,i,e,t]),_=n!==i;return a.jsxs("div",{className:od,children:[a.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")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("settings.working_dir_desc")}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{id:"settings-working-dir",type:"text",value:n,onChange:function(S){v(S.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"}),a.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&&a.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:d}),m&&a.jsx("p",{className:"mt-2 text-xs "+(m.type==="success"?"text-green-600 dark:text-green-400":m.type==="error"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400"),children:m.message}),i&&a.jsx("p",{className:"mt-2 text-xs text-gray-400 dark:text-gray-500",children:t("settings.currently_set_to",{path:i})})]})}function dQ(){const{t:e}=Gt(),[t,n]=y.useState("checking"),[r,i]=y.useState(null),[o,l]=y.useState(null),[u,d]=y.useState(null),f=y.useCallback(function(m){i(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 hg();f(m)}catch(m){d(m.message),n("check-error")}},[f]),h=y.useCallback(async function(){n("updating"),d(null);try{await R3(),n("success");try{const m=await hg();i(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 hg();m||f(v)}catch(v){m||(d(v&&v.message?v.message:String(v)),n("check-error"))}})(),function(){m=!0}},[f]),a.jsx("div",{className:od,children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.current_version")}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:r||"--"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e("settings.latest_version")}),a.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 font-mono",children:t==="checking"?e("settings.checking_updates"):o||"--"})]}),a.jsx(fQ,{t:e,updateStatus:t,updateError:u,latestVersion:o}),a.jsx(pQ,{t:e,updateStatus:t,onCheckUpdates:p,onPerformUpdate:h})]})})}function fQ({t:e,updateStatus:t,updateError:n,latestVersion:r}){return a.jsxs(a.Fragment,{children:[t==="update-available"&&a.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[e("settings.update_available")," (",r,")"]}),t==="no-updates"&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e("settings.no_updates")}),t==="success"&&a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:e("settings.update_success")}),t==="check-error"&&n&&a.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.check_updates_failed"),": ",n]}),t==="error"&&n&&a.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400",children:[e("settings.update_failed"),": ",n]})]})}function pQ({t:e,updateStatus:t,onCheckUpdates:n,onPerformUpdate:r}){const i=t==="idle"||t==="no-updates"||t==="error"||t==="check-error"||t==="success";return a.jsxs("div",{className:"flex gap-2 pt-1",children:[i&&a.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"&&a.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"&&a.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"&&a.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 hQ({registryRows:e,t}){const n=Array.isArray(e)?e:[];return a.jsxs("div",{className:"space-y-3","data-testid":"notifications-merged-pane",children:[n.length>0&&a.jsx("div",{className:"space-y-3",children:n}),a.jsx(sQ,{}),n.length>0&&a.jsx("p",{className:"text-xs opacity-70",children:t("settings.notifications_merged_note")})]})}function gQ({grouped:e,renderRegistryRow:t,t:n}){const r=e&&e[mA]||[];return a.jsx(hQ,{registryRows:r.map(t),t:n})}const wv="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",TR="pave-asr-language",Sv="pave-asr-model",mQ=[{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"}],RR=[{code:"whisper",label:"Whisper",hintKey:"voice.engine_whisper_hint"},{code:"paraformer",label:"Paraformer",hintKey:"voice.engine_paraformer_hint"}];function Ev(e,t){try{return localStorage.getItem(e)||t}catch{return t}}function AR(e,t){try{localStorage.setItem(e,t)}catch{}}function Nv({id:e,label:t,description:n,value:r,options:i,note:o,onValueChange:l,disabled:u}){return a.jsxs("div",{children:[a.jsx("label",{htmlFor:e,className:"text-sm font-medium text-gray-900 dark:text-gray-100 block",children:t}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 mb-2",children:n}),a.jsx("select",{id:e,value:r,disabled:u,onChange:function(d){l(d.target.value)},className:"w-full sm:w-64 px-2 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm text-gray-900 dark:text-gray-100 disabled:opacity-50",children:i.map(function(d){return a.jsx("option",{value:d.code,children:d.label},d.code)})}),o?a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:o}):null]})}function xQ(){const{t:e}=Gt(),[t,n]=y.useState("whisper"),[r,i]=y.useState(function(){return Ev(TR,"auto")}),[o,l]=y.useState(function(){return Ev(Sv,"")}),[u,d]=y.useState([]),[f,p]=y.useState(!1),[h,m]=y.useState(""),[x,v]=y.useState("");y.useEffect(function(){let w=!1;return Hf().then(function(N){w||!N||(Array.isArray(N.models)&&N.models.length>0&&(d(N.models),l(function(R){const T=R||Ev(Sv,"");return N.models.some(function(M){return M.name===T})?T:N.models[0].name})),(N.preferredEngine==="whisper"||N.preferredEngine==="paraformer")&&n(N.preferredEngine))}).catch(function(){}),function(){w=!0}},[]),y.useEffect(function(){r&&AR(TR,r)},[r]),y.useEffect(function(){o&&AR(Sv,o)},[o]);const k=y.useRef(t);y.useEffect(function(){k.current=t},[t]);const _=y.useCallback(function(w){const N=k.current;m(""),v(""),N!==w&&(n(w),p(!0),m3(w).then(function(){w==="paraformer"&&v(e("voice.paraformer_starting"))}).catch(function(R){n(N),m(R&&R.message?String(R.message):String(R))}).finally(function(){p(!1)}))},[e]),S=RR.filter(function(w){return w.code===t})[0];return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:wv,children:[a.jsx(Nv,{id:"settings-voice-engine",label:e("voice.engine"),description:e("voice.engine_description"),value:t,disabled:f,options:RR,onValueChange:_,note:S?e(S.hintKey):null}),x?a.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300 mt-3","data-testid":"voice-engine-notice",children:x}):null,h?a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-3",role:"alert","data-testid":"voice-engine-error",children:e("voice.engine_switch_failed")+": "+h}):null]}),a.jsxs("div",{className:wv,children:[a.jsx(Nv,{id:"settings-voice-language",disabled:t!=="whisper",label:e("voice.language"),description:e("voice.language_description"),value:r,options:mQ,onValueChange:i,note:e("voice.whisper_only")}),r==="yue"?a.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 mt-3","data-testid":"voice-cantonese-note",children:e("voice.cantonese_note")}):null]}),a.jsxs("div",{className:wv,children:[a.jsx(Nv,{id:"settings-voice-model",label:e("voice.model"),description:e("voice.model_description"),value:o,disabled:u.length===0||t!=="whisper",options:u.map(function(w){return{code:w.name,label:w.label||w.name}}),onValueChange:l,note:e("voice.whisper_only")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-3",children:e("voice.next_recording_note")})]})]})}function yQ(){const{t:e}=Gt(),[t,n]=y.useState([]),[r,i]=y.useState({}),[o,l]=y.useState({}),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(null),k=y.useCallback(async()=>{try{d(!0),v(null);const C=(await jA()).settings||[];n(C),i(Bv(C)),l({}),m(null)}catch(T){v(T.message)}finally{d(!1)}},[]),_=y.useCallback((T,C)=>{i(M=>{const I={...M};return I[T]=C,I}),l(M=>{if(!M[T])return M;const{[T]:I,...A}=M;return A}),m(null)},[]),S=qL(t,r),w=Object.keys(S).length,N=y.useCallback(async()=>{p(!0),m(null);try{if(w===0){m({type:"info",message:e("settings.no_changes")});return}const T=await u3(S),C=Object.keys(T.errors||{});try{window.dispatchEvent(new CustomEvent("pave:settings-updated",{detail:{keys:Object.keys(S)}}))}catch{}if(C.length>0?(l(T.errors),m({type:"warning",message:e("settings.partial_save")})):(l({}),m({type:"success",message:e("settings.saved")})),T.settings){const M=T.settings;n(M),i(I=>HL(M,I,C))}}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)}},[S,w,e]),R=y.useCallback(()=>{i(Bv(t)),l({}),m(null)},[t]);return{settings:t,formValues:r,errors:o,loading:u,saving:f,saveResult:h,setSaveResult:m,loadError:x,updates:S,changedCount:w,loadSettings:k,handleChange:_,handleSave:N,handleReset:R}}function bQ(){return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})})}function vQ({t:e,loadError:t,onRetry:n}){return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[a.jsx("p",{className:"text-red-600 dark:text-red-400",children:e("settings.failed_to_load",{error:t})}),a.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 Sk="__dlp__",Ek="__pricing__",xM="Configure Data Loss Prevention rules, detectors, and audit policies.",yM="Configure per-model token pricing used for cost and usage tracking.",Wp="__chat_language__",$u="__chat_notifications__",Vp="__chat_appearance__",Gp="__chat_workspace__",Xl="__chat_version__",Zl="__chat_voice__",kQ=[{groupId:Wp,labelKey:"settings.language",descriptionKey:"settings.language_description"},{groupId:$u,labelKey:"settings.notification_sound",descriptionKey:"settings.notification_sound_desc"},{groupId:$u,labelKey:"settings.native_notifications",descriptionKey:"settings.native_notifications_desc"},{groupId:Vp,labelKey:"settings.mobile_frameless",descriptionKey:"settings.mobile_frameless_desc"},{groupId:Gp,labelKey:"settings.working_dir",descriptionKey:"settings.working_dir_desc"},{groupId:Xl,labelKey:"settings.current_version",descriptionKey:null},{groupId:Xl,labelKey:"settings.latest_version",descriptionKey:null},{groupId:Xl,labelKey:"settings.check_updates",descriptionKey:null},{groupId:Zl,labelKey:"voice.engine",descriptionKey:"voice.engine_description"},{groupId:Zl,labelKey:"voice.language",descriptionKey:"voice.language_description"},{groupId:Zl,labelKey:"voice.model",descriptionKey:"voice.model_description"}],_Q=[{id:Wp,headerKey:"settings.category.language"},{id:$u,headerKey:"settings.notifications"},{id:Vp,headerKey:"settings.appearance"},{id:Gp,headerKey:"settings.workspace"},{id:Xl,headerKey:"settings.version_title"},{id:Zl,headerKey:"settings.category.voice"}],IR={[Wp]:aQ,[$u]:gQ,[Vp]:cQ,[Gp]:uQ,[Xl]:dQ,[Zl]:xQ};function wQ(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 SQ(e,t){return t?e.filter(function(n){return(n.label||"").toLowerCase().indexOf(t)>=0||(n.description||"").toLowerCase().indexOf(t)>=0}):null}function EQ(e,t){return t?e.filter(function(n){return(n.label||"").toLowerCase().indexOf(t)>=0||(n.description||"").toLowerCase().indexOf(t)>=0}):null}function NQ(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 CQ(e){const t={};if(!e)return t;for(let n=0;n<e.length;n++){const r=e[n].groupId;t[r]=(t[r]||0)+1}return t}function jQ({t:e,search:t,onSearchChange:n,onBack:r,groups:i,activeGroup:o,matchCounts:l,searching:u,onSelect:d}){return a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e("settings.title")}),a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:e("settings.v2.badge")})]}),a.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:i.map(function(f){const p=u?l[f.id]:null;return a.jsx("option",{value:f.id,children:p?f.label+" ("+p+")":f.label},f.id)})}),a.jsxs("div",{className:"flex-1 max-w-md ml-auto relative",children:[a.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:a.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"})}),a.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&&a.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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function TQ({t:e,groups:t,activeGroup:n,matchCounts:r,searching:i,onSelect:o}){return a.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=!i&&l.id===n,d=i?r[l.id]:l.kind==="registry"?l.count:null,f=!i||r[l.id];return a.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:[a.jsx("span",{className:"truncate",children:l.label}),f&&d!=null&&a.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 tabular-nums shrink-0",children:d})]},l.id)})})}function RQ({setting:e,formValue:t,error:n,models:r,t:i,onChange:o}){const l=e.source==="env";return a.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:[a.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.label}),l&&a.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 whitespace-nowrap",title:i("settings.env_override",{envVar:e.envVar}),children:i("settings.source_env")})]}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 break-words",children:[e.description,e.requiresRestart&&a.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400 font-medium",children:i("settings.requires_restart")}),e.source==="env"&&a.jsx("span",{className:"block mt-1 text-amber-600 dark:text-amber-400",children:i("settings.env_override",{envVar:e.envVar})}),a.jsx("span",{className:"block mt-0.5 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:e.key})]}),a.jsx(qY,{setting:e,value:t!==void 0?t:"",onChange:o,error:n,models:r,t:i}),e.source!=="default"&&e.defaultValue!==void 0&&e.type!=="object"&&a.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:i("settings.default_prefix",{value:e.defaultValue===""?i("settings.default_empty"):String(e.defaultValue)})})]})}function zf({title:e,description:t,actionLabel:n,onOpen:r}){return a.jsxs("div",{className:"p-6 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-2",children:e}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:t}),a.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 AQ({t:e,headerKey:t,hits:n,onSelectGroup:r}){return a.jsxs("section",{children:[a.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:e(t)}),a.jsx("div",{className:"space-y-3",children:n.map(function(i){return a.jsx(zf,{title:i.label,description:i.description,actionLabel:e("settings.v2.open"),onOpen:function(){r(i.groupId)}},"search-chat-"+i.groupId+"-"+i.labelKey)})})]})}function IQ({t:e,changedCount:t,saving:n,saveResult:r,onSave:i,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 a.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:[a.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&&a.jsx("span",{className:"text-xs "+l,children:r.message}),a.jsxs("div",{className:"ml-auto flex gap-2",children:[a.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")}),a.jsx("button",{type:"button",onClick:i,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 MQ({t:e}){return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[a.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:a.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"})}),a.jsx("p",{className:"text-sm",children:e("settings.v2.no_matches")})]})}function LQ(e){const{q:t,matches:n,launcherMatches:r,chatMatches:i,orderedCategories:o,grouped:l,renderRegistryRow:u,activeGroup:d,t:f,onSelectChatGroup:p,onOpenDlpSettings:h,onOpenPricingSettings:m,activeSessionId:x,mobileFrameless:v,onMobileFramelessChange:k}=e;let _;if(t&&(!n||n.length===0)&&(!r||r.length===0)&&(!i||i.length===0))_=a.jsx(MQ,{t:f});else if(t)_=a.jsxs("div",{className:"space-y-6",children:[a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:f("settings.v2.search_results",{count:(n?n.length:0)+(r?r.length:0)+(i?i.length:0)})}),o.map(function(S){const w=n.filter(function(N){return N.category===S});return w.length===0?null:a.jsxs("section",{children:[a.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:qf[S]?f(qf[S]):S}),a.jsx("div",{className:"space-y-3",children:w.map(u)})]},"search-"+S)}),_Q.map(function(S){const w=(i||[]).filter(function(N){return N.groupId===S.id});return w.length===0?null:a.jsx(AQ,{t:f,headerKey:S.headerKey,hits:w,onSelectGroup:p},"search-chat-"+S.id)}),(r||[]).map(function(S){return a.jsx(zf,{title:S.label,description:S.description,actionLabel:f("settings.v2.open"),onOpen:S.onOpen},"search-launcher-"+S.id)})]});else if(d===Sk)_=a.jsx(zf,{title:f("dlp.title"),description:xM,actionLabel:f("settings.v2.open"),onOpen:h});else if(d===Ek)_=a.jsx(zf,{title:f("pricing.title"),description:yM,actionLabel:f("settings.v2.open"),onOpen:m});else if(IR[d]){const S=IR[d];_=a.jsx("div",{className:"space-y-3",children:a.jsx(S,{activeSessionId:x,mobileFrameless:v,onMobileFramelessChange:k,grouped:l,renderRegistryRow:u,t:f})})}else _=a.jsxs("div",{className:"space-y-3",children:[d==="Experimental Features"&&a.jsx("p",{className:"text-xs opacity-70",children:f("settings.category.experimental.blurb")}),(l[d]||[]).map(u)]});return _}function OQ({onBack:e,onOpenDlpSettings:t,onOpenPricingSettings:n,activeSessionId:r,mobileFrameless:i,onMobileFramelessChange:o}){const{t:l}=Gt(),{settings:u,formValues:d,errors:f,loading:p,saving:h,saveResult:m,loadError:x,changedCount:v,loadSettings:k,handleChange:_,handleSave:S,handleReset:w}=yQ(),N=u.filter(function(q){return!q.hidden}),[R,T]=y.useState([]),[C,M]=y.useState(""),[I,A]=y.useState(null);y.useEffect(()=>{k()},[k]),y.useEffect(()=>{A(function(q){return q||u[0]&&u[0].category||null})},[u]),y.useEffect(()=>{let q=!1;return M3().then(function(Y){q||T(Array.isArray(Y)?Y:Y&&Y.models||[])}).catch(function(){q||T([])}),function(){q=!0}},[]);const L=$L(N),D=WL(L,VL),te=D.filter(function(q){return q!==mA}).map(function(q){return{id:q,kind:"registry",label:qf[q]?l(qf[q]):q,count:L[q].length}}).concat([{id:Wp,kind:"chat",label:l("settings.category.language")},{id:$u,kind:"chat",label:l("settings.notifications")},{id:Vp,kind:"chat",label:l("settings.appearance")},{id:Gp,kind:"chat",label:l("settings.workspace")},{id:Xl,kind:"chat",label:l("settings.version_title")},{id:Zl,kind:"chat",label:l("settings.category.voice")},{id:Sk,kind:"launcher",label:l("dlp.title")},{id:Ek,kind:"launcher",label:l("pricing.title")}]),V=C.trim().toLowerCase(),z=wQ(N,V),G=[{id:Sk,label:l("dlp.title"),description:xM,onOpen:t},{id:Ek,label:l("pricing.title"),description:yM,onOpen:n}],K=SQ(G,V),H=kQ.map(function(q){return{groupId:q.groupId,labelKey:q.labelKey,label:l(q.labelKey),description:q.descriptionKey?l(q.descriptionKey):""}}),se=EQ(H,V),P=CQ(se),W={...NQ(z),...P},ee=y.useCallback(function(q){M(""),A(q)},[]),F=function(q){return a.jsx(RQ,{setting:q,formValue:d[q.key],error:f[q.key],models:R,t:l,onChange:function(Y){_(q.key,Y)}},q.key)};if(p)return a.jsx(bQ,{});if(x)return a.jsx(vQ,{t:l,loadError:x,onRetry:k});const J=LQ({q:V,matches:z,launcherMatches:K,chatMatches:se,orderedCategories:D,grouped:L,renderRegistryRow:F,activeGroup:I,t:l,onOpenDlpSettings:t,onOpenPricingSettings:n,onSelectChatGroup:ee,activeSessionId:r,mobileFrameless:i,onMobileFramelessChange:o});return a.jsxs("div",{className:"h-full flex flex-col","data-page":"settings-v2",children:[a.jsx(jQ,{t:l,search:C,onSearchChange:M,onBack:e,groups:te,activeGroup:I,matchCounts:W,searching:!!V,onSelect:ee}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsx(TQ,{t:l,groups:te,activeGroup:I,matchCounts:W,searching:!!V,onSelect:ee}),a.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:J}),a.jsx(IQ,{t:l,changedCount:v,saving:h,saveResult:m,onSave:S,onReset:w})]})]})]})}function DQ({modelName:e,rates:t,onChange:n,onDelete:r,isDefault:i,t:o}){return a.jsxs("div",{className:"flex items-center gap-2 py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`text-sm font-medium truncate ${i?"text-primary-600 dark:text-primary-400":"text-gray-900 dark:text-gray-100"}`,children:e}),i&&a.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")})]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_input")}),a.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")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_output")}),a.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")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:o("pricing.label_cache")}),a.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")})]}),!i&&a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),i&&a.jsx("div",{className:"w-6"})]})]})}function PQ({onAdd:e,existingModels:t,t:n}){const[r,i]=y.useState(""),[o,l]=y.useState(5),[u,d]=y.useState(15),[f,p]=y.useState(2.5),[h,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}),i(""),l(5),d(15),p(2.5)};return a.jsxs("form",{onSubmit:x,className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("pricing.add_new_model")}),a.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[a.jsx("div",{className:"flex-1 min-w-[120px]",children:a.jsx("input",{type:"text",placeholder:n("pricing.add_model_placeholder"),value:r,onChange:v=>i(v.target.value),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_input")}),a.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"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_output")}),a.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"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:n("pricing.label_cache")}),a.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"})]}),a.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")})]}),h&&a.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:h})]})}function FQ({onClose:e}){const{t}=Gt(),n=nc(),[r,i]=y.useState(null),[o,l]=y.useState(!0),[u,d]=y.useState(!1),[f,p]=y.useState(null),[h,m]=y.useState(!1),x=y.useRef(null);y.useEffect(()=>{let T=!1;async function C(){try{const M=await N3();T||(i(M),l(!1))}catch(M){T||(p(M.message),l(!1))}}return C(),()=>{T=!0}},[]),y.useEffect(()=>{async function T(C){C.key==="Escape"&&(h?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,h,n,t]);const v=y.useCallback((T,C,M)=>{i(I=>!I||!I.models?I:{...I,models:{...I.models,[T]:{...I.models[T],[C]:M}}}),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")})&&(i(C=>{if(!C||!C.models)return C;const M={...C.models};return delete M[T],{...C,models:M}}),m(!0))},[n,t]),_=y.useCallback((T,C)=>{i(M=>M?{...M,models:{...M.models,[T]:C}}:{models:{[T]:C}}),m(!0)},[]),S=y.useCallback(async()=>{p(null),d(!0);try{await C3(r),m(!1),e()}catch(T){p(T.message)}finally{d(!1)}},[r,e]),w=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 j3();i(T.pricing),m(!1)}catch(T){p(T.message)}finally{d(!1)}}},[n,t]),N=y.useCallback(async()=>{h?await n({title:t("pricing.discard_title"),message:t("pricing.discard_confirm"),destructive:!0})&&e():e()},[h,e,n,t]),R=r!=null&&r.models?Object.entries(r.models).sort(([T],[C])=>T==="default"?1:C==="default"?-1:T.localeCompare(C)):[];return a.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:a.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:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("pricing.heading")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("pricing.subtitle")})]}),a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),f&&a.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:a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f})}),!o&&r&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400 flex items-center justify-between",children:[a.jsx("span",{children:t("pricing.configured_count",{count:R.length})}),a.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("pricing.rates_subtitle")})]}),a.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[a.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:[a.jsx("div",{className:"flex-1",children:t("pricing.model_column")}),a.jsx("div",{className:"w-[280px] text-right",children:t("pricing.rates_column")}),a.jsx("div",{className:"w-6"})]}),a.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-800 px-3",children:R.map(([T,C])=>a.jsx(DQ,{modelName:T,rates:C,onChange:v,onDelete:k,isDefault:T==="default",t},T))})]}),a.jsx(PQ,{onAdd:_,existingModels:R.map(([T])=>T),t})]})]}),a.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:[a.jsx("button",{onClick:w,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")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.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")}),a.jsxs("button",{onClick:S,disabled:u||!h,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 dark:disabled:bg-gray-700 text-white rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2",children:[u&&a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),t("pricing.save_changes")]})]})]})]})})}const BQ=[{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"}],zQ=["low","medium","high"];function UQ({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 a.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium ${t[e]||t.medium}`,children:e})}function MR({name:e,regex:t,severity:n,enabled:r,builtin:i,onToggle:o,onRemove:l,t:u}){return a.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:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer shrink-0",children:[a.jsx("input",{type:"checkbox",checked:r,onChange:()=>o(e),className:"sr-only peer",disabled:!1}),a.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"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e}),i&&a.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"})]}),a.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})]}),a.jsx(UQ,{severity:n}),!i&&a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function qQ({onAdd:e,existingNames:t,t:n}){const[r,i]=y.useState(""),[o,l]=y.useState(""),[u,d]=y.useState("medium"),[f,p]=y.useState(""),h=x=>{if(t.includes(x.name)){p(n("dlp.pattern_exists",{name:x.name}));return}i(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),i(""),l(""),d("medium")};return a.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:n("dlp.add_pattern")}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:BQ.map(x=>a.jsx("button",{onClick:()=>h(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))}),a.jsxs("form",{onSubmit:m,className:"flex items-end gap-2 flex-wrap",children:[a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.pattern_name")}),a.jsx("input",{type:"text",placeholder:"e.g. hk_passport",value:r,onChange:x=>i(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"})]}),a.jsxs("div",{className:"flex-[2] min-w-[200px]",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.regex_pattern")}),a.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"})]}),a.jsxs("div",{className:"w-24",children:[a.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 block mb-0.5",children:n("dlp.severity")}),a.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:zQ.map(x=>a.jsx("option",{value:x,children:x},x))})]}),a.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&&a.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:f})]})}function HQ({onClose:e}){const{t}=Gt(),n=nc(),[r,i]=y.useState(null),[o,l]=y.useState([]),[u,d]=y.useState(!0),[f,p]=y.useState(!1),[h,m]=y.useState(null),[x,v]=y.useState(!1),[k,_]=y.useState(!0),[S,w]=y.useState("ask"),[N,R]=y.useState([]),[T,C]=y.useState({}),[M,I]=y.useState("epm/privacy"),A=y.useRef(null);y.useEffect(()=>{let G=!1;async function K(){var H;try{const se=await y3();G||(l(se.builtins||[]),_(se.enabled!==!1),w(se.defaultAction||"ask"),R(se.disabledBuiltins||[]),C(se.patterns||{}),I(((H=se.privateMode)==null?void 0:H.rerouteModel)||"epm/privacy"),i(se),d(!1))}catch(se){G||(m(se.message),d(!1))}}return K(),()=>{G=!0}},[]),y.useEffect(()=>{async function G(K){K.key==="Escape"&&(x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e())}return document.addEventListener("keydown",G),A.current&&A.current.focus(),()=>document.removeEventListener("keydown",G)},[e,x,n,t]);const L=y.useCallback(G=>{R(K=>K.includes(G)?K.filter(H=>H!==G):[...K,G]),v(!0)},[]),D=y.useCallback((G,K,H)=>{C(se=>({...se,[G]:{regex:K,severity:H}})),v(!0)},[]),$=y.useCallback(G=>{C(K=>{const H={...K};return delete H[G],H}),v(!0)},[]),te=y.useCallback(async()=>{m(null),p(!0);try{const K=await b3({enabled:k,defaultAction:S,disabledBuiltins:N,privateMode:{rerouteModel:M},patterns:T});v(!1),i(K.policy),e()}catch(G){m(G.message)}finally{p(!1)}},[k,S,N,T,M,e]),V=y.useCallback(async()=>{x?await n({title:t("dlp.discard_title"),message:t("dlp.discard_confirm"),destructive:!0})&&e():e()},[x,e,n,t]),z=[...o.map(G=>G.name),...Object.keys(T)];return a.jsx("div",{ref:A,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:V,role:"dialog","aria-modal":"true","aria-label":t("dlp.title"),children:a.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-2xl mx-4 max-h-[90vh] flex flex-col",onClick:G=>G.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("dlp.heading")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("dlp.subtitle")})]}),a.jsx("button",{onClick:V,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":t("dlp.close"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[u&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),h&&a.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:a.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),!u&&a.jsxs(a.Fragment,{children:[a.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:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t("dlp.enable_label")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("dlp.enable_desc")})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:k,onChange:G=>{_(G.target.checked),v(!0)},className:"sr-only peer"}),a.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"})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.default_action_label")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.default_action_desc")}),a.jsxs("select",{value:S,onChange:G=>{w(G.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",children:[a.jsx("option",{value:"ask",children:"Ask (show modal)"}),a.jsx("option",{value:"reroute",children:"Always reroute to private"}),a.jsx("option",{value:"warn",children:"Warn only (proceed on cloud)"})]})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 block mb-1",children:t("dlp.reroute_model_label")}),a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:t("dlp.reroute_model_desc")}),a.jsx("input",{type:"text",value:M,onChange:G=>{I(G.target.value),v(!0)},className:"w-full max-w-xs px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono"})]}),a.jsxs("div",{className:"mb-4 mt-6",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.builtin_patterns")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:t("dlp.builtin_desc")}),a.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:o.map(G=>a.jsx(MR,{name:G.name,regex:G.regex,severity:G.severity,enabled:!N.includes(G.name),builtin:!0,onToggle:L,onRemove:()=>{},t},G.name))})]}),a.jsxs("div",{className:"mb-4 mt-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-1",children:t("dlp.user_patterns")}),a.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?a.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")}):a.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden divide-y divide-gray-100 dark:divide-gray-800",children:Object.entries(T).map(([G,K])=>a.jsx(MR,{name:G,regex:K.regex,severity:K.severity,enabled:!0,builtin:!1,onToggle:()=>{},onRemove:$,t},G))})]}),a.jsx(qQ,{onAdd:D,existingNames:z,t})]})]}),!u&&a.jsxs("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-gray-200 dark:border-gray-800",children:[a.jsx("button",{onClick:V,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")}),a.jsx("button",{onClick:te,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 $Q(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 i=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:i,type:o,target:e.target||"*"})}function WQ(e,t){var n=e.sessionTitle||e.sessionID;return n?t("permission.requester",{session:n}):null}function VQ({requests:e}){const{t}=Gt(),n=new Set(e.map(r=>r.sessionID||r.sessionTitle||"")).size;return n<2?null:a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:t("permission.summary_multi",{count:e.length,sessions:n})})}function GQ({request:e,onDismiss:t}){const{t:n}=Gt(),[r,i]=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(k=>{k.includes("not found")||k.includes("expired")?l("Request expired"):k.includes("already")?l("Request already processed"):l(k),i("dismissing"),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u.current&&t(e.id)},2e3)},[e.id,t]),p=y.useCallback(async()=>{i("allow"),l(null);try{const k=await NO(e.id);if(!u.current)return;if(k&&k.success===!1){const _=k.error||k.message||"Failed to confirm";f(_);return}t(e.id)}catch(k){if(!u.current)return;const _=k.message||"Failed to confirm";f(_)}},[e.id,t,f]),h=y.useCallback(async()=>{i("deny"),l(null);try{const k=await CO(e.id);if(!u.current)return;if(k&&k.success===!1){const _=k.error||k.message||"Failed to deny";f(_);return}t(e.id)}catch(k){if(!u.current)return;const _=k.message||"Failed to deny";f(_)}},[e.id,t,f]),m=e.action==="clear",x=e.action==="revoke",v=WQ(e,n);return a.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:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.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:a.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:a.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"})})}),a.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:n("permission.title")})]}),a.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-2",children:$Q(e,n)}),v&&a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:v}),a.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&&a.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-2",children:o}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("button",{onClick:h,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")}),a.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 KQ({requests:e,onDismiss:t}){return!e||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(VQ,{requests:e}),e.map(n=>a.jsx(GQ,{request:n,onDismiss:t},n.id))]})}var YQ="https://account.openpave.ai/dashboard";function QQ({open:e,onClose:t,upgradeUrl:n}){var{t:r}=Gt(),i=y.useRef(null),o=y.useRef(null),l=y.useRef(t),u=YQ;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(h){h.key==="Escape"&&(typeof h.preventDefault=="function"&&h.preventDefault(),typeof h.stopImmediatePropagation=="function"?h.stopImmediatePropagation():typeof h.stopPropagation=="function"&&h.stopPropagation(),l.current())}return document.addEventListener("keydown",p,!0),function(){document.removeEventListener("keydown",p,!0)}},[e]),y.useEffect(function(){if(!e||!i.current)return;function p(h){if(h.key==="Tab"){var m=i.current.querySelectorAll("button:not([disabled]), a:not([disabled])");if(m.length!==0){var x=m[0],v=m[m.length-1];h.shiftKey?document.activeElement===x&&(h.preventDefault(),v.focus()):document.activeElement===v&&(h.preventDefault(),x.focus())}}}return document.addEventListener("keydown",p),function(){document.removeEventListener("keydown",p)}},[e]),e?a.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:a.jsxs("div",{ref:i,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:[a.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center gap-3",children:[a.jsx("span",{className:"text-2xl",role:"img","aria-hidden":"true",children:"🪙"}),a.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r("credits.limit_reached")})]}),a.jsx("div",{className:"px-5 py-4",children:a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("credits.limit_message")})}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[a.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")}),a.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"),a.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:[a.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"}),a.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 XQ(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 i=Math.floor(r/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function Cv(e,t){if(!e||!t)return!e;const n=String(e).toLowerCase(),r=String(t).toLowerCase();let i=0;for(let o=0;o<r.length&&i<n.length;o+=1)r[o]===n[i]&&(i+=1);return i===n.length}function ZQ(e){return e.source==="tui"?"TUI":e.source==="legacy"?"Legacy":"Web"}function JQ({isOpen:e,onClose:t,onSelectSession:n,onNewChat:r,activeSessionId:i,sessions:o,busySessions:l={}}){const{t:u}=Gt(),[d,f]=y.useState(""),[p,h]=y.useState(0),[m,x]=y.useState(null),[v,k]=y.useState(!1),_=y.useRef(null),S=y.useRef(null),w=y.useRef(null),N=d?d.trim():"";y.useEffect(()=>{if(e){f(""),h(0),x(null),k(!1);const A=requestAnimationFrame(()=>{_.current&&_.current.focus()});return()=>cancelAnimationFrame(A)}},[e]),y.useEffect(()=>{let A=!1;const L=d?d.trim():"";if(w.current&&(clearTimeout(w.current),w.current=null),!e){x(null),k(!1);return}if(L.length<2){x(null),k(!1);return}return x(null),k(!0),w.current=setTimeout(()=>{Wl({q:L,limit:20}).then(D=>{if(A)return;const $=Array.isArray(D)?D:D.sessions||[];x($),k(!1)}).catch(()=>{A||k(!1)})},300),()=>{A=!0,w.current&&(clearTimeout(w.current),w.current=null)}},[d,e]);const R=y.useCallback(A=>{if(!i)return A;const L=A.findIndex(te=>te.id===i);if(L<=0)return A;const D=A.slice(),[$]=D.splice(L,1);return D.unshift($),D},[i]),T=y.useMemo(()=>({id:"__new_chat__",isAction:!0,actionType:"new-chat",title:u("spotlight.new_chat")}),[u]),C=y.useMemo(()=>{const A=o||[],L=!N||Cv(N,"new chat")||Cv(N,u("spotlight.new_chat")),D=V=>L&&r?i&&V.length>0&&V[0].id===i?[V[0],T,...V.slice(1)]:[T,...V]:V;if(!N)return D(R(A.slice(0,10)));const $=A.filter(V=>Cv(N,V.title||""));let te;if(m){const V=new Set($.map(G=>G.id)),z=m.filter(G=>!V.has(G.id));te=$.concat(z).slice(0,20)}else te=$.slice(0,20);return D(R(te))},[N,o,m,R,T,r,u,i]);y.useEffect(()=>{h(0)},[N]),y.useEffect(()=>{h(A=>C.length===0?0:A>=C.length?C.length-1:A)},[C.length]),y.useEffect(()=>{if(!S.current)return;const A=S.current.querySelectorAll('[role="option"]');A[p]&&A[p].scrollIntoView({block:"nearest"})},[p,C.length]);const M=y.useCallback(A=>{if(A&&A.isAction&&A.actionType==="new-chat"){r&&r(),t();return}const L=typeof A=="string"?A:A==null?void 0:A.id;L&&n(L),t()},[n,r,t]),I=y.useCallback(A=>{A.key==="ArrowDown"?(A.preventDefault(),h(L=>C.length===0?0:(L+1)%C.length)):A.key==="ArrowUp"?(A.preventDefault(),h(L=>C.length===0?0:(L-1+C.length)%C.length)):A.key==="Enter"?(A.preventDefault(),C[p]&&M(C[p])):A.key==="Escape"&&(A.preventDefault(),t())},[C,p,M,t]);return e?a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/50",onClick:t,role:"presentation",children:a.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:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":u("spotlight.title"),children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.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:A=>f(A.target.value),onKeyDown:I,"aria-label":u("spotlight.placeholder"),"aria-controls":"spotlight-results","aria-activedescendant":C[p]?"spotlight-item-"+p:void 0,autoComplete:"off",spellCheck:"false"}),a.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"})]}),a.jsxs("div",{id:"spotlight-results",ref:S,role:"listbox","aria-label":u("spotlight.results"),className:"max-h-80 overflow-y-auto",children:[!N&&C.length>0&&a.jsx("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider",children:u("spotlight.recent_sessions")}),C.map((A,L)=>{var D;return A.isAction&&A.actionType==="new-chat"?a.jsxs("div",{id:"spotlight-item-"+L,role:"option","aria-selected":L===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 ${L===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:()=>M(A),children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-sm font-medium truncate",children:A.title})})]},A.id):a.jsxs("div",{id:"spotlight-item-"+L,role:"option","aria-selected":L===p,className:`flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors ${L===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:()=>M(A),children:[a.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:a.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"})}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-sm font-medium truncate",children:A.title||u("spotlight.untitled")})}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l[A.id]&&a.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")}),A.id===i&&a.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")}),a.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:ZQ(A)}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap",children:XQ((D=A.time)==null?void 0:D.updated)})]})]},A.id)}),N&&C.length===0&&!v&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.no_results")}),v&&C.length===0&&a.jsx("div",{className:"px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500",children:u("spotlight.searching")})]}),a.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:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.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:"↑"}),a.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")]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.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")]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.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 eX(e){return typeof e=="string"&&e?e:e&&typeof e=="object"&&e.providerID&&e.modelID?e.providerID+"/"+e.modelID:""}function tX(e){var{t}=Gt(),n=e.session,r=e.directory,[i,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}),aO(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?eX(n.model):"",h=n?n.idleInjection:null,m=h&&h.enabled?h:null,x=n&&n.scheduledInjections?n.scheduledInjections.length:0;return a.jsxs("div",{className:"mt-4 pt-3 border-t border-gray-700",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-gray-400 mb-2",children:t("chat.session_info_title")}),n&&a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_soul")}),n.soul?a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.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:i==="soul"?t("chat.session_info_copied"):n.soul,children:n.soul}),a.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")})]}):a.jsx("div",{className:"text-sm text-gray-500",children:t("chat.session_info_soul_default")}),l&&l.loading&&a.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t("chat.session_info_soul_loading")}),l&&l.error&&a.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&&a.jsxs("div",{className:"mt-1",children:[a.jsx("div",{className:"text-xs text-gray-500 font-mono mb-0.5 truncate",title:l.path,children:l.path+" · "+l.size+" B"}),a.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&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_model")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono",children:p}),n.modelUrl&&a.jsx("div",{className:"text-xs text-gray-500 font-mono mt-0.5 truncate",title:n.modelUrl,children:n.modelUrl})]}),n&&n.reasoning_effort&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_reasoning")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono",children:n.reasoning_effort})]}),m&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_idle_injection")}),a.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&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_scheduled")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono",children:x})]}),r&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400 mb-0.5",children:t("chat.session_info_directory")}),a.jsx("div",{className:"text-sm text-gray-200 font-mono truncate",title:r,children:r})]})]})}const P1="pave_recent_directories",nX=10;function LR(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 i=n.split("/").filter(Boolean);return i.length>4?".../"+i.slice(-2).join("/"):n}function F1(){try{const e=localStorage.getItem(P1);return e?JSON.parse(e):[]}catch{return[]}}function rX(e){try{let t=F1();return t=t.filter(n=>n!==e),t.unshift(e),t=t.slice(0,nX),localStorage.setItem(P1,JSON.stringify(t)),t}catch{return[e]}}function iX(e){try{let t=F1();return t=t.filter(n=>n!==e),localStorage.setItem(P1,JSON.stringify(t)),t}catch{return[]}}function bM({className:e}){return a.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:a.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 aX({isOpen:e,onClose:t,sessionId:n,session:r,currentDirectory:i,homeDir:o,onDirectoryChange:l}){var{t:u}=Gt(),d=y.useRef(null),f=y.useRef(null),[p,h]=y.useState(i||""),[m,x]=y.useState("idle"),[v,k]=y.useState(null),[_,S]=y.useState([]),[w,N]=y.useState(!1),[R,T]=y.useState(!1),[C,M]=y.useState(null),I=y.useRef(null),A=y.useRef(0);y.useEffect(function(){e&&(S(F1()),h(i||""),x("idle"),k(null),M(null))},[e,i]),y.useEffect(function(){e&&d.current&&setTimeout(function(){d.current.focus(),d.current.select()},50)},[e]);var L=y.useCallback(function(H){if(!H||H.trim()===""){x("idle"),k(null);return}I.current&&clearTimeout(I.current),x("checking"),A.current+=1;var se=A.current;I.current=setTimeout(async function(){try{const P=await Lw(H.trim());if(se!==A.current)return;k(P),P.exists&&P.isDirectory?x("valid"):P.exists?(x("error"),k({...P,error:u("chat.working_directory_invalid")})):x("not_found")}catch(P){if(se!==A.current)return;x("error"),k({error:P.message})}},300)},[u]),D=y.useCallback(function(H){var se=H.target.value;h(se),M(null),L(se)},[L]),$=y.useCallback(function(H){h(H),M(null),L(H)},[L]),te=y.useCallback(function(H,se){H.stopPropagation(),S(iX(se))},[]),V=y.useCallback(async function(){if(p.trim()){N(!0),M(null);try{const H=await c3(p.trim());if(H.success)try{const se=await Lw(H.path);x("valid"),k(se)}catch{x("valid"),k({exists:!0,isDirectory:!0,hasAgentsMd:!1,path:H.path})}}catch(H){M(u("chat.working_directory_create_failed",{error:H.message}))}finally{N(!1)}}},[p,u]),z=y.useCallback(async function(){if(!(!p.trim()||m!=="valid")){T(!0),M(null);try{const H=(v==null?void 0:v.path)||p.trim();await yi(n,{directory:H}),S(rX(H)),l&&l(H),t()}catch(H){M(H.message)}finally{T(!1)}}},[p,m,v,n,l,t]);y.useEffect(function(){if(!e)return;function H(se){se.key==="Escape"&&(se.preventDefault(),se.stopPropagation(),t())}return document.addEventListener("keydown",H,!0),function(){document.removeEventListener("keydown",H,!0)}},[e,t]),y.useEffect(function(){if(!e)return;function H(se){se.key==="Enter"&&m==="valid"&&!R&&(se.preventDefault(),z())}return document.addEventListener("keydown",H),function(){document.removeEventListener("keydown",H)}},[e,m,R,z]),y.useEffect(function(){return function(){I.current&&clearTimeout(I.current)}},[]);var G=y.useMemo(function(){return LR(i,o)},[i,o]);if(!e)return null;var K=null;return m==="checking"?K=a.jsxs("p",{className:"text-xs text-gray-400 mt-1 flex items-center",children:[a.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?K=a.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"?K=a.jsxs("p",{className:"text-xs text-yellow-500 mt-1",children:["⚠ ",u("chat.working_directory_not_found")]}):m==="error"&&(v!=null&&v.error)&&(K=a.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["✕ ",v.error]})),a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(H){H.target===H.currentTarget&&t()},children:a.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:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(bM,{className:"w-5 h-5 text-gray-400"}),a.jsx("h2",{id:"directory-modal-title",className:"text-lg font-semibold text-gray-100",children:u("chat.working_directory")})]}),a.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":u("common.close"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_current")}),a.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:i,children:G||i||u("chat.working_directory_not_set")})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"directory-input",className:"block text-sm font-medium text-gray-400 mb-1",children:u("chat.working_directory_new_path")}),a.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"}),K]}),C&&a.jsx("p",{className:"text-sm text-red-500",children:C}),_.length>0&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:u("chat.working_directory_recent")}),a.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:_.map(function(H){return a.jsxs("div",{onClick:function(){$(H)},className:"flex items-center justify-between px-3 py-2 bg-gray-900 rounded cursor-pointer hover:bg-gray-700 transition-colors group",children:[a.jsx("span",{className:"text-sm text-gray-200 font-mono truncate flex-1",title:H,children:LR(H,o)}),a.jsx("button",{onClick:function(se){te(se,H)},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:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},H)})})]}),a.jsx(tX,{session:r,directory:G||i||""})]}),a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-700 bg-gray-800/50",children:[a.jsx("div",{children:m==="not_found"&&a.jsx("button",{onClick:V,disabled:w,className:"px-3 py-1.5 text-sm font-medium text-yellow-400 border border-yellow-500/50 rounded hover:bg-yellow-500/10 transition-colors disabled:opacity-50",children:w?"...":u("chat.working_directory_create")})}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.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")}),a.jsx("button",{onClick:z,disabled:m!=="valid"||R,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:R?"...":u("chat.working_directory_change")})]})]})]})})}function sX({isOpen:e,directory:t,defaultDirectory:n,error:r,onChoice:i,onClose:o}){const{t:l}=Gt(),[u,d]=y.useState("");y.useEffect(()=>{e&&d(typeof t=="string"?t:"")},[e,t]);const f=y.useCallback(h=>{if(!(!h||typeof h!="object")){if(h.mode==="path"){const m=typeof h.path=="string"?h.path.trim():"";if(!m)return;i({mode:"path",path:m});return}i(h)}},[i]);if(!e)return null;const p=typeof u=="string"?u.trim():"";return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:function(h){h.target===h.currentTarget&&o()},children:a.jsxs("div",{className:"bg-gray-800 rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden",role:"dialog","aria-modal":"true","aria-labelledby":"session-directory-dialog-title",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-700",children:[a.jsx("h2",{id:"session-directory-dialog-title",className:"text-lg font-semibold text-gray-100",children:l("import.directory_missing",{directory:t||""})}),a.jsx("button",{type:"button",onClick:o,className:"text-gray-400 hover:text-gray-200 transition-colors","aria-label":l("common.close"),children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-4 space-y-4",children:[r&&a.jsx("p",{className:"text-sm text-red-500",children:l("import.directory_invalid",{message:r})}),n&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:l("chat.working_directory")}),a.jsx("p",{className:"text-sm text-gray-200 font-mono bg-gray-900 px-3 py-2 rounded",title:n,children:n})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"session-directory-path",className:"block text-sm font-medium text-gray-400 mb-1",children:l("chat.working_directory_new_path")}),a.jsx("input",{id:"session-directory-path",type:"text",value:u,onChange:function(h){d(h.target.value)},onKeyDown:function(h){h.key==="Enter"&&f({mode:"path",path:p})},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:l("chat.working_directory_placeholder"),autoComplete:"off",spellCheck:"false"})]}),a.jsxs("div",{className:"flex flex-col space-y-2",children:[a.jsx("button",{type:"button",onClick:function(){f({mode:"create"})},className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded hover:bg-blue-700 transition-colors",children:l("import.directory_create")}),a.jsx("button",{type:"button",onClick:function(){f({mode:"default"})},className:"px-4 py-2 text-sm font-medium text-gray-300 border border-gray-600 rounded hover:bg-gray-700 transition-colors",children:l("import.directory_use_default")}),a.jsx("button",{type:"button",disabled:!p,onClick:function(){f({mode:"path",path:p})},className:"px-4 py-2 text-sm font-medium text-gray-300 border border-gray-600 rounded hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:l("import.directory_choose")})]})]})]})})}var yr={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 oX(e){if(e==null||e==="")return"";var t=Number(e);return isNaN(t)?"":String(t)}function jf(e){if(e==null||e==="")return"";var t=Number(e)/1e3;return isNaN(t)?"":String(t)}function Tf(e){var t=parseFloat(e);return isNaN(t)||t<0?0:Math.round(t*1e3)}function zl(e){var t=e.children;return a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 leading-snug",children:t})}function lX(e){var t=e.isOpen,n=e.onClose,r=e.sessionId,i=Gt().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],h=y.useState(!1),m=h[0],x=h[1],v=y.useState(null),k=v[0],_=v[1],S=y.useState(null),w=S[0],N=S[1],R=y.useState(yr.enabled),T=R[0],C=R[1],M=y.useState(yr.message),I=M[0],A=M[1],L=y.useState(String(yr.intervalMs)),D=L[0],$=L[1],te=y.useState(String(yr.maxInjections)),V=te[0],z=te[1],G=y.useState(yr.timeout.enabled),K=G[0],H=G[1],se=y.useState(String(yr.timeout.thresholdMs)),P=se[0],W=se[1],ee=y.useState(String(yr.timeout.cooldownMs)),F=ee[0],J=ee[1],q=y.useState(yr.mode),Y=q[0],oe=q[1],_e=y.useState(String(yr.waitMs)),ae=_e[0],ye=_e[1],Fe=y.useRef(null),ct=y.useState([]),ht=ct[0],pt=ct[1],et=y.useState(!1),ze=et[0],Be=et[1],At=y.useState(!1),lt=At[0],on=At[1],_t=y.useState("9"),gn=_t[0],Ht=_t[1],Kt=y.useState("0"),ut=Kt[0],Pe=Kt[1],le=y.useState("AM"),be=le[0],fe=le[1],Oe=y.useState("weekdays"),ft=Oe[0],gt=Oe[1],dt=y.useState([1,2,3,4,5]),Lt=dt[0],Wt=dt[1],rt=y.useState(""),wt=rt[0],Yt=rt[1],an="";try{an=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{}y.useEffect(function(){return function(){Fe.current&&clearTimeout(Fe.current)}},[]);var kt=y.useCallback(function(){r&&(p(!0),_(null),EA(r).then(function(Me){var Et=Me&&Me.config?Me.config:yr;u(Et),C(Et.enabled||!1),A(Et.message||yr.message),$(jf(Et.intervalMs!=null?Et.intervalMs:yr.intervalMs)),z(oX(Et.maxInjections!=null?Et.maxInjections:yr.maxInjections)),H(Et.timeout?Et.timeout.enabled:yr.timeout.enabled),W(jf(Et.timeout&&Et.timeout.thresholdMs!=null?Et.timeout.thresholdMs:yr.timeout.thresholdMs)),J(jf(Et.timeout&&Et.timeout.cooldownMs!=null?Et.timeout.cooldownMs:yr.timeout.cooldownMs)),oe(Et.mode||yr.mode),ye(jf(Et.waitMs!=null?Et.waitMs:yr.waitMs))}).catch(function(Me){_(Me.message||"Failed to load config")}).finally(function(){p(!1)}))},[r]);y.useEffect(function(){t&&kt()},[t,kt]);var xe=y.useCallback(function(){r&&yO(r).then(function(Me){pt(Me&&Me.schedules?Me.schedules:[])}).catch(function(){pt([])})},[r]);y.useEffect(function(){t&&xe()},[t,xe]),y.useEffect(function(){if(!t)return;function Me(Et){Et.key==="Escape"&&n()}return document.addEventListener("keydown",Me),function(){document.removeEventListener("keydown",Me)}},[t,n]);function De(){if(r){x(!0),_(null),N(null);var Me={enabled:T,message:I.trim()||yr.message,intervalMs:Tf(D)||yr.intervalMs,maxInjections:parseInt(V,10)||0,mode:Y||yr.mode,waitMs:Tf(ae),timeout:{enabled:K,thresholdMs:Tf(P)||yr.timeout.thresholdMs,cooldownMs:Tf(F)||yr.timeout.cooldownMs}};mO(r,Me).then(function(){u(Me),N(i("chat.idle_injection_saved")),Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout(function(){N(null)},3e3)}).catch(function(Et){_(Et.message||"Failed to save")}).finally(function(){x(!1)})}}function Ke(){r&&(x(!0),_(null),N(null),xO(r).then(function(){C(!1),u(null)}).catch(function(Me){_(Me.message||"Failed to disable")}).finally(function(){x(!1)}))}function X(Me,Et){var kn=parseInt(Me,10);return Et==="PM"&&kn!==12&&(kn+=12),Et==="AM"&&kn===12&&(kn=0),kn}function Ee(Me){return Me===0?{h:12,ap:"AM"}:Me<12?{h:Me,ap:"AM"}:Me===12?{h:12,ap:"PM"}:{h:Me-12,ap:"PM"}}function Te(Me,Et){return Me==="every_day"?[0,1,2,3,4,5,6]:Me==="weekdays"?[1,2,3,4,5]:Me==="weekends"?[0,6]:Et.slice().sort()}function mt(Me){var Et=Ee(Me.hour),kn=String(Me.minute).padStart(2,"0");return Et.h+":"+kn+" "+Et.ap}function Ut(Me){var Et=Me.daysOfWeek||[],kn="";if(Et.length===7)kn=i("scheduled_injection.repeat_every_day");else if(Et.length===5&&Et.indexOf(1)!==-1&&Et.indexOf(5)!==-1)kn=i("scheduled_injection.repeat_weekdays");else if(Et.length===2&&Et.indexOf(0)!==-1&&Et.indexOf(6)!==-1)kn=i("scheduled_injection.repeat_weekends");else{for(var Wn=["day_sun","day_mon","day_tue","day_wed","day_thu","day_fri","day_sat"],ki=[],kr=0;kr<7;kr++)Et.indexOf(kr)!==-1&&ki.push(i("scheduled_injection."+Wn[kr]));kn=ki.join(", ")}return Me.timezone&&(kn+=" ("+Me.timezone+")"),kn}function Rt(){if(r){on(!0),_(null);var Me={hour:X(gn,be),minute:parseInt(ut,10),daysOfWeek:Te(ft,Lt),timezone:an||null,message:wt.trim(),enabled:!0};bO(r,Me).then(function(){Be(!1),Yt(""),xe()}).catch(function(Et){_(Et.message||i("scheduled_injection.error_generic"))}).finally(function(){on(!1)})}}function st(Me,Et){r&&vO(r,Me,{enabled:!Et}).then(function(){xe()}).catch(function(kn){_(kn.message||"Failed to toggle schedule")})}function ve(Me){r&&kO(r,Me).then(function(){xe()}).catch(function(Et){_(Et.message||"Failed to delete schedule")})}function Re(Me){var Et=Lt.indexOf(Me);Wt(Et===-1?Lt.concat([Me]):Lt.filter(function(kn){return kn!==Me}))}if(!t)return null;var Xe="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",Ie="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",ie="space-y-3",Ct=function(Me){return"relative inline-flex h-6 w-11 items-center rounded-full transition-colors "+(Me?"bg-primary-600":"bg-gray-300 dark:bg-gray-700")},mn=function(Me){return"inline-block h-4 w-4 transform rounded-full bg-white transition-transform "+(Me?"translate-x-6":"translate-x-1")};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n,"aria-hidden":"true"}),a.jsxs("aside",{ref:o,className:"fixed right-0 top-0 bottom-0 z-50 w-96 max-w-[90vw] bg-white dark:bg-gray-950 shadow-xl border-l border-gray-200 dark:border-gray-800 flex flex-col",role:"dialog","aria-label":i("chat.idle_injection_title"),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("chat.idle_injection_title")}),a.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":i("common.close"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-5",children:f?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-primary-500 border-t-transparent rounded-full"})}):a.jsxs(a.Fragment,{children:[k&&a.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}),w&&a.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:w}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_toggle")}),a.jsx("button",{type:"button",onClick:function(){C(!T)},className:Ct(T),"aria-pressed":T,"aria-label":i("chat.idle_injection_toggle"),children:a.jsx("span",{className:mn(T)})})]}),a.jsxs("div",{className:ie,children:[a.jsx("label",{className:Xe,htmlFor:"ii-message",children:i("chat.idle_injection_message")}),a.jsx("textarea",{id:"ii-message",value:I,onChange:function(Me){A(Me.target.value)},className:Ie+" resize-none",rows:3,placeholder:i("chat.idle_injection_message_placeholder"),disabled:!T})]}),a.jsxs("div",{className:ie,children:[a.jsx("label",{className:Xe,htmlFor:"ii-interval",children:i("chat.idle_injection_interval")}),a.jsx("input",{id:"ii-interval",type:"number",value:D,onChange:function(Me){$(Me.target.value)},className:Ie,min:.5,step:.5,disabled:!T}),a.jsx(zl,{children:i("chat.idle_injection_interval_desc")})]}),a.jsxs("div",{className:ie,children:[a.jsx("label",{className:Xe,htmlFor:"ii-max",children:i("chat.idle_injection_max")}),a.jsx("input",{id:"ii-max",type:"number",value:V,onChange:function(Me){z(Me.target.value)},className:Ie,min:0,disabled:!T}),a.jsx(zl,{children:i("chat.idle_injection_max_desc")})]}),a.jsxs("div",{className:ie,children:[a.jsx("label",{className:Xe,htmlFor:"ii-mode",children:i("chat.idle_injection_mode")}),a.jsxs("select",{id:"ii-mode",value:Y,onChange:function(Me){oe(Me.target.value)},className:Ie,disabled:!T,children:[a.jsx("option",{value:"urgent",children:i("chat.idle_injection_mode_urgent")}),a.jsx("option",{value:"normal",children:i("chat.idle_injection_mode_normal")}),a.jsx("option",{value:"idle",children:i("chat.idle_injection_mode_idle")})]}),a.jsx(zl,{children:i("chat.idle_injection_mode_desc")})]}),Y==="idle"&&a.jsxs("div",{className:ie,children:[a.jsx("label",{className:Xe,htmlFor:"ii-wait",children:i("chat.idle_injection_wait_ms")}),a.jsx("input",{id:"ii-wait",type:"number",value:ae,onChange:function(Me){ye(Me.target.value)},className:Ie,min:0,step:.5,disabled:!T}),a.jsx(zl,{children:i("chat.idle_injection_wait_ms_desc")})]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("chat.idle_injection_timeout_toggle")}),a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("chat.idle_injection_timeout_toggle_desc")})]}),a.jsx("button",{type:"button",onClick:function(){H(!K)},className:Ct(K),"aria-pressed":K,"aria-label":i("chat.idle_injection_timeout_toggle"),disabled:!T,children:a.jsx("span",{className:mn(K)})})]}),a.jsxs("div",{className:ie,children:[a.jsx("label",{className:Xe,htmlFor:"ii-threshold",children:i("chat.idle_injection_timeout_threshold")}),a.jsx("input",{id:"ii-threshold",type:"number",value:P,onChange:function(Me){W(Me.target.value)},className:Ie,min:1,step:.5,disabled:!T||!K}),a.jsx(zl,{children:i("chat.idle_injection_timeout_threshold_desc")})]}),a.jsxs("div",{className:ie,children:[a.jsx("label",{className:Xe,htmlFor:"ii-cooldown",children:i("chat.idle_injection_timeout_cooldown")}),a.jsx("input",{id:"ii-cooldown",type:"number",value:F,onChange:function(Me){J(Me.target.value)},className:Ie,min:.5,step:.5,disabled:!T||!K}),a.jsx(zl,{children:i("chat.idle_injection_timeout_cooldown_desc")})]}),a.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 pt-4"}),a.jsxs("div",{className:ie,children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:i("scheduled_injection.title")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:i("scheduled_injection.subtitle")})]}),ht.length===0&&!ze&&a.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:i("scheduled_injection.empty")}),ht.map(function(Me){return a.jsxs("div",{className:"rounded-lg border p-2.5 space-y-1 "+(Me.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:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:mt(Me)}),a.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:Ut(Me)})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:function(){st(Me.id,Me.enabled)},className:Ct(Me.enabled),"aria-pressed":Me.enabled,"aria-label":i("scheduled_injection.enabled"),children:a.jsx("span",{className:mn(Me.enabled)})}),a.jsx("button",{type:"button",onClick:function(){ve(Me.id)},className:"p-1 rounded text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors","aria-label":i("scheduled_injection.delete"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})})]})]}),Me.message&&a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic truncate",children:['"',Me.message,'"']})]},Me.id)}),ze?a.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:[a.jsxs("div",{children:[a.jsx("label",{className:Xe,children:i("scheduled_injection.time")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("select",{value:gn,onChange:function(Me){Ht(Me.target.value)},className:Ie+" w-20",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(function(Me){return a.jsx("option",{value:String(Me),children:Me},Me)})}),a.jsx("span",{className:"text-gray-500",children:":"}),a.jsxs("select",{value:ut,onChange:function(Me){Pe(Me.target.value)},className:Ie+" w-20",children:[a.jsx("option",{value:"0",children:"00"}),a.jsx("option",{value:"15",children:"15"}),a.jsx("option",{value:"30",children:"30"}),a.jsx("option",{value:"45",children:"45"})]}),a.jsxs("select",{value:be,onChange:function(Me){fe(Me.target.value)},className:Ie+" w-20",children:[a.jsx("option",{value:"AM",children:"AM"}),a.jsx("option",{value:"PM",children:"PM"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:Xe,children:i("scheduled_injection.repeat")}),a.jsxs("select",{value:ft,onChange:function(Me){gt(Me.target.value)},className:Ie,children:[a.jsx("option",{value:"every_day",children:i("scheduled_injection.repeat_every_day")}),a.jsx("option",{value:"weekdays",children:i("scheduled_injection.repeat_weekdays")}),a.jsx("option",{value:"weekends",children:i("scheduled_injection.repeat_weekends")}),a.jsx("option",{value:"custom",children:i("scheduled_injection.repeat_custom")})]})]}),ft==="custom"&&a.jsx("div",{children:a.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(Me){var Et=Lt.indexOf(Me.d)!==-1;return a.jsx("button",{type:"button",onClick:function(){Re(Me.d)},className:"px-2.5 py-1 rounded-md text-xs font-medium transition-colors "+(Et?"bg-primary-600 text-white":"bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-300 dark:hover:bg-gray-700"),children:i("scheduled_injection."+Me.k)},Me.d)})})}),an&&a.jsxs("div",{children:[a.jsx("label",{className:Xe,children:i("scheduled_injection.timezone")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:an})]}),a.jsxs("div",{children:[a.jsx("label",{className:Xe,children:i("scheduled_injection.message")}),a.jsx("textarea",{value:wt,onChange:function(Me){Yt(Me.target.value)},className:Ie+" resize-none",rows:2,placeholder:i("scheduled_injection.message_placeholder")})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:Rt,disabled:lt||ft==="custom"&&Lt.length===0,className:"flex-1 px-3 py-1.5 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i(lt?"scheduled_injection.saving":"scheduled_injection.save")}),a.jsx("button",{type:"button",onClick:function(){Be(!1)},disabled:lt,className:"px-3 py-1.5 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:i("common.close")})]})]}):a.jsxs("button",{type:"button",onClick:function(){Be(!0)},className:"w-full px-3 py-2 rounded-lg border border-dashed border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 text-sm hover:border-primary-400 hover:text-primary-600 dark:hover:text-primary-400 transition-colors",children:["+ ",i("scheduled_injection.add")]})]})]})}),!f&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-800 shrink-0",children:[a.jsx("button",{onClick:De,disabled:m,className:"flex-1 px-4 py-2 rounded-lg bg-primary-600 text-white text-sm font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i(m?"chat.idle_injection_saving":"chat.idle_injection_save")}),a.jsx("button",{onClick:Ke,disabled:m||!T,className:"px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium hover:bg-gray-300 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:i(m?"chat.idle_injection_disabling":"chat.idle_injection_disable")})]})]})]})}function cX({items:e,sessionId:t,isReadOnly:n,onReorder:r,onCancelItem:i,onEditItem:o,t:l}){var[u,d]=y.useState(null),[f,p]=y.useState(null),h=y.useRef(0),m=y.useCallback(function(w,N){if(e[N]&&e[N].status==="dispatching"){w.preventDefault();return}d(N),w.dataTransfer.effectAllowed="move";try{w.dataTransfer.setData("text/plain",String(N))}catch{}},[e]),x=y.useCallback(function(w,N){w.preventDefault(),h.current++,e[N]&&e[N].status!=="dispatching"&&p(N)},[e]),v=y.useCallback(function(w,N){w.preventDefault(),w.dataTransfer.dropEffect="move"},[]),k=y.useCallback(function(){h.current--,h.current<=0&&(h.current=0,p(null))},[]),_=y.useCallback(function(w,N){if(w.preventDefault(),h.current=0,p(null),u===null||u===N){d(null);return}var R=e.slice(),T=R.splice(u,1)[0];R.splice(N,0,T),d(null);var C=R.filter(function(M){return M.status!=="dispatching"}).map(function(M){return M.id});r(C)},[u,e,r]),S=y.useCallback(function(){d(null),p(null),h.current=0},[]);return!e||e.length===0?null:a.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:[a.jsxs("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400",children:[l("chat.queued")," (",e.length,")"]}),e.map(function(w,N){var R=w.status==="dispatching",T=u===N,C=f===N&&u!==N,M=!R&&!n;return a.jsxs("div",{draggable:M,onDragStart:M?function(I){m(I,N)}:void 0,onDragEnter:M?function(I){x(I,N)}:void 0,onDragOver:M?function(I){v(I,N)}:void 0,onDragLeave:M?k:void 0,onDrop:M?function(I){_(I,N)}:void 0,onDragEnd:M?S:void 0,className:"flex items-center justify-between gap-2 px-2 py-1 rounded border text-sm group transition-colors duration-150 "+(R?"border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 opacity-50 ":"border-dashed border-gray-300 dark:border-gray-700 ")+(T?"opacity-40 bg-gray-200 dark:bg-gray-700 ":"")+(C?"border-solid border-accent-400 dark:border-accent-500 bg-accent-50 dark:bg-accent-900/20 ":"")+(M?"cursor-grab active:cursor-grabbing ":""),children:[M&&a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8h16M4 16h16"})}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 cursor-pointer",role:"button",tabIndex:0,onClick:function(){o(w)},onKeyDown:function(I){(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),o(w))},title:l("chat.edit_queued"),"aria-label":l("chat.edit_queued"),children:[a.jsx("span",{className:"text-[10px] uppercase px-1 rounded bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:w.source||"queued"}),w.priority==="urgent"&&a.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"}),a.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:w.displayContent||w.text||""}),!R&&!n&&a.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:a.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"})})]}),!R&&!n&&a.jsx("button",{type:"button",onClick:function(I){I.stopPropagation(),i(w.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:"×"})]},w.id)})]})}const OR="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 uX({rect:e,onQuote:t,onCopy:n,onDismiss:r,label:i,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 jk.createPortal(a.jsxs("div",{style:d,className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button","data-testid":"quote-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:t,"aria-label":i,title:i,className:OR,children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 7h4v4a5 5 0 01-5 5V7zm9 0h4v4a5 5 0 01-5 5V7z"})}),i]}),a.jsxs("button",{type:"button","data-testid":"copy-selection-button",onMouseDown:function(f){f.preventDefault()},onClick:n,"aria-label":o,title:o,className:OR,children:[a.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.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 dX(e){if(!e||typeof e!="string")return[];const t=[],n=e.split(`
|
|
123
|
+
`);for(let r=0;r<n.length;r++){const i=n[r].trim();if(i)try{t.push(JSON.parse(i))}catch{}}return t.sort((r,i)=>(r.seq||0)-(i.seq||0)),t}function Wu(e){return!!e&&typeof e=="object"&&typeof e.$ref=="string"}function ec(e){if(!Wu(e))return null;const t=/(\d+)/.exec(e.$ref);return t?Number(t[1]):null}function fX(e){const t=[],n=new Map;let r=null,i=null;for(const u of e)switch(u.type){case"context":r=u;break;case"store_snapshot":i=u;break;case"request":{const d={seq:u.seq,ts:u.ts,provider:u.provider,model:u.model,url:u.url,headers:u.headers||{},body:u.body,params:u.params||{},sentEstTokens:u.estWireTokens,bodyBytes:u.bodyBytes,shrink:u.shrink||null,fingerprint:u.fingerprint||u.cache&&u.cache.fingerprint||null,cache:u.cache||null,chunks:[],response:null,context:null,store:null,bubbleMessageID:null,compaction:null,messageDrop:null};r&&(r.reqSeq==null||r.reqSeq===u.seq)&&(d.context=r,r=null),i&&(i.reqSeq==null||i.reqSeq===u.seq)&&(d.store=i,i=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=pX(u)}return t}function pX(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 hX(e){const t=[];let n=null,r=null;for(const i of e)(n===null||r==="stop"||r==="error")&&(n={index:t.length,requests:[]},t.push(n)),n.requests.push(i),r=i.finishReason;return t}function gX(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 mX(e){return e.filter(t=>t.type==="compaction")}function xX(e){return e.filter(t=>t.type==="message_drop")}function yX(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),i=n(t),o=f=>{const p={};for(const h of f){const m=h&&h.role||"?";p[m]=(p[m]||0)+1}return p},l=o(r),u=o(i),d=[];for(const f of new Set([...Object.keys(l),...Object.keys(u)])){const p=l[f]||0,h=u[f]||0;p!==h&&d.push({role:f,before:p,after:h,delta:p-h})}return d.sort((f,p)=>p.delta-f.delta),{prevLen:r.length,currLen:i.length,roles:d}}function bX(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=[],i=n&&n.choices&&n.choices[0]&&n.choices[0].delta;if(i){const o=i.reasoning_content??i.reasoning??i.thinking;if(o!=null&&o!==""&&r.push({type:"reasoning",piece:o}),i.content!=null&&i.content!==""&&r.push({type:"text",piece:i.content}),i.tool_calls&&i.tool_calls.length){const u=(i.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 DR(e){try{return JSON.stringify(e)}catch{return String(e)}}function PR(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 vX(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[],i=r.length&&r[0]&&r[0].role==="system"?r.slice(1):r.slice(),o=Math.max(n.length,i.length),l=[];let u=-1,d=1;for(let f=0;f<o;f++){const p=f<n.length?n[f]:void 0,h=f<i.length?i[f]:void 0,m=p===void 0?void 0:DR(p),x=h===void 0?void 0:DR(h),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 S="unchanged";if(p===void 0)S="added";else if(h===void 0)S="dropped";else if(_){const w=p.role||h.role;k<v?w==="tool"?S="tool output stubbed":PR(p)&&!PR(h)?S="reasoning stripped":S="text capped":S="changed"}_&&u<0&&(u=f),l.push({i:f,role:(p||h||{}).role||"?",beforeBytes:v,afterBytes:k,changed:_,tag:S})}return{rows:l,firstChanged:u,maxBytes:d}}function kX(e){const t=typeof e=="string"?dX(e):Array.isArray(e)?e:[],n=fX(t),r=hX(n),i=gX(n),o=mX(t),l=xX(t);return{events:t,requests:n,turns:r,timeline:i,compactions:o,messageDrops:l}}function Uf(e,t){if(e==null)return"(none)";if(e&&typeof e=="object"&&typeof e.$ref=="string"){const n=ec(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 _X(e){return e?Object.keys(e).map(t=>`${t}=${typeof e[t]=="object"?JSON.stringify(e[t]):e[t]}`).join(" "):""}function vM(e,t){const n=[];n.push(`--- Request #${e.seq} [${e.purpose}] ${e.provider||"?"}/${e.model||"?"} ---`),e.url&&n.push(`url: ${e.url}`);const r=_X(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(Uf(e.headers,t)),n.push("REQUEST BODY (exact bytes sent):"),n.push(Uf(e.body,t)),e.response){const i=e.response.assembled;n.push("RESPONSE (assembled):"),i&&typeof i=="object"&&i.$ref?n.push(Uf(i,t)):i&&(i.reasoning&&n.push(`reasoning: ${i.reasoning}`),n.push(`text: ${i.text||""}`),i.tool_calls&&i.tool_calls.length&&n.push(`tool_calls: ${JSON.stringify(i.tool_calls)}`))}if(e.context){const i=e.context;n.push(`CONTEXT: limit=${i.limit} usable=${i.usable} margin=${i.margin} threshold=${i.threshold} tokReal=${i.tokReal} needsCompaction=${i.needsCompaction} source=${i.source??""} windowSource=${i.windowSource??i.epmWindowSignal??""}`)}if(e.compaction){const i=e.compaction,o=[`COMPACTION [${i.trigger}]`];i.deletedMessages!=null&&o.push(`deleted=${i.deletedMessages}`),i.summaryTokens!=null&&o.push(`summaryTok=${i.summaryTokens}`),i.before!=null&&o.push(`before=${i.before}`),i.after!=null&&o.push(`after=${i.after}`),typeof i.handoffFresh=="boolean"&&o.push(`handoffFresh=${i.handoffFresh}`),n.push(o.join(" "))}if(e.messageDrop){const i=e.messageDrop;n.push(`⚠ MESSAGE DROP wire ${i.wireBefore}→${i.wireAfter} (vs req #${i.prevSeq}, no compaction`+(i.storeMessages!=null?`, store intact=${i.storeMessages}`:"")+")")}return n.join(`
|
|
124
|
+
`)}function kM(e){const t=[`--- Chunks for request #${e.seq} (${e.chunkCount}) ---`],n=e.ts;for(let r=0;r<e.chunks.length;r++){const i=e.chunks[r],o=r===0?n!=null?i.ts-n:0:i.ts-e.chunks[r-1].ts;t.push(`[+${o}ms]${i.kind?" ("+i.kind+")":""} ${i.raw}`)}return t.join(`
|
|
125
|
+
`)}function wX(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(Uf(n,t)):n&&(n.reasoning&&r.push(`reasoning:
|
|
126
|
+
${n.reasoning}`),r.push(`text:
|
|
127
|
+
${n.text||""}`),n.tool_calls&&n.tool_calls.length&&r.push(`tool_calls:
|
|
128
|
+
${JSON.stringify(n.tool_calls,null,2)}`)),e.response.usage&&r.push(`usage: ${JSON.stringify(e.response.usage)}`),r.join(`
|
|
129
|
+
`)}function FR(e,t,n){const{requests:r,timeline:i,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(vM(p,n)),p.chunkCount&&(u.push(`CHUNKS (${p.chunkCount}):`),u.push(kM(p))),u.push("");u.push("TIMELINE:"),u.push("seq store sent_est sent_actual threshold compaction");for(const p of i)u.push(`${p.seq} ${p.storeTokens??""} ${p.sentEst??""} ${p.sentActual??""} ${p.threshold??""} ${p.compactionMarker?"YES":""}`);return u.join(`
|
|
130
|
+
`)}function SX(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 i=ec(r);i!=null&&t.add(i)}return Array.from(t)}function ho(e){return e==null?"—":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e)}const Rf=[{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."}],BR=[{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 EX({timeline:e,selectedSeq:t,onSelectSeq:n,height:r=240}){const[i,o]=y.useState(null),[l,u]=y.useState("data"),[d,f]=y.useState(!1),p=y.useRef(null),[h,m]=y.useState(720);y.useEffect(()=>{const M=p.current;if(!M||typeof ResizeObserver>"u")return;const I=new ResizeObserver(A=>{const L=A[0]&&A[0].contentRect&&A[0].contentRect.width;L&&L>0&&m(Math.round(L))});return I.observe(M),()=>I.disconnect()},[]);const x={top:16,right:116,bottom:34,left:56},v=Math.max(1,h-x.left-x.right),k=Math.max(1,r-x.top-x.bottom),_=Array.isArray(e)?e:[],S=y.useMemo(()=>{if(_.length===0)return 1;let M=0;for(const I of _){for(const A of Rf)I[A.key]!=null&&(M=Math.max(M,I[A.key]));I.threshold!=null&&(M=Math.max(M,I.threshold)),l==="window"&&(I.usable!=null&&(M=Math.max(M,I.usable)),I.limit!=null&&(M=Math.max(M,I.limit)))}return Math.max(1,Math.ceil(M*1.12))},[_,l]);if(_.length===0)return a.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 w=M=>x.left+(_.length===1?v/2:M/(_.length-1)*v),N=M=>x.top+k-Math.min(M,S)/S*k,R=M=>{const I=[];let A=!1;return _.forEach((L,D)=>{if(L[M]==null){A=!1;return}I.push(`${A?"L":"M"} ${w(D).toFixed(1)} ${N(L[M]).toFixed(1)}`),A=!0}),I.join(" ")},T=()=>{const M=[];let I=[];const A=()=>{if(I.length){const L=I.map($=>`${w($).toFixed(1)} ${N(_[$].storeTokens).toFixed(1)}`),D=I.slice().reverse().map($=>`${w($).toFixed(1)} ${N(_[$].sentActual).toFixed(1)}`);M.push("M "+L.join(" L ")+" L "+D.join(" L ")+" Z")}I=[]};return _.forEach((L,D)=>{L.storeTokens!=null&&L.sentActual!=null&&L.storeTokens>L.sentActual?I.push(D):A()}),A(),M.join(" ")},C=[0,.25,.5,.75,1].map(M=>Math.round(S*M));return a.jsxs("div",{ref:p,className:"relative",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1 px-1",children:[a.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Context timeline — store vs sent"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>f(M=>!M),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"}),a.jsxs("button",{type:"button",onClick:()=>u(M=>M==="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&&a.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:[a.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: ",a.jsx("b",{children:"store"})," = the full persisted history (grows every response, drops at compaction). ",a.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.)"]}),Rf.map(M=>a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 h-0.5 mt-1.5 shrink-0",style:{background:M.stroke}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:M.label})," ",a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",M.desc]})]})]},M.key)),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 h-2 mt-0.5 rounded-xs shrink-0",style:{background:"#10b981",opacity:.25}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"trimmed"})," ",a.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."})]})]}),BR.map(M=>a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:M.stroke}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:M.label})," ",a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["— ",M.desc]})]})]},M.key)),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"inline-block w-4 border-t border-dashed mt-1.5 shrink-0",style:{borderColor:"#d946ef"}}),a.jsxs("span",{children:[a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:"compact"})," ",a.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"— a compaction ran at this request (vertical marker)."})]})]})]}),a.jsxs("svg",{width:"100%",height:r,viewBox:`0 0 ${h} ${r}`,preserveAspectRatio:"xMidYMid meet",className:"overflow-visible select-none block",onMouseLeave:()=>o(null),children:[C.map((M,I)=>{const A=N(M);return a.jsxs("g",{children:[a.jsx("line",{x1:x.left,y1:A,x2:h-x.right,y2:A,stroke:"currentColor",strokeOpacity:.08,className:"text-gray-500"}),a.jsx("text",{x:x.left-6,y:A,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:ho(M)})]},"yt"+I)}),a.jsx("path",{d:T(),fill:"#10b981",fillOpacity:.1,stroke:"none",pointerEvents:"none"}),BR.map(M=>{const I=_[_.length-1],A=I&&I[M.key];if(A==null||A>S)return null;const L=N(A);return a.jsxs("g",{children:[a.jsx("line",{x1:x.left,y1:L,x2:h-x.right,y2:L,stroke:M.stroke,strokeOpacity:.5,strokeDasharray:"2 4"}),a.jsxs("text",{x:h-x.right+4,y:L,dominantBaseline:"middle",className:"text-[9px]",fill:M.stroke,fillOpacity:.9,children:[M.label," ",ho(A)]})]},"ref"+M.key)}),_.map((M,I)=>M.compactionMarker?a.jsxs("g",{children:[a.jsx("line",{x1:w(I),y1:x.top,x2:w(I),y2:x.top+k,stroke:"#d946ef",strokeOpacity:.7,strokeDasharray:"3 3",strokeWidth:1.5}),a.jsx("text",{x:w(I),y:x.top-4,textAnchor:"middle",className:"text-[8px] font-semibold",fill:"#d946ef",children:"compact"})]},"cm"+I):null),Rf.map(M=>a.jsx("path",{d:R(M.key),fill:"none",stroke:M.stroke,strokeWidth:2,strokeDasharray:M.dash||void 0,strokeLinejoin:"round",strokeLinecap:"round"},M.key)),_.map((M,I)=>{const A=w(I),L=t!=null&&M.seq===t;return a.jsxs("g",{children:[Rf.map(D=>M[D.key]!=null?a.jsx("circle",{cx:A,cy:N(M[D.key]),r:L?3.5:2.5,fill:D.stroke,stroke:"white",strokeWidth:L?1:.5,className:"dark:stroke-gray-950"},D.key):null),a.jsx("rect",{x:A-Math.max(6,v/_.length/2),y:x.top,width:Math.max(12,v/_.length),height:k,fill:L?"#0ea5e9":"transparent",fillOpacity:L?.06:0,className:"cursor-pointer",onMouseEnter:()=>o(I),onClick:()=>n&&n(M.seq)}),a.jsxs("text",{x:A,y:r-8,textAnchor:"middle",className:"text-[8px] fill-gray-400 dark:fill-gray-500",children:["#",M.seq]})]},"pt"+I)}),i!=null&&_[i]&&(()=>{const M=_[i],I=w(i),A=158,L=106,D=Math.min(Math.max(I-A/2,x.left),h-x.right-A),$=x.top+4;return a.jsxs("g",{className:"pointer-events-none",children:[a.jsx("rect",{x:D,y:$,width:A,height:L,rx:4,className:"fill-gray-900/95 dark:fill-gray-800/95"}),a.jsxs("text",{x:D+8,y:$+14,className:"text-[9px] font-semibold fill-white",children:["request #",M.seq,M.compactionMarker?" · compaction":""]}),a.jsxs("text",{x:D+8,y:$+28,className:"text-[9px] fill-emerald-300",children:["store: ",ho(M.storeTokens)]}),a.jsxs("text",{x:D+8,y:$+40,className:"text-[9px] fill-amber-300",children:["sent est: ",ho(M.sentEst)]}),a.jsxs("text",{x:D+8,y:$+52,className:"text-[9px] fill-sky-300",children:["sent actual: ",ho(M.sentActual)]}),a.jsxs("text",{x:D+8,y:$+64,className:"text-[9px] fill-rose-300",children:["tokReal: ",ho(M.tokReal)]}),a.jsxs("text",{x:D+8,y:$+76,className:"text-[9px] fill-yellow-300",children:["threshold: ",ho(M.threshold)]}),a.jsxs("text",{x:D+8,y:$+90,className:"text-[9px] fill-emerald-200/80",children:["trimmed: ",ho(M.trimmed)]})]})})()]})]})}const zR={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 jv(e){return e==null?"—":e.toLocaleString()}function NX({turns:e,selectedSeq:t,onSelect:n}){const[r,i]=y.useState(()=>new Set),o=y.useCallback(u=>{i(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?a.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"No requests."}):a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.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:[a.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."]}),a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(c4,{style:{height:"100%"},data:l,itemContent:(u,d)=>{if(d.kind==="group"){const h=r.has(d.turnIndex);return a.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:[a.jsx("svg",{className:"w-3 h-3 transition-transform "+(h?"-rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})}),"Turn ",d.turnIndex+1,a.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 a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 w-8 shrink-0",children:["#",f.seq]}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded shrink-0 "+(zR[f.purpose]||zR.assistant),children:f.purpose}),a.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300 truncate min-w-0 flex-1",children:f.model}),f.compaction&&a.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&&a.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&&a.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})]}),a.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:[a.jsxs("span",{title:"actual prompt_tokens sent this request",children:["sent ",jv(f.sentActualTokens)," tokens"]}),a.jsxs("span",{title:"growing part-store size",children:["store ",jv(f.storeTokens)," tokens"]}),f.sentActualDelta!=null&&a.jsxs("span",{className:f.sentActualDelta>=0?"text-amber-500":"text-emerald-500",title:"Δ sent actual vs previous request",children:[f.sentActualDelta>=0?"+":"",jv(f.sentActualDelta)," vs prev"]}),f.ttftMs!=null&&a.jsxs("span",{title:"time to first token",children:["ttft ",f.ttftMs," ms"]})]})]})}})})]})}function Mu({text:e,getText:t,label:n="Copy",className:r="",title:i}){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 h=>{h.stopPropagation();const m=typeof t=="function"?t():e;f.current&&clearTimeout(f.current);try{if(!navigator.clipboard)throw new Error("clipboard unavailable");await navigator.clipboard.writeText(m==null?"":String(m)),d(!1),l(!0),f.current=setTimeout(()=>l(!1),1500)}catch(x){console.error("Copy failed:",x),l(!1),d(!0),f.current=setTimeout(()=>d(!1),1800)}},[e,t]);return a.jsx("button",{type:"button",onMouseDown:function(h){h.preventDefault()},onClick:p,title:i||n,"aria-label":i||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?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"copy failed"]}):o?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"copied"]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 CX(e,t){return e==="all"?!0:e==="none"?!1:t<1}function UR({name:e}){return e==null?null:typeof e=="number"?a.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:["[",e,"]"]}):a.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:JSON.stringify(e)})}function jX({value:e}){const[t,n]=y.useState(!1),r=JSON.stringify(e);return r.length<=200?a.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:r}):a.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 break-all",children:[t?r:r.slice(0,200)+"…",a.jsx("button",{type:"button",onClick:i=>{i.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 TX({value:e}){return e===null?a.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"null"}):typeof e=="string"?a.jsx(jX,{value:e}):typeof e=="number"?a.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:String(e)}):typeof e=="boolean"?a.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:String(e)}):a.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:String(e)})}function _M({data:e,name:t,depth:n=0,openMode:r="auto"}){const i=Array.isArray(e),o=e&&typeof e=="object"&&!i,[l,u]=y.useState(()=>CX(r,n)),d={paddingLeft:n*12+"px"};if(!o&&!i)return a.jsxs("div",{style:d,className:"leading-5 break-all",children:[a.jsx("span",{className:"inline-block w-3"}),a.jsx(UR,{name:t}),t!=null&&a.jsx("span",{className:"text-gray-400",children:": "}),a.jsx(TX,{value:e})]});const f=i?e.map((m,x)=>[x,m]):Object.entries(e),[p,h]=i?["[","]"]:["{","}"];return a.jsxs("div",{children:[a.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:[a.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 select-none",children:f.length?l?"▾":"▸":" "}),a.jsx(UR,{name:t}),t!=null&&a.jsx("span",{className:"text-gray-400",children:": "}),a.jsxs("span",{className:"text-gray-400",children:[p,l?"":f.length?` … ${h}`:h]}),!l&&f.length>0&&a.jsxs("span",{className:"ml-1 text-[10px] text-gray-400 dark:text-gray-500",children:[f.length," ",i?"items":"keys"]})]}),l&&f.map(([m,x])=>a.jsx(_M,{data:x,name:m,depth:n+1,openMode:r},m)),l&&f.length>0&&a.jsxs("div",{style:d,className:"leading-5 text-gray-400",children:[a.jsx("span",{className:"inline-block w-3"}),h]})]})}function Yo({value:e,bytes:t,onResolveRef:n,label:r="JSON"}){const[i,o]=y.useState(null),[l,u]=y.useState(!1),[d,f]=y.useState(null),[p,h]=y.useState("all"),[m,x]=y.useState(0),[v,k]=y.useState(!1);y.useEffect(()=>{o(null),u(!1),f(null)},[e]);const _=i??e,S=Wu(_),w=y.useCallback(async()=>{if(n){u(!0),f(null);try{const T=ec(_),C=await n(T);o(C)}catch(T){f(T&&T.message?T.message:"Failed to fetch")}finally{u(!1)}}},[_,n]);if(_==null)return a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"(none)"});if(S)return a.jsxs("div",{className:"text-xs",children:[a.jsx("button",{type:"button",onClick:w,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&&a.jsx("div",{className:"mt-1 text-red-500 dark:text-red-400",children:d})]});const N=typeof _=="string"?_:JSON.stringify(_,null,2),R=_&&typeof _=="object";return a.jsxs("div",{className:"relative group",children:[a.jsxs("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity z-10 flex items-center gap-1",children:[R&&a.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"}),R&&!v&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>{h("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"}),a.jsx("button",{type:"button",onClick:()=>{h("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"})]}),a.jsx(Mu,{getText:()=>N,label:"copy",title:`Copy ${r}`})]}),R&&!v?a.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:a.jsx(_M,{data:_,openMode:p},`${p}-${m}`)}):a.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 qR={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 Af(e){return e==null?"—":e>=1024?(e/1024).toFixed(1)+"KB":e+"B"}function RX({rec:e,onResolveRef:t}){const[n,r]=y.useState("idle"),[i,o]=y.useState(null),[l,u]=y.useState(null),d=e.store&&e.store.messages,f=e.body,p=d===void 0,h=y.useCallback(async()=>{r("loading"),o(null);try{const N=Wu(d)?await t(ec(d)):d,R=Wu(f)?await t(ec(f)):f,T=Array.isArray(N)?N:N&&N.messages||[],C=R&&R.messages||[];u(vX(T,C)),r("ready")}catch(N){o(N&&N.message?N.message:"failed to load"),r("error")}},[d,f,t]);if(p)return a.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 a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:h,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"}),i&&a.jsx("div",{className:"text-[11px] text-red-500 mt-1",children:i})]});const{rows:m,firstChanged:x,maxBytes:v}=l,k=x>=0,_=k?m[x]:null,S=k?x:m.length,w=k?m.length-x:0;return a.jsxs("div",{className:"space-y-2",children:[a.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?a.jsxs(a.Fragment,{children:[a.jsxs("b",{className:"text-amber-700 dark:text-amber-300",children:["Cache prefix breaks at message #",x]})," (",_.role," · ",_.tag,"). The first ",S," message",S===1?"":"s"," are byte-identical to the store (cache-eligible); the ",w," from #",x," on differ, so they're re-prefilled."]}):a.jsxs(a.Fragment,{children:[a.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."]})}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[10px] text-gray-500 dark:text-gray-400",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-gray-300 dark:bg-gray-600"})," store (pre-trim)"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-sky-500"})," sent (post-trim)"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"inline-block w-3 h-2 rounded-xs bg-fuchsia-400/50"})," trimmed off"]}),a.jsx("span",{className:"ml-auto",children:"oldest → newest (top → bottom)"})]}),a.jsxs("div",{className:"space-y-0.5",children:[m.slice(0,300).map(N=>{const R=k&&N.i===x,T=Math.round((N.beforeBytes||0)/v*100),C=Math.round((N.afterBytes||0)/v*100);return a.jsxs("div",{children:[R&&a.jsxs("div",{className:"flex items-center gap-2 my-1","aria-label":"cache prefix break",children:[a.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"}),a.jsx("span",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-400 whitespace-nowrap",children:"cache prefix breaks here ↓"}),a.jsx("div",{className:"flex-1 border-t border-dashed border-amber-500/70"})]}),a.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:[a.jsxs("span",{className:"w-7 text-right text-[10px] text-gray-400 dark:text-gray-500 shrink-0",children:["#",N.i]}),a.jsx("span",{className:"text-[9px] px-1 rounded shrink-0 w-14 text-center "+(qR[N.role]||qR.system),children:N.role}),a.jsxs("div",{className:"flex-1 min-w-0 h-3 rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative",title:`store ${Af(N.beforeBytes)} → sent ${Af(N.afterBytes)}`,children:[a.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&&a.jsx("div",{className:"absolute inset-y-0 bg-fuchsia-400/50",style:{left:C+"%",width:Math.max(0,T-C)+"%"}}),a.jsx("div",{className:"absolute inset-y-0 left-0 bg-sky-500",style:{width:C+"%"}})]}),a.jsx("span",{className:"w-24 text-right text-[9px] font-mono text-gray-500 dark:text-gray-400 shrink-0",children:N.changed?`${Af(N.beforeBytes)}→${Af(N.afterBytes)}`:"cached"}),a.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&&a.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 pl-1 pt-1",children:["… ",m.length-300," more messages"]})]}),a.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 HR=4,AX=2.8,Tv=e=>e==null?"—":e.toLocaleString();function Rv({chars:e,ratio:t,ratioNote:n,tokens:r}){if(e==null)return null;const i=Math.ceil(e/t),o=r!=null?r-i:0;return a.jsxs("span",{className:"block text-[10px] font-mono text-gray-400 dark:text-gray-500 leading-tight mt-px",children:["= ⌈",Tv(e)," chars ÷ ",t,"⌉",o?a.jsxs(a.Fragment,{children:[" + ",Tv(o)]}):null," = ",a.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/80",children:Tv(r)})," tok",a.jsxs("span",{className:"text-gray-300 dark:text-gray-600",children:[" · ",n,o?" + structure/attachments":""]})]})}function Av({label:e,tokens:t,sub:n,calc:r,expanded:i,isOpen:o,onToggle:l}){return a.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[a.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:[a.jsx("span",{className:"inline-block w-3 text-gray-400 dark:text-gray-500 mt-px",children:o?"▾":"▸"}),a.jsxs("span",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-medium text-gray-700 dark:text-gray-200 flex-1",children:e}),a.jsxs("span",{className:"text-[11px] font-mono text-amber-600 dark:text-amber-400",children:[t==null?"—":t.toLocaleString()," tok"]}),n?a.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["· ",n]}):null]}),r]})]}),o&&a.jsx("div",{className:"pb-2 pl-1",children:i})]})}function IX({rec:e,onResolveRef:t,overheadSystem:n,overheadTools:r,toolCount:i,newMessageTokens:o,overheadSystemChars:l,overheadToolsChars:u,newMessageChars:d}){const f=Wu(e.body),[p,h]=y.useState(()=>f?null:e.body),[m,x]=y.useState(()=>f?"idle":"ready"),[v,k]=y.useState(null),[_,S]=y.useState(null),w=y.useCallback(async()=>{if(!f){h(e.body),x("ready");return}x("loading"),k(null);try{const D=await t(ec(e.body));h(D),x("ready")}catch(D){k(D&&D.message?D.message:"failed to load"),x("error")}},[f,e.body,t]),N=D=>{S($=>$===D?null:D),m==="idle"&&w()},R=m==="ready",T=R&&p&&Array.isArray(p.messages)?p.messages:[],C=T.find(D=>D&&D.role==="system"),M=C?C.content:null,I=R&&p?p.tools:null,A=T.length?T[T.length-1]:null,L=(D,$)=>m==="loading"?a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"loading…"}):m==="error"?a.jsxs("div",{className:"text-[10px] text-red-500",children:[v||"failed to load"," —"," ",a.jsx("button",{type:"button",onClick:w,className:"underline hover:no-underline",children:"retry"})]}):D==null?a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 italic",children:"(not present in this request body)"}):a.jsx(Yo,{value:D,onResolveRef:t,label:$});return a.jsxs("div",{className:"pt-1",children:[a.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:"}),a.jsx(Av,{label:"system prompt",tokens:n,calc:a.jsx(Rv,{chars:l,ratio:HR,ratioNote:"natural language",tokens:n}),expanded:L(M,"system prompt"),isOpen:_==="system",onToggle:()=>N("system")}),a.jsx(Av,{label:"tool schemas",tokens:r,sub:i?`${i} tools`:"",calc:a.jsx(Rv,{chars:u,ratio:AX,ratioNote:"JSON",tokens:r}),expanded:L(I,"tool schemas"),isOpen:_==="tools",onToggle:()=>N("tools")}),a.jsx(Av,{label:"new message",tokens:o,calc:a.jsx(Rv,{chars:d,ratio:HR,ratioNote:"natural language",tokens:o}),expanded:L(A,"new message"),isOpen:_==="new",onToggle:()=>N("new")})]})}function MX({rec:e,prevRec:t,onSelectSeq:n}){const r=e&&e.messageDrop;if(!r)return null;const i=t&&t.body&&t.body.messages,o=e.body&&e.body.messages,u=Array.isArray(i)&&Array.isArray(o)?yX(i,o):null,d=t?a.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]}):a.jsxs("span",{title:"That request is no longer in the capture",children:["request #",r.prevSeq]});return a.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:[a.jsxs("div",{className:"px-3 py-2 border-b border-red-200 dark:border-red-900",children:[a.jsxs("div",{className:"text-[12px] font-semibold text-red-700 dark:text-red-300 flex items-center gap-1",children:["⚠ Unexpected message drop",a.jsx("span",{className:"font-normal text-red-500 dark:text-red-400",children:"— possible #1858 regression"})]}),a.jsxs("div",{className:"mt-0.5 text-[11px] text-red-700/90 dark:text-red-300/90",children:["The wire dropped ",a.jsxs("b",{children:[r.wireBefore," → ",r.wireAfter]})," conversation messages between"," ",d," and this one (#",e.seq,") with ",a.jsx("b",{children:"no compaction"}),r.storeMessages!=null&&a.jsxs(a.Fragment,{children:[" — store intact = ",a.jsx("b",{children:r.storeMessages})]}),". Trimming never drops whole messages, so this is a wrongful drop, not a designed trim."]}),a.jsxs("div",{className:"mt-1 text-[10px] text-red-600/80 dark:text-red-400/80",children:["Compare the raw wire arrays:"," ",t?a.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(r.prevSeq),children:["raw request #",r.prevSeq]}):a.jsxs("span",{children:["request #",r.prevSeq," (evicted)"]})," · ",a.jsxs("button",{type:"button",className:"underline underline-offset-2",onClick:()=>n&&n(e.seq),children:["raw request #",e.seq]})]})]}),u&&u.roles.length>0?a.jsxs("div",{className:"px-3 py-1.5",children:[a.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=>a.jsxs("div",{className:"text-[11px] font-mono text-red-800 dark:text-red-200 flex items-center gap-2 py-0.5",children:[a.jsxs("span",{className:"inline-block w-20",children:["[",f.role,"]"]}),a.jsxs("span",{children:[f.before," → ",f.after]}),f.delta>0&&a.jsxs("span",{className:"text-red-600 dark:text-red-300 font-semibold",children:["−",f.delta," dropped"]})]},f.role)),a.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)."})]}):a.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 LX=["Request","Response","Chunks","Context","Lifecycle","Est vs actual"];function yn(e){return e==null?"—":typeof e=="number"?e.toLocaleString():String(e)}function Tn({label:e,children:t,highlight:n}){return a.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:e}),a.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 sp={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"},$R={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 OX({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 a.jsx("span",{className:n+" text-gray-600 dark:text-gray-400",children:e});r.sort((l,u)=>l.start-u.start);const i=[];let o=0;return r.forEach((l,u)=>{l.start<o||(l.start>o&&i.push(a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o,l.start)},"g"+u)),i.push(a.jsx("span",{className:"font-semibold "+(sp[l.type]||sp.other),children:e.slice(l.start,l.end)},"m"+u)),o=l.end)}),o<e.length&&i.push(a.jsx("span",{className:"text-gray-500 dark:text-gray-500",children:e.slice(o)},"tail")),a.jsx("span",{className:n,children:i})}function If({n:e,name:t,sub:n,pct:r,trimmedPct:i,fill:o,dashed:l}){return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-4 shrink-0 text-[10px] text-gray-400 dark:text-gray-500 text-right leading-4",children:e}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[11px] text-gray-700 dark:text-gray-200",children:t}),n&&a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:n}),r!=null&&a.jsxs("div",{className:"h-2.5 w-full rounded bg-gray-100 dark:bg-gray-800 overflow-hidden relative "+(l?"ring-1 ring-inset ring-emerald-400/50":""),children:[i!=null&&a.jsx("div",{className:"absolute inset-y-0 left-0 bg-fuchsia-400/25",style:{width:Math.min(100,i)+"%"}}),a.jsx("div",{className:"absolute inset-y-0 left-0 "+(o||"bg-gray-400"),style:{width:Math.min(100,r)+"%"}})]})]})]})}function Iv({label:e}){return a.jsxs("div",{className:"pl-6 py-0.5 text-[10px] text-gray-400 dark:text-gray-500 flex items-center gap-1",children:[a.jsx("span",{"aria-hidden":!0,children:"↓"}),a.jsx("span",{children:e})]})}function DX({rec:e,prevRec:t,onSelectSeq:n,onResolveRef:r,onJumpToMessage:i,tab:o,onTabChange:l,showRaw:u,onShowRawChange:d}){if(!e)return a.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,h=e.context,m=h&&h.limit!=null&&h.usable!=null?h.limit-h.usable:null,x=h&&h.threshold!=null&&h.tokReal!=null?h.threshold-h.tokReal:null,v=h?h.source==="estimate":!1,k=h&&(h.historicalEstimate!=null||h.lastPromptTokens!=null)&&h.newMessageTokens!=null,_=h?h.source==="actual"?h.lastPromptTokens:h.historicalEstimate:null,S=h&&h.historicalEstimate!=null&&h.staticOverhead!=null?h.historicalEstimate-h.staticOverhead:null;return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[a.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:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:["#",e.seq," · ",e.provider,"/",e.model,a.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})]}),a.jsx("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 truncate",children:e.url})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(Mu,{getText:()=>vM(e),label:"request",title:"Copy this request (body + response + context)"}),f&&a.jsx(Mu,{getText:()=>wX(e),label:"response",title:"Copy the assembled response"}),e.chunkCount>0&&a.jsx(Mu,{getText:()=>kM(e),label:"chunks",title:"Copy all raw chunks"})]})]}),a.jsx(MX,{rec:e,prevRec:t,onSelectSeq:n}),a.jsx("div",{className:"flex items-center gap-1 px-3 pt-2 shrink-0 border-b border-gray-200 dark:border-gray-800",children:LX.map(w=>a.jsx("button",{type:"button",onClick:()=>l(w),className:"px-2.5 py-1 text-xs font-medium rounded-t transition-colors "+(o===w?"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:w},w))}),a.jsxs("div",{className:"flex-1 overflow-auto p-3 min-h-0",children:[o==="Request"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(Tn,{label:"fingerprint",children:e.fingerprint}),a.jsx(Tn,{label:"bodyBytes",children:e.bodyBytes!=null?e.bodyBytes.toLocaleString():null}),e.shrink&&a.jsxs(Tn,{label:"shrink rungs",children:[(e.shrink.rungsFired||[]).join(", ")||"(none)",e.shrink.fitted!=null?` fitted=${e.shrink.fitted}`:""]}),e.bubbleMessageID&&a.jsxs("div",{className:"flex items-baseline gap-2 py-0.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 w-36 shrink-0",children:"bubble msgID"}),i?a.jsx("button",{type:"button",onClick:()=>i(e.bubbleMessageID),className:"text-xs font-mono text-primary-600 dark:text-primary-400 hover:underline",title:"Jump to this message in the conversation",children:e.bubbleMessageID}):a.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-gray-200",children:e.bubbleMessageID})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Params"}),a.jsx(Yo,{value:e.params,label:"params"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Headers (redacted)"}),a.jsx(Yo,{value:e.headers,label:"headers"})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Request body (exact bytes sent)"}),a.jsx(Yo,{value:e.body,bytes:e.bodyBytes,onResolveRef:r,label:"body"})]})]}),o==="Response"&&a.jsx("div",{className:"space-y-3",children:f?a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"HTTP response (status line)"}),a.jsx(Tn,{label:"HTTP status",highlight:e.status!=null&&e.status>=400,children:e.status})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Response headers (from EPM)"}),e.paveContext&&a.jsx(Tn,{label:"x-pave-resolved-model",children:e.paveContext.resolvedModel}),e.paveContext&&a.jsx(Tn,{label:"x-pave-context-floor",children:e.paveContext.contextFloor}),f.headers?a.jsxs("div",{className:"mt-1",children:[a.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500 mb-0.5",children:"full header set (redacted):"}),a.jsx(Yo,{value:f.headers,label:"response headers"})]}):a.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."})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"From the SSE body"}),a.jsx(Tn,{label:"finishReason",highlight:e.finishReason==="length",children:e.finishReason}),f.usage&&a.jsx(Tn,{label:"prompt_tokens",children:yn(f.usage.prompt_tokens)}),f.usage&&a.jsx(Tn,{label:"completion_tokens",children:yn(f.usage.completion_tokens)}),f.usage&&f.usage.total_tokens!=null&&a.jsx(Tn,{label:"total_tokens",children:yn(f.usage.total_tokens)})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Assembled response (from the SSE body)"}),a.jsx(Yo,{value:p,onResolveRef:r,label:"assembled"})]})]}):a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No response captured (in-flight or aborted)."})}),o==="Chunks"&&a.jsxs("div",{className:"space-y-2",children:[a.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:[a.jsxs("span",{children:["TTFT: ",a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.ttftMs!=null?e.ttftMs+"ms":"—"})]}),a.jsxs("span",{children:["total: ",a.jsx("b",{className:"text-gray-700 dark:text-gray-200",children:e.totalMs!=null?e.totalMs+"ms":"—"})]}),a.jsxs("span",{children:["chunks: ",a.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&&a.jsxs("span",{children:["throughput: ",a.jsxs("b",{className:"text-gray-700 dark:text-gray-200",children:[(e.response.usage.completion_tokens/(e.totalMs/1e3)).toFixed(1)," tok/s"]})]}),a.jsxs("label",{className:"ml-auto flex items-center gap-1 cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:u,onChange:w=>d(w.target.checked),className:"accent-primary-500"}),"raw frames"]})]}),e.chunks.length===0?a.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 italic",children:"No chunks captured."}):a.jsx("div",{className:"space-y-1",children:e.chunks.map((w,N)=>{const R=N===0?e.ts!=null?w.ts-e.ts:0:w.ts-e.chunks[N-1].ts,T=bX(w).parts,C=T.filter(M=>M.piece!=="");return a.jsxs("div",{className:"flex items-start gap-2 text-[11px] font-mono",children:[a.jsxs("span",{className:"text-gray-400 dark:text-gray-600 w-12 shrink-0 text-right",children:["+",R,"ms"]}),a.jsx("span",{className:"w-[72px] shrink-0 flex flex-col items-start gap-0.5",children:T.map((M,I)=>a.jsx("span",{className:"px-1 rounded "+($R[M.type]||$R.other),children:M.type},I))}),u?a.jsx(OX,{raw:w.raw,parts:T}):a.jsx("span",{className:"break-all whitespace-pre-wrap min-w-0 flex-1",title:w.raw,children:C.length?C.map((M,I)=>a.jsx("span",{className:(I?"ml-1 ":"")+(sp[M.type]||sp.other),children:M.piece},I)):a.jsx("span",{className:"italic opacity-60 text-gray-500",children:w.raw})})]},w.seq)})}),!u&&e.chunks.length>0&&a.jsxs("div",{className:"pt-1 text-[10px] text-gray-400 dark:text-gray-500",children:["Coloured by the assembled part each chunk feeds: ",a.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"reasoning"})," · ",a.jsx("span",{className:"text-sky-700 dark:text-sky-300",children:"text"})," · ",a.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:"tool"})," · ",a.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:"usage"}),". Toggle “raw frames” for the exact SSE."]})]}),o==="Context"&&a.jsxs("div",{className:"space-y-3",children:[h?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"rounded-lg border p-2.5 "+(h.needsCompaction?"border-fuchsia-300 dark:border-fuchsia-700 bg-fuchsia-50 dark:bg-fuchsia-900/20":"border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900"),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"Compaction decision"}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-semibold "+(h.needsCompaction?"bg-fuchsia-200 text-fuchsia-800 dark:bg-fuchsia-800/60 dark:text-fuchsia-200":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"),children:h.needsCompaction?"TRIGGERED":"not triggered"}),a.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["evaluated ",a.jsx("b",{children:"before"})," the request is sent · once per turn"]})]}),a.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[a.jsxs("div",{children:["compact when ",a.jsx("b",{children:"tokReal > threshold"})," →"," ",a.jsxs("span",{className:h.needsCompaction?"text-fuchsia-600 dark:text-fuchsia-400 font-semibold":"text-emerald-600 dark:text-emerald-400 font-semibold",children:[yn(h.tokReal)," ",h.needsCompaction?">":"≤"," ",yn(h.threshold)]})]}),a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["headroom = threshold − tokReal = ",yn(h.threshold)," − ",yn(h.tokReal)," = ",a.jsx("b",{className:x!=null&&x<0?"text-fuchsia-600 dark:text-fuchsia-400":"",children:yn(x)})]}),a.jsxs("div",{className:"pt-1 text-gray-500 dark:text-gray-400",children:["threshold = ⌊usable × margin⌋ = ⌊",yn(h.usable)," × ",h.margin??"?","⌋ = ",yn(h.threshold)]}),a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["usable = limit − reserve = ",yn(h.limit)," − ",yn(m)," = ",yn(h.usable)]})]})]}),k&&a.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900 p-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide font-semibold text-gray-500 dark:text-gray-400",children:"How tokReal is computed"}),a.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"})]}),a.jsxs("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-200 space-y-0.5",children:[a.jsxs("div",{children:["tokReal = ",v?"historical estimate":"last prompt_tokens"," + new message = ",a.jsx("b",{children:yn(_)})," + ",a.jsx("b",{children:yn(h.newMessageTokens)})," = ",a.jsx("b",{children:yn(h.tokReal)})]}),v?a.jsxs(a.Fragment,{children:[S!=null&&a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["historical estimate = conversation estimate + system+tools overhead = ",yn(S)," + ",yn(h.staticOverhead)," = ",yn(h.historicalEstimate)]}),(h.overheadSystem!=null||h.overheadTools!=null)&&a.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:["system+tools overhead = system prompt ",yn(h.overheadSystem)," + tool schemas ",yn(h.overheadTools),h.toolCount?` (${h.toolCount} tools)`:""," = ",yn(h.staticOverhead)]}),a.jsxs("div",{className:"text-[10px] text-amber-600 dark:text-amber-400 pt-0.5",children:["ESTIMATE — no measured ",a.jsx("code",{children:"prompt_tokens"})," was available yet, so this is openpave's own estimate. The system prompt + tool schemas (",yn(h.staticOverhead),") dominate, which is why tokReal ≫ the store."]})]}):a.jsxs("div",{className:"text-[10px] text-gray-500 dark:text-gray-400 pt-0.5",children:["MEASURED — the previous response's ",a.jsx("code",{children:"prompt_tokens"})," (",yn(h.lastPromptTokens),"), which already counts system prompt + tools + conversation."]}),a.jsx("div",{className:"font-sans",children:a.jsx(IX,{rec:e,onResolveRef:r,overheadSystem:h.overheadSystem,overheadTools:h.overheadTools,toolCount:h.toolCount,newMessageTokens:h.newMessageTokens,overheadSystemChars:h.overheadSystemChars,overheadToolsChars:h.overheadToolsChars,newMessageChars:h.newMessageChars})})]})]}),a.jsxs("div",{children:[a.jsx(Tn,{label:"limit (window)",children:yn(h.limit)}),a.jsx(Tn,{label:"reserve (output)",children:yn(m)}),a.jsx(Tn,{label:"usable",children:yn(h.usable)}),a.jsx(Tn,{label:"margin",children:h.margin}),a.jsx(Tn,{label:"threshold",children:yn(h.threshold)}),a.jsx(Tn,{label:"tokReal",children:yn(h.tokReal)}),a.jsx(Tn,{label:"needsCompaction",highlight:!!h.needsCompaction,children:String(h.needsCompaction)}),a.jsx(Tn,{label:"source",children:h.source}),a.jsx(Tn,{label:"windowSource",children:h.windowSource||h.epmWindowSignal})]})]}):a.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 ",a.jsx("b",{children:"once per turn"})," (at the turn's first request); tool-iteration follow-ups and compaction turns reuse it.",e.contextFrom!=null&&a.jsxs(a.Fragment,{children:[" The most recent decision was evaluated at ",a.jsxs("b",{children:["request #",e.contextFrom]}),"."]})]}),e.store&&a.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[a.jsx(Tn,{label:"storeTokens",children:yn(e.storeTokens)}),a.jsx(Tn,{label:"storeMessages",children:e.storeMessages}),e.store.messages!==void 0&&a.jsxs("div",{className:"mt-2",children:[a.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"}),a.jsx(Yo,{value:e.store.messages,onResolveRef:r,label:"store messages"})]})]}),e.compaction&&a.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fuchsia-500 mb-1",children:"Compaction (followed this request)"}),a.jsx(Tn,{label:"trigger",children:e.compaction.trigger}),a.jsx(Tn,{label:"deleted",children:yn(e.compaction.deletedMessages)}),a.jsx(Tn,{label:"summary tok",children:yn(e.compaction.summaryTokens)}),a.jsx(Tn,{label:"before",children:yn(e.compaction.before)}),a.jsx(Tn,{label:"after",children:yn(e.compaction.after)}),a.jsx(Tn,{label:"handoffFresh",highlight:e.compaction.handoffFresh===!1,children:typeof e.compaction.handoffFresh=="boolean"?String(e.compaction.handoffFresh):"—"})]})]}),o==="Est vs actual"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Estimator (",a.jsx("code",{children:"estimateWireTokens"}),") vs the provider's actual ",a.jsx("code",{children:"prompt_tokens"})," — exposes tokenizer drift."]}),a.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:[a.jsx("b",{children:"sent est"})," counts the whole ",a.jsx("b",{children:"messages array"})," — the system prompt included (it's a ",a.jsx("code",{children:'role:"system"'})," message) — with a coarse byte-length ÷ 3 heuristic plus fixed per-message/tool envelopes, but ",a.jsx("b",{children:"excludes the tool schemas"})," (a top-level ",a.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 ",a.jsx("b",{children:"sent actual"}),". ",a.jsx("b",{children:"sent actual"})," (",a.jsx("code",{children:"prompt_tokens"}),") is the provider's real tokenizer over the ",a.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."]}),a.jsx(Tn,{label:"sent est",children:yn(e.sentEstTokens)}),a.jsx(Tn,{label:"sent actual",children:yn(e.sentActualTokens)}),e.sentEstTokens!=null&&e.sentActualTokens!=null&&a.jsxs(a.Fragment,{children:[a.jsx(Tn,{label:"delta (est−actual)",highlight:Math.abs(e.sentEstTokens-e.sentActualTokens)>e.sentActualTokens*.15,children:(e.sentEstTokens-e.sentActualTokens).toLocaleString()}),a.jsx(Tn,{label:"drift %",children:e.sentActualTokens?((e.sentEstTokens-e.sentActualTokens)/e.sentActualTokens*100).toFixed(1)+"%":"—"})]}),a.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-800",children:[a.jsx(Tn,{label:"store tokens",children:yn(e.storeTokens)}),a.jsx(Tn,{label:"Δ vs prev actual",children:e.sentActualDelta!=null?(e.sentActualDelta>=0?"+":"")+e.sentActualDelta.toLocaleString():null}),e.response&&e.response.usage&&a.jsxs(a.Fragment,{children:[a.jsx(Tn,{label:"completion_tokens",children:e.response.usage.completion_tokens}),a.jsx(Tn,{label:"total_tokens",children:e.response.usage.total_tokens}),e.response.usage.reasoning_tokens!=null&&a.jsx(Tn,{label:"reasoning_tokens",children:e.response.usage.reasoning_tokens})]})]})]}),o==="Lifecycle"&&(()=>{const w=e.trimmed,N=w!=null&&w>0,R=e.finishReason==="length",T=h?h.needsCompaction:null,C=e.storeTokens,M=e.sentActualTokens,I=Math.max(C||0,M||0,e.sentEstTokens||0,1),A=L=>Math.round((L||0)/I*100);return a.jsxs("div",{className:"space-y-3 text-xs leading-relaxed text-gray-600 dark:text-gray-300",children:[a.jsxs("div",{children:[a.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"}),a.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:[a.jsx(If,{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)."}),a.jsx(Iv,{label:"render — internal parts → API message shape; DROP compactedOut, KEEP summary"}),a.jsx(If,{n:"2",name:"LLM context = formattedMessages (the inspector's ‘store’)",sub:`${yn(C)} tok · ${e.storeMessages!=null?e.storeMessages+" msgs":"—"}`,pct:A(C),fill:"bg-emerald-500"}),a.jsx(Iv,{label:"slice — shallow copy so trimming can't touch the original render"}),a.jsx(If,{n:"3",name:"Wire copy = conversationMessages",sub:"identical to layer 2 until trimmed",pct:A(C),fill:"bg-emerald-500/40",dashed:!0}),a.jsx(Iv,{label:N?`trim — fit to budget (−${yn(w)} tok net)`:"trim — nothing net-trimmed this request"}),a.jsx(If,{n:"4",name:"Sent = [system] + trimmed wire + tools",sub:`${yn(M)} tok actual · est ${yn(e.sentEstTokens)}`,pct:A(M),trimmedPct:N?A(C):null,fill:"bg-sky-500"})]}),N&&a.jsxs("div",{className:"mt-0.5 pl-6 text-[10px] text-gray-400 dark:text-gray-500",children:[a.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)",R?" · finishReason=length: model hit the output limit":""]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"…the four steps, in words"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px] text-gray-600 dark:text-gray-300",children:[a.jsxs("li",{children:[a.jsx("b",{children:"Compaction"})," (upstream, only near the limit): summarise old messages in the durable store — flag them ",a.jsx("code",{children:"compactedOut"})," + add a summary."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Render"}),": translate the store’s internal “parts” into the API’s message shape, dropping ",a.jsx("code",{children:"compactedOut"})," and including the summary → layer 2."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Slice"}),": shallow-copy layer 2 → layer 3, so trimming mutates the copy, not the original render."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Trim"}),": shrink the copy to fit the budget (the ladder below), then assemble ",a.jsx("code",{children:"[system + trimmed wire + tools]"})," and send → layer 4."]})]}),a.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["So compaction is ",a.jsx("b",{children:"pre-emptive"})," — before trimming (step 1). There's also a ",a.jsx("b",{children:"reactive"})," path: if the sent request 413s (our budget was an estimate), it trims ",a.jsx("i",{children:"harder"})," and, only if that still won't fit, compacts and resends. Trimming sits between the two."]})]}),a.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:[a.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 ",a.jsx("b",{children:"rewrites older messages"})," (stubs tool outputs, strips reasoning, caps old text) — and the recency-weighted ladder trims the ",a.jsx("b",{children:"oldest first"}),", i.e. the cache prefix. So a trimmed request usually ",a.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."]}),a.jsxs("div",{children:[a.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"}),a.jsx(RX,{rec:e,onResolveRef:r})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Compaction (this request)"}),e.compaction?a.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 ",yn(e.compaction.before)," → ",yn(e.compaction.after)," tok. The on-disk history was permanently summarised."]}):a.jsxs("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:["No compaction on this request.",T!=null&&a.jsxs(a.Fragment,{children:[" Decision at build time: ",a.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)."]})]}),a.jsxs("div",{className:"mt-1 text-[10px] text-gray-500 dark:text-gray-400",children:["Compaction drops old messages from the ",a.jsx("b",{children:"LLM context"})," (a summary replaces them) — it does ",a.jsx("b",{children:"not"})," delete them: they stay on disk flagged ",a.jsx("code",{children:"compactedOut"})," and the web UI still shows every bubble. So the inspector's ",a.jsx("b",{children:"store"})," line = the LLM context (it drops at compaction), not the visible conversation."]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"Trimming vs compaction"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[11px] border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-left text-gray-500 dark:text-gray-400",children:[a.jsx("th",{className:"py-1 pr-2 font-medium",children:" "}),a.jsx("th",{className:"py-1 pr-2 font-semibold text-sky-700 dark:text-sky-300",children:"Trimming"}),a.jsx("th",{className:"py-1 font-semibold text-fuchsia-700 dark:text-fuchsia-300",children:"Compaction"})]})}),a.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(([L,D,$])=>a.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[a.jsx("td",{className:"py-1 pr-2 text-gray-500 dark:text-gray-400 whitespace-nowrap",children:L}),a.jsx("td",{className:"py-1 pr-2 text-gray-700 dark:text-gray-200",children:D}),a.jsx("td",{className:"py-1 text-gray-700 dark:text-gray-200",children:$})]},L))})]})})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-1",children:"The trimming ladder (fitWireToBudget)"}),a.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."}),a.jsxs("ol",{className:"list-decimal list-inside space-y-0.5 text-[11px]",children:[a.jsxs("li",{children:[a.jsx("b",{className:"text-amber-600 dark:text-amber-400",children:"Strip historical reasoning_content"})," — blank out old “thinking” blocks."]}),a.jsxs("li",{children:[a.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool outputs"})," — replace big tool results with a size marker."]}),a.jsxs("li",{children:[a.jsx("b",{className:"text-violet-600 dark:text-violet-400",children:"Stub tool-call arguments"})," — replace large args with a shape placeholder."]}),a.jsxs("li",{children:[a.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."]})]}),a.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 PX(e){return e==null?"":e>=1048576?(e/1048576).toFixed(1)+" MB":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}const Lu=(e,t,n)=>Math.min(n,Math.max(t,e)),WR=0,VR=560,GR=220,KR=200,YR=640,QR=300,op=520;function Mv(e,t,n,r){try{const i=parseInt(window.localStorage.getItem(e),10);if(Number.isFinite(i))return Lu(i,n,r)}catch{}return t}function XR(){try{return Math.max(op,window.innerWidth)}catch{return 1600}}function ZR(){try{return Lu(Math.round(window.innerWidth*.9),op,1600)}catch{return 1200}}function FX({open:e,onClose:t,activeSessionId:n,activeSessionTitle:r,onJumpToMessage:i}){const[o,l]=y.useState([]),[u,d]=y.useState(null),[f,p]=y.useState(""),[h,m]=y.useState(!1),[x,v]=y.useState(null),[k,_]=y.useState(null),[S,w]=y.useState(()=>Mv("inspectorTimelineHeight",GR,WR,VR)),[N,R]=y.useState(()=>Mv("inspectorLedgerWidth",QR,KR,YR)),[T,C]=y.useState(()=>Mv("inspectorDrawerWidth",ZR(),op,XR())),[M,I]=y.useState(!1),[A,L]=y.useState(0),[D,$]=y.useState("Request"),[te,V]=y.useState(!1),z=y.useMemo(()=>f?kX(f):null,[f]);y.useEffect(()=>{try{window.localStorage.setItem("inspectorTimelineHeight",String(S))}catch{}},[S]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorLedgerWidth",String(N))}catch{}},[N]),y.useEffect(()=>{try{window.localStorage.setItem("inspectorDrawerWidth",String(T))}catch{}},[T]);const G=y.useCallback(Y=>{Y.preventDefault();const oe=Y.clientY,_e=S,ae=Fe=>w(Lu(_e+(Fe.clientY-oe),WR,VR)),ye=()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",ye),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",ae),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",ye)},[S]),K=y.useCallback(Y=>{Y.preventDefault();const oe=Y.clientX,_e=N,ae=Fe=>R(Lu(_e+(Fe.clientX-oe),KR,YR)),ye=()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",ye),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",ae),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",ye)},[N]),H=y.useCallback(Y=>{Y.preventDefault();const oe=Y.clientX,_e=T,ae=Fe=>C(Lu(_e+(oe-Fe.clientX),op,XR())),ye=()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",ye),document.body.style.userSelect=""};document.body.style.userSelect="none",window.addEventListener("pointermove",ae),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",ye)},[T]),se=y.useCallback(async()=>{if(z){I(!0);try{const Y=new Map;await Promise.all(SX(z).map(async Fe=>{try{Y.set(Fe,await Mw(u,Fe))}catch{}}));const oe=FR(z,u,Y),_e=new Blob([oe],{type:"text/plain;charset=utf-8"}),ae=URL.createObjectURL(_e),ye=document.createElement("a");ye.href=ae,ye.download=`inspector-${u||"session"}.txt`,document.body.appendChild(ye),ye.click(),ye.remove(),setTimeout(()=>URL.revokeObjectURL(ae),2e3)}catch(Y){v(Y&&Y.message?Y.message:"Download failed")}finally{I(!1)}}},[z,u]),P=y.useCallback(async()=>{try{const Y=await a3();l(Array.isArray(Y)?Y:[])}catch(Y){v(Y&&Y.message?Y.message:"Failed to list sessions")}},[]);y.useEffect(()=>{e&&P()},[e,n,P]),y.useEffect(()=>{e&&d(Y=>n||(Y&&o.some(oe=>oe.id===Y)?Y:o.length?o[0].id:null))},[e,n,o]),y.useEffect(()=>{if(!e||!u){p("");return}let Y=!1;return m(!0),v(null),_(null),p(""),s3(u).then(oe=>{Y||p(oe||"")}).catch(oe=>{Y||(oe&&oe.status===404?p(""):v(oe&&oe.message?oe.message:"Failed to load events"))}).finally(()=>{Y||m(!1)}),()=>{Y=!0}},[e,u,A]);const W=y.useCallback(()=>{P(),L(Y=>Y+1)},[P]);y.useEffect(()=>{if(z&&z.requests.length&&k==null){const Y=z.requests.find(oe=>oe.messageDrop);_((Y||z.requests[0]).seq)}},[z,k]),y.useEffect(()=>{if(!e)return;const Y=oe=>{oe.key==="Escape"&&t()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[e,t]);const ee=y.useCallback(Y=>Mw(u,Y),[u]),F=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 o3(u),p(""),d(null),await P()}catch(Y){v(Y&&Y.message?Y.message:"Failed to purge")}},[u,n,P]),J=y.useMemo(()=>z&&z.requests.find(Y=>Y.seq===k)||null,[z,k]),q=y.useMemo(()=>z&&J&&J.messageDrop&&z.requests.find(Y=>Y.seq===J.messageDrop.prevSeq)||null,[z,J]);return e?a.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[a.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:t,"aria-hidden":"true"}),a.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:[a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector width",title:"Drag to resize the inspector · double-click to reset",onPointerDown:H,onDoubleClick:()=>C(ZR()),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:a.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"})}),a.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:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"text-base shrink-0",children:"🦋"}),a.jsx("h2",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100 shrink-0",children:"Inspector"}),a.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&&a.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&&a.jsx("span",{className:"ml-1 text-emerald-500",title:"the chat you're currently in",children:"●"})]})]}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsxs("select",{value:u||"",onChange:Y=>d(Y.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&&a.jsx("option",{value:"",children:"(no captures)"}),n&&!o.some(Y=>Y.id===n)&&a.jsxs("option",{value:n,children:["● ",n.slice(0,12),"… · (current chat — no capture yet)"]}),o.map(Y=>a.jsxs("option",{value:Y.id,children:[Y.id===n?"● ":"",Y.id.slice(0,12),"… · ",Y.events," ev · ",PX(Y.bytes)]},Y.id))]}),a.jsx("button",{type:"button",onClick:W,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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20 9A8 8 0 006 5.3M4 15a8 8 0 0014 3.7"})})}),z&&a.jsx(Mu,{getText:()=>FR(z,u),label:"copy session",title:"Copy the whole replay as one LLM-friendly text blob (spilled bodies shown as refs)"}),z&&a.jsx("button",{type:"button",onClick:se,disabled:M,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:M?"preparing…":"download"}),a.jsx("button",{type:"button",onClick:F,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"}),a.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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]}),a.jsxs("div",{className:"px-4 pt-2 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[h?a.jsx("div",{style:{height:S},className:"flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"Loading capture…"}):x?a.jsx("div",{style:{height:S},className:"flex items-center justify-center text-sm text-red-500 dark:text-red-400",children:x}):z?a.jsx(EX,{timeline:z.timeline,selectedSeq:k,onSelectSeq:_,height:S}):a.jsx("div",{style:{height:S},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."}),a.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize timeline",title:"Drag to resize the timeline · double-click to reset",onPointerDown:G,onDoubleClick:()=>w(GR),className:"group h-2.5 flex items-center justify-center cursor-row-resize",children:a.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"})})]}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsx("div",{style:{width:N},className:"shrink-0 border-r border-gray-200 dark:border-gray-800 min-h-0 overflow-hidden",children:z?a.jsx(NX,{turns:z.turns,selectedSeq:k,onSelect:_}):a.jsx("div",{className:"p-4 text-xs text-gray-400 dark:text-gray-500 italic",children:"—"})}),a.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:K,onDoubleClick:()=>R(QR),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:a.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"})}),a.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:a.jsx(DX,{rec:J,prevRec:q,onSelectSeq:_,onResolveRef:ee,onJumpToMessage:i,tab:D,onTabChange:$,showRaw:te,onShowRawChange:V},J?J.seq:"none")})]})]}),a.jsx("style",{children:"@keyframes slideIn { from { transform: translateX(24px); opacity: .6 } to { transform: translateX(0); opacity: 1 } }"})]}):null}const BX=8,zX=32;function UX({width:e,min:t,max:n,edge:r,onCommit:i,getPaneEl:o,ariaLabel:l,className:u}){const d=y.useRef(null),f=y.useRef(null),p=y.useRef(null),h=y.useRef(e);h.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,S=v.clientX,w=h.current;try{k.setPointerCapture(v.pointerId)}catch{}d.current=v.pointerId;const N=document.body.style.cursor,R=document.body.style.userSelect;document.body.style.cursor="ew-resize",document.body.style.userSelect="none";let T=!1;const C=L=>{if(d.current!==null&&L.pointerId!==d.current)return;const D=r==="left"?S-L.clientX:L.clientX-S,$=xw(w+D,t,n);_&&(_.style.width=$+"px"),f.current=$},M=L=>{if(T)return;T=!0,window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",I),window.removeEventListener("lostpointercapture",I),document.body.style.cursor=N,document.body.style.userSelect=R;const D=d.current;if(d.current=null,D!==null)try{k.releasePointerCapture(D)}catch{}L&&f.current!==null?i(f.current):_&&(_.style.width=h.current+"px"),f.current=null,p.current=null},I=()=>M(!1),A=()=>M(!0);window.addEventListener("pointermove",C),window.addEventListener("pointerup",A),window.addEventListener("pointercancel",I),window.addEventListener("lostpointercapture",I),p.current=()=>M(!1)},x=v=>{const k=v.shiftKey?zX:BX;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(),i(xw(_,t,n)))};return a.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 JR={oryzo:"oryzo",apple:"apple",flip7:"flip7",questui:"questui",skylearn:"skylearn",editorial:"editorial",blok:"blok",signal:"signal",lens:"lens"};function qX(e,t){const n=typeof e=="string"?e.toLowerCase():"";return Object.prototype.hasOwnProperty.call(JR,n)?JR[n]:t?"oryzo":"default"}function HX(){const[e,t]=y.useState(()=>{if(typeof window<"u"){const A=localStorage.getItem("pave-theme");return A?A==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),[n,r]=y.useState(!1),[i,o]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(!1),[p,h]=y.useState(!1),[m,x]=y.useState(!1),[v,k]=y.useState(!1),[_,S]=y.useState(!1),[w,N]=y.useState(!1),R=e||n;y.useEffect(()=>{const A=document.documentElement;A.classList.toggle("dark",R),A.classList.toggle("theme-oryzo",n),A.classList.toggle("theme-apple",i),A.classList.toggle("theme-flip7",l),A.classList.toggle("theme-questui",d),A.classList.toggle("theme-skylearn",p),A.classList.toggle("theme-editorial",m),A.classList.toggle("theme-blok",v),A.classList.toggle("theme-signal",_),A.classList.toggle("theme-lens",w),A.style.colorScheme=R?"dark":"light",localStorage.setItem("pave-theme",e?"dark":"light"),localStorage.setItem("pave-oryzo",n?"true":"false"),localStorage.setItem("pave-apple",i?"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",w?"true":"false")},[R,e,n,i,l,d,p,w,m,v,_]);const[T,C]=y.useState(()=>typeof window<"u"?localStorage.getItem("pave-mobile-frameless")!=="false":!1);y.useEffect(()=>{typeof window<"u"&&localStorage.setItem("pave-mobile-frameless",T?"true":"false")},[T]);const[M,I]=y.useState(!1);return{darkMode:R,setDarkMode:t,oryzoMode:n,setOryzoMode:r,appleMode:i,setAppleMode:o,flip7Mode:l,setFlip7Mode:u,questuiMode:d,setQuestuiMode:f,skylearnMode:p,setSkylearnMode:h,editorialMode:m,setEditorialMode:x,blokMode:v,setBlokMode:k,signalMode:_,setSignalMode:S,lensMode:w,setLensMode:N,matrixMode:M,setMatrixMode:I,mobileFrameless:T,setMobileFrameless:C}}const lp=200,B1=600;function $X(e,t){const n=Number(e&&e.terminalWidth),r=Number.isFinite(n)?Math.min(B1,Math.max(lp,n)):lp,i=y.useCallback(o=>{const l=typeof o=="function"?o(r):o;t&&t("terminalWidth",l)},[t,r]);return{terminalWidth:r,setTerminalWidth:i}}const Lv="pave-sidebar-width";function WX(){const[e,t]=y.useState(()=>typeof window>"u"?Ou:CL(localStorage.getItem(Lv))),n=y.useRef(e);return n.current=e,y.useEffect(()=>{const r=setTimeout(()=>{localStorage.setItem(Lv,String(e))},200);return()=>clearTimeout(r)},[e]),y.useEffect(()=>{const r=()=>{localStorage.setItem(Lv,String(n.current))};return window.addEventListener("beforeunload",r),()=>{r(),window.removeEventListener("beforeunload",r)}},[]),{sidebarWidth:e,setSidebarWidth:t}}function VX(e,t,n){const[r,i]=y.useState(()=>t?t.paneVisible!==!1:!0),[o,l]=y.useState(""),u=y.useRef(r);u.current=r;const d=t?t.paneVisible!==!1:!0;y.useEffect(()=>{i(d)},[d]);const f=y.useCallback(h=>{const m=!!h;u.current!==m&&(u.current=m,i(m),n&&n("paneVisible",m))},[n]),p=y.useCallback(()=>{const h=!u.current;f(h),l(e(h?"app.right_pane_shown":"app.right_pane_hidden"))},[e,f]);return{rightPaneVisible:r,setRightPaneVisible:f,toggleRightPane:p,rightPaneAnnouncement:o}}const GX="pave-banner-hidden";function KX(e){return e?e.getItem(GX)==="true":!1}function YX(e){return!e}function QX(e,t){const n=()=>typeof window<"u"?window.localStorage:null,[r,i]=y.useState(()=>e?e.bannerHidden===!0:KX(n())),o=y.useRef(r);o.current=r;const l=e?e.bannerHidden===!0:!1;y.useEffect(()=>{i(l)},[l]);const u=y.useCallback(()=>{const d=YX(o.current);o.current=d,i(d),t&&t("bannerHidden",d)},[t]);return{bannerHidden:r,toggleBanner:u}}function XX(e,t){const[n,r]=y.useState(()=>e&&e.paneTab||"map"),i=e&&e.paneTab||"map";y.useEffect(()=>{r(i)},[i]);const o=y.useCallback(l=>{r(l),t&&t("paneTab",l)},[t]);return{paneTab:n,setPaneTab:o}}const ZX=["activities","map","tools","canvas","terminal"],Su={paneVisible:!0,paneTab:"map",terminalWidth:288,bannerHidden:!1,mapShowCompleted:!0,toolmapShowHidden:!1,toolmapShowThoughts:!1},JX=400,eA="pave-hacker";let tA=!1;const Mf={};function eZ(e){return ZX.indexOf(e)!==-1}function pu(e,t){try{const n=localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function nA(e){try{const t=parseFloat(localStorage.getItem(e));if(Number.isFinite(t)&&t>.1)return t}catch{}}function rA(e){try{const t=localStorage.getItem(e);if(t==="LR"||t==="TB")return t}catch{}}function tZ(){if(typeof window>"u")return{};const e={},t=pu("pave-right-pane-visible",null);t!==null&&(e.paneVisible=t);try{const l=localStorage.getItem("pave-activity-view");eZ(l)&&(e.paneTab=l)}catch{}try{const l=parseInt(localStorage.getItem("pave-terminal-width"),10);Number.isFinite(l)&&l>=lp&&l<=B1&&(e.terminalWidth=l)}catch{}e.bannerHidden=pu("pave-banner-hidden",Su.bannerHidden);const n=nA("pave-map-zoom");n!==void 0&&(e.mapZoom=n);const r=rA("pave-map-rankdir");r!==void 0&&(e.mapRankdir=r),e.mapShowCompleted=pu("pave-map-show-completed",Su.mapShowCompleted);const i=nA("pave-toolmap-zoom");i!==void 0&&(e.toolmapZoom=i);const o=rA("pave-toolmap-rankdir");if(o!==void 0&&(e.toolmapRankdir=o),e.toolmapShowHidden=pu("pave-toolmap-show-hidden",Su.toolmapShowHidden),e.toolmapShowThoughts=pu("pave-toolmap-show-thoughts",Su.toolmapShowThoughts),!tA){tA=!0;try{localStorage.getItem(eA)==="true"&&(e.paneTab="terminal"),localStorage.removeItem(eA)}catch{}}return e}function nZ(e,t,n){const[r,i]=y.useState(Mf),o=t&&t.ui&&t.ui.displayLayout||null,l=y.useRef(t);l.current=t;const u=y.useRef(null),d=y.useRef(void 0);o?(u.current=null,d.current=void 0):d.current!==e&&(d.current=e,u.current=tZ());const f=o?Mf:u.current||Mf,p=y.useMemo(()=>({...Su,...f,...o||{},...r}),[f,o,r]),h=y.useRef(p),m=y.useRef(null),x=y.useRef(null);m.current?m.current.sessionId===e&&(m.current.ui=t&&t.ui||{}):h.current=p;const v=y.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null)},[]),k=y.useCallback(()=>{v();const R=m.current;if(m.current=null,!R||!R.sessionId)return;const{sessionId:T,layout:C}=R;let M=R.ui||{};n(I=>{const A=I.find(L=>L.id===T);return A?(M=A.ui||{},I.map(L=>L.id===T?{...L,ui:{...M,displayLayout:C}}:L)):I}),yi(T,{ui:{...M,displayLayout:C}}).catch(I=>{console.error("Failed to persist displayLayout:",I)})},[v,n]),_=y.useRef(k);_.current=k;const S=y.useCallback(()=>{if(!m.current){v();return}_.current()},[v]),w=y.useCallback((R,T)=>{const C={...h.current,[R]:T};h.current=C,i(I=>({...I,[R]:T}));const M=l.current;m.current={sessionId:e,layout:C,ui:M&&M.ui||{}},v(),x.current=setTimeout(()=>_.current(),JX)},[e,v]),N=y.useRef(e);return y.useEffect(()=>{if(N.current===e)return;const R=N.current;N.current=e,m.current&&m.current.sessionId===R?_.current():(m.current=null,v()),i(T=>Object.keys(T).length===0?T:Mf)},[e,v]),y.useEffect(()=>{if(typeof window>"u")return;const R=()=>_.current();return window.addEventListener("beforeunload",R),()=>{window.removeEventListener("beforeunload",R),R()}},[]),{displayLayout:p,setLayoutField:w,flushLayout:S}}const rZ=150;function iZ(e){return e?e.nodeType===1?e:e.parentElement||null:null}function aZ(e){const t=iZ(e.anchorNode);return!t||!t.closest?null:t.closest("[data-message-id]")}function sZ({enabled:e=!0,onQuoteAdd:t}={}){const[n,r]=y.useState(null),i=y.useRef(t);i.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 h=p.toString();if(!h||!h.trim()){r(null);return}const m=aZ(p);if(!m){r(null);return}const x=p.getRangeAt(0).getBoundingClientRect();r({text:h,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:kq(p)})},d=()=>{l&&clearTimeout(l),l=setTimeout(()=>{l=null,u()},rZ)},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 oZ=["web","agent"],lZ=["tui","acp"];function Ov(e){return e?e.client?oZ.indexOf(e.client)!==-1:lZ.indexOf(e.source)===-1:!1}const wM="pave-pwa-install-dismissed";let Dv=null;function cZ(){const e=typeof navigator<"u"&&navigator.userAgent||"",t=/iphone|ipod|ipad/i.test(e),n=/macintosh/i.test(e)&&typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>1;return t||n}function uZ(){try{return localStorage.getItem(wM)==="true"}catch{return!1}}function dZ(){try{localStorage.setItem(wM,"true")}catch{}}function fZ(){const{t:e}=Gt(),[t,n]=y.useState(Dv),[r,i]=y.useState(!1);y.useEffect(()=>{if(gM()||uZ())return;const u=f=>{f.preventDefault(),Dv=f,n(f)},d=()=>{Dv=null,n(null),i(!1)};return window.addEventListener("beforeinstallprompt",u),window.addEventListener("appinstalled",d),cZ()&&i(!0),()=>{window.removeEventListener("beforeinstallprompt",u),window.removeEventListener("appinstalled",d)}},[]);const o=()=>{dZ(),n(null),i(!1)},l=async()=>{if(t){t.prompt();try{await t.userChoice}catch{}n(null)}};return!t&&!r?null:a.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-40 px-3 pb-3 pointer-events-none","data-testid":"pwa-install-prompt",children:a.jsxs("div",{className:"pointer-events-auto mx-auto max-w-md rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-lg px-4 py-3 flex items-center gap-3",children:[a.jsx("img",{src:ar("/icon-192x192.png"),alt:"",className:"h-10 w-10 rounded-lg shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:e("pwa.install_title")}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e(r?"pwa.ios_howto":"pwa.install_description")})]}),!r&&a.jsx("button",{type:"button",onClick:l,className:"shrink-0 px-3 py-1.5 rounded-lg bg-primary-600 hover:bg-primary-700 text-white text-sm font-medium",children:e("pwa.install_button")}),a.jsx("button",{type:"button",onClick:o,"aria-label":e(r?"pwa.install_got_it":"pwa.install_dismiss"),className:"shrink-0 px-2 py-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 text-sm",children:e(r?"pwa.install_got_it":"pwa.install_dismiss")})]})})}function pZ(e){return!!(e&&(e.status||e.response&&e.response.status)===404)}function Pv(e,t){return e.filter(n=>n&&n.id!==t)}function hZ(e){return"Failed to load messages: "+(e&&e.message?e.message:String(e))}function gZ(e,t,n){const r={...e};return n.length===0?delete r[t]:r[t]=n,r}function mZ(e){return!!(e&&e.status===409)}function iA(e,t){return!!(e&&e.length>0||t&&t.length>0)}const SM="session",xZ=/^[A-Za-z0-9][A-Za-z0-9_-]{3,63}$/;function EM(e){return typeof e=="string"&&xZ.test(e)}function NM(){return ar("")}function yZ(e){return"/"+SM+"/"+encodeURIComponent(e)}function bZ(e){return ar(yZ(e))}function vZ(){return NM()||"/"}function kZ(e,t){const n=typeof e=="string"?e:"",r=NM();return r?n===r?"/":n.startsWith(r+"/")?n.slice(r.length)||"/":null:n}function _Z(e,t){const n=kZ(e);if(n===null)return{kind:"outside",sessionId:null};const r=n.length>1?n.replace(/\/+$/,""):n;if(r===""||r==="/")return{kind:"root",sessionId:null};const i=r.split("/").filter(Boolean);if(i[0]!==SM)return{kind:"other",sessionId:null};if(i.length!==2)return{kind:"invalid",sessionId:null};let o=i[1];try{o=decodeURIComponent(i[1])}catch{return{kind:"invalid",sessionId:null}}return EM(o)?{kind:"session",sessionId:o}:{kind:"invalid",sessionId:null}}function aA(){return typeof window>"u"||!window.location?{kind:"outside",sessionId:null}:_Z(window.location.pathname)}function wZ(e){const t=e||{};return t.pathId?{sessionId:t.pathId,source:"path"}:t.queryId?{sessionId:t.queryId,source:"query"}:t.storedId?{sessionId:t.storedId,source:"storage"}:{sessionId:null,source:null}}function CM(e){return e==="path"||e==="query"}const SZ="forbidden",EZ="not_found",NZ="malformed";function sA(){return{code:NZ,sessionId:null}}function CZ(e,t,n){const r=Array.isArray(n)?n:[];return t&&t!==e?t:r.length>0?r[0].id:null}function jZ(e,t){const n=!CM(e);if(e!=="path")return{clear:n,refusal:null,fallback:!1};const r=t&&typeof t.status=="number"?t.status:null;return r===401?{clear:!1,refusal:null,fallback:!1}:{clear:n,refusal:{code:r===403?SZ:EZ,sessionId:null},fallback:!0}}function jM(e){if(typeof window>"u"||!window.history||typeof e!="string")return!1;try{return window.history.replaceState(window.history.state||{},"",e),!0}catch{return!1}}function oA(e){return EM(e)?jM(bZ(e)):!1}function Nk(){return jM(vZ())}const lA=40;function TZ(e){const t=jZ(e.source,e.error);if(!t.fallback)return t;const n=CZ(e.sessionId,e.storedId,e.sessions);return n?e.selectSession(n):Nk(),t.refusal&&e.setRefusal({code:t.refusal.code,sessionId:e.sessionId}),t}function RZ(){var jd,Ma,js;const{t:e}=Gt(),{darkMode:t,setDarkMode:n,oryzoMode:r,setOryzoMode:i,appleMode:o,setAppleMode:l,flip7Mode:u,setFlip7Mode:d,questuiMode:f,setQuestuiMode:p,skylearnMode:h,setSkylearnMode:m,editorialMode:x,setEditorialMode:v,blokMode:k,setBlokMode:_,signalMode:S,setSignalMode:w,lensMode:N,setLensMode:R,matrixMode:T,setMatrixMode:C,mobileFrameless:M,setMobileFrameless:I}=HX(),{sidebarWidth:A,setSidebarWidth:L}=WX(),D="pave-active-session";function $(){try{return localStorage.getItem(D)||null}catch{return null}}function te(O){try{O?localStorage.setItem(D,O):localStorage.removeItem(D)}catch{}}function V(){try{localStorage.removeItem(D)}catch{}}const[,z]=y.useState(0),[G,K]=y.useState(!1),H=y.useRef(null),se=y.useRef(new Map),[P,W]=y.useState(()=>new Set),[ee,F]=y.useState(()=>new Set),J=y.useRef(null),q=y.useRef("chat"),Y=y.useRef(null),oe=y.useMemo(()=>typeof window>"u"?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent||""),[]),[_e,ae]=y.useState(!0),[ye,Fe]=y.useState(!1),[ct,ht]=y.useState(null),[pt,et]=y.useState(null),[ze,Be]=y.useState("chat");q.current=ze;const[At,lt]=y.useState(!1),[on,_t]=y.useState(!1),[gn,Ht]=y.useState(!1),[Kt,ut]=y.useState(!1),[Pe,le]=y.useState([]),[be,fe]=y.useState({}),Oe=y.useRef(!1);y.useEffect(()=>{wO().then(async O=>{if(Fe(O.enabled),O.authenticated&&O.user){Oe.current=!0;try{sessionStorage.removeItem("pave-restore-reloads")}catch{}ht(O.user)}else O.enabled&&await Tk()}).catch(O=>{console.error("Failed to check auth status:",O)}).finally(()=>ae(!1))},[]),y.useEffect(()=>(Sw(({recovered:O,user:Q})=>{if(O){let ne=-1;try{ne=parseInt(sessionStorage.getItem("pave-restore-reloads")||"0",10)}catch{ne=-1}if(ne>=0&&ne<1){let ce=!1;try{sessionStorage.setItem("pave-restore-reloads",String(ne+1)),ce=!0}catch{ce=!1}if(ce){window.location.reload();return}}if(Q){Oe.current=!0,ht(Q);return}}Oe.current&&yt("Session expired. Please log in again."),ht(null)}),()=>Sw(null)),[]),y.useEffect(()=>{ye&&!ct&&pn.disconnect()},[ct,ye]),y.useEffect(()=>{if(!ct)return;let O=!1;return T3().then(Q=>{!O&&Q&&Q.currentVersion&&et(Q.currentVersion)}).catch(()=>{}),()=>{O=!0}},[ct]),y.useEffect(()=>{tQ(()=>J.current),mM().catch(()=>{})},[]);const ft=y.useCallback(async()=>{try{await SO()}catch(O){console.error("Logout failed:",O);return}ht(null),window.location.reload()},[]),[gt,dt]=y.useState(null),[Lt,Wt]=y.useState(!1),[rt,wt]=y.useState([]),[Yt,an]=y.useState([]),[kt,xe]=y.useState({}),De=y.useRef(kt);y.useEffect(()=>{De.current=kt},[kt]);const Ke=y.useRef({}),[X,Ee]=y.useState(()=>window.matchMedia("(min-width: 768px)").matches),[Te,mt]=y.useState(!1),Ut=y.useRef(!1),Rt=y.useRef(null),st=y.useRef(0);y.useEffect(function(){return function(){st.current&&cancelAnimationFrame(st.current)}},[]);const ve=y.useCallback(function(){st.current&&cancelAnimationFrame(st.current),st.current=requestAnimationFrame(function(){st.current=0,Rt.current&&Rt.current.scrollToBottom()})},[]),[Re,Xe]=y.useState([]),Ie=y.useRef([]);Ie.current=Re;const[ie,Ct]=y.useState(null),[mn,Me]=y.useState(null);J.current=ie,y.useEffect(()=>{te(ie)},[ie]),y.useEffect(()=>{ie&&nQ(typeof document<"u"&&document.visibilityState==="visible",ie)},[ie]);const[Et,kn]=y.useState([]),Wn=y.useCallback(function(O){O&&kn(function(Q){return fq(Q,O.text)?Q.concat([{qid:uq(),text:p1(O.text),sourceMessageID:O.sourceMessageID||null,sourceRole:O.sourceRole==="user"?"user":"assistant",sourceTime:O.sourceTime||"",fromCode:O.fromCode===!0}]):Q})},[]),ki=y.useCallback(function(O){kn(function(Q){return Q.filter(function(ne){return ne.qid!==O})})},[]),kr=y.useCallback(function(){kn([])},[]),{selection:dr,clearSelection:wa}=sZ({onQuoteAdd:Wn}),Bs=y.useCallback(function(){dr&&Sp(dr.text)},[dr]);y.useEffect(function(){kn([])},[ie]);const $t=y.useMemo(()=>ie&&Re.find(O=>O.id===ie)||null,[ie,Re]),{displayLayout:Kn,setLayoutField:Ui}=nZ(ie,$t,Xe),{paneTab:fr,setPaneTab:tn}=XX(Kn,Ui),{terminalWidth:ia,setTerminalWidth:aa}=$X(Kn,Ui),{rightPaneVisible:qi,toggleRightPane:Hi,rightPaneAnnouncement:Ye}=VX(e,Kn,Ui),{bannerHidden:Nt,toggleBanner:ln}=QX(Kn,Ui),vn=Kn.paneVisible&&Kn.paneTab==="terminal";y.useEffect(()=>{const O=Q=>{if(Q.repeat)return;const ne=typeof Q.key=="string"?Q.key.toLowerCase():"";if((oe?Q.metaKey:Q.ctrlKey)&&!Q.altKey&&!Q.shiftKey&&ne==="k"){Q.preventDefault(),K(Ue=>!Ue);return}if((oe?Q.metaKey:Q.ctrlKey)&&!Q.altKey&&!Q.shiftKey&&ne==="b"){Q.preventDefault(),Ee(Ue=>!Ue);return}const Ae=(oe?Q.metaKey:Q.ctrlKey)&&!Q.altKey&&!Q.shiftKey&&ne==="j",we=window.matchMedia("(min-width: 1024px)").matches,xt=q.current==="chat";Ae&&J.current&&we&&xt&&(Q.preventDefault(),Hi())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[e,oe,Hi]);const[Cn,dn]=y.useState([]),[ri,Nr]=y.useState(0),[_r,pr]=y.useState(!1),[Qr,$r]=y.useState(null),[_i,sa]=y.useState(!1),wi=y.useRef(!1),[Si,$i]=y.useState(!1),[Or,Ei]=y.useState({}),Dr=y.useRef(Or);Dr.current=Or;const[Sa,_n]=y.useState({}),[Zt,ii]=y.useState(null),[On,jn]=y.useState(null),or=y.useRef(null);y.useEffect(function(){return function(){or.current&&clearTimeout(or.current),Qt.current&&clearTimeout(Qt.current)}},[]);const[Xr,Wr]=y.useState(null),[gi,ot]=y.useState(null),[bt,qt]=y.useState(null),Qt=y.useRef(null),xn=y.useCallback((O,Q)=>{if(O){const ne=!Q&&!!Dr.current[O];ne&&O===Pt.current&&(jn(null),or.current&&(clearTimeout(or.current),or.current=null)),Ei(ce=>{const de={...ce},Ae=!!ce[O];if(Q?de[O]=!0:delete de[O],Ae&&!Q&&Zr.current&&Zr.current[O]&&!Xa.current.has(O)){const we=Zr.current[O];if(we.length>0){const xt=we.shift();O===Pt.current&&Vs(we.length),Promise.resolve().then(()=>{try{O===Pt.current&&Rt.current&&Rt.current.resetAutoScroll(),Ss.current&&Ss.current(O,xt.content,xt.imageAttachments,xt.agent,xt.displayContent,xt.queuedTempId,xt.fileAttachments),O===Pt.current&&Rt.current&&(Rt.current.resetAutoScroll(),ve())}catch(Ue){console.error("[Queue] Drain dispatch failed:",Ue)}})}}return de}),ne&&(Xa.current.delete(O),fg(O).then(ce=>{const de=Array.isArray(ce&&ce.items)?ce.items:[];_n(Ae=>{const we={...Ae};if(de.length===0)if(we[O])delete we[O];else return Ae;else we[O]=de;return we})}).catch(()=>{}))}O===Pt.current&&$i(Q)},[ve]),Vn=y.useCallback(O=>{const Q={};Object.keys(O).forEach(ce=>{O[ce]&&O[ce].type==="busy"&&(Q[ce]=!0)}),Ei(ce=>{const de={...ce};return Object.keys(Q).forEach(Ae=>{de[Ae]=!0}),Object.keys(O).forEach(Ae=>{O[Ae]&&O[Ae].type!=="busy"&&delete de[Ae]}),de});const ne=O[Pt.current];$i(!!(ne&&ne.type==="busy"))},[]),[Ea,lr]=y.useState({}),Ni=y.useRef(null),oa=y.useRef(null),[us,Ya]=y.useState({}),[Co,la]=y.useState({});y.useEffect(()=>{fr==="map"&&ie&&pg(ie).then(O=>{O&&Array.isArray(O.todos)&&la(Q=>({...Q,[ie]:O.todos}))}).catch(()=>{})},[fr,ie]);const[ds,Na]=y.useState({});y.useEffect(()=>{fr==="tools"&&ie&&Pw(ie).then(O=>{O&&Na(Q=>({...Q,[ie]:O}))}).catch(()=>{})},[fr,ie]);const[Ci,Ca]=y.useState(null),[fc,Qa]=y.useState(null),[fs,yt]=y.useState(null),[ps,hs]=y.useState(!1),[ji,jo]=y.useState(null),Ze=50,[U,he]=y.useState(!1),[Ce,Le]=y.useState(0),tt=y.useRef(0),[It,Dt]=y.useState(0),[Rn,Wi]=y.useState(""),Cr=y.useRef(""),[ai,Vr]=y.useState(!0),[zn,ca]=y.useState(!1),[fl,pl]=y.useState(""),[To,ua]=y.useState(0),[Vi,hl]=y.useState(0),[zs,Us]=y.useState(!1),pc=y.useRef(null),hc=y.useRef(null),[Kp,gc]=y.useState(!1),[Yp,Qp]=y.useState(""),[da,gl]=y.useState(null),[Xp,ld]=y.useState(!1),[Ro,cd]=y.useState(null),[Zp,ml]=y.useState(!1),[mc,ud]=y.useState({}),xc=y.useRef({}),[yc,xl]=y.useState({}),gs=y.useRef({}),[Jp,dd]=y.useState({}),bc=y.useRef({}),Ao=y.useRef(new Set),ms=y.useRef(null);y.useEffect(()=>{xc.current=mc},[mc]),y.useEffect(()=>{gs.current=yc},[yc]),y.useEffect(()=>{if(!ie)return;const O=Re.find(Q=>Q.id===ie);O&&(O.moe_top_k!=null&&xc.current[ie]===void 0&&ud(Q=>Q[ie]===void 0?{...Q,[ie]:O.moe_top_k}:Q),O.reasoning_effort&&gs.current[ie]===void 0&&xl(Q=>Q[ie]===void 0?{...Q,[ie]:O.reasoning_effort}:Q))},[ie,Re]);const vc=mc[ie]??null,qs=yc[ie]??"max",fd=Jp[ie]??null,xs=y.useCallback((O,Q)=>{cd({text:O,type:Q||"info"}),ms.current&&clearTimeout(ms.current),ms.current=setTimeout(()=>{cd(null),ms.current=null},3e3)},[]),pd=y.useCallback((O,Q)=>{const ne=O&&(O.properties||O)||{};if(ne.sessionID!==Q)return;const ce=Array.isArray(ne.warnings)?ne.warnings.filter(Boolean):[];if(ce.length===0)return;const de=ce.length>1?" (+"+(ce.length-1)+" more)":"";xs(String(ce[0])+de,"warning")},[xs]);function kc(O,Q){return(Array.isArray(O==null?void 0:O.settings)?O.settings:[]).find(ce=>ce&&ce.key===Q)||null}const[yl,Io]=y.useState(!1),[ys,eh]=y.useState(!1),[Hs,th]=y.useState(!1),[bl,_c]=y.useState(!1),[wc,hd]=y.useState(!1),[Sc,gd]=y.useState(!1),[An,nh]=y.useState("default"),vl=An==="oryzo",[jr,rh]=y.useState(!1);y.useEffect(()=>{const O=()=>{jA().then(Q=>{const ne=Ue=>{const Un=kc(Q,Ue),In=String(Un&&Un.value||"").toLowerCase();return In==="true"||In==="1"};Io(ne("PAVE_EXPERIMENTAL_SESSION_BANNER")),eh(ne("PAVE_EXPERIMENTAL_AGENT_BOARD")),th(ne("PAVE_CAPABILITIES_EXPERIMENTAL")),_c(ne("PAVE_EXPERIMENTAL_TRIGGERS"));const ce=ne("PAVE_EXPERIMENTAL_PLAN_MODE");hd(ce),GL(ce);const de=ne("PAVE_EXPERIMENTAL_DIMMED_HISTORY");gd(de),KL(de);const Ae=kc(Q,"PAVE_EXPERIMENTAL_THEME"),we=Ae&&String(Ae.value||"").toLowerCase(),xt=qX(we,ne("PAVE_EXPERIMENTAL_ORYZO_THEME"));nh(xt),rh(!0)}).catch(Q=>{console.error("[Experimental] Failed to load feature flags:",Q.message)})};return O(),window.addEventListener("pave:settings-updated",O),()=>window.removeEventListener("pave:settings-updated",O)},[ze]),y.useEffect(()=>{!ys&&ze==="board"&&Be("chat"),!Hs&&ze==="capabilities"&&Be("chat"),!bl&&ze==="triggers"&&Be("chat")},[ys,Hs,bl,ze]),y.useEffect(()=>{!vl&&r&&i(!1)},[vl,r,i]),y.useEffect(()=>{An!=="apple"&&o&&l(!1)},[An,o,l]),y.useEffect(()=>{An!=="flip7"&&u&&d(!1)},[An,u,d]),y.useEffect(()=>{An!=="questui"&&f&&p(!1)},[An,f,p]),y.useEffect(()=>{An!=="skylearn"&&h&&m(!1)},[An,h,m]),y.useEffect(()=>{An!=="editorial"&&x&&v(!1)},[An,x,v]),y.useEffect(()=>{An!=="blok"&&k&&_(!1)},[An,k,_]),y.useEffect(()=>{An!=="signal"&&S&&w(!1)},[An,S,w]),y.useEffect(()=>{An!=="lens"&&N&&R(!1)},[An,N,R]);const Ti=y.useRef(!1);y.useEffect(()=>{jr&&vl&&!Ti.current&&(Ti.current=!0,i(!0))},[jr,vl]);const $s=y.useRef(!1);y.useEffect(()=>{jr&&An==="apple"&&!$s.current&&($s.current=!0,l(!0))},[jr,An,l]);const Ec=y.useRef(!1);y.useEffect(()=>{jr&&An==="flip7"&&!Ec.current&&(Ec.current=!0,d(!0))},[jr,An,d]);const Nc=y.useRef(!1);y.useEffect(()=>{jr&&An==="questui"&&!Nc.current&&(Nc.current=!0,p(!0))},[jr,An,p]);const Cc=y.useRef(!1);y.useEffect(()=>{jr&&An==="skylearn"&&!Cc.current&&(Cc.current=!0,m(!0))},[jr,An,m]);const jc=y.useRef(!1);y.useEffect(()=>{jr&&An==="editorial"&&!jc.current&&(jc.current=!0,v(!0))},[jr,An,v]);const kl=y.useRef(!1);y.useEffect(()=>{jr&&An==="blok"&&!kl.current&&(kl.current=!0,_(!0))},[jr,An,_]);const md=y.useRef(!1);y.useEffect(()=>{jr&&An==="signal"&&!md.current&&(md.current=!0,w(!0))},[jr,An,w]);const xd=y.useRef(!1);y.useEffect(()=>{jr&&An==="lens"&&!xd.current&&(xd.current=!0,R(!0))},[jr,An,R]),y.useEffect(()=>{const O=()=>{Iw().then(Q=>{Ht(!!(Q&&Q.inspector))}).catch(Q=>{console.error("[Inspector] Failed to fetch config:",Q.message)})};return window.addEventListener("pave:settings-updated",O),()=>window.removeEventListener("pave:settings-updated",O)},[]),y.useEffect(()=>{zs&&pc.current&&pc.current.focus()},[zs]),y.useEffect(()=>{const O=window.matchMedia("(min-width: 1024px)"),Q=ne=>{ne.matches&&Us(!1)};return O.addEventListener("change",Q),()=>O.removeEventListener("change",Q)},[]);function bs(){const O=Co[ie]||[],Q=[];for(const we of Cn||[])for(const xt of we.parts||[]){if(xt.type!=="tool")continue;const Ue=xt.state&&xt.state.output;if(!Ue)continue;let Un=Ue;if(typeof Ue=="string")try{Un=JSON.parse(Ue)}catch{continue}Un&&Un.canvas&&Un.canvas.type&&Un.canvas.source&&Q.push(Un.canvas)}const ne=ie?`pave-canvas-cleared:${ie}`:null;let ce=new Set;if(ne&&typeof window<"u")try{const we=localStorage.getItem(ne);we&&(ce=new Set(JSON.parse(we)))}catch{}const de=Q.filter(we=>!ce.has(we.type+":"+we.source)),Ae=()=>{if(!ne||typeof window>"u")return;const we=Q.map(xt=>xt.type+":"+xt.source);try{localStorage.setItem(ne,JSON.stringify(we))}catch{}z(xt=>xt+1)};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 overflow-y-auto min-w-0 flex flex-col",children:a.jsxs(a.Fragment,{children:[a.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:[a.jsx("button",{type:"button",onClick:()=>tn("activities"),className:`px-2 py-0.5 rounded ${fr==="activities"?"bg-blue-500 text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,title:"Task progress (current turn)","aria-label":"Task progress view",children:"activities"}),a.jsx("button",{type:"button",onClick:()=>tn("map"),className:`px-2 py-0.5 rounded ${fr==="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"}),a.jsx("button",{type:"button",onClick:()=>tn("tools"),className:`px-2 py-0.5 rounded ${fr==="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"}),a.jsxs("button",{type:"button",onClick:()=>tn("canvas"),className:`px-2 py-0.5 rounded relative ${fr==="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",de.length>0?a.jsxs("span",{className:"ml-1 opacity-70",children:["(",de.length,")"]}):null]}),a.jsx("button",{type:"button",onClick:()=>tn("terminal"),className:`px-2 py-0.5 rounded ${fr==="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"})]}),a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:fr==="activities"?a.jsx(BH,{toolParts:li}):fr==="map"?a.jsx(pG,{todos:O,darkMode:t,displayLayout:Kn,setLayoutField:Ui}):fr==="tools"?a.jsx(SG,{graph:ds[ie]||null,darkMode:t,displayLayout:Kn,setLayoutField:Ui}):fr==="canvas"?a.jsx(vK,{canvases:de,onClear:de.length?Ae:null}):a.jsx(WH,{toolParts:Es,matrixMode:T,onToggleMatrix:()=>C(we=>!we),darkMode:t})})]})}),a.jsx(DK,{messages:Cn,isBusy:Si,isCompacting:Zt!=null,activeModel:gt,sessionModel:kt[ie]||null,isPrivateMode:ee.has(ie),registryEntries:Yt})]})}y.useEffect(()=>{ca(!1),pl(""),ua(0),hl(0),Us(!1)},[ie]),y.useEffect(()=>{if(!ie)return;let O=!1;return x3(ie).then(Q=>{if(O||!Q)return;const ne=ie;Q.privateMode&&F(ce=>{if(ce.has(ne))return ce;const de=new Set(ce);return de.add(ne),de}),Array.isArray(Q.messageIds)&&Q.messageIds.length&&W(ce=>{let de=!1;const Ae=new Set(ce);for(const we of Q.messageIds)Ae.has(we)||(Ae.add(we),de=!0);return de?Ae:ce})}).catch(()=>{}),()=>{O=!0}},[ie]),y.useEffect(()=>{if(!ie){ml(!1);return}let O=!1;return EA(ie).then(Q=>{if(O)return;const ne=Q&&Q.config?Q.config:{};ml(!!ne.enabled)}).catch(()=>{}),()=>{O=!0}},[ie]),y.useEffect(()=>{if(!ie){Wt(!1);return}const O=De.current[ie]||gt;if(!O){Wt(!1);return}let Q=!1;return l3(O).then(ne=>{Q||Wt(!!(ne&&ne.adaptiveQuality))}).catch(()=>{Q||Wt(!1)}),()=>{Q=!0}},[ie,gt,kt]),y.useEffect(()=>{Vi>0&&To>=Vi?ua(Vi-1):Vi===0&&To!==0&&ua(0)},[Vi,To]);const Pt=y.useRef(ie);y.useEffect(()=>{Pt.current=ie;const O=Zr.current[ie];Vs(O?O.length:0)},[ie]),y.useEffect(()=>{if(!ie)return;let O=!1;return fg(ie).then(Q=>{if(O)return;const ne=Array.isArray(Q&&Q.items)?Q.items:[],ce=ie;_n(de=>{const Ae={...de};if(ne.length===0)if(Ae[ce])delete Ae[ce];else return de;else Ae[ce]=ne;return Ae})}).catch(Q=>{console.warn("[queue] hydrate failed for",ie,Q&&Q.message)}),()=>{O=!0}},[ie]);const Ws=y.useRef(fr);y.useEffect(()=>{Ws.current=fr},[fr]);const Zr=y.useRef({}),[yd,Vs]=y.useState(0),Xa=y.useRef(new Set),Za=y.useCallback(O=>{if(O===Pt.current){const Q=Zr.current[O];Vs(Q?Q.length:0)}},[]),bd=y.useCallback(O=>{if(!O)return;const Q=Pt.current;if(!Q)return;const ne=Zr.current[Q];Array.isArray(ne)&&ne.length>0&&(Zr.current[Q]=ne.filter(ce=>ce.queuedTempId!==O)),dn(ce=>ce.filter(de=>de.info.id!==O)),Za(Q)},[Za]),Gi=!ye||!!ct;y.useEffect(()=>{!_e&&Gi&&(Ri(),Ra(),Ow().then(O=>{Vn(O)}).catch(O=>{console.error("Failed to fetch session status:",O)}))},[_e,Gi]),y.useEffect(()=>{!_e&&Gi&&(Iw().then(O=>{O&&O.model&&dt(O.model),Ht(!!(O&&O.inspector))}).catch(O=>{console.error("Failed to fetch config:",O)}),_O().then(O=>{O&&Array.isArray(O.providers)&&wt(O.providers)}).catch(O=>{console.error("Failed to fetch providers:",O)}),qv().then(O=>{O&&Array.isArray(O.entries)&&an(O.entries)}).catch(O=>{console.error("Failed to fetch model registry:",O)}),Hv().then(O=>{O&&O.home&&Qp(O.home)}).catch(O=>{console.error("Failed to fetch path info:",O)}))},[_e,Gi]);const _l=y.useCallback(()=>{EO().then(O=>{const Q=Array.isArray(O&&O.pending)?O.pending:[];le(Q)}).catch(O=>{console.error("Failed to fetch pending permissions:",O)})},[]);y.useEffect(()=>{!_e&&Gi&&_l()},[_e,Gi,_l]),y.useEffect(()=>{const ne=setInterval(()=>{le(ce=>{const de=Date.now(),Ae=ce.filter(we=>de-(we.timestamp||0)<3e5);return Ae.length===ce.length?ce:Ae})},3e4);return()=>clearInterval(ne)},[]);const Ri=y.useCallback(async O=>{try{const Q=O&&O.includeArchived||Ut.current,ne=tt.current||0,ce=Math.max(Ze,ne),de=O&&typeof O.q=="string"?O.q:Cr.current,Ae=!!(de&&de.trim()),we=Date.now(),xt=await Wl({limit:ce,offset:0,includeArchived:Ae?!0:Q,includeOtherApps:!1,q:de});if(xt&&xt.sessions){const Ue=Array.isArray(xt.sessions)?xt.sessions:[];Xe(_w({fetched:Ue,current:Ie.current,prependsSince:we})),he(!!xt.hasMore),Dt(typeof xt.total=="number"?xt.total:Ue.length),Le(Ue.length),tt.current=Ue.length}else{const Ue=Array.isArray(xt)?xt:[];Xe(_w({fetched:Ue,current:Ie.current,prependsSince:we})),he(!1),Dt(Ue.length),Le(Ue.length),tt.current=Ue.length}}catch(Q){return console.error("Failed to load sessions:",Q),!1}return!0},[]);function Mo(O,Q){var ne=Q&&Q.time&&Q.time.updated||0,ce=O&&O.time&&O.time.updated||0;return ne-ce}const wl=200,Sl=y.useRef(wl),[vd,ja]=y.useState(!1),[Gs,vs]=y.useState([]),ih=200,[Tc,Ta]=y.useState([]),ah=y.useMemo(()=>{if(!(Gs.length||Tc.length))return Re;const Q=Object.create(null),ne=[],ce=Re.concat(Gs,Tc);for(let de=0;de<ce.length;de++){const Ae=ce[de];!Ae||!Ae.id||Q[Ae.id]||(Q[Ae.id]=!0,ne.push(Ae))}return ne.sort(Mo)},[Re,Gs,Tc]),El=y.useCallback(async()=>{const O=Cr.current,Q=!!(O&&O.trim());if(!Ut.current&&!Q){Ta([]);return}try{const ne=await Wl({limit:ih,offset:0,onlyArchived:!0,q:O}),ce=ne&&ne.sessions?Array.isArray(ne.sessions)?ne.sessions:[]:Array.isArray(ne)?ne:[];Ta(ce)}catch(ne){console.error("Failed to load archived sessions:",ne)}},[]),Ra=y.useCallback(async()=>{const O=Cr.current,Q=!!(O&&O.trim());try{const ne=await Wl({limit:Sl.current,offset:0,onlyOtherApps:!0,includeArchived:Q?!0:Ut.current,q:O}),ce=ne&&ne.sessions?Array.isArray(ne.sessions)?ne.sessions:[]:Array.isArray(ne)?ne:[];vs(ce),ja(!!(ne&&ne.hasMore))}catch(ne){console.warn("Failed to load other-app sessions:",ne),vs([]),ja(!1)}},[]),Yn=y.useCallback(async()=>{Sl.current+=wl,await Ra()},[Ra]);y.useEffect(()=>{function O(){ie&&uO(ie).then(function(Q){Q&&Q.sessionID&&(Pt.current=Q.sessionID,Ct(Q.sessionID),Ri())}).catch(function(Q){console.error("Failed to create archive session:",Q);const ne=(()=>{if(!Q)return!1;if(Q.status===404||Q.response&&Q.response.status===404)return!0;if(typeof Q.message=="string"){const ce=Q.message.match(/^(\d{3})\s*:/);if(ce&&parseInt(ce[1],10)===404)return!0}return!1})();yt(e(ne?"archiveViewer.noArchive":"archiveViewer.loadError"))})}return document.addEventListener("navigateToArchiveSession",O),()=>document.removeEventListener("navigateToArchiveSession",O)},[ie,Ri,e,yt]);const Rc=async()=>{try{const O=Cr.current,Q=!!(O&&O.trim()),ne=await Wl({limit:Ze,offset:Ce,includeArchived:Q?!0:Ut.current,includeOtherApps:!1,q:O});if(ne&&ne.sessions){const ce=Array.isArray(ne.sessions)?ne.sessions:[];Xe(de=>{for(var Ae={},we=0;we<de.length;we++)Ae[de[we].id]=!0;for(var xt=[],Ue=0;Ue<ce.length;Ue++)Ae[ce[Ue].id]||xt.push(ce[Ue]);return de.concat(xt)}),he(!!ne.hasMore),typeof ne.total=="number"&&Dt(ne.total),Le(de=>{var Ae=de+ce.length;return tt.current=Ae,Ae})}}catch(O){console.error("Failed to load more sessions:",O)}},si=async(O,Q)=>{try{const ne=bA(),ce=(Q?Q.fresh!==!1:!0)&&!wi.current&&!ne,de=await jw(O,ce,ce?{limit:lA}:void 0),Ae=de&&!Array.isArray(de)&&Array.isArray(de.messages),we=Ae?de.messages:de,xt=Ae&&typeof de.compactedOutCount=="number"?de.compactedOutCount:0;return Pt.current!==O?null:Array.isArray(we)?(Nr(ce?xt:0),ce&&Ae?(pr(de.hasMore===!0),$r(typeof de.nextCursor=="string"?de.nextCursor:null)):(pr(!1),$r(null)),dn(Ue=>{const Un=we.some(He=>He.info.mode==="compaction"),In=Array.isArray(Ue)&&Ue.some(He=>He.info&&He.info.mode==="compaction");if(Un&&!In)return we;const cr=new Set(we.map(He=>He.info.id)),me=we.reduce(function(He,it){return it&&it.info&&it.info.mode==="compaction"&&it.info.time&&typeof it.info.time.created=="number"?Math.max(He,it.info.time.created):He},-1/0),Z=Ue.filter(He=>He.info.sessionID===O&&!cr.has(He.info.id)&&!String(He.info.id).startsWith("temp-")&&!(me!==-1/0&&He.info.time&&typeof He.info.time.created=="number"&&He.info.time.created<me));if(Z.length===0)return we;const ue=[];let Ne=0,Ge=0;for(;Ne<we.length||Ge<Z.length;){const He=we[Ne],it=Z[Ge],Vt=He&&He.info.time&&typeof He.info.time.created=="number"?He.info.time.created:1/0,zt=it&&it.info.time&&typeof it.info.time.created=="number"?it.info.time.created:1/0;Ne<we.length&&(Ge>=Z.length||Vt<=zt)?(ue.push(He),Ne++):(ue.push(it),Ge++)}return ue}),we):(dn([]),null)}catch(ne){return console.error("Failed to load messages:",ne),Pt.current===O&&(pZ(ne)?(Pt.current=null,Ct(null),Xe(ce=>Pv(ce,O)),vs(ce=>Pv(ce,O)),Ta(ce=>Pv(ce,O))):yt(hZ(ne))),null}},ks=y.useCallback(async O=>Pt.current!==O?null:(wi.current=!0,si(O,{fresh:!1})),[si]);y.useEffect(()=>{Sc&&ie&&(wi.current||ri!==0&&ks(ie))},[Sc,ie,ri,ks]);const kd=async O=>{if(_i||!_r||!Qr||wi.current||Pt.current!==O)return null;sa(!0);try{const Q=await jw(O,!0,{limit:lA,before:Qr});if(Pt.current!==O)return null;if(!Q||Array.isArray(Q)||!Array.isArray(Q.messages))throw new Error("Invalid paged message response");return Nr(typeof Q.compactedOutCount=="number"?Q.compactedOutCount:0),pr(Q.hasMore===!0),$r(typeof Q.nextCursor=="string"?Q.nextCursor:null),dn(ne=>{const ce=new Map;for(const de of Q.messages.concat(ne))de&&de.info&&de.info.id&&ce.set(de.info.id,de);return Array.from(ce.values()).sort((de,Ae)=>{const we=de.info.time.created-Ae.info.time.created;return we!==0?we:de.info.id<Ae.info.id?-1:de.info.id>Ae.info.id?1:0})}),Q.messages}catch(Q){return Pt.current===O&&yt("Failed to load earlier messages: "+(Q&&Q.message?Q.message:String(Q))),null}finally{Pt.current===O&&sa(!1)}};y.useEffect(()=>{if(!ie){dn([]),Nr(0),pr(!1),$r(null),sa(!1),wi.current=!1,lr({}),Qa(null),Vr(!0);return}dn([]),Nr(0),pr(!1),$r(null),sa(!1),wi.current=!1,Qa(null),Vr(!1),Ca(null),ie&&(Dw(ie).then(me=>{me&&Array.isArray(me.banners)&&Ya(Z=>({...Z,[ie]:me.banners}))}).catch(()=>{}),pg(ie).then(me=>{me&&Array.isArray(me.todos)&&la(Z=>({...Z,[ie]:me.todos}))}).catch(()=>{})),pn.connect(ie);let O=!1,Q=!1,ne=!1,ce=!1;const de=ie,Ae=me=>{if(Pt.current!==de)return;const Z=new Map;if(Array.isArray(me))for(const ue of me){if(!ue||!ue.info||!ue.info.id||!Array.isArray(ue.parts))continue;const Ne=new Set;for(const Ge of ue.parts)Ge&&(Ge.type==="text"||Ge.type==="reasoning")&&Ne.add(Ge.type);Ne.size>0&&Z.set(ue.info.id,Ne)}lr(ue=>{const Ne=ue[de];if(!Ne||Object.keys(Ne).length===0)return ue;const Ge={};let He=!1;for(const it of Object.keys(Ne)){const Vt=Ne[it],zt={};let fn=!1;const qn=Z.get(it);for(const Hn of Object.keys(Vt)){const hr=Vt[Hn];if(hr._fromSnapshot){zt[Hn]=hr,fn=!0;continue}const Pr=hr.type;if(qn&&qn.has(Pr)){He=!0;continue}zt[Hn]=Vt[Hn],fn=!0}fn?Ge[it]=zt:He=!0}if(!He)return ue;if(Object.keys(Ge).length===0){const it={...ue};return delete it[de],it}return{...ue,[de]:Ge}})},we=setTimeout(()=>{!O&&!Q&&(Q=!0,si(de).then(me=>{ne=!0,Ae(me),ce&&Pt.current===de&&si(de).then(Z=>{Ae(Z)})}))},3e3),xt=80;function Ue(){oa.current!=null&&(clearTimeout(oa.current),oa.current=null);const me=Ni.current;me&&(Ni.current=null,lr(Z=>{let ue=Z;for(const Ne of Object.keys(me)){const Ge=me[Ne],He={...ue[Ne]||{}};for(const it of Object.keys(Ge)){const Vt=Ge[it],zt={...He[it]||{}};for(const fn of Object.keys(Vt)){const qn=Vt[fn],Hn=zt[fn];qn.type==="text"||qn.type==="reasoning"?zt[fn]={...qn,text:((Hn==null?void 0:Hn.text)||"")+(qn.delta||"")}:zt[fn]={...Hn,...qn}}He[it]=zt}ue={...ue,[Ne]:He}}return ue}))}function Un(){oa.current==null&&(oa.current=setTimeout(Ue,xt))}function In(me,Z,ue){Ni.current||(Ni.current={});const Ne=Ni.current;Ne[Z]||(Ne[Z]={});const Ge=Ne[Z];Ge[ue]||(Ge[ue]={});const He=Ge[ue],it=He[me.id];me.type==="text"||me.type==="reasoning"?He[me.id]={...me,delta:(it&&it.delta||"")+(me.delta||"")}:He[me.id]={...it,...me}}const cr=[pn.on("connected",()=>{O=!0,clearTimeout(we),Vr(!0),_l(),Ow().then(me=>{Vn(me)}).catch(()=>{}),fg(de).then(me=>{const Z=Array.isArray(me&&me.items)?me.items:[];_n(ue=>{const Ne={...ue};if(Z.length===0)if(Ne[de])delete Ne[de];else return ue;else Ne[de]=Z;return Ne})}).catch(()=>{}),si(de).then(me=>{ne=!0,Ae(me),ce&&Pt.current===de&&si(de).then(Z=>{Ae(Z)})})}),pn.on("error",()=>{Vr(!1),!O&&!Q&&(clearTimeout(we),Q=!0,si(de).then(me=>{ne=!0,Ae(me),ce&&Pt.current===de&&si(de).then(Z=>{Ae(Z)})}))}),pn.on("session.status",me=>{var Ne;const Z=me.properties||me,ue=((Ne=Z.status)==null?void 0:Ne.type)==="busy";xn(Z.sessionID,ue)}),pn.on("message.part.delta",me=>{const Z=(me.properties||me).part;if(!Z||!Z.sessionID)return;se.current.has(Z.sessionID)&&se.current.delete(Z.sessionID);const{sessionID:ue,messageID:Ne}=Z;In(Z,ue,Ne),Un()}),pn.on("streaming.snapshot",me=>{const Z=me.properties||me,ue=Z.sessionID,Ne=Z.parts;!ue||!Array.isArray(Ne)||lr(Ge=>{const He={...Ge[ue]||{}};for(const it of Ne){const Vt={...He[it.messageID]||{}};Vt[it.id]={id:it.id,type:it.type,text:it.text,sessionID:ue,messageID:it.messageID,_fromSnapshot:!0},He[it.messageID]=Vt}return{...Ge,[ue]:He}})}),pn.on("message.progress",me=>{const Z=me.properties||me;Z.sessionID===Pt.current&&Qa({chunks:Z.chunks||0,textLength:Z.textLength||0,toolCalls:Z.toolCalls||0,toolArgBytes:Z.toolArgBytes||0,toolNames:Z.toolNames||[]})}),pn.on("message.part.updated",me=>{const Z=(me.properties||me).part;if(Z){if(Ue(),Z.type==="text"||Z.type==="reasoning"){const ue=Z.sessionID;lr(Ne=>{const Ge=Ne[ue];if(!Ge)return Ne;const He=Ge[Z.messageID];if(!He)return Ne;const it={};var Vt=!1;for(const zt of Object.keys(He))He[zt].type!==Z.type&&(it[zt]=He[zt],Vt=!0);if(!Vt){const zt={...Ge};if(delete zt[Z.messageID],Object.keys(zt).length===0){const fn={...Ne};return delete fn[ue],fn}return{...Ne,[ue]:zt}}return{...Ne,[ue]:{...Ge,[Z.messageID]:it}}})}if(Z.sessionID===Pt.current){if(!ne){Z.sessionID===de&&(ce=!0);return}(Z.type==="tool"||Z.type==="tool-use")&&Ws.current==="tools"&&Pw(Z.sessionID).then(ue=>{ue&&Na(Ne=>({...Ne,[Z.sessionID]:ue}))}).catch(()=>{}),dn(ue=>ue.map(Ne=>{if(Ne.info.id!==Z.messageID)return Ne;const Ge=Ne.parts.findIndex(Vt=>Vt.id===Z.id);if(Ge>=0)return{...Ne,parts:Ne.parts.map((Vt,zt)=>zt===Ge?Z:Vt)};const He=Ne.parts.slice();let it=He.length;for(let Vt=He.length-1;Vt>=0;Vt--){if(He[Vt].id<=Z.id){it=Vt+1;break}Vt===0&&(it=0)}return He.splice(it,0,Z),{...Ne,parts:He}}))}}}),pn.on("message.updated",me=>{const Z=(me.properties||me).info;if(!(!Z||Z.sessionID!==Pt.current)){if(Ue(),!ne){Z.sessionID===de&&(ce=!0);return}if(dn(ue=>{const Ne=ue.findIndex(zt=>zt.info.id===Z.id);if(Ne>=0)return ue.map((zt,fn)=>fn===Ne?{...zt,info:Z}:zt);if(Z.role==="user"){const zt=ue.findIndex(fn=>fn.info.id&&fn.info.id.startsWith("temp-")&&fn.info.role==="user");if(zt>=0)return ue.map((fn,qn)=>qn===zt?{info:Z,parts:[]}:fn)}const Ge={info:Z,parts:[]};if(!Z.time||typeof Z.time.created!="number")return[...ue,Ge];const He=Z.time.created;let it=ue.length;for(let zt=ue.length-1;zt>=0;zt--){const fn=ue[zt].info.time;if(fn&&typeof fn.created=="number"&&fn.created<=He){it=zt+1;break}zt===0&&(it=0)}const Vt=ue.slice();return Vt.splice(it,0,Ge),Vt}),Z.compactedOut!==!0&&Z.finish){const ue=Z.sessionID;lr(Ne=>{const Ge=Ne[ue];if(!Ge||!Ge[Z.id])return Ne;const He={...Ge};if(delete He[Z.id],Object.keys(He).length===0){const it={...Ne};return delete it[ue],it}return{...Ne,[ue]:He}}),Qa(null),Z.finish!=="compacted"&&xn(ue,!1),si(Pt.current)}}}),pn.on("message.deleted",me=>{const Z=me.properties||me,ue=Z.sessionID,Ne=Z.messageID;!ue||!Ne||ue===Pt.current&&(dn(Ge=>Ge.filter(He=>He.info.id!==Ne)),lr(Ge=>{if(!Ge[ue])return Ge;const He=Ge[ue];if(!He[Ne])return Ge;const it={...Ge},Vt={...He};return delete Vt[Ne],it[ue]=Vt,it}))}),pn.on("session.updated",me=>{const Z=me.properties||me,ue=Z.info||Z,Ne=ue&&(ue.id||ue.sessionID)||Z.sessionID||Z.id;if(!Ne){Ri(),Ra();return}const Ge=ue&&ue.time&&typeof ue.time.updated=="number",He=it=>{const zt=!Ie.current.some(qn=>qn&&qn.id===Ne)&&Ov(it),fn=zt?{...it,prependedAt:Date.now()}:it;zt&&(Ie.current=[fn].concat(Ie.current)),Xe(qn=>{var Hn=!1,hr=qn.map(Pr=>Pr.id===Ne?(Hn=!0,{...it,ui:{...it.ui,...Pr.ui}}):Pr);return!Hn&&Ov(it)&&(hr=[fn].concat(hr)),hr.sort(Mo),hr}),Ta(qn=>{var Hn=!1,hr=qn.map(Pr=>Pr.id!==Ne?Pr:(Hn=!0,{...it,ui:{...it.ui,...Pr.ui}}));return Hn?(hr=hr.filter(Pr=>Pr.archived),hr.sort(Mo),hr):qn}),Ov(it)||vs(qn=>{var Hn=!1,hr=qn.map(Pr=>Pr.id!==Ne?Pr:(Hn=!0,{...it,ui:{...it.ui,...Pr.ui}}));return Hn?(hr.sort(Mo),hr):qn})};Ge?(He(ue),xe(it=>{let Vt=it;const zt=ue.model;return typeof zt=="string"&&zt||zt&&typeof zt=="object"&&zt.providerID&&zt.modelID?Vt={...it,[Ne]:zt}:it[Ne]&&(Vt={...it},delete Vt[Ne]),De.current=Vt,Vt})):dg(Ne).then(it=>{He(it),xe(Vt=>{let zt=Vt;const fn=it&&it.model;return typeof fn=="string"&&fn||fn&&typeof fn=="object"&&fn.providerID&&fn.modelID?zt={...Vt,[Ne]:fn}:Vt[Ne]&&(zt={...Vt},delete zt[Ne]),De.current=zt,zt})}).catch(it=>{console.error("Failed to fetch updated session, falling back to full reload:",it),Ri()})}),pn.on("session.deleted",me=>{const Z=me.properties||me,ue=Z.info||Z,Ne=ue&&(ue.id||ue.sessionID)||Z.sessionID||Z.id;Ne&&(Xe(Ge=>Ge.filter(He=>He.id!==Ne)),vs(Ge=>Ge.filter(He=>He.id!==Ne)),Ta(Ge=>Ge.filter(He=>He.id!==Ne)),Ct(Ge=>Ge===Ne?null:Ge))}),pn.on("permission.request",me=>{const Z=me.properties||me;Z.requestId&&le(ue=>ue.some(Ne=>Ne.id===Z.requestId)?ue:[...ue,{id:Z.requestId,action:Z.action,type:Z.type,target:Z.target,reason:Z.reason,description:Z.description,timestamp:Date.now()}])}),pn.on("permission.confirmed",me=>{const Z=me.properties||me;Z.requestId&&le(ue=>ue.filter(Ne=>Ne.id!==Z.requestId))}),pn.on("permission.denied",me=>{const Z=me.properties||me;Z.requestId&&le(ue=>ue.filter(Ne=>Ne.id!==Z.requestId))}),pn.on("question.asked",me=>{const Z=me.properties||me;if(!Z.id)return;const ue=Z.tool&&Z.tool.callID?Z.tool.callID:null;if(ue&&fe(Ne=>({...Ne,[ue]:{id:Z.id,questions:Z.questions}})),O1()){const Ne=Z.questions&&Z.questions[0],Ge=Ne?Ne.text:"A question needs your input.",He=Z.sessionID||null;YY({title:"PAVE — Question",body:Ge.length>200?Ge.slice(0,200)+"…":Ge,tag:"pave-question-"+Z.id,onClick:He?function(){Tr(He),window.focus()}:function(){window.focus()}})}}),pn.on("question.replied",me=>{const Z=me.properties||me;Z.requestId&&fe(ue=>{var Ne={};for(var Ge in ue)(!ue[Ge]||ue[Ge].id!==Z.requestId)&&(Ne[Ge]=ue[Ge]);return Ne})}),pn.on("question.rejected",me=>{const Z=me.properties||me;Z.requestId&&fe(ue=>{var Ne={};for(var Ge in ue)(!ue[Ge]||ue[Ge].id!==Z.requestId)&&(Ne[Ge]=ue[Ge]);return Ne})}),pn.on("quality.hint",me=>{const Z=me.properties||me;if(!Z.preset)return;const ue=Z.sessionID;ue&&(dd(Ne=>({...Ne,[ue]:Z})),bc.current[ue]=Z)}),pn.on("dlp.cancelled",me=>{const ue=(me.properties||me).sessionID;if(!ue)return;const Ne=se.current.get(ue);Ne&&(Ne.tempId&&dn(Ge=>Ge.filter(He=>He.info.id!==Ne.tempId)),ue===Pt.current&&H.current&&typeof H.current.setText=="function"&&H.current.setText(Ne.text||""),se.current.delete(ue)),xn(ue,!1)}),pn.on("dlp.private_message",me=>{const Z=me.properties||me,ue=Z.sessionID,Ne=Z.messageID;!ue||!Ne||(W(Ge=>{if(Ge.has(Ne))return Ge;const He=new Set(Ge);return He.add(Ne),He}),F(Ge=>{if(Ge.has(ue))return Ge;const He=new Set(Ge);return He.add(ue),He}))}),pn.on("dlp.exited_private",me=>{const ue=(me.properties||me).sessionID;ue&&F(Ne=>{if(!Ne.has(ue))return Ne;const Ge=new Set(Ne);return Ge.delete(ue),Ge})}),pn.on("session.error",me=>{const Z=me.properties||me;if(Z.reauthRequired){console.log("[session.error] Re-authentication required, logging out...",Z.source||""),yt("Session expired. Please log in again."),ht(null),Z.sessionID&&xn(Z.sessionID,!1);return}Z.sessionID&&xn(Z.sessionID,!1),Z.sessionID===Pt.current&&(Z.code==="insufficient_credits"?(yt(null),jo(Z.upgradeUrl||null),hs(!0)):yt(Z.error||"An error occurred"))}),pn.on("session.retry",me=>{const Z=me.properties||me;Z.reason==="rate_limit"&&Z.sessionID===Pt.current&&(jn({attempt:Z.attempt,maxRetries:Z.maxRetries,delayMs:Z.delayMs,elapsedMs:Z.elapsedMs||0,maxDurationMs:Z.maxDurationMs||0}),or.current&&clearTimeout(or.current),or.current=setTimeout(()=>jn(null),1e4))}),pn.on("session.compacting",me=>{const Z=me.properties||me;Z.sessionID===Pt.current&&ii(ue=>({...ue,currentTokens:Z.currentTokens??(ue==null?void 0:ue.currentTokens),threshold:Z.threshold??(ue==null?void 0:ue.threshold),reason:Z.reason??(ue==null?void 0:ue.reason),stage:Z.stage??(ue==null?void 0:ue.stage),elapsedMs:Z.elapsedMs??(ue==null?void 0:ue.elapsedMs),messageCount:Z.messageCount??(ue==null?void 0:ue.messageCount),chunks:Z.chunks??(ue==null?void 0:ue.chunks),textLength:Z.textLength??(ue==null?void 0:ue.textLength)}))}),pn.on("session.compacted",me=>{const Z=me.properties||me,ue=Pt.current;if(Z.sessionID===ue){if(ii(null),Wr(null),Z.newSessionID&&Z.newSessionID!==ue&&!Z.inPlace){if(console.log(`[COMPACTED] Cross-session compaction: ${ue} → ${Z.newSessionID}`),Z.newSession){Ks(Z.newSession);const He=Z.newSession.model;(typeof He=="string"&&He||He&&typeof He=="object"&&He.providerID&&He.modelID)&&xe(Vt=>{const zt={...Vt,[Z.newSessionID]:He};return De.current=zt,zt})}Pt.current=Z.newSessionID,Ct(Z.newSessionID),$i(!0);return}if(Z.source==="server"){const He=Z.summary?Z.summary.substring(0,200)+(Z.summary.length>200?"...":""):"";console.log(`[SERVER-COMPACT] Server auto-compacted session: ${Z.deletedMessages} messages replaced, ${Z.summaryTokens||"?"} summary tokens`),He&&console.log("[SERVER-COMPACT] Summary: "+He),Wr({source:"server",deletedMessages:Z.deletedMessages||0,summaryTokens:Z.summaryTokens||0,summary:He})}const Ne=Z.inPlace===!0,Ge=!!Dr.current[ue];Ne&&Ge?console.log("[COMPACTED] In-place compaction during active turn — skipping message reload"):(dn([]),lr(He=>{if(!He[ue])return He;const it={...He};return delete it[ue],it}),Qa(null),si(ue).then(()=>{requestAnimationFrame(()=>{Rt.current&&Pt.current===ue&&Rt.current.scrollToBottom()})}))}}),pn.on("banner.updated",me=>{const Z=me.properties||me;!Z||!Z.sessionID||(Ya(ue=>{const Ne=ue[Z.sessionID]||[];if(Ne.some(He=>He.timestamp===Z.timestamp))return ue;const Ge=[{url:Z.url,timestamp:Z.timestamp,prompt:Z.prompt,createdAt:new Date(Z.timestamp).toISOString()},...Ne];return{...ue,[Z.sessionID]:Ge}}),Z.sessionID===Pt.current&&Ca(null))}),pn.on("banner.progress",me=>{const Z=me.properties||me;if(!Z||Z.sessionID!==Pt.current)return;const ue=Z.stage||"working";let Ne=ue;ue==="queued"?Ne="Banner queued":ue==="summarizing"?Ne="Banner: summarizing…":ue==="rendering"?Ne=Z.line?"Banner: "+Z.line.substring(0,80):"Banner: rendering…":ue==="saved"?Ne="Banner saved":ue==="error"?Ne="Banner error: "+(Z.message||"unknown"):ue==="skipped"&&(Ne="Banner skipped: "+(Z.reason||"")),Ca({stage:ue,label:Ne,ts:Date.now()}),ue==="saved"&&Z.sessionID&&Dw(Z.sessionID).then(Ge=>{Ge&&Array.isArray(Ge.banners)&&Ya(He=>({...He,[Z.sessionID]:Ge.banners}))}).catch(()=>{})}),pn.on("todo.updated",me=>{const Z=me.properties||me;!Z||!Z.sessionID||(Array.isArray(Z.todos)?la(ue=>({...ue,[Z.sessionID]:Z.todos})):pg(Z.sessionID).then(ue=>{ue&&Array.isArray(ue.todos)&&la(Ne=>({...Ne,[Z.sessionID]:ue.todos}))}).catch(()=>{}))}),pn.on("queue.updated",me=>{const Z=me.properties||me;if(!Z||!Z.sessionID)return;const ue=Array.isArray(Z.items)?Z.items:[];_n(Ne=>gZ(Ne,Z.sessionID,ue)),Z.change&&Z.change.kind==="drain"&&Z.sessionID===Pt.current&&Rt.current&&(Rt.current.resetAutoScroll(),ve())}),pn.on("idle-injection.enabled",me=>{const Z=me.properties||me;!Z||Z.sessionID!==de||(ml(!0),xs(e("chat.idle_injection_enabled_toast"),"success"))}),pn.on("idle-injection.disabled",me=>{const Z=me.properties||me;!Z||Z.sessionID!==de||(ml(!1),xs(e("chat.idle_injection_disabled_toast"),"info"))}),pn.on("idle-injection.fired",me=>{const Z=me.properties||me;!Z||Z.sessionID!==de||xs(e("chat.idle_injection_fired_toast"),"success")}),pn.on("idle-injection.timeout",me=>{const Z=me.properties||me;!Z||Z.sessionID!==de||xs(e("chat.idle_injection_timeout_toast"),"warning")}),pn.on("image.validation.warnings",me=>pd(me,de)),pn.on("file.validation.warnings",me=>pd(me,de)),pn.on("scheduled-injection.fired",me=>{const Z=me.properties||me;!Z||Z.sessionID!==de||xs(e("scheduled_injection.fired_toast"),"success")}),pn.on("scheduled-injection.added",()=>{}),pn.on("scheduled-injection.removed",()=>{}),pn.on("prefill.fallback",me=>{const Z=me.properties||me;!Z||Z.sessionID!==de||(qt({originalModel:Z.originalModel,fallbackModel:Z.fallbackModel,reason:Z.reason||"prefill_too_large"}),Qt.current&&clearTimeout(Qt.current),Qt.current=setTimeout(()=>{qt(null),Qt.current=null},15e3))}),pn.on("auth.device_code",me=>{const Z=me.properties||me;Z.user_code&&Z.verification_uri&&ot({verification_uri:Z.verification_uri,user_code:Z.user_code,expires_in:Z.expires_in||300})})];return()=>{clearTimeout(we),oa.current!=null&&(clearTimeout(oa.current),oa.current=null),Ue(),Ni.current=null,ms.current&&clearTimeout(ms.current),Qt.current&&(clearTimeout(Qt.current),Qt.current=null),qt(null),cr.forEach(me=>me()),pn.disconnect()}},[ie]),y.useEffect(()=>{if(!ie)return;const O=setTimeout(()=>{var Q;(Q=H.current)==null||Q.focus()},50);return()=>{clearTimeout(O)}},[ie]);function Ks(O){Xe(Q=>{for(var ne=0;ne<Q.length;ne++)if(Q[ne].id===O.id)return Q.map(ce=>ce.id===O.id?O:ce);return[O,...Q]})}const _s=y.useCallback(async()=>{try{const O=await Cw();Ks(O),Pt.current=O.id,Ct(O.id),oA(O.id)}catch(O){yt("Failed to create session: "+O.message)}},[]);Y.current=_s;const Tr=y.useCallback(async O=>{var Q;if(O!==Pt.current){Pt.current=O,Ct(O),oA(O),yt(null),Me(null),$i(!!Dr.current[O]),ii(null);try{const ne=await dg(O);if(Pt.current!==O)return;((Q=ne==null?void 0:ne.status)==null?void 0:Q.type)==="busy"&&$i(!0),Xe(ce=>{var Ue;if(!ne)return ce;const de=ce.findIndex(Un=>Un.id===O),Ae=((Ue=ne.time)==null?void 0:Ue.updated)||0;if(de>=0){const Un=ce[de],In=ce.filter(Z=>Z.id!==O),cr={...ne,ui:{...ne.ui,...Un.ui}},me=In.findIndex(Z=>{var ue;return(((ue=Z.time)==null?void 0:ue.updated)||0)<=Ae});return In.splice(me<0?In.length:me,0,cr),In}const we=ce.findIndex(Un=>{var In;return(((In=Un.time)==null?void 0:In.updated)||0)<=Ae}),xt=[...ce];return xt.splice(we<0?xt.length:we,0,ne),xt}),xe(ce=>{if(ne&&ne.model)return{...ce,[O]:ne.model};if(ce[O]){const de={...ce};return delete de[O],de}return ce})}catch(ne){console.error("Failed to fetch session status for session",O,ne)}}},[]),Ys=y.useCallback(async O=>{try{await cO(O),BL(O),Xe(Q=>Q.filter(ne=>ne.id!==O)),ie===O&&(Pt.current=null,Ct(null))}catch(Q){yt("Failed to delete: "+Q.message)}},[ie]),_d=y.useCallback(async()=>{try{await dO(),await Ri(),await Ra(),Pt.current=null,Ct(O=>O&&null)}catch(O){yt("Failed to delete sessions: "+O.message)}},[Ri]),sh=y.useCallback(async(O,Q)=>{try{await yi(O,{title:Q}),Xe(ne=>ne.map(ce=>ce.id===O?{...ce,title:Q}:ce))}catch(ne){yt("Failed to rename: "+ne.message)}},[]),oh=y.useCallback(async O=>{try{const Q=await sO(O);Q&&Q.title&&Xe(ne=>ne.map(ce=>ce.id===O?{...ce,title:Q.title}:ce))}catch(Q){yt("Failed to regenerate title: "+Q.message)}},[]),[Ac,Lo]=y.useState(null),Nl=y.useCallback(O=>{Lo(O)},[]),fa=!$t||$t.pushEnabled!==!1,Ic=y.useCallback(async()=>{const O=ie;if(!O)return;const Q=!fa;Xe(ne=>ne.map(ce=>ce.id===O?{...ce,pushEnabled:Q}:ce));try{await yi(O,{pushEnabled:Q})}catch(ne){Xe(ce=>ce.map(de=>de.id===O?{...de,pushEnabled:fa}:de)),yt("Failed to update push setting: "+ne.message)}},[ie,fa]),Mc=y.useCallback(async(O,Q)=>{try{await yi(O,{pinned:Q}),Xe(ne=>ne.map(ce=>ce.id===O?{...ce,pinned:Q}:ce))}catch(ne){yt("Failed to pin: "+ne.message)}},[]),Lc=y.useCallback(async O=>{const Q=Re.find(ce=>ce.id===O);if(!Q||!Q.parentSessionID)return;const ne=Q.parentSessionID;try{await hO(O),Xe(ce=>ce.map(de=>de.id===O?{...de,compactionPinned:!1}:de)),Pt.current=ne,Ct(ne)}catch(ce){yt("Failed to unpin: "+ce.message)}},[Re]),lh=y.useCallback(async(O,Q)=>{try{await yi(O,{archived:Q}),!Ut.current&&Q?(Xe(ne=>ne.filter(ce=>ce.id!==O)),ie===O&&(Pt.current=null,Ct(null))):Xe(ne=>ne.map(ce=>ce.id===O?{...ce,archived:Q}:ce))}catch(ne){yt("Failed to archive: "+ne.message)}},[ie]),wd=y.useCallback(async({readOnly:O=!1}={})=>{if(!ie)return;let Q,ne,ce;if(Xe(de=>{var we;const Ae=de.find(xt=>xt.id===ie);return Q=((we=Ae==null?void 0:Ae.ui)==null?void 0:we.hideThinking)??!1,ne=!Q,ce=Ae==null?void 0:Ae.ui,de.map(xt=>xt.id===ie?{...xt,ui:{...xt.ui,hideThinking:ne}}:xt)}),!O)try{await yi(ie,{ui:{...ce,hideThinking:ne}})}catch(de){console.error("Failed to persist hideThinking:",de),Xe(Ae=>Ae.map(we=>we.id===ie?{...we,ui:{...we.ui,hideThinking:Q}}:we)),yt("Failed to save thinking visibility preference"+(de!=null&&de.message?": "+de.message:""))}},[ie]),ch=y.useCallback(async()=>{if(!ie)return;let O,Q;Xe(ne=>{var de;const ce=ne.find(Ae=>Ae.id===ie);return O=((de=ce==null?void 0:ce.ui)==null?void 0:de.chatInput)==="hidden",Q=ce==null?void 0:ce.ui,ne.map(Ae=>Ae.id===ie?{...Ae,ui:{...Ae.ui,chatInput:O?void 0:"hidden"}}:Ae)});try{const ne={...Q};O?delete ne.chatInput:ne.chatInput="hidden",await yi(ie,{ui:ne})}catch(ne){console.error("Failed to persist chatInput:",ne),Xe(ce=>ce.map(de=>de.id===ie?{...de,ui:{...de.ui,chatInput:O?"hidden":void 0}}:de)),yt("Failed to save chat input visibility"+(ne!=null&&ne.message?": "+ne.message:""))}},[ie]),Sd=y.useCallback(async O=>{try{await p3(O)}catch(Q){yt("Export failed: "+Q.message)}},[]),Qs=y.useCallback(async(O,Q)=>{const ne=Ue=>{gl({yaml:O,directory:Ue.body.directory,defaultDirectory:Ue.body.defaultDirectory})},ce=Ue=>{gl(Un=>({yaml:O,error:Ue.body.error,directory:Ue.body.directory,defaultDirectory:Ue.body.defaultDirectory||Un&&Un.defaultDirectory}))},de=Ue=>{yt("Import failed: "+(Ue.body&&Ue.body.error||Ue.message))},Ae=Ue=>Ue&&Ue.status===409&&Ue.body&&Ue.body.code==="SESSION_DIRECTORY_MISSING",we=Ue=>Ue&&Ue.status===400&&Ue.body&&Ue.body.code==="SESSION_DIRECTORY_INVALID",xt=Ue=>{Ae(Ue)?ne(Ue):we(Ue)?ce(Ue):Ue&&Ue.status===403?de(Ue):yt("Import failed: "+Ue.message)};try{const Ue=await h3(O,Q);Ue&&Ue.id&&(gl(null),await Ri(),Tr(Ue.id))}catch(Ue){xt(Ue)}},[Ri,Tr]),Aa=y.useRef(null);y.useEffect(()=>{const O=aA();Aa.current=O,O.kind==="invalid"&&(Me(sA()),Nk())},[]),y.useEffect(()=>{function O(){const Q=aA();if(Q.kind==="invalid"){Me(sA()),Nk();return}Q.kind==="session"&&Q.sessionId!==Pt.current&&Tr(Q.sessionId)}return window.addEventListener("popstate",O),function(){window.removeEventListener("popstate",O)}},[Tr]);const Oc=y.useRef(!1);y.useEffect(()=>{if(Oc.current||!Gi||Re.length===0)return;Oc.current=!0;var O=null,Q=!1,ne=null;try{var ce=new URLSearchParams(window.location.search),de=wZ({pathId:(Aa.current||{}).sessionId,queryId:ce.get("session"),storedId:$()});O=de.sessionId,ne=de.source,Q=CM(ne)}catch{O=$(),ne="storage"}if(!O)return;if(Re.some(function(we){return we.id===O})){Tr(O);return}const Ae=function(we){TZ({sessionId:O,source:ne,error:we,storedId:$(),sessions:Re,selectSession:Tr,setRefusal:Me})};dg(O).then(function(we){if(we&&we.id){Tr(O);return}Q||V(),Ae(null)}).catch(function(we){Q||V(),Ae(we)})},[Gi,Re,Tr]),y.useEffect(()=>{function O(Q){var ne=Q.data;!ne||ne.type!=="navigate-session"||ne.sessionId&&Tr(ne.sessionId)}return window.addEventListener("message",O),function(){window.removeEventListener("message",O)}},[Tr]),y.useEffect(()=>{function O(){try{var ne=indexedDB.open("pave-sw",1);ne.onupgradeneeded=function(){ne.result.createObjectStore("pave-pending-nav")},ne.onsuccess=function(){var ce=ne.result;if(!ce.objectStoreNames.contains("pave-pending-nav")){ce.close();return}var de=ce.transaction("pave-pending-nav","readwrite"),Ae=de.objectStore("pave-pending-nav"),we=Ae.get("sessionId");we.onsuccess=function(){var xt=we.result;Ae.delete("sessionId"),xt&&xt!==Pt.current&&Tr(xt)},de.oncomplete=function(){ce.close()},de.onerror=function(){ce.close()}},ne.onerror=function(){}}catch{}}function Q(){document.visibilityState==="visible"&&(O(),setTimeout(O,500),setTimeout(O,1500))}return document.addEventListener("visibilitychange",Q),function(){document.removeEventListener("visibilitychange",Q)}},[Tr]);const Xs=y.useCallback(async O=>{if(!ie)return;const Q=Ke.current,ne=(Q[ie]||0)+1;Q[ie]=ne;const ce=De.current[ie];xe(de=>{const Ae={...de};return O?Ae[ie]=O:delete Ae[ie],De.current=Ae,Ae});try{const de=await yi(ie,{model:O||null});if(Q[ie]!==ne)return;de&&(typeof de.model=="string"&&de.model||de.model&&typeof de.model=="object"&&de.model.providerID&&de.model.modelID)?xe(Ae=>{const we={...Ae,[ie]:de.model};return De.current=we,we}):O||xe(Ae=>{const we={...Ae};return delete we[ie],De.current=we,we})}catch(de){if(Q[ie]!==ne)return;xe(Ae=>{const we={...Ae};return ce!==void 0?we[ie]=ce:delete we[ie],De.current=we,we}),console.error("[ModelChange] PATCH failed for session",ie,de),yt("Failed to update session model: "+de.message)}},[ie]),pa=y.useCallback(async function(O,Q){if(ie){var ne=$t&&$t.disabledSkills||[],ce;Q?ce=ne.filter(function(de){return de!==O}):ce=ne.concat([O]),Xe(function(de){return de.map(function(Ae){return Ae.id===ie?{...Ae,disabledSkills:ce}:Ae})});try{await yi(ie,{disabledSkills:ce})}catch(de){Xe(function(Ae){return Ae.map(function(we){return we.id===ie?{...we,disabledSkills:ne}:we})}),console.error("[SkillToggle] PATCH failed:",de)}}},[ie,$t]),Oo=y.useCallback(async function(){if(ie)try{var O=await CA(),Q=O.skillDefaults||{},ne=await Rk(),ce=[];(ne||[]).forEach(function(de){Q[de.name]||ce.push(de.name)}),Xe(function(de){return de.map(function(Ae){return Ae.id===ie?{...Ae,disabledSkills:ce}:Ae})}),await yi(ie,{disabledSkills:ce})}catch(de){console.error("[SkillToggle] Reset to defaults failed:",de)}},[ie]),Ia=y.useCallback(O=>{Xe(Q=>Q.map(ne=>ne.id===ie?{...ne,directory:O}:ne)),gc(!1)},[ie]),ws=y.useRef(null),uh=y.useCallback(O=>{const Q=typeof O=="string"?O:"";Wi(Q),Cr.current=Q,ws.current&&clearTimeout(ws.current),ws.current=setTimeout(()=>{tt.current=0,Sl.current=wl,Ri({q:Q}),Ra(),El()},250)},[]);y.useEffect(()=>()=>{ws.current&&clearTimeout(ws.current)},[]);const dh=y.useCallback(async()=>{const O=!Ut.current;Ut.current=O,await Ri({includeArchived:O})?(mt(O),await Promise.all([El(),Ra()])):Ut.current=!O},[El,Ra]),Ki=y.useCallback(async(O,Q,ne,ce,de,Ae,we)=>{const xt=O===Pt.current;Ae&&xt&&dn(Fr=>Fr.filter(Qi=>Qi.info.id!==Ae));var Ue=(ne?ne.length:0)+(we?we.length:0);if(Ue>Qo)throw yt("Too many attachments. Maximum "+Qo+" per message."),new Error("Too many attachments");var Un=tH(Q,(we||[]).map(function(Fr){return Fr.name}));if(Un>pS)throw yt("Message too large: "+Un+" bytes exceeds the "+pS+"-byte input limit. Shorten the message or remove attachments."),new Error("Input too large");if(ne&&ne.length>0)for(var In=0;In<ne.length;In++){var cr=(ne[In].file.type||"").toLowerCase();if(Ep.indexOf(cr)===-1)throw yt('Unsupported image type: "'+ne[In].name+'". Only PNG, JPEG, GIF, and WebP are supported.'),new Error("Unsupported image type");if(ne[In].file.size>dS){var me=Math.round(ne[In].file.size/1024/1024*10)/10,Z=Math.round(dS/1024/1024*10)/10;throw yt('Image "'+ne[In].name+'" ('+me+"MB) exceeds the "+Z+"MB size limit."),new Error("Image too large")}}if(we&&we.length>0)for(var ue=0;ue<we.length;ue++){var Ne=(we[ue].file.type||"").toLowerCase();if(X5.indexOf(Ne)===-1)throw yt('Unsupported file type: "'+we[ue].name+'" ('+(Ne||"unknown")+")."),new Error("Unsupported file type");if(we[ue].file.size>fS){var Ge=Math.round(we[ue].file.size/1024/1024*10)/10,He=Math.round(fS/1024/1024*10)/10;throw yt('File "'+we[ue].name+'" ('+Ge+"MB) exceeds the "+He+"MB size limit."),new Error("File too large")}}var it=[],Vt=[],zt=we?we.length:0,fn=(we||[]).concat(ne||[]);if(fn.length>0)try{for(var qn=0;qn<fn.length;qn++){var Hn=fn[qn],hr=qn>=zt,Pr=await U3(Hn.file,hr?Hn.file.type:void 0),eo={type:"file",mime:Hn.file.type,filename:Hn.name,path:Pr.path};hr?Vt.push(eo):it.push(eo)}}catch(Fr){throw yt("Failed to upload file: "+Fr.message),Fr}const Ii="temp-"+Date.now();for(var Pc=[{id:Ii+"-text",type:"text",text:de}],Tl=it.concat(Vt),ga=0;ga<Tl.length;ga++)Pc.push({id:Ii+"-file-"+ga,type:"file",mime:Tl[ga].mime,filename:Tl[ga].filename});const Td={info:{id:Ii,sessionID:O,role:"user",time:{created:Date.now(),updated:Date.now()}},parts:Pc};dn(Fr=>xt?[...Fr,Td]:Fr),xt&&Rt.current&&(Rt.current.resetAutoScroll(),ve()),xn(O,!0),se.current.set(O,{text:de,tempId:Ii});const Po=xc.current[O]??null,Fo=gs.current[O]??"max",es=Po===null&&!Ao.current.has(O),Rl=bc.current[O],Al=es&&Rl?Rl.moe_topk||null:Po;try{var Il=null;(Vt.length>0||it.length>0)&&(Il=it.concat(Vt)),await Tw(O,Q,Il,De.current[O]||void 0,ce,{moeTopK:Al,reasoningEffort:Fo,adaptiveQuality:es})}catch(Fr){if(mZ(Fr))if(iA(Vt,it)){const gr=Ii;Zr.current[O]||(Zr.current[O]=[]),Zr.current[O].push({content:Q,imageAttachments:ne,fileAttachments:we,agent:ce,displayContent:de,queuedTempId:gr}),Za(O),xn(O,!1);return}else try{await Rw(O,Q,{displayContent:de,agent:ce||void 0,model:De.current[O]||void 0,moeTopK:Al,reasoningEffort:Fo,adaptiveQuality:es}),dn(gr=>gr.filter(La=>La.info.id!==Ii)),xn(O,!1);return}catch(gr){throw yt("Failed to queue message: "+gr.message),xn(O,!1),dn(La=>La.filter(Fc=>Fc.info.id!==Ii)),gr}if(Fr&&Fr.reauthRequired){yt("Session expired. Please log in again."),ht(null),xn(O,!1),dn(Qi=>Qi.filter(gr=>gr.info.id!==Ii));return}throw yt("Failed to send: "+Fr.message),xn(O,!1),dn(Qi=>Qi.filter(gr=>gr.info.id!==Ii)),Fr}},[Za,ve]),Ss=y.useRef(Ki);y.useEffect(()=>{Ss.current=Ki},[Ki]);const oi=y.useCallback(async(O,Q,ne,ce)=>{yt(null),Et.length>0&&(O=mq(Et,O));const de=O,Ae=O.match(/^\/([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)(?:\s+(.*))?$/s);if(Ae){const cr=Ae[1],me=Ae[2],Z=Ae[3]||"",ue=Z||cr+" "+me,Ne=(cr+"_"+me).replace(/-/g,"_").slice(0,128);O="[SKILL_HINT: User explicitly requested "+cr+"."+me+(Z?" with args: "+Z:"")+". Call the "+Ne+` tool with these parameters.]
|
|
131
|
+
|
|
132
|
+
`+ue}let we=Pt.current;if(!we)try{const cr=await Cw();Ks(cr),Pt.current=cr.id,Ct(cr.id),we=cr.id,await new Promise(me=>setTimeout(me,200))}catch(cr){throw yt("Failed to create session: "+cr.message),cr}if(!!Or[we]){if(!iA(Q,ce)){try{await Rw(we,O,{displayContent:de,agent:ne||void 0,model:De.current[we]||void 0})}catch(Ne){yt("Failed to queue message: "+Ne.message)}return}const me="queued-"+Date.now()+"-"+Math.random().toString(36).slice(2,7),Z=[{id:me+"-text",type:"text",text:de}];if(Q&&Q.length>0)for(var Ue=0;Ue<Q.length;Ue++){var Un=Q[Ue].preview||"";Z.push({id:me+"-img-"+Ue,type:"image_url",image_url:{url:Un}})}if(ce&&ce.length>0)for(var In=0;In<ce.length;In++)Z.push({id:me+"-file-"+In,type:"file",mime:ce[In].file.type,filename:ce[In].name});const ue={info:{id:me,sessionID:we,role:"user",time:{created:Date.now(),updated:Date.now()},_queued:!0},parts:Z};dn(Ne=>[...Ne,ue]),we===Pt.current&&Rt.current&&(Rt.current.resetAutoScroll(),ve()),Zr.current[we]||(Zr.current[we]=[]),Zr.current[we].push({content:O,imageAttachments:Q,agent:ne,displayContent:de,queuedTempId:me,fileAttachments:ce}),Za(we),kn([]);return}await Ki(we,O,Q,ne,de,null,ce),kn([])},[Or,Ki,Za,ve,Et]);y.useEffect(()=>{const O=()=>{oi(e("planCard.executePrompt"),void 0,"build")};return window.addEventListener("pave:plan-execute",O),()=>window.removeEventListener("pave:plan-execute",O)},[oi,e]);const Cl=y.useCallback(async()=>{if(ie)try{const O=ie;Xa.current.add(O),await gO(O),xn(O,!1),Qa(null)}catch(O){console.error("Abort failed:",O),yt("Failed to stop: "+(O&&O.message?O.message:String(O)))}},[ie,xn]),Dc=y.useCallback(async(O,Q,ne)=>{if(yt(null),O==="btw"){const ce=Pt.current;if(!ce){yt("No active session to fork.");return}let de;try{de=await lO(ce)}catch(we){throw yt("Fork failed: "+(we&&we.message?we.message:String(we))),we}if(!de||!de.id)throw yt("Fork failed: server returned no session id."),new Error("Fork returned no session");Ks(de),Pt.current=de.id,Ct(de.id),await new Promise(we=>setTimeout(we,200));const Ae=(Q||"").trim();if(Ae)try{await oi(Ae,ne&&ne.imageAttachments?ne.imageAttachments:void 0,void 0,ne&&ne.fileAttachments?ne.fileAttachments:void 0)}catch{}return}if(O==="compact"){const ce=Pt.current;if(!ce){yt("No active session to compact.");return}yt(null),ii({reason:"manual",stage:"starting"}),Wr(null),pO(ce).then(de=>{if(!de||!de.success){ii(null),yt("Compaction failed: "+(de&&de.error||"unknown error"));return}si(ce),ii(null),Wr(null)}).catch(de=>{ii(null),de&&de.status===409?yt("Cannot compact while the session is busy. Wait for the current response to finish."):yt("Compaction failed: "+(de&&de.message?de.message:String(de)))});return}yt("Unknown built-in command: /"+O)},[oi]),Zs=y.useCallback(O=>{le(Q=>Q.filter(ne=>ne.id!==O))},[]),Ja=y.useCallback(async()=>{for(var O=Cn.length-1;O>=0;O--)if(Cn[O].info.role==="user"){var Q=Cn[O].parts||[],ne=f1(Q,null),ce=Q.filter(function(Ue){return Ue.type==="image_url"&&Ue.image_url}),de=Q.filter(function(Ue){return Ue.type==="file"&&Ue.path&&Ff(Ue.mime)}),Ae=de.map(function(Ue){return{type:"file",mime:Ue.mime,filename:Ue.filename,path:Ue.path}});if(ne.trim()||ce.length>0||Ae.length>0)if(ce.length>0||Ae.length>0){var we=ie;if(!we)break;xn(we,!0),yt(null);try{var xt=Ae.concat(ce.map(function(Ue){return{type:"image_url",image_url:Ue.image_url}}));await Tw(we,ne.trim(),xt,De.current[we]||void 0)}catch(Ue){yt("Failed to retry: "+Ue.message),xn(we,!1)}}else try{await oi(ne.trim())}catch(Ue){yt("Failed to retry: "+Ue.message),xn(ie,!1)}break}},[Cn,oi,ie]),Qn=y.useCallback(async function(O){if(O&&O.trim()){yt(null),Rt.current&&Rt.current.resetAutoScroll();try{await oi(O.trim()),ve()}catch(Q){yt("Failed to resend: "+Q.message),xn(ie,!1)}}},[oi,ve]),Sn=y.useMemo(()=>$t?$t.source==="archive"||$t._readOnly===!0:!1,[$t]),Ai=y.useMemo(()=>$t?$t._readOnly===!0&&$t.source!=="tui"&&$t.source!=="archive":!1,[$t]),Rr=y.useMemo(()=>{if(!Ai||!$t||!Re)return null;for(const O of Re)if(O.parentSessionID===$t.id)return O.id;return null},[Ai,$t,Re]),li=y.useMemo(()=>{var ne;let O=null;for(let ce=Cn.length-1;ce>=0;ce--)if(((ne=Cn[ce].info)==null?void 0:ne.role)==="assistant"){O=Cn[ce];break}if(!O)return[];const Q=(O.parts||[]).filter(ce=>ce.type==="tool");return Q.length===0?[]:!Si&&Q.every(de=>{var Ae,we;return((Ae=de.state)==null?void 0:Ae.status)==="completed"||((we=de.state)==null?void 0:we.status)==="error"})?[]:Q},[Cn,Si]),Es=y.useMemo(()=>{var Q;const O=[];for(const ne of Cn)if(((Q=ne.info)==null?void 0:Q.role)==="assistant"){const ce=(ne.parts||[]).filter(de=>de.type==="tool");O.push(...ce)}return O},[Cn]),Yi=y.useRef(0),[ci,Js]=y.useState(!1),Ed=y.useCallback(O=>{if(O.preventDefault(),O.stopPropagation(),Yi.current++,Yi.current===1){const Q=O.dataTransfer;let ne=!1;Q&&Q.items&&Q.items.length>0&&(ne=Array.from(Q.items).some(ce=>ce.kind==="file")),ne&&Js(!0)}},[]),Nd=y.useCallback(O=>{O.preventDefault(),O.stopPropagation(),Yi.current=Math.max(0,Yi.current-1),Yi.current===0&&Js(!1)},[]),jl=y.useCallback(O=>{O.preventDefault(),O.stopPropagation()},[]),Cd=y.useCallback(O=>{O.preventDefault(),O.stopPropagation(),Yi.current=0,Js(!1);const Q=O.dataTransfer&&O.dataTransfer.files;if(!Q||Q.length===0)return;const ne=Q[0],ce=ne.name.toLowerCase();if(!ce.endsWith(".yaml")&&!ce.endsWith(".yml")){yt(e("import.invalid_file_type"));return}const de=10*1024*1024;if(ne.size>de){yt(e("import.file_too_large"));return}const Ae=new FileReader;Ae.onload=we=>{const xt=we&&we.target?we.target.result:null;if(typeof xt!="string"){yt(e("import.read_error"));return}Qs(xt)},Ae.onerror=()=>{yt(e("import.read_error"))},Ae.readAsText(ne)},[Qs,yt,e]);if(_e)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-950",children:a.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})});if(!ct)return a.jsx(PH,{darkMode:t,onToggleTheme:()=>n(!t)});const ha=$t==null?void 0:$t.title,Ns=typeof ha=="string"?ha.trim():"",Cs=((jd=$t==null?void 0:$t.ui)==null?void 0:jd.hideThinking)??!1,Do=((Ma=$t==null?void 0:$t.ui)==null?void 0:Ma.chatInput)==="hidden";return a.jsxs("div",{className:"h-[100dvh] sm:h-screen flex flex-col",onDragEnter:Ed,onDragLeave:Nd,onDragOver:jl,onDrop:Cd,children:[ci&&a.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:a.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-2xl px-8 py-6 shadow-xl",children:a.jsx("p",{className:"text-lg font-semibold text-primary-600 dark:text-primary-400",children:e("sidebar.drop_to_import")})})}),a.jsx(fZ,{}),a.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:[a.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[a.jsx("button",{type:"button",onClick:()=>Ee(O=>!O),className:"md:hidden 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:e(X?"sidebar.hide":"sidebar.show"),"aria-label":e(X?"sidebar.hide":"sidebar.show"),"aria-expanded":X,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("img",{src:ar(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-8"}),a.jsx("h1",{className:"sr-only",children:"PAVE"}),pt&&a.jsxs("span",{className:"hidden sm:inline text-xs text-gray-400 dark:text-gray-500 select-none",title:e("app.version"),children:["v",pt]})]}),ze==="chat"&&ie&&a.jsx("span",{className:"sm:hidden min-w-0 truncate text-sm font-medium text-gray-600 dark:text-gray-300",title:$t&&$t.title||e("sidebar.untitled"),children:$t&&$t.title||e("sidebar.untitled")}),a.jsxs("nav",{className:"hidden sm:flex items-center gap-1 ml-4",children:[a.jsx("button",{onClick:()=>Be("chat"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ze==="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")}),a.jsx("button",{onClick:()=>Be("skills"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ze==="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")}),a.jsx("button",{onClick:()=>Be("settings"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ze==="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")}),bl&&a.jsx("button",{"data-testid":"nav-triggers-tab",onClick:()=>Be("triggers"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${ze==="triggers"?"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.triggers_tab")})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[ie&&ze==="chat"&&a.jsx("button",{"data-testid":"push-toggle",onClick:Ic,className:`p-1.5 rounded-lg transition-colors ${fa?"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:fa?"Push is on for this session — click to mute":"Push is muted for this session — click to enable","aria-label":fa?"Mute push notifications for this session":"Enable push notifications for this session","aria-pressed":fa,children:a.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0 1 18 14.158V11a6.002 6.002 0 0 0-4-5.659V5a2 2 0 1 0-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"}),!fa&&a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4l16 16"})]})}),gn&&a.jsx("button",{onClick:()=>ut(O=>!O),className:`p-1.5 rounded-lg transition-colors ${Kt?"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":Kt,children:a.jsx("span",{className:"text-sm leading-none",children:"🦋"})}),ie&&ze==="chat"&&a.jsx("button",{onClick:Hi,className:`hidden lg:block p-1.5 rounded-lg transition-colors ${qi?"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:oe?"Cmd+J":"Ctrl+J"}),"aria-label":e("app.toggle_right_pane",{shortcut:oe?"Cmd+J":"Ctrl+J"}),"aria-pressed":qi,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx(_L,{darkMode:t,onToggle:()=>n(!t)}),ct&&a.jsx(FH,{user:ct,onLogout:ft,onSkillManagement:()=>Be("skills"),onPricingSettings:()=>lt(!0),onDlpSettings:()=>_t(!0),onSettings:()=>Be("settings"),onBoard:ys?()=>Be("board"):void 0,onCapabilities:Hs?()=>Be("capabilities"):void 0})]})]}),ze==="skills"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(uY,{onBack:()=>Be("chat")})}):ze==="board"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(mY,{onBack:()=>Be("chat")})}):ze==="capabilities"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(jY,{onBack:()=>Be("chat")})}):ze==="triggers"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(PY,{onBack:()=>Be("chat")})}):ze==="settings"?a.jsx("main",{className:"flex-1 overflow-hidden min-h-0",children:a.jsx(OQ,{onBack:()=>Be("chat"),onOpenDlpSettings:()=>_t(!0),onOpenPricingSettings:()=>lt(!0),activeSessionId:ie,mobileFrameless:M,onMobileFramelessChange:I})}):a.jsxs("main",{className:"flex-1 flex overflow-hidden min-w-0",children:[a.jsx(PL,{sessions:ah,activeSessionId:ie,busySessions:Or,onSelectSession:O=>{Tr(O),window.innerWidth<768&&Ee(!1)},onNewChat:_s,onDeleteSession:Ys,onDeleteAllSessions:_d,onRenameSession:sh,onRegenerateTitle:oh,onPinSession:Mc,onArchiveSession:lh,onExportSession:Sd,onSendToSession:Nl,onImportSession:Qs,onImportError:O=>yt(O),showArchived:Te,onToggleShowArchived:dh,isOpen:X,onClose:()=>Ee(!1),onToggle:()=>Ee(O=>!O),hasMoreSessions:U,onLoadMoreSessions:Rc,hasMoreOtherApps:vd,onLoadMoreOtherApps:Yn,otherAppsCount:Gs.length,search:Rn,onSearchChange:uh,loadedCount:Re.length,totalCount:It,sidebarWidth:A,onSidebarWidthChange:L}),a.jsx("div",{className:"flex-1 flex flex-col bg-white dark:bg-gray-950 min-w-0",children:ie?a.jsxs(a.Fragment,{children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(PK,{sessionModel:ee.has(ie)?"epm/privacy":kt[ie]||null,activeModel:gt,registryEntries:Yt,onModelChange:Xs,disabled:Si||ee.has(ie),lockedReason:ee.has(ie)?"Private mode active — model locked to epm/privacy. Click the lock to exit.":null},ie),Ns?a.jsx("span",{className:"hidden sm:inline text-sm text-gray-500 dark:text-gray-400 truncate min-w-0 max-w-[150px]",title:Ns,children:Ns}):null,a.jsx("button",{onClick:()=>gc(!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:Sn,children:a.jsx(bM,{className:"w-4 h-4"})}),a.jsx(zK,{sessionId:ie,disabledSkills:$t?$t.disabledSkills:[],onToggle:pa,onResetToDefaults:Oo,t:e,disabled:Sn}),a.jsx("button",{onClick:()=>ld(!0),className:`p-1.5 rounded-lg transition-colors ${Zp?"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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),Lt&&a.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(O=>{const Q=vc===null&&fd&&!Ao.current.has(ie)&&fd.moe_topk===O.val,ne=vc===O.val;return a.jsx("button",{onClick:()=>{O.val===null?Ao.current.delete(ie):Ao.current.add(ie),ud(ce=>({...ce,[ie]:O.val})),yi(ie,{moe_top_k:O.val}).catch(()=>{})},disabled:Sn,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${ne?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-xs":Q?"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:O.label},O.label)})}),a.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(O=>a.jsx("button",{onClick:()=>{xl(Q=>({...Q,[ie]:O.val})),yi(ie,{reasoning_effort:O.val}).catch(()=>{})},disabled:Sn,className:`px-1.5 py-0.5 text-[10px] font-medium rounded-md transition-colors ${qs===O.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:O.label},O.val))})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>wd({readOnly:Sn}),className:`p-1.5 rounded-lg transition-colors ${Cs?"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(Cs?"chat.show_thinking":"chat.hide_thinking"),"aria-label":e(Cs?"chat.show_thinking":"chat.hide_thinking"),"aria-pressed":!Cs,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{onClick:()=>ch(),className:`p-1.5 rounded-lg transition-colors ${Do?"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(Do?"chat.show_chat_input":"chat.hide_chat_input"),"aria-label":e(Do?"chat.show_chat_input":"chat.hide_chat_input"),"aria-pressed":!Do,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),yl&&a.jsx("button",{onClick:async()=>{if(ie)try{await v3(ie),yt("Banner generation queued (~2 min)"),setTimeout(()=>yt(null),4e3)}catch(O){yt(`Banner: ${O.message||O}`)}},disabled:!ie,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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),yl&&a.jsx("button",{onClick:ln,className:`p-1.5 rounded-lg transition-colors ${Nt?"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:Nt?"Show banner":"Hide banner","aria-label":Nt?"Show banner":"Hide banner","aria-pressed":!Nt,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Nt?a.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"}):a.jsxs(a.Fragment,{children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),a.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"})]})})}),Ci?a.jsx("span",{className:`hidden md:inline text-[11px] truncate max-w-[260px] px-2 py-0.5 rounded ${Ci.stage==="error"?"text-red-600 dark:text-red-400 bg-red-500/10":Ci.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:Ci.label,children:Ci.label}):null,a.jsx("button",{onClick:()=>Us(O=>!O),className:`p-1.5 rounded-lg transition-colors lg:hidden ${zs?"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":zs,"aria-haspopup":"dialog","aria-controls":"activities-panel-dialog",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{onClick:()=>Sd(ie),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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})})}),a.jsx("button",{onClick:()=>{ca(O=>!O),zn&&(pl(""),ua(0),hl(0))},className:`p-1.5 rounded-lg transition-colors ${zn?"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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})]}),zn&&a.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:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a.jsx("input",{type:"text",placeholder:e("app.search_placeholder"),value:fl,onChange:O=>{pl(O.target.value),ua(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"}),fl&&a.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 shrink-0 tabular-nums",children:Vi>0?e("app.match_count",{current:To+1,total:Vi}):e("app.no_matches")}),fl&&Vi>0&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>ua(O=>(O-1+Vi)%Vi),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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),a.jsx("button",{onClick:()=>ua(O=>(O+1)%Vi),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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:()=>{ca(!1),pl(""),ua(0),hl(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:a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),!ai&&a.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:[a.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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"})}),a.jsx("span",{children:e("app.reconnecting")})]}),mn&&a.jsxs("div",{role:"status","data-session-refusal":mn.code,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:[a.jsxs("span",{children:[mn.code==="forbidden"&&"You do not have access to this session.",mn.code==="not_found"&&"This session no longer exists.",mn.code==="malformed"&&"This link does not name a session."]}),a.jsx("button",{onClick:()=>Me(null),className:"ml-2 text-amber-500 hover:text-amber-700","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),fs&&a.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:[a.jsx("span",{children:fs}),a.jsx("button",{onClick:()=>yt(null),className:"ml-2 text-red-400 hover:text-red-600","aria-label":e("app.dismiss_error"),title:e("app.dismiss_error"),children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),Ro&&a.jsxs("div",{className:`px-4 py-2 text-sm border-b flex items-center gap-2 ${Ro.type==="warning"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 border-amber-200 dark:border-amber-800":Ro.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:[a.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),a.jsx("span",{children:Ro.text})]}),gi&&a.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:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold",children:e("auth.device_code_title")}),a.jsxs("div",{className:"mt-1",children:[a.jsx("a",{href:gi.verification_uri,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:gi.verification_uri})," ","— ",a.jsx("span",{className:"font-mono font-bold text-base select-all",children:gi.user_code})]}),a.jsx("div",{className:"mt-1 text-xs opacity-70",children:e("auth.device_code_waiting")})]}),a.jsx("button",{onClick:()=>ot(null),className:"ml-2 text-blue-400 hover:text-blue-600 shrink-0","aria-label":"Dismiss",title:"Dismiss",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),On&&a.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:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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 ",On.attempt,"/",On.maxRetries,On.maxDurationMs>0&&On.elapsedMs>0&&a.jsxs(a.Fragment,{children:[" (",Math.round(On.elapsedMs/1e3),"s / ",Math.round(On.maxDurationMs/6e4),"m)"]})," ","— next in ",Math.round(On.delayMs/1e3),"s. Click Stop to cancel."]}),a.jsx("button",{onClick:()=>{jn(null),or.current&&(clearTimeout(or.current),or.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),bt&&a.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:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.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: ",bt.fallbackModel," (local model unavailable)"]}),a.jsx("button",{onClick:()=>{qt(null),Qt.current&&(clearTimeout(Qt.current),Qt.current=null)},className:"ml-2 text-amber-400 hover:text-amber-600","aria-label":"Dismiss",title:"Dismiss",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsx(Vq,{ref:Rt,messages:Cn,unloadedCompactedCount:ri,onExpandCompactedHistory:ie?()=>ks(ie):void 0,hasOlderMessages:_r,loadingOlderMessages:_i,onLoadOlderMessages:ie?()=>kd(ie):void 0,streamingParts:Ea[ie]||{},streamingProgress:fc,isBusy:Si,compactingInfo:Zt,compactionResult:Xr,onSwitchToCompactedSession:O=>{Pt.current=O,Ct(O),Wr(null)},onDismissCompactionResult:()=>Wr(null),parentSessionID:$t&&$t.parentSessionID,compactionPinned:$t&&$t.compactionPinned,onUnpinCompaction:Lc,onViewParentSession:O=>{Pt.current=O,Ct(O),Xe(function(Q){return Q.map(function(ne){return ne.id===O?{...ne,_readOnly:!0}:ne})})},user:ct,searchQuery:fl,activeMatchIndex:To,onTotalMatchesChange:hl,onRetry:Sn?void 0:Ja,onEditAndResend:Sn?void 0:Qn,onCancelQueued:Sn?void 0:bd,hideToolBubbles:vn,mobileFrameless:M,hideThinking:Cs,sessionID:ie,banners:(yl?us[ie]:null)||[],bannerHidden:Nt,onToggleBanner:ln,privateMessageIds:P,questionIdMap:be,onQuoteAdd:Wn}),a.jsx(uX,{rect:dr&&dr.rect,label:e("chat.quote_selection"),copyLabel:e("chat.copy_selection"),onCopy:function(){Bs()},onQuote:function(){dr&&Wn(dr),wa()},onDismiss:wa}),(Sa[ie]||[]).length>0&&a.jsx(cX,{items:Sa[ie]||[],sessionId:ie,isReadOnly:Sn,onReorder:function(O){fO(ie,O).catch(function(Q){yt("Failed to reorder: "+Q.message)})},onCancelItem:function(O){Aw(ie,O).catch(function(Q){yt("Failed to cancel: "+Q.message)})},onEditItem:function(O){if(!(O.status==="dispatching"||Sn)){Aw(ie,O.id).catch(function(){});var Q=O.displayContent||O.text||"";Q&&H.current&&typeof H.current.setText=="function"&&H.current.setText(Q)}},t:e}),Sn?a.jsx(ES,{variant:Ai?"compacted":$t&&$t.source==="archive"?"archive":"terminal",label:Ai?e("chat.compacted_switch_to_new")||"Compacted — switch to new session":$t&&$t.source==="archive"?e("chat.viewing_archive"):e("chat.viewing_terminal"),childSessionId:Ai?Rr:null,onSwitchToChild:()=>{Pt.current=Rr,Ct(Rr)}}):((js=$t==null?void 0:$t.ui)==null?void 0:js.chatInput)==="hidden"?a.jsx(ES,{variant:"monitor",label:e("chat.monitor_only")}):a.jsx(EH,{ref:H,sessionId:ie,onSend:oi,onBuiltinCommand:Dc,onAbort:Cl,isBusy:Si,pendingQuotes:Et,onRemoveQuote:ki,onClearQuotes:kr,queuedCount:yd+(Sa[ie]||[]).length,planModeEnabled:wc})]}):a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[a.jsx("img",{src:ar(t?"/pave-logo-dark.png":"/pave-logo-light.png"),alt:"PAVE",className:"h-16 mb-4"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 mb-1",children:e("app.welcome_title")}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:e("app.welcome_start")}),a.jsx("button",{onClick:_s,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")})]})}),ie&&a.jsxs("aside",{ref:hc,style:{width:ia},className:`border-l hidden ${qi?"lg:flex":"lg:hidden"} flex-col relative bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-800`,children:[a.jsx(UX,{width:ia,min:lp,max:B1,edge:"left",onCommit:aa,getPaneEl:()=>hc.current,ariaLabel:e("app.resize_terminal"),className:"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"}),!zs&&bs()]}),zs&&ie&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-30 lg:hidden",onClick:()=>Us(!1)}),a.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:O=>{(O.key==="Escape"||O.key==="Esc")&&(O.stopPropagation(),Us(!1))},ref:pc,children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800 shrink-0",children:[a.jsx("h2",{id:"activities-panel-heading",className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:e("app.activities_panel")}),a.jsx("button",{onClick:()=>Us(!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:a.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),bs()]})]})]}),At&&a.jsx(FQ,{onClose:()=>lt(!1)}),on&&a.jsx(HQ,{onClose:()=>_t(!1)}),gn&&a.jsx(FX,{open:Kt,onClose:()=>ut(!1),activeSessionId:ie,activeSessionTitle:Ns}),a.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-3",children:a.jsx(KQ,{requests:Pe,onDismiss:Zs})}),a.jsx(QQ,{open:ps,onClose:()=>hs(!1),upgradeUrl:ji}),a.jsx(H3,{open:Ac!==null,onClose:()=>Lo(null),senderSessionID:Ac}),a.jsx(aX,{isOpen:Kp,onClose:()=>gc(!1),sessionId:ie,currentDirectory:($t==null?void 0:$t.directory)||"",homeDir:Yp,onDirectoryChange:Ia,session:$t}),a.jsx(sX,{isOpen:!!da,directory:da?da.directory:"",defaultDirectory:da?da.defaultDirectory:"",error:da?da.error:"",onChoice:O=>Qs(da.yaml,O),onClose:()=>gl(null)}),a.jsx(lX,{isOpen:Xp,onClose:()=>ld(!1),sessionId:ie}),a.jsx(JQ,{isOpen:G,onClose:()=>{K(!1),setTimeout(()=>{var O;return(O=H.current)==null?void 0:O.focus()},0)},onSelectSession:O=>{Tr(O)},onNewChat:()=>{typeof Y.current=="function"&&Y.current()},activeSessionId:ie,sessions:Re,busySessions:Or}),a.jsx("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Ye})]})}const AZ=kL();mL.createRoot(document.getElementById("root")).render(a.jsx(Tt.StrictMode,{children:a.jsx(vL,{initialLocale:AZ,children:a.jsx(EL,{children:a.jsx(RZ,{})})})}));export{uA as _,tc as g,pK as p};
|